@contentstack/cli-cm-import 2.0.0-beta.3 → 2.0.0-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +13 -117
  3. package/lib/commands/cm/stacks/import.d.ts +0 -1
  4. package/lib/commands/cm/stacks/import.js +5 -41
  5. package/lib/config/index.js +1 -1
  6. package/lib/import/module-importer.js +0 -11
  7. package/lib/import/modules/composable-studio.d.ts +1 -0
  8. package/lib/import/modules/composable-studio.js +7 -0
  9. package/lib/import/modules/content-types.d.ts +2 -0
  10. package/lib/import/modules/content-types.js +48 -9
  11. package/lib/import/modules/entries.d.ts +2 -0
  12. package/lib/import/modules/entries.js +19 -10
  13. package/lib/import/modules/global-fields.d.ts +1 -1
  14. package/lib/import/modules/global-fields.js +8 -8
  15. package/lib/import/modules/locales.d.ts +1 -1
  16. package/lib/import/modules/locales.js +6 -6
  17. package/lib/import/modules/marketplace-apps.js +2 -2
  18. package/lib/import/modules/personalize.js +1 -1
  19. package/lib/import/modules/variant-entries.js +2 -2
  20. package/lib/types/import-config.d.ts +0 -2
  21. package/lib/utils/asset-helper.js +1 -1
  22. package/lib/utils/common-helper.d.ts +1 -1
  23. package/lib/utils/common-helper.js +6 -6
  24. package/lib/utils/content-type-helper.d.ts +1 -1
  25. package/lib/utils/content-type-helper.js +1 -1
  26. package/lib/utils/extension-helper.js +1 -1
  27. package/lib/utils/import-config-handler.js +5 -9
  28. package/lib/utils/import-path-resolver.js +2 -31
  29. package/lib/utils/logger.d.ts +1 -1
  30. package/lib/utils/logger.js +2 -2
  31. package/lib/utils/login-handler.d.ts +1 -1
  32. package/lib/utils/login-handler.js +3 -3
  33. package/lib/utils/marketplace-app-helper.js +2 -2
  34. package/oclif.manifest.json +3 -47
  35. package/package.json +7 -11
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2024 Contentstack
3
+ Copyright (c) 2026 Contentstack
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
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.3 linux-x64 node-v22.21.1
50
+ @contentstack/cli-cm-import/2.0.0-beta.4 linux-x64 node-v22.22.0
51
51
  $ csdx --help [COMMAND]
52
52
  USAGE
53
53
  $ csdx COMMAND
@@ -58,29 +58,21 @@ USAGE
58
58
  # Commands
59
59
 
60
60
  <!-- commands -->
