@nkhang1902/strapi-plugin-export-import-clsx 1.3.8 → 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.8",
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,7 +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 || value === "") && attr.required) {
306
+ throw new Error(`Missing required field: ${key}`);
307
+ }
308
+
305
309
  if (value === undefined) continue;
310
+
306
311
  if (attr.type === 'component') {
307
312
  if (!value) {
308
313
  cleaned[key] = attr.repeatable ? [] : null;
@@ -418,8 +423,6 @@ module.exports = ({ strapi }) => ({
418
423
 
419
424
  data = this.sanitizeEntryBeforeWrite(data, contentType);
420
425
 
421
- console.log(data)
422
-
423
426
  if (existing) {
424
427
  await strapi.documents(contentType).update({
425
428
  documentId: existing.documentId,