@relyio/sdk 0.6.0 → 0.7.0

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.
Files changed (37) hide show
  1. package/CHANGELOG.md +370 -0
  2. package/dist/.tsbuildinfo +1 -1
  3. package/dist/{chunk-DY2XT7OF.cjs → chunk-72UK5U7T.cjs} +70 -60
  4. package/dist/{chunk-7ABNXVWL.js → chunk-GYHAVYND.js} +777 -399
  5. package/dist/{chunk-I3ESNANB.js → chunk-H6IBQSMM.js} +2 -2
  6. package/dist/{chunk-HT6NFRM2.cjs → chunk-TZL374LS.cjs} +2 -2
  7. package/dist/{chunk-GCMQUM6N.cjs → chunk-VH2DE7HZ.cjs} +776 -402
  8. package/dist/{chunk-XJVY2CLY.js → chunk-YEJUMW4X.js} +70 -60
  9. package/dist/client/index.cjs +4 -3
  10. package/dist/client/index.d.cts +4 -4
  11. package/dist/client/index.d.ts +4 -4
  12. package/dist/client/index.js +2 -1
  13. package/dist/{index-d1Kz1e19.d.cts → define-content-type-DiVpbwNs.d.cts} +1615 -684
  14. package/dist/{index-yPbhZc6q.d.ts → define-content-type-DiVpbwNs.d.ts} +1615 -684
  15. package/dist/{define-schema-1kr2HIzN.d.cts → define-schema-C-5an28C.d.ts} +189 -85
  16. package/dist/{define-schema-ChvAzY8H.d.ts → define-schema-D7MButVt.d.cts} +189 -85
  17. package/dist/{index-XqoGUaAY.d.ts → index-1G97sNA8.d.ts} +489 -267
  18. package/dist/index-BOQIHnsh.d.ts +818 -0
  19. package/dist/index-DbsTUw3Q.d.cts +818 -0
  20. package/dist/{index-Df1VsfJR.d.cts → index-M0X45k7J.d.cts} +489 -267
  21. package/dist/index.cjs +98 -114
  22. package/dist/index.d.cts +31 -31
  23. package/dist/index.d.ts +31 -31
  24. package/dist/index.js +8 -8
  25. package/dist/schema/index.cjs +35 -35
  26. package/dist/schema/index.d.cts +13 -11
  27. package/dist/schema/index.d.ts +13 -11
  28. package/dist/schema/index.js +1 -1
  29. package/dist/types/index.d.cts +2 -2
  30. package/dist/types/index.d.ts +2 -2
  31. package/dist/utils/index.cjs +19 -19
  32. package/dist/utils/index.d.cts +10 -1
  33. package/dist/utils/index.d.ts +10 -1
  34. package/dist/utils/index.js +1 -1
  35. package/package.json +4 -3
  36. package/dist/define-content-type-CDB3kyeA.d.cts +0 -1173
  37. package/dist/define-content-type-CDB3kyeA.d.ts +0 -1173
@@ -1,5 +1,3 @@
1
- import { P as EntryMetadata } from './define-content-type-CDB3kyeA.js';
2
-
3
1
  /**
4
2
  * Generated by scripts/emit-openapi-types.mjs from @relyio/api's committed
5
3
  * openapi-spec.json. Do not edit: run `pnpm codegen:openapi` in this package, which
@@ -237,7 +235,11 @@ interface paths {
237
235
  path?: never;
238
236
  cookie?: never;
239
237
  };
240
- get?: never;
238
+ /**
239
+ * Read a file binding's upload status
240
+ * @description Where the binding's upload got to — `status` and `processing` (stage, progress, error) — whatever the asset entry is published in. Takes the capability the upload routes take, so a key that could have uploaded the file can see whether it failed; the entry itself is read through the key's own lens.
241
+ */
242
+ get: operations['getFileStatus'];
241
243
  put?: never;
242
244
  post?: never;
243
245
  /** Delete a file binding */
@@ -837,6 +839,111 @@ interface paths {
837
839
  }
838
840
  interface components {
839
841
  schemas: {
842
+ /** @description An asset entry’s `file`: the binary’s lifecycle and what was read from it, at the locale the entry’s fields were composed for. Sent beside the asset’s fields on every read of it, with `urls` once `status` is `ready`. How storage addresses the bytes is not part of it. */
843
+ AssetFile: {
844
+ /**
845
+ * @description Where the binary is: `pending_upload` before any bytes, `uploading` once presigned, `processing` once the pipeline has it, then `ready` or `failed`. Independent of the entry’s publication.
846
+ * @enum {string}
847
+ */
848
+ status: 'failed' | 'pending_upload' | 'processing' | 'ready' | 'uploading';
849
+ /**
850
+ * @description `r2` for image and file kinds, `stream` for video.
851
+ * @enum {string}
852
+ */
853
+ backend: 'r2' | 'stream';
854
+ fileName: string;
855
+ mimeType?: string | null;
856
+ /** @description In bytes. */
857
+ size?: number | null;
858
+ /** @description The SHA-256 the client declared: advisory, for duplicate detection only. */
859
+ hash?: string | null;
860
+ /**
861
+ * @description Enforced by the delivery gateway; a `protected` or `private` URL carries a token.
862
+ * @enum {string}
863
+ */
864
+ visibility: 'private' | 'protected' | 'public';
865
+ /** @description What was read from the file. Enrichment adds keys as its stages finish, so the object is open beyond the ones named here. */
866
+ extracted?: {
867
+ width?: number;
868
+ height?: number;
869
+ format?: string;
870
+ duration?: number;
871
+ hasAlpha?: boolean;
872
+ isAnimated?: boolean;
873
+ orientation?: number;
874
+ placeholder?: string;
875
+ dominantColor?: string;
876
+ palette?: string[];
877
+ exif?: {
878
+ [key: string]: unknown;
879
+ };
880
+ video?: {
881
+ codec?: string;
882
+ bitrate?: number;
883
+ framerate?: number;
884
+ audioTracks?: unknown[];
885
+ } & {
886
+ [key: string]: unknown;
887
+ };
888
+ pageCount?: number;
889
+ text?: string;
890
+ safety?: {
891
+ nsfwScore?: number;
892
+ flagged?: boolean;
893
+ categories?: string[];
894
+ } & {
895
+ [key: string]: unknown;
896
+ };
897
+ } & {
898
+ [key: string]: unknown;
899
+ };
900
+ /** @description The smart-crop anchor, each axis `0`–`1`. */
901
+ focalPoint?: {
902
+ x: number;
903
+ y: number;
904
+ };
905
+ /** @description Where metadata enrichment got to. Independent of `status`. */
906
+ enrichment?: {
907
+ /** @enum {string} */
908
+ status: 'complete' | 'failed' | 'partial' | 'pending' | 'running';
909
+ };
910
+ /** @description The malware scan of a file-kind binding. */
911
+ scan?: {
912
+ /** @enum {string} */
913
+ status: 'clean' | 'error' | 'infected' | 'pending' | 'skipped';
914
+ };
915
+ processing?: components['schemas']['AssetFileProcessing'];
916
+ /** @description Whether a video can be played yet. */
917
+ playback?: {
918
+ ready?: boolean;
919
+ };
920
+ };
921
+ /** @description Where the pipeline got to with a file, and why it failed. Present when the pipeline recorded a stage, a progress or an error. */
922
+ AssetFileProcessing: {
923
+ /** @description The stage the pipeline last recorded. */
924
+ stage?: string;
925
+ /** @description How far the pipeline got, `0`–`100`, where it reports that (video encoding). */
926
+ progress?: number;
927
+ /** @description Why the file failed. Present exactly while `status` is `failed`. */
928
+ error?: {
929
+ /** @description The reason, e.g. `UNSUPPORTED_MIME`, `UPLOAD_TOO_LARGE` or `INTERNAL`. */
930
+ code?: string;
931
+ message?: string;
932
+ /** @description `true` only for `INTERNAL`, a failure no property of the file caused. */
933
+ retriable?: boolean;
934
+ };
935
+ };
936
+ /** @description One distinct value of the field, and the entry it was first found in. */
937
+ AutocompleteSuggestion: {
938
+ /** @description The suggested value. */
939
+ text: string;
940
+ /** @description The best relevance among the entries holding it. */
941
+ score: number;
942
+ /** @description An entry holding the value. */
943
+ id: string;
944
+ /** @description The value with its matched part wrapped in `<em>`, when Atlas highlighted it. */
945
+ highlight?: string;
946
+ };
840
947
  /** @description One change to one entry, ids only. Refetch the entry through the ordinary read path to see it. */
841
948
  Change: {
842
949
  entryId: string;
@@ -852,6 +959,104 @@ interface components {
852
959
  nextCursor: string | null;
853
960
  hasMore: boolean;
854
961
  };
962
+ /** @description One entry: its fields at the top level, as the content type declares them, and `_metadata`. An asset entry also carries `file`, an `AssetFile`, and `urls` once the file is ready. */
963
+ Entry: {
964
+ _metadata: components['schemas']['EntryMetadata'];
965
+ } & {
966
+ [key: string]: unknown;
967
+ };
968
+ /** @description One locale an entry has content in. */
969
+ EntryLocale: {
970
+ code: string;
971
+ /** @enum {string} */
972
+ status: 'archived' | 'draft' | 'published';
973
+ /** @description That locale’s own version counter. */
974
+ version: number;
975
+ /**
976
+ * Format: date-time
977
+ * @description When that locale was last published. Absent until it is.
978
+ */
979
+ publishedAt?: string;
980
+ };
981
+ /** @description What this service reports about an entry beside its fields. */
982
+ EntryMetadata: {
983
+ id: string;
984
+ /** @description The content type. */
985
+ type: string;
986
+ /** @enum {string} */
987
+ entryType: 'asset' | 'content' | 'settings' | 'singleton';
988
+ /** @description The slug field’s value at `locale`, or null when the type declares none. */
989
+ slug: string | null;
990
+ /**
991
+ * @description Container lifecycle only. Publication is per locale: `localeStatus`.
992
+ * @enum {string}
993
+ */
994
+ status: 'active' | 'archived' | 'proposed';
995
+ /** @description The reported locale’s own version counter — not the entry’s shared-field counter. `0` when that locale has no content of its own. With `id` and `locale`, it is what `X-Entity-Tag` is minted from. */
996
+ version: number;
997
+ /** @description The locale the fields beside this object were composed for. */
998
+ locale: string;
999
+ /** @description How many versions `locale` has. Sent on a single-entry read; a list leaves it out. */
1000
+ versionCount?: number;
1001
+ /** @description `locale`’s version numbers, newest first, at most 25. Sent on a single-entry read; a list leaves it out. */
1002
+ versions?: number[];
1003
+ /**
1004
+ * @description Publication state of `locale`. Absent when that locale has no content of its own: what is visible in it is inherited through the fallback chain.
1005
+ * @enum {string}
1006
+ */
1007
+ localeStatus?: 'archived' | 'draft' | 'published';
1008
+ /** @description Whether `locale` has unpublished changes of its own. */
1009
+ localeHasDraft: boolean;
1010
+ /** @description Every locale holding unpublished content, sorted. A shared-field draft is listed under the default locale. */
1011
+ draftLocales: string[];
1012
+ /** @description The locale the request named, when it named one other than the default. On `?locales=a,b,c` it is always sent: the primary, or `*` when the list names as many locales as the entry has — as on `?locale=*`. */
1013
+ requestedLocale?: string;
1014
+ /** @description The schema’s default locale. */
1015
+ defaultLocale: string;
1016
+ /** @description Whether the shared (non-localized) fields have unpublished changes. */
1017
+ hasDraft: boolean;
1018
+ /** @description Each field whose value came from another locale, mapped to that locale. Absent when none did. */
1019
+ localeFallbacksApplied?: {
1020
+ [key: string]: string;
1021
+ };
1022
+ /** @description Every locale the entry has content in, the default first. */
1023
+ availableLocales: components['schemas']['EntryLocale'][];
1024
+ /** @description The fields of every other locale asked for, keyed by locale — on `?locales=a,b` and `?locale=*`. A locale with no visible fields is left out. */
1025
+ localizations?: {
1026
+ [key: string]: {
1027
+ [key: string]: unknown;
1028
+ };
1029
+ };
1030
+ /**
1031
+ * Format: date-time
1032
+ * @description When the entry was created.
1033
+ */
1034
+ createdAt: string;
1035
+ /**
1036
+ * Format: date-time
1037
+ * @description When the entry was last written.
1038
+ */
1039
+ updatedAt: string;
1040
+ /**
1041
+ * Format: date-time
1042
+ * @description When the entry was last published. Absent until it is.
1043
+ */
1044
+ publishedAt?: string;
1045
+ /**
1046
+ * Format: date-time
1047
+ * @description When the entry was first published. Absent until it is.
1048
+ */
1049
+ firstPublishedAt?: string;
1050
+ /** @description The entry’s outgoing references, across every locale, each once. */
1051
+ refs: components['schemas']['EntryRef'][];
1052
+ };
1053
+ /** @description One outgoing reference. */
1054
+ EntryRef: {
1055
+ /** @description The declaring field’s path — `hero.link` for a reference inside a component. */
1056
+ path: string;
1057
+ /** @description The referenced entry’s id. */
1058
+ entryUid: string;
1059
+ };
855
1060
  ErrorResponse: {
856
1061
  error: {
857
1062
  /** @enum {string} */
@@ -862,6 +1067,15 @@ interface components {
862
1067
  };
863
1068
  };
864
1069
  };
1070
+ /** @description Where a binding’s upload got to — its lifecycle and nothing of the entry: no fields, no URL. */
1071
+ FileStatus: {
1072
+ /**
1073
+ * @description Where the binary is: `pending_upload` before any bytes, `uploading` once presigned, `processing` once the pipeline has it, then `ready` or `failed`. Independent of the entry’s publication.
1074
+ * @enum {string}
1075
+ */
1076
+ status: 'failed' | 'pending_upload' | 'processing' | 'ready' | 'uploading';
1077
+ processing?: components['schemas']['AssetFileProcessing'];
1078
+ };
865
1079
  MultiPayload: {
866
1080
  results: (components['schemas']['SubSuccess'] | components['schemas']['SubFailure'])[];
867
1081
  summary: components['schemas']['MultiSummary'];
@@ -1035,6 +1249,213 @@ interface components {
1035
1249
  };
1036
1250
  };
1037
1251
  };
1252
+ /** @description How a hit’s relevance was reached. Sent on a search that asked for `explain`. */
1253
+ ScoreBreakdown: {
1254
+ keyword: number;
1255
+ semantic: number;
1256
+ combined: number;
1257
+ };
1258
+ /** @description One highlighted match, as Atlas Search reports it: the path it matched on and the text around the match, split into `hit` and `text` runs. */
1259
+ SearchHighlight: {
1260
+ path: string;
1261
+ score: number;
1262
+ texts: ({
1263
+ value: string;
1264
+ /** @enum {string} */
1265
+ type: 'hit' | 'text';
1266
+ } & {
1267
+ [key: string]: unknown;
1268
+ })[];
1269
+ } & {
1270
+ [key: string]: unknown;
1271
+ };
1272
+ /** @description One hit: the entry’s fields at the top level — at `_metadata.locale`, or only the aliases a `fields` projection names — its `_metadata`, and the score annotations the request asked for. Not an entry read: see `SearchHitMetadata`. */
1273
+ SearchHit: {
1274
+ _metadata: components['schemas']['SearchHitMetadata'];
1275
+ /** @description Relevance. Sent on a search that asked for `includeScore`, and on every similar hit. */
1276
+ _score?: number;
1277
+ _scoreBreakdown?: components['schemas']['ScoreBreakdown'];
1278
+ /** @description Sent when the search asked for `highlight` and Atlas matched a highlighted path. */
1279
+ _highlights?: components['schemas']['SearchHighlight'][];
1280
+ } & {
1281
+ [key: string]: unknown;
1282
+ };
1283
+ /** @description What this service reports about a hit beside its fields. Narrower than an entry read’s `EntryMetadata`: a hit is built from the search row, so it carries no `entryType`, `defaultLocale`, `availableLocales`, `refs`, `firstPublishedAt` or version history — read the entry for those. */
1284
+ SearchHitMetadata: {
1285
+ id: string;
1286
+ /** @description The content type. */
1287
+ type: string;
1288
+ /** @description The slug field’s value at `locale`, or null when the type declares none. */
1289
+ slug: string | null;
1290
+ /**
1291
+ * @description Container lifecycle only. Publication is per locale: `localeStatus`.
1292
+ * @enum {string}
1293
+ */
1294
+ status: 'active' | 'archived' | 'proposed';
1295
+ /** @description The reported locale’s own version counter — not the entry’s shared-field counter. `0` when that locale has no content of its own. With `id` and `locale`, it is what `X-Entity-Tag` is minted from. */
1296
+ version: number;
1297
+ /** @description The locale the fields beside this object were composed for. */
1298
+ locale: string;
1299
+ /**
1300
+ * @description Publication state of `locale`. Absent when that locale has no content of its own: what is visible in it is inherited through the fallback chain.
1301
+ * @enum {string}
1302
+ */
1303
+ localeStatus?: 'archived' | 'draft' | 'published';
1304
+ /** @description Whether `locale` has unpublished changes of its own. */
1305
+ localeHasDraft: boolean;
1306
+ /** @description Every locale holding unpublished content, sorted. A shared-field draft is listed under the default locale. */
1307
+ draftLocales: string[];
1308
+ /** @description Whether the shared (non-localized) fields have unpublished changes. */
1309
+ hasDraft: boolean;
1310
+ /**
1311
+ * Format: date-time
1312
+ * @description When the entry was created.
1313
+ */
1314
+ createdAt: string;
1315
+ /**
1316
+ * Format: date-time
1317
+ * @description When the entry was last written.
1318
+ */
1319
+ updatedAt: string;
1320
+ /**
1321
+ * Format: date-time
1322
+ * @description When the entry was last published. Absent until it is.
1323
+ */
1324
+ publishedAt?: string;
1325
+ };
1326
+ /** @description One settings group: its fields at the top level, as the group declares them, and `_metadata`. */
1327
+ SettingsGroup: {
1328
+ _metadata: components['schemas']['SettingsGroupMetadata'];
1329
+ } & {
1330
+ [key: string]: unknown;
1331
+ };
1332
+ /** @description One group on the listing: its fields at the top level — its declared defaults until it is first written — and `_metadata`. */
1333
+ SettingsGroupListing: {
1334
+ _metadata: components['schemas']['SettingsGroupListingMetadata'];
1335
+ } & {
1336
+ [key: string]: unknown;
1337
+ };
1338
+ /** @description The group as the schema declares it, and — once the group has been written — what a single read reports about it, less the version history. */
1339
+ SettingsGroupListingMetadata: {
1340
+ /** @description The group’s name, as the schema declares it. */
1341
+ displayName: string;
1342
+ /** @description The group’s description, when the schema declares one. */
1343
+ description?: string;
1344
+ } | {
1345
+ id: string;
1346
+ /** @description The settings group. */
1347
+ groupId: string;
1348
+ /** @description The reported locale’s own version counter — not the entry’s shared-field counter. `0` when that locale has no content of its own. With `id` and `locale`, it is what `X-Entity-Tag` is minted from. */
1349
+ version: number;
1350
+ /** @description The locale the fields beside this object were composed for. */
1351
+ locale: string;
1352
+ /**
1353
+ * @description Publication state of `locale`. Absent when that locale has no content of its own: what is visible in it is inherited through the fallback chain.
1354
+ * @enum {string}
1355
+ */
1356
+ localeStatus?: 'archived' | 'draft' | 'published';
1357
+ /** @description Whether `locale` has unpublished changes of its own. */
1358
+ localeHasDraft: boolean;
1359
+ /** @description Every locale holding unpublished content, sorted. A shared-field draft is listed under the default locale. */
1360
+ draftLocales: string[];
1361
+ /**
1362
+ * Format: date-time
1363
+ * @description When the group was last written.
1364
+ */
1365
+ updatedAt: string;
1366
+ /** @description The group’s name, as the schema declares it. */
1367
+ displayName: string;
1368
+ /** @description The group’s description, when the schema declares one. */
1369
+ description?: string;
1370
+ };
1371
+ /** @description What this service reports about a settings group beside its fields: the group, the per-locale facts and when it was last written. */
1372
+ SettingsGroupMetadata: {
1373
+ id: string;
1374
+ /** @description The settings group. */
1375
+ groupId: string;
1376
+ /** @description The reported locale’s own version counter — not the entry’s shared-field counter. `0` when that locale has no content of its own. With `id` and `locale`, it is what `X-Entity-Tag` is minted from. */
1377
+ version: number;
1378
+ /** @description The locale the fields beside this object were composed for. */
1379
+ locale: string;
1380
+ /** @description How many versions `locale` has. */
1381
+ versionCount: number;
1382
+ /** @description `locale`’s version numbers, newest first, at most 25. */
1383
+ versions: number[];
1384
+ /**
1385
+ * @description Publication state of `locale`. Absent when that locale has no content of its own: what is visible in it is inherited through the fallback chain.
1386
+ * @enum {string}
1387
+ */
1388
+ localeStatus?: 'archived' | 'draft' | 'published';
1389
+ /** @description Whether `locale` has unpublished changes of its own. */
1390
+ localeHasDraft: boolean;
1391
+ /** @description Every locale holding unpublished content, sorted. A shared-field draft is listed under the default locale. */
1392
+ draftLocales: string[];
1393
+ /**
1394
+ * Format: date-time
1395
+ * @description When the group was last written.
1396
+ */
1397
+ updatedAt: string;
1398
+ };
1399
+ /** @description Every settings group the schema declares, keyed by group id, at the locale the request resolved to. */
1400
+ SettingsGroups: {
1401
+ [key: string]: components['schemas']['SettingsGroupListing'];
1402
+ };
1403
+ /** @description One singleton: its fields at the top level, as the singleton type declares them, and `_metadata`. */
1404
+ Singleton: {
1405
+ _metadata: components['schemas']['SingletonMetadata'];
1406
+ } & {
1407
+ [key: string]: unknown;
1408
+ };
1409
+ /** @description What this service reports about a singleton beside its fields. Narrower than an entry’s: no slug, no default locale, no available locales, no references. */
1410
+ SingletonMetadata: {
1411
+ id: string;
1412
+ /** @description The singleton type. */
1413
+ type: string;
1414
+ /**
1415
+ * @description Container lifecycle only. Publication is per locale: `localeStatus`.
1416
+ * @enum {string}
1417
+ */
1418
+ status: 'active' | 'archived' | 'proposed';
1419
+ /** @description The reported locale’s own version counter — not the entry’s shared-field counter. `0` when that locale has no content of its own. With `id` and `locale`, it is what `X-Entity-Tag` is minted from. */
1420
+ version: number;
1421
+ /** @description The locale the fields beside this object were composed for. */
1422
+ locale: string;
1423
+ /** @description How many versions `locale` has. */
1424
+ versionCount: number;
1425
+ /** @description `locale`’s version numbers, newest first, at most 25. */
1426
+ versions: number[];
1427
+ /**
1428
+ * @description Publication state of `locale`. Absent when that locale has no content of its own: what is visible in it is inherited through the fallback chain.
1429
+ * @enum {string}
1430
+ */
1431
+ localeStatus?: 'archived' | 'draft' | 'published';
1432
+ /** @description Whether `locale` has unpublished changes of its own. */
1433
+ localeHasDraft: boolean;
1434
+ /** @description Every locale holding unpublished content, sorted. A shared-field draft is listed under the default locale. */
1435
+ draftLocales: string[];
1436
+ /** @description Whether the shared (non-localized) fields have unpublished changes. */
1437
+ hasDraft: boolean;
1438
+ /**
1439
+ * Format: date-time
1440
+ * @description When the singleton was created.
1441
+ */
1442
+ createdAt: string;
1443
+ /**
1444
+ * Format: date-time
1445
+ * @description When the singleton was last written.
1446
+ */
1447
+ updatedAt: string;
1448
+ /**
1449
+ * Format: date-time
1450
+ * @description When the singleton was last published. Absent until it is.
1451
+ */
1452
+ publishedAt?: string;
1453
+ /**
1454
+ * Format: date-time
1455
+ * @description When the singleton was first published. Absent until it is.
1456
+ */
1457
+ firstPublishedAt?: string;
1458
+ };
1038
1459
  SubFailure: {
1039
1460
  index: number;
1040
1461
  id?: string;
@@ -1778,8 +2199,7 @@ interface operations {
1778
2199
  };
1779
2200
  content: {
1780
2201
  'application/json': {
1781
- /** @description The payload itself. */
1782
- data: unknown;
2202
+ data: components['schemas']['Entry'];
1783
2203
  };
1784
2204
  };
1785
2205
  };
@@ -2156,6 +2576,94 @@ interface operations {
2156
2576
  };
2157
2577
  };
2158
2578
  };
