@kontent-ai/migration-toolkit 1.3.0 → 1.5.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.
Files changed (88) hide show
  1. package/README.md +79 -67
  2. package/dist/es2022/core/helpers/workflow-helper.d.ts +1 -0
  3. package/dist/es2022/core/helpers/workflow-helper.js +6 -4
  4. package/dist/es2022/core/helpers/workflow-helper.js.map +1 -1
  5. package/dist/es2022/core/logs/loggers.js +13 -22
  6. package/dist/es2022/core/logs/loggers.js.map +1 -1
  7. package/dist/es2022/core/models/core.models.d.ts +16 -6
  8. package/dist/es2022/core/models/migration.models.d.ts +9 -9
  9. package/dist/es2022/core/models/migration.schema.d.ts +247 -0
  10. package/dist/es2022/core/models/migration.schema.js +12 -2
  11. package/dist/es2022/core/models/migration.schema.js.map +1 -1
  12. package/dist/es2022/core/utils/array.utils.js.map +1 -1
  13. package/dist/es2022/core/utils/binary-data.utils.js +2 -6
  14. package/dist/es2022/core/utils/binary-data.utils.js.map +1 -1
  15. package/dist/es2022/core/utils/confirm.utils.js +10 -14
  16. package/dist/es2022/core/utils/confirm.utils.js.map +1 -1
  17. package/dist/es2022/core/utils/error.utils.js +35 -27
  18. package/dist/es2022/core/utils/error.utils.js.map +1 -1
  19. package/dist/es2022/core/utils/http.utils.js +7 -11
  20. package/dist/es2022/core/utils/http.utils.js.map +1 -1
  21. package/dist/es2022/core/utils/management-client-utils.d.ts +2 -1
  22. package/dist/es2022/core/utils/management-client-utils.js +12 -2
  23. package/dist/es2022/core/utils/management-client-utils.js.map +1 -1
  24. package/dist/es2022/core/utils/run.utils.js +12 -10
  25. package/dist/es2022/core/utils/run.utils.js.map +1 -1
  26. package/dist/es2022/export/context/export-context-fetcher.js +2 -1
  27. package/dist/es2022/export/context/export-context-fetcher.js.map +1 -1
  28. package/dist/es2022/export/export-manager.js +8 -0
  29. package/dist/es2022/export/export-manager.js.map +1 -1
  30. package/dist/es2022/export/export.models.d.ts +2 -1
  31. package/dist/es2022/import/comparers/asset-comparer.d.ts +2 -1
  32. package/dist/es2022/import/comparers/asset-comparer.js +9 -17
  33. package/dist/es2022/import/comparers/asset-comparer.js.map +1 -1
  34. package/dist/es2022/import/context/import-context-fetcher.js +120 -40
  35. package/dist/es2022/import/context/import-context-fetcher.js.map +1 -1
  36. package/dist/es2022/import/import.models.d.ts +2 -1
  37. package/dist/es2022/import/importers/assets-importer.js +12 -2
  38. package/dist/es2022/import/importers/assets-importer.js.map +1 -1
  39. package/dist/es2022/import/importers/language-variant-importer.js +95 -83
  40. package/dist/es2022/import/importers/language-variant-importer.js.map +1 -1
  41. package/dist/es2022/import/importers/workflow-importer.d.ts +41 -4
  42. package/dist/es2022/import/importers/workflow-importer.js +158 -17
  43. package/dist/es2022/import/importers/workflow-importer.js.map +1 -1
  44. package/dist/es2022/metadata.js +2 -2
  45. package/dist/es2022/node/cli/app.js +8 -12
  46. package/dist/es2022/node/cli/app.js.map +1 -1
  47. package/dist/es2022/node/cli/args/args-fetcher.js +9 -10
  48. package/dist/es2022/node/cli/args/args-fetcher.js.map +1 -1
  49. package/dist/es2022/toolkit/migrate.d.ts +1 -3
  50. package/dist/es2022/toolkit/migrate.js.map +1 -1
  51. package/dist/es2022/translation/extraction/items-extraction.processor.js +17 -17
  52. package/dist/es2022/translation/extraction/items-extraction.processor.js.map +1 -1
  53. package/dist/es2022/translation/transforms/export-transforms.js +1 -1
  54. package/dist/es2022/translation/transforms/export-transforms.js.map +1 -1
  55. package/dist/es2022/zip/zip-packager.js +13 -18
  56. package/dist/es2022/zip/zip-packager.js.map +1 -1
  57. package/dist/es2022/zip/zip-transformer.js +3 -1
  58. package/dist/es2022/zip/zip-transformer.js.map +1 -1
  59. package/lib/core/helpers/workflow-helper.ts +8 -8
  60. package/lib/core/logs/loggers.ts +14 -22
  61. package/lib/core/models/core.models.ts +23 -4
  62. package/lib/core/models/migration.models.ts +13 -12
  63. package/lib/core/models/migration.schema.ts +189 -178
  64. package/lib/core/utils/array.utils.ts +2 -10
  65. package/lib/core/utils/binary-data.utils.ts +2 -7
  66. package/lib/core/utils/confirm.utils.ts +18 -24
  67. package/lib/core/utils/error.utils.ts +50 -30
  68. package/lib/core/utils/http.utils.ts +14 -15
  69. package/lib/core/utils/management-client-utils.ts +188 -182
  70. package/lib/core/utils/run.utils.ts +27 -18
  71. package/lib/export/context/export-context-fetcher.ts +2 -1
  72. package/lib/export/export-manager.ts +14 -3
  73. package/lib/export/export.models.ts +3 -1
  74. package/lib/import/comparers/asset-comparer.ts +16 -24
  75. package/lib/import/context/import-context-fetcher.ts +179 -85
  76. package/lib/import/import.models.ts +2 -0
  77. package/lib/import/importers/assets-importer.ts +19 -12
  78. package/lib/import/importers/language-variant-importer.ts +125 -129
  79. package/lib/import/importers/workflow-importer.ts +228 -20
  80. package/lib/metadata.ts +2 -2
  81. package/lib/node/cli/app.ts +11 -12
  82. package/lib/node/cli/args/args-fetcher.ts +12 -14
  83. package/lib/toolkit/migrate.ts +1 -3
  84. package/lib/translation/extraction/items-extraction.processor.ts +93 -93
  85. package/lib/translation/transforms/export-transforms.ts +1 -1
  86. package/lib/zip/zip-packager.ts +26 -28
  87. package/lib/zip/zip-transformer.ts +3 -1
  88. package/package.json +14 -13
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
- It can be used to simplify migration from external systems and also provides a built-in migration between kontent.ai
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
- > which handles creation / updates of content items, language variants, moving items through workflow, publishing,
10
- > archiving, downloading binary data, uploading assets, `id` to `codename` translation and more.
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
- > create a testing environment and run the script there to make sure everything works as you intended to.
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
- > `Workflows`, `languages`...) are consistent with the ones defined in source environment. Any inconsistency in data
78
- > such as referencing inexistent taxonomy term, incorrect element type and other inconsistencies may cause import to
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
- from 3rd party system you typically only use the `import` capabilities of this repository.
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
- Kontent.ai Management API directly.
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
- migration models are `MigrationItem` and `MigrationAsset`. For creating element values `elementsBuilder`.
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 strongly recommended) you may define a migration model
134
- * representing the content type you are trying to migrate into
130
+ * Optionally (but highly recommended) you may define a migration model
131
+ * representing the environment you are trying to migrate into.
135
132
  */
