From 2d3eb3b5597421761c73631a28971eeaebfa6207 Mon Sep 17 00:00:00 2001 From: Emiliano Sanchez Date: Fri, 15 Aug 2025 12:58:34 -0300 Subject: [PATCH 1/2] fix: apply client.registerAPIRequestMiddleware to SDK auth requests --- package-lock.json | 26 +++++++++++++++----------- package.json | 2 +- src/index.ts | 4 ++-- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/package-lock.json b/package-lock.json index 7f0d427..4ba9394 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@harnessio/ff-javascript-client-sdk", - "version": "1.31.0", + "version": "1.31.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@harnessio/ff-javascript-client-sdk", - "version": "1.31.0", + "version": "1.31.1", "license": "Apache-2.0", "dependencies": { "jwt-decode": "^3.1.2", @@ -1245,10 +1245,11 @@ "dev": true }, "node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", + "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", "dev": true, + "license": "MIT", "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -1955,10 +1956,11 @@ } }, "node_modules/filelist/node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", + "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", "dev": true, + "license": "MIT", "dependencies": { "balanced-match": "^1.0.0" } @@ -2001,14 +2003,16 @@ } }, "node_modules/form-data": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.2.tgz", - "integrity": "sha512-hGfm/slu0ZabnNt4oaRZ6uREyfCj6P4fT/n6A1rGV+Z0VdGXjfOhVUpkn6qVQONHGIFwmveGXyDs75+nr6FM8w==", + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.4.tgz", + "integrity": "sha512-KrGhL9Q4zjj0kiUt5OO4Mr/A/jlI2jDYs5eHBpYHPcBEVSiipAvn2Ko2HnPe20rmcuuvMHNdZFp+4IlGTMF0Ow==", "dev": true, + "license": "MIT", "dependencies": { "asynckit": "^0.4.0", "combined-stream": "^1.0.8", "es-set-tostringtag": "^2.1.0", + "hasown": "^2.0.2", "mime-types": "^2.1.12" }, "engines": { diff --git a/package.json b/package.json index 5ea67c3..8b9aed1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@harnessio/ff-javascript-client-sdk", - "version": "1.31.0", + "version": "1.31.1", "author": "Harness", "license": "Apache-2.0", "main": "dist/sdk.cjs.js", diff --git a/src/index.ts b/src/index.ts index 5c5477c..f73647e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -23,7 +23,7 @@ import { getVariation } from './variation' import Poller from './poller' import { createCacheIdSeed, getCache } from './cache' -const SDK_VERSION = '1.31.0' +const SDK_VERSION = '1.31.1' const SDK_INFO = `Javascript ${SDK_VERSION} Client` const METRICS_VALID_COUNT_INTERVAL = 500 const fetch = globalThis.fetch @@ -178,7 +178,7 @@ const initialize = (apiKey: string, target: Target, options?: Options): Result = } try { - const response = await fetch(url, requestOptions) + const response = await fetchWithMiddleware(url, requestOptions) if (!response.ok) { throw new Error(`${response.status}: ${response.statusText}`) From c87ac57832410e71a0959d57271c1303f7df85e1 Mon Sep 17 00:00:00 2001 From: Emiliano Sanchez Date: Sat, 16 Aug 2025 22:43:17 -0300 Subject: [PATCH 2/2] refactor: fix authRequestReadTimeout and debug comments in types.ts --- src/types.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/types.ts b/src/types.ts index 2c33cd2..f18f5e7 100644 --- a/src/types.ts +++ b/src/types.ts @@ -136,16 +136,16 @@ export interface Options { * @default false */ pollingEnabled?: boolean - /** - * Whether to enable debug logging. - * @default false - */ - authRequestReadTimeout?: number /** * The timeout in milliseconds for the authentication request to read the response. * If the request takes longer than this timeout, it will be aborted and the SDK will fail to initialize, and `ERROR_AUTH` and `ERROR` events will be emitted. * @default 0 (no timeout) */ + authRequestReadTimeout?: number + /** + * Whether to enable debug logging. + * @default false + */ debug?: boolean /** * Whether to enable caching.