@kontent-ai/migration-toolkit 2.8.0 → 2.9.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.
@@ -1,8 +1,7 @@
1
1
  import { Buffer as BufferProxy } from 'buffer';
2
2
  import type { Logger, MigrationData } from '../core/index.js';
3
- import { defaultZipFilename, executeWithTrackingAsync, getDefaultLogger } from '../core/index.js';
3
+ import { defaultZipFilename, getDefaultLogger } from '../core/index.js';
4
4
  import { fileManager } from '../file/index.js';
5
- import { libMetadata } from '../metadata.js';
6
5
  import { zipManager } from '../zip/index.js';
7
6
 
8
7
  export interface StoreConfig {
@@ -20,49 +19,19 @@ export async function storeAsync(config: StoreConfig): Promise<void> {
20
19
  const logger = config.logger ?? getDefaultLogger();
21
20
  const filename = config.filename ?? defaultZipFilename;
22
21
 
23
- await executeWithTrackingAsync<void>({
24
- event: {
25
- tool: 'migrationToolkit',
26
- package: {
27
- name: libMetadata.name,
28
- version: libMetadata.version
29
- },
30
- action: 'store',
31
- relatedEnvironmentId: undefined,
32
- details: {}
33
- },
34
- func: async () => {
35
- const zipData = await zipManager(logger).createZipAsync(config.data);
22
+ const zipData = await zipManager(logger).createZipAsync(config.data);
36
23
 
37
- if (zipData instanceof BufferProxy) {
38
- await fileManager(logger).writeFileAsync(filename, zipData);
39
- } else {
40
- throw Error(`Cannot store '${filename}' on File system because the provided zip is not a Buffer`);
41
- }
42
- },
43
- logger: config.logger
44
- });
24
+ if (zipData instanceof BufferProxy) {
25
+ await fileManager(logger).writeFileAsync(filename, zipData);
26
+ } else {
27
+ throw Error(`Cannot store '${filename}' on File system because the provided zip is not a Buffer`);
28
+ }
45
29
  }
46
30
 
47
31
  export async function extractAsync(config: ExtractConfig): Promise<MigrationData> {
48
32
  const logger = config.logger ?? getDefaultLogger();
49
33
  const filename = config.filename ?? defaultZipFilename;
50
34
 
51
- return await executeWithTrackingAsync({
52
- event: {
53
- tool: 'migrationToolkit',
54
- package: {
55
- name: libMetadata.name,
56
- version: libMetadata.version
57
- },
58
- action: 'extract',
59
- relatedEnvironmentId: undefined,
60
- details: {}
61
- },
62
- func: async () => {
63
- const fileData = await fileManager(logger).loadFileAsync(filename);
64
- return await zipManager(logger).parseZipAsync(fileData);
65
- },
66
- logger: config.logger
67
- });
35
+ const fileData = await fileManager(logger).loadFileAsync(filename);
36
+ return await zipManager(logger).parseZipAsync(fileData);
68
37
  }
@@ -1,37 +1,20 @@
1
1
  import chalk from 'chalk';
2
2
  import { writeFile } from 'fs/promises';
3
- import { executeWithTrackingAsync } from '../core/index.js';
4
3
  import type { ImportConfig, ImportResult } from '../import/index.js';
5
4
  import { importManager as _importManager } from '../import/index.js';
6
- import { libMetadata } from '../metadata.js';
7
5
 
8
6
  export async function importAsync(config: ImportConfig): Promise<ImportResult> {
9
- return await executeWithTrackingAsync({
10
- event: {
11
- tool: 'migrationToolkit',
12
- package: {
13
- name: libMetadata.name,
14
- version: libMetadata.version
15
- },
16
- action: 'import',
17
- relatedEnvironmentId: undefined,
18
- details: {}
19
- },
20
- func: async () => {
21
- const importManager = _importManager(config);
22
- const importResult = await importManager.importAsync();
7
+ const importManager = _importManager(config);
8
+ const importResult = await importManager.importAsync();
23
9
 
24
- if (config.createReportFile) {
25
- const reportFile = importManager.getReportFile(importResult);
26
- await writeFile(reportFile.filename, reportFile.content);
27
- config.logger?.log({
28
- type: 'writeFs',
29
- message: `Report '${chalk.yellow(reportFile.filename)}' was created`
30
- });
31
- }
10
+ if (config.createReportFile) {
11
+ const reportFile = importManager.getReportFile(importResult);
12
+ await writeFile(reportFile.filename, reportFile.content);
13
+ config.logger?.log({
14
+ type: 'writeFs',
15
+ message: `Report '${chalk.yellow(reportFile.filename)}' was created`
16
+ });
17
+ }
32
18
 
33
- return importResult;
34
- },
35
- logger: config.logger
36
- });
19
+ return importResult;
37
20
  }
@@ -1,9 +1,8 @@
1
1
  import type { IRetryStrategyOptions } from '@kontent-ai/core-sdk';
2
2
  import type { ExternalIdGenerator, Logger, ManagementClientConfig, MigrationData } from '../core/index.js';
3
- import { executeWithTrackingAsync, getDefaultLogger } from '../core/index.js';
3
+ import { getDefaultLogger } from '../core/index.js';
4
4
  import type { SourceExportItem } from '../export/index.js';
5
5
  import type { ImportResult } from '../import/index.js';
6
- import { libMetadata } from '../metadata.js';
7
6
  import { exportAsync } from './export.js';
8
7
  import { importAsync } from './import.js';
9
8
 
@@ -27,38 +26,21 @@ export interface MigrationResult {
27
26
  export async function migrateAsync(config: MigrationConfig): Promise<MigrationResult> {
28
27
  const logger = config.logger ?? getDefaultLogger();
29
28
 
30
- return await executeWithTrackingAsync({
31
- event: {
32
- tool: 'migrationToolkit',
33
- package: {
34
- name: libMetadata.name,
35
- version: libMetadata.version
36
- },
37
- action: 'migrate',
38
- relatedEnvironmentId: undefined,
39
- details: {
40
- itemsCount: config.sourceEnvironment.items.length
41
- }
42
- },
43
- func: async () => {
44
- const migrationData = await exportAsync({
45
- ...config.sourceEnvironment,
46
- logger: logger,
47
- exportItems: config.sourceEnvironment.items
48
- });
49
-
50
- const importResult = await importAsync({
51
- ...config.targetEnvironment,
52
- logger: logger,
53
- data: migrationData,
54
- externalIdGenerator: config.externalIdGenerator
55
- });
29
+ const migrationData = await exportAsync({
30
+ ...config.sourceEnvironment,
31
+ logger: logger,
32
+ exportItems: config.sourceEnvironment.items
33
+ });
56
34
 
57
- return {
58
- importResult,
59
- migrationData
60
- };
61
- },
62
- logger: config.logger
35
+ const importResult = await importAsync({
36
+ ...config.targetEnvironment,
37
+ logger: logger,
38
+ data: migrationData,
39
+ externalIdGenerator: config.externalIdGenerator
63
40
  });
41
+
42
+ return {
43
+ importResult,
44
+ migrationData
45
+ };
64
46
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kontent-ai/migration-toolkit",
3
- "version": "2.8.0",
3
+ "version": "2.9.0",
4
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
5
  "preferGlobal": true,
6
6
  "private": false,
@@ -50,39 +50,38 @@
50
50
  ],
51
51
  "license": "MIT",
52
52
  "dependencies": {
53
- "@kontent-ai-consulting/tools-analytics": "0.0.8",
54
- "@kontent-ai/management-sdk": "7.9.0",
53
+ "@kontent-ai/management-sdk": "8.0.0",
55
54
  "browser-or-node": "3.0.0",
56
55
  "buffer": "6.0.3",
57
56
  "bytes": "3.1.2",
58
- "chalk": "5.4.1",
57
+ "chalk": "5.6.2",
59
58
  "deep-equal": "2.2.3",
60
- "dotenv": "16.5.0",
59
+ "dotenv": "17.2.3",
61
60
  "jszip": "3.10.1",
62
- "mime": "4.0.7",
63
- "ora": "8.2.0",
64
- "p-limit": "6.2.0",
61
+ "mime": "4.1.0",
62
+ "ora": "9.0.0",
63
+ "p-limit": "7.2.0",
65
64
  "prompts": "2.4.2",
66
- "ts-pattern": "5.7.0",
67
- "yargs": "17.7.2",
68
- "zod": "3.24.3"
65
+ "ts-pattern": "5.9.0",
66
+ "yargs": "18.0.0",
67
+ "zod": "4.1.12"
69
68
  },
70
69
  "devDependencies": {
71
- "@eslint/js": "9.25.1",
70
+ "@eslint/js": "9.39.1",
72
71
  "@types/browser-or-node": "1.3.2",
73
72
  "@types/bytes": "3.1.5",
74
73
  "@types/deep-equal": "1.0.4",
75
- "@types/node": "22.15.3",
74
+ "@types/node": "24.10.0",
76
75
  "@types/prompts": "2.4.9",
77
- "@types/yargs": "17.0.33",
78
- "@typescript-eslint/eslint-plugin": "8.31.1",
79
- "@typescript-eslint/parser": "8.31.1",
80
- "eslint": "9.25.1",
76
+ "@types/yargs": "17.0.34",
77
+ "@typescript-eslint/eslint-plugin": "8.46.4",
78
+ "@typescript-eslint/parser": "8.46.4",
79
+ "eslint": "9.39.1",
81
80
  "standard-version": "9.5.0",
82
81
  "tslib": "2.8.1",
83
- "tsx": "4.19.4",
84
- "typescript": "5.8.3",
85
- "typescript-eslint": "8.31.1",
86
- "vitest": "3.1.2"
82
+ "tsx": "4.20.6",
83
+ "typescript": "5.9.3",
84
+ "typescript-eslint": "8.46.4",
85
+ "vitest": "4.0.8"
87
86
  }
88
87
  }