@nkhang1902/strapi-plugin-export-import-clsx 1.1.1 → 1.1.12
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.
|
|
3
|
+
"version": "1.1.12",
|
|
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": {
|
|
@@ -268,11 +268,11 @@ module.exports = ({ strapi }) => ({
|
|
|
268
268
|
if (attr.type === 'component') {
|
|
269
269
|
cleaned[key] = attr.repeatable
|
|
270
270
|
? (value || []).map((v, i) =>
|
|
271
|
-
sanitizeComponent(v, attr.component, rowIndex, errors, `${fieldPath}[${i}]`)
|
|
271
|
+
this.sanitizeComponent(v, attr.component, rowIndex, errors, `${fieldPath}[${i}]`)
|
|
272
272
|
)
|
|
273
|
-
: sanitizeComponent(value, attr.component, rowIndex, errors, fieldPath);
|
|
273
|
+
: this.sanitizeComponent(value, attr.component, rowIndex, errors, fieldPath);
|
|
274
274
|
} else {
|
|
275
|
-
cleaned[key] = sanitizePrimitive(value, attr, rowIndex, errors, fieldPath);
|
|
275
|
+
cleaned[key] = this.sanitizePrimitive(value, attr, rowIndex, errors, fieldPath);
|
|
276
276
|
}
|
|
277
277
|
}
|
|
278
278
|
|
|
@@ -297,13 +297,13 @@ module.exports = ({ strapi }) => ({
|
|
|
297
297
|
|
|
298
298
|
cleaned[key] = attr.repeatable
|
|
299
299
|
? value.map((v, i) =>
|
|
300
|
-
sanitizeComponent(v, attr.component, rowIndex, errors, `${fieldPath}[${i}]`)
|
|
300
|
+
this.sanitizeComponent(v, attr.component, rowIndex, errors, `${fieldPath}[${i}]`)
|
|
301
301
|
)
|
|
302
|
-
: sanitizeComponent(value, attr.component, rowIndex, errors, fieldPath);
|
|
302
|
+
: this.sanitizeComponent(value, attr.component, rowIndex, errors, fieldPath);
|
|
303
303
|
continue;
|
|
304
304
|
}
|
|
305
305
|
|
|
306
|
-
cleaned[key] = sanitizePrimitive(value, attr, rowIndex, errors, fieldPath);
|
|
306
|
+
cleaned[key] = this.sanitizePrimitive(value, attr, rowIndex, errors, fieldPath);
|
|
307
307
|
}
|
|
308
308
|
|
|
309
309
|
return cleaned;
|
|
@@ -341,36 +341,6 @@ 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
|
-
|
|
374
344
|
async bulkInsertData(importData) {
|
|
375
345
|
const results = {
|
|
376
346
|
created: 0,
|
|
@@ -436,7 +406,7 @@ module.exports = ({ strapi }) => ({
|
|
|
436
406
|
data = await this.handleRelations(data, contentType, trx);
|
|
437
407
|
data = await this.handleComponents(data, existing, contentType);
|
|
438
408
|
const sanitizeErrors = [];
|
|
439
|
-
data = sanitizeEntryBeforeWrite(data, contentType, '', sanitizeErrors);
|
|
409
|
+
data = this.sanitizeEntryBeforeWrite(data, contentType, '', sanitizeErrors);
|
|
440
410
|
|
|
441
411
|
if (sanitizeErrors.length) {
|
|
442
412
|
throw new Error(`Data validation failed:\n${sanitizeErrors.join('\n')}`);
|