@nkhang1902/strapi-plugin-export-import-clsx 1.3.7 → 1.3.9

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.9",
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,17 @@ 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
306
 
305
- if (value === null && attr.required) {
306
- cleaned[key] = attr.default;
307
- continue;
308
- };
307
+ if ((!value || value === "") && attr.required) {
308
+ cleaned[key] = undefined;
309
+ }
309
310
 
310
311
  if (attr.type === 'component') {
311
312
  if (!value) {
312
313
  cleaned[key] = attr.repeatable ? [] : null;
313
314
  continue;
314
315
  }
315
-
316
316
  cleaned[key] = attr.repeatable
317
317
  ? value.map((v, i) =>
318
318
  this.sanitizeComponent(v, attr.component)
@@ -320,10 +320,8 @@ module.exports = ({ strapi }) => ({
320
320
  : this.sanitizeComponent(value, attr.component);
321
321
  continue;
322
322
  }
323
-
324
323
  cleaned[key] = this.sanitizePrimitive(value, attr);
325
324
  }
326
-
327
325
  return cleaned;
328
326
  },
329
327
 
@@ -425,6 +423,8 @@ module.exports = ({ strapi }) => ({
425
423
 
426
424
  data = this.sanitizeEntryBeforeWrite(data, contentType);
427
425
 
426
+ console.log(data)
427
+
428
428
  if (existing) {
429
429
  await strapi.documents(contentType).update({
430
430
  documentId: existing.documentId,