@relyio/sdk 0.6.0 → 0.8.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.
- package/CHANGELOG.md +400 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/{chunk-DY2XT7OF.cjs → chunk-72UK5U7T.cjs} +70 -60
- package/dist/{chunk-I3ESNANB.js → chunk-H6IBQSMM.js} +2 -2
- package/dist/{chunk-7ABNXVWL.js → chunk-QFHVF3YF.js} +1617 -404
- package/dist/{chunk-HT6NFRM2.cjs → chunk-TZL374LS.cjs} +2 -2
- package/dist/{chunk-GCMQUM6N.cjs → chunk-XIE7WJV3.cjs} +1621 -407
- package/dist/{chunk-XJVY2CLY.js → chunk-YEJUMW4X.js} +70 -60
- package/dist/client/index.cjs +4 -3
- package/dist/client/index.d.cts +5 -4
- package/dist/client/index.d.ts +5 -4
- package/dist/client/index.js +2 -1
- package/dist/{index-d1Kz1e19.d.cts → define-content-type-cEGjIwT5.d.cts} +1859 -733
- package/dist/{index-yPbhZc6q.d.ts → define-content-type-cEGjIwT5.d.ts} +1859 -733
- package/dist/{define-schema-1kr2HIzN.d.cts → define-schema-BPj2srgh.d.ts} +189 -85
- package/dist/{define-schema-ChvAzY8H.d.ts → define-schema-DgbJ5Kwn.d.cts} +189 -85
- package/dist/index-B_rIWO_l.d.cts +860 -0
- package/dist/index-Cv4tmcrw.d.ts +860 -0
- package/dist/{index-Df1VsfJR.d.cts → index-DBoPPlT1.d.cts} +684 -277
- package/dist/{index-XqoGUaAY.d.ts → index-yRJ2IqM_.d.ts} +684 -277
- package/dist/index.cjs +148 -124
- package/dist/index.d.cts +174 -64
- package/dist/index.d.ts +174 -64
- package/dist/index.js +43 -18
- package/dist/schema/index.cjs +35 -35
- package/dist/schema/index.d.cts +13 -11
- package/dist/schema/index.d.ts +13 -11
- package/dist/schema/index.js +1 -1
- package/dist/types/index.d.cts +2 -2
- package/dist/types/index.d.ts +2 -2
- package/dist/utils/index.cjs +19 -19
- package/dist/utils/index.d.cts +10 -1
- package/dist/utils/index.d.ts +10 -1
- package/dist/utils/index.js +1 -1
- package/package.json +2 -1
- package/dist/define-content-type-CDB3kyeA.d.cts +0 -1173
- package/dist/define-content-type-CDB3kyeA.d.ts +0 -1173
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { P as EntryMetadata } from './define-content-type-CDB3kyeA.cjs';
|
|
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
|
|
@@ -74,6 +72,40 @@ interface paths {
|
|
|
74
72
|
patch?: never;
|
|
75
73
|
trace?: never;
|
|
76
74
|
};
|
|
75
|
+
'/internal/live/visitor-feed/{projectId}/{datasetId}/changes': {
|
|
76
|
+
parameters: {
|
|
77
|
+
query?: never;
|
|
78
|
+
header?: never;
|
|
79
|
+
path?: never;
|
|
80
|
+
cookie?: never;
|
|
81
|
+
};
|
|
82
|
+
get?: never;
|
|
83
|
+
put?: never;
|
|
84
|
+
/** Read a dataset’s ledger page after a cursor, in the published lens */
|
|
85
|
+
post: operations['readVisitorFeedChanges'];
|
|
86
|
+
delete?: never;
|
|
87
|
+
options?: never;
|
|
88
|
+
head?: never;
|
|
89
|
+
patch?: never;
|
|
90
|
+
trace?: never;
|
|
91
|
+
};
|
|
92
|
+
'/internal/live/visitor-key': {
|
|
93
|
+
parameters: {
|
|
94
|
+
query?: never;
|
|
95
|
+
header?: never;
|
|
96
|
+
path?: never;
|
|
97
|
+
cookie?: never;
|
|
98
|
+
};
|
|
99
|
+
get?: never;
|
|
100
|
+
put?: never;
|
|
101
|
+
/** Resolve a publishable key for the live Worker’s visitor door */
|
|
102
|
+
post: operations['resolveVisitorKey'];
|
|
103
|
+
delete?: never;
|
|
104
|
+
options?: never;
|
|
105
|
+
head?: never;
|
|
106
|
+
patch?: never;
|
|
107
|
+
trace?: never;
|
|
108
|
+
};
|
|
77
109
|
'/internal/media/claim': {
|
|
78
110
|
parameters: {
|
|
79
111
|
query?: never;
|
|
@@ -237,7 +269,11 @@ interface paths {
|
|
|
237
269
|
path?: never;
|
|
238
270
|
cookie?: never;
|
|
239
271
|
};
|
|
240
|
-
|
|
272
|
+
/**
|
|
273
|
+
* Read a file binding's upload status
|
|
274
|
+
* @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.
|
|
275
|
+
*/
|
|
276
|
+
get: operations['getFileStatus'];
|
|
241
277
|
put?: never;
|
|
242
278
|
post?: never;
|
|
243
279
|
/** Delete a file binding */
|
|
@@ -837,6 +873,111 @@ interface paths {
|
|
|
837
873
|
}
|
|
838
874
|
interface components {
|
|
839
875
|
schemas: {
|
|
876
|
+
/** @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. */
|
|
877
|
+
AssetFile: {
|
|
878
|
+
/**
|
|
879
|
+
* @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.
|
|
880
|
+
* @enum {string}
|
|
881
|
+
*/
|
|
882
|
+
status: 'failed' | 'pending_upload' | 'processing' | 'ready' | 'uploading';
|
|
883
|
+
/**
|
|
884
|
+
* @description `r2` for image and file kinds, `stream` for video.
|
|
885
|
+
* @enum {string}
|
|
886
|
+
*/
|
|
887
|
+
backend: 'r2' | 'stream';
|
|
888
|
+
fileName: string;
|
|
889
|
+
mimeType?: string | null;
|
|
890
|
+
/** @description In bytes. */
|
|
891
|
+
size?: number | null;
|
|
892
|
+
/** @description The SHA-256 the client declared: advisory, for duplicate detection only. */
|
|
893
|
+
hash?: string | null;
|
|
894
|
+
/**
|
|
895
|
+
* @description Enforced by the delivery gateway; a `protected` or `private` URL carries a token.
|
|
896
|
+
* @enum {string}
|
|
897
|
+
*/
|
|
898
|
+
visibility: 'private' | 'protected' | 'public';
|
|
899
|
+
/** @description What was read from the file. Enrichment adds keys as its stages finish, so the object is open beyond the ones named here. */
|
|
900
|
+
extracted?: {
|
|
901
|
+
width?: number;
|
|
902
|
+
height?: number;
|
|
903
|
+
format?: string;
|
|
904
|
+
duration?: number;
|
|
905
|
+
hasAlpha?: boolean;
|
|
906
|
+
isAnimated?: boolean;
|
|
907
|
+
orientation?: number;
|
|
908
|
+
placeholder?: string;
|
|
909
|
+
dominantColor?: string;
|
|
910
|
+
palette?: string[];
|
|
911
|
+
exif?: {
|
|
912
|
+
[key: string]: unknown;
|
|
913
|
+
};
|
|
914
|
+
video?: {
|
|
915
|
+
codec?: string;
|
|
916
|
+
bitrate?: number;
|
|
917
|
+
framerate?: number;
|
|
918
|
+
audioTracks?: unknown[];
|
|
919
|
+
} & {
|
|
920
|
+
[key: string]: unknown;
|
|
921
|
+
};
|
|
922
|
+
pageCount?: number;
|
|
923
|
+
text?: string;
|
|
924
|
+
safety?: {
|
|
925
|
+
nsfwScore?: number;
|
|
926
|
+
flagged?: boolean;
|
|
927
|
+
categories?: string[];
|
|
928
|
+
} & {
|
|
929
|
+
[key: string]: unknown;
|
|
930
|
+
};
|
|
931
|
+
} & {
|
|
932
|
+
[key: string]: unknown;
|
|
933
|
+
};
|
|
934
|
+
/** @description The smart-crop anchor, each axis `0`–`1`. */
|
|
935
|
+
focalPoint?: {
|
|
936
|
+
x: number;
|
|
937
|
+
y: number;
|
|
938
|
+
};
|
|
939
|
+
/** @description Where metadata enrichment got to. Independent of `status`. */
|
|
940
|
+
enrichment?: {
|
|
941
|
+
/** @enum {string} */
|
|
942
|
+
status: 'complete' | 'failed' | 'partial' | 'pending' | 'running';
|
|
943
|
+
};
|
|
944
|
+
/** @description The malware scan of a file-kind binding. */
|
|
945
|
+
scan?: {
|
|
946
|
+
/** @enum {string} */
|
|
947
|
+
status: 'clean' | 'error' | 'infected' | 'pending' | 'skipped';
|
|
948
|
+
};
|
|
949
|
+
processing?: components['schemas']['AssetFileProcessing'];
|
|
950
|
+
/** @description Whether a video can be played yet. */
|
|
951
|
+
playback?: {
|
|
952
|
+
ready?: boolean;
|
|
953
|
+
};
|
|
954
|
+
};
|
|
955
|
+
/** @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. */
|
|
956
|
+
AssetFileProcessing: {
|
|
957
|
+
/** @description The stage the pipeline last recorded. */
|
|
958
|
+
stage?: string;
|
|
959
|
+
/** @description How far the pipeline got, `0`–`100`, where it reports that (video encoding). */
|
|
960
|
+
progress?: number;
|
|
961
|
+
/** @description Why the file failed. Present exactly while `status` is `failed`. */
|
|
962
|
+
error?: {
|
|
963
|
+
/** @description The reason, e.g. `UNSUPPORTED_MIME`, `UPLOAD_TOO_LARGE` or `INTERNAL`. */
|
|
964
|
+
code?: string;
|
|
965
|
+
message?: string;
|
|
966
|
+
/** @description `true` only for `INTERNAL`, a failure no property of the file caused. */
|
|
967
|
+
retriable?: boolean;
|
|
968
|
+
};
|
|
969
|
+
};
|
|
970
|
+
/** @description One distinct value of the field, and the entry it was first found in. */
|
|
971
|
+
AutocompleteSuggestion: {
|
|
972
|
+
/** @description The suggested value. */
|
|
973
|
+
text: string;
|
|
974
|
+
/** @description The best relevance among the entries holding it. */
|
|
975
|
+
score: number;
|
|
976
|
+
/** @description An entry holding the value. */
|
|
977
|
+
id: string;
|
|
978
|
+
/** @description The value with its matched part wrapped in `<em>`, when Atlas highlighted it. */
|
|
979
|
+
highlight?: string;
|
|
980
|
+
};
|
|
840
981
|
/** @description One change to one entry, ids only. Refetch the entry through the ordinary read path to see it. */
|
|
841
982
|
Change: {
|
|
842
983
|
entryId: string;
|
|
@@ -852,6 +993,104 @@ interface components {
|
|
|
852
993
|
nextCursor: string | null;
|
|
853
994
|
hasMore: boolean;
|
|
854
995
|
};
|
|
996
|
+
/** @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. */
|
|
997
|
+
Entry: {
|
|
998
|
+
_metadata: components['schemas']['EntryMetadata'];
|
|
999
|
+
} & {
|
|
1000
|
+
[key: string]: unknown;
|
|
1001
|
+
};
|
|
1002
|
+
/** @description One locale an entry has content in. */
|
|
1003
|
+
EntryLocale: {
|
|
1004
|
+
code: string;
|
|
1005
|
+
/** @enum {string} */
|
|
1006
|
+
status: 'archived' | 'draft' | 'published';
|
|
1007
|
+
/** @description That locale’s own version counter. */
|
|
1008
|
+
version: number;
|
|
1009
|
+
/**
|
|
1010
|
+
* Format: date-time
|
|
1011
|
+
* @description When that locale was last published. Absent until it is.
|
|
1012
|
+
*/
|
|
1013
|
+
publishedAt?: string;
|
|
1014
|
+
};
|
|
1015
|
+
/** @description What this service reports about an entry beside its fields. */
|
|
1016
|
+
EntryMetadata: {
|
|
1017
|
+
id: string;
|
|
1018
|
+
/** @description The content type. */
|
|
1019
|
+
type: string;
|
|
1020
|
+
/** @enum {string} */
|
|
1021
|
+
entryType: 'asset' | 'content' | 'settings' | 'singleton';
|
|
1022
|
+
/** @description The slug field’s value at `locale`, or null when the type declares none. */
|
|
1023
|
+
slug: string | null;
|
|
1024
|
+
/**
|
|
1025
|
+
* @description Container lifecycle only. Publication is per locale: `localeStatus`.
|
|
1026
|
+
* @enum {string}
|
|
1027
|
+
*/
|
|
1028
|
+
status: 'active' | 'archived' | 'proposed';
|
|
1029
|
+
/** @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. */
|
|
1030
|
+
version: number;
|
|
1031
|
+
/** @description The locale the fields beside this object were composed for. */
|
|
1032
|
+
locale: string;
|
|
1033
|
+
/** @description How many versions `locale` has. Sent on a single-entry read; a list leaves it out. */
|
|
1034
|
+
versionCount?: number;
|
|
1035
|
+
/** @description `locale`’s version numbers, newest first, at most 25. Sent on a single-entry read; a list leaves it out. */
|
|
1036
|
+
versions?: number[];
|
|
1037
|
+
/**
|
|
1038
|
+
* @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.
|
|
1039
|
+
* @enum {string}
|
|
1040
|
+
*/
|
|
1041
|
+
localeStatus?: 'archived' | 'draft' | 'published';
|
|
1042
|
+
/** @description Whether `locale` has unpublished changes of its own. */
|
|
1043
|
+
localeHasDraft: boolean;
|
|
1044
|
+
/** @description Every locale holding unpublished content, sorted. A shared-field draft is listed under the default locale. */
|
|
1045
|
+
draftLocales: string[];
|
|
1046
|
+
/** @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=*`. */
|
|
1047
|
+
requestedLocale?: string;
|
|
1048
|
+
/** @description The schema’s default locale. */
|
|
1049
|
+
defaultLocale: string;
|
|
1050
|
+
/** @description Whether the shared (non-localized) fields have unpublished changes. */
|
|
1051
|
+
hasDraft: boolean;
|
|
1052
|
+
/** @description Each field whose value came from another locale, mapped to that locale. Absent when none did. */
|
|
1053
|
+
localeFallbacksApplied?: {
|
|
1054
|
+
[key: string]: string;
|
|
1055
|
+
};
|
|
1056
|
+
/** @description Every locale the entry has content in, the default first. */
|
|
1057
|
+
availableLocales: components['schemas']['EntryLocale'][];
|
|
1058
|
+
/** @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. */
|
|
1059
|
+
localizations?: {
|
|
1060
|
+
[key: string]: {
|
|
1061
|
+
[key: string]: unknown;
|
|
1062
|
+
};
|
|
1063
|
+
};
|
|
1064
|
+
/**
|
|
1065
|
+
* Format: date-time
|
|
1066
|
+
* @description When the entry was created.
|
|
1067
|
+
*/
|
|
1068
|
+
createdAt: string;
|
|
1069
|
+
/**
|
|
1070
|
+
* Format: date-time
|
|
1071
|
+
* @description When the entry was last written.
|
|
1072
|
+
*/
|
|
1073
|
+
updatedAt: string;
|
|
1074
|
+
/**
|
|
1075
|
+
* Format: date-time
|
|
1076
|
+
* @description When the entry was last published. Absent until it is.
|
|
1077
|
+
*/
|
|
1078
|
+
publishedAt?: string;
|
|
1079
|
+
/**
|
|
1080
|
+
* Format: date-time
|
|
1081
|
+
* @description When the entry was first published. Absent until it is.
|
|
1082
|
+
*/
|
|
1083
|
+
firstPublishedAt?: string;
|
|
1084
|
+
/** @description The entry’s outgoing references, across every locale, each once. */
|
|
1085
|
+
refs: components['schemas']['EntryRef'][];
|
|
1086
|
+
};
|
|
1087
|
+
/** @description One outgoing reference. */
|
|
1088
|
+
EntryRef: {
|
|
1089
|
+
/** @description The declaring field’s path — `hero.link` for a reference inside a component. */
|
|
1090
|
+
path: string;
|
|
1091
|
+
/** @description The referenced entry’s id. */
|
|
1092
|
+
entryUid: string;
|
|
1093
|
+
};
|
|
855
1094
|
ErrorResponse: {
|
|
856
1095
|
error: {
|
|
857
1096
|
/** @enum {string} */
|
|
@@ -862,6 +1101,15 @@ interface components {
|
|
|
862
1101
|
};
|
|
863
1102
|
};
|
|
864
1103
|
};
|
|
1104
|
+
/** @description Where a binding’s upload got to — its lifecycle and nothing of the entry: no fields, no URL. */
|
|
1105
|
+
FileStatus: {
|
|
1106
|
+
/**
|
|
1107
|
+
* @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.
|
|
1108
|
+
* @enum {string}
|
|
1109
|
+
*/
|
|
1110
|
+
status: 'failed' | 'pending_upload' | 'processing' | 'ready' | 'uploading';
|
|
1111
|
+
processing?: components['schemas']['AssetFileProcessing'];
|
|
1112
|
+
};
|
|
865
1113
|
MultiPayload: {
|
|
866
1114
|
results: (components['schemas']['SubSuccess'] | components['schemas']['SubFailure'])[];
|
|
867
1115
|
summary: components['schemas']['MultiSummary'];
|
|
@@ -1035,6 +1283,213 @@ interface components {
|
|
|
1035
1283
|
};
|
|
1036
1284
|
};
|
|
1037
1285
|
};
|
|
1286
|
+
/** @description How a hit’s relevance was reached. Sent on a search that asked for `explain`. */
|
|
1287
|
+
ScoreBreakdown: {
|
|
1288
|
+
keyword: number;
|
|
1289
|
+
semantic: number;
|
|
1290
|
+
combined: number;
|
|
1291
|
+
};
|
|
1292
|
+
/** @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. */
|
|
1293
|
+
SearchHighlight: {
|
|
1294
|
+
path: string;
|
|
1295
|
+
score: number;
|
|
1296
|
+
texts: ({
|
|
1297
|
+
value: string;
|
|
1298
|
+
/** @enum {string} */
|
|
1299
|
+
type: 'hit' | 'text';
|
|
1300
|
+
} & {
|
|
1301
|
+
[key: string]: unknown;
|
|
1302
|
+
})[];
|
|
1303
|
+
} & {
|
|
1304
|
+
[key: string]: unknown;
|
|
1305
|
+
};
|
|
1306
|
+
/** @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`. */
|
|
1307
|
+
SearchHit: {
|
|
1308
|
+
_metadata: components['schemas']['SearchHitMetadata'];
|
|
1309
|
+
/** @description Relevance. Sent on a search that asked for `includeScore`, and on every similar hit. */
|
|
1310
|
+
_score?: number;
|
|
1311
|
+
_scoreBreakdown?: components['schemas']['ScoreBreakdown'];
|
|
1312
|
+
/** @description Sent when the search asked for `highlight` and Atlas matched a highlighted path. */
|
|
1313
|
+
_highlights?: components['schemas']['SearchHighlight'][];
|
|
1314
|
+
} & {
|
|
1315
|
+
[key: string]: unknown;
|
|
1316
|
+
};
|
|
1317
|
+
/** @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. */
|
|
1318
|
+
SearchHitMetadata: {
|
|
1319
|
+
id: string;
|
|
1320
|
+
/** @description The content type. */
|
|
1321
|
+
type: string;
|
|
1322
|
+
/** @description The slug field’s value at `locale`, or null when the type declares none. */
|
|
1323
|
+
slug: string | null;
|
|
1324
|
+
/**
|
|
1325
|
+
* @description Container lifecycle only. Publication is per locale: `localeStatus`.
|
|
1326
|
+
* @enum {string}
|
|
1327
|
+
*/
|
|
1328
|
+
status: 'active' | 'archived' | 'proposed';
|
|
1329
|
+
/** @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. */
|
|
1330
|
+
version: number;
|
|
1331
|
+
/** @description The locale the fields beside this object were composed for. */
|
|
1332
|
+
locale: string;
|
|
1333
|
+
/**
|
|
1334
|
+
* @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.
|
|
1335
|
+
* @enum {string}
|
|
1336
|
+
*/
|
|
1337
|
+
localeStatus?: 'archived' | 'draft' | 'published';
|
|
1338
|
+
/** @description Whether `locale` has unpublished changes of its own. */
|
|
1339
|
+
localeHasDraft: boolean;
|
|
1340
|
+
/** @description Every locale holding unpublished content, sorted. A shared-field draft is listed under the default locale. */
|
|
1341
|
+
draftLocales: string[];
|
|
1342
|
+
/** @description Whether the shared (non-localized) fields have unpublished changes. */
|
|
1343
|
+
hasDraft: boolean;
|
|
1344
|
+
/**
|
|
1345
|
+
* Format: date-time
|
|
1346
|
+
* @description When the entry was created.
|
|
1347
|
+
*/
|
|
1348
|
+
createdAt: string;
|
|
1349
|
+
/**
|
|
1350
|
+
* Format: date-time
|
|
1351
|
+
* @description When the entry was last written.
|
|
1352
|
+
*/
|
|
1353
|
+
updatedAt: string;
|
|
1354
|
+
/**
|
|
1355
|
+
* Format: date-time
|
|
1356
|
+
* @description When the entry was last published. Absent until it is.
|
|
1357
|
+
*/
|
|
1358
|
+
publishedAt?: string;
|
|
1359
|
+
};
|
|
1360
|
+
/** @description One settings group: its fields at the top level, as the group declares them, and `_metadata`. */
|
|
1361
|
+
SettingsGroup: {
|
|
1362
|
+
_metadata: components['schemas']['SettingsGroupMetadata'];
|
|
1363
|
+
} & {
|
|
1364
|
+
[key: string]: unknown;
|
|
1365
|
+
};
|
|
1366
|
+
/** @description One group on the listing: its fields at the top level — its declared defaults until it is first written — and `_metadata`. */
|
|
1367
|
+
SettingsGroupListing: {
|
|
1368
|
+
_metadata: components['schemas']['SettingsGroupListingMetadata'];
|
|
1369
|
+
} & {
|
|
1370
|
+
[key: string]: unknown;
|
|
1371
|
+
};
|
|
1372
|
+
/** @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. */
|
|
1373
|
+
SettingsGroupListingMetadata: {
|
|
1374
|
+
/** @description The group’s name, as the schema declares it. */
|
|
1375
|
+
displayName: string;
|
|
1376
|
+
/** @description The group’s description, when the schema declares one. */
|
|
1377
|
+
description?: string;
|
|
1378
|
+
} | {
|
|
1379
|
+
id: string;
|
|
1380
|
+
/** @description The settings group. */
|
|
1381
|
+
groupId: string;
|
|
1382
|
+
/** @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. */
|
|
1383
|
+
version: number;
|
|
1384
|
+
/** @description The locale the fields beside this object were composed for. */
|
|
1385
|
+
locale: string;
|
|
1386
|
+
/**
|
|
1387
|
+
* @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.
|
|
1388
|
+
* @enum {string}
|
|
1389
|
+
*/
|
|
1390
|
+
localeStatus?: 'archived' | 'draft' | 'published';
|
|
1391
|
+
/** @description Whether `locale` has unpublished changes of its own. */
|
|
1392
|
+
localeHasDraft: boolean;
|
|
1393
|
+
/** @description Every locale holding unpublished content, sorted. A shared-field draft is listed under the default locale. */
|
|
1394
|
+
draftLocales: string[];
|
|
1395
|
+
/**
|
|
1396
|
+
* Format: date-time
|
|
1397
|
+
* @description When the group was last written.
|
|
1398
|
+
*/
|
|
1399
|
+
updatedAt: string;
|
|
1400
|
+
/** @description The group’s name, as the schema declares it. */
|
|
1401
|
+
displayName: string;
|
|
1402
|
+
/** @description The group’s description, when the schema declares one. */
|
|
1403
|
+
description?: string;
|
|
1404
|
+
};
|
|
1405
|
+
/** @description What this service reports about a settings group beside its fields: the group, the per-locale facts and when it was last written. */
|
|
1406
|
+
SettingsGroupMetadata: {
|
|
1407
|
+
id: string;
|
|
1408
|
+
/** @description The settings group. */
|
|
1409
|
+
groupId: string;
|
|
1410
|
+
/** @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. */
|
|
1411
|
+
version: number;
|
|
1412
|
+
/** @description The locale the fields beside this object were composed for. */
|
|
1413
|
+
locale: string;
|
|
1414
|
+
/** @description How many versions `locale` has. */
|
|
1415
|
+
versionCount: number;
|
|
1416
|
+
/** @description `locale`’s version numbers, newest first, at most 25. */
|
|
1417
|
+
versions: number[];
|
|
1418
|
+
/**
|
|
1419
|
+
* @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.
|
|
1420
|
+
* @enum {string}
|
|
1421
|
+
*/
|
|
1422
|
+
localeStatus?: 'archived' | 'draft' | 'published';
|
|
1423
|
+
/** @description Whether `locale` has unpublished changes of its own. */
|
|
1424
|
+
localeHasDraft: boolean;
|
|
1425
|
+
/** @description Every locale holding unpublished content, sorted. A shared-field draft is listed under the default locale. */
|
|
1426
|
+
draftLocales: string[];
|
|
1427
|
+
/**
|
|
1428
|
+
* Format: date-time
|
|
1429
|
+
* @description When the group was last written.
|
|
1430
|
+
*/
|
|
1431
|
+
updatedAt: string;
|
|
1432
|
+
};
|
|
1433
|
+
/** @description Every settings group the schema declares, keyed by group id, at the locale the request resolved to. */
|
|
1434
|
+
SettingsGroups: {
|
|
1435
|
+
[key: string]: components['schemas']['SettingsGroupListing'];
|
|
1436
|
+
};
|
|
1437
|
+
/** @description One singleton: its fields at the top level, as the singleton type declares them, and `_metadata`. */
|
|
1438
|
+
Singleton: {
|
|
1439
|
+
_metadata: components['schemas']['SingletonMetadata'];
|
|
1440
|
+
} & {
|
|
1441
|
+
[key: string]: unknown;
|
|
1442
|
+
};
|
|
1443
|
+
/** @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. */
|
|
1444
|
+
SingletonMetadata: {
|
|
1445
|
+
id: string;
|
|
1446
|
+
/** @description The singleton type. */
|
|
1447
|
+
type: string;
|
|
1448
|
+
/**
|
|
1449
|
+
* @description Container lifecycle only. Publication is per locale: `localeStatus`.
|
|
1450
|
+
* @enum {string}
|
|
1451
|
+
*/
|
|
1452
|
+
status: 'active' | 'archived' | 'proposed';
|
|
1453
|
+
/** @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. */
|
|
1454
|
+
version: number;
|
|
1455
|
+
/** @description The locale the fields beside this object were composed for. */
|
|
1456
|
+
locale: string;
|
|
1457
|
+
/** @description How many versions `locale` has. */
|
|
1458
|
+
versionCount: number;
|
|
1459
|
+
/** @description `locale`’s version numbers, newest first, at most 25. */
|
|
1460
|
+
versions: number[];
|
|
1461
|
+
/**
|
|
1462
|
+
* @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.
|
|
1463
|
+
* @enum {string}
|
|
1464
|
+
*/
|
|
1465
|
+
localeStatus?: 'archived' | 'draft' | 'published';
|
|
1466
|
+
/** @description Whether `locale` has unpublished changes of its own. */
|
|
1467
|
+
localeHasDraft: boolean;
|
|
1468
|
+
/** @description Every locale holding unpublished content, sorted. A shared-field draft is listed under the default locale. */
|
|
1469
|
+
draftLocales: string[];
|
|
1470
|
+
/** @description Whether the shared (non-localized) fields have unpublished changes. */
|
|
1471
|
+
hasDraft: boolean;
|
|
1472
|
+
/**
|
|
1473
|
+
* Format: date-time
|
|
1474
|
+
* @description When the singleton was created.
|
|
1475
|
+
*/
|
|
1476
|
+
createdAt: string;
|
|
1477
|
+
/**
|
|
1478
|
+
* Format: date-time
|
|
1479
|
+
* @description When the singleton was last written.
|
|
1480
|
+
*/
|
|
1481
|
+
updatedAt: string;
|
|
1482
|
+
/**
|
|
1483
|
+
* Format: date-time
|
|
1484
|
+
* @description When the singleton was last published. Absent until it is.
|
|
1485
|
+
*/
|
|
1486
|
+
publishedAt?: string;
|
|
1487
|
+
/**
|
|
1488
|
+
* Format: date-time
|
|
1489
|
+
* @description When the singleton was first published. Absent until it is.
|
|
1490
|
+
*/
|
|
1491
|
+
firstPublishedAt?: string;
|
|
1492
|
+
};
|
|
1038
1493
|
SubFailure: {
|
|
1039
1494
|
index: number;
|
|
1040
1495
|
id?: string;
|
|
@@ -1200,6 +1655,137 @@ interface operations {
|
|
|
1200
1655
|
};
|
|
1201
1656
|
};
|
|
1202
1657
|
};
|
|
1658
|
+
readVisitorFeedChanges: {
|
|
1659
|
+
parameters: {
|
|
1660
|
+
query?: never;
|
|
1661
|
+
header?: never;
|
|
1662
|
+
path: {
|
|
1663
|
+
projectId: string;
|
|
1664
|
+
datasetId: string;
|
|
1665
|
+
};
|
|
1666
|
+
cookie?: never;
|
|
1667
|
+
};
|
|
1668
|
+
requestBody?: never;
|
|
1669
|
+
responses: {
|
|
1670
|
+
/** @description Success. */
|
|
1671
|
+
200: {
|
|
1672
|
+
headers: {
|
|
1673
|
+
[name: string]: unknown;
|
|
1674
|
+
};
|
|
1675
|
+
content: {
|
|
1676
|
+
'application/json': {
|
|
1677
|
+
/** @description The payload itself. */
|
|
1678
|
+
data: unknown;
|
|
1679
|
+
};
|
|
1680
|
+
};
|
|
1681
|
+
};
|
|
1682
|
+
/** @description REQUEST_INVALID */
|
|
1683
|
+
400: {
|
|
1684
|
+
headers: {
|
|
1685
|
+
[name: string]: unknown;
|
|
1686
|
+
};
|
|
1687
|
+
content: {
|
|
1688
|
+
'application/json': components['schemas']['RefusalRequestInvalid'];
|
|
1689
|
+
};
|
|
1690
|
+
};
|
|
1691
|
+
/** @description ACCESS_DENIED */
|
|
1692
|
+
403: {
|
|
1693
|
+
headers: {
|
|
1694
|
+
[name: string]: unknown;
|
|
1695
|
+
};
|
|
1696
|
+
content: {
|
|
1697
|
+
'application/json': components['schemas']['RefusalAccessDenied'];
|
|
1698
|
+
};
|
|
1699
|
+
};
|
|
1700
|
+
/** @description RESOURCE_NOT_FOUND */
|
|
1701
|
+
404: {
|
|
1702
|
+
headers: {
|
|
1703
|
+
[name: string]: unknown;
|
|
1704
|
+
};
|
|
1705
|
+
content: {
|
|
1706
|
+
'application/json': components['schemas']['RefusalResourceNotFound'];
|
|
1707
|
+
};
|
|
1708
|
+
};
|
|
1709
|
+
/** @description INTERNAL_ERROR */
|
|
1710
|
+
500: {
|
|
1711
|
+
headers: {
|
|
1712
|
+
[name: string]: unknown;
|
|
1713
|
+
};
|
|
1714
|
+
content: {
|
|
1715
|
+
'application/json': components['schemas']['RefusalInternalError'];
|
|
1716
|
+
};
|
|
1717
|
+
};
|
|
1718
|
+
};
|
|
1719
|
+
};
|
|
1720
|
+
resolveVisitorKey: {
|
|
1721
|
+
parameters: {
|
|
1722
|
+
query?: never;
|
|
1723
|
+
header?: never;
|
|
1724
|
+
path?: never;
|
|
1725
|
+
cookie?: never;
|
|
1726
|
+
};
|
|
1727
|
+
requestBody?: never;
|
|
1728
|
+
responses: {
|
|
1729
|
+
/** @description Success. */
|
|
1730
|
+
200: {
|
|
1731
|
+
headers: {
|
|
1732
|
+
'Retry-After'?: string;
|
|
1733
|
+
[name: string]: unknown;
|
|
1734
|
+
};
|
|
1735
|
+
content: {
|
|
1736
|
+
'application/json': {
|
|
1737
|
+
/** @description The payload itself. */
|
|
1738
|
+
data: unknown;
|
|
1739
|
+
};
|
|
1740
|
+
};
|
|
1741
|
+
};
|
|
1742
|
+
/** @description REQUEST_INVALID */
|
|
1743
|
+
400: {
|
|
1744
|
+
headers: {
|
|
1745
|
+
[name: string]: unknown;
|
|
1746
|
+
};
|
|
1747
|
+
content: {
|
|
1748
|
+
'application/json': components['schemas']['RefusalRequestInvalid'];
|
|
1749
|
+
};
|
|
1750
|
+
};
|
|
1751
|
+
/** @description ACCESS_DENIED */
|
|
1752
|
+
403: {
|
|
1753
|
+
headers: {
|
|
1754
|
+
[name: string]: unknown;
|
|
1755
|
+
};
|
|
1756
|
+
content: {
|
|
1757
|
+
'application/json': components['schemas']['RefusalAccessDenied'];
|
|
1758
|
+
};
|
|
1759
|
+
};
|
|
1760
|
+
/** @description RESOURCE_NOT_FOUND */
|
|
1761
|
+
404: {
|
|
1762
|
+
headers: {
|
|
1763
|
+
[name: string]: unknown;
|
|
1764
|
+
};
|
|
1765
|
+
content: {
|
|
1766
|
+
'application/json': components['schemas']['RefusalResourceNotFound'];
|
|
1767
|
+
};
|
|
1768
|
+
};
|
|
1769
|
+
/** @description INTERNAL_ERROR */
|
|
1770
|
+
500: {
|
|
1771
|
+
headers: {
|
|
1772
|
+
[name: string]: unknown;
|
|
1773
|
+
};
|
|
1774
|
+
content: {
|
|
1775
|
+
'application/json': components['schemas']['RefusalInternalError'];
|
|
1776
|
+
};
|
|
1777
|
+
};
|
|
1778
|
+
/** @description SERVICE_INDETERMINATE */
|
|
1779
|
+
503: {
|
|
1780
|
+
headers: {
|
|
1781
|
+
[name: string]: unknown;
|
|
1782
|
+
};
|
|
1783
|
+
content: {
|
|
1784
|
+
'application/json': components['schemas']['RefusalServiceIndeterminate'];
|
|
1785
|
+
};
|
|
1786
|
+
};
|
|
1787
|
+
};
|
|
1788
|
+
};
|
|
1203
1789
|
claimMedia: {
|
|
1204
1790
|
parameters: {
|
|
1205
1791
|
query?: never;
|
|
@@ -1556,7 +2142,10 @@ interface operations {
|
|
|
1556
2142
|
};
|
|
1557
2143
|
listEntries: {
|
|
1558
2144
|
parameters: {
|
|
1559
|
-
query?:
|
|
2145
|
+
query?: {
|
|
2146
|
+
/** @description A changes-feed cursor at or after the change this read follows — the `fresh` a change carries in `@relyio/sdk`. The answer is the read’s own, unchanged; the term only makes the request one that no cache holds an answer to from before that change. A value that is not a cursor the feed issued is refused. */
|
|
2147
|
+
_fresh?: string;
|
|
2148
|
+
};
|
|
1560
2149
|
header?: never;
|
|
1561
2150
|
path: {
|
|
1562
2151
|
contentType: string;
|
|
@@ -1756,7 +2345,10 @@ interface operations {
|
|
|
1756
2345
|
};
|
|
1757
2346
|
getEntry: {
|
|
1758
2347
|
parameters: {
|
|
1759
|
-
query?:
|
|
2348
|
+
query?: {
|
|
2349
|
+
/** @description A changes-feed cursor at or after the change this read follows — the `fresh` a change carries in `@relyio/sdk`. The answer is the read’s own, unchanged; the term only makes the request one that no cache holds an answer to from before that change. A value that is not a cursor the feed issued is refused. */
|
|
2350
|
+
_fresh?: string;
|
|
2351
|
+
};
|
|
1760
2352
|
header?: never;
|
|
1761
2353
|
path: {
|
|
1762
2354
|
contentType: string;
|
|
@@ -1778,8 +2370,7 @@ interface operations {
|
|
|
1778
2370
|
};
|
|
1779
2371
|
content: {
|
|
1780
2372
|
'application/json': {
|
|
1781
|
-
|
|
1782
|
-
data: unknown;
|
|
2373
|
+
data: components['schemas']['Entry'];
|
|
1783
2374
|
};
|
|
1784
2375
|
};
|
|
1785
2376
|
};
|
|
@@ -2065,7 +2656,10 @@ interface operations {
|
|
|
2065
2656
|
};
|
|
2066
2657
|
getChildren: {
|
|
2067
2658
|
parameters: {
|
|
2068
|
-
query?:
|
|
2659
|
+
query?: {
|
|
2660
|
+
/** @description A changes-feed cursor at or after the change this read follows — the `fresh` a change carries in `@relyio/sdk`. The answer is the read’s own, unchanged; the term only makes the request one that no cache holds an answer to from before that change. A value that is not a cursor the feed issued is refused. */
|
|
2661
|
+
_fresh?: string;
|
|
2662
|
+
};
|
|
2069
2663
|
header?: never;
|
|
2070
2664
|
path: {
|
|
2071
2665
|
contentType: string;
|
|
@@ -2156,7 +2750,7 @@ interface operations {
|
|
|
2156
2750
|
};
|
|
2157
2751
|
};
|
|
2158
2752
|
};
|
|
2159
|
-
|
|
2753
|
+
getFileStatus: {
|
|
2160
2754
|
parameters: {
|
|
2161
2755
|
query?: never;
|
|
2162
2756
|
header?: never;
|
|
@@ -2168,12 +2762,16 @@ interface operations {
|
|
|
2168
2762
|
};
|
|
2169
2763
|
requestBody?: never;
|
|
2170
2764
|
responses: {
|
|
2171
|
-
/** @description
|
|
2172
|
-
|
|
2765
|
+
/** @description Success. */
|
|
2766
|
+
200: {
|
|
2173
2767
|
headers: {
|
|
2174
2768
|
[name: string]: unknown;
|
|
2175
2769
|
};
|
|
2176
|
-
content
|
|
2770
|
+
content: {
|
|
2771
|
+
'application/json': {
|
|
2772
|
+
data: components['schemas']['FileStatus'];
|
|
2773
|
+
};
|
|
2774
|
+
};
|
|
2177
2775
|
};
|
|
2178
2776
|
/** @description CONTENT_INVALID, REQUEST_INVALID */
|
|
2179
2777
|
400: {
|
|
@@ -2211,24 +2809,6 @@ interface operations {
|
|
|
2211
2809
|
'application/json': components['schemas']['RefusalResourceNotFound'];
|
|
2212
2810
|
};
|
|
2213
2811
|
};
|
|
2214
|
-
/** @description RESOURCE_CONFLICT */
|
|
2215
|
-
409: {
|
|
2216
|
-
headers: {
|
|
2217
|
-
[name: string]: unknown;
|
|
2218
|
-
};
|
|
2219
|
-
content: {
|
|
2220
|
-
'application/json': components['schemas']['RefusalResourceConflict'];
|
|
2221
|
-
};
|
|
2222
|
-
};
|
|
2223
|
-
/** @description RESOURCE_EXPIRED */
|
|
2224
|
-
410: {
|
|
2225
|
-
headers: {
|
|
2226
|
-
[name: string]: unknown;
|
|
2227
|
-
};
|
|
2228
|
-
content: {
|
|
2229
|
-
'application/json': components['schemas']['RefusalResourceExpired'];
|
|
2230
|
-
};
|
|
2231
|
-
};
|
|
2232
2812
|
/** @description RATE_LIMIT_EXCEEDED */
|
|
2233
2813
|
429: {
|
|
2234
2814
|
headers: {
|
|
@@ -2258,7 +2838,7 @@ interface operations {
|
|
|
2258
2838
|
};
|
|
2259
2839
|
};
|
|
2260
2840
|
};
|
|
2261
|
-
|
|
2841
|
+
deleteFileBinding: {
|
|
2262
2842
|
parameters: {
|
|
2263
2843
|
query?: never;
|
|
2264
2844
|
header?: never;
|
|
@@ -2270,17 +2850,12 @@ interface operations {
|
|
|
2270
2850
|
};
|
|
2271
2851
|
requestBody?: never;
|
|
2272
2852
|
responses: {
|
|
2273
|
-
/** @description
|
|
2274
|
-
|
|
2853
|
+
/** @description No content. */
|
|
2854
|
+
204: {
|
|
2275
2855
|
headers: {
|
|
2276
2856
|
[name: string]: unknown;
|
|
2277
2857
|
};
|
|
2278
|
-
content
|
|
2279
|
-
'application/json': {
|
|
2280
|
-
/** @description The payload itself. */
|
|
2281
|
-
data: unknown;
|
|
2282
|
-
};
|
|
2283
|
-
};
|
|
2858
|
+
content?: never;
|
|
2284
2859
|
};
|
|
2285
2860
|
/** @description CONTENT_INVALID, REQUEST_INVALID */
|
|
2286
2861
|
400: {
|
|
@@ -2365,7 +2940,7 @@ interface operations {
|
|
|
2365
2940
|
};
|
|
2366
2941
|
};
|
|
2367
2942
|
};
|
|
2368
|
-
|
|
2943
|
+
updateFileBinding: {
|
|
2369
2944
|
parameters: {
|
|
2370
2945
|
query?: never;
|
|
2371
2946
|
header?: never;
|
|
@@ -2472,7 +3047,7 @@ interface operations {
|
|
|
2472
3047
|
};
|
|
2473
3048
|
};
|
|
2474
3049
|
};
|
|
2475
|
-
|
|
3050
|
+
confirmFile: {
|
|
2476
3051
|
parameters: {
|
|
2477
3052
|
query?: never;
|
|
2478
3053
|
header?: never;
|
|
@@ -2579,7 +3154,7 @@ interface operations {
|
|
|
2579
3154
|
};
|
|
2580
3155
|
};
|
|
2581
3156
|
};
|
|
2582
|
-
|
|
3157
|
+
abortMultipartUpload: {
|
|
2583
3158
|
parameters: {
|
|
2584
3159
|
query?: never;
|
|
2585
3160
|
header?: never;
|
|
@@ -2686,7 +3261,7 @@ interface operations {
|
|
|
2686
3261
|
};
|
|
2687
3262
|
};
|
|
2688
3263
|
};
|
|
2689
|
-
|
|
3264
|
+
completeMultipartUpload: {
|
|
2690
3265
|
parameters: {
|
|
2691
3266
|
query?: never;
|
|
2692
3267
|
header?: never;
|
|
@@ -2699,7 +3274,7 @@ interface operations {
|
|
|
2699
3274
|
requestBody?: never;
|
|
2700
3275
|
responses: {
|
|
2701
3276
|
/** @description Success. */
|
|
2702
|
-
|
|
3277
|
+
200: {
|
|
2703
3278
|
headers: {
|
|
2704
3279
|
[name: string]: unknown;
|
|
2705
3280
|
};
|
|
@@ -2793,7 +3368,7 @@ interface operations {
|
|
|
2793
3368
|
};
|
|
2794
3369
|
};
|
|
2795
3370
|
};
|
|
2796
|
-
|
|
3371
|
+
createMultipartUpload: {
|
|
2797
3372
|
parameters: {
|
|
2798
3373
|
query?: never;
|
|
2799
3374
|
header?: never;
|
|
@@ -2806,7 +3381,7 @@ interface operations {
|
|
|
2806
3381
|
requestBody?: never;
|
|
2807
3382
|
responses: {
|
|
2808
3383
|
/** @description Success. */
|
|
2809
|
-
|
|
3384
|
+
201: {
|
|
2810
3385
|
headers: {
|
|
2811
3386
|
[name: string]: unknown;
|
|
2812
3387
|
};
|
|
@@ -2900,7 +3475,114 @@ interface operations {
|
|
|
2900
3475
|
};
|
|
2901
3476
|
};
|
|
2902
3477
|
};
|
|
2903
|
-
|
|
3478
|
+
listMultipartParts: {
|
|
3479
|
+
parameters: {
|
|
3480
|
+
query?: never;
|
|
3481
|
+
header?: never;
|
|
3482
|
+
path: {
|
|
3483
|
+
contentType: string;
|
|
3484
|
+
id: string;
|
|
3485
|
+
};
|
|
3486
|
+
cookie?: never;
|
|
3487
|
+
};
|
|
3488
|
+
requestBody?: never;
|
|
3489
|
+
responses: {
|
|
3490
|
+
/** @description Success. */
|
|
3491
|
+
200: {
|
|
3492
|
+
headers: {
|
|
3493
|
+
[name: string]: unknown;
|
|
3494
|
+
};
|
|
3495
|
+
content: {
|
|
3496
|
+
'application/json': {
|
|
3497
|
+
/** @description The payload itself. */
|
|
3498
|
+
data: unknown;
|
|
3499
|
+
};
|
|
3500
|
+
};
|
|
3501
|
+
};
|
|
3502
|
+
/** @description CONTENT_INVALID, REQUEST_INVALID */
|
|
3503
|
+
400: {
|
|
3504
|
+
headers: {
|
|
3505
|
+
[name: string]: unknown;
|
|
3506
|
+
};
|
|
3507
|
+
content: {
|
|
3508
|
+
'application/json': components['schemas']['RefusalContentInvalidOrRequestInvalid'];
|
|
3509
|
+
};
|
|
3510
|
+
};
|
|
3511
|
+
/** @description INVALID_API_KEY, MISSING_API_KEY */
|
|
3512
|
+
401: {
|
|
3513
|
+
headers: {
|
|
3514
|
+
[name: string]: unknown;
|
|
3515
|
+
};
|
|
3516
|
+
content: {
|
|
3517
|
+
'application/json': components['schemas']['RefusalInvalidApiKeyOrMissingApiKey'];
|
|
3518
|
+
};
|
|
3519
|
+
};
|
|
3520
|
+
/** @description ACCESS_DENIED, PLAN_FEATURE_UNAVAILABLE, READ_ONLY_KEY, USAGE_QUOTA_EXCEEDED */
|
|
3521
|
+
403: {
|
|
3522
|
+
headers: {
|
|
3523
|
+
[name: string]: unknown;
|
|
3524
|
+
};
|
|
3525
|
+
content: {
|
|
3526
|
+
'application/json': components['schemas']['RefusalAccessDeniedOrPlanFeatureUnavailableOrReadOnlyKeyOrUsageQuotaExceeded'];
|
|
3527
|
+
};
|
|
3528
|
+
};
|
|
3529
|
+
/** @description RESOURCE_NOT_FOUND */
|
|
3530
|
+
404: {
|
|
3531
|
+
headers: {
|
|
3532
|
+
[name: string]: unknown;
|
|
3533
|
+
};
|
|
3534
|
+
content: {
|
|
3535
|
+
'application/json': components['schemas']['RefusalResourceNotFound'];
|
|
3536
|
+
};
|
|
3537
|
+
};
|
|
3538
|
+
/** @description RESOURCE_CONFLICT */
|
|
3539
|
+
409: {
|
|
3540
|
+
headers: {
|
|
3541
|
+
[name: string]: unknown;
|
|
3542
|
+
};
|
|
3543
|
+
content: {
|
|
3544
|
+
'application/json': components['schemas']['RefusalResourceConflict'];
|
|
3545
|
+
};
|
|
3546
|
+
};
|
|
3547
|
+
/** @description RESOURCE_EXPIRED */
|
|
3548
|
+
410: {
|
|
3549
|
+
headers: {
|
|
3550
|
+
[name: string]: unknown;
|
|
3551
|
+
};
|
|
3552
|
+
content: {
|
|
3553
|
+
'application/json': components['schemas']['RefusalResourceExpired'];
|
|
3554
|
+
};
|
|
3555
|
+
};
|
|
3556
|
+
/** @description RATE_LIMIT_EXCEEDED */
|
|
3557
|
+
429: {
|
|
3558
|
+
headers: {
|
|
3559
|
+
[name: string]: unknown;
|
|
3560
|
+
};
|
|
3561
|
+
content: {
|
|
3562
|
+
'application/json': components['schemas']['RefusalRateLimitExceeded'];
|
|
3563
|
+
};
|
|
3564
|
+
};
|
|
3565
|
+
/** @description INTERNAL_ERROR */
|
|
3566
|
+
500: {
|
|
3567
|
+
headers: {
|
|
3568
|
+
[name: string]: unknown;
|
|
3569
|
+
};
|
|
3570
|
+
content: {
|
|
3571
|
+
'application/json': components['schemas']['RefusalInternalError'];
|
|
3572
|
+
};
|
|
3573
|
+
};
|
|
3574
|
+
/** @description SERVICE_INDETERMINATE */
|
|
3575
|
+
503: {
|
|
3576
|
+
headers: {
|
|
3577
|
+
[name: string]: unknown;
|
|
3578
|
+
};
|
|
3579
|
+
content: {
|
|
3580
|
+
'application/json': components['schemas']['RefusalServiceIndeterminate'];
|
|
3581
|
+
};
|
|
3582
|
+
};
|
|
3583
|
+
};
|
|
3584
|
+
};
|
|
3585
|
+
signMultipartPart: {
|
|
2904
3586
|
parameters: {
|
|
2905
3587
|
query?: never;
|
|
2906
3588
|
header?: never;
|
|
@@ -4342,7 +5024,10 @@ interface operations {
|
|
|
4342
5024
|
};
|
|
4343
5025
|
executeAdhocQuery: {
|
|
4344
5026
|
parameters: {
|
|
4345
|
-
query?:
|
|
5027
|
+
query?: {
|
|
5028
|
+
/** @description A changes-feed cursor at or after the change this read follows — the `fresh` a change carries in `@relyio/sdk`. The answer is the read’s own, unchanged; the term only makes the request one that no cache holds an answer to from before that change. A value that is not a cursor the feed issued is refused. */
|
|
5029
|
+
_fresh?: string;
|
|
5030
|
+
};
|
|
4346
5031
|
header?: never;
|
|
4347
5032
|
path?: never;
|
|
4348
5033
|
cookie?: never;
|
|
@@ -4439,7 +5124,10 @@ interface operations {
|
|
|
4439
5124
|
};
|
|
4440
5125
|
search: {
|
|
4441
5126
|
parameters: {
|
|
4442
|
-
query?:
|
|
5127
|
+
query?: {
|
|
5128
|
+
/** @description A changes-feed cursor at or after the change this read follows — the `fresh` a change carries in `@relyio/sdk`. The answer is the read’s own, unchanged; the term only makes the request one that no cache holds an answer to from before that change. A value that is not a cursor the feed issued is refused. */
|
|
5129
|
+
_fresh?: string;
|
|
5130
|
+
};
|
|
4443
5131
|
header?: never;
|
|
4444
5132
|
path?: never;
|
|
4445
5133
|
cookie?: never;
|
|
@@ -4455,7 +5143,7 @@ interface operations {
|
|
|
4455
5143
|
};
|
|
4456
5144
|
content: {
|
|
4457
5145
|
'application/json': {
|
|
4458
|
-
data:
|
|
5146
|
+
data: components['schemas']['SearchHit'][];
|
|
4459
5147
|
page: components['schemas']['OffsetPage'];
|
|
4460
5148
|
meta: {
|
|
4461
5149
|
[key: string]: unknown;
|
|
@@ -4530,7 +5218,10 @@ interface operations {
|
|
|
4530
5218
|
};
|
|
4531
5219
|
autocomplete: {
|
|
4532
5220
|
parameters: {
|
|
4533
|
-
query?:
|
|
5221
|
+
query?: {
|
|
5222
|
+
/** @description A changes-feed cursor at or after the change this read follows — the `fresh` a change carries in `@relyio/sdk`. The answer is the read’s own, unchanged; the term only makes the request one that no cache holds an answer to from before that change. A value that is not a cursor the feed issued is refused. */
|
|
5223
|
+
_fresh?: string;
|
|
5224
|
+
};
|
|
4534
5225
|
header?: never;
|
|
4535
5226
|
path?: never;
|
|
4536
5227
|
cookie?: never;
|
|
@@ -4546,7 +5237,7 @@ interface operations {
|
|
|
4546
5237
|
};
|
|
4547
5238
|
content: {
|
|
4548
5239
|
'application/json': {
|
|
4549
|
-
data:
|
|
5240
|
+
data: components['schemas']['AutocompleteSuggestion'][];
|
|
4550
5241
|
page: components['schemas']['OffsetPage'];
|
|
4551
5242
|
meta: {
|
|
4552
5243
|
[key: string]: unknown;
|
|
@@ -4612,7 +5303,10 @@ interface operations {
|
|
|
4612
5303
|
};
|
|
4613
5304
|
findSimilar: {
|
|
4614
5305
|
parameters: {
|
|
4615
|
-
query?:
|
|
5306
|
+
query?: {
|
|
5307
|
+
/** @description A changes-feed cursor at or after the change this read follows — the `fresh` a change carries in `@relyio/sdk`. The answer is the read’s own, unchanged; the term only makes the request one that no cache holds an answer to from before that change. A value that is not a cursor the feed issued is refused. */
|
|
5308
|
+
_fresh?: string;
|
|
5309
|
+
};
|
|
4616
5310
|
header?: never;
|
|
4617
5311
|
path?: never;
|
|
4618
5312
|
cookie?: never;
|
|
@@ -4628,7 +5322,7 @@ interface operations {
|
|
|
4628
5322
|
};
|
|
4629
5323
|
content: {
|
|
4630
5324
|
'application/json': {
|
|
4631
|
-
data:
|
|
5325
|
+
data: components['schemas']['SearchHit'][];
|
|
4632
5326
|
page: components['schemas']['OffsetPage'];
|
|
4633
5327
|
meta: {
|
|
4634
5328
|
[key: string]: unknown;
|
|
@@ -4703,7 +5397,10 @@ interface operations {
|
|
|
4703
5397
|
};
|
|
4704
5398
|
getAllSettings: {
|
|
4705
5399
|
parameters: {
|
|
4706
|
-
query?:
|
|
5400
|
+
query?: {
|
|
5401
|
+
/** @description A changes-feed cursor at or after the change this read follows — the `fresh` a change carries in `@relyio/sdk`. The answer is the read’s own, unchanged; the term only makes the request one that no cache holds an answer to from before that change. A value that is not a cursor the feed issued is refused. */
|
|
5402
|
+
_fresh?: string;
|
|
5403
|
+
};
|
|
4707
5404
|
header?: never;
|
|
4708
5405
|
path?: never;
|
|
4709
5406
|
cookie?: never;
|
|
@@ -4721,8 +5418,7 @@ interface operations {
|
|
|
4721
5418
|
};
|
|
4722
5419
|
content: {
|
|
4723
5420
|
'application/json': {
|
|
4724
|
-
|
|
4725
|
-
data: unknown;
|
|
5421
|
+
data: components['schemas']['SettingsGroups'];
|
|
4726
5422
|
};
|
|
4727
5423
|
};
|
|
4728
5424
|
};
|
|
@@ -4784,7 +5480,10 @@ interface operations {
|
|
|
4784
5480
|
};
|
|
4785
5481
|
getSettingsGroup: {
|
|
4786
5482
|
parameters: {
|
|
4787
|
-
query?:
|
|
5483
|
+
query?: {
|
|
5484
|
+
/** @description A changes-feed cursor at or after the change this read follows — the `fresh` a change carries in `@relyio/sdk`. The answer is the read’s own, unchanged; the term only makes the request one that no cache holds an answer to from before that change. A value that is not a cursor the feed issued is refused. */
|
|
5485
|
+
_fresh?: string;
|
|
5486
|
+
};
|
|
4788
5487
|
header?: never;
|
|
4789
5488
|
path: {
|
|
4790
5489
|
groupId: string;
|
|
@@ -4805,8 +5504,7 @@ interface operations {
|
|
|
4805
5504
|
};
|
|
4806
5505
|
content: {
|
|
4807
5506
|
'application/json': {
|
|
4808
|
-
|
|
4809
|
-
data: unknown;
|
|
5507
|
+
data: components['schemas']['SettingsGroup'];
|
|
4810
5508
|
};
|
|
4811
5509
|
};
|
|
4812
5510
|
};
|
|
@@ -5360,7 +6058,10 @@ interface operations {
|
|
|
5360
6058
|
};
|
|
5361
6059
|
getSingleton: {
|
|
5362
6060
|
parameters: {
|
|
5363
|
-
query?:
|
|
6061
|
+
query?: {
|
|
6062
|
+
/** @description A changes-feed cursor at or after the change this read follows — the `fresh` a change carries in `@relyio/sdk`. The answer is the read’s own, unchanged; the term only makes the request one that no cache holds an answer to from before that change. A value that is not a cursor the feed issued is refused. */
|
|
6063
|
+
_fresh?: string;
|
|
6064
|
+
};
|
|
5364
6065
|
header?: never;
|
|
5365
6066
|
path: {
|
|
5366
6067
|
key: string;
|
|
@@ -5381,8 +6082,7 @@ interface operations {
|
|
|
5381
6082
|
};
|
|
5382
6083
|
content: {
|
|
5383
6084
|
'application/json': {
|
|
5384
|
-
|
|
5385
|
-
data: unknown;
|
|
6085
|
+
data: components['schemas']['Singleton'];
|
|
5386
6086
|
};
|
|
5387
6087
|
};
|
|
5388
6088
|
};
|
|
@@ -5828,779 +6528,1205 @@ interface operations {
|
|
|
5828
6528
|
}
|
|
5829
6529
|
|
|
5830
6530
|
/**
|
|
5831
|
-
*
|
|
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.
|
|
5859
|
-
*
|
|
5860
|
-
* Spec: `devtools/docs/guide/engineering/api-contract-spec.md`,
|
|
5861
|
-
* `INV-API-CLIENT-IS-DERIVED`.
|
|
5862
|
-
*/
|
|
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
|
-
/**
|
|
5888
|
-
* The document's success body with the payload typed as the caller's `T`.
|
|
6531
|
+
* Field type definitions matching @relyio/schema package
|
|
5889
6532
|
*
|
|
5890
|
-
*
|
|
5891
|
-
*
|
|
5892
|
-
*
|
|
5893
|
-
*
|
|
5894
|
-
*
|
|
6533
|
+
* Every config option here is spelled as `@relyio/schema`'s field config schema spells it, because
|
|
6534
|
+
* the CLI sends a field's `config` to deploy verbatim, and deploy — and `relyio validate` before it —
|
|
6535
|
+
* refuses an option the field's type does not declare, naming its path (REL-1480). This package does
|
|
6536
|
+
* not depend on `@relyio/schema`, so the
|
|
6537
|
+
* options are pinned from `@relyio/codegen-typescript`, which depends on both: its
|
|
6538
|
+
* `src/__tests__/sdk-field-config.types.ts` fails to compile when a key, whether it is required, or
|
|
6539
|
+
* the values it accepts differs between the two (REL-1408).
|
|
5895
6540
|
*/
|
|
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
6541
|
/**
|
|
5906
|
-
*
|
|
5907
|
-
*
|
|
6542
|
+
* AI configuration. A single prompt — `instructions` — describes what the
|
|
6543
|
+
* element is and how AI should produce its value. Attaches to fields, content
|
|
6544
|
+
* types, components, fieldsets, and (extended) asset types.
|
|
5908
6545
|
*
|
|
5909
|
-
*
|
|
5910
|
-
*
|
|
5911
|
-
*
|
|
5912
|
-
*
|
|
6546
|
+
* @example
|
|
6547
|
+
* ```typescript
|
|
6548
|
+
* fields.richText('body', {
|
|
6549
|
+
* ai: {
|
|
6550
|
+
* instructions: `
|
|
6551
|
+
* Write in a conversational tone.
|
|
6552
|
+
* Use short paragraphs (2-3 sentences).
|
|
6553
|
+
* Target grade 8 reading level.
|
|
6554
|
+
* `
|
|
6555
|
+
* }
|
|
6556
|
+
* })
|
|
6557
|
+
* ```
|
|
5913
6558
|
*/
|
|
5914
|
-
|
|
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 {
|
|
6559
|
+
interface AIConfig {
|
|
5929
6560
|
/**
|
|
5930
|
-
*
|
|
5931
|
-
*
|
|
5932
|
-
*
|
|
6561
|
+
* AI brief for this element: what it should contain and how to produce it.
|
|
6562
|
+
*
|
|
6563
|
+
* Used by the Studio authoring agent and — on asset types with
|
|
6564
|
+
* `ai.autoGenerate` — by the automatic post-upload run.
|
|
6565
|
+
*
|
|
6566
|
+
* The fallback chain for AI guidance is:
|
|
6567
|
+
* 1. ai.instructions (most specific)
|
|
6568
|
+
* 2. ui.description (general field description)
|
|
6569
|
+
* 3. Field displayName + type (inferred from semantics)
|
|
5933
6570
|
*/
|
|
5934
|
-
|
|
6571
|
+
instructions?: string;
|
|
5935
6572
|
}
|
|
5936
6573
|
/**
|
|
5937
|
-
*
|
|
5938
|
-
*
|
|
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.
|
|
6574
|
+
* Field-level AI config. `inputs` names the fields this instruction reads.
|
|
6575
|
+
* Unknown ids and cycles are refused when the schema is parsed.
|
|
5946
6576
|
*/
|
|
5947
|
-
|
|
5948
|
-
|
|
6577
|
+
interface FieldAIConfig extends AIConfig {
|
|
6578
|
+
/** Field ids this instruction reads. Never inferred from instruction text. */
|
|
6579
|
+
inputs?: string[];
|
|
6580
|
+
}
|
|
5949
6581
|
/**
|
|
5950
|
-
*
|
|
6582
|
+
* Asset-type AI configuration. Extends {@link AIConfig} with `autoGenerate`,
|
|
6583
|
+
* the single switch that turns on automatic field generation after upload.
|
|
5951
6584
|
*/
|
|
5952
|
-
|
|
5953
|
-
interface RelyIOConfig {
|
|
5954
|
-
/**
|
|
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.
|
|
5961
|
-
*/
|
|
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;
|
|
6585
|
+
interface AssetAIConfig extends AIConfig {
|
|
6021
6586
|
/**
|
|
6022
|
-
*
|
|
6023
|
-
*
|
|
6024
|
-
*
|
|
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'`.
|
|
6587
|
+
* Master switch for automatic, post-upload field generation. When `true`, the
|
|
6588
|
+
* derived analysis agent fills every field that declares `ai.instructions`,
|
|
6589
|
+
* applied as a review proposal. Only meaningful for image asset types in v1.
|
|
6032
6590
|
*/
|
|
6033
|
-
|
|
6591
|
+
autoGenerate?: boolean;
|
|
6034
6592
|
}
|
|
6035
|
-
interface
|
|
6036
|
-
/** Whether
|
|
6037
|
-
|
|
6038
|
-
/**
|
|
6039
|
-
|
|
6040
|
-
/**
|
|
6041
|
-
|
|
6042
|
-
/** Maximum cache size in bytes (defaults to 50MB) */
|
|
6043
|
-
maxSize?: number;
|
|
6044
|
-
/** Cache strategies to use */
|
|
6045
|
-
strategies?: CacheStrategy[];
|
|
6593
|
+
interface BaseFieldConfig {
|
|
6594
|
+
/** Whether the field is required */
|
|
6595
|
+
required?: boolean;
|
|
6596
|
+
/** Whether the field value must be unique */
|
|
6597
|
+
unique?: boolean;
|
|
6598
|
+
/** Default value for the field. Each field type narrows it to the values its schema accepts. */
|
|
6599
|
+
defaultValue?: unknown;
|
|
6046
6600
|
}
|
|
6047
|
-
interface
|
|
6048
|
-
/**
|
|
6049
|
-
|
|
6050
|
-
/**
|
|
6051
|
-
|
|
6052
|
-
/**
|
|
6053
|
-
|
|
6054
|
-
/** Reconnection delay in milliseconds (defaults to 1000) */
|
|
6055
|
-
reconnectDelay?: number;
|
|
6056
|
-
/** Heartbeat interval in milliseconds (defaults to 30000) */
|
|
6057
|
-
heartbeatInterval?: number;
|
|
6601
|
+
interface FieldUIConfig {
|
|
6602
|
+
/** Display name shown in the UI */
|
|
6603
|
+
displayName: string;
|
|
6604
|
+
/** Field description/help text */
|
|
6605
|
+
description?: string;
|
|
6606
|
+
/** Widget-specific options */
|
|
6607
|
+
options?: Record<string, unknown>;
|
|
6058
6608
|
}
|
|
6059
|
-
interface
|
|
6060
|
-
|
|
6061
|
-
|
|
6062
|
-
|
|
6063
|
-
|
|
6064
|
-
|
|
6065
|
-
|
|
6066
|
-
|
|
6067
|
-
|
|
6068
|
-
|
|
6069
|
-
|
|
6609
|
+
interface RuleCondition {
|
|
6610
|
+
field: string;
|
|
6611
|
+
operator: 'equals' | 'not_equals' | 'contains' | 'not_contains' | 'greater_than' | 'less_than' | 'is_empty' | 'is_not_empty';
|
|
6612
|
+
value?: unknown;
|
|
6613
|
+
}
|
|
6614
|
+
interface RuleConditions {
|
|
6615
|
+
mode: 'all' | 'any' | 'none';
|
|
6616
|
+
conditions: RuleCondition[];
|
|
6617
|
+
}
|
|
6618
|
+
interface VisibilityRule {
|
|
6619
|
+
type: 'visibility';
|
|
6620
|
+
action: 'show' | 'hide';
|
|
6621
|
+
conditions: RuleConditions;
|
|
6622
|
+
}
|
|
6623
|
+
interface RequirementRule {
|
|
6624
|
+
type: 'requirement';
|
|
6625
|
+
action: 'require' | 'optional';
|
|
6626
|
+
conditions: RuleConditions;
|
|
6627
|
+
}
|
|
6628
|
+
interface ValidationRule {
|
|
6629
|
+
type: 'validation';
|
|
6630
|
+
action: 'validate' | 'skip';
|
|
6631
|
+
message?: string;
|
|
6632
|
+
conditions: RuleConditions;
|
|
6633
|
+
}
|
|
6634
|
+
interface ReadOnlyRule {
|
|
6635
|
+
type: 'readOnly';
|
|
6636
|
+
action: 'enable' | 'disable';
|
|
6637
|
+
conditions: RuleConditions;
|
|
6638
|
+
}
|
|
6639
|
+
type FieldRule = VisibilityRule | RequirementRule | ValidationRule | ReadOnlyRule;
|
|
6640
|
+
type LocalizationConfig = boolean | string[] | {
|
|
6641
|
+
enabled: boolean;
|
|
6642
|
+
requiredLocales?: string[];
|
|
6643
|
+
fallback?: boolean;
|
|
6644
|
+
};
|
|
6645
|
+
interface FieldDefinition<TId extends string = string, TType extends string = string, TConfig = unknown> {
|
|
6646
|
+
/** Unique field identifier - preserves literal type for type inference */
|
|
6647
|
+
readonly id: TId;
|
|
6648
|
+
/** Field type */
|
|
6649
|
+
readonly type: TType;
|
|
6650
|
+
/** Type-specific configuration */
|
|
6651
|
+
config?: TConfig;
|
|
6652
|
+
/** UI display configuration */
|
|
6653
|
+
ui?: FieldUIConfig;
|
|
6654
|
+
/** AI configuration: generation/review guidance for this field */
|
|
6655
|
+
ai?: FieldAIConfig;
|
|
6656
|
+
/** Dynamic field rules */
|
|
6657
|
+
rules?: FieldRule[];
|
|
6658
|
+
/** Localization settings */
|
|
6659
|
+
localization?: LocalizationConfig;
|
|
6660
|
+
/** Fallback value when field is empty */
|
|
6661
|
+
fallback?: unknown;
|
|
6662
|
+
/** Whether this field is deprecated */
|
|
6663
|
+
deprecated?: boolean;
|
|
6070
6664
|
}
|
|
6071
6665
|
/**
|
|
6072
|
-
*
|
|
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`).
|
|
6666
|
+
* Any field definition - used in arrays where we need to preserve specific field types
|
|
6079
6667
|
*/
|
|
6080
|
-
|
|
6081
|
-
|
|
6082
|
-
|
|
6083
|
-
|
|
6084
|
-
|
|
6085
|
-
|
|
6086
|
-
|
|
6087
|
-
/** Backoff factor for exponential backoff */
|
|
6088
|
-
backoffFactor: number;
|
|
6089
|
-
/** Whether to add jitter to retry delays */
|
|
6090
|
-
jitter: boolean;
|
|
6668
|
+
type AnyFieldDefinition = FieldDefinition<string, string, unknown>;
|
|
6669
|
+
interface ShortTextConfig extends BaseFieldConfig {
|
|
6670
|
+
/** Maximum character length */
|
|
6671
|
+
maxLength?: number;
|
|
6672
|
+
/** Regex pattern for validation */
|
|
6673
|
+
pattern?: string;
|
|
6674
|
+
defaultValue?: string;
|
|
6091
6675
|
}
|
|
6092
|
-
interface
|
|
6093
|
-
|
|
6094
|
-
|
|
6095
|
-
|
|
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>;
|
|
6676
|
+
interface LongTextConfig extends BaseFieldConfig {
|
|
6677
|
+
minLength?: number;
|
|
6678
|
+
maxLength?: number;
|
|
6679
|
+
defaultValue?: string;
|
|
6111
6680
|
}
|
|
6112
|
-
interface
|
|
6113
|
-
/**
|
|
6114
|
-
|
|
6115
|
-
|
|
6116
|
-
|
|
6117
|
-
|
|
6118
|
-
|
|
6119
|
-
|
|
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
|
-
};
|
|
6681
|
+
interface RichTextConfig extends BaseFieldConfig {
|
|
6682
|
+
/** Maximum character length for the rich text content */
|
|
6683
|
+
maxLength?: number;
|
|
6684
|
+
/** Allowed formatting options (e.g., bold, italic, underline) */
|
|
6685
|
+
allowedFormats?: string[];
|
|
6686
|
+
/** Allowed embed types (e.g., image, video, code) */
|
|
6687
|
+
embedTypes?: string[];
|
|
6688
|
+
defaultValue?: string;
|
|
6140
6689
|
}
|
|
6141
|
-
interface
|
|
6142
|
-
/**
|
|
6143
|
-
|
|
6144
|
-
|
|
6145
|
-
|
|
6146
|
-
|
|
6147
|
-
|
|
6148
|
-
|
|
6149
|
-
|
|
6150
|
-
|
|
6151
|
-
|
|
6152
|
-
|
|
6153
|
-
|
|
6154
|
-
|
|
6155
|
-
|
|
6156
|
-
/**
|
|
6157
|
-
|
|
6158
|
-
/**
|
|
6159
|
-
|
|
6690
|
+
interface SlugConfig extends BaseFieldConfig {
|
|
6691
|
+
/** Source field to generate slug from */
|
|
6692
|
+
sourceField?: string;
|
|
6693
|
+
/** Maximum character length */
|
|
6694
|
+
maxLength?: number;
|
|
6695
|
+
defaultValue?: string;
|
|
6696
|
+
}
|
|
6697
|
+
interface UrlConfig extends BaseFieldConfig {
|
|
6698
|
+
/** Allowed URL protocols */
|
|
6699
|
+
allowedProtocols?: ('http' | 'https' | 'ftp' | 'ftps')[];
|
|
6700
|
+
/** Maximum character length */
|
|
6701
|
+
maxLength?: number;
|
|
6702
|
+
defaultValue?: string;
|
|
6703
|
+
}
|
|
6704
|
+
interface EmailConfig extends BaseFieldConfig {
|
|
6705
|
+
/** Maximum character length */
|
|
6706
|
+
maxLength?: number;
|
|
6707
|
+
/** Whitelist of allowed email domains */
|
|
6708
|
+
domainWhitelist?: string[];
|
|
6709
|
+
defaultValue?: string;
|
|
6710
|
+
}
|
|
6711
|
+
interface IntegerConfig extends BaseFieldConfig {
|
|
6712
|
+
min?: number;
|
|
6713
|
+
max?: number;
|
|
6714
|
+
defaultValue?: number;
|
|
6715
|
+
}
|
|
6716
|
+
interface DecimalConfig extends BaseFieldConfig {
|
|
6717
|
+
min?: number;
|
|
6718
|
+
max?: number;
|
|
6719
|
+
decimalPlaces?: number;
|
|
6720
|
+
roundingMode?: 'HALF_UP' | 'FLOOR' | 'CEILING' | 'ROUND' | 'TRUNCATE';
|
|
6721
|
+
defaultValue?: number;
|
|
6722
|
+
}
|
|
6723
|
+
interface BooleanConfig extends BaseFieldConfig {
|
|
6724
|
+
/** The editor's word for `true` (e.g. `'Published'`). */
|
|
6725
|
+
labelTrue?: string;
|
|
6726
|
+
/** The editor's word for `false` (e.g. `'Draft'`). */
|
|
6727
|
+
labelFalse?: string;
|
|
6728
|
+
defaultValue?: boolean;
|
|
6160
6729
|
}
|
|
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
6730
|
/**
|
|
6165
|
-
* `
|
|
6166
|
-
*
|
|
6167
|
-
*
|
|
6731
|
+
* `TValue` is the union of the option values and `TMulti` whether the field holds a list of them.
|
|
6732
|
+
* `fields.enum()` infers both from the declaration, so a read of the field is typed by its options
|
|
6733
|
+
* (`INV-SS-TYPES-INFERRED`); the defaults describe any enum field.
|
|
6168
6734
|
*/
|
|
6169
|
-
|
|
6170
|
-
|
|
6735
|
+
interface EnumConfig<TValue extends string = string, TMulti extends boolean = boolean> extends BaseFieldConfig {
|
|
6736
|
+
/** The values the field may hold, each with the `label` an editor shows. Deploy refuses an option without one. */
|
|
6737
|
+
options: Array<{
|
|
6738
|
+
value: TValue;
|
|
6739
|
+
label: string;
|
|
6740
|
+
}>;
|
|
6741
|
+
multi?: TMulti;
|
|
6742
|
+
/** One option's value, or a list of them when `multi` is true. */
|
|
6743
|
+
defaultValue?: string | string[];
|
|
6744
|
+
}
|
|
6745
|
+
/** A display format is not config: it is `ui.options.format`, where the schema declares it. */
|
|
6746
|
+
interface DateConfig extends BaseFieldConfig {
|
|
6747
|
+
minDate?: string;
|
|
6748
|
+
maxDate?: string;
|
|
6749
|
+
/** `YYYY-MM-DD` */
|
|
6750
|
+
defaultValue?: string;
|
|
6751
|
+
}
|
|
6752
|
+
/** A display format is not config: it is `ui.options.format`, where the schema declares it. */
|
|
6753
|
+
interface DateTimeConfig extends BaseFieldConfig {
|
|
6754
|
+
minDateTime?: string;
|
|
6755
|
+
maxDateTime?: string;
|
|
6756
|
+
/** Store the instant in UTC (`'UTC'`), or keep the author's local time (`'local'`). */
|
|
6757
|
+
timeZoneHandling?: 'UTC' | 'local';
|
|
6758
|
+
defaultValue?: string;
|
|
6759
|
+
}
|
|
6171
6760
|
/**
|
|
6172
|
-
*
|
|
6173
|
-
*
|
|
6761
|
+
* `TTo` is the union of the target type ids and `TMulti` whether the field holds a list.
|
|
6762
|
+
* `fields.reference()` infers both, so a read of the field is typed by what it points at
|
|
6763
|
+
* (`INV-SS-TYPES-INFERRED`); the defaults describe any reference field.
|
|
6174
6764
|
*/
|
|
6175
|
-
|
|
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;
|
|
6765
|
+
interface ReferenceConfig<TTo extends string = string, TMulti extends boolean = boolean> extends BaseFieldConfig {
|
|
6214
6766
|
/**
|
|
6215
|
-
*
|
|
6767
|
+
* Target entry type id(s) — content type or asset type ids. Pass a single id
|
|
6768
|
+
* for one target or an array for several. All ids must belong to the same
|
|
6769
|
+
* family (all content types or all asset types).
|
|
6216
6770
|
*/
|
|
6217
|
-
|
|
6771
|
+
to: TTo | TTo[];
|
|
6772
|
+
/** Allow multiple references (the field value is a list). */
|
|
6773
|
+
multi?: TMulti;
|
|
6774
|
+
/** Reference strength for publish/unpublish behavior. */
|
|
6775
|
+
referenceStrength?: 'strong' | 'weak';
|
|
6776
|
+
/** Behavior when a referenced entry is deleted. */
|
|
6777
|
+
onTargetDelete?: 'block' | 'nullify';
|
|
6778
|
+
/** A target entry's id, or a list of them when `multi` is true. */
|
|
6779
|
+
defaultValue?: string | string[];
|
|
6780
|
+
}
|
|
6781
|
+
interface TagsConfig extends BaseFieldConfig {
|
|
6782
|
+
allowCustom?: boolean;
|
|
6783
|
+
predefinedTags?: string[];
|
|
6784
|
+
maxTags?: number;
|
|
6785
|
+
}
|
|
6786
|
+
/**
|
|
6787
|
+
* `TSubfields` is the declared subfields, which `fields.list()` infers so a read types each item by
|
|
6788
|
+
* them (`INV-SS-TYPES-INFERRED`); the default describes any list field.
|
|
6789
|
+
*/
|
|
6790
|
+
interface ListConfig<TSubfields extends readonly AnyFieldDefinition[] = FieldDefinition[]> extends BaseFieldConfig {
|
|
6791
|
+
dragAndDrop?: boolean;
|
|
6792
|
+
minItems?: number;
|
|
6793
|
+
maxItems?: number;
|
|
6794
|
+
/** Subfields for list items */
|
|
6795
|
+
subfields?: TSubfields;
|
|
6218
6796
|
}
|
|
6797
|
+
/**
|
|
6798
|
+
* A component field's config: the options every field type takes, and no more — what the schema
|
|
6799
|
+
* declares for a `component(<id>)` field, which has no config of its own. The validation document
|
|
6800
|
+
* reads `required` from it as it does from any field's.
|
|
6801
|
+
*/
|
|
6802
|
+
type ComponentFieldConfig = BaseFieldConfig;
|
|
6803
|
+
type FieldType = 'shortText' | 'longText' | 'richText' | 'slug' | 'url' | 'email' | 'integer' | 'decimal' | 'boolean' | 'enum' | 'date' | 'dateTime' | 'reference' | 'tags' | 'list';
|
|
6804
|
+
type ComponentFieldType = `component(${string})`;
|
|
6805
|
+
type AllFieldTypes = FieldType | ComponentFieldType;
|
|
6219
6806
|
|
|
6220
6807
|
/**
|
|
6221
|
-
*
|
|
6808
|
+
* Workflow definition for content approval pipelines
|
|
6809
|
+
*
|
|
6810
|
+
* Workflows define approval stages that content must pass through before
|
|
6811
|
+
* publication. They can be configured globally and per content type.
|
|
6812
|
+
*
|
|
6813
|
+
* @example
|
|
6814
|
+
* // Simple workflow with one approval stage
|
|
6815
|
+
* const workflow = defineWorkflow({
|
|
6816
|
+
* enabled: true,
|
|
6817
|
+
* stages: [
|
|
6818
|
+
* defineWorkflowStage('review', {
|
|
6819
|
+
* displayName: 'Editorial Review',
|
|
6820
|
+
* allowedRoles: ['editor', 'admin']
|
|
6821
|
+
* })
|
|
6822
|
+
* ]
|
|
6823
|
+
* })
|
|
6824
|
+
*
|
|
6825
|
+
* @example
|
|
6826
|
+
* // Multi-stage workflow
|
|
6827
|
+
* const workflow = defineWorkflow({
|
|
6828
|
+
* enabled: true,
|
|
6829
|
+
* stages: [
|
|
6830
|
+
* defineWorkflowStage('editorial-review', {
|
|
6831
|
+
* displayName: 'Editorial Review',
|
|
6832
|
+
* allowedRoles: ['editor']
|
|
6833
|
+
* }),
|
|
6834
|
+
* defineWorkflowStage('legal-approval', {
|
|
6835
|
+
* displayName: 'Legal Approval',
|
|
6836
|
+
* requiredApprovals: 1,
|
|
6837
|
+
* allowedRoles: ['legal-reviewer']
|
|
6838
|
+
* }),
|
|
6839
|
+
* defineWorkflowStage('final-approval', {
|
|
6840
|
+
* displayName: 'Final Approval',
|
|
6841
|
+
* requiredApprovals: 2,
|
|
6842
|
+
* allowedRoles: ['publisher', 'admin']
|
|
6843
|
+
* })
|
|
6844
|
+
* ]
|
|
6845
|
+
* })
|
|
6222
6846
|
*/
|
|
6223
|
-
|
|
6224
|
-
|
|
6225
|
-
|
|
6226
|
-
|
|
6227
|
-
|
|
6228
|
-
|
|
6847
|
+
/**
|
|
6848
|
+
* Escalation configuration when a workflow stage times out
|
|
6849
|
+
*/
|
|
6850
|
+
interface WorkflowEscalation {
|
|
6851
|
+
/** Roles to notify when stage times out */
|
|
6852
|
+
notifyRoles?: string[];
|
|
6853
|
+
/** Roles to escalate to if still pending after another timeout period */
|
|
6854
|
+
escalateToRoles?: string[];
|
|
6229
6855
|
}
|
|
6230
|
-
|
|
6231
|
-
|
|
6232
|
-
|
|
6233
|
-
|
|
6234
|
-
|
|
6235
|
-
|
|
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;
|
|
6856
|
+
/**
|
|
6857
|
+
* Auto-assignment configuration for workflow stages
|
|
6858
|
+
*/
|
|
6859
|
+
interface WorkflowAutoAssign {
|
|
6860
|
+
/** Roles whose users should be notified when content enters this stage */
|
|
6861
|
+
roles: string[];
|
|
6252
6862
|
}
|
|
6253
|
-
|
|
6254
|
-
|
|
6863
|
+
/**
|
|
6864
|
+
* Workflow stage configuration
|
|
6865
|
+
*/
|
|
6866
|
+
interface WorkflowStageConfig {
|
|
6867
|
+
/** Human-readable name shown in Studio */
|
|
6868
|
+
displayName: string;
|
|
6869
|
+
/** Optional description for reviewers */
|
|
6870
|
+
description?: string;
|
|
6871
|
+
/** Number of approvals needed to pass this stage (default: 1) */
|
|
6872
|
+
requiredApprovals?: number;
|
|
6873
|
+
/** Roles that can approve this stage */
|
|
6874
|
+
allowedRoles?: string[];
|
|
6875
|
+
/** Auto-assignment configuration */
|
|
6876
|
+
autoAssign?: WorkflowAutoAssign;
|
|
6877
|
+
/** Days before escalation triggers (optional) */
|
|
6878
|
+
timeoutDays?: number;
|
|
6879
|
+
/** Escalation configuration when stage times out */
|
|
6880
|
+
escalation?: WorkflowEscalation;
|
|
6255
6881
|
}
|
|
6256
|
-
|
|
6257
|
-
|
|
6258
|
-
|
|
6259
|
-
|
|
6882
|
+
/**
|
|
6883
|
+
* Complete workflow stage definition
|
|
6884
|
+
*/
|
|
6885
|
+
interface WorkflowStageDefinition {
|
|
6886
|
+
readonly _tag: 'workflowStage';
|
|
6887
|
+
readonly id: string;
|
|
6888
|
+
readonly displayName: string;
|
|
6889
|
+
readonly description?: string;
|
|
6890
|
+
/** Absent means the schema's default of 1 */
|
|
6891
|
+
readonly requiredApprovals?: number;
|
|
6892
|
+
readonly allowedRoles?: string[];
|
|
6893
|
+
readonly autoAssign?: WorkflowAutoAssign;
|
|
6894
|
+
readonly timeoutDays?: number;
|
|
6895
|
+
readonly escalation?: WorkflowEscalation;
|
|
6260
6896
|
}
|
|
6261
|
-
|
|
6262
|
-
|
|
6263
|
-
|
|
6264
|
-
|
|
6897
|
+
/**
|
|
6898
|
+
* Workflow configuration
|
|
6899
|
+
*/
|
|
6900
|
+
interface WorkflowConfig {
|
|
6901
|
+
/** Enable/disable workflow for the branch (default: false) */
|
|
6902
|
+
enabled?: boolean;
|
|
6903
|
+
/** Array of approval stage definitions */
|
|
6904
|
+
stages?: WorkflowStageDefinition[];
|
|
6265
6905
|
}
|
|
6266
|
-
|
|
6267
|
-
|
|
6268
|
-
|
|
6269
|
-
|
|
6906
|
+
/**
|
|
6907
|
+
* Complete workflow definition
|
|
6908
|
+
*/
|
|
6909
|
+
interface WorkflowDefinition {
|
|
6910
|
+
readonly _tag: 'workflow';
|
|
6911
|
+
/** Absent means the schema's default, disabled */
|
|
6912
|
+
readonly enabled?: boolean;
|
|
6913
|
+
readonly stages?: WorkflowStageDefinition[];
|
|
6270
6914
|
}
|
|
6271
|
-
|
|
6272
|
-
|
|
6273
|
-
|
|
6274
|
-
|
|
6915
|
+
/**
|
|
6916
|
+
* Per-content-type workflow configuration
|
|
6917
|
+
*/
|
|
6918
|
+
interface ContentTypeWorkflowConfig {
|
|
6919
|
+
/** Enable workflow for this content type (inherits from global if not set) */
|
|
6920
|
+
enabled?: boolean;
|
|
6921
|
+
/** Which global stages apply to this content type (subset of global stages) */
|
|
6922
|
+
stages?: string[];
|
|
6923
|
+
/** Publish automatically after all stages are approved */
|
|
6924
|
+
autoPublish?: boolean;
|
|
6925
|
+
/** Require all locales to be approved before publishing */
|
|
6926
|
+
requireAllLocales?: boolean;
|
|
6275
6927
|
}
|
|
6928
|
+
/**
|
|
6929
|
+
* Define a workflow stage
|
|
6930
|
+
*
|
|
6931
|
+
* @param id - Unique identifier for the stage (kebab-case or camelCase)
|
|
6932
|
+
* @param config - Stage configuration
|
|
6933
|
+
*
|
|
6934
|
+
* @example
|
|
6935
|
+
* const editorialReview = defineWorkflowStage('editorial-review', {
|
|
6936
|
+
* displayName: 'Editorial Review',
|
|
6937
|
+
* description: 'Content quality and style check',
|
|
6938
|
+
* requiredApprovals: 1,
|
|
6939
|
+
* allowedRoles: ['editor', 'senior-editor']
|
|
6940
|
+
* })
|
|
6941
|
+
*
|
|
6942
|
+
* @example
|
|
6943
|
+
* // Stage with auto-assignment and timeout
|
|
6944
|
+
* const legalApproval = defineWorkflowStage('legal-approval', {
|
|
6945
|
+
* displayName: 'Legal Approval',
|
|
6946
|
+
* allowedRoles: ['legal-reviewer'],
|
|
6947
|
+
* autoAssign: { roles: ['legal-reviewer'] },
|
|
6948
|
+
* timeoutDays: 3,
|
|
6949
|
+
* escalation: {
|
|
6950
|
+
* notifyRoles: ['legal-reviewer'],
|
|
6951
|
+
* escalateToRoles: ['admin']
|
|
6952
|
+
* }
|
|
6953
|
+
* })
|
|
6954
|
+
*/
|
|
6955
|
+
declare function defineWorkflowStage(id: string, config: WorkflowStageConfig): WorkflowStageDefinition;
|
|
6956
|
+
/**
|
|
6957
|
+
* Define a workflow configuration
|
|
6958
|
+
*
|
|
6959
|
+
* @param config - Workflow configuration with enabled flag and stages
|
|
6960
|
+
*
|
|
6961
|
+
* @example
|
|
6962
|
+
* // Simple workflow
|
|
6963
|
+
* const workflow = defineWorkflow({
|
|
6964
|
+
* enabled: true,
|
|
6965
|
+
* stages: [
|
|
6966
|
+
* defineWorkflowStage('review', {
|
|
6967
|
+
* displayName: 'Review',
|
|
6968
|
+
* allowedRoles: ['editor']
|
|
6969
|
+
* })
|
|
6970
|
+
* ]
|
|
6971
|
+
* })
|
|
6972
|
+
*
|
|
6973
|
+
* @example
|
|
6974
|
+
* // Disabled workflow (direct publish)
|
|
6975
|
+
* const workflow = defineWorkflow({
|
|
6976
|
+
* enabled: false
|
|
6977
|
+
* })
|
|
6978
|
+
*/
|
|
6979
|
+
declare function defineWorkflow(config: WorkflowConfig): WorkflowDefinition;
|
|
6980
|
+
/**
|
|
6981
|
+
* Define content-type specific workflow configuration
|
|
6982
|
+
*
|
|
6983
|
+
* @param config - Content type workflow configuration
|
|
6984
|
+
*
|
|
6985
|
+
* @example
|
|
6986
|
+
* // Use specific stages from global workflow
|
|
6987
|
+
* const blogPostWorkflow = defineContentTypeWorkflow({
|
|
6988
|
+
* enabled: true,
|
|
6989
|
+
* stages: ['editorial-review', 'final-approval'], // Skip legal
|
|
6990
|
+
* autoPublish: false
|
|
6991
|
+
* })
|
|
6992
|
+
*
|
|
6993
|
+
* @example
|
|
6994
|
+
* // Disable workflow for this content type
|
|
6995
|
+
* const quickUpdateWorkflow = defineContentTypeWorkflow({
|
|
6996
|
+
* enabled: false
|
|
6997
|
+
* })
|
|
6998
|
+
*
|
|
6999
|
+
* @example
|
|
7000
|
+
* // Require all locales to be approved
|
|
7001
|
+
* const marketingPageWorkflow = defineContentTypeWorkflow({
|
|
7002
|
+
* enabled: true,
|
|
7003
|
+
* stages: ['translation-review', 'regional-approval'],
|
|
7004
|
+
* requireAllLocales: true
|
|
7005
|
+
* })
|
|
7006
|
+
*/
|
|
7007
|
+
declare function defineContentTypeWorkflow(config: ContentTypeWorkflowConfig): ContentTypeWorkflowConfig;
|
|
7008
|
+
/**
|
|
7009
|
+
* Check if a value is a workflow stage definition
|
|
7010
|
+
*/
|
|
7011
|
+
declare function isWorkflowStageDefinition(value: unknown): value is WorkflowStageDefinition;
|
|
7012
|
+
/**
|
|
7013
|
+
* Check if a value is a workflow definition
|
|
7014
|
+
*/
|
|
7015
|
+
declare function isWorkflowDefinition(value: unknown): value is WorkflowDefinition;
|
|
7016
|
+
/**
|
|
7017
|
+
* Get all stage IDs from a workflow definition
|
|
7018
|
+
*/
|
|
7019
|
+
declare function getWorkflowStageIds(workflow: WorkflowDefinition): string[];
|
|
7020
|
+
/**
|
|
7021
|
+
* Find a stage by ID in a workflow definition
|
|
7022
|
+
*/
|
|
7023
|
+
declare function findWorkflowStage(workflow: WorkflowDefinition, stageId: string): WorkflowStageDefinition | undefined;
|
|
7024
|
+
/**
|
|
7025
|
+
* Get the next stage after a given stage ID (null if last stage)
|
|
7026
|
+
*/
|
|
7027
|
+
declare function getNextWorkflowStage(workflow: WorkflowDefinition, currentStageId: string): WorkflowStageDefinition | null;
|
|
7028
|
+
/**
|
|
7029
|
+
* Get the first stage in the workflow (null if no stages)
|
|
7030
|
+
*/
|
|
7031
|
+
declare function getFirstWorkflowStage(workflow: WorkflowDefinition): WorkflowStageDefinition | null;
|
|
7032
|
+
/**
|
|
7033
|
+
* Check if a stage is the final stage in the workflow
|
|
7034
|
+
*/
|
|
7035
|
+
declare function isFinalWorkflowStage(workflow: WorkflowDefinition, stageId: string): boolean;
|
|
6276
7036
|
|
|
6277
7037
|
/**
|
|
6278
|
-
*
|
|
7038
|
+
* Singleton content type definition matching @relyio/schema
|
|
7039
|
+
*
|
|
7040
|
+
* In RelyIO, singletons are just content types with a special flag.
|
|
7041
|
+
* They share the same structure as regular content types.
|
|
7042
|
+
*
|
|
7043
|
+
* Uses advanced TypeScript generics to preserve literal field IDs through
|
|
7044
|
+
* the type system, enabling full autocomplete in SDK methods.
|
|
6279
7045
|
*/
|
|
6280
7046
|
|
|
6281
7047
|
/**
|
|
6282
|
-
*
|
|
6283
|
-
* Matches the actual RelyIO API structure with _metadata object
|
|
7048
|
+
* Type alias for a fieldset with any fields.
|
|
6284
7049
|
*/
|
|
6285
|
-
|
|
6286
|
-
|
|
6287
|
-
|
|
6288
|
-
|
|
6289
|
-
|
|
6290
|
-
|
|
6291
|
-
|
|
6292
|
-
|
|
6293
|
-
|
|
6294
|
-
|
|
6295
|
-
|
|
6296
|
-
|
|
6297
|
-
|
|
6298
|
-
|
|
6299
|
-
|
|
6300
|
-
|
|
7050
|
+
type AnyFieldset$2 = Fieldset<any>;
|
|
7051
|
+
/**
|
|
7052
|
+
* What a singleton takes: a content type's settings, since the schema declares a singleton with the
|
|
7053
|
+
* same `ContentTypeSchema` — except `hierarchical`, which is `false` or absent. A singleton is one
|
|
7054
|
+
* entry, with no parent and no children, and deploy refuses `true` for one
|
|
7055
|
+
* (`SINGLETON_CANNOT_BE_HIERARCHICAL`). It used to take a content type's `boolean` and write `false`
|
|
7056
|
+
* whatever it was given.
|
|
7057
|
+
*/
|
|
7058
|
+
interface SingletonConfigWithFields<TFields extends readonly AnyFieldDefinition[] = readonly AnyFieldDefinition[]> extends Omit<ContentTypeConfigWithFields<TFields>, 'hierarchical'> {
|
|
7059
|
+
hierarchical?: false;
|
|
7060
|
+
}
|
|
7061
|
+
/** {@link SingletonConfigWithFields}, with its fields organised into fieldsets. */
|
|
7062
|
+
interface SingletonConfigWithFieldsets<TFieldsets extends readonly AnyFieldset$2[] = readonly AnyFieldset$2[]> extends Omit<ContentTypeConfigWithFieldsets<TFieldsets>, 'hierarchical'> {
|
|
7063
|
+
hierarchical?: false;
|
|
7064
|
+
}
|
|
7065
|
+
/**
|
|
7066
|
+
* Singleton content type definition - preserves field types for inference
|
|
7067
|
+
*/
|
|
7068
|
+
interface SingletonContentTypeDefinition<TFields extends readonly AnyFieldDefinition[] = readonly AnyFieldDefinition[], TFieldsets extends readonly AnyFieldset$2[] = readonly AnyFieldset$2[]> {
|
|
7069
|
+
readonly _tag: 'singletonContentType';
|
|
7070
|
+
readonly name: string;
|
|
7071
|
+
readonly displayName: string;
|
|
7072
|
+
readonly displayNamePlural?: string;
|
|
7073
|
+
readonly description?: string;
|
|
7074
|
+
/** AI configuration: generation guidance + entry intelligence */
|
|
7075
|
+
readonly ai?: AIConfig;
|
|
7076
|
+
/** Field ID to use as entry display title */
|
|
7077
|
+
readonly displayField?: string;
|
|
7078
|
+
readonly hierarchical?: false;
|
|
7079
|
+
readonly accessTags?: string[];
|
|
7080
|
+
/** Workflow configuration for this singleton */
|
|
7081
|
+
readonly workflow?: ContentTypeWorkflowConfig;
|
|
7082
|
+
readonly fields?: TFields;
|
|
7083
|
+
readonly fieldsets?: TFieldsets;
|
|
6301
7084
|
}
|
|
6302
7085
|
/**
|
|
6303
|
-
*
|
|
7086
|
+
* Define a singleton content type
|
|
6304
7087
|
*
|
|
6305
|
-
*
|
|
6306
|
-
*
|
|
6307
|
-
*
|
|
6308
|
-
*
|
|
7088
|
+
* Singletons are single-instance content types like homepage, site settings, etc.
|
|
7089
|
+
* They use the same field structure as regular content types.
|
|
7090
|
+
*
|
|
7091
|
+
* The generic type parameters preserve the literal field IDs through the type
|
|
7092
|
+
* system, enabling autocomplete in SDK methods.
|
|
7093
|
+
*
|
|
7094
|
+
* @example
|
|
7095
|
+
* const homepage = defineSingletonContentType('homepage', {
|
|
7096
|
+
* displayName: 'Homepage',
|
|
7097
|
+
* fields: [
|
|
7098
|
+
* fields.shortText('heroTitle', { config: { required: true } }),
|
|
7099
|
+
* fields.reference('heroImage', { config: { to: 'productPhoto' } }), // an asset type's entry
|
|
7100
|
+
* ]
|
|
7101
|
+
* })
|
|
6309
7102
|
*/
|
|
6310
|
-
|
|
6311
|
-
|
|
6312
|
-
|
|
7103
|
+
declare function defineSingletonContentType<TFields extends readonly AnyFieldDefinition[], _TFieldsets extends readonly Fieldset<AnyFieldDefinition[]>[]>(name: string, config: SingletonConfigWithFields<TFields>): SingletonContentTypeDefinition<TFields, readonly []>;
|
|
7104
|
+
declare function defineSingletonContentType<_TFields extends readonly AnyFieldDefinition[], TFieldsets extends readonly Fieldset<AnyFieldDefinition[]>[]>(name: string, config: SingletonConfigWithFieldsets<TFieldsets>): SingletonContentTypeDefinition<readonly [], TFieldsets>;
|
|
7105
|
+
declare const defineSingleton: typeof defineSingletonContentType;
|
|
6313
7106
|
/**
|
|
6314
|
-
*
|
|
6315
|
-
*
|
|
7107
|
+
* What a read reports about a singleton beside its fields: the committed document's
|
|
7108
|
+
* `SingletonMetadata`, read through `http/api-schema.ts` rather than declared again here.
|
|
6316
7109
|
*
|
|
6317
|
-
*
|
|
6318
|
-
*
|
|
6319
|
-
*
|
|
7110
|
+
* Narrower than an entry's — no slug, default locale, available locales or references — and it
|
|
7111
|
+
* names the singleton by `id` and `type`. The hand-written type this replaces declared a `key` and a
|
|
7112
|
+
* `singletonType` the wire does not carry, and `Date` timestamps where it sends ISO 8601 strings.
|
|
6320
7113
|
*/
|
|
6321
|
-
type
|
|
6322
|
-
|
|
6323
|
-
|
|
6324
|
-
|
|
6325
|
-
|
|
6326
|
-
|
|
6327
|
-
|
|
6328
|
-
|
|
6329
|
-
|
|
6330
|
-
|
|
6331
|
-
|
|
7114
|
+
type SingletonMetadata = components['schemas']['SingletonMetadata'];
|
|
7115
|
+
/**
|
|
7116
|
+
* Type alias for any singleton content type definition.
|
|
7117
|
+
*/
|
|
7118
|
+
type AnySingletonContentTypeDefinition = SingletonContentTypeDefinition<any, any>;
|
|
7119
|
+
/**
|
|
7120
|
+
* Infer the TypeScript type from a singleton definition: every field typed as a read returns it
|
|
7121
|
+
* (`schema/infer-fields.ts`), plus `_metadata`. `S` is the schema, as for `InferContentType`.
|
|
7122
|
+
*/
|
|
7123
|
+
type InferSingletonContentType<T extends AnySingletonContentTypeDefinition, S extends FieldSchemaContext | undefined = undefined> = FieldValues<DeclaredFields<T>, S> & {
|
|
7124
|
+
_metadata: SingletonMetadata;
|
|
6332
7125
|
};
|
|
7126
|
+
type InferSingleton<T extends AnySingletonContentTypeDefinition, S extends FieldSchemaContext | undefined = undefined> = InferSingletonContentType<T, S>;
|
|
7127
|
+
|
|
6333
7128
|
/**
|
|
6334
|
-
*
|
|
7129
|
+
* Asset type definition matching @relyio/schema AssetTypeSchema
|
|
7130
|
+
*
|
|
7131
|
+
* Asset types are first-class entries (entryType: 'asset') that pair a binary
|
|
7132
|
+
* pipeline family (declared via exactly one kind key: `image`, `video`, or
|
|
7133
|
+
* `file`) with user-defined metadata fields that reuse the standard field
|
|
7134
|
+
* system — including fieldsets, workflow, access tags, and AI config.
|
|
7135
|
+
*
|
|
7136
|
+
* The kind config blocks are strongly typed below (mirroring the zod-inferred
|
|
7137
|
+
* `@relyio/schema` types), so authoring asset types in TypeScript gets full
|
|
7138
|
+
* autocomplete. The authoritative validation still lives in @relyio/schema's
|
|
7139
|
+
* `AssetTypesValidator` and runs on deploy.
|
|
6335
7140
|
*/
|
|
6336
|
-
|
|
6337
|
-
|
|
6338
|
-
|
|
6339
|
-
|
|
6340
|
-
|
|
6341
|
-
|
|
6342
|
-
|
|
6343
|
-
|
|
6344
|
-
|
|
6345
|
-
|
|
6346
|
-
|
|
6347
|
-
|
|
6348
|
-
|
|
6349
|
-
|
|
6350
|
-
|
|
6351
|
-
|
|
6352
|
-
|
|
6353
|
-
|
|
6354
|
-
|
|
6355
|
-
|
|
6356
|
-
|
|
6357
|
-
/**
|
|
6358
|
-
|
|
6359
|
-
|
|
6360
|
-
|
|
6361
|
-
|
|
6362
|
-
|
|
7141
|
+
|
|
7142
|
+
/** Resize fit modes supported by the Cloudflare Images binding. */
|
|
7143
|
+
type ImageFitMode = 'cover' | 'contain' | 'fill' | 'inside' | 'outside';
|
|
7144
|
+
/** Output formats the Cloudflare Images binding can produce (`heic` is input-only). */
|
|
7145
|
+
type ImageOutputFormat = 'avif' | 'webp' | 'jpeg' | 'png';
|
|
7146
|
+
/** Shared image transform props (CF Images vocabulary). */
|
|
7147
|
+
interface ImageTransform {
|
|
7148
|
+
width?: number;
|
|
7149
|
+
height?: number;
|
|
7150
|
+
fit?: ImageFitMode;
|
|
7151
|
+
format?: ImageOutputFormat;
|
|
7152
|
+
quality?: number;
|
|
7153
|
+
}
|
|
7154
|
+
/** Upload gate for the `image` kind (rejects bad files at the door). */
|
|
7155
|
+
interface ImageUploadConfig {
|
|
7156
|
+
allowedMimeTypes?: string[];
|
|
7157
|
+
maxFileSize?: number;
|
|
7158
|
+
minWidth?: number;
|
|
7159
|
+
maxWidth?: number;
|
|
7160
|
+
minHeight?: number;
|
|
7161
|
+
maxHeight?: number;
|
|
7162
|
+
/** `width:height`, e.g. `16:9`. */
|
|
7163
|
+
aspectRatio?: string;
|
|
7164
|
+
}
|
|
7165
|
+
/** Upload gate for the `video` kind. */
|
|
7166
|
+
interface VideoUploadConfig {
|
|
7167
|
+
allowedMimeTypes?: string[];
|
|
7168
|
+
maxFileSize?: number;
|
|
7169
|
+
maxDuration?: number;
|
|
7170
|
+
minWidth?: number;
|
|
7171
|
+
maxWidth?: number;
|
|
7172
|
+
minHeight?: number;
|
|
7173
|
+
maxHeight?: number;
|
|
7174
|
+
}
|
|
7175
|
+
/** Upload gate for the `file` kind (MIME + size only in v1). */
|
|
7176
|
+
interface FileUploadConfig {
|
|
7177
|
+
allowedMimeTypes?: string[];
|
|
7178
|
+
maxFileSize?: number;
|
|
7179
|
+
}
|
|
7180
|
+
/** Delivery rendition preset (max 20 per asset type), applied on the fly by the gateway. */
|
|
7181
|
+
interface VariantDefinition extends ImageTransform {
|
|
7182
|
+
/** Variant id; must start with a letter (codegen emits the `*Variant` union from these). */
|
|
7183
|
+
id: string;
|
|
6363
7184
|
}
|
|
6364
7185
|
/**
|
|
6365
|
-
*
|
|
7186
|
+
* Ingest normalization of the canonical stored original (image v1 only).
|
|
7187
|
+
* `true` expands to the platform default on deploy.
|
|
6366
7188
|
*/
|
|
6367
|
-
type
|
|
6368
|
-
|
|
6369
|
-
};
|
|
7189
|
+
type ImageSourceConfig = boolean | (ImageTransform & {
|
|
7190
|
+
stripMetadata?: boolean;
|
|
7191
|
+
});
|
|
7192
|
+
/** EXIF retention policy for the `image` kind (plan 15). */
|
|
7193
|
+
interface ImageExifConfig {
|
|
7194
|
+
/** Retain GPS in `extracted.exif` (default strips it for privacy). */
|
|
7195
|
+
keepGps?: boolean;
|
|
7196
|
+
}
|
|
7197
|
+
/** Image kind config (`upload`, `source`, `variants`, `localization`, `exif`). */
|
|
7198
|
+
interface ImageKindConfig {
|
|
7199
|
+
upload?: ImageUploadConfig;
|
|
7200
|
+
source?: ImageSourceConfig;
|
|
7201
|
+
/** Max 20 variants per asset type. */
|
|
7202
|
+
variants?: VariantDefinition[];
|
|
7203
|
+
localization?: LocalizationConfig;
|
|
7204
|
+
exif?: ImageExifConfig;
|
|
7205
|
+
}
|
|
7206
|
+
/** Poster/thumbnail strategy for the `video` kind. */
|
|
7207
|
+
interface VideoPosterConfig {
|
|
7208
|
+
/** 0.0–1.0 → Stream thumbnailTimestampPct. */
|
|
7209
|
+
defaultTimestampPct?: number;
|
|
7210
|
+
/** Enable an animated preview (gif/webp). */
|
|
7211
|
+
animated?: boolean;
|
|
7212
|
+
}
|
|
7213
|
+
/** Subtitle track strategy for the `video` kind. */
|
|
7214
|
+
interface VideoCaptionsConfig {
|
|
7215
|
+
enabled?: boolean;
|
|
7216
|
+
requiredLocales?: string[];
|
|
7217
|
+
/** Stream AI transcription when no track is uploaded. */
|
|
7218
|
+
autoGenerate?: boolean;
|
|
7219
|
+
}
|
|
7220
|
+
/** Downloadable-MP4 toggle for the `video` kind. */
|
|
7221
|
+
interface VideoDownloadConfig {
|
|
7222
|
+
enabled?: boolean;
|
|
7223
|
+
}
|
|
7224
|
+
/** Stream watermark profile for the `video` kind. */
|
|
7225
|
+
interface VideoWatermarkConfig {
|
|
7226
|
+
enabled?: boolean;
|
|
7227
|
+
/** Account-level Stream watermark profile uid. */
|
|
7228
|
+
profileId?: string;
|
|
7229
|
+
}
|
|
6370
7230
|
/**
|
|
6371
|
-
*
|
|
7231
|
+
* Video kind config (`upload`, `poster`, `captions`, `download`, `watermark`,
|
|
7232
|
+
* `localization`). Stream auto-generates the ABR ladder — there is intentionally
|
|
7233
|
+
* NO `variants` and NO `encoding` block.
|
|
6372
7234
|
*/
|
|
6373
|
-
interface
|
|
6374
|
-
|
|
6375
|
-
|
|
6376
|
-
|
|
6377
|
-
|
|
6378
|
-
|
|
6379
|
-
|
|
6380
|
-
|
|
6381
|
-
|
|
6382
|
-
|
|
6383
|
-
|
|
6384
|
-
|
|
6385
|
-
|
|
6386
|
-
|
|
6387
|
-
|
|
7235
|
+
interface VideoKindConfig {
|
|
7236
|
+
upload?: VideoUploadConfig;
|
|
7237
|
+
poster?: VideoPosterConfig;
|
|
7238
|
+
captions?: VideoCaptionsConfig;
|
|
7239
|
+
download?: VideoDownloadConfig;
|
|
7240
|
+
watermark?: VideoWatermarkConfig;
|
|
7241
|
+
localization?: LocalizationConfig;
|
|
7242
|
+
}
|
|
7243
|
+
/** Malware scan config for the `file` kind (plan 19). */
|
|
7244
|
+
interface FileScanConfig {
|
|
7245
|
+
enabled?: boolean;
|
|
7246
|
+
blockUntilClean?: boolean;
|
|
7247
|
+
}
|
|
7248
|
+
/** File kind config (`upload`, `localization`, `scan`, `extractText`). */
|
|
7249
|
+
interface FileKindConfig {
|
|
7250
|
+
upload?: FileUploadConfig;
|
|
7251
|
+
localization?: LocalizationConfig;
|
|
7252
|
+
/** Malware scan (plan 19). */
|
|
7253
|
+
scan?: FileScanConfig;
|
|
7254
|
+
/** Extract searchable text + metadata for PDFs (plan 15). */
|
|
7255
|
+
extractText?: boolean;
|
|
7256
|
+
}
|
|
7257
|
+
interface AssetTypeBaseConfig {
|
|
7258
|
+
/** Display name shown in the UI */
|
|
7259
|
+
displayName: string;
|
|
7260
|
+
/** Plural display name (e.g., "Product Photos" for "Product Photo") */
|
|
7261
|
+
displayNamePlural?: string;
|
|
7262
|
+
/** Description of the asset type */
|
|
7263
|
+
description?: string;
|
|
7264
|
+
/**
|
|
7265
|
+
* AI configuration. `ai.instructions` is an optional global brief; per-field
|
|
7266
|
+
* `ai.instructions` describe individual fields. `ai.autoGenerate` (image
|
|
7267
|
+
* kind, v1) is the master switch: when true, the derived analysis agent runs
|
|
7268
|
+
* after upload and fills every field that declares `ai.instructions`, applied
|
|
7269
|
+
* as a review proposal.
|
|
7270
|
+
*/
|
|
7271
|
+
ai?: AssetAIConfig;
|
|
7272
|
+
/** Field ID to use as the asset display title */
|
|
7273
|
+
displayField?: string;
|
|
7274
|
+
/** Access tags for role-based access control */
|
|
7275
|
+
accessTags?: string[];
|
|
7276
|
+
/** Workflow configuration for this asset type */
|
|
7277
|
+
workflow?: ContentTypeWorkflowConfig;
|
|
7278
|
+
/** Image pipeline config — mutually exclusive with `video`/`file` */
|
|
7279
|
+
image?: ImageKindConfig;
|
|
7280
|
+
/** Video pipeline config — mutually exclusive with `image`/`file` */
|
|
7281
|
+
video?: VideoKindConfig;
|
|
7282
|
+
/** File pipeline config — mutually exclusive with `image`/`video` */
|
|
7283
|
+
file?: FileKindConfig;
|
|
6388
7284
|
}
|
|
6389
7285
|
/**
|
|
6390
|
-
*
|
|
7286
|
+
* Type alias for a fieldset with any fields.
|
|
6391
7287
|
*/
|
|
6392
|
-
type
|
|
6393
|
-
|
|
6394
|
-
|
|
6395
|
-
|
|
6396
|
-
|
|
6397
|
-
|
|
6398
|
-
|
|
6399
|
-
|
|
6400
|
-
|
|
7288
|
+
type AnyFieldset$1 = Fieldset<any>;
|
|
7289
|
+
/** Asset type configuration using direct fields. */
|
|
7290
|
+
interface AssetTypeConfigWithFields<TFields extends readonly AnyFieldDefinition[] = readonly AnyFieldDefinition[]> extends AssetTypeBaseConfig {
|
|
7291
|
+
/** Direct field definitions - preserves literal types */
|
|
7292
|
+
fields: TFields;
|
|
7293
|
+
/** Cannot have fieldsets when using fields */
|
|
7294
|
+
fieldsets?: never;
|
|
7295
|
+
}
|
|
7296
|
+
/** Asset type configuration using fieldsets. */
|
|
7297
|
+
interface AssetTypeConfigWithFieldsets<TFieldsets extends readonly AnyFieldset$1[] = readonly AnyFieldset$1[]> extends AssetTypeBaseConfig {
|
|
7298
|
+
/** Field organization via fieldsets - preserves literal types */
|
|
7299
|
+
fieldsets: TFieldsets;
|
|
7300
|
+
/** Cannot have direct fields when using fieldsets */
|
|
7301
|
+
fields?: never;
|
|
7302
|
+
}
|
|
6401
7303
|
/**
|
|
6402
|
-
*
|
|
7304
|
+
* Asset type configuration with no metadata fields: the asset is its file. `AssetTypeSchema` makes
|
|
7305
|
+
* `fields` and `fieldsets` both optional, so this is an asset type deploy accepts (REL-1454).
|
|
6403
7306
|
*/
|
|
6404
|
-
|
|
6405
|
-
|
|
6406
|
-
|
|
6407
|
-
|
|
6408
|
-
|
|
6409
|
-
|
|
6410
|
-
|
|
6411
|
-
|
|
7307
|
+
interface AssetTypeConfigWithoutFields extends AssetTypeBaseConfig {
|
|
7308
|
+
fields?: never;
|
|
7309
|
+
fieldsets?: never;
|
|
7310
|
+
}
|
|
7311
|
+
/** Asset type configuration: direct fields, fieldsets, or neither. */
|
|
7312
|
+
type AssetTypeConfig<TFields extends readonly AnyFieldDefinition[] = readonly AnyFieldDefinition[], TFieldsets extends readonly AnyFieldset$1[] = readonly AnyFieldset$1[]> = AssetTypeConfigWithFields<TFields> | AssetTypeConfigWithFieldsets<TFieldsets> | AssetTypeConfigWithoutFields;
|
|
7313
|
+
/** Asset type definition - preserves field types for inference. */
|
|
7314
|
+
interface AssetTypeDefinition<TFields extends readonly AnyFieldDefinition[] = readonly AnyFieldDefinition[], TFieldsets extends readonly AnyFieldset$1[] = readonly AnyFieldset$1[]> {
|
|
7315
|
+
readonly _tag: 'assetType';
|
|
7316
|
+
readonly name: string;
|
|
7317
|
+
readonly displayName: string;
|
|
7318
|
+
readonly displayNamePlural?: string;
|
|
7319
|
+
readonly description?: string;
|
|
7320
|
+
readonly ai?: AssetAIConfig;
|
|
7321
|
+
readonly displayField?: string;
|
|
7322
|
+
readonly accessTags?: string[];
|
|
7323
|
+
readonly workflow?: ContentTypeWorkflowConfig;
|
|
7324
|
+
readonly image?: ImageKindConfig;
|
|
7325
|
+
readonly video?: VideoKindConfig;
|
|
7326
|
+
readonly file?: FileKindConfig;
|
|
7327
|
+
readonly fields?: TFields;
|
|
7328
|
+
readonly fieldsets?: TFieldsets;
|
|
7329
|
+
}
|
|
7330
|
+
/**
|
|
7331
|
+
* Define an asset type.
|
|
7332
|
+
*
|
|
7333
|
+
* Exactly one kind key (`image`, `video`, or `file`) must be supplied. Metadata
|
|
7334
|
+
* fields are optional: declare `fields`, `fieldsets`, or neither. The generic
|
|
7335
|
+
* type parameters preserve literal field IDs for inference, mirroring
|
|
7336
|
+
* `defineContentType`.
|
|
7337
|
+
*
|
|
7338
|
+
* @example
|
|
7339
|
+
* const productPhoto = defineAssetType('productPhoto', {
|
|
7340
|
+
* displayName: 'Product Photo',
|
|
7341
|
+
* image: {
|
|
7342
|
+
* upload: { allowedMimeTypes: ['image/jpeg', 'image/png', 'image/webp'], maxFileSize: 10485760 },
|
|
7343
|
+
* variants: [{ id: 'thumb', width: 200, height: 200, fit: 'cover', format: 'webp' }],
|
|
7344
|
+
* },
|
|
7345
|
+
* fields: [
|
|
7346
|
+
* fields.shortText('altText', { ui: { displayName: 'Alt Text' } }),
|
|
7347
|
+
* ],
|
|
7348
|
+
* })
|
|
7349
|
+
*/
|
|
7350
|
+
declare function defineAssetType(name: string, config: AssetTypeConfigWithoutFields): AssetTypeDefinition<readonly [], readonly []>;
|
|
7351
|
+
declare function defineAssetType<TFields extends readonly AnyFieldDefinition[], _TFieldsets extends readonly Fieldset<AnyFieldDefinition[]>[]>(name: string, config: AssetTypeConfigWithFields<TFields>): AssetTypeDefinition<TFields, readonly []>;
|
|
7352
|
+
declare function defineAssetType<_TFields extends readonly AnyFieldDefinition[], TFieldsets extends readonly Fieldset<AnyFieldDefinition[]>[]>(name: string, config: AssetTypeConfigWithFieldsets<TFieldsets>): AssetTypeDefinition<readonly [], TFieldsets>;
|
|
7353
|
+
/**
|
|
7354
|
+
* Type alias for any asset type definition.
|
|
7355
|
+
*/
|
|
7356
|
+
type AnyAssetTypeDefinition = AssetTypeDefinition<any, any>;
|
|
7357
|
+
/**
|
|
7358
|
+
* Infer the TypeScript type from an asset type definition.
|
|
7359
|
+
*
|
|
7360
|
+
* Mirrors {@link InferContentType}: produces the (optional) metadata field shape
|
|
7361
|
+
* plus `_metadata`, so it is assignable to `BaseContent` and can parametrize
|
|
7362
|
+
* `AssetClient<T>`. The runtime `file`/`urls` blocks are layered on by the
|
|
7363
|
+
* client's `AssetEntryResponse<T>` return type, not here, to keep the schema
|
|
7364
|
+
* layer free of any dependency on the client layer.
|
|
7365
|
+
*/
|
|
7366
|
+
type InferAssetType<T extends AnyAssetTypeDefinition, S extends FieldSchemaContext | undefined = undefined> = FieldValues<DeclaredFields<T>, S> & {
|
|
7367
|
+
_metadata: EntryMetadata;
|
|
6412
7368
|
};
|
|
7369
|
+
|
|
6413
7370
|
/**
|
|
6414
|
-
* What
|
|
6415
|
-
* written down here.
|
|
7371
|
+
* What a read returns for each field, derived from the field's declaration (`INV-SS-TYPES-INFERRED`).
|
|
6416
7372
|
*
|
|
6417
|
-
*
|
|
6418
|
-
*
|
|
6419
|
-
*
|
|
6420
|
-
*
|
|
6421
|
-
* every caller of the SDK's most-used method, and nothing could see it because
|
|
6422
|
-
* the type said otherwise.
|
|
7373
|
+
* Every `Infer*` in this package — content types, singletons, asset types, settings groups — types
|
|
7374
|
+
* its fields here and nowhere else, so an entry, a referenced entry, a component and a list item are
|
|
7375
|
+
* typed by one table. The types describe **what a read returns**, which is not always what a write
|
|
7376
|
+
* accepts:
|
|
6423
7377
|
*
|
|
6424
|
-
*
|
|
6425
|
-
*
|
|
7378
|
+
* - `richText` is the stored HTML string; `date` is `YYYY-MM-DD` and `dateTime` an ISO 8601 string —
|
|
7379
|
+
* the client does not revive dates.
|
|
7380
|
+
* - A `reference` is the target's id until `include` names it, and then the target entry itself.
|
|
7381
|
+
* The type cannot see `include`, so it is both: `string | <entry>`. A single reference whose target
|
|
7382
|
+
* was deleted with `onTargetDelete: 'nullify'` is `null`.
|
|
7383
|
+
* - A localized field is the value for the one locale the read composed, like any other field; the
|
|
7384
|
+
* other locales of a `locales=` read sit under `_metadata.localizations`, not here.
|
|
7385
|
+
* - Every field is optional. The wire omits a field with no value — a draft, a `fields` projection, a
|
|
7386
|
+
* locale with nothing to fall back to, an entry older than a field — so `required` does not make
|
|
7387
|
+
* one present.
|
|
6426
7388
|
*/
|
|
6427
|
-
|
|
7389
|
+
|
|
6428
7390
|
/**
|
|
6429
|
-
*
|
|
6430
|
-
*
|
|
7391
|
+
* The parts of a schema a field's value type reads: the types a reference may expand to and the
|
|
7392
|
+
* components a component field names. Structural, so every `defineSchema()` result fits.
|
|
7393
|
+
*
|
|
7394
|
+
* Without one in view — `InferContentType<typeof post>` with no second argument — a reference
|
|
7395
|
+
* expands to an {@link UnresolvedEntry} and a component to an {@link UnresolvedComponent}: the field
|
|
7396
|
+
* is still typed, but what it names is not.
|
|
6431
7397
|
*/
|
|
6432
|
-
interface
|
|
6433
|
-
|
|
6434
|
-
|
|
6435
|
-
|
|
6436
|
-
|
|
6437
|
-
|
|
6438
|
-
|
|
6439
|
-
|
|
6440
|
-
|
|
6441
|
-
|
|
6442
|
-
|
|
6443
|
-
|
|
6444
|
-
singletonType: string;
|
|
6445
|
-
/** Content version */
|
|
6446
|
-
version: number;
|
|
6447
|
-
/** Content locale */
|
|
6448
|
-
locale: string;
|
|
6449
|
-
};
|
|
7398
|
+
interface FieldSchemaContext {
|
|
7399
|
+
readonly contentTypes: object;
|
|
7400
|
+
readonly components: object;
|
|
7401
|
+
readonly singletonContentTypes: object;
|
|
7402
|
+
readonly assetTypes?: object;
|
|
7403
|
+
}
|
|
7404
|
+
/** A schema in view, or `undefined` when none is. */
|
|
7405
|
+
type Context = FieldSchemaContext | undefined;
|
|
7406
|
+
/** An expanded reference whose target type is not in view: an entry, with fields nothing declared. */
|
|
7407
|
+
interface UnresolvedEntry {
|
|
7408
|
+
_metadata: EntryMetadata;
|
|
7409
|
+
[field: string]: unknown;
|
|
6450
7410
|
}
|
|
7411
|
+
/** A component whose definition is not in view: an object, with fields nothing declared. */
|
|
7412
|
+
type UnresolvedComponent = Record<string, unknown>;
|
|
6451
7413
|
/**
|
|
6452
|
-
*
|
|
7414
|
+
* One row per field type the schema declares. `OverEveryFieldType` makes the table exhaustive by
|
|
7415
|
+
* construction: a field type added to `FieldType` without a row here fails to compile, rather than
|
|
7416
|
+
* reading as `unknown`.
|
|
6453
7417
|
*/
|
|
6454
|
-
|
|
6455
|
-
|
|
6456
|
-
|
|
6457
|
-
|
|
6458
|
-
|
|
6459
|
-
|
|
6460
|
-
|
|
6461
|
-
|
|
6462
|
-
|
|
6463
|
-
|
|
6464
|
-
|
|
6465
|
-
|
|
7418
|
+
type OverEveryFieldType<T extends {
|
|
7419
|
+
[K in FieldType]: unknown;
|
|
7420
|
+
}> = T;
|
|
7421
|
+
type FieldValueByType<C, S extends Context> = OverEveryFieldType<{
|
|
7422
|
+
shortText: string;
|
|
7423
|
+
longText: string;
|
|
7424
|
+
/** The stored HTML. */
|
|
7425
|
+
richText: string;
|
|
7426
|
+
email: string;
|
|
7427
|
+
url: string;
|
|
7428
|
+
slug: string;
|
|
7429
|
+
integer: number;
|
|
7430
|
+
decimal: number;
|
|
7431
|
+
boolean: boolean;
|
|
7432
|
+
enum: EnumValue<C>;
|
|
7433
|
+
/** `YYYY-MM-DD`. */
|
|
7434
|
+
date: string;
|
|
7435
|
+
/** ISO 8601. */
|
|
7436
|
+
dateTime: string;
|
|
7437
|
+
reference: ReferenceValue<C, S>;
|
|
7438
|
+
tags: string[];
|
|
7439
|
+
list: ListValue<C, S>;
|
|
7440
|
+
}>;
|
|
7441
|
+
/**
|
|
7442
|
+
* The value a read returns for field `F`.
|
|
7443
|
+
*
|
|
7444
|
+
* The last arm is the one `unknown` in this module, and it is deliberate: a field whose `type` is not
|
|
7445
|
+
* a declared literal — a definition built from a plain `string` rather than through `fields.*` — has
|
|
7446
|
+
* no row to read.
|
|
7447
|
+
*/
|
|
7448
|
+
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;
|
|
7449
|
+
/** The fields `F` (a union of field definitions) as an object, each optional — see the module note. */
|
|
7450
|
+
type FieldValues<F extends AnyFieldDefinition, S extends Context = undefined> = {
|
|
7451
|
+
[K in F['id']]?: FieldValue<Extract<F, {
|
|
7452
|
+
readonly id: K;
|
|
7453
|
+
}>, S>;
|
|
7454
|
+
};
|
|
7455
|
+
/**
|
|
7456
|
+
* Every field a definition declares, directly or through its fieldsets, as one union — the one walk
|
|
7457
|
+
* over `fields` / `fieldsets` every `Infer*` shares.
|
|
7458
|
+
*/
|
|
7459
|
+
type DeclaredFields<T extends {
|
|
7460
|
+
readonly fields?: unknown;
|
|
7461
|
+
readonly fieldsets?: unknown;
|
|
7462
|
+
}> = Extract<(NonNullable<T['fields']> extends readonly (infer F)[] ? F : never) | (NonNullable<T['fieldsets']> extends readonly (infer FS)[] ? FS extends {
|
|
7463
|
+
readonly fields: readonly (infer F)[];
|
|
7464
|
+
} ? F : never : never), AnyFieldDefinition>;
|
|
7465
|
+
/** `multi` as declared: `true`, `false`, or `boolean` when the declaration does not say. */
|
|
7466
|
+
type Multiplicity<C> = C extends {
|
|
7467
|
+
readonly multi?: infer M;
|
|
7468
|
+
} ? M : false;
|
|
7469
|
+
/** One `V`, a list of them, or — when `multi` is not a literal — either. */
|
|
7470
|
+
type OneOrMany<C, V> = [Multiplicity<C>] extends [true] ? V[] : [Multiplicity<C>] extends [false | undefined] ? V : V | V[];
|
|
7471
|
+
type EnumValue<C> = OneOrMany<C, C extends {
|
|
7472
|
+
readonly options: ReadonlyArray<{
|
|
7473
|
+
readonly value: infer V;
|
|
7474
|
+
}>;
|
|
7475
|
+
} ? V : string>;
|
|
7476
|
+
type ReferenceTarget<C> = C extends {
|
|
7477
|
+
readonly to: infer T;
|
|
7478
|
+
} ? T extends readonly (infer E)[] ? E : T : string;
|
|
7479
|
+
/** `R[K]` where `R` declares `K`. A `Record<string, never>` default declares nothing. */
|
|
7480
|
+
type Declared<R, K> = K extends keyof R ? R[K] : never;
|
|
7481
|
+
type ContentEntryOf<D, S extends Context> = D extends ContentTypeDefinition ? InferContentType<D, S> : never;
|
|
7482
|
+
type SingletonEntryOf<D, S extends Context> = D extends SingletonContentTypeDefinition ? InferSingletonContentType<D, S> : never;
|
|
7483
|
+
type AssetEntryOf<D, S extends Context> = D extends AssetTypeDefinition ? InferAssetType<D, S> : never;
|
|
7484
|
+
type OrUnresolved<T> = [T] extends [never] ? UnresolvedEntry : T;
|
|
7485
|
+
/** What `include` expands a reference to `Target` into: that type's entry, typed by the schema. */
|
|
7486
|
+
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;
|
|
7487
|
+
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>;
|
|
7488
|
+
type ComponentFields<D, S extends Context> = [D] extends [never] ? UnresolvedComponent : D extends {
|
|
7489
|
+
readonly fields: readonly (infer F)[];
|
|
7490
|
+
} ? FieldValues<Extract<F, AnyFieldDefinition>, S> : UnresolvedComponent;
|
|
7491
|
+
type ComponentValue<Id extends string, S extends Context> = S extends FieldSchemaContext ? ComponentFields<Declared<S['components'], Id>, S> : UnresolvedComponent;
|
|
7492
|
+
/**
|
|
7493
|
+
* A list with subfields is a list of objects typed by them; a list without is a list of strings,
|
|
7494
|
+
* which is what the validation document enforces for it.
|
|
7495
|
+
*/
|
|
7496
|
+
type ListValue<C, S extends Context> = C extends {
|
|
7497
|
+
readonly subfields?: infer Sub;
|
|
7498
|
+
} ? Sub extends readonly (infer F)[] ? [F] extends [never] ? string[] : Array<FieldValues<Extract<F, AnyFieldDefinition>, S>> : string[] : string[];
|
|
7499
|
+
|
|
7500
|
+
/**
|
|
7501
|
+
* Content type definition matching @relyio/schema ContentTypeSchema
|
|
7502
|
+
*
|
|
7503
|
+
* Uses advanced TypeScript generics to preserve each field's declaration through the type system,
|
|
7504
|
+
* so `InferContentType` types every field by what a read returns and `where()` autocompletes.
|
|
7505
|
+
*/
|
|
7506
|
+
|
|
6466
7507
|
/**
|
|
6467
|
-
*
|
|
7508
|
+
* Fieldset for organizing related fields
|
|
7509
|
+
* Generic over fields to preserve literal field IDs
|
|
6468
7510
|
*/
|
|
6469
|
-
interface
|
|
6470
|
-
/**
|
|
6471
|
-
|
|
6472
|
-
/**
|
|
6473
|
-
|
|
6474
|
-
/**
|
|
6475
|
-
|
|
7511
|
+
interface Fieldset<TFields extends readonly AnyFieldDefinition[] = readonly AnyFieldDefinition[]> {
|
|
7512
|
+
/** Unique fieldset identifier */
|
|
7513
|
+
readonly id: string;
|
|
7514
|
+
/** Display name shown in the UI */
|
|
7515
|
+
readonly displayName: string;
|
|
7516
|
+
/** Optional description */
|
|
7517
|
+
readonly description?: string;
|
|
7518
|
+
/** Whether an editing surface shows this fieldset collapsed to begin with */
|
|
7519
|
+
readonly collapsedByDefault?: boolean;
|
|
7520
|
+
/** AI configuration for content generation and review */
|
|
7521
|
+
readonly ai?: AIConfig;
|
|
7522
|
+
/** Fields within this fieldset - preserves literal types */
|
|
7523
|
+
readonly fields: TFields;
|
|
6476
7524
|
}
|
|
6477
7525
|
/**
|
|
6478
|
-
*
|
|
7526
|
+
* Type alias for a fieldset with any fields.
|
|
7527
|
+
* Used in generic constraints where we need to accept any fieldset type.
|
|
6479
7528
|
*/
|
|
6480
|
-
|
|
6481
|
-
|
|
6482
|
-
|
|
6483
|
-
|
|
7529
|
+
type AnyFieldset = Fieldset<any>;
|
|
7530
|
+
/**
|
|
7531
|
+
* Create a fieldset for organizing fields
|
|
7532
|
+
* Generic to preserve the specific field types for type inference
|
|
7533
|
+
*
|
|
7534
|
+
* @example
|
|
7535
|
+
* const seoFieldset = fieldset('seo', {
|
|
7536
|
+
* displayName: 'SEO Settings',
|
|
7537
|
+
* fields: [
|
|
7538
|
+
* fields.shortText('metaTitle', { config: { maxLength: 60 } }),
|
|
7539
|
+
* fields.longText('metaDescription', { config: { maxLength: 160 } }),
|
|
7540
|
+
* ]
|
|
7541
|
+
* })
|
|
7542
|
+
*/
|
|
7543
|
+
declare function fieldset<TFields extends readonly AnyFieldDefinition[]>(id: string, config: {
|
|
6484
7544
|
displayName: string;
|
|
6485
|
-
/** Description */
|
|
6486
7545
|
description?: string;
|
|
6487
|
-
/**
|
|
6488
|
-
|
|
6489
|
-
|
|
7546
|
+
/** Show the fieldset collapsed until an editor opens it */
|
|
7547
|
+
collapsedByDefault?: boolean;
|
|
7548
|
+
ai?: AIConfig;
|
|
7549
|
+
fields: TFields;
|
|
7550
|
+
}): Fieldset<TFields>;
|
|
7551
|
+
/**
|
|
7552
|
+
* Content type configuration using direct fields
|
|
7553
|
+
* Generic to preserve literal field IDs for type inference
|
|
7554
|
+
*/
|
|
7555
|
+
interface ContentTypeConfigWithFields<TFields extends readonly AnyFieldDefinition[] = readonly AnyFieldDefinition[]> {
|
|
7556
|
+
/** Display name shown in the UI */
|
|
7557
|
+
displayName: string;
|
|
7558
|
+
/** Plural display name shown in the UI (e.g., "Products" for "Product") */
|
|
7559
|
+
displayNamePlural?: string;
|
|
7560
|
+
/** Description of the content type */
|
|
7561
|
+
description?: string;
|
|
7562
|
+
/** AI configuration: generation/review guidance */
|
|
7563
|
+
ai?: AIConfig;
|
|
7564
|
+
/**
|
|
7565
|
+
* Field ID to use as entry display title in lists, references, and editor header.
|
|
7566
|
+
* If not set, falls back to: title → name → slug → first shortText field → entryUid
|
|
7567
|
+
*/
|
|
7568
|
+
displayField?: string;
|
|
7569
|
+
/** Whether this content type supports hierarchical (parent-child) relationships */
|
|
6490
7570
|
hierarchical?: boolean;
|
|
6491
|
-
/**
|
|
6492
|
-
|
|
6493
|
-
|
|
6494
|
-
|
|
6495
|
-
|
|
7571
|
+
/** Access tags for role-based access control */
|
|
7572
|
+
accessTags?: string[];
|
|
7573
|
+
/** Workflow configuration for this content type */
|
|
7574
|
+
workflow?: ContentTypeWorkflowConfig;
|
|
7575
|
+
/** Direct field definitions - preserves literal types */
|
|
7576
|
+
fields: TFields;
|
|
7577
|
+
/** Cannot have fieldsets when using fields */
|
|
7578
|
+
fieldsets?: never;
|
|
6496
7579
|
}
|
|
6497
7580
|
/**
|
|
6498
|
-
*
|
|
7581
|
+
* Content type configuration using fieldsets
|
|
7582
|
+
* Generic to preserve fieldset field types
|
|
6499
7583
|
*/
|
|
6500
|
-
interface
|
|
6501
|
-
/**
|
|
6502
|
-
|
|
6503
|
-
/**
|
|
6504
|
-
|
|
6505
|
-
/**
|
|
6506
|
-
title?: string;
|
|
6507
|
-
/** Field description */
|
|
7584
|
+
interface ContentTypeConfigWithFieldsets<TFieldsets extends readonly AnyFieldset[] = readonly AnyFieldset[]> {
|
|
7585
|
+
/** Display name shown in the UI */
|
|
7586
|
+
displayName: string;
|
|
7587
|
+
/** Plural display name shown in the UI (e.g., "Products" for "Product") */
|
|
7588
|
+
displayNamePlural?: string;
|
|
7589
|
+
/** Description of the content type */
|
|
6508
7590
|
description?: string;
|
|
6509
|
-
/**
|
|
6510
|
-
|
|
6511
|
-
/**
|
|
6512
|
-
|
|
6513
|
-
|
|
6514
|
-
|
|
6515
|
-
|
|
6516
|
-
|
|
7591
|
+
/** AI configuration: generation/review guidance */
|
|
7592
|
+
ai?: AIConfig;
|
|
7593
|
+
/**
|
|
7594
|
+
* Field ID to use as entry display title in lists, references, and editor header.
|
|
7595
|
+
* If not set, falls back to: title → name → slug → first shortText field → entryUid
|
|
7596
|
+
*/
|
|
7597
|
+
displayField?: string;
|
|
7598
|
+
/** Access tags for role-based access control */
|
|
7599
|
+
accessTags?: string[];
|
|
7600
|
+
/** Whether this content type supports hierarchical (parent-child) relationships */
|
|
7601
|
+
hierarchical?: boolean;
|
|
7602
|
+
/** Workflow configuration for this content type */
|
|
7603
|
+
workflow?: ContentTypeWorkflowConfig;
|
|
7604
|
+
/** Field organization via fieldsets - preserves literal types */
|
|
7605
|
+
fieldsets: TFieldsets;
|
|
7606
|
+
/** Cannot have direct fields when using fieldsets */
|
|
7607
|
+
fields?: never;
|
|
6517
7608
|
}
|
|
6518
7609
|
/**
|
|
6519
|
-
*
|
|
7610
|
+
* Content type configuration (either fields OR fieldsets, not both)
|
|
6520
7611
|
*/
|
|
6521
|
-
type
|
|
7612
|
+
type ContentTypeConfig<TFields extends readonly AnyFieldDefinition[] = readonly AnyFieldDefinition[], TFieldsets extends readonly AnyFieldset[] = readonly AnyFieldset[]> = ContentTypeConfigWithFields<TFields> | ContentTypeConfigWithFieldsets<TFieldsets>;
|
|
6522
7613
|
/**
|
|
6523
|
-
*
|
|
7614
|
+
* Content type definition - preserves field types for inference
|
|
6524
7615
|
*/
|
|
6525
|
-
interface
|
|
6526
|
-
|
|
6527
|
-
|
|
6528
|
-
|
|
6529
|
-
|
|
6530
|
-
|
|
6531
|
-
|
|
7616
|
+
interface ContentTypeDefinition<TFields extends readonly AnyFieldDefinition[] = readonly AnyFieldDefinition[], TFieldsets extends readonly AnyFieldset[] = readonly AnyFieldset[]> {
|
|
7617
|
+
readonly _tag: 'contentType';
|
|
7618
|
+
readonly name: string;
|
|
7619
|
+
readonly displayName: string;
|
|
7620
|
+
readonly displayNamePlural?: string;
|
|
7621
|
+
readonly description?: string;
|
|
7622
|
+
/** AI configuration: generation/review guidance */
|
|
7623
|
+
readonly ai?: AIConfig;
|
|
7624
|
+
/** Field ID to use as entry display title */
|
|
7625
|
+
readonly displayField?: string;
|
|
7626
|
+
readonly hierarchical?: boolean;
|
|
7627
|
+
readonly accessTags?: string[];
|
|
7628
|
+
readonly workflow?: ContentTypeWorkflowConfig;
|
|
7629
|
+
readonly fields?: TFields;
|
|
7630
|
+
readonly fieldsets?: TFieldsets;
|
|
6532
7631
|
}
|
|
6533
7632
|
/**
|
|
6534
|
-
*
|
|
7633
|
+
* Define a content type with type-safe fields
|
|
7634
|
+
*
|
|
7635
|
+
* The generic type parameters preserve the literal field IDs through the type
|
|
7636
|
+
* system, enabling autocomplete in SDK methods like where(), select(), etc.
|
|
7637
|
+
*
|
|
7638
|
+
* @example
|
|
7639
|
+
* // Using direct fields
|
|
7640
|
+
* const product = defineContentType('product', {
|
|
7641
|
+
* displayName: 'Product',
|
|
7642
|
+
* fields: [
|
|
7643
|
+
* fields.shortText('title', { config: { required: true } }),
|
|
7644
|
+
* fields.decimal('price', { config: { min: 0, decimalPlaces: 2 } }),
|
|
7645
|
+
* ]
|
|
7646
|
+
* })
|
|
7647
|
+
*
|
|
7648
|
+
* @example
|
|
7649
|
+
* // Using fieldsets for organization
|
|
7650
|
+
* const product = defineContentType('product', {
|
|
7651
|
+
* displayName: 'Product',
|
|
7652
|
+
* fieldsets: [
|
|
7653
|
+
* fieldset('basic', {
|
|
7654
|
+
* displayName: 'Basic Info',
|
|
7655
|
+
* fields: [
|
|
7656
|
+
* fields.shortText('title', { config: { required: true } }),
|
|
7657
|
+
* ]
|
|
7658
|
+
* }),
|
|
7659
|
+
* fieldset('pricing', {
|
|
7660
|
+
* displayName: 'Pricing',
|
|
7661
|
+
* fields: [
|
|
7662
|
+
* fields.decimal('price', { config: { min: 0, decimalPlaces: 2 } }),
|
|
7663
|
+
* ]
|
|
7664
|
+
* }),
|
|
7665
|
+
* ]
|
|
7666
|
+
* })
|
|
6535
7667
|
*/
|
|
6536
|
-
|
|
6537
|
-
|
|
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
|
-
}
|
|
7668
|
+
declare function defineContentType<TFields extends readonly AnyFieldDefinition[], _TFieldsets extends readonly Fieldset<AnyFieldDefinition[]>[]>(name: string, config: ContentTypeConfigWithFields<TFields>): ContentTypeDefinition<TFields, readonly []>;
|
|
7669
|
+
declare function defineContentType<_TFields extends readonly AnyFieldDefinition[], TFieldsets extends readonly Fieldset<AnyFieldDefinition[]>[]>(name: string, config: ContentTypeConfigWithFieldsets<TFieldsets>): ContentTypeDefinition<readonly [], TFieldsets>;
|
|
6552
7670
|
/**
|
|
6553
|
-
*
|
|
7671
|
+
* Type alias for any content type definition.
|
|
6554
7672
|
*/
|
|
6555
|
-
type
|
|
7673
|
+
type AnyContentTypeDefinition = ContentTypeDefinition<any, any>;
|
|
6556
7674
|
/**
|
|
6557
|
-
*
|
|
7675
|
+
* What a read reports about an entry beside its fields: the committed document's `EntryMetadata`
|
|
7676
|
+
* (`apps/services/api/openapi-spec.json`), read through `http/api-schema.ts`, its one derivation in
|
|
7677
|
+
* this package — not declared a second time here.
|
|
7678
|
+
*
|
|
7679
|
+
* It used to be written out by hand, and the copy had drifted from the wire: it declared a
|
|
7680
|
+
* `parentId` no read sends, typed `createdAt` and `updatedAt` as `Date` where the wire sends ISO 8601
|
|
7681
|
+
* strings, and left out what a reader most needs — `availableLocales`, `defaultLocale`, `slug`,
|
|
7682
|
+
* `refs` — so the preview toolbar took them through a structural type of its own. A field the
|
|
7683
|
+
* service adds or changes now reaches this type when `api-schema.ts` is regenerated, and
|
|
7684
|
+
* `__tests__/read-metadata.types.ts` fails `type:check` if a read stops declaring it.
|
|
7685
|
+
*
|
|
7686
|
+
* Every entry-shaped value carries it — a single read, each item of a list or of `children()`, and
|
|
7687
|
+
* an entry an `include` expanded — because the service builds each of them with one transform.
|
|
7688
|
+
* `versionCount` and `versions` are sent on a single read only, so they are optional.
|
|
6558
7689
|
*/
|
|
6559
|
-
|
|
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
|
-
}
|
|
7690
|
+
type EntryMetadata = components['schemas']['EntryMetadata'];
|
|
6573
7691
|
/**
|
|
6574
|
-
*
|
|
7692
|
+
* The per-locale publication facts every one-document read reports, an entry's, a singleton's and a
|
|
7693
|
+
* settings group's alike (`INV-LM-PUBLICATION-IS-REPORTED-PER-LOCALE`): a `Pick` of the document's
|
|
7694
|
+
* {@link EntryMetadata}, so this package holds no copy of them. `localeStatus` is absent when the
|
|
7695
|
+
* locale has no content of its own.
|
|
6575
7696
|
*/
|
|
6576
|
-
|
|
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
|
-
}
|
|
7697
|
+
type LocalePublicationFields = Pick<EntryMetadata, 'localeStatus' | 'localeHasDraft' | 'draftLocales'>;
|
|
6586
7698
|
/**
|
|
6587
|
-
*
|
|
7699
|
+
* Infer the TypeScript type of an entry from a content type definition: every field it declares,
|
|
7700
|
+
* directly or through fieldsets, typed as a read returns it (`INV-SS-TYPES-INFERRED`), plus
|
|
7701
|
+
* `_metadata`. Each field is optional — `schema/infer-fields.ts` says why, and what each field type
|
|
7702
|
+
* reads as.
|
|
7703
|
+
*
|
|
7704
|
+
* `S` is the schema the type belongs to. With it, a reference expanded by `include` is typed as the
|
|
7705
|
+
* entry it points at and a component field by the component's fields; without it, those two are
|
|
7706
|
+
* typed as an entry or an object whose fields are not known. A client typed by a schema passes it.
|
|
7707
|
+
*
|
|
7708
|
+
* @example
|
|
7709
|
+
* const product = defineContentType('product', {
|
|
7710
|
+
* displayName: 'Product',
|
|
7711
|
+
* fields: [
|
|
7712
|
+
* fields.shortText('title'),
|
|
7713
|
+
* fields.decimal('price'),
|
|
7714
|
+
* fields.enum('status', {
|
|
7715
|
+
* config: {
|
|
7716
|
+
* options: [
|
|
7717
|
+
* { value: 'draft', label: 'Draft' },
|
|
7718
|
+
* { value: 'live', label: 'Live' },
|
|
7719
|
+
* ],
|
|
7720
|
+
* },
|
|
7721
|
+
* }),
|
|
7722
|
+
* ]
|
|
7723
|
+
* })
|
|
7724
|
+
*
|
|
7725
|
+
* type Product = InferContentType<typeof product>
|
|
7726
|
+
* // { title?: string; price?: number; status?: 'draft' | 'live'; _metadata: EntryMetadata }
|
|
6588
7727
|
*/
|
|
6589
|
-
|
|
6590
|
-
|
|
6591
|
-
|
|
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
|
-
}
|
|
7728
|
+
type InferContentType<T extends AnyContentTypeDefinition, S extends FieldSchemaContext | undefined = undefined> = FieldValues<DeclaredFields<T>, S> & {
|
|
7729
|
+
_metadata: EntryMetadata;
|
|
7730
|
+
};
|
|
6605
7731
|
|
|
6606
|
-
export { type
|
|
7732
|
+
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 };
|