@extrahorizon/javascript-sdk 8.14.2-dev-208-aa6da5c → 8.14.2-dev-211-13941b3
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 +3 -1
- package/build/index.cjs.js +14 -12
- package/build/index.mjs +14 -12
- package/build/types/version.d.ts +1 -1
- package/build/version.d.ts +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -8,7 +8,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
8
8
|
## [8.14.2]
|
|
9
9
|
|
|
10
10
|
### Fixed
|
|
11
|
-
- OAuth2 token refreshes are now shared between parallel requests
|
|
11
|
+
- OAuth2 token refreshes are now shared between parallel requests, no longer invalidating each other
|
|
12
|
+
- Response transformations are no longer applied twice to retried requests
|
|
13
|
+
- Retry handling no longer masks internally generated errors as `TypeError: Cannot destructure property 'retry' of 'config' as it is undefined`
|
|
12
14
|
|
|
13
15
|
## [8.14.1]
|
|
14
16
|
|
package/build/index.cjs.js
CHANGED
|
@@ -1752,11 +1752,13 @@ function typeReceivedError(error) {
|
|
|
1752
1752
|
}
|
|
1753
1753
|
|
|
1754
1754
|
const retryInterceptor = (axios) => async (error) => {
|
|
1755
|
+
if (!error || !error.isAxiosError || !error.config) {
|
|
1756
|
+
throw error;
|
|
1757
|
+
}
|
|
1755
1758
|
const { config } = error;
|
|
1756
1759
|
const { retry } = config;
|
|
1757
1760
|
// tries includes the initial try. So 5 tries equals 4 retries
|
|
1758
|
-
if ((
|
|
1759
|
-
(retry === null || retry === void 0 ? void 0 : retry.tries) > (retry === null || retry === void 0 ? void 0 : retry.current) &&
|
|
1761
|
+
if ((retry === null || retry === void 0 ? void 0 : retry.tries) > (retry === null || retry === void 0 ? void 0 : retry.current) &&
|
|
1760
1762
|
(retry === null || retry === void 0 ? void 0 : retry.retryCondition(error))) {
|
|
1761
1763
|
await delay(retry.retryTimeInMs);
|
|
1762
1764
|
return axios({
|
|
@@ -2235,11 +2237,11 @@ function createOAuth1HttpClient(http, options) {
|
|
|
2235
2237
|
{}),
|
|
2236
2238
|
},
|
|
2237
2239
|
}));
|
|
2238
|
-
httpWithAuth.interceptors.response.use(null, retryInterceptor(httpWithAuth));
|
|
2239
|
-
httpWithAuth.interceptors.response.use(null, typeReceivedErrorsInterceptor);
|
|
2240
2240
|
httpWithAuth.interceptors.response.use(camelizeResponseData);
|
|
2241
2241
|
httpWithAuth.interceptors.response.use(transformResponseData);
|
|
2242
2242
|
httpWithAuth.interceptors.response.use(transformKeysResponseData);
|
|
2243
|
+
httpWithAuth.interceptors.response.use(null, retryInterceptor(httpWithAuth));
|
|
2244
|
+
httpWithAuth.interceptors.response.use(null, typeReceivedErrorsInterceptor);
|
|
2243
2245
|
async function authenticate(data) {
|
|
2244
2246
|
// If the user has passed in a token/tokenSecret combination.
|
|
2245
2247
|
// Validate it against /users/me on the unauthenticated Axios client unless skipTokenCheck is true
|
|
@@ -2455,6 +2457,9 @@ function createOAuth2HttpClient(http, options) {
|
|
|
2455
2457
|
},
|
|
2456
2458
|
};
|
|
2457
2459
|
});
|
|
2460
|
+
httpWithAuth.interceptors.response.use(camelizeResponseData);
|
|
2461
|
+
httpWithAuth.interceptors.response.use(transformResponseData);
|
|
2462
|
+
httpWithAuth.interceptors.response.use(transformKeysResponseData);
|
|
2458
2463
|
httpWithAuth.interceptors.response.use(null, retryInterceptor(httpWithAuth));
|
|
2459
2464
|
// If we receive a expired/unknown access token error, refresh the tokens
|
|
2460
2465
|
httpWithAuth.interceptors.response.use(null, async (error) => {
|
|
@@ -2474,9 +2479,6 @@ function createOAuth2HttpClient(http, options) {
|
|
|
2474
2479
|
throw error;
|
|
2475
2480
|
});
|
|
2476
2481
|
httpWithAuth.interceptors.response.use(null, typeReceivedErrorsInterceptor);
|
|
2477
|
-
httpWithAuth.interceptors.response.use(camelizeResponseData);
|
|
2478
|
-
httpWithAuth.interceptors.response.use(transformResponseData);
|
|
2479
|
-
httpWithAuth.interceptors.response.use(transformKeysResponseData);
|
|
2480
2482
|
/**
|
|
2481
2483
|
* - Adds a creationTimestamp to the token
|
|
2482
2484
|
* - Notifies the user
|
|
@@ -2642,11 +2644,11 @@ function createProxyHttpClient(http, options) {
|
|
|
2642
2644
|
return Promise.reject(error);
|
|
2643
2645
|
});
|
|
2644
2646
|
}
|
|
2645
|
-
httpWithAuth.interceptors.response.use(null, retryInterceptor(httpWithAuth));
|
|
2646
|
-
httpWithAuth.interceptors.response.use(null, typeReceivedErrorsInterceptor);
|
|
2647
2647
|
httpWithAuth.interceptors.response.use(camelizeResponseData);
|
|
2648
2648
|
httpWithAuth.interceptors.response.use(transformResponseData);
|
|
2649
2649
|
httpWithAuth.interceptors.response.use(transformKeysResponseData);
|
|
2650
|
+
httpWithAuth.interceptors.response.use(null, retryInterceptor(httpWithAuth));
|
|
2651
|
+
httpWithAuth.interceptors.response.use(null, typeReceivedErrorsInterceptor);
|
|
2650
2652
|
async function logout() {
|
|
2651
2653
|
try {
|
|
2652
2654
|
await httpWithAuth.post('/logout');
|
|
@@ -2707,11 +2709,11 @@ function createHttpClient({ packageVersion, host, requestLogger, responseLogger,
|
|
|
2707
2709
|
return Promise.reject(error);
|
|
2708
2710
|
});
|
|
2709
2711
|
}
|
|
2710
|
-
http.interceptors.response.use(null, retryInterceptor(http));
|
|
2711
|
-
http.interceptors.response.use(null, typeReceivedErrorsInterceptor);
|
|
2712
2712
|
http.interceptors.response.use(camelizeResponseData);
|
|
2713
2713
|
http.interceptors.response.use(transformResponseData);
|
|
2714
2714
|
http.interceptors.response.use(transformKeysResponseData);
|
|
2715
|
+
http.interceptors.response.use(null, retryInterceptor(http));
|
|
2716
|
+
http.interceptors.response.use(null, typeReceivedErrorsInterceptor);
|
|
2715
2717
|
return http;
|
|
2716
2718
|
}
|
|
2717
2719
|
|
|
@@ -5781,7 +5783,7 @@ const templatesV2Service = (httpWithAuth) => {
|
|
|
5781
5783
|
};
|
|
5782
5784
|
};
|
|
5783
5785
|
|
|
5784
|
-
const version = '8.14.2-dev-
|
|
5786
|
+
const version = '8.14.2-dev-211-13941b3';
|
|
5785
5787
|
|
|
5786
5788
|
/**
|
|
5787
5789
|
* Create ExtraHorizon client.
|
package/build/index.mjs
CHANGED
|
@@ -1722,11 +1722,13 @@ function typeReceivedError(error) {
|
|
|
1722
1722
|
}
|
|
1723
1723
|
|
|
1724
1724
|
const retryInterceptor = (axios) => async (error) => {
|
|
1725
|
+
if (!error || !error.isAxiosError || !error.config) {
|
|
1726
|
+
throw error;
|
|
1727
|
+
}
|
|
1725
1728
|
const { config } = error;
|
|
1726
1729
|
const { retry } = config;
|
|
1727
1730
|
// tries includes the initial try. So 5 tries equals 4 retries
|
|
1728
|
-
if ((
|
|
1729
|
-
(retry === null || retry === void 0 ? void 0 : retry.tries) > (retry === null || retry === void 0 ? void 0 : retry.current) &&
|
|
1731
|
+
if ((retry === null || retry === void 0 ? void 0 : retry.tries) > (retry === null || retry === void 0 ? void 0 : retry.current) &&
|
|
1730
1732
|
(retry === null || retry === void 0 ? void 0 : retry.retryCondition(error))) {
|
|
1731
1733
|
await delay(retry.retryTimeInMs);
|
|
1732
1734
|
return axios({
|
|
@@ -2205,11 +2207,11 @@ function createOAuth1HttpClient(http, options) {
|
|
|
2205
2207
|
{}),
|
|
2206
2208
|
},
|
|
2207
2209
|
}));
|
|
2208
|
-
httpWithAuth.interceptors.response.use(null, retryInterceptor(httpWithAuth));
|
|
2209
|
-
httpWithAuth.interceptors.response.use(null, typeReceivedErrorsInterceptor);
|
|
2210
2210
|
httpWithAuth.interceptors.response.use(camelizeResponseData);
|
|
2211
2211
|
httpWithAuth.interceptors.response.use(transformResponseData);
|
|
2212
2212
|
httpWithAuth.interceptors.response.use(transformKeysResponseData);
|
|
2213
|
+
httpWithAuth.interceptors.response.use(null, retryInterceptor(httpWithAuth));
|
|
2214
|
+
httpWithAuth.interceptors.response.use(null, typeReceivedErrorsInterceptor);
|
|
2213
2215
|
async function authenticate(data) {
|
|
2214
2216
|
// If the user has passed in a token/tokenSecret combination.
|
|
2215
2217
|
// Validate it against /users/me on the unauthenticated Axios client unless skipTokenCheck is true
|
|
@@ -2425,6 +2427,9 @@ function createOAuth2HttpClient(http, options) {
|
|
|
2425
2427
|
},
|
|
2426
2428
|
};
|
|
2427
2429
|
});
|
|
2430
|
+
httpWithAuth.interceptors.response.use(camelizeResponseData);
|
|
2431
|
+
httpWithAuth.interceptors.response.use(transformResponseData);
|
|
2432
|
+
httpWithAuth.interceptors.response.use(transformKeysResponseData);
|
|
2428
2433
|
httpWithAuth.interceptors.response.use(null, retryInterceptor(httpWithAuth));
|
|
2429
2434
|
// If we receive a expired/unknown access token error, refresh the tokens
|
|
2430
2435
|
httpWithAuth.interceptors.response.use(null, async (error) => {
|
|
@@ -2444,9 +2449,6 @@ function createOAuth2HttpClient(http, options) {
|
|
|
2444
2449
|
throw error;
|
|
2445
2450
|
});
|
|
2446
2451
|
httpWithAuth.interceptors.response.use(null, typeReceivedErrorsInterceptor);
|
|
2447
|
-
httpWithAuth.interceptors.response.use(camelizeResponseData);
|
|
2448
|
-
httpWithAuth.interceptors.response.use(transformResponseData);
|
|
2449
|
-
httpWithAuth.interceptors.response.use(transformKeysResponseData);
|
|
2450
2452
|
/**
|
|
2451
2453
|
* - Adds a creationTimestamp to the token
|
|
2452
2454
|
* - Notifies the user
|
|
@@ -2612,11 +2614,11 @@ function createProxyHttpClient(http, options) {
|
|
|
2612
2614
|
return Promise.reject(error);
|
|
2613
2615
|
});
|
|
2614
2616
|
}
|
|
2615
|
-
httpWithAuth.interceptors.response.use(null, retryInterceptor(httpWithAuth));
|
|
2616
|
-
httpWithAuth.interceptors.response.use(null, typeReceivedErrorsInterceptor);
|
|
2617
2617
|
httpWithAuth.interceptors.response.use(camelizeResponseData);
|
|
2618
2618
|
httpWithAuth.interceptors.response.use(transformResponseData);
|
|
2619
2619
|
httpWithAuth.interceptors.response.use(transformKeysResponseData);
|
|
2620
|
+
httpWithAuth.interceptors.response.use(null, retryInterceptor(httpWithAuth));
|
|
2621
|
+
httpWithAuth.interceptors.response.use(null, typeReceivedErrorsInterceptor);
|
|
2620
2622
|
async function logout() {
|
|
2621
2623
|
try {
|
|
2622
2624
|
await httpWithAuth.post('/logout');
|
|
@@ -2677,11 +2679,11 @@ function createHttpClient({ packageVersion, host, requestLogger, responseLogger,
|
|
|
2677
2679
|
return Promise.reject(error);
|
|
2678
2680
|
});
|
|
2679
2681
|
}
|
|
2680
|
-
http.interceptors.response.use(null, retryInterceptor(http));
|
|
2681
|
-
http.interceptors.response.use(null, typeReceivedErrorsInterceptor);
|
|
2682
2682
|
http.interceptors.response.use(camelizeResponseData);
|
|
2683
2683
|
http.interceptors.response.use(transformResponseData);
|
|
2684
2684
|
http.interceptors.response.use(transformKeysResponseData);
|
|
2685
|
+
http.interceptors.response.use(null, retryInterceptor(http));
|
|
2686
|
+
http.interceptors.response.use(null, typeReceivedErrorsInterceptor);
|
|
2685
2687
|
return http;
|
|
2686
2688
|
}
|
|
2687
2689
|
|
|
@@ -5751,7 +5753,7 @@ const templatesV2Service = (httpWithAuth) => {
|
|
|
5751
5753
|
};
|
|
5752
5754
|
};
|
|
5753
5755
|
|
|
5754
|
-
const version = '8.14.2-dev-
|
|
5756
|
+
const version = '8.14.2-dev-211-13941b3';
|
|
5755
5757
|
|
|
5756
5758
|
/**
|
|
5757
5759
|
* Create ExtraHorizon client.
|
package/build/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "8.14.2-dev-
|
|
1
|
+
export declare const version = "8.14.2-dev-211-13941b3";
|
package/build/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "8.14.2-dev-
|
|
1
|
+
export declare const version = "8.14.2-dev-211-13941b3";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@extrahorizon/javascript-sdk",
|
|
3
|
-
"version": "8.14.2-dev-
|
|
3
|
+
"version": "8.14.2-dev-211-13941b3",
|
|
4
4
|
"description": "This package serves as a JavaScript wrapper around all Extra Horizon cloud services.",
|
|
5
5
|
"main": "build/index.cjs.js",
|
|
6
6
|
"types": "build/types/index.d.ts",
|