@lumibase/sdk 2.0.0 → 2.2.1
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.cjs +964 -32
- package/dist/index.d.cts +644 -10
- package/dist/index.d.ts +644 -10
- package/dist/index.js +954 -32
- package/package.json +5 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,50 @@
|
|
|
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 & {
|
|
5
24
|
readonly __brand: TBrand;
|
|
6
25
|
};
|
|
26
|
+
/**
|
|
27
|
+
* Value of a timezone-aware datetime field (`options.timezone: true`, #747).
|
|
28
|
+
* Write either `{ instant, tz }` or `{ local, tz }`; reads return all three.
|
|
29
|
+
*/
|
|
30
|
+
interface ZonedDateTime {
|
|
31
|
+
/** ISO-8601 instant in UTC. */
|
|
32
|
+
instant: string;
|
|
33
|
+
/** IANA time zone the value was authored in. */
|
|
34
|
+
tz: string;
|
|
35
|
+
/** UTC offset of `tz` at `instant`, e.g. `-04:00`. */
|
|
36
|
+
offset: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* One block of a `blocks` field (dynamic zone, #748). `type` is the block
|
|
40
|
+
* template's collection name and discriminates the union; generated types
|
|
41
|
+
* narrow it to a literal per template.
|
|
42
|
+
*/
|
|
43
|
+
interface LumibaseBlock<TType extends string = string, TData = Record<string, unknown>> {
|
|
44
|
+
id: string;
|
|
45
|
+
type: TType;
|
|
46
|
+
data: TData;
|
|
47
|
+
}
|
|
7
48
|
type AgentRiskLevel = "safe" | "review_required" | "dangerous" | "blocked";
|
|
8
49
|
interface AgentGoalResource {
|
|
9
50
|
id: string;
|
|
@@ -361,7 +402,12 @@ interface TypegenSchemaFilters {
|
|
|
361
402
|
include?: string[];
|
|
362
403
|
exclude?: string[];
|
|
363
404
|
}
|
|
364
|
-
type ItemFilterOp = "_eq" | "_neq" | "_in" | "_nin" | "_gt" | "_gte" | "_lt" | "_lte" | "_contains" | "_starts_with" | "_ends_with" | "_null" | "_nnull" | "_json_contains" | "_has_key" | "_has_any_keys" | "_has_all_keys";
|
|
405
|
+
type ItemFilterOp = "_eq" | "_neq" | "_in" | "_nin" | "_gt" | "_gte" | "_lt" | "_lte" | "_contains" | "_starts_with" | "_ends_with" | "_null" | "_nnull" | "_json_contains" | "_has_key" | "_has_any_keys" | "_has_all_keys" | "_near" | "_within_bbox";
|
|
406
|
+
/** Value of a `geopoint` field: WGS 84 degrees. */
|
|
407
|
+
interface GeoPoint {
|
|
408
|
+
lat: number;
|
|
409
|
+
lng: number;
|
|
410
|
+
}
|
|
365
411
|
interface ItemFilter {
|
|
366
412
|
_and?: ItemFilter[];
|
|
367
413
|
_or?: ItemFilter[];
|
|
@@ -370,6 +416,13 @@ interface ItemFilter {
|
|
|
370
416
|
[op in ItemFilterOp]?: unknown;
|
|
371
417
|
} | ItemFilter[] | undefined;
|
|
372
418
|
}
|
|
419
|
+
/** Result of `items(name).tree.move()` (#749). */
|
|
420
|
+
interface TreeMoveResult {
|
|
421
|
+
id: string;
|
|
422
|
+
parentId: string | null;
|
|
423
|
+
path: string;
|
|
424
|
+
sort: number;
|
|
425
|
+
}
|
|
373
426
|
interface ListItemsParams {
|
|
374
427
|
fields?: string[];
|
|
375
428
|
filter?: ItemFilter;
|
|
@@ -383,6 +436,83 @@ interface ListItemsParams {
|
|
|
383
436
|
* for a cheaper list (e.g. infinite scroll) and omits `meta.total`.
|
|
384
437
|
*/
|
|
385
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>;
|
|
457
|
+
}
|
|
458
|
+
/** Options for `items(name).export()` — `GET /items/:collection/export` (#727). */
|
|
459
|
+
interface ExportItemsParams {
|
|
460
|
+
/** `csv` (default) or `json` (`{ collection, format, items: [...] }`). */
|
|
461
|
+
format?: 'csv' | 'json';
|
|
462
|
+
/** Data fields to include; structural columns are always written. */
|
|
463
|
+
fields?: string[];
|
|
464
|
+
/** Locales for translatable fields. CSV writes one `field.locale` column each. */
|
|
465
|
+
locales?: string[];
|
|
466
|
+
/** `id` (default) keeps foreign ids; `slug` swaps in the related slug; `embed` adds the related record. */
|
|
467
|
+
relations?: 'id' | 'slug' | 'embed';
|
|
468
|
+
filter?: ItemFilter;
|
|
469
|
+
sort?: string[];
|
|
470
|
+
status?: string;
|
|
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
|
+
}
|
|
489
|
+
type ImportJobStatus = 'queued' | 'running' | 'succeeded' | 'failed' | 'cancelled' | 'timed_out';
|
|
490
|
+
/** A background import job (`/api/v1/imports`, #726). The uploaded file is never returned. */
|
|
491
|
+
interface ImportJob {
|
|
492
|
+
id: string;
|
|
493
|
+
collection: string;
|
|
494
|
+
format: 'csv' | 'json';
|
|
495
|
+
mode: 'create' | 'upsert';
|
|
496
|
+
status: ImportJobStatus;
|
|
497
|
+
totalRows: number;
|
|
498
|
+
processedRows: number;
|
|
499
|
+
createdRows: number;
|
|
500
|
+
updatedRows: number;
|
|
501
|
+
failedRows: number;
|
|
502
|
+
/** Row errors beyond the stored cap, counted but not kept. */
|
|
503
|
+
errorsTruncated: number;
|
|
504
|
+
message: string | null;
|
|
505
|
+
createdBy: string | null;
|
|
506
|
+
cancelRequested: boolean;
|
|
507
|
+
createdAt: string;
|
|
508
|
+
startedAt: string | null;
|
|
509
|
+
finishedAt: string | null;
|
|
510
|
+
}
|
|
511
|
+
interface ImportRowError {
|
|
512
|
+
/** 1-based data row (CSV: line after the header; JSON: position in `items`). */
|
|
513
|
+
row: number;
|
|
514
|
+
id?: string;
|
|
515
|
+
message: string;
|
|
386
516
|
}
|
|
387
517
|
/** Reserved metadata attributes present on every search hit. */
|
|
388
518
|
interface SearchHitMeta {
|
|
@@ -427,11 +557,27 @@ interface ItemRow<TData extends Record<string, unknown> = Record<string, unknown
|
|
|
427
557
|
status: string;
|
|
428
558
|
data: TData;
|
|
429
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;
|
|
430
567
|
/** Content scheduling window (Publish_Window); null when not scheduled. */
|
|
431
568
|
publishAt?: string | null;
|
|
432
569
|
unpublishAt?: string | null;
|
|
433
570
|
/** Editorial workflow state; null when the workflow is not in use. */
|
|
434
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;
|
|
578
|
+
/** Tree collections (#749): parent item id (null = root) and materialised path `/root/…/self/`. */
|
|
579
|
+
parentId?: string | null;
|
|
580
|
+
path?: string | null;
|
|
435
581
|
userCreated: string | null;
|
|
436
582
|
userUpdated: string | null;
|
|
437
583
|
createdAt: string;
|
|
@@ -853,6 +999,41 @@ interface ShareSecretResult extends ShareResource {
|
|
|
853
999
|
token: string;
|
|
854
1000
|
url: string;
|
|
855
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
|
+
}
|
|
856
1037
|
interface PresetResource {
|
|
857
1038
|
id: string;
|
|
858
1039
|
siteId: string;
|
|
@@ -1246,7 +1427,76 @@ interface FileResource {
|
|
|
1246
1427
|
folder: string | null;
|
|
1247
1428
|
metadata: Record<string, unknown>;
|
|
1248
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;
|
|
1249
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;
|
|
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
|
+
};
|
|
1250
1500
|
}
|
|
1251
1501
|
interface UploadTypeCatalogueEntry {
|
|
1252
1502
|
mime: string;
|
|
@@ -1498,13 +1748,76 @@ interface DeploymentResource {
|
|
|
1498
1748
|
commitMessage: string | null;
|
|
1499
1749
|
url: string | null;
|
|
1500
1750
|
triggeredBy: string | null;
|
|
1501
|
-
triggerSource: "manual" | "auto" | "agent";
|
|
1751
|
+
triggerSource: "manual" | "auto" | "agent" | "promote";
|
|
1502
1752
|
errorMessage: string | null;
|
|
1503
1753
|
logExcerpt: string | null;
|
|
1504
1754
|
createdAt: string;
|
|
1505
1755
|
updatedAt: string;
|
|
1506
1756
|
completedAt: string | null;
|
|
1507
1757
|
}
|
|
1758
|
+
/** Deployment environment (#743): preview / staging / production or any site-defined slug. */
|
|
1759
|
+
interface DeploymentEnvironmentResource {
|
|
1760
|
+
key: string;
|
|
1761
|
+
name: string;
|
|
1762
|
+
targetIds: string[];
|
|
1763
|
+
requiresApproval: boolean;
|
|
1764
|
+
promotesTo: string | null;
|
|
1765
|
+
}
|
|
1766
|
+
/** A parked deploy/promotion waiting for a human approver (#743). */
|
|
1767
|
+
interface DeploymentApprovalResource {
|
|
1768
|
+
id: string;
|
|
1769
|
+
kind: "trigger" | "promote";
|
|
1770
|
+
scope: "environment" | "target";
|
|
1771
|
+
environment: string;
|
|
1772
|
+
sourceEnvironment: string | null;
|
|
1773
|
+
sourceDeploymentId: string | null;
|
|
1774
|
+
targetIds: string[];
|
|
1775
|
+
branch: string | null;
|
|
1776
|
+
reason: string | null;
|
|
1777
|
+
status: "pending" | "deciding" | "approved" | "rejected" | "expired" | "failed";
|
|
1778
|
+
requestedBy: {
|
|
1779
|
+
type: string;
|
|
1780
|
+
id: string | null;
|
|
1781
|
+
} | null;
|
|
1782
|
+
createdAt: string;
|
|
1783
|
+
expiresAt: string;
|
|
1784
|
+
decidedAt: string | null;
|
|
1785
|
+
decidedBy: string | null;
|
|
1786
|
+
result: unknown;
|
|
1787
|
+
/** Present on list responses: whether the caller may decide it. */
|
|
1788
|
+
canDecide?: boolean;
|
|
1789
|
+
}
|
|
1790
|
+
interface DeploymentDispatchResult {
|
|
1791
|
+
targetId: string;
|
|
1792
|
+
ok: boolean;
|
|
1793
|
+
deployment: DeploymentResource | null;
|
|
1794
|
+
mode?: "native" | "retrigger";
|
|
1795
|
+
error?: {
|
|
1796
|
+
code: string;
|
|
1797
|
+
message: string;
|
|
1798
|
+
};
|
|
1799
|
+
}
|
|
1800
|
+
/** Outcome of an environment deploy / promotion request. */
|
|
1801
|
+
type DeploymentRequestOutcome = {
|
|
1802
|
+
status: "dispatched";
|
|
1803
|
+
environment: string | null;
|
|
1804
|
+
results: DeploymentDispatchResult[];
|
|
1805
|
+
} | {
|
|
1806
|
+
status: "pending_approval";
|
|
1807
|
+
environment: string;
|
|
1808
|
+
approval: DeploymentApprovalResource;
|
|
1809
|
+
};
|
|
1810
|
+
/** What the caller may do on the deployments page. */
|
|
1811
|
+
interface DeploymentAccessResource {
|
|
1812
|
+
admin: boolean;
|
|
1813
|
+
capabilities: string[];
|
|
1814
|
+
humanDecider: boolean;
|
|
1815
|
+
environments: Array<{
|
|
1816
|
+
key: string;
|
|
1817
|
+
canTrigger: boolean;
|
|
1818
|
+
canApprove: boolean;
|
|
1819
|
+
}>;
|
|
1820
|
+
}
|
|
1508
1821
|
|
|
1509
1822
|
/**
|
|
1510
1823
|
* LumiBase JS SDK
|
|
@@ -1583,6 +1896,12 @@ interface LumiClient<TSchema extends DefaultSchema = DefaultSchema> {
|
|
|
1583
1896
|
siteId: string;
|
|
1584
1897
|
fetcher: typeof fetch;
|
|
1585
1898
|
rawRequest: <T>(path: string, init?: RequestInit) => Promise<LumiResponse<T>>;
|
|
1899
|
+
/**
|
|
1900
|
+
* Like `rawRequest`, but resolves with the unread `Response` so the caller
|
|
1901
|
+
* can stream the body (downloads, exports). Same auth headers and the same
|
|
1902
|
+
* silent refresh on 401; a non-2xx status still throws `LumiError`.
|
|
1903
|
+
*/
|
|
1904
|
+
rawFetch: (path: string, init?: RequestInit) => Promise<Response>;
|
|
1586
1905
|
request: <Output>(command: (client: LumiClient<TSchema>) => Promise<Output>) => Promise<Output>;
|
|
1587
1906
|
with: <Extension>(plugin: (client: LumiClient<TSchema>) => Extension) => LumiClient<TSchema> & Extension;
|
|
1588
1907
|
}
|
|
@@ -1685,6 +2004,32 @@ declare class AudienceClient {
|
|
|
1685
2004
|
*/
|
|
1686
2005
|
declare function toWebSocketBase(baseUrl: string): string;
|
|
1687
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
|
+
|
|
1688
2033
|
/**
|
|
1689
2034
|
* RealtimeClient — typed WebSocket client for the LumiBase realtime API.
|
|
1690
2035
|
*
|
|
@@ -1786,6 +2131,18 @@ declare class RealtimeClient {
|
|
|
1786
2131
|
private _sendRaw;
|
|
1787
2132
|
}
|
|
1788
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
|
+
|
|
1789
2146
|
/**
|
|
1790
2147
|
* Loose shape for `users.preferences`. The CMS validates the strict schema
|
|
1791
2148
|
* (`@lumibase/contracts/schemas#UserPreferences`); the SDK stays decoupled and
|
|
@@ -1795,7 +2152,8 @@ declare class RealtimeClient {
|
|
|
1795
2152
|
interface UserPreferencesPayload {
|
|
1796
2153
|
language?: string;
|
|
1797
2154
|
theme?: "auto" | "light" | "dark";
|
|
1798
|
-
|
|
2155
|
+
/** Display time zone (IANA); `null` clears it → browser zone (#747). */
|
|
2156
|
+
timezone?: string | null;
|
|
1799
2157
|
keybindings?: Record<string, string>;
|
|
1800
2158
|
[key: string]: unknown;
|
|
1801
2159
|
}
|
|
@@ -1838,6 +2196,23 @@ declare function legacyRest(): <TSchema extends DefaultSchema>(client: LumiClien
|
|
|
1838
2196
|
listRelations: () => Promise<LumiResponse<RelationResource[]>>;
|
|
1839
2197
|
createRelation: (input: RelationInput) => Promise<LumiResponse<RelationResource>>;
|
|
1840
2198
|
deleteRelation: (id: string) => Promise<LumiResponse<null>>;
|
|
2199
|
+
/**
|
|
2200
|
+
* Collection form layout (#750): tabs / groups / dividers + conditions.
|
|
2201
|
+
* Typed loosely so the SDK stays decoupled from contracts; parse with
|
|
2202
|
+
* `parseFormLayout` from `@lumibase/contracts/form-layout`.
|
|
2203
|
+
*/
|
|
2204
|
+
getFormLayout: (name: string) => Promise<LumiResponse<{
|
|
2205
|
+
layout: unknown;
|
|
2206
|
+
}>>;
|
|
2207
|
+
setFormLayout: (name: string, layout: unknown) => Promise<LumiResponse<{
|
|
2208
|
+
layout: unknown;
|
|
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>>;
|
|
1841
2216
|
};
|
|
1842
2217
|
items: <TName extends keyof TSchema & string>(name: TName) => {
|
|
1843
2218
|
list: (params?: ListItemsParams) => Promise<ListItemsResponse<TSchema[TName] extends Record<string, unknown> ? TSchema[TName] : Record<string, unknown>>>;
|
|
@@ -1846,6 +2221,8 @@ declare function legacyRest(): <TSchema extends DefaultSchema>(client: LumiClien
|
|
|
1846
2221
|
data: Partial<TSchema[TName] extends Record<string, unknown> ? TSchema[TName] : Record<string, unknown>>;
|
|
1847
2222
|
status?: string;
|
|
1848
2223
|
sort?: number;
|
|
2224
|
+
/** Tree collections (#749): parent item id; null/absent = root. */
|
|
2225
|
+
parentId?: string | null;
|
|
1849
2226
|
/** ISO timestamps for content scheduling (Publish_Window). */
|
|
1850
2227
|
publishAt?: string | null;
|
|
1851
2228
|
unpublishAt?: string | null;
|
|
@@ -1857,14 +2234,55 @@ declare function legacyRest(): <TSchema extends DefaultSchema>(client: LumiClien
|
|
|
1857
2234
|
/** ISO timestamps for content scheduling (Publish_Window). */
|
|
1858
2235
|
publishAt?: string | null;
|
|
1859
2236
|
unpublishAt?: string | null;
|
|
1860
|
-
}) => 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>>>>;
|
|
1861
2238
|
replace: (id: string, input: {
|
|
1862
2239
|
data: TSchema[TName] extends Record<string, unknown> ? TSchema[TName] : Record<string, unknown>;
|
|
1863
2240
|
status?: string;
|
|
1864
2241
|
sort?: number;
|
|
1865
|
-
}) => 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>>>>;
|
|
1866
2243
|
delete: (id: string) => Promise<LumiResponse<null>>;
|
|
2244
|
+
/**
|
|
2245
|
+
* Stream the collection as CSV or JSON (#727). Resolves with the
|
|
2246
|
+
* unread `Response`: pipe `res.body` to a file, or `await res.text()`.
|
|
2247
|
+
* Uses the caller's read permission; filters use the list syntax.
|
|
2248
|
+
*/
|
|
2249
|
+
export: (params?: ExportItemsParams) => Promise<Response>;
|
|
1867
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>>>>;
|
|
2272
|
+
/**
|
|
2273
|
+
* Hierarchical collections (#749) on a `meta.tree.enabled` collection.
|
|
2274
|
+
* Reads apply the caller's row rules; the anchor must be readable.
|
|
2275
|
+
*/
|
|
2276
|
+
tree: {
|
|
2277
|
+
children: (parent: string | null, params?: ListItemsParams) => Promise<ListItemsResponse<TSchema[TName] extends Record<string, unknown> ? TSchema[TName] : Record<string, unknown>>>;
|
|
2278
|
+
subtree: (parent: string | null, params?: ListItemsParams) => Promise<ListItemsResponse<TSchema[TName] extends Record<string, unknown> ? TSchema[TName] : Record<string, unknown>>>;
|
|
2279
|
+
ancestors: (node: string) => Promise<ListItemsResponse<TSchema[TName] extends Record<string, unknown> ? TSchema[TName] : Record<string, unknown>>>;
|
|
2280
|
+
/** Move an item and its subtree; `position` is its 0-based index among the new siblings. */
|
|
2281
|
+
move: (id: string, input: {
|
|
2282
|
+
parentId: string | null;
|
|
2283
|
+
position?: number;
|
|
2284
|
+
}) => Promise<LumiResponse<TreeMoveResult>>;
|
|
2285
|
+
};
|
|
1868
2286
|
listRevisions: (id: string) => Promise<LumiResponse<RevisionRow[]>>;
|
|
1869
2287
|
revertRevision: (id: string, revisionId: string) => Promise<LumiResponse<ItemRow<TSchema[TName] extends Record<string, unknown> ? TSchema[TName] : Record<string, unknown>>>>;
|
|
1870
2288
|
listPins: (id: string) => Promise<LumiResponse<{
|
|
@@ -1889,6 +2307,30 @@ declare function legacyRest(): <TSchema extends DefaultSchema>(client: LumiClien
|
|
|
1889
2307
|
promote: (id: string, key: string) => Promise<LumiResponse<ItemRow<TSchema[TName] extends Record<string, unknown> ? TSchema[TName] : Record<string, unknown>>>>;
|
|
1890
2308
|
};
|
|
1891
2309
|
};
|
|
2310
|
+
imports: {
|
|
2311
|
+
/**
|
|
2312
|
+
* Upload a CSV or JSON export file and queue it. Resolves with the job
|
|
2313
|
+
* (`202`); poll `get(id)` until `status` is terminal.
|
|
2314
|
+
*/
|
|
2315
|
+
create: (collection: string, file: Blob | string, opts?: {
|
|
2316
|
+
format?: "csv" | "json";
|
|
2317
|
+
mode?: "create" | "upsert";
|
|
2318
|
+
filename?: string;
|
|
2319
|
+
}) => Promise<LumiResponse<ImportJob>>;
|
|
2320
|
+
list: (params?: {
|
|
2321
|
+
collection?: string;
|
|
2322
|
+
status?: ImportJobStatus;
|
|
2323
|
+
limit?: number;
|
|
2324
|
+
}) => Promise<LumiResponse<ImportJob[]>>;
|
|
2325
|
+
get: (id: string) => Promise<LumiResponse<ImportJob>>;
|
|
2326
|
+
errors: (id: string) => Promise<LumiResponse<{
|
|
2327
|
+
errors: ImportRowError[];
|
|
2328
|
+
truncated: number;
|
|
2329
|
+
}>>;
|
|
2330
|
+
/** The error report as a CSV download (`row,id,message`). */
|
|
2331
|
+
errorsCsv: (id: string) => Promise<Response>;
|
|
2332
|
+
cancel: (id: string) => Promise<LumiResponse<ImportJob>>;
|
|
2333
|
+
};
|
|
1892
2334
|
roles: {
|
|
1893
2335
|
list: () => Promise<LumiResponse<RoleResource[]>>;
|
|
1894
2336
|
detail: (id: string) => Promise<LumiResponse<RoleDetail>>;
|
|
@@ -2001,6 +2443,17 @@ declare function legacyRest(): <TSchema extends DefaultSchema>(client: LumiClien
|
|
|
2001
2443
|
create: (input: ShareCreateInput) => Promise<LumiResponse<ShareSecretResult>>;
|
|
2002
2444
|
revoke: (id: string) => Promise<LumiResponse<ShareResource>>;
|
|
2003
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
|
+
};
|
|
2004
2457
|
me: {
|
|
2005
2458
|
getPreferences: () => Promise<LumiResponse<UserPreferencesPayload>>;
|
|
2006
2459
|
updatePreferences: (patch: UserPreferencesPayload) => Promise<LumiResponse<UserPreferencesPayload>>;
|
|
@@ -2157,12 +2610,60 @@ declare function legacyRest(): <TSchema extends DefaultSchema>(client: LumiClien
|
|
|
2157
2610
|
parent?: string | null;
|
|
2158
2611
|
}) => Promise<LumiResponse<FolderResource>>;
|
|
2159
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[]>>;
|
|
2160
2615
|
};
|
|
2161
2616
|
files: {
|
|
2162
|
-
|
|
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
|
+
};
|
|
2163
2657
|
create: (input: Record<string, unknown>) => Promise<LumiResponse<FileResource>>;
|
|
2164
2658
|
update: (id: string, patch: Record<string, unknown>) => Promise<LumiResponse<FileResource>>;
|
|
2165
|
-
|
|
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>>;
|
|
2166
2667
|
getPresignedUrl: (filename: string) => Promise<LumiResponse<{
|
|
2167
2668
|
url: string;
|
|
2168
2669
|
method: string;
|
|
@@ -2193,10 +2694,39 @@ declare function legacyRest(): <TSchema extends DefaultSchema>(client: LumiClien
|
|
|
2193
2694
|
create: (input: Record<string, unknown>) => Promise<LumiResponse<DeploymentTargetResource>>;
|
|
2194
2695
|
update: (id: string, patch: Record<string, unknown>) => Promise<LumiResponse<DeploymentTargetResource>>;
|
|
2195
2696
|
delete: (id: string) => Promise<LumiResponse<null>>;
|
|
2697
|
+
/**
|
|
2698
|
+
* Resolves with the deployment (201), or — when the target belongs to
|
|
2699
|
+
* an approval-gated environment (#743) — with a `pending_approval`
|
|
2700
|
+
* outcome (202).
|
|
2701
|
+
*/
|
|
2196
2702
|
deploy: (id: string, input?: {
|
|
2197
2703
|
branch?: string;
|
|
2198
2704
|
reason?: string;
|
|
2199
|
-
}) => Promise<LumiResponse<DeploymentResource
|
|
2705
|
+
}) => Promise<LumiResponse<DeploymentResource | {
|
|
2706
|
+
status: "pending_approval";
|
|
2707
|
+
environment: string;
|
|
2708
|
+
approval: DeploymentApprovalResource;
|
|
2709
|
+
}>>;
|
|
2710
|
+
};
|
|
2711
|
+
access: () => Promise<LumiResponse<DeploymentAccessResource>>;
|
|
2712
|
+
environments: {
|
|
2713
|
+
list: () => Promise<LumiResponse<DeploymentEnvironmentResource[]>>;
|
|
2714
|
+
update: (environments: DeploymentEnvironmentResource[]) => Promise<LumiResponse<DeploymentEnvironmentResource[]>>;
|
|
2715
|
+
deploy: (key: string, input?: {
|
|
2716
|
+
branch?: string;
|
|
2717
|
+
reason?: string;
|
|
2718
|
+
}) => Promise<LumiResponse<DeploymentRequestOutcome>>;
|
|
2719
|
+
promote: (key: string, input?: {
|
|
2720
|
+
deploymentId?: string;
|
|
2721
|
+
reason?: string;
|
|
2722
|
+
}) => Promise<LumiResponse<DeploymentRequestOutcome>>;
|
|
2723
|
+
};
|
|
2724
|
+
approvals: {
|
|
2725
|
+
list: (status?: string) => Promise<LumiResponse<DeploymentApprovalResource[]>>;
|
|
2726
|
+
decide: (id: string, input: {
|
|
2727
|
+
decision: "approved" | "rejected";
|
|
2728
|
+
reason?: string;
|
|
2729
|
+
}) => Promise<LumiResponse<DeploymentApprovalResource>>;
|
|
2200
2730
|
};
|
|
2201
2731
|
list: (params?: {
|
|
2202
2732
|
targetId?: string;
|
|
@@ -2685,6 +3215,12 @@ interface TypegenCollection {
|
|
|
2685
3215
|
interface TypegenField {
|
|
2686
3216
|
name: string;
|
|
2687
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;
|
|
2688
3224
|
required: boolean;
|
|
2689
3225
|
nullable: boolean;
|
|
2690
3226
|
readonly?: boolean;
|
|
@@ -2696,6 +3232,10 @@ interface TypegenField {
|
|
|
2696
3232
|
kind?: 'm2o' | 'o2m' | 'm2m' | 'm2a';
|
|
2697
3233
|
target?: string;
|
|
2698
3234
|
enum?: string[];
|
|
3235
|
+
/** Timezone-aware datetime (#747): value is `{ instant, tz, offset }`. */
|
|
3236
|
+
timezone?: boolean;
|
|
3237
|
+
/** Dynamic zones (#748): block template names a `blocks` field accepts. */
|
|
3238
|
+
allowedBlocks?: string[];
|
|
2699
3239
|
}
|
|
2700
3240
|
interface TypegenRelation {
|
|
2701
3241
|
field: string;
|
|
@@ -2706,7 +3246,101 @@ interface TypegenRelation {
|
|
|
2706
3246
|
oneCollection?: string;
|
|
2707
3247
|
oneField?: string | null;
|
|
2708
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
|
+
};
|
|
2709
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;
|
|
2710
3344
|
|
|
2711
3345
|
/** Default module specifier the generated file imports `ID` / `Locale` / `Brand` from. */
|
|
2712
3346
|
declare const DEFAULT_IMPORT_SOURCE = "@lumibase/sdk";
|
|
@@ -2750,5 +3384,5 @@ declare function toNextMetadata(item: unknown): Record<string, unknown>;
|
|
|
2750
3384
|
*/
|
|
2751
3385
|
declare function jsonLdScript(item: unknown): string | undefined;
|
|
2752
3386
|
|
|
2753
|
-
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 };
|
|
2754
|
-
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, DeploymentResource, DeploymentTargetResource, DomainCreateInput, DomainResource, DomainVerificationRecord, ExtensionResource, FieldDeleteOptions, FieldInput, FieldMutationOptions, FieldRenameInput, FieldResource, FileResource, FlowGraph, FlowNode, FlowResource, FlowRun, FlowRunResult, FlowRunStatus, FlowStatus, FlowTriggerType, FolderResource, GenerateOptions, GrantAction, GraphQLExtension, ID, ItemFilter, ItemFilterOp, ItemRow, ListItemsParams, ListItemsResponse, ListMarketplaceExtensionsParams, Locale, LumiClient, LumiClientOptions, LumiErrorBody, LumiResponse, 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, TypegenCollection, TypegenField, TypegenManifest, TypegenRelation, TypegenSchemaFilters, UploadConfigResource, UploadTypeCatalogueEntry, UserPreferencesPayload, UserResource, VersionCompare, VersionFieldChange, ViewPreset, WebSocketFactory, WebSocketLike, WebhookResource };
|
|
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 };
|