@nkhang1902/strapi-plugin-export-import-clsx 1.3.2 → 1.3.3
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.3",
|
|
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": {
|
|
@@ -270,7 +270,7 @@ module.exports = ({ strapi }) => ({
|
|
|
270
270
|
return data;
|
|
271
271
|
},
|
|
272
272
|
|
|
273
|
-
sanitizeComponent(data, uid
|
|
273
|
+
sanitizeComponent(data, uid) {
|
|
274
274
|
const schema = strapi.components[uid];
|
|
275
275
|
if (!schema) return data;
|
|
276
276
|
|
|
@@ -283,44 +283,43 @@ module.exports = ({ strapi }) => ({
|
|
|
283
283
|
if (attr.type === 'component') {
|
|
284
284
|
cleaned[key] = attr.repeatable
|
|
285
285
|
? (value || []).map((v, i) =>
|
|
286
|
-
this.sanitizeComponent(v, attr.component
|
|
286
|
+
this.sanitizeComponent(v, attr.component)
|
|
287
287
|
)
|
|
288
|
-
: this.sanitizeComponent(value, attr.component
|
|
288
|
+
: this.sanitizeComponent(value, attr.component);
|
|
289
289
|
} else {
|
|
290
|
-
cleaned[key] = this.sanitizePrimitive(value, attr
|
|
290
|
+
cleaned[key] = this.sanitizePrimitive(value, attr);
|
|
291
291
|
}
|
|
292
292
|
}
|
|
293
293
|
|
|
294
294
|
return cleaned;
|
|
295
295
|
},
|
|
296
296
|
|
|
297
|
-
sanitizeEntryBeforeWrite(data, uid
|
|
297
|
+
sanitizeEntryBeforeWrite(data, uid) {
|
|
298
298
|
const schema = strapi.contentTypes[uid];
|
|
299
299
|
const cleaned = {};
|
|
300
|
-
|
|
300
|
+
console.log('data', data);
|
|
301
301
|
for (const [key, attr] of Object.entries(schema.attributes)) {
|
|
302
302
|
const value = data[key];
|
|
303
|
-
|
|
304
|
-
|
|
303
|
+
|
|
305
304
|
if (value === undefined) continue;
|
|
306
|
-
|
|
305
|
+
|
|
307
306
|
if (attr.type === 'component') {
|
|
308
307
|
if (!value) {
|
|
309
308
|
cleaned[key] = attr.repeatable ? [] : null;
|
|
310
309
|
continue;
|
|
311
310
|
}
|
|
312
|
-
|
|
311
|
+
|
|
313
312
|
cleaned[key] = attr.repeatable
|
|
314
313
|
? value.map((v, i) =>
|
|
315
|
-
this.sanitizeComponent(v, attr.component
|
|
314
|
+
this.sanitizeComponent(v, attr.component)
|
|
316
315
|
)
|
|
317
|
-
: this.sanitizeComponent(value, attr.component
|
|
316
|
+
: this.sanitizeComponent(value, attr.component);
|
|
318
317
|
continue;
|
|
319
318
|
}
|
|
320
319
|
|
|
321
|
-
cleaned[key] = this.sanitizePrimitive(value, attr
|
|
320
|
+
cleaned[key] = this.sanitizePrimitive(value, attr);
|
|
322
321
|
}
|
|
323
|
-
|
|
322
|
+
|
|
324
323
|
return cleaned;
|
|
325
324
|
},
|
|
326
325
|
|
|
@@ -420,11 +419,7 @@ module.exports = ({ strapi }) => ({
|
|
|
420
419
|
data = await this.handleRelations(data, contentType, eventId);
|
|
421
420
|
data = await this.handleComponents(data, existing, contentType);
|
|
422
421
|
|
|
423
|
-
|
|
424
|
-
data = this.sanitizeEntryBeforeWrite(data, contentType, '', sanitizeErrors);
|
|
425
|
-
if (sanitizeErrors.length) {
|
|
426
|
-
throw new Error(sanitizeErrors.join('\n'));
|
|
427
|
-
}
|
|
422
|
+
data = this.sanitizeEntryBeforeWrite(data, contentType);
|
|
428
423
|
|
|
429
424
|
if (existing) {
|
|
430
425
|
await strapi.documents(contentType).update({
|