@kontent-ai/migration-toolkit 2.9.1 → 3.0.0-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.
Files changed (239) hide show
  1. package/README.md +19 -17
  2. package/dist/core/config.js +3 -3
  3. package/dist/core/config.js.map +1 -1
  4. package/dist/core/helpers/workflow-helper.d.ts +1 -1
  5. package/dist/core/helpers/workflow-helper.js +28 -26
  6. package/dist/core/helpers/workflow-helper.js.map +1 -1
  7. package/dist/core/logs/loggers.d.ts +1 -1
  8. package/dist/core/logs/loggers.js +15 -15
  9. package/dist/core/logs/loggers.js.map +1 -1
  10. package/dist/core/models/core.models.d.ts +29 -22
  11. package/dist/core/models/error.models.d.ts +26 -0
  12. package/dist/core/models/error.models.js +104 -0
  13. package/dist/core/models/error.models.js.map +1 -0
  14. package/dist/core/models/log.models.d.ts +2 -2
  15. package/dist/core/models/migration.models.d.ts +17 -19
  16. package/dist/core/models/migration.schema.d.ts +9 -9
  17. package/dist/core/models/migration.schema.js +28 -28
  18. package/dist/core/models/migration.schema.js.map +1 -1
  19. package/dist/core/utils/array.utils.d.ts +1 -1
  20. package/dist/core/utils/array.utils.js +4 -3
  21. package/dist/core/utils/array.utils.js.map +1 -1
  22. package/dist/core/utils/binary-data.utils.d.ts +1 -1
  23. package/dist/core/utils/binary-data.utils.js +6 -6
  24. package/dist/core/utils/binary-data.utils.js.map +1 -1
  25. package/dist/core/utils/confirm.utils.d.ts +3 -1
  26. package/dist/core/utils/confirm.utils.js +92 -24
  27. package/dist/core/utils/confirm.utils.js.map +1 -1
  28. package/dist/core/utils/error.utils.d.ts +1 -1
  29. package/dist/core/utils/error.utils.js +16 -14
  30. package/dist/core/utils/error.utils.js.map +1 -1
  31. package/dist/core/utils/external-id.utils.js +1 -1
  32. package/dist/core/utils/external-id.utils.js.map +1 -1
  33. package/dist/core/utils/global.utils.d.ts +3 -3
  34. package/dist/core/utils/global.utils.js +20 -18
  35. package/dist/core/utils/global.utils.js.map +1 -1
  36. package/dist/core/utils/http.utils.d.ts +2 -2
  37. package/dist/core/utils/http.utils.js +4 -4
  38. package/dist/core/utils/http.utils.js.map +1 -1
  39. package/dist/core/utils/management-client-utils.d.ts +4 -4
  40. package/dist/core/utils/management-client-utils.js +37 -34
  41. package/dist/core/utils/management-client-utils.js.map +1 -1
  42. package/dist/core/utils/processing-utils.d.ts +4 -4
  43. package/dist/core/utils/processing-utils.js +13 -13
  44. package/dist/core/utils/processing-utils.js.map +1 -1
  45. package/dist/core/utils/run.utils.d.ts +2 -2
  46. package/dist/core/utils/run.utils.js +7 -7
  47. package/dist/core/utils/run.utils.js.map +1 -1
  48. package/dist/core/utils/try.utils.d.ts +14 -0
  49. package/dist/core/utils/try.utils.js +18 -0
  50. package/dist/core/utils/try.utils.js.map +1 -0
  51. package/dist/export/context/export-context-fetcher.d.ts +1 -1
  52. package/dist/export/context/export-context-fetcher.js +92 -62
  53. package/dist/export/context/export-context-fetcher.js.map +1 -1
  54. package/dist/export/export-manager.d.ts +2 -2
  55. package/dist/export/export-manager.js +73 -59
  56. package/dist/export/export-manager.js.map +1 -1
  57. package/dist/export/export.models.d.ts +21 -2
  58. package/dist/export/utils/export.utils.d.ts +1 -1
  59. package/dist/export/utils/export.utils.js +3 -2
  60. package/dist/export/utils/export.utils.js.map +1 -1
  61. package/dist/file/file-manager.d.ts +2 -2
  62. package/dist/file/file-manager.js +7 -7
  63. package/dist/file/file-manager.js.map +1 -1
  64. package/dist/import/comparers/asset-comparer.d.ts +2 -2
  65. package/dist/import/comparers/asset-comparer.js +12 -11
  66. package/dist/import/comparers/asset-comparer.js.map +1 -1
  67. package/dist/import/context/import-context-fetcher.d.ts +1 -1
  68. package/dist/import/context/import-context-fetcher.js +77 -73
  69. package/dist/import/context/import-context-fetcher.js.map +1 -1
  70. package/dist/import/import-manager.d.ts +1 -1
  71. package/dist/import/import-manager.js +59 -56
  72. package/dist/import/import-manager.js.map +1 -1
  73. package/dist/import/import.models.d.ts +6 -2
  74. package/dist/import/importers/assets-importer.d.ts +3 -3
  75. package/dist/import/importers/assets-importer.js +46 -43
  76. package/dist/import/importers/assets-importer.js.map +1 -1
  77. package/dist/import/importers/content-items-importer.d.ts +3 -3
  78. package/dist/import/importers/content-items-importer.js +28 -25
  79. package/dist/import/importers/content-items-importer.js.map +1 -1
  80. package/dist/import/importers/language-variant-importer.d.ts +3 -3
  81. package/dist/import/importers/language-variant-importer.js +45 -45
  82. package/dist/import/importers/language-variant-importer.js.map +1 -1
  83. package/dist/import/importers/workflow-importer.d.ts +3 -2
  84. package/dist/import/importers/workflow-importer.js +58 -54
  85. package/dist/import/importers/workflow-importer.js.map +1 -1
  86. package/dist/import/utils/import.utils.d.ts +1 -1
  87. package/dist/import/utils/import.utils.js +3 -2
  88. package/dist/import/utils/import.utils.js.map +1 -1
  89. package/dist/index.d.ts +11 -7
  90. package/dist/index.js +10 -8
  91. package/dist/index.js.map +1 -1
  92. package/dist/metadata.js +3 -3
  93. package/dist/metadata.js.map +1 -1
  94. package/dist/node/cli/actions/export-action.d.ts +1 -1
  95. package/dist/node/cli/actions/export-action.js +29 -23
  96. package/dist/node/cli/actions/export-action.js.map +1 -1
  97. package/dist/node/cli/actions/import-action.d.ts +1 -1
  98. package/dist/node/cli/actions/import-action.js +15 -12
  99. package/dist/node/cli/actions/import-action.js.map +1 -1
  100. package/dist/node/cli/actions/migrate-action.d.ts +1 -1
  101. package/dist/node/cli/actions/migrate-action.js +26 -22
  102. package/dist/node/cli/actions/migrate-action.js.map +1 -1
  103. package/dist/node/cli/app.js +13 -12
  104. package/dist/node/cli/app.js.map +1 -1
  105. package/dist/node/cli/args/args-fetcher.d.ts +1 -1
  106. package/dist/node/cli/args/args-fetcher.js +14 -13
  107. package/dist/node/cli/args/args-fetcher.js.map +1 -1
  108. package/dist/node/cli/args/args-setter.d.ts +1 -1
  109. package/dist/node/cli/args/args-setter.js +8 -6
  110. package/dist/node/cli/args/args-setter.js.map +1 -1
  111. package/dist/node/cli/cli.models.d.ts +2 -2
  112. package/dist/node/cli/commands.js +68 -56
  113. package/dist/node/cli/commands.js.map +1 -1
  114. package/dist/toolkit/elements-builder.d.ts +1 -1
  115. package/dist/toolkit/elements-builder.js +12 -12
  116. package/dist/toolkit/elements-builder.js.map +1 -1
  117. package/dist/toolkit/export.d.ts +2 -2
  118. package/dist/toolkit/export.js +8 -8
  119. package/dist/toolkit/export.js.map +1 -1
  120. package/dist/toolkit/file.d.ts +2 -1
  121. package/dist/toolkit/file.js +18 -16
  122. package/dist/toolkit/file.js.map +1 -1
  123. package/dist/toolkit/import.d.ts +1 -1
  124. package/dist/toolkit/import.js +12 -12
  125. package/dist/toolkit/import.js.map +1 -1
  126. package/dist/toolkit/migrate.d.ts +13 -4
  127. package/dist/toolkit/migrate.js +15 -13
  128. package/dist/toolkit/migrate.js.map +1 -1
  129. package/dist/translation/extraction/items-extraction.processor.d.ts +5 -4
  130. package/dist/translation/extraction/items-extraction.processor.js +73 -35
  131. package/dist/translation/extraction/items-extraction.processor.js.map +1 -1
  132. package/dist/translation/helpers/export-placeholder.utils.d.ts +11 -0
  133. package/dist/translation/helpers/export-placeholder.utils.js +11 -0
  134. package/dist/translation/helpers/export-placeholder.utils.js.map +1 -0
  135. package/dist/translation/helpers/rich-text.processor.d.ts +6 -6
  136. package/dist/translation/helpers/rich-text.processor.js +38 -38
  137. package/dist/translation/helpers/rich-text.processor.js.map +1 -1
  138. package/dist/translation/transforms/export-transforms.d.ts +2 -2
  139. package/dist/translation/transforms/export-transforms.js +93 -67
  140. package/dist/translation/transforms/export-transforms.js.map +1 -1
  141. package/dist/translation/transforms/import-transforms.d.ts +2 -2
  142. package/dist/translation/transforms/import-transforms.js +38 -40
  143. package/dist/translation/transforms/import-transforms.js.map +1 -1
  144. package/dist/zip/zip-manager.d.ts +4 -3
  145. package/dist/zip/zip-manager.js +9 -9
  146. package/dist/zip/zip-manager.js.map +1 -1
  147. package/dist/zip/zip-packager.d.ts +2 -2
  148. package/dist/zip/zip-packager.js +19 -17
  149. package/dist/zip/zip-packager.js.map +1 -1
  150. package/dist/zip/zip-transformer.d.ts +3 -2
  151. package/dist/zip/zip-transformer.js +16 -15
  152. package/dist/zip/zip-transformer.js.map +1 -1
  153. package/dist/zip/zip.models.d.ts +2 -2
  154. package/lib/core/config.ts +6 -6
  155. package/lib/core/helpers/workflow-helper.ts +190 -185
  156. package/lib/core/logs/loggers.ts +52 -52
  157. package/lib/core/models/core.models.ts +130 -119
  158. package/lib/core/models/error.models.ts +148 -0
  159. package/lib/core/models/log.models.ts +20 -20
  160. package/lib/core/models/migration.models.ts +54 -57
  161. package/lib/core/models/migration.schema.ts +108 -108
  162. package/lib/core/utils/array.utils.ts +43 -42
  163. package/lib/core/utils/binary-data.utils.ts +16 -16
  164. package/lib/core/utils/confirm.utils.ts +184 -106
  165. package/lib/core/utils/error.utils.ts +69 -72
  166. package/lib/core/utils/external-id.utils.ts +4 -4
  167. package/lib/core/utils/global.utils.ts +81 -75
  168. package/lib/core/utils/http.utils.ts +23 -23
  169. package/lib/core/utils/management-client-utils.ts +189 -186
  170. package/lib/core/utils/processing-utils.ts +82 -82
  171. package/lib/core/utils/run.utils.ts +50 -50
  172. package/lib/core/utils/try.utils.ts +30 -0
  173. package/lib/export/context/export-context-fetcher.ts +472 -447
  174. package/lib/export/export-manager.ts +250 -232
  175. package/lib/export/export.models.ts +71 -56
  176. package/lib/export/utils/export.utils.ts +9 -7
  177. package/lib/file/file-manager.ts +28 -28
  178. package/lib/import/comparers/asset-comparer.ts +107 -106
  179. package/lib/import/context/import-context-fetcher.ts +462 -462
  180. package/lib/import/import-manager.ts +243 -240
  181. package/lib/import/import.models.ts +69 -67
  182. package/lib/import/importers/assets-importer.ts +240 -236
  183. package/lib/import/importers/content-items-importer.ts +126 -122
  184. package/lib/import/importers/language-variant-importer.ts +324 -328
  185. package/lib/import/importers/workflow-importer.ts +372 -367
  186. package/lib/import/utils/import.utils.ts +9 -7
  187. package/lib/index.ts +12 -8
  188. package/lib/metadata.ts +3 -4
  189. package/lib/node/cli/actions/export-action.ts +44 -38
  190. package/lib/node/cli/actions/import-action.ts +32 -29
  191. package/lib/node/cli/actions/migrate-action.ts +50 -46
  192. package/lib/node/cli/app.ts +21 -21
  193. package/lib/node/cli/args/args-fetcher.ts +55 -54
  194. package/lib/node/cli/args/args-setter.ts +34 -32
  195. package/lib/node/cli/cli.models.ts +17 -17
  196. package/lib/node/cli/commands.ts +165 -153
  197. package/lib/toolkit/elements-builder.ts +69 -69
  198. package/lib/toolkit/export.ts +21 -21
  199. package/lib/toolkit/file.ts +59 -53
  200. package/lib/toolkit/import.ts +32 -32
  201. package/lib/toolkit/migrate.ts +60 -49
  202. package/lib/translation/extraction/items-extraction.processor.ts +203 -173
  203. package/lib/translation/helpers/export-placeholder.utils.ts +10 -0
  204. package/lib/translation/helpers/rich-text.processor.ts +311 -311
  205. package/lib/translation/transforms/export-transforms.ts +313 -279
  206. package/lib/translation/transforms/import-transforms.ts +188 -191
  207. package/lib/zip/zip-manager.ts +28 -27
  208. package/lib/zip/zip-packager.ts +75 -73
  209. package/lib/zip/zip-transformer.ts +112 -107
  210. package/lib/zip/zip.models.ts +7 -7
  211. package/package.json +91 -84
  212. package/dist/core/index.d.ts +0 -16
  213. package/dist/core/index.js +0 -17
  214. package/dist/core/index.js.map +0 -1
  215. package/dist/export/index.d.ts +0 -2
  216. package/dist/export/index.js +0 -3
  217. package/dist/export/index.js.map +0 -1
  218. package/dist/file/index.d.ts +0 -1
  219. package/dist/file/index.js +0 -2
  220. package/dist/file/index.js.map +0 -1
  221. package/dist/import/index.d.ts +0 -2
  222. package/dist/import/index.js +0 -3
  223. package/dist/import/index.js.map +0 -1
  224. package/dist/toolkit/index.d.ts +0 -5
  225. package/dist/toolkit/index.js +0 -6
  226. package/dist/toolkit/index.js.map +0 -1
  227. package/dist/translation/index.d.ts +0 -4
  228. package/dist/translation/index.js +0 -5
  229. package/dist/translation/index.js.map +0 -1
  230. package/dist/zip/index.d.ts +0 -4
  231. package/dist/zip/index.js +0 -5
  232. package/dist/zip/index.js.map +0 -1
  233. package/lib/core/index.ts +0 -18
  234. package/lib/export/index.ts +0 -2
  235. package/lib/file/index.ts +0 -1
  236. package/lib/import/index.ts +0 -2
  237. package/lib/toolkit/index.ts +0 -5
  238. package/lib/translation/index.ts +0 -4
  239. package/lib/zip/index.ts +0 -4
