@passkeyme/auth 2.0.9 → 2.0.11
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 +2 -2
- package/dist/index.esm.js +413 -267
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +413 -267
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +413 -267
- package/dist/index.umd.js.map +1 -1
- package/dist/src/passkeyme-auth.d.ts.map +1 -1
- package/dist/src/types.d.ts +5 -5
- package/dist/src/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -828,7 +828,7 @@
|
|
|
828
828
|
const defaultRedirectUri = typeof window !== "undefined" && window.location && window.location.origin
|
|
829
829
|
? `${window.location.origin}/auth/callback`
|
|
830
830
|
: "http://localhost:3000/auth/callback";
|
|
831
|
-
//
|
|
831
|
+
// Base URL for hosted auth UI pages - defaults to auth.passkeyme.com
|
|
832
832
|
const serverUrl = config.baseUrl || "https://auth.passkeyme.com";
|
|
833
833
|
console.log("[DEBUG] serverUrl determined as:", serverUrl);
|
|
834
834
|
this.config = {
|
|
@@ -1019,11 +1019,15 @@
|
|
|
1019
1019
|
*/
|
|
1020
1020
|
redirectToOAuth(provider, redirectUri) {
|
|
1021
1021
|
const finalRedirectUri = redirectUri || this.config.redirectUri;
|
|
1022
|
-
// Build direct OAuth initiation URL
|
|
1022
|
+
// Build direct OAuth initiation URL - use apiUrl for backend API endpoints
|
|
1023
|
+
const apiBaseUrl = this.config.apiUrl ||
|
|
1024
|
+
(typeof window !== "undefined" && window.location.hostname !== "localhost"
|
|
1025
|
+
? "https://api.passkeyme.com"
|
|
1026
|
+
: "http://localhost:8000");
|
|
1023
1027
|
const params = new URLSearchParams({
|
|
1024
1028
|
redirect_uri: finalRedirectUri,
|
|
1025
1029
|
});
|
|
1026
|
-
const oauthUrl = `${
|
|
1030
|
+
const oauthUrl = `${apiBaseUrl}/auth/${this.config.appId}/oauth/${provider}/start?${params.toString()}`;
|
|
1027
1031
|
logger.debug("Redirecting directly to OAuth provider:", provider, oauthUrl);
|
|
1028
1032
|
this.performRedirect(oauthUrl, finalRedirectUri);
|
|
1029
1033
|
}
|
|
@@ -1833,6 +1837,13 @@
|
|
|
1833
1837
|
return new PasskeymeAuth(config);
|
|
1834
1838
|
}
|
|
1835
1839
|
|
|
1840
|
+
/**
|
|
1841
|
+
* Create a bound version of a function with a specified `this` context
|
|
1842
|
+
*
|
|
1843
|
+
* @param {Function} fn - The function to bind
|
|
1844
|
+
* @param {*} thisArg - The value to be passed as the `this` parameter
|
|
1845
|
+
* @returns {Function} A new function that will call the original function with the specified `this` context
|
|
1846
|
+
*/
|
|
1836
1847
|
function bind(fn, thisArg) {
|
|
1837
1848
|
return function wrap() {
|
|
1838
1849
|
return fn.apply(thisArg, arguments);
|
|
@@ -1884,7 +1895,7 @@
|
|
|
1884
1895
|
*/
|
|
1885
1896
|
function isBuffer(val) {
|
|
1886
1897
|
return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
|
|
1887
|
-
&& isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);
|
|
1898
|
+
&& isFunction$1(val.constructor.isBuffer) && val.constructor.isBuffer(val);
|
|
1888
1899
|
}
|
|
1889
1900
|
|
|
1890
1901
|
/**
|
|
@@ -1929,7 +1940,7 @@
|
|
|
1929
1940
|
* @param {*} val The value to test
|
|
1930
1941
|
* @returns {boolean} True if value is a Function, otherwise false
|
|
1931
1942
|
*/
|
|
1932
|
-
const isFunction = typeOfTest('function');
|
|
1943
|
+
const isFunction$1 = typeOfTest('function');
|
|
1933
1944
|
|
|
1934
1945
|
/**
|
|
1935
1946
|
* Determine if a value is a Number
|
|
@@ -1985,7 +1996,7 @@
|
|
|
1985
1996
|
if (!isObject(val) || isBuffer(val)) {
|
|
1986
1997
|
return false;
|
|
1987
1998
|
}
|
|
1988
|
-
|
|
1999
|
+
|
|
1989
2000
|
try {
|
|
1990
2001
|
return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
|
|
1991
2002
|
} catch (e) {
|
|
@@ -2037,7 +2048,7 @@
|
|
|
2037
2048
|
*
|
|
2038
2049
|
* @returns {boolean} True if value is a Stream, otherwise false
|
|
2039
2050
|
*/
|
|
2040
|
-
const isStream = (val) => isObject(val) && isFunction(val.pipe);
|
|
2051
|
+
const isStream = (val) => isObject(val) && isFunction$1(val.pipe);
|
|
2041
2052
|
|
|
2042
2053
|
/**
|
|
2043
2054
|
* Determine if a value is a FormData
|
|
@@ -2050,10 +2061,10 @@
|
|
|
2050
2061
|
let kind;
|
|
2051
2062
|
return thing && (
|
|
2052
2063
|
(typeof FormData === 'function' && thing instanceof FormData) || (
|
|
2053
|
-
isFunction(thing.append) && (
|
|
2064
|
+
isFunction$1(thing.append) && (
|
|
2054
2065
|
(kind = kindOf(thing)) === 'formdata' ||
|
|
2055
2066
|
// detect form-data instance
|
|
2056
|
-
(kind === 'object' && isFunction(thing.toString) && thing.toString() === '[object FormData]')
|
|
2067
|
+
(kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]')
|
|
2057
2068
|
)
|
|
2058
2069
|
)
|
|
2059
2070
|
)
|
|
@@ -2178,7 +2189,7 @@
|
|
|
2178
2189
|
* @returns {Object} Result of all merge properties
|
|
2179
2190
|
*/
|
|
2180
2191
|
function merge(/* obj1, obj2, obj3, ... */) {
|
|
2181
|
-
const {caseless} = isContextDefined(this) && this || {};
|
|
2192
|
+
const {caseless, skipUndefined} = isContextDefined(this) && this || {};
|
|
2182
2193
|
const result = {};
|
|
2183
2194
|
const assignValue = (val, key) => {
|
|
2184
2195
|
const targetKey = caseless && findKey(result, key) || key;
|
|
@@ -2188,7 +2199,7 @@
|
|
|
2188
2199
|
result[targetKey] = merge({}, val);
|
|
2189
2200
|
} else if (isArray(val)) {
|
|
2190
2201
|
result[targetKey] = val.slice();
|
|
2191
|
-
} else {
|
|
2202
|
+
} else if (!skipUndefined || !isUndefined(val)) {
|
|
2192
2203
|
result[targetKey] = val;
|
|
2193
2204
|
}
|
|
2194
2205
|
};
|
|
@@ -2211,7 +2222,7 @@
|
|
|
2211
2222
|
*/
|
|
2212
2223
|
const extend = (a, b, thisArg, {allOwnKeys}= {}) => {
|
|
2213
2224
|
forEach(b, (val, key) => {
|
|
2214
|
-
if (thisArg && isFunction(val)) {
|
|
2225
|
+
if (thisArg && isFunction$1(val)) {
|
|
2215
2226
|
a[key] = bind(val, thisArg);
|
|
2216
2227
|
} else {
|
|
2217
2228
|
a[key] = val;
|
|
@@ -2427,13 +2438,13 @@
|
|
|
2427
2438
|
const freezeMethods = (obj) => {
|
|
2428
2439
|
reduceDescriptors(obj, (descriptor, name) => {
|
|
2429
2440
|
// skip restricted props in strict mode
|
|
2430
|
-
if (isFunction(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
|
|
2441
|
+
if (isFunction$1(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
|
|
2431
2442
|
return false;
|
|
2432
2443
|
}
|
|
2433
2444
|
|
|
2434
2445
|
const value = obj[name];
|
|
2435
2446
|
|
|
2436
|
-
if (!isFunction(value)) return;
|
|
2447
|
+
if (!isFunction$1(value)) return;
|
|
2437
2448
|
|
|
2438
2449
|
descriptor.enumerable = false;
|
|
2439
2450
|
|
|
@@ -2470,6 +2481,8 @@
|
|
|
2470
2481
|
return value != null && Number.isFinite(value = +value) ? value : defaultValue;
|
|
2471
2482
|
};
|
|
2472
2483
|
|
|
2484
|
+
|
|
2485
|
+
|
|
2473
2486
|
/**
|
|
2474
2487
|
* If the thing is a FormData object, return true, otherwise return false.
|
|
2475
2488
|
*
|
|
@@ -2478,7 +2491,7 @@
|
|
|
2478
2491
|
* @returns {boolean}
|
|
2479
2492
|
*/
|
|
2480
2493
|
function isSpecCompliantForm(thing) {
|
|
2481
|
-
return !!(thing && isFunction(thing.append) && thing[toStringTag] === 'FormData' && thing[iterator]);
|
|
2494
|
+
return !!(thing && isFunction$1(thing.append) && thing[toStringTag] === 'FormData' && thing[iterator]);
|
|
2482
2495
|
}
|
|
2483
2496
|
|
|
2484
2497
|
const toJSONObject = (obj) => {
|
|
@@ -2520,7 +2533,7 @@
|
|
|
2520
2533
|
const isAsyncFn = kindOfTest('AsyncFunction');
|
|
2521
2534
|
|
|
2522
2535
|
const isThenable = (thing) =>
|
|
2523
|
-
thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
|
|
2536
|
+
thing && (isObject(thing) || isFunction$1(thing)) && isFunction$1(thing.then) && isFunction$1(thing.catch);
|
|
2524
2537
|
|
|
2525
2538
|
// original code
|
|
2526
2539
|
// https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
|
|
@@ -2544,7 +2557,7 @@
|
|
|
2544
2557
|
})(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
|
|
2545
2558
|
})(
|
|
2546
2559
|
typeof setImmediate === 'function',
|
|
2547
|
-
isFunction(_global.postMessage)
|
|
2560
|
+
isFunction$1(_global.postMessage)
|
|
2548
2561
|
);
|
|
2549
2562
|
|
|
2550
2563
|
const asap = typeof queueMicrotask !== 'undefined' ?
|
|
@@ -2553,7 +2566,7 @@
|
|
|
2553
2566
|
// *********************
|
|
2554
2567
|
|
|
2555
2568
|
|
|
2556
|
-
const isIterable = (thing) => thing != null && isFunction(thing[iterator]);
|
|
2569
|
+
const isIterable = (thing) => thing != null && isFunction$1(thing[iterator]);
|
|
2557
2570
|
|
|
2558
2571
|
|
|
2559
2572
|
var utils$1 = {
|
|
@@ -2577,7 +2590,7 @@
|
|
|
2577
2590
|
isFile,
|
|
2578
2591
|
isBlob,
|
|
2579
2592
|
isRegExp,
|
|
2580
|
-
isFunction,
|
|
2593
|
+
isFunction: isFunction$1,
|
|
2581
2594
|
isStream,
|
|
2582
2595
|
isURLSearchParams,
|
|
2583
2596
|
isTypedArray,
|
|
@@ -2703,11 +2716,18 @@
|
|
|
2703
2716
|
return prop !== 'isAxiosError';
|
|
2704
2717
|
});
|
|
2705
2718
|
|
|
2706
|
-
|
|
2719
|
+
const msg = error && error.message ? error.message : 'Error';
|
|
2707
2720
|
|
|
2708
|
-
|
|
2721
|
+
// Prefer explicit code; otherwise copy the low-level error's code (e.g. ECONNREFUSED)
|
|
2722
|
+
const errCode = code == null && error ? error.code : code;
|
|
2723
|
+
AxiosError.call(axiosError, msg, errCode, config, request, response);
|
|
2709
2724
|
|
|
2710
|
-
|
|
2725
|
+
// Chain the original error on the standard field; non-enumerable to avoid JSON noise
|
|
2726
|
+
if (error && axiosError.cause == null) {
|
|
2727
|
+
Object.defineProperty(axiosError, 'cause', { value: error, configurable: true });
|
|
2728
|
+
}
|
|
2729
|
+
|
|
2730
|
+
axiosError.name = (error && error.name) || 'Error';
|
|
2711
2731
|
|
|
2712
2732
|
customProps && Object.assign(axiosError, customProps);
|
|
2713
2733
|
|
|
@@ -2998,9 +3018,7 @@
|
|
|
2998
3018
|
replace(/%3A/gi, ':').
|
|
2999
3019
|
replace(/%24/g, '$').
|
|
3000
3020
|
replace(/%2C/gi, ',').
|
|
3001
|
-
replace(/%20/g, '+')
|
|
3002
|
-
replace(/%5B/gi, '[').
|
|
3003
|
-
replace(/%5D/gi, ']');
|
|
3021
|
+
replace(/%20/g, '+');
|
|
3004
3022
|
}
|
|
3005
3023
|
|
|
3006
3024
|
/**
|
|
@@ -3078,7 +3096,7 @@
|
|
|
3078
3096
|
*
|
|
3079
3097
|
* @param {Number} id The ID that was returned by `use`
|
|
3080
3098
|
*
|
|
3081
|
-
* @returns {
|
|
3099
|
+
* @returns {void}
|
|
3082
3100
|
*/
|
|
3083
3101
|
eject(id) {
|
|
3084
3102
|
if (this.handlers[id]) {
|
|
@@ -3405,7 +3423,7 @@
|
|
|
3405
3423
|
const strictJSONParsing = !silentJSONParsing && JSONRequested;
|
|
3406
3424
|
|
|
3407
3425
|
try {
|
|
3408
|
-
return JSON.parse(data);
|
|
3426
|
+
return JSON.parse(data, this.parseReviver);
|
|
3409
3427
|
} catch (e) {
|
|
3410
3428
|
if (strictJSONParsing) {
|
|
3411
3429
|
if (e.name === 'SyntaxError') {
|
|
@@ -4044,27 +4062,38 @@
|
|
|
4044
4062
|
|
|
4045
4063
|
// Standard browser envs support document.cookie
|
|
4046
4064
|
{
|
|
4047
|
-
write(name, value, expires, path, domain, secure) {
|
|
4048
|
-
|
|
4065
|
+
write(name, value, expires, path, domain, secure, sameSite) {
|
|
4066
|
+
if (typeof document === 'undefined') return;
|
|
4049
4067
|
|
|
4050
|
-
|
|
4068
|
+
const cookie = [`${name}=${encodeURIComponent(value)}`];
|
|
4051
4069
|
|
|
4052
|
-
utils$1.
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
|
|
4070
|
+
if (utils$1.isNumber(expires)) {
|
|
4071
|
+
cookie.push(`expires=${new Date(expires).toUTCString()}`);
|
|
4072
|
+
}
|
|
4073
|
+
if (utils$1.isString(path)) {
|
|
4074
|
+
cookie.push(`path=${path}`);
|
|
4075
|
+
}
|
|
4076
|
+
if (utils$1.isString(domain)) {
|
|
4077
|
+
cookie.push(`domain=${domain}`);
|
|
4078
|
+
}
|
|
4079
|
+
if (secure === true) {
|
|
4080
|
+
cookie.push('secure');
|
|
4081
|
+
}
|
|
4082
|
+
if (utils$1.isString(sameSite)) {
|
|
4083
|
+
cookie.push(`SameSite=${sameSite}`);
|
|
4084
|
+
}
|
|
4057
4085
|
|
|
4058
4086
|
document.cookie = cookie.join('; ');
|
|
4059
4087
|
},
|
|
4060
4088
|
|
|
4061
4089
|
read(name) {
|
|
4062
|
-
|
|
4063
|
-
|
|
4090
|
+
if (typeof document === 'undefined') return null;
|
|
4091
|
+
const match = document.cookie.match(new RegExp('(?:^|; )' + name + '=([^;]*)'));
|
|
4092
|
+
return match ? decodeURIComponent(match[1]) : null;
|
|
4064
4093
|
},
|
|
4065
4094
|
|
|
4066
4095
|
remove(name) {
|
|
4067
|
-
this.write(name, '', Date.now() - 86400000);
|
|
4096
|
+
this.write(name, '', Date.now() - 86400000, '/');
|
|
4068
4097
|
}
|
|
4069
4098
|
}
|
|
4070
4099
|
|
|
@@ -4153,11 +4182,11 @@
|
|
|
4153
4182
|
}
|
|
4154
4183
|
|
|
4155
4184
|
// eslint-disable-next-line consistent-return
|
|
4156
|
-
function mergeDeepProperties(a, b, prop
|
|
4185
|
+
function mergeDeepProperties(a, b, prop, caseless) {
|
|
4157
4186
|
if (!utils$1.isUndefined(b)) {
|
|
4158
|
-
return getMergedValue(a, b, prop
|
|
4187
|
+
return getMergedValue(a, b, prop, caseless);
|
|
4159
4188
|
} else if (!utils$1.isUndefined(a)) {
|
|
4160
|
-
return getMergedValue(undefined, a, prop
|
|
4189
|
+
return getMergedValue(undefined, a, prop, caseless);
|
|
4161
4190
|
}
|
|
4162
4191
|
}
|
|
4163
4192
|
|
|
@@ -4215,7 +4244,7 @@
|
|
|
4215
4244
|
socketPath: defaultToConfig2,
|
|
4216
4245
|
responseEncoding: defaultToConfig2,
|
|
4217
4246
|
validateStatus: mergeDirectKeys,
|
|
4218
|
-
headers: (a, b
|
|
4247
|
+
headers: (a, b, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true)
|
|
4219
4248
|
};
|
|
4220
4249
|
|
|
4221
4250
|
utils$1.forEach(Object.keys({...config1, ...config2}), function computeConfigValue(prop) {
|
|
@@ -4230,7 +4259,7 @@
|
|
|
4230
4259
|
var resolveConfig = (config) => {
|
|
4231
4260
|
const newConfig = mergeConfig({}, config);
|
|
4232
4261
|
|
|
4233
|
-
let {data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth} = newConfig;
|
|
4262
|
+
let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
|
|
4234
4263
|
|
|
4235
4264
|
newConfig.headers = headers = AxiosHeaders$1.from(headers);
|
|
4236
4265
|
|
|
@@ -4243,17 +4272,21 @@
|
|
|
4243
4272
|
);
|
|
4244
4273
|
}
|
|
4245
4274
|
|
|
4246
|
-
let contentType;
|
|
4247
|
-
|
|
4248
4275
|
if (utils$1.isFormData(data)) {
|
|
4249
4276
|
if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
|
|
4250
|
-
headers.setContentType(undefined); //
|
|
4251
|
-
} else if ((
|
|
4252
|
-
//
|
|
4253
|
-
const
|
|
4254
|
-
headers
|
|
4277
|
+
headers.setContentType(undefined); // browser handles it
|
|
4278
|
+
} else if (utils$1.isFunction(data.getHeaders)) {
|
|
4279
|
+
// Node.js FormData (like form-data package)
|
|
4280
|
+
const formHeaders = data.getHeaders();
|
|
4281
|
+
// Only set safe headers to avoid overwriting security headers
|
|
4282
|
+
const allowedHeaders = ['content-type', 'content-length'];
|
|
4283
|
+
Object.entries(formHeaders).forEach(([key, val]) => {
|
|
4284
|
+
if (allowedHeaders.includes(key.toLowerCase())) {
|
|
4285
|
+
headers.set(key, val);
|
|
4286
|
+
}
|
|
4287
|
+
});
|
|
4255
4288
|
}
|
|
4256
|
-
}
|
|
4289
|
+
}
|
|
4257
4290
|
|
|
4258
4291
|
// Add xsrf header
|
|
4259
4292
|
// This is only done if running in a standard browser environment.
|
|
@@ -4370,15 +4403,18 @@
|
|
|
4370
4403
|
};
|
|
4371
4404
|
|
|
4372
4405
|
// Handle low level network errors
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
|
|
4376
|
-
|
|
4377
|
-
|
|
4378
|
-
|
|
4379
|
-
|
|
4406
|
+
request.onerror = function handleError(event) {
|
|
4407
|
+
// Browsers deliver a ProgressEvent in XHR onerror
|
|
4408
|
+
// (message may be empty; when present, surface it)
|
|
4409
|
+
// See https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/error_event
|
|
4410
|
+
const msg = event && event.message ? event.message : 'Network Error';
|
|
4411
|
+
const err = new AxiosError(msg, AxiosError.ERR_NETWORK, config, request);
|
|
4412
|
+
// attach the underlying event for consumers who want details
|
|
4413
|
+
err.event = event || null;
|
|
4414
|
+
reject(err);
|
|
4415
|
+
request = null;
|
|
4380
4416
|
};
|
|
4381
|
-
|
|
4417
|
+
|
|
4382
4418
|
// Handle timeout
|
|
4383
4419
|
request.ontimeout = function handleTimeout() {
|
|
4384
4420
|
let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded';
|
|
@@ -4594,14 +4630,18 @@
|
|
|
4594
4630
|
})
|
|
4595
4631
|
};
|
|
4596
4632
|
|
|
4597
|
-
const
|
|
4598
|
-
|
|
4633
|
+
const DEFAULT_CHUNK_SIZE = 64 * 1024;
|
|
4634
|
+
|
|
4635
|
+
const {isFunction} = utils$1;
|
|
4636
|
+
|
|
4637
|
+
const globalFetchAPI = (({Request, Response}) => ({
|
|
4638
|
+
Request, Response
|
|
4639
|
+
}))(utils$1.global);
|
|
4640
|
+
|
|
4641
|
+
const {
|
|
4642
|
+
ReadableStream: ReadableStream$1, TextEncoder
|
|
4643
|
+
} = utils$1.global;
|
|
4599
4644
|
|
|
4600
|
-
// used only inside the fetch adapter
|
|
4601
|
-
const encodeText = isFetchSupported && (typeof TextEncoder === 'function' ?
|
|
4602
|
-
((encoder) => (str) => encoder.encode(str))(new TextEncoder()) :
|
|
4603
|
-
async (str) => new Uint8Array(await new Response(str).arrayBuffer())
|
|
4604
|
-
);
|
|
4605
4645
|
|
|
4606
4646
|
const test = (fn, ...args) => {
|
|
4607
4647
|
try {
|
|
@@ -4611,278 +4651,380 @@
|
|
|
4611
4651
|
}
|
|
4612
4652
|
};
|
|
4613
4653
|
|
|
4614
|
-
const
|
|
4615
|
-
|
|
4654
|
+
const factory = (env) => {
|
|
4655
|
+
env = utils$1.merge.call({
|
|
4656
|
+
skipUndefined: true
|
|
4657
|
+
}, globalFetchAPI, env);
|
|
4616
4658
|
|
|
4617
|
-
const
|
|
4618
|
-
|
|
4619
|
-
|
|
4620
|
-
|
|
4621
|
-
duplexAccessed = true;
|
|
4622
|
-
return 'half';
|
|
4623
|
-
},
|
|
4624
|
-
}).headers.has('Content-Type');
|
|
4659
|
+
const {fetch: envFetch, Request, Response} = env;
|
|
4660
|
+
const isFetchSupported = envFetch ? isFunction(envFetch) : typeof fetch === 'function';
|
|
4661
|
+
const isRequestSupported = isFunction(Request);
|
|
4662
|
+
const isResponseSupported = isFunction(Response);
|
|
4625
4663
|
|
|
4626
|
-
|
|
4627
|
-
|
|
4664
|
+
if (!isFetchSupported) {
|
|
4665
|
+
return false;
|
|
4666
|
+
}
|
|
4628
4667
|
|
|
4629
|
-
|
|
4668
|
+
const isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream$1);
|
|
4630
4669
|
|
|
4631
|
-
|
|
4632
|
-
|
|
4670
|
+
const encodeText = isFetchSupported && (typeof TextEncoder === 'function' ?
|
|
4671
|
+
((encoder) => (str) => encoder.encode(str))(new TextEncoder()) :
|
|
4672
|
+
async (str) => new Uint8Array(await new Request(str).arrayBuffer())
|
|
4673
|
+
);
|
|
4633
4674
|
|
|
4675
|
+
const supportsRequestStream = isRequestSupported && isReadableStreamSupported && test(() => {
|
|
4676
|
+
let duplexAccessed = false;
|
|
4634
4677
|
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
|
|
4678
|
+
const hasContentType = new Request(platform.origin, {
|
|
4679
|
+
body: new ReadableStream$1(),
|
|
4680
|
+
method: 'POST',
|
|
4681
|
+
get duplex() {
|
|
4682
|
+
duplexAccessed = true;
|
|
4683
|
+
return 'half';
|
|
4684
|
+
},
|
|
4685
|
+
}).headers.has('Content-Type');
|
|
4638
4686
|
|
|
4639
|
-
|
|
4640
|
-
['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {
|
|
4641
|
-
!resolvers[type] && (resolvers[type] = utils$1.isFunction(res[type]) ? (res) => res[type]() :
|
|
4642
|
-
(_, config) => {
|
|
4643
|
-
throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config);
|
|
4644
|
-
});
|
|
4687
|
+
return duplexAccessed && !hasContentType;
|
|
4645
4688
|
});
|
|
4646
|
-
})(new Response));
|
|
4647
4689
|
|
|
4648
|
-
|
|
4649
|
-
|
|
4650
|
-
return 0;
|
|
4651
|
-
}
|
|
4690
|
+
const supportsResponseStream = isResponseSupported && isReadableStreamSupported &&
|
|
4691
|
+
test(() => utils$1.isReadableStream(new Response('').body));
|
|
4652
4692
|
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
}
|
|
4693
|
+
const resolvers = {
|
|
4694
|
+
stream: supportsResponseStream && ((res) => res.body)
|
|
4695
|
+
};
|
|
4656
4696
|
|
|
4657
|
-
|
|
4658
|
-
|
|
4659
|
-
|
|
4660
|
-
|
|
4697
|
+
isFetchSupported && ((() => {
|
|
4698
|
+
['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {
|
|
4699
|
+
!resolvers[type] && (resolvers[type] = (res, config) => {
|
|
4700
|
+
let method = res && res[type];
|
|
4701
|
+
|
|
4702
|
+
if (method) {
|
|
4703
|
+
return method.call(res);
|
|
4704
|
+
}
|
|
4705
|
+
|
|
4706
|
+
throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config);
|
|
4707
|
+
});
|
|
4661
4708
|
});
|
|
4662
|
-
|
|
4663
|
-
}
|
|
4709
|
+
})());
|
|
4664
4710
|
|
|
4665
|
-
|
|
4666
|
-
|
|
4667
|
-
|
|
4711
|
+
const getBodyLength = async (body) => {
|
|
4712
|
+
if (body == null) {
|
|
4713
|
+
return 0;
|
|
4714
|
+
}
|
|
4668
4715
|
|
|
4669
|
-
|
|
4670
|
-
|
|
4671
|
-
|
|
4716
|
+
if (utils$1.isBlob(body)) {
|
|
4717
|
+
return body.size;
|
|
4718
|
+
}
|
|
4672
4719
|
|
|
4673
|
-
|
|
4674
|
-
|
|
4675
|
-
|
|
4676
|
-
|
|
4720
|
+
if (utils$1.isSpecCompliantForm(body)) {
|
|
4721
|
+
const _request = new Request(platform.origin, {
|
|
4722
|
+
method: 'POST',
|
|
4723
|
+
body,
|
|
4724
|
+
});
|
|
4725
|
+
return (await _request.arrayBuffer()).byteLength;
|
|
4726
|
+
}
|
|
4677
4727
|
|
|
4678
|
-
|
|
4679
|
-
|
|
4728
|
+
if (utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
|
|
4729
|
+
return body.byteLength;
|
|
4730
|
+
}
|
|
4680
4731
|
|
|
4681
|
-
|
|
4682
|
-
|
|
4732
|
+
if (utils$1.isURLSearchParams(body)) {
|
|
4733
|
+
body = body + '';
|
|
4734
|
+
}
|
|
4735
|
+
|
|
4736
|
+
if (utils$1.isString(body)) {
|
|
4737
|
+
return (await encodeText(body)).byteLength;
|
|
4738
|
+
}
|
|
4739
|
+
};
|
|
4740
|
+
|
|
4741
|
+
const resolveBodyLength = async (headers, body) => {
|
|
4742
|
+
const length = utils$1.toFiniteNumber(headers.getContentLength());
|
|
4743
|
+
|
|
4744
|
+
return length == null ? getBodyLength(body) : length;
|
|
4745
|
+
};
|
|
4746
|
+
|
|
4747
|
+
return async (config) => {
|
|
4748
|
+
let {
|
|
4749
|
+
url,
|
|
4750
|
+
method,
|
|
4751
|
+
data,
|
|
4752
|
+
signal,
|
|
4753
|
+
cancelToken,
|
|
4754
|
+
timeout,
|
|
4755
|
+
onDownloadProgress,
|
|
4756
|
+
onUploadProgress,
|
|
4757
|
+
responseType,
|
|
4758
|
+
headers,
|
|
4759
|
+
withCredentials = 'same-origin',
|
|
4760
|
+
fetchOptions
|
|
4761
|
+
} = resolveConfig(config);
|
|
4762
|
+
|
|
4763
|
+
let _fetch = envFetch || fetch;
|
|
4683
4764
|
|
|
4684
|
-
|
|
4685
|
-
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
timeout,
|
|
4692
|
-
onDownloadProgress,
|
|
4693
|
-
onUploadProgress,
|
|
4694
|
-
responseType,
|
|
4695
|
-
headers,
|
|
4696
|
-
withCredentials = 'same-origin',
|
|
4697
|
-
fetchOptions
|
|
4698
|
-
} = resolveConfig(config);
|
|
4699
|
-
|
|
4700
|
-
responseType = responseType ? (responseType + '').toLowerCase() : 'text';
|
|
4701
|
-
|
|
4702
|
-
let composedSignal = composeSignals$1([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
|
|
4703
|
-
|
|
4704
|
-
let request;
|
|
4705
|
-
|
|
4706
|
-
const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
|
|
4765
|
+
responseType = responseType ? (responseType + '').toLowerCase() : 'text';
|
|
4766
|
+
|
|
4767
|
+
let composedSignal = composeSignals$1([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
|
|
4768
|
+
|
|
4769
|
+
let request = null;
|
|
4770
|
+
|
|
4771
|
+
const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
|
|
4707
4772
|
composedSignal.unsubscribe();
|
|
4708
|
-
|
|
4773
|
+
});
|
|
4709
4774
|
|
|
4710
|
-
|
|
4775
|
+
let requestContentLength;
|
|
4711
4776
|
|
|
4712
|
-
|
|
4713
|
-
|
|
4714
|
-
|
|
4715
|
-
|
|
4716
|
-
|
|
4717
|
-
|
|
4718
|
-
|
|
4719
|
-
|
|
4720
|
-
|
|
4721
|
-
|
|
4777
|
+
try {
|
|
4778
|
+
if (
|
|
4779
|
+
onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' &&
|
|
4780
|
+
(requestContentLength = await resolveBodyLength(headers, data)) !== 0
|
|
4781
|
+
) {
|
|
4782
|
+
let _request = new Request(url, {
|
|
4783
|
+
method: 'POST',
|
|
4784
|
+
body: data,
|
|
4785
|
+
duplex: "half"
|
|
4786
|
+
});
|
|
4722
4787
|
|
|
4723
|
-
|
|
4788
|
+
let contentTypeHeader;
|
|
4724
4789
|
|
|
4725
|
-
|
|
4726
|
-
|
|
4727
|
-
|
|
4790
|
+
if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
|
|
4791
|
+
headers.setContentType(contentTypeHeader);
|
|
4792
|
+
}
|
|
4728
4793
|
|
|
4729
|
-
|
|
4730
|
-
|
|
4731
|
-
|
|
4732
|
-
|
|
4733
|
-
|
|
4794
|
+
if (_request.body) {
|
|
4795
|
+
const [onProgress, flush] = progressEventDecorator(
|
|
4796
|
+
requestContentLength,
|
|
4797
|
+
progressEventReducer(asyncDecorator(onUploadProgress))
|
|
4798
|
+
);
|
|
4734
4799
|
|
|
4735
|
-
|
|
4800
|
+
data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
|
|
4801
|
+
}
|
|
4736
4802
|
}
|
|
4737
|
-
}
|
|
4738
4803
|
|
|
4739
|
-
|
|
4740
|
-
|
|
4741
|
-
|
|
4804
|
+
if (!utils$1.isString(withCredentials)) {
|
|
4805
|
+
withCredentials = withCredentials ? 'include' : 'omit';
|
|
4806
|
+
}
|
|
4742
4807
|
|
|
4743
|
-
|
|
4744
|
-
|
|
4745
|
-
|
|
4746
|
-
request = new Request(url, {
|
|
4747
|
-
...fetchOptions,
|
|
4748
|
-
signal: composedSignal,
|
|
4749
|
-
method: method.toUpperCase(),
|
|
4750
|
-
headers: headers.normalize().toJSON(),
|
|
4751
|
-
body: data,
|
|
4752
|
-
duplex: "half",
|
|
4753
|
-
credentials: isCredentialsSupported ? withCredentials : undefined
|
|
4754
|
-
});
|
|
4808
|
+
// Cloudflare Workers throws when credentials are defined
|
|
4809
|
+
// see https://github.com/cloudflare/workerd/issues/902
|
|
4810
|
+
const isCredentialsSupported = isRequestSupported && "credentials" in Request.prototype;
|
|
4755
4811
|
|
|
4756
|
-
|
|
4812
|
+
const resolvedOptions = {
|
|
4813
|
+
...fetchOptions,
|
|
4814
|
+
signal: composedSignal,
|
|
4815
|
+
method: method.toUpperCase(),
|
|
4816
|
+
headers: headers.normalize().toJSON(),
|
|
4817
|
+
body: data,
|
|
4818
|
+
duplex: "half",
|
|
4819
|
+
credentials: isCredentialsSupported ? withCredentials : undefined
|
|
4820
|
+
};
|
|
4757
4821
|
|
|
4758
|
-
|
|
4822
|
+
request = isRequestSupported && new Request(url, resolvedOptions);
|
|
4759
4823
|
|
|
4760
|
-
|
|
4761
|
-
const options = {};
|
|
4824
|
+
let response = await (isRequestSupported ? _fetch(request, fetchOptions) : _fetch(url, resolvedOptions));
|
|
4762
4825
|
|
|
4763
|
-
|
|
4764
|
-
options[prop] = response[prop];
|
|
4765
|
-
});
|
|
4826
|
+
const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
|
|
4766
4827
|
|
|
4767
|
-
|
|
4828
|
+
if (supportsResponseStream && (onDownloadProgress || (isStreamResponse && unsubscribe))) {
|
|
4829
|
+
const options = {};
|
|
4768
4830
|
|
|
4769
|
-
|
|
4770
|
-
|
|
4771
|
-
|
|
4772
|
-
) || [];
|
|
4831
|
+
['status', 'statusText', 'headers'].forEach(prop => {
|
|
4832
|
+
options[prop] = response[prop];
|
|
4833
|
+
});
|
|
4773
4834
|
|
|
4774
|
-
|
|
4775
|
-
trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
|
|
4776
|
-
flush && flush();
|
|
4777
|
-
unsubscribe && unsubscribe();
|
|
4778
|
-
}),
|
|
4779
|
-
options
|
|
4780
|
-
);
|
|
4781
|
-
}
|
|
4835
|
+
const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
|
|
4782
4836
|
|
|
4783
|
-
|
|
4837
|
+
const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
|
|
4838
|
+
responseContentLength,
|
|
4839
|
+
progressEventReducer(asyncDecorator(onDownloadProgress), true)
|
|
4840
|
+
) || [];
|
|
4784
4841
|
|
|
4785
|
-
|
|
4842
|
+
response = new Response(
|
|
4843
|
+
trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
|
|
4844
|
+
flush && flush();
|
|
4845
|
+
unsubscribe && unsubscribe();
|
|
4846
|
+
}),
|
|
4847
|
+
options
|
|
4848
|
+
);
|
|
4849
|
+
}
|
|
4786
4850
|
|
|
4787
|
-
|
|
4851
|
+
responseType = responseType || 'text';
|
|
4788
4852
|
|
|
4789
|
-
|
|
4790
|
-
|
|
4791
|
-
|
|
4792
|
-
|
|
4793
|
-
|
|
4794
|
-
|
|
4795
|
-
|
|
4796
|
-
|
|
4797
|
-
|
|
4798
|
-
|
|
4799
|
-
|
|
4800
|
-
|
|
4801
|
-
|
|
4802
|
-
|
|
4803
|
-
|
|
4804
|
-
|
|
4805
|
-
|
|
4806
|
-
|
|
4807
|
-
|
|
4808
|
-
|
|
4853
|
+
let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
|
|
4854
|
+
|
|
4855
|
+
!isStreamResponse && unsubscribe && unsubscribe();
|
|
4856
|
+
|
|
4857
|
+
return await new Promise((resolve, reject) => {
|
|
4858
|
+
settle(resolve, reject, {
|
|
4859
|
+
data: responseData,
|
|
4860
|
+
headers: AxiosHeaders$1.from(response.headers),
|
|
4861
|
+
status: response.status,
|
|
4862
|
+
statusText: response.statusText,
|
|
4863
|
+
config,
|
|
4864
|
+
request
|
|
4865
|
+
});
|
|
4866
|
+
})
|
|
4867
|
+
} catch (err) {
|
|
4868
|
+
unsubscribe && unsubscribe();
|
|
4869
|
+
|
|
4870
|
+
if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
|
|
4871
|
+
throw Object.assign(
|
|
4872
|
+
new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request),
|
|
4873
|
+
{
|
|
4874
|
+
cause: err.cause || err
|
|
4875
|
+
}
|
|
4876
|
+
)
|
|
4877
|
+
}
|
|
4878
|
+
|
|
4879
|
+
throw AxiosError.from(err, err && err.code, config, request);
|
|
4809
4880
|
}
|
|
4881
|
+
}
|
|
4882
|
+
};
|
|
4883
|
+
|
|
4884
|
+
const seedCache = new Map();
|
|
4885
|
+
|
|
4886
|
+
const getFetch = (config) => {
|
|
4887
|
+
let env = (config && config.env) || {};
|
|
4888
|
+
const {fetch, Request, Response} = env;
|
|
4889
|
+
const seeds = [
|
|
4890
|
+
Request, Response, fetch
|
|
4891
|
+
];
|
|
4892
|
+
|
|
4893
|
+
let len = seeds.length, i = len,
|
|
4894
|
+
seed, target, map = seedCache;
|
|
4895
|
+
|
|
4896
|
+
while (i--) {
|
|
4897
|
+
seed = seeds[i];
|
|
4898
|
+
target = map.get(seed);
|
|
4899
|
+
|
|
4900
|
+
target === undefined && map.set(seed, target = (i ? new Map() : factory(env)));
|
|
4810
4901
|
|
|
4811
|
-
|
|
4902
|
+
map = target;
|
|
4812
4903
|
}
|
|
4813
|
-
});
|
|
4814
4904
|
|
|
4905
|
+
return target;
|
|
4906
|
+
};
|
|
4907
|
+
|
|
4908
|
+
getFetch();
|
|
4909
|
+
|
|
4910
|
+
/**
|
|
4911
|
+
* Known adapters mapping.
|
|
4912
|
+
* Provides environment-specific adapters for Axios:
|
|
4913
|
+
* - `http` for Node.js
|
|
4914
|
+
* - `xhr` for browsers
|
|
4915
|
+
* - `fetch` for fetch API-based requests
|
|
4916
|
+
*
|
|
4917
|
+
* @type {Object<string, Function|Object>}
|
|
4918
|
+
*/
|
|
4815
4919
|
const knownAdapters = {
|
|
4816
4920
|
http: httpAdapter,
|
|
4817
4921
|
xhr: xhrAdapter,
|
|
4818
|
-
fetch:
|
|
4922
|
+
fetch: {
|
|
4923
|
+
get: getFetch,
|
|
4924
|
+
}
|
|
4819
4925
|
};
|
|
4820
4926
|
|
|
4927
|
+
// Assign adapter names for easier debugging and identification
|
|
4821
4928
|
utils$1.forEach(knownAdapters, (fn, value) => {
|
|
4822
4929
|
if (fn) {
|
|
4823
4930
|
try {
|
|
4824
|
-
Object.defineProperty(fn, 'name', {value});
|
|
4931
|
+
Object.defineProperty(fn, 'name', { value });
|
|
4825
4932
|
} catch (e) {
|
|
4826
4933
|
// eslint-disable-next-line no-empty
|
|
4827
4934
|
}
|
|
4828
|
-
Object.defineProperty(fn, 'adapterName', {value});
|
|
4935
|
+
Object.defineProperty(fn, 'adapterName', { value });
|
|
4829
4936
|
}
|
|
4830
4937
|
});
|
|
4831
4938
|
|
|
4939
|
+
/**
|
|
4940
|
+
* Render a rejection reason string for unknown or unsupported adapters
|
|
4941
|
+
*
|
|
4942
|
+
* @param {string} reason
|
|
4943
|
+
* @returns {string}
|
|
4944
|
+
*/
|
|
4832
4945
|
const renderReason = (reason) => `- ${reason}`;
|
|
4833
4946
|
|
|
4947
|
+
/**
|
|
4948
|
+
* Check if the adapter is resolved (function, null, or false)
|
|
4949
|
+
*
|
|
4950
|
+
* @param {Function|null|false} adapter
|
|
4951
|
+
* @returns {boolean}
|
|
4952
|
+
*/
|
|
4834
4953
|
const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
|
|
4835
4954
|
|
|
4836
|
-
|
|
4837
|
-
|
|
4838
|
-
|
|
4839
|
-
|
|
4840
|
-
|
|
4841
|
-
|
|
4842
|
-
|
|
4955
|
+
/**
|
|
4956
|
+
* Get the first suitable adapter from the provided list.
|
|
4957
|
+
* Tries each adapter in order until a supported one is found.
|
|
4958
|
+
* Throws an AxiosError if no adapter is suitable.
|
|
4959
|
+
*
|
|
4960
|
+
* @param {Array<string|Function>|string|Function} adapters - Adapter(s) by name or function.
|
|
4961
|
+
* @param {Object} config - Axios request configuration
|
|
4962
|
+
* @throws {AxiosError} If no suitable adapter is available
|
|
4963
|
+
* @returns {Function} The resolved adapter function
|
|
4964
|
+
*/
|
|
4965
|
+
function getAdapter(adapters, config) {
|
|
4966
|
+
adapters = utils$1.isArray(adapters) ? adapters : [adapters];
|
|
4843
4967
|
|
|
4844
|
-
|
|
4968
|
+
const { length } = adapters;
|
|
4969
|
+
let nameOrAdapter;
|
|
4970
|
+
let adapter;
|
|
4845
4971
|
|
|
4846
|
-
|
|
4847
|
-
nameOrAdapter = adapters[i];
|
|
4848
|
-
let id;
|
|
4972
|
+
const rejectedReasons = {};
|
|
4849
4973
|
|
|
4850
|
-
|
|
4974
|
+
for (let i = 0; i < length; i++) {
|
|
4975
|
+
nameOrAdapter = adapters[i];
|
|
4976
|
+
let id;
|
|
4851
4977
|
|
|
4852
|
-
|
|
4853
|
-
adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
|
|
4978
|
+
adapter = nameOrAdapter;
|
|
4854
4979
|
|
|
4855
|
-
|
|
4856
|
-
|
|
4857
|
-
}
|
|
4858
|
-
}
|
|
4980
|
+
if (!isResolvedHandle(nameOrAdapter)) {
|
|
4981
|
+
adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
|
|
4859
4982
|
|
|
4860
|
-
if (adapter) {
|
|
4861
|
-
|
|
4983
|
+
if (adapter === undefined) {
|
|
4984
|
+
throw new AxiosError(`Unknown adapter '${id}'`);
|
|
4862
4985
|
}
|
|
4986
|
+
}
|
|
4863
4987
|
|
|
4864
|
-
|
|
4988
|
+
if (adapter && (utils$1.isFunction(adapter) || (adapter = adapter.get(config)))) {
|
|
4989
|
+
break;
|
|
4865
4990
|
}
|
|
4866
4991
|
|
|
4867
|
-
|
|
4992
|
+
rejectedReasons[id || '#' + i] = adapter;
|
|
4993
|
+
}
|
|
4868
4994
|
|
|
4869
|
-
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
)
|
|
4995
|
+
if (!adapter) {
|
|
4996
|
+
const reasons = Object.entries(rejectedReasons)
|
|
4997
|
+
.map(([id, state]) => `adapter ${id} ` +
|
|
4998
|
+
(state === false ? 'is not supported by the environment' : 'is not available in the build')
|
|
4999
|
+
);
|
|
4873
5000
|
|
|
4874
|
-
|
|
4875
|
-
|
|
4876
|
-
|
|
5001
|
+
let s = length ?
|
|
5002
|
+
(reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) :
|
|
5003
|
+
'as no adapter specified';
|
|
4877
5004
|
|
|
4878
|
-
|
|
4879
|
-
|
|
4880
|
-
|
|
4881
|
-
|
|
4882
|
-
|
|
5005
|
+
throw new AxiosError(
|
|
5006
|
+
`There is no suitable adapter to dispatch the request ` + s,
|
|
5007
|
+
'ERR_NOT_SUPPORT'
|
|
5008
|
+
);
|
|
5009
|
+
}
|
|
4883
5010
|
|
|
4884
|
-
|
|
4885
|
-
|
|
5011
|
+
return adapter;
|
|
5012
|
+
}
|
|
5013
|
+
|
|
5014
|
+
/**
|
|
5015
|
+
* Exports Axios adapters and utility to resolve an adapter
|
|
5016
|
+
*/
|
|
5017
|
+
var adapters = {
|
|
5018
|
+
/**
|
|
5019
|
+
* Resolve an adapter from a list of adapter names or functions.
|
|
5020
|
+
* @type {Function}
|
|
5021
|
+
*/
|
|
5022
|
+
getAdapter,
|
|
5023
|
+
|
|
5024
|
+
/**
|
|
5025
|
+
* Exposes all known adapters
|
|
5026
|
+
* @type {Object<string, Function|Object>}
|
|
5027
|
+
*/
|
|
4886
5028
|
adapters: knownAdapters
|
|
4887
5029
|
};
|
|
4888
5030
|
|
|
@@ -4925,7 +5067,7 @@
|
|
|
4925
5067
|
config.headers.setContentType('application/x-www-form-urlencoded', false);
|
|
4926
5068
|
}
|
|
4927
5069
|
|
|
4928
|
-
const adapter = adapters.getAdapter(config.adapter || defaults$1.adapter);
|
|
5070
|
+
const adapter = adapters.getAdapter(config.adapter || defaults$1.adapter, config);
|
|
4929
5071
|
|
|
4930
5072
|
return adapter(config).then(function onAdapterResolution(response) {
|
|
4931
5073
|
throwIfCancellationRequested(config);
|
|
@@ -4959,7 +5101,7 @@
|
|
|
4959
5101
|
});
|
|
4960
5102
|
}
|
|
4961
5103
|
|
|
4962
|
-
const VERSION = "1.
|
|
5104
|
+
const VERSION = "1.13.2";
|
|
4963
5105
|
|
|
4964
5106
|
const validators$1 = {};
|
|
4965
5107
|
|
|
@@ -5215,8 +5357,6 @@
|
|
|
5215
5357
|
|
|
5216
5358
|
let newConfig = config;
|
|
5217
5359
|
|
|
5218
|
-
i = 0;
|
|
5219
|
-
|
|
5220
5360
|
while (i < len) {
|
|
5221
5361
|
const onFulfilled = requestInterceptorChain[i++];
|
|
5222
5362
|
const onRejected = requestInterceptorChain[i++];
|
|
@@ -5520,6 +5660,12 @@
|
|
|
5520
5660
|
LoopDetected: 508,
|
|
5521
5661
|
NotExtended: 510,
|
|
5522
5662
|
NetworkAuthenticationRequired: 511,
|
|
5663
|
+
WebServerIsDown: 521,
|
|
5664
|
+
ConnectionTimedOut: 522,
|
|
5665
|
+
OriginIsUnreachable: 523,
|
|
5666
|
+
TimeoutOccurred: 524,
|
|
5667
|
+
SslHandshakeFailed: 525,
|
|
5668
|
+
InvalidSslCertificate: 526,
|
|
5523
5669
|
};
|
|
5524
5670
|
|
|
5525
5671
|
Object.entries(HttpStatusCode).forEach(([key, value]) => {
|