@vigilbase/cli
Version:
Vigilbase CLI — security scanners, agent tools, and Vigilbase One from the terminal.
21 lines (20 loc) • 932 B
JavaScript
// GENERATED from packages/api-contract/src/core/pagination.ts by scripts/vendor-api-contract.mjs — do not edit
import { z } from 'zod';
/**
* Cursor pagination, promoted from OS (`@vigilbase-os/contracts` pageSchema and
* CursorParams), which now re-exports these.
*
* Query: `limit` (1–200, default 50) and an opaque `cursor`. Response:
* `{ items, nextCursor? }`; no `nextCursor` means the last page. Cursors are
* opaque to callers, and each product binds them to the tenant and filters.
*/
export const PAGE_LIMIT_DEFAULT = 50;
export const PAGE_LIMIT_MAX = 200;
export const CURSOR_MAX_LENGTH = 512;
export const CursorParams = z.object({
cursor: z.string().max(CURSOR_MAX_LENGTH).optional(),
limit: z.coerce.number().int().positive().max(PAGE_LIMIT_MAX).default(PAGE_LIMIT_DEFAULT),
});
export function pageSchema(item) {
return z.object({ items: z.array(item), nextCursor: z.string().optional() });
}