@contentstack/cli-cm-import 1.16.4 → 1.16.5

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.16.4 linux-x64 node-v18.20.4
50
+ @contentstack/cli-cm-import/1.16.5 linux-x64 node-v18.20.4
51
51
  $ csdx --help [COMMAND]
52
52
  USAGE
53
53
  $ csdx COMMAND
@@ -58,7 +58,7 @@ class ImportCustomRoles extends base_class_1.default {
58
58
  this.customRolesLocales = utils_1.fsUtil.readFile((0, node_path_1.join)(this.customRolesFolderPath, this.customRolesConfig.customRolesLocalesFileName), true);
59
59
  }
60
60
  else {
61
- (0, utils_1.log)(this.importConfig, `No such file or directory - '${this.customRolesFolderPath}'`, 'error');
61
+ (0, utils_1.log)(this.importConfig, `No custom-rules are found - '${this.customRolesFolderPath}'`, 'info');
62
62
  return;
63
63
  }
64
64
  //create webhooks in mapper directory
@@ -31,7 +31,7 @@ class ImportEnvironments extends base_class_1.default {
31
31
  this.environments = utils_1.fsUtil.readFile((0, node_path_1.join)(this.environmentsFolderPath, 'environments.json'), true);
32
32
  }
33
33
  else {
34
- (0, utils_1.log)(this.importConfig, `No such file or directory - '${this.environmentsFolderPath}'`, 'error');
34
+ (0, utils_1.log)(this.importConfig, `No Environments Found - '${this.environmentsFolderPath}'`, 'info');
35
35
  return;
36
36
  }
37
37
  await utils_1.fsUtil.makeDirectory(this.mapperDirPath);
@@ -35,7 +35,7 @@ class ImportExtensions extends base_class_1.default {
35
35
  this.extensions = utils_1.fsUtil.readFile((0, node_path_1.join)(this.extensionsFolderPath, 'extensions.json'), true);
36
36
  }
37
37
  else {
38
- (0, utils_1.log)(this.importConfig, `No such file or directory - '${this.extensionsFolderPath}'`, 'error');
38
+ (0, utils_1.log)(this.importConfig, `No Extensions Found - '${this.extensionsFolderPath}'`, 'info');
39
39
  return;
40
40
  }
41
41
  await utils_1.fsUtil.makeDirectory(this.mapperDirPath);
@@ -33,7 +33,7 @@ class Importlabels extends base_class_1.default {
33
33
  this.labels = utils_1.fsUtil.readFile((0, node_path_1.join)(this.labelsFolderPath, 'labels.json'), true);
34
34
  }
35
35
  else {
36
- (0, utils_1.log)(this.importConfig, `No such file or directory - '${this.labelsFolderPath}'`, 'error');
36
+ (0, utils_1.log)(this.importConfig, `No labels found - '${this.labelsFolderPath}'`, 'info');
37
37
  return;
38
38
  }
39
39
  //create labels in mapper directory
@@ -54,7 +54,7 @@ class Importlabels extends base_class_1.default {
54
54
  }
