@lumibase/sdk 2.1.0 → 2.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,4 +1,23 @@
1
1
  type DefaultSchema = Record<string, Record<string, unknown>>;
2
+ /**
3
+ * Turn the output of `lumibase types` into a schema the client accepts.
4
+ *
5
+ * Typegen emits one `interface` per collection and a `LumibaseCollections`
6
+ * interface mapping names to them. Interfaces carry no implicit index
7
+ * signature, so `createLumiClient<LumibaseSchema>()` fails the
8
+ * `DefaultSchema` constraint. Mapping over the keys yields structurally
9
+ * identical anonymous object types, which do satisfy it:
10
+ *
11
+ * ```ts
12
+ * import type { LumibaseSchema } from './lumibase-types';
13
+ * const lumi = createLumiClient<SchemaOf<LumibaseSchema>>({ … });
14
+ * ```
15
+ */
16
+ type SchemaOf<T> = {
17
+ [Collection in keyof T & string]: {
18
+ [Field in keyof T[Collection]]: T[Collection][Field];
19
+ };
20
+ };
2
21
  type ID = string;
3
22
  type Locale = string;
4
23
  type Brand<TBrand extends string, TValue> = TValue & {
@@ -417,6 +436,24 @@ interface ListItemsParams {
417
436
  * for a cheaper list (e.g. infinite scroll) and omits `meta.total`.
418
437
  */
419
438
  meta?: 'total_count' | 'none';
439
+ /**
440
+ * Publication cohort (#688): `live` (published, inside its window),
441
+ * `preview` (draft + published) or `all`. Anonymous callers always get `live`.
442
+ */
443
+ publicationState?: PublicationState;
444
+ /** Only items edited since their last publish (#687). */
445
+ modifiedSincePublish?: boolean;
446
+ }
447
+ type PublicationState = 'live' | 'preview' | 'all';
448
+ /** Options for `items(name).duplicate()` — `POST /items/:collection/:id/duplicate` (#689). */
449
+ interface DuplicateItemOptions {
450
+ /** `reference` (default) copies m2m links; `deep` also copies o2m children; `none` copies the item alone. */
451
+ relations?: 'none' | 'reference' | 'deep';
452
+ /** `false` keeps only `locale` of translatable fields. Default `true`. */
453
+ translations?: boolean;
454
+ locale?: string;
455
+ /** Field values to set on the copy. */
456
+ overrides?: Record<string, unknown>;
420
457
  }
421
458
  /** Options for `items(name).export()` — `GET /items/:collection/export` (#727). */
422
459
  interface ExportItemsParams {
@@ -432,6 +469,23 @@ interface ExportItemsParams {
432
469
  sort?: string[];
433
470
  status?: string;
434
471
  }
472
+ /** Cast a JSON path filter compares under (`data.price::numeric`, #729). */
473
+ type JsonPathCast = 'numeric' | 'boolean' | 'timestamp' | 'text';
474
+ /**
475
+ * Expression index advice for a JSON path filter
476
+ * (`GET /api/v1/collections/:name/index-advice`, #729). Advice only — the
477
+ * server never runs the DDL; an operator reviews and applies it.
478
+ */
479
+ interface JsonPathIndexAdvice {
480
+ path: string;
481
+ cast: JsonPathCast;
482
+ indexName: string;
483
+ /** The SQL expression the filter builder emits for this path + cast. */
484
+ expression: string;
485
+ /** `CREATE INDEX CONCURRENTLY …`, or `null` when the cast cannot be indexed (timestamp). */
486
+ ddl: string | null;
487
+ notes: string[];
488
+ }
435
489
  type ImportJobStatus = 'queued' | 'running' | 'succeeded' | 'failed' | 'cancelled' | 'timed_out';
436
490
  /** A background import job (`/api/v1/imports`, #726). The uploaded file is never returned. */
437
491
  interface ImportJob {
@@ -503,11 +557,24 @@ interface ItemRow<TData extends Record<string, unknown> = Record<string, unknown
503
557
  status: string;
504
558
  data: TData;
505
559
  sort: number;
560
+ /**
561
+ * Optimistic-concurrency counter, also sent as the `ETag` of the detail
562
+ * response. Pass it back as `ifMatch` on `patch`/`replace` to make the write
563
+ * fail with 412 if someone else changed the item first. Absent on servers
564
+ * older than this field.
565
+ */
566
+ version?: number;
506
567
  /** Content scheduling window (Publish_Window); null when not scheduled. */
507
568
  publishAt?: string | null;
508
569
  unpublishAt?: string | null;
509
570
  /** Editorial workflow state; null when the workflow is not in use. */
510
571
  editorialState?: string | null;
572
+ /** First publish; set once, never moves (#687). */
573
+ firstPublishedAt?: string | null;
574
+ /** Most recent publish; kept on unpublish (#687). */
575
+ publishedAt?: string | null;
576
+ /** Data edited since the last publish (#687). */
577
+ hasUnpublishedChanges?: boolean;
511
578
  /** Tree collections (#749): parent item id (null = root) and materialised path `/root/…/self/`. */
512
579
  parentId?: string | null;
513
580
  path?: string | null;
@@ -932,6 +999,41 @@ interface ShareSecretResult extends ShareResource {
932
999
  token: string;
933
1000
  url: string;
934
1001
  }
1002
+ /** `POST /api/v1/preview/token` body (epic #667). Item (+ version) or release. */
1003
+ interface PreviewTokenMintInput {
1004
+ collection?: string;
1005
+ itemId?: string;
1006
+ versionKey?: string;
1007
+ releaseId?: string;
1008
+ locale?: string;
1009
+ ttlSeconds?: number;
1010
+ }
1011
+ /** A preview secret row (never includes the token hash). */
1012
+ interface PreviewTokenResource {
1013
+ id: string;
1014
+ siteId: string;
1015
+ collection: string | null;
1016
+ itemId: string | null;
1017
+ versionKey: string | null;
1018
+ releaseId: string | null;
1019
+ locale: string | null;
1020
+ createdBy: string;
1021
+ expiresAt: string;
1022
+ revokedAt: string | null;
1023
+ revokedBy: string | null;
1024
+ useCount: number;
1025
+ lastUsedAt: string | null;
1026
+ createdAt: string;
1027
+ }
1028
+ /** Mint result: the token (shown once) and the URL built from the collection's `meta.previewUrl`. */
1029
+ interface PreviewTokenSecretResult extends PreviewTokenResource {
1030
+ token: string;
1031
+ url: string | null;
1032
+ }
1033
+ interface PreviewSettingsResource {
1034
+ allowedOrigins: string[];
1035
+ ttlSeconds: number;
1036
+ }
935
1037
  interface PresetResource {
936
1038
  id: string;
937
1039
  siteId: string;
@@ -1325,7 +1427,76 @@ interface FileResource {
1325
1427
  folder: string | null;
1326
1428
  metadata: Record<string, unknown>;
1327
1429
  uploadedBy: string | null;
1430
+ /** Full SHA-256 (hex) of the current binary; null until known (#706). */
1431
+ contentHash?: string | null;
1432
+ /** Binary revision; bumped by every in-place replace (#703). */
1433
+ version?: number;
1434
+ /** Malware scan state (#707): `skipped` | `pending` | `clean` | `infected` | `error`. */
1435
+ scanStatus?: string;
1436
+ createdAt: string;
1437
+ updatedAt?: string;
1438
+ }
1439
+ /** A previous binary of a file, kept for undo after a replace (#703). */
1440
+ interface FileVersionResource {
1441
+ id: string;
1442
+ siteId: string;
1443
+ fileId: string;
1444
+ version: number;
1445
+ filenameDisk: string;
1446
+ filenameDownload: string;
1447
+ mime: string;
1448
+ filesize: number;
1449
+ width: number | null;
1450
+ height: number | null;
1451
+ contentHash: string | null;
1452
+ metadata: Record<string, unknown>;
1453
+ replacedBy: string | null;
1328
1454
  createdAt: string;
1455
+ expiresAt: string;
1456
+ }
1457
+ /** Where a file is used (#706). */
1458
+ type FileReferenceResource = {
1459
+ kind: "item";
1460
+ collection: string;
1461
+ id: string;
1462
+ status: string;
1463
+ fields: string[];
1464
+ } | {
1465
+ kind: "page";
1466
+ id: string;
1467
+ slug: string;
1468
+ title: string;
1469
+ };
1470
+ interface FolderTreeNodeResource extends Omit<FolderResource, "siteId" | "createdAt"> {
1471
+ path: string;
1472
+ namePath: string;
1473
+ depth: number;
1474
+ children: FolderTreeNodeResource[];
1475
+ }
1476
+ /** Query for `files.list` — every key optional (media picker backend, #708). */
1477
+ interface FileListQuery {
1478
+ /** Folder id, or `"root"` for files outside any folder. */
1479
+ folder?: string;
1480
+ /** Widen `folder` to its whole subtree. */
1481
+ subfolders?: boolean;
1482
+ search?: string;
1483
+ /** Exact MIME types or `type/*` prefixes. */
1484
+ mime?: string[];
1485
+ ids?: string[];
1486
+ limit?: number;
1487
+ offset?: number;
1488
+ }
1489
+ /** Per-site DAM settings (`files.dam`). */
1490
+ interface DamSettingsResource {
1491
+ deletePolicy: "confirm" | "block";
1492
+ versionRetentionDays: number;
1493
+ stripGpsOnPublic: boolean;
1494
+ extractMetadata: boolean;
1495
+ scan: {
1496
+ enabled: boolean;
1497
+ provider: "http";
1498
+ onError: "quarantine" | "allow";
1499
+ };
1329
1500
  }
1330
1501
  interface UploadTypeCatalogueEntry {
1331
1502
  mime: string;
@@ -1833,6 +2004,32 @@ declare class AudienceClient {
1833
2004
  */
1834
2005
  declare function toWebSocketBase(baseUrl: string): string;
1835
2006
 
2007
+ /**
2008
+ * Reference-counted connection sharing for {@link RealtimeClient}.
2009
+ *
2010
+ * Framework adapters (`@lumibase/vue`, `@lumibase/svelte`, `@lumibase/astro`)
2011
+ * mount and unmount many components that each want "the realtime connection
2012
+ * to be open while I am alive". Calling `connect()` from each one is safe
2013
+ * (it is idempotent) but nothing would ever close the socket again. This
2014
+ * helper keeps one count per client: the first `retainRealtime()` opens the
2015
+ * connection, the release of the last holder closes it.
2016
+ *
2017
+ * The count lives in a WeakMap, so a client that is garbage-collected takes
2018
+ * its count with it, and two independent clients never share one.
2019
+ */
2020
+ /** The part of `RealtimeClient` the retain counter drives. */
2021
+ interface RealtimeConnectable {
2022
+ connect(): unknown;
2023
+ disconnect(): void;
2024
+ }
2025
+ /** Number of live holders for `client` (0 when nobody retains it). */
2026
+ declare function realtimeHolders(client: RealtimeConnectable): number;
2027
+ /**
2028
+ * Mark `client` as in use. Connects on the first hold. Returns a release
2029
+ * function that is safe to call more than once — only the first call counts.
2030
+ */
2031
+ declare function retainRealtime(client: RealtimeConnectable): () => void;
2032
+
1836
2033
  /**
1837
2034
  * RealtimeClient — typed WebSocket client for the LumiBase realtime API.
1838
2035
  *
@@ -1934,6 +2131,18 @@ declare class RealtimeClient {
1934
2131
  private _sendRaw;
1935
2132
  }
1936
2133
 
2134
+ /** Options for item `patch` / `replace`. */
2135
+ interface ItemWriteOptions {
2136
+ /**
2137
+ * Only write if the item is still at this version (from `ItemRow.version`
2138
+ * or the detail response's `ETag`). If someone else changed it first, the
2139
+ * request fails with a `LumiError` of status 412 and code
2140
+ * `PRECONDITION_FAILED`, and nothing is written. Omit to overwrite
2141
+ * unconditionally (the default).
2142
+ */
2143
+ ifMatch?: number;
2144
+ }
2145
+
1937
2146
  /**
1938
2147
  * Loose shape for `users.preferences`. The CMS validates the strict schema
1939
2148
  * (`@lumibase/contracts/schemas#UserPreferences`); the SDK stays decoupled and
@@ -1998,6 +2207,12 @@ declare function legacyRest(): <TSchema extends DefaultSchema>(client: LumiClien
1998
2207
  setFormLayout: (name: string, layout: unknown) => Promise<LumiResponse<{
1999
2208
  layout: unknown;
2000
2209
  }>>;
2210
+ /**
2211
+ * Expression index advice for filtering on a JSON path (#729). `cast`
2212
+ * defaults to the declared type of a top-level field; nested paths
2213
+ * must name it. Read-only: the DDL is returned, never executed.
2214
+ */
2215
+ indexAdvice: (name: string, path: string, cast?: JsonPathCast) => Promise<LumiResponse<JsonPathIndexAdvice>>;
2001
2216
  };
2002
2217
  items: <TName extends keyof TSchema & string>(name: TName) => {
2003
2218
  list: (params?: ListItemsParams) => Promise<ListItemsResponse<TSchema[TName] extends Record<string, unknown> ? TSchema[TName] : Record<string, unknown>>>;
@@ -2019,12 +2234,12 @@ declare function legacyRest(): <TSchema extends DefaultSchema>(client: LumiClien
2019
2234
  /** ISO timestamps for content scheduling (Publish_Window). */
2020
2235
  publishAt?: string | null;
2021
2236
  unpublishAt?: string | null;
2022
- }) => Promise<LumiResponse<ItemRow<TSchema[TName] extends Record<string, unknown> ? TSchema[TName] : Record<string, unknown>>>>;
2237
+ }, options?: ItemWriteOptions) => Promise<LumiResponse<ItemRow<TSchema[TName] extends Record<string, unknown> ? TSchema[TName] : Record<string, unknown>>>>;
2023
2238
  replace: (id: string, input: {
2024
2239
  data: TSchema[TName] extends Record<string, unknown> ? TSchema[TName] : Record<string, unknown>;
2025
2240
  status?: string;
2026
2241
  sort?: number;
2027
- }) => Promise<LumiResponse<ItemRow<TSchema[TName] extends Record<string, unknown> ? TSchema[TName] : Record<string, unknown>>>>;
2242
+ }, options?: ItemWriteOptions) => Promise<LumiResponse<ItemRow<TSchema[TName] extends Record<string, unknown> ? TSchema[TName] : Record<string, unknown>>>>;
2028
2243
  delete: (id: string) => Promise<LumiResponse<null>>;
2029
2244
  /**
2030
2245
  * Stream the collection as CSV or JSON (#727). Resolves with the
@@ -2033,6 +2248,27 @@ declare function legacyRest(): <TSchema extends DefaultSchema>(client: LumiClien
2033
2248
  */
2034
2249
  export: (params?: ExportItemsParams) => Promise<Response>;
2035
2250
  bulk: (op: "create" | "update" | "delete", payload: Array<Record<string, unknown>>) => Promise<LumiResponse<ItemRow<TSchema[TName] extends Record<string, unknown> ? TSchema[TName] : Record<string, unknown>>[]>>;
2251
+ /**
2252
+ * Save-as-copy (#689): a draft copy with unique fields suffixed
2253
+ * (`-copy`, `-copy-2`, …). Goes through the normal create path.
2254
+ */
2255
+ duplicate: (id: string, options?: DuplicateItemOptions) => Promise<LumiResponse<ItemRow<TSchema[TName] extends Record<string, unknown> ? TSchema[TName] : Record<string, unknown>>>>;
2256
+ /**
2257
+ * Manual ordering (#690) on a `meta.manualSort` collection: place `id`
2258
+ * right after `after` (null = first) or right before `before`.
2259
+ */
2260
+ reorder: (id: string, target: {
2261
+ after: string | null;
2262
+ } | {
2263
+ before: string;
2264
+ }) => Promise<LumiResponse<ItemRow<TSchema[TName] extends Record<string, unknown> ? TSchema[TName] : Record<string, unknown>>>>;
2265
+ /**
2266
+ * Patch without recording a revision (#693) — for autosave and
2267
+ * machine writes. Agent-authored writes keep their revision anyway.
2268
+ */
2269
+ patchWithoutRevision: (id: string, input: {
2270
+ data?: Partial<TSchema[TName] extends Record<string, unknown> ? TSchema[TName] : Record<string, unknown>>;
2271
+ }) => Promise<LumiResponse<ItemRow<TSchema[TName] extends Record<string, unknown> ? TSchema[TName] : Record<string, unknown>>>>;
2036
2272
  /**
2037
2273
  * Hierarchical collections (#749) on a `meta.tree.enabled` collection.
2038
2274
  * Reads apply the caller's row rules; the anchor must be readable.
@@ -2207,6 +2443,17 @@ declare function legacyRest(): <TSchema extends DefaultSchema>(client: LumiClien
2207
2443
  create: (input: ShareCreateInput) => Promise<LumiResponse<ShareSecretResult>>;
2208
2444
  revoke: (id: string) => Promise<LumiResponse<ShareResource>>;
2209
2445
  };
2446
+ preview: {
2447
+ mintToken: (input: PreviewTokenMintInput) => Promise<LumiResponse<PreviewTokenSecretResult>>;
2448
+ listTokens: () => Promise<LumiResponse<PreviewTokenResource[]>>;
2449
+ revokeToken: (id: string) => Promise<LumiResponse<PreviewTokenResource>>;
2450
+ /** Rotation: revoke every live preview token of the site (site admin). */
2451
+ revokeAll: () => Promise<LumiResponse<{
2452
+ revoked: number;
2453
+ }>>;
2454
+ getSettings: () => Promise<LumiResponse<PreviewSettingsResource>>;
2455
+ updateSettings: (input: PreviewSettingsResource) => Promise<LumiResponse<PreviewSettingsResource>>;
2456
+ };
2210
2457
  me: {
2211
2458
  getPreferences: () => Promise<LumiResponse<UserPreferencesPayload>>;
2212
2459
  updatePreferences: (patch: UserPreferencesPayload) => Promise<LumiResponse<UserPreferencesPayload>>;
@@ -2363,12 +2610,60 @@ declare function legacyRest(): <TSchema extends DefaultSchema>(client: LumiClien
2363
2610
  parent?: string | null;
2364
2611
  }) => Promise<LumiResponse<FolderResource>>;
2365
2612
  delete: (id: string) => Promise<LumiResponse<null>>;
2613
+ /** Nested folder tree with id paths (`/a/b/`) and name paths (#701). */
2614
+ tree: () => Promise<LumiResponse<FolderTreeNodeResource[]>>;
2366
2615
  };
2367
2616
  files: {
2368
- list: () => Promise<LumiResponse<FileResource[]>>;
2617
+ /**
2618
+ * List / filter the library. Without a query: the first 1000 files,
2619
+ * newest first. `meta` carries `{ total, limit, offset }`.
2620
+ */
2621
+ list: (query?: FileListQuery) => Promise<LumiResponse<FileResource[]>>;
2622
+ get: (id: string) => Promise<LumiResponse<FileResource>>;
2623
+ /**
2624
+ * Replace the bytes behind a file in place (#703): same id, key, folder
2625
+ * and references; `version` bumps. Pass `expectedVersion` to refuse
2626
+ * (409) when someone replaced it since you loaded it.
2627
+ */
2628
+ replaceContent: (id: string, body: Blob | ArrayBuffer | Uint8Array, opts: {
2629
+ mime: string;
2630
+ filename?: string;
2631
+ expectedVersion?: number;
2632
+ }) => Promise<LumiResponse<FileResource>>;
2633
+ /** URL that serves the current bytes; pass `version` for an immutable, cacheable URL. */
2634
+ contentUrl: (id: string, version?: number) => string;
2635
+ versions: (id: string) => Promise<LumiResponse<FileVersionResource[]>>;
2636
+ restoreVersion: (id: string, versionId: string) => Promise<LumiResponse<FileResource>>;
2637
+ /** Items and pages that reference the file (#706). */
2638
+ usage: (id: string) => Promise<LumiResponse<FileReferenceResource[]>>;
2639
+ /** Files with the same content hash (lowercase hex SHA-256). */
2640
+ duplicates: (hash: string) => Promise<LumiResponse<FileResource[]>>;
2641
+ /** Bulk move and/or merge editorial metadata (alt, title, caption, credit, tags). */
2642
+ bulk: (input: {
2643
+ ids: string[];
2644
+ folder?: string | null;
2645
+ metadata?: {
2646
+ alt?: string;
2647
+ title?: string;
2648
+ caption?: string;
2649
+ credit?: string;
2650
+ tags?: string[];
2651
+ };
2652
+ }) => Promise<LumiResponse<FileResource[]>>;
2653
+ settings: {
2654
+ get: () => Promise<LumiResponse<DamSettingsResource>>;
2655
+ update: (patch: Partial<DamSettingsResource>) => Promise<LumiResponse<DamSettingsResource>>;
2656
+ };
2369
2657
  create: (input: Record<string, unknown>) => Promise<LumiResponse<FileResource>>;
2370
2658
  update: (id: string, patch: Record<string, unknown>) => Promise<LumiResponse<FileResource>>;
2371
- delete: (id: string) => Promise<LumiResponse<null>>;
2659
+ /**
2660
+ * Safe delete (#706): a referenced file answers 409 `FILE_IN_USE` with the
2661
+ * references in `errors[0].details.usage`; repeat with `{ confirm: true }`
2662
+ * to delete anyway (unless the site's policy is `block`).
2663
+ */
2664
+ delete: (id: string, opts?: {
2665
+ confirm?: boolean;
2666
+ }) => Promise<LumiResponse<null>>;
2372
2667
  getPresignedUrl: (filename: string) => Promise<LumiResponse<{
2373
2668
  url: string;
2374
2669
  method: string;
@@ -2920,6 +3215,12 @@ interface TypegenCollection {
2920
3215
  interface TypegenField {
2921
3216
  name: string;
2922
3217
  type: string;
3218
+ /**
3219
+ * Studio interface id (`translatable-text`, `file`, `files`, …). Optional so
3220
+ * manifests from older servers still type-check; generators use it to tell a
3221
+ * per-locale map or a file reference from a plain scalar.
3222
+ */
3223
+ interface?: string;
2923
3224
  required: boolean;
2924
3225
  nullable: boolean;
2925
3226
  readonly?: boolean;
@@ -2945,7 +3246,101 @@ interface TypegenRelation {
2945
3246
  oneCollection?: string;
2946
3247
  oneField?: string | null;
2947
3248
  junctionCollection?: string | null;
3249
+ /**
3250
+ * The relation row's own `type`. `kind` is the direction seen from this
3251
+ * collection (an m2o row reads as `o2m` from its one side); the GraphQL SDL
3252
+ * target needs the stored type to mirror which nested fields the server adds.
3253
+ */
3254
+ relationType?: 'm2o' | 'o2m' | 'm2m' | 'm2a';
3255
+ /** Field name the server's GraphQL expansion uses for this relation. */
3256
+ alias?: string;
3257
+ }
3258
+
3259
+ /** Interface id of a per-locale text map (`{ en: 'Hi', vi: 'Chào' }`). */
3260
+ declare const TRANSLATABLE_INTERFACE = "translatable-text";
3261
+ /** Interface id of a single file reference (a file id). */
3262
+ declare const FILE_INTERFACE = "file";
3263
+ /** Interface id of a multi-file reference (an array of file ids). */
3264
+ declare const FILES_INTERFACE = "files";
3265
+ /**
3266
+ * Keeps only the collections a config asked for. Applied client-side as well
3267
+ * as on the server so a saved manifest file honours `include` / `exclude` too.
3268
+ */
3269
+ declare function filterManifest(manifest: TypegenManifest, filters: {
3270
+ include?: readonly string[];
3271
+ exclude?: readonly string[];
3272
+ }): TypegenManifest;
3273
+
3274
+ /** Module the generated validators import `z` from. */
3275
+ declare const DEFAULT_ZOD_IMPORT = "zod";
3276
+ interface GenerateZodOptions {
3277
+ /** Module specifier for `import { z } from '…'`. Defaults to `zod`. */
3278
+ importSource?: string;
3279
+ }
3280
+ /**
3281
+ * Generates Zod runtime validators that mirror {@link generateTypes}: one
3282
+ * `<Name>Schema` per collection, an inferred `<Name>` type, and a
3283
+ * `LumibaseSchemas` map keyed by collection name.
3284
+ *
3285
+ * Optionality and nullability follow the TS generator exactly (`?` when not
3286
+ * required, `| null` when not required or nullable). The output uses only the
3287
+ * API surface shared by Zod 3 and Zod 4.
3288
+ *
3289
+ * Two deliberate differences from the TS types, both toward what the API
3290
+ * actually returns: branded ids validate as plain strings (a brand is a
3291
+ * compile-time marker), and to-many relations accept an id or an expanded
3292
+ * object per entry (the REST API returns ids unless the relation is expanded).
3293
+ */
3294
+ declare function generateZod(manifest: TypegenManifest, options?: GenerateZodOptions): string;
3295
+
3296
+ /**
3297
+ * GraphQL SDL for a site, derived from the typegen manifest.
3298
+ *
3299
+ * Mirrors the schema the CMS serves at `/graphql`
3300
+ * (`apps/cms/src/graphql/schema-builder.ts` + `type-mapping.ts`): the same
3301
+ * type names (`blog_posts` → `BlogPosts`), structural columns, scalar mapping,
3302
+ * nested m2o/o2m relation fields, and the Query / Mutation / Subscription
3303
+ * root fields. A parity test in the CMS holds the two together.
3304
+ *
3305
+ * Pure text: no `graphql` runtime dependency. Descriptions are omitted, so
3306
+ * the output depends only on the schema shape.
3307
+ */
3308
+ declare function generateGraphQLSdl(manifest: TypegenManifest): string;
3309
+
3310
+ /** A JSON Schema 2020-12 object as embedded in an OpenAPI 3.1 document. */
3311
+ type JsonSchema = Record<string, unknown>;
3312
+ interface GenerateOpenApiOptions {
3313
+ /** `info.title`. Defaults to `LumiBase content schemas`. */
3314
+ title?: string;
3315
+ /** `info.version`. Defaults to `manifest-v<manifest.version>`. */
3316
+ version?: string;
3317
+ }
3318
+ interface OpenApiComponentsDocument {
3319
+ openapi: '3.1.0';
3320
+ info: {
3321
+ title: string;
3322
+ version: string;
3323
+ description: string;
3324
+ };
3325
+ components: {
3326
+ schemas: Record<string, JsonSchema>;
3327
+ };
2948
3328
  }
3329
+ /**
3330
+ * An OpenAPI 3.1 `components/schemas` document built from the typegen
3331
+ * manifest — offline, with no caller in mind: every collection and field in
3332
+ * the manifest is documented, encrypted values may be masked (`'***'`).
3333
+ *
3334
+ * Component names and shapes follow the live per-caller document
3335
+ * (`GET /api/v1/openapi.json`) so either can feed the same client generator:
3336
+ * `<collection>.Fields` (user fields), `<collection>.Item` (the stored row —
3337
+ * system columns at the top level, user fields under `data`),
3338
+ * `<collection>.Projection` (the flat `?fields=` shape),
3339
+ * `<collection>.CreateInput` / `.UpdateInput`, plus `{ data, meta }`
3340
+ * envelopes `<collection>.Response` / `.ListResponse` and the shared
3341
+ * `PaginationMeta` / `ErrorResponse`.
3342
+ */
3343
+ declare function generateOpenApi(manifest: TypegenManifest, options?: GenerateOpenApiOptions): OpenApiComponentsDocument;
2949
3344
 
2950
3345
  /** Default module specifier the generated file imports `ID` / `Locale` / `Brand` from. */
2951
3346
  declare const DEFAULT_IMPORT_SOURCE = "@lumibase/sdk";
@@ -2989,5 +3384,5 @@ declare function toNextMetadata(item: unknown): Record<string, unknown>;
2989
3384
  */
2990
3385
  declare function jsonLdScript(item: unknown): string | undefined;
2991
3386
 
2992
- export { ACCESS_EXPORT_SCHEMA, AudienceClient, DECISION_ERROR_CODES, DEFAULT_IMPORT_SOURCE, LumiError, RealtimeClient, ackCdcSubscription, checkCdcPipelineHealth, createAgentArtifact, createAgentGoal, createBookmark, createCdcPipeline, createCdcSubscription, createLumiClient, decide, decideAgentApproval, decisionErrorCode, deleteBookmark, deleteCdcPipeline, deleteCdcSubscription, deployCdc, dispatchCdcSubscription, dryRunAccessImport, evaluateAgentArtifact, exportAccessManifest, extractSeo, generateAgentApp, generateTypes, getEffectivePreset, getReview, getReviewProfile, graphql, importAccessManifest, jsonLdScript, legacyRest, listAgentApprovals, listAgentArtifacts, listAgentGoals, listAgentRuns, listAgentTools, listBookmarks, listCdcPipelines, listCdcSubscriptionDeliveries, listCdcSubscriptions, listReviewProfiles, listReviews, mediaUrl, publishAgentArtifact, readAgentMemoryContext, readCdcEvents, readCdcPipeline, readCdcPipelineMetricHistory, readCdcPipelineMetrics, readCdcSubscription, readItem, readItems, replayCdcSubscription, retryAgentRun, reviewContentHash, reviewDraft, rollbackAgentArtifact, rollbackCdcDeployment, saveUserView, search, startCdcPipeline, stopCdcPipeline, submitReviewFeedback, toNextMetadata, toWebSocketBase, updateBookmark, updateCdcPipeline, updateCdcSubscription, validateCdcDeploymentEnv, writeAgentMemory };
2993
- export type { AIApproval, AIApprovalStatus, AIChatResponse, AIChatStatus, AIContentAssistResult, AIConversation, AIFieldSuggestion, AIMessage, AccessConflict, AccessConflictCheckInput, AccessConflictReport, AccessExportApiKey, AccessExportBindings, AccessExportManifest, AccessExportPermission, AccessExportPolicy, AccessExportRole, AccessImportApplyResult, AccessImportDiff, AccessImportDiffEntry, AccessImportDiffSection, AccessImportDryRunResult, AccessImportIssue, AccessImportMode, AccessImportOptions, AccessImportSummary, ActivityResource, AgentApprovalResource, AgentArtifactCreateInput, AgentArtifactResource, AgentArtifactType, AgentEvaluationResource, AgentGenerateAppInput, AgentGenerateAppResult, AgentGoalCreateInput, AgentGoalResource, AgentMemoryContext, AgentMemoryResource, AgentMemoryWriteInput, AgentRiskLevel, AgentRunResource, AgentToolResource, ApiKeyCreateInput, ApiKeyPolicyAttachment, ApiKeyResource, ApiKeyRoleAttachment, ApiKeyRotateInput, ApiKeySecretResult, AudienceClientOptions, AudienceEvent, AudienceNotification, Brand, CdcActorType, CdcConnectorType, CdcDeliveryResource, CdcDeployInput, CdcDeploymentResult, CdcDeploymentStatus, CdcDeploymentStep, CdcDeploymentTarget, CdcEnvValidationResult, CdcEventEnvelope, CdcFeedPage, CdcFeedReadParams, CdcHealthCheckResult, CdcHealthMetricEntry, CdcOperation, CdcPayloadMode, CdcPipelineCreateInput, CdcPipelineMetrics, CdcPipelinePatchInput, CdcPipelineResource, CdcPipelineStatus, CdcReplayInput, CdcRollbackResult, CdcSource, CdcSubscriptionCreateInput, CdcSubscriptionKind, CdcSubscriptionPatchInput, CdcSubscriptionResource, CdcSubscriptionStatus, CdcValidateEnvInput, ChannelEventCallback, ChoiceAnswer, ChoiceQuestion, CollectionInput, CollectionResource, CompiledPermission, ConnectionStatus, ContentVersion, CreateSCIMTokenParams, DecideOptions, DecisionAnswer, DecisionErrorCode, DecisionPayload, DecisionQuestion, DecisionRequest, DecisionResult, DefaultSchema, DeliverySeo, DeploymentAccessResource, DeploymentApprovalResource, DeploymentDispatchResult, DeploymentEnvironmentResource, DeploymentRequestOutcome, DeploymentResource, DeploymentTargetResource, DomainCreateInput, DomainResource, DomainVerificationRecord, ExportItemsParams, ExtensionResource, FieldDeleteOptions, FieldInput, FieldMutationOptions, FieldRenameInput, FieldResource, FileResource, FlowGraph, FlowNode, FlowResource, FlowRun, FlowRunResult, FlowRunStatus, FlowStatus, FlowTriggerType, FolderResource, GenerateOptions, GeoPoint, GrantAction, GraphQLExtension, ID, ImportJob, ImportJobStatus, ImportRowError, ItemFilter, ItemFilterOp, ItemRow, ListItemsParams, ListItemsResponse, ListMarketplaceExtensionsParams, Locale, LumiClient, LumiClientOptions, LumiErrorBody, LumiResponse, LumibaseBlock, MarketplaceExtension, MarketplaceListResponse, MaterializeDataResponse, MaterializeProjection, MaterializeRefreshResult, MaterializeRefreshStrategy, MaterializedCollection, MediaTransform, NotificationCallback, NoulAnswer, NoulQuestion, PermissionAction, PermissionBundle, PermissionCheckResult, PermissionRow, PolicyDetail, PolicyResource, PresenceCallback, PresenceEntry, PresetResource, PresetScope, PrimaryKeyType, RealmAccessDescriptor, RealmAccessGrant, RealmAccessState, RealmGrantInput, RealtimeEvent, RealtimeEventCallback, RelationInput, RelationResource, RelationType, ReviewFeedback, ReviewFeedbackEntry, ReviewFeedbackRequest, ReviewPreset, ReviewProfile, ReviewRequestOptions, ReviewRun, ReviewRunRequest, ReviewRunStatus, ReviewStaleReason, ReviewVerdict, RevisionRow, RoleDetail, RoleResource, SCIMTokenCreated, SCIMTokenMeta, SCIMTokenRotated, SchemaApplyInput, SchemaApplyResult, SchemaChangedEvent, SchemaDiff, SchemaDiffEntry, SchemaDiffInput, SchemaDiffRisk, SchemaRuntimeImpact, ScopedViewPreset, ScoreAnswer, ScoreQuestion, SearchHit, SearchHitMeta, SearchParams, SearchResponse, SettingResource, ShareCreateInput, ShareResource, ShareSecretResult, SiteConfigUpdate, SiteResource, StatusCallback, StorageMode, TeamMemberResource, TeamResource, TmEntry, TmSource, TmSuggestion, TranslationResource, TreeMoveResult, TypegenCollection, TypegenField, TypegenManifest, TypegenRelation, TypegenSchemaFilters, UploadConfigResource, UploadTypeCatalogueEntry, UserPreferencesPayload, UserResource, VersionCompare, VersionFieldChange, ViewPreset, WebSocketFactory, WebSocketLike, WebhookResource, ZonedDateTime };
3387
+ export { ACCESS_EXPORT_SCHEMA, AudienceClient, DECISION_ERROR_CODES, DEFAULT_IMPORT_SOURCE, DEFAULT_ZOD_IMPORT, FILES_INTERFACE, FILE_INTERFACE, LumiError, RealtimeClient, TRANSLATABLE_INTERFACE, ackCdcSubscription, checkCdcPipelineHealth, createAgentArtifact, createAgentGoal, createBookmark, createCdcPipeline, createCdcSubscription, createLumiClient, decide, decideAgentApproval, decisionErrorCode, deleteBookmark, deleteCdcPipeline, deleteCdcSubscription, deployCdc, dispatchCdcSubscription, dryRunAccessImport, evaluateAgentArtifact, exportAccessManifest, extractSeo, filterManifest, generateAgentApp, generateGraphQLSdl, generateOpenApi, generateTypes, generateZod, getEffectivePreset, getReview, getReviewProfile, graphql, importAccessManifest, jsonLdScript, legacyRest, listAgentApprovals, listAgentArtifacts, listAgentGoals, listAgentRuns, listAgentTools, listBookmarks, listCdcPipelines, listCdcSubscriptionDeliveries, listCdcSubscriptions, listReviewProfiles, listReviews, mediaUrl, publishAgentArtifact, readAgentMemoryContext, readCdcEvents, readCdcPipeline, readCdcPipelineMetricHistory, readCdcPipelineMetrics, readCdcSubscription, readItem, readItems, realtimeHolders, replayCdcSubscription, retainRealtime, retryAgentRun, reviewContentHash, reviewDraft, rollbackAgentArtifact, rollbackCdcDeployment, saveUserView, search, startCdcPipeline, stopCdcPipeline, submitReviewFeedback, toNextMetadata, toWebSocketBase, updateBookmark, updateCdcPipeline, updateCdcSubscription, validateCdcDeploymentEnv, writeAgentMemory };
3388
+ export type { AIApproval, AIApprovalStatus, AIChatResponse, AIChatStatus, AIContentAssistResult, AIConversation, AIFieldSuggestion, AIMessage, AccessConflict, AccessConflictCheckInput, AccessConflictReport, AccessExportApiKey, AccessExportBindings, AccessExportManifest, AccessExportPermission, AccessExportPolicy, AccessExportRole, AccessImportApplyResult, AccessImportDiff, AccessImportDiffEntry, AccessImportDiffSection, AccessImportDryRunResult, AccessImportIssue, AccessImportMode, AccessImportOptions, AccessImportSummary, ActivityResource, AgentApprovalResource, AgentArtifactCreateInput, AgentArtifactResource, AgentArtifactType, AgentEvaluationResource, AgentGenerateAppInput, AgentGenerateAppResult, AgentGoalCreateInput, AgentGoalResource, AgentMemoryContext, AgentMemoryResource, AgentMemoryWriteInput, AgentRiskLevel, AgentRunResource, AgentToolResource, ApiKeyCreateInput, ApiKeyPolicyAttachment, ApiKeyResource, ApiKeyRoleAttachment, ApiKeyRotateInput, ApiKeySecretResult, AudienceClientOptions, AudienceEvent, AudienceNotification, Brand, CdcActorType, CdcConnectorType, CdcDeliveryResource, CdcDeployInput, CdcDeploymentResult, CdcDeploymentStatus, CdcDeploymentStep, CdcDeploymentTarget, CdcEnvValidationResult, CdcEventEnvelope, CdcFeedPage, CdcFeedReadParams, CdcHealthCheckResult, CdcHealthMetricEntry, CdcOperation, CdcPayloadMode, CdcPipelineCreateInput, CdcPipelineMetrics, CdcPipelinePatchInput, CdcPipelineResource, CdcPipelineStatus, CdcReplayInput, CdcRollbackResult, CdcSource, CdcSubscriptionCreateInput, CdcSubscriptionKind, CdcSubscriptionPatchInput, CdcSubscriptionResource, CdcSubscriptionStatus, CdcValidateEnvInput, ChannelEventCallback, ChoiceAnswer, ChoiceQuestion, CollectionInput, CollectionResource, CompiledPermission, ConnectionStatus, ContentVersion, CreateSCIMTokenParams, DamSettingsResource, DecideOptions, DecisionAnswer, DecisionErrorCode, DecisionPayload, DecisionQuestion, DecisionRequest, DecisionResult, DefaultSchema, DeliverySeo, DeploymentAccessResource, DeploymentApprovalResource, DeploymentDispatchResult, DeploymentEnvironmentResource, DeploymentRequestOutcome, DeploymentResource, DeploymentTargetResource, DomainCreateInput, DomainResource, DomainVerificationRecord, DuplicateItemOptions, ExportItemsParams, ExtensionResource, FieldDeleteOptions, FieldInput, FieldMutationOptions, FieldRenameInput, FieldResource, FileListQuery, FileReferenceResource, FileResource, FileVersionResource, FlowGraph, FlowNode, FlowResource, FlowRun, FlowRunResult, FlowRunStatus, FlowStatus, FlowTriggerType, FolderResource, FolderTreeNodeResource, GenerateOpenApiOptions, GenerateOptions, GenerateZodOptions, GeoPoint, GrantAction, GraphQLExtension, ID, ImportJob, ImportJobStatus, ImportRowError, ItemFilter, ItemFilterOp, ItemRow, ItemWriteOptions, JsonPathCast, JsonPathIndexAdvice, JsonSchema, ListItemsParams, ListItemsResponse, ListMarketplaceExtensionsParams, Locale, LumiClient, LumiClientOptions, LumiErrorBody, LumiResponse, LumibaseBlock, MarketplaceExtension, MarketplaceListResponse, MaterializeDataResponse, MaterializeProjection, MaterializeRefreshResult, MaterializeRefreshStrategy, MaterializedCollection, MediaTransform, NotificationCallback, NoulAnswer, NoulQuestion, OpenApiComponentsDocument, PermissionAction, PermissionBundle, PermissionCheckResult, PermissionRow, PolicyDetail, PolicyResource, PresenceCallback, PresenceEntry, PresetResource, PresetScope, PreviewSettingsResource, PreviewTokenMintInput, PreviewTokenResource, PreviewTokenSecretResult, PrimaryKeyType, PublicationState, RealmAccessDescriptor, RealmAccessGrant, RealmAccessState, RealmGrantInput, RealtimeConnectable, RealtimeEvent, RealtimeEventCallback, RelationInput, RelationResource, RelationType, ReviewFeedback, ReviewFeedbackEntry, ReviewFeedbackRequest, ReviewPreset, ReviewProfile, ReviewRequestOptions, ReviewRun, ReviewRunRequest, ReviewRunStatus, ReviewStaleReason, ReviewVerdict, RevisionRow, RoleDetail, RoleResource, SCIMTokenCreated, SCIMTokenMeta, SCIMTokenRotated, SchemaApplyInput, SchemaApplyResult, SchemaChangedEvent, SchemaDiff, SchemaDiffEntry, SchemaDiffInput, SchemaDiffRisk, SchemaOf, SchemaRuntimeImpact, ScopedViewPreset, ScoreAnswer, ScoreQuestion, SearchHit, SearchHitMeta, SearchParams, SearchResponse, SettingResource, ShareCreateInput, ShareResource, ShareSecretResult, SiteConfigUpdate, SiteResource, StatusCallback, StorageMode, TeamMemberResource, TeamResource, TmEntry, TmSource, TmSuggestion, TranslationResource, TreeMoveResult, TypegenCollection, TypegenField, TypegenManifest, TypegenRelation, TypegenSchemaFilters, UploadConfigResource, UploadTypeCatalogueEntry, UserPreferencesPayload, UserResource, VersionCompare, VersionFieldChange, ViewPreset, WebSocketFactory, WebSocketLike, WebhookResource, ZonedDateTime };