@pooflabs/web 0.0.76 → 0.0.78
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/README.md +32 -0
- package/dist/{index-COMIXUxl.js → index-CKaaE12K.js} +2 -2
- package/dist/{index-COMIXUxl.js.map → index-CKaaE12K.js.map} +1 -1
- package/dist/{index-Dsh0H37n.esm.js → index-Cmu0PVJD.esm.js} +2 -2
- package/dist/{index-Dsh0H37n.esm.js.map → index-Cmu0PVJD.esm.js.map} +1 -1
- package/dist/{index-BrlvWT1Q.js → index-Cp727oEW.js} +450 -23
- package/dist/index-Cp727oEW.js.map +1 -0
- package/dist/{index-C5Cnn7Hq.esm.js → index-CwGoYY0Y.esm.js} +450 -24
- package/dist/index-CwGoYY0Y.esm.js.map +1 -0
- package/dist/{index-BilNgDSc.js → index-DE7k2G22.js} +2 -2
- package/dist/{index-BilNgDSc.js.map → index-DE7k2G22.js.map} +1 -1
- package/dist/{index-DeVykeX4.esm.js → index-OAJ0rndN.esm.js} +2 -2
- package/dist/{index-DeVykeX4.esm.js.map → index-OAJ0rndN.esm.js.map} +1 -1
- package/dist/{index.browser-CMO2pjaF.js → index.browser-AZQ5TnZ4.js} +3 -3
- package/dist/{index.browser-CMO2pjaF.js.map → index.browser-AZQ5TnZ4.js.map} +1 -1
- package/dist/{index.browser-CSTWylhG.esm.js → index.browser-B4een3Gz.esm.js} +3 -3
- package/dist/{index.browser-CSTWylhG.esm.js.map → index.browser-B4een3Gz.esm.js.map} +1 -1
- package/dist/index.browser-BMtEulGJ.js +122 -0
- package/dist/index.browser-BMtEulGJ.js.map +1 -0
- package/dist/{index.browser-DZjyUgtx.esm.js → index.browser-C-_FEr5M.esm.js} +449 -479
- package/dist/index.browser-C-_FEr5M.esm.js.map +1 -0
- package/dist/index.browser-DFeGGyO7.esm.js +1250 -0
- package/dist/index.browser-DFeGGyO7.esm.js.map +1 -0
- package/dist/{index.browser-BOJRGZWX.js → index.browser-DjEZSiqI.js} +449 -479
- package/dist/index.browser-DjEZSiqI.js.map +1 -0
- package/dist/index.browser-QPkAiPQp.js +1253 -0
- package/dist/index.browser-QPkAiPQp.js.map +1 -0
- package/dist/index.browser-x87QUr4N.esm.js +119 -0
- package/dist/index.browser-x87QUr4N.esm.js.map +1 -0
- package/dist/index.esm.js +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/{index.native-H-fEcP_L.esm.js → index.native-CjEJXA9y.esm.js} +450 -24
- package/dist/index.native-CjEJXA9y.esm.js.map +1 -0
- package/dist/{index.native-CkUXrvPQ.js → index.native-D7IrIMX1.js} +450 -23
- package/dist/index.native-D7IrIMX1.js.map +1 -0
- package/dist/index.native.esm.js +1 -1
- package/dist/index.native.js +2 -1
- package/dist/index.native.js.map +1 -1
- package/dist/{phantom-wallet-provider-5IQi4ihD.esm.js → phantom-wallet-provider-B1TleWsy.esm.js} +3 -3
- package/dist/{phantom-wallet-provider-5IQi4ihD.esm.js.map → phantom-wallet-provider-B1TleWsy.esm.js.map} +1 -1
- package/dist/{phantom-wallet-provider-DrNrxSUL.js → phantom-wallet-provider-DwmdHVd-.js} +3 -3
- package/dist/{phantom-wallet-provider-DrNrxSUL.js.map → phantom-wallet-provider-DwmdHVd-.js.map} +1 -1
- package/dist/{privy-wallet-provider-BtLH1dpY.esm.js → privy-wallet-provider-CZgiUwUN.esm.js} +3 -3
- package/dist/{privy-wallet-provider-BtLH1dpY.esm.js.map → privy-wallet-provider-CZgiUwUN.esm.js.map} +1 -1
- package/dist/{privy-wallet-provider-CrRfcONv.js → privy-wallet-provider-Cf6WgpK1.js} +3 -3
- package/dist/{privy-wallet-provider-CrRfcONv.js.map → privy-wallet-provider-Cf6WgpK1.js.map} +1 -1
- package/dist/{solana-mobile-wallet-provider-C3l6mxSm.esm.js → solana-mobile-wallet-provider-C9j8O3mD.esm.js} +3 -3
- package/dist/{solana-mobile-wallet-provider-C3l6mxSm.esm.js.map → solana-mobile-wallet-provider-C9j8O3mD.esm.js.map} +1 -1
- package/dist/{solana-mobile-wallet-provider-QcGazewW.js → solana-mobile-wallet-provider-DZmpeNIS.js} +3 -3
- package/dist/{solana-mobile-wallet-provider-QcGazewW.js.map → solana-mobile-wallet-provider-DZmpeNIS.js.map} +1 -1
- package/package.json +2 -2
- package/dist/index-BrlvWT1Q.js.map +0 -1
- package/dist/index-C5Cnn7Hq.esm.js.map +0 -1
- package/dist/index.browser--rDwfvXH.esm.js +0 -307
- package/dist/index.browser--rDwfvXH.esm.js.map +0 -1
- package/dist/index.browser-BOJRGZWX.js.map +0 -1
- package/dist/index.browser-CLZv9v_y.js +0 -310
- package/dist/index.browser-CLZv9v_y.js.map +0 -1
- package/dist/index.browser-DQKnuR3q.esm.js +0 -1468
- package/dist/index.browser-DQKnuR3q.esm.js.map +0 -1
- package/dist/index.browser-DZjyUgtx.esm.js.map +0 -1
- package/dist/index.browser-DqO3G-HJ.js +0 -1471
- package/dist/index.browser-DqO3G-HJ.js.map +0 -1
- package/dist/index.native-CkUXrvPQ.js.map +0 -1
- package/dist/index.native-H-fEcP_L.esm.js.map +0 -1
|
@@ -6400,6 +6400,261 @@ var ReconnectingWebSocket = /** @class */ (function () {
|
|
|
6400
6400
|
return ReconnectingWebSocket;
|
|
6401
6401
|
}());
|
|
6402
6402
|
|
|
6403
|
+
function getDefaultExportFromCjs (x) {
|
|
6404
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
6405
|
+
}
|
|
6406
|
+
|
|
6407
|
+
var isRetryAllowed$1;
|
|
6408
|
+
var hasRequiredIsRetryAllowed;
|
|
6409
|
+
|
|
6410
|
+
function requireIsRetryAllowed () {
|
|
6411
|
+
if (hasRequiredIsRetryAllowed) return isRetryAllowed$1;
|
|
6412
|
+
hasRequiredIsRetryAllowed = 1;
|
|
6413
|
+
|
|
6414
|
+
const denyList = new Set([
|
|
6415
|
+
'ENOTFOUND',
|
|
6416
|
+
'ENETUNREACH',
|
|
6417
|
+
|
|
6418
|
+
// SSL errors from https://github.com/nodejs/node/blob/fc8e3e2cdc521978351de257030db0076d79e0ab/src/crypto/crypto_common.cc#L301-L328
|
|
6419
|
+
'UNABLE_TO_GET_ISSUER_CERT',
|
|
6420
|
+
'UNABLE_TO_GET_CRL',
|
|
6421
|
+
'UNABLE_TO_DECRYPT_CERT_SIGNATURE',
|
|
6422
|
+
'UNABLE_TO_DECRYPT_CRL_SIGNATURE',
|
|
6423
|
+
'UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY',
|
|
6424
|
+
'CERT_SIGNATURE_FAILURE',
|
|
6425
|
+
'CRL_SIGNATURE_FAILURE',
|
|
6426
|
+
'CERT_NOT_YET_VALID',
|
|
6427
|
+
'CERT_HAS_EXPIRED',
|
|
6428
|
+
'CRL_NOT_YET_VALID',
|
|
6429
|
+
'CRL_HAS_EXPIRED',
|
|
6430
|
+
'ERROR_IN_CERT_NOT_BEFORE_FIELD',
|
|
6431
|
+
'ERROR_IN_CERT_NOT_AFTER_FIELD',
|
|
6432
|
+
'ERROR_IN_CRL_LAST_UPDATE_FIELD',
|
|
6433
|
+
'ERROR_IN_CRL_NEXT_UPDATE_FIELD',
|
|
6434
|
+
'OUT_OF_MEM',
|
|
6435
|
+
'DEPTH_ZERO_SELF_SIGNED_CERT',
|
|
6436
|
+
'SELF_SIGNED_CERT_IN_CHAIN',
|
|
6437
|
+
'UNABLE_TO_GET_ISSUER_CERT_LOCALLY',
|
|
6438
|
+
'UNABLE_TO_VERIFY_LEAF_SIGNATURE',
|
|
6439
|
+
'CERT_CHAIN_TOO_LONG',
|
|
6440
|
+
'CERT_REVOKED',
|
|
6441
|
+
'INVALID_CA',
|
|
6442
|
+
'PATH_LENGTH_EXCEEDED',
|
|
6443
|
+
'INVALID_PURPOSE',
|
|
6444
|
+
'CERT_UNTRUSTED',
|
|
6445
|
+
'CERT_REJECTED',
|
|
6446
|
+
'HOSTNAME_MISMATCH'
|
|
6447
|
+
]);
|
|
6448
|
+
|
|
6449
|
+
// TODO: Use `error?.code` when targeting Node.js 14
|
|
6450
|
+
isRetryAllowed$1 = error => !denyList.has(error && error.code);
|
|
6451
|
+
return isRetryAllowed$1;
|
|
6452
|
+
}
|
|
6453
|
+
|
|
6454
|
+
var isRetryAllowedExports = requireIsRetryAllowed();
|
|
6455
|
+
var isRetryAllowed = /*@__PURE__*/getDefaultExportFromCjs(isRetryAllowedExports);
|
|
6456
|
+
|
|
6457
|
+
const namespace = 'axios-retry';
|
|
6458
|
+
function isNetworkError(error) {
|
|
6459
|
+
const CODE_EXCLUDE_LIST = ['ERR_CANCELED', 'ECONNABORTED'];
|
|
6460
|
+
if (error.response) {
|
|
6461
|
+
return false;
|
|
6462
|
+
}
|
|
6463
|
+
if (!error.code) {
|
|
6464
|
+
return false;
|
|
6465
|
+
}
|
|
6466
|
+
// Prevents retrying timed out & cancelled requests
|
|
6467
|
+
if (CODE_EXCLUDE_LIST.includes(error.code)) {
|
|
6468
|
+
return false;
|
|
6469
|
+
}
|
|
6470
|
+
// Prevents retrying unsafe errors
|
|
6471
|
+
return isRetryAllowed(error);
|
|
6472
|
+
}
|
|
6473
|
+
const SAFE_HTTP_METHODS = ['get', 'head', 'options'];
|
|
6474
|
+
const IDEMPOTENT_HTTP_METHODS = SAFE_HTTP_METHODS.concat(['put', 'delete']);
|
|
6475
|
+
function isRetryableError(error) {
|
|
6476
|
+
return (error.code !== 'ECONNABORTED' &&
|
|
6477
|
+
(!error.response ||
|
|
6478
|
+
error.response.status === 429 ||
|
|
6479
|
+
(error.response.status >= 500 && error.response.status <= 599)));
|
|
6480
|
+
}
|
|
6481
|
+
function isSafeRequestError(error) {
|
|
6482
|
+
if (!error.config?.method) {
|
|
6483
|
+
// Cannot determine if the request can be retried
|
|
6484
|
+
return false;
|
|
6485
|
+
}
|
|
6486
|
+
return isRetryableError(error) && SAFE_HTTP_METHODS.indexOf(error.config.method) !== -1;
|
|
6487
|
+
}
|
|
6488
|
+
function isIdempotentRequestError(error) {
|
|
6489
|
+
if (!error.config?.method) {
|
|
6490
|
+
// Cannot determine if the request can be retried
|
|
6491
|
+
return false;
|
|
6492
|
+
}
|
|
6493
|
+
return isRetryableError(error) && IDEMPOTENT_HTTP_METHODS.indexOf(error.config.method) !== -1;
|
|
6494
|
+
}
|
|
6495
|
+
function isNetworkOrIdempotentRequestError(error) {
|
|
6496
|
+
return isNetworkError(error) || isIdempotentRequestError(error);
|
|
6497
|
+
}
|
|
6498
|
+
function retryAfter(error = undefined) {
|
|
6499
|
+
const retryAfterHeader = error?.response?.headers['retry-after'];
|
|
6500
|
+
if (!retryAfterHeader) {
|
|
6501
|
+
return 0;
|
|
6502
|
+
}
|
|
6503
|
+
// if the retry after header is a number, convert it to milliseconds
|
|
6504
|
+
let retryAfterMs = (Number(retryAfterHeader) || 0) * 1000;
|
|
6505
|
+
// If the retry after header is a date, get the number of milliseconds until that date
|
|
6506
|
+
if (retryAfterMs === 0) {
|
|
6507
|
+
retryAfterMs = (new Date(retryAfterHeader).valueOf() || 0) - Date.now();
|
|
6508
|
+
}
|
|
6509
|
+
return Math.max(0, retryAfterMs);
|
|
6510
|
+
}
|
|
6511
|
+
function noDelay(_retryNumber = 0, error = undefined) {
|
|
6512
|
+
return Math.max(0, retryAfter(error));
|
|
6513
|
+
}
|
|
6514
|
+
function exponentialDelay(retryNumber = 0, error = undefined, delayFactor = 100) {
|
|
6515
|
+
const calculatedDelay = 2 ** retryNumber * delayFactor;
|
|
6516
|
+
const delay = Math.max(calculatedDelay, retryAfter(error));
|
|
6517
|
+
const randomSum = delay * 0.2 * Math.random(); // 0-20% of the delay
|
|
6518
|
+
return delay + randomSum;
|
|
6519
|
+
}
|
|
6520
|
+
/**
|
|
6521
|
+
* Linear delay
|
|
6522
|
+
* @param {number | undefined} delayFactor - delay factor in milliseconds (default: 100)
|
|
6523
|
+
* @returns {function} (retryNumber: number, error: AxiosError | undefined) => number
|
|
6524
|
+
*/
|
|
6525
|
+
function linearDelay(delayFactor = 100) {
|
|
6526
|
+
return (retryNumber = 0, error = undefined) => {
|
|
6527
|
+
const delay = retryNumber * delayFactor;
|
|
6528
|
+
return Math.max(delay, retryAfter(error));
|
|
6529
|
+
};
|
|
6530
|
+
}
|
|
6531
|
+
const DEFAULT_OPTIONS = {
|
|
6532
|
+
retries: 3,
|
|
6533
|
+
retryCondition: isNetworkOrIdempotentRequestError,
|
|
6534
|
+
retryDelay: noDelay,
|
|
6535
|
+
shouldResetTimeout: false,
|
|
6536
|
+
onRetry: () => { },
|
|
6537
|
+
onMaxRetryTimesExceeded: () => { },
|
|
6538
|
+
validateResponse: null
|
|
6539
|
+
};
|
|
6540
|
+
function getRequestOptions(config, defaultOptions) {
|
|
6541
|
+
return { ...DEFAULT_OPTIONS, ...defaultOptions, ...config[namespace] };
|
|
6542
|
+
}
|
|
6543
|
+
function setCurrentState(config, defaultOptions, resetLastRequestTime = false) {
|
|
6544
|
+
const currentState = getRequestOptions(config, defaultOptions || {});
|
|
6545
|
+
currentState.retryCount = currentState.retryCount || 0;
|
|
6546
|
+
if (!currentState.lastRequestTime || resetLastRequestTime) {
|
|
6547
|
+
currentState.lastRequestTime = Date.now();
|
|
6548
|
+
}
|
|
6549
|
+
config[namespace] = currentState;
|
|
6550
|
+
return currentState;
|
|
6551
|
+
}
|
|
6552
|
+
function fixConfig(axiosInstance, config) {
|
|
6553
|
+
// @ts-ignore
|
|
6554
|
+
if (axiosInstance.defaults.agent === config.agent) {
|
|
6555
|
+
// @ts-ignore
|
|
6556
|
+
delete config.agent;
|
|
6557
|
+
}
|
|
6558
|
+
if (axiosInstance.defaults.httpAgent === config.httpAgent) {
|
|
6559
|
+
delete config.httpAgent;
|
|
6560
|
+
}
|
|
6561
|
+
if (axiosInstance.defaults.httpsAgent === config.httpsAgent) {
|
|
6562
|
+
delete config.httpsAgent;
|
|
6563
|
+
}
|
|
6564
|
+
}
|
|
6565
|
+
async function shouldRetry(currentState, error) {
|
|
6566
|
+
const { retries, retryCondition } = currentState;
|
|
6567
|
+
const shouldRetryOrPromise = (currentState.retryCount || 0) < retries && retryCondition(error);
|
|
6568
|
+
// This could be a promise
|
|
6569
|
+
if (typeof shouldRetryOrPromise === 'object') {
|
|
6570
|
+
try {
|
|
6571
|
+
const shouldRetryPromiseResult = await shouldRetryOrPromise;
|
|
6572
|
+
// keep return true unless shouldRetryPromiseResult return false for compatibility
|
|
6573
|
+
return shouldRetryPromiseResult !== false;
|
|
6574
|
+
}
|
|
6575
|
+
catch (_err) {
|
|
6576
|
+
return false;
|
|
6577
|
+
}
|
|
6578
|
+
}
|
|
6579
|
+
return shouldRetryOrPromise;
|
|
6580
|
+
}
|
|
6581
|
+
async function handleRetry(axiosInstance, currentState, error, config) {
|
|
6582
|
+
currentState.retryCount += 1;
|
|
6583
|
+
const { retryDelay, shouldResetTimeout, onRetry } = currentState;
|
|
6584
|
+
const delay = retryDelay(currentState.retryCount, error);
|
|
6585
|
+
// Axios fails merging this configuration to the default configuration because it has an issue
|
|
6586
|
+
// with circular structures: https://github.com/mzabriskie/axios/issues/370
|
|
6587
|
+
fixConfig(axiosInstance, config);
|
|
6588
|
+
if (!shouldResetTimeout && config.timeout && currentState.lastRequestTime) {
|
|
6589
|
+
const lastRequestDuration = Date.now() - currentState.lastRequestTime;
|
|
6590
|
+
const timeout = config.timeout - lastRequestDuration - delay;
|
|
6591
|
+
if (timeout <= 0) {
|
|
6592
|
+
return Promise.reject(error);
|
|
6593
|
+
}
|
|
6594
|
+
config.timeout = timeout;
|
|
6595
|
+
}
|
|
6596
|
+
config.transformRequest = [(data) => data];
|
|
6597
|
+
await onRetry(currentState.retryCount, error, config);
|
|
6598
|
+
if (config.signal?.aborted) {
|
|
6599
|
+
return Promise.resolve(axiosInstance(config));
|
|
6600
|
+
}
|
|
6601
|
+
return new Promise((resolve) => {
|
|
6602
|
+
const abortListener = () => {
|
|
6603
|
+
clearTimeout(timeout);
|
|
6604
|
+
resolve(axiosInstance(config));
|
|
6605
|
+
};
|
|
6606
|
+
const timeout = setTimeout(() => {
|
|
6607
|
+
resolve(axiosInstance(config));
|
|
6608
|
+
if (config.signal?.removeEventListener) {
|
|
6609
|
+
config.signal.removeEventListener('abort', abortListener);
|
|
6610
|
+
}
|
|
6611
|
+
}, delay);
|
|
6612
|
+
if (config.signal?.addEventListener) {
|
|
6613
|
+
config.signal.addEventListener('abort', abortListener, { once: true });
|
|
6614
|
+
}
|
|
6615
|
+
});
|
|
6616
|
+
}
|
|
6617
|
+
async function handleMaxRetryTimesExceeded(currentState, error) {
|
|
6618
|
+
if (currentState.retryCount >= currentState.retries)
|
|
6619
|
+
await currentState.onMaxRetryTimesExceeded(error, currentState.retryCount);
|
|
6620
|
+
}
|
|
6621
|
+
const axiosRetry = (axiosInstance, defaultOptions) => {
|
|
6622
|
+
const requestInterceptorId = axiosInstance.interceptors.request.use((config) => {
|
|
6623
|
+
setCurrentState(config, defaultOptions, true);
|
|
6624
|
+
if (config[namespace]?.validateResponse) {
|
|
6625
|
+
// by setting this, all HTTP responses will be go through the error interceptor first
|
|
6626
|
+
config.validateStatus = () => false;
|
|
6627
|
+
}
|
|
6628
|
+
return config;
|
|
6629
|
+
});
|
|
6630
|
+
const responseInterceptorId = axiosInstance.interceptors.response.use(null, async (error) => {
|
|
6631
|
+
const { config } = error;
|
|
6632
|
+
// If we have no information to retry the request
|
|
6633
|
+
if (!config) {
|
|
6634
|
+
return Promise.reject(error);
|
|
6635
|
+
}
|
|
6636
|
+
const currentState = setCurrentState(config, defaultOptions);
|
|
6637
|
+
if (error.response && currentState.validateResponse?.(error.response)) {
|
|
6638
|
+
// no issue with response
|
|
6639
|
+
return error.response;
|
|
6640
|
+
}
|
|
6641
|
+
if (await shouldRetry(currentState, error)) {
|
|
6642
|
+
return handleRetry(axiosInstance, currentState, error, config);
|
|
6643
|
+
}
|
|
6644
|
+
await handleMaxRetryTimesExceeded(currentState, error);
|
|
6645
|
+
return Promise.reject(error);
|
|
6646
|
+
});
|
|
6647
|
+
return { requestInterceptorId, responseInterceptorId };
|
|
6648
|
+
};
|
|
6649
|
+
// Compatibility with CommonJS
|
|
6650
|
+
axiosRetry.isNetworkError = isNetworkError;
|
|
6651
|
+
axiosRetry.isSafeRequestError = isSafeRequestError;
|
|
6652
|
+
axiosRetry.isIdempotentRequestError = isIdempotentRequestError;
|
|
6653
|
+
axiosRetry.isNetworkOrIdempotentRequestError = isNetworkOrIdempotentRequestError;
|
|
6654
|
+
axiosRetry.exponentialDelay = exponentialDelay;
|
|
6655
|
+
axiosRetry.linearDelay = linearDelay;
|
|
6656
|
+
axiosRetry.isRetryableError = isRetryableError;
|
|
6657
|
+
|
|
6403
6658
|
let axiosClient;
|
|
6404
6659
|
async function getAxiosAuthClient() {
|
|
6405
6660
|
if (!axiosClient) {
|
|
@@ -6409,6 +6664,7 @@ async function getAxiosAuthClient() {
|
|
|
6409
6664
|
headers: {
|
|
6410
6665
|
'Content-Type': 'application/json',
|
|
6411
6666
|
},
|
|
6667
|
+
timeout: 30000, // 30s timeout, matching makeApiRequest
|
|
6412
6668
|
});
|
|
6413
6669
|
}
|
|
6414
6670
|
return axiosClient;
|
|
@@ -6455,15 +6711,41 @@ async function createSessionWithPrivy(authToken, address, privyIdToken) {
|
|
|
6455
6711
|
});
|
|
6456
6712
|
return response.data;
|
|
6457
6713
|
}
|
|
6714
|
+
// Deduplicate concurrent refreshSession calls to prevent multiple code paths
|
|
6715
|
+
// (WebSocket reconnection, periodic refresh, API 401 retry) from all hitting
|
|
6716
|
+
// /session/refresh simultaneously.
|
|
6717
|
+
// Note: module-level state is shared across requests in SSR/Node — acceptable
|
|
6718
|
+
// since there is only one active session per server instance (same pattern as
|
|
6719
|
+
// refreshInFlight in api.ts).
|
|
6720
|
+
let refreshInFlight$1 = null;
|
|
6721
|
+
let refreshInFlightToken = null;
|
|
6458
6722
|
async function refreshSession(refreshToken) {
|
|
6459
|
-
|
|
6460
|
-
|
|
6461
|
-
|
|
6462
|
-
|
|
6463
|
-
|
|
6464
|
-
|
|
6465
|
-
|
|
6466
|
-
|
|
6723
|
+
if (refreshInFlight$1 && refreshInFlightToken === refreshToken) {
|
|
6724
|
+
return refreshInFlight$1;
|
|
6725
|
+
}
|
|
6726
|
+
refreshInFlightToken = refreshToken;
|
|
6727
|
+
let currentFlight;
|
|
6728
|
+
currentFlight = refreshInFlight$1 = (async () => {
|
|
6729
|
+
try {
|
|
6730
|
+
const client = await getAxiosAuthClient();
|
|
6731
|
+
const config = await getConfig();
|
|
6732
|
+
const appId = config.appId;
|
|
6733
|
+
const response = await client.post('/session/refresh', {
|
|
6734
|
+
refreshToken,
|
|
6735
|
+
appId
|
|
6736
|
+
});
|
|
6737
|
+
return response.data;
|
|
6738
|
+
}
|
|
6739
|
+
finally {
|
|
6740
|
+
// Only clear if we're still the active in-flight request.
|
|
6741
|
+
// A second call with a different token may have replaced us.
|
|
6742
|
+
if (refreshInFlight$1 === currentFlight) {
|
|
6743
|
+
refreshInFlight$1 = null;
|
|
6744
|
+
refreshInFlightToken = null;
|
|
6745
|
+
}
|
|
6746
|
+
}
|
|
6747
|
+
})();
|
|
6748
|
+
return refreshInFlight$1;
|
|
6467
6749
|
}
|
|
6468
6750
|
async function signSessionCreateMessage(_signMessageFunction) {
|
|
6469
6751
|
}
|
|
@@ -6601,14 +6883,10 @@ class WebSessionManager {
|
|
|
6601
6883
|
WebSessionManager.TAROBASE_SESSION_STORAGE_KEY = "tarobase_session_storage";
|
|
6602
6884
|
|
|
6603
6885
|
var webSessionManager = /*#__PURE__*/Object.freeze({
|
|
6604
|
-
|
|
6605
|
-
|
|
6886
|
+
__proto__: null,
|
|
6887
|
+
WebSessionManager: WebSessionManager
|
|
6606
6888
|
});
|
|
6607
6889
|
|
|
6608
|
-
function getDefaultExportFromCjs (x) {
|
|
6609
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
6610
|
-
}
|
|
6611
|
-
|
|
6612
6890
|
var buffer$1 = {};
|
|
6613
6891
|
|
|
6614
6892
|
var base64Js$1 = {};
|
|
@@ -9405,7 +9683,19 @@ async function buildSetDocumentsTransaction(connection, idl, anchorProvider, pay
|
|
|
9405
9683
|
}
|
|
9406
9684
|
}
|
|
9407
9685
|
else if (lutKey != null) {
|
|
9408
|
-
|
|
9686
|
+
// The LUT may have just been created server-side and the client's RPC node
|
|
9687
|
+
// may not have indexed it yet (load-balancer split). Retry with exponential
|
|
9688
|
+
// back-off; first retry at 100 ms almost always resolves it.
|
|
9689
|
+
let table = null;
|
|
9690
|
+
for (let attempt = 0; attempt < 5; attempt++) {
|
|
9691
|
+
const { value } = await connection.getAddressLookupTable(new web3_js.PublicKey(lutKey));
|
|
9692
|
+
if (value) {
|
|
9693
|
+
table = value;
|
|
9694
|
+
break;
|
|
9695
|
+
}
|
|
9696
|
+
if (attempt < 4)
|
|
9697
|
+
await new Promise(r => setTimeout(r, 100 * Math.pow(2, attempt)));
|
|
9698
|
+
}
|
|
9409
9699
|
if (!table)
|
|
9410
9700
|
throw new Error('LUT not found after creation/extend');
|
|
9411
9701
|
lookupTables.push(table);
|
|
@@ -9540,8 +9830,8 @@ class ServerSessionManager {
|
|
|
9540
9830
|
ServerSessionManager.instance = new ServerSessionManager();
|
|
9541
9831
|
|
|
9542
9832
|
var serverSessionManager = /*#__PURE__*/Object.freeze({
|
|
9543
|
-
|
|
9544
|
-
|
|
9833
|
+
__proto__: null,
|
|
9834
|
+
ServerSessionManager: ServerSessionManager
|
|
9545
9835
|
});
|
|
9546
9836
|
|
|
9547
9837
|
/**
|
|
@@ -9640,6 +9930,23 @@ async function updateIdTokenAndAccessToken(idToken, accessToken, isServer = fals
|
|
|
9640
9930
|
await WebSessionManager.updateIdTokenAndAccessToken(idToken, accessToken);
|
|
9641
9931
|
}
|
|
9642
9932
|
|
|
9933
|
+
const apiClient = globalAxios.create();
|
|
9934
|
+
axiosRetry(apiClient, {
|
|
9935
|
+
retries: 2,
|
|
9936
|
+
retryCondition: (error) => {
|
|
9937
|
+
var _a, _b;
|
|
9938
|
+
// Only retry GET requests on network errors (ECONNRESET, ETIMEDOUT, etc.)
|
|
9939
|
+
// Writes (POST/PUT) are not retried — the server may have processed
|
|
9940
|
+
// the request before the connection was reset.
|
|
9941
|
+
return axiosRetry.isNetworkError(error) && ((_b = (_a = error.config) === null || _a === void 0 ? void 0 : _a.method) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === 'get';
|
|
9942
|
+
},
|
|
9943
|
+
retryDelay: axiosRetry.exponentialDelay,
|
|
9944
|
+
shouldResetTimeout: true,
|
|
9945
|
+
onRetry: (retryCount, error, requestConfig) => {
|
|
9946
|
+
var _a;
|
|
9947
|
+
console.warn(`[tarobase-sdk] retry ${retryCount} for ${(_a = requestConfig.method) === null || _a === void 0 ? void 0 : _a.toUpperCase()} ${requestConfig.url} — ${error.code || error.message}`);
|
|
9948
|
+
},
|
|
9949
|
+
});
|
|
9643
9950
|
const refreshInFlight = new Map();
|
|
9644
9951
|
async function refreshAuthSessionOnce(appId, isServer) {
|
|
9645
9952
|
const key = `${isServer ? "server" : "web"}:${appId}`;
|
|
@@ -9686,6 +9993,7 @@ async function makeApiRequest(method, urlPath, data, _overrides) {
|
|
|
9686
9993
|
ServerSessionManager.instance.clearSession();
|
|
9687
9994
|
};
|
|
9688
9995
|
async function executeRequest() {
|
|
9996
|
+
var _a;
|
|
9689
9997
|
// When _getAuthHeaders is provided (wallet client), use it as the sole auth source.
|
|
9690
9998
|
// Otherwise use the global createAuthHeader (default path).
|
|
9691
9999
|
const authHeader = (_overrides === null || _overrides === void 0 ? void 0 : _overrides._getAuthHeaders)
|
|
@@ -9707,11 +10015,12 @@ async function makeApiRequest(method, urlPath, data, _overrides) {
|
|
|
9707
10015
|
method,
|
|
9708
10016
|
url: `${config.apiUrl}${urlPath.startsWith("/") ? urlPath : `/${urlPath}`}`,
|
|
9709
10017
|
headers,
|
|
10018
|
+
timeout: (_a = _overrides === null || _overrides === void 0 ? void 0 : _overrides.timeout) !== null && _a !== void 0 ? _a : 30000,
|
|
9710
10019
|
};
|
|
9711
10020
|
if (method !== "GET" && method !== "get") {
|
|
9712
10021
|
requestConfig.data = data ? JSON.stringify(data) : {};
|
|
9713
10022
|
}
|
|
9714
|
-
const response = await
|
|
10023
|
+
const response = await apiClient(requestConfig);
|
|
9715
10024
|
return { data: response.data, status: response.status, headers: response.headers };
|
|
9716
10025
|
}
|
|
9717
10026
|
try {
|
|
@@ -10122,6 +10431,90 @@ function cleanupExpiredCache() {
|
|
|
10122
10431
|
});
|
|
10123
10432
|
lastCacheCleanup = now;
|
|
10124
10433
|
}
|
|
10434
|
+
async function getMany(paths, opts = {}) {
|
|
10435
|
+
if (paths.length === 0) {
|
|
10436
|
+
return [];
|
|
10437
|
+
}
|
|
10438
|
+
if (paths.length > 30) {
|
|
10439
|
+
throw new Error('Cannot fetch more than 30 documents at once');
|
|
10440
|
+
}
|
|
10441
|
+
const normalizedPaths = [];
|
|
10442
|
+
for (const path of paths) {
|
|
10443
|
+
let normalizedPath = path.startsWith("/") ? path.slice(1) : path;
|
|
10444
|
+
if (normalizedPath.endsWith("*") && normalizedPath.length > 1) {
|
|
10445
|
+
normalizedPath = normalizedPath.slice(0, -1);
|
|
10446
|
+
}
|
|
10447
|
+
if (!normalizedPath || normalizedPath.length === 0) {
|
|
10448
|
+
throw new Error(`Invalid path provided: ${path}`);
|
|
10449
|
+
}
|
|
10450
|
+
const pathIsDocument = normalizedPath.split("/").length % 2 === 0;
|
|
10451
|
+
if (!pathIsDocument) {
|
|
10452
|
+
throw new Error(`Path must point to a document (even number of segments): ${path}`);
|
|
10453
|
+
}
|
|
10454
|
+
normalizedPaths.push(normalizedPath);
|
|
10455
|
+
}
|
|
10456
|
+
const now = Date.now();
|
|
10457
|
+
const results = new Array(paths.length);
|
|
10458
|
+
const uncachedIndices = [];
|
|
10459
|
+
const uncachedPaths = [];
|
|
10460
|
+
for (let i = 0; i < normalizedPaths.length; i++) {
|
|
10461
|
+
const normalizedPath = normalizedPaths[i];
|
|
10462
|
+
const cacheKey = `${normalizedPath}:`;
|
|
10463
|
+
if (!opts.bypassCache && getCache[cacheKey] && now < getCache[cacheKey].expiresAt) {
|
|
10464
|
+
results[i] = { path: normalizedPath, data: getCache[cacheKey].data };
|
|
10465
|
+
}
|
|
10466
|
+
else {
|
|
10467
|
+
uncachedIndices.push(i);
|
|
10468
|
+
uncachedPaths.push(normalizedPath);
|
|
10469
|
+
}
|
|
10470
|
+
}
|
|
10471
|
+
if (uncachedPaths.length > 0) {
|
|
10472
|
+
try {
|
|
10473
|
+
const response = await makeApiRequest('POST', 'items/batch', { paths: uncachedPaths }, opts._overrides);
|
|
10474
|
+
const serverResults = response.data.results;
|
|
10475
|
+
const serverResultsMap = new Map();
|
|
10476
|
+
for (const result of serverResults) {
|
|
10477
|
+
serverResultsMap.set(result.path, result);
|
|
10478
|
+
}
|
|
10479
|
+
for (let i = 0; i < uncachedIndices.length; i++) {
|
|
10480
|
+
const originalIndex = uncachedIndices[i];
|
|
10481
|
+
const normalizedPath = uncachedPaths[i];
|
|
10482
|
+
const serverResult = serverResultsMap.get(normalizedPath);
|
|
10483
|
+
if (serverResult) {
|
|
10484
|
+
results[originalIndex] = serverResult;
|
|
10485
|
+
if (!serverResult.error && !opts.bypassCache) {
|
|
10486
|
+
const cacheKey = `${normalizedPath}:`;
|
|
10487
|
+
getCache[cacheKey] = {
|
|
10488
|
+
data: serverResult.data,
|
|
10489
|
+
expiresAt: now + GET_CACHE_TTL
|
|
10490
|
+
};
|
|
10491
|
+
}
|
|
10492
|
+
}
|
|
10493
|
+
else {
|
|
10494
|
+
results[originalIndex] = {
|
|
10495
|
+
path: normalizedPath,
|
|
10496
|
+
data: null,
|
|
10497
|
+
error: { code: 'NOT_FOUND', message: `No result returned for path ${normalizedPath}` }
|
|
10498
|
+
};
|
|
10499
|
+
}
|
|
10500
|
+
}
|
|
10501
|
+
if (now - lastCacheCleanup > 5000) {
|
|
10502
|
+
cleanupExpiredCache();
|
|
10503
|
+
lastCacheCleanup = now;
|
|
10504
|
+
}
|
|
10505
|
+
}
|
|
10506
|
+
catch (error) {
|
|
10507
|
+
for (const originalIndex of uncachedIndices) {
|
|
10508
|
+
results[originalIndex] = {
|
|
10509
|
+
path: normalizedPaths[originalIndex],
|
|
10510
|
+
data: null,
|
|
10511
|
+
error: { code: 'NOT_FOUND', message: error instanceof Error ? error.message : 'Unknown error' }
|
|
10512
|
+
};
|
|
10513
|
+
}
|
|
10514
|
+
}
|
|
10515
|
+
}
|
|
10516
|
+
return results;
|
|
10517
|
+
}
|
|
10125
10518
|
async function runQuery(absolutePath, queryName, queryArgs, opts) {
|
|
10126
10519
|
const result = await runQueryMany([{ absolutePath, queryName, queryArgs }], opts);
|
|
10127
10520
|
return result[0];
|
|
@@ -10563,6 +10956,7 @@ function scheduleTokenRefresh(connection, isServer) {
|
|
|
10563
10956
|
// This replaces the old single setTimeout approach which was unreliable for long
|
|
10564
10957
|
// delays (browsers throttle/suspend timers in background tabs).
|
|
10565
10958
|
connection.tokenRefreshTimer = setInterval(async () => {
|
|
10959
|
+
var _a, _b;
|
|
10566
10960
|
try {
|
|
10567
10961
|
const currentToken = await getIdToken$1(isServer);
|
|
10568
10962
|
if (!currentToken)
|
|
@@ -10593,6 +10987,17 @@ function scheduleTokenRefresh(connection, isServer) {
|
|
|
10593
10987
|
}
|
|
10594
10988
|
}
|
|
10595
10989
|
catch (refreshError) {
|
|
10990
|
+
// If the refresh token itself is invalid (401/403), stop retrying —
|
|
10991
|
+
// the token won't magically become valid next interval, and continuing
|
|
10992
|
+
// to hammer /session/refresh causes 429 rate-limit storms.
|
|
10993
|
+
if (((_a = refreshError === null || refreshError === void 0 ? void 0 : refreshError.response) === null || _a === void 0 ? void 0 : _a.status) === 401 || ((_b = refreshError === null || refreshError === void 0 ? void 0 : refreshError.response) === null || _b === void 0 ? void 0 : _b.status) === 403) {
|
|
10994
|
+
console.warn('[WS v2] Refresh token rejected (401/403), stopping periodic refresh');
|
|
10995
|
+
if (connection.tokenRefreshTimer) {
|
|
10996
|
+
clearInterval(connection.tokenRefreshTimer);
|
|
10997
|
+
connection.tokenRefreshTimer = null;
|
|
10998
|
+
}
|
|
10999
|
+
return;
|
|
11000
|
+
}
|
|
10596
11001
|
console.warn('[WS v2] Proactive token refresh failed, will retry next interval:', refreshError);
|
|
10597
11002
|
}
|
|
10598
11003
|
}
|
|
@@ -10603,6 +11008,7 @@ function scheduleTokenRefresh(connection, isServer) {
|
|
|
10603
11008
|
}, TOKEN_CHECK_INTERVAL);
|
|
10604
11009
|
}
|
|
10605
11010
|
async function getFreshAuthToken(isServer) {
|
|
11011
|
+
var _a, _b;
|
|
10606
11012
|
const currentToken = await getIdToken$1(isServer);
|
|
10607
11013
|
if (!currentToken) {
|
|
10608
11014
|
return null;
|
|
@@ -10625,6 +11031,17 @@ async function getFreshAuthToken(isServer) {
|
|
|
10625
11031
|
}
|
|
10626
11032
|
catch (error) {
|
|
10627
11033
|
console.error('[WS v2] Error refreshing token:', error);
|
|
11034
|
+
// If the refresh token is permanently invalid (401/403), clear the stale
|
|
11035
|
+
// session from storage so future attempts don't keep retrying with it.
|
|
11036
|
+
if (!isServer && (((_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.status) === 401 || ((_b = error === null || error === void 0 ? void 0 : error.response) === null || _b === void 0 ? void 0 : _b.status) === 403)) {
|
|
11037
|
+
try {
|
|
11038
|
+
const { WebSessionManager } = await Promise.resolve().then(function () { return webSessionManager; });
|
|
11039
|
+
WebSessionManager.clearSession();
|
|
11040
|
+
}
|
|
11041
|
+
catch (clearError) {
|
|
11042
|
+
console.warn('[WS v2] Failed to clear stale session:', clearError);
|
|
11043
|
+
}
|
|
11044
|
+
}
|
|
10628
11045
|
}
|
|
10629
11046
|
// Return null instead of the expired token to prevent infinite 401 reconnect storms.
|
|
10630
11047
|
// The server accepts unauthenticated connections; auth-required subscriptions will
|
|
@@ -10745,7 +11162,16 @@ async function getOrCreateConnection(appId, isServer) {
|
|
|
10745
11162
|
ws.addEventListener('open', () => {
|
|
10746
11163
|
connection.isConnecting = false;
|
|
10747
11164
|
connection.isConnected = true;
|
|
10748
|
-
|
|
11165
|
+
// NOTE: Do NOT reset consecutiveAuthFailures here. It is reset when a
|
|
11166
|
+
// fresh auth token is actually obtained (in urlProvider, line ~389) or on
|
|
11167
|
+
// an explicit auth change (reconnectWithNewAuthV2, line ~854). Resetting
|
|
11168
|
+
// on every 'open' event created an infinite loop: auth fails 5x → connect
|
|
11169
|
+
// without auth → open resets counter → disconnect → auth fails 5x again →
|
|
11170
|
+
// repeat forever, hammering /session/refresh and causing 429s.
|
|
11171
|
+
//
|
|
11172
|
+
// An elevated counter is safe for anonymous/guest sessions: when there's no
|
|
11173
|
+
// token at all (getIdToken returns null), the counter is never checked —
|
|
11174
|
+
// urlProvider skips straight to unauthenticated connection.
|
|
10749
11175
|
// Schedule periodic token freshness checks
|
|
10750
11176
|
scheduleTokenRefresh(connection, isServer);
|
|
10751
11177
|
// Re-subscribe to all existing subscriptions after reconnect
|
|
@@ -15217,7 +15643,7 @@ async function loadDependencies() {
|
|
|
15217
15643
|
const [reactModule, reactDomModule, phantomModule] = await Promise.all([
|
|
15218
15644
|
import('react'),
|
|
15219
15645
|
import('react-dom/client'),
|
|
15220
|
-
Promise.resolve().then(function () { return require('./index-
|
|
15646
|
+
Promise.resolve().then(function () { return require('./index-CKaaE12K.js'); })
|
|
15221
15647
|
]);
|
|
15222
15648
|
// Extract default export from ESM module namespace
|
|
15223
15649
|
// Dynamic import() returns { default: Module, ...exports }, not the module directly
|
|
@@ -20573,7 +20999,7 @@ async function loadMwaProtocol() {
|
|
|
20573
20999
|
return mwaProtocolLoadPromise;
|
|
20574
21000
|
mwaProtocolLoadPromise = (async () => {
|
|
20575
21001
|
try {
|
|
20576
|
-
mwaProtocolModule = await Promise.resolve().then(function () { return require('./index.browser-
|
|
21002
|
+
mwaProtocolModule = await Promise.resolve().then(function () { return require('./index.browser-BMtEulGJ.js'); });
|
|
20577
21003
|
}
|
|
20578
21004
|
catch (e) {
|
|
20579
21005
|
console.warn('[SolanaMobileWallet] @solana-mobile/mobile-wallet-adapter-protocol-web3js not installed. Install it to enable Seeker wallet support.');
|
|
@@ -20595,7 +21021,7 @@ async function registerMobileWalletAdapter(config) {
|
|
|
20595
21021
|
if (typeof window === 'undefined')
|
|
20596
21022
|
return;
|
|
20597
21023
|
try {
|
|
20598
|
-
const walletStandardMobile = await Promise.resolve().then(function () { return require('./index.browser-
|
|
21024
|
+
const walletStandardMobile = await Promise.resolve().then(function () { return require('./index.browser-AZQ5TnZ4.js'); });
|
|
20599
21025
|
const registerMwa = walletStandardMobile.registerMwa || ((_a = walletStandardMobile.default) === null || _a === void 0 ? void 0 : _a.registerMwa);
|
|
20600
21026
|
if (!registerMwa) {
|
|
20601
21027
|
console.warn('[SolanaMobileWallet] registerMwa not found in @solana-mobile/wallet-standard-mobile');
|
|
@@ -21536,6 +21962,7 @@ exports.getCurrentUser = getCurrentUser;
|
|
|
21536
21962
|
exports.getDefaultExportFromCjs = getDefaultExportFromCjs$1;
|
|
21537
21963
|
exports.getFiles = getFiles;
|
|
21538
21964
|
exports.getIdToken = getIdToken;
|
|
21965
|
+
exports.getMany = getMany;
|
|
21539
21966
|
exports.getPlatform = getPlatform;
|
|
21540
21967
|
exports.init = init;
|
|
21541
21968
|
exports.isMobileWalletAvailable = isMobileWalletAvailable;
|
|
@@ -21560,4 +21987,4 @@ exports.signSessionCreateMessage = signSessionCreateMessage;
|
|
|
21560
21987
|
exports.signTransaction = signTransaction;
|
|
21561
21988
|
exports.subscribe = subscribe;
|
|
21562
21989
|
exports.useAuth = useAuth;
|
|
21563
|
-
//# sourceMappingURL=index-
|
|
21990
|
+
//# sourceMappingURL=index-Cp727oEW.js.map
|