@stackbit/cms-core 0.1.25 → 0.1.26-develop.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/dist/content-store-utils.d.ts +5 -5
  2. package/dist/content-store-utils.d.ts.map +1 -1
  3. package/dist/content-store-utils.js +15 -3
  4. package/dist/content-store-utils.js.map +1 -1
  5. package/dist/content-store.d.ts +11 -3
  6. package/dist/content-store.d.ts.map +1 -1
  7. package/dist/content-store.js +10 -5
  8. package/dist/content-store.js.map +1 -1
  9. package/dist/index.d.ts +2 -1
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +2 -1
  12. package/dist/index.js.map +1 -1
  13. package/dist/services/git.d.ts +38 -0
  14. package/dist/services/git.d.ts.map +1 -0
  15. package/dist/services/git.js +201 -0
  16. package/dist/services/git.js.map +1 -0
  17. package/dist/services/index.d.ts +3 -0
  18. package/dist/services/index.d.ts.map +1 -0
  19. package/dist/services/index.js +15 -0
  20. package/dist/services/index.js.map +1 -0
  21. package/dist/services/run.d.ts +7 -0
  22. package/dist/services/run.d.ts.map +1 -0
  23. package/dist/services/run.js +53 -0
  24. package/dist/services/run.js.map +1 -0
  25. package/dist/types/content-store-document-fields.d.ts +600 -0
  26. package/dist/types/content-store-document-fields.d.ts.map +1 -0
  27. package/dist/types/content-store-document-fields.js +3 -0
  28. package/dist/types/content-store-document-fields.js.map +1 -0
  29. package/dist/types/content-store-documents.d.ts +99 -0
  30. package/dist/types/content-store-documents.d.ts.map +1 -0
  31. package/dist/types/content-store-documents.js +3 -0
  32. package/dist/types/content-store-documents.js.map +1 -0
  33. package/dist/types/content-store-types.d.ts +75 -0
  34. package/dist/types/content-store-types.d.ts.map +1 -0
  35. package/dist/types/content-store-types.js.map +1 -0
  36. package/dist/types/content-store-update-operation.d.ts +61 -0
  37. package/dist/types/content-store-update-operation.d.ts.map +1 -0
  38. package/dist/types/content-store-update-operation.js +3 -0
  39. package/dist/types/content-store-update-operation.js.map +1 -0
  40. package/dist/types/index.d.ts +6 -0
  41. package/dist/types/index.d.ts.map +1 -0
  42. package/dist/types/index.js +18 -0
  43. package/dist/types/index.js.map +1 -0
  44. package/dist/types/search-filter.d.ts +1 -1
  45. package/dist/types/search-filter.d.ts.map +1 -1
  46. package/dist/utils/create-update-csi-docs.d.ts +1 -1
  47. package/dist/utils/create-update-csi-docs.d.ts.map +1 -1
  48. package/dist/utils/create-update-csi-docs.js +28 -14
  49. package/dist/utils/create-update-csi-docs.js.map +1 -1
  50. package/dist/utils/csi-to-store-docs-converter.d.ts +1 -1
  51. package/dist/utils/csi-to-store-docs-converter.d.ts.map +1 -1
  52. package/dist/utils/csi-to-store-docs-converter.js +20 -4
  53. package/dist/utils/csi-to-store-docs-converter.js.map +1 -1
  54. package/dist/utils/duplicate-document.d.ts +1 -1
  55. package/dist/utils/duplicate-document.d.ts.map +1 -1
  56. package/dist/utils/duplicate-document.js +11 -0
  57. package/dist/utils/duplicate-document.js.map +1 -1
  58. package/dist/utils/index.d.ts +2 -2
  59. package/dist/utils/index.d.ts.map +1 -1
  60. package/dist/utils/search-utils.d.ts +1 -1
  61. package/dist/utils/search-utils.d.ts.map +1 -1
  62. package/dist/utils/search-utils.js +16 -16
  63. package/dist/utils/search-utils.js.map +1 -1
  64. package/dist/utils/site-map.d.ts +1 -1
  65. package/dist/utils/site-map.d.ts.map +1 -1
  66. package/dist/utils/site-map.js +9 -0
  67. package/dist/utils/site-map.js.map +1 -1
  68. package/dist/utils/store-to-api-docs-converter.d.ts +2 -2
  69. package/dist/utils/store-to-api-docs-converter.d.ts.map +1 -1
  70. package/dist/utils/store-to-api-docs-converter.js +87 -38
  71. package/dist/utils/store-to-api-docs-converter.js.map +1 -1
  72. package/dist/utils/store-to-csi-docs-converter.d.ts +1 -1
  73. package/dist/utils/store-to-csi-docs-converter.d.ts.map +1 -1
  74. package/dist/utils/store-to-csi-docs-converter.js +4 -0
  75. package/dist/utils/store-to-csi-docs-converter.js.map +1 -1
  76. package/dist/utils/timer.d.ts +1 -1
  77. package/dist/utils/timer.d.ts.map +1 -1
  78. package/package.json +9 -6
  79. package/src/content-store-utils.ts +19 -8
  80. package/src/content-store.ts +28 -15
  81. package/src/index.ts +2 -1
  82. package/src/services/git.ts +245 -0
  83. package/src/services/index.ts +2 -0
  84. package/src/services/run.ts +54 -0
  85. package/src/types/content-store-document-fields.ts +658 -0
  86. package/src/types/content-store-documents.ts +113 -0
  87. package/src/types/content-store-types.ts +96 -0
  88. package/src/types/content-store-update-operation.ts +85 -0
  89. package/src/types/index.ts +5 -0
  90. package/src/types/search-filter.ts +26 -19
  91. package/src/utils/create-update-csi-docs.ts +33 -16
  92. package/src/utils/csi-to-store-docs-converter.ts +33 -14
  93. package/src/utils/duplicate-document.ts +11 -1
  94. package/src/utils/search-utils.ts +18 -19
  95. package/src/utils/site-map.ts +10 -1
  96. package/src/utils/store-to-api-docs-converter.ts +86 -38
  97. package/src/utils/store-to-csi-docs-converter.ts +5 -1
  98. package/src/utils/timer.ts +1 -1
  99. package/dist/content-store-types.d.ts +0 -411
  100. package/dist/content-store-types.d.ts.map +0 -1
  101. package/dist/content-store-types.js.map +0 -1
  102. package/src/content-store-types.ts +0 -527
  103. /package/dist/{content-store-types.js → types/content-store-types.js} +0 -0
