sdk-nave-nodejs 0.0.5 → 0.1.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.
package/CHANGELOG.md ADDED
@@ -0,0 +1,56 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented here.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.1.0] - 2026-06-19
9
+
10
+ This is a **breaking** release: the SDK no longer bundles `node-fetch` and now
11
+ relies on the runtime's built-in global `fetch`.
12
+
13
+ ### Changed
14
+
15
+ - **BREAKING:** Replaced `node-fetch@2` with Node's built-in global `fetch`
16
+ (undici). `node-fetch@2` is EOL and throws `FetchError: Premature close`
17
+ (`ERR_STREAM_PREMATURE_CLOSE`) on gzipped responses under Node 24.16+. The
18
+ global `fetch` works in both CommonJS and ESM consumers, so the package
19
+ stays CommonJS.
20
+ - **BREAKING:** Now requires **Node.js >= 18** (declared via `engines`), the
21
+ first release line with a stable global `fetch`.
22
+ - Transport failures are rethrown **unchanged** (still a
23
+ `TypeError: fetch failed` with the original `cause`), so callers can keep
24
+ classifying them by `error.cause.code`.
25
+
26
+ ### Added
27
+
28
+ - Per-request timeout via `AbortSignal.timeout`, configurable with the
29
+ `timeoutMs` constructor option (default `15000`).
30
+ - Automatic retry for **GET requests only** on transient transport errors,
31
+ configurable with the `maxRetries` constructor option (default `2`,
32
+ exponential backoff). Non-GET requests (e.g. `createOrder`) are never
33
+ retried, so a write cannot be duplicated.
34
+ - Token cache hardening in `ensureToken()`:
35
+ - `tokenRefreshBufferMs` constructor option (default `60000`) refreshes the
36
+ access token shortly before expiry to absorb clock skew / latency.
37
+ - Concurrent refreshes are coalesced into a single auth request (no
38
+ thundering herd); a failed refresh is not cached.
39
+ - `NAVE_DEBUG_CURL` environment variable: when set, a failed (non-ok) request
40
+ also logs a ready-to-run `curl` command (including auth) so it can be
41
+ replayed by hand. Off by default.
42
+
43
+ ### Security
44
+
45
+ - Resolved `pnpm audit` advisory **GHSA-g7r4-m6w7-qqqr** (esbuild < 0.28.1, a
46
+ dev-only transitive dependency) via a pinned override.
47
+
48
+ ### Development
49
+
50
+ - Switched the package manager from yarn to **pnpm** (`pnpm-lock.yaml`,
51
+ `packageManager` pin).
52
+ - Supply-chain hardening in `pnpm-workspace.yaml`: `minimumReleaseAge`,
53
+ `verifyDepsBeforeRun`, and an explicit build-script allowlist.
54
+ - Upgraded the dev toolchain: TypeScript 6, Biome 2, Vitest 4, @types/node 25.
55
+
56
+ [0.1.0]: https://github.com/emilioastarita/sdk-nave-nodejs/compare/v0.0.5...v0.1.0
package/README.md CHANGED
@@ -12,7 +12,7 @@ https://navenegocios.ar/
12
12
 
13
13
  ## Install
14
14
 
15
- Ensure you have Node.js v14 or later installed. Then, run the following command to install the SDK:
15
+ Ensure you have Node.js v18 or later installed. Then, run the following command to install the SDK:
16
16
 
17
17
 
