@stackbit/cms-core 0.1.29 → 0.1.30-alpha.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/dist/content-store-utils.d.ts +5 -5
- package/dist/content-store-utils.d.ts.map +1 -1
- package/dist/content-store-utils.js +6 -2
- package/dist/content-store-utils.js.map +1 -1
- package/dist/content-store.d.ts +3 -3
- package/dist/content-store.d.ts.map +1 -1
- package/dist/content-store.js +1 -1
- package/dist/content-store.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/types/content-store-document-fields.d.ts +600 -0
- package/dist/types/content-store-document-fields.d.ts.map +1 -0
- package/dist/types/content-store-document-fields.js +3 -0
- package/dist/types/content-store-document-fields.js.map +1 -0
- package/dist/types/content-store-documents.d.ts +99 -0
- package/dist/types/content-store-documents.d.ts.map +1 -0
- package/dist/types/content-store-documents.js +3 -0
- package/dist/types/content-store-documents.js.map +1 -0
- package/dist/types/content-store-types.d.ts +75 -0
- package/dist/types/content-store-types.d.ts.map +1 -0
- package/dist/types/content-store-types.js.map +1 -0
- package/dist/types/content-store-update-operation.d.ts +61 -0
- package/dist/types/content-store-update-operation.d.ts.map +1 -0
- package/dist/types/content-store-update-operation.js +3 -0
- package/dist/types/content-store-update-operation.js.map +1 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +18 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/search-filter.d.ts +1 -1
- package/dist/types/search-filter.d.ts.map +1 -1
- package/dist/utils/create-update-csi-docs.d.ts +1 -1
- package/dist/utils/create-update-csi-docs.d.ts.map +1 -1
- package/dist/utils/create-update-csi-docs.js +9 -5
- package/dist/utils/create-update-csi-docs.js.map +1 -1
- package/dist/utils/csi-to-store-docs-converter.d.ts +1 -1
- package/dist/utils/csi-to-store-docs-converter.d.ts.map +1 -1
- package/dist/utils/csi-to-store-docs-converter.js +20 -4
- package/dist/utils/csi-to-store-docs-converter.js.map +1 -1
- package/dist/utils/duplicate-document.d.ts +1 -1
- package/dist/utils/duplicate-document.d.ts.map +1 -1
- package/dist/utils/index.d.ts +2 -2
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/search-utils.d.ts +1 -1
- package/dist/utils/search-utils.d.ts.map +1 -1
- package/dist/utils/search-utils.js +16 -16
- package/dist/utils/search-utils.js.map +1 -1
- package/dist/utils/site-map.d.ts +1 -1
- package/dist/utils/site-map.d.ts.map +1 -1
- package/dist/utils/store-to-api-docs-converter.d.ts +1 -1
- package/dist/utils/store-to-api-docs-converter.d.ts.map +1 -1
- package/dist/utils/store-to-api-docs-converter.js +39 -12
- package/dist/utils/store-to-api-docs-converter.js.map +1 -1
- package/dist/utils/store-to-csi-docs-converter.d.ts +1 -1
- package/dist/utils/store-to-csi-docs-converter.d.ts.map +1 -1
- package/dist/utils/timer.d.ts +1 -1
- package/dist/utils/timer.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/content-store-utils.ts +10 -7
- package/src/content-store.ts +10 -10
- package/src/index.ts +1 -1
- package/src/types/content-store-document-fields.ts +658 -0
- package/src/types/content-store-documents.ts +113 -0
- package/src/types/content-store-types.ts +96 -0
- package/src/types/content-store-update-operation.ts +85 -0
- package/src/types/index.ts +5 -0
- package/src/types/search-filter.ts +26 -19
- package/src/utils/create-update-csi-docs.ts +13 -8
- package/src/utils/csi-to-store-docs-converter.ts +33 -14
- package/src/utils/duplicate-document.ts +2 -2
- package/src/utils/search-utils.ts +18 -19
- package/src/utils/site-map.ts +1 -1
- package/src/utils/store-to-api-docs-converter.ts +41 -13
- package/src/utils/store-to-csi-docs-converter.ts +1 -1
- package/src/utils/timer.ts +1 -1
- package/dist/content-store-types.d.ts +0 -413
- package/dist/content-store-types.d.ts.map +0 -1
- package/dist/content-store-types.js.map +0 -1
- package/src/content-store-types.ts +0 -531
- /package/dist/{content-store-types.js → types/content-store-types.js} +0 -0
|
@@ -0,0 +1,658 @@
|
|
|
1
|
+
import * as CSITypes from '@stackbit/types';
|
|
2
|
+
|
|
3
|
+
export type DocumentField =
|
|
4
|
+
| DocumentStringLikeField
|
|
5
|
+
| DocumentMarkdownField
|
|
6
|
+
| DocumentNumberField
|
|
7
|
+
| DocumentBooleanField
|
|
8
|
+
| DocumentJsonField
|
|
9
|
+
| DocumentStyleField
|
|
10
|
+
| DocumentRichTextField
|
|
11
|
+
| DocumentImageField
|
|
12
|
+
| DocumentFileField
|
|
13
|
+
| DocumentObjectField
|
|
14
|
+
| DocumentModelField
|
|
15
|
+
| DocumentReferenceField
|
|
16
|
+
| DocumentCrossReferenceField
|
|
17
|
+
| DocumentListField;
|
|
18
|
+
|
|
19
|
+
export type DocumentFieldNonLocalized =
|
|
20
|
+
| DocumentStringLikeFieldNonLocalized
|
|
21
|
+
| DocumentMarkdownFieldNonLocalized
|
|
22
|
+
| DocumentNumberFieldNonLocalized
|
|
23
|
+
| DocumentBooleanFieldNonLocalized
|
|
24
|
+
| DocumentJsonFieldNonLocalized
|
|
25
|
+
| DocumentStyleFieldNonLocalized
|
|
26
|
+
| DocumentRichTextFieldNonLocalized
|
|
27
|
+
| DocumentImageFieldNonLocalized
|
|
28
|
+
| DocumentFileFieldNonLocalized
|
|
29
|
+
| DocumentObjectFieldNonLocalized
|
|
30
|
+
| DocumentModelFieldNonLocalized
|
|
31
|
+
| DocumentReferenceFieldNonLocalized
|
|
32
|
+
| DocumentCrossReferenceFieldNonLocalized
|
|
33
|
+
| DocumentListFieldNonLocalized;
|
|
34
|
+
|
|
35
|
+
export type DocumentFieldLocalized =
|
|
36
|
+
| DocumentStringLikeFieldLocalized
|
|
37
|
+
| DocumentMarkdownFieldLocalized
|
|
38
|
+
| DocumentNumberFieldLocalized
|
|
39
|
+
| DocumentBooleanFieldLocalized
|
|
40
|
+
| DocumentJsonFieldLocalized
|
|
41
|
+
| DocumentStyleFieldLocalized
|
|
42
|
+
| DocumentRichTextFieldLocalized
|
|
43
|
+
| DocumentImageFieldLocalized
|
|
44
|
+
| DocumentFileFieldLocalized
|
|
45
|
+
| DocumentObjectFieldLocalized
|
|
46
|
+
| DocumentModelFieldLocalized
|
|
47
|
+
| DocumentReferenceFieldLocalized
|
|
48
|
+
| DocumentCrossReferenceFieldLocalized
|
|
49
|
+
| DocumentListFieldLocalized;
|
|
50
|
+
|
|
51
|
+
export type DocumentFieldAPI =
|
|
52
|
+
| DocumentStringLikeFieldAPI
|
|
53
|
+
| DocumentMarkdownFieldAPI
|
|
54
|
+
| DocumentNumberFieldAPI
|
|
55
|
+
| DocumentBooleanFieldAPI
|
|
56
|
+
| DocumentJsonFieldAPI
|
|
57
|
+
| DocumentStyleFieldAPI
|
|
58
|
+
| DocumentRichTextFieldAPI
|
|
59
|
+
| DocumentImageFieldAPI
|
|
60
|
+
| DocumentFileFieldAPI
|
|
61
|
+
| DocumentObjectFieldAPI
|
|
62
|
+
| DocumentModelFieldAPI
|
|
63
|
+
| DocumentReferenceFieldAPI
|
|
64
|
+
| DocumentCrossReferenceFieldAPI
|
|
65
|
+
| DocumentListFieldAPI;
|
|
66
|
+
|
|
67
|
+
export type DocumentFieldBaseProps = DocumentFieldBasePropsForDocumentField<DocumentFieldNonLocalized>;
|
|
68
|
+
export type DocumentFieldSpecificProps = DocumentFieldSpecificPropsForDocumentField<DocumentFieldLocalized>;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Utility Types
|
|
72
|
+
*/
|
|
73
|
+
type FieldType = CSITypes.FieldType;
|
|
74
|
+
|
|
75
|
+
export type ExtractByType<Union extends { type: FieldType | 'unresolved_reference' }, Type extends FieldType | 'unresolved_reference'> = Union extends {
|
|
76
|
+
type: Type;
|
|
77
|
+
}
|
|
78
|
+
? Union
|
|
79
|
+
: never;
|
|
80
|
+
export type DocumentFieldForType<Type extends FieldType> = ExtractByType<DocumentField, Type>;
|
|
81
|
+
export type DocumentFieldNonLocalizedForType<Type extends FieldType> = ExtractByType<DocumentFieldNonLocalized, Type>;
|
|
82
|
+
export type DocumentFieldLocalizedForType<Type extends FieldType> = ExtractByType<DocumentFieldLocalized, Type>;
|
|
83
|
+
export type DocumentFieldAPIForType<Type extends FieldType | 'unresolved_reference'> = ExtractByType<DocumentFieldAPI, Type>;
|
|
84
|
+
export type DocumentFieldBasePropsForType<Type extends FieldType> = ExtractByType<DocumentFieldBaseProps, Type>;
|
|
85
|
+
|
|
86
|
+
export type DocumentFieldBasePropsForDocumentField<DocField extends DocumentField> = DocField extends { isUnset?: false; localized?: false }
|
|
87
|
+
? Omit<DocField, keyof DocumentFieldSpecificPropsForDocumentField<DocumentFieldLocalizedForType<DocField['type']>> | 'localized' | 'isUnset'>
|
|
88
|
+
: never;
|
|
89
|
+
|
|
90
|
+
export type DocumentFieldSpecificPropsForDocumentField<DocField extends DocumentFieldLocalized> = DocField extends { locales: Record<string, infer Props> }
|
|
91
|
+
? Omit<Props, 'locale'>
|
|
92
|
+
: never;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* string-like fields (e.g., string, url, slug, text, html, enum, date, datetime, color)
|
|
96
|
+
* The 'markdown' is not included, although it is a string field, because it has
|
|
97
|
+
* the `multiElement` and `isUnset` fields.
|
|
98
|
+
* The 'file' also has `isUnset` field and should have its own type anyway.
|
|
99
|
+
*/
|
|
100
|
+
type DocumentStringLikeFieldTypes = Exclude<CSITypes.DocumentStringLikeFieldTypes, 'markdown' | 'file'>;
|
|
101
|
+
|
|
102
|
+
export type DocumentStringLikeField = DocumentStringLikeFieldForType<DocumentStringLikeFieldTypes>;
|
|
103
|
+
export type DocumentStringLikeFieldNonLocalized = DistributeDocumentStringLikeFieldNonLocalized<DocumentStringLikeFieldTypes>;
|
|
104
|
+
export type DocumentStringLikeFieldLocalized = DistributeDocumentStringFieldLocalized<DocumentStringLikeFieldTypes>;
|
|
105
|
+
export type DocumentStringLikeFieldAPI = DistributeDocumentStringFieldAPI<DocumentStringLikeFieldTypes>;
|
|
106
|
+
|
|
107
|
+
export type DocumentStringLikeFieldForType<Type> = Type extends DocumentStringLikeFieldTypes
|
|
108
|
+
? DocumentStringLikeFieldNonLocalizedForType<Type> | DocumentStringLikeFieldLocalizedForType<Type>
|
|
109
|
+
: never;
|
|
110
|
+
export type DistributeDocumentStringLikeFieldNonLocalized<Type> = Type extends DocumentStringLikeFieldTypes
|
|
111
|
+
? DocumentStringLikeFieldNonLocalizedForType<Type>
|
|
112
|
+
: never;
|
|
113
|
+
export type DistributeDocumentStringFieldLocalized<Type> = Type extends DocumentStringLikeFieldTypes ? DocumentStringLikeFieldLocalizedForType<Type> : never;
|
|
114
|
+
export type DistributeDocumentStringFieldAPI<Type> = Type extends DocumentStringLikeFieldTypes ? DocumentStringLikeFieldAPIForType<Type> : never;
|
|
115
|
+
|
|
116
|
+
export interface DocumentStringLikeFieldNonLocalizedForType<Type extends DocumentStringLikeFieldTypes> {
|
|
117
|
+
type: Type;
|
|
118
|
+
label?: string;
|
|
119
|
+
localized?: false;
|
|
120
|
+
value?: string;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export interface DocumentStringLikeFieldLocalizedForType<Type extends DocumentStringLikeFieldTypes> {
|
|
124
|
+
type: Type;
|
|
125
|
+
label?: string;
|
|
126
|
+
localized: true;
|
|
127
|
+
locales: Record<
|
|
128
|
+
string,
|
|
129
|
+
{
|
|
130
|
+
locale: string;
|
|
131
|
+
value: string;
|
|
132
|
+
}
|
|
133
|
+
>;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export type DocumentStringLikeFieldAPIForType<Type extends DocumentStringLikeFieldTypes> = {
|
|
137
|
+
type: Type;
|
|
138
|
+
label?: string;
|
|
139
|
+
description?: string;
|
|
140
|
+
value?: string | null;
|
|
141
|
+
} & ({ localized?: false } | { localized: true; locale: string });
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* markdown
|
|
145
|
+
*/
|
|
146
|
+
export type DocumentMarkdownField = DocumentMarkdownFieldNonLocalized | DocumentMarkdownFieldLocalized;
|
|
147
|
+
|
|
148
|
+
export type DocumentMarkdownFieldNonLocalized = {
|
|
149
|
+
type: 'markdown';
|
|
150
|
+
label?: string;
|
|
151
|
+
localized?: false;
|
|
152
|
+
multiElement?: boolean;
|
|
153
|
+
value?: string;
|
|
154
|
+
} & ({ isUnset: true; value?: never } | { isUnset?: false; value: string });
|
|
155
|
+
|
|
156
|
+
export interface DocumentMarkdownFieldLocalized {
|
|
157
|
+
type: 'markdown';
|
|
158
|
+
label?: string;
|
|
159
|
+
localized: true;
|
|
160
|
+
locales: Record<
|
|
161
|
+
string,
|
|
162
|
+
{
|
|
163
|
+
locale: string;
|
|
164
|
+
multiElement?: boolean;
|
|
165
|
+
value: string;
|
|
166
|
+
}
|
|
167
|
+
>;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export type DocumentMarkdownFieldAPI = {
|
|
171
|
+
type: 'markdown';
|
|
172
|
+
multiElement?: boolean;
|
|
173
|
+
label?: string;
|
|
174
|
+
description?: string;
|
|
175
|
+
value?: string | null;
|
|
176
|
+
} & ({ isUnset: true; value?: null } | { isUnset?: false; value: string }) &
|
|
177
|
+
({ localized?: false } | { localized: true; locale: string });
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* number
|
|
181
|
+
*/
|
|
182
|
+
export type DocumentNumberField = DocumentNumberFieldNonLocalized | DocumentNumberFieldLocalized;
|
|
183
|
+
|
|
184
|
+
export interface DocumentNumberFieldNonLocalized {
|
|
185
|
+
type: 'number';
|
|
186
|
+
label?: string;
|
|
187
|
+
localized?: false;
|
|
188
|
+
value?: number;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export interface DocumentNumberFieldLocalized {
|
|
192
|
+
type: 'number';
|
|
193
|
+
label?: string;
|
|
194
|
+
localized: true;
|
|
195
|
+
locales: Record<
|
|
196
|
+
string,
|
|
197
|
+
{
|
|
198
|
+
locale: string;
|
|
199
|
+
value: number;
|
|
200
|
+
}
|
|
201
|
+
>;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
export type DocumentNumberFieldAPI = {
|
|
205
|
+
type: 'number';
|
|
206
|
+
value?: number | null;
|
|
207
|
+
label?: string;
|
|
208
|
+
description?: string;
|
|
209
|
+
} & ({ localized?: false } | { localized: true; locale: string });
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* boolean
|
|
213
|
+
*/
|
|
214
|
+
export type DocumentBooleanField = DocumentBooleanFieldNonLocalized | DocumentBooleanFieldLocalized;
|
|
215
|
+
|
|
216
|
+
export interface DocumentBooleanFieldNonLocalized {
|
|
217
|
+
type: 'boolean';
|
|
218
|
+
label?: string;
|
|
219
|
+
localized?: false;
|
|
220
|
+
value?: boolean;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
export interface DocumentBooleanFieldLocalized {
|
|
224
|
+
type: 'boolean';
|
|
225
|
+
label?: string;
|
|
226
|
+
localized: true;
|
|
227
|
+
locales: Record<
|
|
228
|
+
string,
|
|
229
|
+
{
|
|
230
|
+
locale: string;
|
|
231
|
+
value: boolean;
|
|
232
|
+
}
|
|
233
|
+
>;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
export type DocumentBooleanFieldAPI = {
|
|
237
|
+
type: 'boolean';
|
|
238
|
+
value?: boolean | null;
|
|
239
|
+
label?: string;
|
|
240
|
+
description?: string;
|
|
241
|
+
} & ({ localized?: false } | { localized: true; locale: string });
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* json
|
|
245
|
+
*/
|
|
246
|
+
export type DocumentJsonField = DocumentJsonFieldNonLocalized | DocumentJsonFieldLocalized;
|
|
247
|
+
|
|
248
|
+
export type DocumentJsonFieldNonLocalized = {
|
|
249
|
+
type: 'json';
|
|
250
|
+
label?: string;
|
|
251
|
+
localized?: false;
|
|
252
|
+
value?: any;
|
|
253
|
+
} & ({ isUnset: true; value?: never } | { isUnset?: false; value: any });
|
|
254
|
+
|
|
255
|
+
export interface DocumentJsonFieldLocalized {
|
|
256
|
+
type: 'json';
|
|
257
|
+
label?: string;
|
|
258
|
+
localized: true;
|
|
259
|
+
locales: Record<
|
|
260
|
+
string,
|
|
261
|
+
{
|
|
262
|
+
locale: string;
|
|
263
|
+
value: any;
|
|
264
|
+
}
|
|
265
|
+
>;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
export type DocumentJsonFieldAPI = {
|
|
269
|
+
type: 'json';
|
|
270
|
+
label?: string;
|
|
271
|
+
description?: string;
|
|
272
|
+
value?: any;
|
|
273
|
+
} & ({ isUnset: true; value?: null } | { isUnset?: false; value: any }) &
|
|
274
|
+
({ localized?: false } | { localized: true; locale: string });
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* style
|
|
278
|
+
*/
|
|
279
|
+
export type DocumentStyleField = DocumentStyleFieldNonLocalized | DocumentStyleFieldLocalized;
|
|
280
|
+
export type DocumentStyleFieldValue = Record<string, Partial<Record<CSITypes.StyleProps, any>>>;
|
|
281
|
+
|
|
282
|
+
export interface DocumentStyleFieldNonLocalized {
|
|
283
|
+
type: 'style';
|
|
284
|
+
label?: string;
|
|
285
|
+
localized?: false;
|
|
286
|
+
value?: DocumentStyleFieldValue;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
export interface DocumentStyleFieldLocalized {
|
|
290
|
+
type: 'style';
|
|
291
|
+
label?: string;
|
|
292
|
+
localized: true;
|
|
293
|
+
locales: Record<
|
|
294
|
+
string,
|
|
295
|
+
{
|
|
296
|
+
locale: string;
|
|
297
|
+
value: DocumentStyleFieldValue;
|
|
298
|
+
}
|
|
299
|
+
>;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
export type DocumentStyleFieldAPI = {
|
|
303
|
+
type: 'style';
|
|
304
|
+
value?: DocumentStyleFieldValue | null;
|
|
305
|
+
label?: string;
|
|
306
|
+
description?: string;
|
|
307
|
+
} & ({ localized?: false } | { localized: true; locale: string });
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* richText
|
|
311
|
+
*/
|
|
312
|
+
export type DocumentRichTextField = DocumentRichTextFieldNonLocalized | DocumentRichTextFieldLocalized;
|
|
313
|
+
// TODO: richText value should be well defined according to Stackbit's internal rich-text format
|
|
314
|
+
export type DocumentRichTextFieldValue = any;
|
|
315
|
+
|
|
316
|
+
export type DocumentRichTextFieldNonLocalized = {
|
|
317
|
+
type: 'richText';
|
|
318
|
+
label?: string;
|
|
319
|
+
localized?: false;
|
|
320
|
+
hint?: string;
|
|
321
|
+
multiElement?: boolean;
|
|
322
|
+
value?: DocumentRichTextFieldValue;
|
|
323
|
+
} & ({ isUnset: true; value?: never } | { isUnset?: false; value: DocumentRichTextFieldValue });
|
|
324
|
+
|
|
325
|
+
export interface DocumentRichTextFieldLocalized {
|
|
326
|
+
type: 'richText';
|
|
327
|
+
label?: string;
|
|
328
|
+
localized: true;
|
|
329
|
+
locales: Record<
|
|
330
|
+
string,
|
|
331
|
+
{
|
|
332
|
+
locale: string;
|
|
333
|
+
hint?: string;
|
|
334
|
+
multiElement?: boolean;
|
|
335
|
+
value: DocumentRichTextFieldValue;
|
|
336
|
+
}
|
|
337
|
+
>;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
export type DocumentRichTextFieldAPI = {
|
|
341
|
+
type: 'richText';
|
|
342
|
+
hint?: string;
|
|
343
|
+
multiElement?: boolean;
|
|
344
|
+
label?: string;
|
|
345
|
+
description?: string;
|
|
346
|
+
value?: DocumentRichTextFieldValue | null;
|
|
347
|
+
} & ({ isUnset: true; value?: null } | { isUnset?: false; value: DocumentRichTextFieldValue }) &
|
|
348
|
+
({ localized?: false } | { localized: true; locale: string });
|
|
349
|
+
|
|
350
|
+
/**
|
|
351
|
+
* image
|
|
352
|
+
*/
|
|
353
|
+
export type DocumentImageField = DocumentImageFieldNonLocalized | DocumentImageFieldLocalized;
|
|
354
|
+
|
|
355
|
+
export type DocumentImageFieldNonLocalized = {
|
|
356
|
+
type: 'image';
|
|
357
|
+
label?: string;
|
|
358
|
+
localized?: false;
|
|
359
|
+
source?: string;
|
|
360
|
+
sourceData?: any;
|
|
361
|
+
} & ({ isUnset: true } | { isUnset?: false; fields: ImageFields });
|
|
362
|
+
|
|
363
|
+
export interface DocumentImageFieldLocalized {
|
|
364
|
+
type: 'image';
|
|
365
|
+
label?: string;
|
|
366
|
+
source?: string;
|
|
367
|
+
sourceData?: any;
|
|
368
|
+
localized: true;
|
|
369
|
+
locales: Record<
|
|
370
|
+
string,
|
|
371
|
+
{
|
|
372
|
+
locale: string;
|
|
373
|
+
fields: ImageFields;
|
|
374
|
+
}
|
|
375
|
+
>;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
export type ImageFields = {
|
|
379
|
+
title: DocumentStringLikeFieldForType<'string'>;
|
|
380
|
+
url: DocumentStringLikeFieldForType<'string'>;
|
|
381
|
+
};
|
|
382
|
+
|
|
383
|
+
export type DocumentImageFieldAPI = {
|
|
384
|
+
type: 'image';
|
|
385
|
+
source?: string;
|
|
386
|
+
sourceData?: any;
|
|
387
|
+
label?: string;
|
|
388
|
+
description?: string;
|
|
389
|
+
} & ({ isUnset: true } | { isUnset?: false; fields: ImageFieldsAPI }) &
|
|
390
|
+
({ localized?: false } | { localized: true; locale: string });
|
|
391
|
+
|
|
392
|
+
export type ImageFieldsAPI = {
|
|
393
|
+
title: DocumentFieldAPIForType<'string'>;
|
|
394
|
+
url: DocumentFieldAPIForType<'string'>;
|
|
395
|
+
};
|
|
396
|
+
|
|
397
|
+
/**
|
|
398
|
+
* file
|
|
399
|
+
*/
|
|
400
|
+
export type DocumentFileField = DocumentFileFieldNonLocalized | DocumentFileFieldLocalized;
|
|
401
|
+
|
|
402
|
+
export type DocumentFileFieldNonLocalized = {
|
|
403
|
+
type: 'file';
|
|
404
|
+
label?: string;
|
|
405
|
+
localized?: false;
|
|
406
|
+
value?: any;
|
|
407
|
+
} & ({ isUnset: true; value?: never } | { isUnset?: false; value: any });
|
|
408
|
+
|
|
409
|
+
export interface DocumentFileFieldLocalized {
|
|
410
|
+
type: 'file';
|
|
411
|
+
label?: string;
|
|
412
|
+
localized: true;
|
|
413
|
+
locales: Record<
|
|
414
|
+
string,
|
|
415
|
+
{
|
|
416
|
+
locale: string;
|
|
417
|
+
value: any;
|
|
418
|
+
}
|
|
419
|
+
>;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
export type DocumentFileFieldAPI = {
|
|
423
|
+
type: 'file';
|
|
424
|
+
label?: string;
|
|
425
|
+
description?: string;
|
|
426
|
+
value?: any;
|
|
427
|
+
} & ({ isUnset: true; value?: null } | { isUnset?: false; value: any }) &
|
|
428
|
+
({ localized?: false } | { localized: true; locale: string });
|
|
429
|
+
|
|
430
|
+
/**
|
|
431
|
+
* object
|
|
432
|
+
*/
|
|
433
|
+
export type DocumentObjectField = DocumentObjectFieldNonLocalized | DocumentObjectFieldLocalized;
|
|
434
|
+
|
|
435
|
+
export type DocumentObjectFieldNonLocalized = {
|
|
436
|
+
type: 'object';
|
|
437
|
+
label?: string;
|
|
438
|
+
localized?: false;
|
|
439
|
+
} & (
|
|
440
|
+
| { isUnset: true }
|
|
441
|
+
| {
|
|
442
|
+
isUnset?: false;
|
|
443
|
+
srcObjectLabel: string;
|
|
444
|
+
fields: Record<string, DocumentField>;
|
|
445
|
+
}
|
|
446
|
+
);
|
|
447
|
+
|
|
448
|
+
export interface DocumentObjectFieldLocalized {
|
|
449
|
+
type: 'object';
|
|
450
|
+
label?: string;
|
|
451
|
+
localized: true;
|
|
452
|
+
locales: Record<
|
|
453
|
+
string,
|
|
454
|
+
{
|
|
455
|
+
locale: string;
|
|
456
|
+
srcObjectLabel: string;
|
|
457
|
+
fields: Record<string, DocumentField>;
|
|
458
|
+
}
|
|
459
|
+
>;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
export type DocumentObjectFieldAPI = {
|
|
463
|
+
type: 'object';
|
|
464
|
+
label?: string;
|
|
465
|
+
description?: string;
|
|
466
|
+
} & (
|
|
467
|
+
| { isUnset: true }
|
|
468
|
+
| {
|
|
469
|
+
isUnset?: false;
|
|
470
|
+
srcObjectLabel: string;
|
|
471
|
+
fields: Record<string, DocumentFieldAPI>;
|
|
472
|
+
}
|
|
473
|
+
) &
|
|
474
|
+
({ localized?: false } | { localized: true; locale: string });
|
|
475
|
+
|
|
476
|
+
/**
|
|
477
|
+
* model
|
|
478
|
+
*/
|
|
479
|
+
export type DocumentModelField = DocumentModelFieldNonLocalized | DocumentModelFieldLocalized;
|
|
480
|
+
|
|
481
|
+
export type DocumentModelFieldNonLocalized = {
|
|
482
|
+
type: 'model';
|
|
483
|
+
label?: string;
|
|
484
|
+
localized?: false;
|
|
485
|
+
} & (
|
|
486
|
+
| { isUnset: true }
|
|
487
|
+
| {
|
|
488
|
+
isUnset?: false;
|
|
489
|
+
srcObjectLabel: string;
|
|
490
|
+
srcModelName: string;
|
|
491
|
+
srcModelLabel: string;
|
|
492
|
+
fields: Record<string, DocumentField>;
|
|
493
|
+
}
|
|
494
|
+
);
|
|
495
|
+
|
|
496
|
+
export interface DocumentModelFieldLocalized {
|
|
497
|
+
type: 'model';
|
|
498
|
+
label?: string;
|
|
499
|
+
localized: true;
|
|
500
|
+
locales: Record<
|
|
501
|
+
string,
|
|
502
|
+
{
|
|
503
|
+
locale: string;
|
|
504
|
+
srcObjectLabel: string;
|
|
505
|
+
srcModelName: string;
|
|
506
|
+
srcModelLabel: string;
|
|
507
|
+
fields: Record<string, DocumentField>;
|
|
508
|
+
}
|
|
509
|
+
>;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
export type DocumentModelFieldAPI = {
|
|
513
|
+
type: 'object';
|
|
514
|
+
label?: string;
|
|
515
|
+
description?: string;
|
|
516
|
+
} & (
|
|
517
|
+
| { isUnset: true }
|
|
518
|
+
| {
|
|
519
|
+
isUnset?: false;
|
|
520
|
+
srcObjectLabel: string;
|
|
521
|
+
srcModelName: string;
|
|
522
|
+
srcModelLabel: string;
|
|
523
|
+
fields: Record<string, DocumentFieldAPI>;
|
|
524
|
+
}
|
|
525
|
+
) &
|
|
526
|
+
({ localized?: false } | { localized: true; locale: string });
|
|
527
|
+
|
|
528
|
+
/**
|
|
529
|
+
* reference
|
|
530
|
+
*/
|
|
531
|
+
export type DocumentReferenceField = DocumentReferenceFieldNonLocalized | DocumentReferenceFieldLocalized;
|
|
532
|
+
|
|
533
|
+
export type DocumentReferenceFieldNonLocalized = {
|
|
534
|
+
type: 'reference';
|
|
535
|
+
refType: 'document' | 'asset';
|
|
536
|
+
label?: string;
|
|
537
|
+
localized?: false;
|
|
538
|
+
} & (
|
|
539
|
+
| { isUnset: true }
|
|
540
|
+
| {
|
|
541
|
+
isUnset?: false;
|
|
542
|
+
refId: string;
|
|
543
|
+
}
|
|
544
|
+
);
|
|
545
|
+
|
|
546
|
+
export interface DocumentReferenceFieldLocalized {
|
|
547
|
+
type: 'reference';
|
|
548
|
+
refType: 'document' | 'asset';
|
|
549
|
+
label?: string;
|
|
550
|
+
localized: true;
|
|
551
|
+
locales: Record<
|
|
552
|
+
string,
|
|
553
|
+
{
|
|
554
|
+
locale: string;
|
|
555
|
+
refId: string;
|
|
556
|
+
}
|
|
557
|
+
>;
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
export type DocumentReferenceFieldAPI = {
|
|
561
|
+
type: 'unresolved_reference';
|
|
562
|
+
refType: 'object' | 'image';
|
|
563
|
+
label?: string;
|
|
564
|
+
description?: string;
|
|
565
|
+
} & (
|
|
566
|
+
| { isUnset: true }
|
|
567
|
+
| {
|
|
568
|
+
isUnset?: false;
|
|
569
|
+
refId: string;
|
|
570
|
+
}
|
|
571
|
+
) &
|
|
572
|
+
({ localized?: false } | { localized: true; locale: string });
|
|
573
|
+
|
|
574
|
+
/**
|
|
575
|
+
* cross-reference
|
|
576
|
+
*/
|
|
577
|
+
export type DocumentCrossReferenceField = DocumentCrossReferenceFieldNonLocalized | DocumentCrossReferenceFieldLocalized;
|
|
578
|
+
|
|
579
|
+
export type DocumentCrossReferenceFieldNonLocalized = {
|
|
580
|
+
type: 'cross-reference';
|
|
581
|
+
refType: 'document' | 'asset';
|
|
582
|
+
label?: string;
|
|
583
|
+
localized?: false;
|
|
584
|
+
} & (
|
|
585
|
+
| { isUnset: true }
|
|
586
|
+
| {
|
|
587
|
+
isUnset?: false;
|
|
588
|
+
refId: string;
|
|
589
|
+
refSrcType: string;
|
|
590
|
+
refProjectId: string;
|
|
591
|
+
}
|
|
592
|
+
);
|
|
593
|
+
|
|
594
|
+
export interface DocumentCrossReferenceFieldLocalized {
|
|
595
|
+
type: 'cross-reference';
|
|
596
|
+
refType: 'document' | 'asset';
|
|
597
|
+
label?: string;
|
|
598
|
+
localized: true;
|
|
599
|
+
locales: Record<
|
|
600
|
+
string,
|
|
601
|
+
{
|
|
602
|
+
locale: string;
|
|
603
|
+
refId: string;
|
|
604
|
+
refSrcType: string;
|
|
605
|
+
refProjectId: string;
|
|
606
|
+
}
|
|
607
|
+
>;
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
export type DocumentCrossReferenceFieldAPI = {
|
|
611
|
+
type: 'cross-reference';
|
|
612
|
+
refType: 'document' | 'asset';
|
|
613
|
+
label?: string;
|
|
614
|
+
description?: string;
|
|
615
|
+
} & (
|
|
616
|
+
| { isUnset: true }
|
|
617
|
+
| {
|
|
618
|
+
isUnset?: false;
|
|
619
|
+
refId: string;
|
|
620
|
+
refSrcType: string;
|
|
621
|
+
refProjectId: string;
|
|
622
|
+
}
|
|
623
|
+
) &
|
|
624
|
+
({ localized?: false } | { localized: true; locale: string });
|
|
625
|
+
|
|
626
|
+
/**
|
|
627
|
+
* list
|
|
628
|
+
*/
|
|
629
|
+
export type DocumentListField = DocumentListFieldNonLocalized | DocumentListFieldLocalized;
|
|
630
|
+
export type DocumentListFieldItems = Exclude<DocumentFieldNonLocalized, DocumentListFieldNonLocalized>;
|
|
631
|
+
|
|
632
|
+
export interface DocumentListFieldNonLocalized {
|
|
633
|
+
type: 'list';
|
|
634
|
+
label?: string;
|
|
635
|
+
localized?: false;
|
|
636
|
+
items: DocumentListFieldItems[];
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
export interface DocumentListFieldLocalized {
|
|
640
|
+
type: 'list';
|
|
641
|
+
label?: string;
|
|
642
|
+
localized: true;
|
|
643
|
+
locales: Record<
|
|
644
|
+
string,
|
|
645
|
+
{
|
|
646
|
+
locale: string;
|
|
647
|
+
items: DocumentListFieldItems[];
|
|
648
|
+
}
|
|
649
|
+
>;
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
export type DocumentListFieldItemsAPI = Exclude<DocumentFieldAPI, DocumentListFieldAPI>;
|
|
653
|
+
export type DocumentListFieldAPI = {
|
|
654
|
+
type: 'list';
|
|
655
|
+
label?: string;
|
|
656
|
+
description?: string;
|
|
657
|
+
items: DocumentListFieldItemsAPI[];
|
|
658
|
+
} & ({ localized?: false } | { localized: true; locale: string });
|