@nkhang1902/strapi-plugin-export-import-clsx 1.1.0 → 1.1.1

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.1.0",
3
+ "version": "1.1.1",
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": {
@@ -341,6 +341,36 @@ module.exports = ({ strapi }) => ({
341
341
  }
342
342
  },
343
343
 
344
+ sanitizeEntryBeforeWrite(data, uid, rowIndex, errors, path = '') {
345
+ const schema = strapi.contentTypes[uid];
346
+ const cleaned = {};
347
+
348
+ for (const [key, attr] of Object.entries(schema.attributes)) {
349
+ const value = data[key];
350
+ const fieldPath = path ? `${path}.${key}` : key;
351
+
352
+ if (value === undefined) continue;
353
+
354
+ if (attr.type === 'component') {
355
+ if (!value) {
356
+ cleaned[key] = attr.repeatable ? [] : null;
357
+ continue;
358
+ }
359
+
360
+ cleaned[key] = attr.repeatable
361
+ ? value.map((v, i) =>
362
+ sanitizeComponent(v, attr.component, rowIndex, errors, `${fieldPath}[${i}]`)
363
+ )
364
+ : sanitizeComponent(value, attr.component, rowIndex, errors, fieldPath);
365
+ continue;
366
+ }
367
+
368
+ cleaned[key] = sanitizePrimitive(value, attr, rowIndex, errors, fieldPath);
369
+ }
370
+
371
+ return cleaned;
372
+ },
373
+
344
374
  async bulkInsertData(importData) {
345
375
  const results = {
346
376
  created: 0,