UNPKG

@vigilbase/cli

Version:

Vigilbase CLI — security scanners, agent tools, and Vigilbase One from the terminal.

83 lines (82 loc) • 3.33 kB
// GENERATED from packages/api-contract/src/one/v1/customers.ts by scripts/vendor-api-contract.mjs — do not edit import { z } from 'zod'; import { defineOperation } from '../../core/operation.js'; import { CustomerParams, Id, ListQuery, ONE_READ_AUTH, page, READ_ERRORS, Timestamp } from './shared.js'; export const CustomerServiceState = z.enum(['active', 'pending', 'inactive', 'error']); export const CustomerPartnerRef = z.object({ id: Id, name: z.string().nullable() }).meta({ id: 'CustomerPartnerRef' }); /** A customer as v1 lists it: identity, lifecycle, partner and its services. */ export const Customer = z .object({ id: Id, name: z.string(), domain: z.string().nullable(), industry: z.string().nullable(), lifecycleStatus: z.string().meta({ description: 'prospect, onboarding, active, churned, …' }), onboardingStatus: z.string(), accountOwnerName: z.string().nullable(), partner: CustomerPartnerRef.nullable(), services: z.array(z.object({ tool: z.string().meta({ description: 'Integration tool, e.g. cloudflare, ninja-one.' }), status: CustomerServiceState, })), createdAt: Timestamp.nullable(), updatedAt: Timestamp.nullable(), }) .meta({ id: 'Customer' }); /** One customer with its service counts. */ export const CustomerDetail = z .object({ id: Id, name: z.string(), domain: z.string().nullable(), industry: z.string().nullable(), lifecycleStatus: z.string(), onboardingStatus: z.string(), accountOwnerName: z.string().nullable(), partner: CustomerPartnerRef.nullable(), isPartner: z.boolean(), serviceCounts: z.object({ active: z.number().int(), total: z.number().int(), error: z.number().int() }), createdAt: Timestamp.nullable(), updatedAt: Timestamp.nullable(), }) .meta({ id: 'CustomerDetail' }); export const listCustomers = defineOperation({ id: 'one.customers.list', product: 'one', version: 'v1', method: 'GET', path: '/customers', summary: 'List customers', description: 'Customers the caller can see: every customer for Vigilbase staff, a partner’s own customers, otherwise the caller’s organisation. Newest first.', tags: ['customers'], stability: 'beta', audience: 'customer', auth: ONE_READ_AUTH, permissions: ['read:customers'], pagination: 'cursor', request: { query: ListQuery }, responses: { 200: page(Customer) }, errors: READ_ERRORS, legacy: [{ host: 'one', path: '/api/customers' }], expose: { mcp: 'code-mode', cli: 'customers list', llms: true }, }); export const getCustomer = defineOperation({ id: 'one.customers.get', product: 'one', version: 'v1', method: 'GET', path: '/customers/{customerId}', summary: 'Get a customer', description: 'One customer with its partner, account owner and service counts.', tags: ['customers'], stability: 'beta', audience: 'customer', auth: ONE_READ_AUTH, permissions: ['read:customers'], request: { params: CustomerParams }, responses: { 200: CustomerDetail }, errors: READ_ERRORS, legacy: [{ host: 'one', path: '/api/customers/{id}/summary' }], expose: { mcp: 'code-mode', cli: 'customers show', llms: true }, }); export const customerOperations = [listCustomers, getCustomer];