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