@adaptic/backend-legacy 0.0.1021 → 0.0.1022

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/esm/utils.d.ts CHANGED
@@ -1,5 +1,10 @@
1
1
  /**
2
- * Recursively removes undefined and null properties from an object or array.
2
+ * Recursively removes undefined properties from an object or array.
3
+ *
4
+ * Object properties whose value is `null` are PRESERVED. In a Prisma update an
5
+ * omitted field is left untouched while `{ set: null }` clears it, so dropping
6
+ * null would silently turn every "clear this field" into a no-op that still
7
+ * reports success.
3
8
  *
4
9
  * This utility is called by generated CRUD functions to clean GraphQL variables
5
10
  * before passing them to Apollo Client. The input objects contain Prisma-typed
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,OAAO,GACjE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAuDrC"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,OAAO,GACjE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAyErC"}
package/esm/utils.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,SAAS,aAAa,CAAC,KAAc;IACnC,IAAI,OAAO,KAAK,KAAK,QAAQ,I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AC5C,YAAY,GAAG;4BACb,EAAE,EAAE,oBAAoB,CAAC,QAAQ,CAAC,EAA6B,CAAC;yBACjE,CAAC;oBACJ,CAAC;yBAAM,CAAC;wBACN,wEAAwE;wBACxE,YAAY,GAAG,oBAAoB,CACjC,KAAgC,CACjC,CAAC;oBACJ,CAAC;gBACH,CAAC;qBAAM,CAAC;oBACN,8BAA8B;oBAC9B,YAAY,GAAG,oBAAoB,CAAC,KAAgC,CAAC,CAAC;gBACxE,CAAC;gBAED,IACE,YAAY,KAAK,SAAS;oBAC1B,YAAY,KAAK,IAAI;oBACrB,CAAC,CAAC,aAAa,CAAC,YAAY,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,EACtE,CAAC;oBACD,GAAG,CAAC,GAAG,CAAC,GAAG,YAAY,CAAC;gBAC1B,CAAC;YACH,CAAC;YAED,OAAO,GAAG,CAAC;QACb,CAAC,EAAE,EAAE,CAAC,CAAC;IACT,CAAC;IAED,OAAO,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,IAAI;QACtC,CAAC,CAAE,GAA+B;QAClC,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC"}
package/esm/utils.mjs CHANGED
@@ -9,7 +9,12 @@ function isPlainObject(value) {
9
9
  return proto === Object.prototype || proto === null;
10
10
  }
11
11
  /**
12
- * Recursively removes undefined and null properties from an object or array.
12
+ * Recursively removes undefined properties from an object or array.
13
+ *
14
+ * Object properties whose value is `null` are PRESERVED. In a Prisma update an
15
+ * omitted field is left untouched while `{ set: null }` clears it, so dropping
16
+ * null would silently turn every "clear this field" into a no-op that still
17
+ * reports success.
13
18
  *
14
19
  * This utility is called by generated CRUD functions to clean GraphQL variables
15
20
  * before passing them to Apollo Client. The input objects contain Prisma-typed
@@ -35,7 +40,24 @@ export function removeUndefinedProps(obj) {
35
40
  const record = obj;
36
41
  return Object.keys(record).reduce((acc, key) => {
37
42
  const value = record[key];
38
- if (value !== undefined && value !== null) {
43
+ // `null` is a VALUE and survives; only `undefined` is an absence.
44
+ //
45
+ // The two mean opposite things in a Prisma update: an omitted field is
46
+ // left alone, `{ set: null }` clears it. Treating them alike made
47
+ // clearing a nullable field impossible on every generated model —
48
+ // `update({ id, field: null })` returned the unchanged row with no error,
49
+ // because this function emptied `{ set: null }` to `{}` and the
50
+ // empty-object rule below then dropped the field entirely. A write that
51
+ // reports success while changing nothing is worse than one that fails.
52
+ //
53
+ // Short-circuited here rather than by relaxing the guards below, because
54
+ // those also govern array items and the scalar tail, where dropping null
55
+ // is long-standing behaviour this correction has no reason to disturb.
56
+ if (value === null) {
57
+ acc[key] = null;
58
+ return acc;
59
+ }
60
+ if (value !== undefined) {
39
61
  let cleanedValue;
40
62
  if (key === 'where' && isPlainObject(value)) {
41
63
  const whereObj = value;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adaptic/backend-legacy",
3
- "version": "0.0.1021",
3
+ "version": "0.0.1022",
4
4
  "description": "Backend executable CRUD functions with dynamic variables construction, and type definitions for the Adaptic AI platform.",
5
5
  "type": "module",
6
6
  "types": "index.d.ts",
package/utils.cjs CHANGED
@@ -12,7 +12,12 @@ function isPlainObject(value) {
12
12
  return proto === Object.prototype || proto === null;
13
13
  }
14
14
  /**
15
- * Recursively removes undefined and null properties from an object or array.
15
+ * Recursively removes undefined properties from an object or array.
16
+ *
17
+ * Object properties whose value is `null` are PRESERVED. In a Prisma update an
18
+ * omitted field is left untouched while `{ set: null }` clears it, so dropping
19
+ * null would silently turn every "clear this field" into a no-op that still
20
+ * reports success.
16
21
  *
17
22
  * This utility is called by generated CRUD functions to clean GraphQL variables
18
23
  * before passing them to Apollo Client. The input objects contain Prisma-typed
@@ -38,7 +43,24 @@ function removeUndefinedProps(obj) {
38
43
  const record = obj;
39
44
  return Object.keys(record).reduce((acc, key) => {
40
45
  const value = record[key];
41
- if (value !== undefined && value !== null) {
46
+ // `null` is a VALUE and survives; only `undefined` is an absence.
47
+ //
48
+ // The two mean opposite things in a Prisma update: an omitted field is
49
+ // left alone, `{ set: null }` clears it. Treating them alike made
50
+ // clearing a nullable field impossible on every generated model —
51
+ // `update({ id, field: null })` returned the unchanged row with no error,
52
+ // because this function emptied `{ set: null }` to `{}` and the
53
+ // empty-object rule below then dropped the field entirely. A write that
54
+ // reports success while changing nothing is worse than one that fails.
55
+ //
56
+ // Short-circuited here rather than by relaxing the guards below, because
57
+ // those also govern array items and the scalar tail, where dropping null
58
+ // is long-standing behaviour this correction has no reason to disturb.
59
+ if (value === null) {
60
+ acc[key] = null;
61
+ return acc;
62
+ }
63
+ if (value !== undefined) {
42
64
  let cleanedValue;
43
65
  if (key === 'where' && isPlainObject(value)) {
44
66
  const whereObj = value;
package/utils.d.ts CHANGED
@@ -1,5 +1,10 @@
1
1
  /**
2
- * Recursively removes undefined and null properties from an object or array.
2
+ * Recursively removes undefined properties from an object or array.
3
+ *
4
+ * Object properties whose value is `null` are PRESERVED. In a Prisma update an
5
+ * omitted field is left untouched while `{ set: null }` clears it, so dropping
6
+ * null would silently turn every "clear this field" into a no-op that still
7
+ * reports success.
3
8
  *
4
9
  * This utility is called by generated CRUD functions to clean GraphQL variables
5
10
  * before passing them to Apollo Client. The input objects contain Prisma-typed