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

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.9",
3
+ "version": "1.4.0",
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": {
@@ -235,6 +235,8 @@ module.exports = ({ strapi }) => ({
235
235
  "checkedInInvestors",
236
236
  "checkedInVipGuests",
237
237
  "checkedInCorporates",
238
+ "wishlist",
239
+ "availableSlot",
238
240
  ];
239
241
  const SHORTCUT_FIELDS = [
240
242
  "email",
@@ -268,7 +270,7 @@ module.exports = ({ strapi }) => ({
268
270
  .filter(([key, definition]) => definition.type === "relation")
269
271
  .map(([key]) => key);
270
272
 
271
- const skipFields = Object.entries(attr)
273
+ const mediaFields = Object.entries(attr)
272
274
  .filter(([key, definition]) => definition.type === "media")
273
275
  .map(([key]) => key);
274
276
 
@@ -307,8 +309,7 @@ module.exports = ({ strapi }) => ({
307
309
  }
308
310
  if (SYSTEM_KEYS.includes(key)) continue;
309
311
  if (customFields.includes(key) && !ALLOWED_OBJECT_FIELDS.includes(key) && !ALLOWED_OBJECT_ARRAY_FIELDS.includes(key)) continue;
310
- if ([...skipFields, "wishlist", "availableSlot"].includes(key))
311
- continue;
312
+ if (mediaFields.includes(key)) continue;
312
313
 
313
314
  if (componentFields.includes(key)) {
314
315
  for (const subKey in value) {
@@ -302,12 +302,12 @@ module.exports = ({ strapi }) => ({
302
302
  const cleaned = {};
303
303
  for (const [key, attr] of Object.entries(schema.attributes)) {
304
304
  const value = data[key];
305
- if (value === undefined) continue;
306
-
307
305
  if ((!value || value === "") && attr.required) {
308
- cleaned[key] = undefined;
306
+ throw new Error(`Missing required field: ${key}`);
309
307
  }
310
308
 
309
+ if (value === undefined) continue;
310
+
311
311
  if (attr.type === 'component') {
312
312
  if (!value) {
313
313
  cleaned[key] = attr.repeatable ? [] : null;
@@ -423,8 +423,6 @@ module.exports = ({ strapi }) => ({
423
423
 
424
424
  data = this.sanitizeEntryBeforeWrite(data, contentType);
425
425
 
426
- console.log(data)
427
-
428
426
  if (existing) {
429
427
  await strapi.documents(contentType).update({
430
428
  documentId: existing.documentId,