@kontent-ai/migration-toolkit 1.0.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/.npmignore +13 -0
- package/LICENSE.md +9 -0
- package/README.md +272 -0
- package/dist/es2022/core/helpers/workflow-helper.d.ts +37 -0
- package/dist/es2022/core/helpers/workflow-helper.js +67 -0
- package/dist/es2022/core/helpers/workflow-helper.js.map +1 -0
- package/dist/es2022/core/index.d.ts +15 -0
- package/dist/es2022/core/index.js +16 -0
- package/dist/es2022/core/index.js.map +1 -0
- package/dist/es2022/core/logs/loggers.d.ts +2 -0
- package/dist/es2022/core/logs/loggers.js +69 -0
- package/dist/es2022/core/logs/loggers.js.map +1 -0
- package/dist/es2022/core/models/core.models.d.ts +91 -0
- package/dist/es2022/core/models/core.models.js +2 -0
- package/dist/es2022/core/models/core.models.js.map +1 -0
- package/dist/es2022/core/models/log.models.d.ts +15 -0
- package/dist/es2022/core/models/log.models.js +2 -0
- package/dist/es2022/core/models/log.models.js.map +1 -0
- package/dist/es2022/core/models/migration.models.d.ts +136 -0
- package/dist/es2022/core/models/migration.models.js +2 -0
- package/dist/es2022/core/models/migration.models.js.map +1 -0
- package/dist/es2022/core/utils/array.utils.d.ts +5 -0
- package/dist/es2022/core/utils/array.utils.js +27 -0
- package/dist/es2022/core/utils/array.utils.js.map +1 -0
- package/dist/es2022/core/utils/binary-data.utils.d.ts +5 -0
- package/dist/es2022/core/utils/binary-data.utils.js +21 -0
- package/dist/es2022/core/utils/binary-data.utils.js.map +1 -0
- package/dist/es2022/core/utils/confirm.utils.d.ts +31 -0
- package/dist/es2022/core/utils/confirm.utils.js +73 -0
- package/dist/es2022/core/utils/confirm.utils.js.map +1 -0
- package/dist/es2022/core/utils/error.utils.d.ts +4 -0
- package/dist/es2022/core/utils/error.utils.js +50 -0
- package/dist/es2022/core/utils/error.utils.js.map +1 -0
- package/dist/es2022/core/utils/external-id.utils.d.ts +5 -0
- package/dist/es2022/core/utils/external-id.utils.js +5 -0
- package/dist/es2022/core/utils/external-id.utils.js.map +1 -0
- package/dist/es2022/core/utils/global.utils.d.ts +14 -0
- package/dist/es2022/core/utils/global.utils.js +45 -0
- package/dist/es2022/core/utils/global.utils.js.map +1 -0
- package/dist/es2022/core/utils/http.utils.d.ts +3 -0
- package/dist/es2022/core/utils/http.utils.js +29 -0
- package/dist/es2022/core/utils/http.utils.js.map +1 -0
- package/dist/es2022/core/utils/management-client-utils.d.ts +19 -0
- package/dist/es2022/core/utils/management-client-utils.js +129 -0
- package/dist/es2022/core/utils/management-client-utils.js.map +1 -0
- package/dist/es2022/core/utils/processing-utils.d.ts +12 -0
- package/dist/es2022/core/utils/processing-utils.js +39 -0
- package/dist/es2022/core/utils/processing-utils.js.map +1 -0
- package/dist/es2022/core/utils/run.utils.d.ts +10 -0
- package/dist/es2022/core/utils/run.utils.js +37 -0
- package/dist/es2022/core/utils/run.utils.js.map +1 -0
- package/dist/es2022/export/context/export-context-fetcher.d.ts +4 -0
- package/dist/es2022/export/context/export-context-fetcher.js +289 -0
- package/dist/es2022/export/context/export-context-fetcher.js.map +1 -0
- package/dist/es2022/export/export-manager.d.ts +5 -0
- package/dist/es2022/export/export-manager.js +167 -0
- package/dist/es2022/export/export-manager.js.map +1 -0
- package/dist/es2022/export/export.models.d.ts +55 -0
- package/dist/es2022/export/export.models.js +2 -0
- package/dist/es2022/export/export.models.js.map +1 -0
- package/dist/es2022/export/index.d.ts +2 -0
- package/dist/es2022/export/index.js +3 -0
- package/dist/es2022/export/index.js.map +1 -0
- package/dist/es2022/export/utils/export.utils.d.ts +2 -0
- package/dist/es2022/export/utils/export.utils.js +5 -0
- package/dist/es2022/export/utils/export.utils.js.map +1 -0
- package/dist/es2022/file/file-manager.d.ts +5 -0
- package/dist/es2022/file/file-manager.js +29 -0
- package/dist/es2022/file/file-manager.js.map +1 -0
- package/dist/es2022/file/index.d.ts +1 -0
- package/dist/es2022/file/index.js +2 -0
- package/dist/es2022/file/index.js.map +1 -0
- package/dist/es2022/import/comparers/asset-comparer.d.ts +12 -0
- package/dist/es2022/import/comparers/asset-comparer.js +65 -0
- package/dist/es2022/import/comparers/asset-comparer.js.map +1 -0
- package/dist/es2022/import/context/import-context-fetcher.d.ts +4 -0
- package/dist/es2022/import/context/import-context-fetcher.js +235 -0
- package/dist/es2022/import/context/import-context-fetcher.js.map +1 -0
- package/dist/es2022/import/import-manager.d.ts +4 -0
- package/dist/es2022/import/import-manager.js +80 -0
- package/dist/es2022/import/import-manager.js.map +1 -0
- package/dist/es2022/import/import.models.d.ts +45 -0
- package/dist/es2022/import/import.models.js +2 -0
- package/dist/es2022/import/import.models.js.map +1 -0
- package/dist/es2022/import/importers/assets-importer.d.ts +10 -0
- package/dist/es2022/import/importers/assets-importer.js +175 -0
- package/dist/es2022/import/importers/assets-importer.js.map +1 -0
- package/dist/es2022/import/importers/content-items-importer.d.ts +10 -0
- package/dist/es2022/import/importers/content-items-importer.js +97 -0
- package/dist/es2022/import/importers/content-items-importer.js.map +1 -0
- package/dist/es2022/import/importers/language-variant-importer.d.ts +11 -0
- package/dist/es2022/import/importers/language-variant-importer.js +215 -0
- package/dist/es2022/import/importers/language-variant-importer.js.map +1 -0
- package/dist/es2022/import/importers/workflow-importer.d.ts +18 -0
- package/dist/es2022/import/importers/workflow-importer.js +122 -0
- package/dist/es2022/import/importers/workflow-importer.js.map +1 -0
- package/dist/es2022/import/index.d.ts +2 -0
- package/dist/es2022/import/index.js +3 -0
- package/dist/es2022/import/index.js.map +1 -0
- package/dist/es2022/import/utils/import.utils.d.ts +2 -0
- package/dist/es2022/import/utils/import.utils.js +5 -0
- package/dist/es2022/import/utils/import.utils.js.map +1 -0
- package/dist/es2022/index.d.ts +8 -0
- package/dist/es2022/index.js +10 -0
- package/dist/es2022/index.js.map +1 -0
- package/dist/es2022/metadata.d.ts +5 -0
- package/dist/es2022/metadata.js +6 -0
- package/dist/es2022/metadata.js.map +1 -0
- package/dist/es2022/node/cli/actions/export-action.d.ts +2 -0
- package/dist/es2022/node/cli/actions/export-action.js +40 -0
- package/dist/es2022/node/cli/actions/export-action.js.map +1 -0
- package/dist/es2022/node/cli/actions/import-action.d.ts +2 -0
- package/dist/es2022/node/cli/actions/import-action.js +29 -0
- package/dist/es2022/node/cli/actions/import-action.js.map +1 -0
- package/dist/es2022/node/cli/actions/migrate-action.d.ts +2 -0
- package/dist/es2022/node/cli/actions/migrate-action.js +47 -0
- package/dist/es2022/node/cli/actions/migrate-action.js.map +1 -0
- package/dist/es2022/node/cli/app.d.ts +2 -0
- package/dist/es2022/node/cli/app.js +27 -0
- package/dist/es2022/node/cli/app.js.map +1 -0
- package/dist/es2022/node/cli/args/args-fetcher.d.ts +2 -0
- package/dist/es2022/node/cli/args/args-fetcher.js +46 -0
- package/dist/es2022/node/cli/args/args-fetcher.js.map +1 -0
- package/dist/es2022/node/cli/args/args-setter.d.ts +2 -0
- package/dist/es2022/node/cli/args/args-setter.js +31 -0
- package/dist/es2022/node/cli/args/args-setter.js.map +1 -0
- package/dist/es2022/node/cli/cli.models.d.ts +24 -0
- package/dist/es2022/node/cli/cli.models.js +2 -0
- package/dist/es2022/node/cli/cli.models.js.map +1 -0
- package/dist/es2022/node/cli/commands.d.ts +1 -0
- package/dist/es2022/node/cli/commands.js +157 -0
- package/dist/es2022/node/cli/commands.js.map +1 -0
- package/dist/es2022/toolkit/elements-builder.d.ts +14 -0
- package/dist/es2022/toolkit/elements-builder.js +69 -0
- package/dist/es2022/toolkit/elements-builder.js.map +1 -0
- package/dist/es2022/toolkit/export.d.ts +3 -0
- package/dist/es2022/toolkit/export.js +21 -0
- package/dist/es2022/toolkit/export.js.map +1 -0
- package/dist/es2022/toolkit/file.d.ts +12 -0
- package/dist/es2022/toolkit/file.js +50 -0
- package/dist/es2022/toolkit/file.js.map +1 -0
- package/dist/es2022/toolkit/import.d.ts +2 -0
- package/dist/es2022/toolkit/import.js +21 -0
- package/dist/es2022/toolkit/import.js.map +1 -0
- package/dist/es2022/toolkit/index.d.ts +5 -0
- package/dist/es2022/toolkit/index.js +6 -0
- package/dist/es2022/toolkit/index.js.map +1 -0
- package/dist/es2022/toolkit/migrate.d.ts +21 -0
- package/dist/es2022/toolkit/migrate.js +39 -0
- package/dist/es2022/toolkit/migrate.js.map +1 -0
- package/dist/es2022/translation/extraction/items-extraction.processor.d.ts +24 -0
- package/dist/es2022/translation/extraction/items-extraction.processor.js +108 -0
- package/dist/es2022/translation/extraction/items-extraction.processor.js.map +1 -0
- package/dist/es2022/translation/helpers/rich-text.processor.d.ts +22 -0
- package/dist/es2022/translation/helpers/rich-text.processor.js +209 -0
- package/dist/es2022/translation/helpers/rich-text.processor.js.map +1 -0
- package/dist/es2022/translation/index.d.ts +4 -0
- package/dist/es2022/translation/index.js +5 -0
- package/dist/es2022/translation/index.js.map +1 -0
- package/dist/es2022/translation/transforms/export-transforms.d.ts +3 -0
- package/dist/es2022/translation/transforms/export-transforms.js +196 -0
- package/dist/es2022/translation/transforms/export-transforms.js.map +1 -0
- package/dist/es2022/translation/transforms/import-transforms.d.ts +7 -0
- package/dist/es2022/translation/transforms/import-transforms.js +183 -0
- package/dist/es2022/translation/transforms/import-transforms.js.map +1 -0
- package/dist/es2022/zip/index.d.ts +4 -0
- package/dist/es2022/zip/index.js +5 -0
- package/dist/es2022/zip/index.js.map +1 -0
- package/dist/es2022/zip/zip-manager.d.ts +6 -0
- package/dist/es2022/zip/zip-manager.js +27 -0
- package/dist/es2022/zip/zip-manager.js.map +1 -0
- package/dist/es2022/zip/zip-packager.d.ts +3 -0
- package/dist/es2022/zip/zip-packager.js +69 -0
- package/dist/es2022/zip/zip-packager.js.map +1 -0
- package/dist/es2022/zip/zip-transformer.d.ts +6 -0
- package/dist/es2022/zip/zip-transformer.js +82 -0
- package/dist/es2022/zip/zip-transformer.js.map +1 -0
- package/dist/es2022/zip/zip.models.d.ts +13 -0
- package/dist/es2022/zip/zip.models.js +2 -0
- package/dist/es2022/zip/zip.models.js.map +1 -0
- package/lib/core/helpers/workflow-helper.ts +104 -0
- package/lib/core/index.ts +17 -0
- package/lib/core/logs/loggers.ts +80 -0
- package/lib/core/models/core.models.ts +134 -0
- package/lib/core/models/log.models.ts +31 -0
- package/lib/core/models/migration.models.ts +165 -0
- package/lib/core/utils/array.utils.ts +49 -0
- package/lib/core/utils/binary-data.utils.ts +29 -0
- package/lib/core/utils/confirm.utils.ts +139 -0
- package/lib/core/utils/error.utils.ts +65 -0
- package/lib/core/utils/external-id.utils.ts +9 -0
- package/lib/core/utils/global.utils.ts +59 -0
- package/lib/core/utils/http.utils.ts +35 -0
- package/lib/core/utils/management-client-utils.ts +182 -0
- package/lib/core/utils/processing-utils.ts +71 -0
- package/lib/core/utils/run.utils.ts +51 -0
- package/lib/export/context/export-context-fetcher.ts +475 -0
- package/lib/export/export-manager.ts +249 -0
- package/lib/export/export.models.ts +87 -0
- package/lib/export/index.ts +2 -0
- package/lib/export/utils/export.utils.ts +10 -0
- package/lib/file/file-manager.ts +37 -0
- package/lib/file/index.ts +1 -0
- package/lib/import/comparers/asset-comparer.ts +113 -0
- package/lib/import/context/import-context-fetcher.ts +367 -0
- package/lib/import/import-manager.ts +103 -0
- package/lib/import/import.models.ts +84 -0
- package/lib/import/importers/assets-importer.ts +239 -0
- package/lib/import/importers/content-items-importer.ts +142 -0
- package/lib/import/importers/language-variant-importer.ts +342 -0
- package/lib/import/importers/workflow-importer.ts +159 -0
- package/lib/import/index.ts +2 -0
- package/lib/import/utils/import.utils.ts +10 -0
- package/lib/index.ts +9 -0
- package/lib/metadata.ts +6 -0
- package/lib/node/cli/actions/export-action.ts +45 -0
- package/lib/node/cli/actions/import-action.ts +34 -0
- package/lib/node/cli/actions/migrate-action.ts +52 -0
- package/lib/node/cli/app.ts +29 -0
- package/lib/node/cli/args/args-fetcher.ts +61 -0
- package/lib/node/cli/args/args-setter.ts +35 -0
- package/lib/node/cli/cli.models.ts +28 -0
- package/lib/node/cli/commands.ts +161 -0
- package/lib/toolkit/elements-builder.ts +84 -0
- package/lib/toolkit/export.ts +21 -0
- package/lib/toolkit/file.ts +70 -0
- package/lib/toolkit/import.ts +21 -0
- package/lib/toolkit/index.ts +5 -0
- package/lib/toolkit/migrate.ts +71 -0
- package/lib/translation/extraction/items-extraction.processor.ts +181 -0
- package/lib/translation/helpers/rich-text.processor.ts +300 -0
- package/lib/translation/index.ts +4 -0
- package/lib/translation/transforms/export-transforms.ts +253 -0
- package/lib/translation/transforms/import-transforms.ts +215 -0
- package/lib/zip/index.ts +4 -0
- package/lib/zip/zip-manager.ts +33 -0
- package/lib/zip/zip-packager.ts +86 -0
- package/lib/zip/zip-transformer.ts +105 -0
- package/lib/zip/zip.models.ts +12 -0
- package/package.json +88 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../../../lib/node/cli/app.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAE/D,MAAM,GAAG,GAAG,KAAK,IAAI,EAAE;IACnB,MAAM,WAAW,GAAG,MAAM,qBAAqB,EAAE,CAAC;IAClD,MAAM,MAAM,GAAG,WAAW,CAAC,YAAY,EAAE,CAAC;IAE1C,IAAI,MAAM,KAAK,QAAQ,EAAE,CAAC;QACtB,OAAO,MAAM,iBAAiB,CAAC,WAAW,CAAC,CAAC;IAChD,CAAC;SAAM,IAAI,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC7B,OAAO,MAAM,iBAAiB,CAAC,WAAW,CAAC,CAAC;IAChD,CAAC;SAAM,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QAC9B,OAAO,MAAM,kBAAkB,CAAC,WAAW,CAAC,CAAC;IACjD,CAAC;IAED,WAAW,CAAC;QACR,OAAO,EAAE,mBAAmB,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG;KACnD,CAAC,CAAC;AACP,CAAC,CAAC;AAEF,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IAChB,WAAW,CAAC,GAAG,CAAC,CAAC;AACrB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import yargs from 'yargs';
|
|
2
|
+
import { hideBin } from 'yargs/helpers';
|
|
3
|
+
import chalk from 'chalk';
|
|
4
|
+
import { exitProgram } from '../../../core/index.js';
|
|
5
|
+
export async function argumentsFetcherAsync() {
|
|
6
|
+
const argv = yargs(hideBin(process.argv));
|
|
7
|
+
const resolvedArgv = await argv.argv;
|
|
8
|
+
const getOptionalArgumentValue = (argName) => {
|
|
9
|
+
return resolvedArgv[argName]?.toString();
|
|
10
|
+
};
|
|
11
|
+
return {
|
|
12
|
+
getCliAction() {
|
|
13
|
+
const command = resolvedArgv._?.[0]?.toString()?.toLowerCase();
|
|
14
|
+
if (command === 'export') {
|
|
15
|
+
return 'export';
|
|
16
|
+
}
|
|
17
|
+
if (command === 'import') {
|
|
18
|
+
return 'import';
|
|
19
|
+
}
|
|
20
|
+
if (command === 'migrate') {
|
|
21
|
+
return 'migrate';
|
|
22
|
+
}
|
|
23
|
+
throw Error(`Unsupported command '${chalk.yellow(command)}'`);
|
|
24
|
+
},
|
|
25
|
+
getOptionalArgumentValue(argName) {
|
|
26
|
+
return resolvedArgv[argName]?.toString();
|
|
27
|
+
},
|
|
28
|
+
getRequiredArgumentValue(argName) {
|
|
29
|
+
const value = getOptionalArgumentValue(argName);
|
|
30
|
+
if (!value) {
|
|
31
|
+
exitProgram({
|
|
32
|
+
message: `Missing '${chalk.yellow(argName)}' argument value`
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
return value;
|
|
36
|
+
},
|
|
37
|
+
getBooleanArgumentValue(argName, defaultValue) {
|
|
38
|
+
const value = getOptionalArgumentValue(argName);
|
|
39
|
+
if (!value) {
|
|
40
|
+
return defaultValue;
|
|
41
|
+
}
|
|
42
|
+
return value.toLowerCase() === 'true'.toLowerCase();
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=args-fetcher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"args-fetcher.js","sourceRoot":"","sources":["../../../../../lib/node/cli/args/args-fetcher.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAa,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAShE,MAAM,CAAC,KAAK,UAAU,qBAAqB;IACvC,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IAC1C,MAAM,YAAY,GAAe,MAAM,IAAI,CAAC,IAAI,CAAC;IAEjD,MAAM,wBAAwB,GAAG,CAAC,OAAe,EAAE,EAAE;QACjD,OAAO,YAAY,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,CAAC;IAC7C,CAAC,CAAC;IAEF,OAAO;QACH,YAAY;YACR,MAAM,OAAO,GAAG,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,EAAE,WAAW,EAAE,CAAC;YAE/D,IAAI,OAAO,KAAgB,QAAQ,EAAE,CAAC;gBAClC,OAAO,QAAQ,CAAC;YACpB,CAAC;YACD,IAAI,OAAO,KAAgB,QAAQ,EAAE,CAAC;gBAClC,OAAO,QAAQ,CAAC;YACpB,CAAC;YACD,IAAI,OAAO,KAAgB,SAAS,EAAE,CAAC;gBACnC,OAAO,SAAS,CAAC;YACrB,CAAC;YAED,MAAM,KAAK,CAAC,wBAAwB,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAClE,CAAC;QACD,wBAAwB,CAAC,OAAe;YACpC,OAAO,YAAY,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,CAAC;QAC7C,CAAC;QACD,wBAAwB,CAAC,OAAe;YACpC,MAAM,KAAK,GAAG,wBAAwB,CAAC,OAAO,CAAC,CAAC;YAEhD,IAAI,CAAC,KAAK,EAAE,CAAC;gBACT,WAAW,CAAC;oBACR,OAAO,EAAE,YAAY,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,kBAAkB;iBAC/D,CAAC,CAAC;YACP,CAAC;YAED,OAAO,KAAK,CAAC;QACjB,CAAC;QACD,uBAAuB,CAAC,OAAe,EAAE,YAAqB;YAC1D,MAAM,KAAK,GAAG,wBAAwB,CAAC,OAAO,CAAC,CAAC;YAEhD,IAAI,CAAC,KAAK,EAAE,CAAC;gBACT,OAAO,YAAY,CAAC;YACxB,CAAC;YAED,OAAO,KAAK,CAAC,WAAW,EAAE,KAAK,MAAM,CAAC,WAAW,EAAE,CAAC;QACxD,CAAC;KACJ,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import yargs from 'yargs';
|
|
2
|
+
import { hideBin } from 'yargs/helpers';
|
|
3
|
+
export function argumentsSetter() {
|
|
4
|
+
const argv = yargs(hideBin(process.argv));
|
|
5
|
+
return {
|
|
6
|
+
withCommand(command) {
|
|
7
|
+
argv.command(command.name, command.description, (yargs) => {
|
|
8
|
+
command.examples.forEach((example) => yargs.example(command.name, example));
|
|
9
|
+
command.options.forEach((option) => {
|
|
10
|
+
yargs.positional(option.name, {
|
|
11
|
+
alias: option.alias,
|
|
12
|
+
describe: option.description,
|
|
13
|
+
type: option.type,
|
|
14
|
+
demandOption: option.isRequired
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
return this;
|
|
19
|
+
},
|
|
20
|
+
withOption(option) {
|
|
21
|
+
argv.option(option.name, {
|
|
22
|
+
alias: option.alias,
|
|
23
|
+
description: option.description,
|
|
24
|
+
type: option.type,
|
|
25
|
+
demandOption: option.isRequired
|
|
26
|
+
});
|
|
27
|
+
return this;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=args-setter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"args-setter.js","sourceRoot":"","sources":["../../../../../lib/node/cli/args/args-setter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAGxC,MAAM,UAAU,eAAe;IAC3B,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IAE1C,OAAO;QACH,WAAW,CAAC,OAAgB;YACxB,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,WAAW,EAAE,CAAC,KAAK,EAAE,EAAE;gBACtD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;gBAC5E,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;oBAC/B,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,EAAE;wBAC1B,KAAK,EAAE,MAAM,CAAC,KAAK;wBACnB,QAAQ,EAAE,MAAM,CAAC,WAAW;wBAC5B,IAAI,EAAE,MAAM,CAAC,IAAI;wBACjB,YAAY,EAAE,MAAM,CAAC,UAAU;qBAClC,CAAC,CAAC;gBACP,CAAC,CAAC,CAAC;YACP,CAAC,CAAC,CAAC;YAEH,OAAO,IAAI,CAAC;QAChB,CAAC;QACD,UAAU,CAAC,MAAqB;YAC5B,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE;gBACrB,KAAK,EAAE,MAAM,CAAC,KAAK;gBACnB,WAAW,EAAE,MAAM,CAAC,WAAW;gBAC/B,IAAI,EAAE,MAAM,CAAC,IAAI;gBACjB,YAAY,EAAE,MAAM,CAAC,UAAU;aAClC,CAAC,CAAC;YAEH,OAAO,IAAI,CAAC;QAChB,CAAC;KACJ,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { CliAction } from '../../core/index.js';
|
|
2
|
+
export interface Command {
|
|
3
|
+
readonly name: string;
|
|
4
|
+
readonly description: string;
|
|
5
|
+
readonly options: readonly CommandOption[];
|
|
6
|
+
readonly examples: string[];
|
|
7
|
+
}
|
|
8
|
+
export interface CommandOption {
|
|
9
|
+
readonly name: string;
|
|
10
|
+
readonly isRequired: boolean;
|
|
11
|
+
readonly alias?: string;
|
|
12
|
+
readonly description?: string;
|
|
13
|
+
readonly type?: 'boolean' | 'number' | 'string';
|
|
14
|
+
}
|
|
15
|
+
export type CliArgumentsSetter = {
|
|
16
|
+
withCommand(command: Command): CliArgumentsSetter;
|
|
17
|
+
withOption(option: CommandOption): CliArgumentsSetter;
|
|
18
|
+
};
|
|
19
|
+
export type CliArgumentsFetcher = {
|
|
20
|
+
getCliAction(): CliAction;
|
|
21
|
+
getOptionalArgumentValue(argName: string): string | undefined;
|
|
22
|
+
getRequiredArgumentValue(argName: string): string;
|
|
23
|
+
getBooleanArgumentValue(argName: string, defaultValue: boolean): boolean;
|
|
24
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.models.js","sourceRoot":"","sources":["../../../../lib/node/cli/cli.models.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const cliArgs: import("./cli.models.js").CliArgumentsSetter;
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { argumentsSetter } from './args/args-setter.js';
|
|
2
|
+
export const cliArgs = argumentsSetter()
|
|
3
|
+
.withCommand({
|
|
4
|
+
name: 'export',
|
|
5
|
+
description: 'Exports content (items & assets) from Kontent.ai environment',
|
|
6
|
+
examples: [
|
|
7
|
+
`kontent-ai-migration-toolkit export --sourceEnvironmentId=x --sourceApiKey=x --language=default --items=itemA,itemB`
|
|
8
|
+
],
|
|
9
|
+
options: [
|
|
10
|
+
{
|
|
11
|
+
name: `sourceApiKey`,
|
|
12
|
+
description: `Api key used for request authorization`,
|
|
13
|
+
type: 'string',
|
|
14
|
+
isRequired: true
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
name: `sourceEnvironmentId`,
|
|
18
|
+
description: `Environment id of the source environment`,
|
|
19
|
+
type: 'string',
|
|
20
|
+
isRequired: true
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: `language`,
|
|
24
|
+
description: `Language codename of items to export`,
|
|
25
|
+
type: 'string',
|
|
26
|
+
isRequired: true
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: `items`,
|
|
30
|
+
description: `Comma separated item codenames to export`,
|
|
31
|
+
type: 'string',
|
|
32
|
+
isRequired: true
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: `filename`,
|
|
36
|
+
description: `Name of items file to export / import`,
|
|
37
|
+
type: 'string',
|
|
38
|
+
isRequired: false
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: `assetsFilename`,
|
|
42
|
+
description: `Name of assets file to export / import`,
|
|
43
|
+
type: 'string',
|
|
44
|
+
isRequired: false
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
name: `baseUrl`,
|
|
48
|
+
description: `Custom base URL`,
|
|
49
|
+
type: 'string',
|
|
50
|
+
isRequired: false
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
})
|
|
54
|
+
.withCommand({
|
|
55
|
+
name: 'import',
|
|
56
|
+
description: 'Imports content (items & assets) into Kontent.ai environment',
|
|
57
|
+
examples: [
|
|
58
|
+
`kontent-ai-migration-toolkit import --targetEnvironmentId=x --targetApiKey=x --filename=items.zip --assetsFilename=assets.zip`
|
|
59
|
+
],
|
|
60
|
+
options: [
|
|
61
|
+
{
|
|
62
|
+
name: `targetApiKey`,
|
|
63
|
+
description: `Api key used for request authorization`,
|
|
64
|
+
type: 'string',
|
|
65
|
+
isRequired: true
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
name: `targetEnvironmentId`,
|
|
69
|
+
description: `Environment id of the target environment`,
|
|
70
|
+
type: 'string',
|
|
71
|
+
isRequired: true
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
name: `filename`,
|
|
75
|
+
description: `Name of items file to export / import`,
|
|
76
|
+
type: 'string',
|
|
77
|
+
isRequired: false
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
name: `assetsFilename`,
|
|
81
|
+
description: `Name of assets file to export / import`,
|
|
82
|
+
type: 'string',
|
|
83
|
+
isRequired: false
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
name: `baseUrl`,
|
|
87
|
+
description: `Custom base URL`,
|
|
88
|
+
type: 'string',
|
|
89
|
+
isRequired: false
|
|
90
|
+
}
|
|
91
|
+
]
|
|
92
|
+
})
|
|
93
|
+
.withCommand({
|
|
94
|
+
name: 'migrate',
|
|
95
|
+
description: 'Migrates content (items & assets) from one Kontent.ai environment into another Kontent.ai environment',
|
|
96
|
+
examples: [
|
|
97
|
+
`kontent-ai-migration-toolkit migrate --targetEnvironmentId=x --targetApiKey=x --sourceEnvironmentId=x --sourceApiKey=x --language=default --items=itemA,itemB`
|
|
98
|
+
],
|
|
99
|
+
options: [
|
|
100
|
+
{
|
|
101
|
+
name: `sourceApiKey`,
|
|
102
|
+
description: `Api key used for request authorization`,
|
|
103
|
+
type: 'string',
|
|
104
|
+
isRequired: true
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
name: `sourceEnvironmentId`,
|
|
108
|
+
description: `Environment id of the source environment`,
|
|
109
|
+
type: 'string',
|
|
110
|
+
isRequired: true
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
name: `language`,
|
|
114
|
+
description: `Language codename of items to export`,
|
|
115
|
+
type: 'string',
|
|
116
|
+
isRequired: true
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
name: `items`,
|
|
120
|
+
description: `Comma separated item codenames to export`,
|
|
121
|
+
type: 'string',
|
|
122
|
+
isRequired: true
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
name: `targetApiKey`,
|
|
126
|
+
description: `Api key used for request authorization`,
|
|
127
|
+
type: 'string',
|
|
128
|
+
isRequired: true
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
name: `targetEnvironmentId`,
|
|
132
|
+
description: `Environment id of the target environment`,
|
|
133
|
+
type: 'string',
|
|
134
|
+
isRequired: true
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
name: `baseUrl`,
|
|
138
|
+
description: `Custom base URL`,
|
|
139
|
+
type: 'string',
|
|
140
|
+
isRequired: false
|
|
141
|
+
}
|
|
142
|
+
]
|
|
143
|
+
})
|
|
144
|
+
.withOption({
|
|
145
|
+
alias: `f`,
|
|
146
|
+
name: `force`,
|
|
147
|
+
description: `When enabled, confirmation is not required`,
|
|
148
|
+
type: 'boolean',
|
|
149
|
+
isRequired: false
|
|
150
|
+
})
|
|
151
|
+
.withOption({
|
|
152
|
+
alias: `h`,
|
|
153
|
+
name: `help`,
|
|
154
|
+
description: `Show help`,
|
|
155
|
+
isRequired: false
|
|
156
|
+
});
|
|
157
|
+
//# sourceMappingURL=commands.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commands.js","sourceRoot":"","sources":["../../../../lib/node/cli/commands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EA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AAS;YACf,WAAW,EAAE,iBAAiB;YAC9B,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE,KAAK;SACpB;KACJ;CACJ,CAAC;KAED,UAAU,CAAC;IACR,KAAK,EAAE,GAAG;IACV,IAAI,EAAE,OAAO;IACb,WAAW,EAAE,4CAA4C;IACzD,IAAI,EAAE,SAAS;IACf,UAAU,EAAE,KAAK;CACpB,CAAC;KACD,UAAU,CAAC;IACR,KAAK,EAAE,GAAG;IACV,IAAI,EAAE,MAAM;IACZ,WAAW,EAAE,WAAW;IACxB,UAAU,EAAE,KAAK;CACpB,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { MigrationElementModels } from '../core/index.js';
|
|
2
|
+
export declare const elementsBuilder: {
|
|
3
|
+
textElement: (data: Omit<MigrationElementModels.TextElement, "type">) => MigrationElementModels.TextElement;
|
|
4
|
+
assetElement: (data: Omit<MigrationElementModels.AssetElement, "type">) => MigrationElementModels.AssetElement;
|
|
5
|
+
customElement: (data: Omit<MigrationElementModels.CustomElement, "type">) => MigrationElementModels.CustomElement;
|
|
6
|
+
dateTimeElement: (data: Omit<MigrationElementModels.DateTimeElement, "type">) => MigrationElementModels.DateTimeElement;
|
|
7
|
+
linkedItemsElement: (data: Omit<MigrationElementModels.LinkedItemsElement, "type">) => MigrationElementModels.LinkedItemsElement;
|
|
8
|
+
multipleChoiceElement: (data: Omit<MigrationElementModels.MultipleChoiceElement, "type">) => MigrationElementModels.MultipleChoiceElement;
|
|
9
|
+
numberElement: (data: Omit<MigrationElementModels.NumberElement, "type">) => MigrationElementModels.NumberElement;
|
|
10
|
+
richTextElement: (data: Omit<MigrationElementModels.RichTextElement, "type">) => MigrationElementModels.RichTextElement;
|
|
11
|
+
subpagesElement: (data: Omit<MigrationElementModels.SubpagesElement, "type">) => MigrationElementModels.SubpagesElement;
|
|
12
|
+
taxonomyElement: (data: Omit<MigrationElementModels.TaxonomyElement, "type">) => MigrationElementModels.TaxonomyElement;
|
|
13
|
+
urlSlugElement: (data: Omit<MigrationElementModels.UrlSlugElement, "type">) => MigrationElementModels.UrlSlugElement;
|
|
14
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
export const elementsBuilder = {
|
|
2
|
+
textElement: (data) => {
|
|
3
|
+
return {
|
|
4
|
+
...data,
|
|
5
|
+
type: 'text'
|
|
6
|
+
};
|
|
7
|
+
},
|
|
8
|
+
assetElement: (data) => {
|
|
9
|
+
return {
|
|
10
|
+
...data,
|
|
11
|
+
type: 'asset'
|
|
12
|
+
};
|
|
13
|
+
},
|
|
14
|
+
customElement: (data) => {
|
|
15
|
+
return {
|
|
16
|
+
...data,
|
|
17
|
+
type: 'custom'
|
|
18
|
+
};
|
|
19
|
+
},
|
|
20
|
+
dateTimeElement: (data) => {
|
|
21
|
+
return {
|
|
22
|
+
...data,
|
|
23
|
+
type: 'date_time'
|
|
24
|
+
};
|
|
25
|
+
},
|
|
26
|
+
linkedItemsElement: (data) => {
|
|
27
|
+
return {
|
|
28
|
+
...data,
|
|
29
|
+
type: 'modular_content'
|
|
30
|
+
};
|
|
31
|
+
},
|
|
32
|
+
multipleChoiceElement: (data) => {
|
|
33
|
+
return {
|
|
34
|
+
...data,
|
|
35
|
+
type: 'multiple_choice'
|
|
36
|
+
};
|
|
37
|
+
},
|
|
38
|
+
numberElement: (data) => {
|
|
39
|
+
return {
|
|
40
|
+
...data,
|
|
41
|
+
type: 'number'
|
|
42
|
+
};
|
|
43
|
+
},
|
|
44
|
+
richTextElement: (data) => {
|
|
45
|
+
return {
|
|
46
|
+
...data,
|
|
47
|
+
type: 'rich_text'
|
|
48
|
+
};
|
|
49
|
+
},
|
|
50
|
+
subpagesElement: (data) => {
|
|
51
|
+
return {
|
|
52
|
+
...data,
|
|
53
|
+
type: 'subpages'
|
|
54
|
+
};
|
|
55
|
+
},
|
|
56
|
+
taxonomyElement: (data) => {
|
|
57
|
+
return {
|
|
58
|
+
...data,
|
|
59
|
+
type: 'taxonomy'
|
|
60
|
+
};
|
|
61
|
+
},
|
|
62
|
+
urlSlugElement: (data) => {
|
|
63
|
+
return {
|
|
64
|
+
...data,
|
|
65
|
+
type: 'url_slug'
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
//# sourceMappingURL=elements-builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"elements-builder.js","sourceRoot":"","sources":["../../../lib/toolkit/elements-builder.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,eAAe,GAAG;IAC3B,WAAW,EAAE,CAAC,IAAsD,EAAsC,EAAE;QACxG,OAAO;YACH,GAAG,IAAI;YACP,IAAI,EAAE,MAAM;SACf,CAAC;IACN,CAAC;IACD,YAAY,EAAE,CAAC,IAAuD,EAAuC,EAAE;QAC3G,OAAO;YACH,GAAG,IAAI;YACP,IAAI,EAAE,OAAO;SAChB,CAAC;IACN,CAAC;IACD,aAAa,EAAE,CAAC,IAAwD,EAAwC,EAAE;QAC9G,OAAO;YACH,GAAG,IAAI;YACP,IAAI,EAAE,QAAQ;SACjB,CAAC;IACN,CAAC;IACD,eAAe,EAAE,CACb,IAA0D,EACpB,EAAE;QACxC,OAAO;YACH,GAAG,IAAI;YACP,IAAI,EAAE,WAAW;SACpB,CAAC;IACN,CAAC;IACD,kBAAkB,EAAE,CAChB,IAA6D,EACpB,EAAE;QAC3C,OAAO;YACH,GAAG,IAAI;YACP,IAAI,EAAE,iBAAiB;SAC1B,CAAC;IACN,CAAC;IACD,qBAAqB,EAAE,CACnB,IAAgE,EACpB,EAAE;QAC9C,OAAO;YACH,GAAG,IAAI;YACP,IAAI,EAAE,iBAAiB;SAC1B,CAAC;IACN,CAAC;IACD,aAAa,EAAE,CAAC,IAAwD,EAAwC,EAAE;QAC9G,OAAO;YACH,GAAG,IAAI;YACP,IAAI,EAAE,QAAQ;SACjB,CAAC;IACN,CAAC;IACD,eAAe,EAAE,CACb,IAA0D,EACpB,EAAE;QACxC,OAAO;YACH,GAAG,IAAI;YACP,IAAI,EAAE,WAAW;SACpB,CAAC;IACN,CAAC;IACD,eAAe,EAAE,CACb,IAA0D,EACpB,EAAE;QACxC,OAAO;YACH,GAAG,IAAI;YACP,IAAI,EAAE,UAAU;SACnB,CAAC;IACN,CAAC;IACD,eAAe,EAAE,CACb,IAA0D,EACpB,EAAE;QACxC,OAAO;YACH,GAAG,IAAI;YACP,IAAI,EAAE,UAAU;SACnB,CAAC;IACN,CAAC;IACD,cAAc,EAAE,CACZ,IAAyD,EACpB,EAAE;QACvC,OAAO;YACH,GAAG,IAAI;YACP,IAAI,EAAE,UAAU;SACnB,CAAC;IACN,CAAC;CACJ,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { libMetadata } from '../metadata.js';
|
|
2
|
+
import { executeWithTrackingAsync } from '../core/index.js';
|
|
3
|
+
import { exportManager } from '../export/index.js';
|
|
4
|
+
export async function exportAsync(config) {
|
|
5
|
+
return await executeWithTrackingAsync({
|
|
6
|
+
event: {
|
|
7
|
+
tool: 'migrationToolkit',
|
|
8
|
+
package: {
|
|
9
|
+
name: libMetadata.name,
|
|
10
|
+
version: libMetadata.version
|
|
11
|
+
},
|
|
12
|
+
action: 'export',
|
|
13
|
+
relatedEnvironmentId: undefined,
|
|
14
|
+
details: {}
|
|
15
|
+
},
|
|
16
|
+
func: async () => {
|
|
17
|
+
return await exportManager(config).exportAsync();
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=export.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export.js","sourceRoot":"","sources":["../../../lib/toolkit/export.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAiB,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAAgB,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEjE,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,MAAoB;IAClD,OAAO,MAAM,wBAAwB,CAAC;QAClC,KAAK,EAAE;YACH,IAAI,EAAE,kBAAkB;YACxB,OAAO,EAAE;gBACL,IAAI,EAAE,WAAW,CAAC,IAAI;gBACtB,OAAO,EAAE,WAAW,CAAC,OAAO;aAC/B;YACD,MAAM,EAAE,QAAQ;YAChB,oBAAoB,EAAE,SAAS;YAC/B,OAAO,EAAE,EAAE;SACd;QACD,IAAI,EAAE,KAAK,IAAI,EAAE;YACb,OAAO,MAAM,aAAa,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,CAAC;QACrD,CAAC;KACJ,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Logger, MigrationData } from '../core/index.js';
|
|
2
|
+
export interface StoreConfig {
|
|
3
|
+
readonly data: MigrationData;
|
|
4
|
+
readonly filename?: string;
|
|
5
|
+
readonly logger?: Logger;
|
|
6
|
+
}
|
|
7
|
+
export interface ExtractConfig {
|
|
8
|
+
readonly filename?: string;
|
|
9
|
+
readonly logger?: Logger;
|
|
10
|
+
}
|
|
11
|
+
export declare function storeAsync(config: StoreConfig): Promise<void>;
|
|
12
|
+
export declare function extractAsync(config: ExtractConfig): Promise<MigrationData>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { fileManager } from '../file/index.js';
|
|
2
|
+
import { executeWithTrackingAsync, getDefaultZipFilename, getDefaultLogger } from '../core/index.js';
|
|
3
|
+
import { zipManager } from '../zip/index.js';
|
|
4
|
+
import { libMetadata } from '../metadata.js';
|
|
5
|
+
export async function storeAsync(config) {
|
|
6
|
+
const logger = config.logger ?? getDefaultLogger();
|
|
7
|
+
const filename = getDefaultZipFilename();
|
|
8
|
+
await executeWithTrackingAsync({
|
|
9
|
+
event: {
|
|
10
|
+
tool: 'migrationToolkit',
|
|
11
|
+
package: {
|
|
12
|
+
name: libMetadata.name,
|
|
13
|
+
version: libMetadata.version
|
|
14
|
+
},
|
|
15
|
+
action: 'store',
|
|
16
|
+
relatedEnvironmentId: undefined,
|
|
17
|
+
details: {}
|
|
18
|
+
},
|
|
19
|
+
func: async () => {
|
|
20
|
+
const zipData = await zipManager(logger).createZipAsync(config.data);
|
|
21
|
+
if (zipData instanceof Buffer) {
|
|
22
|
+
await fileManager(logger).writeFileAsync(filename, zipData);
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
throw Error(`Cannot store '${filename}' on File system because the provided zip is not a Buffer`);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
export async function extractAsync(config) {
|
|
31
|
+
const logger = config.logger ?? getDefaultLogger();
|
|
32
|
+
const filename = getDefaultZipFilename();
|
|
33
|
+
return await executeWithTrackingAsync({
|
|
34
|
+
event: {
|
|
35
|
+
tool: 'migrationToolkit',
|
|
36
|
+
package: {
|
|
37
|
+
name: libMetadata.name,
|
|
38
|
+
version: libMetadata.version
|
|
39
|
+
},
|
|
40
|
+
action: 'extract',
|
|
41
|
+
relatedEnvironmentId: undefined,
|
|
42
|
+
details: {}
|
|
43
|
+
},
|
|
44
|
+
func: async () => {
|
|
45
|
+
const fileData = await fileManager(logger).loadFileAsync(filename);
|
|
46
|
+
return await zipManager(logger).parseZipAsync(fileData);
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file.js","sourceRoot":"","sources":["../../../lib/toolkit/file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAEH,wBAAwB,EACxB,qBAAqB,EACrB,gBAAgB,EAEnB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB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AAE;SACd;QACD,IAAI,EAAE,KAAK,IAAI,EAAE;YACb,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,MAAM,CAAC,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;YACnE,OAAO,MAAM,UAAU,CAAC,MAAM,CAAC,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;QAC5D,CAAC;KACJ,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { executeWithTrackingAsync } from '../core/index.js';
|
|
2
|
+
import { importManager } from '../import/index.js';
|
|
3
|
+
import { libMetadata } from '../metadata.js';
|
|
4
|
+
export async function importAsync(config) {
|
|
5
|
+
return await executeWithTrackingAsync({
|
|
6
|
+
event: {
|
|
7
|
+
tool: 'migrationToolkit',
|
|
8
|
+
package: {
|
|
9
|
+
name: libMetadata.name,
|
|
10
|
+
version: libMetadata.version
|
|
11
|
+
},
|
|
12
|
+
action: 'import',
|
|
13
|
+
relatedEnvironmentId: undefined,
|
|
14
|
+
details: {}
|
|
15
|
+
},
|
|
16
|
+
func: async () => {
|
|
17
|
+
return await importManager(config).importAsync();
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=import.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"import.js","sourceRoot":"","sources":["../../../lib/toolkit/import.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAA8B,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,MAAoB;IAClD,OAAO,MAAM,wBAAwB,CAAC;QAClC,KAAK,EAAE;YACH,IAAI,EAAE,kBAAkB;YACxB,OAAO,EAAE;gBACL,IAAI,EAAE,WAAW,CAAC,IAAI;gBACtB,OAAO,EAAE,WAAW,CAAC,OAAO;aAC/B;YACD,MAAM,EAAE,QAAQ;YAChB,oBAAoB,EAAE,SAAS;YAC/B,OAAO,EAAE,EAAE;SACd;QACD,IAAI,EAAE,KAAK,IAAI,EAAE;YACb,OAAO,MAAM,aAAa,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,CAAC;QACrD,CAAC;KACJ,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/toolkit/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,uBAAuB,CAAC;AACtC,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { IRetryStrategyOptions } from '@kontent-ai/core-sdk';
|
|
2
|
+
import { ExternalIdGenerator, Logger, ManagementClientConfig, MigrationData } from '../core/index.js';
|
|
3
|
+
import { SourceExportItem } from '../export/index.js';
|
|
4
|
+
import { ImportResult } from '../import/index.js';
|
|
5
|
+
export interface MigrationSource extends ManagementClientConfig {
|
|
6
|
+
readonly items: readonly SourceExportItem[];
|
|
7
|
+
}
|
|
8
|
+
export interface MigrationTarget extends ManagementClientConfig {
|
|
9
|
+
}
|
|
10
|
+
export interface MigrationConfig {
|
|
11
|
+
readonly retryStrategy?: IRetryStrategyOptions;
|
|
12
|
+
readonly externalIdGenerator?: ExternalIdGenerator;
|
|
13
|
+
readonly logger?: Logger;
|
|
14
|
+
readonly sourceEnvironment: MigrationSource;
|
|
15
|
+
readonly targetEnvironment: MigrationTarget;
|
|
16
|
+
}
|
|
17
|
+
export interface MigrationResult {
|
|
18
|
+
readonly migrationData: MigrationData;
|
|
19
|
+
readonly importResult: ImportResult;
|
|
20
|
+
}
|
|
21
|
+
export declare function migrateAsync(config: MigrationConfig): Promise<MigrationResult>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { libMetadata } from '../metadata.js';
|
|
2
|
+
import { executeWithTrackingAsync, getDefaultLogger } from '../core/index.js';
|
|
3
|
+
import { exportAsync } from './export.js';
|
|
4
|
+
import { importAsync } from './import.js';
|
|
5
|
+
export async function migrateAsync(config) {
|
|
6
|
+
const logger = config.logger ?? getDefaultLogger();
|
|
7
|
+
return await executeWithTrackingAsync({
|
|
8
|
+
event: {
|
|
9
|
+
tool: 'migrationToolkit',
|
|
10
|
+
package: {
|
|
11
|
+
name: libMetadata.name,
|
|
12
|
+
version: libMetadata.version
|
|
13
|
+
},
|
|
14
|
+
action: 'migrate',
|
|
15
|
+
relatedEnvironmentId: undefined,
|
|
16
|
+
details: {
|
|
17
|
+
itemsCount: config.sourceEnvironment.items.length
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
func: async () => {
|
|
21
|
+
const migrationData = await exportAsync({
|
|
22
|
+
...config.sourceEnvironment,
|
|
23
|
+
logger: logger,
|
|
24
|
+
exportItems: config.sourceEnvironment.items
|
|
25
|
+
});
|
|
26
|
+
const importResult = await importAsync({
|
|
27
|
+
...config.targetEnvironment,
|
|
28
|
+
logger: logger,
|
|
29
|
+
data: migrationData,
|
|
30
|
+
externalIdGenerator: config.externalIdGenerator
|
|
31
|
+
});
|
|
32
|
+
return {
|
|
33
|
+
importResult,
|
|
34
|
+
migrationData
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=migrate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrate.js","sourceRoot":"","sources":["../../../lib/toolkit/migrate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EAKH,wBAAwB,EACxB,gBAAgB,EACnB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAsB1C,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,MAAuB;IACtD,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,gBAAgB,EAAE,CAAC;IAEnD,OAAO,MAAM,wBAAwB,CAAC;QAClC,KAAK,EAAE;YACH,IAAI,EAAE,kBAAkB;YACxB,OAAO,EAAE;gBACL,IAAI,EAAE,WAAW,CAAC,IAAI;gBACtB,OAAO,EAAE,WAAW,CAAC,OAAO;aAC/B;YACD,MAAM,EAAE,SAAS;YACjB,oBAAoB,EAAE,SAAS;YAC/B,OAAO,EAAE;gBACL,UAAU,EAAE,MAAM,CAAC,iBAAiB,CAAC,KAAK,CAAC,MAAM;aACpD;SACJ;QACD,IAAI,EAAE,KAAK,IAAI,EAAE;YACb,MAAM,aAAa,GAAG,MAAM,WAAW,CAAC;gBACpC,GAAG,MAAM,CAAC,iBAAiB;gBAC3B,MAAM,EAAE,MAAM;gBACd,WAAW,EAAE,MAAM,CAAC,iBAAiB,CAAC,KAAK;aAC9C,CAAC,CAAC;YAEH,MAAM,YAAY,GAAG,MAAM,WAAW,CAAC;gBACnC,GAAG,MAAM,CAAC,iBAAiB;gBAC3B,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE,aAAa;gBACnB,mBAAmB,EAAE,MAAM,CAAC,mBAAmB;aAClD,CAAC,CAAC;YAEH,OAAO;gBACH,YAAY;gBACZ,aAAa;aAChB,CAAC;QACN,CAAC;KACJ,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { MigrationElements, ReferencedDataInLanguageVariants, ReferencedDataInMigrationItems } from '../../core/index.js';
|
|
2
|
+
import { GetFlattenedElementByCodenames } from '../../import/index.js';
|
|
3
|
+
import { ElementModels } from '@kontent-ai/management-sdk';
|
|
4
|
+
import { GetFlattenedElementByIds } from 'lib/export/export.models.js';
|
|
5
|
+
export interface ExtractItemById {
|
|
6
|
+
readonly elements: Readonly<ElementModels.ContentItemElement>[];
|
|
7
|
+
readonly contentTypeId: string;
|
|
8
|
+
}
|
|
9
|
+
export interface ExtractItemByCodename {
|
|
10
|
+
readonly elements: MigrationElements;
|
|
11
|
+
readonly contentTypeCodename: string;
|
|
12
|
+
}
|
|
13
|
+
export interface ReferencedDataInMigrationItemsLocal {
|
|
14
|
+
readonly itemCodenames: Set<string>;
|
|
15
|
+
readonly assetCodenames: Set<string>;
|
|
16
|
+
}
|
|
17
|
+
export interface ReferencedDataInLanguageVariantsLocal {
|
|
18
|
+
readonly itemIds: Set<string>;
|
|
19
|
+
readonly assetIds: Set<string>;
|
|
20
|
+
}
|
|
21
|
+
export declare function itemsExtractionProcessor(): {
|
|
22
|
+
extractReferencedDataFromExtractItems: (items: readonly ExtractItemById[], getElement: GetFlattenedElementByIds) => ReferencedDataInLanguageVariants;
|
|
23
|
+
extractReferencedItemsFromMigrationItems: (items: readonly ExtractItemByCodename[], getElement: GetFlattenedElementByCodenames) => ReferencedDataInMigrationItems;
|
|
24
|
+
};
|