@@ -1,112 +1,117 @@
1
- import chalk from 'chalk';
2
- import type { z } from 'zod';
3
- import type { Logger, MigrationAsset, MigrationData, MigrationItem, ZipMigrationAssetSchema } from '../core/index.js';
4
- import { MigrationItemsSchema, ZipMigrationAssetsSchema, getDefaultLogger, mapAsync } from '../core/index.js';
5
- import type { FileBinaryData, ZipPackager } from './zip.models.js';
1
+ import chalk from "chalk";
2
+ import type { z } from "zod";
3
+ import { getDefaultLogger } from "../core/logs/loggers.js";
4
+ import { MigrationToolkitError } from "../core/models/error.models.js";
5
+ import type { Logger } from "../core/models/log.models.js";
6
+ import type { MigrationAsset, MigrationData, MigrationItem } from "../core/models/migration.models.js";
7
+ import { MigrationItemsSchema, type ZipMigrationAssetSchema, ZipMigrationAssetsSchema } from "../core/models/migration.schema.js";
8
+ import { mapAsync } from "../core/utils/array.utils.js";
9
+ import type { FileBinaryData, ZipPackager } from "./zip.models.js";
6
10
 
7
11
  type ZipAssetRecord = z.infer<typeof ZipMigrationAssetSchema>;
