@getpara/user-management-client 2.18.0 → 2.19.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/dist/cjs/client.js +15 -2
- package/dist/esm/client.js +13 -1
- package/dist/types/client.d.ts +2 -1
- package/package.json +3 -2
package/dist/cjs/client.js
CHANGED
|
@@ -78,10 +78,12 @@ var client_exports = {};
|
|
|
78
78
|
__export(client_exports, {
|
|
79
79
|
default: () => client_default,
|
|
80
80
|
handleResponseError: () => handleResponseError,
|
|
81
|
-
handleResponseSuccess: () => handleResponseSuccess
|
|
81
|
+
handleResponseSuccess: () => handleResponseSuccess,
|
|
82
|
+
isRetryableError: () => isRetryableError
|
|
82
83
|
});
|
|
83
84
|
module.exports = __toCommonJS(client_exports);
|
|
84
85
|
var import_axios = __toESM(require("axios"));
|
|
86
|
+
var import_axios_retry = __toESM(require("axios-retry"));
|
|
85
87
|
var import_utils = require("./utils.js");
|
|
86
88
|
var import_consts = require("./consts.js");
|
|
87
89
|
var import_error = require("./error.js");
|
|
@@ -105,6 +107,10 @@ const handleResponseError = (error) => {
|
|
|
105
107
|
}
|
|
106
108
|
throw new import_error.ParaApiError("Unknown error");
|
|
107
109
|
};
|
|
110
|
+
const isRetryableError = (error) => {
|
|
111
|
+
var _a, _b, _c, _d;
|
|
112
|
+
return import_axios_retry.default.isNetworkOrIdempotentRequestError(error) || ((_b = (_a = error.response) == null ? void 0 : _a.status) != null ? _b : 0) >= 500 && ((_d = (_c = error.config) == null ? void 0 : _c.method) == null ? void 0 : _d.toUpperCase()) !== "POST";
|
|
113
|
+
};
|
|
108
114
|
class Client {
|
|
109
115
|
constructor({
|
|
110
116
|
userManagementHost,
|
|
@@ -578,6 +584,7 @@ class Client {
|
|
|
578
584
|
const axiosConfig = {
|
|
579
585
|
baseURL: userManagementHost,
|
|
580
586
|
withCredentials: true,
|
|
587
|
+
timeout: 6e4,
|
|
581
588
|
headers
|
|
582
589
|
};
|
|
583
590
|
if (retrieveSessionCookie) {
|
|
@@ -630,6 +637,11 @@ class Client {
|
|
|
630
637
|
});
|
|
631
638
|
};
|
|
632
639
|
}
|
|
640
|
+
(0, import_axios_retry.default)(this.baseRequest, {
|
|
641
|
+
retries: 3,
|
|
642
|
+
retryDelay: import_axios_retry.default.exponentialDelay,
|
|
643
|
+
retryCondition: isRetryableError
|
|
644
|
+
});
|
|
633
645
|
this.baseRequest.interceptors.response.use(handleResponseSuccess, handleResponseError);
|
|
634
646
|
}
|
|
635
647
|
// DEPRECATED: use uploadUserKeyShares instead
|
|
@@ -1128,5 +1140,6 @@ var client_default = Client;
|
|
|
1128
1140
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1129
1141
|
0 && (module.exports = {
|
|
1130
1142
|
handleResponseError,
|
|
1131
|
-
handleResponseSuccess
|
|
1143
|
+
handleResponseSuccess,
|
|
1144
|
+
isRetryableError
|
|
1132
1145
|
});
|
package/dist/esm/client.js
CHANGED
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
__spreadValues
|
|
6
6
|
} from "./chunk-BBZEL7EG.js";
|
|
7
7
|
import axios from "axios";
|
|
8
|
+
import axiosRetry from "axios-retry";
|
|
8
9
|
import { extractWalletRef, fromAccountMetadata, fromLinkedAccounts } from "./utils.js";
|
|
9
10
|
import {
|
|
10
11
|
SESSION_COOKIE_HEADER_NAME,
|
|
@@ -34,6 +35,10 @@ const handleResponseError = (error) => {
|
|
|
34
35
|
}
|
|
35
36
|
throw new ParaApiError("Unknown error");
|
|
36
37
|
};
|
|
38
|
+
const isRetryableError = (error) => {
|
|
39
|
+
var _a, _b, _c, _d;
|
|
40
|
+
return axiosRetry.isNetworkOrIdempotentRequestError(error) || ((_b = (_a = error.response) == null ? void 0 : _a.status) != null ? _b : 0) >= 500 && ((_d = (_c = error.config) == null ? void 0 : _c.method) == null ? void 0 : _d.toUpperCase()) !== "POST";
|
|
41
|
+
};
|
|
37
42
|
class Client {
|
|
38
43
|
constructor({
|
|
39
44
|
userManagementHost,
|
|
@@ -507,6 +512,7 @@ class Client {
|
|
|
507
512
|
const axiosConfig = {
|
|
508
513
|
baseURL: userManagementHost,
|
|
509
514
|
withCredentials: true,
|
|
515
|
+
timeout: 6e4,
|
|
510
516
|
headers
|
|
511
517
|
};
|
|
512
518
|
if (retrieveSessionCookie) {
|
|
@@ -559,6 +565,11 @@ class Client {
|
|
|
559
565
|
});
|
|
560
566
|
};
|
|
561
567
|
}
|
|
568
|
+
axiosRetry(this.baseRequest, {
|
|
569
|
+
retries: 3,
|
|
570
|
+
retryDelay: axiosRetry.exponentialDelay,
|
|
571
|
+
retryCondition: isRetryableError
|
|
572
|
+
});
|
|
562
573
|
this.baseRequest.interceptors.response.use(handleResponseSuccess, handleResponseError);
|
|
563
574
|
}
|
|
564
575
|
// DEPRECATED: use uploadUserKeyShares instead
|
|
@@ -1057,5 +1068,6 @@ var client_default = Client;
|
|
|
1057
1068
|
export {
|
|
1058
1069
|
client_default as default,
|
|
1059
1070
|
handleResponseError,
|
|
1060
|
-
handleResponseSuccess
|
|
1071
|
+
handleResponseSuccess,
|
|
1072
|
+
isRetryableError
|
|
1061
1073
|
};
|
package/dist/types/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AxiosResponse } from 'axios';
|
|
1
|
+
import { AxiosError, AxiosResponse } from 'axios';
|
|
2
2
|
import { AccountMetadata, Auth, AuthIdentifier, AuthMethod, BackupKitEmailProps, BiometricLocationHint, Chain, CurrentWalletIds, EncryptedKeyShare, EncryptorType, ExternalWalletInfo, LoginExternalWalletResponse, KeyShareType, Network, OnRampAsset, OnRampConfig, OnRampProvider, OnRampPurchase, OnRampPurchaseCreateParams, OnRampPurchaseUpdateParams, AuthMethodStatus, PregenIds, PrimaryAuth, PublicKeyType, ServerAuthStateSignup, SessionInfo, Setup2faResponse, SignUpOrLogInResponse, TelegramAuthResponse, TPregenIdentifierType, VerificationEmailProps, VerifiedAuth, VerifyFarcasterResponse, VerifyTelegramResponse, VerifyThirdPartyAuth, WalletEntity, WalletParams, TWalletScheme, TWalletType, VerifyExternalWalletParams, IssueJwtParams, IssueJwtResponse, LinkAccountParams, LinkedAccounts, ResendVerificationCodeParams, AssetMetadataIndexed, GetProfileBalanceParams, ProfileBalance, LegacyAuthMethod, PrimaryAuthInfo, ServerAuthStateLogin, ServerAuthStateDone, UserPreferences, EstimateTransactionOpts, EstimateTransactionResult, BroadcastTransactionOpts, BroadcastTransactionResult, TExternalWalletType, GetPendingTransactionResponse } from '@getpara/shared';
|
|
3
3
|
interface ConfigOpts {
|
|
4
4
|
useFetchAdapter?: boolean;
|
|
@@ -144,6 +144,7 @@ export type VerifyTelegramRes = {
|
|
|
144
144
|
};
|
|
145
145
|
export declare const handleResponseSuccess: (response: AxiosResponse<any, any>) => AxiosResponse<any, any>;
|
|
146
146
|
export declare const handleResponseError: (error: any) => never;
|
|
147
|
+
export declare const isRetryableError: (error: AxiosError) => boolean;
|
|
147
148
|
declare class Client {
|
|
148
149
|
private baseRequest;
|
|
149
150
|
constructor({ userManagementHost, apiKey, partnerId, version, opts, retrieveSessionCookie, persistSessionCookie, partnerConfigOverride, }: ClientConfig);
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpara/user-management-client",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.19.0",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@getpara/shared": "^1.12.0",
|
|
6
6
|
"axios": "^1.8.4",
|
|
7
|
+
"axios-retry": "^4.5.0",
|
|
7
8
|
"libphonenumber-js": "^1.11.7"
|
|
8
9
|
},
|
|
9
10
|
"devDependencies": {
|
|
@@ -20,7 +21,7 @@
|
|
|
20
21
|
"dist",
|
|
21
22
|
"package.json"
|
|
22
23
|
],
|
|
23
|
-
"gitHead": "
|
|
24
|
+
"gitHead": "7dc9400777adb653c0cc28e0d9236424eb384467",
|
|
24
25
|
"main": "dist/cjs/index.js",
|
|
25
26
|
"module": "dist/esm/index.js",
|
|
26
27
|
"scripts": {
|