18
18
  ```
@@ -90,9 +90,9 @@ file with your testing credentials at the root of the project.
90
90
  If you want to try it:
91
91
 
92
92
  1. Git clone this repo
93
- 2. Install deps: `yarn install`
93
+ 2. Install deps: `pnpm install`
94
94
  3. Provide the `.env` file copying the `.env.example` format
95
- 4. Run the suite `yarn run test`
95
+ 4. Run the suite `pnpm test`
96
96
 
97
97
 
98
98
 
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,iDAA8C;AAErC,2FAFA,uBAAU,OAEA;AADnB,qDAAmC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,iDAA8C;AAGrC,2FAHA,uBAAU,OAGA;AADnB,qDAAmC"}
@@ -1,5 +1,16 @@
1
1
  import { BodyNaveCreateOrder, ResponseNaveCancelOrder, ResponseNaveCreateOrder, ResponseNaveGetOrder, ResponseNaveToken } from './client-types';
2
+ type JSONValue = string | null | number | boolean | {
3
+ [key: string]: JSONValue;
4
+ } | Array<JSONValue>;
2
5
  export type Environment = 'production' | 'testing';
6
+ type NaveRequestOptions = {
7
+ method?: 'GET' | 'POST' | 'DELETE' | 'PUT';
8
+ path: string;
9
+ body?: JSONValue | unknown;
10
+ headers?: Record<string, string>;
11
+ newHeaders?: Record<string, string>;
12
+ baseUrl: string;
13
+ };
3
14
  export declare class NaveClient {
4
15
  private readonly headers;
5
16
  private baseUrls;
@@ -8,14 +19,21 @@ export declare class NaveClient {
8
19
  private audience;
9
20
  private storeId;
10
21
  private platform;
22
+ private timeoutMs;
23
+ private maxRetries;
24
+ private tokenRefreshBufferMs;
11
25
  private credentials;
12
- constructor({ audience, clientSecret, clientId, environment, storeId, platform, }: {
26
+ private tokenRefreshPromise;
27
+ constructor({ audience, clientSecret, clientId, environment, storeId, platform, timeoutMs, maxRetries, tokenRefreshBufferMs, }: {
13
28
  clientId: string;
14
29
  clientSecret: string;
15
30
  audience: string;
16
31
  environment?: Environment;
17
32
  storeId: string;
18
33
  platform: string;
34
+ timeoutMs?: number;
35
+ maxRetries?: number;
36
+ tokenRefreshBufferMs?: number;
19
37
  });
20
38
  fetchNewToken(cache?: boolean): Promise<ResponseNaveToken>;
21
39
  ensureToken(): Promise<ResponseNaveToken>;
@@ -23,5 +41,6 @@ export declare class NaveClient {
23
41
  getOrder(paymentRequestId: string): Promise<ResponseNaveGetOrder>;
24
42
  cancelOrder(paymentId: string): Promise<ResponseNaveCancelOrder>;
25
43
  private ecommerceRequest;
26
- private request;
44
+ request: <T>({ method, path, body, headers, newHeaders, baseUrl, }: NaveRequestOptions) => Promise<T>;
27
45
  }
46
+ export {};
@@ -1,10 +1,65 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.NaveClient = void 0;
7
- const node_fetch_1 = __importDefault(require("node-fetch"));
4
+ const TRANSIENT_CAUSE_CODES = new Set([
5
+ 'UND_ERR_SOCKET',
6
+ 'UND_ERR_CONNECT_TIMEOUT',
7
+ 'UND_ERR_REQ_CONTENT_LENGTH_MISMATCH',
8
+ 'ECONNRESET',
9
+ 'ECONNREFUSED',
10
+ 'ENOTFOUND',
11
+ 'EAI_AGAIN',
12
+ 'ETIMEDOUT',
13
+ 'EPIPE',
14
+ ]);
15
+ const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
16
+ /**
17
+ * Detects transient transport failures from the global fetch (undici) that are
18
+ * safe to retry for idempotent requests. This inspects the raw error shape and
19
+ * never wraps it, so callers can still classify the original error themselves.
20
+ */
21
+ const isTransientTransportError = (error) => {
22
+ if (!(error instanceof Error)) {
23
+ return false;
24
+ }
25
+ // AbortSignal.timeout() firing surfaces as a TimeoutError; a manual abort as
26
+ // an AbortError. Both mean the request never completed -> safe to retry.
27
+ if (error.name === 'AbortError' || error.name === 'TimeoutError') {
28
+ return true;
29
+ }
30
+ if (error instanceof TypeError && error.message === 'fetch failed') {
31
+ const cause = error.cause;
32
+ if (cause instanceof Error) {
33
+ const code = cause.code;
34
+ if (typeof code === 'string' && TRANSIENT_CAUSE_CODES.has(code)) {
35
+ return true;
36
+ }
37
+ if (cause.message.includes('terminated') ||
38
+ cause.message.includes('other side closed')) {
39
+ return true;
40
+ }
41
+ }
42
+ }
43
+ return false;
44
+ };
45
+ // POSIX single-quote escaping so the value survives a copy-paste into a shell.
46
+ const shellQuote = (value) => `'${value.replace(/'/g, "'\\''")}'`;
47
+ /**
48
+ * Render a request as a runnable `curl` command for debugging failed calls.
49
+ * Gated by the NAVE_DEBUG_CURL env var (see `request`). NOTE: this includes
50
+ * the Authorization header verbatim so the command can be replayed as-is.
51
+ */
52
+ const toCurlCommand = (method, url, headers, body) => {
53
+ const parts = ['curl', '-X', method];
54
+ for (const [key, value] of Object.entries(headers)) {
55
+ parts.push('-H', shellQuote(`${key}: ${value}`));
56
+ }
57
+ if (body) {
58
+ parts.push('--data', shellQuote(body));
59
+ }
60
+ parts.push(shellQuote(url));
61
+ return parts.join(' ');
62
+ };
8
63
  const ENVIRONMENT_URLS = Object.freeze({
9
64
  production: {
10
65
  security: 'https://services.apinaranja.com',
@@ -23,11 +78,17 @@ class NaveClient {
23
78
  audience;
24
79
  storeId;
25
80
  platform;
81
+ timeoutMs;
82
+ maxRetries;
83
+ tokenRefreshBufferMs;
26
84
  credentials = {
27
85
  token: null,
28
86
  expires: 0,
29
87
  };
30
- constructor({ audience, clientSecret, clientId, environment = 'testing', storeId, platform, }) {
88
+ // Shared in-flight token fetch, so concurrent callers don't all hit the auth
89
+ // endpoint at once (thundering herd). Cleared once the fetch settles.
90
+ tokenRefreshPromise = null;
91
+ constructor({ audience, clientSecret, clientId, environment = 'testing', storeId, platform, timeoutMs = 15000, maxRetries = 2, tokenRefreshBufferMs = 60000, }) {
31
92
  this.baseUrls =
32
93
  environment === 'production'
33
94
  ? ENVIRONMENT_URLS.production
@@ -37,6 +98,9 @@ class NaveClient {
37
98
  this.clientId = clientId;
38
99
  this.storeId = storeId;
39
100
  this.platform = platform;
101
+ this.timeoutMs = timeoutMs;
102
+ this.maxRetries = maxRetries;
103
+ this.tokenRefreshBufferMs = tokenRefreshBufferMs;
40
104
  this.headers = {
41
105
  'Content-Type': 'application/json',
42
106
  };
@@ -55,12 +119,30 @@ class NaveClient {
55
119
  });
56
120
  }
57
121
  async ensureToken() {
58
- if (!this.credentials.token || this.credentials.expires < Date.now()) {
59
- this.credentials.token = await this.fetchNewToken();
60
- this.credentials.expires =
61
- Date.now() + this.credentials.token.expires_in * 1000;
122
+ // Refresh a bit before the real expiry (tokenRefreshBufferMs) to absorb
123
+ // clock skew and in-flight latency, so we never send a just-expired token.
124
+ if (this.credentials.token &&
125
+ this.credentials.expires - this.tokenRefreshBufferMs > Date.now()) {
126
+ return this.credentials.token;
62
127
  }
63
- return this.credentials.token;
128
+ // Coalesce concurrent refreshes onto a single fetch. The first caller
129
+ // creates the promise; the rest await the same one. Cleared on settle so a
130
+ // failed fetch doesn't get cached and the next call can retry.
131
+ if (!this.tokenRefreshPromise) {
132
+ this.tokenRefreshPromise = this.fetchNewToken()
133
+ .then((token) => {
134
+ this.credentials.token = token;
135
+ // expires_in is documented in seconds; Number() guards against the
136
+ // API returning it as a string.
137
+ this.credentials.expires =
138
+ Date.now() + Number(token.expires_in) * 1000;
139
+ return token;
140
+ })
141
+ .finally(() => {
142
+ this.tokenRefreshPromise = null;
143
+ });
144
+ }
145
+ return this.tokenRefreshPromise;
64
146
  }
65
147
  async createOrder(order) {
66
148
  return this.ecommerceRequest({
@@ -99,16 +181,41 @@ class NaveClient {
99
181
  const _headers = newHeaders
100
182
  ? newHeaders
101
183
  : { ...this.headers, ...headers };
102
- const res = await (0, node_fetch_1.default)(url, {
103
- method,
104
- headers: _headers,
105
- body: method !== 'GET' && body ? JSON.stringify(body) : undefined,
106
- });
107
- if (!res.ok) {
108
- console.log(`Error (${res.status}) fetching ${url} \nwith ${method} \n and Body: ${JSON.stringify(body)} \n and Headers: ${JSON.stringify(_headers)}`);
109
- throw new Error(await res.text());
184
+ const serializedBody = method !== 'GET' && body ? JSON.stringify(body) : undefined;
185
+ // Only idempotent GETs are retried. Retrying a POST (e.g. createOrder)
186
+ // could create duplicate orders, so non-GET runs a single attempt.
187
+ const maxAttempts = method === 'GET' ? this.maxRetries + 1 : 1;
188
+ for (let attempt = 0;; attempt++) {
189
+ try {
190
+ // A fresh timeout signal per attempt; AbortSignal.timeout fires once.
191
+ const res = await fetch(url, {
192
+ method,
193
+ headers: _headers,
194
+ body: serializedBody,
195
+ signal: AbortSignal.timeout(this.timeoutMs),
196
+ });
197
+ if (!res.ok) {
198
+ console.log(`Error (${res.status}) fetching ${url} \nwith ${method} \n and Body: ${JSON.stringify(body)} \n and Headers: ${JSON.stringify(_headers)}`);
199
+ // Set NAVE_DEBUG_CURL=1 to also print a ready-to-run curl command
200
+ // (includes auth) so the failing request can be replayed manually.
201
+ if (process.env.NAVE_DEBUG_CURL) {
202
+ console.log(`Reproduce with:\n${toCurlCommand(method, url, _headers, serializedBody)}`);
203
+ }
204
+ throw new Error(await res.text());
205
+ }
206
+ return (await res.json());
207
+ }
208
+ catch (error) {
209
+ const canRetry = attempt < maxAttempts - 1 && isTransientTransportError(error);
210
+ if (!canRetry) {
211
+ // Rethrow the ORIGINAL error untouched: the consuming backend
212
+ // classifies transport failures via `instanceof TypeError` and
213
+ // `error.cause.code`. Wrapping it would break that classification.
214
+ throw error;
215
+ }
216
+ await sleep(200 * 2 ** attempt);
217
+ }
110
218
  }
111
- return res.json();
112
219
  };
113
220
  }
114
221
  exports.NaveClient = NaveClient;
@@ -1 +1 @@
1
- {"version":3,"file":"NaveClient.js","sourceRoot":"","sources":["../../src/lib/NaveClient.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA+B;AAmB/B,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAC;IACrC,UAAU,EAAE;QACV,QAAQ,EAAE,iCAAiC;QAC3C,SAAS,EAAE,sBAAsB;KAClC;IACD,OAAO,EAAE;QACP,QAAQ,EAAE,qCAAqC;QAC/C,SAAS,EAAE,yBAAyB;KACrC;CACF,CAAC,CAAC;AAWH,MAAa,UAAU;IACJ,OAAO,GAA2B,EAAE,CAAC;IAC9C,QAAQ,CAAkC;IAC1C,QAAQ,CAAS;IACjB,YAAY,CAAS;IACrB,QAAQ,CAAS;IACjB,OAAO,CAAS;IAChB,QAAQ,CAAS;IACjB,WAAW,GAGf;QACF,KAAK,EAAE,IAAI;QACX,OAAO,EAAE,CAAC;KACX,CAAC;IAEF,YAAY,EACV,QAAQ,EACR,YAAY,EACZ,QAAQ,EACR,WAAW,GAAG,SAAS,EACvB,OAAO,EACP,QAAQ,GAQT;QACC,IAAI,CAAC,QAAQ;YACX,WAAW,KAAK,YAAY;gBAC1B,CAAC,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CAAC,EAAE,EAAE,CAAC;oBACZ,OAAO,CAAC,GAAG,CACT,UACE,GAAG,CAAC,MACN,cAAc,GAAG,WAAW,MAAM,iBAAiB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,oBAAoB,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,CACtH,CAAC;oBACF,kEAAkE;oBAClE,mEAAmE;oBACnE,IAAI,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,CAAC;wBAChC,OAAO,CAAC,GAAG,CACT,oBAAoB,aAAa,CAAC,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,cAAc,CAAC,EAAE,CAC3E,CAAC;oBACJ,CAAC;oBACD,MAAM,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;gBACpC,CAAC;gBAED,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAM,CAAC;YACjC,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,QAAQ,GACZ,OAAO,GAAG,WAAW,GAAG,CAAC,IAAI,yBAAyB,CAAC,KAAK,CAAC,CAAC;gBAChE,IAAI,CAAC,QAAQ,EAAE,CAAC;oBACd,8DAA8D;oBAC9D,+DAA+D;oBAC/D,mEAAmE;oBACnE,MAAM,KAAK,CAAC;gBACd,CAAC;gBACD,MAAM,KAAK,CAAC,GAAG,GAAG,CAAC,IAAI,OAAO,CAAC,CAAC;YAClC,CAAC;QACH,CAAC;IACH,CAAC,CAAC;CACH;AA3MD,gCA2MC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "sdk-nave-nodejs",
3
3
  "description": "Nave SDK for Node.js",
4
- "version": "0.0.5",
4
+ "version": "0.1.0",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "type": "commonjs",
@@ -9,14 +9,9 @@
9
9
  "files": [
10
10
  "dist",
11
11
  "README.md",
12
- "LICENCE"
12
+ "CHANGELOG.md",
13
+ "LICENSE"
13
14
  ],
14
- "scripts": {
15
- "test": "vitest run",
16
- "build": "tsc",
17
- "prepack": "yarn clean && yarn build",
18
- "clean": "rm -rf ./dist/*"
19
- },
20
15
  "author": "Emilio Astarita (https://github.com/emilioastarita/)",
21
16
  "repository": {
22
17
  "type": "git",
@@ -32,16 +27,20 @@
32
27
  "sdk",
33
28
  "integration"
34
29
  ],
35
- "dependencies": {
36
- "node-fetch": "^2.7.0"
30
+ "engines": {
31
+ "node": ">=18"
37
32
  },
38
33
  "devDependencies": {
39
- "@biomejs/biome": "^1.9.4",
34
+ "@biomejs/biome": "^2.5.0",
40
35
  "@total-typescript/tsconfig": "^1.0.4",
41
- "@types/node": "^22.13.14",
42
- "@types/node-fetch": "^2.6.12",
43
- "dotenv": "^16.4.7",
44
- "typescript": "^5.8.2",
45
- "vitest": "^3.1.1"
36
+ "@types/node": "^25.9.3",
37
+ "dotenv": "^17.4.2",
38
+ "typescript": "^6.0.3",
39
+ "vitest": "^4.1.9"
40
+ },
41
+ "scripts": {
42
+ "test": "vitest run",
43
+ "build": "tsc",
44
+ "clean": "rm -rf ./dist/*"
46
45
  }
47
- }
46
+ }