adaptic-backend 1.0.287 → 1.0.289

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
@@ -32,26 +32,33 @@ var __importStar = (this && this.__importStar) || (function () {
32
32
  return result;
33
33
  };
34
34
  })();
35
- var __importDefault = (this && this.__importDefault) || function (mod) {
36
- return (mod && mod.__esModule) ? mod : { "default": mod };
37
- };
38
35
  Object.defineProperty(exports, "__esModule", { value: true });
39
36
  exports.split = exports.onError = exports.setContext = exports.HttpLink = exports.InMemoryCache = exports.gql = exports.ApolloError = exports.ApolloClient = exports.client = void 0;
40
37
  exports.getApolloClient = getApolloClient;
41
- // ==========================
42
- // 2. Static (Client-side) Imports
43
- // Use default import and destructuring so that CommonJS modules export correctly in ESM.
44
- // ==========================
38
+ // ====================================================
39
+ // 1. For Server-side: Create a require() function for ESM.
40
+ // ====================================================
41
+ const module_1 = require("module");
42
+ // If we're in a CommonJS environment, use the global require;
43
+ // otherwise (in an ES module) use createRequire(import.meta.url).
44
+ const requireFromESM = (typeof require !== "undefined")
45
+ ? require
46
+ // @ts-ignore
47
+ : (0, module_1.createRequire)(import.meta.url);
48
+ // ====================================================
49
+ // 3. Client-side Static Imports
50
+ // For the browser (client-side) we import from the standard ESM entry points.
51
+ // ====================================================
52
+ // Import the core module as a namespace to extract its members.
45
53
  const pkg = __importStar(require("@apollo/client"));
46
54
  const { ApolloClient: ApolloClientImported, InMemoryCache: InMemoryCacheImported, HttpLink: HttpLinkImported, gql: gqlImported, ApolloError: ApolloErrorImported, split: splitImported, } = pkg;
47
- const context_cjs_1 = __importDefault(require("@apollo/client/link/context/context.cjs"));
48
- const { setContext: setContextImported } = context_cjs_1.default;
49
- const error_cjs_1 = __importDefault(require("@apollo/client/link/error/error.cjs"));
50
- const { onError: onErrorImported } = error_cjs_1.default;
51
- // ==========================
52
- // 3. Declare Runtime Variables
53
- // These variables will eventually be assigned the proper implementations based on the runtime.
54
- // ==========================
55
+ // Import link utilities from their ESM paths.
56
+ const context_1 = require("@apollo/client/link/context");
57
+ const error_1 = require("@apollo/client/link/error");
58
+ // ====================================================
59
+ // 4. Declare Runtime Variables
60
+ // These variables will be assigned the proper implementations based on the runtime.
61
+ // ====================================================
55
62
  let ApolloClient;
56
63
  let ApolloError;
57
64
  let gql;
@@ -60,26 +67,27 @@ let HttpLink;
60
67
  let setContext;
61
68
  let onError;
62
69
  let split;
63
- // ==========================
64
- // 4. Environment Detection & Conditional Assignment
65
- // We check if we are in a server environment (including AWS Lambda)
66
- // ==========================
70
+ // ====================================================
71
+ // 5. Environment Detection & Conditional Assignment
72
+ // We check if we are in a server-like environment (including AWS Lambda).
73
+ // ====================================================
67
74
  const isLambda = Boolean(process.env.AWS_EXECUTION_ENV);
68
75
  const isServer = typeof window === "undefined";
69
76
  if (isServer || isLambda) {
70
77
  // --- Server-side (or AWS Lambda) ---
71
- // Use require() to load the modules synchronously at runtime.
72
- const pkg = require("@apollo/client");
78
+ // Use the require() function (created by createRequire) to load modules synchronously.
79
+ const pkg = requireFromESM("@apollo/client");
73
80
  exports.ApolloClient = ApolloClient = pkg.ApolloClient;
74
81
  exports.InMemoryCache = InMemoryCache = pkg.InMemoryCache;
75
82
  exports.HttpLink = HttpLink = pkg.HttpLink;
76
83
  exports.gql = gql = pkg.gql;
77
84
  exports.ApolloError = ApolloError = pkg.ApolloError;
78
85
  exports.split = split = pkg.split;
79
- // Load additional submodules.
80
- const contextPkg = require("@apollo/client/link/context/context.cjs");
86
+ // For the link utilities on the server, we can continue to load from the CommonJS files.
87
+ const contextPkg = requireFromESM("@apollo/client/link/context/context.cjs");
88
+ // (Note: if you prefer and if it’s supported in your version, you might also try the ESM path.)
81
89
  exports.setContext = setContext = contextPkg.setContext;
82
- const errorPkg = require("@apollo/client/link/error/error.cjs");
90
+ const errorPkg = requireFromESM("@apollo/client/link/error/error.cjs");
83
91
  exports.onError = onError = errorPkg.onError;
84
92
  }