8
12
 
9
13
  export function zipTransformer(zip: ZipPackager, logger?: Logger) {
10
- const loggerToUse: Logger = logger ?? getDefaultLogger();
11
- const filename: string = 'items.json';
12
- const assetsFilename: string = 'assets.json';
13
- const assetsBinaryFolderName: string = 'binary_data';
14
-
15
- const getAssetFolderConfig = (asset: MigrationAsset): { readonly partialColder: string; readonly fullPath: string } => {
16
- const codenamePartialFolder: string = asset.codename.slice(0, 2);
17
- return {
18
- partialColder: codenamePartialFolder,
19
- fullPath: `${assetsBinaryFolderName}/${codenamePartialFolder}/${asset.codename}/${asset.filename}`
20
- };
21
- };
22
-
23
- const transformItems = (items: readonly MigrationItem[]): void => {
24
- zip.addFile(filename, items.length ? JSON.stringify(items) : '[]');
25
- };
26
-
27
- const transformAssets = (assets: readonly MigrationAsset[]): void => {
28
- const assetRecords: ZipAssetRecord[] = [];
29
- const binaryDataFolder = zip.addFolder(assetsBinaryFolderName);
30
-
31
- assets.forEach((asset) => {
32
- const folderConfig = getAssetFolderConfig(asset);
33
- const partialFolder = binaryDataFolder.addFolder(folderConfig.partialColder);
34
- const codenameFolder = partialFolder.addFolder(asset.codename);
35
-
36
- assetRecords.push({
37
- _zipFilename: folderConfig.fullPath,
38
- filename: asset.filename,
39
- title: asset.title,
40
- codename: asset.codename,
41
- collection: asset.collection,
42
- descriptions: asset.descriptions,
43
- folder: asset.folder
44
- });
45
-
46
- if (asset.binary_data) {
47
- codenameFolder.addFile(asset.filename, asset.binary_data);
48
- }
49
- });
50
-
51
- zip.addFile(assetsFilename, JSON.stringify(assetRecords));
52
- };
53
-
54
- const parseItems = async () => {
55
- const content = await zip.getFileContentAsync(filename);
56
-
57
- if (!content) {
58
- return [];
59
- }
60
-
61
- return MigrationItemsSchema.parse(JSON.parse(content));
62
- };
63
-
64
- const parseAssets = async () => {
65
- const content = await zip.getFileContentAsync(assetsFilename);
66
-
67
- if (!content) {
68
- return [];
69
- }
70
-
71
- const assetRecords = ZipMigrationAssetsSchema.parse(JSON.parse(content));
72
-
73
- return await mapAsync(assetRecords, async (assetRecord) => {
74
- const binaryFile = await zip.getBinaryDataAsync(`${assetRecord._zipFilename}`);
75
-
76
- if (!binaryFile) {
77
- throw Error(`Could not load binary data for file '${chalk.red(assetRecord._zipFilename)}'`);
78
- }
79
-
80
- const migrationAsset: MigrationAsset = {
81
- codename: assetRecord.codename,
82
- filename: assetRecord.filename,
83
- collection: assetRecord.collection,
84
- title: assetRecord.title,
85
- descriptions: assetRecord.descriptions,
86
- folder: assetRecord.folder,
87
- binary_data: binaryFile
88
- };
89
-
90
- return migrationAsset;
91
- });
92
- };
93
-
94
- return {
95
- async transformAsync(data: MigrationData): Promise<FileBinaryData> {
96
- transformItems(data.items);
97
- transformAssets(data.assets);
98
-
99
- return await zip.generateZipAsync({ logger: loggerToUse });
100
- },
101
- async parseAsync(): Promise<MigrationData> {
102
- const items = await parseItems();
103
- const assets = await parseAssets();
104
-
105
- const migrationData: MigrationData = {
106
- assets: assets,
107
- items: items
108
- };
109
- return migrationData;
110
- }
111
- };
14
+ const loggerToUse: Logger = logger ?? getDefaultLogger();
15
+ const filename: string = "items.json";
16
+ const assetsFilename: string = "assets.json";
17
+ const assetsBinaryFolderName: string = "binary_data";
18
+
19
+ const getAssetFolderConfig = (asset: MigrationAsset): { readonly partialColder: string; readonly fullPath: string } => {
20
+ const codenamePartialFolder: string = asset.codename.slice(0, 2);
21
+ return {
22
+ partialColder: codenamePartialFolder,
23
+ fullPath: `${assetsBinaryFolderName}/${codenamePartialFolder}/${asset.codename}/${asset.filename}`,
24
+ };
25
+ };
26
+
27
+ const transformItems = (items: readonly MigrationItem[]): void => {
28
+ zip.addFile(filename, items.length ? JSON.stringify(items) : "[]");
29
+ };
30
+
31
+ const transformAssets = (assets: readonly MigrationAsset[]): void => {
32
+ const assetRecords: ZipAssetRecord[] = [];
33
+ const binaryDataFolder = zip.addFolder(assetsBinaryFolderName);
34
+
35
+ assets.forEach((asset) => {
36
+ const folderConfig = getAssetFolderConfig(asset);
37
+ const partialFolder = binaryDataFolder.addFolder(folderConfig.partialColder);
38
+ const codenameFolder = partialFolder.addFolder(asset.codename);
39
+
40
+ assetRecords.push({
41
+ _zipFilename: folderConfig.fullPath,
42
+ filename: asset.filename,
43
+ title: asset.title,
44
+ codename: asset.codename,
45
+ collection: asset.collection,
46
+ descriptions: asset.descriptions,
47
+ folder: asset.folder,
48
+ });
49
+
50
+ codenameFolder.addFile(asset.filename, asset.binary_data);
51
+ });
52
+
53
+ zip.addFile(assetsFilename, JSON.stringify(assetRecords));
54
+ };
55
+
56
+ const parseItems = async () => {
57
+ const content = await zip.getFileContentAsync(filename);
58
+
59
+ if (!content) {
60
+ return [];
61
+ }
62
+
63
+ return MigrationItemsSchema.parse(JSON.parse(content));
64
+ };
65
+
66
+ const parseAssets = async () => {
67
+ const content = await zip.getFileContentAsync(assetsFilename);
68
+
69
+ if (!content) {
70
+ return [];
71
+ }
72
+
73
+ const assetRecords = ZipMigrationAssetsSchema.parse(JSON.parse(content));
74
+
75
+ return await mapAsync(assetRecords, async (assetRecord) => {
76
+ const binaryFile = await zip.getBinaryDataAsync(`${assetRecord._zipFilename}`);
77
+
78
+ if (!binaryFile) {
79
+ throw new MigrationToolkitError(
80
+ "invalidZip",
81
+ `Could not load binary data for file '${chalk.red(assetRecord._zipFilename)}'`,
82
+ );
83
+ }
84
+
85
+ const migrationAsset: MigrationAsset = {
86
+ codename: assetRecord.codename,
87
+ filename: assetRecord.filename,
88
+ collection: assetRecord.collection,
89
+ title: assetRecord.title,
90
+ descriptions: assetRecord.descriptions,
91
+ folder: assetRecord.folder,
92
+ binary_data: binaryFile,
93
+ };
94
+
95
+ return migrationAsset;
96
+ });
97
+ };
98
+
99
+ return {
100
+ async transformAsync(data: MigrationData): Promise<FileBinaryData> {
101
+ transformItems(data.items);
102
+ transformAssets(data.assets);
103
+
104
+ return await zip.generateZipAsync({ logger: loggerToUse });
105
+ },
106
+ async parseAsync(): Promise<MigrationData> {
107
+ const items = await parseItems();
108
+ const assets = await parseAssets();
109
+
110
+ const migrationData: MigrationData = {
111
+ assets: assets,
112
+ items: items,
113
+ };
114
+ return migrationData;
115
+ },
116
+ };
112
117
  }
