@contentstack/cli-cm-import 2.0.0-beta.1 → 2.0.0-beta.10
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/LICENSE +1 -1
- package/README.md +50 -96
- package/lib/commands/cm/stacks/import.d.ts +0 -1
- package/lib/commands/cm/stacks/import.js +13 -46
- package/lib/config/index.js +7 -0
- package/lib/constants/index.d.ts +57 -0
- package/lib/constants/index.js +59 -0
- package/lib/import/module-importer.js +4 -4
- package/lib/import/modules/assets.js +18 -9
- package/lib/import/modules/base-class.d.ts +21 -4
- package/lib/import/modules/base-class.js +31 -1
- package/lib/import/modules/composable-studio.d.ts +44 -0
- package/lib/import/modules/composable-studio.js +235 -0
- package/lib/import/modules/content-types.d.ts +2 -0
- package/lib/import/modules/content-types.js +52 -13
- package/lib/import/modules/custom-roles.js +10 -10
- package/lib/import/modules/entries.d.ts +2 -0
- package/lib/import/modules/entries.js +41 -36
- package/lib/import/modules/environments.js +6 -6
- package/lib/import/modules/extensions.js +7 -7
- package/lib/import/modules/global-fields.d.ts +1 -1
- package/lib/import/modules/global-fields.js +10 -10
- package/lib/import/modules/labels.js +6 -6
- package/lib/import/modules/locales.d.ts +1 -1
- package/lib/import/modules/locales.js +8 -8
- package/lib/import/modules/marketplace-apps.js +6 -6
- package/lib/import/modules/personalize.js +2 -3
- package/lib/import/modules/stack.js +5 -5
- package/lib/import/modules/taxonomies.d.ts +26 -3
- package/lib/import/modules/taxonomies.js +180 -63
- package/lib/import/modules/variant-entries.js +5 -5
- package/lib/import/modules/webhooks.js +6 -6
- package/lib/import/modules/workflows.d.ts +1 -1
- package/lib/import/modules/workflows.js +7 -7
- package/lib/types/default-config.d.ts +6 -0
- package/lib/types/index.d.ts +37 -11
- package/lib/utils/asset-helper.js +1 -1
- package/lib/utils/common-helper.d.ts +1 -1
- package/lib/utils/common-helper.js +8 -7
- package/lib/utils/content-type-helper.d.ts +1 -1
- package/lib/utils/content-type-helper.js +3 -3
- package/lib/utils/extension-helper.js +5 -4
- package/lib/utils/file-helper.js +1 -1
- package/lib/utils/import-config-handler.js +7 -13
- package/lib/utils/import-path-resolver.js +2 -8
- package/lib/utils/logger.d.ts +1 -1
- package/lib/utils/logger.js +2 -2
- package/lib/utils/login-handler.d.ts +1 -1
- package/lib/utils/login-handler.js +4 -4
- package/lib/utils/marketplace-app-helper.js +9 -6
- package/lib/utils/taxonomies-helper.js +1 -1
- package/messages/index.json +10 -1
- package/oclif.manifest.json +4 -48
- package/package.json +15 -17
|
@@ -4,13 +4,14 @@ const tslib_1 = require("tslib");
|
|
|
4
4
|
/* eslint-disable no-prototype-builtins */
|
|
5
5
|
/*!
|
|
6
6
|
* Contentstack Import
|
|
7
|
-
* Copyright (c)
|
|
7
|
+
* Copyright (c) 2026 Contentstack LLC
|
|
8
8
|
* MIT Licensed
|
|
9
9
|
*/
|
|
10
10
|
const path = tslib_1.__importStar(require("path"));
|
|
11
11
|
const fs_1 = require("fs");
|
|
12
12
|
const lodash_1 = require("lodash");
|
|
13
13
|
const cli_utilities_1 = require("@contentstack/cli-utilities");
|
|
14
|
+
const constants_1 = require("../../constants");
|
|
14
15
|
const utils_1 = require("../../utils");
|
|
15
16
|
const base_class_1 = tslib_1.__importDefault(require("./base-class"));
|
|
16
17
|
class EntriesImport extends base_class_1.default {
|
|
@@ -19,19 +20,28 @@ class EntriesImport extends base_class_1.default {
|
|
|
19
20
|
this.entriesForVariant = [];
|
|
20
21
|
this.importConfig.context.module = utils_1.MODULE_CONTEXTS.ENTRIES;
|
|
21
22
|
this.currentModuleName = utils_1.MODULE_NAMES[utils_1.MODULE_CONTEXTS.ENTRIES];
|
|
22
|
-
this.assetUidMapperPath = path.resolve((0, cli_utilities_1.sanitizePath)(importConfig.
|
|
23
|
-
this.assetUrlMapperPath = path.resolve((0, cli_utilities_1.sanitizePath)(importConfig.
|
|
24
|
-
this.entriesMapperPath = path.resolve((0, cli_utilities_1.sanitizePath)(importConfig.
|
|
25
|
-
this.envPath = path.resolve((0, cli_utilities_1.sanitizePath)(importConfig.
|
|
26
|
-
this.entriesUIDMapperPath = path.join((0, cli_utilities_1.sanitizePath)(this.entriesMapperPath),
|
|
27
|
-
this.uniqueUidMapperPath = path.join((0, cli_utilities_1.sanitizePath)(this.entriesMapperPath),
|
|
28
|
-
this.modifiedCTsPath = path.join((0, cli_utilities_1.sanitizePath)(this.entriesMapperPath),
|
|
29
|
-
this.marketplaceAppMapperPath = path.join((0, cli_utilities_1.sanitizePath)(this.importConfig.
|
|
30
|
-
this.taxonomiesPath = path.join((0, cli_utilities_1.sanitizePath)(this.importConfig.
|
|
23
|
+
this.assetUidMapperPath = path.resolve((0, cli_utilities_1.sanitizePath)(importConfig.backupDir), constants_1.PATH_CONSTANTS.MAPPER, constants_1.PATH_CONSTANTS.MAPPER_MODULES.ASSETS, constants_1.PATH_CONSTANTS.FILES.UID_MAPPING);
|
|
24
|
+
this.assetUrlMapperPath = path.resolve((0, cli_utilities_1.sanitizePath)(importConfig.backupDir), constants_1.PATH_CONSTANTS.MAPPER, constants_1.PATH_CONSTANTS.MAPPER_MODULES.ASSETS, constants_1.PATH_CONSTANTS.FILES.URL_MAPPING);
|
|
25
|
+
this.entriesMapperPath = path.resolve((0, cli_utilities_1.sanitizePath)(importConfig.backupDir), constants_1.PATH_CONSTANTS.MAPPER, constants_1.PATH_CONSTANTS.MAPPER_MODULES.ENTRIES);
|
|
26
|
+
this.envPath = path.resolve((0, cli_utilities_1.sanitizePath)(importConfig.contentDir), constants_1.PATH_CONSTANTS.CONTENT_DIRS.ENVIRONMENTS, constants_1.PATH_CONSTANTS.FILES.ENVIRONMENTS);
|
|
27
|
+
this.entriesUIDMapperPath = path.join((0, cli_utilities_1.sanitizePath)(this.entriesMapperPath), constants_1.PATH_CONSTANTS.FILES.UID_MAPPING);
|
|
28
|
+
this.uniqueUidMapperPath = path.join((0, cli_utilities_1.sanitizePath)(this.entriesMapperPath), constants_1.PATH_CONSTANTS.FILES.UNIQUE_MAPPING);
|
|
29
|
+
this.modifiedCTsPath = path.join((0, cli_utilities_1.sanitizePath)(this.entriesMapperPath), constants_1.PATH_CONSTANTS.FILES.MODIFIED_SCHEMAS);
|
|
30
|
+
this.marketplaceAppMapperPath = path.join((0, cli_utilities_1.sanitizePath)(this.importConfig.backupDir), constants_1.PATH_CONSTANTS.MAPPER, constants_1.PATH_CONSTANTS.MAPPER_MODULES.MARKETPLACE_APPS, constants_1.PATH_CONSTANTS.FILES.UID_MAPPING);
|
|
31
|
+
this.taxonomiesPath = path.join((0, cli_utilities_1.sanitizePath)(this.importConfig.backupDir), constants_1.PATH_CONSTANTS.MAPPER, constants_1.PATH_CONSTANTS.MAPPER_MODULES.TAXONOMIES, constants_1.PATH_CONSTANTS.MAPPER_MODULES.TAXONOMY_TERMS, constants_1.PATH_CONSTANTS.FILES.SUCCESS);
|
|
31
32
|
this.entriesConfig = importConfig.modules.entries;
|
|
32
|
-
this.entriesPath = path.resolve((0, cli_utilities_1.sanitizePath)(importConfig.
|
|
33
|
-
this.cTsPath = path.resolve((0, cli_utilities_1.sanitizePath)(importConfig.
|
|
34
|
-
this.localesPath = path.resolve((0, cli_utilities_1.sanitizePath)(importConfig.
|
|
33
|
+
this.entriesPath = path.resolve((0, cli_utilities_1.sanitizePath)(importConfig.contentDir), (0, cli_utilities_1.sanitizePath)(this.entriesConfig.dirName));
|
|
34
|
+
this.cTsPath = path.resolve((0, cli_utilities_1.sanitizePath)(importConfig.contentDir), (0, cli_utilities_1.sanitizePath)(importConfig.modules['content-types'].dirName));
|
|
35
|
+
this.localesPath = path.resolve((0, cli_utilities_1.sanitizePath)(importConfig.contentDir), (0, cli_utilities_1.sanitizePath)(importConfig.modules.locales.dirName), (0, cli_utilities_1.sanitizePath)(importConfig.modules.locales.fileName));
|
|
36
|
+
// Initialize composable studio paths if config exists
|
|
37
|
+
if (this.importConfig.modules['composable-studio']) {
|
|
38
|
+
this.composableStudioSuccessPath = path.join((0, cli_utilities_1.sanitizePath)(importConfig.backupDir), constants_1.PATH_CONSTANTS.MAPPER, this.importConfig.modules['composable-studio'].dirName, this.importConfig.modules['composable-studio'].fileName);
|
|
39
|
+
this.composableStudioExportPath = path.join((0, cli_utilities_1.sanitizePath)(importConfig.backupDir), this.importConfig.modules['composable-studio'].dirName, this.importConfig.modules['composable-studio'].fileName);
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
this.composableStudioSuccessPath = '';
|
|
43
|
+
this.composableStudioExportPath = '';
|
|
44
|
+
}
|
|
35
45
|
this.importConcurrency = this.entriesConfig.importConcurrency || importConfig.importConcurrency;
|
|
36
46
|
this.entriesUidMapper = {};
|
|
37
47
|
this.modifiedCTs = [];
|
|
@@ -112,8 +122,7 @@ class EntriesImport extends base_class_1.default {
|
|
|
112
122
|
.updateStatus(utils_1.PROCESS_STATUS[utils_1.PROCESS_NAMES.CLEANUP].CLEANING, utils_1.PROCESS_NAMES.CLEANUP);
|
|
113
123
|
await this.processCleanup();
|
|
114
124
|
progress.completeProcess(utils_1.PROCESS_NAMES.CLEANUP, true);
|
|
115
|
-
this.
|
|
116
|
-
cli_utilities_1.log.success('Entries imported successfully', this.importConfig.context);
|
|
125
|
+
this.completeProgressWithMessage();
|
|
117
126
|
}
|
|
118
127
|
catch (error) {
|
|
119
128
|
this.createEntryDataForVariantEntry();
|
|
@@ -124,7 +133,7 @@ class EntriesImport extends base_class_1.default {
|
|
|
124
133
|
async analyzeEntryData() {
|
|
125
134
|
return this.withLoadingSpinner('ENTRIES: Analyzing import data...', async () => {
|
|
126
135
|
cli_utilities_1.log.debug('Loading content types for entry analysis', this.importConfig.context);
|
|
127
|
-
this.cTs =
|
|
136
|
+
this.cTs = (0, cli_utilities_1.readContentTypeSchemas)(this.cTsPath);
|
|
128
137
|
if (!this.cTs || (0, lodash_1.isEmpty)(this.cTs)) {
|
|
129
138
|
return [0, 0, 0, 0, 0];
|
|
130
139
|
}
|
|
@@ -148,7 +157,7 @@ class EntriesImport extends base_class_1.default {
|
|
|
148
157
|
for (let locale of this.locales) {
|
|
149
158
|
for (let contentType of this.cTs) {
|
|
150
159
|
const basePath = path.join(this.entriesPath, contentType.uid, locale.code);
|
|
151
|
-
const fs = new cli_utilities_1.FsUtility({ basePath, indexFileName:
|
|
160
|
+
const fs = new cli_utilities_1.FsUtility({ basePath, indexFileName: constants_1.PATH_CONSTANTS.FILES.INDEX });
|
|
152
161
|
const indexer = fs.indexFileContent;
|
|
153
162
|
const chunksInThisCTLocale = (0, lodash_1.values)(indexer).length;
|
|
154
163
|
totalEntryChunks += chunksInThisCTLocale;
|
|
@@ -200,7 +209,7 @@ class EntriesImport extends base_class_1.default {
|
|
|
200
209
|
await this.createEntries(entryRequestOption);
|
|
201
210
|
}
|
|
202
211
|
cli_utilities_1.log.debug('Writing entry UID mappings to file', this.importConfig.context);
|
|
203
|
-
await utils_1.fileHelper.writeLargeFile(path.join(this.entriesMapperPath,
|
|
212
|
+
await utils_1.fileHelper.writeLargeFile(path.join(this.entriesMapperPath, constants_1.PATH_CONSTANTS.FILES.UID_MAPPING), this.entriesUidMapper);
|
|
204
213
|
utils_1.fsUtil.writeFile(path.join(this.entriesMapperPath, 'failed-entries.json'), this.failedEntries);
|
|
205
214
|
}
|
|
206
215
|
async processEntryReplacement() {
|
|
@@ -357,7 +366,7 @@ class EntriesImport extends base_class_1.default {
|
|
|
357
366
|
async createEntries({ cTUid, locale }) {
|
|
358
367
|
var _a, _b;
|
|
359
368
|
const processName = 'Create Entries';
|
|
360
|
-
const indexFileName =
|
|
369
|
+
const indexFileName = constants_1.PATH_CONSTANTS.FILES.INDEX;
|
|
361
370
|
const basePath = path.join(this.entriesPath, cTUid, locale);
|
|
362
371
|
const fs = new cli_utilities_1.FsUtility({ basePath, indexFileName });
|
|
363
372
|
const indexer = fs.indexFileContent;
|
|
@@ -373,7 +382,7 @@ class EntriesImport extends base_class_1.default {
|
|
|
373
382
|
// Write created entries
|
|
374
383
|
const entriesCreateFileHelper = new cli_utilities_1.FsUtility({
|
|
375
384
|
moduleName: 'entries',
|
|
376
|
-
indexFileName:
|
|
385
|
+
indexFileName: constants_1.PATH_CONSTANTS.FILES.INDEX,
|
|
377
386
|
basePath: path.join(this.entriesMapperPath, cTUid, locale),
|
|
378
387
|
chunkFileSize: this.entriesConfig.chunkFileSize,
|
|
379
388
|
keepMetadata: false,
|
|
@@ -382,7 +391,7 @@ class EntriesImport extends base_class_1.default {
|
|
|
382
391
|
// create file instance for existing entries
|
|
383
392
|
const existingEntriesFileHelper = new cli_utilities_1.FsUtility({
|
|
384
393
|
moduleName: 'entries',
|
|
385
|
-
indexFileName:
|
|
394
|
+
indexFileName: constants_1.PATH_CONSTANTS.FILES.INDEX,
|
|
386
395
|
basePath: path.join(this.entriesMapperPath, cTUid, locale, 'existing'),
|
|
387
396
|
chunkFileSize: this.entriesConfig.chunkFileSize,
|
|
388
397
|
keepMetadata: false,
|
|
@@ -534,7 +543,7 @@ class EntriesImport extends base_class_1.default {
|
|
|
534
543
|
}
|
|
535
544
|
async replaceEntries({ cTUid, locale }) {
|
|
536
545
|
const processName = 'Replace existing Entries';
|
|
537
|
-
const indexFileName =
|
|
546
|
+
const indexFileName = constants_1.PATH_CONSTANTS.FILES.INDEX;
|
|
538
547
|
const basePath = path.join(this.entriesMapperPath, cTUid, locale, 'existing');
|
|
539
548
|
const fs = new cli_utilities_1.FsUtility({ basePath, indexFileName });
|
|
540
549
|
const indexer = fs.indexFileContent;
|
|
@@ -547,7 +556,7 @@ class EntriesImport extends base_class_1.default {
|
|
|
547
556
|
// Write updated entries
|
|
548
557
|
const entriesReplaceFileHelper = new cli_utilities_1.FsUtility({
|
|
549
558
|
moduleName: 'entries',
|
|
550
|
-
indexFileName:
|
|
559
|
+
indexFileName: constants_1.PATH_CONSTANTS.FILES.INDEX,
|
|
551
560
|
basePath: path.join(this.entriesMapperPath, cTUid, locale),
|
|
552
561
|
chunkFileSize: this.entriesConfig.chunkFileSize,
|
|
553
562
|
keepMetadata: false,
|
|
@@ -662,7 +671,7 @@ class EntriesImport extends base_class_1.default {
|
|
|
662
671
|
}
|
|
663
672
|
async updateEntriesWithReferences({ cTUid, locale }) {
|
|
664
673
|
const processName = 'Update Entries';
|
|
665
|
-
const indexFileName =
|
|
674
|
+
const indexFileName = constants_1.PATH_CONSTANTS.FILES.INDEX;
|
|
666
675
|
const basePath = path.join(this.entriesMapperPath, cTUid, locale);
|
|
667
676
|
const fs = new cli_utilities_1.FsUtility({ basePath, indexFileName });
|
|
668
677
|
const indexer = fs.indexFileContent;
|
|
@@ -842,10 +851,15 @@ class EntriesImport extends base_class_1.default {
|
|
|
842
851
|
}
|
|
843
852
|
cli_utilities_1.log.debug(`Found ${cTsWithFieldRules.length} content types with field rules to update`, this.importConfig.context);
|
|
844
853
|
try {
|
|
854
|
+
// Read content types from individual files
|
|
855
|
+
const cTs = (0, cli_utilities_1.readContentTypeSchemas)(this.cTsPath) || [];
|
|
845
856
|
for (let cTUid of cTsWithFieldRules) {
|
|
846
857
|
cli_utilities_1.log.debug(`Processing field rules for content type: ${cTUid}`, this.importConfig.context);
|
|
847
|
-
const cTs = utils_1.fsUtil.readFile(path.join(this.cTsPath, 'schema.json'));
|
|
848
858
|
const contentType = (0, lodash_1.find)(cTs, { uid: cTUid });
|
|
859
|
+
if (!contentType) {
|
|
860
|
+
cli_utilities_1.log.debug(`Content type ${cTUid} not found in schemas`, this.importConfig.context);
|
|
861
|
+
continue;
|
|
862
|
+
}
|
|
849
863
|
if (contentType.field_rules) {
|
|
850
864
|
cli_utilities_1.log.debug(`Found ${contentType.field_rules.length} field rules for content type: ${cTUid}`, this.importConfig.context);
|
|
851
865
|
const fieldDatatypeMap = {};
|
|
@@ -907,7 +921,7 @@ class EntriesImport extends base_class_1.default {
|
|
|
907
921
|
}
|
|
908
922
|
async publishEntries({ cTUid, locale }) {
|
|
909
923
|
const processName = 'Publish Entries';
|
|
910
|
-
const indexFileName =
|
|
924
|
+
const indexFileName = constants_1.PATH_CONSTANTS.FILES.INDEX;
|
|
911
925
|
const basePath = path.join(this.entriesPath, cTUid, locale);
|
|
912
926
|
const fs = new cli_utilities_1.FsUtility({ basePath, indexFileName });
|
|
913
927
|
const indexer = fs.indexFileContent;
|
|
@@ -935,16 +949,7 @@ class EntriesImport extends base_class_1.default {
|
|
|
935
949
|
(0, cli_utilities_1.handleAndLogError)(error, Object.assign(Object.assign({}, this.importConfig.context), { cTUid, locale }));
|
|
936
950
|
});
|
|
937
951
|
if (chunk) {
|
|
938
|
-
|
|
939
|
-
let apiContentDuplicate = [];
|
|
940
|
-
apiContentDuplicate = apiContent.flatMap((content) => {
|
|
941
|
-
var _a;
|
|
942
|
-
if (((_a = content === null || content === void 0 ? void 0 : content.publish_details) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
943
|
-
return content.publish_details.map((publish) => (Object.assign(Object.assign({}, content), { locale: publish.locale, publish_details: [publish] })));
|
|
944
|
-
}
|
|
945
|
-
return []; // Return an empty array if publish_details is empty
|
|
946
|
-
});
|
|
947
|
-
apiContent = apiContentDuplicate;
|
|
952
|
+
const apiContent = (0, lodash_1.values)(chunk).filter((content) => { var _a; return ((_a = content === null || content === void 0 ? void 0 : content.publish_details) === null || _a === void 0 ? void 0 : _a.length) > 0; });
|
|
948
953
|
cli_utilities_1.log.debug(`Processing ${apiContent.length} publishable entries in chunk ${index}`, this.importConfig.context);
|
|
949
954
|
if ((apiContent === null || apiContent === void 0 ? void 0 : apiContent.length) === 0) {
|
|
950
955
|
cli_utilities_1.log.debug(`No publishable entries found in chunk ${index}`, this.importConfig.context);
|
|
@@ -5,6 +5,7 @@ const isEmpty_1 = tslib_1.__importDefault(require("lodash/isEmpty"));
|
|
|
5
5
|
const values_1 = tslib_1.__importDefault(require("lodash/values"));
|
|
6
6
|
const node_path_1 = require("node:path");
|
|
7
7
|
const cli_utilities_1 = require("@contentstack/cli-utilities");
|
|
8
|
+
const constants_1 = require("../../constants");
|
|
8
9
|
const utils_1 = require("../../utils");
|
|
9
10
|
const base_class_1 = tslib_1.__importDefault(require("./base-class"));
|
|
10
11
|
class ImportEnvironments extends base_class_1.default {
|
|
@@ -13,11 +14,11 @@ class ImportEnvironments extends base_class_1.default {
|
|
|
13
14
|
this.importConfig.context.module = utils_1.MODULE_CONTEXTS.ENVIRONMENTS;
|
|
14
15
|
this.currentModuleName = utils_1.MODULE_NAMES[utils_1.MODULE_CONTEXTS.ENVIRONMENTS];
|
|
15
16
|
this.environmentsConfig = importConfig.modules.environments;
|
|
16
|
-
this.mapperDirPath = (0, node_path_1.join)(this.importConfig.backupDir,
|
|
17
|
+
this.mapperDirPath = (0, node_path_1.join)(this.importConfig.backupDir, constants_1.PATH_CONSTANTS.MAPPER, constants_1.PATH_CONSTANTS.MAPPER_MODULES.ENVIRONMENTS);
|
|
17
18
|
this.environmentsFolderPath = (0, node_path_1.join)(this.importConfig.backupDir, this.environmentsConfig.dirName);
|
|
18
|
-
this.envUidMapperPath = (0, node_path_1.join)(this.mapperDirPath,
|
|
19
|
-
this.envSuccessPath = (0, node_path_1.join)(this.mapperDirPath,
|
|
20
|
-
this.envFailsPath = (0, node_path_1.join)(this.mapperDirPath,
|
|
19
|
+
this.envUidMapperPath = (0, node_path_1.join)(this.mapperDirPath, constants_1.PATH_CONSTANTS.FILES.UID_MAPPING);
|
|
20
|
+
this.envSuccessPath = (0, node_path_1.join)(this.mapperDirPath, constants_1.PATH_CONSTANTS.FILES.SUCCESS);
|
|
21
|
+
this.envFailsPath = (0, node_path_1.join)(this.mapperDirPath, constants_1.PATH_CONSTANTS.FILES.FAILS);
|
|
21
22
|
this.envFailed = [];
|
|
22
23
|
this.envSuccess = [];
|
|
23
24
|
this.envUidMapper = {};
|
|
@@ -39,8 +40,7 @@ class ImportEnvironments extends base_class_1.default {
|
|
|
39
40
|
progress.updateStatus(utils_1.PROCESS_STATUS[utils_1.PROCESS_NAMES.ENVIRONMENTS_IMPORT].IMPORTING);
|
|
40
41
|
await this.importEnvironments();
|
|
41
42
|
await this.processImportResults();
|
|
42
|
-
this.
|
|
43
|
-
cli_utilities_1.log.success('Environments have been imported successfully!', this.importConfig.context);
|
|
43
|
+
this.completeProgressWithMessage();
|
|
44
44
|
}
|
|
45
45
|
catch (error) {
|
|
46
46
|
this.completeProgress(false, (error === null || error === void 0 ? void 0 : error.message) || 'Environments import failed');
|
|
@@ -6,6 +6,7 @@ const values_1 = tslib_1.__importDefault(require("lodash/values"));
|
|
|
6
6
|
const cloneDeep_1 = tslib_1.__importDefault(require("lodash/cloneDeep"));
|
|
7
7
|
const node_path_1 = require("node:path");
|
|
8
8
|
const cli_utilities_1 = require("@contentstack/cli-utilities");
|
|
9
|
+
const constants_1 = require("../../constants");
|
|
9
10
|
const utils_1 = require("../../utils");
|
|
10
11
|
const base_class_1 = tslib_1.__importDefault(require("./base-class"));
|
|
11
12
|
class ImportExtensions extends base_class_1.default {
|
|
@@ -14,12 +15,12 @@ class ImportExtensions extends base_class_1.default {
|
|
|
14
15
|
this.importConfig.context.module = utils_1.MODULE_CONTEXTS.EXTENSIONS;
|
|
15
16
|
this.currentModuleName = utils_1.MODULE_NAMES[utils_1.MODULE_CONTEXTS.EXTENSIONS];
|
|
16
17
|
this.extensionsConfig = importConfig.modules.extensions;
|
|
17
|
-
this.mapperDirPath = (0, node_path_1.join)(this.importConfig.backupDir,
|
|
18
|
+
this.mapperDirPath = (0, node_path_1.join)(this.importConfig.backupDir, constants_1.PATH_CONSTANTS.MAPPER, constants_1.PATH_CONSTANTS.MAPPER_MODULES.EXTENSIONS);
|
|
18
19
|
this.extensionsFolderPath = (0, node_path_1.join)(this.importConfig.backupDir, this.extensionsConfig.dirName);
|
|
19
|
-
this.extUidMapperPath = (0, node_path_1.join)(this.mapperDirPath,
|
|
20
|
-
this.extSuccessPath = (0, node_path_1.join)(this.mapperDirPath,
|
|
21
|
-
this.extFailsPath = (0, node_path_1.join)(this.mapperDirPath,
|
|
22
|
-
this.extPendingPath = (0, node_path_1.join)(this.mapperDirPath,
|
|
20
|
+
this.extUidMapperPath = (0, node_path_1.join)(this.mapperDirPath, constants_1.PATH_CONSTANTS.FILES.UID_MAPPING);
|
|
21
|
+
this.extSuccessPath = (0, node_path_1.join)(this.mapperDirPath, constants_1.PATH_CONSTANTS.FILES.SUCCESS);
|
|
22
|
+
this.extFailsPath = (0, node_path_1.join)(this.mapperDirPath, constants_1.PATH_CONSTANTS.FILES.FAILS);
|
|
23
|
+
this.extPendingPath = (0, node_path_1.join)(this.mapperDirPath, constants_1.PATH_CONSTANTS.FILES.PENDING_EXTENSIONS);
|
|
23
24
|
this.extFailed = [];
|
|
24
25
|
this.extSuccess = [];
|
|
25
26
|
this.existingExtensions = [];
|
|
@@ -60,8 +61,7 @@ class ImportExtensions extends base_class_1.default {
|
|
|
60
61
|
progress.completeProcess(utils_1.PROCESS_NAMES.EXTENSIONS_REPLACE_EXISTING, true);
|
|
61
62
|
}
|
|
62
63
|
await this.processExtensionResults();
|
|
63
|
-
this.
|
|
64
|
-
cli_utilities_1.log.success('Extensions have been imported successfully!', this.importConfig.context);
|
|
64
|
+
this.completeProgressWithMessage();
|
|
65
65
|
}
|
|
66
66
|
catch (error) {
|
|
67
67
|
this.completeProgress(false, (error === null || error === void 0 ? void 0 : error.message) || 'Create failed');
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/* eslint-disable no-prototype-builtins */
|
|
3
3
|
/*!
|
|
4
4
|
* Contentstack Import
|
|
5
|
-
* Copyright (c)
|
|
5
|
+
* Copyright (c) 2026 Contentstack LLC
|
|
6
6
|
* MIT Licensed
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -10,6 +10,7 @@ const tslib_1 = require("tslib");
|
|
|
10
10
|
const path = tslib_1.__importStar(require("path"));
|
|
11
11
|
const lodash_1 = require("lodash");
|
|
12
12
|
const cli_utilities_1 = require("@contentstack/cli-utilities");
|
|
13
|
+
const constants_1 = require("../../constants");
|
|
13
14
|
const utils_1 = require("../../utils");
|
|
14
15
|
const base_class_1 = tslib_1.__importDefault(require("./base-class"));
|
|
15
16
|
const global_field_helper_1 = require("../../utils/global-field-helper");
|
|
@@ -27,13 +28,13 @@ class ImportGlobalFields extends base_class_1.default {
|
|
|
27
28
|
this.pendingGFs = [];
|
|
28
29
|
this.existingGFs = [];
|
|
29
30
|
this.reqConcurrency = this.gFsConfig.writeConcurrency || this.config.writeConcurrency;
|
|
30
|
-
this.gFsMapperPath = path.resolve((0, cli_utilities_1.sanitizePath)(this.config.
|
|
31
|
-
this.gFsFolderPath = path.resolve((0, cli_utilities_1.sanitizePath)(this.config.
|
|
32
|
-
this.gFsFailsPath = path.resolve((0, cli_utilities_1.sanitizePath)(this.config.
|
|
33
|
-
this.gFsSuccessPath = path.resolve((0, cli_utilities_1.sanitizePath)(this.config.
|
|
34
|
-
this.gFsUidMapperPath = path.resolve((0, cli_utilities_1.sanitizePath)(this.config.
|
|
35
|
-
this.gFsPendingPath = path.resolve((0, cli_utilities_1.sanitizePath)(this.config.
|
|
36
|
-
this.marketplaceAppMapperPath = path.join((0, cli_utilities_1.sanitizePath)(this.config.
|
|
31
|
+
this.gFsMapperPath = path.resolve((0, cli_utilities_1.sanitizePath)(this.config.backupDir), constants_1.PATH_CONSTANTS.MAPPER, constants_1.PATH_CONSTANTS.MAPPER_MODULES.GLOBAL_FIELDS);
|
|
32
|
+
this.gFsFolderPath = path.resolve((0, cli_utilities_1.sanitizePath)(this.config.contentDir), (0, cli_utilities_1.sanitizePath)(this.gFsConfig.dirName));
|
|
33
|
+
this.gFsFailsPath = path.resolve((0, cli_utilities_1.sanitizePath)(this.config.backupDir), constants_1.PATH_CONSTANTS.MAPPER, constants_1.PATH_CONSTANTS.MAPPER_MODULES.GLOBAL_FIELDS, constants_1.PATH_CONSTANTS.FILES.FAILS);
|
|
34
|
+
this.gFsSuccessPath = path.resolve((0, cli_utilities_1.sanitizePath)(this.config.backupDir), constants_1.PATH_CONSTANTS.MAPPER, constants_1.PATH_CONSTANTS.MAPPER_MODULES.GLOBAL_FIELDS, constants_1.PATH_CONSTANTS.FILES.SUCCESS);
|
|
35
|
+
this.gFsUidMapperPath = path.resolve((0, cli_utilities_1.sanitizePath)(this.config.backupDir), constants_1.PATH_CONSTANTS.MAPPER, constants_1.PATH_CONSTANTS.MAPPER_MODULES.GLOBAL_FIELDS, constants_1.PATH_CONSTANTS.FILES.UID_MAPPING);
|
|
36
|
+
this.gFsPendingPath = path.resolve((0, cli_utilities_1.sanitizePath)(this.config.backupDir), constants_1.PATH_CONSTANTS.MAPPER, constants_1.PATH_CONSTANTS.MAPPER_MODULES.GLOBAL_FIELDS, constants_1.PATH_CONSTANTS.FILES.PENDING_GLOBAL_FIELDS);
|
|
37
|
+
this.marketplaceAppMapperPath = path.join((0, cli_utilities_1.sanitizePath)(this.config.backupDir), constants_1.PATH_CONSTANTS.MAPPER, constants_1.PATH_CONSTANTS.MAPPER_MODULES.MARKETPLACE_APPS, constants_1.PATH_CONSTANTS.FILES.UID_MAPPING);
|
|
37
38
|
}
|
|
38
39
|
/**
|
|
39
40
|
* @method start
|
|
@@ -76,8 +77,7 @@ class ImportGlobalFields extends base_class_1.default {
|
|
|
76
77
|
progress.completeProcess(utils_1.PROCESS_NAMES.GLOBAL_FIELDS_REPLACE_EXISTING, true);
|
|
77
78
|
}
|
|
78
79
|
await this.processGlobalFieldResults();
|
|
79
|
-
this.
|
|
80
|
-
cli_utilities_1.log.success('Global fields import has been completed!', this.importConfig.context);
|
|
80
|
+
this.completeProgressWithMessage();
|
|
81
81
|
}
|
|
82
82
|
catch (error) {
|
|
83
83
|
this.completeProgress(false, (error === null || error === void 0 ? void 0 : error.message) || 'Global fields import failed');
|
|
@@ -6,6 +6,7 @@ const node_path_1 = require("node:path");
|
|
|
6
6
|
const isEmpty_1 = tslib_1.__importDefault(require("lodash/isEmpty"));
|
|
7
7
|
const values_1 = tslib_1.__importDefault(require("lodash/values"));
|
|
8
8
|
const cli_utilities_1 = require("@contentstack/cli-utilities");
|
|
9
|
+
const constants_1 = require("../../constants");
|
|
9
10
|
const utils_1 = require("../../utils");
|
|
10
11
|
const base_class_1 = tslib_1.__importDefault(require("./base-class"));
|
|
11
12
|
class ImportLabels extends base_class_1.default {
|
|
@@ -14,11 +15,11 @@ class ImportLabels extends base_class_1.default {
|
|
|
14
15
|
this.importConfig.context.module = utils_1.MODULE_CONTEXTS.LABELS;
|
|
15
16
|
this.currentModuleName = utils_1.MODULE_NAMES[utils_1.MODULE_CONTEXTS.LABELS];
|
|
16
17
|
this.labelsConfig = importConfig.modules.labels;
|
|
17
|
-
this.mapperDirPath = (0, node_path_1.join)(this.importConfig.backupDir,
|
|
18
|
+
this.mapperDirPath = (0, node_path_1.join)(this.importConfig.backupDir, constants_1.PATH_CONSTANTS.MAPPER, constants_1.PATH_CONSTANTS.MAPPER_MODULES.LABELS);
|
|
18
19
|
this.labelsFolderPath = (0, node_path_1.join)(this.importConfig.backupDir, this.labelsConfig.dirName);
|
|
19
|
-
this.labelUidMapperPath = (0, node_path_1.join)(this.mapperDirPath,
|
|
20
|
-
this.createdLabelPath = (0, node_path_1.join)(this.mapperDirPath,
|
|
21
|
-
this.labelFailsPath = (0, node_path_1.join)(this.mapperDirPath,
|
|
20
|
+
this.labelUidMapperPath = (0, node_path_1.join)(this.mapperDirPath, constants_1.PATH_CONSTANTS.FILES.UID_MAPPING);
|
|
21
|
+
this.createdLabelPath = (0, node_path_1.join)(this.mapperDirPath, constants_1.PATH_CONSTANTS.FILES.SUCCESS);
|
|
22
|
+
this.labelFailsPath = (0, node_path_1.join)(this.mapperDirPath, constants_1.PATH_CONSTANTS.FILES.FAILS);
|
|
22
23
|
this.labels = {};
|
|
23
24
|
this.failedLabel = [];
|
|
24
25
|
this.createdLabel = [];
|
|
@@ -55,8 +56,7 @@ class ImportLabels extends base_class_1.default {
|
|
|
55
56
|
await this.updateLabels();
|
|
56
57
|
progress.completeProcess(utils_1.PROCESS_NAMES.LABELS_UPDATE, true);
|
|
57
58
|
this.processLabelResults();
|
|
58
|
-
this.
|
|
59
|
-
cli_utilities_1.log.success('Labels have been imported successfully!', this.importConfig.context);
|
|
59
|
+
this.completeProgressWithMessage();
|
|
60
60
|
}
|
|
61
61
|
catch (error) {
|
|
62
62
|
this.completeProgress(false, (error === null || error === void 0 ? void 0 : error.message) || 'Labels import failed');
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/* eslint-disable no-prototype-builtins */
|
|
3
3
|
/*!
|
|
4
4
|
* Contentstack Import
|
|
5
|
-
* Copyright (c)
|
|
5
|
+
* Copyright (c) 2026 Contentstack LLC
|
|
6
6
|
* MIT Licensed
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -10,6 +10,7 @@ const tslib_1 = require("tslib");
|
|
|
10
10
|
const path = tslib_1.__importStar(require("path"));
|
|
11
11
|
const lodash_1 = require("lodash");
|
|
12
12
|
const cli_utilities_1 = require("@contentstack/cli-utilities");
|
|
13
|
+
const constants_1 = require("../../constants");
|
|
13
14
|
const base_class_1 = tslib_1.__importDefault(require("./base-class"));
|
|
14
15
|
const utils_1 = require("../../utils");
|
|
15
16
|
class ImportLocales extends base_class_1.default {
|
|
@@ -27,11 +28,11 @@ class ImportLocales extends base_class_1.default {
|
|
|
27
28
|
this.createdLocales = [];
|
|
28
29
|
this.failedLocales = [];
|
|
29
30
|
this.reqConcurrency = this.localeConfig.writeConcurrency || this.config.writeConcurrency;
|
|
30
|
-
this.langMapperPath = path.resolve((0, cli_utilities_1.sanitizePath)(this.config.
|
|
31
|
-
this.langFolderPath = path.resolve((0, cli_utilities_1.sanitizePath)(this.config.
|
|
32
|
-
this.langFailsPath = path.resolve((0, cli_utilities_1.sanitizePath)(this.config.
|
|
33
|
-
this.langSuccessPath = path.resolve((0, cli_utilities_1.sanitizePath)(this.config.
|
|
34
|
-
this.langUidMapperPath = path.resolve((0, cli_utilities_1.sanitizePath)(this.config.
|
|
31
|
+
this.langMapperPath = path.resolve((0, cli_utilities_1.sanitizePath)(this.config.backupDir), constants_1.PATH_CONSTANTS.MAPPER, constants_1.PATH_CONSTANTS.MAPPER_MODULES.LANGUAGES);
|
|
32
|
+
this.langFolderPath = path.resolve((0, cli_utilities_1.sanitizePath)(this.config.contentDir), (0, cli_utilities_1.sanitizePath)(this.localeConfig.dirName));
|
|
33
|
+
this.langFailsPath = path.resolve((0, cli_utilities_1.sanitizePath)(this.config.backupDir), constants_1.PATH_CONSTANTS.MAPPER, constants_1.PATH_CONSTANTS.MAPPER_MODULES.LANGUAGES, constants_1.PATH_CONSTANTS.FILES.FAILS);
|
|
34
|
+
this.langSuccessPath = path.resolve((0, cli_utilities_1.sanitizePath)(this.config.backupDir), constants_1.PATH_CONSTANTS.MAPPER, constants_1.PATH_CONSTANTS.MAPPER_MODULES.LANGUAGES, constants_1.PATH_CONSTANTS.FILES.SUCCESS);
|
|
35
|
+
this.langUidMapperPath = path.resolve((0, cli_utilities_1.sanitizePath)(this.config.backupDir), constants_1.PATH_CONSTANTS.MAPPER, constants_1.PATH_CONSTANTS.MAPPER_MODULES.LANGUAGES, constants_1.PATH_CONSTANTS.FILES.UID_MAPPER);
|
|
35
36
|
}
|
|
36
37
|
async start() {
|
|
37
38
|
try {
|
|
@@ -49,8 +50,7 @@ class ImportLocales extends base_class_1.default {
|
|
|
49
50
|
cli_utilities_1.log.debug('Writing failed locales to file', this.config.context);
|
|
50
51
|
utils_1.fsUtil.writeFile(this.langFailsPath, this.failedLocales);
|
|
51
52
|
cli_utilities_1.log.debug(`Written ${this.failedLocales.length} failed locales to file`, this.config.context);
|
|
52
|
-
this.
|
|
53
|
-
cli_utilities_1.log.success('Languages have been imported successfully!', this.config.context);
|
|
53
|
+
this.completeProgressWithMessage({ context: this.config.context });
|
|
54
54
|
}
|
|
55
55
|
catch (error) {
|
|
56
56
|
this.completeProgress(false, (error === null || error === void 0 ? void 0 : error.message) || 'Locales import failed');
|
|
@@ -13,6 +13,7 @@ const filter_1 = tslib_1.__importDefault(require("lodash/filter"));
|
|
|
13
13
|
const isEmpty_1 = tslib_1.__importDefault(require("lodash/isEmpty"));
|
|
14
14
|
const toLower_1 = tslib_1.__importDefault(require("lodash/toLower"));
|
|
15
15
|
const cli_utilities_1 = require("@contentstack/cli-utilities");
|
|
16
|
+
const constants_1 = require("../../constants");
|
|
16
17
|
const interactive_1 = require("../../utils/interactive");
|
|
17
18
|
const utils_1 = require("../../utils");
|
|
18
19
|
const base_class_1 = tslib_1.__importDefault(require("./base-class"));
|
|
@@ -22,9 +23,9 @@ class ImportMarketplaceApps extends base_class_1.default {
|
|
|
22
23
|
this.importConfig.context.module = utils_1.MODULE_CONTEXTS.MARKETPLACE_APPS;
|
|
23
24
|
this.currentModuleName = utils_1.MODULE_NAMES[utils_1.MODULE_CONTEXTS.MARKETPLACE_APPS];
|
|
24
25
|
this.marketPlaceAppConfig = importConfig.modules.marketplace_apps;
|
|
25
|
-
this.mapperDirPath = (0, node_path_1.join)(this.importConfig.backupDir,
|
|
26
|
+
this.mapperDirPath = (0, node_path_1.join)(this.importConfig.backupDir, constants_1.PATH_CONSTANTS.MAPPER, constants_1.PATH_CONSTANTS.MAPPER_MODULES.MARKETPLACE_APPS);
|
|
26
27
|
this.marketPlaceFolderPath = (0, node_path_1.join)(this.importConfig.backupDir, this.marketPlaceAppConfig.dirName);
|
|
27
|
-
this.marketPlaceUidMapperPath = (0, node_path_1.join)(this.mapperDirPath,
|
|
28
|
+
this.marketPlaceUidMapperPath = (0, node_path_1.join)(this.mapperDirPath, constants_1.PATH_CONSTANTS.FILES.UID_MAPPING);
|
|
28
29
|
this.appNameMapping = {};
|
|
29
30
|
this.appUidMapping = {};
|
|
30
31
|
this.appOriginalName = undefined;
|
|
@@ -85,8 +86,7 @@ class ImportMarketplaceApps extends base_class_1.default {
|
|
|
85
86
|
.updateStatus(utils_1.PROCESS_STATUS[utils_1.PROCESS_NAMES.INSTALL_APPS].INSTALLING, utils_1.PROCESS_NAMES.INSTALL_APPS);
|
|
86
87
|
await this.importMarketplaceApps();
|
|
87
88
|
progress.completeProcess(utils_1.PROCESS_NAMES.INSTALL_APPS, true);
|
|
88
|
-
this.
|
|
89
|
-
cli_utilities_1.log.success('Marketplace apps have been imported successfully!', this.importConfig.context);
|
|
89
|
+
this.completeProgressWithMessage();
|
|
90
90
|
}
|
|
91
91
|
catch (error) {
|
|
92
92
|
this.completeProgress(false, (error === null || error === void 0 ? void 0 : error.message) || 'Marketplace apps import failed');
|
|
@@ -347,11 +347,11 @@ class ImportMarketplaceApps extends base_class_1.default {
|
|
|
347
347
|
*/
|
|
348
348
|
async installApp(config, appManifestUid) {
|
|
349
349
|
cli_utilities_1.log.debug(`Installing app with manifest UID: ${appManifestUid}`, this.importConfig.context);
|
|
350
|
-
cli_utilities_1.log.debug(`Target stack: ${config.
|
|
350
|
+
cli_utilities_1.log.debug(`Target stack: ${config.apiKey}`, this.importConfig.context);
|
|
351
351
|
return await this.appSdk
|
|
352
352
|
.marketplace(this.importConfig.org_uid)
|
|
353
353
|
.app(appManifestUid)
|
|
354
|
-
.install({ targetUid: config.
|
|
354
|
+
.install({ targetUid: config.apiKey, targetType: 'stack' })
|
|
355
355
|
.then((response) => {
|
|
356
356
|
cli_utilities_1.log.debug(`App installation successful: ${appManifestUid}`, this.importConfig.context);
|
|
357
357
|
return response;
|
|
@@ -46,8 +46,7 @@ class ImportPersonalize extends base_class_1.default {
|
|
|
46
46
|
else {
|
|
47
47
|
cli_utilities_1.log.debug('No personalize modules configured for processing', this.config.context);
|
|
48
48
|
}
|
|
49
|
-
this.
|
|
50
|
-
cli_utilities_1.log.success('Personalize import completed successfully', this.config.context);
|
|
49
|
+
this.completeProgressWithMessage();
|
|
51
50
|
}
|
|
52
51
|
catch (error) {
|
|
53
52
|
this.personalizeConfig.importData = false; // Stop personalize import if project creation fails
|
|
@@ -145,7 +144,7 @@ class ImportPersonalize extends base_class_1.default {
|
|
|
145
144
|
}
|
|
146
145
|
const personalize = this.config.modules.personalize;
|
|
147
146
|
const { dirName, fileName } = personalize.projects;
|
|
148
|
-
const projectPath = (0, path_1.join)((0, cli_utilities_1.sanitizePath)(this.config.
|
|
147
|
+
const projectPath = (0, path_1.join)((0, cli_utilities_1.sanitizePath)(this.config.contentDir), (0, cli_utilities_1.sanitizePath)(personalize.dirName), (0, cli_utilities_1.sanitizePath)(dirName), (0, cli_utilities_1.sanitizePath)(fileName));
|
|
149
148
|
cli_utilities_1.log.debug(`Checking for project file: ${projectPath}`, this.config.context);
|
|
150
149
|
if (!(0, fs_1.existsSync)(projectPath)) {
|
|
151
150
|
this.config.modules.personalize.importData = false;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const node_path_1 = require("node:path");
|
|
5
5
|
const cli_utilities_1 = require("@contentstack/cli-utilities");
|
|
6
|
+
const constants_1 = require("../../constants");
|
|
6
7
|
const base_class_1 = tslib_1.__importDefault(require("./base-class"));
|
|
7
8
|
const utils_1 = require("../../utils");
|
|
8
9
|
class ImportStack extends base_class_1.default {
|
|
@@ -12,8 +13,8 @@ class ImportStack extends base_class_1.default {
|
|
|
12
13
|
this.envUidMapper = {};
|
|
13
14
|
this.importConfig.context.module = utils_1.MODULE_CONTEXTS.STACK;
|
|
14
15
|
this.currentModuleName = utils_1.MODULE_NAMES[utils_1.MODULE_CONTEXTS.STACK];
|
|
15
|
-
this.stackSettingsPath = (0, node_path_1.join)(this.importConfig.backupDir,
|
|
16
|
-
this.envUidMapperPath = (0, node_path_1.join)(this.importConfig.backupDir,
|
|
16
|
+
this.stackSettingsPath = (0, node_path_1.join)(this.importConfig.backupDir, constants_1.PATH_CONSTANTS.CONTENT_DIRS.STACK, constants_1.PATH_CONSTANTS.FILES.SETTINGS);
|
|
17
|
+
this.envUidMapperPath = (0, node_path_1.join)(this.importConfig.backupDir, constants_1.PATH_CONSTANTS.MAPPER, constants_1.PATH_CONSTANTS.MAPPER_MODULES.ENVIRONMENTS, constants_1.PATH_CONSTANTS.FILES.UID_MAPPING);
|
|
17
18
|
}
|
|
18
19
|
/**
|
|
19
20
|
* @method start
|
|
@@ -35,8 +36,7 @@ class ImportStack extends base_class_1.default {
|
|
|
35
36
|
progress.updateStatus(utils_1.PROCESS_STATUS[utils_1.PROCESS_NAMES.STACK_IMPORT].IMPORTING);
|
|
36
37
|
cli_utilities_1.log.info('Starting stack settings import process', this.importConfig.context);
|
|
37
38
|
await this.importStackSettings();
|
|
38
|
-
this.
|
|
39
|
-
cli_utilities_1.log.success('Stack settings imported successfully!', this.importConfig.context);
|
|
39
|
+
this.completeProgressWithMessage();
|
|
40
40
|
}
|
|
41
41
|
catch (error) {
|
|
42
42
|
this.completeProgress(false, 'Stack settings import failed');
|
|
@@ -47,7 +47,7 @@ class ImportStack extends base_class_1.default {
|
|
|
47
47
|
var _a, _b, _c;
|
|
48
48
|
cli_utilities_1.log.debug('Processing stack settings for import', this.importConfig.context);
|
|
49
49
|
// Update environment UID mapping if live preview is configured
|
|
50
|
-
if (((_a = this.stackSettings) === null || _a === void 0 ? void 0 : _a.live_preview) && ((_b = this.stackSettings) === null || _b === void 0 ? void 0 : _b.live_preview['default-env'])) {
|
|
50
|
+
if (((_a = this.stackSettings) === null || _a === void 0 ? void 0 : _a.live_preview) && ((_b = this.stackSettings) === null || _b === void 0 ? void 0 : _b.live_preview['default-env']) !== undefined) {
|
|
51
51
|
const oldEnvUid = this.stackSettings.live_preview['default-env'];
|
|
52
52
|
const mappedEnvUid = this.envUidMapper[oldEnvUid];
|
|
53
53
|
if (mappedEnvUid) {
|
|
@@ -10,6 +10,8 @@ export default class ImportTaxonomies extends BaseClass {
|
|
|
10
10
|
private termsMapperDirPath;
|
|
11
11
|
private termsSuccessPath;
|
|
12
12
|
private termsFailsPath;
|
|
13
|
+
private localesFilePath;
|
|
14
|
+
private isLocaleBasedStructure;
|
|
13
15
|
createdTaxonomies: Record<string, unknown>;
|
|
14
16
|
failedTaxonomies: Record<string, unknown>;
|
|
15
17
|
createdTerms: Record<string, Record<string, unknown>>;
|
|
@@ -26,13 +28,34 @@ export default class ImportTaxonomies extends BaseClass {
|
|
|
26
28
|
* @async
|
|
27
29
|
* @returns {Promise<any>} Promise<any>
|
|
28
30
|
*/
|
|
29
|
-
importTaxonomies(
|
|
31
|
+
importTaxonomies({ apiContent, localeCode }: {
|
|
32
|
+
apiContent: any[];
|
|
33
|
+
localeCode?: string;
|
|
34
|
+
}): Promise<void>;
|
|
30
35
|
/**
|
|
31
|
-
*
|
|
36
|
+
* Import taxonomies using legacy structure (taxonomies/{uid}.json)
|
|
37
|
+
*/
|
|
38
|
+
importTaxonomiesLegacy(): Promise<void>;
|
|
39
|
+
/**
|
|
40
|
+
* Import taxonomies using locale-based structure (taxonomies/{locale}/{uid}.json)
|
|
41
|
+
*/
|
|
42
|
+
importTaxonomiesByLocale(): Promise<void>;
|
|
43
|
+
handleSuccess(apiData: any, locale?: string): void;
|
|
44
|
+
handleFailure(error: any, apiData: any, locale?: string): void;
|
|
45
|
+
/**
|
|
46
|
+
* @method serializeTaxonomy
|
|
32
47
|
* @param {ApiOptions} apiOptions ApiOptions
|
|
33
48
|
* @returns {ApiOptions} ApiOptions
|
|
34
49
|
*/
|
|
35
|
-
|
|
50
|
+
serializeTaxonomy(apiOptions: ApiOptions): ApiOptions;
|
|
51
|
+
loadTaxonomyFile(filePath: string): Record<string, unknown> | undefined;
|
|
52
|
+
findTaxonomyFilePath(taxonomyUID: string): string | undefined;
|
|
53
|
+
findTaxonomyInLocaleFolders(taxonomyUID: string): string | undefined;
|
|
54
|
+
loadAvailableLocales(): Record<string, string>;
|
|
55
|
+
/**
|
|
56
|
+
* Detect if locale-based folder structure exists (taxonomies/{locale}/{uid}.json)
|
|
57
|
+
*/
|
|
58
|
+
detectAndScanLocaleStructure(): boolean;
|
|
36
59
|
/**
|
|
37
60
|
* create taxonomies success and fail in (mapper/taxonomies)
|
|
38
61
|
* create terms success and fail in (mapper/taxonomies/terms)
|