@@ -1,527 +0,0 @@
1
- import { DocumentStatus, FieldType } from '@stackbit/types';
2
- import { Model } from '@stackbit/sdk';
3
- import * as CSITypes from '@stackbit/types';
4
-
5
- export { FieldType, DocumentStatus, Logger } from '@stackbit/types';
6
-
7
- export interface ContentSourceData {
8
- /* Internal content source id computed by concatenating srcType and srcProjectId */
9
- id: string;
10
- /* The content source instance loaded from stackbitConfig.contentSources */
11
- instance: CSITypes.ContentSourceInterface;
12
- srcType: string;
13
- srcProjectId: string;
14
- locales?: CSITypes.Locale[];
15
- defaultLocaleCode?: string;
16
- /* Array of extended and validated Models */
17
- models: Model[];
18
- /* Map of extended and validated Models by model name */
19
- modelMap: Record<string, Model>;
20
- /* Array of original Models (as provided by content source) */
21
- csiModels: CSITypes.Model[];
22
- /* Map of original Models (as provided by content source) by model name */
23
- csiModelMap: Record<string, CSITypes.Model>;
24
- /* Array of original content source Documents */
25
- csiDocuments: CSITypes.Document[];
26
- /* Map of original content source Documents by document ID */
27
- csiDocumentMap: Record<string, CSITypes.Document>;
28
- /* Array of converted content-store Documents */
29
- documents: Document[];
30
- /* Map of converted content-store Documents by document ID */
31
- documentMap: Record<string, Document>;
32
- /* Array of original content source Assets */
33
- csiAssets: CSITypes.Asset[];
34
- /* Map of original content source Assets by asset ID */
35
- csiAssetMap: Record<string, CSITypes.Asset>;
36
- /* Array of converted content-store Assets */
37
- assets: Asset[];
38
- /* Map of converted content-store Assets by asset ID */
39
- assetMap: Record<string, Asset>;
40
- }
41
-
42
- export interface Document {
43
- type: 'document';
44
- srcType: string;
45
- srcProjectId: string;
46
- srcProjectUrl: string;
47
- srcEnvironment: string;
48
- srcObjectId: string;
49
- srcObjectUrl: string;
50
- srcObjectLabel: string;
51
- srcModelName: string;
52
- srcModelLabel: string;
53
- isChanged: boolean;
54
- status: DocumentStatus;
55
- createdAt: string;
56
- createdBy?: string;
57
- updatedAt: string;
58
- updatedBy?: string[];
59
- locale?: string;
60
- fields: Record<string, DocumentField>;
61
- }
62
-
63
- export interface Asset {
64
- type: 'asset';
65
- srcType: string;
66
- srcProjectId: string;
67
- srcProjectUrl: string;
68
- srcEnvironment: string;
69
- srcObjectId: string;
70
- srcObjectUrl: string;
71
- srcObjectLabel: string;
72
- srcModelName: string;
73
- srcModelLabel: string;
74
- isChanged: boolean;
75
- status: DocumentStatus;
76
- createdAt: string;
77
- createdBy?: string;
78
- updatedAt: string;
79
- updatedBy?: string[];
80
- locale?: string;
81
- fields: AssetFields;
82
- }
83
-
84
- export type AssetFields = {
85
- title: DocumentValueFieldForType<'string'>;
86
- file: AssetFileField;
87
- };
88
-
89
- export interface UploadAssetData {
90
- url: string;
91
- data?: string;
92
- metadata: {
93
- name: string;
94
- type: string;
95
- };
96
- }
97
-
98
- export interface ContentChangeResultItem {
99
- srcType: string;
100
- srcProjectId: string;
101
- srcObjectId: string;
102
- }
103
-
104
- export interface ContentChangeResult {
105
- updatedDocuments: ContentChangeResultItem[];
106
- updatedAssets: ContentChangeResultItem[];
107
- deletedDocuments: ContentChangeResultItem[];
108
- deletedAssets: ContentChangeResultItem[];
109
- }
110
-
111
- export type APIObject = APIDocumentObject | APIImageObject;
112
-
113
- export interface APIDocumentObject extends Omit<Document, 'fields' | 'type'> {
114
- type: 'object';
115
- fields: Record<string, DocumentFieldAPI>;
116
- }
117
-
118
- export interface APIImageObject extends Omit<Asset, 'fields' | 'type'> {
119
- type: 'image';
120
- fields: AssetFieldsAPI;
121
- }
122
-
123
- export type AssetFieldsAPI = {
124
- title: DocumentFieldAPIForType<'string'>;
125
- url: DocumentFieldAPIForType<'string'>;
126
- };
127
-
128
- export interface APIAsset {
129
- objectId: string;
130
- createdAt: string;
131
- url: string;
132
- title?: string;
133
- fileName?: string;
134
- contentType?: string;
135
- size?: number;
136
- width?: number;
137
- height?: number;
138
- }
139
-
140
- export type DocumentField =
141
- | DocumentValueField
142
- | DocumentObjectField
143
- | DocumentModelField
144
- | DocumentReferenceField
145
- | DocumentCrossReferenceField
146
- | DocumentListField
147
- | DocumentMarkdownField
148
- | DocumentRichTextField
149
- | DocumentImageField;
150
-
151
- export type DocumentFieldLocalized =
152
- | DocumentValueFieldLocalized
153
- | DocumentObjectFieldLocalized
154
- | DocumentModelFieldLocalized
155
- | DocumentReferenceFieldLocalized
156
- | DocumentCrossReferenceFieldLocalized
157
- | DocumentMarkdownFieldLocalized
158
- | DocumentRichTextFieldLocalized
159
- | DocumentListFieldLocalized
160
- | DocumentImageFieldLocalized;
161
-
162
- export type DocumentFieldNonLocalized =
163
- | DocumentValueFieldNonLocalized
164
- | DocumentObjectFieldNonLocalized
165
- | DocumentModelFieldNonLocalized
166
- | DocumentReferenceFieldNonLocalized
167
- | DocumentCrossReferenceFieldNonLocalized
168
- | DocumentMarkdownFieldNonLocalized
169
- | DocumentRichTextFieldNonLocalized
170
- | DocumentListFieldNonLocalized
171
- | DocumentImageFieldNonLocalized;
172
-
173
- export type DocumentFieldAPI =
174
- | DocumentValueFieldAPI
175
- | DocumentObjectFieldAPI
176
- | DocumentModelFieldAPI
177
- | DocumentReferenceFieldAPI
178
- | DocumentCrossReferenceFieldAPI
179
- | DocumentMarkdownFieldAPI
180
- | DocumentRichTextFieldAPI
181
- | DocumentListFieldAPI
182
- | DocumentImageFieldAPI;
183
-
184
- export type DocumentFieldBaseProps =
185
- | DocumentValueFieldBaseProps
186
- | DocumentObjectFieldBase
187
- | DocumentModelFieldBase
188
- | DocumentReferenceFieldBase
189
- | DocumentCrossReferenceFieldBase
190
- | DocumentListFieldBase
191
- | DocumentRichTextFieldBase
192
- | DocumentImageFieldBase;
193
-
194
- export type DistributiveOmit<T, K extends PropertyKey> = T extends any ? Omit<T, K> : never;
195
-
196
- export type Simplify<T> = {
197
- [K in keyof T]: T[K];
198
- };
199
-
200
- export type FindByType<Union extends { type: FieldType | 'unresolved_reference' }, Type> = Union extends { type: Type } ? Union : never;
201
- export type DocumentFieldForType<Type extends FieldType> = FindByType<DocumentField, Type>;
202
- export type DocumentFieldLocalizedForType<Type extends FieldType> = FindByType<DocumentFieldLocalized, Type>;
203
- export type DocumentFieldNonLocalizedForType<Type extends FieldType> = FindByType<DocumentFieldNonLocalized, Type>;
204
- export type DocumentFieldAPIForType<Type extends FieldType | 'unresolved_reference'> = FindByType<DocumentFieldAPI, Type>;
205
- export type DocumentFieldBasePropsForType<Type extends FieldType> = FindByType<DocumentFieldBaseProps, Type>;
206
- export type DocumentFieldSpecificPropsForType<Type extends FieldType> = Simplify<
207
- DistributiveOmit<DocumentFieldNonLocalizedForType<Type>, keyof DocumentFieldBasePropsForType<Type> | 'label' | 'locale' | 'localized'>
208
- >;
209
-
210
- // helpers
211
- export type DocumentFieldTypeLocalized<BaseFieldProps, LocalizedFieldProps> = Simplify<
212
- BaseFieldProps & {
213
- label?: string;
214
- localized: true;
215
- locales: Record<string, { locale: string } & Omit<Exclude<LocalizedFieldProps, DocumentFieldUnsetProps>, 'isUnset'>>;
216
- }
217
- >;
218
-
219
- export type DocumentFieldTypeNonLocalized<BaseFieldProps, LocalizedFieldProps> = Simplify<
220
- BaseFieldProps &
221
- LocalizedFieldProps & {
222
- label?: string;
223
- localized?: false;
224
- }
225
- >;
226
-
227
- export type DocumentFieldTypeAPI<BaseFieldProps, LocalizedFieldProps> = BaseFieldProps &
228
- LocalizedFieldProps & {
229
- label?: string;
230
- description?: string;
231
- locale?: string;
232
- localized?: boolean;
233
- } & ({ localized?: false } | { localized: true; locale: string });
234
-
235
- // any field that is not 'object' | 'model' | 'reference' | 'cross-reference' | 'richText' | 'markdown' | 'list'
236
- export type DocumentValueFieldType = Exclude<FieldType, 'object' | 'model' | 'reference' | 'cross-reference' | 'markdown' | 'richText' | 'list' | 'image'>;
237
-
238
- export type DocumentValueFieldForType<Type> = Type extends DocumentValueFieldType
239
- ? DocumentValueFieldLocalizedForType<Type> | DocumentValueFieldNonLocalizedForType<Type>
240
- : never;
241
- export type DocumentValueField = DocumentValueFieldForType<DocumentValueFieldType>;
242
-
243
- export type DocumentValueFieldLocalizedForType<Type> = Type extends DocumentValueFieldType
244
- ? DocumentFieldTypeLocalized<DocumentValueFieldBase<Type>, DocumentValueFieldProps>
245
- : never;
246
- export type DocumentValueFieldLocalized = DocumentValueFieldLocalizedForType<DocumentValueFieldType>;
247
-
248
- export type DocumentValueFieldNonLocalizedForType<Type> = Type extends DocumentValueFieldType
249
- ? DocumentFieldTypeNonLocalized<DocumentValueFieldBase<Type>, DocumentValueFieldProps>
250
- : never;
251
- export type DocumentValueFieldNonLocalized = DocumentValueFieldNonLocalizedForType<DocumentValueFieldType>;
252
-
253
- export type DocumentValueFieldAPIForType<Type> = Type extends DocumentValueFieldType
254
- ? DocumentFieldTypeAPI<DocumentValueFieldBase<Type>, DocumentValueFieldProps>
255
- : never;
256
- export type DocumentValueFieldAPI = DocumentValueFieldAPIForType<DocumentValueFieldType>;
257
-
258
- export type DocumentValueFieldBasePropsForType<Type> = Type extends DocumentValueFieldType ? DocumentValueFieldBase<Type> : never;
259
- export type DocumentValueFieldBaseProps = DocumentValueFieldBasePropsForType<DocumentValueFieldType>;
260
- export type DocumentValueFieldBase<Type extends DocumentValueFieldType> = {
261
- type: Type;
262
- };
263
- export type DocumentValueFieldProps = {
264
- value: any;
265
- };
266
-
267
- export type DocumentFieldUnsetProps = { isUnset: true };
268
-
269
- // object
270
- export type DocumentObjectField = DocumentObjectFieldLocalized | DocumentObjectFieldNonLocalized;
271
- export type DocumentObjectFieldLocalized = DocumentFieldTypeLocalized<DocumentObjectFieldBase, DocumentObjectFieldProps>;
272
- export type DocumentObjectFieldNonLocalized = DocumentFieldTypeNonLocalized<DocumentObjectFieldBase, DocumentObjectFieldProps>;
273
- export type DocumentObjectFieldAPI = DocumentFieldTypeAPI<DocumentObjectFieldBase, DocumentObjectFieldPropsAPI>;
274
- export type DocumentObjectFieldBase = { type: 'object' };
275
- export type DocumentObjectFieldPropsCommon = {
276
- srcObjectLabel: string;
277
- };
278
- export type DocumentObjectFieldProps = DocumentFieldUnsetProps | ({ isUnset?: false; fields: Record<string, DocumentField> } & DocumentObjectFieldPropsCommon);
279
- export type DocumentObjectFieldPropsAPI =
280
- | DocumentFieldUnsetProps
281
- | ({ isUnset?: false; fields: Record<string, DocumentFieldAPI> } & DocumentObjectFieldPropsCommon);
282
-
283
- // model
284
- export type DocumentModelField = DocumentModelFieldLocalized | DocumentModelFieldNonLocalized;
285
- export type DocumentModelFieldLocalized = DocumentFieldTypeLocalized<DocumentModelFieldBase, DocumentModelFieldProps>;
286
- export type DocumentModelFieldNonLocalized = DocumentFieldTypeNonLocalized<DocumentModelFieldBase, DocumentModelFieldProps>;
287
- export type DocumentModelFieldAPI = DocumentFieldTypeAPI<{ type: 'object' }, DocumentModelFieldPropsAPI>;
288
- export type DocumentModelFieldBase = { type: 'model' };
289
- export type DocumentModelFieldPropsCommon = {
290
- srcObjectLabel: string;
291
- srcModelName: string;
292
- srcModelLabel: string;
293
- };
294
- export type DocumentModelFieldProps = DocumentFieldUnsetProps | ({ isUnset?: false; fields: Record<string, DocumentField> } & DocumentModelFieldPropsCommon);
295
- export type DocumentModelFieldPropsAPI =
296
- | DocumentFieldUnsetProps
297
- | ({ isUnset?: false; fields: Record<string, DocumentFieldAPI> } & DocumentModelFieldPropsCommon);
298
-
299
- // reference
300
- export type DocumentReferenceField = DocumentReferenceFieldLocalized | DocumentReferenceFieldNonLocalized;
301
- export type DocumentReferenceFieldLocalized = DocumentFieldTypeLocalized<DocumentReferenceFieldBase, DocumentReferenceFieldProps>;
302
- export type DocumentReferenceFieldNonLocalized = DocumentFieldTypeNonLocalized<DocumentReferenceFieldBase, DocumentReferenceFieldProps>;
303
- export type DocumentReferenceFieldAPI = DocumentFieldTypeAPI<DocumentReferenceFieldBaseAPI, DocumentReferenceFieldProps>;
304
- export type DocumentReferenceFieldBase = {
305
- type: 'reference';
306
- refType: 'document' | 'asset';
307
- };
308
- export type DocumentReferenceFieldProps = DocumentFieldUnsetProps | { isUnset?: false; refId: string };
309
- export type DocumentReferenceFieldBaseAPI = {
310
- type: 'unresolved_reference';
311
- refType: 'object' | 'image';
312
- };
313
-
314
- // cross-reference
315
- export type DocumentCrossReferenceField = DocumentCrossReferenceFieldLocalized | DocumentCrossReferenceFieldNonLocalized;
316
- export type DocumentCrossReferenceFieldLocalized = DocumentFieldTypeLocalized<DocumentCrossReferenceFieldBase, DocumentCrossReferenceFieldProps>;
317
- export type DocumentCrossReferenceFieldNonLocalized = DocumentFieldTypeNonLocalized<DocumentCrossReferenceFieldBase, DocumentCrossReferenceFieldProps>;
318
- export type DocumentCrossReferenceFieldAPI = DocumentFieldTypeAPI<DocumentCrossReferenceFieldBase, DocumentCrossReferenceFieldProps>;
319
- export type DocumentCrossReferenceFieldBase = {
320
- type: 'cross-reference';
321
- refType: 'document' | 'asset';
322
- };
323
- export type DocumentCrossReferenceFieldProps =
324
- | DocumentFieldUnsetProps
325
- | {
326
- isUnset?: false;
327
- refId: string;
328
- refSrcType: string;
329
- refProjectId: string;
330
- };
331
-
332
- // markdown
333
- export type DocumentMarkdownField = DocumentMarkdownFieldLocalized | DocumentMarkdownFieldNonLocalized;
334
- export type DocumentMarkdownFieldLocalized = DocumentFieldTypeLocalized<DocumentMarkdownFieldBase, DocumentMarkdownFieldProps>;
335
- export type DocumentMarkdownFieldNonLocalized = DocumentFieldTypeNonLocalized<DocumentMarkdownFieldBase, DocumentMarkdownFieldProps>;
336
- export type DocumentMarkdownFieldAPI = DocumentFieldTypeAPI<DocumentMarkdownFieldBase, DocumentMarkdownFieldProps>;
337
- export type DocumentMarkdownFieldBase = {
338
- type: 'markdown';
339
- };
340
- export type DocumentMarkdownFieldProps = {
341
- isUnset?: boolean;
342
- multiElement?: boolean;
343
- value: any;
344
- };
345
-
346
- // richText
347
- export type DocumentRichTextField = DocumentRichTextFieldLocalized | DocumentRichTextFieldNonLocalized;
348
- export type DocumentRichTextFieldLocalized = DocumentFieldTypeLocalized<DocumentRichTextFieldBase, DocumentRichTextFieldProps>;
349
- export type DocumentRichTextFieldNonLocalized = DocumentFieldTypeNonLocalized<DocumentRichTextFieldBase, DocumentRichTextFieldProps>;
350
- export type DocumentRichTextFieldAPI = DocumentFieldTypeAPI<DocumentRichTextFieldBase, DocumentRichTextFieldProps>;
351
- export type DocumentRichTextFieldBase = {
352
- type: 'richText';
353
- };
354
- export type DocumentRichTextFieldProps = {
355
- isUnset?: boolean;
356
- hint?: string;
357
- multiElement?: boolean;
358
- value: any;
359
- };
360
-
361
- // list
362
- export type DocumentListField = DocumentListFieldLocalized | DocumentListFieldNonLocalized;
363
- export type DocumentListFieldLocalized = DocumentFieldTypeLocalized<DocumentListFieldBase, DocumentListFieldProps>;
364
- export type DocumentListFieldNonLocalized = DocumentFieldTypeNonLocalized<DocumentListFieldBase, DocumentListFieldProps>;
365
- export type DocumentListFieldAPI = DocumentFieldTypeAPI<DocumentListFieldBase, DocumentListFieldPropsAPI>;
366
- export type DocumentListFieldBase = {
367
- type: 'list';
368
- };
369
- export type DocumentListFieldItems = Exclude<DocumentFieldNonLocalized, DocumentListFieldNonLocalized>;
370
- export type DocumentListFieldProps = {
371
- items: DocumentListFieldItems[];
372
- };
373
- export type DocumentListFieldItemsAPI = Exclude<DocumentFieldAPI, DocumentListFieldAPI>;
374
- export type DocumentListFieldPropsAPI = {
375
- items: DocumentListFieldItemsAPI[];
376
- };
377
-
378
- // image
379
- export type DocumentImageField = DocumentImageFieldLocalized | DocumentImageFieldNonLocalized;
380
- export type DocumentImageFieldLocalized = DocumentFieldTypeLocalized<DocumentImageFieldBase, DocumentImageFieldProps>;
381
- export type DocumentImageFieldNonLocalized = DocumentFieldTypeNonLocalized<DocumentImageFieldBase, DocumentImageFieldProps>;
382
- export type DocumentImageFieldAPI = DocumentFieldTypeAPI<DocumentImageFieldBase, DocumentImageFieldPropsAPI>;
383
- export type DocumentImageFieldBase = { type: 'image' };
384
- export type DocumentImageFieldProps = DocumentFieldUnsetProps | { isUnset?: false; fields: ImageFields };
385
- export type DocumentImageFieldPropsAPI = DocumentFieldUnsetProps | { isUnset?: false; fields: ImageFieldsAPI };
386
- export type ImageFields = {
387
- title: DocumentFieldForType<'string'>;
388
- url: DocumentFieldForType<'string'>;
389
- };
390
- export type ImageFieldsAPI = AssetFieldsAPI;
391
-
392
- // assetFile
393
- export type AssetFileField = AssetFileFieldLocalized | AssetFileFieldNonLocalized;
394
- export type AssetFileFieldLocalized = DocumentFieldTypeLocalized<AssetFileFieldBase, AssetFileFieldProps>;
395
- export type AssetFileFieldNonLocalized = DocumentFieldTypeNonLocalized<AssetFileFieldBase, AssetFileFieldProps>;
396
- export type AssetFileFieldBase = {
397
- type: 'assetFile';
398
- };
399
- export type AssetFileFieldProps = {
400
- url: string;
401
- fileName?: string;
402
- contentType?: string;
403
- size?: number;
404
- dimensions?: {
405
- width?: number;
406
- height?: number;
407
- };
408
- };
409
- export type UpdateOperation = UpdateOperationSet | UpdateOperationUnset | UpdateOperationInsert | UpdateOperationRemove | UpdateOperationReorder;
410
-
411
- export interface UpdateOperationBase {
412
- opType: string;
413
- fieldPath: (string | number)[];
414
- locale?: string;
415
- }
416
-
417
- export interface UpdateOperationSet extends UpdateOperationBase {
418
- opType: 'set';
419
- field: UpdateOperationField;
420
- }
421
-
422
- export interface UpdateOperationUnset extends UpdateOperationBase {
423
- opType: 'unset';
424
- }
425
-
426
- export interface UpdateOperationInsert extends UpdateOperationBase {
427
- opType: 'insert';
428
- index?: number;
429
- item: Exclude<UpdateOperationField, UpdateOperationListField>;
430
- }
431
-
432
- export interface UpdateOperationRemove extends UpdateOperationBase {
433
- opType: 'remove';
434
- index: number;
435
- }
436
-
437
- export interface UpdateOperationReorder extends UpdateOperationBase {
438
- opType: 'reorder';
439
- order: number[];
440
- }
441
-
442
- export type UpdateOperationField =
443
- | UpdateOperationValueField
444
- | UpdateOperationObjectField
445
- | UpdateOperationModelField
446
- | UpdateOperationReferenceField
447
- | UpdateOperationCrossReferenceField
448
- | UpdateOperationListField;
449
-
450
- export type UpdateOperationValueFieldType = Exclude<FieldType, 'object' | 'model' | 'reference' | 'cross-reference' | 'list'>;
451
-
452
- export type UpdateOperationValueField = DistributeUpdateOperationValueField<UpdateOperationValueFieldType>;
453
-
454
- export type DistributeUpdateOperationValueField<Type extends UpdateOperationValueFieldType> = Type extends UpdateOperationValueFieldType
455
- ? UpdateOperationValueFieldForType<Type>
456
- : never;
457
-
458
- export type UpdateOperationValueFieldForType<Type extends UpdateOperationValueFieldType> = {
459
- type: Type;
460
- value: any;
461
- };
462
-
463
- export type UpdateOperationObjectField = {
464
- type: 'object';
465
- object: Record<string, any>;
466
- };
467
-
468
- export type UpdateOperationModelField = {
469
- type: 'model';
470
- modelName: string;
471
- object: Record<string, any>;
472
- };
473
-
474
- export type UpdateOperationReferenceField = {
475
- type: 'reference';
476
- refType: 'document' | 'asset';
477
- refId: string;
478
- };
479
-
480
- export type UpdateOperationCrossReferenceField = {
481
- type: 'cross-reference';
482
- refType: 'document' | 'asset';
483
- refId: string;
484
- refSrcType: string;
485
- refProjectId: string;
486
- };
487
-
488
- export type UpdateOperationListField = {
489
- type: 'list';
490
- items: any[];
491
- };
492
-
493
- export type User = {
494
- name: string;
495
- email: string;
496
- connections: {
497
- type: string;
498
- [key: string]: any;
499
- }[];
500
- };
501
-
502
- export type ValidationError = {
503
- message: string;
504
- srcType: string;
505
- srcProjectId: string;
506
- srcObjectType: string;
507
- srcObjectId: string;
508
- fieldPath: (string | number)[];
509
- isUniqueValidation?: boolean;
510
- };
511
-
512
- export type HasAccessResult = {
513
- hasConnection: boolean;
514
- hasPermissions: boolean;
515
- contentSources: {
516
- srcType: string;
517
- srcProjectId: string;
518
- hasConnection: boolean;
519
- hasPermissions: boolean;
520
- }[];
521
- };
522
-
523
- export interface CrossReferenceData {
524
- refId: string;
525
- refSrcType: string;
526
- refProjectId: string;
527
- }