@@ -1,13 +1,13 @@
1
- import type { Buffer as BufferProxy } from 'buffer';
2
- import type { Logger } from '../core/index.js';
1
+ import type { Buffer as BufferProxy } from "buffer";
2
+ import type { Logger } from "../core/models/log.models.js";
3
3
 
4
4
  export type FileBinaryData = BufferProxy | Blob;
5
5
  export type ZipCompressionLevel = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
6
6
 
7
7
  export type ZipPackager = {
8
- addFile(filePath: string, data: string | FileBinaryData): void;
9
- addFolder(name: string): ZipPackager;
10
- generateZipAsync(config: { readonly logger?: Logger; readonly compressionLevel?: ZipCompressionLevel }): Promise<FileBinaryData>;
11
- getBinaryDataAsync(filePath: string): Promise<FileBinaryData | undefined>;
12
- getFileContentAsync(filePath: string): Promise<string | undefined>;
8
+ addFile(filePath: string, data: string | FileBinaryData): void;
9
+ addFolder(name: string): ZipPackager;
10
+ generateZipAsync(config: { readonly logger?: Logger; readonly compressionLevel?: ZipCompressionLevel }): Promise<FileBinaryData>;
11
+ getBinaryDataAsync(filePath: string): Promise<FileBinaryData | undefined>;
12
+ getFileContentAsync(filePath: string): Promise<string | undefined>;
13
13
  };
