@passkeyme/react-auth 2.0.10 → 2.0.12
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 +15 -16
- package/dist/index.esm.js +405 -263
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +405 -263
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -2423,6 +2423,13 @@ debugMode = false, passkeyOptions = {}, }) => {
|
|
|
2423
2423
|
}, children: ["Continue with", " ", provider.charAt(0).toUpperCase() + provider.slice(1)] }) }, provider))) })), (showDebugInfo || debugMode) && (jsxRuntime.jsxs("div", { style: mergedTheme.debugInfo, children: [jsxRuntime.jsx("strong", { children: "\uD83D\uDC1B Debug Info:" }), jsxRuntime.jsx("br", {}), "Passkey Support: ", isPasskeySupported() ? "Yes" : "No", jsxRuntime.jsx("br", {}), "Authenticated: ", isAuthenticated ? "Yes" : "No", jsxRuntime.jsx("br", {}), "Auth Loading: ", authLoading ? "Yes" : "No", jsxRuntime.jsx("br", {}), "Passkey Attempted: ", passkeyAttempted ? "Yes" : "No", jsxRuntime.jsx("br", {}), "Show OAuth: ", showOAuthOptions ? "Yes" : "No", jsxRuntime.jsx("br", {}), "Available Providers: ", availableProviders.join(", ") || "None"] }))] }));
|
|
2424
2424
|
};
|
|
2425
2425
|
|
|
2426
|
+
/**
|
|
2427
|
+
* Create a bound version of a function with a specified `this` context
|
|
2428
|
+
*
|
|
2429
|
+
* @param {Function} fn - The function to bind
|
|
2430
|
+
* @param {*} thisArg - The value to be passed as the `this` parameter
|
|
2431
|
+
* @returns {Function} A new function that will call the original function with the specified `this` context
|
|
2432
|
+
*/
|
|
2426
2433
|
function bind(fn, thisArg) {
|
|
2427
2434
|
return function wrap() {
|
|
2428
2435
|
return fn.apply(thisArg, arguments);
|
|
@@ -2474,7 +2481,7 @@ const isUndefined = typeOfTest('undefined');
|
|
|
2474
2481
|
*/
|
|
2475
2482
|
function isBuffer(val) {
|
|
2476
2483
|
return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
|
|
2477
|
-
&& isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);
|
|
2484
|
+
&& isFunction$1(val.constructor.isBuffer) && val.constructor.isBuffer(val);
|
|
2478
2485
|
}
|
|
2479
2486
|
|
|
2480
2487
|
/**
|
|
@@ -2519,7 +2526,7 @@ const isString = typeOfTest('string');
|
|
|
2519
2526
|
* @param {*} val The value to test
|
|
2520
2527
|
* @returns {boolean} True if value is a Function, otherwise false
|
|
2521
2528
|
*/
|
|
2522
|
-
const isFunction = typeOfTest('function');
|
|
2529
|
+
const isFunction$1 = typeOfTest('function');
|
|
2523
2530
|
|
|
2524
2531
|
/**
|
|
2525
2532
|
* Determine if a value is a Number
|
|
@@ -2575,7 +2582,7 @@ const isEmptyObject = (val) => {
|
|
|
2575
2582
|
if (!isObject(val) || isBuffer(val)) {
|
|
2576
2583
|
return false;
|
|
2577
2584
|
}
|
|
2578
|
-
|
|
2585
|
+
|
|
2579
2586
|
try {
|
|
2580
2587
|
return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
|
|
2581
2588
|
} catch (e) {
|
|
@@ -2627,7 +2634,7 @@ const isFileList = kindOfTest('FileList');
|
|
|
2627
2634
|
*
|
|
2628
2635
|
* @returns {boolean} True if value is a Stream, otherwise false
|
|
2629
2636
|
*/
|
|
2630
|
-
const isStream = (val) => isObject(val) && isFunction(val.pipe);
|
|
2637
|
+
const isStream = (val) => isObject(val) && isFunction$1(val.pipe);
|
|
2631
2638
|
|
|
2632
2639
|
/**
|
|
2633
2640
|
* Determine if a value is a FormData
|
|
@@ -2640,10 +2647,10 @@ const isFormData = (thing) => {
|
|
|
2640
2647
|
let kind;
|
|
2641
2648
|
return thing && (
|
|
2642
2649
|
(typeof FormData === 'function' && thing instanceof FormData) || (
|
|
2643
|
-
isFunction(thing.append) && (
|
|
2650
|
+
isFunction$1(thing.append) && (
|
|
2644
2651
|
(kind = kindOf(thing)) === 'formdata' ||
|
|
2645
2652
|
// detect form-data instance
|
|
2646
|
-
(kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]')
|
|
2653
|
+
(kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]')
|
|
2647
2654
|
)
|
|
2648
2655
|
)
|
|
2649
2656
|
)
|
|
@@ -2768,7 +2775,7 @@ const isContextDefined = (context) => !isUndefined(context) && context !== _glob
|
|
|
2768
2775
|
* @returns {Object} Result of all merge properties
|
|
2769
2776
|
*/
|
|
2770
2777
|
function merge(/* obj1, obj2, obj3, ... */) {
|
|
2771
|
-
const {caseless} = isContextDefined(this) && this || {};
|
|
2778
|
+
const {caseless, skipUndefined} = isContextDefined(this) && this || {};
|
|
2772
2779
|
const result = {};
|
|
2773
2780
|
const assignValue = (val, key) => {
|
|
2774
2781
|
const targetKey = caseless && findKey(result, key) || key;
|
|
@@ -2778,7 +2785,7 @@ function merge(/* obj1, obj2, obj3, ... */) {
|
|
|
2778
2785
|
result[targetKey] = merge({}, val);
|
|
2779
2786
|
} else if (isArray(val)) {
|
|
2780
2787
|
result[targetKey] = val.slice();
|
|
2781
|
-
} else {
|
|
2788
|
+
} else if (!skipUndefined || !isUndefined(val)) {
|
|
2782
2789
|
result[targetKey] = val;
|
|
2783
2790
|
}
|
|
2784
2791
|
};
|
|
@@ -2801,7 +2808,7 @@ function merge(/* obj1, obj2, obj3, ... */) {
|
|
|
2801
2808
|
*/
|
|
2802
2809
|
const extend = (a, b, thisArg, {allOwnKeys}= {}) => {
|
|
2803
2810
|
forEach(b, (val, key) => {
|
|
2804
|
-
if (thisArg && isFunction(val)) {
|
|
2811
|
+
if (thisArg && isFunction$1(val)) {
|
|
2805
2812
|
a[key] = bind(val, thisArg);
|
|
2806
2813
|
} else {
|
|
2807
2814
|
a[key] = val;
|
|
@@ -3017,13 +3024,13 @@ const reduceDescriptors = (obj, reducer) => {
|
|
|
3017
3024
|
const freezeMethods = (obj) => {
|
|
3018
3025
|
reduceDescriptors(obj, (descriptor, name) => {
|
|
3019
3026
|
// skip restricted props in strict mode
|
|
3020
|
-
if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
|
|
3027
|
+
if (isFunction$1(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
|
|
3021
3028
|
return false;
|
|
3022
3029
|
}
|
|
3023
3030
|
|
|
3024
3031
|
const value = obj[name];
|
|
3025
3032
|
|
|
3026
|
-
if (!isFunction(value)) return;
|
|
3033
|
+
if (!isFunction$1(value)) return;
|
|
3027
3034
|
|
|
3028
3035
|
descriptor.enumerable = false;
|
|
3029
3036
|
|
|
@@ -3060,6 +3067,8 @@ const toFiniteNumber = (value, defaultValue) => {
|
|
|
3060
3067
|
return value != null && Number.isFinite(value = +value) ? value : defaultValue;
|
|
3061
3068
|
};
|
|
3062
3069
|
|
|
3070
|
+
|
|
3071
|
+
|
|
3063
3072
|
/**
|
|
3064
3073
|
* If the thing is a FormData object, return true, otherwise return false.
|
|
3065
3074
|
*
|
|
@@ -3068,7 +3077,7 @@ const toFiniteNumber = (value, defaultValue) => {
|
|
|
3068
3077
|
* @returns {boolean}
|
|
3069
3078
|
*/
|
|
3070
3079
|
function isSpecCompliantForm(thing) {
|
|
3071
|
-
return !!(thing && isFunction(thing.append) && thing[toStringTag] === 'FormData' && thing[iterator]);
|
|
3080
|
+
return !!(thing && isFunction$1(thing.append) && thing[toStringTag] === 'FormData' && thing[iterator]);
|
|
3072
3081
|
}
|
|
3073
3082
|
|
|
3074
3083
|
const toJSONObject = (obj) => {
|
|
@@ -3110,7 +3119,7 @@ const toJSONObject = (obj) => {
|
|
|
3110
3119
|
const isAsyncFn = kindOfTest('AsyncFunction');
|
|
3111
3120
|
|
|
3112
3121
|
const isThenable = (thing) =>
|
|
3113
|
-
thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
|
|
3122
|
+
thing && (isObject(thing) || isFunction$1(thing)) && isFunction$1(thing.then) && isFunction$1(thing.catch);
|
|
3114
3123
|
|
|
3115
3124
|
// original code
|
|
3116
3125
|
// https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
|
|
@@ -3134,7 +3143,7 @@ const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
|
|
|
3134
3143
|
})(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
|
|
3135
3144
|
})(
|
|
3136
3145
|
typeof setImmediate === 'function',
|
|
3137
|
-
isFunction(_global.postMessage)
|
|
3146
|
+
isFunction$1(_global.postMessage)
|
|
3138
3147
|
);
|
|
3139
3148
|
|
|
3140
3149
|
const asap = typeof queueMicrotask !== 'undefined' ?
|
|
@@ -3143,7 +3152,7 @@ const asap = typeof queueMicrotask !== 'undefined' ?
|
|
|
3143
3152
|
// *********************
|
|
3144
3153
|
|
|
3145
3154
|
|
|
3146
|
-
const isIterable = (thing) => thing != null && isFunction(thing[iterator]);
|
|
3155
|
+
const isIterable = (thing) => thing != null && isFunction$1(thing[iterator]);
|
|
3147
3156
|
|
|
3148
3157
|
|
|
3149
3158
|
var utils$1 = {
|
|
@@ -3167,7 +3176,7 @@ var utils$1 = {
|
|
|
3167
3176
|
isFile,
|
|
3168
3177
|
isBlob,
|
|
3169
3178
|
isRegExp,
|
|
3170
|
-
isFunction,
|
|
3179
|
+
isFunction: isFunction$1,
|
|
3171
3180
|
isStream,
|
|
3172
3181
|
isURLSearchParams,
|
|
3173
3182
|
isTypedArray,
|
|
@@ -3293,11 +3302,18 @@ AxiosError.from = (error, code, config, request, response, customProps) => {
|
|
|
3293
3302
|
return prop !== 'isAxiosError';
|
|
3294
3303
|
});
|
|
3295
3304
|
|
|
3296
|
-
|
|
3305
|
+
const msg = error && error.message ? error.message : 'Error';
|
|
3297
3306
|
|
|
3298
|
-
|
|
3307
|
+
// Prefer explicit code; otherwise copy the low-level error's code (e.g. ECONNREFUSED)
|
|
3308
|
+
const errCode = code == null && error ? error.code : code;
|
|
3309
|
+
AxiosError.call(axiosError, msg, errCode, config, request, response);
|
|
3299
3310
|
|
|
3300
|
-
|
|
3311
|
+
// Chain the original error on the standard field; non-enumerable to avoid JSON noise
|
|
3312
|
+
if (error && axiosError.cause == null) {
|
|
3313
|
+
Object.defineProperty(axiosError, 'cause', { value: error, configurable: true });
|
|
3314
|
+
}
|
|
3315
|
+
|
|
3316
|
+
axiosError.name = (error && error.name) || 'Error';
|
|
3301
3317
|
|
|
3302
3318
|
customProps && Object.assign(axiosError, customProps);
|
|
3303
3319
|
|
|
@@ -3588,9 +3604,7 @@ function encode(val) {
|
|
|
3588
3604
|
replace(/%3A/gi, ':').
|
|
3589
3605
|
replace(/%24/g, '$').
|
|
3590
3606
|
replace(/%2C/gi, ',').
|
|
3591
|
-
replace(/%20/g, '+')
|
|
3592
|
-
replace(/%5B/gi, '[').
|
|
3593
|
-
replace(/%5D/gi, ']');
|
|
3607
|
+
replace(/%20/g, '+');
|
|
3594
3608
|
}
|
|
3595
3609
|
|
|
3596
3610
|
/**
|
|
@@ -3668,7 +3682,7 @@ class InterceptorManager {
|
|
|
3668
3682
|
*
|
|
3669
3683
|
* @param {Number} id The ID that was returned by `use`
|
|
3670
3684
|
*
|
|
3671
|
-
* @returns {
|
|
3685
|
+
* @returns {void}
|
|
3672
3686
|
*/
|
|
3673
3687
|
eject(id) {
|
|
3674
3688
|
if (this.handlers[id]) {
|
|
@@ -3995,7 +4009,7 @@ const defaults = {
|
|
|
3995
4009
|
const strictJSONParsing = !silentJSONParsing && JSONRequested;
|
|
3996
4010
|
|
|
3997
4011
|
try {
|
|
3998
|
-
return JSON.parse(data);
|
|
4012
|
+
return JSON.parse(data, this.parseReviver);
|
|
3999
4013
|
} catch (e) {
|
|
4000
4014
|
if (strictJSONParsing) {
|
|
4001
4015
|
if (e.name === 'SyntaxError') {
|
|
@@ -4634,27 +4648,38 @@ var cookies = platform.hasStandardBrowserEnv ?
|
|
|
4634
4648
|
|
|
4635
4649
|
// Standard browser envs support document.cookie
|
|
4636
4650
|
{
|
|
4637
|
-
write(name, value, expires, path, domain, secure) {
|
|
4638
|
-
|
|
4651
|
+
write(name, value, expires, path, domain, secure, sameSite) {
|
|
4652
|
+
if (typeof document === 'undefined') return;
|
|
4639
4653
|
|
|
4640
|
-
|
|
4654
|
+
const cookie = [`${name}=${encodeURIComponent(value)}`];
|
|
4641
4655
|
|
|
4642
|
-
utils$1.
|
|
4643
|
-
|
|
4644
|
-
|
|
4645
|
-
|
|
4646
|
-
|
|
4656
|
+
if (utils$1.isNumber(expires)) {
|
|
4657
|
+
cookie.push(`expires=${new Date(expires).toUTCString()}`);
|
|
4658
|
+
}
|
|
4659
|
+
if (utils$1.isString(path)) {
|
|
4660
|
+
cookie.push(`path=${path}`);
|
|
4661
|
+
}
|
|
4662
|
+
if (utils$1.isString(domain)) {
|
|
4663
|
+
cookie.push(`domain=${domain}`);
|
|
4664
|
+
}
|
|
4665
|
+
if (secure === true) {
|
|
4666
|
+
cookie.push('secure');
|
|
4667
|
+
}
|
|
4668
|
+
if (utils$1.isString(sameSite)) {
|
|
4669
|
+
cookie.push(`SameSite=${sameSite}`);
|
|
4670
|
+
}
|
|
4647
4671
|
|
|
4648
4672
|
document.cookie = cookie.join('; ');
|
|
4649
4673
|
},
|
|
4650
4674
|
|
|
4651
4675
|
read(name) {
|
|
4652
|
-
|
|
4653
|
-
|
|
4676
|
+
if (typeof document === 'undefined') return null;
|
|
4677
|
+
const match = document.cookie.match(new RegExp('(?:^|; )' + name + '=([^;]*)'));
|
|
4678
|
+
return match ? decodeURIComponent(match[1]) : null;
|
|
4654
4679
|
},
|
|
4655
4680
|
|
|
4656
4681
|
remove(name) {
|
|
4657
|
-
this.write(name, '', Date.now() - 86400000);
|
|
4682
|
+
this.write(name, '', Date.now() - 86400000, '/');
|
|
4658
4683
|
}
|
|
4659
4684
|
}
|
|
4660
4685
|
|
|
@@ -4743,11 +4768,11 @@ function mergeConfig(config1, config2) {
|
|
|
4743
4768
|
}
|
|
4744
4769
|
|
|
4745
4770
|
// eslint-disable-next-line consistent-return
|
|
4746
|
-
function mergeDeepProperties(a, b, prop
|
|
4771
|
+
function mergeDeepProperties(a, b, prop, caseless) {
|
|
4747
4772
|
if (!utils$1.isUndefined(b)) {
|
|
4748
|
-
return getMergedValue(a, b, prop
|
|
4773
|
+
return getMergedValue(a, b, prop, caseless);
|
|
4749
4774
|
} else if (!utils$1.isUndefined(a)) {
|
|
4750
|
-
return getMergedValue(undefined, a, prop
|
|
4775
|
+
return getMergedValue(undefined, a, prop, caseless);
|
|
4751
4776
|
}
|
|
4752
4777
|
}
|
|
4753
4778
|
|
|
@@ -4805,7 +4830,7 @@ function mergeConfig(config1, config2) {
|
|
|
4805
4830
|
socketPath: defaultToConfig2,
|
|
4806
4831
|
responseEncoding: defaultToConfig2,
|
|
4807
4832
|
validateStatus: mergeDirectKeys,
|
|
4808
|
-
headers: (a, b
|
|
4833
|
+
headers: (a, b, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true)
|
|
4809
4834
|
};
|
|
4810
4835
|
|
|
4811
4836
|
utils$1.forEach(Object.keys({...config1, ...config2}), function computeConfigValue(prop) {
|
|
@@ -4820,7 +4845,7 @@ function mergeConfig(config1, config2) {
|
|
|
4820
4845
|
var resolveConfig = (config) => {
|
|
4821
4846
|
const newConfig = mergeConfig({}, config);
|
|
4822
4847
|
|
|
4823
|
-
let {data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth} = newConfig;
|
|
4848
|
+
let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
|
|
4824
4849
|
|
|
4825
4850
|
newConfig.headers = headers = AxiosHeaders$1.from(headers);
|
|
4826
4851
|
|
|
@@ -4833,17 +4858,21 @@ var resolveConfig = (config) => {
|
|
|
4833
4858
|
);
|
|
4834
4859
|
}
|
|
4835
4860
|
|
|
4836
|
-
let contentType;
|
|
4837
|
-
|
|
4838
4861
|
if (utils$1.isFormData(data)) {
|
|
4839
4862
|
if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
|
|
4840
|
-
headers.setContentType(undefined); //
|
|
4841
|
-
} else if ((
|
|
4842
|
-
//
|
|
4843
|
-
const
|
|
4844
|
-
headers
|
|
4863
|
+
headers.setContentType(undefined); // browser handles it
|
|
4864
|
+
} else if (utils$1.isFunction(data.getHeaders)) {
|
|
4865
|
+
// Node.js FormData (like form-data package)
|
|
4866
|
+
const formHeaders = data.getHeaders();
|
|
4867
|
+
// Only set safe headers to avoid overwriting security headers
|
|
4868
|
+
const allowedHeaders = ['content-type', 'content-length'];
|
|
4869
|
+
Object.entries(formHeaders).forEach(([key, val]) => {
|
|
4870
|
+
if (allowedHeaders.includes(key.toLowerCase())) {
|
|
4871
|
+
headers.set(key, val);
|
|
4872
|
+
}
|
|
4873
|
+
});
|
|
4845
4874
|
}
|
|
4846
|
-
}
|
|
4875
|
+
}
|
|
4847
4876
|
|
|
4848
4877
|
// Add xsrf header
|
|
4849
4878
|
// This is only done if running in a standard browser environment.
|
|
@@ -4960,15 +4989,18 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
|
4960
4989
|
};
|
|
4961
4990
|
|
|
4962
4991
|
// Handle low level network errors
|
|
4963
|
-
|
|
4964
|
-
|
|
4965
|
-
|
|
4966
|
-
|
|
4967
|
-
|
|
4968
|
-
|
|
4969
|
-
|
|
4992
|
+
request.onerror = function handleError(event) {
|
|
4993
|
+
// Browsers deliver a ProgressEvent in XHR onerror
|
|
4994
|
+
// (message may be empty; when present, surface it)
|
|
4995
|
+
// See https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/error_event
|
|
4996
|
+
const msg = event && event.message ? event.message : 'Network Error';
|
|
4997
|
+
const err = new AxiosError(msg, AxiosError.ERR_NETWORK, config, request);
|
|
4998
|
+
// attach the underlying event for consumers who want details
|
|
4999
|
+
err.event = event || null;
|
|
5000
|
+
reject(err);
|
|
5001
|
+
request = null;
|
|
4970
5002
|
};
|
|
4971
|
-
|
|
5003
|
+
|
|
4972
5004
|
// Handle timeout
|
|
4973
5005
|
request.ontimeout = function handleTimeout() {
|
|
4974
5006
|
let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded';
|
|
@@ -5184,14 +5216,18 @@ const trackStream = (stream, chunkSize, onProgress, onFinish) => {
|
|
|
5184
5216
|
})
|
|
5185
5217
|
};
|
|
5186
5218
|
|
|
5187
|
-
const
|
|
5188
|
-
|
|
5219
|
+
const DEFAULT_CHUNK_SIZE = 64 * 1024;
|
|
5220
|
+
|
|
5221
|
+
const {isFunction} = utils$1;
|
|
5222
|
+
|
|
5223
|
+
const globalFetchAPI = (({Request, Response}) => ({
|
|
5224
|
+
Request, Response
|
|
5225
|
+
}))(utils$1.global);
|
|
5226
|
+
|
|
5227
|
+
const {
|
|
5228
|
+
ReadableStream: ReadableStream$1, TextEncoder
|
|
5229
|
+
} = utils$1.global;
|
|
5189
5230
|
|
|
5190
|
-
// used only inside the fetch adapter
|
|
5191
|
-
const encodeText = isFetchSupported && (typeof TextEncoder === 'function' ?
|
|
5192
|
-
((encoder) => (str) => encoder.encode(str))(new TextEncoder()) :
|
|
5193
|
-
async (str) => new Uint8Array(await new Response(str).arrayBuffer())
|
|
5194
|
-
);
|
|
5195
5231
|
|
|
5196
5232
|
const test = (fn, ...args) => {
|
|
5197
5233
|
try {
|
|
@@ -5201,278 +5237,380 @@ const test = (fn, ...args) => {
|
|
|
5201
5237
|
}
|
|
5202
5238
|
};
|
|
5203
5239
|
|
|
5204
|
-
const
|
|
5205
|
-
|
|
5240
|
+
const factory = (env) => {
|
|
5241
|
+
env = utils$1.merge.call({
|
|
5242
|
+
skipUndefined: true
|
|
5243
|
+
}, globalFetchAPI, env);
|
|
5206
5244
|
|
|
5207
|
-
const
|
|
5208
|
-
|
|
5209
|
-
|
|
5210
|
-
|
|
5211
|
-
duplexAccessed = true;
|
|
5212
|
-
return 'half';
|
|
5213
|
-
},
|
|
5214
|
-
}).headers.has('Content-Type');
|
|
5245
|
+
const {fetch: envFetch, Request, Response} = env;
|
|
5246
|
+
const isFetchSupported = envFetch ? isFunction(envFetch) : typeof fetch === 'function';
|
|
5247
|
+
const isRequestSupported = isFunction(Request);
|
|
5248
|
+
const isResponseSupported = isFunction(Response);
|
|
5215
5249
|
|
|
5216
|
-
|
|
5217
|
-
|
|
5250
|
+
if (!isFetchSupported) {
|
|
5251
|
+
return false;
|
|
5252
|
+
}
|
|
5218
5253
|
|
|
5219
|
-
const
|
|
5254
|
+
const isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream$1);
|
|
5220
5255
|
|
|
5221
|
-
const
|
|
5222
|
-
|
|
5256
|
+
const encodeText = isFetchSupported && (typeof TextEncoder === 'function' ?
|
|
5257
|
+
((encoder) => (str) => encoder.encode(str))(new TextEncoder()) :
|
|
5258
|
+
async (str) => new Uint8Array(await new Request(str).arrayBuffer())
|
|
5259
|
+
);
|
|
5223
5260
|
|
|
5261
|
+
const supportsRequestStream = isRequestSupported && isReadableStreamSupported && test(() => {
|
|
5262
|
+
let duplexAccessed = false;
|
|
5224
5263
|
|
|
5225
|
-
const
|
|
5226
|
-
|
|
5227
|
-
|
|
5264
|
+
const hasContentType = new Request(platform.origin, {
|
|
5265
|
+
body: new ReadableStream$1(),
|
|
5266
|
+
method: 'POST',
|
|
5267
|
+
get duplex() {
|
|
5268
|
+
duplexAccessed = true;
|
|
5269
|
+
return 'half';
|
|
5270
|
+
},
|
|
5271
|
+
}).headers.has('Content-Type');
|
|
5228
5272
|
|
|
5229
|
-
|
|
5230
|
-
['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {
|
|
5231
|
-
!resolvers[type] && (resolvers[type] = utils$1.isFunction(res[type]) ? (res) => res[type]() :
|
|
5232
|
-
(_, config) => {
|
|
5233
|
-
throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config);
|
|
5234
|
-
});
|
|
5273
|
+
return duplexAccessed && !hasContentType;
|
|
5235
5274
|
});
|
|
5236
|
-
})(new Response));
|
|
5237
5275
|
|
|
5238
|
-
const
|
|
5239
|
-
|
|
5240
|
-
return 0;
|
|
5241
|
-
}
|
|
5276
|
+
const supportsResponseStream = isResponseSupported && isReadableStreamSupported &&
|
|
5277
|
+
test(() => utils$1.isReadableStream(new Response('').body));
|
|
5242
5278
|
|
|
5243
|
-
|
|
5244
|
-
|
|
5245
|
-
}
|
|
5279
|
+
const resolvers = {
|
|
5280
|
+
stream: supportsResponseStream && ((res) => res.body)
|
|
5281
|
+
};
|
|
5246
5282
|
|
|
5247
|
-
|
|
5248
|
-
|
|
5249
|
-
|
|
5250
|
-
|
|
5283
|
+
isFetchSupported && ((() => {
|
|
5284
|
+
['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {
|
|
5285
|
+
!resolvers[type] && (resolvers[type] = (res, config) => {
|
|
5286
|
+
let method = res && res[type];
|
|
5287
|
+
|
|
5288
|
+
if (method) {
|
|
5289
|
+
return method.call(res);
|
|
5290
|
+
}
|
|
5291
|
+
|
|
5292
|
+
throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config);
|
|
5293
|
+
});
|
|
5251
5294
|
});
|
|
5252
|
-
|
|
5253
|
-
}
|
|
5295
|
+
})());
|
|
5254
5296
|
|
|
5255
|
-
|
|
5256
|
-
|
|
5257
|
-
|
|
5297
|
+
const getBodyLength = async (body) => {
|
|
5298
|
+
if (body == null) {
|
|
5299
|
+
return 0;
|
|
5300
|
+
}
|
|
5258
5301
|
|
|
5259
|
-
|
|
5260
|
-
|
|
5261
|
-
|
|
5302
|
+
if (utils$1.isBlob(body)) {
|
|
5303
|
+
return body.size;
|
|
5304
|
+
}
|
|
5262
5305
|
|
|
5263
|
-
|
|
5264
|
-
|
|
5265
|
-
|
|
5266
|
-
|
|
5306
|
+
if (utils$1.isSpecCompliantForm(body)) {
|
|
5307
|
+
const _request = new Request(platform.origin, {
|
|
5308
|
+
method: 'POST',
|
|
5309
|
+
body,
|
|
5310
|
+
});
|
|
5311
|
+
return (await _request.arrayBuffer()).byteLength;
|
|
5312
|
+
}
|
|
5267
5313
|
|
|
5268
|
-
|
|
5269
|
-
|
|
5314
|
+
if (utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
|
|
5315
|
+
return body.byteLength;
|
|
5316
|
+
}
|
|
5270
5317
|
|
|
5271
|
-
|
|
5272
|
-
|
|
5318
|
+
if (utils$1.isURLSearchParams(body)) {
|
|
5319
|
+
body = body + '';
|
|
5320
|
+
}
|
|
5321
|
+
|
|
5322
|
+
if (utils$1.isString(body)) {
|
|
5323
|
+
return (await encodeText(body)).byteLength;
|
|
5324
|
+
}
|
|
5325
|
+
};
|
|
5326
|
+
|
|
5327
|
+
const resolveBodyLength = async (headers, body) => {
|
|
5328
|
+
const length = utils$1.toFiniteNumber(headers.getContentLength());
|
|
5329
|
+
|
|
5330
|
+
return length == null ? getBodyLength(body) : length;
|
|
5331
|
+
};
|
|
5332
|
+
|
|
5333
|
+
return async (config) => {
|
|
5334
|
+
let {
|
|
5335
|
+
url,
|
|
5336
|
+
method,
|
|
5337
|
+
data,
|
|
5338
|
+
signal,
|
|
5339
|
+
cancelToken,
|
|
5340
|
+
timeout,
|
|
5341
|
+
onDownloadProgress,
|
|
5342
|
+
onUploadProgress,
|
|
5343
|
+
responseType,
|
|
5344
|
+
headers,
|
|
5345
|
+
withCredentials = 'same-origin',
|
|
5346
|
+
fetchOptions
|
|
5347
|
+
} = resolveConfig(config);
|
|
5348
|
+
|
|
5349
|
+
let _fetch = envFetch || fetch;
|
|
5273
5350
|
|
|
5274
|
-
|
|
5275
|
-
|
|
5276
|
-
|
|
5277
|
-
|
|
5278
|
-
|
|
5279
|
-
|
|
5280
|
-
|
|
5281
|
-
timeout,
|
|
5282
|
-
onDownloadProgress,
|
|
5283
|
-
onUploadProgress,
|
|
5284
|
-
responseType,
|
|
5285
|
-
headers,
|
|
5286
|
-
withCredentials = 'same-origin',
|
|
5287
|
-
fetchOptions
|
|
5288
|
-
} = resolveConfig(config);
|
|
5289
|
-
|
|
5290
|
-
responseType = responseType ? (responseType + '').toLowerCase() : 'text';
|
|
5291
|
-
|
|
5292
|
-
let composedSignal = composeSignals$1([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
|
|
5293
|
-
|
|
5294
|
-
let request;
|
|
5295
|
-
|
|
5296
|
-
const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
|
|
5351
|
+
responseType = responseType ? (responseType + '').toLowerCase() : 'text';
|
|
5352
|
+
|
|
5353
|
+
let composedSignal = composeSignals$1([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
|
|
5354
|
+
|
|
5355
|
+
let request = null;
|
|
5356
|
+
|
|
5357
|
+
const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
|
|
5297
5358
|
composedSignal.unsubscribe();
|
|
5298
|
-
|
|
5359
|
+
});
|
|
5299
5360
|
|
|
5300
|
-
|
|
5361
|
+
let requestContentLength;
|
|
5301
5362
|
|
|
5302
|
-
|
|
5303
|
-
|
|
5304
|
-
|
|
5305
|
-
|
|
5306
|
-
|
|
5307
|
-
|
|
5308
|
-
|
|
5309
|
-
|
|
5310
|
-
|
|
5311
|
-
|
|
5363
|
+
try {
|
|
5364
|
+
if (
|
|
5365
|
+
onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' &&
|
|
5366
|
+
(requestContentLength = await resolveBodyLength(headers, data)) !== 0
|
|
5367
|
+
) {
|
|
5368
|
+
let _request = new Request(url, {
|
|
5369
|
+
method: 'POST',
|
|
5370
|
+
body: data,
|
|
5371
|
+
duplex: "half"
|
|
5372
|
+
});
|
|
5312
5373
|
|
|
5313
|
-
|
|
5374
|
+
let contentTypeHeader;
|
|
5314
5375
|
|
|
5315
|
-
|
|
5316
|
-
|
|
5317
|
-
|
|
5376
|
+
if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
|
|
5377
|
+
headers.setContentType(contentTypeHeader);
|
|
5378
|
+
}
|
|
5318
5379
|
|
|
5319
|
-
|
|
5320
|
-
|
|
5321
|
-
|
|
5322
|
-
|
|
5323
|
-
|
|
5380
|
+
if (_request.body) {
|
|
5381
|
+
const [onProgress, flush] = progressEventDecorator(
|
|
5382
|
+
requestContentLength,
|
|
5383
|
+
progressEventReducer(asyncDecorator(onUploadProgress))
|
|
5384
|
+
);
|
|
5324
5385
|
|
|
5325
|
-
|
|
5386
|
+
data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
|
|
5387
|
+
}
|
|
5326
5388
|
}
|
|
5327
|
-
}
|
|
5328
5389
|
|
|
5329
|
-
|
|
5330
|
-
|
|
5331
|
-
|
|
5390
|
+
if (!utils$1.isString(withCredentials)) {
|
|
5391
|
+
withCredentials = withCredentials ? 'include' : 'omit';
|
|
5392
|
+
}
|
|
5332
5393
|
|
|
5333
|
-
|
|
5334
|
-
|
|
5335
|
-
|
|
5336
|
-
request = new Request(url, {
|
|
5337
|
-
...fetchOptions,
|
|
5338
|
-
signal: composedSignal,
|
|
5339
|
-
method: method.toUpperCase(),
|
|
5340
|
-
headers: headers.normalize().toJSON(),
|
|
5341
|
-
body: data,
|
|
5342
|
-
duplex: "half",
|
|
5343
|
-
credentials: isCredentialsSupported ? withCredentials : undefined
|
|
5344
|
-
});
|
|
5394
|
+
// Cloudflare Workers throws when credentials are defined
|
|
5395
|
+
// see https://github.com/cloudflare/workerd/issues/902
|
|
5396
|
+
const isCredentialsSupported = isRequestSupported && "credentials" in Request.prototype;
|
|
5345
5397
|
|
|
5346
|
-
|
|
5398
|
+
const resolvedOptions = {
|
|
5399
|
+
...fetchOptions,
|
|
5400
|
+
signal: composedSignal,
|
|
5401
|
+
method: method.toUpperCase(),
|
|
5402
|
+
headers: headers.normalize().toJSON(),
|
|
5403
|
+
body: data,
|
|
5404
|
+
duplex: "half",
|
|
5405
|
+
credentials: isCredentialsSupported ? withCredentials : undefined
|
|
5406
|
+
};
|
|
5347
5407
|
|
|
5348
|
-
|
|
5408
|
+
request = isRequestSupported && new Request(url, resolvedOptions);
|
|
5349
5409
|
|
|
5350
|
-
|
|
5351
|
-
const options = {};
|
|
5410
|
+
let response = await (isRequestSupported ? _fetch(request, fetchOptions) : _fetch(url, resolvedOptions));
|
|
5352
5411
|
|
|
5353
|
-
|
|
5354
|
-
options[prop] = response[prop];
|
|
5355
|
-
});
|
|
5412
|
+
const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
|
|
5356
5413
|
|
|
5357
|
-
|
|
5414
|
+
if (supportsResponseStream && (onDownloadProgress || (isStreamResponse && unsubscribe))) {
|
|
5415
|
+
const options = {};
|
|
5358
5416
|
|
|
5359
|
-
|
|
5360
|
-
|
|
5361
|
-
|
|
5362
|
-
) || [];
|
|
5417
|
+
['status', 'statusText', 'headers'].forEach(prop => {
|
|
5418
|
+
options[prop] = response[prop];
|
|
5419
|
+
});
|
|
5363
5420
|
|
|
5364
|
-
|
|
5365
|
-
trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
|
|
5366
|
-
flush && flush();
|
|
5367
|
-
unsubscribe && unsubscribe();
|
|
5368
|
-
}),
|
|
5369
|
-
options
|
|
5370
|
-
);
|
|
5371
|
-
}
|
|
5421
|
+
const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
|
|
5372
5422
|
|
|
5373
|
-
|
|
5423
|
+
const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
|
|
5424
|
+
responseContentLength,
|
|
5425
|
+
progressEventReducer(asyncDecorator(onDownloadProgress), true)
|
|
5426
|
+
) || [];
|
|
5374
5427
|
|
|
5375
|
-
|
|
5428
|
+
response = new Response(
|
|
5429
|
+
trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
|
|
5430
|
+
flush && flush();
|
|
5431
|
+
unsubscribe && unsubscribe();
|
|
5432
|
+
}),
|
|
5433
|
+
options
|
|
5434
|
+
);
|
|
5435
|
+
}
|
|
5376
5436
|
|
|
5377
|
-
|
|
5437
|
+
responseType = responseType || 'text';
|
|
5378
5438
|
|
|
5379
|
-
|
|
5380
|
-
settle(resolve, reject, {
|
|
5381
|
-
data: responseData,
|
|
5382
|
-
headers: AxiosHeaders$1.from(response.headers),
|
|
5383
|
-
status: response.status,
|
|
5384
|
-
statusText: response.statusText,
|
|
5385
|
-
config,
|
|
5386
|
-
request
|
|
5387
|
-
});
|
|
5388
|
-
})
|
|
5389
|
-
} catch (err) {
|
|
5390
|
-
unsubscribe && unsubscribe();
|
|
5439
|
+
let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
|
|
5391
5440
|
|
|
5392
|
-
|
|
5393
|
-
|
|
5394
|
-
|
|
5395
|
-
{
|
|
5396
|
-
|
|
5397
|
-
|
|
5398
|
-
|
|
5441
|
+
!isStreamResponse && unsubscribe && unsubscribe();
|
|
5442
|
+
|
|
5443
|
+
return await new Promise((resolve, reject) => {
|
|
5444
|
+
settle(resolve, reject, {
|
|
5445
|
+
data: responseData,
|
|
5446
|
+
headers: AxiosHeaders$1.from(response.headers),
|
|
5447
|
+
status: response.status,
|
|
5448
|
+
statusText: response.statusText,
|
|
5449
|
+
config,
|
|
5450
|
+
request
|
|
5451
|
+
});
|
|
5452
|
+
})
|
|
5453
|
+
} catch (err) {
|
|
5454
|
+
unsubscribe && unsubscribe();
|
|
5455
|
+
|
|
5456
|
+
if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
|
|
5457
|
+
throw Object.assign(
|
|
5458
|
+
new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request),
|
|
5459
|
+
{
|
|
5460
|
+
cause: err.cause || err
|
|
5461
|
+
}
|
|
5462
|
+
)
|
|
5463
|
+
}
|
|
5464
|
+
|
|
5465
|
+
throw AxiosError.from(err, err && err.code, config, request);
|
|
5399
5466
|
}
|
|
5467
|
+
}
|
|
5468
|
+
};
|
|
5469
|
+
|
|
5470
|
+
const seedCache = new Map();
|
|
5471
|
+
|
|
5472
|
+
const getFetch = (config) => {
|
|
5473
|
+
let env = (config && config.env) || {};
|
|
5474
|
+
const {fetch, Request, Response} = env;
|
|
5475
|
+
const seeds = [
|
|
5476
|
+
Request, Response, fetch
|
|
5477
|
+
];
|
|
5478
|
+
|
|
5479
|
+
let len = seeds.length, i = len,
|
|
5480
|
+
seed, target, map = seedCache;
|
|
5481
|
+
|
|
5482
|
+
while (i--) {
|
|
5483
|
+
seed = seeds[i];
|
|
5484
|
+
target = map.get(seed);
|
|
5485
|
+
|
|
5486
|
+
target === undefined && map.set(seed, target = (i ? new Map() : factory(env)));
|
|
5400
5487
|
|
|
5401
|
-
|
|
5488
|
+
map = target;
|
|
5402
5489
|
}
|
|
5403
|
-
});
|
|
5404
5490
|
|
|
5491
|
+
return target;
|
|
5492
|
+
};
|
|
5493
|
+
|
|
5494
|
+
getFetch();
|
|
5495
|
+
|
|
5496
|
+
/**
|
|
5497
|
+
* Known adapters mapping.
|
|
5498
|
+
* Provides environment-specific adapters for Axios:
|
|
5499
|
+
* - `http` for Node.js
|
|
5500
|
+
* - `xhr` for browsers
|
|
5501
|
+
* - `fetch` for fetch API-based requests
|
|
5502
|
+
*
|
|
5503
|
+
* @type {Object<string, Function|Object>}
|
|
5504
|
+
*/
|
|
5405
5505
|
const knownAdapters = {
|
|
5406
5506
|
http: httpAdapter,
|
|
5407
5507
|
xhr: xhrAdapter,
|
|
5408
|
-
fetch:
|
|
5508
|
+
fetch: {
|
|
5509
|
+
get: getFetch,
|
|
5510
|
+
}
|
|
5409
5511
|
};
|
|
5410
5512
|
|
|
5513
|
+
// Assign adapter names for easier debugging and identification
|
|
5411
5514
|
utils$1.forEach(knownAdapters, (fn, value) => {
|
|
5412
5515
|
if (fn) {
|
|
5413
5516
|
try {
|
|
5414
|
-
Object.defineProperty(fn, 'name', {value});
|
|
5517
|
+
Object.defineProperty(fn, 'name', { value });
|
|
5415
5518
|
} catch (e) {
|
|
5416
5519
|
// eslint-disable-next-line no-empty
|
|
5417
5520
|
}
|
|
5418
|
-
Object.defineProperty(fn, 'adapterName', {value});
|
|
5521
|
+
Object.defineProperty(fn, 'adapterName', { value });
|
|
5419
5522
|
}
|
|
5420
5523
|
});
|
|
5421
5524
|
|
|
5525
|
+
/**
|
|
5526
|
+
* Render a rejection reason string for unknown or unsupported adapters
|
|
5527
|
+
*
|
|
5528
|
+
* @param {string} reason
|
|
5529
|
+
* @returns {string}
|
|
5530
|
+
*/
|
|
5422
5531
|
const renderReason = (reason) => `- ${reason}`;
|
|
5423
5532
|
|
|
5533
|
+
/**
|
|
5534
|
+
* Check if the adapter is resolved (function, null, or false)
|
|
5535
|
+
*
|
|
5536
|
+
* @param {Function|null|false} adapter
|
|
5537
|
+
* @returns {boolean}
|
|
5538
|
+
*/
|
|
5424
5539
|
const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
|
|
5425
5540
|
|
|
5426
|
-
|
|
5427
|
-
|
|
5428
|
-
|
|
5429
|
-
|
|
5430
|
-
|
|
5431
|
-
|
|
5432
|
-
|
|
5541
|
+
/**
|
|
5542
|
+
* Get the first suitable adapter from the provided list.
|
|
5543
|
+
* Tries each adapter in order until a supported one is found.
|
|
5544
|
+
* Throws an AxiosError if no adapter is suitable.
|
|
5545
|
+
*
|
|
5546
|
+
* @param {Array<string|Function>|string|Function} adapters - Adapter(s) by name or function.
|
|
5547
|
+
* @param {Object} config - Axios request configuration
|
|
5548
|
+
* @throws {AxiosError} If no suitable adapter is available
|
|
5549
|
+
* @returns {Function} The resolved adapter function
|
|
5550
|
+
*/
|
|
5551
|
+
function getAdapter(adapters, config) {
|
|
5552
|
+
adapters = utils$1.isArray(adapters) ? adapters : [adapters];
|
|
5433
5553
|
|
|
5434
|
-
|
|
5554
|
+
const { length } = adapters;
|
|
5555
|
+
let nameOrAdapter;
|
|
5556
|
+
let adapter;
|
|
5435
5557
|
|
|
5436
|
-
|
|
5437
|
-
nameOrAdapter = adapters[i];
|
|
5438
|
-
let id;
|
|
5558
|
+
const rejectedReasons = {};
|
|
5439
5559
|
|
|
5440
|
-
|
|
5560
|
+
for (let i = 0; i < length; i++) {
|
|
5561
|
+
nameOrAdapter = adapters[i];
|
|
5562
|
+
let id;
|
|
5441
5563
|
|
|
5442
|
-
|
|
5443
|
-
adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
|
|
5564
|
+
adapter = nameOrAdapter;
|
|
5444
5565
|
|
|
5445
|
-
|
|
5446
|
-
|
|
5447
|
-
}
|
|
5448
|
-
}
|
|
5566
|
+
if (!isResolvedHandle(nameOrAdapter)) {
|
|
5567
|
+
adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
|
|
5449
5568
|
|
|
5450
|
-
if (adapter) {
|
|
5451
|
-
|
|
5569
|
+
if (adapter === undefined) {
|
|
5570
|
+
throw new AxiosError(`Unknown adapter '${id}'`);
|
|
5452
5571
|
}
|
|
5572
|
+
}
|
|
5453
5573
|
|
|
5454
|
-
|
|
5574
|
+
if (adapter && (utils$1.isFunction(adapter) || (adapter = adapter.get(config)))) {
|
|
5575
|
+
break;
|
|
5455
5576
|
}
|
|
5456
5577
|
|
|
5457
|
-
|
|
5578
|
+
rejectedReasons[id || '#' + i] = adapter;
|
|
5579
|
+
}
|
|
5458
5580
|
|
|
5459
|
-
|
|
5460
|
-
|
|
5461
|
-
|
|
5462
|
-
)
|
|
5581
|
+
if (!adapter) {
|
|
5582
|
+
const reasons = Object.entries(rejectedReasons)
|
|
5583
|
+
.map(([id, state]) => `adapter ${id} ` +
|
|
5584
|
+
(state === false ? 'is not supported by the environment' : 'is not available in the build')
|
|
5585
|
+
);
|
|
5463
5586
|
|
|
5464
|
-
|
|
5465
|
-
|
|
5466
|
-
|
|
5587
|
+
let s = length ?
|
|
5588
|
+
(reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) :
|
|
5589
|
+
'as no adapter specified';
|
|
5467
5590
|
|
|
5468
|
-
|
|
5469
|
-
|
|
5470
|
-
|
|
5471
|
-
|
|
5472
|
-
|
|
5591
|
+
throw new AxiosError(
|
|
5592
|
+
`There is no suitable adapter to dispatch the request ` + s,
|
|
5593
|
+
'ERR_NOT_SUPPORT'
|
|
5594
|
+
);
|
|
5595
|
+
}
|
|
5473
5596
|
|
|
5474
|
-
|
|
5475
|
-
|
|
5597
|
+
return adapter;
|
|
5598
|
+
}
|
|
5599
|
+
|
|
5600
|
+
/**
|
|
5601
|
+
* Exports Axios adapters and utility to resolve an adapter
|
|
5602
|
+
*/
|
|
5603
|
+
var adapters = {
|
|
5604
|
+
/**
|
|
5605
|
+
* Resolve an adapter from a list of adapter names or functions.
|
|
5606
|
+
* @type {Function}
|
|
5607
|
+
*/
|
|
5608
|
+
getAdapter,
|
|
5609
|
+
|
|
5610
|
+
/**
|
|
5611
|
+
* Exposes all known adapters
|
|
5612
|
+
* @type {Object<string, Function|Object>}
|
|
5613
|
+
*/
|
|
5476
5614
|
adapters: knownAdapters
|
|
5477
5615
|
};
|
|
5478
5616
|
|
|
@@ -5515,7 +5653,7 @@ function dispatchRequest(config) {
|
|
|
5515
5653
|
config.headers.setContentType('application/x-www-form-urlencoded', false);
|
|
5516
5654
|
}
|
|
5517
5655
|
|
|
5518
|
-
const adapter = adapters.getAdapter(config.adapter || defaults$1.adapter);
|
|
5656
|
+
const adapter = adapters.getAdapter(config.adapter || defaults$1.adapter, config);
|
|
5519
5657
|
|
|
5520
5658
|
return adapter(config).then(function onAdapterResolution(response) {
|
|
5521
5659
|
throwIfCancellationRequested(config);
|
|
@@ -5549,7 +5687,7 @@ function dispatchRequest(config) {
|
|
|
5549
5687
|
});
|
|
5550
5688
|
}
|
|
5551
5689
|
|
|
5552
|
-
const VERSION = "1.
|
|
5690
|
+
const VERSION = "1.13.2";
|
|
5553
5691
|
|
|
5554
5692
|
const validators$1 = {};
|
|
5555
5693
|
|
|
@@ -5805,8 +5943,6 @@ class Axios {
|
|
|
5805
5943
|
|
|
5806
5944
|
let newConfig = config;
|
|
5807
5945
|
|
|
5808
|
-
i = 0;
|
|
5809
|
-
|
|
5810
5946
|
while (i < len) {
|
|
5811
5947
|
const onFulfilled = requestInterceptorChain[i++];
|
|
5812
5948
|
const onRejected = requestInterceptorChain[i++];
|
|
@@ -6110,6 +6246,12 @@ const HttpStatusCode = {
|
|
|
6110
6246
|
LoopDetected: 508,
|
|
6111
6247
|
NotExtended: 510,
|
|
6112
6248
|
NetworkAuthenticationRequired: 511,
|
|
6249
|
+
WebServerIsDown: 521,
|
|
6250
|
+
ConnectionTimedOut: 522,
|
|
6251
|
+
OriginIsUnreachable: 523,
|
|
6252
|
+
TimeoutOccurred: 524,
|
|
6253
|
+
SslHandshakeFailed: 525,
|
|
6254
|
+
InvalidSslCertificate: 526,
|
|
6113
6255
|
};
|
|
6114
6256
|
|
|
6115
6257
|
Object.entries(HttpStatusCode).forEach(([key, value]) => {
|