61
- * [`csdx cm:stacks:import [-c <value>] [-k <value>] [-d <value>] [-a <value>] [--module <value>] [--backup-dir <value>] [--branch <value>] [--import-webhook-status disable|current]`](#csdx-cmstacksimport--c-value--k-value--d-value--a-value---module-value---backup-dir-value---branch-value---import-webhook-status-disablecurrent)
62
- * [`csdx cm:stacks:import [-c <value>] [-k <value>] [-d <value>] [-a <value>] [--module <value>] [--backup-dir <value>] [--branch <value>] [--import-webhook-status disable|current]`](#csdx-cmstacksimport--c-value--k-value--d-value--a-value---module-value---backup-dir-value---branch-value---import-webhook-status-disablecurrent)
61
+ * [`csdx cm:stacks:import [--config <value>] [--stack-api-key <value>] [--data-dir <value>] [--alias <value>] [--module <value>] [--backup-dir <value>] [--branch <value>] [--import-webhook-status disable|current]`](#csdx-cmstacksimport---config-value---stack-api-key-value---data-dir-value---alias-value---module-value---backup-dir-value---branch-value---import-webhook-status-disablecurrent)
63
62
 
64
- ## `csdx cm:stacks:import [-c <value>] [-k <value>] [-d <value>] [-a <value>] [--module <value>] [--backup-dir <value>] [--branch <value>] [--import-webhook-status disable|current]`
63
+ ## `csdx cm:stacks:import [--config <value>] [--stack-api-key <value>] [--data-dir <value>] [--alias <value>] [--module <value>] [--backup-dir <value>] [--branch <value>] [--import-webhook-status disable|current]`
65
64
 
66
65
  Import content from a stack
67
66
 
68
67
  ```
69
68
  USAGE
70
- $ csdx cm:import cm:stacks:import [-c <value>] [-k <value>] [-d <value>] [-a <value>] [--module <value>]
71
- [--backup-dir <value>] [--branch <value>] [--import-webhook-status disable|current]
69
+ $ csdx cm:stacks:import [--config <value>] [--stack-api-key <value>] [--data-dir <value>] [--alias <value>]
70
+ [--module <value>] [--backup-dir <value>] [--branch <value>] [--import-webhook-status disable|current]
72
71
 
73
72
  FLAGS
74
- -B, --branch=<value>
75
- The name of the branch where you want to import your content. If you don't mention the branch name, then by default
76
- the content will be imported to the main branch.
77
-
78
73
  -a, --alias=<value>
79
74
  The management token of the destination stack where you will import the content.
80
75
 
81
- -b, --backup-dir=<value>
82
- [optional] Backup directory name when using specific module.
83
-
84
76
  -c, --config=<value>
85
77
  [optional] The path of the configuration JSON file containing all the options for a single run.
86
78
 
@@ -92,15 +84,16 @@ FLAGS
92
84
  -k, --stack-api-key=<value>
93
85
  API Key of the target stack
94
86
 
95
- -m, --module=<value>
96
- [optional] Specify the module to import into the target stack. If not specified, the import command will import all
97
- the modules into the stack. The available modules are assets, content-types, entries, environments, extensions,
98
- marketplace-apps, global-fields, labels, locales, webhooks, workflows, custom-roles, personalize projects,
99
- taxonomies, and composable-studio.
100
-
101
87
  -y, --yes
102
88
  [optional] Force override all Marketplace prompts.
103
89
 
90
+ --backup-dir=<value>
91
+ [optional] Backup directory name when using specific module.
92
+
93
+ --branch=<value>
94
+ The name of the branch where you want to import your content. If you don't mention the branch name, then by default
95
+ the content will be imported to the main branch.
96
+
104
97
  --branch-alias=<value>
105
98
  Specify the branch alias where you want to import your content. If not specified, the content is imported into the
106
99
  main branch by default.
@@ -113,112 +106,18 @@ FLAGS
113
106
  stack. <options: disable|current>
114
107
  <options: disable|current>
115
108
 
116
- --personalize-project-name=<value>
117
- (optional) Provide a unique name for the Personalize project.
118
-
119
- --replace-existing
120
- Replaces the existing module in the target stack.
121
-
122
- --skip-app-recreation
123
- (optional) Skips the recreation of private apps if they already exist.
124
-
125
- --skip-assets-publish
126
- Skips asset publishing during the import process.
127
-
128
- --skip-audit
129
- Skips the audit fix that occurs during an import operation.
130
-
131
- --skip-entries-publish
132
- Skips entry publishing during the import process
133
-
134
- --skip-existing
135
- Skips the module exists warning messages.
136
-
137
- DESCRIPTION
138
- Import content from a stack
139
-
140
- ALIASES
141
- $ csdx cm:import
142
-
143
- EXAMPLES
144
- $ csdx cm:stacks:import --stack-api-key <stack_api_key> --data-dir <path/of/export/destination/dir>
145
-
146
- $ csdx cm:stacks:import --config <path/of/config/dir>
147
-
148
- $ csdx cm:stacks:import --module <single module name>
149
-
150
- $ csdx cm:stacks:import --module <single module name> --backup-dir <backup dir>
151
-
152
- $ csdx cm:stacks:import --alias <management_token_alias>
153
-
154
- $ csdx cm:stacks:import --alias <management_token_alias> --data-dir <path/of/export/destination/dir>
155
-
156
- $ csdx cm:stacks:import --alias <management_token_alias> --config <path/of/config/file>
157
-
158
- $ csdx cm:stacks:import --branch <branch name> --yes --skip-audit
159
- ```
160
-
161
- ## `csdx cm:stacks:import [-c <value>] [-k <value>] [-d <value>] [-a <value>] [--module <value>] [--backup-dir <value>] [--branch <value>] [--import-webhook-status disable|current]`
162
-
163
- Import content from a stack
164
-
165
- ```
166
- USAGE
167
- $ csdx cm:stacks:import [-c <value>] [-k <value>] [-d <value>] [-a <value>] [--module <value>] [--backup-dir
168
- <value>] [--branch <value>] [--import-webhook-status disable|current]
169
-
170
- FLAGS
171
- -B, --branch=<value>
172
- The name of the branch where you want to import your content. If you don't mention the branch name, then by default
173
- the content will be imported to the main branch.
174
-
175
- -a, --alias=<value>
176
- The management token of the destination stack where you will import the content.
177
-
178
- -b, --backup-dir=<value>
179
- [optional] Backup directory name when using specific module.
180
-
181
- -c, --config=<value>
182
- [optional] The path of the configuration JSON file containing all the options for a single run.
183
-
184
- -d, --data-dir=<value>
185
- The path or the location in your file system where the content, you intend to import, is stored. For example, -d
186
- "C:\Users\Name\Desktop\cli\content". If the export folder has branches involved, then the path should point till the
187
- particular branch. For example, “-d "C:\Users\Name\Desktop\cli\content\branch_name"
188
-
189
- -k, --stack-api-key=<value>
190
- API Key of the target stack
191
-
192
- -m, --module=<value>
109
+ --module=<value>
193
110
  [optional] Specify the module to import into the target stack. If not specified, the import command will import all
194
111
  the modules into the stack. The available modules are assets, content-types, entries, environments, extensions,
195
112
  marketplace-apps, global-fields, labels, locales, webhooks, workflows, custom-roles, personalize projects,
196
113
  taxonomies, and composable-studio.
197
114
 
198
- -y, --yes
199
- [optional] Force override all Marketplace prompts.
200
-
201
- --branch-alias=<value>
202
- Specify the branch alias where you want to import your content. If not specified, the content is imported into the
203
- main branch by default.
204
-
205
- --exclude-global-modules
206
- Excludes the branch-independent module from the import operation.
207
-
208
- --import-webhook-status=<option>
209
- [default: disable] [default: disable] (optional) This webhook state keeps the same state of webhooks as the source
210
- stack. <options: disable|current>
211
- <options: disable|current>
212
-
213
115
  --personalize-project-name=<value>
214
116
  (optional) Provide a unique name for the Personalize project.
215
117
 
216
118
  --replace-existing
217
119
  Replaces the existing module in the target stack.
218
120
 
219
- --skip-app-recreation
220
- (optional) Skips the recreation of private apps if they already exist.
221
-
222
121
  --skip-assets-publish
223
122
  Skips asset publishing during the import process.
224
123
 
@@ -234,9 +133,6 @@ FLAGS
234
133
  DESCRIPTION
235
134
  Import content from a stack
236
135
 
237
- ALIASES
238
- $ csdx cm:import
239
-
240
136
  EXAMPLES
241
137
  $ csdx cm:stacks:import --stack-api-key <stack_api_key> --data-dir <path/of/export/destination/dir>
242
138
 
@@ -4,7 +4,6 @@ export default class ImportCommand extends Command {
4
4
  static description: string;
5
5
  static examples: string[];
6
6
  static flags: FlagInput;
7
- static aliases: string[];
8
7
  static usage: string;
9
8
  run(): Promise<void>;
10
9
  private logAndPrintErrorDetails;
@@ -6,6 +6,7 @@ const import_1 = require("../../../import");
6
6
  const utils_1 = require("../../../utils");
7
7
  class ImportCommand extends cli_command_1.Command {
8
8
  async run() {
9
+ var _a, _b;
9
10
  // setup import config
10
11
  // initialize the importer
11
12
  // start import
@@ -15,9 +16,10 @@ class ImportCommand extends cli_command_1.Command {
15
16
  const { flags } = await this.parse(ImportCommand);
16
17
  importConfig = await (0, utils_1.setupImportConfig)(flags);
17
18
  // Prepare the context object
19
+ (0, cli_utilities_1.createLogContext)(((_b = (_a = this.context) === null || _a === void 0 ? void 0 : _a.info) === null || _b === void 0 ? void 0 : _b.command) || 'cm:stacks:export', importConfig.apiKey, importConfig.authenticationMethod);
18
20
  const context = this.createImportContext(importConfig.apiKey, importConfig.authenticationMethod);
19
21
  importConfig.context = Object.assign({}, context);
20
- // log.info(`Using CLI version: ${this.context?.cliVersion}`, importConfig.context);
22
+ //log.info(`Using Cli Version: ${this.context?.cliVersion}`, importConfig.context);
21
23
  // Note setting host to create cma client
22
24
  importConfig.host = this.cmaHost;
23
25
  importConfig.region = this.region;
@@ -37,12 +39,7 @@ class ImportCommand extends cli_command_1.Command {
37
39
  const moduleImporter = new import_1.ModuleImporter(managementAPIClient, importConfig);
38
40
  const result = await moduleImporter.start();
39
41
  backupDir = importConfig.backupDir;
40
- if (!(result === null || result === void 0 ? void 0 : result.noSuccessMsg)) {
41
- const successMessage = importConfig.stackName
42
- ? `Successfully imported the content to the stack named ${importConfig.stackName} with the API key ${importConfig.apiKey} .`
43
- : `The content has been imported to the stack ${importConfig.apiKey} successfully!`;
44
- cli_utilities_1.log.success(successMessage, importConfig.context);
45
- }
42
+ //Note: Final summary is now handled by summary manager
46
43
  cli_utilities_1.CLIProgressManager.printGlobalSummary();
47
44
  this.logSuccessAndBackupMessages(backupDir, importConfig);
48
45
  // Clear progress module setting now that import is complete
@@ -119,21 +116,10 @@ ImportCommand.flags = {
119
116
  char: 'c',
120
117
  description: '[optional] The path of the configuration JSON file containing all the options for a single run.',
121
118
  }),
122
- 'stack-uid': cli_utilities_1.flags.string({
123
- char: 's',
124
- description: 'API key of the target stack.',
125
- hidden: true,
126
- parse: (0, cli_utilities_1.printFlagDeprecation)(['-s', '--stack-uid'], ['-k', '--stack-api-key']),
127
- }),
128
119
  'stack-api-key': cli_utilities_1.flags.string({
129
120
  char: 'k',
130
121
  description: 'API Key of the target stack',
131
122
  }),
132
- data: cli_utilities_1.flags.string({
133
- description: 'path and location where data is stored',
134
- hidden: true,
135
- parse: (0, cli_utilities_1.printFlagDeprecation)(['--data'], ['--data-dir']),
136
- }),
137
123
  'data-dir': cli_utilities_1.flags.string({
138
124
  char: 'd',
139
125
  description: `The path or the location in your file system where the content, you intend to import, is stored. For example, -d "C:\\Users\\Name\\Desktop\\cli\\content". If the export folder has branches involved, then the path should point till the particular branch. For example, “-d "C:\\Users\\Name\\Desktop\\cli\\content\\branch_name"`,
@@ -142,32 +128,15 @@ ImportCommand.flags = {
142
128
  char: 'a',
143
129
  description: 'The management token of the destination stack where you will import the content.',
144
130
  }),
145
- 'management-token-alias': cli_utilities_1.flags.string({
146
- description: 'alias of the management token',
147
- hidden: true,
148
- parse: (0, cli_utilities_1.printFlagDeprecation)(['--management-token-alias'], ['-a', '--alias']),
149
- }),
150
- 'auth-token': cli_utilities_1.flags.boolean({
151
- char: 'A',
152
- description: 'to use auth token',
153
- hidden: true,
154
- parse: (0, cli_utilities_1.printFlagDeprecation)(['-A', '--auth-token']),
155
- }),
156
131
  module: cli_utilities_1.flags.string({
157
132
  required: false,
158
- char: 'm',
159
133
  description: '[optional] Specify the module to import into the target stack. If not specified, the import command will import all the modules into the stack. The available modules are assets, content-types, entries, environments, extensions, marketplace-apps, global-fields, labels, locales, webhooks, workflows, custom-roles, personalize projects, taxonomies, and composable-studio.',
160
- parse: (0, cli_utilities_1.printFlagDeprecation)(['-m'], ['--module']),
161
134
  }),
162
135
  'backup-dir': cli_utilities_1.flags.string({
163
- char: 'b',
164
136
  description: '[optional] Backup directory name when using specific module.',
165
- parse: (0, cli_utilities_1.printFlagDeprecation)(['-b'], ['--backup-dir']),
166
137
  }),
167
138
  branch: cli_utilities_1.flags.string({
168
- char: 'B',
169
139
  description: "The name of the branch where you want to import your content. If you don't mention the branch name, then by default the content will be imported to the main branch.",
170
- parse: (0, cli_utilities_1.printFlagDeprecation)(['-B'], ['--branch']),
171
140
  exclusive: ['branch-alias'],
172
141
  }),
173
142
  'branch-alias': cli_utilities_1.flags.string({
@@ -185,10 +154,6 @@ ImportCommand.flags = {
185
154
  required: false,
186
155
  description: '[optional] Force override all Marketplace prompts.',
187
156
  }),
188
- 'skip-app-recreation': cli_utilities_1.flags.boolean({
189
- description: '(optional) Skips the recreation of private apps if they already exist.',
190
- parse: (0, cli_utilities_1.printFlagDeprecation)(['--skip-app-recreation']),
191
- }),
192
157
  'replace-existing': cli_utilities_1.flags.boolean({
193
158
  required: false,
194
159
  description: 'Replaces the existing module in the target stack.',
@@ -218,5 +183,4 @@ ImportCommand.flags = {
218
183
  default: false,
219
184
  }),
220
185
  };
221
- ImportCommand.aliases = ['cm:import'];
222
- ImportCommand.usage = 'cm:stacks:import [-c <value>] [-k <value>] [-d <value>] [-a <value>] [--module <value>] [--backup-dir <value>] [--branch <value>] [--import-webhook-status disable|current]';
186
+ ImportCommand.usage = 'cm:stacks:import [--config <value>] [--stack-api-key <value>] [--data-dir <value>] [--alias <value>] [--module <value>] [--backup-dir <value>] [--branch <value>] [--import-webhook-status disable|current]';
@@ -33,6 +33,7 @@ const config = {
33
33
  'stack',
34
34
  'assets',
35
35
  'taxonomies',
36
+ 'composable-studio',
36
37
  'extensions',
37
38
  'marketplace-apps',
38
39
  'global-fields',
@@ -44,7 +45,6 @@ const config = {
44
45
  'variant-entries',
45
46
  'labels',
46
47
  'webhooks',
47
- 'composable-studio',
48
48
  ],
49
49
  locales: {
50
50
  dirName: 'locales',
@@ -37,8 +37,6 @@ class ModuleImporter {
37
37
  const backupDir = await (0, utils_1.backupHandler)(this.importConfig);
38
38
  if (backupDir) {
39
39
  this.importConfig.backupDir = backupDir;
40
- // To support the old config
41
- this.importConfig.data = backupDir;
42
40
  }
43
41
  // NOTE audit and fix the import content.
44
42
  if (!this.importConfig.skipAudit &&
@@ -66,15 +64,6 @@ class ModuleImporter {
66
64
  }
67
65
  async importByModuleByName(moduleName) {
68
66
  cli_utilities_1.log.info(`Starting import of ${moduleName} module`, this.importConfig.context);
69
- // Check if module should be skipped for legacy contentVersion
70
- if (this.importConfig.contentVersion !== 2) {
71
- const onlyTSModules = this.importConfig.onlyTSModules || [];
72
- if (onlyTSModules.includes(moduleName)) {
73
- // Module is in onlyTSModules list, skip import for legacy contentVersion
74
- return undefined;
75
- }
76
- }
77
- // Use module import (same for both contentVersion 1 and 2)
78
67
  return (0, modules_1.default)({
79
68
  stackAPIClient: this.stackAPIClient,
80
69
  importConfig: this.importConfig,
@@ -7,6 +7,7 @@ export default class ImportComposableStudio {
7
7
  private apiClient;
8
8
  private envUidMapperPath;
9
9
  private envUidMapper;
10
+ private projectMapperPath;
10
11
  constructor({ importConfig }: ModuleClassParams);
11
12
  /**
12
13
  * Entry point for Studio import
@@ -12,6 +12,7 @@ class ImportComposableStudio {
12
12
  this.composableStudioConfig = importConfig.modules['composable-studio'];
13
13
  // Setup paths
14
14
  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);
15
16
  this.composableStudioFilePath = (0, node_path_1.join)(this.composableStudioPath, this.composableStudioConfig.fileName);
16
17
  this.envUidMapperPath = (0, node_path_1.join)(this.importConfig.backupDir, 'mapper', 'environments', 'uid-mapping.json');
17
18
  this.envUidMapper = {};
@@ -179,6 +180,12 @@ class ImportComposableStudio {
179
180
  if (response.status >= 200 && response.status < 300) {
180
181
  projectCreated = true;
181
182
  cli_utilities_1.log.debug(`Project created successfully with UID: ${(_c = response.data) === null || _c === void 0 ? void 0 : _c.uid}`, this.importConfig.context);
183
+ // Create mapper directory if it doesn't exist
184
+ await utils_1.fsUtil.makeDirectory(this.projectMapperPath);
185
+ // write the project to file
186
+ const projectFileSuccessPath = (0, node_path_1.join)(this.projectMapperPath, this.composableStudioConfig.fileName);
187
+ utils_1.fsUtil.writeFile(projectFileSuccessPath, response.data);
188
+ cli_utilities_1.log.debug(`Project written to: ${projectFileSuccessPath}`, this.importConfig.context);
182
189
  }
183
190
  else {
184
191
  throw new Error(`API call failed with status ${response.status}: ${JSON.stringify(response.data)}`);
@@ -25,6 +25,8 @@ export default class ContentTypesImport extends BaseClass {
25
25
  private extPendingPath;
26
26
  private isExtensionsUpdate;
27
27
  private pendingExts;
28
+ private composableStudioSuccessPath;
29
+ private composableStudioExportPath;
28
30
  constructor({ importConfig, stackAPIClient }: ModuleClassParams);
29
31
  start(): Promise<any>;
30
32
  seedCTs(): Promise<any>;
@@ -1,6 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
+ /* eslint-disable no-prototype-builtins */
5
+ /*!
6
+ * Contentstack Import
7
+ * Copyright (c) 2026 Contentstack LLC
8
+ * MIT Licensed
9
+ */
4
10
  const path = tslib_1.__importStar(require("path"));
5
11
  const lodash_1 = require("lodash");
6
12
  const cli_utilities_1 = require("@contentstack/cli-utilities");
@@ -16,19 +22,28 @@ class ContentTypesImport extends base_class_1.default {
16
22
  this.cTsConfig = importConfig.modules['content-types'];
17
23
  this.gFsConfig = importConfig.modules['global-fields'];
18
24
  this.reqConcurrency = this.cTsConfig.writeConcurrency || this.importConfig.writeConcurrency;
19
- this.cTsFolderPath = path.join((0, cli_utilities_1.sanitizePath)(this.importConfig.data), (0, cli_utilities_1.sanitizePath)(this.cTsConfig.dirName));
20
- this.cTsMapperPath = path.join((0, cli_utilities_1.sanitizePath)(this.importConfig.data), 'mapper', 'content_types');
21
- this.cTsSuccessPath = path.join((0, cli_utilities_1.sanitizePath)(this.importConfig.data), 'mapper', 'content_types', 'success.json');
22
- this.gFsFolderPath = path.resolve((0, cli_utilities_1.sanitizePath)(this.importConfig.data), (0, cli_utilities_1.sanitizePath)(this.gFsConfig.dirName));
23
- this.gFsMapperFolderPath = path.join((0, cli_utilities_1.sanitizePath)(importConfig.data), 'mapper', 'global_fields', 'success.json');
24
- this.gFsPendingPath = path.join((0, cli_utilities_1.sanitizePath)(importConfig.data), 'mapper', 'global_fields', 'pending_global_fields.js');
25
- this.marketplaceAppMapperPath = path.join((0, cli_utilities_1.sanitizePath)(this.importConfig.data), 'mapper', 'marketplace_apps', 'uid-mapping.json');
25
+ 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');
26
32
  this.ignoredFilesInContentTypesFolder = new Map([
27
33
  ['__master.json', 'true'],
28
34
  ['__priority.json', 'true'],
29
35
  ['schema.json', 'true'],
30
36
  ['.DS_Store', 'true'],
31
37
  ]);
38
+ // Initialize composable studio paths if config exists
39
+ if (this.importConfig.modules['composable-studio']) {
40
+ this.composableStudioSuccessPath = path.join((0, cli_utilities_1.sanitizePath)(this.importConfig.data), 'mapper', this.importConfig.modules['composable-studio'].dirName, this.importConfig.modules['composable-studio'].fileName);
41
+ this.composableStudioExportPath = path.join((0, cli_utilities_1.sanitizePath)(this.importConfig.data), this.importConfig.modules['composable-studio'].dirName, this.importConfig.modules['composable-studio'].fileName);
42
+ }
43
+ else {
44
+ this.composableStudioSuccessPath = '';
45
+ this.composableStudioExportPath = '';
46
+ }
32
47
  this.cTs = [];
33
48
  this.createdCTs = [];
34
49
  this.titleToUIdMap = new Map();
@@ -37,8 +52,8 @@ class ContentTypesImport extends base_class_1.default {
37
52
  this.createdGFs = [];
38
53
  this.pendingGFs = [];
39
54
  this.pendingExts = [];
40
- this.taxonomiesPath = path.join((0, cli_utilities_1.sanitizePath)(importConfig.data), 'mapper', 'taxonomies', 'success.json');
41
- this.extPendingPath = path.join((0, cli_utilities_1.sanitizePath)(importConfig.data), 'mapper', 'extensions', 'pending_extensions.js');
55
+ this.taxonomiesPath = path.join((0, cli_utilities_1.sanitizePath)(importConfig.contentDir), 'mapper', 'taxonomies', 'success.json');
56
+ this.extPendingPath = path.join((0, cli_utilities_1.sanitizePath)(importConfig.contentDir), 'mapper', 'extensions', 'pending_extensions.js');
42
57
  }
43
58
  async start() {
44
59
  var _a;
@@ -49,6 +64,30 @@ class ContentTypesImport extends base_class_1.default {
49
64
  cli_utilities_1.log.info('No content type found to import', this.importConfig.context);
50
65
  return;
51
66
  }
67
+ // If success file doesn't exist but export file does, skip the composition content type
68
+ // Only check if composable studio paths are configured
69
+ if (this.composableStudioSuccessPath &&
70
+ this.composableStudioExportPath &&
71
+ !utils_1.fileHelper.fileExistsSync(this.composableStudioSuccessPath) &&
72
+ utils_1.fileHelper.fileExistsSync(this.composableStudioExportPath)) {
73
+ const exportedProject = utils_1.fileHelper.readFileSync(this.composableStudioExportPath);
74
+ if (exportedProject === null || exportedProject === void 0 ? void 0 : exportedProject.contentTypeUid) {
75
+ const originalCount = this.cTs.length;
76
+ this.cTs = this.cTs.filter((ct) => {
77
+ const shouldSkip = ct.uid === exportedProject.contentTypeUid;
78
+ if (shouldSkip) {
79
+ cli_utilities_1.log.info(`Skipping content type '${ct.uid}' as Composable Studio project was not created successfully`, this.importConfig.context);
80
+ }
81
+ return !shouldSkip;
82
+ });
83
+ const skippedCount = originalCount - this.cTs.length;
84
+ if (skippedCount > 0) {
85
+ cli_utilities_1.log.debug(`Filtered out ${skippedCount} composition content type(s) from import`, this.importConfig.context);
86
+ }
87
+ }
88
+ }
89
+ await utils_1.fsUtil.makeDirectory(this.cTsMapperPath);
90
+ cli_utilities_1.log.debug('Created content types mapper directory.', this.importConfig.context);
52
91
  await utils_1.fsUtil.makeDirectory(this.cTsMapperPath);
53
92
  cli_utilities_1.log.debug('Created content types mapper directory', this.importConfig.context);
54
93
  const progress = this.initializeProgress();
@@ -38,6 +38,8 @@ export default class EntriesImport extends BaseClass {
38
38
  locale: string;
39
39
  entry_uid: string;
40
40
  }>;
41
+ private composableStudioSuccessPath;
42
+ private composableStudioExportPath;
41
43
  constructor({ importConfig, stackAPIClient }: ModuleClassParams);
42
44
  start(): Promise<any>;
43
45
  private analyzeEntryData;
@@ -4,7 +4,7 @@ const tslib_1 = require("tslib");
4
4
  /* eslint-disable no-prototype-builtins */
5
5
  /*!
6
6
  * Contentstack Import
7
- * Copyright (c) 2024 Contentstack LLC
7
+ * Copyright (c) 2026 Contentstack LLC
8
8
  * MIT Licensed
9
9
  */
10
10
  const path = tslib_1.__importStar(require("path"));
@@ -19,19 +19,28 @@ class EntriesImport extends base_class_1.default {
19
19
  this.entriesForVariant = [];
20
20
  this.importConfig.context.module = utils_1.MODULE_CONTEXTS.ENTRIES;
21
21
  this.currentModuleName = utils_1.MODULE_NAMES[utils_1.MODULE_CONTEXTS.ENTRIES];
22
- this.assetUidMapperPath = path.resolve((0, cli_utilities_1.sanitizePath)(importConfig.data), 'mapper', 'assets', 'uid-mapping.json');
23
- this.assetUrlMapperPath = path.resolve((0, cli_utilities_1.sanitizePath)(importConfig.data), 'mapper', 'assets', 'url-mapping.json');
24
- this.entriesMapperPath = path.resolve((0, cli_utilities_1.sanitizePath)(importConfig.data), 'mapper', 'entries');
25
- this.envPath = path.resolve((0, cli_utilities_1.sanitizePath)(importConfig.data), 'environments', 'environments.json');
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
26
  this.entriesUIDMapperPath = path.join((0, cli_utilities_1.sanitizePath)(this.entriesMapperPath), 'uid-mapping.json');
27
27
  this.uniqueUidMapperPath = path.join((0, cli_utilities_1.sanitizePath)(this.entriesMapperPath), 'unique-mapping.json');
28
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.data), 'mapper', 'marketplace_apps', 'uid-mapping.json');
30
- this.taxonomiesPath = path.join((0, cli_utilities_1.sanitizePath)(this.importConfig.data), 'mapper', 'taxonomies', 'terms', 'success.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');
31
31
  this.entriesConfig = importConfig.modules.entries;
32
- this.entriesPath = path.resolve((0, cli_utilities_1.sanitizePath)(importConfig.data), (0, cli_utilities_1.sanitizePath)(this.entriesConfig.dirName));
33
- this.cTsPath = path.resolve((0, cli_utilities_1.sanitizePath)(importConfig.data), (0, cli_utilities_1.sanitizePath)(importConfig.modules['content-types'].dirName));
34
- this.localesPath = path.resolve((0, cli_utilities_1.sanitizePath)(importConfig.data), (0, cli_utilities_1.sanitizePath)(importConfig.modules.locales.dirName), (0, cli_utilities_1.sanitizePath)(importConfig.modules.locales.fileName));
32
+ this.entriesPath = path.resolve((0, cli_utilities_1.sanitizePath)(importConfig.contentDir), (0, cli_utilities_1.sanitizePath)(this.entriesConfig.dirName));
33
+ this.cTsPath = path.resolve((0, cli_utilities_1.sanitizePath)(importConfig.contentDir), (0, cli_utilities_1.sanitizePath)(importConfig.modules['content-types'].dirName));
34
+ 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
+ // Initialize composable studio paths if config exists
36
+ if (this.importConfig.modules['composable-studio']) {
37
+ this.composableStudioSuccessPath = path.join((0, cli_utilities_1.sanitizePath)(this.importConfig.data), 'mapper', this.importConfig.modules['composable-studio'].dirName, this.importConfig.modules['composable-studio'].fileName);
38
+ this.composableStudioExportPath = path.join((0, cli_utilities_1.sanitizePath)(this.importConfig.data), this.importConfig.modules['composable-studio'].dirName, this.importConfig.modules['composable-studio'].fileName);
39
+ }
40
+ else {
41
+ this.composableStudioSuccessPath = '';
42
+ this.composableStudioExportPath = '';
43
+ }
35
44
  this.importConcurrency = this.entriesConfig.importConcurrency || importConfig.importConcurrency;
36
45
  this.entriesUidMapper = {};
37
46
  this.modifiedCTs = [];
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * Contentstack Import
3
- * Copyright (c) 2024 Contentstack LLC
3
+ * Copyright (c) 2026 Contentstack LLC
4
4
  * MIT Licensed
5
5
  */
6
6
  import { ModuleClassParams } from '../../types';
@@ -2,7 +2,7 @@
2
2
  /* eslint-disable no-prototype-builtins */
3
3
  /*!
4
4
  * Contentstack Import
5
- * Copyright (c) 2024 Contentstack LLC
5
+ * Copyright (c) 2026 Contentstack LLC
6
6
  * MIT Licensed
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -27,13 +27,13 @@ class ImportGlobalFields extends base_class_1.default {
27
27
  this.pendingGFs = [];
28
28
  this.existingGFs = [];
29
29
  this.reqConcurrency = this.gFsConfig.writeConcurrency || this.config.writeConcurrency;
30
- this.gFsMapperPath = path.resolve((0, cli_utilities_1.sanitizePath)(this.config.data), 'mapper', 'global_fields');
31
- this.gFsFolderPath = path.resolve((0, cli_utilities_1.sanitizePath)(this.config.data), (0, cli_utilities_1.sanitizePath)(this.gFsConfig.dirName));
32
- this.gFsFailsPath = path.resolve((0, cli_utilities_1.sanitizePath)(this.config.data), 'mapper', 'global_fields', 'fails.json');
33
- this.gFsSuccessPath = path.resolve((0, cli_utilities_1.sanitizePath)(this.config.data), 'mapper', 'global_fields', 'success.json');
34
- this.gFsUidMapperPath = path.resolve((0, cli_utilities_1.sanitizePath)(this.config.data), 'mapper', 'global_fields', 'uid-mapping.json');
35
- this.gFsPendingPath = path.resolve((0, cli_utilities_1.sanitizePath)(this.config.data), 'mapper', 'global_fields', 'pending_global_fields.js');
36
- this.marketplaceAppMapperPath = path.join((0, cli_utilities_1.sanitizePath)(this.config.data), 'mapper', 'marketplace_apps', 'uid-mapping.json');
30
+ this.gFsMapperPath = path.resolve((0, cli_utilities_1.sanitizePath)(this.config.contentDir), 'mapper', 'global_fields');
31
+ this.gFsFolderPath = path.resolve((0, cli_utilities_1.sanitizePath)(this.config.contentDir), (0, cli_utilities_1.sanitizePath)(this.gFsConfig.dirName));
32
+ this.gFsFailsPath = path.resolve((0, cli_utilities_1.sanitizePath)(this.config.contentDir), 'mapper', 'global_fields', 'fails.json');
33
+ this.gFsSuccessPath = path.resolve((0, cli_utilities_1.sanitizePath)(this.config.contentDir), 'mapper', 'global_fields', 'success.json');
34
+ this.gFsUidMapperPath = path.resolve((0, cli_utilities_1.sanitizePath)(this.config.contentDir), 'mapper', 'global_fields', 'uid-mapping.json');
35
+ this.gFsPendingPath = path.resolve((0, cli_utilities_1.sanitizePath)(this.config.contentDir), 'mapper', 'global_fields', 'pending_global_fields.js');
36
+ this.marketplaceAppMapperPath = path.join((0, cli_utilities_1.sanitizePath)(this.config.contentDir), 'mapper', 'marketplace_apps', 'uid-mapping.json');
37
37
  }
38
38
  /**
39
39
  * @method start
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * Contentstack Import
3
- * Copyright (c) 2024 Contentstack LLC
3
+ * Copyright (c) 2026 Contentstack LLC
4
4
  * MIT Licensed
5
5
  */
6
6
  import BaseClass from './base-class';
@@ -2,7 +2,7 @@
2
2
  /* eslint-disable no-prototype-builtins */
3
3
  /*!
4
4
  * Contentstack Import
5
- * Copyright (c) 2024 Contentstack LLC
5
+ * Copyright (c) 2026 Contentstack LLC
6
6
  * MIT Licensed
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -27,11 +27,11 @@ class ImportLocales extends base_class_1.default {
27
27
  this.createdLocales = [];
28
28
  this.failedLocales = [];
29
29
  this.reqConcurrency = this.localeConfig.writeConcurrency || this.config.writeConcurrency;
30
- this.langMapperPath = path.resolve((0, cli_utilities_1.sanitizePath)(this.config.data), 'mapper', 'languages');
31
- this.langFolderPath = path.resolve((0, cli_utilities_1.sanitizePath)(this.config.data), (0, cli_utilities_1.sanitizePath)(this.localeConfig.dirName));
32
- this.langFailsPath = path.resolve((0, cli_utilities_1.sanitizePath)(this.config.data), 'mapper', 'languages', 'fails.json');
33
- this.langSuccessPath = path.resolve((0, cli_utilities_1.sanitizePath)(this.config.data), 'mapper', 'languages', 'success.json');
34
- this.langUidMapperPath = path.resolve((0, cli_utilities_1.sanitizePath)(this.config.data), 'mapper', 'languages', 'uid-mapper.json');
30
+ this.langMapperPath = path.resolve((0, cli_utilities_1.sanitizePath)(this.config.contentDir), 'mapper', 'languages');
31
+ this.langFolderPath = path.resolve((0, cli_utilities_1.sanitizePath)(this.config.contentDir), (0, cli_utilities_1.sanitizePath)(this.localeConfig.dirName));
32
+ this.langFailsPath = path.resolve((0, cli_utilities_1.sanitizePath)(this.config.contentDir), 'mapper', 'languages', 'fails.json');
33
+ this.langSuccessPath = path.resolve((0, cli_utilities_1.sanitizePath)(this.config.contentDir), 'mapper', 'languages', 'success.json');
34
+ this.langUidMapperPath = path.resolve((0, cli_utilities_1.sanitizePath)(this.config.contentDir), 'mapper', 'languages', 'uid-mapper.json');
35
35
  }
36
36
  async start() {
37
37
  try {
@@ -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.target_stack}`, this.importConfig.context);
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.target_stack, targetType: 'stack' })
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;
@@ -145,7 +145,7 @@ class ImportPersonalize extends base_class_1.default {
145
145
  }
