@contentstack/cli-cm-import 1.15.4 → 1.15.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 +1 -1
- package/bin/dev.js +6 -0
- package/bin/run.js +7 -0
- package/lib/utils/asset-helper.js +19 -18
- package/oclif.manifest.json +1 -1
- package/package.json +5 -5
- package/bin/dev +0 -6
- package/bin/run +0 -6
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.5 linux-x64 node-v18.20.2
|
|
51
51
|
$ csdx --help [COMMAND]
|
|
52
52
|
USAGE
|
|
53
53
|
$ csdx COMMAND
|
package/bin/dev.js
ADDED
package/bin/run.js
ADDED
|
@@ -350,24 +350,24 @@ function findFileUrls(schema, _entry, assetUrls) {
|
|
|
350
350
|
}
|
|
351
351
|
}
|
|
352
352
|
}
|
|
353
|
-
function updateFileFields(
|
|
354
|
-
if (_.isPlainObject(
|
|
353
|
+
function updateFileFields(object, parent, pos, mappedAssetUids, matchedUids, unmatchedUids, mappedAssetUrls) {
|
|
354
|
+
if (_.isPlainObject(object) && _.has(object, 'filename') && _.has(object, 'uid')) {
|
|
355
355
|
if (typeof pos !== 'undefined') {
|
|
356
356
|
if (typeof pos === 'number' || typeof pos === 'string') {
|
|
357
357
|
const replacer = () => {
|
|
358
|
-
if (mappedAssetUids.hasOwnProperty(
|
|
359
|
-
parent[pos] = mappedAssetUids[
|
|
360
|
-
matchedUids.push(
|
|
358
|
+
if (mappedAssetUids.hasOwnProperty(object.uid)) {
|
|
359
|
+
parent[pos] = mappedAssetUids[object.uid];
|
|
360
|
+
matchedUids.push(object.uid);
|
|
361
361
|
}
|
|
362
362
|
else {
|
|
363
363
|
parent[pos] = '';
|
|
364
|
-
unmatchedUids.push(
|
|
364
|
+
unmatchedUids.push(object.uid);
|
|
365
365
|
}
|
|
366
366
|
};
|
|
367
367
|
if (parent.uid && mappedAssetUids[parent.uid]) {
|
|
368
368
|
parent.uid = mappedAssetUids[parent.uid];
|
|
369
369
|
}
|
|
370
|
-
if (
|
|
370
|
+
if (object &&
|
|
371
371
|
_.isObject(parent[pos]) &&
|
|
372
372
|
parent[pos].uid &&
|
|
373
373
|
parent[pos].url &&
|
|
@@ -379,11 +379,11 @@ function updateFileFields(objekt, parent, pos, mappedAssetUids, matchedUids, unm
|
|
|
379
379
|
parent._content_type_uid === 'sys_assets') {
|
|
380
380
|
parent = _.omit(parent, ['asset']);
|
|
381
381
|
}
|
|
382
|
-
if (
|
|
383
|
-
|
|
382
|
+
if (object.uid && mappedAssetUids && mappedAssetUids[object.uid]) {
|
|
383
|
+
object.uid = mappedAssetUids[object.uid];
|
|
384
384
|
}
|
|
385
|
-
if (
|
|
386
|
-
|
|
385
|
+
if (object.url && mappedAssetUrls && mappedAssetUrls[object.url]) {
|
|
386
|
+
object.url = mappedAssetUrls[object.url];
|
|
387
387
|
}
|
|
388
388
|
}
|
|
389
389
|
else {
|
|
@@ -392,13 +392,14 @@ function updateFileFields(objekt, parent, pos, mappedAssetUids, matchedUids, unm
|
|
|
392
392
|
}
|
|
393
393
|
}
|
|
394
394
|
}
|
|
395
|
-
else if (_.isPlainObject(
|
|
396
|
-
for (let key in
|
|
397
|
-
updateFileFields(
|
|
395
|
+
else if (_.isPlainObject(object)) {
|
|
396
|
+
for (let key in object)
|
|
397
|
+
updateFileFields(object[key], object, key, mappedAssetUids, matchedUids, unmatchedUids);
|
|
398
398
|
}
|
|
399
|
-
else if (_.isArray(
|
|
400
|
-
for (let i = 0; i <=
|
|
401
|
-
updateFileFields(
|
|
402
|
-
|
|
399
|
+
else if (_.isArray(object) && object.length) {
|
|
400
|
+
for (let i = 0; i <= object.length; i++)
|
|
401
|
+
updateFileFields(object[i], object, i, mappedAssetUids, matchedUids, unmatchedUids);
|
|
402
|
+
// No need for _.compact() since you want to keep zero values
|
|
403
|
+
parent[pos] = _.filter(object, (value) => value !== undefined && value !== null);
|
|
403
404
|
}
|
|
404
405
|
}
|
package/oclif.manifest.json
CHANGED
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.15.
|
|
4
|
+
"version": "1.15.5",
|
|
5
5
|
"author": "Contentstack",
|
|
6
6
|
"bugs": "https://github.com/contentstack/cli/issues",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@contentstack/cli-audit": "~1.6.
|
|
9
|
-
"@contentstack/cli-command": "~1.2.
|
|
10
|
-
"@contentstack/cli-utilities": "~1.6.
|
|
8
|
+
"@contentstack/cli-audit": "~1.6.1",
|
|
9
|
+
"@contentstack/cli-command": "~1.2.18",
|
|
10
|
+
"@contentstack/cli-utilities": "~1.6.1",
|
|
11
11
|
"@contentstack/management": "~1.15.3",
|
|
12
|
-
"@oclif/core": "^
|
|
12
|
+
"@oclif/core": "^3.26.5",
|
|
13
13
|
"big-json": "^3.2.0",
|
|
14
14
|
"bluebird": "^3.7.2",
|
|
15
15
|
"chalk": "^4.1.2",
|
package/bin/dev
DELETED