@zauru-sdk/services 6.12.0 → 6.13.0

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.
@@ -1,10 +1,34 @@
1
- import { AsyncLocalStorage } from "node:async_hooks";
2
1
  import { bindHttpClientPolicyRuntime, getHttpClientPolicy, httpTimeoutMsForClient, isRetryableHttpError, } from "@zauru-sdk/common";
3
- const als = new AsyncLocalStorage();
4
- bindHttpClientPolicyRuntime({
5
- get: () => als.getStore(),
6
- run: (policy, fn) => als.run(policy, fn),
7
- });
2
+ /**
3
+ * Bind Node ALS without a static `node:async_hooks` import. Vite's client
4
+ * bundle stubs that builtin as `__vite-browser-external` and fails named
5
+ * exports. `process.getBuiltinModule` is runtime-only (Node 20.16+/22+).
6
+ * Older Node and the browser keep common's fallback store.
7
+ */
8
+ function tryBindNodeAls() {
9
+ const processRef = globalThis.process;
10
+ if (!processRef?.versions?.node ||
11
+ typeof processRef.getBuiltinModule !== "function") {
12
+ return;
13
+ }
14
+ try {
15
+ const hooks = processRef.getBuiltinModule("async_hooks") ??
16
+ processRef.getBuiltinModule("node:async_hooks");
17
+ const AsyncLocalStorage = hooks?.AsyncLocalStorage;
18
+ if (!AsyncLocalStorage) {
19
+ return;
20
+ }
21
+ const als = new AsyncLocalStorage();
22
+ bindHttpClientPolicyRuntime({
23
+ get: () => als.getStore(),
24
+ run: (policy, fn) => als.run(policy, fn),
25
+ });
26
+ }
27
+ catch {
28
+ // Keep common's in-process fallback.
29
+ }
30
+ }
31
+ tryBindNodeAls();
8
32
  export function applyHttpClientTimeout(request, client) {
9
33
  if (request.timeout != null && request.timeout > 0) {
10
34
  return request;
@@ -12,6 +12,7 @@ export declare function getShipments(session: Session, config: {
12
12
  id_number_not_null?: boolean;
13
13
  id_number_not_empty?: boolean;
14
14
  withMovementLots?: boolean;
15
+ withMovements?: boolean;
15
16
  memoILike?: string;
16
17
  voided?: boolean;
17
18
  delivered?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zauru-sdk/services",
3
- "version": "6.12.0",
3
+ "version": "6.13.0",
4
4
  "description": "Servicios de consulta a Zauru",
5
5
  "main": "./dist/esm/index.js",
6
6
  "module": "./dist/esm/index.js",
@@ -13,7 +13,7 @@
13
13
  "scripts": {
14
14
  "build": "npm run build:esm",
15
15
  "build:esm": "tsc -p tsconfig.esm.json",
16
- "test": "echo \"Error: no test specified\" && exit 1"
16
+ "test": "tsx --test src/zauru/httpClientRuntime.test.ts"
17
17
  },
18
18
  "files": [
19
19
  "dist"
@@ -21,6 +21,7 @@
21
21
  "author": "Oscar Cuéllar",
22
22
  "license": "MIT",
23
23
  "devDependencies": {
24
+ "tsx": "^4.23.15",
24
25
  "typescript": "^5.1.6"
25
26
  },
26
27
  "dependencies": {
@@ -28,11 +29,11 @@
28
29
  "@upstash/redis": "^1.34.5",
29
30
  "@zauru-sdk/common": "^6.10.0",
30
31
  "@zauru-sdk/config": "^6.0.0",
31
- "@zauru-sdk/graphql": "^6.8.0",
32
+ "@zauru-sdk/graphql": "^6.9.0",
32
33
  "@zauru-sdk/types": "^6.24.0",
33
34
  "axios": "^1.6.7",
34
35
  "chalk": "5.3.0",
35
36
  "moment": "^2.30.1"
36
37
  },
37
- "gitHead": "8df8d97cb33e23e09198c617a95cffdff96cd05b"
38
+ "gitHead": "2daa677e6cd4948b23bfbf862929b4c74655e4e0"
38
39
  }