@coinlist-co/react 0.12.2-rc.726778a → 0.12.2-rc.9fb6364
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/{chunk-IRV5YU42.js → chunk-BNMF2HMW.js} +98 -2
- package/dist/chunk-BNMF2HMW.js.map +1 -0
- package/dist/{chunk-3UQPCAU4.js → chunk-KRA6EM2L.js} +2 -2
- package/dist/{chunk-C6F5FOFP.js → chunk-STAHYDLY.js} +52 -19
- package/dist/chunk-STAHYDLY.js.map +1 -0
- package/dist/client/index.cjs +287 -53
- package/dist/client/index.cjs.map +1 -1
- package/dist/client/index.d.cts +26 -8
- package/dist/client/index.d.ts +26 -8
- package/dist/client/index.js +182 -39
- package/dist/client/index.js.map +1 -1
- package/dist/server/index.cjs +435 -76
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.cts +47 -38
- package/dist/server/index.d.ts +47 -38
- package/dist/server/index.js +316 -61
- package/dist/server/index.js.map +1 -1
- package/dist/time-B5YOQxuh.d.ts +50 -0
- package/dist/time-BY3apBpc.d.cts +50 -0
- package/dist/{token-registry-snapshot-BNBNuDu1.d.ts → token-registry-snapshot-C1NxdBmF.d.ts} +1 -1
- package/dist/{token-registry-snapshot-CqI6dXM_.d.cts → token-registry-snapshot-DyjrA32p.d.cts} +1 -1
- package/dist/{tokens-namespace-CIWBtgt2.d.cts → tokens-namespace-BJfFeowE.d.cts} +53 -1
- package/dist/{tokens-namespace-CIWBtgt2.d.ts → tokens-namespace-BJfFeowE.d.ts} +53 -1
- package/dist/universal/index.cjs +83 -1
- package/dist/universal/index.cjs.map +1 -1
- package/dist/universal/index.d.cts +5 -4
- package/dist/universal/index.d.ts +5 -4
- package/dist/universal/index.js +10 -2
- package/package.json +1 -1
- package/dist/chunk-C6F5FOFP.js.map +0 -1
- package/dist/chunk-IRV5YU42.js.map +0 -1
- /package/dist/{chunk-3UQPCAU4.js.map → chunk-KRA6EM2L.js.map} +0 -0
|
@@ -1,3 +1,27 @@
|
|
|
1
|
+
// src/universal/api/internal-access-token-source.ts
|
|
2
|
+
var SentWith = {
|
|
3
|
+
userToken: (token) => ({
|
|
4
|
+
type: "user-token",
|
|
5
|
+
token
|
|
6
|
+
}),
|
|
7
|
+
noUserToken: { type: "no-user-token" }
|
|
8
|
+
};
|
|
9
|
+
var TokenTrigger = {
|
|
10
|
+
beforeRequest: { type: "before-request" },
|
|
11
|
+
after401: (rejected) => ({
|
|
12
|
+
type: "after-401",
|
|
13
|
+
rejected
|
|
14
|
+
})
|
|
15
|
+
};
|
|
16
|
+
function isRejectedToken(token, rejected) {
|
|
17
|
+
switch (rejected.type) {
|
|
18
|
+
case "user-token":
|
|
19
|
+
return rejected.token.value === token.value;
|
|
20
|
+
case "no-user-token":
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
1
25
|
// src/universal/api/http-attributes.ts
|
|
2
26
|
var empty = {};
|
|
3
27
|
var concat = (left, right) => ({
|
|
@@ -25,6 +49,10 @@ var retryAttempt = (attempt) => ({
|
|
|
25
49
|
var renewAttempted = (value) => ({
|
|
26
50
|
renewAttempted: value
|
|
27
51
|
});
|
|
52
|
+
var notRetryable = () => ({ retryable: false });
|
|
53
|
+
var sentWith = (token) => ({
|
|
54
|
+
sentWith: token
|
|
55
|
+
});
|
|
28
56
|
var requestId = (id) => ({ requestId: id });
|
|
29
57
|
var getRequestId = (attrs) => attrs?.requestId ?? null;
|
|
30
58
|
var isProtected = (attrs) => attrs?.protected === true;
|
|
@@ -32,6 +60,8 @@ var needUserAgent = (attrs) => attrs?.userAgent === true;
|
|
|
32
60
|
var isIdempotent = (attrs) => attrs?.idempotencyKey === true;
|
|
33
61
|
var getRetryAttempt = (attrs) => attrs?.retryAttempt ?? 0;
|
|
34
62
|
var wasRenewAttempted = (attrs) => attrs?.renewAttempted === true;
|
|
63
|
+
var isRetryable = (attrs) => attrs?.retryable !== false;
|
|
64
|
+
var getSentWith = (attrs) => attrs?.sentWith === void 0 ? SentWith.noUserToken : SentWith.userToken(attrs.sentWith);
|
|
35
65
|
var getClientCredentials = (attrs) => attrs?.clientCredentials;
|
|
36
66
|
var Attributes = {
|
|
37
67
|
empty,
|
|
@@ -47,6 +77,10 @@ var Attributes = {
|
|
|
47
77
|
getRetryAttempt,
|
|
48
78
|
renewAttempted,
|
|
49
79
|
wasRenewAttempted,
|
|
80
|
+
notRetryable,
|
|
81
|
+
isRetryable,
|
|
82
|
+
sentWith,
|
|
83
|
+
getSentWith,
|
|
50
84
|
clientCredentials,
|
|
51
85
|
getClientCredentials,
|
|
52
86
|
requestId,
|
|
@@ -209,6 +243,54 @@ var MathError = class extends Error {
|
|
|
209
243
|
}
|
|
210
244
|
};
|
|
211
245
|
|
|
246
|
+
// src/universal/types/time.ts
|
|
247
|
+
var MAX_EPOCH_MILLIS = 864e13;
|
|
248
|
+
var EpochMillis = {
|
|
249
|
+
/**
|
|
250
|
+
* @throws {@link ValidationError} unless `value` is an integer a `Date` can
|
|
251
|
+
* represent: at most {@link MAX_EPOCH_MILLIS} either side of the epoch.
|
|
252
|
+
*/
|
|
253
|
+
of: (value) => {
|
|
254
|
+
if (!Number.isInteger(value) || Math.abs(value) > MAX_EPOCH_MILLIS) {
|
|
255
|
+
throw new ValidationError(
|
|
256
|
+
`EpochMillis must be an integer within \xB1${MAX_EPOCH_MILLIS}, got ${value}`
|
|
257
|
+
);
|
|
258
|
+
}
|
|
259
|
+
return value;
|
|
260
|
+
},
|
|
261
|
+
/** The wall clock. Code that needs the time takes a `TimeEff` instead. */
|
|
262
|
+
now: () => EpochMillis.of(Date.now()),
|
|
263
|
+
/** @throws {@link ValidationError} for an invalid `Date`. */
|
|
264
|
+
fromDate: (date) => EpochMillis.of(date.getTime()),
|
|
265
|
+
/** How long after `from` the instant `to` is; negative if it is before. */
|
|
266
|
+
elapsed: (from, to) => Millis.of(to - from),
|
|
267
|
+
plus: (at, duration) => EpochMillis.of(at + duration)
|
|
268
|
+
};
|
|
269
|
+
var Millis = {
|
|
270
|
+
of: (value) => value
|
|
271
|
+
};
|
|
272
|
+
var Seconds = {
|
|
273
|
+
/**
|
|
274
|
+
* @throws {@link ValidationError} unless `value` is a non-negative integer.
|
|
275
|
+
*/
|
|
276
|
+
of: (value) => {
|
|
277
|
+
if (!Number.isInteger(value) || value < 0) {
|
|
278
|
+
throw new ValidationError(
|
|
279
|
+
`Seconds must be a non-negative integer, got ${value}`
|
|
280
|
+
);
|
|
281
|
+
}
|
|
282
|
+
return value;
|
|
283
|
+
},
|
|
284
|
+
toMillis: (value) => Millis.of(value * 1e3)
|
|
285
|
+
};
|
|
286
|
+
function isExpired({
|
|
287
|
+
expiresAt,
|
|
288
|
+
now,
|
|
289
|
+
buffer = Millis.of(0)
|
|
290
|
+
}) {
|
|
291
|
+
return now >= expiresAt - buffer;
|
|
292
|
+
}
|
|
293
|
+
|
|
212
294
|
// src/universal/core/shared/blockchain/erc20/abi.ts
|
|
213
295
|
var ERC20_ABI = [
|
|
214
296
|
{
|
|
@@ -2957,11 +3039,18 @@ var HttpClient = class {
|
|
|
2957
3039
|
);
|
|
2958
3040
|
let response = await this.executeRequest(preparedRequest);
|
|
2959
3041
|
for (const middleware of this.middleware.afterRequest ?? []) {
|
|
3042
|
+
let retried = false;
|
|
2960
3043
|
response = await middleware({
|
|
2961
3044
|
request: preparedRequest,
|
|
2962
3045
|
response,
|
|
2963
|
-
retry: (nextRequest = preparedRequest) =>
|
|
3046
|
+
retry: (nextRequest = preparedRequest) => {
|
|
3047
|
+
retried = true;
|
|
3048
|
+
return this.runRequestWithAfterMiddleware(nextRequest);
|
|
3049
|
+
}
|
|
2964
3050
|
});
|
|
3051
|
+
if (retried) {
|
|
3052
|
+
return response;
|
|
3053
|
+
}
|
|
2965
3054
|
}
|
|
2966
3055
|
return response;
|
|
2967
3056
|
}
|
|
@@ -3407,6 +3496,9 @@ export {
|
|
|
3407
3496
|
VERIFY_IDENTITY_PATH,
|
|
3408
3497
|
VERIFY_IDENTITY_ACCREDITATION_PATH,
|
|
3409
3498
|
WALLET_PATH,
|
|
3499
|
+
SentWith,
|
|
3500
|
+
TokenTrigger,
|
|
3501
|
+
isRejectedToken,
|
|
3410
3502
|
Attributes,
|
|
3411
3503
|
HttpError,
|
|
3412
3504
|
apiErrorCode,
|
|
@@ -3419,6 +3511,10 @@ export {
|
|
|
3419
3511
|
describeErrorUnredacted,
|
|
3420
3512
|
internalLogger,
|
|
3421
3513
|
HttpClient,
|
|
3514
|
+
EpochMillis,
|
|
3515
|
+
Millis,
|
|
3516
|
+
Seconds,
|
|
3517
|
+
isExpired,
|
|
3422
3518
|
ERC20_ABI,
|
|
3423
3519
|
fetchAllPages,
|
|
3424
3520
|
Cursor,
|
|
@@ -3535,4 +3631,4 @@ export {
|
|
|
3535
3631
|
OAuthRefreshToken,
|
|
3536
3632
|
OAuthSession
|
|
3537
3633
|
};
|
|
3538
|
-
//# sourceMappingURL=chunk-
|
|
3634
|
+
//# sourceMappingURL=chunk-BNMF2HMW.js.map
|