@contentstack/cli-cm-import 2.0.0-beta.6 → 2.0.0-beta.8

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/README.md CHANGED
@@ -47,7 +47,7 @@ $ npm install -g @contentstack/cli-cm-import
47
47
  $ csdx COMMAND
48
48
  running command...
49
49
  $ csdx (--version)
50
- @contentstack/cli-cm-import/2.0.0-beta.6 linux-x64 node-v22.22.0
50
+ @contentstack/cli-cm-import/2.0.0-beta.8 linux-x64 node-v22.22.0
51
51
  $ csdx --help [COMMAND]
52
52
  USAGE
53
53
  $ csdx COMMAND
@@ -55,8 +55,8 @@ class ImportCommand extends cli_command_1.Command {
55
55
  logAndPrintErrorDetails(error, importConfig) {
56
56
  var _a;
57
57
  cli_utilities_1.cliux.print('\n');
58
- const logPath = (0, cli_utilities_1.getLogPath)();
59
- const logMsg = `The log has been stored at '${logPath}'`;
58
+ const sessionLogPath = (0, cli_utilities_1.getSessionLogPath)();
59
+ const logMsg = `The log has been stored at '${sessionLogPath}'`;
60
60
  const backupDir = importConfig === null || importConfig === void 0 ? void 0 : importConfig.backupDir;
61
61
  const backupDirMsg = backupDir
62
62
  ? `The backup content has been stored at '${backupDir}'`
@@ -73,8 +73,8 @@ class ImportCommand extends cli_command_1.Command {
73
73
  logSuccessAndBackupMessages(backupDir, importConfig) {
74
74
  var _a;
75
75
  cli_utilities_1.cliux.print('\n');
76
- const logPath = (0, cli_utilities_1.getLogPath)();
77
- const logMsg = `The log has been stored at '${logPath}'`;
76
+ const sessionLogPath = (0, cli_utilities_1.getSessionLogPath)();
77
+ const logMsg = `The log has been stored at '${sessionLogPath}'`;
78
78
  const backupDirMsg = `The backup content has been stored at '${backupDir}'`;
79
79
  cli_utilities_1.log.success(logMsg, importConfig.context);
80
80
  cli_utilities_1.log.info(backupDirMsg, importConfig.context);
@@ -0,0 +1,57 @@
1
+ export declare const PATH_CONSTANTS: {
2
+ /** Root mapper directory (contains module-specific mapper subdirs) */
3
+ readonly MAPPER: "mapper";
4
+ /** Common mapper file names */
5
+ readonly FILES: {
6
+ readonly SUCCESS: "success.json";
7
+ readonly FAILS: "fails.json";
8
+ readonly UID_MAPPING: "uid-mapping.json";
9
+ readonly URL_MAPPING: "url-mapping.json";
10
+ readonly UID_MAPPER: "uid-mapper.json";
11
+ readonly SCHEMA: "schema.json";
12
+ readonly SETTINGS: "settings.json";
13
+ readonly MODIFIED_SCHEMAS: "modified-schemas.json";
14
+ readonly UNIQUE_MAPPING: "unique-mapping.json";
15
+ readonly TAXONOMIES: "taxonomies.json";
16
+ readonly ENVIRONMENTS: "environments.json";
17
+ readonly PENDING_EXTENSIONS: "pending_extensions.js";
18
+ readonly PENDING_GLOBAL_FIELDS: "pending_global_fields.js";
19
+ readonly INDEX: "index.json";
20
+ readonly FOLDER_MAPPING: "folder-mapping.json";
21
+ readonly VERSIONED_ASSETS: "versioned-assets.json";
22
+ };
23
+ /** Module subdirectory names within mapper */
24
+ readonly MAPPER_MODULES: {
25
+ readonly ASSETS: "assets";
26
+ readonly ENTRIES: "entries";
27
+ readonly CONTENT_TYPES: "content_types";
28
+ readonly TAXONOMIES: "taxonomies";
29
+ readonly TAXONOMY_TERMS: "terms";
30
+ readonly GLOBAL_FIELDS: "global_fields";
31
+ readonly EXTENSIONS: "extensions";
32
+ readonly WORKFLOWS: "workflows";
33
+ readonly WEBHOOKS: "webhooks";
34
+ readonly LABELS: "labels";
35
+ readonly ENVIRONMENTS: "environments";
36
+ readonly MARKETPLACE_APPS: "marketplace_apps";
37
+ readonly CUSTOM_ROLES: "custom-roles";
38
+ readonly LANGUAGES: "languages";
39
+ };
40
+ /** Content directory names (used in both import and export) */
41
+ readonly CONTENT_DIRS: {
42
+ readonly ASSETS: "assets";
43
+ readonly ENTRIES: "entries";
44
+ readonly CONTENT_TYPES: "content_types";
45
+ readonly TAXONOMIES: "taxonomies";
46
+ readonly GLOBAL_FIELDS: "global_fields";
47
+ readonly EXTENSIONS: "extensions";
48
+ readonly WEBHOOKS: "webhooks";
49
+ readonly WORKFLOWS: "workflows";
50
+ readonly LABELS: "labels";
51
+ readonly ENVIRONMENTS: "environments";
52
+ readonly STACK: "stack";
53
+ readonly LOCALES: "locales";
54
+ readonly MARKETPLACE_APPS: "marketplace_apps";
55
+ };
56
+ };
57
+ export type PathConstants = typeof PATH_CONSTANTS;
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PATH_CONSTANTS = void 0;
4
+ exports.PATH_CONSTANTS = {
5
+ /** Root mapper directory (contains module-specific mapper subdirs) */
6
+ MAPPER: 'mapper',
7
+ /** Common mapper file names */
8
+ FILES: {
9
+ SUCCESS: 'success.json',
10
+ FAILS: 'fails.json',
11
+ UID_MAPPING: 'uid-mapping.json',
12
+ URL_MAPPING: 'url-mapping.json',
13
+ UID_MAPPER: 'uid-mapper.json',
14
+ SCHEMA: 'schema.json',
15
+ SETTINGS: 'settings.json',
16
+ MODIFIED_SCHEMAS: 'modified-schemas.json',
17
+ UNIQUE_MAPPING: 'unique-mapping.json',
18
+ TAXONOMIES: 'taxonomies.json',
19
+ ENVIRONMENTS: 'environments.json',
20
+ PENDING_EXTENSIONS: 'pending_extensions.js',
21
+ PENDING_GLOBAL_FIELDS: 'pending_global_fields.js',
22
+ INDEX: 'index.json',
23
+ FOLDER_MAPPING: 'folder-mapping.json',
24
+ VERSIONED_ASSETS: 'versioned-assets.json',
25
+ },
26
+ /** Module subdirectory names within mapper */
27
+ MAPPER_MODULES: {
28
+ ASSETS: 'assets',
29
+ ENTRIES: 'entries',
30
+ CONTENT_TYPES: 'content_types',
31
+ TAXONOMIES: 'taxonomies',
32
+ TAXONOMY_TERMS: 'terms',
33
+ GLOBAL_FIELDS: 'global_fields',
34
+ EXTENSIONS: 'extensions',
35
+ WORKFLOWS: 'workflows',
36
+ WEBHOOKS: 'webhooks',
37
+ LABELS: 'labels',
38
+ ENVIRONMENTS: 'environments',
39
+ MARKETPLACE_APPS: 'marketplace_apps',
40
+ CUSTOM_ROLES: 'custom-roles',
41
+ LANGUAGES: 'languages',
42
+ },
43
+ /** Content directory names (used in both import and export) */
44
+ CONTENT_DIRS: {
45
+ ASSETS: 'assets',
46
+ ENTRIES: 'entries',
47
+ CONTENT_TYPES: 'content_types',
48
+ TAXONOMIES: 'taxonomies',
49
+ GLOBAL_FIELDS: 'global_fields',
50
+ EXTENSIONS: 'extensions',
51
+ WEBHOOKS: 'webhooks',
52
+ WORKFLOWS: 'workflows',
53
+ LABELS: 'labels',
54
+ ENVIRONMENTS: 'environments',
55
+ STACK: 'stack',
56
+ LOCALES: 'locales',
57
+ MARKETPLACE_APPS: 'marketplace_apps',
58
+ },
59
+ };
@@ -13,6 +13,7 @@ const includes_1 = tslib_1.__importDefault(require("lodash/includes"));
13
13
  const uuid_1 = require("uuid");
14
14
  const node_path_1 = require("node:path");
15
15
  const cli_utilities_1 = require("@contentstack/cli-utilities");
16
+ const constants_1 = require("../../constants");
16
17
  const config_1 = tslib_1.__importDefault(require("../../config"));
17
18
  const utils_1 = require("../../utils");
18
19
  const base_class_1 = tslib_1.__importDefault(require("./base-class"));
@@ -26,14 +27,14 @@ class ImportAssets extends base_class_1.default {
26
27
  this.assetsFolderMap = {};
27
28
  this.importConfig.context.module = utils_1.MODULE_CONTEXTS.ASSETS;
28
29
  this.currentModuleName = utils_1.MODULE_NAMES[utils_1.MODULE_CONTEXTS.ASSETS];
29
- this.assetsPath = (0, node_path_1.join)(this.importConfig.backupDir, 'assets');
30
- this.mapperDirPath = (0, node_path_1.join)(this.importConfig.backupDir, 'mapper', 'assets');
31
- this.assetUidMapperPath = (0, node_path_1.join)(this.mapperDirPath, 'uid-mapping.json');
32
- this.assetUrlMapperPath = (0, node_path_1.join)(this.mapperDirPath, 'url-mapping.json');
33
- this.assetFolderUidMapperPath = (0, node_path_1.join)(this.mapperDirPath, 'folder-mapping.json');
30
+ this.assetsPath = (0, node_path_1.join)(this.importConfig.backupDir, constants_1.PATH_CONSTANTS.CONTENT_DIRS.ASSETS);
31
+ this.mapperDirPath = (0, node_path_1.join)(this.importConfig.backupDir, constants_1.PATH_CONSTANTS.MAPPER, constants_1.PATH_CONSTANTS.MAPPER_MODULES.ASSETS);
32
+ this.assetUidMapperPath = (0, node_path_1.join)(this.mapperDirPath, constants_1.PATH_CONSTANTS.FILES.UID_MAPPING);
33
+ this.assetUrlMapperPath = (0, node_path_1.join)(this.mapperDirPath, constants_1.PATH_CONSTANTS.FILES.URL_MAPPING);
34
+ this.assetFolderUidMapperPath = (0, node_path_1.join)(this.mapperDirPath, constants_1.PATH_CONSTANTS.FILES.FOLDER_MAPPING);
34
35
  this.assetsRootPath = (0, node_path_1.join)(this.importConfig.backupDir, this.assetConfig.dirName);
35
36
  this.fs = new cli_utilities_1.FsUtility({ basePath: this.mapperDirPath });
36
- this.environments = this.fs.readFile((0, node_path_1.join)(this.importConfig.backupDir, 'environments', 'environments.json'), true);
37
+ this.environments = this.fs.readFile((0, node_path_1.join)(this.importConfig.backupDir, constants_1.PATH_CONSTANTS.CONTENT_DIRS.ENVIRONMENTS, constants_1.PATH_CONSTANTS.FILES.ENVIRONMENTS), true);
37
38
  }
38
39
  /**
39
40
  * @method start
@@ -141,7 +142,9 @@ class ImportAssets extends base_class_1.default {
141
142
  */
142
143
  async importAssets(isVersion = false) {
143
144
  const processName = isVersion ? 'import versioned assets' : 'import assets';
144
- const indexFileName = isVersion ? 'versioned-assets.json' : 'assets.json';
145
+ const indexFileName = isVersion
146
+ ? constants_1.PATH_CONSTANTS.FILES.VERSIONED_ASSETS
147
+ : this.assetConfig.fileName;
145
148
  const basePath = isVersion ? (0, node_path_1.join)(this.assetsPath, 'versions') : this.assetsPath;
146
149
  const progressProcessName = isVersion ? utils_1.PROCESS_NAMES.ASSET_VERSIONS : utils_1.PROCESS_NAMES.ASSET_UPLOAD;
147
150
  cli_utilities_1.log.debug(`Importing ${processName} from ${basePath}`, this.importConfig.context);
@@ -259,7 +262,10 @@ class ImportAssets extends base_class_1.default {
259
262
  * @returns {Promise<void>} Promise<void>
260
263
  */
261
264
  async publish() {
262
- const fs = new cli_utilities_1.FsUtility({ basePath: this.assetsPath, indexFileName: 'assets.json' });
265
+ const fs = new cli_utilities_1.FsUtility({
266
+ basePath: this.assetsPath,
267
+ indexFileName: this.assetConfig.fileName,
268
+ });
263
269
  if ((0, isEmpty_1.default)(this.assetsUidMap)) {
264
270
  cli_utilities_1.log.debug('Loading asset UID mappings from file', this.importConfig.context);
265
271
  this.assetsUidMap = fs.readFile(this.assetUidMapperPath, true);
@@ -416,7 +422,10 @@ class ImportAssets extends base_class_1.default {
416
422
  return count;
417
423
  }
418
424
  async countPublishableAssets() {
419
- const fsUtil = new cli_utilities_1.FsUtility({ basePath: this.assetsPath, indexFileName: 'assets.json' });
425
+ const fsUtil = new cli_utilities_1.FsUtility({
426
+ basePath: this.assetsPath,
427
+ indexFileName: this.assetConfig.fileName,
428
+ });
420
429
  let count = 0;
421
430
  for (const _ of (0, values_1.default)(fsUtil.indexFileContent)) {
422
431
  const chunkData = await fsUtil.readChunkFiles.next().catch(() => ({}));
@@ -1,5 +1,4 @@
1
- import { Stack } from '@contentstack/management/types/stack';
2
- import { CLIProgressManager } from '@contentstack/cli-utilities';
1
+ import { ManagementStack, CLIProgressManager } from '@contentstack/cli-utilities';
3
2
  import { ImportConfig, ModuleClassParams } from '../../types';
4
3
  export type AdditionalKeys = {
5
4
  backupDir: string;
@@ -41,13 +40,13 @@ export type CustomPromiseHandlerInput = {
41
40
  };
42
41
  export type CustomPromiseHandler = (input: CustomPromiseHandlerInput) => Promise<any>;
43
42
  export default abstract class BaseClass {
44
- readonly client: Stack;
43
+ readonly client: ManagementStack;
45
44
  importConfig: ImportConfig;
46
45
  modulesConfig: any;
47
46
  protected progressManager: CLIProgressManager | null;
48
47
  protected currentModuleName: string;
49
48
  constructor({ importConfig, stackAPIClient }: Omit<ModuleClassParams, 'moduleName'>);
50
- get stack(): Stack;
49
+ get stack(): ManagementStack;
51
50
  static printFinalSummary(): void;
52
51
  /**
53
52
  * Create simple progress manager
@@ -68,7 +67,7 @@ export default abstract class BaseClass {
68
67
  * - moduleName: The module name to generate the message (e.g., 'Content types', 'Entries')
69
68
  * If not provided, uses this.currentModuleName
70
69
  * - customSuccessMessage: Optional custom success message. If not provided, generates: "{moduleName} have been imported successfully!"
71
- * - customWarningMessage: Optional custom warning message. If not provided, generates: "{moduleName} have been imported with some errors. Please check the logs for details."
70
+ * - customWarningMessage: Optional custom warning message. If not provided, generates: "{moduleName} have been imported with some errors. Please check the logs at: {sessionLogPath}"
72
71
  * - context: Optional context for logging
73
72
  */
74
73
  protected completeProgressWithMessage(options?: CompleteProgressOptions): void;
@@ -61,7 +61,7 @@ class BaseClass {
61
61
  * - moduleName: The module name to generate the message (e.g., 'Content types', 'Entries')
62
62
  * If not provided, uses this.currentModuleName
63
63
  * - customSuccessMessage: Optional custom success message. If not provided, generates: "{moduleName} have been imported successfully!"
64
- * - customWarningMessage: Optional custom warning message. If not provided, generates: "{moduleName} have been imported with some errors. Please check the logs for details."
64
+ * - customWarningMessage: Optional custom warning message. If not provided, generates: "{moduleName} have been imported with some errors. Please check the logs at: {sessionLogPath}"
65
65
  * - context: Optional context for logging
66
66
  */
67
67
  completeProgressWithMessage(options) {
@@ -72,7 +72,8 @@ class BaseClass {
72
72
  const name = (options === null || options === void 0 ? void 0 : options.moduleName) || this.currentModuleName || 'Module';
73
73
  // Generate default messages if not provided
74
74
  const successMessage = (options === null || options === void 0 ? void 0 : options.customSuccessMessage) || `${name} have been imported successfully!`;
75
- const warningMessage = (options === null || options === void 0 ? void 0 : options.customWarningMessage) || `${name} have been imported with some errors. Please check the logs for details.`;
75
+ const sessionLogPath = (0, cli_utilities_1.getSessionLogPath)();
76
+ const warningMessage = (options === null || options === void 0 ? void 0 : options.customWarningMessage) || `${name} have been imported with some errors. Please check the logs at: ${sessionLogPath}`;
76
77
  this.completeProgress(true);
77
78
  if (hasErrors) {
78
79
  cli_utilities_1.log.warn(warningMessage, logContext);
@@ -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 isEmpty_1 = tslib_1.__importDefault(require("lodash/isEmpty"));
7
8
  const utils_1 = require("../../utils");
8
9
  class ImportComposableStudio {
@@ -12,9 +13,9 @@ class ImportComposableStudio {
12
13
  this.composableStudioConfig = importConfig.modules['composable-studio'];
13
14
  // Setup paths
14
15
  this.composableStudioPath = (0, node_path_1.join)(this.importConfig.backupDir, this.composableStudioConfig.dirName);
15
- this.projectMapperPath = (0, node_path_1.join)(this.importConfig.backupDir, 'mapper', this.composableStudioConfig.dirName);
16
+ this.projectMapperPath = (0, node_path_1.join)(this.importConfig.backupDir, constants_1.PATH_CONSTANTS.MAPPER, this.composableStudioConfig.dirName);
16
17
  this.composableStudioFilePath = (0, node_path_1.join)(this.composableStudioPath, this.composableStudioConfig.fileName);
17
- this.envUidMapperPath = (0, node_path_1.join)(this.importConfig.backupDir, 'mapper', 'environments', 'uid-mapping.json');
18
+ 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);
18
19
  this.envUidMapper = {};
19
20
  // Initialize HttpClient with Studio API base URL
20
21
  this.apiClient = new cli_utilities_1.HttpClient();
@@ -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 content_type_helper_1 = require("../../utils/content-type-helper");
15
16
  const utils_1 = require("../../utils");
@@ -23,24 +24,22 @@ class ContentTypesImport extends base_class_1.default {
23
24
  this.gFsConfig = importConfig.modules['global-fields'];
24
25
  this.reqConcurrency = this.cTsConfig.writeConcurrency || this.importConfig.writeConcurrency;
25
26
  this.cTsFolderPath = path.join((0, cli_utilities_1.sanitizePath)(this.importConfig.contentDir), (0, cli_utilities_1.sanitizePath)(this.cTsConfig.dirName));
26
- this.cTsMapperPath = path.join((0, cli_utilities_1.sanitizePath)(this.importConfig.contentDir), 'mapper', 'content_types');
27
- this.cTsSuccessPath = path.join((0, cli_utilities_1.sanitizePath)(this.importConfig.contentDir), 'mapper', 'content_types', 'success.json');
28
- this.gFsFolderPath = path.resolve((0, cli_utilities_1.sanitizePath)(this.importConfig.contentDir), (0, cli_utilities_1.sanitizePath)(this.gFsConfig.dirName));
29
- this.gFsMapperFolderPath = path.join((0, cli_utilities_1.sanitizePath)(importConfig.contentDir), 'mapper', 'global_fields', 'success.json');
30
- this.gFsPendingPath = path.join((0, cli_utilities_1.sanitizePath)(importConfig.contentDir), 'mapper', 'global_fields', 'pending_global_fields.js');
31
- this.marketplaceAppMapperPath = path.join((0, cli_utilities_1.sanitizePath)(this.importConfig.contentDir), 'mapper', 'marketplace_apps', 'uid-mapping.json');
27
+ this.cTsMapperPath = path.join((0, cli_utilities_1.sanitizePath)(this.importConfig.backupDir), constants_1.PATH_CONSTANTS.MAPPER, constants_1.PATH_CONSTANTS.MAPPER_MODULES.CONTENT_TYPES);
28
+ this.cTsSuccessPath = path.join((0, cli_utilities_1.sanitizePath)(this.importConfig.backupDir), constants_1.PATH_CONSTANTS.MAPPER, constants_1.PATH_CONSTANTS.MAPPER_MODULES.CONTENT_TYPES, constants_1.PATH_CONSTANTS.FILES.SUCCESS);
29
+ this.gFsFolderPath = path.resolve((0, cli_utilities_1.sanitizePath)(this.importConfig.backupDir), (0, cli_utilities_1.sanitizePath)(this.gFsConfig.dirName));
30
+ this.gFsMapperFolderPath = path.join((0, cli_utilities_1.sanitizePath)(importConfig.backupDir), constants_1.PATH_CONSTANTS.MAPPER, constants_1.PATH_CONSTANTS.MAPPER_MODULES.GLOBAL_FIELDS, constants_1.PATH_CONSTANTS.FILES.SUCCESS);
31
+ this.gFsPendingPath = path.join((0, cli_utilities_1.sanitizePath)(importConfig.backupDir), constants_1.PATH_CONSTANTS.MAPPER, constants_1.PATH_CONSTANTS.MAPPER_MODULES.GLOBAL_FIELDS, constants_1.PATH_CONSTANTS.FILES.PENDING_GLOBAL_FIELDS);
32
+ 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);
32
33
  this.ignoredFilesInContentTypesFolder = new Map([
33
34
  ['__master.json', 'true'],
34
35
  ['__priority.json', 'true'],
35
- ['schema.json', 'true'],
36
+ [constants_1.PATH_CONSTANTS.FILES.SCHEMA, 'true'],
36
37
  ['.DS_Store', 'true'],
37
38
  ]);
38
39
  // Initialize composable studio paths if config exists
39
40
  if (this.importConfig.modules['composable-studio']) {
40
- // Use contentDir as fallback if data is not available
41
- const basePath = this.importConfig.data || this.importConfig.contentDir;
42
- this.composableStudioSuccessPath = path.join((0, cli_utilities_1.sanitizePath)(basePath), 'mapper', this.importConfig.modules['composable-studio'].dirName, this.importConfig.modules['composable-studio'].fileName);
43
- this.composableStudioExportPath = path.join((0, cli_utilities_1.sanitizePath)(basePath), this.importConfig.modules['composable-studio'].dirName, this.importConfig.modules['composable-studio'].fileName);
41
+ 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);
42
+ this.composableStudioExportPath = path.join((0, cli_utilities_1.sanitizePath)(importConfig.backupDir), this.importConfig.modules['composable-studio'].dirName, this.importConfig.modules['composable-studio'].fileName);
44
43
  }
45
44
  else {
46
45
  this.composableStudioSuccessPath = '';
@@ -54,8 +53,8 @@ class ContentTypesImport extends base_class_1.default {
54
53
  this.createdGFs = [];
55
54
  this.pendingGFs = [];
56
55
  this.pendingExts = [];
57
- this.taxonomiesPath = path.join((0, cli_utilities_1.sanitizePath)(importConfig.contentDir), 'mapper', 'taxonomies', 'success.json');
58
- this.extPendingPath = path.join((0, cli_utilities_1.sanitizePath)(importConfig.contentDir), 'mapper', 'extensions', 'pending_extensions.js');
56
+ this.taxonomiesPath = path.join((0, cli_utilities_1.sanitizePath)(importConfig.contentDir), constants_1.PATH_CONSTANTS.MAPPER, constants_1.PATH_CONSTANTS.MAPPER_MODULES.TAXONOMIES, constants_1.PATH_CONSTANTS.FILES.SUCCESS);
57
+ this.extPendingPath = path.join((0, cli_utilities_1.sanitizePath)(importConfig.contentDir), constants_1.PATH_CONSTANTS.MAPPER, constants_1.PATH_CONSTANTS.MAPPER_MODULES.EXTENSIONS, constants_1.PATH_CONSTANTS.FILES.PENDING_EXTENSIONS);
59
58
  }
60
59
  async start() {
61
60
  var _a;
@@ -322,7 +321,7 @@ class ContentTypesImport extends base_class_1.default {
322
321
  async analyzeImportData() {
323
322
  var _a, _b, _c, _d, _e;
324
323
  const [cts, gfs, pendingGfs, pendingExt] = await this.withLoadingSpinner('CONTENT TYPES: Analyzing import data...', async () => {
325
- const cts = utils_1.fsUtil.readFile(path.join(this.cTsFolderPath, 'schema.json'));
324
+ const cts = utils_1.fsUtil.readFile(path.join(this.cTsFolderPath, constants_1.PATH_CONSTANTS.FILES.SCHEMA));
326
325
  const gfs = utils_1.fsUtil.readFile(path.resolve(this.gFsFolderPath, this.gFsConfig.fileName));
327
326
  const pendingGfs = utils_1.fsUtil.readFile(this.gFsPendingPath);
328
327
  const pendingExt = utils_1.fsUtil.readFile(this.extPendingPath);
@@ -6,6 +6,7 @@ const values_1 = tslib_1.__importDefault(require("lodash/values"));
6
6
  const node_path_1 = require("node:path");
7
7
  const lodash_1 = require("lodash");
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 ImportCustomRoles extends base_class_1.default {
@@ -49,13 +50,13 @@ class ImportCustomRoles extends base_class_1.default {
49
50
  this.importConfig.context.module = utils_1.MODULE_CONTEXTS.CUSTOM_ROLES;
50
51
  this.currentModuleName = utils_1.MODULE_NAMES[utils_1.MODULE_CONTEXTS.CUSTOM_ROLES];
51
52
  this.customRolesConfig = importConfig.modules.customRoles;
52
- this.customRolesMapperPath = (0, node_path_1.join)(this.importConfig.backupDir, 'mapper', 'custom-roles');
53
+ this.customRolesMapperPath = (0, node_path_1.join)(this.importConfig.backupDir, constants_1.PATH_CONSTANTS.MAPPER, constants_1.PATH_CONSTANTS.MAPPER_MODULES.CUSTOM_ROLES);
53
54
  this.customRolesFolderPath = (0, node_path_1.join)(this.importConfig.backupDir, this.customRolesConfig.dirName);
54
- this.customRolesUidMapperPath = (0, node_path_1.join)(this.customRolesMapperPath, 'uid-mapping.json');
55
- this.envUidMapperFolderPath = (0, node_path_1.join)(this.importConfig.backupDir, 'mapper', 'environments');
56
- this.entriesUidMapperFolderPath = (0, node_path_1.join)(this.importConfig.backupDir, 'mapper', 'entries');
57
- this.createdCustomRolesPath = (0, node_path_1.join)(this.customRolesMapperPath, 'success.json');
58
- this.customRolesFailsPath = (0, node_path_1.join)(this.customRolesMapperPath, 'fails.json');
55
+ this.customRolesUidMapperPath = (0, node_path_1.join)(this.customRolesMapperPath, constants_1.PATH_CONSTANTS.FILES.UID_MAPPING);
56
+ this.envUidMapperFolderPath = (0, node_path_1.join)(this.importConfig.backupDir, constants_1.PATH_CONSTANTS.MAPPER, constants_1.PATH_CONSTANTS.MAPPER_MODULES.ENVIRONMENTS);
57
+ this.entriesUidMapperFolderPath = (0, node_path_1.join)(this.importConfig.backupDir, constants_1.PATH_CONSTANTS.MAPPER, constants_1.PATH_CONSTANTS.MAPPER_MODULES.ENTRIES);
58
+ this.createdCustomRolesPath = (0, node_path_1.join)(this.customRolesMapperPath, constants_1.PATH_CONSTANTS.FILES.SUCCESS);
59
+ this.customRolesFailsPath = (0, node_path_1.join)(this.customRolesMapperPath, constants_1.PATH_CONSTANTS.FILES.FAILS);
59
60
  this.customRoles = {};
60
61
  this.failedCustomRoles = [];
61
62
  this.createdCustomRoles = [];
@@ -232,8 +233,8 @@ class ImportCustomRoles extends base_class_1.default {
232
233
  cli_utilities_1.log.debug('Creating custom roles mapper directory', this.importConfig.context);
233
234
  await utils_1.fsUtil.makeDirectory(this.customRolesMapperPath);
234
235
  this.customRolesUidMapper = this.loadJsonFileIfExists(this.customRolesUidMapperPath, 'custom roles');
235
- this.environmentsUidMap = this.loadJsonFileIfExists((0, node_path_1.join)(this.envUidMapperFolderPath, 'uid-mapping.json'), 'environments');
236
- this.entriesUidMap = this.loadJsonFileIfExists((0, node_path_1.join)(this.entriesUidMapperFolderPath, 'uid-mapping.json'), 'entries');
236
+ this.environmentsUidMap = this.loadJsonFileIfExists((0, node_path_1.join)(this.envUidMapperFolderPath, constants_1.PATH_CONSTANTS.FILES.UID_MAPPING), 'environments');
237
+ this.entriesUidMap = this.loadJsonFileIfExists((0, node_path_1.join)(this.entriesUidMapperFolderPath, constants_1.PATH_CONSTANTS.FILES.UID_MAPPING), 'entries');
237
238
  }
238
239
  loadJsonFileIfExists(path, label) {
239
240
  if (utils_1.fileHelper.fileExistsSync(path)) {
@@ -11,6 +11,7 @@ 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,25 +20,23 @@ 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.contentDir), 'mapper', 'assets', 'uid-mapping.json');
23
- this.assetUrlMapperPath = path.resolve((0, cli_utilities_1.sanitizePath)(importConfig.contentDir), 'mapper', 'assets', 'url-mapping.json');
24
- this.entriesMapperPath = path.resolve((0, cli_utilities_1.sanitizePath)(importConfig.contentDir), 'mapper', 'entries');
25
- this.envPath = path.resolve((0, cli_utilities_1.sanitizePath)(importConfig.contentDir), 'environments', 'environments.json');
26
- this.entriesUIDMapperPath = path.join((0, cli_utilities_1.sanitizePath)(this.entriesMapperPath), 'uid-mapping.json');
27
- this.uniqueUidMapperPath = path.join((0, cli_utilities_1.sanitizePath)(this.entriesMapperPath), 'unique-mapping.json');
28
- this.modifiedCTsPath = path.join((0, cli_utilities_1.sanitizePath)(this.entriesMapperPath), 'modified-schemas.json');
29
- this.marketplaceAppMapperPath = path.join((0, cli_utilities_1.sanitizePath)(this.importConfig.contentDir), 'mapper', 'marketplace_apps', 'uid-mapping.json');
30
- this.taxonomiesPath = path.join((0, cli_utilities_1.sanitizePath)(this.importConfig.contentDir), 'mapper', 'taxonomies', 'terms', 'success.json');
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
33
  this.entriesPath = path.resolve((0, cli_utilities_1.sanitizePath)(importConfig.contentDir), (0, cli_utilities_1.sanitizePath)(this.entriesConfig.dirName));
33
34
  this.cTsPath = path.resolve((0, cli_utilities_1.sanitizePath)(importConfig.contentDir), (0, cli_utilities_1.sanitizePath)(importConfig.modules['content-types'].dirName));
34
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));
35
36
  // Initialize composable studio paths if config exists
36
37
  if (this.importConfig.modules['composable-studio']) {
37
- // Use contentDir as fallback if data is not available
38
- const basePath = this.importConfig.data || this.importConfig.contentDir;
39
- this.composableStudioSuccessPath = path.join((0, cli_utilities_1.sanitizePath)(basePath), 'mapper', this.importConfig.modules['composable-studio'].dirName, this.importConfig.modules['composable-studio'].fileName);
40
- this.composableStudioExportPath = path.join((0, cli_utilities_1.sanitizePath)(basePath), this.importConfig.modules['composable-studio'].dirName, this.importConfig.modules['composable-studio'].fileName);
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);
41
40
  }
42
41
  else {
43
42
  this.composableStudioSuccessPath = '';
@@ -134,7 +133,7 @@ class EntriesImport extends base_class_1.default {
134
133
  async analyzeEntryData() {
135
134
  return this.withLoadingSpinner('ENTRIES: Analyzing import data...', async () => {
136
135
  cli_utilities_1.log.debug('Loading content types for entry analysis', this.importConfig.context);
137
- this.cTs = utils_1.fsUtil.readFile(path.join(this.cTsPath, 'schema.json'));
136
+ this.cTs = utils_1.fsUtil.readFile(path.join(this.cTsPath, constants_1.PATH_CONSTANTS.FILES.SCHEMA));
138
137
  if (!this.cTs || (0, lodash_1.isEmpty)(this.cTs)) {
139
138
  return [0, 0, 0, 0, 0];
140
139
  }
@@ -158,7 +157,7 @@ class EntriesImport extends base_class_1.default {
158
157
  for (let locale of this.locales) {
159
158
  for (let contentType of this.cTs) {
160
159
  const basePath = path.join(this.entriesPath, contentType.uid, locale.code);
161
- const fs = new cli_utilities_1.FsUtility({ basePath, indexFileName: 'index.json' });
160
+ const fs = new cli_utilities_1.FsUtility({ basePath, indexFileName: constants_1.PATH_CONSTANTS.FILES.INDEX });
162
161
  const indexer = fs.indexFileContent;
163
162
  const chunksInThisCTLocale = (0, lodash_1.values)(indexer).length;
164
163
  totalEntryChunks += chunksInThisCTLocale;
@@ -210,7 +209,7 @@ class EntriesImport extends base_class_1.default {
210
209
  await this.createEntries(entryRequestOption);
211
210
  }
212
211
  cli_utilities_1.log.debug('Writing entry UID mappings to file', this.importConfig.context);
213
- await utils_1.fileHelper.writeLargeFile(path.join(this.entriesMapperPath, 'uid-mapping.json'), this.entriesUidMapper);
212
+ await utils_1.fileHelper.writeLargeFile(path.join(this.entriesMapperPath, constants_1.PATH_CONSTANTS.FILES.UID_MAPPING), this.entriesUidMapper);
214
213
  utils_1.fsUtil.writeFile(path.join(this.entriesMapperPath, 'failed-entries.json'), this.failedEntries);
215
214
  }
216
215
  async processEntryReplacement() {
@@ -367,7 +366,7 @@ class EntriesImport extends base_class_1.default {
367
366
  async createEntries({ cTUid, locale }) {
368
367
  var _a, _b;
369
368
  const processName = 'Create Entries';
370
- const indexFileName = 'index.json';
369
+ const indexFileName = constants_1.PATH_CONSTANTS.FILES.INDEX;
371
370
  const basePath = path.join(this.entriesPath, cTUid, locale);
372
371
  const fs = new cli_utilities_1.FsUtility({ basePath, indexFileName });
373
372
  const indexer = fs.indexFileContent;
@@ -383,7 +382,7 @@ class EntriesImport extends base_class_1.default {
383
382
  // Write created entries
384
383
  const entriesCreateFileHelper = new cli_utilities_1.FsUtility({
385
384
  moduleName: 'entries',
386
- indexFileName: 'index.json',
385
+ indexFileName: constants_1.PATH_CONSTANTS.FILES.INDEX,
387
386
  basePath: path.join(this.entriesMapperPath, cTUid, locale),
388
387
  chunkFileSize: this.entriesConfig.chunkFileSize,
389
388
  keepMetadata: false,
@@ -392,7 +391,7 @@ class EntriesImport extends base_class_1.default {
392
391
  // create file instance for existing entries
393
392
  const existingEntriesFileHelper = new cli_utilities_1.FsUtility({
394
393
  moduleName: 'entries',
395
- indexFileName: 'index.json',
394
+ indexFileName: constants_1.PATH_CONSTANTS.FILES.INDEX,
396
395
  basePath: path.join(this.entriesMapperPath, cTUid, locale, 'existing'),
397
396
  chunkFileSize: this.entriesConfig.chunkFileSize,
398
397
  keepMetadata: false,
@@ -544,7 +543,7 @@ class EntriesImport extends base_class_1.default {
544
543
  }
545
544
  async replaceEntries({ cTUid, locale }) {
546
545
  const processName = 'Replace existing Entries';
547
- const indexFileName = 'index.json';
546
+ const indexFileName = constants_1.PATH_CONSTANTS.FILES.INDEX;
548
547
  const basePath = path.join(this.entriesMapperPath, cTUid, locale, 'existing');
549
548
  const fs = new cli_utilities_1.FsUtility({ basePath, indexFileName });
550
549
  const indexer = fs.indexFileContent;
@@ -557,7 +556,7 @@ class EntriesImport extends base_class_1.default {
557
556
  // Write updated entries
558
557
  const entriesReplaceFileHelper = new cli_utilities_1.FsUtility({
559
558
  moduleName: 'entries',
560
- indexFileName: 'index.json',
559
+ indexFileName: constants_1.PATH_CONSTANTS.FILES.INDEX,
561
560
  basePath: path.join(this.entriesMapperPath, cTUid, locale),
562
561
  chunkFileSize: this.entriesConfig.chunkFileSize,
563
562
  keepMetadata: false,
@@ -672,7 +671,7 @@ class EntriesImport extends base_class_1.default {
672
671
  }
673
672
  async updateEntriesWithReferences({ cTUid, locale }) {
674
673
  const processName = 'Update Entries';
675
- const indexFileName = 'index.json';
674
+ const indexFileName = constants_1.PATH_CONSTANTS.FILES.INDEX;
676
675
  const basePath = path.join(this.entriesMapperPath, cTUid, locale);
677
676
  const fs = new cli_utilities_1.FsUtility({ basePath, indexFileName });
678
677
  const indexer = fs.indexFileContent;
@@ -854,7 +853,7 @@ class EntriesImport extends base_class_1.default {
854
853
  try {
855
854
  for (let cTUid of cTsWithFieldRules) {
856
855
  cli_utilities_1.log.debug(`Processing field rules for content type: ${cTUid}`, this.importConfig.context);
857
- const cTs = utils_1.fsUtil.readFile(path.join(this.cTsPath, 'schema.json'));
856
+ const cTs = utils_1.fsUtil.readFile(path.join(this.cTsPath, constants_1.PATH_CONSTANTS.FILES.SCHEMA));
858
857
  const contentType = (0, lodash_1.find)(cTs, { uid: cTUid });
859
858
  if (contentType.field_rules) {
860
859
  cli_utilities_1.log.debug(`Found ${contentType.field_rules.length} field rules for content type: ${cTUid}`, this.importConfig.context);
@@ -917,7 +916,7 @@ class EntriesImport extends base_class_1.default {
917
916
  }
918
917
  async publishEntries({ cTUid, locale }) {
919
918
  const processName = 'Publish Entries';
920
- const indexFileName = 'index.json';
919
+ const indexFileName = constants_1.PATH_CONSTANTS.FILES.INDEX;
921
920
  const basePath = path.join(this.entriesPath, cTUid, locale);
922
921
  const fs = new cli_utilities_1.FsUtility({ basePath, indexFileName });
923
922
  const indexer = fs.indexFileContent;
@@ -945,16 +944,7 @@ class EntriesImport extends base_class_1.default {
945
944
  (0, cli_utilities_1.handleAndLogError)(error, Object.assign(Object.assign({}, this.importConfig.context), { cTUid, locale }));
946
945
  });
947
946
  if (chunk) {
948
- let apiContent = (0, lodash_1.values)(chunk);
949
- let apiContentDuplicate = [];
950
- apiContentDuplicate = apiContent.flatMap((content) => {
951
- var _a;
952
- if (((_a = content === null || content === void 0 ? void 0 : content.publish_details) === null || _a === void 0 ? void 0 : _a.length) > 0) {
953
- return content.publish_details.map((publish) => (Object.assign(Object.assign({}, content), { locale: publish.locale, publish_details: [publish] })));
954
- }
955
- return []; // Return an empty array if publish_details is empty
956
- });
957
- apiContent = apiContentDuplicate;
947
+ 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; });
958
948
  cli_utilities_1.log.debug(`Processing ${apiContent.length} publishable entries in chunk ${index}`, this.importConfig.context);
959
949
  if ((apiContent === null || apiContent === void 0 ? void 0 : apiContent.length) === 0) {
960
950
  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, 'mapper', 'environments');
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, 'uid-mapping.json');
19
- this.envSuccessPath = (0, node_path_1.join)(this.mapperDirPath, 'success.json');
20
- this.envFailsPath = (0, node_path_1.join)(this.mapperDirPath, 'fails.json');
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 = {};
@@ -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, 'mapper', 'extensions');
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, 'uid-mapping.json');
20
- this.extSuccessPath = (0, node_path_1.join)(this.mapperDirPath, 'success.json');
21
- this.extFailsPath = (0, node_path_1.join)(this.mapperDirPath, 'fails.json');
22
- this.extPendingPath = (0, node_path_1.join)(this.mapperDirPath, 'pending_extensions.js');
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 = [];