adaptic-backend 1.0.31 → 1.0.32

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": "adaptic-backend",
3
- "version": "1.0.31",
3
+ "version": "1.0.32",
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",
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,CAsBlD"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,CAsClD"}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,oBAAoB,CAAC,GAAQ;IAC3C,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QACvB,OAAO,GAAG;aACP,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC;aACvC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,KAAK,SAAS,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACxE,CAAC;SAAM,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC;QACnD,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,GAAQ,EAAE,GAAG,EAAE,EAAE;YAC/C,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,C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AAG,KAAK,OAAO,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;oBACnE,IAAI,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,EAAE,KAAK,SAAS,EAAE,CAAC;wBACzD,4CAA4C;wBAC5C,YAAY,GAAG,EAAE,EAAE,EAAE,oBAAoB,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC;oBACxD,CAAC;yBAAM,CAAC;wBACN,wEAAwE;wBACxE,YAAY,GAAG,oBAAoB,CAAC,KAAK,CAAC,CAAC;oBAC7C,CAAC;gBACH,CAAC;qBAAM,CAAC;oBACN,8BAA8B;oBAC9B,YAAY,GAAG,oBAAoB,CAAC,KAAK,CAAC,CAAC;gBAC7C,CAAC;gBAED,IACE,YAAY,KAAK,SAAS;oBAC1B,CAAC,OAAO,YAAY,KAAK,QAAQ,IAAI,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,EAC1E,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,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC;AAC7C,CAAC"}
package/server/utils.mjs CHANGED
@@ -6,10 +6,25 @@ export function removeUndefinedProps(obj) {
6
6
  }
7
7
  else if (typeof obj === 'object' && obj !== null) {
8
8
  return Object.keys(obj).reduce((acc, key) => {
9
- const value = obj[key];
9
+ let value = obj[key];
10
10
  if (value !== undefined) {
11
- const cleanedValue = removeUndefinedProps(value);
12
- if (cleanedValue !== undefined && (typeof cleanedValue !== 'object' || Object.keys(cleanedValue).length > 0)) {
11
+ let cleanedValue;
12
+ if (key === 'where' && typeof value === 'object' && value !== null) {
13
+ if (value.hasOwnProperty('id') && value.id !== undefined) {
14
+ // Retain only the 'id' field within 'where'
15
+ cleanedValue = { id: removeUndefinedProps(value.id) };
16
+ }
17
+ else {
18
+ // Process 'where' object normally if 'id' is undefined or doesn't exist
19
+ cleanedValue = removeUndefinedProps(value);
20
+ }
21
+ }
22
+ else {
23
+ // Process other keys normally
24
+ cleanedValue = removeUndefinedProps(value);
25
+ }
26
+ if (cleanedValue !== undefined &&
27
+ (typeof cleanedValue !== 'object' || Object.keys(cleanedValue).length > 0)) {
13
28
  acc[key] = cleanedValue;
14
29
  }
15
30
  }
package/utils.js CHANGED
@@ -9,10 +9,25 @@ function removeUndefinedProps(obj) {
9
9
  }
10
10
  else if (typeof obj === 'object' && obj !== null) {
11
11
  return Object.keys(obj).reduce((acc, key) => {
12
- const value = obj[key];
12
+ let value = obj[key];
13
13
  if (value !== undefined) {
14
- const cleanedValue = removeUndefinedProps(value);
15
- if (cleanedValue !== undefined && (typeof cleanedValue !== 'object' || Object.keys(cleanedValue).length > 0)) {
14
+ let cleanedValue;
15
+ if (key === 'where' && typeof value === 'object' && value !== null) {
16
+ if (value.hasOwnProperty('id') && value.id !== undefined) {
17
+ // Retain only the 'id' field within 'where'
18
+ cleanedValue = { id: removeUndefinedProps(value.id) };
19
+ }
20
+ else {
21
+ // Process 'where' object normally if 'id' is undefined or doesn't exist
22
+ cleanedValue = removeUndefinedProps(value);
23
+ }
24
+ }
25
+ else {
26
+ // Process other keys normally
27
+ cleanedValue = removeUndefinedProps(value);
28
+ }
29
+ if (cleanedValue !== undefined &&
30
+ (typeof cleanedValue !== 'object' || Object.keys(cleanedValue).length > 0)) {
16
31
  acc[key] = cleanedValue;
17
32
  }
18
33
  }