@contentchef/contentchef-types 2.5.1 → 2.5.5
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/api/ContentDefinition.d.ts +8 -1
- package/dist/api/ContentDefinitionSchema.d.ts +16 -2
- package/dist/api/ContentDefinitionSchema.js +1 -0
- package/dist/api/ContentTranslation.d.ts +10 -0
- package/lib/api/ContentDefinition.ts +19 -10
- package/lib/api/ContentDefinitionSchema.ts +21 -6
- package/lib/api/ContentTranslation.ts +21 -6
- package/package.json +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AuthorResponse } from './Author';
|
|
2
|
-
import { ContentDefinitionSchema, Field, I18NDictionary } from './ContentDefinitionSchema';
|
|
3
2
|
import { PagedListResponse } from './common';
|
|
3
|
+
import { ContentDefinitionSchema, Field, I18NDictionary } from './ContentDefinitionSchema';
|
|
4
4
|
import { Extension } from './Extension';
|
|
5
5
|
/**
|
|
6
6
|
* This type represent the unique content definition id type
|
|
@@ -15,6 +15,9 @@ export declare type GetContentDefinitionRequest = {
|
|
|
15
15
|
*/
|
|
16
16
|
id: ContentDefinitionId;
|
|
17
17
|
};
|
|
18
|
+
export declare type ArrayField = {
|
|
19
|
+
path: string;
|
|
20
|
+
};
|
|
18
21
|
/**
|
|
19
22
|
* This type represent the data needed to make a list content definition API request
|
|
20
23
|
*/
|
|
@@ -160,6 +163,10 @@ export declare type ContentDefinitionResponse = {
|
|
|
160
163
|
* Extensions used by the definition (type Extension or string (mnemonicId) depending if they are resolved or not)
|
|
161
164
|
*/
|
|
162
165
|
extensions: Extension[] | string[];
|
|
166
|
+
/**
|
|
167
|
+
* Valued with paths to each array or null if definition is legacy
|
|
168
|
+
*/
|
|
169
|
+
trackableArrayFields?: ArrayField[] | null;
|
|
163
170
|
};
|
|
164
171
|
/**
|
|
165
172
|
* This type represent the response of a create content definition API request
|
|
@@ -18,7 +18,8 @@ export declare enum SchemaTypeIds {
|
|
|
18
18
|
ONE_FRAGMENT_OF = "oneFragmentOf",
|
|
19
19
|
ONE_LINKED_CONTENT_OF = "oneLinkedContentOf",
|
|
20
20
|
ARRAY = "array",
|
|
21
|
-
SLUG = "slug"
|
|
21
|
+
SLUG = "slug",
|
|
22
|
+
MEDIA = "media"
|
|
22
23
|
}
|
|
23
24
|
/**
|
|
24
25
|
* This enum represent al possible long text sub types
|
|
@@ -328,6 +329,15 @@ export declare type SlugConstraints = {
|
|
|
328
329
|
prefix?: string;
|
|
329
330
|
allowSlash?: boolean;
|
|
330
331
|
};
|
|
332
|
+
/**
|
|
333
|
+
* Constraints of a `media` field
|
|
334
|
+
*/
|
|
335
|
+
export declare type MediaConstraints = {
|
|
336
|
+
/**
|
|
337
|
+
* Determines type of media (raw, video, image)
|
|
338
|
+
*/
|
|
339
|
+
type: MediaType;
|
|
340
|
+
};
|
|
331
341
|
/**
|
|
332
342
|
* This type represent the model of a Schema Type Field
|
|
333
343
|
* @template T The type of the field
|
|
@@ -403,6 +413,10 @@ export declare type CloudinaryVideoSchemaType = TranslatableSchemaType<SchemaTyp
|
|
|
403
413
|
* This type represent a cloudinary raw field schema type
|
|
404
414
|
*/
|
|
405
415
|
export declare type CloudinaryRawSchemaType = TranslatableSchemaType<SchemaType<SchemaTypeIds.CLOUDINARY_RAW, {}>>;
|
|
416
|
+
/**
|
|
417
|
+
* Media field schema type
|
|
418
|
+
*/
|
|
419
|
+
export declare type MediaSchemaType = TranslatableSchemaType<SchemaType<SchemaTypeIds.MEDIA, MediaConstraints>>;
|
|
406
420
|
/**
|
|
407
421
|
* This type represent a number field schema type
|
|
408
422
|
* A number field can be indexed and searched when requesting the content
|
|
@@ -451,7 +465,7 @@ export declare type IndexableSchemaTypes = TextSchemaType | LongTextSchemaType |
|
|
|
451
465
|
/**
|
|
452
466
|
* This are all the fields that can be localized
|
|
453
467
|
*/
|
|
454
|
-
export declare type TranslatableSchemaTypes = TextSchemaType | LongTextSchemaType | CloudinaryPublicIdSchemaType | CloudinaryImageSchemaType | CloudinaryVideoSchemaType | CloudinaryRawSchemaType;
|
|
468
|
+
export declare type TranslatableSchemaTypes = TextSchemaType | LongTextSchemaType | CloudinaryPublicIdSchemaType | CloudinaryImageSchemaType | CloudinaryVideoSchemaType | CloudinaryRawSchemaType | MediaSchemaType;
|
|
455
469
|
/**
|
|
456
470
|
* This type group all the schema types of a content definition that are not indexable
|
|
457
471
|
*/
|
|
@@ -22,6 +22,7 @@ var SchemaTypeIds;
|
|
|
22
22
|
SchemaTypeIds["ONE_LINKED_CONTENT_OF"] = "oneLinkedContentOf";
|
|
23
23
|
SchemaTypeIds["ARRAY"] = "array";
|
|
24
24
|
SchemaTypeIds["SLUG"] = "slug";
|
|
25
|
+
SchemaTypeIds["MEDIA"] = "media";
|
|
25
26
|
})(SchemaTypeIds = exports.SchemaTypeIds || (exports.SchemaTypeIds = {}));
|
|
26
27
|
/**
|
|
27
28
|
* This enum represent al possible long text sub types
|
|
@@ -48,3 +48,13 @@ export declare type ListContentTranslationRequest = {
|
|
|
48
48
|
contentId: ContentId;
|
|
49
49
|
};
|
|
50
50
|
export declare type ListContentTranslationResponse = ContentTranslation[];
|
|
51
|
+
export declare type DeleteContentTranslationRequest = {
|
|
52
|
+
contentId: ContentId;
|
|
53
|
+
locale: string;
|
|
54
|
+
};
|
|
55
|
+
export declare type DeleteContentTranslationResponse = boolean;
|
|
56
|
+
export declare type CleanContentTranslationRequest = {
|
|
57
|
+
contentId: ContentId;
|
|
58
|
+
locales: string[];
|
|
59
|
+
};
|
|
60
|
+
export declare type CleanContentTranslationResponse = boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AuthorResponse } from './Author';
|
|
2
|
-
import { ContentDefinitionSchema, Field, I18NDictionary } from './ContentDefinitionSchema';
|
|
3
2
|
import { PagedListResponse } from './common';
|
|
3
|
+
import { ContentDefinitionSchema, Field, I18NDictionary } from './ContentDefinitionSchema';
|
|
4
4
|
import { Extension } from './Extension';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -18,6 +18,10 @@ export type GetContentDefinitionRequest = {
|
|
|
18
18
|
id: ContentDefinitionId;
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
+
export type ArrayField = {
|
|
22
|
+
path: string;
|
|
23
|
+
};
|
|
24
|
+
|
|
21
25
|
/**
|
|
22
26
|
* This type represent the data needed to make a list content definition API request
|
|
23
27
|
*/
|
|
@@ -42,7 +46,7 @@ export type ListContentDefinitionsRequest = {
|
|
|
42
46
|
* This filter is used to search contents that contain the value inserted in the mnemonic id
|
|
43
47
|
*/
|
|
44
48
|
mnemonicId?: string;
|
|
45
|
-
}
|
|
49
|
+
};
|
|
46
50
|
};
|
|
47
51
|
|
|
48
52
|
/**
|
|
@@ -81,7 +85,7 @@ export type ListContentDefinitionsItem = {
|
|
|
81
85
|
/**
|
|
82
86
|
* Extensions used by the definition
|
|
83
87
|
*/
|
|
84
|
-
|
|
88
|
+
extensions: string[];
|
|
85
89
|
};
|
|
86
90
|
|
|
87
91
|
/**
|
|
@@ -170,6 +174,11 @@ export type ContentDefinitionResponse = {
|
|
|
170
174
|
* Extensions used by the definition (type Extension or string (mnemonicId) depending if they are resolved or not)
|
|
171
175
|
*/
|
|
172
176
|
extensions: Extension[] | string[];
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Valued with paths to each array or null if definition is legacy
|
|
180
|
+
*/
|
|
181
|
+
trackableArrayFields?: ArrayField[] | null;
|
|
173
182
|
};
|
|
174
183
|
|
|
175
184
|
/**
|
|
@@ -200,7 +209,7 @@ export type ValidateDefinitionFieldRequest = {
|
|
|
200
209
|
/**
|
|
201
210
|
* The default content definition schema language
|
|
202
211
|
*/
|
|
203
|
-
defaultLanguage: string
|
|
212
|
+
defaultLanguage: string;
|
|
204
213
|
};
|
|
205
214
|
|
|
206
215
|
/**
|
|
@@ -261,7 +270,7 @@ export type ContentDefinitionSchemaErrors = {
|
|
|
261
270
|
/**
|
|
262
271
|
* This attribute represents an error if the language of the schema is not a valid string
|
|
263
272
|
*/
|
|
264
|
-
lang?: string
|
|
273
|
+
lang?: string;
|
|
265
274
|
};
|
|
266
275
|
|
|
267
276
|
/**
|
|
@@ -275,7 +284,7 @@ export type SchemaFragmentErrors = {
|
|
|
275
284
|
* - The value is a SchemaFieldViolationErrors if the fragment is valid but there are internal fields with validation validation errors
|
|
276
285
|
* - The value is a AttributeViolation if the fragment has invalid attributes
|
|
277
286
|
*/
|
|
278
|
-
[key: string]: (SchemaFieldViolationsErrors | AttributeViolation)[]
|
|
287
|
+
[key: string]: (SchemaFieldViolationsErrors | AttributeViolation)[];
|
|
279
288
|
};
|
|
280
289
|
|
|
281
290
|
/**
|
|
@@ -307,7 +316,7 @@ export type AttributeViolation = {
|
|
|
307
316
|
/**
|
|
308
317
|
* The detailed list of errors that occurred
|
|
309
318
|
*/
|
|
310
|
-
details: AttributeViolationDetail[]
|
|
319
|
+
details: AttributeViolationDetail[];
|
|
311
320
|
};
|
|
312
321
|
|
|
313
322
|
/**
|
|
@@ -323,7 +332,7 @@ export type AttributeViolationDetail = {
|
|
|
323
332
|
* The attributes affected by the error
|
|
324
333
|
*
|
|
325
334
|
*/
|
|
326
|
-
affectedAttributes: string[]
|
|
335
|
+
affectedAttributes: string[];
|
|
327
336
|
};
|
|
328
337
|
|
|
329
338
|
/**
|
|
@@ -337,7 +346,7 @@ export type ArrayAttributeViolation = {
|
|
|
337
346
|
/**
|
|
338
347
|
* The list of errors inside the attribute
|
|
339
348
|
*/
|
|
340
|
-
itemsDetails: ArrayAttributeViolationDetail[]
|
|
349
|
+
itemsDetails: ArrayAttributeViolationDetail[];
|
|
341
350
|
};
|
|
342
351
|
|
|
343
352
|
/**
|
|
@@ -351,7 +360,7 @@ export type ArrayAttributeViolationDetail = {
|
|
|
351
360
|
/**
|
|
352
361
|
* The detailed errors of the value
|
|
353
362
|
*/
|
|
354
|
-
details: AttributeViolationDetail[]
|
|
363
|
+
details: AttributeViolationDetail[];
|
|
355
364
|
};
|
|
356
365
|
|
|
357
366
|
/**
|
|
@@ -19,7 +19,8 @@ export enum SchemaTypeIds {
|
|
|
19
19
|
ONE_FRAGMENT_OF = 'oneFragmentOf',
|
|
20
20
|
ONE_LINKED_CONTENT_OF = 'oneLinkedContentOf',
|
|
21
21
|
ARRAY = 'array',
|
|
22
|
-
SLUG = 'slug'
|
|
22
|
+
SLUG = 'slug',
|
|
23
|
+
MEDIA = 'media',
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
/**
|
|
@@ -43,7 +44,7 @@ export type ContentDefinitionSchema = {
|
|
|
43
44
|
/**
|
|
44
45
|
* The list of fields defined for the definition
|
|
45
46
|
*/
|
|
46
|
-
fields: Field[]
|
|
47
|
+
fields: Field[];
|
|
47
48
|
/**
|
|
48
49
|
* The fragments defined for the definition
|
|
49
50
|
* A Fragment is a custom field defined by the user and can be used internally in the definition
|
|
@@ -272,7 +273,7 @@ export type LinkedContentFieldConstraints = {
|
|
|
272
273
|
*/
|
|
273
274
|
lazy?: boolean;
|
|
274
275
|
|
|
275
|
-
linkType?: LinkType;
|
|
276
|
+
linkType?: LinkType;
|
|
276
277
|
};
|
|
277
278
|
|
|
278
279
|
/**
|
|
@@ -292,7 +293,7 @@ export type OneFragmentOfConstraints = {
|
|
|
292
293
|
/**
|
|
293
294
|
* Set this value to define which fragments the field can use
|
|
294
295
|
*/
|
|
295
|
-
names: string[]
|
|
296
|
+
names: string[];
|
|
296
297
|
};
|
|
297
298
|
|
|
298
299
|
/**
|
|
@@ -360,6 +361,16 @@ export type SlugConstraints = {
|
|
|
360
361
|
allowSlash?: boolean;
|
|
361
362
|
};
|
|
362
363
|
|
|
364
|
+
/**
|
|
365
|
+
* Constraints of a `media` field
|
|
366
|
+
*/
|
|
367
|
+
export type MediaConstraints = {
|
|
368
|
+
/**
|
|
369
|
+
* Determines type of media (raw, video, image)
|
|
370
|
+
*/
|
|
371
|
+
type: MediaType;
|
|
372
|
+
};
|
|
373
|
+
|
|
363
374
|
/**
|
|
364
375
|
* This type represent the model of a Schema Type Field
|
|
365
376
|
* @template T The type of the field
|
|
@@ -373,7 +384,7 @@ export type SchemaType<T, C> = {
|
|
|
373
384
|
/**
|
|
374
385
|
* This attribute represent the constraints of the field
|
|
375
386
|
*/
|
|
376
|
-
constraints: C
|
|
387
|
+
constraints: C;
|
|
377
388
|
};
|
|
378
389
|
|
|
379
390
|
/**
|
|
@@ -440,6 +451,10 @@ export type CloudinaryVideoSchemaType = TranslatableSchemaType<SchemaType<Schema
|
|
|
440
451
|
* This type represent a cloudinary raw field schema type
|
|
441
452
|
*/
|
|
442
453
|
export type CloudinaryRawSchemaType = TranslatableSchemaType<SchemaType<SchemaTypeIds.CLOUDINARY_RAW, {}>>;
|
|
454
|
+
/**
|
|
455
|
+
* Media field schema type
|
|
456
|
+
*/
|
|
457
|
+
export type MediaSchemaType = TranslatableSchemaType<SchemaType<SchemaTypeIds.MEDIA, MediaConstraints>>;
|
|
443
458
|
/**
|
|
444
459
|
* This type represent a number field schema type
|
|
445
460
|
* A number field can be indexed and searched when requesting the content
|
|
@@ -495,7 +510,7 @@ export type IndexableSchemaTypes = TextSchemaType | LongTextSchemaType | LinkedC
|
|
|
495
510
|
/**
|
|
496
511
|
* This are all the fields that can be localized
|
|
497
512
|
*/
|
|
498
|
-
export type TranslatableSchemaTypes = TextSchemaType | LongTextSchemaType | CloudinaryPublicIdSchemaType | CloudinaryImageSchemaType | CloudinaryVideoSchemaType | CloudinaryRawSchemaType;
|
|
513
|
+
export type TranslatableSchemaTypes = TextSchemaType | LongTextSchemaType | CloudinaryPublicIdSchemaType | CloudinaryImageSchemaType | CloudinaryVideoSchemaType | CloudinaryRawSchemaType | MediaSchemaType;
|
|
499
514
|
|
|
500
515
|
/**
|
|
501
516
|
* This type group all the schema types of a content definition that are not indexable
|
|
@@ -8,7 +8,7 @@ export type FieldTranslation = {
|
|
|
8
8
|
path: FieldPath;
|
|
9
9
|
value: string;
|
|
10
10
|
checksum: string;
|
|
11
|
-
}
|
|
11
|
+
};
|
|
12
12
|
|
|
13
13
|
export type ContentTranslation = {
|
|
14
14
|
id: ContentTranslationId;
|
|
@@ -21,14 +21,14 @@ export type ContentTranslation = {
|
|
|
21
21
|
latestContributor: AuthorResponse;
|
|
22
22
|
content: ContentResponse;
|
|
23
23
|
status: ContentTranslationStatus;
|
|
24
|
-
}
|
|
24
|
+
};
|
|
25
25
|
|
|
26
26
|
export type GetContentTranslationRequest = {
|
|
27
27
|
contentId: ContentId;
|
|
28
28
|
locale: string;
|
|
29
|
-
}
|
|
29
|
+
};
|
|
30
30
|
|
|
31
|
-
export type GetContentTranslationResponse = ContentTranslation & { translatedContent: ContentResponse };
|
|
31
|
+
export type GetContentTranslationResponse = ContentTranslation & { translatedContent: ContentResponse; };
|
|
32
32
|
|
|
33
33
|
export type CreateContentTranslationRequest = {
|
|
34
34
|
contentId: ContentId;
|
|
@@ -55,6 +55,21 @@ export enum ContentTranslationStatus {
|
|
|
55
55
|
|
|
56
56
|
export type ListContentTranslationRequest = {
|
|
57
57
|
contentId: ContentId;
|
|
58
|
-
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export type ListContentTranslationResponse = ContentTranslation[];
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
export type DeleteContentTranslationRequest = {
|
|
64
|
+
contentId: ContentId;
|
|
65
|
+
locale: string;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export type DeleteContentTranslationResponse = boolean;
|
|
69
|
+
|
|
70
|
+
export type CleanContentTranslationRequest = {
|
|
71
|
+
contentId: ContentId;
|
|
72
|
+
locales: string[];
|
|
73
|
+
};
|
|
59
74
|
|
|
60
|
-
export type
|
|
75
|
+
export type CleanContentTranslationResponse = boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentchef/contentchef-types",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.5",
|
|
4
4
|
"description": "ContentChef types",
|
|
5
5
|
"author": "PierpaoloIannone <piannone@byte-code.com>",
|
|
6
6
|
"homepage": "https://github.com/ContentChef/contentchef-management-js-client#readme",
|
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"typescript": "^4.0.5"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "74ebc47fe87871c7e31fb1e8803e31589c7158d4"
|
|
38
38
|
}
|