55
55
  async importlabels() {
56
56
  if (this.labels === undefined || (0, isEmpty_1.default)(this.labels)) {
57
- (0, utils_1.log)(this.importConfig, 'No Label Found', 'info');
57
+ (0, utils_1.log)(this.importConfig, 'No Labels Found', 'info');
58
58
  return;
59
59
  }
60
60
  const apiContent = (0, values_1.default)(this.labels);
@@ -40,7 +40,7 @@ class ImportMarketplaceApps {
40
40
  this.marketplaceApps = utils_1.fsUtil.readFile((0, node_path_1.join)(this.marketPlaceFolderPath, this.marketPlaceAppConfig.fileName), true);
41
41
  }
42
42
  else {
43
- (0, utils_1.log)(this.importConfig, `No such file or directory - '${this.marketPlaceFolderPath}'`, 'error');
43
+ (0, utils_1.log)(this.importConfig, `No Marketplace apps are found - '${this.marketPlaceFolderPath}'`, 'info');
44
44
  return;
45
45
  }
46
46
  if ((0, isEmpty_1.default)(this.marketplaceApps)) {
@@ -33,7 +33,7 @@ class ImportTaxonomies extends base_class_1.default {
33
33
  this.taxonomies = utils_1.fsUtil.readFile((0, node_path_1.join)(this.taxonomiesFolderPath, 'taxonomies.json'), true);
34
34
  }
35
35
  else {
36
- (0, utils_1.log)(this.importConfig, `No such file or directory - '${this.taxonomiesFolderPath}'`, 'error');
36
+ (0, utils_1.log)(this.importConfig, `No Taxonomies Found! - '${this.taxonomiesFolderPath}'`, 'info');
37
37
  return;
38
38
  }
39
39
  //Step 2 create taxonomies & terms mapper directory
@@ -32,7 +32,7 @@ class ImportWebhooks extends base_class_1.default {
32
32
  this.webhooks = utils_1.fsUtil.readFile((0, node_path_1.join)(this.webhooksFolderPath, 'webhooks.json'), true);
33
33
  }
34
34
  else {
35
- (0, utils_1.log)(this.importConfig, `No such file or directory - '${this.webhooksFolderPath}'`, 'error');
35
+ (0, utils_1.log)(this.importConfig, `No Webhooks Found - '${this.webhooksFolderPath}'`, 'info');
36
36
  return;
37
37
  }
38
38
  //create webhooks in mapper directory
@@ -39,7 +39,7 @@ class ImportWorkflows extends base_class_1.default {
39
39
  this.workflows = utils_1.fsUtil.readFile((0, node_path_1.join)(this.workflowsFolderPath, this.workflowsConfig.fileName), true);
40
40
  }
41
41
  else {
42
- (0, utils_1.log)(this.importConfig, `No such file or directory - '${this.workflowsFolderPath}'`, 'error');
42
+ (0, utils_1.log)(this.importConfig, `No Workflows Found - '${this.workflowsFolderPath}'`, 'info');
43
43
  return;
44
44
  }
45
45
  //create workflows in mapper directory
@@ -237,11 +237,7 @@ const lookupAssets = function (data, mappedAssetUids, mappedAssetUrls, assetUidM
237
237
  assetUrls.forEach(function (assetUrl) {
238
238
  let mappedAssetUrl = mappedAssetUrls[assetUrl];
239
239
  if (typeof mappedAssetUrl !== 'undefined') {
240
- //NOTE - This code was added to resolve the SRE issue but once the code was merged Assets URLs in JSON RTE started breaking
241
- // const sanitizedUrl = escapeRegExp(assetUrl).replace(/\.\./g, '\\$&');
242
- // const escapedMappedUrl = escapeRegExp(mappedAssetUrl).replace(/\.\./g, '\\$&');
243
- // entry = entry.replace(new RegExp(sanitizedUrl, 'img'), escapedMappedUrl);
244
- entry = entry.replace(new RegExp(assetUrl, 'img'), mappedAssetUrl);
240
+ entry = entry.split(assetUrl).join(mappedAssetUrl);
245
241
  matchedUrls.push(mappedAssetUrl);
246
242
  }
247
243
  else {
@@ -252,12 +248,8 @@ const lookupAssets = function (data, mappedAssetUids, mappedAssetUrls, assetUidM
252
248
  let uid = mappedAssetUids[assetUid];
253
249
  if (typeof uid !== 'undefined') {
254
250
  const escapedAssetUid = assetUid.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
255
- const regex = new RegExp(`\\b${escapedAssetUid}\\b`, 'img');
256
- let { status } = (0, cli_utilities_1.validateRegex)(new RegExp(regex, 'img'));
257
- if (status === 'safe') {
258
- entry = entry.replace(regex, uid);
259
- matchedUids.push(assetUid);
260
- }
251
+ entry = entry.split(escapedAssetUid).join(uid);
252
+ matchedUids.push(assetUid);
261
253
  }
262
254
  else {
263
255
  unmatchedUids.push(assetUid);
@@ -86,7 +86,9 @@ const lookupEntries = function (data, mappedUids, uidMapperPath) {
86
86
  else {
87
87
  const key = _parent[j];
88
88
  if (Object.prototype.hasOwnProperty.call(_entry, key)) {
89
- _entry = _entry[key];
89
+ const tempEntry = Object.create(null);
90
+ _.merge(tempEntry, _entry);
91
+ _entry = tempEntry[key];
90
92
  let _keys = _.clone(_parent).splice(j + 1, len);
91
93
  if (Array.isArray(_entry)) {
92
94
  for (let i = 0, _i = _entry === null || _entry === void 0 ? void 0 : _entry.length; i < _i; i++) {
@@ -575,11 +577,10 @@ const restoreJsonRteEntryRefs = (entry, sourceStackEntry, ctSchema = [], { uidMa
575
577
  };
576
578
  exports.restoreJsonRteEntryRefs = restoreJsonRteEntryRefs;
577
579
  function updateUids(str, match, uidMapper) {
580
+ var _a;
578
581
  const sanitizedMatch = (0, cli_utilities_1.escapeRegExp)(match);
579
- const regex = new RegExp(`\\b${sanitizedMatch}\\b`, 'g');
580
- let { status } = (0, cli_utilities_1.validateRegex)(regex);
581
- if (status === 'safe')
582
- return str.replace(regex, (matchedString) => uidMapper[matchedString]);
582
+ const replacement = (_a = uidMapper[match]) !== null && _a !== void 0 ? _a : sanitizedMatch;
583
+ return str.split(sanitizedMatch).join(replacement);
583
584
  }
584
585
  function setDirtyTrue(jsonRteChild) {
585
586
  // also removing uids in this function
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.16.4",
2
+ "version": "1.16.5",
3
3
  "commands": {
4
4
  "cm:stacks:import": {
5
5
  "id": "cm:stacks:import",
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@contentstack/cli-cm-import",
3
3
  "description": "Contentstack CLI plugin to import content into stack",
4
- "version": "1.16.4",
4
+ "version": "1.16.5",
5
5
  "author": "Contentstack",
6
6
  "bugs": "https://github.com/contentstack/cli/issues",
7
7
  "dependencies": {
8
- "@contentstack/cli-audit": "~1.6.3",
8
+ "@contentstack/cli-audit": "~1.6.5",
9
9
  "@contentstack/cli-command": "~1.2.19",
10
- "@contentstack/cli-utilities": "~1.7.0",
11
- "@contentstack/management": "~1.15.3",
10
+ "@contentstack/cli-utilities": "~1.7.1",
11
+ "@contentstack/management": "~1.17.0",
12
12
  "@oclif/core": "^3.26.5",
13
13
  "big-json": "^3.2.0",
14
14
  "bluebird": "^3.7.2",