@xchainjs/xchain-aggregator 2.0.35 → 2.1.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/lib/index.esm.js +346 -45
- package/lib/index.js +346 -45
- package/package.json +5 -5
package/lib/index.esm.js
CHANGED
|
@@ -6081,36 +6081,36 @@ function requireIsRetryAllowed () {
|
|
|
6081
6081
|
var isRetryAllowedExports = requireIsRetryAllowed();
|
|
6082
6082
|
var isRetryAllowed = /*@__PURE__*/getDefaultExportFromCjs(isRetryAllowedExports);
|
|
6083
6083
|
|
|
6084
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
6084
|
+
function asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
6085
6085
|
|
|
6086
|
-
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
6086
|
+
function _asyncToGenerator$1(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
6087
6087
|
|
|
6088
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
6088
|
+
function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
6089
6089
|
|
|
6090
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
6090
|
+
function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$1(Object(source), true).forEach(function (key) { _defineProperty$1(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
6091
6091
|
|
|
6092
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6093
|
-
var namespace = 'axios-retry';
|
|
6092
|
+
function _defineProperty$1(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6093
|
+
var namespace$1 = 'axios-retry';
|
|
6094
6094
|
/**
|
|
6095
6095
|
* @param {Error} error
|
|
6096
6096
|
* @return {boolean}
|
|
6097
6097
|
*/
|
|
6098
6098
|
|
|
6099
|
-
function isNetworkError(error) {
|
|
6099
|
+
function isNetworkError$1(error) {
|
|
6100
6100
|
var CODE_EXCLUDE_LIST = ['ERR_CANCELED', 'ECONNABORTED'];
|
|
6101
6101
|
return !error.response && Boolean(error.code) && // Prevents retrying cancelled requests
|
|
6102
6102
|
!CODE_EXCLUDE_LIST.includes(error.code) && // Prevents retrying timed out & cancelled requests
|
|
6103
6103
|
isRetryAllowed(error) // Prevents retrying unsafe errors
|
|
6104
6104
|
;
|
|
6105
6105
|
}
|
|
6106
|
-
var SAFE_HTTP_METHODS = ['get', 'head', 'options'];
|
|
6107
|
-
var IDEMPOTENT_HTTP_METHODS = SAFE_HTTP_METHODS.concat(['put', 'delete']);
|
|
6106
|
+
var SAFE_HTTP_METHODS$1 = ['get', 'head', 'options'];
|
|
6107
|
+
var IDEMPOTENT_HTTP_METHODS$1 = SAFE_HTTP_METHODS$1.concat(['put', 'delete']);
|
|
6108
6108
|
/**
|
|
6109
6109
|
* @param {Error} error
|
|
6110
6110
|
* @return {boolean}
|
|
6111
6111
|
*/
|
|
6112
6112
|
|
|
6113
|
-
function isRetryableError(error) {
|
|
6113
|
+
function isRetryableError$1(error) {
|
|
6114
6114
|
return error.code !== 'ECONNABORTED' && (!error.response || error.response.status >= 500 && error.response.status <= 599);
|
|
6115
6115
|
}
|
|
6116
6116
|
/**
|
|
@@ -6118,40 +6118,40 @@ function isRetryableError(error) {
|
|
|
6118
6118
|
* @return {boolean}
|
|
6119
6119
|
*/
|
|
6120
6120
|
|
|
6121
|
-
function isSafeRequestError(error) {
|
|
6121
|
+
function isSafeRequestError$1(error) {
|
|
6122
6122
|
if (!error.config) {
|
|
6123
6123
|
// Cannot determine if the request can be retried
|
|
6124
6124
|
return false;
|
|
6125
6125
|
}
|
|
6126
6126
|
|
|
6127
|
-
return isRetryableError(error) && SAFE_HTTP_METHODS.indexOf(error.config.method) !== -1;
|
|
6127
|
+
return isRetryableError$1(error) && SAFE_HTTP_METHODS$1.indexOf(error.config.method) !== -1;
|
|
6128
6128
|
}
|
|
6129
6129
|
/**
|
|
6130
6130
|
* @param {Error} error
|
|
6131
6131
|
* @return {boolean}
|
|
6132
6132
|
*/
|
|
6133
6133
|
|
|
6134
|
-
function isIdempotentRequestError(error) {
|
|
6134
|
+
function isIdempotentRequestError$1(error) {
|
|
6135
6135
|
if (!error.config) {
|
|
6136
6136
|
// Cannot determine if the request can be retried
|
|
6137
6137
|
return false;
|
|
6138
6138
|
}
|
|
6139
6139
|
|
|
6140
|
-
return isRetryableError(error) && IDEMPOTENT_HTTP_METHODS.indexOf(error.config.method) !== -1;
|
|
6140
|
+
return isRetryableError$1(error) && IDEMPOTENT_HTTP_METHODS$1.indexOf(error.config.method) !== -1;
|
|
6141
6141
|
}
|
|
6142
6142
|
/**
|
|
6143
6143
|
* @param {Error} error
|
|
6144
6144
|
* @return {boolean}
|
|
6145
6145
|
*/
|
|
6146
6146
|
|
|
6147
|
-
function isNetworkOrIdempotentRequestError(error) {
|
|
6148
|
-
return isNetworkError(error) || isIdempotentRequestError(error);
|
|
6147
|
+
function isNetworkOrIdempotentRequestError$1(error) {
|
|
6148
|
+
return isNetworkError$1(error) || isIdempotentRequestError$1(error);
|
|
6149
6149
|
}
|
|
6150
6150
|
/**
|
|
6151
6151
|
* @return {number} - delay in milliseconds, always 0
|
|
6152
6152
|
*/
|
|
6153
6153
|
|
|
6154
|
-
function noDelay() {
|
|
6154
|
+
function noDelay$1() {
|
|
6155
6155
|
return 0;
|
|
6156
6156
|
}
|
|
6157
6157
|
/**
|
|
@@ -6164,7 +6164,7 @@ function noDelay() {
|
|
|
6164
6164
|
*/
|
|
6165
6165
|
|
|
6166
6166
|
|
|
6167
|
-
function exponentialDelay() {
|
|
6167
|
+
function exponentialDelay$1() {
|
|
6168
6168
|
var retryNumber = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
6169
6169
|
var delayFactor = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 100;
|
|
6170
6170
|
var delay = Math.pow(2, retryNumber) * delayFactor;
|
|
@@ -6174,10 +6174,10 @@ function exponentialDelay() {
|
|
|
6174
6174
|
}
|
|
6175
6175
|
/** @type {IAxiosRetryConfig} */
|
|
6176
6176
|
|
|
6177
|
-
var DEFAULT_OPTIONS = {
|
|
6177
|
+
var DEFAULT_OPTIONS$1 = {
|
|
6178
6178
|
retries: 3,
|
|
6179
|
-
retryCondition: isNetworkOrIdempotentRequestError,
|
|
6180
|
-
retryDelay: noDelay,
|
|
6179
|
+
retryCondition: isNetworkOrIdempotentRequestError$1,
|
|
6180
|
+
retryDelay: noDelay$1,
|
|
6181
6181
|
shouldResetTimeout: false,
|
|
6182
6182
|
onRetry: () => {}
|
|
6183
6183
|
};
|
|
@@ -6188,8 +6188,8 @@ var DEFAULT_OPTIONS = {
|
|
|
6188
6188
|
* @return {IAxiosRetryConfigExtended}
|
|
6189
6189
|
*/
|
|
6190
6190
|
|
|
6191
|
-
function getRequestOptions(config, defaultOptions) {
|
|
6192
|
-
return _objectSpread(_objectSpread(_objectSpread({}, DEFAULT_OPTIONS), defaultOptions), config[namespace]);
|
|
6191
|
+
function getRequestOptions$1(config, defaultOptions) {
|
|
6192
|
+
return _objectSpread$1(_objectSpread$1(_objectSpread$1({}, DEFAULT_OPTIONS$1), defaultOptions), config[namespace$1]);
|
|
6193
6193
|
}
|
|
6194
6194
|
/**
|
|
6195
6195
|
* Initializes and returns the retry state for the given request/config
|
|
@@ -6199,10 +6199,10 @@ function getRequestOptions(config, defaultOptions) {
|
|
|
6199
6199
|
*/
|
|
6200
6200
|
|
|
6201
6201
|
|
|
6202
|
-
function getCurrentState(config, defaultOptions) {
|
|
6203
|
-
var currentState = getRequestOptions(config, defaultOptions);
|
|
6202
|
+
function getCurrentState$1(config, defaultOptions) {
|
|
6203
|
+
var currentState = getRequestOptions$1(config, defaultOptions);
|
|
6204
6204
|
currentState.retryCount = currentState.retryCount || 0;
|
|
6205
|
-
config[namespace] = currentState;
|
|
6205
|
+
config[namespace$1] = currentState;
|
|
6206
6206
|
return currentState;
|
|
6207
6207
|
}
|
|
6208
6208
|
/**
|
|
@@ -6211,7 +6211,7 @@ function getCurrentState(config, defaultOptions) {
|
|
|
6211
6211
|
*/
|
|
6212
6212
|
|
|
6213
6213
|
|
|
6214
|
-
function fixConfig(axios, config) {
|
|
6214
|
+
function fixConfig$1(axios, config) {
|
|
6215
6215
|
if (axios.defaults.agent === config.agent) {
|
|
6216
6216
|
delete config.agent;
|
|
6217
6217
|
}
|
|
@@ -6232,8 +6232,8 @@ function fixConfig(axios, config) {
|
|
|
6232
6232
|
*/
|
|
6233
6233
|
|
|
6234
6234
|
|
|
6235
|
-
function shouldRetry(_x, _x2) {
|
|
6236
|
-
return _shouldRetry.apply(this, arguments);
|
|
6235
|
+
function shouldRetry$1(_x, _x2) {
|
|
6236
|
+
return _shouldRetry$1.apply(this, arguments);
|
|
6237
6237
|
}
|
|
6238
6238
|
/**
|
|
6239
6239
|
* Adds response interceptors to an axios instance to retry requests failed due to network issues
|
|
@@ -6293,8 +6293,8 @@ function shouldRetry(_x, _x2) {
|
|
|
6293
6293
|
*/
|
|
6294
6294
|
|
|
6295
6295
|
|
|
6296
|
-
function _shouldRetry() {
|
|
6297
|
-
_shouldRetry = _asyncToGenerator(function* (currentState, error) {
|
|
6296
|
+
function _shouldRetry$1() {
|
|
6297
|
+
_shouldRetry$1 = _asyncToGenerator$1(function* (currentState, error) {
|
|
6298
6298
|
var {
|
|
6299
6299
|
retries,
|
|
6300
6300
|
retryCondition
|
|
@@ -6313,17 +6313,17 @@ function _shouldRetry() {
|
|
|
6313
6313
|
|
|
6314
6314
|
return shouldRetryOrPromise;
|
|
6315
6315
|
});
|
|
6316
|
-
return _shouldRetry.apply(this, arguments);
|
|
6316
|
+
return _shouldRetry$1.apply(this, arguments);
|
|
6317
6317
|
}
|
|
6318
6318
|
|
|
6319
|
-
function axiosRetry(axios, defaultOptions) {
|
|
6319
|
+
function axiosRetry$1(axios, defaultOptions) {
|
|
6320
6320
|
var requestInterceptorId = axios.interceptors.request.use(config => {
|
|
6321
|
-
var currentState = getCurrentState(config, defaultOptions);
|
|
6321
|
+
var currentState = getCurrentState$1(config, defaultOptions);
|
|
6322
6322
|
currentState.lastRequestTime = Date.now();
|
|
6323
6323
|
return config;
|
|
6324
6324
|
});
|
|
6325
6325
|
var responseInterceptorId = axios.interceptors.response.use(null, /*#__PURE__*/function () {
|
|
6326
|
-
var _ref = _asyncToGenerator(function* (error) {
|
|
6326
|
+
var _ref = _asyncToGenerator$1(function* (error) {
|
|
6327
6327
|
var {
|
|
6328
6328
|
config
|
|
6329
6329
|
} = error; // If we have no information to retry the request
|
|
@@ -6332,9 +6332,9 @@ function axiosRetry(axios, defaultOptions) {
|
|
|
6332
6332
|
return Promise.reject(error);
|
|
6333
6333
|
}
|
|
6334
6334
|
|
|
6335
|
-
var currentState = getCurrentState(config, defaultOptions);
|
|
6335
|
+
var currentState = getCurrentState$1(config, defaultOptions);
|
|
6336
6336
|
|
|
6337
|
-
if (yield shouldRetry(currentState, error)) {
|
|
6337
|
+
if (yield shouldRetry$1(currentState, error)) {
|
|
6338
6338
|
currentState.retryCount += 1;
|
|
6339
6339
|
var {
|
|
6340
6340
|
retryDelay,
|
|
@@ -6344,7 +6344,7 @@ function axiosRetry(axios, defaultOptions) {
|
|
|
6344
6344
|
var delay = retryDelay(currentState.retryCount, error); // Axios fails merging this configuration to the default configuration because it has an issue
|
|
6345
6345
|
// with circular structures: https://github.com/mzabriskie/axios/issues/370
|
|
6346
6346
|
|
|
6347
|
-
fixConfig(axios, config);
|
|
6347
|
+
fixConfig$1(axios, config);
|
|
6348
6348
|
|
|
6349
6349
|
if (!shouldResetTimeout && config.timeout && currentState.lastRequestTime) {
|
|
6350
6350
|
var lastRequestDuration = Date.now() - currentState.lastRequestTime;
|
|
@@ -6375,12 +6375,12 @@ function axiosRetry(axios, defaultOptions) {
|
|
|
6375
6375
|
};
|
|
6376
6376
|
} // Compatibility with CommonJS
|
|
6377
6377
|
|
|
6378
|
-
axiosRetry.isNetworkError = isNetworkError;
|
|
6379
|
-
axiosRetry.isSafeRequestError = isSafeRequestError;
|
|
6380
|
-
axiosRetry.isIdempotentRequestError = isIdempotentRequestError;
|
|
6381
|
-
axiosRetry.isNetworkOrIdempotentRequestError = isNetworkOrIdempotentRequestError;
|
|
6382
|
-
axiosRetry.exponentialDelay = exponentialDelay;
|
|
6383
|
-
axiosRetry.isRetryableError = isRetryableError;
|
|
6378
|
+
axiosRetry$1.isNetworkError = isNetworkError$1;
|
|
6379
|
+
axiosRetry$1.isSafeRequestError = isSafeRequestError$1;
|
|
6380
|
+
axiosRetry$1.isIdempotentRequestError = isIdempotentRequestError$1;
|
|
6381
|
+
axiosRetry$1.isNetworkOrIdempotentRequestError = isNetworkOrIdempotentRequestError$1;
|
|
6382
|
+
axiosRetry$1.exponentialDelay = exponentialDelay$1;
|
|
6383
|
+
axiosRetry$1.isRetryableError = isRetryableError$1;
|
|
6384
6384
|
|
|
6385
6385
|
/******************************************************************************
|
|
6386
6386
|
Copyright (c) Microsoft Corporation.
|
|
@@ -6444,7 +6444,7 @@ let MidgardApi$1 = class MidgardApi {
|
|
|
6444
6444
|
constructor(network = Network.Mainnet, config) {
|
|
6445
6445
|
this.network = network;
|
|
6446
6446
|
this.config = config !== null && config !== void 0 ? config : defaultMidgardConfig$1[this.network];
|
|
6447
|
-
axiosRetry(axios, { retries: this.config.apiRetries, retryDelay: axiosRetry.exponentialDelay });
|
|
6447
|
+
axiosRetry$1(axios, { retries: this.config.apiRetries, retryDelay: axiosRetry$1.exponentialDelay });
|
|
6448
6448
|
this.midgardClients = this.config.midgardBaseUrls.map((url) => new MidgardApi$2(new Configuration$1({ basePath: url })));
|
|
6449
6449
|
}
|
|
6450
6450
|
/**
|
|
@@ -8871,6 +8871,307 @@ class MidgardApi extends DefaultApi {
|
|
|
8871
8871
|
}
|
|
8872
8872
|
}
|
|
8873
8873
|
|
|
8874
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
8875
|
+
|
|
8876
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
8877
|
+
|
|
8878
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
8879
|
+
|
|
8880
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
8881
|
+
|
|
8882
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
8883
|
+
var namespace = 'axios-retry';
|
|
8884
|
+
/**
|
|
8885
|
+
* @param {Error} error
|
|
8886
|
+
* @return {boolean}
|
|
8887
|
+
*/
|
|
8888
|
+
|
|
8889
|
+
function isNetworkError(error) {
|
|
8890
|
+
var CODE_EXCLUDE_LIST = ['ERR_CANCELED', 'ECONNABORTED'];
|
|
8891
|
+
return !error.response && Boolean(error.code) && // Prevents retrying cancelled requests
|
|
8892
|
+
!CODE_EXCLUDE_LIST.includes(error.code) && // Prevents retrying timed out & cancelled requests
|
|
8893
|
+
isRetryAllowed(error) // Prevents retrying unsafe errors
|
|
8894
|
+
;
|
|
8895
|
+
}
|
|
8896
|
+
var SAFE_HTTP_METHODS = ['get', 'head', 'options'];
|
|
8897
|
+
var IDEMPOTENT_HTTP_METHODS = SAFE_HTTP_METHODS.concat(['put', 'delete']);
|
|
8898
|
+
/**
|
|
8899
|
+
* @param {Error} error
|
|
8900
|
+
* @return {boolean}
|
|
8901
|
+
*/
|
|
8902
|
+
|
|
8903
|
+
function isRetryableError(error) {
|
|
8904
|
+
return error.code !== 'ECONNABORTED' && (!error.response || error.response.status >= 500 && error.response.status <= 599);
|
|
8905
|
+
}
|
|
8906
|
+
/**
|
|
8907
|
+
* @param {Error} error
|
|
8908
|
+
* @return {boolean}
|
|
8909
|
+
*/
|
|
8910
|
+
|
|
8911
|
+
function isSafeRequestError(error) {
|
|
8912
|
+
if (!error.config) {
|
|
8913
|
+
// Cannot determine if the request can be retried
|
|
8914
|
+
return false;
|
|
8915
|
+
}
|
|
8916
|
+
|
|
8917
|
+
return isRetryableError(error) && SAFE_HTTP_METHODS.indexOf(error.config.method) !== -1;
|
|
8918
|
+
}
|
|
8919
|
+
/**
|
|
8920
|
+
* @param {Error} error
|
|
8921
|
+
* @return {boolean}
|
|
8922
|
+
*/
|
|
8923
|
+
|
|
8924
|
+
function isIdempotentRequestError(error) {
|
|
8925
|
+
if (!error.config) {
|
|
8926
|
+
// Cannot determine if the request can be retried
|
|
8927
|
+
return false;
|
|
8928
|
+
}
|
|
8929
|
+
|
|
8930
|
+
return isRetryableError(error) && IDEMPOTENT_HTTP_METHODS.indexOf(error.config.method) !== -1;
|
|
8931
|
+
}
|
|
8932
|
+
/**
|
|
8933
|
+
* @param {Error} error
|
|
8934
|
+
* @return {boolean}
|
|
8935
|
+
*/
|
|
8936
|
+
|
|
8937
|
+
function isNetworkOrIdempotentRequestError(error) {
|
|
8938
|
+
return isNetworkError(error) || isIdempotentRequestError(error);
|
|
8939
|
+
}
|
|
8940
|
+
/**
|
|
8941
|
+
* @return {number} - delay in milliseconds, always 0
|
|
8942
|
+
*/
|
|
8943
|
+
|
|
8944
|
+
function noDelay() {
|
|
8945
|
+
return 0;
|
|
8946
|
+
}
|
|
8947
|
+
/**
|
|
8948
|
+
* Set delayFactor 1000 for an exponential delay to occur on the order
|
|
8949
|
+
* of seconds
|
|
8950
|
+
* @param {number} [retryNumber=0]
|
|
8951
|
+
* @param {Error} error - unused; for existing API of retryDelay callback
|
|
8952
|
+
* @param {number} [delayFactor=100] milliseconds
|
|
8953
|
+
* @return {number} - delay in milliseconds
|
|
8954
|
+
*/
|
|
8955
|
+
|
|
8956
|
+
|
|
8957
|
+
function exponentialDelay() {
|
|
8958
|
+
var retryNumber = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
8959
|
+
var delayFactor = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 100;
|
|
8960
|
+
var delay = Math.pow(2, retryNumber) * delayFactor;
|
|
8961
|
+
var randomSum = delay * 0.2 * Math.random(); // 0-20% of the delay
|
|
8962
|
+
|
|
8963
|
+
return delay + randomSum;
|
|
8964
|
+
}
|
|
8965
|
+
/** @type {IAxiosRetryConfig} */
|
|
8966
|
+
|
|
8967
|
+
var DEFAULT_OPTIONS = {
|
|
8968
|
+
retries: 3,
|
|
8969
|
+
retryCondition: isNetworkOrIdempotentRequestError,
|
|
8970
|
+
retryDelay: noDelay,
|
|
8971
|
+
shouldResetTimeout: false,
|
|
8972
|
+
onRetry: () => {}
|
|
8973
|
+
};
|
|
8974
|
+
/**
|
|
8975
|
+
* Returns the axios-retry options for the current request
|
|
8976
|
+
* @param {AxiosRequestConfig} config
|
|
8977
|
+
* @param {IAxiosRetryConfig} defaultOptions
|
|
8978
|
+
* @return {IAxiosRetryConfigExtended}
|
|
8979
|
+
*/
|
|
8980
|
+
|
|
8981
|
+
function getRequestOptions(config, defaultOptions) {
|
|
8982
|
+
return _objectSpread(_objectSpread(_objectSpread({}, DEFAULT_OPTIONS), defaultOptions), config[namespace]);
|
|
8983
|
+
}
|
|
8984
|
+
/**
|
|
8985
|
+
* Initializes and returns the retry state for the given request/config
|
|
8986
|
+
* @param {AxiosRequestConfig} config
|
|
8987
|
+
* @param {IAxiosRetryConfig} defaultOptions
|
|
8988
|
+
* @return {IAxiosRetryConfigExtended}
|
|
8989
|
+
*/
|
|
8990
|
+
|
|
8991
|
+
|
|
8992
|
+
function getCurrentState(config, defaultOptions) {
|
|
8993
|
+
var currentState = getRequestOptions(config, defaultOptions);
|
|
8994
|
+
currentState.retryCount = currentState.retryCount || 0;
|
|
8995
|
+
config[namespace] = currentState;
|
|
8996
|
+
return currentState;
|
|
8997
|
+
}
|
|
8998
|
+
/**
|
|
8999
|
+
* @param {Axios} axios
|
|
9000
|
+
* @param {AxiosRequestConfig} config
|
|
9001
|
+
*/
|
|
9002
|
+
|
|
9003
|
+
|
|
9004
|
+
function fixConfig(axios, config) {
|
|
9005
|
+
if (axios.defaults.agent === config.agent) {
|
|
9006
|
+
delete config.agent;
|
|
9007
|
+
}
|
|
9008
|
+
|
|
9009
|
+
if (axios.defaults.httpAgent === config.httpAgent) {
|
|
9010
|
+
delete config.httpAgent;
|
|
9011
|
+
}
|
|
9012
|
+
|
|
9013
|
+
if (axios.defaults.httpsAgent === config.httpsAgent) {
|
|
9014
|
+
delete config.httpsAgent;
|
|
9015
|
+
}
|
|
9016
|
+
}
|
|
9017
|
+
/**
|
|
9018
|
+
* Checks retryCondition if request can be retried. Handles it's returning value or Promise.
|
|
9019
|
+
* @param {IAxiosRetryConfigExtended} currentState
|
|
9020
|
+
* @param {Error} error
|
|
9021
|
+
* @return {Promise<boolean>}
|
|
9022
|
+
*/
|
|
9023
|
+
|
|
9024
|
+
|
|
9025
|
+
function shouldRetry(_x, _x2) {
|
|
9026
|
+
return _shouldRetry.apply(this, arguments);
|
|
9027
|
+
}
|
|
9028
|
+
/**
|
|
9029
|
+
* Adds response interceptors to an axios instance to retry requests failed due to network issues
|
|
9030
|
+
*
|
|
9031
|
+
* @example
|
|
9032
|
+
*
|
|
9033
|
+
* import axios from 'axios';
|
|
9034
|
+
*
|
|
9035
|
+
* axiosRetry(axios, { retries: 3 });
|
|
9036
|
+
*
|
|
9037
|
+
* axios.get('http://example.com/test') // The first request fails and the second returns 'ok'
|
|
9038
|
+
* .then(result => {
|
|
9039
|
+
* result.data; // 'ok'
|
|
9040
|
+
* });
|
|
9041
|
+
*
|
|
9042
|
+
* // Exponential back-off retry delay between requests
|
|
9043
|
+
* axiosRetry(axios, { retryDelay : axiosRetry.exponentialDelay});
|
|
9044
|
+
*
|
|
9045
|
+
* // Custom retry delay
|
|
9046
|
+
* axiosRetry(axios, { retryDelay : (retryCount) => {
|
|
9047
|
+
* return retryCount * 1000;
|
|
9048
|
+
* }});
|
|
9049
|
+
*
|
|
9050
|
+
* // Also works with custom axios instances
|
|
9051
|
+
* const client = axios.create({ baseURL: 'http://example.com' });
|
|
9052
|
+
* axiosRetry(client, { retries: 3 });
|
|
9053
|
+
*
|
|
9054
|
+
* client.get('/test') // The first request fails and the second returns 'ok'
|
|
9055
|
+
* .then(result => {
|
|
9056
|
+
* result.data; // 'ok'
|
|
9057
|
+
* });
|
|
9058
|
+
*
|
|
9059
|
+
* // Allows request-specific configuration
|
|
9060
|
+
* client
|
|
9061
|
+
* .get('/test', {
|
|
9062
|
+
* 'axios-retry': {
|
|
9063
|
+
* retries: 0
|
|
9064
|
+
* }
|
|
9065
|
+
* })
|
|
9066
|
+
* .catch(error => { // The first request fails
|
|
9067
|
+
* error !== undefined
|
|
9068
|
+
* });
|
|
9069
|
+
*
|
|
9070
|
+
* @param {Axios} axios An axios instance (the axios object or one created from axios.create)
|
|
9071
|
+
* @param {Object} [defaultOptions]
|
|
9072
|
+
* @param {number} [defaultOptions.retries=3] Number of retries
|
|
9073
|
+
* @param {boolean} [defaultOptions.shouldResetTimeout=false]
|
|
9074
|
+
* Defines if the timeout should be reset between retries
|
|
9075
|
+
* @param {Function} [defaultOptions.retryCondition=isNetworkOrIdempotentRequestError]
|
|
9076
|
+
* A function to determine if the error can be retried
|
|
9077
|
+
* @param {Function} [defaultOptions.retryDelay=noDelay]
|
|
9078
|
+
* A function to determine the delay between retry requests
|
|
9079
|
+
* @param {Function} [defaultOptions.onRetry=()=>{}]
|
|
9080
|
+
* A function to get notified when a retry occurs
|
|
9081
|
+
* @return {{ requestInterceptorId: number, responseInterceptorId: number }}
|
|
9082
|
+
* The ids of the interceptors added to the request and to the response (so they can be ejected at a later time)
|
|
9083
|
+
*/
|
|
9084
|
+
|
|
9085
|
+
|
|
9086
|
+
function _shouldRetry() {
|
|
9087
|
+
_shouldRetry = _asyncToGenerator(function* (currentState, error) {
|
|
9088
|
+
var {
|
|
9089
|
+
retries,
|
|
9090
|
+
retryCondition
|
|
9091
|
+
} = currentState;
|
|
9092
|
+
var shouldRetryOrPromise = currentState.retryCount < retries && retryCondition(error); // This could be a promise
|
|
9093
|
+
|
|
9094
|
+
if (typeof shouldRetryOrPromise === 'object') {
|
|
9095
|
+
try {
|
|
9096
|
+
var shouldRetryPromiseResult = yield shouldRetryOrPromise; // keep return true unless shouldRetryPromiseResult return false for compatibility
|
|
9097
|
+
|
|
9098
|
+
return shouldRetryPromiseResult !== false;
|
|
9099
|
+
} catch (_err) {
|
|
9100
|
+
return false;
|
|
9101
|
+
}
|
|
9102
|
+
}
|
|
9103
|
+
|
|
9104
|
+
return shouldRetryOrPromise;
|
|
9105
|
+
});
|
|
9106
|
+
return _shouldRetry.apply(this, arguments);
|
|
9107
|
+
}
|
|
9108
|
+
|
|
9109
|
+
function axiosRetry(axios, defaultOptions) {
|
|
9110
|
+
var requestInterceptorId = axios.interceptors.request.use(config => {
|
|
9111
|
+
var currentState = getCurrentState(config, defaultOptions);
|
|
9112
|
+
currentState.lastRequestTime = Date.now();
|
|
9113
|
+
return config;
|
|
9114
|
+
});
|
|
9115
|
+
var responseInterceptorId = axios.interceptors.response.use(null, /*#__PURE__*/function () {
|
|
9116
|
+
var _ref = _asyncToGenerator(function* (error) {
|
|
9117
|
+
var {
|
|
9118
|
+
config
|
|
9119
|
+
} = error; // If we have no information to retry the request
|
|
9120
|
+
|
|
9121
|
+
if (!config) {
|
|
9122
|
+
return Promise.reject(error);
|
|
9123
|
+
}
|
|
9124
|
+
|
|
9125
|
+
var currentState = getCurrentState(config, defaultOptions);
|
|
9126
|
+
|
|
9127
|
+
if (yield shouldRetry(currentState, error)) {
|
|
9128
|
+
currentState.retryCount += 1;
|
|
9129
|
+
var {
|
|
9130
|
+
retryDelay,
|
|
9131
|
+
shouldResetTimeout,
|
|
9132
|
+
onRetry
|
|
9133
|
+
} = currentState;
|
|
9134
|
+
var delay = retryDelay(currentState.retryCount, error); // Axios fails merging this configuration to the default configuration because it has an issue
|
|
9135
|
+
// with circular structures: https://github.com/mzabriskie/axios/issues/370
|
|
9136
|
+
|
|
9137
|
+
fixConfig(axios, config);
|
|
9138
|
+
|
|
9139
|
+
if (!shouldResetTimeout && config.timeout && currentState.lastRequestTime) {
|
|
9140
|
+
var lastRequestDuration = Date.now() - currentState.lastRequestTime;
|
|
9141
|
+
var timeout = config.timeout - lastRequestDuration - delay;
|
|
9142
|
+
|
|
9143
|
+
if (timeout <= 0) {
|
|
9144
|
+
return Promise.reject(error);
|
|
9145
|
+
}
|
|
9146
|
+
|
|
9147
|
+
config.timeout = timeout;
|
|
9148
|
+
}
|
|
9149
|
+
|
|
9150
|
+
config.transformRequest = [data => data];
|
|
9151
|
+
yield onRetry(currentState.retryCount, error, config);
|
|
9152
|
+
return new Promise(resolve => setTimeout(() => resolve(axios(config)), delay));
|
|
9153
|
+
}
|
|
9154
|
+
|
|
9155
|
+
return Promise.reject(error);
|
|
9156
|
+
});
|
|
9157
|
+
|
|
9158
|
+
return function (_x3) {
|
|
9159
|
+
return _ref.apply(this, arguments);
|
|
9160
|
+
};
|
|
9161
|
+
}());
|
|
9162
|
+
return {
|
|
9163
|
+
requestInterceptorId,
|
|
9164
|
+
responseInterceptorId
|
|
9165
|
+
};
|
|
9166
|
+
} // Compatibility with CommonJS
|
|
9167
|
+
|
|
9168
|
+
axiosRetry.isNetworkError = isNetworkError;
|
|
9169
|
+
axiosRetry.isSafeRequestError = isSafeRequestError;
|
|
9170
|
+
axiosRetry.isIdempotentRequestError = isIdempotentRequestError;
|
|
9171
|
+
axiosRetry.isNetworkOrIdempotentRequestError = isNetworkOrIdempotentRequestError;
|
|
9172
|
+
axiosRetry.exponentialDelay = exponentialDelay;
|
|
9173
|
+
axiosRetry.isRetryableError = isRetryableError;
|
|
9174
|
+
|
|
8874
9175
|
/******************************************************************************
|
|
8875
9176
|
Copyright (c) Microsoft Corporation.
|
|
8876
9177
|
|
package/lib/index.js
CHANGED
|
@@ -6083,36 +6083,36 @@ function requireIsRetryAllowed () {
|
|
|
6083
6083
|
var isRetryAllowedExports = requireIsRetryAllowed();
|
|
6084
6084
|
var isRetryAllowed = /*@__PURE__*/getDefaultExportFromCjs(isRetryAllowedExports);
|
|
6085
6085
|
|
|
6086
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
6086
|
+
function asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
6087
6087
|
|
|
6088
|
-
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
6088
|
+
function _asyncToGenerator$1(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
6089
6089
|
|
|
6090
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
6090
|
+
function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
6091
6091
|
|
|
6092
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
6092
|
+
function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$1(Object(source), true).forEach(function (key) { _defineProperty$1(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
6093
6093
|
|
|
6094
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6095
|
-
var namespace = 'axios-retry';
|
|
6094
|
+
function _defineProperty$1(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6095
|
+
var namespace$1 = 'axios-retry';
|
|
6096
6096
|
/**
|
|
6097
6097
|
* @param {Error} error
|
|
6098
6098
|
* @return {boolean}
|
|
6099
6099
|
*/
|
|
6100
6100
|
|
|
6101
|
-
function isNetworkError(error) {
|
|
6101
|
+
function isNetworkError$1(error) {
|
|
6102
6102
|
var CODE_EXCLUDE_LIST = ['ERR_CANCELED', 'ECONNABORTED'];
|
|
6103
6103
|
return !error.response && Boolean(error.code) && // Prevents retrying cancelled requests
|
|
6104
6104
|
!CODE_EXCLUDE_LIST.includes(error.code) && // Prevents retrying timed out & cancelled requests
|
|
6105
6105
|
isRetryAllowed(error) // Prevents retrying unsafe errors
|
|
6106
6106
|
;
|
|
6107
6107
|
}
|
|
6108
|
-
var SAFE_HTTP_METHODS = ['get', 'head', 'options'];
|
|
6109
|
-
var IDEMPOTENT_HTTP_METHODS = SAFE_HTTP_METHODS.concat(['put', 'delete']);
|
|
6108
|
+
var SAFE_HTTP_METHODS$1 = ['get', 'head', 'options'];
|
|
6109
|
+
var IDEMPOTENT_HTTP_METHODS$1 = SAFE_HTTP_METHODS$1.concat(['put', 'delete']);
|
|
6110
6110
|
/**
|
|
6111
6111
|
* @param {Error} error
|
|
6112
6112
|
* @return {boolean}
|
|
6113
6113
|
*/
|
|
6114
6114
|
|
|
6115
|
-
function isRetryableError(error) {
|
|
6115
|
+
function isRetryableError$1(error) {
|
|
6116
6116
|
return error.code !== 'ECONNABORTED' && (!error.response || error.response.status >= 500 && error.response.status <= 599);
|
|
6117
6117
|
}
|
|
6118
6118
|
/**
|
|
@@ -6120,40 +6120,40 @@ function isRetryableError(error) {
|
|
|
6120
6120
|
* @return {boolean}
|
|
6121
6121
|
*/
|
|
6122
6122
|
|
|
6123
|
-
function isSafeRequestError(error) {
|
|
6123
|
+
function isSafeRequestError$1(error) {
|
|
6124
6124
|
if (!error.config) {
|
|
6125
6125
|
// Cannot determine if the request can be retried
|
|
6126
6126
|
return false;
|
|
6127
6127
|
}
|
|
6128
6128
|
|
|
6129
|
-
return isRetryableError(error) && SAFE_HTTP_METHODS.indexOf(error.config.method) !== -1;
|
|
6129
|
+
return isRetryableError$1(error) && SAFE_HTTP_METHODS$1.indexOf(error.config.method) !== -1;
|
|
6130
6130
|
}
|
|
6131
6131
|
/**
|
|
6132
6132
|
* @param {Error} error
|
|
6133
6133
|
* @return {boolean}
|
|
6134
6134
|
*/
|
|
6135
6135
|
|
|
6136
|
-
function isIdempotentRequestError(error) {
|
|
6136
|
+
function isIdempotentRequestError$1(error) {
|
|
6137
6137
|
if (!error.config) {
|
|
6138
6138
|
// Cannot determine if the request can be retried
|
|
6139
6139
|
return false;
|
|
6140
6140
|
}
|
|
6141
6141
|
|
|
6142
|
-
return isRetryableError(error) && IDEMPOTENT_HTTP_METHODS.indexOf(error.config.method) !== -1;
|
|
6142
|
+
return isRetryableError$1(error) && IDEMPOTENT_HTTP_METHODS$1.indexOf(error.config.method) !== -1;
|
|
6143
6143
|
}
|
|
6144
6144
|
/**
|
|
6145
6145
|
* @param {Error} error
|
|
6146
6146
|
* @return {boolean}
|
|
6147
6147
|
*/
|
|
6148
6148
|
|
|
6149
|
-
function isNetworkOrIdempotentRequestError(error) {
|
|
6150
|
-
return isNetworkError(error) || isIdempotentRequestError(error);
|
|
6149
|
+
function isNetworkOrIdempotentRequestError$1(error) {
|
|
6150
|
+
return isNetworkError$1(error) || isIdempotentRequestError$1(error);
|
|
6151
6151
|
}
|
|
6152
6152
|
/**
|
|
6153
6153
|
* @return {number} - delay in milliseconds, always 0
|
|
6154
6154
|
*/
|
|
6155
6155
|
|
|
6156
|
-
function noDelay() {
|
|
6156
|
+
function noDelay$1() {
|
|
6157
6157
|
return 0;
|
|
6158
6158
|
}
|
|
6159
6159
|
/**
|
|
@@ -6166,7 +6166,7 @@ function noDelay() {
|
|
|
6166
6166
|
*/
|
|
6167
6167
|
|
|
6168
6168
|
|
|
6169
|
-
function exponentialDelay() {
|
|
6169
|
+
function exponentialDelay$1() {
|
|
6170
6170
|
var retryNumber = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
6171
6171
|
var delayFactor = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 100;
|
|
6172
6172
|
var delay = Math.pow(2, retryNumber) * delayFactor;
|
|
@@ -6176,10 +6176,10 @@ function exponentialDelay() {
|
|
|
6176
6176
|
}
|
|
6177
6177
|
/** @type {IAxiosRetryConfig} */
|
|
6178
6178
|
|
|
6179
|
-
var DEFAULT_OPTIONS = {
|
|
6179
|
+
var DEFAULT_OPTIONS$1 = {
|
|
6180
6180
|
retries: 3,
|
|
6181
|
-
retryCondition: isNetworkOrIdempotentRequestError,
|
|
6182
|
-
retryDelay: noDelay,
|
|
6181
|
+
retryCondition: isNetworkOrIdempotentRequestError$1,
|
|
6182
|
+
retryDelay: noDelay$1,
|
|
6183
6183
|
shouldResetTimeout: false,
|
|
6184
6184
|
onRetry: () => {}
|
|
6185
6185
|
};
|
|
@@ -6190,8 +6190,8 @@ var DEFAULT_OPTIONS = {
|
|
|
6190
6190
|
* @return {IAxiosRetryConfigExtended}
|
|
6191
6191
|
*/
|
|
6192
6192
|
|
|
6193
|
-
function getRequestOptions(config, defaultOptions) {
|
|
6194
|
-
return _objectSpread(_objectSpread(_objectSpread({}, DEFAULT_OPTIONS), defaultOptions), config[namespace]);
|
|
6193
|
+
function getRequestOptions$1(config, defaultOptions) {
|
|
6194
|
+
return _objectSpread$1(_objectSpread$1(_objectSpread$1({}, DEFAULT_OPTIONS$1), defaultOptions), config[namespace$1]);
|
|
6195
6195
|
}
|
|
6196
6196
|
/**
|
|
6197
6197
|
* Initializes and returns the retry state for the given request/config
|
|
@@ -6201,10 +6201,10 @@ function getRequestOptions(config, defaultOptions) {
|
|
|
6201
6201
|
*/
|
|
6202
6202
|
|
|
6203
6203
|
|
|
6204
|
-
function getCurrentState(config, defaultOptions) {
|
|
6205
|
-
var currentState = getRequestOptions(config, defaultOptions);
|
|
6204
|
+
function getCurrentState$1(config, defaultOptions) {
|
|
6205
|
+
var currentState = getRequestOptions$1(config, defaultOptions);
|
|
6206
6206
|
currentState.retryCount = currentState.retryCount || 0;
|
|
6207
|
-
config[namespace] = currentState;
|
|
6207
|
+
config[namespace$1] = currentState;
|
|
6208
6208
|
return currentState;
|
|
6209
6209
|
}
|
|
6210
6210
|
/**
|
|
@@ -6213,7 +6213,7 @@ function getCurrentState(config, defaultOptions) {
|
|
|
6213
6213
|
*/
|
|
6214
6214
|
|
|
6215
6215
|
|
|
6216
|
-
function fixConfig(axios, config) {
|
|
6216
|
+
function fixConfig$1(axios, config) {
|
|
6217
6217
|
if (axios.defaults.agent === config.agent) {
|
|
6218
6218
|
delete config.agent;
|
|
6219
6219
|
}
|
|
@@ -6234,8 +6234,8 @@ function fixConfig(axios, config) {
|
|
|
6234
6234
|
*/
|
|
6235
6235
|
|
|
6236
6236
|
|
|
6237
|
-
function shouldRetry(_x, _x2) {
|
|
6238
|
-
return _shouldRetry.apply(this, arguments);
|
|
6237
|
+
function shouldRetry$1(_x, _x2) {
|
|
6238
|
+
return _shouldRetry$1.apply(this, arguments);
|
|
6239
6239
|
}
|
|
6240
6240
|
/**
|
|
6241
6241
|
* Adds response interceptors to an axios instance to retry requests failed due to network issues
|
|
@@ -6295,8 +6295,8 @@ function shouldRetry(_x, _x2) {
|
|
|
6295
6295
|
*/
|
|
6296
6296
|
|
|
6297
6297
|
|
|
6298
|
-
function _shouldRetry() {
|
|
6299
|
-
_shouldRetry = _asyncToGenerator(function* (currentState, error) {
|
|
6298
|
+
function _shouldRetry$1() {
|
|
6299
|
+
_shouldRetry$1 = _asyncToGenerator$1(function* (currentState, error) {
|
|
6300
6300
|
var {
|
|
6301
6301
|
retries,
|
|
6302
6302
|
retryCondition
|
|
@@ -6315,17 +6315,17 @@ function _shouldRetry() {
|
|
|
6315
6315
|
|
|
6316
6316
|
return shouldRetryOrPromise;
|
|
6317
6317
|
});
|
|
6318
|
-
return _shouldRetry.apply(this, arguments);
|
|
6318
|
+
return _shouldRetry$1.apply(this, arguments);
|
|
6319
6319
|
}
|
|
6320
6320
|
|
|
6321
|
-
function axiosRetry(axios, defaultOptions) {
|
|
6321
|
+
function axiosRetry$1(axios, defaultOptions) {
|
|
6322
6322
|
var requestInterceptorId = axios.interceptors.request.use(config => {
|
|
6323
|
-
var currentState = getCurrentState(config, defaultOptions);
|
|
6323
|
+
var currentState = getCurrentState$1(config, defaultOptions);
|
|
6324
6324
|
currentState.lastRequestTime = Date.now();
|
|
6325
6325
|
return config;
|
|
6326
6326
|
});
|
|
6327
6327
|
var responseInterceptorId = axios.interceptors.response.use(null, /*#__PURE__*/function () {
|
|
6328
|
-
var _ref = _asyncToGenerator(function* (error) {
|
|
6328
|
+
var _ref = _asyncToGenerator$1(function* (error) {
|
|
6329
6329
|
var {
|
|
6330
6330
|
config
|
|
6331
6331
|
} = error; // If we have no information to retry the request
|
|
@@ -6334,9 +6334,9 @@ function axiosRetry(axios, defaultOptions) {
|
|
|
6334
6334
|
return Promise.reject(error);
|
|
6335
6335
|
}
|
|
6336
6336
|
|
|
6337
|
-
var currentState = getCurrentState(config, defaultOptions);
|
|
6337
|
+
var currentState = getCurrentState$1(config, defaultOptions);
|
|
6338
6338
|
|
|
6339
|
-
if (yield shouldRetry(currentState, error)) {
|
|
6339
|
+
if (yield shouldRetry$1(currentState, error)) {
|
|
6340
6340
|
currentState.retryCount += 1;
|
|
6341
6341
|
var {
|
|
6342
6342
|
retryDelay,
|
|
@@ -6346,7 +6346,7 @@ function axiosRetry(axios, defaultOptions) {
|
|
|
6346
6346
|
var delay = retryDelay(currentState.retryCount, error); // Axios fails merging this configuration to the default configuration because it has an issue
|
|
6347
6347
|
// with circular structures: https://github.com/mzabriskie/axios/issues/370
|
|
6348
6348
|
|
|
6349
|
-
fixConfig(axios, config);
|
|
6349
|
+
fixConfig$1(axios, config);
|
|
6350
6350
|
|
|
6351
6351
|
if (!shouldResetTimeout && config.timeout && currentState.lastRequestTime) {
|
|
6352
6352
|
var lastRequestDuration = Date.now() - currentState.lastRequestTime;
|
|
@@ -6377,12 +6377,12 @@ function axiosRetry(axios, defaultOptions) {
|
|
|
6377
6377
|
};
|
|
6378
6378
|
} // Compatibility with CommonJS
|
|
6379
6379
|
|
|
6380
|
-
axiosRetry.isNetworkError = isNetworkError;
|
|
6381
|
-
axiosRetry.isSafeRequestError = isSafeRequestError;
|
|
6382
|
-
axiosRetry.isIdempotentRequestError = isIdempotentRequestError;
|
|
6383
|
-
axiosRetry.isNetworkOrIdempotentRequestError = isNetworkOrIdempotentRequestError;
|
|
6384
|
-
axiosRetry.exponentialDelay = exponentialDelay;
|
|
6385
|
-
axiosRetry.isRetryableError = isRetryableError;
|
|
6380
|
+
axiosRetry$1.isNetworkError = isNetworkError$1;
|
|
6381
|
+
axiosRetry$1.isSafeRequestError = isSafeRequestError$1;
|
|
6382
|
+
axiosRetry$1.isIdempotentRequestError = isIdempotentRequestError$1;
|
|
6383
|
+
axiosRetry$1.isNetworkOrIdempotentRequestError = isNetworkOrIdempotentRequestError$1;
|
|
6384
|
+
axiosRetry$1.exponentialDelay = exponentialDelay$1;
|
|
6385
|
+
axiosRetry$1.isRetryableError = isRetryableError$1;
|
|
6386
6386
|
|
|
6387
6387
|
/******************************************************************************
|
|
6388
6388
|
Copyright (c) Microsoft Corporation.
|
|
@@ -6446,7 +6446,7 @@ let MidgardApi$1 = class MidgardApi {
|
|
|
6446
6446
|
constructor(network = xchainClient.Network.Mainnet, config) {
|
|
6447
6447
|
this.network = network;
|
|
6448
6448
|
this.config = config !== null && config !== void 0 ? config : defaultMidgardConfig$1[this.network];
|
|
6449
|
-
axiosRetry(axios, { retries: this.config.apiRetries, retryDelay: axiosRetry.exponentialDelay });
|
|
6449
|
+
axiosRetry$1(axios, { retries: this.config.apiRetries, retryDelay: axiosRetry$1.exponentialDelay });
|
|
6450
6450
|
this.midgardClients = this.config.midgardBaseUrls.map((url) => new MidgardApi$2(new Configuration$1({ basePath: url })));
|
|
6451
6451
|
}
|
|
6452
6452
|
/**
|
|
@@ -8873,6 +8873,307 @@ class MidgardApi extends DefaultApi {
|
|
|
8873
8873
|
}
|
|
8874
8874
|
}
|
|
8875
8875
|
|
|
8876
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
8877
|
+
|
|
8878
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
8879
|
+
|
|
8880
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
8881
|
+
|
|
8882
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
8883
|
+
|
|
8884
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
8885
|
+
var namespace = 'axios-retry';
|
|
8886
|
+
/**
|
|
8887
|
+
* @param {Error} error
|
|
8888
|
+
* @return {boolean}
|
|
8889
|
+
*/
|
|
8890
|
+
|
|
8891
|
+
function isNetworkError(error) {
|
|
8892
|
+
var CODE_EXCLUDE_LIST = ['ERR_CANCELED', 'ECONNABORTED'];
|
|
8893
|
+
return !error.response && Boolean(error.code) && // Prevents retrying cancelled requests
|
|
8894
|
+
!CODE_EXCLUDE_LIST.includes(error.code) && // Prevents retrying timed out & cancelled requests
|
|
8895
|
+
isRetryAllowed(error) // Prevents retrying unsafe errors
|
|
8896
|
+
;
|
|
8897
|
+
}
|
|
8898
|
+
var SAFE_HTTP_METHODS = ['get', 'head', 'options'];
|
|
8899
|
+
var IDEMPOTENT_HTTP_METHODS = SAFE_HTTP_METHODS.concat(['put', 'delete']);
|
|
8900
|
+
/**
|
|
8901
|
+
* @param {Error} error
|
|
8902
|
+
* @return {boolean}
|
|
8903
|
+
*/
|
|
8904
|
+
|
|
8905
|
+
function isRetryableError(error) {
|
|
8906
|
+
return error.code !== 'ECONNABORTED' && (!error.response || error.response.status >= 500 && error.response.status <= 599);
|
|
8907
|
+
}
|
|
8908
|
+
/**
|
|
8909
|
+
* @param {Error} error
|
|
8910
|
+
* @return {boolean}
|
|
8911
|
+
*/
|
|
8912
|
+
|
|
8913
|
+
function isSafeRequestError(error) {
|
|
8914
|
+
if (!error.config) {
|
|
8915
|
+
// Cannot determine if the request can be retried
|
|
8916
|
+
return false;
|
|
8917
|
+
}
|
|
8918
|
+
|
|
8919
|
+
return isRetryableError(error) && SAFE_HTTP_METHODS.indexOf(error.config.method) !== -1;
|
|
8920
|
+
}
|
|
8921
|
+
/**
|
|
8922
|
+
* @param {Error} error
|
|
8923
|
+
* @return {boolean}
|
|
8924
|
+
*/
|
|
8925
|
+
|
|
8926
|
+
function isIdempotentRequestError(error) {
|
|
8927
|
+
if (!error.config) {
|
|
8928
|
+
// Cannot determine if the request can be retried
|
|
8929
|
+
return false;
|
|
8930
|
+
}
|
|
8931
|
+
|
|
8932
|
+
return isRetryableError(error) && IDEMPOTENT_HTTP_METHODS.indexOf(error.config.method) !== -1;
|
|
8933
|
+
}
|
|
8934
|
+
/**
|
|
8935
|
+
* @param {Error} error
|
|
8936
|
+
* @return {boolean}
|
|
8937
|
+
*/
|
|
8938
|
+
|
|
8939
|
+
function isNetworkOrIdempotentRequestError(error) {
|
|
8940
|
+
return isNetworkError(error) || isIdempotentRequestError(error);
|
|
8941
|
+
}
|
|
8942
|
+
/**
|
|
8943
|
+
* @return {number} - delay in milliseconds, always 0
|
|
8944
|
+
*/
|
|
8945
|
+
|
|
8946
|
+
function noDelay() {
|
|
8947
|
+
return 0;
|
|
8948
|
+
}
|
|
8949
|
+
/**
|
|
8950
|
+
* Set delayFactor 1000 for an exponential delay to occur on the order
|
|
8951
|
+
* of seconds
|
|
8952
|
+
* @param {number} [retryNumber=0]
|
|
8953
|
+
* @param {Error} error - unused; for existing API of retryDelay callback
|
|
8954
|
+
* @param {number} [delayFactor=100] milliseconds
|
|
8955
|
+
* @return {number} - delay in milliseconds
|
|
8956
|
+
*/
|
|
8957
|
+
|
|
8958
|
+
|
|
8959
|
+
function exponentialDelay() {
|
|
8960
|
+
var retryNumber = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
8961
|
+
var delayFactor = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 100;
|
|
8962
|
+
var delay = Math.pow(2, retryNumber) * delayFactor;
|
|
8963
|
+
var randomSum = delay * 0.2 * Math.random(); // 0-20% of the delay
|
|
8964
|
+
|
|
8965
|
+
return delay + randomSum;
|
|
8966
|
+
}
|
|
8967
|
+
/** @type {IAxiosRetryConfig} */
|
|
8968
|
+
|
|
8969
|
+
var DEFAULT_OPTIONS = {
|
|
8970
|
+
retries: 3,
|
|
8971
|
+
retryCondition: isNetworkOrIdempotentRequestError,
|
|
8972
|
+
retryDelay: noDelay,
|
|
8973
|
+
shouldResetTimeout: false,
|
|
8974
|
+
onRetry: () => {}
|
|
8975
|
+
};
|
|
8976
|
+
/**
|
|
8977
|
+
* Returns the axios-retry options for the current request
|
|
8978
|
+
* @param {AxiosRequestConfig} config
|
|
8979
|
+
* @param {IAxiosRetryConfig} defaultOptions
|
|
8980
|
+
* @return {IAxiosRetryConfigExtended}
|
|
8981
|
+
*/
|
|
8982
|
+
|
|
8983
|
+
function getRequestOptions(config, defaultOptions) {
|
|
8984
|
+
return _objectSpread(_objectSpread(_objectSpread({}, DEFAULT_OPTIONS), defaultOptions), config[namespace]);
|
|
8985
|
+
}
|
|
8986
|
+
/**
|
|
8987
|
+
* Initializes and returns the retry state for the given request/config
|
|
8988
|
+
* @param {AxiosRequestConfig} config
|
|
8989
|
+
* @param {IAxiosRetryConfig} defaultOptions
|
|
8990
|
+
* @return {IAxiosRetryConfigExtended}
|
|
8991
|
+
*/
|
|
8992
|
+
|
|
8993
|
+
|
|
8994
|
+
function getCurrentState(config, defaultOptions) {
|
|
8995
|
+
var currentState = getRequestOptions(config, defaultOptions);
|
|
8996
|
+
currentState.retryCount = currentState.retryCount || 0;
|
|
8997
|
+
config[namespace] = currentState;
|
|
8998
|
+
return currentState;
|
|
8999
|
+
}
|
|
9000
|
+
/**
|
|
9001
|
+
* @param {Axios} axios
|
|
9002
|
+
* @param {AxiosRequestConfig} config
|
|
9003
|
+
*/
|
|
9004
|
+
|
|
9005
|
+
|
|
9006
|
+
function fixConfig(axios, config) {
|
|
9007
|
+
if (axios.defaults.agent === config.agent) {
|
|
9008
|
+
delete config.agent;
|
|
9009
|
+
}
|
|
9010
|
+
|
|
9011
|
+
if (axios.defaults.httpAgent === config.httpAgent) {
|
|
9012
|
+
delete config.httpAgent;
|
|
9013
|
+
}
|
|
9014
|
+
|
|
9015
|
+
if (axios.defaults.httpsAgent === config.httpsAgent) {
|
|
9016
|
+
delete config.httpsAgent;
|
|
9017
|
+
}
|
|
9018
|
+
}
|
|
9019
|
+
/**
|
|
9020
|
+
* Checks retryCondition if request can be retried. Handles it's returning value or Promise.
|
|
9021
|
+
* @param {IAxiosRetryConfigExtended} currentState
|
|
9022
|
+
* @param {Error} error
|
|
9023
|
+
* @return {Promise<boolean>}
|
|
9024
|
+
*/
|
|
9025
|
+
|
|
9026
|
+
|
|
9027
|
+
function shouldRetry(_x, _x2) {
|
|
9028
|
+
return _shouldRetry.apply(this, arguments);
|
|
9029
|
+
}
|
|
9030
|
+
/**
|
|
9031
|
+
* Adds response interceptors to an axios instance to retry requests failed due to network issues
|
|
9032
|
+
*
|
|
9033
|
+
* @example
|
|
9034
|
+
*
|
|
9035
|
+
* import axios from 'axios';
|
|
9036
|
+
*
|
|
9037
|
+
* axiosRetry(axios, { retries: 3 });
|
|
9038
|
+
*
|
|
9039
|
+
* axios.get('http://example.com/test') // The first request fails and the second returns 'ok'
|
|
9040
|
+
* .then(result => {
|
|
9041
|
+
* result.data; // 'ok'
|
|
9042
|
+
* });
|
|
9043
|
+
*
|
|
9044
|
+
* // Exponential back-off retry delay between requests
|
|
9045
|
+
* axiosRetry(axios, { retryDelay : axiosRetry.exponentialDelay});
|
|
9046
|
+
*
|
|
9047
|
+
* // Custom retry delay
|
|
9048
|
+
* axiosRetry(axios, { retryDelay : (retryCount) => {
|
|
9049
|
+
* return retryCount * 1000;
|
|
9050
|
+
* }});
|
|
9051
|
+
*
|
|
9052
|
+
* // Also works with custom axios instances
|
|
9053
|
+
* const client = axios.create({ baseURL: 'http://example.com' });
|
|
9054
|
+
* axiosRetry(client, { retries: 3 });
|
|
9055
|
+
*
|
|
9056
|
+
* client.get('/test') // The first request fails and the second returns 'ok'
|
|
9057
|
+
* .then(result => {
|
|
9058
|
+
* result.data; // 'ok'
|
|
9059
|
+
* });
|
|
9060
|
+
*
|
|
9061
|
+
* // Allows request-specific configuration
|
|
9062
|
+
* client
|
|
9063
|
+
* .get('/test', {
|
|
9064
|
+
* 'axios-retry': {
|
|
9065
|
+
* retries: 0
|
|
9066
|
+
* }
|
|
9067
|
+
* })
|
|
9068
|
+
* .catch(error => { // The first request fails
|
|
9069
|
+
* error !== undefined
|
|
9070
|
+
* });
|
|
9071
|
+
*
|
|
9072
|
+
* @param {Axios} axios An axios instance (the axios object or one created from axios.create)
|
|
9073
|
+
* @param {Object} [defaultOptions]
|
|
9074
|
+
* @param {number} [defaultOptions.retries=3] Number of retries
|
|
9075
|
+
* @param {boolean} [defaultOptions.shouldResetTimeout=false]
|
|
9076
|
+
* Defines if the timeout should be reset between retries
|
|
9077
|
+
* @param {Function} [defaultOptions.retryCondition=isNetworkOrIdempotentRequestError]
|
|
9078
|
+
* A function to determine if the error can be retried
|
|
9079
|
+
* @param {Function} [defaultOptions.retryDelay=noDelay]
|
|
9080
|
+
* A function to determine the delay between retry requests
|
|
9081
|
+
* @param {Function} [defaultOptions.onRetry=()=>{}]
|
|
9082
|
+
* A function to get notified when a retry occurs
|
|
9083
|
+
* @return {{ requestInterceptorId: number, responseInterceptorId: number }}
|
|
9084
|
+
* The ids of the interceptors added to the request and to the response (so they can be ejected at a later time)
|
|
9085
|
+
*/
|
|
9086
|
+
|
|
9087
|
+
|
|
9088
|
+
function _shouldRetry() {
|
|
9089
|
+
_shouldRetry = _asyncToGenerator(function* (currentState, error) {
|
|
9090
|
+
var {
|
|
9091
|
+
retries,
|
|
9092
|
+
retryCondition
|
|
9093
|
+
} = currentState;
|
|
9094
|
+
var shouldRetryOrPromise = currentState.retryCount < retries && retryCondition(error); // This could be a promise
|
|
9095
|
+
|
|
9096
|
+
if (typeof shouldRetryOrPromise === 'object') {
|
|
9097
|
+
try {
|
|
9098
|
+
var shouldRetryPromiseResult = yield shouldRetryOrPromise; // keep return true unless shouldRetryPromiseResult return false for compatibility
|
|
9099
|
+
|
|
9100
|
+
return shouldRetryPromiseResult !== false;
|
|
9101
|
+
} catch (_err) {
|
|
9102
|
+
return false;
|
|
9103
|
+
}
|
|
9104
|
+
}
|
|
9105
|
+
|
|
9106
|
+
return shouldRetryOrPromise;
|
|
9107
|
+
});
|
|
9108
|
+
return _shouldRetry.apply(this, arguments);
|
|
9109
|
+
}
|
|
9110
|
+
|
|
9111
|
+
function axiosRetry(axios, defaultOptions) {
|
|
9112
|
+
var requestInterceptorId = axios.interceptors.request.use(config => {
|
|
9113
|
+
var currentState = getCurrentState(config, defaultOptions);
|
|
9114
|
+
currentState.lastRequestTime = Date.now();
|
|
9115
|
+
return config;
|
|
9116
|
+
});
|
|
9117
|
+
var responseInterceptorId = axios.interceptors.response.use(null, /*#__PURE__*/function () {
|
|
9118
|
+
var _ref = _asyncToGenerator(function* (error) {
|
|
9119
|
+
var {
|
|
9120
|
+
config
|
|
9121
|
+
} = error; // If we have no information to retry the request
|
|
9122
|
+
|
|
9123
|
+
if (!config) {
|
|
9124
|
+
return Promise.reject(error);
|
|
9125
|
+
}
|
|
9126
|
+
|
|
9127
|
+
var currentState = getCurrentState(config, defaultOptions);
|
|
9128
|
+
|
|
9129
|
+
if (yield shouldRetry(currentState, error)) {
|
|
9130
|
+
currentState.retryCount += 1;
|
|
9131
|
+
var {
|
|
9132
|
+
retryDelay,
|
|
9133
|
+
shouldResetTimeout,
|
|
9134
|
+
onRetry
|
|
9135
|
+
} = currentState;
|
|
9136
|
+
var delay = retryDelay(currentState.retryCount, error); // Axios fails merging this configuration to the default configuration because it has an issue
|
|
9137
|
+
// with circular structures: https://github.com/mzabriskie/axios/issues/370
|
|
9138
|
+
|
|
9139
|
+
fixConfig(axios, config);
|
|
9140
|
+
|
|
9141
|
+
if (!shouldResetTimeout && config.timeout && currentState.lastRequestTime) {
|
|
9142
|
+
var lastRequestDuration = Date.now() - currentState.lastRequestTime;
|
|
9143
|
+
var timeout = config.timeout - lastRequestDuration - delay;
|
|
9144
|
+
|
|
9145
|
+
if (timeout <= 0) {
|
|
9146
|
+
return Promise.reject(error);
|
|
9147
|
+
}
|
|
9148
|
+
|
|
9149
|
+
config.timeout = timeout;
|
|
9150
|
+
}
|
|
9151
|
+
|
|
9152
|
+
config.transformRequest = [data => data];
|
|
9153
|
+
yield onRetry(currentState.retryCount, error, config);
|
|
9154
|
+
return new Promise(resolve => setTimeout(() => resolve(axios(config)), delay));
|
|
9155
|
+
}
|
|
9156
|
+
|
|
9157
|
+
return Promise.reject(error);
|
|
9158
|
+
});
|
|
9159
|
+
|
|
9160
|
+
return function (_x3) {
|
|
9161
|
+
return _ref.apply(this, arguments);
|
|
9162
|
+
};
|
|
9163
|
+
}());
|
|
9164
|
+
return {
|
|
9165
|
+
requestInterceptorId,
|
|
9166
|
+
responseInterceptorId
|
|
9167
|
+
};
|
|
9168
|
+
} // Compatibility with CommonJS
|
|
9169
|
+
|
|
9170
|
+
axiosRetry.isNetworkError = isNetworkError;
|
|
9171
|
+
axiosRetry.isSafeRequestError = isSafeRequestError;
|
|
9172
|
+
axiosRetry.isIdempotentRequestError = isIdempotentRequestError;
|
|
9173
|
+
axiosRetry.isNetworkOrIdempotentRequestError = isNetworkOrIdempotentRequestError;
|
|
9174
|
+
axiosRetry.exponentialDelay = exponentialDelay;
|
|
9175
|
+
axiosRetry.isRetryableError = isRetryableError;
|
|
9176
|
+
|
|
8876
9177
|
/******************************************************************************
|
|
8877
9178
|
Copyright (c) Microsoft Corporation.
|
|
8878
9179
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xchainjs/xchain-aggregator",
|
|
3
3
|
"description": "Protocol aggregator to make actions in different protocols",
|
|
4
|
-
"version": "2.0
|
|
4
|
+
"version": "2.1.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"module": "lib/index.esm.js",
|
|
@@ -32,18 +32,18 @@
|
|
|
32
32
|
"@chainflip/sdk": "1.11.2",
|
|
33
33
|
"@xchainjs/xchain-client": "2.0.10",
|
|
34
34
|
"@xchainjs/xchain-mayachain": "4.1.1",
|
|
35
|
-
"@xchainjs/xchain-mayachain-amm": "4.1.
|
|
35
|
+
"@xchainjs/xchain-mayachain-amm": "4.1.10",
|
|
36
36
|
"@xchainjs/xchain-mayachain-query": "2.1.6",
|
|
37
37
|
"@xchainjs/xchain-thorchain": "3.0.14",
|
|
38
|
-
"@xchainjs/xchain-thorchain-amm": "3.0.
|
|
38
|
+
"@xchainjs/xchain-thorchain-amm": "3.0.28",
|
|
39
39
|
"@xchainjs/xchain-thorchain-query": "2.0.16",
|
|
40
40
|
"@xchainjs/xchain-util": "2.0.5",
|
|
41
|
-
"@xchainjs/xchain-wallet": "2.0.
|
|
41
|
+
"@xchainjs/xchain-wallet": "2.0.21"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@xchainjs/xchain-avax": "2.0.14",
|
|
45
45
|
"@xchainjs/xchain-base": "1.0.14",
|
|
46
|
-
"@xchainjs/xchain-bitcoin": "2.0
|
|
46
|
+
"@xchainjs/xchain-bitcoin": "2.1.0",
|
|
47
47
|
"@xchainjs/xchain-bsc": "2.0.15",
|
|
48
48
|
"@xchainjs/xchain-ethereum": "2.0.15",
|
|
49
49
|
"@xchainjs/xchain-kujira": "2.0.10",
|