@nestledjs/data-browser 1.0.2 → 1.0.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.
@@ -436,21 +436,28 @@ function processNestedObject(value, model) {
436
436
  return Object.keys(cleanedNested).length > 0 ? cleanedNested : null;
437
437
  }
438
438
  function cleanFormInput(input, model) {
439
- var _a, _b, _c;
439
+ var _a, _b, _c, _d, _e;
440
440
  const cleaned = {};
441
441
  const booleanFields = new Set(
442
442
  ((_b = (_a = model == null ? void 0 : model.fields) == null ? void 0 : _a.filter((field) => field.type.toLowerCase() === "boolean")) == null ? void 0 : _b.map((field) => field.name)) || []
443
443
  );
444
+ const requiredArrayFields = new Set(
445
+ ((_d = (_c = model == null ? void 0 : model.fields) == null ? void 0 : _c.filter((field) => field.isList && !field.isOptional && !field.relationName)) == null ? void 0 : _d.map((field) => field.name)) || []
446
+ );
444
447
  for (const [key, value] of Object.entries(input)) {
445
448
  if (booleanFields.has(key) && value === void 0) {
446
449
  cleaned[key] = false;
447
450
  continue;
448
451
  }
452
+ if (requiredArrayFields.has(key) && (value === void 0 || value === null || value === "")) {
453
+ cleaned[key] = [];
454
+ continue;
455
+ }
449
456
  if (shouldSkipValue(key, value)) {
450
457
  continue;
451
458
  }
452
459
  if (typeof value === "string") {
453
- const field = (_c = model == null ? void 0 : model.fields) == null ? void 0 : _c.find((f) => f.name === key);
460
+ const field = (_e = model == null ? void 0 : model.fields) == null ? void 0 : _e.find((f) => f.name === key);
454
461
  const convertedValue = convertStringValue(value, field);
455
462
  cleaned[key] = convertedValue;
456
463
  continue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nestledjs/data-browser",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "Universal admin data browser for Nestled framework projects with full CRUD operations",
5
5
  "main": "./index.js",
6
6
  "module": "./index.js",
@@ -38,7 +38,7 @@
38
38
  "@apollo/client": "^4.0.0",
39
39
  "@heroicons/react": "^2.0.0",
40
40
  "@nestledjs/forms": "^0.5.0",
41
- "@nestledjs/shared-components": "^1.0.2",
41
+ "@nestledjs/shared-components": "^1.0.4",
42
42
  "react": "^19.0.0",
43
43
  "react-router": "^7.0.0"
44
44
  },