@contentstack/cli-cm-import 1.9.0 → 1.9.1

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.9.0 linux-x64 node-v18.18.0
50
+ @contentstack/cli-cm-import/1.9.1 linux-x64 node-v18.18.0
51
51
  $ csdx --help [COMMAND]
52
52
  USAGE
53
53
  $ csdx COMMAND
@@ -11,14 +11,12 @@ class ImportCommand extends cli_command_1.Command {
11
11
  // setup import config
12
12
  // initialize the importer
13
13
  // start import
14
- let contentDir;
15
14
  let backupDir;
16
15
  try {
17
16
  const { flags } = await this.parse(ImportCommand);
18
17
  let importConfig = await (0, utils_1.setupImportConfig)(flags);
19
18
  // Note setting host to create cma client
20
19
  importConfig.host = this.cmaHost;
21
- contentDir = importConfig.contentDir;
22
20
  backupDir = importConfig.backupDir;
23
21
  const managementAPIClient = await (0, cli_utilities_1.managementSDKClient)(importConfig);
24
22
  const moduleImporter = new import_1.ModuleImporter(managementAPIClient, importConfig);
@@ -23,7 +23,7 @@ class ModuleImporter {
23
23
  const httpClient = new cli_utilities_1.HttpClient({
24
24
  headers: { api_key: this.importConfig.apiKey, authorization: this.importConfig.management_token },
25
25
  });
26
- const { data } = await httpClient.post('https://api.contentstack.io/v3/locales', {
26
+ const { data } = await httpClient.post(`https://${this.importConfig.host}/v3/locales`, {
27
27
  locale: {
28
28
  name: 'English',
29
29
  code: 'en-us',
@@ -98,22 +98,11 @@ const sanitizeStack = (importConfig) => {
98
98
  };
99
99
  exports.sanitizeStack = sanitizeStack;
100
100
  const masterLocalDetails = (stackAPIClient) => {
101
- return new Promise((resolve, reject) => {
102
- const result = stackAPIClient.locale().query();
103
- result
104
- .find()
105
- .then((response) => {
106
- const masterLocalObj = response.items.filter((obj) => {
107
- if (obj.fallback_locale === null) {
108
- return obj;
109
- }
110
- });
111
- return resolve(masterLocalObj[0]);
112
- })
113
- .catch((error) => {
114
- return reject(error);
115
- });
116
- });
101
+ return stackAPIClient
102
+ .locale()
103
+ .query({ query: { fallback_locale: null } })
104
+ .find()
105
+ .then(({ items }) => items[0]);
117
106
  };
118
107
  exports.masterLocalDetails = masterLocalDetails;
119
108
  const field_rules_update = (importConfig, ctPath) => {
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.9.0",
2
+ "version": "1.9.1",
3
3
  "commands": {
4
4
  "cm:stacks:import": {
5
5
  "id": "cm:stacks:import",
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@contentstack/cli-cm-import",
3
3
  "description": "Contentstack CLI plugin to import content into stack",
4
- "version": "1.9.0",
4
+ "version": "1.9.1",
5
5
  "author": "Contentstack",
6
6
  "bugs": "https://github.com/contentstack/cli/issues",
7
7
  "dependencies": {
8
+ "@contentstack/cli-command": "~1.2.13",
9
+ "@contentstack/cli-utilities": "~1.5.3",
8
10
  "@contentstack/management": "~1.10.2",
9
- "@contentstack/cli-command": "~1.2.12",
10
- "@contentstack/cli-utilities": "~1.5.2",
11
11
  "@oclif/core": "^2.9.3",
12
12
  "big-json": "^3.2.0",
13
13
  "bluebird": "^3.7.2",