@contentchef/contentchef-types 11.0.0 → 11.1.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/Component.d.ts +574 -0
- package/dist/api/Component.js +52 -0
- package/dist/api/Content.d.ts +15 -2
- package/dist/api/ContentDefinition.d.ts +41 -5
- package/dist/api/ContentDefinition.js +3 -0
- package/dist/api/ContentDefinitionSchema.d.ts +37 -0
- package/dist/api/index.d.ts +1 -0
- package/dist/api/index.js +1 -0
- package/lib/api/Component.ts +592 -0
- package/lib/api/Content.ts +15 -2
- package/lib/api/ContentDefinition.ts +43 -5
- package/lib/api/ContentDefinitionSchema.ts +40 -0
- package/lib/api/index.ts +1 -0
- package/package.json +2 -2
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AuthorResponse } from './Author';
|
|
2
2
|
import { PagedListResponse } from './common';
|
|
3
|
-
import {
|
|
3
|
+
import { DefinitionMigrationState, FieldChanges } from './Component';
|
|
4
|
+
import { ComponentMarker, ContentDefinitionSchema, ContentDefinitionSchemaInput, Field, I18NDictionary } from './ContentDefinitionSchema';
|
|
4
5
|
import { Extension } from './Extension';
|
|
5
6
|
|
|
6
7
|
/**
|
|
@@ -108,7 +109,7 @@ export type CreateContentDefinitionRequest = {
|
|
|
108
109
|
/**
|
|
109
110
|
* The content definition fields schema
|
|
110
111
|
*/
|
|
111
|
-
schema:
|
|
112
|
+
schema: ContentDefinitionSchemaInput;
|
|
112
113
|
|
|
113
114
|
/**
|
|
114
115
|
* will bypass content definition mnemonicId validation for every linked-content field
|
|
@@ -135,7 +136,7 @@ export type UpdateContentDefinitionRequest = {
|
|
|
135
136
|
/**
|
|
136
137
|
* The content definition fields schema
|
|
137
138
|
*/
|
|
138
|
-
schema:
|
|
139
|
+
schema: ContentDefinitionSchemaInput;
|
|
139
140
|
|
|
140
141
|
/**
|
|
141
142
|
* will bypass content definition mnemonicId validation for every linked-content field
|
|
@@ -189,6 +190,31 @@ export type ContentDefinitionResponse = {
|
|
|
189
190
|
* Valued with paths to each array or null if definition is legacy
|
|
190
191
|
*/
|
|
191
192
|
trackableArrayFields?: ArrayField[] | null;
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* The components the definition's managed fragments copy, one per component
|
|
196
|
+
*/
|
|
197
|
+
components: ComponentMarker[];
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* This type represent one component a definition uses, as the get content definition API request
|
|
202
|
+
* describes it
|
|
203
|
+
*/
|
|
204
|
+
export type DefinitionComponent = ComponentMarker & {
|
|
205
|
+
/**
|
|
206
|
+
* The component latest version
|
|
207
|
+
*/
|
|
208
|
+
latestVersion: number;
|
|
209
|
+
/**
|
|
210
|
+
* The archived status of the component
|
|
211
|
+
*/
|
|
212
|
+
archived: boolean;
|
|
213
|
+
/**
|
|
214
|
+
* What upgrading from `version` to `latestVersion` would add, remove, change and rename, all empty
|
|
215
|
+
* when up to date. What it would do to the contents is only known by previewing it
|
|
216
|
+
*/
|
|
217
|
+
changes: FieldChanges;
|
|
192
218
|
};
|
|
193
219
|
|
|
194
220
|
/**
|
|
@@ -202,7 +228,16 @@ export type UpdateContentDefinitionResponse = ContentDefinitionResponse;
|
|
|
202
228
|
/**
|
|
203
229
|
* This type represent the response of a get content definition API request
|
|
204
230
|
*/
|
|
205
|
-
export type GetContentDefinitionResponse = ContentDefinitionResponse
|
|
231
|
+
export type GetContentDefinitionResponse = (Omit<ContentDefinitionResponse, 'components'> & {
|
|
232
|
+
/**
|
|
233
|
+
* The components the definition uses, each with its latest version and what upgrading to it changes
|
|
234
|
+
*/
|
|
235
|
+
components: DefinitionComponent[];
|
|
236
|
+
/**
|
|
237
|
+
* Where the definition's contents stand in its migrations
|
|
238
|
+
*/
|
|
239
|
+
migration: DefinitionMigrationState;
|
|
240
|
+
}) | undefined;
|
|
206
241
|
|
|
207
242
|
/**
|
|
208
243
|
* This type represent the data needed to make a validate definition field API request
|
|
@@ -416,5 +451,8 @@ export enum SchemaFieldViolationCodes {
|
|
|
416
451
|
translatableNotAllowed = 'translatableNotAllowed',
|
|
417
452
|
invalidEnumValue = 'invalidEnumValue',
|
|
418
453
|
compactCannotBeNested = 'compactCannotBeNested',
|
|
419
|
-
variantTypeNotAllowed = 'variantTypeNotAllowed'
|
|
454
|
+
variantTypeNotAllowed = 'variantTypeNotAllowed',
|
|
455
|
+
componentArchived = 'componentArchived',
|
|
456
|
+
componentNotPublished = 'componentNotPublished',
|
|
457
|
+
invalidComponentMarker = 'invalidComponentMarker'
|
|
420
458
|
}
|
|
@@ -76,6 +76,46 @@ export type FragmentDefinition = {
|
|
|
76
76
|
* The friendly labels of the fragment
|
|
77
77
|
*/
|
|
78
78
|
labels?: I18NDictionary;
|
|
79
|
+
/**
|
|
80
|
+
* Set on a managed fragment: a copy of a component version, keyed by the component's mnemonic id,
|
|
81
|
+
* that the backend writes and nobody edits by hand. Saving a definition with the marker alone has
|
|
82
|
+
* the backend fill in labels and fields, and saving it with a later `version` upgrades the fragment
|
|
83
|
+
*/
|
|
84
|
+
component?: ComponentMarker;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* This type represent a content definition schema as the create and update content definition API
|
|
89
|
+
* requests take it, whose managed fragments may leave out their labels and fields
|
|
90
|
+
*/
|
|
91
|
+
export type ContentDefinitionSchemaInput = Omit<ContentDefinitionSchema, 'fragments'> & {
|
|
92
|
+
fragments: {
|
|
93
|
+
[name: string]: FragmentDefinition | ManagedFragmentInput;
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* This type represent a managed fragment as a definition save may send it: labels and fields left out
|
|
99
|
+
* are filled in from the component version, and labels and fields sent must be the version's
|
|
100
|
+
*/
|
|
101
|
+
export type ManagedFragmentInput = {
|
|
102
|
+
component: ComponentMarker;
|
|
103
|
+
labels?: I18NDictionary;
|
|
104
|
+
fields?: Field[];
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* This type represent the marker of a managed fragment, naming the component and the version it copies
|
|
109
|
+
*/
|
|
110
|
+
export type ComponentMarker = {
|
|
111
|
+
/**
|
|
112
|
+
* The component mnemonic id, which is also the fragment's key in the schema
|
|
113
|
+
*/
|
|
114
|
+
mnemonicId: string;
|
|
115
|
+
/**
|
|
116
|
+
* The component version the fragment copies
|
|
117
|
+
*/
|
|
118
|
+
version: number;
|
|
79
119
|
};
|
|
80
120
|
|
|
81
121
|
/**
|
package/lib/api/index.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentchef/contentchef-types",
|
|
3
|
-
"version": "11.0.
|
|
3
|
+
"version": "11.1.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": "8970d38d1236984dee510da19687d73078f76a70"
|
|
38
38
|
}
|