@contentstack/cli-cm-import 1.15.7 → 1.15.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/1.15.
|
|
50
|
+
@contentstack/cli-cm-import/1.15.8 linux-x64 node-v18.20.3
|
|
51
51
|
$ csdx --help [COMMAND]
|
|
52
52
|
USAGE
|
|
53
53
|
$ csdx COMMAND
|
|
@@ -59,11 +59,14 @@ class ImportEnvironments extends base_class_1.default {
|
|
|
59
59
|
(0, utils_1.log)(this.importConfig, `Environment '${name}' imported successfully`, 'success');
|
|
60
60
|
utils_1.fsUtil.writeFile(this.envUidMapperPath, this.envUidMapper);
|
|
61
61
|
};
|
|
62
|
-
const onReject = ({ error, apiData }) => {
|
|
62
|
+
const onReject = async ({ error, apiData }) => {
|
|
63
63
|
var _a;
|
|
64
64
|
const err = (error === null || error === void 0 ? void 0 : error.message) ? JSON.parse(error.message) : error;
|
|
65
|
-
const { name } = apiData;
|
|
65
|
+
const { name, uid } = apiData;
|
|
66
66
|
if ((_a = err === null || err === void 0 ? void 0 : err.errors) === null || _a === void 0 ? void 0 : _a.name) {
|
|
67
|
+
const res = await this.getEnvDetails(name);
|
|
68
|
+
this.envUidMapper[uid] = (res === null || res === void 0 ? void 0 : res.uid) || ' ';
|
|
69
|
+
utils_1.fsUtil.writeFile(this.envUidMapperPath, this.envUidMapper);
|
|
67
70
|
(0, utils_1.log)(this.importConfig, `Environment '${name}' already exists`, 'info');
|
|
68
71
|
}
|
|
69
72
|
else {
|
|
@@ -101,5 +104,14 @@ class ImportEnvironments extends base_class_1.default {
|
|
|
101
104
|
}
|
|
102
105
|
return apiOptions;
|
|
103
106
|
}
|
|
107
|
+
async getEnvDetails(envName) {
|
|
108
|
+
return await this.stack
|
|
109
|
+
.environment(envName)
|
|
110
|
+
.fetch()
|
|
111
|
+
.then((data) => data)
|
|
112
|
+
.catch((error) => {
|
|
113
|
+
(0, utils_1.log)(this.importConfig, `Failed to fetch environment details. ${(0, utils_1.formatError)(error)}`, 'error');
|
|
114
|
+
});
|
|
115
|
+
}
|
|
104
116
|
}
|
|
105
117
|
exports.default = ImportEnvironments;
|
|
@@ -67,15 +67,22 @@ class ImportTaxonomies extends base_class_1.default {
|
|
|
67
67
|
const onReject = ({ error, apiData }) => {
|
|
68
68
|
var _a, _b, _c;
|
|
69
69
|
const taxonomyUID = (_a = apiData === null || apiData === void 0 ? void 0 : apiData.taxonomy) === null || _a === void 0 ? void 0 : _a.uid;
|
|
70
|
-
if ((error === null || error === void 0 ? void 0 : error.
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
if ((error === null || error === void 0 ? void 0 : error.status) === 409 && (error === null || error === void 0 ? void 0 : error.statusText) === 'Conflict') {
|
|
71
|
+
(0, utils_1.log)(this.importConfig, `Taxonomy '${taxonomyUID}' already exists!`, 'info');
|
|
72
|
+
this.createdTaxonomies[taxonomyUID] = apiData === null || apiData === void 0 ? void 0 : apiData.taxonomy;
|
|
73
|
+
this.createdTerms[taxonomyUID] = apiData === null || apiData === void 0 ? void 0 : apiData.terms;
|
|
73
74
|
}
|
|
74
75
|
else {
|
|
75
|
-
(0
|
|
76
|
+
if ((error === null || error === void 0 ? void 0 : error.errorMessage) || (error === null || error === void 0 ? void 0 : error.message)) {
|
|
77
|
+
const errorMsg = (error === null || error === void 0 ? void 0 : error.errorMessage) || ((_b = error === null || error === void 0 ? void 0 : error.errors) === null || _b === void 0 ? void 0 : _b.taxonomy) || ((_c = error === null || error === void 0 ? void 0 : error.errors) === null || _c === void 0 ? void 0 : _c.term) || (error === null || error === void 0 ? void 0 : error.message);
|
|
78
|
+
(0, utils_1.log)(this.importConfig, `Taxonomy '${taxonomyUID}' failed to be import! ${errorMsg}`, 'error');
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
(0, utils_1.log)(this.importConfig, `Taxonomy '${taxonomyUID}' failed to be import! ${(0, utils_1.formatError)(error)}`, 'error');
|
|
82
|
+
}
|
|
83
|
+
this.failedTaxonomies[taxonomyUID] = apiData === null || apiData === void 0 ? void 0 : apiData.taxonomy;
|
|
84
|
+
this.failedTerms[taxonomyUID] = apiData === null || apiData === void 0 ? void 0 : apiData.terms;
|
|
76
85
|
}
|
|
77
|
-
this.failedTaxonomies[taxonomyUID] = apiData === null || apiData === void 0 ? void 0 : apiData.taxonomy;
|
|
78
|
-
this.failedTerms[taxonomyUID] = apiData === null || apiData === void 0 ? void 0 : apiData.terms;
|
|
79
86
|
};
|
|
80
87
|
await this.makeConcurrentCall({
|
|
81
88
|
apiContent,
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED