@stackbit/cms-core 0.0.17 → 0.0.19-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/annotator/html.d.ts +1 -0
- package/dist/annotator/html.d.ts.map +1 -0
- package/dist/annotator/index.d.ts +3 -2
- package/dist/annotator/index.d.ts.map +1 -0
- package/dist/annotator/react.d.ts +1 -0
- package/dist/annotator/react.d.ts.map +1 -0
- package/dist/common/common-schema.d.ts +3 -10
- package/dist/common/common-schema.d.ts.map +1 -0
- package/dist/common/common-schema.js +3 -4
- package/dist/common/common-schema.js.map +1 -1
- package/dist/consts.d.ts +1 -0
- package/dist/consts.d.ts.map +1 -0
- package/dist/content-source-interface.d.ts +324 -0
- package/dist/content-source-interface.d.ts.map +1 -0
- package/dist/content-source-interface.js +28 -0
- package/dist/content-source-interface.js.map +1 -0
- package/dist/content-store-types.d.ts +328 -0
- package/dist/content-store-types.d.ts.map +1 -0
- package/dist/content-store-types.js +3 -0
- package/dist/content-store-types.js.map +1 -0
- package/dist/content-store.d.ts +207 -0
- package/dist/content-store.d.ts.map +1 -0
- package/dist/content-store.js +1743 -0
- package/dist/content-store.js.map +1 -0
- package/dist/encoder.d.ts +36 -7
- package/dist/encoder.d.ts.map +1 -0
- package/dist/encoder.js +63 -40
- package/dist/encoder.js.map +1 -1
- package/dist/index.d.ts +11 -6
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +37 -11
- package/dist/index.js.map +1 -1
- package/dist/stackbit/index.d.ts +7 -3
- package/dist/stackbit/index.d.ts.map +1 -0
- package/dist/stackbit/index.js +13 -10
- package/dist/stackbit/index.js.map +1 -1
- package/dist/utils/index.d.ts +8 -7
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/schema-utils.d.ts +3 -2
- package/dist/utils/schema-utils.d.ts.map +1 -0
- package/dist/utils/timer.d.ts +18 -0
- package/dist/utils/timer.d.ts.map +1 -0
- package/dist/utils/timer.js +36 -0
- package/dist/utils/timer.js.map +1 -0
- package/package.json +8 -4
- package/src/common/common-schema.ts +12 -0
- package/src/content-source-interface.ts +468 -0
- package/src/content-store-types.ts +416 -0
- package/src/content-store.ts +2233 -0
- package/src/{encoder.js → encoder.ts} +55 -17
- package/src/index.ts +10 -0
- package/src/stackbit/{index.js → index.ts} +5 -9
- package/src/utils/timer.ts +42 -0
- package/dist/utils/lazy-poller.d.ts +0 -21
- package/dist/utils/lazy-poller.js +0 -56
- package/dist/utils/lazy-poller.js.map +0 -1
- package/src/common/common-schema.js +0 -14
- package/src/index.js +0 -13
- package/src/utils/lazy-poller.ts +0 -74
|
@@ -0,0 +1,416 @@
|
|
|
1
|
+
import { DocumentStatus, FieldType } from './content-source-interface';
|
|
2
|
+
|
|
3
|
+
export { FieldType, Logger, LeveledLogMethod, DocumentStatus } from './content-source-interface';
|
|
4
|
+
|
|
5
|
+
export interface Document {
|
|
6
|
+
type: 'document';
|
|
7
|
+
srcType: string;
|
|
8
|
+
srcProjectId: string;
|
|
9
|
+
srcProjectUrl: string;
|
|
10
|
+
srcEnvironment: string;
|
|
11
|
+
srcObjectId: string;
|
|
12
|
+
srcObjectUrl: string;
|
|
13
|
+
srcObjectLabel: string;
|
|
14
|
+
srcModelName: string;
|
|
15
|
+
srcModelLabel: string;
|
|
16
|
+
isChanged: boolean;
|
|
17
|
+
status: DocumentStatus;
|
|
18
|
+
createdAt: string;
|
|
19
|
+
createdBy?: string;
|
|
20
|
+
updatedAt: string;
|
|
21
|
+
updatedBy?: string[];
|
|
22
|
+
fields: Record<string, DocumentField>;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface Asset {
|
|
26
|
+
type: 'asset';
|
|
27
|
+
srcType: string;
|
|
28
|
+
srcProjectId: string;
|
|
29
|
+
srcProjectUrl: string;
|
|
30
|
+
srcEnvironment: string;
|
|
31
|
+
srcObjectId: string;
|
|
32
|
+
srcObjectUrl: string;
|
|
33
|
+
srcObjectLabel: string;
|
|
34
|
+
srcModelName: string;
|
|
35
|
+
srcModelLabel: string;
|
|
36
|
+
isChanged: boolean;
|
|
37
|
+
status: DocumentStatus;
|
|
38
|
+
createdAt: string;
|
|
39
|
+
createdBy?: string;
|
|
40
|
+
updatedAt: string;
|
|
41
|
+
updatedBy?: string[];
|
|
42
|
+
fields: AssetFields;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export type AssetFields = {
|
|
46
|
+
title: DocumentValueFieldForType<'string'>;
|
|
47
|
+
file: AssetFileField;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export interface UploadAssetData {
|
|
51
|
+
url: string;
|
|
52
|
+
data?: string;
|
|
53
|
+
metadata: {
|
|
54
|
+
name: string;
|
|
55
|
+
type: string;
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export interface ContentChangeResultItem {
|
|
60
|
+
srcType: string;
|
|
61
|
+
srcProjectId: string;
|
|
62
|
+
srcObjectId: string;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface ContentChangeResult {
|
|
66
|
+
updatedDocuments: ContentChangeResultItem[];
|
|
67
|
+
updatedAssets: ContentChangeResultItem[];
|
|
68
|
+
deletedDocuments: ContentChangeResultItem[];
|
|
69
|
+
deletedAssets: ContentChangeResultItem[];
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export type APIObject = APIDocumentObject | APIImageObject;
|
|
73
|
+
|
|
74
|
+
export interface APIDocumentObject extends Omit<Document, 'fields' | 'type'> {
|
|
75
|
+
type: 'object';
|
|
76
|
+
fields: Record<string, DocumentFieldAPI>;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export interface APIImageObject extends Omit<Asset, 'fields' | 'type'> {
|
|
80
|
+
type: 'image';
|
|
81
|
+
fields: AssetFieldsAPI;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export type AssetFieldsAPI = {
|
|
85
|
+
title: DocumentFieldAPIForType<'string'>;
|
|
86
|
+
url: DocumentFieldAPIForType<'string'>;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export interface APIAsset {
|
|
90
|
+
objectId: string;
|
|
91
|
+
createdAt: string;
|
|
92
|
+
url: string;
|
|
93
|
+
title?: string;
|
|
94
|
+
fileName?: string;
|
|
95
|
+
contentType?: string;
|
|
96
|
+
size?: number;
|
|
97
|
+
width?: number;
|
|
98
|
+
height?: number;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export type DocumentField =
|
|
102
|
+
| DocumentValueField
|
|
103
|
+
| DocumentObjectField
|
|
104
|
+
| DocumentModelField
|
|
105
|
+
| DocumentReferenceField
|
|
106
|
+
| DocumentListField
|
|
107
|
+
| DocumentMarkdownField
|
|
108
|
+
| DocumentRichTextField;
|
|
109
|
+
|
|
110
|
+
export type DocumentFieldLocalized =
|
|
111
|
+
| DocumentValueFieldLocalized
|
|
112
|
+
| DocumentObjectFieldLocalized
|
|
113
|
+
| DocumentModelFieldLocalized
|
|
114
|
+
| DocumentReferenceFieldLocalized
|
|
115
|
+
| DocumentMarkdownFieldLocalized
|
|
116
|
+
| DocumentRichTextFieldLocalized
|
|
117
|
+
| DocumentListFieldLocalized;
|
|
118
|
+
|
|
119
|
+
export type DocumentFieldNonLocalized =
|
|
120
|
+
| DocumentValueFieldNonLocalized
|
|
121
|
+
| DocumentObjectFieldNonLocalized
|
|
122
|
+
| DocumentModelFieldNonLocalized
|
|
123
|
+
| DocumentReferenceFieldNonLocalized
|
|
124
|
+
| DocumentMarkdownFieldNonLocalized
|
|
125
|
+
| DocumentRichTextFieldNonLocalized
|
|
126
|
+
| DocumentListFieldNonLocalized;
|
|
127
|
+
|
|
128
|
+
export type DocumentFieldAPI =
|
|
129
|
+
| DocumentValueFieldAPI
|
|
130
|
+
| DocumentObjectFieldAPI
|
|
131
|
+
| DocumentModelFieldAPI
|
|
132
|
+
| DocumentReferenceFieldAPI
|
|
133
|
+
| DocumentMarkdownFieldAPI
|
|
134
|
+
| DocumentRichTextFieldAPI
|
|
135
|
+
| DocumentListFieldAPI;
|
|
136
|
+
|
|
137
|
+
export type DocumentFieldBaseProps =
|
|
138
|
+
| DocumentValueFieldBaseProps
|
|
139
|
+
| DocumentObjectFieldBase
|
|
140
|
+
| DocumentModelFieldBase
|
|
141
|
+
| DocumentReferenceFieldBase
|
|
142
|
+
| DocumentListFieldBase
|
|
143
|
+
| DocumentRichTextFieldBase;
|
|
144
|
+
|
|
145
|
+
export type DistributiveOmit<T, K extends PropertyKey> = T extends any ? Omit<T, K> : never;
|
|
146
|
+
|
|
147
|
+
export type Simplify<T> = {
|
|
148
|
+
[K in keyof T]: T[K];
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
export type FindByType<Union extends { type: FieldType | 'unresolved_reference' }, Type> = Union extends { type: Type } ? Union : never;
|
|
152
|
+
export type DocumentFieldForType<Type extends FieldType> = FindByType<DocumentField, Type>;
|
|
153
|
+
export type DocumentFieldLocalizedForType<Type extends FieldType> = FindByType<DocumentFieldLocalized, Type>;
|
|
154
|
+
export type DocumentFieldNonLocalizedForType<Type extends FieldType> = FindByType<DocumentFieldNonLocalized, Type>;
|
|
155
|
+
export type DocumentFieldAPIForType<Type extends FieldType | 'unresolved_reference'> = FindByType<DocumentFieldAPI, Type>;
|
|
156
|
+
export type DocumentFieldBasePropsForType<Type extends FieldType> = FindByType<DocumentFieldBaseProps, Type>;
|
|
157
|
+
export type DocumentFieldSpecificPropsForType<Type extends FieldType> = Simplify<
|
|
158
|
+
DistributiveOmit<DocumentFieldNonLocalizedForType<Type>, keyof DocumentFieldBasePropsForType<Type> | 'label' | 'locale' | 'localized'>
|
|
159
|
+
>;
|
|
160
|
+
|
|
161
|
+
// helpers
|
|
162
|
+
export type DocumentFieldTypeLocalized<BaseFieldProps, LocalizedFieldProps> = Simplify<
|
|
163
|
+
BaseFieldProps & {
|
|
164
|
+
label?: string;
|
|
165
|
+
localized: true;
|
|
166
|
+
locales: Record<string, { locale: string } & Omit<LocalizedFieldProps, 'isUnset'>>;
|
|
167
|
+
}
|
|
168
|
+
>;
|
|
169
|
+
|
|
170
|
+
export type DocumentFieldTypeNonLocalized<BaseFieldProps, LocalizedFieldProps> = Simplify<
|
|
171
|
+
BaseFieldProps &
|
|
172
|
+
LocalizedFieldProps & {
|
|
173
|
+
label?: string;
|
|
174
|
+
localized?: false;
|
|
175
|
+
locale?: string;
|
|
176
|
+
}
|
|
177
|
+
>;
|
|
178
|
+
|
|
179
|
+
export type DocumentFieldTypeAPI<BaseFieldProps, LocalizedFieldProps> = BaseFieldProps &
|
|
180
|
+
LocalizedFieldProps & {
|
|
181
|
+
label?: string;
|
|
182
|
+
description?: string;
|
|
183
|
+
locale?: string;
|
|
184
|
+
localized?: boolean;
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
// any field that is not 'object' | 'model' | 'reference' | 'richText' | 'markdown' | 'list'
|
|
188
|
+
export type DocumentValueFieldType = Exclude<FieldType, 'object' | 'model' | 'reference' | 'markdown' | 'richText' | 'list'>;
|
|
189
|
+
|
|
190
|
+
export type DocumentValueFieldForType<Type> = Type extends DocumentValueFieldType
|
|
191
|
+
? DocumentValueFieldLocalizedForType<Type> | DocumentValueFieldNonLocalizedForType<Type>
|
|
192
|
+
: never;
|
|
193
|
+
export type DocumentValueField = DocumentValueFieldForType<DocumentValueFieldType>;
|
|
194
|
+
|
|
195
|
+
export type DocumentValueFieldLocalizedForType<Type> = Type extends DocumentValueFieldType
|
|
196
|
+
? DocumentFieldTypeLocalized<DocumentValueFieldBase<Type>, DocumentValueFieldProps>
|
|
197
|
+
: never;
|
|
198
|
+
export type DocumentValueFieldLocalized = DocumentValueFieldLocalizedForType<DocumentValueFieldType>;
|
|
199
|
+
|
|
200
|
+
export type DocumentValueFieldNonLocalizedForType<Type> = Type extends DocumentValueFieldType
|
|
201
|
+
? DocumentFieldTypeNonLocalized<DocumentValueFieldBase<Type>, DocumentValueFieldProps>
|
|
202
|
+
: never;
|
|
203
|
+
export type DocumentValueFieldNonLocalized = DocumentValueFieldNonLocalizedForType<DocumentValueFieldType>;
|
|
204
|
+
|
|
205
|
+
export type DocumentValueFieldAPIForType<Type> = Type extends DocumentValueFieldType
|
|
206
|
+
? DocumentFieldTypeAPI<DocumentValueFieldBase<Type>, DocumentValueFieldProps>
|
|
207
|
+
: never;
|
|
208
|
+
export type DocumentValueFieldAPI = DocumentValueFieldAPIForType<DocumentValueFieldType>;
|
|
209
|
+
|
|
210
|
+
export type DocumentValueFieldBasePropsForType<Type> = Type extends DocumentValueFieldType ? DocumentValueFieldBase<Type> : never;
|
|
211
|
+
export type DocumentValueFieldBaseProps = DocumentValueFieldBasePropsForType<DocumentValueFieldType>;
|
|
212
|
+
export type DocumentValueFieldBase<Type extends DocumentValueFieldType> = {
|
|
213
|
+
type: Type;
|
|
214
|
+
};
|
|
215
|
+
export type DocumentValueFieldProps = {
|
|
216
|
+
value: any;
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
// object
|
|
220
|
+
export type DocumentObjectField = DocumentObjectFieldLocalized | DocumentObjectFieldNonLocalized;
|
|
221
|
+
export type DocumentObjectFieldLocalized = DocumentFieldTypeLocalized<DocumentObjectFieldBase, DocumentObjectFieldProps>;
|
|
222
|
+
export type DocumentObjectFieldNonLocalized = DocumentFieldTypeNonLocalized<DocumentObjectFieldBase, DocumentObjectFieldProps>;
|
|
223
|
+
export type DocumentObjectFieldAPI = DocumentFieldTypeAPI<DocumentObjectFieldBase, DocumentObjectFieldPropsAPI>;
|
|
224
|
+
export type DocumentObjectFieldBase = { type: 'object' };
|
|
225
|
+
export type DocumentObjectFieldPropsCommon = {
|
|
226
|
+
srcObjectLabel: string;
|
|
227
|
+
};
|
|
228
|
+
export type DocumentObjectFieldProps = { isUnset: true } | ({ isUnset?: false; fields: Record<string, DocumentField> } & DocumentObjectFieldPropsCommon);
|
|
229
|
+
export type DocumentObjectFieldPropsAPI = { isUnset: true } | ({ isUnset?: false; fields: Record<string, DocumentFieldAPI> } & DocumentObjectFieldPropsCommon);
|
|
230
|
+
|
|
231
|
+
// model
|
|
232
|
+
export type DocumentModelField = DocumentModelFieldLocalized | DocumentModelFieldNonLocalized;
|
|
233
|
+
export type DocumentModelFieldLocalized = DocumentFieldTypeLocalized<DocumentModelFieldBase, DocumentModelFieldProps>;
|
|
234
|
+
export type DocumentModelFieldNonLocalized = DocumentFieldTypeNonLocalized<DocumentModelFieldBase, DocumentModelFieldProps>;
|
|
235
|
+
export type DocumentModelFieldAPI = DocumentFieldTypeAPI<DocumentModelFieldBase, DocumentModelFieldPropsAPI>;
|
|
236
|
+
export type DocumentModelFieldBase = { type: 'model' };
|
|
237
|
+
export type DocumentModelFieldPropsCommon = {
|
|
238
|
+
srcObjectLabel: string;
|
|
239
|
+
srcModelName: string;
|
|
240
|
+
srcModelLabel: string;
|
|
241
|
+
};
|
|
242
|
+
export type DocumentModelFieldProps = { isUnset: true } | ({ isUnset?: false; fields: Record<string, DocumentField> } & DocumentModelFieldPropsCommon);
|
|
243
|
+
export type DocumentModelFieldPropsAPI = { isUnset: true } | ({ isUnset?: false; fields: Record<string, DocumentFieldAPI> } & DocumentModelFieldPropsCommon);
|
|
244
|
+
|
|
245
|
+
// reference
|
|
246
|
+
export type DocumentReferenceField = DocumentReferenceFieldLocalized | DocumentReferenceFieldNonLocalized;
|
|
247
|
+
export type DocumentReferenceFieldLocalized = DocumentFieldTypeLocalized<DocumentReferenceFieldBase, DocumentReferenceFieldProps>;
|
|
248
|
+
export type DocumentReferenceFieldNonLocalized = DocumentFieldTypeNonLocalized<DocumentReferenceFieldBase, DocumentReferenceFieldProps>;
|
|
249
|
+
export type DocumentReferenceFieldAPI = DocumentFieldTypeAPI<DocumentReferenceFieldBaseAPI, DocumentReferenceFieldProps>;
|
|
250
|
+
export type DocumentReferenceFieldBase = {
|
|
251
|
+
type: 'reference';
|
|
252
|
+
refType: 'document' | 'asset';
|
|
253
|
+
};
|
|
254
|
+
export type DocumentReferenceFieldProps = { isUnset: true } | { isUnset?: false; refId: string };
|
|
255
|
+
export type DocumentReferenceFieldBaseAPI = {
|
|
256
|
+
type: 'unresolved_reference';
|
|
257
|
+
refType: 'object' | 'image';
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
// markdown
|
|
261
|
+
export type DocumentMarkdownField = DocumentMarkdownFieldLocalized | DocumentMarkdownFieldNonLocalized;
|
|
262
|
+
export type DocumentMarkdownFieldLocalized = DocumentFieldTypeLocalized<DocumentMarkdownFieldBase, DocumentMarkdownFieldProps>;
|
|
263
|
+
export type DocumentMarkdownFieldNonLocalized = DocumentFieldTypeNonLocalized<DocumentMarkdownFieldBase, DocumentMarkdownFieldProps>;
|
|
264
|
+
export type DocumentMarkdownFieldAPI = DocumentFieldTypeAPI<DocumentMarkdownFieldBase, DocumentMarkdownFieldProps>;
|
|
265
|
+
export type DocumentMarkdownFieldBase = {
|
|
266
|
+
type: 'markdown';
|
|
267
|
+
};
|
|
268
|
+
export type DocumentMarkdownFieldProps = {
|
|
269
|
+
isUnset?: boolean;
|
|
270
|
+
multiElement?: boolean;
|
|
271
|
+
value: any;
|
|
272
|
+
};
|
|
273
|
+
|
|
274
|
+
// richText
|
|
275
|
+
export type DocumentRichTextField = DocumentRichTextFieldLocalized | DocumentRichTextFieldNonLocalized;
|
|
276
|
+
export type DocumentRichTextFieldLocalized = DocumentFieldTypeLocalized<DocumentRichTextFieldBase, DocumentRichTextFieldProps>;
|
|
277
|
+
export type DocumentRichTextFieldNonLocalized = DocumentFieldTypeNonLocalized<DocumentRichTextFieldBase, DocumentRichTextFieldProps>;
|
|
278
|
+
export type DocumentRichTextFieldAPI = DocumentFieldTypeAPI<DocumentRichTextFieldBase, DocumentRichTextFieldProps>;
|
|
279
|
+
export type DocumentRichTextFieldBase = {
|
|
280
|
+
type: 'richText';
|
|
281
|
+
};
|
|
282
|
+
export type DocumentRichTextFieldProps = {
|
|
283
|
+
isUnset?: boolean;
|
|
284
|
+
hint?: string;
|
|
285
|
+
multiElement?: boolean;
|
|
286
|
+
value: any;
|
|
287
|
+
};
|
|
288
|
+
|
|
289
|
+
// list
|
|
290
|
+
export type DocumentListField = DocumentListFieldLocalized | DocumentListFieldNonLocalized;
|
|
291
|
+
export type DocumentListFieldLocalized = DocumentFieldTypeLocalized<DocumentListFieldBase, DocumentListFieldProps>;
|
|
292
|
+
export type DocumentListFieldNonLocalized = DocumentFieldTypeNonLocalized<DocumentListFieldBase, DocumentListFieldProps>;
|
|
293
|
+
export type DocumentListFieldAPI = DocumentFieldTypeAPI<DocumentListFieldBase, DocumentListFieldPropsAPI>;
|
|
294
|
+
export type DocumentListFieldBase = {
|
|
295
|
+
type: 'list';
|
|
296
|
+
};
|
|
297
|
+
export type DocumentListFieldProps = {
|
|
298
|
+
items: DocumentField[];
|
|
299
|
+
};
|
|
300
|
+
export type DocumentListFieldPropsAPI = {
|
|
301
|
+
items: DocumentFieldAPI[];
|
|
302
|
+
};
|
|
303
|
+
|
|
304
|
+
// assetFile
|
|
305
|
+
export type AssetFileField = AssetFileFieldLocalized | AssetFileFieldNonLocalized;
|
|
306
|
+
export type AssetFileFieldLocalized = DocumentFieldTypeLocalized<AssetFileFieldBase, AssetFileFieldProps>;
|
|
307
|
+
export type AssetFileFieldNonLocalized = DocumentFieldTypeNonLocalized<AssetFileFieldBase, AssetFileFieldProps>;
|
|
308
|
+
export type AssetFileFieldBase = {
|
|
309
|
+
type: 'assetFile';
|
|
310
|
+
};
|
|
311
|
+
export type AssetFileFieldProps = {
|
|
312
|
+
url: string;
|
|
313
|
+
fileName?: string;
|
|
314
|
+
contentType?: string;
|
|
315
|
+
size?: number;
|
|
316
|
+
dimensions?: {
|
|
317
|
+
width?: number;
|
|
318
|
+
height?: number;
|
|
319
|
+
};
|
|
320
|
+
};
|
|
321
|
+
export type UpdateOperation = UpdateOperationSet | UpdateOperationUnset | UpdateOperationInsert | UpdateOperationRemove | UpdateOperationReorder;
|
|
322
|
+
|
|
323
|
+
export type UpdateOperationBase = {
|
|
324
|
+
opType: string;
|
|
325
|
+
fieldPath: (string | number)[];
|
|
326
|
+
locale?: string;
|
|
327
|
+
};
|
|
328
|
+
|
|
329
|
+
export type UpdateOperationSet = Simplify<
|
|
330
|
+
UpdateOperationBase & {
|
|
331
|
+
opType: 'set';
|
|
332
|
+
field: UpdateOperationField;
|
|
333
|
+
}
|
|
334
|
+
>;
|
|
335
|
+
|
|
336
|
+
export type UpdateOperationUnset = Simplify<
|
|
337
|
+
UpdateOperationBase & {
|
|
338
|
+
opType: 'unset';
|
|
339
|
+
}
|
|
340
|
+
>;
|
|
341
|
+
|
|
342
|
+
export type UpdateOperationInsert = Simplify<
|
|
343
|
+
UpdateOperationBase & {
|
|
344
|
+
opType: 'insert';
|
|
345
|
+
index?: number;
|
|
346
|
+
item: UpdateOperationField;
|
|
347
|
+
}
|
|
348
|
+
>;
|
|
349
|
+
|
|
350
|
+
export type UpdateOperationRemove = Simplify<
|
|
351
|
+
UpdateOperationBase & {
|
|
352
|
+
opType: 'remove';
|
|
353
|
+
index: number;
|
|
354
|
+
}
|
|
355
|
+
>;
|
|
356
|
+
|
|
357
|
+
export type UpdateOperationReorder = Simplify<
|
|
358
|
+
UpdateOperationBase & {
|
|
359
|
+
opType: 'reorder';
|
|
360
|
+
order: number[];
|
|
361
|
+
}
|
|
362
|
+
>;
|
|
363
|
+
|
|
364
|
+
export type UpdateOperationField =
|
|
365
|
+
| UpdateOperationValueField
|
|
366
|
+
| UpdateOperationObjectField
|
|
367
|
+
| UpdateOperationModelField
|
|
368
|
+
| UpdateOperationReferenceField
|
|
369
|
+
| UpdateOperationListField;
|
|
370
|
+
|
|
371
|
+
export type UpdateOperationValueFieldType = Exclude<FieldType, 'object' | 'model' | 'reference' | 'list'>;
|
|
372
|
+
export type UpdateOperationValueField = {
|
|
373
|
+
type: UpdateOperationValueFieldType;
|
|
374
|
+
value: any;
|
|
375
|
+
};
|
|
376
|
+
|
|
377
|
+
export type UpdateOperationObjectField = {
|
|
378
|
+
type: 'object';
|
|
379
|
+
object: Record<string, any>;
|
|
380
|
+
};
|
|
381
|
+
|
|
382
|
+
export type UpdateOperationModelField = {
|
|
383
|
+
type: 'model';
|
|
384
|
+
modelName: string;
|
|
385
|
+
object: Record<string, any>;
|
|
386
|
+
};
|
|
387
|
+
|
|
388
|
+
export type UpdateOperationReferenceField = {
|
|
389
|
+
type: 'reference';
|
|
390
|
+
refType: 'document' | 'asset';
|
|
391
|
+
refId: string;
|
|
392
|
+
};
|
|
393
|
+
|
|
394
|
+
export type UpdateOperationListField = {
|
|
395
|
+
type: 'list';
|
|
396
|
+
items: any[];
|
|
397
|
+
};
|
|
398
|
+
|
|
399
|
+
export type User = {
|
|
400
|
+
name: string;
|
|
401
|
+
email: string;
|
|
402
|
+
connections: {
|
|
403
|
+
type: string;
|
|
404
|
+
[key: string]: any;
|
|
405
|
+
}[];
|
|
406
|
+
};
|
|
407
|
+
|
|
408
|
+
export type ValidationError = {
|
|
409
|
+
message: string;
|
|
410
|
+
srcType: string;
|
|
411
|
+
srcProjectId: string;
|
|
412
|
+
srcObjectType: string;
|
|
413
|
+
srcObjectId: string;
|
|
414
|
+
fieldPath: (string | number)[];
|
|
415
|
+
isUniqueValidation?: boolean;
|
|
416
|
+
};
|