2579
+ getFileStatus: {
2580
+ parameters: {
2581
+ query?: never;
2582
+ header?: never;
2583
+ path: {
2584
+ contentType: string;
2585
+ id: string;
2586
+ };
2587
+ cookie?: never;
2588
+ };
2589
+ requestBody?: never;
2590
+ responses: {
2591
+ /** @description Success. */
2592
+ 200: {
2593
+ headers: {
2594
+ [name: string]: unknown;
2595
+ };
2596
+ content: {
2597
+ 'application/json': {
2598
+ data: components['schemas']['FileStatus'];
2599
+ };
2600
+ };
2601
+ };
2602
+ /** @description CONTENT_INVALID, REQUEST_INVALID */
2603
+ 400: {
2604
+ headers: {
2605
+ [name: string]: unknown;
2606
+ };
2607
+ content: {
2608
+ 'application/json': components['schemas']['RefusalContentInvalidOrRequestInvalid'];
2609
+ };
2610
+ };
2611
+ /** @description INVALID_API_KEY, MISSING_API_KEY */
2612
+ 401: {
2613
+ headers: {
2614
+ [name: string]: unknown;
2615
+ };
2616
+ content: {
2617
+ 'application/json': components['schemas']['RefusalInvalidApiKeyOrMissingApiKey'];
2618
+ };
2619
+ };
2620
+ /** @description ACCESS_DENIED, PLAN_FEATURE_UNAVAILABLE, READ_ONLY_KEY, USAGE_QUOTA_EXCEEDED */
2621
+ 403: {
2622
+ headers: {
2623
+ [name: string]: unknown;
2624
+ };
2625
+ content: {
2626
+ 'application/json': components['schemas']['RefusalAccessDeniedOrPlanFeatureUnavailableOrReadOnlyKeyOrUsageQuotaExceeded'];
2627
+ };
2628
+ };
2629
+ /** @description RESOURCE_NOT_FOUND */
2630
+ 404: {
2631
+ headers: {
2632
+ [name: string]: unknown;
2633
+ };
2634
+ content: {
2635
+ 'application/json': components['schemas']['RefusalResourceNotFound'];
2636
+ };
2637
+ };
2638
+ /** @description RATE_LIMIT_EXCEEDED */
2639
+ 429: {
2640
+ headers: {
2641
+ [name: string]: unknown;
2642
+ };
2643
+ content: {
2644
+ 'application/json': components['schemas']['RefusalRateLimitExceeded'];
2645
+ };
2646
+ };
2647
+ /** @description INTERNAL_ERROR */
2648
+ 500: {
2649
+ headers: {
2650
+ [name: string]: unknown;
2651
+ };
2652
+ content: {
2653
+ 'application/json': components['schemas']['RefusalInternalError'];
2654
+ };
2655
+ };
2656
+ /** @description SERVICE_INDETERMINATE */
2657
+ 503: {
2658
+ headers: {
2659
+ [name: string]: unknown;
2660
+ };
2661
+ content: {
2662
+ 'application/json': components['schemas']['RefusalServiceIndeterminate'];
2663
+ };
2664
+ };
2665
+ };
2666
+ };
2159
2667
  deleteFileBinding: {
2160
2668
  parameters: {
2161
2669
  query?: never;
@@ -4455,7 +4963,7 @@ interface operations {
4455
4963
  };
4456
4964
  content: {
4457
4965
  'application/json': {
4458
- data: unknown[];
4966
+ data: components['schemas']['SearchHit'][];
4459
4967
  page: components['schemas']['OffsetPage'];
4460
4968
  meta: {
4461
4969
  [key: string]: unknown;
@@ -4546,7 +5054,7 @@ interface operations {
4546
5054
  };
4547
5055
  content: {
4548
5056
  'application/json': {
4549
- data: unknown[];
5057
+ data: components['schemas']['AutocompleteSuggestion'][];
4550
5058
  page: components['schemas']['OffsetPage'];
4551
5059
  meta: {
4552
5060
  [key: string]: unknown;
@@ -4628,7 +5136,7 @@ interface operations {
4628
5136
  };
4629
5137
  content: {
4630
5138
  'application/json': {
4631
- data: unknown[];
5139
+ data: components['schemas']['SearchHit'][];
4632
5140
  page: components['schemas']['OffsetPage'];
4633
5141
  meta: {
4634
5142
  [key: string]: unknown;
@@ -4721,8 +5229,7 @@ interface operations {
4721
5229
  };
4722
5230
  content: {
4723
5231
  'application/json': {
4724
- /** @description The payload itself. */
4725
- data: unknown;
5232
+ data: components['schemas']['SettingsGroups'];
4726
5233
  };
4727
5234
  };
4728
5235
  };
@@ -4805,8 +5312,7 @@ interface operations {
4805
5312
  };
4806
5313
  content: {
4807
5314
  'application/json': {
4808
- /** @description The payload itself. */
4809
- data: unknown;
5315
+ data: components['schemas']['SettingsGroup'];
4810
5316
  };
4811
5317
  };
4812
5318
  };
@@ -5381,8 +5887,7 @@ interface operations {
5381
5887
  };
5382
5888
  content: {
5383
5889
  'application/json': {
5384
- /** @description The payload itself. */
5385
- data: unknown;
5890
+ data: components['schemas']['Singleton'];
5386
5891
  };
5387
5892
  };
5388
5893
  };
@@ -5828,779 +6333,1205 @@ interface operations {
5828
6333
  }
5829
6334
 
5830
6335
  /**
5831
- * Where the SDK's transport gets its truth.
5832
- *
5833
- * Every route this client calls is named by its **path template as the
5834
- * committed document spells it**, and the body type it expects is read out of
5835
- * that document rather than written down here. `api-schema.ts` beside this file
5836
- * is generated by `pnpm api:types` from `apps/services/api/openapi-spec.json`,
5837
- * which is itself generated from that service's `RouteContract`s
5838
- * (`INV-API-DOCUMENT-IS-DERIVED`). So the chain is: one declaration in
5839
- * `routes.ts` → the serializer that produces the body → the document → these
5840
- * types → the method that reads it.
5841
- *
5842
- * That chain is the answer to the question this phase exists to close. Before
5843
- * it, six SDK methods read a key the server does not send; each had no caller
5844
- * and no test, so nothing could see them. Now:
5845
- *
5846
- * - A route that changes **kind** — `collection` to `object`, say — changes
5847
- * whether the document's 200 body carries `page` and whether `data` is an
5848
- * array. `Wire<…>` follows, `readPayload` follows, and the method's declared
5849
- * return type stops matching. `tsc` names the method.
5850
- * - A route that changes **path** or is deleted stops being a `keyof paths`, so
5851
- * the call site fails on the literal.
5852
- * - A route that changes **dialect** changes `page` from `CursorPage` to
5853
- * `OffsetPage`, and anything reading `nextCursor` fails.
5854
- *
5855
- * `/v1` lives in these templates because it lives in the document
5856
- * (`INV-API-VERSION-IS-DECIDED-ONCE`). Before this phase the SDK's base URL was
5857
- * `https://api.relyio.com` and its paths were `/{contentType}`, so every
5858
- * versioned request went to a path the router does not serve.
6336
+ * Field type definitions matching @relyio/schema package
5859
6337
  *
5860
- * Spec: `devtools/docs/guide/engineering/api-contract-spec.md`,
5861
- * `INV-API-CLIENT-IS-DERIVED`.
6338
+ * Every config option here is spelled as `@relyio/schema`'s field config schema spells it, because
6339
+ * the CLI sends a field's `config` to deploy verbatim, and deploy — and `relyio validate` before it —
6340
+ * refuses an option the field's type does not declare, naming its path (REL-1480). This package does
6341
+ * not depend on `@relyio/schema`, so the
6342
+ * options are pinned from `@relyio/codegen-typescript`, which depends on both: its
6343
+ * `src/__tests__/sdk-field-config.types.ts` fails to compile when a key, whether it is required, or
6344
+ * the values it accepts differs between the two (REL-1408).
5862
6345
  */
5863
-
5864
- /** Every path the committed document declares. */
5865
- type ApiPath = keyof paths;
5866
- type Verb = 'get' | 'post' | 'put' | 'patch' | 'delete';
5867
- /** The verbs the document declares on this path — not the seven HTTP has. */
5868
- type ApiMethod<P extends ApiPath> = {
5869
- [M in Verb]: M extends keyof paths[P] ? paths[P][M] extends {
5870
- responses: unknown;
5871
- } ? M : never : never;
5872
- }[Verb];
5873
- type Operation<P extends ApiPath, M extends ApiMethod<P>> = M extends keyof paths[P] ? paths[P][M] : never;
5874
- type JsonBody<R> = R extends {
5875
- content: {
5876
- 'application/json': infer B;
5877
- };
5878
- } ? B : never;
5879
- /**
5880
- * The success body the document declares, preferring 200 where a route serves
5881
- * both. A route with neither — `kind: 'empty'`, which serves 204 — resolves to
5882
- * `never`, and `readPayload` cannot be called on it.
5883
- */
5884
- type ApiSuccessBody<P extends ApiPath, M extends ApiMethod<P>> = Operation<P, M> extends {
5885
- responses: infer R;
5886
- } ? 200 extends keyof R ? JsonBody<R[200]> : 201 extends keyof R ? JsonBody<R[201]> : never : never;
5887
6346
  /**
5888
- * The document's success body with the payload typed as the caller's `T`.
6347
+ * AI configuration. A single prompt — `instructions` — describes what the
6348
+ * element is and how AI should produce its value. Attaches to fields, content
6349
+ * types, components, fieldsets, and (extended) asset types.
5889
6350
  *
5890
- * The array arm is tested **first** on purpose: `{ data: unknown[] }` also
5891
- * satisfies `{ data: unknown }`, so the object arm would swallow every
5892
- * collection and hand a list route's caller a single entity — which is the
5893
- * exact defect class (`ContentClient.children` reading `.data.items` from an
5894
- * object route) that this phase makes unrepresentable.
6351
+ * @example
6352
+ * ```typescript
6353
+ * fields.richText('body', {
6354
+ * ai: {
6355
+ * instructions: `
6356
+ * Write in a conversational tone.
6357
+ * Use short paragraphs (2-3 sentences).
6358
+ * Target grade 8 reading level.
6359
+ * `
6360
+ * }
6361
+ * })
6362
+ * ```
5895
6363
  */
5896
- type Wire<P extends ApiPath, M extends ApiMethod<P>, T> = ApiSuccessBody<P, M> extends {
5897
- data: unknown[];
5898
- } ? Omit<ApiSuccessBody<P, M>, 'data'> & {
5899
- data: T[];
5900
- } : ApiSuccessBody<P, M> extends {
5901
- data: unknown;
5902
- } ? Omit<ApiSuccessBody<P, M>, 'data'> & {
5903
- data: T;
5904
- } : ApiSuccessBody<P, M>;
5905
- /**
5906
- * The path parameters the document declares for this operation, or `never`
5907
- * where it declares none.
5908
- *
5909
- * `never` rather than `{}`: a route with no segments must **forbid** a `path`
5910
- * argument, not merely tolerate an empty one, and `keyof Record<string, never>`
5911
- * is `string`, so an empty-object encoding cannot be told apart from a real
5912
- * one at the type level.
5913
- */
5914
- type PathParamsOf<P extends ApiPath, M extends ApiMethod<P>> = Operation<P, M> extends {
5915
- parameters: {
5916
- path?: infer X;
5917
- };
5918
- } ? [X] extends [undefined] ? never : NonNullable<X> : never;
5919
- /** What {@link matchRoute} recovers from a URL the client emitted. */
5920
- interface RouteMatch {
5921
- /** The document's path template — the value a tag translator switches on. */
5922
- path: ApiPath;
5923
- /** The template's `{name}` segments, decoded: the inverse of {@link fillPath}. */
5924
- params: Record<string, string>;
5925
- /** The query string; a key that appears more than once comes back as an array. */
5926
- query: Record<string, string | string[]>;
5927
- }
5928
- interface MatchRouteOptions {
6364
+ interface AIConfig {
5929
6365
  /**
5930
- * The client's `baseUrl`, when it carries a path prefix of its own
5931
- * (`https://example.com/relyio`). Its path is removed before the template is
5932
- * matched. Unneeded for the default `https://api.relyio.com`.
6366
+ * AI brief for this element: what it should contain and how to produce it.
6367
+ *
6368
+ * Used by the Studio authoring agent and — on asset types with
6369
+ * `ai.autoGenerate` — by the automatic post-upload run.
6370
+ *
6371
+ * The fallback chain for AI guidance is:
6372
+ * 1. ai.instructions (most specific)
6373
+ * 2. ui.description (general field description)
6374
+ * 3. Field displayName + type (inferred from semantics)
5933
6375
  */
5934
- baseUrl?: string;
6376
+ instructions?: string;
5935
6377
  }
5936
6378
  /**
5937
- * Recover the route a URL names: the inverse of {@link fillPath}, over the same
5938
- * committed document (`INV-API-CLIENT-IS-DERIVED`).
5939
- *
5940
- * `matchRoute(url).path` is an `ApiPath`, so anything that keys behaviour on a
5941
- * request — a cache-tag translator, say — switches on the document's templates
5942
- * and never on a route table of its own.
5943
- *
5944
- * Returns `null` for a URL no declared template matches — a presigned storage
5945
- * URL, or a path outside `baseUrl` — rather than a guess.
6379
+ * Field-level AI config. `inputs` names the fields this instruction reads.
6380
+ * Unknown ids and cycles are refused when the schema is parsed.
5946
6381
  */
5947
- declare function matchRoute(url: string | URL, options?: MatchRouteOptions): RouteMatch | null;
5948
-
6382
+ interface FieldAIConfig extends AIConfig {
6383
+ /** Field ids this instruction reads. Never inferred from instruction text. */
6384
+ inputs?: string[];
6385
+ }
5949
6386
  /**
5950
- * Configuration types for the RelyIO SDK
6387
+ * Asset-type AI configuration. Extends {@link AIConfig} with `autoGenerate`,
6388
+ * the single switch that turns on automatic field generation after upload.
5951
6389
  */
5952
-
5953
- interface RelyIOConfig {
6390
+ interface AssetAIConfig extends AIConfig {
5954
6391
  /**
5955
- * API key for authentication, sent as `X-API-Key`.
5956
- *
5957
- * Required by every request, not by construction: a client built without one — a module-scope
5958
- * client whose `process.env` variable is unset during a build — constructs, and each request it
5959
- * makes rejects with `MissingApiKeyError` before anything is sent. Under `relyio dev` the
5960
- * sandbox's key is used instead, so none need be configured.
6392
+ * Master switch for automatic, post-upload field generation. When `true`, the
6393
+ * derived analysis agent fills every field that declares `ai.instructions`,
6394
+ * applied as a review proposal. Only meaningful for image asset types in v1.
5961
6395
  */
5962
- apiKey: string;
5963
- /** Base URL for the RelyIO API */
5964
- baseUrl?: string;
5965
- /** Dataset to use */
5966
- dataset?: string;
5967
- /**
5968
- * Default locale for all content queries
5969
- * Can be overridden per-query using .locale() or .withLocale()
5970
- *
5971
- * @example
5972
- * const client = createClient({
5973
- * apiKey: '...',
5974
- * locale: 'en-US', // All queries default to English
5975
- * })
5976
- */
5977
- locale?: string;
5978
- /** Request timeout in milliseconds (defaults to 30000) */
5979
- timeout?: number;
5980
- /** Number of retry attempts for failed requests (defaults to 3) */
5981
- retryAttempts?: number;
5982
- /** Whether to use HTTPS (defaults to true) */
5983
- useSsl?: boolean;
5984
- /** Environment mode */
5985
- environment?: 'development' | 'staging' | 'production';
5986
- /**
5987
- * Cache configuration.
5988
- *
5989
- * Declarative only: the client keeps no response cache, and nothing in it reads
5990
- * these values, so every call goes to `fetch`. There is no SDK-side cache to
5991
- * turn off under a framework that caches `fetch` itself (Next.js).
5992
- */
5993
- cache?: CacheConfig;
5994
- /** Real-time configuration */
5995
- realtime?: RealtimeConfig;
5996
- /** Debug configuration */
5997
- debug?: DebugConfig;
5998
- /** Custom headers to include with requests */
5999
- headers?: Record<string, string>;
6000
- /**
6001
- * The function every request to the RelyIO API is sent through. Omit it and the
6002
- * client calls the runtime's `globalThis.fetch`, looked up per request. File
6003
- * bytes an asset upload PUTs straight to a presigned storage URL do not pass
6004
- * through it.
6005
- *
6006
- * The client still builds every request — URL, method, headers, body, signal —
6007
- * and hands this function that `RequestInit` unchanged, retries included, so an
6008
- * `Idempotency-Key` minted for a write is the same on every attempt. Supply one
6009
- * to add what your framework reads off the `RequestInit`, for example Next.js
6010
- * cache tags:
6011
- *
6012
- * @example
6013
- * const client = createClient({
6014
- * apiKey: '...',
6015
- * fetch: (input, init) => fetch(input, { ...init, next: { tags: ['posts'] } }),
6016
- * })
6017
- */
6018
- fetch?: typeof globalThis.fetch;
6019
- /** Browser-specific configuration */
6020
- browser?: BrowserConfig;
6021
- /**
6022
- * `relyio dev` sandbox detection.
6023
- *
6024
- * When developing under `relyio dev`, the CLI injects an ephemeral sandbox's dataset + scoped
6025
- * preview API key (via env vars or a local `.relyio/dev.json`). The SDK then transparently
6026
- * targets that sandbox instead of production — no code changes required.
6027
- *
6028
- * - Omit (default): detection runs automatically unless `NODE_ENV === 'production'`, so
6029
- * `relyio dev -- pnpm dev` "just works" while production builds stay untouched.
6030
- * - `false`: disable detection entirely (force production targeting even in a dev shell).
6031
- * - `true`: force detection even when `NODE_ENV === 'production'`.
6032
- */
6033
- dev?: boolean;
6396
+ autoGenerate?: boolean;
6034
6397
  }
6035
- interface CacheConfig {
6036
- /** Whether caching is enabled (defaults to true) */
6037
- enabled?: boolean;
6038
- /** Cache TTL in milliseconds (defaults to 5 minutes) */
6039
- ttl?: number;
6040
- /** Maximum number of cache entries (defaults to 1000) */
6041
- maxEntries?: number;
6042
- /** Maximum cache size in bytes (defaults to 50MB) */
6043
- maxSize?: number;
6044
- /** Cache strategies to use */
6045
- strategies?: CacheStrategy[];
6398
+ interface BaseFieldConfig {
6399
+ /** Whether the field is required */
6400
+ required?: boolean;
6401
+ /** Whether the field value must be unique */
6402
+ unique?: boolean;
6403
+ /** Default value for the field. Each field type narrows it to the values its schema accepts. */
6404
+ defaultValue?: unknown;
6046
6405
  }
6047
- interface RealtimeConfig {
6048
- /** Whether real-time features are enabled (defaults to true) */
6049
- enabled?: boolean;
6050
- /** WebSocket URL for real-time connections */
6051
- wsUrl?: string;
6052
- /** Maximum number of reconnection attempts (defaults to 10) */
6053
- maxReconnectAttempts?: number;
6054
- /** Reconnection delay in milliseconds (defaults to 1000) */
6055
- reconnectDelay?: number;
6056
- /** Heartbeat interval in milliseconds (defaults to 30000) */
6057
- heartbeatInterval?: number;
6406
+ interface FieldUIConfig {
6407
+ /** Display name shown in the UI */
6408
+ displayName: string;
6409
+ /** Field description/help text */
6410
+ description?: string;
6411
+ /** Widget-specific options */
6412
+ options?: Record<string, unknown>;
6058
6413
  }
6059
- interface DebugConfig {
6060
- /** Whether debug mode is enabled (defaults to false) */
6061
- enabled?: boolean;
6062
- /** Whether to log network requests (defaults to false) */
6063
- logRequests?: boolean;
6064
- /** Whether to log cache operations (defaults to false) */
6065
- logCache?: boolean;
6066
- /** Whether to log WebSocket events (defaults to false) */
6067
- logWebSocket?: boolean;
6068
- /** Custom logger function */
6069
- logger?: (_level: LogLevel, _message: string, _data?: unknown) => void;
6414
+ interface RuleCondition {
6415
+ field: string;
6416
+ operator: 'equals' | 'not_equals' | 'contains' | 'not_contains' | 'greater_than' | 'less_than' | 'is_empty' | 'is_not_empty';
6417
+ value?: unknown;
6418
+ }
6419
+ interface RuleConditions {
6420
+ mode: 'all' | 'any' | 'none';
6421
+ conditions: RuleCondition[];
6422
+ }
6423
+ interface VisibilityRule {
6424
+ type: 'visibility';
6425
+ action: 'show' | 'hide';
6426
+ conditions: RuleConditions;
6427
+ }
6428
+ interface RequirementRule {
6429
+ type: 'requirement';
6430
+ action: 'require' | 'optional';
6431
+ conditions: RuleConditions;
6432
+ }
6433
+ interface ValidationRule {
6434
+ type: 'validation';
6435
+ action: 'validate' | 'skip';
6436
+ message?: string;
6437
+ conditions: RuleConditions;
6438
+ }
6439
+ interface ReadOnlyRule {
6440
+ type: 'readOnly';
6441
+ action: 'enable' | 'disable';
6442
+ conditions: RuleConditions;
6443
+ }
6444
+ type FieldRule = VisibilityRule | RequirementRule | ValidationRule | ReadOnlyRule;
6445
+ type LocalizationConfig = boolean | string[] | {
6446
+ enabled: boolean;
6447
+ requiredLocales?: string[];
6448
+ fallback?: boolean;
6449
+ };
6450
+ interface FieldDefinition<TId extends string = string, TType extends string = string, TConfig = unknown> {
6451
+ /** Unique field identifier - preserves literal type for type inference */
6452
+ readonly id: TId;
6453
+ /** Field type */
6454
+ readonly type: TType;
6455
+ /** Type-specific configuration */
6456
+ config?: TConfig;
6457
+ /** UI display configuration */
6458
+ ui?: FieldUIConfig;
6459
+ /** AI configuration: generation/review guidance for this field */
6460
+ ai?: FieldAIConfig;
6461
+ /** Dynamic field rules */
6462
+ rules?: FieldRule[];
6463
+ /** Localization settings */
6464
+ localization?: LocalizationConfig;
6465
+ /** Fallback value when field is empty */
6466
+ fallback?: unknown;
6467
+ /** Whether this field is deprecated */
6468
+ deprecated?: boolean;
6070
6469
  }
6071
6470
  /**
6072
- * The numbers the retry backoff is computed from.
6073
- *
6074
- * There is no `retryCondition` here any more. It was a predicate over
6075
- * `(error, attempt)`, which is structurally unable to see the request — so the
6076
- * only rule it could express is "is this error retryable", and the rule that
6077
- * matters is "may this request be sent twice". That question, and the answer,
6078
- * live in `RetryPolicy` (`http/retry-policy.ts`).
6471
+ * Any field definition - used in arrays where we need to preserve specific field types
6079
6472
  */
6080
- interface RetryConfig {
6081
- /** Maximum number of attempts, including the first. */
6082
- maxAttempts: number;
6083
- /** Base delay between retries in milliseconds */
6084
- baseDelay: number;
6085
- /** Maximum delay between retries in milliseconds */
6086
- maxDelay: number;
6087
- /** Backoff factor for exponential backoff */
6088
- backoffFactor: number;
6089
- /** Whether to add jitter to retry delays */
6090
- jitter: boolean;
6473
+ type AnyFieldDefinition = FieldDefinition<string, string, unknown>;
6474
+ interface ShortTextConfig extends BaseFieldConfig {
6475
+ /** Maximum character length */
6476
+ maxLength?: number;
6477
+ /** Regex pattern for validation */
6478
+ pattern?: string;
6479
+ defaultValue?: string;
6091
6480
  }
6092
- interface RequestConfig {
6093
- /** HTTP method */
6094
- method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
6095
- /** Request URL */
6096
- url: string;
6097
- /** Request headers */
6098
- headers?: Record<string, string>;
6099
- /** Request body */
6100
- body?: unknown;
6101
- /** Query parameters */
6102
- params?: Record<string, unknown>;
6103
- /** Request timeout in milliseconds */
6104
- timeout?: number;
6105
- /** Whether to retry this request on failure */
6106
- retryable?: boolean;
6107
- /** Abort signal for canceling requests */
6108
- signal?: AbortSignal;
6109
- /** Additional metadata for the request */
6110
- metadata?: Record<string, unknown>;
6481
+ interface LongTextConfig extends BaseFieldConfig {
6482
+ minLength?: number;
6483
+ maxLength?: number;
6484
+ defaultValue?: string;
6111
6485
  }
6112
- interface ApiResponse<T = unknown> {
6113
- /**
6114
- * The response body exactly as the route's contract declares it —
6115
- * `{ data }`, `{ data, page }`, `{ data, page, meta }` or `{ empty }`.
6116
- *
6117
- * Named `body`, not `data`, because the envelope's own key is `data`: the
6118
- * incumbent `response.data.data` read like a typo and was one 33 times, in
6119
- * six methods that read a key the server never sent. One `data` in the
6120
- * spelling means `readPayload(response.body)` is the only way to reach a
6121
- * payload (`INV-API-CLIENT-IS-DERIVED`).
6122
- */
6123
- body: T;
6124
- /** HTTP status code */
6125
- status: number;
6126
- /** HTTP status text */
6127
- statusText: string;
6128
- /** Response headers */
6129
- headers: Record<string, string>;
6130
- /** Request configuration that generated this response */
6131
- config: RequestConfig;
6132
- /** Whether this response came from cache */
6133
- fromCache?: boolean;
6134
- /** Cache metadata */
6135
- cacheMetadata?: {
6136
- key: string;
6137
- timestamp: number;
6138
- ttl: number;
6139
- };
6486
+ interface RichTextConfig extends BaseFieldConfig {
6487
+ /** Maximum character length for the rich text content */
6488
+ maxLength?: number;
6489
+ /** Allowed formatting options (e.g., bold, italic, underline) */
6490
+ allowedFormats?: string[];
6491
+ /** Allowed embed types (e.g., image, video, code) */
6492
+ embedTypes?: string[];
6493
+ defaultValue?: string;
6140
6494
  }
6141
- interface BrowserConfig {
6142
- /**
6143
- * Whether requests the client sends from a web page carry the browser's cookies to another
6144
- * origin (defaults to `true`).
6145
- *
6146
- * `true` sends every request with `credentials: 'include'`. `false` sends it with
6147
- * `credentials: 'same-origin'`: nothing to another origin, and a same-origin request — the API
6148
- * behind a proxy on your own host — sent as the platform's own `fetch` would send it. The RelyIO
6149
- * API authenticates with your API key and reads no cookie, so `false` changes nothing it
6150
- * answers.
6151
- *
6152
- * Applied only where `window` exists. On a server, in an edge runtime or in a Web Worker the
6153
- * client sets no `credentials` mode at all, whatever this says.
6154
- */
6155
- includeCredentials?: boolean;
6156
- /** Whether to use relative URLs for same-origin requests (defaults to false) */
6157
- useRelativeUrls?: boolean;
6158
- /** Custom CORS error handling */
6159
- onCorsError?: (_error: Error, _context: unknown) => void;
6495
+ interface SlugConfig extends BaseFieldConfig {
6496
+ /** Source field to generate slug from */
6497
+ sourceField?: string;
6498
+ /** Maximum character length */
6499
+ maxLength?: number;
6500
+ defaultValue?: string;
6501
+ }
6502
+ interface UrlConfig extends BaseFieldConfig {
6503
+ /** Allowed URL protocols */
6504
+ allowedProtocols?: ('http' | 'https' | 'ftp' | 'ftps')[];
6505
+ /** Maximum character length */
6506
+ maxLength?: number;
6507
+ defaultValue?: string;
6508
+ }
6509
+ interface EmailConfig extends BaseFieldConfig {
6510
+ /** Maximum character length */
6511
+ maxLength?: number;
6512
+ /** Whitelist of allowed email domains */
6513
+ domainWhitelist?: string[];
6514
+ defaultValue?: string;
6515
+ }
6516
+ interface IntegerConfig extends BaseFieldConfig {
6517
+ min?: number;
6518
+ max?: number;
6519
+ defaultValue?: number;
6520
+ }
6521
+ interface DecimalConfig extends BaseFieldConfig {
6522
+ min?: number;
6523
+ max?: number;
6524
+ decimalPlaces?: number;
6525
+ roundingMode?: 'HALF_UP' | 'FLOOR' | 'CEILING' | 'ROUND' | 'TRUNCATE';
6526
+ defaultValue?: number;
6527
+ }
6528
+ interface BooleanConfig extends BaseFieldConfig {
6529
+ /** The editor's word for `true` (e.g. `'Published'`). */
6530
+ labelTrue?: string;
6531
+ /** The editor's word for `false` (e.g. `'Draft'`). */
6532
+ labelFalse?: string;
6533
+ defaultValue?: boolean;
6160
6534
  }
6161
- type CacheStrategy = 'memory' | 'persistent' | 'network-first' | 'cache-first' | 'stale-while-revalidate';
6162
- type LogLevel = 'debug' | 'info' | 'warn' | 'error';
6163
- type Environment = 'development' | 'staging' | 'production';
6164
6535
  /**
6165
- * `fetch` stays optional after the merge: absent means the runtime's own, and
6166
- * that is read per request rather than captured here, so no default value
6167
- * stands in for it.
6536
+ * `TValue` is the union of the option values and `TMulti` whether the field holds a list of them.
6537
+ * `fields.enum()` infers both from the declaration, so a read of the field is typed by its options
6538
+ * (`INV-SS-TYPES-INFERRED`); the defaults describe any enum field.
6168
6539
  */
6169
- type MergedRelyIOConfig = Required<Omit<RelyIOConfig, 'dataset' | 'locale' | 'dev' | 'fetch'>> & Pick<RelyIOConfig, 'dataset' | 'locale' | 'dev' | 'fetch'>;
6170
-
6540
+ interface EnumConfig<TValue extends string = string, TMulti extends boolean = boolean> extends BaseFieldConfig {
6541
+ /** The values the field may hold, each with the `label` an editor shows. Deploy refuses an option without one. */
6542
+ options: Array<{
6543
+ value: TValue;
6544
+ label: string;
6545
+ }>;
6546
+ multi?: TMulti;
6547
+ /** One option's value, or a list of them when `multi` is true. */
6548
+ defaultValue?: string | string[];
6549
+ }
6550
+ /** A display format is not config: it is `ui.options.format`, where the schema declares it. */
6551
+ interface DateConfig extends BaseFieldConfig {
6552
+ minDate?: string;
6553
+ maxDate?: string;
6554
+ /** `YYYY-MM-DD` */
6555
+ defaultValue?: string;
6556
+ }
6557
+ /** A display format is not config: it is `ui.options.format`, where the schema declares it. */
6558
+ interface DateTimeConfig extends BaseFieldConfig {
6559
+ minDateTime?: string;
6560
+ maxDateTime?: string;
6561
+ /** Store the instant in UTC (`'UTC'`), or keep the author's local time (`'local'`). */
6562
+ timeZoneHandling?: 'UTC' | 'local';
6563
+ defaultValue?: string;
6564
+ }
6171
6565
  /**
6172
- * Base error class for all RelyIO SDK errors
6173
- * Provides consistent error handling, context tracking, and retry logic
6566
+ * `TTo` is the union of the target type ids and `TMulti` whether the field holds a list.
6567
+ * `fields.reference()` infers both, so a read of the field is typed by what it points at
6568
+ * (`INV-SS-TYPES-INFERRED`); the defaults describe any reference field.
6174
6569
  */
6175
- declare abstract class SDKError extends Error {
6176
- /** Unique error code for programmatic error handling */
6177
- abstract readonly code: string;
6178
- /** Whether this error is retryable */
6179
- abstract readonly retryable: boolean;
6180
- /** HTTP status code if applicable */
6181
- readonly statusCode?: number;
6182
- /** Original error that caused this error */
6183
- readonly cause?: Error;
6184
- /** Additional context about the error */
6185
- readonly context?: Record<string, unknown>;
6186
- /** Timestamp when the error occurred */
6187
- readonly timestamp: number;
6188
- constructor(message: string, statusCode?: number, cause?: Error, context?: Record<string, unknown>);
6189
- /**
6190
- * Convert error to JSON for logging and debugging
6191
- */
6192
- toJSON(): {
6193
- name: string;
6194
- message: string;
6195
- code: string;
6196
- statusCode: number | undefined;
6197
- retryable: boolean;
6198
- context: Record<string, unknown> | undefined;
6199
- timestamp: number;
6200
- stack: string | undefined;
6201
- };
6202
- /**
6203
- * Get a user-friendly error message
6204
- */
6205
- getUserMessage(): string;
6206
- /**
6207
- * Get detailed error information for debugging
6208
- */
6209
- getDebugInfo(): string;
6210
- /**
6211
- * Check if this error is of a specific type
6212
- */
6213
- isType(errorType: string): boolean;
6570
+ interface ReferenceConfig<TTo extends string = string, TMulti extends boolean = boolean> extends BaseFieldConfig {
6214
6571
  /**
6215
- * Create a new error with additional context
6572
+ * Target entry type id(s) — content type or asset type ids. Pass a single id
6573
+ * for one target or an array for several. All ids must belong to the same
6574
+ * family (all content types or all asset types).
6216
6575
  */
6217
- withContext(context: Record<string, unknown>): this;
6576
+ to: TTo | TTo[];
6577
+ /** Allow multiple references (the field value is a list). */
6578
+ multi?: TMulti;
6579
+ /** Reference strength for publish/unpublish behavior. */
6580
+ referenceStrength?: 'strong' | 'weak';
6581
+ /** Behavior when a referenced entry is deleted. */
6582
+ onTargetDelete?: 'block' | 'nullify';
6583
+ /** A target entry's id, or a list of them when `multi` is true. */
6584
+ defaultValue?: string | string[];
6218
6585
  }
6586
+ interface TagsConfig extends BaseFieldConfig {
6587
+ allowCustom?: boolean;
6588
+ predefinedTags?: string[];
6589
+ maxTags?: number;
6590
+ }
6591
+ /**
6592
+ * `TSubfields` is the declared subfields, which `fields.list()` infers so a read types each item by
6593
+ * them (`INV-SS-TYPES-INFERRED`); the default describes any list field.
6594
+ */
6595
+ interface ListConfig<TSubfields extends readonly AnyFieldDefinition[] = FieldDefinition[]> extends BaseFieldConfig {
6596
+ dragAndDrop?: boolean;
6597
+ minItems?: number;
6598
+ maxItems?: number;
6599
+ /** Subfields for list items */
6600
+ subfields?: TSubfields;
6601
+ }
6602
+ /**
6603
+ * A component field's config: the options every field type takes, and no more — what the schema
6604
+ * declares for a `component(<id>)` field, which has no config of its own. The validation document
6605
+ * reads `required` from it as it does from any field's.
6606
+ */
6607
+ type ComponentFieldConfig = BaseFieldConfig;
6608
+ type FieldType = 'shortText' | 'longText' | 'richText' | 'slug' | 'url' | 'email' | 'integer' | 'decimal' | 'boolean' | 'enum' | 'date' | 'dateTime' | 'reference' | 'tags' | 'list';
6609
+ type ComponentFieldType = `component(${string})`;
6610
+ type AllFieldTypes = FieldType | ComponentFieldType;
6219
6611
 
6220
6612
  /**
6221
- * Validation errors and related interfaces
6613
+ * Workflow definition for content approval pipelines
6614
+ *
6615
+ * Workflows define approval stages that content must pass through before
6616
+ * publication. They can be configured globally and per content type.
6617
+ *
6618
+ * @example
6619
+ * // Simple workflow with one approval stage
6620
+ * const workflow = defineWorkflow({
6621
+ * enabled: true,
6622
+ * stages: [
6623
+ * defineWorkflowStage('review', {
6624
+ * displayName: 'Editorial Review',
6625
+ * allowedRoles: ['editor', 'admin']
6626
+ * })
6627
+ * ]
6628
+ * })
6629
+ *
6630
+ * @example
6631
+ * // Multi-stage workflow
6632
+ * const workflow = defineWorkflow({
6633
+ * enabled: true,
6634
+ * stages: [
6635
+ * defineWorkflowStage('editorial-review', {
6636
+ * displayName: 'Editorial Review',
6637
+ * allowedRoles: ['editor']
6638
+ * }),
6639
+ * defineWorkflowStage('legal-approval', {
6640
+ * displayName: 'Legal Approval',
6641
+ * requiredApprovals: 1,
6642
+ * allowedRoles: ['legal-reviewer']
6643
+ * }),
6644
+ * defineWorkflowStage('final-approval', {
6645
+ * displayName: 'Final Approval',
6646
+ * requiredApprovals: 2,
6647
+ * allowedRoles: ['publisher', 'admin']
6648
+ * })
6649
+ * ]
6650
+ * })
6222
6651
  */
6223
- interface ValidationViolation {
6224
- field: string;
6225
- message: string;
6226
- code: string;
6227
- value?: unknown;
6228
- path?: string[];
6652
+ /**
6653
+ * Escalation configuration when a workflow stage times out
6654
+ */
6655
+ interface WorkflowEscalation {
6656
+ /** Roles to notify when stage times out */
6657
+ notifyRoles?: string[];
6658
+ /** Roles to escalate to if still pending after another timeout period */
6659
+ escalateToRoles?: string[];
6229
6660
  }
6230
- declare abstract class BaseValidationError extends SDKError {
6231
- readonly retryable = false;
6232
- readonly violations: ValidationViolation[];
6233
- /**
6234
- * @param context - Carried beside `violations`. The mapper passes the refusal body as
6235
- * `context.response`, as it does for every other contract code, so a consumer that hands the
6236
- * service's own words on can read them here too.
6237
- */
6238
- constructor(message?: string, violations?: ValidationViolation[], statusCode?: number, cause?: Error, context?: Record<string, unknown>);
6239
- getUserMessage(): string;
6240
- /**
6241
- * Get violations for a specific field
6242
- */
6243
- getViolationsForField(fieldName: string): ValidationViolation[];
6244
- /**
6245
- * Check if a specific field has validation errors
6246
- */
6247
- hasFieldError(fieldName: string): boolean;
6248
- /**
6249
- * Get all validation messages as a formatted string
6250
- */
6251
- getFormattedMessages(): string;
6661
+ /**
6662
+ * Auto-assignment configuration for workflow stages
6663
+ */
6664
+ interface WorkflowAutoAssign {
6665
+ /** Roles whose users should be notified when content enters this stage */
6666
+ roles: string[];
6252
6667
  }
6253
- declare class ValidationError extends BaseValidationError {
6254
- readonly code = "VALIDATION_ERROR";
6668
+ /**
6669
+ * Workflow stage configuration
6670
+ */
6671
+ interface WorkflowStageConfig {
6672
+ /** Human-readable name shown in Studio */
6673
+ displayName: string;
6674
+ /** Optional description for reviewers */
6675
+ description?: string;
6676
+ /** Number of approvals needed to pass this stage (default: 1) */
6677
+ requiredApprovals?: number;
6678
+ /** Roles that can approve this stage */
6679
+ allowedRoles?: string[];
6680
+ /** Auto-assignment configuration */
6681
+ autoAssign?: WorkflowAutoAssign;
6682
+ /** Days before escalation triggers (optional) */
6683
+ timeoutDays?: number;
6684
+ /** Escalation configuration when stage times out */
6685
+ escalation?: WorkflowEscalation;
6255
6686
  }
6256
- declare class InvalidPayloadError extends BaseValidationError {
6257
- readonly code = "INVALID_PAYLOAD";
6258
- constructor(message?: string, violations?: ValidationViolation[], cause?: Error, context?: Record<string, unknown>);
6259
- getUserMessage(): string;
6687
+ /**
6688
+ * Complete workflow stage definition
6689
+ */
6690
+ interface WorkflowStageDefinition {
6691
+ readonly _tag: 'workflowStage';
6692
+ readonly id: string;
6693
+ readonly displayName: string;
6694
+ readonly description?: string;
6695
+ /** Absent means the schema's default of 1 */
6696
+ readonly requiredApprovals?: number;
6697
+ readonly allowedRoles?: string[];
6698
+ readonly autoAssign?: WorkflowAutoAssign;
6699
+ readonly timeoutDays?: number;
6700
+ readonly escalation?: WorkflowEscalation;
6260
6701
  }
6261
- declare class SchemaValidationError extends BaseValidationError {
6262
- readonly code = "SCHEMA_VALIDATION_ERROR";
6263
- constructor(message?: string, violations?: ValidationViolation[], cause?: Error);
6264
- getUserMessage(): string;
6702
+ /**
6703
+ * Workflow configuration
6704
+ */
6705
+ interface WorkflowConfig {
6706
+ /** Enable/disable workflow for the branch (default: false) */
6707
+ enabled?: boolean;
6708
+ /** Array of approval stage definitions */
6709
+ stages?: WorkflowStageDefinition[];
6265
6710
  }
6266
- declare class RequiredFieldError extends BaseValidationError {
6267
- readonly code = "REQUIRED_FIELD_ERROR";
6268
- constructor(fieldName: string, message?: string, cause?: Error);
6269
- getUserMessage(): string;
6711
+ /**
6712
+ * Complete workflow definition
6713
+ */
6714
+ interface WorkflowDefinition {
6715
+ readonly _tag: 'workflow';
6716
+ /** Absent means the schema's default, disabled */
6717
+ readonly enabled?: boolean;
6718
+ readonly stages?: WorkflowStageDefinition[];
6270
6719
  }
6271
- declare class InvalidFieldTypeError extends BaseValidationError {
6272
- readonly code = "INVALID_FIELD_TYPE";
6273
- constructor(fieldName: string, expectedType: string, actualType: string, value?: unknown, cause?: Error);
6274
- getUserMessage(): string;
6720
+ /**
6721
+ * Per-content-type workflow configuration
6722
+ */
6723
+ interface ContentTypeWorkflowConfig {
6724
+ /** Enable workflow for this content type (inherits from global if not set) */
6725
+ enabled?: boolean;
6726
+ /** Which global stages apply to this content type (subset of global stages) */
6727
+ stages?: string[];
6728
+ /** Publish automatically after all stages are approved */
6729
+ autoPublish?: boolean;
6730
+ /** Require all locales to be approved before publishing */
6731
+ requireAllLocales?: boolean;
6275
6732
  }
6733
+ /**
6734
+ * Define a workflow stage
6735
+ *
6736
+ * @param id - Unique identifier for the stage (kebab-case or camelCase)
6737
+ * @param config - Stage configuration
6738
+ *
6739
+ * @example
6740
+ * const editorialReview = defineWorkflowStage('editorial-review', {
6741
+ * displayName: 'Editorial Review',
6742
+ * description: 'Content quality and style check',
6743
+ * requiredApprovals: 1,
6744
+ * allowedRoles: ['editor', 'senior-editor']
6745
+ * })
6746
+ *
6747
+ * @example
6748
+ * // Stage with auto-assignment and timeout
6749
+ * const legalApproval = defineWorkflowStage('legal-approval', {
6750
+ * displayName: 'Legal Approval',
6751
+ * allowedRoles: ['legal-reviewer'],
6752
+ * autoAssign: { roles: ['legal-reviewer'] },
6753
+ * timeoutDays: 3,
6754
+ * escalation: {
6755
+ * notifyRoles: ['legal-reviewer'],
6756
+ * escalateToRoles: ['admin']
6757
+ * }
6758
+ * })
6759
+ */
6760
+ declare function defineWorkflowStage(id: string, config: WorkflowStageConfig): WorkflowStageDefinition;
6761
+ /**
6762
+ * Define a workflow configuration
6763
+ *
6764
+ * @param config - Workflow configuration with enabled flag and stages
6765
+ *
6766
+ * @example
6767
+ * // Simple workflow
6768
+ * const workflow = defineWorkflow({
6769
+ * enabled: true,
6770
+ * stages: [
6771
+ * defineWorkflowStage('review', {
6772
+ * displayName: 'Review',
6773
+ * allowedRoles: ['editor']
6774
+ * })
6775
+ * ]
6776
+ * })
6777
+ *
6778
+ * @example
6779
+ * // Disabled workflow (direct publish)
6780
+ * const workflow = defineWorkflow({
6781
+ * enabled: false
6782
+ * })
6783
+ */
6784
+ declare function defineWorkflow(config: WorkflowConfig): WorkflowDefinition;
6785
+ /**
6786
+ * Define content-type specific workflow configuration
6787
+ *
6788
+ * @param config - Content type workflow configuration
6789
+ *
6790
+ * @example
6791
+ * // Use specific stages from global workflow
6792
+ * const blogPostWorkflow = defineContentTypeWorkflow({
6793
+ * enabled: true,
6794
+ * stages: ['editorial-review', 'final-approval'], // Skip legal
6795
+ * autoPublish: false
6796
+ * })
6797
+ *
6798
+ * @example
6799
+ * // Disable workflow for this content type
6800
+ * const quickUpdateWorkflow = defineContentTypeWorkflow({
6801
+ * enabled: false
6802
+ * })
6803
+ *
6804
+ * @example
6805
+ * // Require all locales to be approved
6806
+ * const marketingPageWorkflow = defineContentTypeWorkflow({
6807
+ * enabled: true,
6808
+ * stages: ['translation-review', 'regional-approval'],
6809
+ * requireAllLocales: true
6810
+ * })
6811
+ */
6812
+ declare function defineContentTypeWorkflow(config: ContentTypeWorkflowConfig): ContentTypeWorkflowConfig;
6813
+ /**
6814
+ * Check if a value is a workflow stage definition
6815
+ */
6816
+ declare function isWorkflowStageDefinition(value: unknown): value is WorkflowStageDefinition;
6817
+ /**
6818
+ * Check if a value is a workflow definition
6819
+ */
6820
+ declare function isWorkflowDefinition(value: unknown): value is WorkflowDefinition;
6821
+ /**
6822
+ * Get all stage IDs from a workflow definition
6823
+ */
6824
+ declare function getWorkflowStageIds(workflow: WorkflowDefinition): string[];
6825
+ /**
6826
+ * Find a stage by ID in a workflow definition
6827
+ */
6828
+ declare function findWorkflowStage(workflow: WorkflowDefinition, stageId: string): WorkflowStageDefinition | undefined;
6829
+ /**
6830
+ * Get the next stage after a given stage ID (null if last stage)
6831
+ */
6832
+ declare function getNextWorkflowStage(workflow: WorkflowDefinition, currentStageId: string): WorkflowStageDefinition | null;
6833
+ /**
6834
+ * Get the first stage in the workflow (null if no stages)
6835
+ */
6836
+ declare function getFirstWorkflowStage(workflow: WorkflowDefinition): WorkflowStageDefinition | null;
6837
+ /**
6838
+ * Check if a stage is the final stage in the workflow
6839
+ */
6840
+ declare function isFinalWorkflowStage(workflow: WorkflowDefinition, stageId: string): boolean;
6276
6841
 
6277
6842
  /**
6278
- * Core type definitions for the RelyIO SDK
6843
+ * Singleton content type definition matching @relyio/schema
6844
+ *
6845
+ * In RelyIO, singletons are just content types with a special flag.
6846
+ * They share the same structure as regular content types.
6847
+ *
6848
+ * Uses advanced TypeScript generics to preserve literal field IDs through
6849
+ * the type system, enabling full autocomplete in SDK methods.
6279
6850
  */
6280
6851
 
6281
6852
  /**
6282
- * Base interface for all content items
6283
- * Matches the actual RelyIO API structure with _metadata object
6853
+ * Type alias for a fieldset with any fields.
6284
6854
  */
6285
- interface BaseContent {
6286
- /**
6287
- * RelyIO metadata object containing system fields.
6288
- *
6289
- * `EntryMetadata` rather than a second copy of it: this interface and
6290
- * `schema/define-content-type.ts` declared the same fifteen fields independently, so the
6291
- * per-locale publication half lived twice inside one package and a field added to one was
6292
- * silently absent from the other (`INV-LM-PUBLICATION-IS-REPORTED-PER-LOCALE`).
6293
- */
6294
- _metadata: EntryMetadata & {
6295
- /**
6296
- * Present when the entry is inherited from a source dataset (linked dataset CoW).
6297
- * If set, this entry was not modified in the linked dataset and comes from the source.
6298
- */
6299
- sourceDatasetId?: string;
6300
- };
6855
+ type AnyFieldset$2 = Fieldset<any>;
6856
+ /**
6857
+ * What a singleton takes: a content type's settings, since the schema declares a singleton with the
6858
+ * same `ContentTypeSchema` — except `hierarchical`, which is `false` or absent. A singleton is one
6859
+ * entry, with no parent and no children, and deploy refuses `true` for one
6860
+ * (`SINGLETON_CANNOT_BE_HIERARCHICAL`). It used to take a content type's `boolean` and write `false`
6861
+ * whatever it was given.
6862
+ */
6863
+ interface SingletonConfigWithFields<TFields extends readonly AnyFieldDefinition[] = readonly AnyFieldDefinition[]> extends Omit<ContentTypeConfigWithFields<TFields>, 'hierarchical'> {
6864
+ hierarchical?: false;
6865
+ }
6866
+ /** {@link SingletonConfigWithFields}, with its fields organised into fieldsets. */
6867
+ interface SingletonConfigWithFieldsets<TFieldsets extends readonly AnyFieldset$2[] = readonly AnyFieldset$2[]> extends Omit<ContentTypeConfigWithFieldsets<TFieldsets>, 'hierarchical'> {
6868
+ hierarchical?: false;
6869
+ }
6870
+ /**
6871
+ * Singleton content type definition - preserves field types for inference
6872
+ */
6873
+ interface SingletonContentTypeDefinition<TFields extends readonly AnyFieldDefinition[] = readonly AnyFieldDefinition[], TFieldsets extends readonly AnyFieldset$2[] = readonly AnyFieldset$2[]> {
6874
+ readonly _tag: 'singletonContentType';
6875
+ readonly name: string;
6876
+ readonly displayName: string;
6877
+ readonly displayNamePlural?: string;
6878
+ readonly description?: string;
6879
+ /** AI configuration: generation guidance + entry intelligence */
6880
+ readonly ai?: AIConfig;
6881
+ /** Field ID to use as entry display title */
6882
+ readonly displayField?: string;
6883
+ readonly hierarchical?: false;
6884
+ readonly accessTags?: string[];
6885
+ /** Workflow configuration for this singleton */
6886
+ readonly workflow?: ContentTypeWorkflowConfig;
6887
+ readonly fields?: TFields;
6888
+ readonly fieldsets?: TFieldsets;
6301
6889
  }
6302
6890
  /**
6303
- * The value a `where` condition compares a field against: one of the values the field holds.
6891
+ * Define a singleton content type
6892
+ *
6893
+ * Singletons are single-instance content types like homepage, site settings, etc.
6894
+ * They use the same field structure as regular content types.
6304
6895
  *
6305
- * Not the field's read type. The REST dialect (`fromRestWhere` in `@relyio/entry-reads`) reads a
6306
- * bare value as `eq`, an array as `in` and an object as operators — refusing an object with none —
6307
- * and drops `null`. So a list field (`tags`) is matched by one of its items, a reference by the
6308
- * target's id, and a component or an expanded entry is never a value to send.
6896
+ * The generic type parameters preserve the literal field IDs through the type
6897
+ * system, enabling autocomplete in SDK methods.
6898
+ *
6899
+ * @example
6900
+ * const homepage = defineSingletonContentType('homepage', {
6901
+ * displayName: 'Homepage',
6902
+ * fields: [
6903
+ * fields.shortText('heroTitle', { config: { required: true } }),
6904
+ * fields.reference('heroImage', { config: { to: 'productPhoto' } }), // an asset type's entry
6905
+ * ]
6906
+ * })
6309
6907
  */
6310
- type WhereScalar<V> = Exclude<V extends readonly (infer Item)[] ? Item : V, null | undefined | object>;
6311
- /** One field's condition: a value (`eq`), a list of values (`in`), or operators. */
6312
- type WhereFieldCondition<V> = WhereScalar<V> | WhereScalar<V>[] | WhereOperator<WhereScalar<V>>;
6908
+ declare function defineSingletonContentType<TFields extends readonly AnyFieldDefinition[], _TFieldsets extends readonly Fieldset<AnyFieldDefinition[]>[]>(name: string, config: SingletonConfigWithFields<TFields>): SingletonContentTypeDefinition<TFields, readonly []>;
6909
+ declare function defineSingletonContentType<_TFields extends readonly AnyFieldDefinition[], TFieldsets extends readonly Fieldset<AnyFieldDefinition[]>[]>(name: string, config: SingletonConfigWithFieldsets<TFieldsets>): SingletonContentTypeDefinition<readonly [], TFieldsets>;
6910
+ declare const defineSingleton: typeof defineSingletonContentType;
6313
6911
  /**
6314
- * Query conditions for filtering content
6315
- * Supports both content fields and metadata fields
6912
+ * What a read reports about a singleton beside its fields: the committed document's
6913
+ * `SingletonMetadata`, read through `http/api-schema.ts` rather than declared again here.
6316
6914
  *
6317
- * Typed by the content type's fields where a schema types the client: each key is a declared field
6318
- * and each value one of that field's values. Untyped (`BaseContent`, which declares no fields), any
6319
- * field name is accepted — nothing declares which exist.
6915
+ * Narrower than an entry's — no slug, default locale, available locales or references — and it
6916
+ * names the singleton by `id` and `type`. The hand-written type this replaces declared a `key` and a
6917
+ * `singletonType` the wire does not carry, and `Date` timestamps where it sends ISO 8601 strings.
6320
6918
  */
6321
- type WhereClause<T extends BaseContent = BaseContent> = ([
6322
- Exclude<keyof T, '_metadata'>
6323
- ] extends [never] ? {
6324
- [field: string]: unknown;
6325
- } : {
6326
- [K in Exclude<keyof T, '_metadata'>]?: WhereFieldCondition<T[K]>;
6327
- }) & {
6328
- /** Metadata field conditions */
6329
- _metadata?: {
6330
- [K in keyof T['_metadata']]?: T['_metadata'][K] | WhereOperator<T['_metadata'][K]>;
6331
- };
6919
+ type SingletonMetadata = components['schemas']['SingletonMetadata'];
6920
+ /**
6921
+ * Type alias for any singleton content type definition.
6922
+ */
6923
+ type AnySingletonContentTypeDefinition = SingletonContentTypeDefinition<any, any>;
6924
+ /**
6925
+ * Infer the TypeScript type from a singleton definition: every field typed as a read returns it
6926
+ * (`schema/infer-fields.ts`), plus `_metadata`. `S` is the schema, as for `InferContentType`.
6927
+ */
6928
+ type InferSingletonContentType<T extends AnySingletonContentTypeDefinition, S extends FieldSchemaContext | undefined = undefined> = FieldValues<DeclaredFields<T>, S> & {
6929
+ _metadata: SingletonMetadata;
6332
6930
  };
6931
+ type InferSingleton<T extends AnySingletonContentTypeDefinition, S extends FieldSchemaContext | undefined = undefined> = InferSingletonContentType<T, S>;
6932
+
6333
6933
  /**
6334
- * Query operators for advanced filtering
6934
+ * Asset type definition matching @relyio/schema AssetTypeSchema
6935
+ *
6936
+ * Asset types are first-class entries (entryType: 'asset') that pair a binary
6937
+ * pipeline family (declared via exactly one kind key: `image`, `video`, or
6938
+ * `file`) with user-defined metadata fields that reuse the standard field
6939
+ * system — including fieldsets, workflow, access tags, and AI config.
6940
+ *
6941
+ * The kind config blocks are strongly typed below (mirroring the zod-inferred
6942
+ * `@relyio/schema` types), so authoring asset types in TypeScript gets full
6943
+ * autocomplete. The authoritative validation still lives in @relyio/schema's
6944
+ * `AssetTypesValidator` and runs on deploy.
6335
6945
  */
6336
- interface WhereOperator<T = unknown> {
6337
- /** Equals */
6338
- $eq?: T;
6339
- /** Not equals */
6340
- $ne?: T;
6341
- /** Greater than */
6342
- $gt?: T;
6343
- /** Greater than or equal */
6344
- $gte?: T;
6345
- /** Less than */
6346
- $lt?: T;
6347
- /** Less than or equal */
6348
- $lte?: T;
6349
- /** In array */
6350
- $in?: T[];
6351
- /** Not in array */
6352
- $nin?: T[];
6353
- /** Contains (for strings) */
6354
- $contains?: string;
6355
- /** Starts with (for strings) */
6356
- $startsWith?: string;
6357
- /** Ends with (for strings) */
6358
- $endsWith?: string;
6359
- /** Regular expression match */
6360
- $regex?: string;
6361
- /** Exists (field is not null/undefined) */
6362
- $exists?: boolean;
6946
+
6947
+ /** Resize fit modes supported by the Cloudflare Images binding. */
6948
+ type ImageFitMode = 'cover' | 'contain' | 'fill' | 'inside' | 'outside';
6949
+ /** Output formats the Cloudflare Images binding can produce (`heic` is input-only). */
6950
+ type ImageOutputFormat = 'avif' | 'webp' | 'jpeg' | 'png';
6951
+ /** Shared image transform props (CF Images vocabulary). */
6952
+ interface ImageTransform {
6953
+ width?: number;
6954
+ height?: number;
6955
+ fit?: ImageFitMode;
6956
+ format?: ImageOutputFormat;
6957
+ quality?: number;
6958
+ }
6959
+ /** Upload gate for the `image` kind (rejects bad files at the door). */
6960
+ interface ImageUploadConfig {
6961
+ allowedMimeTypes?: string[];
6962
+ maxFileSize?: number;
6963
+ minWidth?: number;
6964
+ maxWidth?: number;
6965
+ minHeight?: number;
6966
+ maxHeight?: number;
6967
+ /** `width:height`, e.g. `16:9`. */
6968
+ aspectRatio?: string;
6969
+ }
6970
+ /** Upload gate for the `video` kind. */
6971
+ interface VideoUploadConfig {
6972
+ allowedMimeTypes?: string[];
6973
+ maxFileSize?: number;
6974
+ maxDuration?: number;
6975
+ minWidth?: number;
6976
+ maxWidth?: number;
6977
+ minHeight?: number;
6978
+ maxHeight?: number;
6979
+ }
6980
+ /** Upload gate for the `file` kind (MIME + size only in v1). */
6981
+ interface FileUploadConfig {
6982
+ allowedMimeTypes?: string[];
6983
+ maxFileSize?: number;
6984
+ }
6985
+ /** Delivery rendition preset (max 20 per asset type), applied on the fly by the gateway. */
6986
+ interface VariantDefinition extends ImageTransform {
6987
+ /** Variant id; must start with a letter (codegen emits the `*Variant` union from these). */
6988
+ id: string;
6363
6989
  }
6364
6990
  /**
6365
- * Sort options for query results
6991
+ * Ingest normalization of the canonical stored original (image v1 only).
6992
+ * `true` expands to the platform default on deploy.
6366
6993
  */
6367
- type SortOptions<T extends BaseContent = BaseContent> = {
6368
- [K in keyof T]?: 'asc' | 'desc';
6369
- };
6994
+ type ImageSourceConfig = boolean | (ImageTransform & {
6995
+ stripMetadata?: boolean;
6996
+ });
6997
+ /** EXIF retention policy for the `image` kind (plan 15). */
6998
+ interface ImageExifConfig {
6999
+ /** Retain GPS in `extracted.exif` (default strips it for privacy). */
7000
+ keepGps?: boolean;
7001
+ }
7002
+ /** Image kind config (`upload`, `source`, `variants`, `localization`, `exif`). */
7003
+ interface ImageKindConfig {
7004
+ upload?: ImageUploadConfig;
7005
+ source?: ImageSourceConfig;
7006
+ /** Max 20 variants per asset type. */
7007
+ variants?: VariantDefinition[];
7008
+ localization?: LocalizationConfig;
7009
+ exif?: ImageExifConfig;
7010
+ }
7011
+ /** Poster/thumbnail strategy for the `video` kind. */
7012
+ interface VideoPosterConfig {
7013
+ /** 0.0–1.0 → Stream thumbnailTimestampPct. */
7014
+ defaultTimestampPct?: number;
7015
+ /** Enable an animated preview (gif/webp). */
7016
+ animated?: boolean;
7017
+ }
7018
+ /** Subtitle track strategy for the `video` kind. */
7019
+ interface VideoCaptionsConfig {
7020
+ enabled?: boolean;
7021
+ requiredLocales?: string[];
7022
+ /** Stream AI transcription when no track is uploaded. */
7023
+ autoGenerate?: boolean;
7024
+ }
7025
+ /** Downloadable-MP4 toggle for the `video` kind. */
7026
+ interface VideoDownloadConfig {
7027
+ enabled?: boolean;
7028
+ }
7029
+ /** Stream watermark profile for the `video` kind. */
7030
+ interface VideoWatermarkConfig {
7031
+ enabled?: boolean;
7032
+ /** Account-level Stream watermark profile uid. */
7033
+ profileId?: string;
7034
+ }
6370
7035
  /**
6371
- * Query options for content requests
7036
+ * Video kind config (`upload`, `poster`, `captions`, `download`, `watermark`,
7037
+ * `localization`). Stream auto-generates the ABR ladder — there is intentionally
7038
+ * NO `variants` and NO `encoding` block.
6372
7039
  */
6373
- interface QueryOptions<T extends BaseContent = BaseContent> {
6374
- /** Conditions to filter by */
6375
- where?: WhereClause<T>;
6376
- /** Fields to include in response */
6377
- select?: (keyof T)[];
6378
- /** Related content to include */
6379
- include?: string[];
6380
- /** Sort options */
6381
- sort?: SortOptions<T>;
6382
- /** Limit number of results */
6383
- limit?: number;
6384
- /** Offset for pagination */
6385
- offset?: number;
6386
- /** Cursor for cursor-based pagination */
6387
- cursor?: string;
7040
+ interface VideoKindConfig {
7041
+ upload?: VideoUploadConfig;
7042
+ poster?: VideoPosterConfig;
7043
+ captions?: VideoCaptionsConfig;
7044
+ download?: VideoDownloadConfig;
7045
+ watermark?: VideoWatermarkConfig;
7046
+ localization?: LocalizationConfig;
7047
+ }
7048
+ /** Malware scan config for the `file` kind (plan 19). */
7049
+ interface FileScanConfig {
7050
+ enabled?: boolean;
7051
+ blockUntilClean?: boolean;
7052
+ }
7053
+ /** File kind config (`upload`, `localization`, `scan`, `extractText`). */
7054
+ interface FileKindConfig {
7055
+ upload?: FileUploadConfig;
7056
+ localization?: LocalizationConfig;
7057
+ /** Malware scan (plan 19). */
7058
+ scan?: FileScanConfig;
7059
+ /** Extract searchable text + metadata for PDFs (plan 15). */
7060
+ extractText?: boolean;
7061
+ }
7062
+ interface AssetTypeBaseConfig {
7063
+ /** Display name shown in the UI */
7064
+ displayName: string;
7065
+ /** Plural display name (e.g., "Product Photos" for "Product Photo") */
7066
+ displayNamePlural?: string;
7067
+ /** Description of the asset type */
7068
+ description?: string;
7069
+ /**
7070
+ * AI configuration. `ai.instructions` is an optional global brief; per-field
7071
+ * `ai.instructions` describe individual fields. `ai.autoGenerate` (image
7072
+ * kind, v1) is the master switch: when true, the derived analysis agent runs
7073
+ * after upload and fills every field that declares `ai.instructions`, applied
7074
+ * as a review proposal.
7075
+ */
7076
+ ai?: AssetAIConfig;
7077
+ /** Field ID to use as the asset display title */
7078
+ displayField?: string;
7079
+ /** Access tags for role-based access control */
7080
+ accessTags?: string[];
7081
+ /** Workflow configuration for this asset type */
7082
+ workflow?: ContentTypeWorkflowConfig;
7083
+ /** Image pipeline config — mutually exclusive with `video`/`file` */
7084
+ image?: ImageKindConfig;
7085
+ /** Video pipeline config — mutually exclusive with `image`/`file` */
7086
+ video?: VideoKindConfig;
7087
+ /** File pipeline config — mutually exclusive with `image`/`video` */
7088
+ file?: FileKindConfig;
6388
7089
  }
6389
7090
  /**
6390
- * Content creation input - excludes metadata fields that are managed by the system
7091
+ * Type alias for a fieldset with any fields.
6391
7092
  */
6392
- type CreateInput<T extends BaseContent> = Omit<T, '_metadata'> & {
6393
- /** Optional metadata that can be set during creation */
6394
- _metadata?: {
6395
- /** Parent ID for hierarchical content */
6396
- parentId?: string | null;
6397
- /** Content locale */
6398
- locale?: string;
6399
- };
6400
- };
7093
+ type AnyFieldset$1 = Fieldset<any>;
7094
+ /** Asset type configuration using direct fields. */
7095
+ interface AssetTypeConfigWithFields<TFields extends readonly AnyFieldDefinition[] = readonly AnyFieldDefinition[]> extends AssetTypeBaseConfig {
7096
+ /** Direct field definitions - preserves literal types */
7097
+ fields: TFields;
7098
+ /** Cannot have fieldsets when using fields */
7099
+ fieldsets?: never;
7100
+ }
7101
+ /** Asset type configuration using fieldsets. */
7102
+ interface AssetTypeConfigWithFieldsets<TFieldsets extends readonly AnyFieldset$1[] = readonly AnyFieldset$1[]> extends AssetTypeBaseConfig {
7103
+ /** Field organization via fieldsets - preserves literal types */
7104
+ fieldsets: TFieldsets;
7105
+ /** Cannot have direct fields when using fieldsets */
7106
+ fields?: never;
7107
+ }
6401
7108
  /**
6402
- * Content update input - excludes system-managed metadata fields
7109
+ * Asset type configuration with no metadata fields: the asset is its file. `AssetTypeSchema` makes
7110
+ * `fields` and `fieldsets` both optional, so this is an asset type deploy accepts (REL-1454).
6403
7111
  */
6404
- type UpdateInput<T extends BaseContent> = Partial<Omit<T, '_metadata'>> & {
6405
- /** Optional metadata that can be updated */
6406
- _metadata?: {
6407
- /** Parent ID for hierarchical content */
6408
- parentId?: string | null;
6409
- /** Content locale */
6410
- locale?: string;
6411
- };
7112
+ interface AssetTypeConfigWithoutFields extends AssetTypeBaseConfig {
7113
+ fields?: never;
7114
+ fieldsets?: never;
7115
+ }
7116
+ /** Asset type configuration: direct fields, fieldsets, or neither. */
7117
+ type AssetTypeConfig<TFields extends readonly AnyFieldDefinition[] = readonly AnyFieldDefinition[], TFieldsets extends readonly AnyFieldset$1[] = readonly AnyFieldset$1[]> = AssetTypeConfigWithFields<TFields> | AssetTypeConfigWithFieldsets<TFieldsets> | AssetTypeConfigWithoutFields;
7118
+ /** Asset type definition - preserves field types for inference. */
7119
+ interface AssetTypeDefinition<TFields extends readonly AnyFieldDefinition[] = readonly AnyFieldDefinition[], TFieldsets extends readonly AnyFieldset$1[] = readonly AnyFieldset$1[]> {
7120
+ readonly _tag: 'assetType';
7121
+ readonly name: string;
7122
+ readonly displayName: string;
7123
+ readonly displayNamePlural?: string;
7124
+ readonly description?: string;
7125
+ readonly ai?: AssetAIConfig;
7126
+ readonly displayField?: string;
7127
+ readonly accessTags?: string[];
7128
+ readonly workflow?: ContentTypeWorkflowConfig;
7129
+ readonly image?: ImageKindConfig;
7130
+ readonly video?: VideoKindConfig;
7131
+ readonly file?: FileKindConfig;
7132
+ readonly fields?: TFields;
7133
+ readonly fieldsets?: TFieldsets;
7134
+ }
7135
+ /**
7136
+ * Define an asset type.
7137
+ *
7138
+ * Exactly one kind key (`image`, `video`, or `file`) must be supplied. Metadata
7139
+ * fields are optional: declare `fields`, `fieldsets`, or neither. The generic
7140
+ * type parameters preserve literal field IDs for inference, mirroring
7141
+ * `defineContentType`.
7142
+ *
7143
+ * @example
7144
+ * const productPhoto = defineAssetType('productPhoto', {
7145
+ * displayName: 'Product Photo',
7146
+ * image: {
7147
+ * upload: { allowedMimeTypes: ['image/jpeg', 'image/png', 'image/webp'], maxFileSize: 10485760 },
7148
+ * variants: [{ id: 'thumb', width: 200, height: 200, fit: 'cover', format: 'webp' }],
7149
+ * },
7150
+ * fields: [
7151
+ * fields.shortText('altText', { ui: { displayName: 'Alt Text' } }),
7152
+ * ],
7153
+ * })
7154
+ */
7155
+ declare function defineAssetType(name: string, config: AssetTypeConfigWithoutFields): AssetTypeDefinition<readonly [], readonly []>;
7156
+ declare function defineAssetType<TFields extends readonly AnyFieldDefinition[], _TFieldsets extends readonly Fieldset<AnyFieldDefinition[]>[]>(name: string, config: AssetTypeConfigWithFields<TFields>): AssetTypeDefinition<TFields, readonly []>;
7157
+ declare function defineAssetType<_TFields extends readonly AnyFieldDefinition[], TFieldsets extends readonly Fieldset<AnyFieldDefinition[]>[]>(name: string, config: AssetTypeConfigWithFieldsets<TFieldsets>): AssetTypeDefinition<readonly [], TFieldsets>;
7158
+ /**
7159
+ * Type alias for any asset type definition.
7160
+ */
7161
+ type AnyAssetTypeDefinition = AssetTypeDefinition<any, any>;
7162
+ /**
7163
+ * Infer the TypeScript type from an asset type definition.
7164
+ *
7165
+ * Mirrors {@link InferContentType}: produces the (optional) metadata field shape
7166
+ * plus `_metadata`, so it is assignable to `BaseContent` and can parametrize
7167
+ * `AssetClient<T>`. The runtime `file`/`urls` blocks are layered on by the
7168
+ * client's `AssetEntryResponse<T>` return type, not here, to keep the schema
7169
+ * layer free of any dependency on the client layer.
7170
+ */
7171
+ type InferAssetType<T extends AnyAssetTypeDefinition, S extends FieldSchemaContext | undefined = undefined> = FieldValues<DeclaredFields<T>, S> & {
7172
+ _metadata: EntryMetadata;
6412
7173
  };
7174
+
6413
7175
  /**
6414
- * What the entry list serves — **read from the committed document**, not
6415
- * written down here.
7176
+ * What a read returns for each field, derived from the field's declaration (`INV-SS-TYPES-INFERRED`).
6416
7177
  *
6417
- * It used to be a hand-written `{ items, total?, hasMore, nextCursor }`, and
6418
- * every field of it was wrong after API2: the route is the cursor dialect, so
6419
- * the body is `{ data, page: { nextCursor, hasMore } }` and there is no total
6420
- * at all. `execute()` therefore resolved `result.items` — `undefined` — for
6421
- * every caller of the SDK's most-used method, and nothing could see it because
6422
- * the type said otherwise.
7178
+ * Every `Infer*` in this package — content types, singletons, asset types, settings groups — types
7179
+ * its fields here and nowhere else, so an entry, a referenced entry, a component and a list item are
7180
+ * typed by one table. The types describe **what a read returns**, which is not always what a write
7181
+ * accepts:
6423
7182
  *
6424
- * Deriving it means the next dialect change is a compile error in user code
6425
- * rather than an `undefined` at runtime (`INV-API-CLIENT-IS-DERIVED`).
7183
+ * - `richText` is the stored HTML string; `date` is `YYYY-MM-DD` and `dateTime` an ISO 8601 string —
7184
+ * the client does not revive dates.
7185
+ * - A `reference` is the target's id until `include` names it, and then the target entry itself.
7186
+ * The type cannot see `include`, so it is both: `string | <entry>`. A single reference whose target
7187
+ * was deleted with `onTargetDelete: 'nullify'` is `null`.
7188
+ * - A localized field is the value for the one locale the read composed, like any other field; the
7189
+ * other locales of a `locales=` read sit under `_metadata.localizations`, not here.
7190
+ * - Every field is optional. The wire omits a field with no value — a draft, a `fields` projection, a
7191
+ * locale with nothing to fall back to, an entry older than a field — so `required` does not make
7192
+ * one present.
6426
7193
  */
6427
- type ContentQueryResult<T extends BaseContent = BaseContent> = Wire<'/v1/{contentType}', 'get', T>;
7194
+
6428
7195
  /**
6429
- * Singleton content (single instance per type)
6430
- * Matches the actual RelyIO API structure
7196
+ * The parts of a schema a field's value type reads: the types a reference may expand to and the
7197
+ * components a component field names. Structural, so every `defineSchema()` result fits.
7198
+ *
7199
+ * Without one in view — `InferContentType<typeof post>` with no second argument — a reference
7200
+ * expands to an {@link UnresolvedEntry} and a component to an {@link UnresolvedComponent}: the field
7201
+ * is still typed, but what it names is not.
6431
7202
  */
6432
- interface SingletonContent {
6433
- /** Content fields at top level */
6434
- [key: string]: unknown;
6435
- /** RelyIO metadata object for singletons */
6436
- _metadata: {
6437
- /** Singleton key identifier */
6438
- key: string;
6439
- /** When the singleton was created */
6440
- createdAt: Date;
6441
- /** When the singleton was last updated */
6442
- updatedAt: Date;
6443
- /** Singleton type identifier */
6444
- singletonType: string;
6445
- /** Content version */
6446
- version: number;
6447
- /** Content locale */
6448
- locale: string;
6449
- };
7203
+ interface FieldSchemaContext {
7204
+ readonly contentTypes: object;
7205
+ readonly components: object;
7206
+ readonly singletonContentTypes: object;
7207
+ readonly assetTypes?: object;
6450
7208
  }
7209
+ /** A schema in view, or `undefined` when none is. */
7210
+ type Context = FieldSchemaContext | undefined;
7211
+ /** An expanded reference whose target type is not in view: an entry, with fields nothing declared. */
7212
+ interface UnresolvedEntry {
7213
+ _metadata: EntryMetadata;
7214
+ [field: string]: unknown;
7215
+ }
7216
+ /** A component whose definition is not in view: an object, with fields nothing declared. */
7217
+ type UnresolvedComponent = Record<string, unknown>;
6451
7218
  /**
6452
- * Settings group
7219
+ * One row per field type the schema declares. `OverEveryFieldType` makes the table exhaustive by
7220
+ * construction: a field type added to `FieldType` without a row here fails to compile, rather than
7221
+ * reading as `unknown`.
6453
7222
  */
6454
- interface SettingsGroup {
6455
- /** Unique identifier for the settings group */
6456
- id: string;
6457
- /** Settings group name */
6458
- name: string;
6459
- /** Settings data */
6460
- settings: Record<string, unknown>;
6461
- /** When the settings were created */
6462
- createdAt: string;
6463
- /** When the settings were last updated */
6464
- updatedAt: string;
6465
- }
7223
+ type OverEveryFieldType<T extends {
7224
+ [K in FieldType]: unknown;
7225
+ }> = T;
7226
+ type FieldValueByType<C, S extends Context> = OverEveryFieldType<{
7227
+ shortText: string;
7228
+ longText: string;
7229
+ /** The stored HTML. */
7230
+ richText: string;
7231
+ email: string;
7232
+ url: string;
7233
+ slug: string;
7234
+ integer: number;
7235
+ decimal: number;
7236
+ boolean: boolean;
7237
+ enum: EnumValue<C>;
7238
+ /** `YYYY-MM-DD`. */
7239
+ date: string;
7240
+ /** ISO 8601. */
7241
+ dateTime: string;
7242
+ reference: ReferenceValue<C, S>;
7243
+ tags: string[];
7244
+ list: ListValue<C, S>;
7245
+ }>;
6466
7246
  /**
6467
- * Custom query definition
7247
+ * The value a read returns for field `F`.
7248
+ *
7249
+ * The last arm is the one `unknown` in this module, and it is deliberate: a field whose `type` is not
7250
+ * a declared literal — a definition built from a plain `string` rather than through `fields.*` — has
7251
+ * no row to read.
6468
7252
  */
6469
- interface CustomQuery<TVariables = unknown, TResponse = unknown> {
6470
- /** Query name */
6471
- name: string;
6472
- /** Query variables */
6473
- variables?: TVariables;
6474
- /** Expected response type */
6475
- response?: TResponse;
7253
+ type FieldValue<F extends AnyFieldDefinition, S extends Context = undefined> = F['type'] extends `component(${infer Id})` ? ComponentValue<Id, S> : F['type'] extends FieldType ? FieldValueByType<NonNullable<F['config']>, S>[F['type']] : unknown;
7254
+ /** The fields `F` (a union of field definitions) as an object, each optional — see the module note. */
7255
+ type FieldValues<F extends AnyFieldDefinition, S extends Context = undefined> = {
7256
+ [K in F['id']]?: FieldValue<Extract<F, {
7257
+ readonly id: K;
7258
+ }>, S>;
7259
+ };
7260
+ /**
7261
+ * Every field a definition declares, directly or through its fieldsets, as one union — the one walk
7262
+ * over `fields` / `fieldsets` every `Infer*` shares.
7263
+ */
7264
+ type DeclaredFields<T extends {
7265
+ readonly fields?: unknown;
7266
+ readonly fieldsets?: unknown;
7267
+ }> = Extract<(NonNullable<T['fields']> extends readonly (infer F)[] ? F : never) | (NonNullable<T['fieldsets']> extends readonly (infer FS)[] ? FS extends {
7268
+ readonly fields: readonly (infer F)[];
7269
+ } ? F : never : never), AnyFieldDefinition>;
7270
+ /** `multi` as declared: `true`, `false`, or `boolean` when the declaration does not say. */
7271
+ type Multiplicity<C> = C extends {
7272
+ readonly multi?: infer M;
7273
+ } ? M : false;
7274
+ /** One `V`, a list of them, or — when `multi` is not a literal — either. */
7275
+ type OneOrMany<C, V> = [Multiplicity<C>] extends [true] ? V[] : [Multiplicity<C>] extends [false | undefined] ? V : V | V[];
7276
+ type EnumValue<C> = OneOrMany<C, C extends {
7277
+ readonly options: ReadonlyArray<{
7278
+ readonly value: infer V;
7279
+ }>;
7280
+ } ? V : string>;
7281
+ type ReferenceTarget<C> = C extends {
7282
+ readonly to: infer T;
7283
+ } ? T extends readonly (infer E)[] ? E : T : string;
7284
+ /** `R[K]` where `R` declares `K`. A `Record<string, never>` default declares nothing. */
7285
+ type Declared<R, K> = K extends keyof R ? R[K] : never;
7286
+ type ContentEntryOf<D, S extends Context> = D extends ContentTypeDefinition ? InferContentType<D, S> : never;
7287
+ type SingletonEntryOf<D, S extends Context> = D extends SingletonContentTypeDefinition ? InferSingletonContentType<D, S> : never;
7288
+ type AssetEntryOf<D, S extends Context> = D extends AssetTypeDefinition ? InferAssetType<D, S> : never;
7289
+ type OrUnresolved<T> = [T] extends [never] ? UnresolvedEntry : T;
7290
+ /** What `include` expands a reference to `Target` into: that type's entry, typed by the schema. */
7291
+ type ExpandedEntry<Target, S extends Context> = S extends FieldSchemaContext ? OrUnresolved<ContentEntryOf<Declared<S['contentTypes'], Target>, S> | SingletonEntryOf<Declared<S['singletonContentTypes'], Target>, S> | AssetEntryOf<Declared<NonNullable<S['assetTypes']>, Target>, S>> : UnresolvedEntry;
7292
+ type ReferenceValue<C, S extends Context> = [Multiplicity<C>] extends [true] ? Array<string | ExpandedEntry<ReferenceTarget<C>, S>> : [Multiplicity<C>] extends [false | undefined] ? string | null | ExpandedEntry<ReferenceTarget<C>, S> : string | null | Array<string | ExpandedEntry<ReferenceTarget<C>, S>> | ExpandedEntry<ReferenceTarget<C>, S>;
7293
+ type ComponentFields<D, S extends Context> = [D] extends [never] ? UnresolvedComponent : D extends {
7294
+ readonly fields: readonly (infer F)[];
7295
+ } ? FieldValues<Extract<F, AnyFieldDefinition>, S> : UnresolvedComponent;
7296
+ type ComponentValue<Id extends string, S extends Context> = S extends FieldSchemaContext ? ComponentFields<Declared<S['components'], Id>, S> : UnresolvedComponent;
7297
+ /**
7298
+ * A list with subfields is a list of objects typed by them; a list without is a list of strings,
7299
+ * which is what the validation document enforces for it.
7300
+ */
7301
+ type ListValue<C, S extends Context> = C extends {
7302
+ readonly subfields?: infer Sub;
7303
+ } ? Sub extends readonly (infer F)[] ? [F] extends [never] ? string[] : Array<FieldValues<Extract<F, AnyFieldDefinition>, S>> : string[] : string[];
7304
+
7305
+ /**
7306
+ * Content type definition matching @relyio/schema ContentTypeSchema
7307
+ *
7308
+ * Uses advanced TypeScript generics to preserve each field's declaration through the type system,
7309
+ * so `InferContentType` types every field by what a read returns and `where()` autocompletes.
7310
+ */
7311
+
7312
+ /**
7313
+ * Fieldset for organizing related fields
7314
+ * Generic over fields to preserve literal field IDs
7315
+ */
7316
+ interface Fieldset<TFields extends readonly AnyFieldDefinition[] = readonly AnyFieldDefinition[]> {
7317
+ /** Unique fieldset identifier */
7318
+ readonly id: string;
7319
+ /** Display name shown in the UI */
7320
+ readonly displayName: string;
7321
+ /** Optional description */
7322
+ readonly description?: string;
7323
+ /** Whether an editing surface shows this fieldset collapsed to begin with */
7324
+ readonly collapsedByDefault?: boolean;
7325
+ /** AI configuration for content generation and review */
7326
+ readonly ai?: AIConfig;
7327
+ /** Fields within this fieldset - preserves literal types */
7328
+ readonly fields: TFields;
6476
7329
  }
6477
7330
  /**
6478
- * Content type schema information
7331
+ * Type alias for a fieldset with any fields.
7332
+ * Used in generic constraints where we need to accept any fieldset type.
7333
+ */
7334
+ type AnyFieldset = Fieldset<any>;
7335
+ /**
7336
+ * Create a fieldset for organizing fields
7337
+ * Generic to preserve the specific field types for type inference
7338
+ *
7339
+ * @example
7340
+ * const seoFieldset = fieldset('seo', {
7341
+ * displayName: 'SEO Settings',
7342
+ * fields: [
7343
+ * fields.shortText('metaTitle', { config: { maxLength: 60 } }),
7344
+ * fields.longText('metaDescription', { config: { maxLength: 160 } }),
7345
+ * ]
7346
+ * })
7347
+ */
7348
+ declare function fieldset<TFields extends readonly AnyFieldDefinition[]>(id: string, config: {
7349
+ displayName: string;
7350
+ description?: string;
7351
+ /** Show the fieldset collapsed until an editor opens it */
7352
+ collapsedByDefault?: boolean;
7353
+ ai?: AIConfig;
7354
+ fields: TFields;
7355
+ }): Fieldset<TFields>;
7356
+ /**
7357
+ * Content type configuration using direct fields
7358
+ * Generic to preserve literal field IDs for type inference
6479
7359
  */
6480
- interface ContentTypeSchema {
6481
- /** Content type name */
6482
- name: string;
6483
- /** Display name */
7360
+ interface ContentTypeConfigWithFields<TFields extends readonly AnyFieldDefinition[] = readonly AnyFieldDefinition[]> {
7361
+ /** Display name shown in the UI */
6484
7362
  displayName: string;
6485
- /** Description */
7363
+ /** Plural display name shown in the UI (e.g., "Products" for "Product") */
7364
+ displayNamePlural?: string;
7365
+ /** Description of the content type */
6486
7366
  description?: string;
6487
- /** Field definitions */
6488
- fields: FieldDefinition[];
6489
- /** Whether this content type is hierarchical */
7367
+ /** AI configuration: generation/review guidance */
7368
+ ai?: AIConfig;
7369
+ /**
7370
+ * Field ID to use as entry display title in lists, references, and editor header.
7371
+ * If not set, falls back to: title → name → slug → first shortText field → entryUid
7372
+ */
7373
+ displayField?: string;
7374
+ /** Whether this content type supports hierarchical (parent-child) relationships */
6490
7375
  hierarchical?: boolean;
6491
- /** Preview configuration */
6492
- preview?: {
6493
- select?: Record<string, string>;
6494
- prepare?: (_selection: Record<string, unknown>) => Record<string, unknown>;
6495
- };
7376
+ /** Access tags for role-based access control */
7377
+ accessTags?: string[];
7378
+ /** Workflow configuration for this content type */
7379
+ workflow?: ContentTypeWorkflowConfig;
7380
+ /** Direct field definitions - preserves literal types */
7381
+ fields: TFields;
7382
+ /** Cannot have fieldsets when using fields */
7383
+ fieldsets?: never;
6496
7384
  }
6497
7385
  /**
6498
- * Field definition for content types
7386
+ * Content type configuration using fieldsets
7387
+ * Generic to preserve fieldset field types
6499
7388
  */
6500
- interface FieldDefinition {
6501
- /** Field name */
6502
- name: string;
6503
- /** Field type */
6504
- type: FieldTypeName;
6505
- /** Display title */
6506
- title?: string;
6507
- /** Field description */
7389
+ interface ContentTypeConfigWithFieldsets<TFieldsets extends readonly AnyFieldset[] = readonly AnyFieldset[]> {
7390
+ /** Display name shown in the UI */
7391
+ displayName: string;
7392
+ /** Plural display name shown in the UI (e.g., "Products" for "Product") */
7393
+ displayNamePlural?: string;
7394
+ /** Description of the content type */
6508
7395
  description?: string;
6509
- /** Whether field is required */
6510
- required?: boolean;
6511
- /** Default value */
6512
- default?: unknown;
6513
- /** Validation rules */
6514
- validation?: ValidationRule[];
6515
- /** Field options */
6516
- options?: FieldOptions;
7396
+ /** AI configuration: generation/review guidance */
7397
+ ai?: AIConfig;
7398
+ /**
7399
+ * Field ID to use as entry display title in lists, references, and editor header.
7400
+ * If not set, falls back to: title → name → slug → first shortText field → entryUid
7401
+ */
7402
+ displayField?: string;
7403
+ /** Access tags for role-based access control */
7404
+ accessTags?: string[];
7405
+ /** Whether this content type supports hierarchical (parent-child) relationships */
7406
+ hierarchical?: boolean;
7407
+ /** Workflow configuration for this content type */
7408
+ workflow?: ContentTypeWorkflowConfig;
7409
+ /** Field organization via fieldsets - preserves literal types */
7410
+ fieldsets: TFieldsets;
7411
+ /** Cannot have direct fields when using fieldsets */
7412
+ fields?: never;
6517
7413
  }
6518
7414
  /**
6519
- * Supported field type names (string identifiers)
7415
+ * Content type configuration (either fields OR fieldsets, not both)
6520
7416
  */
6521
- type FieldTypeName = 'string' | 'number' | 'boolean' | 'date' | 'datetime' | 'text' | 'markdown' | 'richtext' | 'slug' | 'url' | 'email' | 'image' | 'file' | 'reference' | 'array' | 'object' | 'geopoint' | 'color';
7417
+ type ContentTypeConfig<TFields extends readonly AnyFieldDefinition[] = readonly AnyFieldDefinition[], TFieldsets extends readonly AnyFieldset[] = readonly AnyFieldset[]> = ContentTypeConfigWithFields<TFields> | ContentTypeConfigWithFieldsets<TFieldsets>;
6522
7418
  /**
6523
- * Field validation rules
7419
+ * Content type definition - preserves field types for inference
6524
7420
  */
6525
- interface ValidationRule {
6526
- /** Rule type */
6527
- type: 'required' | 'min' | 'max' | 'pattern' | 'custom';
6528
- /** Rule value */
6529
- value?: unknown;
6530
- /** Error message */
6531
- message?: string;
7421
+ interface ContentTypeDefinition<TFields extends readonly AnyFieldDefinition[] = readonly AnyFieldDefinition[], TFieldsets extends readonly AnyFieldset[] = readonly AnyFieldset[]> {
7422
+ readonly _tag: 'contentType';
7423
+ readonly name: string;
7424
+ readonly displayName: string;
7425
+ readonly displayNamePlural?: string;
7426
+ readonly description?: string;
7427
+ /** AI configuration: generation/review guidance */
7428
+ readonly ai?: AIConfig;
7429
+ /** Field ID to use as entry display title */
7430
+ readonly displayField?: string;
7431
+ readonly hierarchical?: boolean;
7432
+ readonly accessTags?: string[];
7433
+ readonly workflow?: ContentTypeWorkflowConfig;
7434
+ readonly fields?: TFields;
7435
+ readonly fieldsets?: TFieldsets;
6532
7436
  }
6533
7437
  /**
6534
- * Field-specific options
7438
+ * Define a content type with type-safe fields
7439
+ *
7440
+ * The generic type parameters preserve the literal field IDs through the type
7441
+ * system, enabling autocomplete in SDK methods like where(), select(), etc.
7442
+ *
7443
+ * @example
7444
+ * // Using direct fields
7445
+ * const product = defineContentType('product', {
7446
+ * displayName: 'Product',
7447
+ * fields: [
7448
+ * fields.shortText('title', { config: { required: true } }),
7449
+ * fields.decimal('price', { config: { min: 0, decimalPlaces: 2 } }),
7450
+ * ]
7451
+ * })
7452
+ *
7453
+ * @example
7454
+ * // Using fieldsets for organization
7455
+ * const product = defineContentType('product', {
7456
+ * displayName: 'Product',
7457
+ * fieldsets: [
7458
+ * fieldset('basic', {
7459
+ * displayName: 'Basic Info',
7460
+ * fields: [
7461
+ * fields.shortText('title', { config: { required: true } }),
7462
+ * ]
7463
+ * }),
7464
+ * fieldset('pricing', {
7465
+ * displayName: 'Pricing',
7466
+ * fields: [
7467
+ * fields.decimal('price', { config: { min: 0, decimalPlaces: 2 } }),
7468
+ * ]
7469
+ * }),
7470
+ * ]
7471
+ * })
6535
7472
  */
6536
- interface FieldOptions {
6537
- /** For array fields */
6538
- of?: FieldDefinition;
6539
- /** For reference fields */
6540
- to?: string | string[];
6541
- /** For string fields */
6542
- list?: string[];
6543
- /** For number fields */
6544
- min?: number;
6545
- max?: number;
6546
- /** For image/file fields */
6547
- accept?: string[];
6548
- /** For rich text fields */
6549
- marks?: string[];
6550
- blocks?: string[];
6551
- }
7473
+ declare function defineContentType<TFields extends readonly AnyFieldDefinition[], _TFieldsets extends readonly Fieldset<AnyFieldDefinition[]>[]>(name: string, config: ContentTypeConfigWithFields<TFields>): ContentTypeDefinition<TFields, readonly []>;
7474
+ declare function defineContentType<_TFields extends readonly AnyFieldDefinition[], TFieldsets extends readonly Fieldset<AnyFieldDefinition[]>[]>(name: string, config: ContentTypeConfigWithFieldsets<TFieldsets>): ContentTypeDefinition<readonly [], TFieldsets>;
6552
7475
  /**
6553
- * Real-time event types
7476
+ * Type alias for any content type definition.
6554
7477
  */
6555
- type RealtimeEventType = 'created' | 'updated' | 'deleted' | 'published' | 'unpublished';
7478
+ type AnyContentTypeDefinition = ContentTypeDefinition<any, any>;
6556
7479
  /**
6557
- * Real-time event payload
7480
+ * What a read reports about an entry beside its fields: the committed document's `EntryMetadata`
7481
+ * (`apps/services/api/openapi-spec.json`), read through `http/api-schema.ts`, its one derivation in
7482
+ * this package — not declared a second time here.
7483
+ *
7484
+ * It used to be written out by hand, and the copy had drifted from the wire: it declared a
7485
+ * `parentId` no read sends, typed `createdAt` and `updatedAt` as `Date` where the wire sends ISO 8601
7486
+ * strings, and left out what a reader most needs — `availableLocales`, `defaultLocale`, `slug`,
7487
+ * `refs` — so the preview toolbar took them through a structural type of its own. A field the
7488
+ * service adds or changes now reaches this type when `api-schema.ts` is regenerated, and
7489
+ * `__tests__/read-metadata.types.ts` fails `type:check` if a read stops declaring it.
7490
+ *
7491
+ * Every entry-shaped value carries it — a single read, each item of a list or of `children()`, and
7492
+ * an entry an `include` expanded — because the service builds each of them with one transform.
7493
+ * `versionCount` and `versions` are sent on a single read only, so they are optional.
6558
7494
  */
6559
- interface RealtimeEvent<T extends BaseContent = BaseContent> {
6560
- /** Event type */
6561
- type: RealtimeEventType;
6562
- /** Content type */
6563
- contentType: string;
6564
- /** Content item (for created/updated events) */
6565
- item?: T;
6566
- /** Content ID (for deleted events) */
6567
- id?: string;
6568
- /** Timestamp */
6569
- timestamp: number;
6570
- /** Event metadata */
6571
- metadata?: Record<string, unknown>;
6572
- }
7495
+ type EntryMetadata = components['schemas']['EntryMetadata'];
6573
7496
  /**
6574
- * Subscription options
7497
+ * The per-locale publication facts every one-document read reports, an entry's, a singleton's and a
7498
+ * settings group's alike (`INV-LM-PUBLICATION-IS-REPORTED-PER-LOCALE`): a `Pick` of the document's
7499
+ * {@link EntryMetadata}, so this package holds no copy of them. `localeStatus` is absent when the
7500
+ * locale has no content of its own.
6575
7501
  */
6576
- interface SubscriptionOptions<T extends BaseContent = BaseContent> {
6577
- /** Content type to subscribe to */
6578
- contentType: string;
6579
- /** Filter conditions */
6580
- where?: WhereClause<T>;
6581
- /** Events to listen for */
6582
- events?: RealtimeEventType[];
6583
- /** Subscription metadata */
6584
- metadata?: Record<string, unknown>;
6585
- }
7502
+ type LocalePublicationFields = Pick<EntryMetadata, 'localeStatus' | 'localeHasDraft' | 'draftLocales'>;
6586
7503
  /**
6587
- * Performance metrics
7504
+ * Infer the TypeScript type of an entry from a content type definition: every field it declares,
7505
+ * directly or through fieldsets, typed as a read returns it (`INV-SS-TYPES-INFERRED`), plus
7506
+ * `_metadata`. Each field is optional — `schema/infer-fields.ts` says why, and what each field type
7507
+ * reads as.
7508
+ *
7509
+ * `S` is the schema the type belongs to. With it, a reference expanded by `include` is typed as the
7510
+ * entry it points at and a component field by the component's fields; without it, those two are
7511
+ * typed as an entry or an object whose fields are not known. A client typed by a schema passes it.
7512
+ *
7513
+ * @example
7514
+ * const product = defineContentType('product', {
7515
+ * displayName: 'Product',
7516
+ * fields: [
7517
+ * fields.shortText('title'),
7518
+ * fields.decimal('price'),
7519
+ * fields.enum('status', {
7520
+ * config: {
7521
+ * options: [
7522
+ * { value: 'draft', label: 'Draft' },
7523
+ * { value: 'live', label: 'Live' },
7524
+ * ],
7525
+ * },
7526
+ * }),
7527
+ * ]
7528
+ * })
7529
+ *
7530
+ * type Product = InferContentType<typeof product>
7531
+ * // { title?: string; price?: number; status?: 'draft' | 'live'; _metadata: EntryMetadata }
6588
7532
  */
6589
- interface PerformanceMetrics {
6590
- /** Request duration in milliseconds */
6591
- duration: number;
6592
- /** Request timestamp */
6593
- timestamp: number;
6594
- /** Request URL */
6595
- url: string;
6596
- /** HTTP method */
6597
- method: string;
6598
- /** Response status code */
6599
- statusCode: number;
6600
- /** Whether response came from cache */
6601
- fromCache: boolean;
6602
- /** Cache hit ratio */
6603
- cacheHitRatio?: number;
6604
- }
7533
+ type InferContentType<T extends AnyContentTypeDefinition, S extends FieldSchemaContext | undefined = undefined> = FieldValues<DeclaredFields<T>, S> & {
7534
+ _metadata: EntryMetadata;
7535
+ };
6605
7536
 
6606
- export { type ApiPath as A, type BaseContent as B, type CreateInput as C, type DebugConfig as D, type Environment as E, type FieldTypeName as F, ValidationError as G, SchemaValidationError as H, InvalidPayloadError as I, RequiredFieldError as J, InvalidFieldTypeError as K, type LogLevel as L, type MatchRouteOptions as M, type MergedRelyIOConfig as N, type PathParamsOf as O, type PerformanceMetrics as P, type QueryOptions as Q, type RelyIOConfig as R, SDKError as S, type components as T, type UpdateInput as U, type ValidationRule as V, type Wire as W, type paths as X, type FieldDefinition as Y, type ApiMethod as a, type ApiSuccessBody as b, type RouteMatch as c, type WhereScalar as d, type WhereFieldCondition as e, type WhereClause as f, type WhereOperator as g, type SortOptions as h, type ContentQueryResult as i, type SingletonContent as j, type SettingsGroup as k, type CustomQuery as l, matchRoute as m, type ContentTypeSchema as n, type FieldOptions as o, type RealtimeEventType as p, type RealtimeEvent as q, type SubscriptionOptions as r, type CacheConfig as s, type RealtimeConfig as t, type RequestConfig as u, type ApiResponse as v, type RetryConfig as w, type CacheStrategy as x, type ValidationViolation as y, BaseValidationError as z };
7537
+ export { type SingletonConfigWithFieldsets as $, type AnyFieldDefinition as A, type BooleanConfig as B, type ComponentFieldConfig as C, type DecimalConfig as D, type EmailConfig as E, type FieldUIConfig as F, type UnresolvedComponent as G, defineContentType as H, type IntegerConfig as I, fieldset as J, type Fieldset as K, type LocalizationConfig as L, type ContentTypeConfig as M, type ContentTypeConfigWithFields as N, type ContentTypeConfigWithFieldsets as O, type ContentTypeDefinition as P, type EntryMetadata as Q, type RichTextConfig as R, type ShortTextConfig as S, type TagsConfig as T, type UrlConfig as U, type ValidationRule as V, type InferContentType as W, type LocalePublicationFields as X, defineSingletonContentType as Y, defineSingleton as Z, type SingletonConfigWithFields as _, type FieldAIConfig as a, type SingletonContentTypeDefinition as a0, type SingletonMetadata as a1, type InferSingletonContentType as a2, type InferSingleton as a3, defineAssetType as a4, type AssetTypeConfig as a5, type AssetTypeConfigWithFields as a6, type AssetTypeConfigWithFieldsets as a7, type AssetTypeConfigWithoutFields as a8, type AssetTypeDefinition as a9, getFirstWorkflowStage as aA, isFinalWorkflowStage as aB, type WorkflowEscalation as aC, type WorkflowAutoAssign as aD, type WorkflowStageConfig as aE, type WorkflowStageDefinition as aF, type WorkflowConfig as aG, type WorkflowDefinition as aH, type ContentTypeWorkflowConfig as aI, type paths as aJ, type components as aK, type InferAssetType as aa, type ImageKindConfig as ab, type VideoKindConfig as ac, type FileKindConfig as ad, type ImageTransform as ae, type ImageFitMode as af, type ImageOutputFormat as ag, type ImageUploadConfig as ah, type ImageSourceConfig as ai, type ImageExifConfig as aj, type VariantDefinition as ak, type VideoUploadConfig as al, type VideoPosterConfig as am, type VideoCaptionsConfig as an, type VideoDownloadConfig as ao, type VideoWatermarkConfig as ap, type FileUploadConfig as aq, type FileScanConfig as ar, defineWorkflow as as, defineWorkflowStage as at, defineContentTypeWorkflow as au, isWorkflowDefinition as av, isWorkflowStageDefinition as aw, getWorkflowStageIds as ax, findWorkflowStage as ay, getNextWorkflowStage as az, type FieldRule as b, type FieldDefinition as c, type LongTextConfig as d, type SlugConfig as e, type EnumConfig as f, type DateConfig as g, type DateTimeConfig as h, type ReferenceConfig as i, type ListConfig as j, type AIConfig as k, type AllFieldTypes as l, type AssetAIConfig as m, type BaseFieldConfig as n, type ComponentFieldType as o, type FieldType as p, type ReadOnlyRule as q, type RequirementRule as r, type RuleCondition as s, type RuleConditions as t, type VisibilityRule as u, type FieldSchemaContext as v, type FieldValue as w, type FieldValues as x, type DeclaredFields as y, type UnresolvedEntry as z };