@kontent-ai/migration-toolkit 1.3.0 → 1.4.0
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/README.md +82 -67
- package/dist/es2022/core/models/migration.models.d.ts +9 -9
- package/dist/es2022/core/utils/management-client-utils.js +1 -1
- package/dist/es2022/core/utils/management-client-utils.js.map +1 -1
- package/dist/es2022/import/importers/language-variant-importer.js +10 -6
- package/dist/es2022/import/importers/language-variant-importer.js.map +1 -1
- package/dist/es2022/metadata.js +2 -2
- package/dist/es2022/translation/transforms/export-transforms.js +1 -1
- package/dist/es2022/translation/transforms/export-transforms.js.map +1 -1
- package/lib/core/models/migration.models.ts +13 -12
- package/lib/core/models/migration.schema.ts +178 -178
- package/lib/core/utils/management-client-utils.ts +4 -10
- package/lib/import/importers/language-variant-importer.ts +17 -29
- package/lib/metadata.ts +2 -2
- package/lib/translation/transforms/export-transforms.ts +1 -1
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
# Kontent.ai Migration Toolkit
|
|
2
2
|
|
|
3
|
-
The purpose of this tool is to facilitate _content migration_ to & from [Kontent.ai](https://kontent.ai) environments.
|
|
4
|
-
|
|
5
|
-
environments.
|
|
3
|
+
The purpose of this tool is to facilitate _content migration_ to & from [Kontent.ai](https://kontent.ai) environments. It can be used to
|
|
4
|
+
simplify migration from external systems and also provides a built-in migration between kontent.ai environments.
|
|
6
5
|
|
|
7
6
|
> [!TIP]
|
|
8
|
-
> This library aims to streamline the migration to / from Kontent.ai environments by providing an abstraction layer
|
|
9
|
-
>
|
|
10
|
-
>
|
|
7
|
+
> This library aims to streamline the migration to / from Kontent.ai environments by providing an abstraction layer which handles creation /
|
|
8
|
+
> updates of content items, language variants, moving items through workflow, publishing, archiving, downloading binary data, uploading
|
|
9
|
+
> assets, `id` to `codename` translation and more.
|
|
11
10
|
|
|
12
11
|
This library can only be used as a library both in `node.js` & `browser` or as a `CLI` utility.
|
|
13
12
|
|
|
@@ -36,8 +35,7 @@ kontent-ai-migration-toolkit migrate --help
|
|
|
36
35
|
4. [Migrate content between Kontent.ai environments](https://github.com/Kontent-ai/kontent-ai-migration-toolkit/blob/main/samples/migrate-between-kontent-ai-environments.ts)
|
|
37
36
|
|
|
38
37
|
> [!NOTE]
|
|
39
|
-
> You can run `kontent-ai-migration-toolkit` many times over without being worried that duplicate content items / assets
|
|
40
|
-
> are created.
|
|
38
|
+
> You can run `kontent-ai-migration-toolkit` many times over without being worried that duplicate content items / assets are created.
|
|
41
39
|
|
|
42
40
|
# Migrate between Kontent.ai environments
|
|
43
41
|
|
|
@@ -69,14 +67,13 @@ kontent-ai-migration-toolkit migrate --targetEnvironmentId=x --targetApiKey=x --
|
|
|
69
67
|
# Import
|
|
70
68
|
|
|
71
69
|
> [!CAUTION]
|
|
72
|
-
> **We do not recommended importing into a production environment directly without testing**. Instead you should first
|
|
73
|
-
>
|
|
70
|
+
> **We do not recommended importing into a production environment directly without testing**. Instead you should first create a testing
|
|
71
|
+
> environment and run the script there to make sure everything works as you intended to.
|
|
74
72
|
|
|
75
73
|
> [!NOTE]
|
|
76
|
-
> When importing it is essential that the target project structure (i.e. `Content types`, `Taxonomies`, `Collections`,
|
|
77
|
-
> `
|
|
78
|
-
>
|
|
79
|
-
> fail.
|
|
74
|
+
> When importing it is essential that the target project structure (i.e. `Content types`, `Taxonomies`, `Collections`, `Workflows`,
|
|
75
|
+
> `languages`...) are consistent with the ones defined in source environment. Any inconsistency in data such as referencing inexistent
|
|
76
|
+
> taxonomy term, incorrect element type and other inconsistencies may cause import to fail.
|
|
80
77
|
|
|
81
78
|
## Configuration
|
|
82
79
|
|
|
@@ -97,8 +94,8 @@ kontent-ai-migration-toolkit import --targetEnvironmentId=x --targetApiKey=x --f
|
|
|
97
94
|
|
|
98
95
|
# Migrate from Kontent.ai
|
|
99
96
|
|
|
100
|
-
This library can also be used to export content items & assets from Kontent.ai environments. However, when migration
|
|
101
|
-
|
|
97
|
+
This library can also be used to export content items & assets from Kontent.ai environments. However, when migration from 3rd party system
|
|
98
|
+
you typically only use the `import` capabilities of this repository.
|
|
102
99
|
|
|
103
100
|
## Configuration
|
|
104
101
|
|
|
@@ -120,27 +117,38 @@ kontent-ai-migration-toolkit export --sourceEnvironmentId=x --sourceApiKey=x --l
|
|
|
120
117
|
|
|
121
118
|
# Migrate from external systems
|
|
122
119
|
|
|
123
|
-
You can use this library when exporting from 3rd party systems (i.e. legacy CMS) as it will abstract your from using
|
|
124
|
-
|
|
120
|
+
You can use this library when exporting from 3rd party systems (i.e. legacy CMS) as it will abstract your from using Kontent.ai Management
|
|
121
|
+
API directly.
|
|
125
122
|
|
|
126
|
-
The main focus is therefore on transforming the data you need to migrate into a format this library supports. The main
|
|
127
|
-
|
|
123
|
+
The main focus is therefore on transforming the data you need to migrate into a format this library supports. The main migration models are
|
|
124
|
+
`MigrationItem` and `MigrationAsset`. For creating element values `elementsBuilder`.
|
|
128
125
|
|
|
129
126
|
See below example of using a strongly typed model and migrating a single item with an asset.
|
|
130
127
|
|
|
131
128
|
```typescript
|
|
132
129
|
/**
|
|
133
|
-
* Optionally (but
|
|
134
|
-
* representing the
|
|
130
|
+
* Optionally (but highly recommended) you may define a migration model
|
|
131
|
+
* representing the environment you are trying to migrate into.
|
|
135
132
|
*/
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
133
|
+
type LanguageCodenames = 'default' | 'en';
|
|
134
|
+
type CollectionCodenames = 'default' | 'global';
|
|
135
|
+
type WorkflowCodenames = 'default' | 'custom';
|
|
136
|
+
type ContentTypeCodenames = 'article' | 'author';
|
|
137
|
+
type WorkflowStepCodenames = 'published' | 'archived' | 'draft';
|
|
138
|
+
type ContentTypeCodename<Codename extends ContentTypeCodenames> = Codename;
|
|
139
|
+
|
|
140
|
+
type ArticleItem = MigrationItem<
|
|
141
|
+
{
|
|
142
|
+
title: MigrationElementModels.TextElement;
|
|
143
|
+
rating: MigrationElementModels.NumberElement;
|
|
144
|
+
related_pages: MigrationElementModels.LinkedItemsElement;
|
|
145
|
+
teaser_image: MigrationElementModels.AssetElement;
|
|
146
|
+
},
|
|
147
|
+
MigrationItemSystem<ContentTypeCodename<'article'>, LanguageCodenames, CollectionCodenames, WorkflowCodenames>,
|
|
148
|
+
WorkflowStepCodenames
|
|
149
|
+
>;
|
|
150
|
+
|
|
151
|
+
const migrationItem: ArticleItem = {
|
|
144
152
|
system: {
|
|
145
153
|
name: 'My article',
|
|
146
154
|
// codename is primary identifier - also used for validating whether asset exists in target env
|
|
@@ -151,29 +159,39 @@ const migrationItem: MigrationItem<ArticleElements> = {
|
|
|
151
159
|
},
|
|
152
160
|
language: {
|
|
153
161
|
// language codename must match the language in your target K.ai environment
|
|
154
|
-
codename: '
|
|
162
|
+
codename: 'en'
|
|
155
163
|
},
|
|
156
164
|
type: {
|
|
157
165
|
// type codename must match the content type codename in your target K.ai environment
|
|
158
166
|
codename: 'article'
|
|
167
|
+
},
|
|
168
|
+
workflow: {
|
|
169
|
+
codename: 'default'
|
|
159
170
|
}
|
|
160
171
|
},
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
},
|
|
169
|
-
{
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
172
|
+
versions: [
|
|
173
|
+
{
|
|
174
|
+
workflow_step: {
|
|
175
|
+
codename: 'published'
|
|
176
|
+
},
|
|
177
|
+
elements: {
|
|
178
|
+
title: elementsBuilder.textElement({ value: 'Title of the article' }),
|
|
179
|
+
rating: elementsBuilder.numberElement({ value: 5 }),
|
|
180
|
+
related_pages: elementsBuilder.linkedItemsElement({
|
|
181
|
+
value: [
|
|
182
|
+
{
|
|
183
|
+
codename: 'pageA'
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
codename: 'pageB'
|
|
187
|
+
}
|
|
188
|
+
]
|
|
189
|
+
}),
|
|
190
|
+
// assets are referenced by their codename
|
|
191
|
+
teaser_image: elementsBuilder.assetElement({ value: [{ codename: 'article_teaser' }] })
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
]
|
|
177
195
|
};
|
|
178
196
|
|
|
179
197
|
const migrationAsset: MigrationAsset = {
|
|
@@ -218,21 +236,20 @@ await importAsync({
|
|
|
218
236
|
|
|
219
237
|
### How are content items imported?
|
|
220
238
|
|
|
221
|
-
The Migration Toolkit creates content items that are not present in target project. If the content item exists in target
|
|
222
|
-
|
|
223
|
-
|
|
239
|
+
The Migration Toolkit creates content items that are not present in target project. If the content item exists in target project (based on
|
|
240
|
+
item's `codename`) the item will be updated, otherwise it will be created. No duplicate items will be created. The workflow of the item in
|
|
241
|
+
target environment will be set to match the source environment.
|
|
224
242
|
|
|
225
243
|
### How are assets imported?
|
|
226
244
|
|
|
227
|
-
If asset exists in target project (based on asset's `codename`), the asset upload will be skipped and not uploaded at
|
|
228
|
-
|
|
245
|
+
If asset exists in target project (based on asset's `codename`), the asset upload will be skipped and not uploaded at all. Otherwise the
|
|
246
|
+
asset will be created in target environment.
|
|
229
247
|
|
|
230
248
|
### How are referenced content items & asset handled?
|
|
231
249
|
|
|
232
|
-
If you have a reference to a content item or asset (i.e. in linked items element, asset element, rich text element...)
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
creates a placeholder for the item until it becomes available.
|
|
250
|
+
If you have a reference to a content item or asset (i.e. in linked items element, asset element, rich text element...) the migration toolkit
|
|
251
|
+
first checks whether the referenced object exists (based on item or asset `codename`) and if it does, successfuly sets the reference. If the
|
|
252
|
+
object does not exist, it will be referenced by an `external_id` which creates a placeholder for the item until it becomes available.
|
|
236
253
|
|
|
237
254
|
See the table below to learn how `external_id` is generated by default:
|
|
238
255
|
|
|
@@ -241,25 +258,23 @@ See the table below to learn how `external_id` is generated by default:
|
|
|
241
258
|
| **Asset** | `asset_{codename}` | my_file | `asset_my_file` |
|
|
242
259
|
| **Content item** | `item_{codename}` | article | `item_article` |
|
|
243
260
|
|
|
244
|
-
If you need to change the way `external_id` is created, you may supply a custom implementation of `externalIdGenerator`
|
|
245
|
-
|
|
261
|
+
If you need to change the way `external_id` is created, you may supply a custom implementation of `externalIdGenerator` within import /
|
|
262
|
+
migrate functions.
|
|
246
263
|
|
|
247
264
|
## Limitations
|
|
248
265
|
|
|
249
|
-
1. Asset folder assignments are not preserved during migration because folders can be referenced only by id's and not
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
3. Language variants in `Scheduled` workflow step do not preserve their workflow status because the API does not provide
|
|
254
|
-
an information about scheduled times
|
|
266
|
+
1. Asset folder assignments are not preserved during migration because folders can be referenced only by id's and not codenames.
|
|
267
|
+
2. Assets element values are not preserved during migration because elements can be referenced only by id's and not codenames.
|
|
268
|
+
3. Language variants in `Scheduled` workflow step do not preserve their workflow status because the API does not provide an information
|
|
269
|
+
about scheduled times
|
|
255
270
|
|
|
256
271
|
## FAQ
|
|
257
272
|
|
|
258
273
|
### I'm getting `Header overflow` exception
|
|
259
274
|
|
|
260
|
-
The Node.js limits the maximum header size of HTTP requests. In some cases it may be required for you to increase this
|
|
261
|
-
|
|
262
|
-
|
|
275
|
+
The Node.js limits the maximum header size of HTTP requests. In some cases it may be required for you to increase this limitation to be able
|
|
276
|
+
to successfully fetch data from Kontent.ai. You can do so by using the `max-http-header-size` option
|
|
277
|
+
(https://nodejs.org/api/cli.html#--max-http-header-sizesize)
|
|
263
278
|
|
|
264
279
|
Example script call:
|
|
265
280
|
|
|
@@ -21,13 +21,13 @@ export declare namespace MigrationElementModels {
|
|
|
21
21
|
export type MigrationReference<T extends string = string> = z.infer<typeof MigrationReferenceSchema> & {
|
|
22
22
|
readonly codename: T;
|
|
23
23
|
};
|
|
24
|
-
export type MigrationItemSystem<
|
|
24
|
+
export type MigrationItemSystem<TTypeCodenames extends string = string, TLanguageCodenames extends string = string, TCollectionCodenames extends string = string, TWorkflowCodenames extends string = string> = z.infer<typeof MigrationItemSystemSchema> & {
|
|
25
25
|
readonly codename: string;
|
|
26
26
|
readonly name: string;
|
|
27
|
-
readonly language: MigrationReference<
|
|
28
|
-
readonly type: MigrationReference<
|
|
29
|
-
readonly collection: MigrationReference<
|
|
30
|
-
readonly workflow: MigrationReference<
|
|
27
|
+
readonly language: MigrationReference<TLanguageCodenames>;
|
|
28
|
+
readonly type: MigrationReference<TTypeCodenames>;
|
|
29
|
+
readonly collection: MigrationReference<TCollectionCodenames>;
|
|
30
|
+
readonly workflow: MigrationReference<TWorkflowCodenames>;
|
|
31
31
|
};
|
|
32
32
|
export type MigrationUrlSlugMode = z.infer<typeof MigrationUrlSlugModeSchema>;
|
|
33
33
|
export type MigrationElementType = z.infer<typeof MigrationElementTypeSchema>;
|
|
@@ -40,11 +40,11 @@ export type MigrationElements = z.infer<typeof MigrationElementsSchema>;
|
|
|
40
40
|
export type MigrationAssetDescription = z.infer<typeof MigrationAssetDescriptionSchema>;
|
|
41
41
|
export type MigrationAsset = z.infer<typeof MigrationAssetSchema>;
|
|
42
42
|
export type MigrationData = z.infer<typeof MigrationDataSchema>;
|
|
43
|
-
export type MigrationItemVersion<TElements extends MigrationElements = MigrationElements,
|
|
43
|
+
export type MigrationItemVersion<TElements extends MigrationElements = MigrationElements, TWorkflowStepCodenames extends string = string> = z.infer<typeof MigrationItemVersionSchema> & {
|
|
44
44
|
readonly elements: Readonly<TElements>;
|
|
45
|
-
readonly workflow_step: MigrationReference<
|
|
45
|
+
readonly workflow_step: MigrationReference<TWorkflowStepCodenames>;
|
|
46
46
|
};
|
|
47
|
-
export type MigrationItem<TElements extends MigrationElements = MigrationElements, TSystem extends MigrationItemSystem = MigrationItemSystem,
|
|
48
|
-
readonly versions: Readonly<MigrationItemVersion<TElements,
|
|
47
|
+
export type MigrationItem<TElements extends MigrationElements = MigrationElements, TSystem extends MigrationItemSystem = MigrationItemSystem, TWorkflowStepCodenames extends string = string> = z.infer<typeof MigrationItemSchema> & {
|
|
48
|
+
readonly versions: Readonly<MigrationItemVersion<TElements, TWorkflowStepCodenames>[]>;
|
|
49
49
|
readonly system: TSystem;
|
|
50
50
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"management-client-utils.js","sourceRoot":"","sources":["../../../../lib/core/utils/management-client-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EASH,sBAAsB,EACzB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAGrD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAShD,MAAM,UAAU,4BAA4B,CAAC,MAA8B;IACvE,OAAO,sBAAsB,CAAC;QAC1B,aAAa,EAAE,MAAM,CAAC,aAAa;QACnC,aAAa,EAAE,MAAM,CAAC,aAAa,IAAI,oBAAoB;QAC3D,WAAW,EAAE,kBAAkB;QAC/B,MAAM,EAAE,MAAM,CAAC,MAAM;KACxB,CAAC,CAAC;AACP,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,MAAkC,EAAE,MAAc;IACpF,MAAM,mBAAmB,GAAG,KAAK,IAA4D,EAAE;QAC3F,OAAO,CAAC,MAAM,MAAM,CAAC,sBAAsB,EAAE,CAAC,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC;IAC5E,CAAC,CAAC;IAEF,MAAM,oBAAoB,GAAG,KAAK,
|
|
1
|
+
{"version":3,"file":"management-client-utils.js","sourceRoot":"","sources":["../../../../lib/core/utils/management-client-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EASH,sBAAsB,EACzB,MAAM,4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UAA0B,EAA4C,EAAE;QACjH,MAAM,YAAY,GAAG,MAAM,mBAAmB,CAAC;YAC3C,MAAM,EAAE,MAAM;YACd,UAAU,EAAE,UAAU;YACtB,IAAI,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,MAAM,MAAM,CAAC,gBAAgB,EAAE,CAAC,YAAY,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK;YAC7E,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,aAAa;SACtB,CAAC,CAAC;QAEH,MAAM,mBAAmB,GAAG,MAAM,mBAAmB,CAAC;YAClD,MAAM,EAAE,MAAM;YACd,UAAU,EAAE,UAAU;YACtB,IAAI,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,MAAM,MAAM,CAAC,uBAAuB,EAAE,CAAC,YAAY,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK;YACpF,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,oBAAoB;SAC7B,CAAC,CAAC;QAEH,OAAO;YACH,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE;gBAChC,MAAM,UAAU,GAAyB;oBACrC,mBAAmB,EAAE,WAAW,CAAC,QAAQ;oBACzC,aAAa,EAAE,WAAW,CAAC,EAAE;oBAC7B,QAAQ,EAAE,sBAAsB,CAAC,WAAW,EAAE,mBAAmB,CAAC;iBACrE,CAAC;gBAEF,OAAO,UAAU,CAAC;YACtB,CAAC,CAAC;SACL,CAAC;IACN,CAAC,CAAC;IAEF,OAAO;QACH,sBAAsB;QACtB,oBAAoB;QACpB,oBAAoB;QACpB,qBAAqB;QACrB,6BAA6B;QAC7B,mBAAmB;KACtB,CAAC;AACN,CAAC"}
|
|
@@ -119,10 +119,7 @@ export function languageVariantImporter(config) {
|
|
|
119
119
|
workflowStepCodenameInTargetEnvironment: lastWorkflowStepCodenameInTargetEnvironment
|
|
120
120
|
});
|
|
121
121
|
}
|
|
122
|
-
return [
|
|
123
|
-
...(publishedLanguageVariant ? [publishedLanguageVariant] : []),
|
|
124
|
-
...(draftLanguageVariant ? [draftLanguageVariant] : [])
|
|
125
|
-
];
|
|
122
|
+
return [...(publishedLanguageVariant ? [publishedLanguageVariant] : []), ...(draftLanguageVariant ? [draftLanguageVariant] : [])];
|
|
126
123
|
};
|
|
127
124
|
const createNewVersionOfLanguageVariantAsync = async (logSpinner, migrationItem) => {
|
|
128
125
|
await runMapiRequestAsync({
|
|
@@ -147,10 +144,17 @@ export function languageVariantImporter(config) {
|
|
|
147
144
|
logger: config.logger,
|
|
148
145
|
func: async () => {
|
|
149
146
|
await config.client
|
|
150
|
-
.
|
|
147
|
+
.changeWorkflowOfLanguageVariant()
|
|
151
148
|
.byItemCodename(migrationItem.system.codename)
|
|
152
149
|
.byLanguageCodename(migrationItem.system.language.codename)
|
|
153
|
-
.
|
|
150
|
+
.withData({
|
|
151
|
+
workflow_identifier: {
|
|
152
|
+
codename: workflow.codename
|
|
153
|
+
},
|
|
154
|
+
step_identifier: {
|
|
155
|
+
codename: firstWorkflowStep.codename
|
|
156
|
+
}
|
|
157
|
+
})
|
|
154
158
|
.toPromise();
|
|
155
159
|
},
|
|
156
160
|
action: 'changeWorkflowStep',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"language-variant-importer.js","sourceRoot":"","sources":["../../../../lib/import/importers/language-variant-importer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"language-variant-importer.js","sourceRoot":"","sources":["../../../../lib/import/importers/language-variant-importer.ts"],"names":[],"mappings":"AACA,OAAO,EAEH,iBAAiB,EACjB,mBAAmB,EAKnB,cAAc,EACd,YAAY,EACf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;A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C;YACD,YAAY,EAAE,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,EAAE;gBAC9C,MAAM,WAAW,GAAG,YAAY,CAC5B,MAAM,CAAC,oBAAoB,EAC3B,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,KAAK,aAAa,CAAC,MAAM,CAAC,QAAQ,EACzD,uCAAuC,KAAK,CAAC,GAAG,CAC5C,aAAa,CAAC,MAAM,CAAC,QAAQ,CAChC,8CAA8C,CAClD,CAAC;gBAEF,OAAO,MAAM,0BAA0B,CAAC,UAAU,EAAE,aAAa,EAAE,WAAW,CAAC,CAAC;YACpF,CAAC;SACJ,CAAC,CACL,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IACtC,CAAC,CAAC;IAEF,OAAO;QACH,WAAW;KACd,CAAC;AACN,CAAC"}
|
package/dist/es2022/metadata.js
CHANGED
|
@@ -143,7 +143,7 @@ function findTaxonomy(termId, taxonomy) {
|
|
|
143
143
|
return taxonomy;
|
|
144
144
|
}
|
|
145
145
|
if (taxonomy.terms) {
|
|
146
|
-
const foundTerm = taxonomy.terms.find((term) => findTaxonomy(
|
|
146
|
+
const foundTerm = taxonomy.terms.find((term) => findTaxonomy(termId, term));
|
|
147
147
|
if (foundTerm) {
|
|
148
148
|
return foundTerm;
|
|
149
149
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"export-transforms.js","sourceRoot":"","sources":["../../../../lib/translation/transforms/export-transforms.ts"],"names":[],"mappings":"AAAA,OAAO,EAKH,YAAY,EACZ,cAAc,EACjB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,CAAC,MAAM,gBAAgB,GAAgE;IACzF,IAAI,EA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,CAAC,YAAY,CAAC,
|
|
1
|
+
{"version":3,"file":"export-transforms.js","sourceRoot":"","sources":["../../../../lib/translation/transforms/export-transforms.ts"],"names":[],"mappings":"AAAA,OAAO,EAKH,YAAY,EACZ,cAAc,EACjB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,CAAC,MAAM,gBAAgB,GAAgE;IACzF,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,QAAQ,EAAE;IACpD,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;QACb,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC;YAC5B,OAAO,SAAS,CAAC;QACrB,CAAC;QAED,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC;YAC1C,MAAM,KAAK,CAAC,0CAA0C,CAAC,CAAC;QAC5D,CAAC;QAED,IAAI,IAAI,CAAC,aAAa,CAAC,KAAK,KAAK,CAAC,EAAE,CAAC;YACjC,OAAO,CAAC,CAAC;QACb,CAAC;QAED,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC;IACrC,CAAC;IACD,SAAS,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,QAAQ,EAAE;IACzD,SAAS,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,sBAAsB,CAAC,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,OAAO,CAAC;IAC7E,KAAK,EAAE,CAAC,IAAI,EAAE,EAAE;QACZ,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC;YAC5B,OAAO,EAAE,CAAC;QACd,CAAC;QAED,IAAI,CAAC,KAAK,CAAC,OAAO,CA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AY,EAAE,CAAC,EAAE,EAAE,EAAE;QACvE,MAAM,SAAS,GAAG,OAAO,CAAC,+BAA+B,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC;QAEnE,IAAI,CAAC,SAAS,EAAE,CAAC;YACb,MAAM,KAAK,CAAC,+BAA+B,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;QACjE,CAAC;QAED,OAAO;YACH,QAAQ,EAAE,SAAS,CAAC,QAAQ;SAC/B,CAAC;IACN,CAAC,CAAC,CAAC,IAAI,CAAC;IAER,mCAAmC;IACnC,YAAY,GAAG,iBAAiB,EAAE,CAAC,eAAe,CAAC,YAAY,EAAE,CAAC,EAAE,EAAE,EAAE;QACpE,MAAM,UAAU,GAAG,OAAO,CAAC,gCAAgC,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC;QAEtE,IAAI,CAAC,UAAU,EAAE,CAAC;YACd,MAAM,KAAK,CAAC,gCAAgC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;QAClE,CAAC;QAED,OAAO;YACH,QAAQ,EAAE,UAAU,CAAC,QAAQ;SAChC,CAAC;IACN,CAAC,CAAC,CAAC,IAAI,CAAC;IAER,OAAO;QACH,UAAU,EAAE,aAAa,CAAC,UAAU;QACpC,KAAK,EAAE,YAAY;KACtB,CAAC;AACN,CAAC"}
|
|
@@ -42,18 +42,19 @@ export namespace MigrationElementModels {
|
|
|
42
42
|
export type MigrationReference<T extends string = string> = z.infer<typeof MigrationReferenceSchema> & {
|
|
43
43
|
readonly codename: T;
|
|
44
44
|
};
|
|
45
|
+
|
|
45
46
|
export type MigrationItemSystem<
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
TTypeCodenames extends string = string,
|
|
48
|
+
TLanguageCodenames extends string = string,
|
|
49
|
+
TCollectionCodenames extends string = string,
|
|
50
|
+
TWorkflowCodenames extends string = string
|
|
50
51
|
> = z.infer<typeof MigrationItemSystemSchema> & {
|
|
51
52
|
readonly codename: string;
|
|
52
53
|
readonly name: string;
|
|
53
|
-
readonly language: MigrationReference<
|
|
54
|
-
readonly type: MigrationReference<
|
|
55
|
-
readonly collection: MigrationReference<
|
|
56
|
-
readonly workflow: MigrationReference<
|
|
54
|
+
readonly language: MigrationReference<TLanguageCodenames>;
|
|
55
|
+
readonly type: MigrationReference<TTypeCodenames>;
|
|
56
|
+
readonly collection: MigrationReference<TCollectionCodenames>;
|
|
57
|
+
readonly workflow: MigrationReference<TWorkflowCodenames>;
|
|
57
58
|
};
|
|
58
59
|
export type MigrationUrlSlugMode = z.infer<typeof MigrationUrlSlugModeSchema>;
|
|
59
60
|
export type MigrationElementType = z.infer<typeof MigrationElementTypeSchema>;
|
|
@@ -69,17 +70,17 @@ export type MigrationData = z.infer<typeof MigrationDataSchema>;
|
|
|
69
70
|
|
|
70
71
|
export type MigrationItemVersion<
|
|
71
72
|
TElements extends MigrationElements = MigrationElements,
|
|
72
|
-
|
|
73
|
+
TWorkflowStepCodenames extends string = string
|
|
73
74
|
> = z.infer<typeof MigrationItemVersionSchema> & {
|
|
74
75
|
readonly elements: Readonly<TElements>;
|
|
75
|
-
readonly workflow_step: MigrationReference<
|
|
76
|
+
readonly workflow_step: MigrationReference<TWorkflowStepCodenames>;
|
|
76
77
|
};
|
|
77
78
|
|
|
78
79
|
export type MigrationItem<
|
|
79
80
|
TElements extends MigrationElements = MigrationElements,
|
|
80
81
|
TSystem extends MigrationItemSystem = MigrationItemSystem,
|
|
81
|
-
|
|
82
|
+
TWorkflowStepCodenames extends string = string
|
|
82
83
|
> = z.infer<typeof MigrationItemSchema> & {
|
|
83
|
-
readonly versions: Readonly<MigrationItemVersion<TElements,
|
|
84
|
+
readonly versions: Readonly<MigrationItemVersion<TElements, TWorkflowStepCodenames>[]>;
|
|
84
85
|
readonly system: TSystem;
|
|
85
86
|
};
|
|
@@ -1,178 +1,178 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
|
|
3
|
-
interface Elements {
|
|
4
|
-
readonly [key: string]: Element;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
type UrlSlugMode = 'autogenerated' | 'custom';
|
|
8
|
-
|
|
9
|
-
type UrlSlugElementValue = {
|
|
10
|
-
readonly value?: string;
|
|
11
|
-
readonly mode: UrlSlugMode;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
type Reference = { readonly codename: string };
|
|
15
|
-
|
|
16
|
-
type Component = {
|
|
17
|
-
readonly system: {
|
|
18
|
-
readonly id: string;
|
|
19
|
-
readonly type: Reference;
|
|
20
|
-
};
|
|
21
|
-
readonly elements: Elements;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
type RichTextElementValue = {
|
|
25
|
-
readonly value: string;
|
|
26
|
-
readonly components: Readonly<Component[]>;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
type ElementValue = string | undefined | number | Reference[] | RichTextElementValue | UrlSlugElementValue;
|
|
30
|
-
|
|
31
|
-
type Element = {
|
|
32
|
-
readonly type: ElementType;
|
|
33
|
-
readonly value?: ElementValue;
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
type ElementType =
|
|
37
|
-
| 'text'
|
|
38
|
-
| 'rich_text'
|
|
39
|
-
| 'number'
|
|
40
|
-
| 'multiple_choice'
|
|
41
|
-
| 'date_time'
|
|
42
|
-
| 'asset'
|
|
43
|
-
| 'modular_content'
|
|
44
|
-
| 'taxonomy'
|
|
45
|
-
| 'url_slug'
|
|
46
|
-
| 'custom'
|
|
47
|
-
| 'subpages';
|
|
48
|
-
|
|
49
|
-
export const MigrationUrlSlugModeSchema = z.enum(['autogenerated', 'custom']).readonly();
|
|
50
|
-
export const MigrationElementTypeSchema = z
|
|
51
|
-
.enum([
|
|
52
|
-
'text',
|
|
53
|
-
'rich_text',
|
|
54
|
-
'number',
|
|
55
|
-
'multiple_choice',
|
|
56
|
-
'date_time',
|
|
57
|
-
'asset',
|
|
58
|
-
'modular_content',
|
|
59
|
-
'taxonomy',
|
|
60
|
-
'url_slug',
|
|
61
|
-
'custom',
|
|
62
|
-
'subpages'
|
|
63
|
-
])
|
|
64
|
-
.readonly();
|
|
65
|
-
|
|
66
|
-
export const MigrationReferenceSchema = z
|
|
67
|
-
.strictObject({
|
|
68
|
-
codename: z.string().readonly()
|
|
69
|
-
})
|
|
70
|
-
.readonly();
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* ZodType is needed to be specified here due to the use of 'lazy' & circular dependency between types
|
|
74
|
-
* Otherwise TS has no way of statically inferring the type
|
|
75
|
-
*/
|
|
76
|
-
export const MigrationElementsSchema: z.ZodReadonly<z.ZodType<Elements>> = z
|
|
77
|
-
.record(
|
|
78
|
-
z.string(),
|
|
79
|
-
z.lazy(() => MigrationElementSchema)
|
|
80
|
-
)
|
|
81
|
-
.readonly();
|
|
82
|
-
|
|
83
|
-
export const MigrationComponentSchema = z
|
|
84
|
-
.strictObject({
|
|
85
|
-
system: z.strictObject({
|
|
86
|
-
id: z.string(),
|
|
87
|
-
type: MigrationReferenceSchema
|
|
88
|
-
}),
|
|
89
|
-
elements: MigrationElementsSchema
|
|
90
|
-
})
|
|
91
|
-
.readonly();
|
|
92
|
-
|
|
93
|
-
export const MigrationUrlSlugElementValueSchema = z
|
|
94
|
-
.strictObject({
|
|
95
|
-
value: z.optional(z.string()),
|
|
96
|
-
mode: MigrationUrlSlugModeSchema
|
|
97
|
-
})
|
|
98
|
-
.readonly();
|
|
99
|
-
|
|
100
|
-
export const MigrationRichTextElementValueSchema = z
|
|
101
|
-
.strictObject({
|
|
102
|
-
value: z.string(),
|
|
103
|
-
components: z.array(MigrationComponentSchema).readonly()
|
|
104
|
-
})
|
|
105
|
-
.readonly();
|
|
106
|
-
|
|
107
|
-
export const MigrationElementValueSchema = z.union([
|
|
108
|
-
z.string(),
|
|
109
|
-
z.undefined(),
|
|
110
|
-
z.number(),
|
|
111
|
-
z.array(MigrationReferenceSchema),
|
|
112
|
-
MigrationRichTextElementValueSchema,
|
|
113
|
-
MigrationUrlSlugElementValueSchema
|
|
114
|
-
]);
|
|
115
|
-
|
|
116
|
-
export const MigrationElementSchema = z
|
|
117
|
-
.strictObject({
|
|
118
|
-
type: MigrationElementTypeSchema,
|
|
119
|
-
value: MigrationElementValueSchema
|
|
120
|
-
})
|
|
121
|
-
.readonly();
|
|
122
|
-
|
|
123
|
-
export const MigrationItemVersionSchema = z
|
|
124
|
-
.strictObject({
|
|
125
|
-
workflow_step: MigrationReferenceSchema,
|
|
126
|
-
elements: MigrationElementsSchema
|
|
127
|
-
})
|
|
128
|
-
.readonly();
|
|
129
|
-
|
|
130
|
-
export const MigrationItemSystemSchema = z.strictObject({
|
|
131
|
-
codename: z.string(),
|
|
132
|
-
name: z.string(),
|
|
133
|
-
language: MigrationReferenceSchema,
|
|
134
|
-
type: MigrationReferenceSchema,
|
|
135
|
-
collection: MigrationReferenceSchema,
|
|
136
|
-
workflow: MigrationReferenceSchema
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
export const MigrationItemSchema = z
|
|
140
|
-
.strictObject({
|
|
141
|
-
system: MigrationItemSystemSchema,
|
|
142
|
-
versions: z.array(MigrationItemVersionSchema).readonly()
|
|
143
|
-
})
|
|
144
|
-
.readonly();
|
|
145
|
-
|
|
146
|
-
export const MigrationAssetDescriptionSchema = z
|
|
147
|
-
.strictObject({
|
|
148
|
-
language: MigrationReferenceSchema,
|
|
149
|
-
description: z.optional(z.string())
|
|
150
|
-
})
|
|
151
|
-
.readonly();
|
|
152
|
-
|
|
153
|
-
const BaseMigrationAssetSchema = z.strictObject({
|
|
154
|
-
codename: z.string(),
|
|
155
|
-
filename: z.string(),
|
|
156
|
-
title: z.string(),
|
|
157
|
-
collection: z.optional(MigrationReferenceSchema),
|
|
158
|
-
descriptions: z.optional(z.array(MigrationAssetDescriptionSchema)).readonly()
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
export const MigrationAssetSchema = BaseMigrationAssetSchema.extend({
|
|
162
|
-
binaryData: z.union([z.instanceof(Buffer), z.instanceof(Blob)])
|
|
163
|
-
}).readonly();
|
|
164
|
-
|
|
165
|
-
export const ZipMigrationAssetSchema = BaseMigrationAssetSchema.extend({
|
|
166
|
-
_zipFilename: z.string()
|
|
167
|
-
}).readonly();
|
|
168
|
-
|
|
169
|
-
export const MigrationAssetsSchema = z.array(MigrationAssetSchema).readonly();
|
|
170
|
-
export const ZipMigrationAssetsSchema = z.array(ZipMigrationAssetSchema).readonly();
|
|
171
|
-
export const MigrationItemsSchema = z.array(MigrationItemSchema).readonly();
|
|
172
|
-
|
|
173
|
-
export const MigrationDataSchema = z
|
|
174
|
-
.strictObject({
|
|
175
|
-
items: MigrationItemsSchema,
|
|
176
|
-
assets: MigrationAssetsSchema
|
|
177
|
-
})
|
|
178
|
-
.readonly();
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
interface Elements {
|
|
4
|
+
readonly [key: string]: Element;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
type UrlSlugMode = 'autogenerated' | 'custom';
|
|
8
|
+
|
|
9
|
+
type UrlSlugElementValue = {
|
|
10
|
+
readonly value?: string;
|
|
11
|
+
readonly mode: UrlSlugMode;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
type Reference = { readonly codename: string };
|
|
15
|
+
|
|
16
|
+
type Component = {
|
|
17
|
+
readonly system: {
|
|
18
|
+
readonly id: string;
|
|
19
|
+
readonly type: Reference;
|
|
20
|
+
};
|
|
21
|
+
readonly elements: Elements;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
type RichTextElementValue = {
|
|
25
|
+
readonly value: string;
|
|
26
|
+
readonly components: Readonly<Component[]>;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
type ElementValue = string | undefined | number | Reference[] | RichTextElementValue | UrlSlugElementValue;
|
|
30
|
+
|
|
31
|
+
type Element = {
|
|
32
|
+
readonly type: ElementType;
|
|
33
|
+
readonly value?: ElementValue;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
type ElementType =
|
|
37
|
+
| 'text'
|
|
38
|
+
| 'rich_text'
|
|
39
|
+
| 'number'
|
|
40
|
+
| 'multiple_choice'
|
|
41
|
+
| 'date_time'
|
|
42
|
+
| 'asset'
|
|
43
|
+
| 'modular_content'
|
|
44
|
+
| 'taxonomy'
|
|
45
|
+
| 'url_slug'
|
|
46
|
+
| 'custom'
|
|
47
|
+
| 'subpages';
|
|
48
|
+
|
|
49
|
+
export const MigrationUrlSlugModeSchema = z.enum(['autogenerated', 'custom']).readonly();
|
|
50
|
+
export const MigrationElementTypeSchema = z
|
|
51
|
+
.enum([
|
|
52
|
+
'text',
|
|
53
|
+
'rich_text',
|
|
54
|
+
'number',
|
|
55
|
+
'multiple_choice',
|
|
56
|
+
'date_time',
|
|
57
|
+
'asset',
|
|
58
|
+
'modular_content',
|
|
59
|
+
'taxonomy',
|
|
60
|
+
'url_slug',
|
|
61
|
+
'custom',
|
|
62
|
+
'subpages'
|
|
63
|
+
])
|
|
64
|
+
.readonly();
|
|
65
|
+
|
|
66
|
+
export const MigrationReferenceSchema = z
|
|
67
|
+
.strictObject({
|
|
68
|
+
codename: z.string().readonly()
|
|
69
|
+
})
|
|
70
|
+
.readonly();
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* ZodType is needed to be specified here due to the use of 'lazy' & circular dependency between types
|
|
74
|
+
* Otherwise TS has no way of statically inferring the type
|
|
75
|
+
*/
|
|
76
|
+
export const MigrationElementsSchema: z.ZodReadonly<z.ZodType<Elements>> = z
|
|
77
|
+
.record(
|
|
78
|
+
z.string(),
|
|
79
|
+
z.lazy(() => MigrationElementSchema)
|
|
80
|
+
)
|
|
81
|
+
.readonly();
|
|
82
|
+
|
|
83
|
+
export const MigrationComponentSchema = z
|
|
84
|
+
.strictObject({
|
|
85
|
+
system: z.strictObject({
|
|
86
|
+
id: z.string(),
|
|
87
|
+
type: MigrationReferenceSchema
|
|
88
|
+
}),
|
|
89
|
+
elements: MigrationElementsSchema
|
|
90
|
+
})
|
|
91
|
+
.readonly();
|
|
92
|
+
|
|
93
|
+
export const MigrationUrlSlugElementValueSchema = z
|
|
94
|
+
.strictObject({
|
|
95
|
+
value: z.optional(z.string()),
|
|
96
|
+
mode: MigrationUrlSlugModeSchema
|
|
97
|
+
})
|
|
98
|
+
.readonly();
|
|
99
|
+
|
|
100
|
+
export const MigrationRichTextElementValueSchema = z
|
|
101
|
+
.strictObject({
|
|
102
|
+
value: z.string(),
|
|
103
|
+
components: z.array(MigrationComponentSchema).readonly()
|
|
104
|
+
})
|
|
105
|
+
.readonly();
|
|
106
|
+
|
|
107
|
+
export const MigrationElementValueSchema = z.union([
|
|
108
|
+
z.string(),
|
|
109
|
+
z.undefined(),
|
|
110
|
+
z.number(),
|
|
111
|
+
z.array(MigrationReferenceSchema),
|
|
112
|
+
MigrationRichTextElementValueSchema,
|
|
113
|
+
MigrationUrlSlugElementValueSchema
|
|
114
|
+
]);
|
|
115
|
+
|
|
116
|
+
export const MigrationElementSchema = z
|
|
117
|
+
.strictObject({
|
|
118
|
+
type: MigrationElementTypeSchema,
|
|
119
|
+
value: MigrationElementValueSchema
|
|
120
|
+
})
|
|
121
|
+
.readonly();
|
|
122
|
+
|
|
123
|
+
export const MigrationItemVersionSchema = z
|
|
124
|
+
.strictObject({
|
|
125
|
+
workflow_step: MigrationReferenceSchema,
|
|
126
|
+
elements: MigrationElementsSchema
|
|
127
|
+
})
|
|
128
|
+
.readonly();
|
|
129
|
+
|
|
130
|
+
export const MigrationItemSystemSchema = z.strictObject({
|
|
131
|
+
codename: z.string(),
|
|
132
|
+
name: z.string(),
|
|
133
|
+
language: MigrationReferenceSchema,
|
|
134
|
+
type: MigrationReferenceSchema,
|
|
135
|
+
collection: MigrationReferenceSchema,
|
|
136
|
+
workflow: MigrationReferenceSchema
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
export const MigrationItemSchema = z
|
|
140
|
+
.strictObject({
|
|
141
|
+
system: MigrationItemSystemSchema,
|
|
142
|
+
versions: z.array(MigrationItemVersionSchema).readonly()
|
|
143
|
+
})
|
|
144
|
+
.readonly();
|
|
145
|
+
|
|
146
|
+
export const MigrationAssetDescriptionSchema = z
|
|
147
|
+
.strictObject({
|
|
148
|
+
language: MigrationReferenceSchema,
|
|
149
|
+
description: z.optional(z.string())
|
|
150
|
+
})
|
|
151
|
+
.readonly();
|
|
152
|
+
|
|
153
|
+
const BaseMigrationAssetSchema = z.strictObject({
|
|
154
|
+
codename: z.string(),
|
|
155
|
+
filename: z.string(),
|
|
156
|
+
title: z.string(),
|
|
157
|
+
collection: z.optional(MigrationReferenceSchema),
|
|
158
|
+
descriptions: z.optional(z.array(MigrationAssetDescriptionSchema)).readonly()
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
export const MigrationAssetSchema = BaseMigrationAssetSchema.extend({
|
|
162
|
+
binaryData: z.union([z.instanceof(Buffer), z.instanceof(Blob)])
|
|
163
|
+
}).readonly();
|
|
164
|
+
|
|
165
|
+
export const ZipMigrationAssetSchema = BaseMigrationAssetSchema.extend({
|
|
166
|
+
_zipFilename: z.string()
|
|
167
|
+
}).readonly();
|
|
168
|
+
|
|
169
|
+
export const MigrationAssetsSchema = z.array(MigrationAssetSchema).readonly();
|
|
170
|
+
export const ZipMigrationAssetsSchema = z.array(ZipMigrationAssetSchema).readonly();
|
|
171
|
+
export const MigrationItemsSchema = z.array(MigrationItemSchema).readonly();
|
|
172
|
+
|
|
173
|
+
export const MigrationDataSchema = z
|
|
174
|
+
.strictObject({
|
|
175
|
+
items: MigrationItemsSchema,
|
|
176
|
+
assets: MigrationAssetsSchema
|
|
177
|
+
})
|
|
178
|
+
.readonly();
|
|
@@ -39,9 +39,7 @@ export function managementClientUtils(client: Readonly<ManagementClient>, logger
|
|
|
39
39
|
return (await client.environmentInformation().toPromise()).data.project;
|
|
40
40
|
};
|
|
41
41
|
|
|
42
|
-
const getAllLanguagesAsync = async (
|
|
43
|
-
logSpinner: LogSpinnerData
|
|
44
|
-
): Promise<readonly LanguageModels.LanguageModel[]> => {
|
|
42
|
+
const getAllLanguagesAsync = async (logSpinner: LogSpinnerData): Promise<readonly LanguageModels.LanguageModel[]> => {
|
|
45
43
|
return await runMapiRequestAsync({
|
|
46
44
|
logSpinner: logSpinner,
|
|
47
45
|
logger: logger,
|
|
@@ -51,9 +49,7 @@ export function managementClientUtils(client: Readonly<ManagementClient>, logger
|
|
|
51
49
|
});
|
|
52
50
|
};
|
|
53
51
|
|
|
54
|
-
const getAllCollectionsAsync = async (
|
|
55
|
-
logSpinner: LogSpinnerData
|
|
56
|
-
): Promise<readonly CollectionModels.Collection[]> => {
|
|
52
|
+
const getAllCollectionsAsync = async (logSpinner: LogSpinnerData): Promise<readonly CollectionModels.Collection[]> => {
|
|
57
53
|
return await runMapiRequestAsync({
|
|
58
54
|
logger: logger,
|
|
59
55
|
logSpinner: logSpinner,
|
|
@@ -121,7 +117,7 @@ export function managementClientUtils(client: Readonly<ManagementClient>, logger
|
|
|
121
117
|
codename: snippetElement.codename,
|
|
122
118
|
type: snippetElement.type,
|
|
123
119
|
id: snippetElement.id,
|
|
124
|
-
element:
|
|
120
|
+
element: snippetElement
|
|
125
121
|
};
|
|
126
122
|
|
|
127
123
|
return flattenedElement;
|
|
@@ -139,9 +135,7 @@ export function managementClientUtils(client: Readonly<ManagementClient>, logger
|
|
|
139
135
|
.filter(isNotUndefined);
|
|
140
136
|
};
|
|
141
137
|
|
|
142
|
-
const getFlattenedContentTypesAsync = async (
|
|
143
|
-
logSpinner: LogSpinnerData
|
|
144
|
-
): Promise<readonly FlattenedContentType[]> => {
|
|
138
|
+
const getFlattenedContentTypesAsync = async (logSpinner: LogSpinnerData): Promise<readonly FlattenedContentType[]> => {
|
|
145
139
|
const contentTypes = await runMapiRequestAsync({
|
|
146
140
|
logger: logger,
|
|
147
141
|
logSpinner: logSpinner,
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ContentItemModels,
|
|
3
|
-
ElementContracts,
|
|
4
|
-
LanguageVariantModels,
|
|
5
|
-
ManagementClient,
|
|
6
|
-
WorkflowModels
|
|
7
|
-
} from '@kontent-ai/management-sdk';
|
|
1
|
+
import { ContentItemModels, ElementContracts, LanguageVariantModels, ManagementClient, WorkflowModels } from '@kontent-ai/management-sdk';
|
|
8
2
|
import {
|
|
9
3
|
Logger,
|
|
10
4
|
processItemsAsync,
|
|
@@ -45,11 +39,9 @@ export function languageVariantImporter(config: {
|
|
|
45
39
|
.byLanguageCodename(data.migrationItem.system.language.codename)
|
|
46
40
|
.withData(() => {
|
|
47
41
|
return {
|
|
48
|
-
elements: Object.entries(data.migrationItemVersion.elements).map(
|
|
49
|
-
(
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
),
|
|
42
|
+
elements: Object.entries(data.migrationItemVersion.elements).map(([codename, migrationElement]) => {
|
|
43
|
+
return getElementContract(data.migrationItem, migrationElement, codename);
|
|
44
|
+
}),
|
|
53
45
|
workflow: {
|
|
54
46
|
workflow_identifier: {
|
|
55
47
|
codename: data.workflow.codename
|
|
@@ -112,9 +104,7 @@ export function languageVariantImporter(config: {
|
|
|
112
104
|
readonly workflowStepCodenameInTargetEnvironment: string | undefined;
|
|
113
105
|
}): Promise<Readonly<LanguageVariantModels.ContentItemLanguageVariant>> => {
|
|
114
106
|
// validate workflow
|
|
115
|
-
const { step, workflow } = workflowHelper(
|
|
116
|
-
config.importContext.environmentData.workflows
|
|
117
|
-
).getWorkflowAndStepByCodenames({
|
|
107
|
+
const { step, workflow } = workflowHelper(config.importContext.environmentData.workflows).getWorkflowAndStepByCodenames({
|
|
118
108
|
workflowCodename: data.migrationItem.system.workflow.codename,
|
|
119
109
|
stepCodename: data.migrationItemVersion.workflow_step.codename
|
|
120
110
|
});
|
|
@@ -203,16 +193,10 @@ export function languageVariantImporter(config: {
|
|
|
203
193
|
});
|
|
204
194
|
}
|
|
205
195
|
|
|
206
|
-
return [
|
|
207
|
-
...(publishedLanguageVariant ? [publishedLanguageVariant] : []),
|
|
208
|
-
...(draftLanguageVariant ? [draftLanguageVariant] : [])
|
|
209
|
-
];
|
|
196
|
+
return [...(publishedLanguageVariant ? [publishedLanguageVariant] : []), ...(draftLanguageVariant ? [draftLanguageVariant] : [])];
|
|
210
197
|
};
|
|
211
198
|
|
|
212
|
-
const createNewVersionOfLanguageVariantAsync = async (
|
|
213
|
-
logSpinner: LogSpinnerData,
|
|
214
|
-
migrationItem: MigrationItem
|
|
215
|
-
): Promise<void> => {
|
|
199
|
+
const createNewVersionOfLanguageVariantAsync = async (logSpinner: LogSpinnerData, migrationItem: MigrationItem): Promise<void> => {
|
|
216
200
|
await runMapiRequestAsync({
|
|
217
201
|
logger: config.logger,
|
|
218
202
|
func: async () => {
|
|
@@ -241,10 +225,17 @@ export function languageVariantImporter(config: {
|
|
|
241
225
|
logger: config.logger,
|
|
242
226
|
func: async () => {
|
|
243
227
|
await config.client
|
|
244
|
-
.
|
|
228
|
+
.changeWorkflowOfLanguageVariant()
|
|
245
229
|
.byItemCodename(migrationItem.system.codename)
|
|
246
230
|
.byLanguageCodename(migrationItem.system.language.codename)
|
|
247
|
-
.
|
|
231
|
+
.withData({
|
|
232
|
+
workflow_identifier: {
|
|
233
|
+
codename: workflow.codename
|
|
234
|
+
},
|
|
235
|
+
step_identifier: {
|
|
236
|
+
codename: firstWorkflowStep.codename
|
|
237
|
+
}
|
|
238
|
+
})
|
|
248
239
|
.toPromise();
|
|
249
240
|
},
|
|
250
241
|
action: 'changeWorkflowStep',
|
|
@@ -306,10 +297,7 @@ export function languageVariantImporter(config: {
|
|
|
306
297
|
});
|
|
307
298
|
|
|
308
299
|
return (
|
|
309
|
-
await processItemsAsync<
|
|
310
|
-
MigrationItem,
|
|
311
|
-
readonly Readonly<LanguageVariantModels.ContentItemLanguageVariant>[]
|
|
312
|
-
>({
|
|
300
|
+
await processItemsAsync<MigrationItem, readonly Readonly<LanguageVariantModels.ContentItemLanguageVariant>[]>({
|
|
313
301
|
action: 'Importing language variants',
|
|
314
302
|
logger: config.logger,
|
|
315
303
|
parallelLimit: 1,
|
package/lib/metadata.ts
CHANGED
|
@@ -181,7 +181,7 @@ function findTaxonomy(termId: string, taxonomy: Readonly<TaxonomyModels.Taxonomy
|
|
|
181
181
|
}
|
|
182
182
|
|
|
183
183
|
if (taxonomy.terms) {
|
|
184
|
-
const foundTerm = taxonomy.terms.find((term) => findTaxonomy(
|
|
184
|
+
const foundTerm = taxonomy.terms.find((term) => findTaxonomy(termId, term));
|
|
185
185
|
|
|
186
186
|
if (foundTerm) {
|
|
187
187
|
return foundTerm;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kontent-ai/migration-toolkit",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "This program can be used to import content related data into Kontent.ai from various formats. Additionally, it can also be used to export Kontent.ai data using Delivery API.",
|
|
5
5
|
"preferGlobal": true,
|
|
6
6
|
"private": false,
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"license": "MIT",
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@kontent-ai-consulting/tools-analytics": "0.0.6",
|
|
56
|
-
"@kontent-ai/management-sdk": "
|
|
56
|
+
"@kontent-ai/management-sdk": "7.0.0",
|
|
57
57
|
"browser-or-node": "3.0.0",
|
|
58
58
|
"bytes": "3.1.2",
|
|
59
59
|
"chalk": "5.3.0",
|
|
@@ -68,21 +68,21 @@
|
|
|
68
68
|
"zod": "3.23.8"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
|
-
"@eslint/js": "9.
|
|
71
|
+
"@eslint/js": "9.8.0",
|
|
72
72
|
"@types/deep-equal": "1.0.4",
|
|
73
73
|
"@types/browser-or-node": "1.3.2",
|
|
74
74
|
"@types/bytes": "3.1.4",
|
|
75
75
|
"@types/eslint__js": "8.42.3",
|
|
76
|
-
"@types/node": "
|
|
76
|
+
"@types/node": "22.0.0",
|
|
77
77
|
"@types/prompts": "2.4.9",
|
|
78
78
|
"@types/yargs": "17.0.32",
|
|
79
|
-
"@typescript-eslint/eslint-plugin": "7.
|
|
80
|
-
"@typescript-eslint/parser": "7.
|
|
79
|
+
"@typescript-eslint/eslint-plugin": "7.17.0",
|
|
80
|
+
"@typescript-eslint/parser": "7.17.0",
|
|
81
81
|
"eslint": "8.57.0",
|
|
82
82
|
"standard-version": "9.5.0",
|
|
83
83
|
"tslib": "2.6.3",
|
|
84
84
|
"tsx": "4.16.2",
|
|
85
|
-
"typescript": "5.5.
|
|
86
|
-
"typescript-eslint": "7.
|
|
85
|
+
"typescript": "5.5.4",
|
|
86
|
+
"typescript-eslint": "7.17.0"
|
|
87
87
|
}
|
|
88
88
|
}
|