@contentchef/contentchef-types 11.0.0-alpha.0 → 11.0.0-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/api/Content.d.ts +3 -1
- package/dist/api/Content.js +2 -0
- package/dist/api/ContentDefinition.d.ts +4 -1
- package/dist/api/ContentDefinition.js +3 -0
- package/dist/api/ContentDefinitionSchema.d.ts +69 -2
- package/dist/api/ContentDefinitionSchema.js +11 -1
- package/lib/api/Content.ts +2 -0
- package/lib/api/ContentDefinition.ts +4 -1
- package/lib/api/ContentDefinitionSchema.ts +68 -1
- package/package.json +2 -2
package/dist/api/Content.d.ts
CHANGED
|
@@ -769,7 +769,9 @@ export declare enum ContentFieldViolationCodes {
|
|
|
769
769
|
textFieldPatternNotMatched = "textField.patternNotMatched",
|
|
770
770
|
textFieldValueMissingInListOfValue = "textField.valueMissingInListOfValue",
|
|
771
771
|
textFieldValueIsNotAString = "textField.valueIsNotAString",
|
|
772
|
-
textFieldBlankValueNotAllowed = "textField.blankValueNotAllowed"
|
|
772
|
+
textFieldBlankValueNotAllowed = "textField.blankValueNotAllowed",
|
|
773
|
+
segmentedFieldValueIsNotSegmented = "segmentedField.valueIsNotSegmented",
|
|
774
|
+
segmentedFieldSegmentNotDeclared = "segmentedField.segmentNotDeclared"
|
|
773
775
|
}
|
|
774
776
|
/**
|
|
775
777
|
* Request type for getContentStatus
|
package/dist/api/Content.js
CHANGED
|
@@ -86,6 +86,8 @@ var ContentFieldViolationCodes;
|
|
|
86
86
|
ContentFieldViolationCodes["textFieldValueMissingInListOfValue"] = "textField.valueMissingInListOfValue";
|
|
87
87
|
ContentFieldViolationCodes["textFieldValueIsNotAString"] = "textField.valueIsNotAString";
|
|
88
88
|
ContentFieldViolationCodes["textFieldBlankValueNotAllowed"] = "textField.blankValueNotAllowed";
|
|
89
|
+
ContentFieldViolationCodes["segmentedFieldValueIsNotSegmented"] = "segmentedField.valueIsNotSegmented";
|
|
90
|
+
ContentFieldViolationCodes["segmentedFieldSegmentNotDeclared"] = "segmentedField.segmentNotDeclared";
|
|
89
91
|
})(ContentFieldViolationCodes || (exports.ContentFieldViolationCodes = ContentFieldViolationCodes = {}));
|
|
90
92
|
var LocalizationSettings;
|
|
91
93
|
(function (LocalizationSettings) {
|
|
@@ -366,6 +366,7 @@ export declare enum SchemaFieldViolationCodes {
|
|
|
366
366
|
invalidNumberValueInList = "invalidNumberValueInList",
|
|
367
367
|
invalidArrayValue = "invalidArrayValue",
|
|
368
368
|
invalidEmptyArray = "invalidEmptyArray",
|
|
369
|
+
invalidEmptyObject = "invalidEmptyObject",
|
|
369
370
|
invalidListOfValuesValue = "invalidListOfValuesValue",
|
|
370
371
|
fragmentNameNotFound = "fragmentNameNotFound",
|
|
371
372
|
fragmentNameAlreadyInUse = "fragmentNameAlreadyInUse",
|
|
@@ -387,5 +388,7 @@ export declare enum SchemaFieldViolationCodes {
|
|
|
387
388
|
extensionNotSupportedForType = "extensionNotSupportedForType",
|
|
388
389
|
translatableNotAllowed = "translatableNotAllowed",
|
|
389
390
|
invalidEnumValue = "invalidEnumValue",
|
|
390
|
-
compactCannotBeNested = "compactCannotBeNested"
|
|
391
|
+
compactCannotBeNested = "compactCannotBeNested",
|
|
392
|
+
segmentTypeNotAllowed = "segmentTypeNotAllowed",
|
|
393
|
+
segmentNameNotFound = "segmentNameNotFound"
|
|
391
394
|
}
|
|
@@ -22,6 +22,7 @@ var SchemaFieldViolationCodes;
|
|
|
22
22
|
SchemaFieldViolationCodes["invalidNumberValueInList"] = "invalidNumberValueInList";
|
|
23
23
|
SchemaFieldViolationCodes["invalidArrayValue"] = "invalidArrayValue";
|
|
24
24
|
SchemaFieldViolationCodes["invalidEmptyArray"] = "invalidEmptyArray";
|
|
25
|
+
SchemaFieldViolationCodes["invalidEmptyObject"] = "invalidEmptyObject";
|
|
25
26
|
SchemaFieldViolationCodes["invalidListOfValuesValue"] = "invalidListOfValuesValue";
|
|
26
27
|
SchemaFieldViolationCodes["fragmentNameNotFound"] = "fragmentNameNotFound";
|
|
27
28
|
SchemaFieldViolationCodes["fragmentNameAlreadyInUse"] = "fragmentNameAlreadyInUse";
|
|
@@ -44,4 +45,6 @@ var SchemaFieldViolationCodes;
|
|
|
44
45
|
SchemaFieldViolationCodes["translatableNotAllowed"] = "translatableNotAllowed";
|
|
45
46
|
SchemaFieldViolationCodes["invalidEnumValue"] = "invalidEnumValue";
|
|
46
47
|
SchemaFieldViolationCodes["compactCannotBeNested"] = "compactCannotBeNested";
|
|
48
|
+
SchemaFieldViolationCodes["segmentTypeNotAllowed"] = "segmentTypeNotAllowed";
|
|
49
|
+
SchemaFieldViolationCodes["segmentNameNotFound"] = "segmentNameNotFound";
|
|
47
50
|
})(SchemaFieldViolationCodes || (exports.SchemaFieldViolationCodes = SchemaFieldViolationCodes = {}));
|
|
@@ -19,7 +19,8 @@ export declare enum SchemaTypeIds {
|
|
|
19
19
|
ONE_LINKED_CONTENT_OF = "oneLinkedContentOf",
|
|
20
20
|
ARRAY = "array",
|
|
21
21
|
SLUG = "slug",
|
|
22
|
-
MEDIA = "media"
|
|
22
|
+
MEDIA = "media",
|
|
23
|
+
SEGMENTED = "segmented"
|
|
23
24
|
}
|
|
24
25
|
/**
|
|
25
26
|
* This enum represent al possible long text sub types
|
|
@@ -293,6 +294,68 @@ export type OneLinkedContentOfConstraints = {
|
|
|
293
294
|
lazy?: boolean;
|
|
294
295
|
linkType?: LinkType;
|
|
295
296
|
};
|
|
297
|
+
/**
|
|
298
|
+
* This type represent one segment of a segmented field: the same `{ type, constraints }` pair a
|
|
299
|
+
* schema field carries, minus the name, because the map key in `SegmentsTable` is the name
|
|
300
|
+
*
|
|
301
|
+
* `oneLinkedContentOf` is the only reference form admitted, `linked-content` is its single
|
|
302
|
+
* definition special case and carries the identical payload value
|
|
303
|
+
*/
|
|
304
|
+
export type SegmentDescriptor = {
|
|
305
|
+
type: SchemaTypeIds.FRAGMENT;
|
|
306
|
+
constraints: FragmentFieldConstraints;
|
|
307
|
+
} | {
|
|
308
|
+
type: SchemaTypeIds.ONE_FRAGMENT_OF;
|
|
309
|
+
constraints: OneFragmentOfConstraints;
|
|
310
|
+
} | {
|
|
311
|
+
type: SchemaTypeIds.ONE_LINKED_CONTENT_OF;
|
|
312
|
+
constraints: OneLinkedContentOfConstraints;
|
|
313
|
+
};
|
|
314
|
+
/**
|
|
315
|
+
* This type represent the model to define a segment of a segmented field
|
|
316
|
+
*/
|
|
317
|
+
export type SegmentDefinition = SegmentDescriptor & {
|
|
318
|
+
/**
|
|
319
|
+
* The friendly labels of the segment
|
|
320
|
+
*/
|
|
321
|
+
labels?: I18NDictionary;
|
|
322
|
+
};
|
|
323
|
+
/**
|
|
324
|
+
* This type represent the model of the attribute segments of a segmented field, keyed by segment
|
|
325
|
+
* name, like `FragmentsTable`
|
|
326
|
+
* Names must match `^[a-z0-9_-]+$` and are unordered
|
|
327
|
+
*/
|
|
328
|
+
export type SegmentsTable = {
|
|
329
|
+
/**
|
|
330
|
+
* The name is the unique id of the segment and its value is the model representing the segment
|
|
331
|
+
*/
|
|
332
|
+
[name: string]: SegmentDefinition;
|
|
333
|
+
};
|
|
334
|
+
/**
|
|
335
|
+
* This enum constrains every segment of a field to one family
|
|
336
|
+
* When omitted, segments of both families are allowed in the same field
|
|
337
|
+
*/
|
|
338
|
+
export declare enum SegmentsType {
|
|
339
|
+
FRAGMENTS = "fragments",
|
|
340
|
+
REFERENCES = "references"
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* This type represent the model of a segmented field constraints
|
|
344
|
+
*/
|
|
345
|
+
export type SegmentedFieldConstraints = {
|
|
346
|
+
/**
|
|
347
|
+
* Set this value to define the segments the field is made of
|
|
348
|
+
*/
|
|
349
|
+
segments: SegmentsTable;
|
|
350
|
+
/**
|
|
351
|
+
* Set this value to define the segment served when the request matches none of this field's segments
|
|
352
|
+
*/
|
|
353
|
+
defaultSegment?: string;
|
|
354
|
+
/**
|
|
355
|
+
* Set this value to constrain every segment of the field to one family
|
|
356
|
+
*/
|
|
357
|
+
segmentsType?: SegmentsType;
|
|
358
|
+
};
|
|
296
359
|
/**
|
|
297
360
|
* This type represent the model of an array field constraints
|
|
298
361
|
* @template T The type of the item used ad children of the array
|
|
@@ -444,6 +507,10 @@ export type OneFragmentOfSchemaType = SchemaType<SchemaTypeIds.ONE_FRAGMENT_OF,
|
|
|
444
507
|
* A one linked content of field can be indexed and searched when requesting the content
|
|
445
508
|
*/
|
|
446
509
|
export type OneLinkedContentOfSchemaType = IndexableSchemaType<SchemaTypeIds.ONE_LINKED_CONTENT_OF, OneLinkedContentOfConstraints>;
|
|
510
|
+
/**
|
|
511
|
+
* This type represent a segmented field schema type
|
|
512
|
+
*/
|
|
513
|
+
export type SegmentedSchemaType = SchemaType<SchemaTypeIds.SEGMENTED, SegmentedFieldConstraints>;
|
|
447
514
|
/**
|
|
448
515
|
* Slug schema type
|
|
449
516
|
* This type is indexable and translatable by default
|
|
@@ -469,7 +536,7 @@ export type TranslatableSchemaTypes = NumberSchemaType | TextSchemaType | LongTe
|
|
|
469
536
|
/**
|
|
470
537
|
* This type group all the schema types of a content definition that are not indexable
|
|
471
538
|
*/
|
|
472
|
-
export type PlainSchemaTypes = DateSchemaType | FragmentSchemaType | OneFragmentOfSchemaType | SlugSchemaType;
|
|
539
|
+
export type PlainSchemaTypes = DateSchemaType | FragmentSchemaType | OneFragmentOfSchemaType | SlugSchemaType | SegmentedSchemaType;
|
|
473
540
|
/**
|
|
474
541
|
* This type group all schema types of a content definition
|
|
475
542
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LinkType = exports.LongTextSubTypes = exports.SchemaTypeIds = void 0;
|
|
3
|
+
exports.SegmentsType = exports.LinkType = exports.LongTextSubTypes = exports.SchemaTypeIds = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* This enum represent al possible schema field type ids
|
|
6
6
|
*/
|
|
@@ -23,6 +23,7 @@ var SchemaTypeIds;
|
|
|
23
23
|
SchemaTypeIds["ARRAY"] = "array";
|
|
24
24
|
SchemaTypeIds["SLUG"] = "slug";
|
|
25
25
|
SchemaTypeIds["MEDIA"] = "media";
|
|
26
|
+
SchemaTypeIds["SEGMENTED"] = "segmented";
|
|
26
27
|
})(SchemaTypeIds || (exports.SchemaTypeIds = SchemaTypeIds = {}));
|
|
27
28
|
/**
|
|
28
29
|
* This enum represent al possible long text sub types
|
|
@@ -39,3 +40,12 @@ var LinkType;
|
|
|
39
40
|
LinkType[LinkType["LAZY"] = 1] = "LAZY";
|
|
40
41
|
LinkType[LinkType["COMPACT"] = 2] = "COMPACT";
|
|
41
42
|
})(LinkType || (exports.LinkType = LinkType = {}));
|
|
43
|
+
/**
|
|
44
|
+
* This enum constrains every segment of a field to one family
|
|
45
|
+
* When omitted, segments of both families are allowed in the same field
|
|
46
|
+
*/
|
|
47
|
+
var SegmentsType;
|
|
48
|
+
(function (SegmentsType) {
|
|
49
|
+
SegmentsType["FRAGMENTS"] = "fragments";
|
|
50
|
+
SegmentsType["REFERENCES"] = "references";
|
|
51
|
+
})(SegmentsType || (exports.SegmentsType = SegmentsType = {}));
|
package/lib/api/Content.ts
CHANGED
|
@@ -838,6 +838,8 @@ export enum ContentFieldViolationCodes {
|
|
|
838
838
|
textFieldValueMissingInListOfValue = "textField.valueMissingInListOfValue",
|
|
839
839
|
textFieldValueIsNotAString = "textField.valueIsNotAString",
|
|
840
840
|
textFieldBlankValueNotAllowed = "textField.blankValueNotAllowed",
|
|
841
|
+
segmentedFieldValueIsNotSegmented = "segmentedField.valueIsNotSegmented",
|
|
842
|
+
segmentedFieldSegmentNotDeclared = "segmentedField.segmentNotDeclared",
|
|
841
843
|
}
|
|
842
844
|
|
|
843
845
|
/**
|
|
@@ -393,6 +393,7 @@ export enum SchemaFieldViolationCodes {
|
|
|
393
393
|
invalidNumberValueInList = 'invalidNumberValueInList',
|
|
394
394
|
invalidArrayValue = 'invalidArrayValue',
|
|
395
395
|
invalidEmptyArray = 'invalidEmptyArray',
|
|
396
|
+
invalidEmptyObject = 'invalidEmptyObject',
|
|
396
397
|
invalidListOfValuesValue = 'invalidListOfValuesValue',
|
|
397
398
|
fragmentNameNotFound = 'fragmentNameNotFound',
|
|
398
399
|
fragmentNameAlreadyInUse = 'fragmentNameAlreadyInUse',
|
|
@@ -414,5 +415,7 @@ export enum SchemaFieldViolationCodes {
|
|
|
414
415
|
extensionNotSupportedForType = 'extensionNotSupportedForType',
|
|
415
416
|
translatableNotAllowed = 'translatableNotAllowed',
|
|
416
417
|
invalidEnumValue = 'invalidEnumValue',
|
|
417
|
-
compactCannotBeNested = 'compactCannotBeNested'
|
|
418
|
+
compactCannotBeNested = 'compactCannotBeNested',
|
|
419
|
+
segmentTypeNotAllowed = 'segmentTypeNotAllowed',
|
|
420
|
+
segmentNameNotFound = 'segmentNameNotFound'
|
|
418
421
|
}
|
|
@@ -21,6 +21,7 @@ export enum SchemaTypeIds {
|
|
|
21
21
|
ARRAY = 'array',
|
|
22
22
|
SLUG = 'slug',
|
|
23
23
|
MEDIA = 'media',
|
|
24
|
+
SEGMENTED = 'segmented',
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
/**
|
|
@@ -319,6 +320,67 @@ export type OneLinkedContentOfConstraints = {
|
|
|
319
320
|
linkType?: LinkType;
|
|
320
321
|
};
|
|
321
322
|
|
|
323
|
+
/**
|
|
324
|
+
* This type represent one segment of a segmented field: the same `{ type, constraints }` pair a
|
|
325
|
+
* schema field carries, minus the name, because the map key in `SegmentsTable` is the name
|
|
326
|
+
*
|
|
327
|
+
* `oneLinkedContentOf` is the only reference form admitted, `linked-content` is its single
|
|
328
|
+
* definition special case and carries the identical payload value
|
|
329
|
+
*/
|
|
330
|
+
export type SegmentDescriptor =
|
|
331
|
+
| { type: SchemaTypeIds.FRAGMENT; constraints: FragmentFieldConstraints; }
|
|
332
|
+
| { type: SchemaTypeIds.ONE_FRAGMENT_OF; constraints: OneFragmentOfConstraints; }
|
|
333
|
+
| { type: SchemaTypeIds.ONE_LINKED_CONTENT_OF; constraints: OneLinkedContentOfConstraints; };
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* This type represent the model to define a segment of a segmented field
|
|
337
|
+
*/
|
|
338
|
+
export type SegmentDefinition = SegmentDescriptor & {
|
|
339
|
+
/**
|
|
340
|
+
* The friendly labels of the segment
|
|
341
|
+
*/
|
|
342
|
+
labels?: I18NDictionary;
|
|
343
|
+
};
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* This type represent the model of the attribute segments of a segmented field, keyed by segment
|
|
347
|
+
* name, like `FragmentsTable`
|
|
348
|
+
* Names must match `^[a-z0-9_-]+$` and are unordered
|
|
349
|
+
*/
|
|
350
|
+
export type SegmentsTable = {
|
|
351
|
+
/**
|
|
352
|
+
* The name is the unique id of the segment and its value is the model representing the segment
|
|
353
|
+
*/
|
|
354
|
+
[name: string]: SegmentDefinition;
|
|
355
|
+
};
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* This enum constrains every segment of a field to one family
|
|
359
|
+
* When omitted, segments of both families are allowed in the same field
|
|
360
|
+
*/
|
|
361
|
+
export enum SegmentsType {
|
|
362
|
+
FRAGMENTS = 'fragments',
|
|
363
|
+
REFERENCES = 'references'
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* This type represent the model of a segmented field constraints
|
|
368
|
+
*/
|
|
369
|
+
export type SegmentedFieldConstraints = {
|
|
370
|
+
/**
|
|
371
|
+
* Set this value to define the segments the field is made of
|
|
372
|
+
*/
|
|
373
|
+
segments: SegmentsTable;
|
|
374
|
+
/**
|
|
375
|
+
* Set this value to define the segment served when the request matches none of this field's segments
|
|
376
|
+
*/
|
|
377
|
+
defaultSegment?: string;
|
|
378
|
+
/**
|
|
379
|
+
* Set this value to constrain every segment of the field to one family
|
|
380
|
+
*/
|
|
381
|
+
segmentsType?: SegmentsType;
|
|
382
|
+
};
|
|
383
|
+
|
|
322
384
|
/**
|
|
323
385
|
* This type represent the model of an array field constraints
|
|
324
386
|
* @template T The type of the item used ad children of the array
|
|
@@ -483,6 +545,11 @@ export type OneFragmentOfSchemaType = SchemaType<SchemaTypeIds.ONE_FRAGMENT_OF,
|
|
|
483
545
|
*/
|
|
484
546
|
export type OneLinkedContentOfSchemaType = IndexableSchemaType<SchemaTypeIds.ONE_LINKED_CONTENT_OF, OneLinkedContentOfConstraints>;
|
|
485
547
|
|
|
548
|
+
/**
|
|
549
|
+
* This type represent a segmented field schema type
|
|
550
|
+
*/
|
|
551
|
+
export type SegmentedSchemaType = SchemaType<SchemaTypeIds.SEGMENTED, SegmentedFieldConstraints>;
|
|
552
|
+
|
|
486
553
|
/**
|
|
487
554
|
* Slug schema type
|
|
488
555
|
* This type is indexable and translatable by default
|
|
@@ -515,7 +582,7 @@ export type TranslatableSchemaTypes = NumberSchemaType | TextSchemaType | LongTe
|
|
|
515
582
|
/**
|
|
516
583
|
* This type group all the schema types of a content definition that are not indexable
|
|
517
584
|
*/
|
|
518
|
-
export type PlainSchemaTypes = DateSchemaType | FragmentSchemaType | OneFragmentOfSchemaType | SlugSchemaType;
|
|
585
|
+
export type PlainSchemaTypes = DateSchemaType | FragmentSchemaType | OneFragmentOfSchemaType | SlugSchemaType | SegmentedSchemaType;
|
|
519
586
|
|
|
520
587
|
/**
|
|
521
588
|
* This type group all schema types of a content definition
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentchef/contentchef-types",
|
|
3
|
-
"version": "11.0.0-alpha.
|
|
3
|
+
"version": "11.0.0-alpha.1",
|
|
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": "^5.9.3"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "b618c00d0b1642ac9a75685fa08e214b83e22fc8"
|
|
38
38
|
}
|