@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.
@@ -1,6 +1,7 @@
1
1
  import { AuthorResponse } from './Author';
2
2
  import { PagedListResponse } from './common';
3
- import { ContentDefinitionSchema, Field, I18NDictionary } from './ContentDefinitionSchema';
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
  * This type represent the unique content definition id type
@@ -100,7 +101,7 @@ export type CreateContentDefinitionRequest = {
100
101
  /**
101
102
  * The content definition fields schema
102
103
  */
103
- schema: ContentDefinitionSchema;
104
+ schema: ContentDefinitionSchemaInput;
104
105
  /**
105
106
  * will bypass content definition mnemonicId validation for every linked-content field
106
107
  */
@@ -125,7 +126,7 @@ export type UpdateContentDefinitionRequest = {
125
126
  /**
126
127
  * The content definition fields schema
127
128
  */
128
- schema: ContentDefinitionSchema;
129
+ schema: ContentDefinitionSchemaInput;
129
130
  /**
130
131
  * will bypass content definition mnemonicId validation for every linked-content field
131
132
  */
@@ -175,6 +176,29 @@ export type ContentDefinitionResponse = {
175
176
  * Valued with paths to each array or null if definition is legacy
176
177
  */
177
178
  trackableArrayFields?: ArrayField[] | null;
179
+ /**
180
+ * The components the definition's managed fragments copy, one per component
181
+ */
182
+ components: ComponentMarker[];
183
+ };
184
+ /**
185
+ * This type represent one component a definition uses, as the get content definition API request
186
+ * describes it
187
+ */
188
+ export type DefinitionComponent = ComponentMarker & {
189
+ /**
190
+ * The component latest version
191
+ */
192
+ latestVersion: number;
193
+ /**
194
+ * The archived status of the component
195
+ */
196
+ archived: boolean;
197
+ /**
198
+ * What upgrading from `version` to `latestVersion` would add, remove, change and rename, all empty
199
+ * when up to date. What it would do to the contents is only known by previewing it
200
+ */
201
+ changes: FieldChanges;
178
202
  };
179
203
  /**
180
204
  * This type represent the response of a create content definition API request
@@ -187,7 +211,16 @@ export type UpdateContentDefinitionResponse = ContentDefinitionResponse;
187
211
  /**
188
212
  * This type represent the response of a get content definition API request
189
213
  */
190
- export type GetContentDefinitionResponse = ContentDefinitionResponse | undefined;
214
+ export type GetContentDefinitionResponse = (Omit<ContentDefinitionResponse, 'components'> & {
215
+ /**
216
+ * The components the definition uses, each with its latest version and what upgrading to it changes
217
+ */
218
+ components: DefinitionComponent[];
219
+ /**
220
+ * Where the definition's contents stand in its migrations
221
+ */
222
+ migration: DefinitionMigrationState;
223
+ }) | undefined;
191
224
  /**
192
225
  * This type represent the data needed to make a validate definition field API request
193
226
  */
@@ -389,5 +422,8 @@ export declare enum SchemaFieldViolationCodes {
389
422
  translatableNotAllowed = "translatableNotAllowed",
390
423
  invalidEnumValue = "invalidEnumValue",
391
424
  compactCannotBeNested = "compactCannotBeNested",
392
- variantTypeNotAllowed = "variantTypeNotAllowed"
425
+ variantTypeNotAllowed = "variantTypeNotAllowed",
426
+ componentArchived = "componentArchived",
427
+ componentNotPublished = "componentNotPublished",
428
+ invalidComponentMarker = "invalidComponentMarker"
393
429
  }
@@ -46,4 +46,7 @@ var SchemaFieldViolationCodes;
46
46
  SchemaFieldViolationCodes["invalidEnumValue"] = "invalidEnumValue";
47
47
  SchemaFieldViolationCodes["compactCannotBeNested"] = "compactCannotBeNested";
48
48
  SchemaFieldViolationCodes["variantTypeNotAllowed"] = "variantTypeNotAllowed";
49
+ SchemaFieldViolationCodes["componentArchived"] = "componentArchived";
50
+ SchemaFieldViolationCodes["componentNotPublished"] = "componentNotPublished";
51
+ SchemaFieldViolationCodes["invalidComponentMarker"] = "invalidComponentMarker";
49
52
  })(SchemaFieldViolationCodes || (exports.SchemaFieldViolationCodes = SchemaFieldViolationCodes = {}));
@@ -71,6 +71,43 @@ export type FragmentDefinition = {
71
71
  * The friendly labels of the fragment
72
72
  */
73
73
  labels?: I18NDictionary;
74
+ /**
75
+ * Set on a managed fragment: a copy of a component version, keyed by the component's mnemonic id,
76
+ * that the backend writes and nobody edits by hand. Saving a definition with the marker alone has
77
+ * the backend fill in labels and fields, and saving it with a later `version` upgrades the fragment
78
+ */
79
+ component?: ComponentMarker;
80
+ };
81
+ /**
82
+ * This type represent a content definition schema as the create and update content definition API
83
+ * requests take it, whose managed fragments may leave out their labels and fields
84
+ */
85
+ export type ContentDefinitionSchemaInput = Omit<ContentDefinitionSchema, 'fragments'> & {
86
+ fragments: {
87
+ [name: string]: FragmentDefinition | ManagedFragmentInput;
88
+ };
89
+ };
90
+ /**
91
+ * This type represent a managed fragment as a definition save may send it: labels and fields left out
92
+ * are filled in from the component version, and labels and fields sent must be the version's
93
+ */
94
+ export type ManagedFragmentInput = {
95
+ component: ComponentMarker;
96
+ labels?: I18NDictionary;
97
+ fields?: Field[];
98
+ };
99
+ /**
100
+ * This type represent the marker of a managed fragment, naming the component and the version it copies
101
+ */
102
+ export type ComponentMarker = {
103
+ /**
104
+ * The component mnemonic id, which is also the fragment's key in the schema
105
+ */
106
+ mnemonicId: string;
107
+ /**
108
+ * The component version the fragment copies
109
+ */
110
+ version: number;
74
111
  };
75
112
  /**
76
113
  * This type represent the base model of a schema field
@@ -3,6 +3,7 @@ export * from './AuditLog';
3
3
  export * from './Author';
4
4
  export * from './Channel';
5
5
  export * from './Content';
6
+ export * from './Component';
6
7
  export * from './ContentDefinition';
7
8
  export * from './ContentDefinitionSchema';
8
9
  export * from './ContentExportImport';
package/dist/api/index.js CHANGED
@@ -19,6 +19,7 @@ __exportStar(require("./AuditLog"), exports);
19
19
  __exportStar(require("./Author"), exports);
20
20
  __exportStar(require("./Channel"), exports);
21
21
  __exportStar(require("./Content"), exports);
22
+ __exportStar(require("./Component"), exports);
22
23
  __exportStar(require("./ContentDefinition"), exports);
23
24
  __exportStar(require("./ContentDefinitionSchema"), exports);
24
25
  __exportStar(require("./ContentExportImport"), exports);