85
93
  else {
@@ -90,13 +98,13 @@ else {
90
98
  exports.HttpLink = HttpLink = HttpLinkImported;
91
99
  exports.gql = gql = gqlImported;
92
100
  exports.ApolloError = ApolloError = ApolloErrorImported;
93
- exports.setContext = setContext = setContextImported;
94
- exports.onError = onError = onErrorImported;
101
+ exports.setContext = setContext = context_1.setContext;
102
+ exports.onError = onError = error_1.onError;
95
103
  exports.split = split = splitImported;
96
104
  }
97
- // ==========================
98
- // 5. Apollo Client Initialization & Singleton Pattern
99
- // ==========================
105
+ // ====================================================
106
+ // 6. Apollo Client Initialization & Singleton Pattern
107
+ // ====================================================
100
108
  let apolloClient = null;
101
109
  /**
102
110
  * Initializes a new Apollo Client instance.
@@ -146,8 +154,8 @@ function getApolloClient() {
146
154
  }
147
155
  return apolloClient;
148
156
  }
149
- // ==========================
150
- // 6. Exports
151
- // ==========================
157
+ // ====================================================
158
+ // 7. Exports
159
+ // ====================================================
152
160
  exports.client = getApolloClient();
153
161
  //# sourceMappingURL=client.js.map
package/client.d.ts CHANGED
@@ -1,10 +1,8 @@
1
1
  import type { ApolloClient as ApolloClientType, InMemoryCache as InMemoryCacheType, HttpLink as HttpLinkType, NormalizedCacheObject } from "@apollo/client";
2
2
  import * as pkg from "@apollo/client";
3
3
  declare const ApolloClientImported: typeof ApolloClientType, InMemoryCacheImported: typeof InMemoryCacheType, HttpLinkImported: typeof HttpLinkType, gqlImported: typeof pkg.gql, ApolloErrorImported: typeof pkg.ApolloError, splitImported: typeof pkg.ApolloLink.split;
4
- import contextPkg from "@apollo/client/link/context/context.cjs";
5
- declare const setContextImported: typeof contextPkg.setContext;
6
- import errorPkg from "@apollo/client/link/error/error.cjs";
7
- declare const onErrorImported: typeof errorPkg.onError;
4
+ import { setContext as setContextImported } from "@apollo/client/link/context";
5
+ import { onError as onErrorImported } from "@apollo/client/link/error";
8
6
  declare let ApolloClient: typeof ApolloClientImported;
9
7
  declare let ApolloError: typeof ApolloErrorImported;
10
8
  declare let gql: typeof gqlImported;
package/esm/client.d.ts CHANGED
@@ -1,10 +1,8 @@
1
1
  import type { ApolloClient as ApolloClientType, InMemoryCache as InMemoryCacheType, HttpLink as HttpLinkType, NormalizedCacheObject } from "@apollo/client";
2
2
  import * as pkg from "@apollo/client";
3
3
  declare const ApolloClientImported: typeof ApolloClientType, InMemoryCacheImported: typeof InMemoryCacheType, HttpLinkImported: typeof HttpLinkType, gqlImported: typeof pkg.gql, ApolloErrorImported: typeof pkg.ApolloError, splitImported: typeof pkg.ApolloLink.split;
4
- import contextPkg from "@apollo/client/link/context/context.cjs";
5
- declare const setContextImported: typeof contextPkg.setContext;
6
- import errorPkg from "@apollo/client/link/error/error.cjs";
7
- declare const onErrorImported: typeof errorPkg.onError;
4
+ import { setContext as setContextImported } from "@apollo/client/link/context";
5
+ import { onError as onErrorImported } from "@apollo/client/link/error";
8
6
  declare let ApolloClient: typeof ApolloClientImported;
9
7
  declare let ApolloError: typeof ApolloErrorImported;
10
8
  declare let gql: typeof gqlImported;
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,YAAY,IAAI,gBAAgB,EAChC,aAAa,IAAI,iBAAiB,EAClC,QAAQ,IAAI,YAAY,EACxB,qBAAqB,EACtB,MAAM,gBAAgB,CAAC;AAMxB,OAAO,KAAK,GAAG,MAAM,gBAAgB,CAAC;AAEtC,QAAA,MACgB,oBAAoB,2BACnB,qBAAqB,4BAC1B,gBAAgB,uBACrB,WAAW,kBACH,mBAAmB,0BACzB,aAAa,6BACf,CAAC;AAER,OAAO,UAAU,MAAM,yCAAyC,CAAC;AACjE,QAAA,MAAoB,kBAAkB,8BAAe,CAAC;AAEtD,OAAO,QAAQ,MAAM,qCAAqC,CAAC;AAC3D,QAAA,MAAiB,eAAe,yBAAa,CAAC;AAM9C,QAAA,IAAI,YAAY,EAAE,OAAO,oBAAoB,CAAC;AAC9C,QAAA,IAAI,WAAW,EAAE,OAAO,mBAAmB,CAAC;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AAE;gBAC7C,UAAU,EAAE,YAAY;aACzB;SACF,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,kCAAkC;IAClC,MAAM,SAAS,GAAG,OAAO,CAAC,CAAC,EAAE,aAAa,EAAE,YAAY,EAAE,EAAE,EAAE;QAC5D,IAAI,aAAa,EAAE,CAAC;YAClB,aAAa,CAAC,OAAO,CAAC,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,EAAE,CACrD,OAAO,CAAC,KAAK,CACX,6BAA6B,OAAO,eAAe,SAAS,WAAW,IAAI,EAAE,CAC9E,CACF,CAAC;QACJ,CAAC;QACD,IAAI,YAAY,EAAE,CAAC;YACjB,OAAO,CAAC,KAAK,CAAC,oBAAoB,YAAY,EAAE,CAAC,CAAC;QACpD,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,sDAAsD;IACtD,OAAO,IAAI,YAAY,CAAC;QACtB,IAAI,EAAE,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;QACzD,KAAK,EAAE,IAAI,aAAa,EAAE;KAC3B,CAAC,CAAC;AACL,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,eAAe;IAC7B,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,YAAY,GAAG,gBAAgB,EAAE,CAAC;IACpC,CAAC;IACD,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,uDAAuD;AACvD,aAAa;AACb,uDAAuD;AACvD,MAAM,CAAC,MAAM,MAAM,GAAG,eAAe,EAAE,CAAC;AAExC,OAAO,EACL,YAAY,EACZ,WAAW,EACX,GAAG,EACH,aAAa,EACb,QAAQ,EACR,UAAU,EACV,OAAO,EACP,KAAK,GACN,CAAC"}
package/esm/client.mjs CHANGED
@@ -1,17 +1,27 @@
1
- // ==========================
2
- // 2. Static (Client-side) Imports
3
- // Use default import and destructuring so that CommonJS modules export correctly in ESM.
4
- // ==========================
1
+ // ====================================================
2
+ // 1. For Server-side: Create a require() function for ESM.
3
+ // ====================================================
4
+ import { createRequire } from "module";
5
+ // If we're in a CommonJS environment, use the global require;
6
+ // otherwise (in an ES module) use createRequire(import.meta.url).
7
+ const requireFromESM = (typeof require !== "undefined")
8
+ ? require
9
+ // @ts-ignore
10
+ : createRequire(import.meta.url);
11
+ // ====================================================
12
+ // 3. Client-side Static Imports
13
+ // For the browser (client-side) we import from the standard ESM entry points.
14
+ // ====================================================
15
+ // Import the core module as a namespace to extract its members.
5
16
  import * as pkg from "@apollo/client";
6
17
  const { ApolloClient: ApolloClientImported, InMemoryCache: InMemoryCacheImported, HttpLink: HttpLinkImported, gql: gqlImported, ApolloError: ApolloErrorImported, split: splitImported, } = pkg;
7
- import contextPkg from "@apollo/client/link/context/context.cjs";
8
- const { setContext: setContextImported } = contextPkg;
9
- import errorPkg from "@apollo/client/link/error/error.cjs";
10
- const { onError: onErrorImported } = errorPkg;
11
- // ==========================
12
- // 3. Declare Runtime Variables
13
- // These variables will eventually be assigned the proper implementations based on the runtime.
14
- // ==========================
18
+ // Import link utilities from their ESM paths.
19
+ import { setContext as setContextImported } from "@apollo/client/link/context";
20
+ import { onError as onErrorImported } from "@apollo/client/link/error";
21
+ // ====================================================
22
+ // 4. Declare Runtime Variables
23
+ // These variables will be assigned the proper implementations based on the runtime.
24
+ // ====================================================
15
25
  let ApolloClient;
16
26
  let ApolloError;
17
27
  let gql;
@@ -20,26 +30,27 @@ let HttpLink;
20
30
  let setContext;
21
31
  let onError;
22
32
  let split;
23
- // ==========================
24
- // 4. Environment Detection & Conditional Assignment
25
- // We check if we are in a server environment (including AWS Lambda)
26
- // ==========================
33
+ // ====================================================
34
+ // 5. Environment Detection & Conditional Assignment
35
+ // We check if we are in a server-like environment (including AWS Lambda).
36
+ // ====================================================
27
37
  const isLambda = Boolean(process.env.AWS_EXECUTION_ENV);
28
38
  const isServer = typeof window === "undefined";
29
39
  if (isServer || isLambda) {
30
40
  // --- Server-side (or AWS Lambda) ---
31
- // Use require() to load the modules synchronously at runtime.
32
- const pkg = require("@apollo/client");
41
+ // Use the require() function (created by createRequire) to load modules synchronously.
42
+ const pkg = requireFromESM("@apollo/client");
33
43
  ApolloClient = pkg.ApolloClient;
34
44
  InMemoryCache = pkg.InMemoryCache;
35
45
  HttpLink = pkg.HttpLink;
36
46
  gql = pkg.gql;
37
47
  ApolloError = pkg.ApolloError;
38
48
  split = pkg.split;
39
- // Load additional submodules.
40
- const contextPkg = require("@apollo/client/link/context/context.cjs");
49
+ // For the link utilities on the server, we can continue to load from the CommonJS files.
50
+ const contextPkg = requireFromESM("@apollo/client/link/context/context.cjs");
51
+ // (Note: if you prefer and if it’s supported in your version, you might also try the ESM path.)
41
52
  setContext = contextPkg.setContext;
42
- const errorPkg = require("@apollo/client/link/error/error.cjs");
53
+ const errorPkg = requireFromESM("@apollo/client/link/error/error.cjs");
43
54
  onError = errorPkg.onError;
44
55
  }
45
56
  else {
@@ -54,9 +65,9 @@ else {
54
65
  onError = onErrorImported;
55
66
  split = splitImported;
56
67
  }
57
- // ==========================
58
- // 5. Apollo Client Initialization & Singleton Pattern
59
- // ==========================
68
+ // ====================================================
69
+ // 6. Apollo Client Initialization & Singleton Pattern
70
+ // ====================================================
60
71
  let apolloClient = null;
61
72
  /**
62
73
  * Initializes a new Apollo Client instance.
@@ -106,10 +117,9 @@ export function getApolloClient() {
106
117
  }
107
118
  return apolloClient;
108
119
  }
109
- // ==========================
110
- // 6. Exports
111
- // ==========================
120
+ // ====================================================
121
+ // 7. Exports
122
+ // ====================================================
112
123
  export const client = getApolloClient();
113
- // Re-export runtime implementations for convenience.
114
124
  export { ApolloClient, ApolloError, gql, InMemoryCache, HttpLink, setContext, onError, split, };
115
125
  //# sourceMappingURL=client.js.map
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "adaptic-backend",
3
- "version": "1.0.287",
3
+ "version": "1.0.289",
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",
7
- "main": "index.js",
7
+ "main": "index.cjs",
8
8
  "module": "esm/index.mjs",
9
9
  "scripts": {
10
10
  "build": "tsc --declaration --emitDeclarationOnly"