136
- interface ArticleElements extends MigrationElements {
137
- title: MigrationElementModels.TextElement;
138
- rating: MigrationElementModels.NumberElement;
139
- related_pages: MigrationElementModels.LinkedItemsElement;
140
- teaser_image: MigrationElementModels.AssetElement;
141
- }
142
-
143
- const migrationItem: MigrationItem<ArticleElements> = {
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: 'en_uk'
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
- elements: {
162
- title: elementsBuilder.textElement({ value: 'Title of the article' }),
163
- rating: elementsBuilder.numberElement({ value: 5 }),
164
- related_pages: elementsBuilder.linkedItemsElement({
165
- value: [
166
- {
167
- codename: 'pageA'
168
- },
169
- {
170
- codename: 'pageB'
171
- }
172
- ]
173
- }),
174
- // assets are referenced by their codename
175
- teaser_image: elementsBuilder.assetElement({ value: [{ codename: 'article_teaser' }] })
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
- project (based on item's `codename`) the item will be updated, otherwise it will be created. No duplicate items will be
223
- created. The workflow of the item in target environment will be set to match the source environment.
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
- all. Otherwise the asset will be created in target environment.
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
- the migration toolkit first checks whether the referenced object exists (based on item or asset `codename`) and if it
234
- does, successfuly sets the reference. If the object does not exist, it will be referenced by an `external_id` which
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,20 @@ 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
- within import / migrate functions.
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
- codenames.
251
- 2. Assets element values are not preserved during migration because elements can be referenced only by id's and not
252
- codenames.
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. Custom asset elements are not supported (= values of these elements are not exported or imported )
255
267
 
256
268
  ## FAQ
257
269
 
258
270
  ### I'm getting `Header overflow` exception
259
271
 
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
- limitation to be able to successfully fetch data from Kontent.ai. You can do so by using the `max-http-header-size`
262
- option (https://nodejs.org/api/cli.html#--max-http-header-sizesize)
272
+ 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
273
+ to successfully fetch data from Kontent.ai. You can do so by using the `max-http-header-size` option
274
+ (https://nodejs.org/api/cli.html#--max-http-header-sizesize)
263
275
 
264
276
  Example script call:
265
277
 
@@ -33,5 +33,6 @@ export declare function workflowHelper(workflows: readonly Readonly<WorkflowMode
33
33
  isPublishedStepByCodename: (stepCodename: string) => boolean;
34
34
  isArchivedStepByCodename: (stepCodename: string) => boolean;
35
35
  isScheduledStepByCodename: (stepCodename: string) => boolean;
36
+ isPublishedStepById: (stepId: string) => boolean;
36
37
  };
37
38
  export {};
@@ -11,9 +11,7 @@ export function workflowHelper(workflows) {
11
11
  return getWorkflow({
12
12
  errorMessage: [
13
13
  `Workflow with codename '${chalk.red(workflowCodename)}' does not exist in target project`,
14
- `Available workflows are (${workflows.length}): ${workflows
15
- .map((m) => chalk.cyan(m.codename))
16
- .join(', ')}`
14
+ `Available workflows are (${workflows.length}): ${workflows.map((m) => chalk.cyan(m.codename)).join(', ')}`
17
15
  ].join(', '),
18
16
  match: (workflow) => workflow.codename.toLowerCase() === workflowCodename.toLowerCase()
19
17
  });
@@ -52,6 +50,9 @@ export function workflowHelper(workflows) {
52
50
  const isScheduledStepByCodename = (stepCodename) => {
53
51
  return workflows.find((workflow) => workflow.scheduledStep.codename === stepCodename) ? true : false;
54
52
  };
53
+ const isPublishedStepById = (stepId) => {
54
+ return workflows.find((workflow) => workflow.publishedStep.id === stepId) ? true : false;
55
+ };
55
56
  return {
56
57
  getWorkflowByCodename,
57
58
  getWorkflowStepByCodename,
@@ -61,7 +62,8 @@ export function workflowHelper(workflows) {
61
62
  getWorkflow,
62
63
  isPublishedStepByCodename,
63
64
  isArchivedStepByCodename,
64
- isScheduledStepByCodename
65
+ isScheduledStepByCodename,
66
+ isPublishedStepById
65
67
  };
66
68
  }
67
69
  //# sourceMappingURL=workflow-helper.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"workflow-helper.js","sourceRoot":"","sources":["../../../../lib/core/helpers/workflow-helper.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAgBvD,MAAM,UAAU,cAAc,CAAC,SAAuD;IAClF,MAAM,eAAe,GAAG,CAAC,QAA2C,EAAE,WAAwB,EAAgB,EAAE;QAC5G,OAAO,YAAY,CACf,CAAC,GAAG,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,YAAY,EAAE,QAAQ,CAAC,aAAa,EAAE,QAAQ,CAAC,aAAa,CAAC,EAC1F,WAAW,CAAC,KAAK,EACjB,WAAW,CAAC,YAAY,CAC3B,CAAC;IACN,CAAC,CAAC;IAEF,MAAM,WAAW,GAAG,CAAC,eAAgC,EAAqC,EAAE;QACxF,OAAO,YAAY,CAAC,SAAS,EAAE,eAAe,CAAC,KAAK,EAAE,eAAe,CAAC,YAAY,CAAC,CAAC;IACxF,CAAC,CAAC;IAEF,MAAM,qBAAqB,GAAG,CAAC,gBAAwB,EAAqC,EAAE;QAC1F,OAAO,WAAW,CAAC;YACf,YAAY,EAAE;gBACV,2BAA2B,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,oCAAoC;gBAC1F,4BAA4B,SAAS,CAAC,MAAM,MAAM,SAAS;qBACtD,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,C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,KAAK,YAAY,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;IACxG,CAAC,CAAC;IAEF,MAAM,yBAAyB,GAAG,CAAC,YAAoB,EAAW,EAAE;QAChE,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,aAAa,CAAC,QAAQ,KAAK,YAAY,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;IACzG,CAAC,CAAC;IAEF,MAAM,mBAAmB,GAAG,CAAC,MAAc,EAAW,EAAE;QACpD,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;IAC7F,CAAC,CAAC;IAEF,OAAO;QACH,qBAAqB;QACrB,yBAAyB;QACzB,6BAA6B;QAC7B,eAAe;QACf,kBAAkB;QAClB,WAAW;QACX,yBAAyB;QACzB,wBAAwB;QACxB,yBAAyB;QACzB,mBAAmB;KACtB,CAAC;AACN,CAAC"}
@@ -1,15 +1,12 @@
1
1
  import chalk from 'chalk';
2
2
  import { getCurrentEnvironment } from '../utils/global.utils.js';
3
+ import { match, P } from 'ts-pattern';
3
4
  const originalWarn = console.warn;
4
5
  export function getDefaultLogger() {
5
- const currentEnv = getCurrentEnvironment();
6
- if (currentEnv === 'node') {
7
- return defaultNodeLogger;
8
- }
9
- if (currentEnv === 'browser') {
10
- return defaultBrowserLogger;
11
- }
12
- throw Error(`Invalid environment`);
6
+ return match(getCurrentEnvironment())
7
+ .with('node', () => defaultNodeLogger)
8
+ .with('browser', () => defaultBrowserLogger)
9
+ .exhaustive();
13
10
  }
14
11
  const defaultNodeLogger = {
15
12
  log: (data) => console.log(getLogDataMessage(data)),
@@ -48,19 +45,13 @@ const defaultBrowserLogger = {
48
45
  }
49
46
  };
50
47
  function getLogDataMessage(data) {
51
- let typeColor = chalk.yellow;
52
- if (data.type === 'info') {
53
- typeColor = chalk.cyan;
54
- }
55
- else if (data.type === 'error' || data.type === 'errorData' || data.type === 'warning' || data.type === 'cancel') {
56
- typeColor = chalk.red;
57
- }
58
- else if (data.type === 'completed') {
59
- typeColor = chalk.green;
60
- }
61
- else if (data.type === 'skip') {
62
- typeColor = chalk.gray;
63
- }
64
- return `${typeColor(data.type)}: ${data.message}`;
48
+ const color = match(data.type)
49
+ .returnType()
50
+ .with('info', () => chalk.cyan)
51
+ .with(P.union('error', 'errorData', 'warning', 'cancel'), () => chalk.red)
52
+ .with('completed', () => chalk.green)
53
+ .with('skip', () => chalk.gray)
54
+ .otherwise(() => chalk.yellow);
55
+ return `${color(data.type)}: ${data.message}`;
65
56
  }
66
57
  //# sourceMappingURL=loggers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"loggers.js","sourceRoot":"","sources":["../../../../lib/core/logs/loggers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAEjE,MAAM,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;AAElC,MAAM,UAAU,gBAAgB;IAC5B,MAAM,UAAU,GAAG,qBAAqB,EAAE,CAAC;IAE3C,IAAI,UAAU,KAAK,MAAM,EAAE,CAAC;QACxB,OAAO,iBAAiB,CAAC;IAC7B,CAAC;IACD,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;QAC3B,OAAO,oBAAoB,CAAC;IAChC,CAAC;IACD,MAAM,KAAK,CAAC,qBAAqB,CAAC,CAAC;AACvC,CAAC;AAED,MAAM,iBAAiB,GAAW;IAC9B,GAAG,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;IACnD,mBAAmB,EAAE,KAAK,EAAE,IA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E,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;IACnD,mBAAmB,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;QAChC,OAAO,MAAM,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE;YACvB,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;YACrD,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,GAAG,iBAAiB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACvD,CAAC,CAAC,CAAC;IACP,CAAC;CACJ,CAAC;AAEF,SAAS,iBAAiB,CAAC,IAAuB;IAC9C,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC;SACzB,UAAU,EAAiB;SAC3B,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC;SAC9B,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,CAAC,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC;SACzE,IAAI,CAAC,WAAW,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC;SACpC,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC;SAC9B,SAAS,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAEnC,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,OAAO,EAAE,CAAC;AAClD,CAAC"}
@@ -1,12 +1,18 @@
1
1
  import { AssetModels, ContentItemModels, ContentTypeElements, LanguageVariantModels, WorkflowModels } from '@kontent-ai/management-sdk';
2
2
  import { MigrationElementType } from './migration.models.js';
3
- import { WorkflowStep } from '../helpers/workflow-helper.js';
3
+ export type LiteralUnion<T extends string> = T | (string & {});
4
4
  export type TargetItemState = 'exists' | 'doesNotExists';
5
5
  export type CliAction = 'export' | 'import' | 'migrate';
6
6
  export type EnvContext = 'browser' | 'node';
7
- export type MapiAction = 'list' | 'view' | 'archive' | 'unpublish' | 'changeWorkflowStep' | 'publish' | 'upload' | 'create' | 'upsert' | 'createNewVersion';
7
+ export type MapiAction = 'list' | 'view' | 'archive' | 'unpublish' | 'changeWorkflowStep' | 'publish' | 'upload' | 'create' | 'upsert' | 'schedulePublish' | 'scheduleUnpublish' | 'cancelScheduledPublish' | 'cancelScheduledUnpublish' | 'createNewVersion';
8
8
  export type MigrationItemType = 'exportItem';
9
- export type MapiType = 'contentType' | 'asset' | 'contentTypeSnippet' | 'contentItem' | 'languageVariant' | 'language' | 'collection' | 'taxonomy' | 'binaryFile' | 'workflow';
9
+ export type MapiType = 'contentType' | 'assetFolder' | 'asset' | 'contentTypeSnippet' | 'contentItem' | 'languageVariant' | 'language' | 'collection' | 'taxonomy' | 'binaryFile' | 'workflow';
10
+ export type LanguageVariantWorkflowStateValues = 'published' | 'archived' | 'draft' | 'scheduled';
11
+ export type LanguageVariantSchedulesStateValues = 'scheduledPublish' | 'scheduledUnpublish' | 'n/a';
12
+ export type LanguageVariantWorkflowState = {
13
+ readonly workflowState: LanguageVariantWorkflowStateValues;
14
+ readonly scheduledState: LanguageVariantSchedulesStateValues;
15
+ } | undefined;
10
16
  export interface ItemInfo {
11
17
  readonly title: string;
12
18
  readonly itemType: MapiType | MigrationItemType;
@@ -42,13 +48,17 @@ export interface ItemStateInTargetEnvironmentByCodename {
42
48
  readonly item: Readonly<ContentItemModels.ContentItem> | undefined;
43
49
  readonly externalIdToUse: string;
44
50
  }
51
+ export interface LanguageVariantStateData {
52
+ readonly languageVariant: Readonly<LanguageVariantModels.ContentItemLanguageVariant> | undefined;
53
+ readonly workflow: Readonly<WorkflowModels.Workflow> | undefined;
54
+ readonly workflowState: LanguageVariantWorkflowState;
55
+ }
45
56
  export interface LanguageVariantStateInTargetEnvironmentByCodename {
46
57
  readonly state: TargetItemState;
47
58
  readonly itemCodename: string;
48
59
  readonly languageCodename: string;
49
- readonly languageVariant: Readonly<LanguageVariantModels.ContentItemLanguageVariant> | undefined;
50
- readonly workflow: Readonly<WorkflowModels.Workflow> | undefined;
51
- readonly step: Readonly<WorkflowStep> | undefined;
60
+ readonly publishedLanguageVariant: LanguageVariantStateData | undefined;
61
+ readonly draftLanguageVariant: LanguageVariantStateData | undefined;
52
62
  }
53
63
  export interface AssetStateInTargetEnvironmentByCodename {
54
64
  readonly state: TargetItemState;
@@ -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<TType extends string = string, TLanguage extends string = string, TCollection extends string = string, TWorkflow extends string = string> = z.infer<typeof MigrationItemSystemSchema> & {
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<TLanguage>;
28
- readonly type: MigrationReference<TType>;
29
- readonly collection: MigrationReference<TCollection>;
30
- readonly workflow: MigrationReference<TWorkflow>;
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, TWorkflowStepCodename extends string = string> = z.infer<typeof MigrationItemVersionSchema> & {
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<TWorkflowStepCodename>;
45
+ readonly workflow_step: MigrationReference<TWorkflowStepCodenames>;
46
46
  };
47
- export type MigrationItem<TElements extends MigrationElements = MigrationElements, TSystem extends MigrationItemSystem = MigrationItemSystem, TWorkflowStepCodename extends string = string> = z.infer<typeof MigrationItemSchema> & {
48
- readonly versions: Readonly<MigrationItemVersion<TElements, TWorkflowStepCodename>[]>;
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
  };