package/package.json CHANGED
@@ -1,86 +1,93 @@
1
1
  {
2
- "name": "@kontent-ai/migration-toolkit",
3
- "version": "2.9.1",
4
- "description": "This program can be used to import content related data into Kontent.ai from various sources. The included functionality enables the content & asset export/import from Kontent.ai environments.",
5
- "preferGlobal": true,
6
- "private": false,
7
- "bin": {
8
- "kontent-ai-migration-toolkit": "./dist/node/cli/app.js"
9
- },
10
- "repository": {
11
- "type": "git",
12
- "url": "https://github.com/Kontent-ai/kontent-ai-migration-toolkit"
13
- },
14
- "engines": {
15
- "node": ">=20"
16
- },
17
- "author": "Richard Sustek",
18
- "exports": "./dist/index.js",
19
- "types": "./dist/index.d.ts",
20
- "type": "module",
21
- "scripts": {
22
- "test": "npm run test:unit",
23
- "release": "npm run lint && standard-version && npm run update:version",
24
- "release:major": "npm run lint && standard-version --release-as major && npm run update:version",
25
- "release:major:beta": "npm run lint && standard-version --prerelease --release-as major && npm run update:version",
26
- "release:beta": "standard-version --prerelease && npm run update:version",
27
- "prepublishOnly": "npm run lint && npm run build && npm run push:tags",
28
- "publish:beta": "npm publish --tag=next",
29
- "build": "npm run clean && npm run lint:fix && tsc --p tsconfig.build.json",
30
- "test:migrate": "cd scripts/test && tsx test-migrate.ts",
31
- "test:import": "cd scripts/test && tsx test-import.ts",
32
- "test:export": "cd scripts/test && tsx test-export.ts",
33
- "test:export:cli": "tsx lib/node/cli/app export --language=x --items=x --sourceEnvironmentId=x --sourceApiKey=x",
34
- "test:help": "tsx lib/node/cli/app --help",
35
- "test:help:command": "tsx lib/node/cli/app migrate --help",
36
- "test:unit": "vitest run --config=vitest.config.js",
37
- "lint": "npx eslint lib",
38
- "lint:fix": "npx eslint lib --fix",
39
- "clean": "tsx scripts/clean.ts",
40
- "push:tags": "git push --tags",
41
- "update:version": "tsx ./scripts/version/update-version.ts"
42
- },
43
- "keywords": [
44
- "Kontent.ai",
45
- "Kontent.ai import",
46
- "Kontent.ai import toolkit",
47
- "Kontent.ai migration tool",
48
- "Kontent.ai migrations",
49
- "Kontent.ai data migrations"
50
- ],
51
- "license": "MIT",
52
- "dependencies": {
53
- "@kontent-ai-consulting/tools-analytics": "0.0.9",
54
- "@kontent-ai/management-sdk": "8.0.0",
55
- "browser-or-node": "3.0.0",
56
- "buffer": "6.0.3",
57
- "bytes": "3.1.2",
58
- "chalk": "5.6.2",
59
- "deep-equal": "2.2.3",
60
- "dotenv": "17.2.3",
61
- "jszip": "3.10.1",
62
- "mime": "4.1.0",
63
- "ora": "9.0.0",
64
- "p-limit": "7.2.0",
65
- "prompts": "2.4.2",
66
- "ts-pattern": "5.9.0",
67
- "yargs": "18.0.0",
68
- "zod": "4.1.12"
69
- },
70
- "devDependencies": {
71
- "@eslint/js": "9.39.1",
72
- "@types/browser-or-node": "1.3.2",
73
- "@types/bytes": "3.1.5",
74
- "@types/deep-equal": "1.0.4",
75
- "@types/node": "24.10.0",
76
- "@types/prompts": "2.4.9",
77
- "@types/yargs": "17.0.34",
78
- "eslint": "9.39.1",
79
- "standard-version": "9.5.0",
80
- "tslib": "2.8.1",
81
- "tsx": "4.20.6",
82
- "typescript": "5.9.3",
83
- "typescript-eslint": "8.46.4",
84
- "vitest": "4.0.8"
85
- }
2
+ "name": "@kontent-ai/migration-toolkit",
3
+ "version": "3.0.0-1",
4
+ "description": "This program can be used to import content related data into Kontent.ai from various sources. The included functionality enables the content & asset export/import from Kontent.ai environments.",
5
+ "preferGlobal": true,
6
+ "private": false,
7
+ "bin": {
8
+ "kontent-ai-migration-toolkit": "./dist/node/cli/app.js"
9
+ },
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "https://github.com/Kontent-ai/kontent-ai-migration-toolkit"
13
+ },
14
+ "engines": {
15
+ "node": ">=20"
16
+ },
17
+ "author": "Richard Sustek",
18
+ "exports": "./dist/index.js",
19
+ "types": "./dist/index.d.ts",
20
+ "type": "module",
21
+ "scripts": {
22
+ "test": "npm run test:unit",
23
+ "release": "npm run lint && standard-version && npm run update:version",
24
+ "release:major": "npm run lint && standard-version --release-as major && npm run update:version",
25
+ "release:major:beta": "npm run lint && standard-version --prerelease --release-as major && npm run update:version",
26
+ "release:beta": "standard-version --prerelease && npm run update:version",
27
+ "prepublishOnly": "npm run lint && npm run build && npm run push:tags",
28
+ "publish:beta": "npm publish --tag=next",
29
+ "build": "npm run clean && npm run lint && tsc --p tsconfig.build.json",
30
+ "test:migrate": "cd scripts/test && tsx test-migrate.ts",
31
+ "test:import": "cd scripts/test && tsx test-import.ts",
32
+ "test:export": "cd scripts/test && tsx test-export.ts",
33
+ "test:export:cli": "tsx lib/node/cli/app export --language=x --items=x --sourceEnvironmentId=x --sourceApiKey=x",
34
+ "test:help": "tsx lib/node/cli/app --help",
35
+ "test:help:command": "tsx lib/node/cli/app migrate --help",
36
+ "test:unit": "vitest run --config=vitest.config.js",
37
+ "lint": "npm run biome:check && npm run eslint",
38
+ "lint:fix": "npm run biome:fix && npm run eslint:fix",
39
+ "clean": "tsx scripts/clean.ts",
40
+ "push:tags": "git push --tags",
41
+ "update:version": "tsx ./scripts/version/update-version.ts",
42
+ "biome:check": "biome check",
43
+ "biome:fix": "biome check --write",
44
+ "biome:fix:unsafe": "biome check --write --unsafe",
45
+ "eslint": "eslint",
46
+ "eslint:fix": "eslint --fix"
47
+ },
48
+ "keywords": [
49
+ "Kontent.ai",
50
+ "Kontent.ai import",
51
+ "Kontent.ai import toolkit",
52
+ "Kontent.ai migration tool",
53
+ "Kontent.ai migrations",
54
+ "Kontent.ai data migrations"
55
+ ],
56
+ "license": "MIT",
57
+ "dependencies": {
58
+ "@kontent-ai-consulting/tools-analytics": "0.0.9",
59
+ "@kontent-ai/management-sdk": "8.0.0",
60
+ "browser-or-node": "3.0.0",
61
+ "buffer": "6.0.3",
62
+ "bytes": "3.1.2",
63
+ "chalk": "5.6.2",
64
+ "deep-equal": "2.2.3",
65
+ "dotenv": "17.2.3",
66
+ "jszip": "3.10.1",
67
+ "mime": "4.1.0",
68
+ "ora": "9.0.0",
69
+ "p-limit": "7.2.0",
70
+ "prompts": "2.4.2",
71
+ "ts-pattern": "5.9.0",
72
+ "yargs": "18.0.0",
73
+ "zod": "4.1.13"
74
+ },
75
+ "devDependencies": {
76
+ "@biomejs/biome": "2.3.7",
77
+ "@kontent-ai/biome-config": "0.5.1",
78
+ "@eslint/js": "9.39.1",
79
+ "@types/browser-or-node": "1.3.2",
80
+ "@types/bytes": "3.1.5",
81
+ "@types/deep-equal": "1.0.4",
82
+ "@types/node": "24.10.1",
83
+ "@types/prompts": "2.4.9",
84
+ "@types/yargs": "17.0.35",
85
+ "eslint": "9.39.1",
86
+ "standard-version": "9.5.0",
87
+ "tslib": "2.8.1",
88
+ "tsx": "4.20.6",
89
+ "typescript": "5.9.3",
90
+ "typescript-eslint": "8.48.0",
91
+ "vitest": "4.0.14"
92
+ }
86
93
  }
