@nkhang1902/strapi-plugin-export-import-clsx 1.3.6 → 1.3.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nkhang1902/strapi-plugin-export-import-clsx",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.8",
|
|
4
4
|
"description": "A powerful Strapi plugin for exporting and importing data with Excel support and advanced filtering",
|
|
5
5
|
"main": "./strapi-server.js",
|
|
6
6
|
"scripts": {
|
|
@@ -89,7 +89,7 @@ module.exports = ({ strapi }) => ({
|
|
|
89
89
|
}
|
|
90
90
|
const worksheet = workbook.Sheets[sheetName];
|
|
91
91
|
const rows = XLSX.utils.sheet_to_json(worksheet, {
|
|
92
|
-
defval:
|
|
92
|
+
defval: ""
|
|
93
93
|
});
|
|
94
94
|
|
|
95
95
|
if (!rows.length) return;
|
|
@@ -187,7 +187,7 @@ module.exports = ({ strapi }) => ({
|
|
|
187
187
|
}
|
|
188
188
|
|
|
189
189
|
// Excel explicitly empty → unlink
|
|
190
|
-
if (value === "") {
|
|
190
|
+
if (value === "" || value === null) {
|
|
191
191
|
if (relation === "manyToMany" || relation === "oneToMany") {
|
|
192
192
|
updatedEntry[field] = [];
|
|
193
193
|
} else {
|
|
@@ -213,9 +213,12 @@ module.exports = ({ strapi }) => ({
|
|
|
213
213
|
const processed = [];
|
|
214
214
|
|
|
215
215
|
for (const v of values) {
|
|
216
|
-
if (!v || v === "")
|
|
216
|
+
if (!v || v === "") {
|
|
217
|
+
processed.push(null);
|
|
218
|
+
continue;
|
|
219
|
+
}
|
|
217
220
|
const resolved = await resolveRelationValue(field, v, target, eventId);
|
|
218
|
-
|
|
221
|
+
processed.push(resolved);
|
|
219
222
|
}
|
|
220
223
|
|
|
221
224
|
updatedEntry[field] = Array.isArray(value) ? processed : processed[0];
|
|
@@ -299,15 +302,12 @@ module.exports = ({ strapi }) => ({
|
|
|
299
302
|
const cleaned = {};
|
|
300
303
|
for (const [key, attr] of Object.entries(schema.attributes)) {
|
|
301
304
|
const value = data[key];
|
|
302
|
-
|
|
303
305
|
if (value === undefined) continue;
|
|
304
|
-
|
|
305
306
|
if (attr.type === 'component') {
|
|
306
307
|
if (!value) {
|
|
307
308
|
cleaned[key] = attr.repeatable ? [] : null;
|
|
308
309
|
continue;
|
|
309
310
|
}
|
|
310
|
-
|
|
311
311
|
cleaned[key] = attr.repeatable
|
|
312
312
|
? value.map((v, i) =>
|
|
313
313
|
this.sanitizeComponent(v, attr.component)
|
|
@@ -315,10 +315,8 @@ module.exports = ({ strapi }) => ({
|
|
|
315
315
|
: this.sanitizeComponent(value, attr.component);
|
|
316
316
|
continue;
|
|
317
317
|
}
|
|
318
|
-
|
|
319
318
|
cleaned[key] = this.sanitizePrimitive(value, attr);
|
|
320
319
|
}
|
|
321
|
-
|
|
322
320
|
return cleaned;
|
|
323
321
|
},
|
|
324
322
|
|
|
@@ -420,6 +418,8 @@ module.exports = ({ strapi }) => ({
|
|
|
420
418
|
|
|
421
419
|
data = this.sanitizeEntryBeforeWrite(data, contentType);
|
|
422
420
|
|
|
421
|
+
console.log(data)
|
|
422
|
+
|
|
423
423
|
if (existing) {
|
|
424
424
|
await strapi.documents(contentType).update({
|
|
425
425
|
documentId: existing.documentId,
|