@nestledjs/data-browser 1.0.3 → 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.
@@ -32,6 +32,5 @@ export declare function buildFormFields(sdk: any, model: DatabaseModel, operatio
32
32
  /**
33
33
  * Clean form input data for GraphQL mutations
34
34
  * Removes Apollo metadata and system fields
35
- * Handles Prisma array field update syntax
36
35
  */
37
36
  export declare function cleanFormInput(input: Record<string, unknown>, model?: DatabaseModel): Record<string, unknown>;
@@ -441,30 +441,19 @@ function cleanFormInput(input, model) {
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 arrayFields = new Map(
445
- ((_d = (_c = model == null ? void 0 : model.fields) == null ? void 0 : _c.filter((field) => field.isList && !field.relationName)) == null ? void 0 : _d.map((field) => [field.name, { isRequired: !field.isOptional }])) || []
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
446
  );
447
447
  for (const [key, value] of Object.entries(input)) {
448
448
  if (booleanFields.has(key) && value === void 0) {
449
449
  cleaned[key] = false;
450
450
  continue;
451
451
  }
452
- if (shouldSkipValue(key, value)) {
452
+ if (requiredArrayFields.has(key) && (value === void 0 || value === null || value === "")) {
453
+ cleaned[key] = [];
453
454
  continue;
454
455
  }
455
- const arrayFieldInfo = arrayFields.get(key);
456
- if (arrayFieldInfo) {
457
- if (value === null || value === "") {
458
- cleaned[key] = arrayFieldInfo.isRequired ? { set: [] } : null;
459
- continue;
460
- }
461
- let arrayValue;
462
- if (Array.isArray(value)) {
463
- arrayValue = value;
464
- } else {
465
- arrayValue = [value];
466
- }
467
- cleaned[key] = { set: arrayValue };
456
+ if (shouldSkipValue(key, value)) {
468
457
  continue;
469
458
  }
470
459
  if (typeof value === "string") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nestledjs/data-browser",
3
- "version": "1.0.3",
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.3",
41
+ "@nestledjs/shared-components": "^1.0.4",
42
42
  "react": "^19.0.0",
43
43
  "react-router": "^7.0.0"
44
44
  },