@nkhang1902/strapi-plugin-export-import-clsx 1.3.7 → 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.7",
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: null
92
+ defval: ""
93
93
  });
94
94
 
95
95
  if (!rows.length) return;
@@ -213,9 +213,12 @@ module.exports = ({ strapi }) => ({
213
213
  const processed = [];
214
214
 
215
215
  for (const v of values) {
216
- if (!v || v === "") continue;
216
+ if (!v || v === "") {
217
+ processed.push(null);
218
+ continue;
219
+ }
217
220
  const resolved = await resolveRelationValue(field, v, target, eventId);
218
- if (resolved) processed.push(resolved);
221
+ processed.push(resolved);
219
222
  }
220
223
 
221
224
  updatedEntry[field] = Array.isArray(value) ? processed : processed[0];
@@ -299,20 +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
- if (value === null && attr.required) {
306
- cleaned[key] = attr.default;
307
- continue;
308
- };
309
-
310
306
  if (attr.type === 'component') {
311
307
  if (!value) {
312
308
  cleaned[key] = attr.repeatable ? [] : null;
313
309
  continue;
314
310
  }
315
-
316
311
  cleaned[key] = attr.repeatable
317
312
  ? value.map((v, i) =>
318
313
  this.sanitizeComponent(v, attr.component)
@@ -320,10 +315,8 @@ module.exports = ({ strapi }) => ({
320
315
  : this.sanitizeComponent(value, attr.component);
321
316
  continue;
322
317
  }
323
-
324
318
  cleaned[key] = this.sanitizePrimitive(value, attr);
325
319
  }
326
-
327
320
  return cleaned;
328
321
  },
329
322
 
@@ -425,6 +418,8 @@ module.exports = ({ strapi }) => ({
425
418
 
426
419
  data = this.sanitizeEntryBeforeWrite(data, contentType);
427
420
 
421
+ console.log(data)
422
+
428
423
  if (existing) {
429
424
  await strapi.documents(contentType).update({
430
425
  documentId: existing.documentId,