@adaptic/backend-legacy 0.0.70 → 0.0.71

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/client.cjs CHANGED
@@ -39,7 +39,7 @@ exports.configureConnectionPool = configureConnectionPool;
39
39
  exports.setTokenProvider = setTokenProvider;
40
40
  exports.getApolloClient = getApolloClient;
41
41
  exports.getApolloModules = getApolloModules;
42
- const logger_1 = require("./utils/logger");
42
+ const logger_1 = require("./utils/logger.cjs");
43
43
  const DEFAULT_POOL_CONFIG = {
44
44
  maxConcurrentOperations: 100, // Maximum concurrent operations to the database
45
45
  retryAttempts: 3, // Number of retry attempts for failed operations
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adaptic/backend-legacy",
3
- "version": "0.0.70",
3
+ "version": "0.0.71",
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",
@@ -20,6 +20,7 @@
20
20
  "esm/",
21
21
  "server/",
22
22
  "resolvers/",
23
+ "utils/",
23
24
  "*.d.ts",
24
25
  "*.js",
25
26
  "*.cjs",
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ /**
3
+ * Utils module index
4
+ * Re-exports utility functions for CRUD operations
5
+ *
6
+ * This file provides a utils/index.mjs export path for ESM imports
7
+ * from generated CRUD files that import from './utils/index.mjs'
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.removeUndefinedProps = removeUndefinedProps;
11
+ /**
12
+ * Recursively removes undefined and null properties from an object or array.
13
+ *
14
+ * This utility is called by generated CRUD functions to clean GraphQL variables
15
+ * before passing them to Apollo Client. The input objects contain Prisma-typed
16
+ * fields (Date, Decimal, bigint, JsonValue, nested relations, etc.) which cannot
17
+ * be enumerated exhaustively. The return value is used as Apollo OperationVariables.
18
+ *
19
+ * We use Record<string, unknown> for the parameter to accept all generated Prisma
20
+ * input shapes without needing to enumerate every possible field type.
21
+ */
22
+ function removeUndefinedProps(obj) {
23
+ if (Array.isArray(obj)) {
24
+ return obj
25
+ .map((item) => removeUndefinedProps(item))
26
+ .filter((item) => item !== undefined &&
27
+ item !== null &&
28
+ (typeof item !== 'object' ||
29
+ Object.keys(item).length > 0));
30
+ }
31
+ else if (typeof obj === 'object' &&
32
+ obj !== null &&
33
+ !(obj instanceof Date)) {
34
+ const record = obj;
35
+ return Object.keys(record).reduce((acc, key) => {
36
+ const value = record[key];
37
+ if (value !== undefined && value !== null) {
38
+ let cleanedValue;
39
+ if (key === 'where' &&
40
+ typeof value === 'object' &&
41
+ value !== null &&
42
+ !(value instanceof Date)) {
43
+ const whereObj = value;
44
+ if (Object.prototype.hasOwnProperty.call(whereObj, 'id') &&
45
+ whereObj.id !== undefined) {
46
+ // Retain only the 'id' field within 'where'
47
+ cleanedValue = {
48
+ id: removeUndefinedProps(whereObj.id),
49
+ };
50
+ }
51
+ else {
52
+ // Process 'where' object normally if 'id' is undefined or doesn't exist
53
+ cleanedValue = removeUndefinedProps(value);
54
+ }
55
+ }
56
+ else {
57
+ // Process other keys normally
58
+ cleanedValue = removeUndefinedProps(value);
59
+ }
60
+ if (cleanedValue !== undefined &&
61
+ cleanedValue !== null &&
62
+ (typeof cleanedValue !== 'object' ||
63
+ cleanedValue instanceof Date ||
64
+ Object.keys(cleanedValue).length > 0)) {
65
+ acc[key] = cleanedValue;
66
+ }
67
+ }
68
+ return acc;
69
+ }, {});
70
+ }
71
+ return obj !== undefined && obj !== null
72
+ ? obj
73
+ : undefined;
74
+ }
75
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Utils module index
3
+ * Re-exports utility functions for CRUD operations
4
+ *
5
+ * This file provides a utils/index.mjs export path for ESM imports
6
+ * from generated CRUD files that import from './utils/index.mjs'
7
+ */
8
+ /**
9
+ * Recursively removes undefined and null properties from an object or array.
10
+ *
11
+ * This utility is called by generated CRUD functions to clean GraphQL variables
12
+ * before passing them to Apollo Client. The input objects contain Prisma-typed
13
+ * fields (Date, Decimal, bigint, JsonValue, nested relations, etc.) which cannot
14
+ * be enumerated exhaustively. The return value is used as Apollo OperationVariables.
15
+ *
16
+ * We use Record<string, unknown> for the parameter to accept all generated Prisma
17
+ * input shapes without needing to enumerate every possible field type.
18
+ */
19
+ export declare function removeUndefinedProps(obj: Record<string, unknown> | Record<string, unknown>[] | unknown): Record<string, unknown> | undefined;
20
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;;;;;GAUG;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,CAmErC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAaH,oDAqEC;AAhFD;;;;;;;;;;GAUG;AACH,SAAgB,oBAAoB,CAClC,GAAkE;IAElE,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QACvB,OAAO,GAAG;aACP,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC;aACzC,MAAM,CACL,CAAC,IAAI,EAAE,EAAE,CACP,IAAI,KAAK,SAAS;YAClB,IAAI,KAAK,IAAI;YACb,CAAC,OAAO,IAAI,KAAK,QAAQ;gBACvB,MAAM,CAAC,IAAI,CAAC,IAA+B,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CACvB,CAAC;IAC5C,CAAC;SAAM,IACL,OAAO,GAAG,KAAK,QAAQ;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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"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.logger = void 0;
4
+ function formatLogEntry(level, service, message, meta) {
5
+ const entry = {
6
+ level,
7
+ message,
8
+ timestamp: new Date().toISOString(),
9
+ service,
10
+ ...meta,
11
+ };
12
+ return JSON.stringify(entry);
13
+ }
14
+ function createLogger(service) {
15
+ return {
16
+ info: (message, meta) => {
17
+ process.stdout.write(formatLogEntry('info', service, message, meta) + '\n');
18
+ },
19
+ warn: (message, meta) => {
20
+ process.stdout.write(formatLogEntry('warn', service, message, meta) + '\n');
21
+ },
22
+ error: (message, meta) => {
23
+ process.stderr.write(formatLogEntry('error', service, message, meta) + '\n');
24
+ },
25
+ debug: (message, meta) => {
26
+ process.stdout.write(formatLogEntry('debug', service, message, meta) + '\n');
27
+ },
28
+ };
29
+ }
30
+ exports.logger = createLogger('backend-legacy');
31
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1,9 @@
1
+ interface Logger {
2
+ info: (message: string, meta?: Record<string, unknown>) => void;
3
+ warn: (message: string, meta?: Record<string, unknown>) => void;
4
+ error: (message: string, meta?: Record<string, unknown>) => void;
5
+ debug: (message: string, meta?: Record<string, unknown>) => void;
6
+ }
7
+ export declare const logger: Logger;
8
+ export {};
9
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAUA,UAAU,MAAM;IACd,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IA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