@@ -1,16 +0,0 @@
1
- export * from './utils/array.utils.js';
2
- export * from './utils/binary-data.utils.js';
3
- export * from './utils/confirm.utils.js';
4
- export * from './utils/error.utils.js';
5
- export * from './utils/external-id.utils.js';
6
- export * from './utils/global.utils.js';
7
- export * from './utils/http.utils.js';
8
- export * from './utils/management-client-utils.js';
9
- export * from './utils/processing-utils.js';
10
- export * from './utils/run.utils.js';
11
- export * from './models/core.models.js';
12
- export * from './models/log.models.js';
13
- export * from './models/migration.models.js';
14
- export * from './models/migration.schema.js';
15
- export * from './helpers/workflow-helper.js';
16
- export * from './logs/loggers.js';
@@ -1,17 +0,0 @@
1
- export * from './utils/array.utils.js';
2
- export * from './utils/binary-data.utils.js';
3
- export * from './utils/confirm.utils.js';
4
- export * from './utils/error.utils.js';
5
- export * from './utils/external-id.utils.js';
6
- export * from './utils/global.utils.js';
7
- export * from './utils/http.utils.js';
8
- export * from './utils/management-client-utils.js';
9
- export * from './utils/processing-utils.js';
10
- export * from './utils/run.utils.js';
11
- export * from './models/core.models.js';
12
- export * from './models/log.models.js';
13
- export * from './models/migration.models.js';
14
- export * from './models/migration.schema.js';
15
- export * from './helpers/workflow-helper.js';
16
- export * from './logs/loggers.js';
17
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oCAAoC,CAAC;AACnD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,sBAAsB,CAAC;AAErC,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAE7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,mBAAmB,CAAC"}
@@ -1,2 +0,0 @@
1
- export * from './export-manager.js';
2
- export * from './export.models.js';
@@ -1,3 +0,0 @@
1
- export * from './export-manager.js';
2
- export * from './export.models.js';
3
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/export/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC"}
@@ -1 +0,0 @@
1
- export * from './file-manager.js';
@@ -1,2 +0,0 @@
1
- export * from './file-manager.js';
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/file/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}
@@ -1,2 +0,0 @@
1
- export * from './import-manager.js';
2
- export * from './import.models.js';
@@ -1,3 +0,0 @@
1
- export * from './import-manager.js';
2
- export * from './import.models.js';
3
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/import/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC"}
@@ -1,5 +0,0 @@
1
- export * from './elements-builder.js';
2
- export * from './export.js';
3
- export * from './file.js';
4
- export * from './import.js';
5
- export * from './migrate.js';
@@ -1,6 +0,0 @@
1
- export * from './elements-builder.js';
2
- export * from './export.js';
3
- export * from './file.js';
4
- export * from './import.js';
5
- export * from './migrate.js';
6
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/toolkit/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC"}
@@ -1,4 +0,0 @@
1
- export * from './extraction/items-extraction.processor.js';
2
- export * from './helpers/rich-text.processor.js';
3
- export * from './transforms/export-transforms.js';
4
- export * from './transforms/import-transforms.js';
@@ -1,5 +0,0 @@
1
- export * from './extraction/items-extraction.processor.js';
2
- export * from './helpers/rich-text.processor.js';
3
- export * from './transforms/export-transforms.js';
4
- export * from './transforms/import-transforms.js';
5
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/translation/index.ts"],"names":[],"mappings":"AAAA,cAAc,4CAA4C,CAAC;AAC3D,cAAc,kCAAkC,CAAC;AACjD,cAAc,mCAAmC,CAAC;AAClD,cAAc,mCAAmC,CAAC"}
@@ -1,4 +0,0 @@
1
- export * from './zip-manager.js';
2
- export * from './zip-packager.js';
3
- export * from './zip-transformer.js';
4
- export * from './zip.models.js';
package/dist/zip/index.js DELETED
@@ -1,5 +0,0 @@
1
- export * from './zip-manager.js';
2
- export * from './zip-packager.js';
3
- export * from './zip-transformer.js';
4
- export * from './zip.models.js';
5
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/zip/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC"}
package/lib/core/index.ts DELETED
@@ -1,18 +0,0 @@
1
- export * from './utils/array.utils.js';
2
- export * from './utils/binary-data.utils.js';
3
- export * from './utils/confirm.utils.js';
4
- export * from './utils/error.utils.js';
5
- export * from './utils/external-id.utils.js';
6
- export * from './utils/global.utils.js';
7
- export * from './utils/http.utils.js';
8
- export * from './utils/management-client-utils.js';
9
- export * from './utils/processing-utils.js';
10
- export * from './utils/run.utils.js';
11
-
12
- export * from './models/core.models.js';
13
- export * from './models/log.models.js';
14
- export * from './models/migration.models.js';
15
- export * from './models/migration.schema.js';
16
-
17
- export * from './helpers/workflow-helper.js';
18
- export * from './logs/loggers.js';
@@ -1,2 +0,0 @@
1
- export * from './export-manager.js';
2
- export * from './export.models.js';
package/lib/file/index.ts DELETED
@@ -1 +0,0 @@
1
- export * from './file-manager.js';
@@ -1,2 +0,0 @@
1
- export * from './import-manager.js';
2
- export * from './import.models.js';
@@ -1,5 +0,0 @@
1
- export * from './elements-builder.js';
2
- export * from './export.js';
3
- export * from './file.js';
4
- export * from './import.js';
5
- export * from './migrate.js';
@@ -1,4 +0,0 @@
1
- export * from './extraction/items-extraction.processor.js';
2
- export * from './helpers/rich-text.processor.js';
3
- export * from './transforms/export-transforms.js';
4
- export * from './transforms/import-transforms.js';
package/lib/zip/index.ts DELETED
@@ -1,4 +0,0 @@
1
- export * from './zip-manager.js';
2
- export * from './zip-packager.js';
3
- export * from './zip-transformer.js';
4
- export * from './zip.models.js';