@contentstack/cli-cm-branches 1.1.4 → 1.2.0
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
|
@@ -37,7 +37,7 @@ $ npm install -g @contentstack/cli-cm-branches
|
|
|
37
37
|
$ csdx COMMAND
|
|
38
38
|
running command...
|
|
39
39
|
$ csdx (--version)
|
|
40
|
-
@contentstack/cli-cm-branches/1.
|
|
40
|
+
@contentstack/cli-cm-branches/1.2.0 linux-x64 node-v18.20.4
|
|
41
41
|
$ csdx --help [COMMAND]
|
|
42
42
|
USAGE
|
|
43
43
|
$ csdx COMMAND
|
|
@@ -111,6 +111,13 @@ function entryCreateScript(contentType) {
|
|
|
111
111
|
findAssetIdsFromJsonRte(entry, schema);
|
|
112
112
|
parent.pop();
|
|
113
113
|
}
|
|
114
|
+
if (
|
|
115
|
+
schema[i].data_type === 'json' &&
|
|
116
|
+
schema[i].field_metadata.extension &&
|
|
117
|
+
schema[i].field_metadata.is_asset
|
|
118
|
+
) {
|
|
119
|
+
fetchAssetFromFileFields(parent,schema[i],entry);
|
|
120
|
+
}
|
|
114
121
|
if (
|
|
115
122
|
schema[i].data_type === 'text' &&
|
|
116
123
|
schema[i].field_metadata &&
|
|
@@ -124,43 +131,47 @@ function entryCreateScript(contentType) {
|
|
|
124
131
|
parent.pop();
|
|
125
132
|
}
|
|
126
133
|
if (schema[i].data_type === 'file') {
|
|
127
|
-
parent
|
|
128
|
-
let updatedEntry = entry;
|
|
129
|
-
for (let i = 0; i < parent.length; i++) {
|
|
130
|
-
updatedEntry = updatedEntry[parent[i]];
|
|
131
|
-
}
|
|
132
|
-
const imgDetails = updatedEntry;
|
|
133
|
-
if (schema[i].multiple) {
|
|
134
|
-
if (imgDetails && imgDetails.length) {
|
|
135
|
-
imgDetails.forEach((img) => {
|
|
136
|
-
const obj = {
|
|
137
|
-
uid: img.uid,
|
|
138
|
-
parent_uid: img.parent_uid,
|
|
139
|
-
description: img.description,
|
|
140
|
-
title: img.title,
|
|
141
|
-
filename: img.filename,
|
|
142
|
-
url: img.url,
|
|
143
|
-
};
|
|
144
|
-
cAssetDetails.push(obj);
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
} else {
|
|
148
|
-
if (imgDetails) {
|
|
149
|
-
const obj = {
|
|
150
|
-
uid: imgDetails.uid,
|
|
151
|
-
parent_uid: imgDetails.parent_uid,
|
|
152
|
-
description: imgDetails.description,
|
|
153
|
-
title: imgDetails.title,
|
|
154
|
-
filename: imgDetails.filename,
|
|
155
|
-
url: imgDetails.url,
|
|
156
|
-
};
|
|
157
|
-
cAssetDetails.push(obj);
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
parent.pop();
|
|
134
|
+
fetchAssetFromFileFields(parent,schema[i],entry);
|
|
161
135
|
}
|
|
162
136
|
}
|
|
163
137
|
};
|
|
138
|
+
|
|
139
|
+
function fetchAssetFromFileFields (parent, schema, entry) {
|
|
140
|
+
parent.push(schema.uid);
|
|
141
|
+
let updatedEntry = entry;
|
|
142
|
+
for (let i = 0; i < parent.length; i++) {
|
|
143
|
+
updatedEntry = updatedEntry[parent[i]];
|
|
144
|
+
}
|
|
145
|
+
const imgDetails = updatedEntry;
|
|
146
|
+
if (schema.multiple) {
|
|
147
|
+
if (imgDetails && imgDetails.length) {
|
|
148
|
+
imgDetails.forEach((img) => {
|
|
149
|
+
const obj = {
|
|
150
|
+
uid: img.uid,
|
|
151
|
+
parent_uid: img.parent_uid,
|
|
152
|
+
description: img.description,
|
|
153
|
+
title: img.title,
|
|
154
|
+
filename: img.filename,
|
|
155
|
+
url: img.url,
|
|
156
|
+
};
|
|
157
|
+
assetDetails.push(obj);
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
} else {
|
|
161
|
+
if (imgDetails) {
|
|
162
|
+
const obj = {
|
|
163
|
+
uid: imgDetails.uid,
|
|
164
|
+
parent_uid: imgDetails.parent_uid,
|
|
165
|
+
description: imgDetails.description,
|
|
166
|
+
title: imgDetails.title,
|
|
167
|
+
filename: imgDetails.filename,
|
|
168
|
+
url: imgDetails.url,
|
|
169
|
+
};
|
|
170
|
+
assetDetails.push(obj);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
parent.pop();
|
|
174
|
+
}
|
|
164
175
|
|
|
165
176
|
function findAssetIdsFromHtmlRte(entryObj, ctSchema) {
|
|
166
177
|
const regex = /<img asset_uid=\\"([^"]+)\\"/g;
|
|
@@ -133,6 +133,15 @@ function entryCreateUpdateScript(contentType) {
|
|
|
133
133
|
findAssetIdsFromJsonRte(entry, schema);
|
|
134
134
|
parent.pop();
|
|
135
135
|
}
|
|
136
|
+
|
|
137
|
+
if (
|
|
138
|
+
schema[i].data_type === 'json' &&
|
|
139
|
+
schema[i].field_metadata.extension &&
|
|
140
|
+
schema[i].field_metadata.is_asset
|
|
141
|
+
) {
|
|
142
|
+
fetchAssetFromFileFields(parent,schema[i],entry);
|
|
143
|
+
}
|
|
144
|
+
|
|
136
145
|
if (
|
|
137
146
|
schema[i].data_type === 'text' &&
|
|
138
147
|
schema[i].field_metadata &&
|
|
@@ -146,44 +155,47 @@ function entryCreateUpdateScript(contentType) {
|
|
|
146
155
|
parent.pop();
|
|
147
156
|
}
|
|
148
157
|
if (schema[i].data_type === 'file') {
|
|
149
|
-
parent
|
|
150
|
-
let updatedEntry = entry;
|
|
151
|
-
for (let i = 0; i < parent.length; i++) {
|
|
152
|
-
updatedEntry = updatedEntry[parent[i]];
|
|
153
|
-
}
|
|
154
|
-
const imgDetails = updatedEntry;
|
|
155
|
-
if (schema[i].multiple) {
|
|
156
|
-
if (imgDetails && imgDetails.length) {
|
|
157
|
-
imgDetails.forEach((img) => {
|
|
158
|
-
const obj = {
|
|
159
|
-
uid: img.uid,
|
|
160
|
-
parent_uid: img.parent_uid,
|
|
161
|
-
description: img.description,
|
|
162
|
-
title: img.title,
|
|
163
|
-
filename: img.filename,
|
|
164
|
-
url: img.url,
|
|
165
|
-
};
|
|
166
|
-
assetDetails.push(obj);
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
} else {
|
|
170
|
-
if (imgDetails) {
|
|
171
|
-
const obj = {
|
|
172
|
-
uid: imgDetails.uid,
|
|
173
|
-
parent_uid: imgDetails.parent_uid,
|
|
174
|
-
description: imgDetails.description,
|
|
175
|
-
title: imgDetails.title,
|
|
176
|
-
filename: imgDetails.filename,
|
|
177
|
-
url: imgDetails.url,
|
|
178
|
-
};
|
|
179
|
-
assetDetails.push(obj);
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
parent.pop();
|
|
158
|
+
fetchAssetFromFileFields(parent,schema[i],entry);
|
|
183
159
|
}
|
|
184
160
|
}
|
|
185
161
|
};
|
|
186
162
|
|
|
163
|
+
function fetchAssetFromFileFields (parent, schema, entry) {
|
|
164
|
+
parent.push(schema.uid);
|
|
165
|
+
let updatedEntry = entry;
|
|
166
|
+
for (let i = 0; i < parent.length; i++) {
|
|
167
|
+
updatedEntry = updatedEntry[parent[i]];
|
|
168
|
+
}
|
|
169
|
+
const imgDetails = updatedEntry;
|
|
170
|
+
if (schema.multiple) {
|
|
171
|
+
if (imgDetails && imgDetails.length) {
|
|
172
|
+
imgDetails.forEach((img) => {
|
|
173
|
+
const obj = {
|
|
174
|
+
uid: img.uid,
|
|
175
|
+
parent_uid: img.parent_uid,
|
|
176
|
+
description: img.description,
|
|
177
|
+
title: img.title,
|
|
178
|
+
filename: img.filename,
|
|
179
|
+
url: img.url,
|
|
180
|
+
};
|
|
181
|
+
assetDetails.push(obj);
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
} else {
|
|
185
|
+
if (imgDetails) {
|
|
186
|
+
const obj = {
|
|
187
|
+
uid: imgDetails.uid,
|
|
188
|
+
parent_uid: imgDetails.parent_uid,
|
|
189
|
+
description: imgDetails.description,
|
|
190
|
+
title: imgDetails.title,
|
|
191
|
+
filename: imgDetails.filename,
|
|
192
|
+
url: imgDetails.url,
|
|
193
|
+
};
|
|
194
|
+
assetDetails.push(obj);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
parent.pop();
|
|
198
|
+
}
|
|
187
199
|
function findAssetIdsFromHtmlRte(entryObj, ctSchema) {
|
|
188
200
|
const regex = /<img asset_uid=\\"([^"]+)\\"/g;
|
|
189
201
|
let match;
|
|
@@ -133,6 +133,13 @@ function entryUpdateScript(contentType) {
|
|
|
133
133
|
findAssetIdsFromJsonRte(entry, schema);
|
|
134
134
|
parent.pop();
|
|
135
135
|
}
|
|
136
|
+
if (
|
|
137
|
+
schema[i].data_type === 'json' &&
|
|
138
|
+
schema[i].field_metadata.extension &&
|
|
139
|
+
schema[i].field_metadata.is_asset
|
|
140
|
+
) {
|
|
141
|
+
fetchAssetFromFileFields(parent,schema[i],entry);
|
|
142
|
+
}
|
|
136
143
|
if (
|
|
137
144
|
schema[i].data_type === 'text' &&
|
|
138
145
|
schema[i].field_metadata &&
|
|
@@ -146,44 +153,48 @@ function entryUpdateScript(contentType) {
|
|
|
146
153
|
parent.pop();
|
|
147
154
|
}
|
|
148
155
|
if (schema[i].data_type === 'file') {
|
|
149
|
-
parent
|
|
150
|
-
let updatedEntry = entry;
|
|
151
|
-
for (let i = 0; i < parent.length; i++) {
|
|
152
|
-
updatedEntry = updatedEntry[parent[i]];
|
|
153
|
-
}
|
|
154
|
-
const imgDetails = updatedEntry;
|
|
155
|
-
if (schema[i].multiple) {
|
|
156
|
-
if (imgDetails && imgDetails.length) {
|
|
157
|
-
imgDetails.forEach((img) => {
|
|
158
|
-
const obj = {
|
|
159
|
-
uid: img.uid,
|
|
160
|
-
parent_uid: img.parent_uid,
|
|
161
|
-
description: img.description,
|
|
162
|
-
title: img.title,
|
|
163
|
-
filename: img.filename,
|
|
164
|
-
url: img.url,
|
|
165
|
-
};
|
|
166
|
-
assetDetails.push(obj);
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
} else {
|
|
170
|
-
if (imgDetails) {
|
|
171
|
-
const obj = {
|
|
172
|
-
uid: imgDetails.uid,
|
|
173
|
-
parent_uid: imgDetails.parent_uid,
|
|
174
|
-
description: imgDetails.description,
|
|
175
|
-
title: imgDetails.title,
|
|
176
|
-
filename: imgDetails.filename,
|
|
177
|
-
url: imgDetails.url,
|
|
178
|
-
};
|
|
179
|
-
assetDetails.push(obj);
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
parent.pop();
|
|
156
|
+
fetchAssetFromFileFields(parent,schema[i],entry);
|
|
183
157
|
}
|
|
184
158
|
}
|
|
185
159
|
};
|
|
186
|
-
|
|
160
|
+
|
|
161
|
+
function fetchAssetFromFileFields (parent, schema, entry) {
|
|
162
|
+
parent.push(schema.uid);
|
|
163
|
+
let updatedEntry = entry;
|
|
164
|
+
for (let i = 0; i < parent.length; i++) {
|
|
165
|
+
updatedEntry = updatedEntry[parent[i]];
|
|
166
|
+
}
|
|
167
|
+
const imgDetails = updatedEntry;
|
|
168
|
+
if (schema.multiple) {
|
|
169
|
+
if (imgDetails && imgDetails.length) {
|
|
170
|
+
imgDetails.forEach((img) => {
|
|
171
|
+
const obj = {
|
|
172
|
+
uid: img.uid,
|
|
173
|
+
parent_uid: img.parent_uid,
|
|
174
|
+
description: img.description,
|
|
175
|
+
title: img.title,
|
|
176
|
+
filename: img.filename,
|
|
177
|
+
url: img.url,
|
|
178
|
+
};
|
|
179
|
+
assetDetails.push(obj);
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
} else {
|
|
183
|
+
if (imgDetails) {
|
|
184
|
+
const obj = {
|
|
185
|
+
uid: imgDetails.uid,
|
|
186
|
+
parent_uid: imgDetails.parent_uid,
|
|
187
|
+
description: imgDetails.description,
|
|
188
|
+
title: imgDetails.title,
|
|
189
|
+
filename: imgDetails.filename,
|
|
190
|
+
url: imgDetails.url,
|
|
191
|
+
};
|
|
192
|
+
assetDetails.push(obj);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
parent.pop();
|
|
196
|
+
}
|
|
197
|
+
|
|
187
198
|
function findAssetIdsFromHtmlRte(entryObj, ctSchema) {
|
|
188
199
|
const regex = /<img asset_uid=\\"([^"]+)\\"/g;
|
|
189
200
|
let match;
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentstack/cli-cm-branches",
|
|
3
3
|
"description": "Contentstack CLI plugin to do branches operations",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.2.0",
|
|
5
5
|
"author": "Contentstack",
|
|
6
6
|
"bugs": "https://github.com/contentstack/cli/issues",
|
|
7
7
|
"dependencies": {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@contentstack/cli-auth": "~1.3.22",
|
|
29
|
-
"@contentstack/cli-config": "~1.
|
|
29
|
+
"@contentstack/cli-config": "~1.8.0",
|
|
30
30
|
"@contentstack/cli-dev-dependencies": "~1.2.4",
|
|
31
31
|
"@oclif/plugin-help": "^5.1.19",
|
|
32
32
|
"@oclif/test": "^2.5.6",
|