@contentstack/cli-cm-import 1.20.0 → 1.20.2

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/1.20.0 linux-x64 node-v22.14.0
50
+ @contentstack/cli-cm-import/1.20.2 linux-x64 node-v22.14.0
51
51
  $ csdx --help [COMMAND]
52
52
  USAGE
53
53
  $ csdx COMMAND
@@ -23,6 +23,22 @@ class ImportCommand extends cli_command_1.Command {
23
23
  importConfig.modules.personalize.baseURL[importConfig.region.name] = this.personalizeUrl;
24
24
  backupDir = importConfig.cliLogsPath || importConfig.backupDir;
25
25
  const managementAPIClient = await (0, cli_utilities_1.managementSDKClient)(importConfig);
26
+ if (!flags.branch) {
27
+ try {
28
+ const branches = await managementAPIClient
29
+ .stack({ api_key: importConfig.apiKey })
30
+ .branch()
31
+ .query()
32
+ .find()
33
+ .then(({ items }) => items);
34
+ if (branches.length) {
35
+ flags.branch = 'main';
36
+ }
37
+ }
38
+ catch (error) {
39
+ // Branch not enabled, just the let flow continue
40
+ }
41
+ }
26
42
  const moduleImporter = new import_1.ModuleImporter(managementAPIClient, importConfig);
27
43
  const result = await moduleImporter.start();
28
44
  if (!(result === null || result === void 0 ? void 0 : result.noSuccessMsg)) {
@@ -21,13 +21,13 @@ const setupConfig = async (importCmdFlags) => {
21
21
  }
22
22
  config = merge_1.default.recursive(config, externalConfig);
23
23
  }
24
- config.contentDir = importCmdFlags['data'] || importCmdFlags['data-dir'] || config.data || (await (0, interactive_1.askContentDir)());
24
+ config.contentDir = (0, cli_utilities_1.sanitizePath)(importCmdFlags['data'] || importCmdFlags['data-dir'] || config.data || (await (0, interactive_1.askContentDir)()));
25
25
  const pattern = /[*$%#<>{}!&?]/g;
26
26
  if (pattern.test(config.contentDir)) {
27
27
  cli_utilities_1.cliux.print(`\nPlease add a directory path without any of the special characters: (*,&,{,},[,],$,%,<,>,?,!)`, {
28
28
  color: 'yellow',
29
29
  });
30
- config.contentDir = await (0, interactive_1.askContentDir)();
30
+ config.contentDir = (0, cli_utilities_1.sanitizePath)(await (0, interactive_1.askContentDir)());
31
31
  }
32
32
  config.contentDir = config.contentDir.replace(/['"]/g, '');
33
33
  config.contentDir = path.resolve(config.contentDir);
@@ -22,7 +22,10 @@ function returnString(args) {
22
22
  .map(function (item) {
23
23
  if (item && typeof item === 'object') {
24
24
  try {
25
- return JSON.stringify(item).replace(/authtoken\":\d"blt................/g, 'authtoken":"blt....');
25
+ const redactedObject = (0, cli_utilities_1.redactObject)(item);
26
+ if (redactedObject && typeof redactedObject === 'object') {
27
+ return JSON.stringify(redactedObject);
28
+ }
26
29
  }
27
30
  catch (error) { }
28
31
  return item;
@@ -122,7 +125,7 @@ function init(_logPath) {
122
125
  };
123
126
  }
124
127
  const log = async (config, message, type) => {
125
- config.cliLogsPath = config.cliLogsPath || config.data || path.join(__dirname, 'logs');
128
+ config.cliLogsPath = (0, cli_utilities_1.sanitizePath)(config.cliLogsPath || config.data || path.join(__dirname, 'logs'));
126
129
  // ignoring the type argument, as we are not using it to create a logfile anymore
127
130
  if (type !== 'error') {
128
131
  // removed type argument from init method
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.20.0",
2
+ "version": "1.20.2",
3
3
  "commands": {
4
4
  "cm:stacks:import": {
5
5
  "id": "cm:stacks:import",
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": "1.20.0",
4
+ "version": "1.20.2",
5
5
  "author": "Contentstack",
6
6
  "bugs": "https://github.com/contentstack/cli/issues",
7
7
  "dependencies": {
8
- "@contentstack/cli-audit": "~1.8.0",
8
+ "@contentstack/cli-audit": "~1.10.0",
9
9
  "@contentstack/cli-command": "~1.3.3",
10
- "@contentstack/cli-utilities": "~1.8.4",
10
+ "@contentstack/cli-utilities": "~1.9.0",
11
11
  "@contentstack/management": "~1.18.4",
12
- "@contentstack/cli-variants": "~1.1.5",
12
+ "@contentstack/cli-variants": "~1.1.6",
13
13
  "@oclif/core": "^3.27.0",
14
14
  "big-json": "^3.2.0",
15
15
  "bluebird": "^3.7.2",