146
146
  const personalize = this.config.modules.personalize;
147
147
  const { dirName, fileName } = personalize.projects;
148
- const projectPath = (0, path_1.join)((0, cli_utilities_1.sanitizePath)(this.config.data), (0, cli_utilities_1.sanitizePath)(personalize.dirName), (0, cli_utilities_1.sanitizePath)(dirName), (0, cli_utilities_1.sanitizePath)(fileName));
148
+ 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
149
  cli_utilities_1.log.debug(`Checking for project file: ${projectPath}`, this.config.context);
150
150
  if (!(0, fs_1.existsSync)(projectPath)) {
151
151
  this.config.modules.personalize.importData = false;
@@ -13,7 +13,7 @@ class ImportVariantEntries extends base_class_1.default {
13
13
  this.config.context.module = utils_1.MODULE_CONTEXTS.VARIANT_ENTRIES;
14
14
  this.currentModuleName = utils_1.MODULE_NAMES[utils_1.MODULE_CONTEXTS.VARIANT_ENTRIES];
15
15
  this.personalize = importConfig.modules.personalize;
16
- this.projectMapperFilePath = path_1.default.resolve((0, cli_utilities_1.sanitizePath)(this.config.data), 'mapper', (0, cli_utilities_1.sanitizePath)(this.personalize.dirName), 'projects', 'projects.json');
16
+ this.projectMapperFilePath = path_1.default.resolve((0, cli_utilities_1.sanitizePath)(this.config.contentDir), 'mapper', (0, cli_utilities_1.sanitizePath)(this.personalize.dirName), 'projects', 'projects.json');
17
17
  }
18
18
  /**
19
19
  * @method start
@@ -89,7 +89,7 @@ class ImportVariantEntries extends base_class_1.default {
89
89
  return [false, 0];
90
90
  }
91
91
  // Basic validation - check if data file exists
92
- const dataFilePath = path_1.default.resolve((0, cli_utilities_1.sanitizePath)(this.config.data), 'mapper', 'entries', 'data-for-variant-entry.json');
92
+ const dataFilePath = path_1.default.resolve((0, cli_utilities_1.sanitizePath)(this.config.contentDir), 'mapper', 'entries', 'data-for-variant-entry.json');
93
93
  const hasVariantData = utils_1.fileHelper.fileExistsSync(dataFilePath);
94
94
  cli_utilities_1.log.debug(`Found valid personalize project: ${project.uid} with variant data: ${hasVariantData}`, this.config.context);
95
95
  // Return 0 count - let the variant module update it dynamically
@@ -48,7 +48,6 @@ export default interface ImportConfig extends DefaultConfig, ExternalConfig {
48
48
  authtoken?: string;
49
49
  destinationStackName?: string;
50
50
  org_uid?: string;
51
- contentVersion: number;
52
51
  replaceExisting?: boolean;
53
52
  skipExisting?: boolean;
54
53
  skipAudit?: boolean;
@@ -57,7 +56,6 @@ export default interface ImportConfig extends DefaultConfig, ExternalConfig {
57
56
  personalizeProjectName?: string;
58
57
  'exclude-global-modules': false;
59
58
  context: Context;
60
- onlyTSModules?: Modules[];
61
59
  }
62
60
  type branch = {
63
61
  uid: string;
@@ -34,7 +34,7 @@ const uploadAssetHelper = function (config, req, fsPath, RETRY) {
34
34
  cli_utilities_1.log.debug(`Uploading asset (attempt ${RETRY}/${MAX_RETRY_LIMIT}): ${fsPath}`);
35
35
  req.upload = fsPath;
36
36
  const stackAPIClient = APIClient.stack({
37
- api_key: config.target_stack,
37
+ api_key: config.apiKey,
38
38
  management_token: config.management_token,
39
39
  });
40
40
  stackAPIClient
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * Contentstack Import
3
- * Copyright (c) 2024 Contentstack LLC
3
+ * Copyright (c) 2026 Contentstack LLC
4
4
  * MIT Licensed
5
5
  */
6
6
  import { ImportConfig } from '../types';
@@ -2,7 +2,7 @@
2
2
  /* eslint-disable no-console */
3
3
  /*!
4
4
  * Contentstack Import
5
- * Copyright (c) 2024 Contentstack LLC
5
+ * Copyright (c) 2026 Contentstack LLC
6
6
  * MIT Licensed
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -25,14 +25,14 @@ const initialization = (configData) => {
25
25
  exports.initialization = initialization;
26
26
  const validateConfig = (importConfig) => {
27
27
  cli_utilities_1.log.debug('Validating import configuration');
28
- if (importConfig.email && importConfig.password && !importConfig.target_stack) {
28
+ if (importConfig.email && importConfig.password && !importConfig.apiKey) {
29
29
  cli_utilities_1.log.debug('Target stack API token is required when using email/password authentication');
30
30
  return 'error';
31
31
  }
32
32
  else if (!importConfig.email &&
33
33
  !importConfig.password &&
34
34
  !importConfig.management_token &&
35
- importConfig.target_stack &&
35
+ importConfig.apiKey &&
36
36
  !(0, cli_utilities_1.isAuthenticated)()) {
37
37
  cli_utilities_1.log.debug('Authentication credentials missing - either management token or email/password required');
38
38
  return 'error';
@@ -70,7 +70,7 @@ const sanitizeStack = (importConfig) => {
70
70
  const newStackVersion = stackDetails.data.stack.settings.version;
71
71
  const newStackDate = new Date(newStackVersion).toString();
72
72
  cli_utilities_1.log.debug(`New stack version: ${newStackVersion} (${newStackDate})`);
73
- const stackFilePath = path.join((0, cli_utilities_1.sanitizePath)(importConfig.data), (0, cli_utilities_1.sanitizePath)(importConfig.modules.stack.dirName), (0, cli_utilities_1.sanitizePath)(importConfig.modules.stack.fileName));
73
+ const stackFilePath = path.join((0, cli_utilities_1.sanitizePath)(importConfig.contentDir), (0, cli_utilities_1.sanitizePath)(importConfig.modules.stack.dirName), (0, cli_utilities_1.sanitizePath)(importConfig.modules.stack.fileName));
74
74
  cli_utilities_1.log.debug(`Reading stack file from: ${stackFilePath}`);
75
75
  const oldStackDetails = (0, file_helper_1.readFileSync)(stackFilePath);
76
76
  if (!oldStackDetails || !oldStackDetails.settings || !oldStackDetails.settings.hasOwnProperty('version')) {
@@ -137,7 +137,7 @@ const field_rules_update = (importConfig, ctPath) => {
137
137
  for (let i = 0; i < fieldRuleConditionLength; i++) {
138
138
  if (schema.field_rules[k].conditions[i].operand_field === 'reference') {
139
139
  cli_utilities_1.log.debug(`Processing reference field rule condition`);
140
- let entryMapperPath = path.resolve(importConfig.data, 'mapper', 'entries');
140
+ let entryMapperPath = path.resolve(importConfig.contentDir, 'mapper', 'entries');
141
141
  let entryUidMapperPath = path.join(entryMapperPath, 'uid-mapping.json');
142
142
  let fieldRulesValue = schema.field_rules[k].conditions[i].value;
143
143
  let fieldRulesArray = fieldRulesValue.split('.');
@@ -158,7 +158,7 @@ const field_rules_update = (importConfig, ctPath) => {
158
158
  }
159
159
  }
160
160
  const stackAPIClient = client.stack({
161
- api_key: importConfig.target_stack,
161
+ api_key: importConfig.apiKey,
162
162
  management_token: importConfig.management_token,
163
163
  });
164
164
  let ctObj = stackAPIClient.contentType(schema.uid);
@@ -42,7 +42,7 @@ export declare const schemaTemplate: {
42
42
  };
43
43
  /*!
44
44
  * Contentstack Import
45
- * Copyright (c) 2024 Contentstack LLC
45
+ * Copyright (c) 2026 Contentstack LLC
46
46
  * MIT Licensed
47
47
  */
48
48
  export declare const suppressSchemaReference: (schema: any, flag: any) => void;
@@ -48,7 +48,7 @@ exports.schemaTemplate = {
48
48
  };
49
49
  /*!
50
50
  * Contentstack Import
51
- * Copyright (c) 2024 Contentstack LLC
51
+ * Copyright (c) 2026 Contentstack LLC
52
52
  * MIT Licensed
53
53
  */
54
54
  const suppressSchemaReference = function (schema, flag) {
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.lookupExtension = void 0;
7
7
  /*!
8
8
  * Contentstack Import
9
- * Copyright (c) 2024 Contentstack LLC
9
+ * Copyright (c) 2026 Contentstack LLC
10
10
  * MIT Licensed
11
11
  */
12
12
  const node_path_1 = require("node:path");
@@ -11,6 +11,9 @@ const interactive_1 = require("./interactive");
11
11
  const login_handler_1 = tslib_1.__importDefault(require("./login-handler"));
12
12
  const setupConfig = async (importCmdFlags) => {
13
13
  var _a;
14
+ // Set progress supported module FIRST, before any log calls
15
+ // This ensures the logger respects the showConsoleLogs setting correctly
16
+ cli_utilities_1.configHandler.set('log.progressSupportedModule', 'import');
14
17
  let config = (0, merge_1.default)({}, config_1.default);
15
18
  // Track authentication method
16
19
  let authenticationMethod = 'unknown';
@@ -23,7 +26,7 @@ const setupConfig = async (importCmdFlags) => {
23
26
  }
24
27
  config = merge_1.default.recursive(config, externalConfig);
25
28
  }
26
- config.contentDir = (0, cli_utilities_1.sanitizePath)(importCmdFlags['data'] || importCmdFlags['data-dir'] || config.data || (await (0, interactive_1.askContentDir)()));
29
+ config.contentDir = (0, cli_utilities_1.sanitizePath)(importCmdFlags['data'] || importCmdFlags['data-dir'] || config.contentDir || (await (0, interactive_1.askContentDir)()));
27
30
  const pattern = /[*$%#<>{}!&?]/g;
28
31
  if (pattern.test(config.contentDir)) {
29
32
  cli_utilities_1.cliux.print(`\nPlease enter a directory path without any special characters: (*,&,{,},[,],$,%,<,>,?,!)`, {
@@ -33,8 +36,6 @@ const setupConfig = async (importCmdFlags) => {
33
36
  }
34
37
  config.contentDir = config.contentDir.replace(/['"]/g, '');
35
38
  config.contentDir = path.resolve(config.contentDir);
36
- //Note to support the old key
37
- config.data = config.contentDir;
38
39
  const managementTokenAlias = importCmdFlags['management-token-alias'] || importCmdFlags['alias'];
39
40
  if (managementTokenAlias) {
40
41
  const { token, apiKey } = (_a = cli_utilities_1.configHandler.get(`tokens.${managementTokenAlias}`)) !== null && _a !== void 0 ? _a : {};
@@ -71,7 +72,7 @@ const setupConfig = async (importCmdFlags) => {
71
72
  cli_utilities_1.log.debug('User authenticated via auth token');
72
73
  }
73
74
  config.apiKey =
74
- importCmdFlags['stack-uid'] || importCmdFlags['stack-api-key'] || config.target_stack || (await (0, interactive_1.askAPIKey)());
75
+ importCmdFlags['stack-uid'] || importCmdFlags['stack-api-key'] || config.apiKey || (await (0, interactive_1.askAPIKey)());
75
76
  if (typeof config.apiKey !== 'string') {
76
77
  throw new Error('Invalid API key received');
77
78
  }
@@ -79,12 +80,9 @@ const setupConfig = async (importCmdFlags) => {
79
80
  }
80
81
  config.isAuthenticated = (0, cli_utilities_1.isAuthenticated)();
81
82
  config.auth_token = cli_utilities_1.configHandler.get('authtoken'); // TBD handle auth token in httpClient & sdk
82
- //Note to support the old key
83
- config.source_stack = config.apiKey;
84
83
  config.skipAudit = importCmdFlags['skip-audit'];
85
84
  config.forceStopMarketplaceAppsPrompt = importCmdFlags.yes;
86
85
  config.importWebhookStatus = importCmdFlags['import-webhook-status'];
87
- config.skipPrivateAppRecreationIfExist = !importCmdFlags['skip-app-recreation'];
88
86
  if (importCmdFlags['branch-alias']) {
89
87
  config.branchAlias = importCmdFlags['branch-alias'];
90
88
  }
@@ -105,8 +103,6 @@ const setupConfig = async (importCmdFlags) => {
105
103
  if (importCmdFlags['skip-entries-publish']) {
106
104
  config.skipEntriesPublish = importCmdFlags['skip-entries-publish'];
107
105
  }
108
- // Note to support old modules
109
- config.target_stack = config.apiKey;
110
106
  config.replaceExisting = importCmdFlags['replace-existing'];
111
107
  config.skipExisting = importCmdFlags['skip-existing'];
112
108
  config.personalizeProjectName = importCmdFlags['personalize-project-name'];
@@ -63,7 +63,7 @@ exports.selectBranchFromDirectory = selectBranchFromDirectory;
63
63
  */
64
64
  const resolveImportPath = async (importConfig, stackAPIClient) => {
65
65
  cli_utilities_1.log.debug('Resolving import path based on directory structure');
66
- const contentDir = importConfig.contentDir || importConfig.data;
66
+ const contentDir = importConfig.contentDir;
67
67
  cli_utilities_1.log.debug(`Content directory: ${contentDir}`);
68
68
  if (!(0, file_helper_1.fileExistsSync)(contentDir)) {
69
69
  throw new Error(`Content directory does not exist: ${contentDir}`);
@@ -83,11 +83,6 @@ const resolveImportPath = async (importConfig, stackAPIClient) => {
83
83
  cli_utilities_1.log.debug(`Branch directory not found: ${branchPath}, using contentDir as-is`);
84
84
  return contentDir;
85
85
  }
86
- const exportInfoPath = path.join(contentDir, 'export-info.json');
87
- if ((0, file_helper_1.fileExistsSync)(exportInfoPath)) {
88
- cli_utilities_1.log.debug('Found export-info.json - using contentDir as-is (v2 export)');
89
- return contentDir;
90
- }
91
86
  const moduleTypes = config_1.default.modules.types;
92
87
  const hasModuleFolders = moduleTypes.some((moduleType) => (0, file_helper_1.fileExistsSync)(path.join(contentDir, moduleType)));
93
88
  if (hasModuleFolders) {
@@ -115,31 +110,7 @@ const updateImportConfigWithResolvedPath = async (importConfig, resolvedPath) =>
115
110
  }
116
111
  importConfig.branchDir = resolvedPath;
117
112
  importConfig.contentDir = resolvedPath;
118
- importConfig.data = resolvedPath;
119
- // Check if export-info.json exists to determine contentVersion
120
- const exportInfoPath = path.join(resolvedPath, 'export-info.json');
121
- if ((0, file_helper_1.fileExistsSync)(exportInfoPath)) {
122
- try {
123
- const exportInfo = await (0, file_helper_1.readFile)(exportInfoPath);
124
- // If export-info.json exists, set contentVersion to 2 (or use value from file if present)
125
- if (exportInfo && exportInfo.contentVersion) {
126
- importConfig.contentVersion = exportInfo.contentVersion;
127
- }
128
- else {
129
- // If export-info.json exists but contentVersion is missing, default to 2
130
- importConfig.contentVersion = 2;
131
- }
132
- }
133
- catch (error) {
134
- // If export-info.json exists but is null or can't be read, default to 2
135
- importConfig.contentVersion = 2;
136
- }
137
- }
138
- else {
139
- // If export-info.json doesn't exist, default to 1 (legacy format)
140
- importConfig.contentVersion = 1;
141
- }
142
- cli_utilities_1.log.debug(`Import config updated - contentDir: ${importConfig.contentDir}, branchDir: ${importConfig.branchDir}, data: ${importConfig.data}, contentVersion: ${importConfig.contentVersion}`);
113
+ cli_utilities_1.log.debug(`Import config updated - contentDir: ${importConfig.contentDir}, branchDir: ${importConfig.branchDir}`);
143
114
  };
144
115
  exports.updateImportConfigWithResolvedPath = updateImportConfigWithResolvedPath;
145
116
  /**
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * Contentstack Export
3
- * Copyright (c) 2024 Contentstack LLC
3
+ * Copyright (c) 2026 Contentstack LLC
4
4
  * MIT Licensed
5
5
  */
6
6
  import { ImportConfig } from '../types';
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  /*!
3
3
  * Contentstack Export
4
- * Copyright (c) 2024 Contentstack LLC
4
+ * Copyright (c) 2026 Contentstack LLC
5
5
  * MIT Licensed
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -125,7 +125,7 @@ function init(_logPath) {
125
125
  };
126
126
  }
127
127
  const log = async (config, message, type) => {
128
- config.cliLogsPath = (0, cli_utilities_1.sanitizePath)(config.cliLogsPath || config.data || path.join(__dirname, 'logs'));
128
+ config.cliLogsPath = (0, cli_utilities_1.sanitizePath)(config.cliLogsPath || config.contentDir || path.join(__dirname, 'logs'));
129
129
  // ignoring the type argument, as we are not using it to create a logfile anymore
130
130
  if (type !== 'error') {
131
131
  // removed type argument from init method
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * Contentstack Import
3
- * Copyright (c) 2024 Contentstack LLC
3
+ * Copyright (c) 2026 Contentstack LLC
4
4
  * MIT Licensed
5
5
  */
6
6
  import { ImportConfig } from '../types';
@@ -4,7 +4,7 @@
4
4
  /* eslint-disable no-empty */
5
5
  /*!
6
6
  * Contentstack Import
7
- * Copyright (c) 2024 Contentstack LLC
7
+ * Copyright (c) 2026 Contentstack LLC
8
8
  * MIT Licensed
9
9
  */
10
10
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -18,7 +18,7 @@ const login = async (config) => {
18
18
  if (authtoken) {
19
19
  cli_utilities_1.log.debug('Login successful, setting up headers');
20
20
  config.headers = {
21
- api_key: config.source_stack,
21
+ api_key: config.apiKey,
22
22
  access_token: config.access_token,
23
23
  authtoken: config.authtoken,
24
24
  'X-User-Agent': 'contentstack-export/v',
@@ -36,7 +36,7 @@ const login = async (config) => {
36
36
  else if ((0, cli_utilities_1.isAuthenticated)()) {
37
37
  cli_utilities_1.log.debug('Using existing authentication, validating stack access');
38
38
  const stackAPIClient = client.stack({
39
- api_key: config.target_stack,
39
+ api_key: config.apiKey,
40
40
  management_token: config.management_token,
41
41
  });
42
42
  const stack = await stackAPIClient.fetch().catch((error) => {
@@ -18,7 +18,7 @@ const getAllStackSpecificApps = async (config, skip = 0, listOfApps = []) => {
18
18
  const collection = await appSdk
19
19
  .marketplace(config.org_uid)
20
20
  .installation()
21
- .fetchAll({ target_uids: config.target_stack, skip })
21
+ .fetchAll({ target_uids: config.apiKey, skip })
22
22
  .catch((error) => {
23
23
  (0, cli_utilities_1.handleAndLogError)(error);
24
24
  cli_utilities_1.log.error(error, config === null || config === void 0 ? void 0 : config.context);
@@ -54,7 +54,7 @@ const getOrgUid = async (config) => {
54
54
  cli_utilities_1.log.debug('Fetching organization UID');
55
55
  const tempAPIClient = await (0, cli_utilities_1.managementSDKClient)({ host: config.host });
56
56
  const tempStackData = await tempAPIClient
57
- .stack({ api_key: config.target_stack })
57
+ .stack({ api_key: config.apiKey })
58
58
  .fetch()
59
59
  .catch((error) => {
60
60
  (0, cli_utilities_1.handleAndLogError)(error);
@@ -1,9 +1,7 @@
1
1
  {
2
2
  "commands": {
3
3
  "cm:stacks:import": {
4
- "aliases": [
5
- "cm:import"
6
- ],
4
+ "aliases": [],
7
5
  "args": {},
8
6
  "description": "Import content from a stack",
9
7
  "examples": [
@@ -25,15 +23,6 @@
25
23
  "multiple": false,
26
24
  "type": "option"
27
25
  },
28
- "stack-uid": {
29
- "char": "s",
30
- "description": "API key of the target stack.",
31
- "hidden": true,
32
- "name": "stack-uid",
33
- "hasDynamicHelp": false,
34
- "multiple": false,
35
- "type": "option"
36
- },
37
26
  "stack-api-key": {
38
27
  "char": "k",
39
28
  "description": "API Key of the target stack",
@@ -42,14 +31,6 @@
42
31
  "multiple": false,
43
32
  "type": "option"
44
33
  },
45
- "data": {
46
- "description": "path and location where data is stored",
47
- "hidden": true,
48
- "name": "data",
49
- "hasDynamicHelp": false,
50
- "multiple": false,
51
- "type": "option"
52
- },
53
34
  "data-dir": {
54
35
  "char": "d",
55
36
  "description": "The path or the location in your file system where the content, you intend to import, is stored. For example, -d \"C:\\Users\\Name\\Desktop\\cli\\content\". If the export folder has branches involved, then the path should point till the particular branch. For example, “-d \"C:\\Users\\Name\\Desktop\\cli\\content\\branch_name\"",
@@ -66,24 +47,7 @@
66
47
  "multiple": false,
67
48
  "type": "option"
68
49
  },
69
- "management-token-alias": {
70
- "description": "alias of the management token",
71
- "hidden": true,
72
- "name": "management-token-alias",
73
- "hasDynamicHelp": false,
74
- "multiple": false,
75
- "type": "option"
76
- },
77
- "auth-token": {
78
- "char": "A",
79
- "description": "to use auth token",
80
- "hidden": true,
81
- "name": "auth-token",
82
- "allowNo": false,
83
- "type": "boolean"
84
- },
85
50
  "module": {
86
- "char": "m",
87
51
  "description": "[optional] Specify the module to import into the target stack. If not specified, the import command will import all the modules into the stack. The available modules are assets, content-types, entries, environments, extensions, marketplace-apps, global-fields, labels, locales, webhooks, workflows, custom-roles, personalize projects, taxonomies, and composable-studio.",
88
52
  "name": "module",
89
53
  "required": false,
@@ -92,7 +56,6 @@
92
56
  "type": "option"
93
57
  },
94
58
  "backup-dir": {
95
- "char": "b",
96
59
  "description": "[optional] Backup directory name when using specific module.",
97
60
  "name": "backup-dir",
98
61
  "hasDynamicHelp": false,
@@ -100,7 +63,6 @@
100
63
  "type": "option"
101
64
  },
102
65
  "branch": {
103
- "char": "B",
104
66
  "description": "The name of the branch where you want to import your content. If you don't mention the branch name, then by default the content will be imported to the main branch.",
105
67
  "exclusive": [
106
68
  "branch-alias"
@@ -141,12 +103,6 @@
141
103
  "allowNo": false,
142
104
  "type": "boolean"
143
105
  },
144
- "skip-app-recreation": {
145
- "description": "(optional) Skips the recreation of private apps if they already exist.",
146
- "name": "skip-app-recreation",
147
- "allowNo": false,
148
- "type": "boolean"
149
- },
150
106
  "replace-existing": {
151
107
  "description": "Replaces the existing module in the target stack.",
152
108
  "name": "replace-existing",
@@ -201,7 +157,7 @@
201
157
  "pluginName": "@contentstack/cli-cm-import",
202
158
  "pluginType": "core",
203
159
  "strict": true,
204
- "usage": "cm:stacks:import [-c <value>] [-k <value>] [-d <value>] [-a <value>] [--module <value>] [--backup-dir <value>] [--branch <value>] [--import-webhook-status disable|current]",
160
+ "usage": "cm:stacks:import [--config <value>] [--stack-api-key <value>] [--data-dir <value>] [--alias <value>] [--module <value>] [--backup-dir <value>] [--branch <value>] [--import-webhook-status disable|current]",
205
161
  "isESM": false,
206
162
  "relativePath": [
207
163
  "lib",
@@ -212,5 +168,5 @@
212
168
  ]
213
169
  }
214
170
  },
215
- "version": "2.0.0-beta.3"
171
+ "version": "2.0.0-beta.4"
216
172
  }
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@contentstack/cli-cm-import",
3
3
  "description": "Contentstack CLI plugin to import content into stack",
4
- "version": "2.0.0-beta.3",
4
+ "version": "2.0.0-beta.4",
5
5
  "author": "Contentstack",
6
6
  "bugs": "https://github.com/contentstack/cli/issues",
7
7
  "dependencies": {
8
- "@contentstack/cli-audit": "2.0.0-beta",
8
+ "@contentstack/cli-audit": "~2.0.0-beta.1",
9
9
  "@contentstack/cli-command": "~1.7.0",
10
- "@contentstack/cli-utilities": "~1.15.0",
11
- "@contentstack/management": "~1.22.0",
12
- "@contentstack/cli-variants": "~2.0.0-beta.3",
10
+ "@contentstack/cli-utilities": "~1.17.0",
11
+ "@contentstack/management": "~1.27.3",
12
+ "@contentstack/cli-variants": "~2.0.0-beta.4",
13
13
  "@oclif/core": "^4.3.0",
14
14
  "big-json": "^3.2.0",
15
15
  "bluebird": "^3.7.2",
@@ -86,13 +86,9 @@
86
86
  "repositoryPrefix": "<%- repo %>/blob/main/packages/contentstack-import/<%- commandPath %>"
87
87
  },
88
88
  "csdxConfig": {
89
- "expiredCommands": {
90
- "cm:import": "csdx cm:stacks:import"
91
- },
92
89
  "shortCommandName": {
93
- "cm:stacks:import": "IMPRT",
94
- "cm:import": "O-IMPRT"
90
+ "cm:stacks:import": "IMPRT"
95
91
  }
96
92
  },
97
93
  "repository": "https://github.com/contentstack/cli"
98
- }
94
+ }