@pelcro/react-pelcro-js 4.0.0-alpha.110 → 4.0.0-alpha.111
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +524 -1430
- package/dist/index.esm.js +523 -1430
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -3,7 +3,7 @@ import React__default, { useContext, useState, useRef, useEffect, useReducer, us
|
|
|
3
3
|
import ReactDOM, { render as render$1, createPortal } from 'react-dom';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import util$1 from 'util';
|
|
6
|
-
import stream
|
|
6
|
+
import stream from 'stream';
|
|
7
7
|
import path from 'path';
|
|
8
8
|
import http from 'http';
|
|
9
9
|
import https from 'https';
|
|
@@ -13,7 +13,7 @@ import assert from 'assert';
|
|
|
13
13
|
import tty from 'tty';
|
|
14
14
|
import os from 'os';
|
|
15
15
|
import zlib from 'zlib';
|
|
16
|
-
import
|
|
16
|
+
import EventEmitter$1 from 'events';
|
|
17
17
|
|
|
18
18
|
function _typeof$4(o) {
|
|
19
19
|
"@babel/helpers - typeof";
|
|
@@ -29006,16 +29006,12 @@ const isStream = (val) => isObject(val) && isFunction$1(val.pipe);
|
|
|
29006
29006
|
* @returns {boolean} True if value is an FormData, otherwise false
|
|
29007
29007
|
*/
|
|
29008
29008
|
const isFormData = (thing) => {
|
|
29009
|
-
|
|
29009
|
+
const pattern = '[object FormData]';
|
|
29010
29010
|
return thing && (
|
|
29011
|
-
(typeof FormData === 'function' && thing instanceof FormData) ||
|
|
29012
|
-
|
|
29013
|
-
|
|
29014
|
-
|
|
29015
|
-
(kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]')
|
|
29016
|
-
)
|
|
29017
|
-
)
|
|
29018
|
-
)
|
|
29011
|
+
(typeof FormData === 'function' && thing instanceof FormData) ||
|
|
29012
|
+
toString.call(thing) === pattern ||
|
|
29013
|
+
(isFunction$1(thing.toString) && thing.toString() === pattern)
|
|
29014
|
+
);
|
|
29019
29015
|
};
|
|
29020
29016
|
|
|
29021
29017
|
/**
|
|
@@ -29027,8 +29023,6 @@ const isFormData = (thing) => {
|
|
|
29027
29023
|
*/
|
|
29028
29024
|
const isURLSearchParams = kindOfTest('URLSearchParams');
|
|
29029
29025
|
|
|
29030
|
-
const [isReadableStream, isRequest, isResponse, isHeaders] = ['ReadableStream', 'Request', 'Response', 'Headers'].map(kindOfTest);
|
|
29031
|
-
|
|
29032
29026
|
/**
|
|
29033
29027
|
* Trim excess whitespace off the beginning and end of a string
|
|
29034
29028
|
*
|
|
@@ -29336,7 +29330,7 @@ const matchAll = (regExp, str) => {
|
|
|
29336
29330
|
const isHTMLForm = kindOfTest('HTMLFormElement');
|
|
29337
29331
|
|
|
29338
29332
|
const toCamelCase = str => {
|
|
29339
|
-
return str.toLowerCase().replace(/[
|
|
29333
|
+
return str.toLowerCase().replace(/[_-\s]([a-z\d])(\w*)/g,
|
|
29340
29334
|
function replacer(m, p1, p2) {
|
|
29341
29335
|
return p1.toUpperCase() + p2;
|
|
29342
29336
|
}
|
|
@@ -29360,9 +29354,8 @@ const reduceDescriptors = (obj, reducer) => {
|
|
|
29360
29354
|
const reducedDescriptors = {};
|
|
29361
29355
|
|
|
29362
29356
|
forEach(descriptors, (descriptor, name) => {
|
|
29363
|
-
|
|
29364
|
-
|
|
29365
|
-
reducedDescriptors[name] = ret || descriptor;
|
|
29357
|
+
if (reducer(descriptor, name, obj) !== false) {
|
|
29358
|
+
reducedDescriptors[name] = descriptor;
|
|
29366
29359
|
}
|
|
29367
29360
|
});
|
|
29368
29361
|
|
|
@@ -29417,40 +29410,10 @@ const toObjectSet = (arrayOrString, delimiter) => {
|
|
|
29417
29410
|
const noop$2 = () => {};
|
|
29418
29411
|
|
|
29419
29412
|
const toFiniteNumber = (value, defaultValue) => {
|
|
29420
|
-
|
|
29421
|
-
|
|
29422
|
-
|
|
29423
|
-
const ALPHA = 'abcdefghijklmnopqrstuvwxyz';
|
|
29424
|
-
|
|
29425
|
-
const DIGIT = '0123456789';
|
|
29426
|
-
|
|
29427
|
-
const ALPHABET = {
|
|
29428
|
-
DIGIT,
|
|
29429
|
-
ALPHA,
|
|
29430
|
-
ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT
|
|
29431
|
-
};
|
|
29432
|
-
|
|
29433
|
-
const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
|
|
29434
|
-
let str = '';
|
|
29435
|
-
const {length} = alphabet;
|
|
29436
|
-
while (size--) {
|
|
29437
|
-
str += alphabet[Math.random() * length|0];
|
|
29438
|
-
}
|
|
29439
|
-
|
|
29440
|
-
return str;
|
|
29413
|
+
value = +value;
|
|
29414
|
+
return Number.isFinite(value) ? value : defaultValue;
|
|
29441
29415
|
};
|
|
29442
29416
|
|
|
29443
|
-
/**
|
|
29444
|
-
* If the thing is a FormData object, return true, otherwise return false.
|
|
29445
|
-
*
|
|
29446
|
-
* @param {unknown} thing - The thing to check.
|
|
29447
|
-
*
|
|
29448
|
-
* @returns {boolean}
|
|
29449
|
-
*/
|
|
29450
|
-
function isSpecCompliantForm(thing) {
|
|
29451
|
-
return !!(thing && isFunction$1(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator]);
|
|
29452
|
-
}
|
|
29453
|
-
|
|
29454
29417
|
const toJSONObject = (obj) => {
|
|
29455
29418
|
const stack = new Array(10);
|
|
29456
29419
|
|
|
@@ -29482,42 +29445,7 @@ const toJSONObject = (obj) => {
|
|
|
29482
29445
|
return visit(obj, 0);
|
|
29483
29446
|
};
|
|
29484
29447
|
|
|
29485
|
-
|
|
29486
|
-
|
|
29487
|
-
const isThenable = (thing) =>
|
|
29488
|
-
thing && (isObject(thing) || isFunction$1(thing)) && isFunction$1(thing.then) && isFunction$1(thing.catch);
|
|
29489
|
-
|
|
29490
|
-
// original code
|
|
29491
|
-
// https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
|
|
29492
|
-
|
|
29493
|
-
const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
|
|
29494
|
-
if (setImmediateSupported) {
|
|
29495
|
-
return setImmediate;
|
|
29496
|
-
}
|
|
29497
|
-
|
|
29498
|
-
return postMessageSupported ? ((token, callbacks) => {
|
|
29499
|
-
_global.addEventListener("message", ({source, data}) => {
|
|
29500
|
-
if (source === _global && data === token) {
|
|
29501
|
-
callbacks.length && callbacks.shift()();
|
|
29502
|
-
}
|
|
29503
|
-
}, false);
|
|
29504
|
-
|
|
29505
|
-
return (cb) => {
|
|
29506
|
-
callbacks.push(cb);
|
|
29507
|
-
_global.postMessage(token, "*");
|
|
29508
|
-
}
|
|
29509
|
-
})(`axios@${Math.random()}`, []) : (cb) => setTimeout(cb);
|
|
29510
|
-
})(
|
|
29511
|
-
typeof setImmediate === 'function',
|
|
29512
|
-
isFunction$1(_global.postMessage)
|
|
29513
|
-
);
|
|
29514
|
-
|
|
29515
|
-
const asap = typeof queueMicrotask !== 'undefined' ?
|
|
29516
|
-
queueMicrotask.bind(_global) : ( typeof process !== 'undefined' && process.nextTick || _setImmediate);
|
|
29517
|
-
|
|
29518
|
-
// *********************
|
|
29519
|
-
|
|
29520
|
-
var utils$1 = {
|
|
29448
|
+
var utils = {
|
|
29521
29449
|
isArray,
|
|
29522
29450
|
isArrayBuffer,
|
|
29523
29451
|
isBuffer: isBuffer$1,
|
|
@@ -29528,10 +29456,6 @@ var utils$1 = {
|
|
|
29528
29456
|
isBoolean,
|
|
29529
29457
|
isObject,
|
|
29530
29458
|
isPlainObject,
|
|
29531
|
-
isReadableStream,
|
|
29532
|
-
isRequest,
|
|
29533
|
-
isResponse,
|
|
29534
|
-
isHeaders,
|
|
29535
29459
|
isUndefined,
|
|
29536
29460
|
isDate,
|
|
29537
29461
|
isFile,
|
|
@@ -29567,14 +29491,7 @@ var utils$1 = {
|
|
|
29567
29491
|
findKey,
|
|
29568
29492
|
global: _global,
|
|
29569
29493
|
isContextDefined,
|
|
29570
|
-
|
|
29571
|
-
generateString,
|
|
29572
|
-
isSpecCompliantForm,
|
|
29573
|
-
toJSONObject,
|
|
29574
|
-
isAsyncFn,
|
|
29575
|
-
isThenable,
|
|
29576
|
-
setImmediate: _setImmediate,
|
|
29577
|
-
asap
|
|
29494
|
+
toJSONObject
|
|
29578
29495
|
};
|
|
29579
29496
|
|
|
29580
29497
|
/**
|
|
@@ -29602,13 +29519,10 @@ function AxiosError(message, code, config, request, response) {
|
|
|
29602
29519
|
code && (this.code = code);
|
|
29603
29520
|
config && (this.config = config);
|
|
29604
29521
|
request && (this.request = request);
|
|
29605
|
-
|
|
29606
|
-
this.response = response;
|
|
29607
|
-
this.status = response.status ? response.status : null;
|
|
29608
|
-
}
|
|
29522
|
+
response && (this.response = response);
|
|
29609
29523
|
}
|
|
29610
29524
|
|
|
29611
|
-
utils
|
|
29525
|
+
utils.inherits(AxiosError, Error, {
|
|
29612
29526
|
toJSON: function toJSON() {
|
|
29613
29527
|
return {
|
|
29614
29528
|
// Standard
|
|
@@ -29623,9 +29537,9 @@ utils$1.inherits(AxiosError, Error, {
|
|
|
29623
29537
|
columnNumber: this.columnNumber,
|
|
29624
29538
|
stack: this.stack,
|
|
29625
29539
|
// Axios
|
|
29626
|
-
config: utils
|
|
29540
|
+
config: utils.toJSONObject(this.config),
|
|
29627
29541
|
code: this.code,
|
|
29628
|
-
status: this.status
|
|
29542
|
+
status: this.response && this.response.status ? this.response.status : null
|
|
29629
29543
|
};
|
|
29630
29544
|
}
|
|
29631
29545
|
});
|
|
@@ -29658,7 +29572,7 @@ Object.defineProperty(prototype$1, 'isAxiosError', {value: true});
|
|
|
29658
29572
|
AxiosError.from = (error, code, config, request, response, customProps) => {
|
|
29659
29573
|
const axiosError = Object.create(prototype$1);
|
|
29660
29574
|
|
|
29661
|
-
utils
|
|
29575
|
+
utils.toFlatObject(error, axiosError, function filter(obj) {
|
|
29662
29576
|
return obj !== Error.prototype;
|
|
29663
29577
|
}, prop => {
|
|
29664
29578
|
return prop !== 'isAxiosError';
|
|
@@ -41606,7 +41520,7 @@ FormData$1.prototype.toString = function () {
|
|
|
41606
41520
|
* @returns {boolean}
|
|
41607
41521
|
*/
|
|
41608
41522
|
function isVisitable(thing) {
|
|
41609
|
-
return utils
|
|
41523
|
+
return utils.isPlainObject(thing) || utils.isArray(thing);
|
|
41610
41524
|
}
|
|
41611
41525
|
|
|
41612
41526
|
/**
|
|
@@ -41617,7 +41531,7 @@ function isVisitable(thing) {
|
|
|
41617
41531
|
* @returns {string} the key without the brackets.
|
|
41618
41532
|
*/
|
|
41619
41533
|
function removeBrackets(key) {
|
|
41620
|
-
return utils
|
|
41534
|
+
return utils.endsWith(key, '[]') ? key.slice(0, -2) : key;
|
|
41621
41535
|
}
|
|
41622
41536
|
|
|
41623
41537
|
/**
|
|
@@ -41646,13 +41560,24 @@ function renderKey(path, key, dots) {
|
|
|
41646
41560
|
* @returns {boolean}
|
|
41647
41561
|
*/
|
|
41648
41562
|
function isFlatArray(arr) {
|
|
41649
|
-
return utils
|
|
41563
|
+
return utils.isArray(arr) && !arr.some(isVisitable);
|
|
41650
41564
|
}
|
|
41651
41565
|
|
|
41652
|
-
const predicates = utils
|
|
41566
|
+
const predicates = utils.toFlatObject(utils, {}, null, function filter(prop) {
|
|
41653
41567
|
return /^is[A-Z]/.test(prop);
|
|
41654
41568
|
});
|
|
41655
41569
|
|
|
41570
|
+
/**
|
|
41571
|
+
* If the thing is a FormData object, return true, otherwise return false.
|
|
41572
|
+
*
|
|
41573
|
+
* @param {unknown} thing - The thing to check.
|
|
41574
|
+
*
|
|
41575
|
+
* @returns {boolean}
|
|
41576
|
+
*/
|
|
41577
|
+
function isSpecCompliant(thing) {
|
|
41578
|
+
return thing && utils.isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator];
|
|
41579
|
+
}
|
|
41580
|
+
|
|
41656
41581
|
/**
|
|
41657
41582
|
* Convert a data object to FormData
|
|
41658
41583
|
*
|
|
@@ -41677,7 +41602,7 @@ const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop)
|
|
|
41677
41602
|
* @returns
|
|
41678
41603
|
*/
|
|
41679
41604
|
function toFormData(obj, formData, options) {
|
|
41680
|
-
if (!utils
|
|
41605
|
+
if (!utils.isObject(obj)) {
|
|
41681
41606
|
throw new TypeError('target must be an object');
|
|
41682
41607
|
}
|
|
41683
41608
|
|
|
@@ -41685,13 +41610,13 @@ function toFormData(obj, formData, options) {
|
|
|
41685
41610
|
formData = formData || new (form_data || FormData)();
|
|
41686
41611
|
|
|
41687
41612
|
// eslint-disable-next-line no-param-reassign
|
|
41688
|
-
options = utils
|
|
41613
|
+
options = utils.toFlatObject(options, {
|
|
41689
41614
|
metaTokens: true,
|
|
41690
41615
|
dots: false,
|
|
41691
41616
|
indexes: false
|
|
41692
41617
|
}, false, function defined(option, source) {
|
|
41693
41618
|
// eslint-disable-next-line no-eq-null,eqeqeq
|
|
41694
|
-
return !utils
|
|
41619
|
+
return !utils.isUndefined(source[option]);
|
|
41695
41620
|
});
|
|
41696
41621
|
|
|
41697
41622
|
const metaTokens = options.metaTokens;
|
|
@@ -41700,24 +41625,24 @@ function toFormData(obj, formData, options) {
|
|
|
41700
41625
|
const dots = options.dots;
|
|
41701
41626
|
const indexes = options.indexes;
|
|
41702
41627
|
const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
|
|
41703
|
-
const useBlob = _Blob &&
|
|
41628
|
+
const useBlob = _Blob && isSpecCompliant(formData);
|
|
41704
41629
|
|
|
41705
|
-
if (!utils
|
|
41630
|
+
if (!utils.isFunction(visitor)) {
|
|
41706
41631
|
throw new TypeError('visitor must be a function');
|
|
41707
41632
|
}
|
|
41708
41633
|
|
|
41709
41634
|
function convertValue(value) {
|
|
41710
41635
|
if (value === null) return '';
|
|
41711
41636
|
|
|
41712
|
-
if (utils
|
|
41637
|
+
if (utils.isDate(value)) {
|
|
41713
41638
|
return value.toISOString();
|
|
41714
41639
|
}
|
|
41715
41640
|
|
|
41716
|
-
if (!useBlob && utils
|
|
41641
|
+
if (!useBlob && utils.isBlob(value)) {
|
|
41717
41642
|
throw new AxiosError('Blob is not supported. Use a Buffer instead.');
|
|
41718
41643
|
}
|
|
41719
41644
|
|
|
41720
|
-
if (utils
|
|
41645
|
+
if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) {
|
|
41721
41646
|
return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
|
|
41722
41647
|
}
|
|
41723
41648
|
|
|
@@ -41738,20 +41663,20 @@ function toFormData(obj, formData, options) {
|
|
|
41738
41663
|
let arr = value;
|
|
41739
41664
|
|
|
41740
41665
|
if (value && !path && typeof value === 'object') {
|
|
41741
|
-
if (utils
|
|
41666
|
+
if (utils.endsWith(key, '{}')) {
|
|
41742
41667
|
// eslint-disable-next-line no-param-reassign
|
|
41743
41668
|
key = metaTokens ? key : key.slice(0, -2);
|
|
41744
41669
|
// eslint-disable-next-line no-param-reassign
|
|
41745
41670
|
value = JSON.stringify(value);
|
|
41746
41671
|
} else if (
|
|
41747
|
-
(utils
|
|
41748
|
-
(
|
|
41672
|
+
(utils.isArray(value) && isFlatArray(value)) ||
|
|
41673
|
+
(utils.isFileList(value) || utils.endsWith(key, '[]') && (arr = utils.toArray(value))
|
|
41749
41674
|
)) {
|
|
41750
41675
|
// eslint-disable-next-line no-param-reassign
|
|
41751
41676
|
key = removeBrackets(key);
|
|
41752
41677
|
|
|
41753
41678
|
arr.forEach(function each(el, index) {
|
|
41754
|
-
!(utils
|
|
41679
|
+
!(utils.isUndefined(el) || el === null) && formData.append(
|
|
41755
41680
|
// eslint-disable-next-line no-nested-ternary
|
|
41756
41681
|
indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'),
|
|
41757
41682
|
convertValue(el)
|
|
@@ -41779,7 +41704,7 @@ function toFormData(obj, formData, options) {
|
|
|
41779
41704
|
});
|
|
41780
41705
|
|
|
41781
41706
|
function build(value, path) {
|
|
41782
|
-
if (utils
|
|
41707
|
+
if (utils.isUndefined(value)) return;
|
|
41783
41708
|
|
|
41784
41709
|
if (stack.indexOf(value) !== -1) {
|
|
41785
41710
|
throw Error('Circular reference detected in ' + path.join('.'));
|
|
@@ -41787,9 +41712,9 @@ function toFormData(obj, formData, options) {
|
|
|
41787
41712
|
|
|
41788
41713
|
stack.push(value);
|
|
41789
41714
|
|
|
41790
|
-
utils
|
|
41791
|
-
const result = !(utils
|
|
41792
|
-
formData, el, utils
|
|
41715
|
+
utils.forEach(value, function each(el, key) {
|
|
41716
|
+
const result = !(utils.isUndefined(el) || el === null) && visitor.call(
|
|
41717
|
+
formData, el, utils.isString(key) ? key.trim() : key, path, exposedHelpers
|
|
41793
41718
|
);
|
|
41794
41719
|
|
|
41795
41720
|
if (result === true) {
|
|
@@ -41800,7 +41725,7 @@ function toFormData(obj, formData, options) {
|
|
|
41800
41725
|
stack.pop();
|
|
41801
41726
|
}
|
|
41802
41727
|
|
|
41803
|
-
if (!utils
|
|
41728
|
+
if (!utils.isObject(obj)) {
|
|
41804
41729
|
throw new TypeError('data must be an object');
|
|
41805
41730
|
}
|
|
41806
41731
|
|
|
@@ -41885,7 +41810,7 @@ function encode(val) {
|
|
|
41885
41810
|
*
|
|
41886
41811
|
* @param {string} url The base of the url (e.g., http://www.google.com)
|
|
41887
41812
|
* @param {object} [params] The params to be appended
|
|
41888
|
-
* @param {?
|
|
41813
|
+
* @param {?object} options
|
|
41889
41814
|
*
|
|
41890
41815
|
* @returns {string} The formatted url
|
|
41891
41816
|
*/
|
|
@@ -41897,12 +41822,6 @@ function buildURL(url, params, options) {
|
|
|
41897
41822
|
|
|
41898
41823
|
const _encode = options && options.encode || encode;
|
|
41899
41824
|
|
|
41900
|
-
if (utils$1.isFunction(options)) {
|
|
41901
|
-
options = {
|
|
41902
|
-
serialize: options
|
|
41903
|
-
};
|
|
41904
|
-
}
|
|
41905
|
-
|
|
41906
41825
|
const serializeFn = options && options.serialize;
|
|
41907
41826
|
|
|
41908
41827
|
let serializedParams;
|
|
@@ -41910,7 +41829,7 @@ function buildURL(url, params, options) {
|
|
|
41910
41829
|
if (serializeFn) {
|
|
41911
41830
|
serializedParams = serializeFn(params, options);
|
|
41912
41831
|
} else {
|
|
41913
|
-
serializedParams = utils
|
|
41832
|
+
serializedParams = utils.isURLSearchParams(params) ?
|
|
41914
41833
|
params.toString() :
|
|
41915
41834
|
new AxiosURLSearchParams(params, options).toString(_encode);
|
|
41916
41835
|
}
|
|
@@ -41985,7 +41904,7 @@ class InterceptorManager {
|
|
|
41985
41904
|
* @returns {void}
|
|
41986
41905
|
*/
|
|
41987
41906
|
forEach(fn) {
|
|
41988
|
-
utils
|
|
41907
|
+
utils.forEach(this.handlers, function forEachHandler(h) {
|
|
41989
41908
|
if (h !== null) {
|
|
41990
41909
|
fn(h);
|
|
41991
41910
|
}
|
|
@@ -42001,7 +41920,7 @@ var transitionalDefaults = {
|
|
|
42001
41920
|
|
|
42002
41921
|
var URLSearchParams = url.URLSearchParams;
|
|
42003
41922
|
|
|
42004
|
-
var platform
|
|
41923
|
+
var platform = {
|
|
42005
41924
|
isNode: true,
|
|
42006
41925
|
classes: {
|
|
42007
41926
|
URLSearchParams,
|
|
@@ -42011,68 +41930,10 @@ var platform$1 = {
|
|
|
42011
41930
|
protocols: [ 'http', 'https', 'file', 'data' ]
|
|
42012
41931
|
};
|
|
42013
41932
|
|
|
42014
|
-
const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
|
|
42015
|
-
|
|
42016
|
-
const _navigator = typeof navigator === 'object' && navigator || undefined;
|
|
42017
|
-
|
|
42018
|
-
/**
|
|
42019
|
-
* Determine if we're running in a standard browser environment
|
|
42020
|
-
*
|
|
42021
|
-
* This allows axios to run in a web worker, and react-native.
|
|
42022
|
-
* Both environments support XMLHttpRequest, but not fully standard globals.
|
|
42023
|
-
*
|
|
42024
|
-
* web workers:
|
|
42025
|
-
* typeof window -> undefined
|
|
42026
|
-
* typeof document -> undefined
|
|
42027
|
-
*
|
|
42028
|
-
* react-native:
|
|
42029
|
-
* navigator.product -> 'ReactNative'
|
|
42030
|
-
* nativescript
|
|
42031
|
-
* navigator.product -> 'NativeScript' or 'NS'
|
|
42032
|
-
*
|
|
42033
|
-
* @returns {boolean}
|
|
42034
|
-
*/
|
|
42035
|
-
const hasStandardBrowserEnv = hasBrowserEnv &&
|
|
42036
|
-
(!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
|
|
42037
|
-
|
|
42038
|
-
/**
|
|
42039
|
-
* Determine if we're running in a standard browser webWorker environment
|
|
42040
|
-
*
|
|
42041
|
-
* Although the `isStandardBrowserEnv` method indicates that
|
|
42042
|
-
* `allows axios to run in a web worker`, the WebWorker will still be
|
|
42043
|
-
* filtered out due to its judgment standard
|
|
42044
|
-
* `typeof window !== 'undefined' && typeof document !== 'undefined'`.
|
|
42045
|
-
* This leads to a problem when axios post `FormData` in webWorker
|
|
42046
|
-
*/
|
|
42047
|
-
const hasStandardBrowserWebWorkerEnv = (() => {
|
|
42048
|
-
return (
|
|
42049
|
-
typeof WorkerGlobalScope !== 'undefined' &&
|
|
42050
|
-
// eslint-disable-next-line no-undef
|
|
42051
|
-
self instanceof WorkerGlobalScope &&
|
|
42052
|
-
typeof self.importScripts === 'function'
|
|
42053
|
-
);
|
|
42054
|
-
})();
|
|
42055
|
-
|
|
42056
|
-
const origin = hasBrowserEnv && window.location.href || 'http://localhost';
|
|
42057
|
-
|
|
42058
|
-
var utils = /*#__PURE__*/Object.freeze({
|
|
42059
|
-
__proto__: null,
|
|
42060
|
-
hasBrowserEnv: hasBrowserEnv,
|
|
42061
|
-
hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
|
|
42062
|
-
hasStandardBrowserEnv: hasStandardBrowserEnv,
|
|
42063
|
-
navigator: _navigator,
|
|
42064
|
-
origin: origin
|
|
42065
|
-
});
|
|
42066
|
-
|
|
42067
|
-
var platform = {
|
|
42068
|
-
...utils,
|
|
42069
|
-
...platform$1
|
|
42070
|
-
};
|
|
42071
|
-
|
|
42072
41933
|
function toURLEncodedForm(data, options) {
|
|
42073
41934
|
return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({
|
|
42074
41935
|
visitor: function(value, key, path, helpers) {
|
|
42075
|
-
if (
|
|
41936
|
+
if (utils.isBuffer(value)) {
|
|
42076
41937
|
this.append(key, value.toString('base64'));
|
|
42077
41938
|
return false;
|
|
42078
41939
|
}
|
|
@@ -42094,7 +41955,7 @@ function parsePropPath(name) {
|
|
|
42094
41955
|
// foo.x.y.z
|
|
42095
41956
|
// foo-x-y-z
|
|
42096
41957
|
// foo x y z
|
|
42097
|
-
return utils
|
|
41958
|
+
return utils.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
|
|
42098
41959
|
return match[0] === '[]' ? '' : match[1] || match[0];
|
|
42099
41960
|
});
|
|
42100
41961
|
}
|
|
@@ -42129,15 +41990,12 @@ function arrayToObject(arr) {
|
|
|
42129
41990
|
function formDataToJSON(formData) {
|
|
42130
41991
|
function buildPath(path, value, target, index) {
|
|
42131
41992
|
let name = path[index++];
|
|
42132
|
-
|
|
42133
|
-
if (name === '__proto__') return true;
|
|
42134
|
-
|
|
42135
41993
|
const isNumericKey = Number.isFinite(+name);
|
|
42136
41994
|
const isLast = index >= path.length;
|
|
42137
|
-
name = !name && utils
|
|
41995
|
+
name = !name && utils.isArray(target) ? target.length : name;
|
|
42138
41996
|
|
|
42139
41997
|
if (isLast) {
|
|
42140
|
-
if (utils
|
|
41998
|
+
if (utils.hasOwnProp(target, name)) {
|
|
42141
41999
|
target[name] = [target[name], value];
|
|
42142
42000
|
} else {
|
|
42143
42001
|
target[name] = value;
|
|
@@ -42146,23 +42004,23 @@ function formDataToJSON(formData) {
|
|
|
42146
42004
|
return !isNumericKey;
|
|
42147
42005
|
}
|
|
42148
42006
|
|
|
42149
|
-
if (!target[name] || !utils
|
|
42007
|
+
if (!target[name] || !utils.isObject(target[name])) {
|
|
42150
42008
|
target[name] = [];
|
|
42151
42009
|
}
|
|
42152
42010
|
|
|
42153
42011
|
const result = buildPath(path, value, target[name], index);
|
|
42154
42012
|
|
|
42155
|
-
if (result && utils
|
|
42013
|
+
if (result && utils.isArray(target[name])) {
|
|
42156
42014
|
target[name] = arrayToObject(target[name]);
|
|
42157
42015
|
}
|
|
42158
42016
|
|
|
42159
42017
|
return !isNumericKey;
|
|
42160
42018
|
}
|
|
42161
42019
|
|
|
42162
|
-
if (utils
|
|
42020
|
+
if (utils.isFormData(formData) && utils.isFunction(formData.entries)) {
|
|
42163
42021
|
const obj = {};
|
|
42164
42022
|
|
|
42165
|
-
utils
|
|
42023
|
+
utils.forEachEntry(formData, (name, value) => {
|
|
42166
42024
|
buildPath(parsePropPath(name), value, obj, 0);
|
|
42167
42025
|
});
|
|
42168
42026
|
|
|
@@ -42172,6 +42030,10 @@ function formDataToJSON(formData) {
|
|
|
42172
42030
|
return null;
|
|
42173
42031
|
}
|
|
42174
42032
|
|
|
42033
|
+
const DEFAULT_CONTENT_TYPE = {
|
|
42034
|
+
'Content-Type': undefined
|
|
42035
|
+
};
|
|
42036
|
+
|
|
42175
42037
|
/**
|
|
42176
42038
|
* It takes a string, tries to parse it, and if it fails, it returns the stringified version
|
|
42177
42039
|
* of the input
|
|
@@ -42183,10 +42045,10 @@ function formDataToJSON(formData) {
|
|
|
42183
42045
|
* @returns {string} A stringified version of the rawValue.
|
|
42184
42046
|
*/
|
|
42185
42047
|
function stringifySafely(rawValue, parser, encoder) {
|
|
42186
|
-
if (utils
|
|
42048
|
+
if (utils.isString(rawValue)) {
|
|
42187
42049
|
try {
|
|
42188
42050
|
(parser || JSON.parse)(rawValue);
|
|
42189
|
-
return utils
|
|
42051
|
+
return utils.trim(rawValue);
|
|
42190
42052
|
} catch (e) {
|
|
42191
42053
|
if (e.name !== 'SyntaxError') {
|
|
42192
42054
|
throw e;
|
|
@@ -42201,36 +42063,38 @@ const defaults = {
|
|
|
42201
42063
|
|
|
42202
42064
|
transitional: transitionalDefaults,
|
|
42203
42065
|
|
|
42204
|
-
adapter: ['xhr', 'http'
|
|
42066
|
+
adapter: ['xhr', 'http'],
|
|
42205
42067
|
|
|
42206
42068
|
transformRequest: [function transformRequest(data, headers) {
|
|
42207
42069
|
const contentType = headers.getContentType() || '';
|
|
42208
42070
|
const hasJSONContentType = contentType.indexOf('application/json') > -1;
|
|
42209
|
-
const isObjectPayload = utils
|
|
42071
|
+
const isObjectPayload = utils.isObject(data);
|
|
42210
42072
|
|
|
42211
|
-
if (isObjectPayload && utils
|
|
42073
|
+
if (isObjectPayload && utils.isHTMLForm(data)) {
|
|
42212
42074
|
data = new FormData(data);
|
|
42213
42075
|
}
|
|
42214
42076
|
|
|
42215
|
-
const isFormData = utils
|
|
42077
|
+
const isFormData = utils.isFormData(data);
|
|
42216
42078
|
|
|
42217
42079
|
if (isFormData) {
|
|
42080
|
+
if (!hasJSONContentType) {
|
|
42081
|
+
return data;
|
|
42082
|
+
}
|
|
42218
42083
|
return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
|
|
42219
42084
|
}
|
|
42220
42085
|
|
|
42221
|
-
if (utils
|
|
42222
|
-
utils
|
|
42223
|
-
utils
|
|
42224
|
-
utils
|
|
42225
|
-
utils
|
|
42226
|
-
utils$1.isReadableStream(data)
|
|
42086
|
+
if (utils.isArrayBuffer(data) ||
|
|
42087
|
+
utils.isBuffer(data) ||
|
|
42088
|
+
utils.isStream(data) ||
|
|
42089
|
+
utils.isFile(data) ||
|
|
42090
|
+
utils.isBlob(data)
|
|
42227
42091
|
) {
|
|
42228
42092
|
return data;
|
|
42229
42093
|
}
|
|
42230
|
-
if (utils
|
|
42094
|
+
if (utils.isArrayBufferView(data)) {
|
|
42231
42095
|
return data.buffer;
|
|
42232
42096
|
}
|
|
42233
|
-
if (utils
|
|
42097
|
+
if (utils.isURLSearchParams(data)) {
|
|
42234
42098
|
headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
|
|
42235
42099
|
return data.toString();
|
|
42236
42100
|
}
|
|
@@ -42242,7 +42106,7 @@ const defaults = {
|
|
|
42242
42106
|
return toURLEncodedForm(data, this.formSerializer).toString();
|
|
42243
42107
|
}
|
|
42244
42108
|
|
|
42245
|
-
if ((isFileList = utils
|
|
42109
|
+
if ((isFileList = utils.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
|
|
42246
42110
|
const _FormData = this.env && this.env.FormData;
|
|
42247
42111
|
|
|
42248
42112
|
return toFormData(
|
|
@@ -42266,11 +42130,7 @@ const defaults = {
|
|
|
42266
42130
|
const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
|
|
42267
42131
|
const JSONRequested = this.responseType === 'json';
|
|
42268
42132
|
|
|
42269
|
-
if (utils
|
|
42270
|
-
return data;
|
|
42271
|
-
}
|
|
42272
|
-
|
|
42273
|
-
if (data && utils$1.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
|
|
42133
|
+
if (data && utils.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
|
|
42274
42134
|
const silentJSONParsing = transitional && transitional.silentJSONParsing;
|
|
42275
42135
|
const strictJSONParsing = !silentJSONParsing && JSONRequested;
|
|
42276
42136
|
|
|
@@ -42312,19 +42172,22 @@ const defaults = {
|
|
|
42312
42172
|
|
|
42313
42173
|
headers: {
|
|
42314
42174
|
common: {
|
|
42315
|
-
'Accept': 'application/json, text/plain, */*'
|
|
42316
|
-
'Content-Type': undefined
|
|
42175
|
+
'Accept': 'application/json, text/plain, */*'
|
|
42317
42176
|
}
|
|
42318
42177
|
}
|
|
42319
42178
|
};
|
|
42320
42179
|
|
|
42321
|
-
utils
|
|
42180
|
+
utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
|
|
42322
42181
|
defaults.headers[method] = {};
|
|
42323
42182
|
});
|
|
42324
42183
|
|
|
42184
|
+
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|
42185
|
+
defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
|
|
42186
|
+
});
|
|
42187
|
+
|
|
42325
42188
|
// RawAxiosHeaders whose duplicates are ignored by node
|
|
42326
42189
|
// c.f. https://nodejs.org/api/http.html#http_message_headers
|
|
42327
|
-
const ignoreDuplicateOf = utils
|
|
42190
|
+
const ignoreDuplicateOf = utils.toObjectSet([
|
|
42328
42191
|
'age', 'authorization', 'content-length', 'content-type', 'etag',
|
|
42329
42192
|
'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
|
|
42330
42193
|
'last-modified', 'location', 'max-forwards', 'proxy-authorization',
|
|
@@ -42385,7 +42248,7 @@ function normalizeValue(value) {
|
|
|
42385
42248
|
return value;
|
|
42386
42249
|
}
|
|
42387
42250
|
|
|
42388
|
-
return utils
|
|
42251
|
+
return utils.isArray(value) ? value.map(normalizeValue) : String(value);
|
|
42389
42252
|
}
|
|
42390
42253
|
|
|
42391
42254
|
function parseTokens(str) {
|
|
@@ -42400,24 +42263,22 @@ function parseTokens(str) {
|
|
|
42400
42263
|
return tokens;
|
|
42401
42264
|
}
|
|
42402
42265
|
|
|
42403
|
-
|
|
42266
|
+
function isValidHeaderName(str) {
|
|
42267
|
+
return /^[-_a-zA-Z]+$/.test(str.trim());
|
|
42268
|
+
}
|
|
42404
42269
|
|
|
42405
|
-
function matchHeaderValue(context, value, header, filter
|
|
42406
|
-
if (utils
|
|
42270
|
+
function matchHeaderValue(context, value, header, filter) {
|
|
42271
|
+
if (utils.isFunction(filter)) {
|
|
42407
42272
|
return filter.call(this, value, header);
|
|
42408
42273
|
}
|
|
42409
42274
|
|
|
42410
|
-
if (
|
|
42411
|
-
value = header;
|
|
42412
|
-
}
|
|
42413
|
-
|
|
42414
|
-
if (!utils$1.isString(value)) return;
|
|
42275
|
+
if (!utils.isString(value)) return;
|
|
42415
42276
|
|
|
42416
|
-
if (utils
|
|
42277
|
+
if (utils.isString(filter)) {
|
|
42417
42278
|
return value.indexOf(filter) !== -1;
|
|
42418
42279
|
}
|
|
42419
42280
|
|
|
42420
|
-
if (utils
|
|
42281
|
+
if (utils.isRegExp(filter)) {
|
|
42421
42282
|
return filter.test(value);
|
|
42422
42283
|
}
|
|
42423
42284
|
}
|
|
@@ -42430,7 +42291,7 @@ function formatHeader(header) {
|
|
|
42430
42291
|
}
|
|
42431
42292
|
|
|
42432
42293
|
function buildAccessors(obj, header) {
|
|
42433
|
-
const accessorName = utils
|
|
42294
|
+
const accessorName = utils.toCamelCase(' ' + header);
|
|
42434
42295
|
|
|
42435
42296
|
['get', 'set', 'has'].forEach(methodName => {
|
|
42436
42297
|
Object.defineProperty(obj, methodName + accessorName, {
|
|
@@ -42457,7 +42318,7 @@ class AxiosHeaders {
|
|
|
42457
42318
|
throw new Error('header name must be a non-empty string');
|
|
42458
42319
|
}
|
|
42459
42320
|
|
|
42460
|
-
const key = utils
|
|
42321
|
+
const key = utils.findKey(self, lHeader);
|
|
42461
42322
|
|
|
42462
42323
|
if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) {
|
|
42463
42324
|
self[key || _header] = normalizeValue(_value);
|
|
@@ -42465,16 +42326,12 @@ class AxiosHeaders {
|
|
|
42465
42326
|
}
|
|
42466
42327
|
|
|
42467
42328
|
const setHeaders = (headers, _rewrite) =>
|
|
42468
|
-
utils
|
|
42329
|
+
utils.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
|
|
42469
42330
|
|
|
42470
|
-
if (utils
|
|
42331
|
+
if (utils.isPlainObject(header) || header instanceof this.constructor) {
|
|
42471
42332
|
setHeaders(header, valueOrRewrite);
|
|
42472
|
-
} else if(utils
|
|
42333
|
+
} else if(utils.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
|
42473
42334
|
setHeaders(parseHeaders(header), valueOrRewrite);
|
|
42474
|
-
} else if (utils$1.isHeaders(header)) {
|
|
42475
|
-
for (const [key, value] of header.entries()) {
|
|
42476
|
-
setHeader(value, key, rewrite);
|
|
42477
|
-
}
|
|
42478
42335
|
} else {
|
|
42479
42336
|
header != null && setHeader(valueOrRewrite, header, rewrite);
|
|
42480
42337
|
}
|
|
@@ -42486,7 +42343,7 @@ class AxiosHeaders {
|
|
|
42486
42343
|
header = normalizeHeader(header);
|
|
42487
42344
|
|
|
42488
42345
|
if (header) {
|
|
42489
|
-
const key = utils
|
|
42346
|
+
const key = utils.findKey(this, header);
|
|
42490
42347
|
|
|
42491
42348
|
if (key) {
|
|
42492
42349
|
const value = this[key];
|
|
@@ -42499,11 +42356,11 @@ class AxiosHeaders {
|
|
|
42499
42356
|
return parseTokens(value);
|
|
42500
42357
|
}
|
|
42501
42358
|
|
|
42502
|
-
if (utils
|
|
42359
|
+
if (utils.isFunction(parser)) {
|
|
42503
42360
|
return parser.call(this, value, key);
|
|
42504
42361
|
}
|
|
42505
42362
|
|
|
42506
|
-
if (utils
|
|
42363
|
+
if (utils.isRegExp(parser)) {
|
|
42507
42364
|
return parser.exec(value);
|
|
42508
42365
|
}
|
|
42509
42366
|
|
|
@@ -42516,9 +42373,9 @@ class AxiosHeaders {
|
|
|
42516
42373
|
header = normalizeHeader(header);
|
|
42517
42374
|
|
|
42518
42375
|
if (header) {
|
|
42519
|
-
const key = utils
|
|
42376
|
+
const key = utils.findKey(this, header);
|
|
42520
42377
|
|
|
42521
|
-
return !!(key &&
|
|
42378
|
+
return !!(key && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
|
|
42522
42379
|
}
|
|
42523
42380
|
|
|
42524
42381
|
return false;
|
|
@@ -42532,7 +42389,7 @@ class AxiosHeaders {
|
|
|
42532
42389
|
_header = normalizeHeader(_header);
|
|
42533
42390
|
|
|
42534
42391
|
if (_header) {
|
|
42535
|
-
const key = utils
|
|
42392
|
+
const key = utils.findKey(self, _header);
|
|
42536
42393
|
|
|
42537
42394
|
if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
|
|
42538
42395
|
delete self[key];
|
|
@@ -42542,7 +42399,7 @@ class AxiosHeaders {
|
|
|
42542
42399
|
}
|
|
42543
42400
|
}
|
|
42544
42401
|
|
|
42545
|
-
if (utils
|
|
42402
|
+
if (utils.isArray(header)) {
|
|
42546
42403
|
header.forEach(deleteHeader);
|
|
42547
42404
|
} else {
|
|
42548
42405
|
deleteHeader(header);
|
|
@@ -42551,28 +42408,16 @@ class AxiosHeaders {
|
|
|
42551
42408
|
return deleted;
|
|
42552
42409
|
}
|
|
42553
42410
|
|
|
42554
|
-
clear(
|
|
42555
|
-
|
|
42556
|
-
let i = keys.length;
|
|
42557
|
-
let deleted = false;
|
|
42558
|
-
|
|
42559
|
-
while (i--) {
|
|
42560
|
-
const key = keys[i];
|
|
42561
|
-
if(!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
|
|
42562
|
-
delete this[key];
|
|
42563
|
-
deleted = true;
|
|
42564
|
-
}
|
|
42565
|
-
}
|
|
42566
|
-
|
|
42567
|
-
return deleted;
|
|
42411
|
+
clear() {
|
|
42412
|
+
return Object.keys(this).forEach(this.delete.bind(this));
|
|
42568
42413
|
}
|
|
42569
42414
|
|
|
42570
42415
|
normalize(format) {
|
|
42571
42416
|
const self = this;
|
|
42572
42417
|
const headers = {};
|
|
42573
42418
|
|
|
42574
|
-
utils
|
|
42575
|
-
const key = utils
|
|
42419
|
+
utils.forEach(this, (value, header) => {
|
|
42420
|
+
const key = utils.findKey(headers, header);
|
|
42576
42421
|
|
|
42577
42422
|
if (key) {
|
|
42578
42423
|
self[key] = normalizeValue(value);
|
|
@@ -42601,8 +42446,8 @@ class AxiosHeaders {
|
|
|
42601
42446
|
toJSON(asStrings) {
|
|
42602
42447
|
const obj = Object.create(null);
|
|
42603
42448
|
|
|
42604
|
-
utils
|
|
42605
|
-
value != null && value !== false && (obj[header] = asStrings && utils
|
|
42449
|
+
utils.forEach(this, (value, header) => {
|
|
42450
|
+
value != null && value !== false && (obj[header] = asStrings && utils.isArray(value) ? value.join(', ') : value);
|
|
42606
42451
|
});
|
|
42607
42452
|
|
|
42608
42453
|
return obj;
|
|
@@ -42649,26 +42494,16 @@ class AxiosHeaders {
|
|
|
42649
42494
|
}
|
|
42650
42495
|
}
|
|
42651
42496
|
|
|
42652
|
-
utils
|
|
42497
|
+
utils.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
|
|
42653
42498
|
|
|
42654
42499
|
return this;
|
|
42655
42500
|
}
|
|
42656
42501
|
}
|
|
42657
42502
|
|
|
42658
|
-
AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent'
|
|
42503
|
+
AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent']);
|
|
42659
42504
|
|
|
42660
|
-
|
|
42661
|
-
utils
|
|
42662
|
-
let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
|
|
42663
|
-
return {
|
|
42664
|
-
get: () => value,
|
|
42665
|
-
set(headerValue) {
|
|
42666
|
-
this[mapped] = headerValue;
|
|
42667
|
-
}
|
|
42668
|
-
}
|
|
42669
|
-
});
|
|
42670
|
-
|
|
42671
|
-
utils$1.freezeMethods(AxiosHeaders);
|
|
42505
|
+
utils.freezeMethods(AxiosHeaders.prototype);
|
|
42506
|
+
utils.freezeMethods(AxiosHeaders);
|
|
42672
42507
|
|
|
42673
42508
|
/**
|
|
42674
42509
|
* Transform the data for a request or a response
|
|
@@ -42684,7 +42519,7 @@ function transformData(fns, response) {
|
|
|
42684
42519
|
const headers = AxiosHeaders.from(context.headers);
|
|
42685
42520
|
let data = context.data;
|
|
42686
42521
|
|
|
42687
|
-
utils
|
|
42522
|
+
utils.forEach(fns, function transform(fn) {
|
|
42688
42523
|
data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);
|
|
42689
42524
|
});
|
|
42690
42525
|
|
|
@@ -42712,7 +42547,7 @@ function CanceledError(message, config, request) {
|
|
|
42712
42547
|
this.name = 'CanceledError';
|
|
42713
42548
|
}
|
|
42714
42549
|
|
|
42715
|
-
utils
|
|
42550
|
+
utils.inherits(CanceledError, AxiosError, {
|
|
42716
42551
|
__CANCEL__: true
|
|
42717
42552
|
});
|
|
42718
42553
|
|
|
@@ -42764,7 +42599,7 @@ function isAbsoluteURL(url) {
|
|
|
42764
42599
|
*/
|
|
42765
42600
|
function combineURLs(baseURL, relativeURL) {
|
|
42766
42601
|
return relativeURL
|
|
42767
|
-
? baseURL.replace(
|
|
42602
|
+
? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
|
|
42768
42603
|
: baseURL;
|
|
42769
42604
|
}
|
|
42770
42605
|
|
|
@@ -42892,10 +42727,6 @@ function getEnv(key) {
|
|
|
42892
42727
|
|
|
42893
42728
|
var getProxyForUrl_1 = getProxyForUrl;
|
|
42894
42729
|
|
|
42895
|
-
var proxyFromEnv = {
|
|
42896
|
-
getProxyForUrl: getProxyForUrl_1
|
|
42897
|
-
};
|
|
42898
|
-
|
|
42899
42730
|
/**
|
|
42900
42731
|
* Helpers.
|
|
42901
42732
|
*/
|
|
@@ -44732,7 +44563,7 @@ var followRedirects = wrap({ http: http, https: https });
|
|
|
44732
44563
|
var wrap_1 = wrap;
|
|
44733
44564
|
followRedirects.wrap = wrap_1;
|
|
44734
44565
|
|
|
44735
|
-
const VERSION = "1.
|
|
44566
|
+
const VERSION = "1.2.2";
|
|
44736
44567
|
|
|
44737
44568
|
function parseProtocol(url) {
|
|
44738
44569
|
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
|
|
@@ -44787,11 +44618,93 @@ function fromDataURI(uri, asBlob, options) {
|
|
|
44787
44618
|
throw new AxiosError('Unsupported protocol ' + protocol, AxiosError.ERR_NOT_SUPPORT);
|
|
44788
44619
|
}
|
|
44789
44620
|
|
|
44621
|
+
/**
|
|
44622
|
+
* Throttle decorator
|
|
44623
|
+
* @param {Function} fn
|
|
44624
|
+
* @param {Number} freq
|
|
44625
|
+
* @return {Function}
|
|
44626
|
+
*/
|
|
44627
|
+
function throttle(fn, freq) {
|
|
44628
|
+
let timestamp = 0;
|
|
44629
|
+
const threshold = 1000 / freq;
|
|
44630
|
+
let timer = null;
|
|
44631
|
+
return function throttled(force, args) {
|
|
44632
|
+
const now = Date.now();
|
|
44633
|
+
if (force || now - timestamp > threshold) {
|
|
44634
|
+
if (timer) {
|
|
44635
|
+
clearTimeout(timer);
|
|
44636
|
+
timer = null;
|
|
44637
|
+
}
|
|
44638
|
+
timestamp = now;
|
|
44639
|
+
return fn.apply(null, args);
|
|
44640
|
+
}
|
|
44641
|
+
if (!timer) {
|
|
44642
|
+
timer = setTimeout(() => {
|
|
44643
|
+
timer = null;
|
|
44644
|
+
timestamp = Date.now();
|
|
44645
|
+
return fn.apply(null, args);
|
|
44646
|
+
}, threshold - (now - timestamp));
|
|
44647
|
+
}
|
|
44648
|
+
};
|
|
44649
|
+
}
|
|
44650
|
+
|
|
44651
|
+
/**
|
|
44652
|
+
* Calculate data maxRate
|
|
44653
|
+
* @param {Number} [samplesCount= 10]
|
|
44654
|
+
* @param {Number} [min= 1000]
|
|
44655
|
+
* @returns {Function}
|
|
44656
|
+
*/
|
|
44657
|
+
function speedometer(samplesCount, min) {
|
|
44658
|
+
samplesCount = samplesCount || 10;
|
|
44659
|
+
const bytes = new Array(samplesCount);
|
|
44660
|
+
const timestamps = new Array(samplesCount);
|
|
44661
|
+
let head = 0;
|
|
44662
|
+
let tail = 0;
|
|
44663
|
+
let firstSampleTS;
|
|
44664
|
+
|
|
44665
|
+
min = min !== undefined ? min : 1000;
|
|
44666
|
+
|
|
44667
|
+
return function push(chunkLength) {
|
|
44668
|
+
const now = Date.now();
|
|
44669
|
+
|
|
44670
|
+
const startedAt = timestamps[tail];
|
|
44671
|
+
|
|
44672
|
+
if (!firstSampleTS) {
|
|
44673
|
+
firstSampleTS = now;
|
|
44674
|
+
}
|
|
44675
|
+
|
|
44676
|
+
bytes[head] = chunkLength;
|
|
44677
|
+
timestamps[head] = now;
|
|
44678
|
+
|
|
44679
|
+
let i = tail;
|
|
44680
|
+
let bytesCount = 0;
|
|
44681
|
+
|
|
44682
|
+
while (i !== head) {
|
|
44683
|
+
bytesCount += bytes[i++];
|
|
44684
|
+
i = i % samplesCount;
|
|
44685
|
+
}
|
|
44686
|
+
|
|
44687
|
+
head = (head + 1) % samplesCount;
|
|
44688
|
+
|
|
44689
|
+
if (head === tail) {
|
|
44690
|
+
tail = (tail + 1) % samplesCount;
|
|
44691
|
+
}
|
|
44692
|
+
|
|
44693
|
+
if (now - firstSampleTS < min) {
|
|
44694
|
+
return;
|
|
44695
|
+
}
|
|
44696
|
+
|
|
44697
|
+
const passed = startedAt && now - startedAt;
|
|
44698
|
+
|
|
44699
|
+
return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
|
|
44700
|
+
};
|
|
44701
|
+
}
|
|
44702
|
+
|
|
44790
44703
|
const kInternals = Symbol('internals');
|
|
44791
44704
|
|
|
44792
44705
|
class AxiosTransformStream extends stream.Transform{
|
|
44793
44706
|
constructor(options) {
|
|
44794
|
-
options = utils
|
|
44707
|
+
options = utils.toFlatObject(options, {
|
|
44795
44708
|
maxRate: 0,
|
|
44796
44709
|
chunkSize: 64 * 1024,
|
|
44797
44710
|
minChunkSize: 100,
|
|
@@ -44799,15 +44712,19 @@ class AxiosTransformStream extends stream.Transform{
|
|
|
44799
44712
|
ticksRate: 2,
|
|
44800
44713
|
samplesCount: 15
|
|
44801
44714
|
}, null, (prop, source) => {
|
|
44802
|
-
return !utils
|
|
44715
|
+
return !utils.isUndefined(source[prop]);
|
|
44803
44716
|
});
|
|
44804
44717
|
|
|
44805
44718
|
super({
|
|
44806
44719
|
readableHighWaterMark: options.chunkSize
|
|
44807
44720
|
});
|
|
44808
44721
|
|
|
44722
|
+
const self = this;
|
|
44723
|
+
|
|
44809
44724
|
const internals = this[kInternals] = {
|
|
44725
|
+
length: options.length,
|
|
44810
44726
|
timeWindow: options.timeWindow,
|
|
44727
|
+
ticksRate: options.ticksRate,
|
|
44811
44728
|
chunkSize: options.chunkSize,
|
|
44812
44729
|
maxRate: options.maxRate,
|
|
44813
44730
|
minChunkSize: options.minChunkSize,
|
|
@@ -44819,6 +44736,8 @@ class AxiosTransformStream extends stream.Transform{
|
|
|
44819
44736
|
onReadCallback: null
|
|
44820
44737
|
};
|
|
44821
44738
|
|
|
44739
|
+
const _speedometer = speedometer(internals.ticksRate * options.samplesCount, internals.timeWindow);
|
|
44740
|
+
|
|
44822
44741
|
this.on('newListener', event => {
|
|
44823
44742
|
if (event === 'progress') {
|
|
44824
44743
|
if (!internals.isCaptured) {
|
|
@@ -44826,6 +44745,38 @@ class AxiosTransformStream extends stream.Transform{
|
|
|
44826
44745
|
}
|
|
44827
44746
|
}
|
|
44828
44747
|
});
|
|
44748
|
+
|
|
44749
|
+
let bytesNotified = 0;
|
|
44750
|
+
|
|
44751
|
+
internals.updateProgress = throttle(function throttledHandler() {
|
|
44752
|
+
const totalBytes = internals.length;
|
|
44753
|
+
const bytesTransferred = internals.bytesSeen;
|
|
44754
|
+
const progressBytes = bytesTransferred - bytesNotified;
|
|
44755
|
+
if (!progressBytes || self.destroyed) return;
|
|
44756
|
+
|
|
44757
|
+
const rate = _speedometer(progressBytes);
|
|
44758
|
+
|
|
44759
|
+
bytesNotified = bytesTransferred;
|
|
44760
|
+
|
|
44761
|
+
process.nextTick(() => {
|
|
44762
|
+
self.emit('progress', {
|
|
44763
|
+
'loaded': bytesTransferred,
|
|
44764
|
+
'total': totalBytes,
|
|
44765
|
+
'progress': totalBytes ? (bytesTransferred / totalBytes) : undefined,
|
|
44766
|
+
'bytes': progressBytes,
|
|
44767
|
+
'rate': rate ? rate : undefined,
|
|
44768
|
+
'estimated': rate && totalBytes && bytesTransferred <= totalBytes ?
|
|
44769
|
+
(totalBytes - bytesTransferred) / rate : undefined
|
|
44770
|
+
});
|
|
44771
|
+
});
|
|
44772
|
+
}, internals.ticksRate);
|
|
44773
|
+
|
|
44774
|
+
const onFinish = () => {
|
|
44775
|
+
internals.updateProgress(true);
|
|
44776
|
+
};
|
|
44777
|
+
|
|
44778
|
+
this.once('end', onFinish);
|
|
44779
|
+
this.once('error', onFinish);
|
|
44829
44780
|
}
|
|
44830
44781
|
|
|
44831
44782
|
_read(size) {
|
|
@@ -44839,6 +44790,7 @@ class AxiosTransformStream extends stream.Transform{
|
|
|
44839
44790
|
}
|
|
44840
44791
|
|
|
44841
44792
|
_transform(chunk, encoding, callback) {
|
|
44793
|
+
const self = this;
|
|
44842
44794
|
const internals = this[kInternals];
|
|
44843
44795
|
const maxRate = internals.maxRate;
|
|
44844
44796
|
|
|
@@ -44850,14 +44802,16 @@ class AxiosTransformStream extends stream.Transform{
|
|
|
44850
44802
|
const bytesThreshold = (maxRate / divider);
|
|
44851
44803
|
const minChunkSize = internals.minChunkSize !== false ? Math.max(internals.minChunkSize, bytesThreshold * 0.01) : 0;
|
|
44852
44804
|
|
|
44853
|
-
|
|
44805
|
+
function pushChunk(_chunk, _callback) {
|
|
44854
44806
|
const bytes = Buffer.byteLength(_chunk);
|
|
44855
44807
|
internals.bytesSeen += bytes;
|
|
44856
44808
|
internals.bytes += bytes;
|
|
44857
44809
|
|
|
44858
|
-
|
|
44810
|
+
if (internals.isCaptured) {
|
|
44811
|
+
internals.updateProgress();
|
|
44812
|
+
}
|
|
44859
44813
|
|
|
44860
|
-
if (
|
|
44814
|
+
if (self.push(_chunk)) {
|
|
44861
44815
|
process.nextTick(_callback);
|
|
44862
44816
|
} else {
|
|
44863
44817
|
internals.onReadCallback = () => {
|
|
@@ -44865,7 +44819,7 @@ class AxiosTransformStream extends stream.Transform{
|
|
|
44865
44819
|
process.nextTick(_callback);
|
|
44866
44820
|
};
|
|
44867
44821
|
}
|
|
44868
|
-
}
|
|
44822
|
+
}
|
|
44869
44823
|
|
|
44870
44824
|
const transformChunk = (_chunk, _callback) => {
|
|
44871
44825
|
const chunkSize = Buffer.byteLength(_chunk);
|
|
@@ -44922,299 +44876,13 @@ class AxiosTransformStream extends stream.Transform{
|
|
|
44922
44876
|
}
|
|
44923
44877
|
});
|
|
44924
44878
|
}
|
|
44925
|
-
}
|
|
44926
|
-
|
|
44927
|
-
const {asyncIterator} = Symbol;
|
|
44928
|
-
|
|
44929
|
-
const readBlob = async function* (blob) {
|
|
44930
|
-
if (blob.stream) {
|
|
44931
|
-
yield* blob.stream();
|
|
44932
|
-
} else if (blob.arrayBuffer) {
|
|
44933
|
-
yield await blob.arrayBuffer();
|
|
44934
|
-
} else if (blob[asyncIterator]) {
|
|
44935
|
-
yield* blob[asyncIterator]();
|
|
44936
|
-
} else {
|
|
44937
|
-
yield blob;
|
|
44938
|
-
}
|
|
44939
|
-
};
|
|
44940
|
-
|
|
44941
|
-
const BOUNDARY_ALPHABET = utils$1.ALPHABET.ALPHA_DIGIT + '-_';
|
|
44942
|
-
|
|
44943
|
-
const textEncoder = typeof TextEncoder === 'function' ? new TextEncoder() : new util$1.TextEncoder();
|
|
44944
|
-
|
|
44945
|
-
const CRLF = '\r\n';
|
|
44946
|
-
const CRLF_BYTES = textEncoder.encode(CRLF);
|
|
44947
|
-
const CRLF_BYTES_COUNT = 2;
|
|
44948
|
-
|
|
44949
|
-
class FormDataPart {
|
|
44950
|
-
constructor(name, value) {
|
|
44951
|
-
const {escapeName} = this.constructor;
|
|
44952
|
-
const isStringValue = utils$1.isString(value);
|
|
44953
|
-
|
|
44954
|
-
let headers = `Content-Disposition: form-data; name="${escapeName(name)}"${
|
|
44955
|
-
!isStringValue && value.name ? `; filename="${escapeName(value.name)}"` : ''
|
|
44956
|
-
}${CRLF}`;
|
|
44957
44879
|
|
|
44958
|
-
|
|
44959
|
-
|
|
44960
|
-
|
|
44961
|
-
headers += `Content-Type: ${value.type || "application/octet-stream"}${CRLF}`;
|
|
44962
|
-
}
|
|
44963
|
-
|
|
44964
|
-
this.headers = textEncoder.encode(headers + CRLF);
|
|
44965
|
-
|
|
44966
|
-
this.contentLength = isStringValue ? value.byteLength : value.size;
|
|
44967
|
-
|
|
44968
|
-
this.size = this.headers.byteLength + this.contentLength + CRLF_BYTES_COUNT;
|
|
44969
|
-
|
|
44970
|
-
this.name = name;
|
|
44971
|
-
this.value = value;
|
|
44972
|
-
}
|
|
44973
|
-
|
|
44974
|
-
async *encode(){
|
|
44975
|
-
yield this.headers;
|
|
44976
|
-
|
|
44977
|
-
const {value} = this;
|
|
44978
|
-
|
|
44979
|
-
if(utils$1.isTypedArray(value)) {
|
|
44980
|
-
yield value;
|
|
44981
|
-
} else {
|
|
44982
|
-
yield* readBlob(value);
|
|
44983
|
-
}
|
|
44984
|
-
|
|
44985
|
-
yield CRLF_BYTES;
|
|
44986
|
-
}
|
|
44987
|
-
|
|
44988
|
-
static escapeName(name) {
|
|
44989
|
-
return String(name).replace(/[\r\n"]/g, (match) => ({
|
|
44990
|
-
'\r' : '%0D',
|
|
44991
|
-
'\n' : '%0A',
|
|
44992
|
-
'"' : '%22',
|
|
44993
|
-
}[match]));
|
|
44994
|
-
}
|
|
44995
|
-
}
|
|
44996
|
-
|
|
44997
|
-
const formDataToStream = (form, headersHandler, options) => {
|
|
44998
|
-
const {
|
|
44999
|
-
tag = 'form-data-boundary',
|
|
45000
|
-
size = 25,
|
|
45001
|
-
boundary = tag + '-' + utils$1.generateString(size, BOUNDARY_ALPHABET)
|
|
45002
|
-
} = options || {};
|
|
45003
|
-
|
|
45004
|
-
if(!utils$1.isFormData(form)) {
|
|
45005
|
-
throw TypeError('FormData instance required');
|
|
45006
|
-
}
|
|
45007
|
-
|
|
45008
|
-
if (boundary.length < 1 || boundary.length > 70) {
|
|
45009
|
-
throw Error('boundary must be 10-70 characters long')
|
|
45010
|
-
}
|
|
45011
|
-
|
|
45012
|
-
const boundaryBytes = textEncoder.encode('--' + boundary + CRLF);
|
|
45013
|
-
const footerBytes = textEncoder.encode('--' + boundary + '--' + CRLF + CRLF);
|
|
45014
|
-
let contentLength = footerBytes.byteLength;
|
|
45015
|
-
|
|
45016
|
-
const parts = Array.from(form.entries()).map(([name, value]) => {
|
|
45017
|
-
const part = new FormDataPart(name, value);
|
|
45018
|
-
contentLength += part.size;
|
|
45019
|
-
return part;
|
|
45020
|
-
});
|
|
45021
|
-
|
|
45022
|
-
contentLength += boundaryBytes.byteLength * parts.length;
|
|
45023
|
-
|
|
45024
|
-
contentLength = utils$1.toFiniteNumber(contentLength);
|
|
45025
|
-
|
|
45026
|
-
const computedHeaders = {
|
|
45027
|
-
'Content-Type': `multipart/form-data; boundary=${boundary}`
|
|
45028
|
-
};
|
|
45029
|
-
|
|
45030
|
-
if (Number.isFinite(contentLength)) {
|
|
45031
|
-
computedHeaders['Content-Length'] = contentLength;
|
|
45032
|
-
}
|
|
45033
|
-
|
|
45034
|
-
headersHandler && headersHandler(computedHeaders);
|
|
45035
|
-
|
|
45036
|
-
return Readable.from((async function *() {
|
|
45037
|
-
for(const part of parts) {
|
|
45038
|
-
yield boundaryBytes;
|
|
45039
|
-
yield* part.encode();
|
|
45040
|
-
}
|
|
45041
|
-
|
|
45042
|
-
yield footerBytes;
|
|
45043
|
-
})());
|
|
45044
|
-
};
|
|
45045
|
-
|
|
45046
|
-
class ZlibHeaderTransformStream extends stream.Transform {
|
|
45047
|
-
__transform(chunk, encoding, callback) {
|
|
45048
|
-
this.push(chunk);
|
|
45049
|
-
callback();
|
|
45050
|
-
}
|
|
45051
|
-
|
|
45052
|
-
_transform(chunk, encoding, callback) {
|
|
45053
|
-
if (chunk.length !== 0) {
|
|
45054
|
-
this._transform = this.__transform;
|
|
45055
|
-
|
|
45056
|
-
// Add Default Compression headers if no zlib headers are present
|
|
45057
|
-
if (chunk[0] !== 120) { // Hex: 78
|
|
45058
|
-
const header = Buffer.alloc(2);
|
|
45059
|
-
header[0] = 120; // Hex: 78
|
|
45060
|
-
header[1] = 156; // Hex: 9C
|
|
45061
|
-
this.push(header, encoding);
|
|
45062
|
-
}
|
|
45063
|
-
}
|
|
45064
|
-
|
|
45065
|
-
this.__transform(chunk, encoding, callback);
|
|
44880
|
+
setLength(length) {
|
|
44881
|
+
this[kInternals].length = +length;
|
|
44882
|
+
return this;
|
|
45066
44883
|
}
|
|
45067
44884
|
}
|
|
45068
44885
|
|
|
45069
|
-
const callbackify = (fn, reducer) => {
|
|
45070
|
-
return utils$1.isAsyncFn(fn) ? function (...args) {
|
|
45071
|
-
const cb = args.pop();
|
|
45072
|
-
fn.apply(this, args).then((value) => {
|
|
45073
|
-
try {
|
|
45074
|
-
reducer ? cb(null, ...reducer(value)) : cb(null, value);
|
|
45075
|
-
} catch (err) {
|
|
45076
|
-
cb(err);
|
|
45077
|
-
}
|
|
45078
|
-
}, cb);
|
|
45079
|
-
} : fn;
|
|
45080
|
-
};
|
|
45081
|
-
|
|
45082
|
-
/**
|
|
45083
|
-
* Calculate data maxRate
|
|
45084
|
-
* @param {Number} [samplesCount= 10]
|
|
45085
|
-
* @param {Number} [min= 1000]
|
|
45086
|
-
* @returns {Function}
|
|
45087
|
-
*/
|
|
45088
|
-
function speedometer(samplesCount, min) {
|
|
45089
|
-
samplesCount = samplesCount || 10;
|
|
45090
|
-
const bytes = new Array(samplesCount);
|
|
45091
|
-
const timestamps = new Array(samplesCount);
|
|
45092
|
-
let head = 0;
|
|
45093
|
-
let tail = 0;
|
|
45094
|
-
let firstSampleTS;
|
|
45095
|
-
|
|
45096
|
-
min = min !== undefined ? min : 1000;
|
|
45097
|
-
|
|
45098
|
-
return function push(chunkLength) {
|
|
45099
|
-
const now = Date.now();
|
|
45100
|
-
|
|
45101
|
-
const startedAt = timestamps[tail];
|
|
45102
|
-
|
|
45103
|
-
if (!firstSampleTS) {
|
|
45104
|
-
firstSampleTS = now;
|
|
45105
|
-
}
|
|
45106
|
-
|
|
45107
|
-
bytes[head] = chunkLength;
|
|
45108
|
-
timestamps[head] = now;
|
|
45109
|
-
|
|
45110
|
-
let i = tail;
|
|
45111
|
-
let bytesCount = 0;
|
|
45112
|
-
|
|
45113
|
-
while (i !== head) {
|
|
45114
|
-
bytesCount += bytes[i++];
|
|
45115
|
-
i = i % samplesCount;
|
|
45116
|
-
}
|
|
45117
|
-
|
|
45118
|
-
head = (head + 1) % samplesCount;
|
|
45119
|
-
|
|
45120
|
-
if (head === tail) {
|
|
45121
|
-
tail = (tail + 1) % samplesCount;
|
|
45122
|
-
}
|
|
45123
|
-
|
|
45124
|
-
if (now - firstSampleTS < min) {
|
|
45125
|
-
return;
|
|
45126
|
-
}
|
|
45127
|
-
|
|
45128
|
-
const passed = startedAt && now - startedAt;
|
|
45129
|
-
|
|
45130
|
-
return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
|
|
45131
|
-
};
|
|
45132
|
-
}
|
|
45133
|
-
|
|
45134
|
-
/**
|
|
45135
|
-
* Throttle decorator
|
|
45136
|
-
* @param {Function} fn
|
|
45137
|
-
* @param {Number} freq
|
|
45138
|
-
* @return {Function}
|
|
45139
|
-
*/
|
|
45140
|
-
function throttle(fn, freq) {
|
|
45141
|
-
let timestamp = 0;
|
|
45142
|
-
let threshold = 1000 / freq;
|
|
45143
|
-
let lastArgs;
|
|
45144
|
-
let timer;
|
|
45145
|
-
|
|
45146
|
-
const invoke = (args, now = Date.now()) => {
|
|
45147
|
-
timestamp = now;
|
|
45148
|
-
lastArgs = null;
|
|
45149
|
-
if (timer) {
|
|
45150
|
-
clearTimeout(timer);
|
|
45151
|
-
timer = null;
|
|
45152
|
-
}
|
|
45153
|
-
fn.apply(null, args);
|
|
45154
|
-
};
|
|
45155
|
-
|
|
45156
|
-
const throttled = (...args) => {
|
|
45157
|
-
const now = Date.now();
|
|
45158
|
-
const passed = now - timestamp;
|
|
45159
|
-
if ( passed >= threshold) {
|
|
45160
|
-
invoke(args, now);
|
|
45161
|
-
} else {
|
|
45162
|
-
lastArgs = args;
|
|
45163
|
-
if (!timer) {
|
|
45164
|
-
timer = setTimeout(() => {
|
|
45165
|
-
timer = null;
|
|
45166
|
-
invoke(lastArgs);
|
|
45167
|
-
}, threshold - passed);
|
|
45168
|
-
}
|
|
45169
|
-
}
|
|
45170
|
-
};
|
|
45171
|
-
|
|
45172
|
-
const flush = () => lastArgs && invoke(lastArgs);
|
|
45173
|
-
|
|
45174
|
-
return [throttled, flush];
|
|
45175
|
-
}
|
|
45176
|
-
|
|
45177
|
-
const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
|
|
45178
|
-
let bytesNotified = 0;
|
|
45179
|
-
const _speedometer = speedometer(50, 250);
|
|
45180
|
-
|
|
45181
|
-
return throttle(e => {
|
|
45182
|
-
const loaded = e.loaded;
|
|
45183
|
-
const total = e.lengthComputable ? e.total : undefined;
|
|
45184
|
-
const progressBytes = loaded - bytesNotified;
|
|
45185
|
-
const rate = _speedometer(progressBytes);
|
|
45186
|
-
const inRange = loaded <= total;
|
|
45187
|
-
|
|
45188
|
-
bytesNotified = loaded;
|
|
45189
|
-
|
|
45190
|
-
const data = {
|
|
45191
|
-
loaded,
|
|
45192
|
-
total,
|
|
45193
|
-
progress: total ? (loaded / total) : undefined,
|
|
45194
|
-
bytes: progressBytes,
|
|
45195
|
-
rate: rate ? rate : undefined,
|
|
45196
|
-
estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
|
|
45197
|
-
event: e,
|
|
45198
|
-
lengthComputable: total != null,
|
|
45199
|
-
[isDownloadStream ? 'download' : 'upload']: true
|
|
45200
|
-
};
|
|
45201
|
-
|
|
45202
|
-
listener(data);
|
|
45203
|
-
}, freq);
|
|
45204
|
-
};
|
|
45205
|
-
|
|
45206
|
-
const progressEventDecorator = (total, throttled) => {
|
|
45207
|
-
const lengthComputable = total != null;
|
|
45208
|
-
|
|
45209
|
-
return [(loaded) => throttled[0]({
|
|
45210
|
-
lengthComputable,
|
|
45211
|
-
total,
|
|
45212
|
-
loaded
|
|
45213
|
-
}), throttled[1]];
|
|
45214
|
-
};
|
|
45215
|
-
|
|
45216
|
-
const asyncDecorator = (fn) => (...args) => utils$1.asap(() => fn(...args));
|
|
45217
|
-
|
|
45218
44886
|
const zlibOptions = {
|
|
45219
44887
|
flush: zlib.constants.Z_SYNC_FLUSH,
|
|
45220
44888
|
finishFlush: zlib.constants.Z_SYNC_FLUSH
|
|
@@ -45225,7 +44893,7 @@ const brotliOptions = {
|
|
|
45225
44893
|
finishFlush: zlib.constants.BROTLI_OPERATION_FLUSH
|
|
45226
44894
|
};
|
|
45227
44895
|
|
|
45228
|
-
const isBrotliSupported = utils
|
|
44896
|
+
const isBrotliSupported = utils.isFunction(zlib.createBrotliDecompress);
|
|
45229
44897
|
|
|
45230
44898
|
const {http: httpFollow, https: httpsFollow} = followRedirects;
|
|
45231
44899
|
|
|
@@ -45235,14 +44903,6 @@ const supportedProtocols = platform.protocols.map(protocol => {
|
|
|
45235
44903
|
return protocol + ':';
|
|
45236
44904
|
});
|
|
45237
44905
|
|
|
45238
|
-
const flushOnFinish = (stream, [throttled, flush]) => {
|
|
45239
|
-
stream
|
|
45240
|
-
.on('end', flush)
|
|
45241
|
-
.on('error', flush);
|
|
45242
|
-
|
|
45243
|
-
return throttled;
|
|
45244
|
-
};
|
|
45245
|
-
|
|
45246
44906
|
/**
|
|
45247
44907
|
* If the proxy or config beforeRedirects functions are defined, call them with the options
|
|
45248
44908
|
* object.
|
|
@@ -45251,12 +44911,12 @@ const flushOnFinish = (stream, [throttled, flush]) => {
|
|
|
45251
44911
|
*
|
|
45252
44912
|
* @returns {Object<string, any>}
|
|
45253
44913
|
*/
|
|
45254
|
-
function dispatchBeforeRedirect(options
|
|
44914
|
+
function dispatchBeforeRedirect(options) {
|
|
45255
44915
|
if (options.beforeRedirects.proxy) {
|
|
45256
44916
|
options.beforeRedirects.proxy(options);
|
|
45257
44917
|
}
|
|
45258
44918
|
if (options.beforeRedirects.config) {
|
|
45259
|
-
options.beforeRedirects.config(options
|
|
44919
|
+
options.beforeRedirects.config(options);
|
|
45260
44920
|
}
|
|
45261
44921
|
}
|
|
45262
44922
|
|
|
@@ -45272,7 +44932,7 @@ function dispatchBeforeRedirect(options, responseDetails) {
|
|
|
45272
44932
|
function setProxy(options, configProxy, location) {
|
|
45273
44933
|
let proxy = configProxy;
|
|
45274
44934
|
if (!proxy && proxy !== false) {
|
|
45275
|
-
const proxyUrl =
|
|
44935
|
+
const proxyUrl = getProxyForUrl_1(location);
|
|
45276
44936
|
if (proxyUrl) {
|
|
45277
44937
|
proxy = new URL(proxyUrl);
|
|
45278
44938
|
}
|
|
@@ -45313,77 +44973,27 @@ function setProxy(options, configProxy, location) {
|
|
|
45313
44973
|
};
|
|
45314
44974
|
}
|
|
45315
44975
|
|
|
45316
|
-
const isHttpAdapterSupported = typeof process !== 'undefined' && utils
|
|
45317
|
-
|
|
45318
|
-
// temporary hotfix
|
|
45319
|
-
|
|
45320
|
-
const wrapAsync = (asyncExecutor) => {
|
|
45321
|
-
return new Promise((resolve, reject) => {
|
|
45322
|
-
let onDone;
|
|
45323
|
-
let isDone;
|
|
45324
|
-
|
|
45325
|
-
const done = (value, isRejected) => {
|
|
45326
|
-
if (isDone) return;
|
|
45327
|
-
isDone = true;
|
|
45328
|
-
onDone && onDone(value, isRejected);
|
|
45329
|
-
};
|
|
45330
|
-
|
|
45331
|
-
const _resolve = (value) => {
|
|
45332
|
-
done(value);
|
|
45333
|
-
resolve(value);
|
|
45334
|
-
};
|
|
45335
|
-
|
|
45336
|
-
const _reject = (reason) => {
|
|
45337
|
-
done(reason, true);
|
|
45338
|
-
reject(reason);
|
|
45339
|
-
};
|
|
45340
|
-
|
|
45341
|
-
asyncExecutor(_resolve, _reject, (onDoneHandler) => (onDone = onDoneHandler)).catch(_reject);
|
|
45342
|
-
})
|
|
45343
|
-
};
|
|
45344
|
-
|
|
45345
|
-
const resolveFamily = ({address, family}) => {
|
|
45346
|
-
if (!utils$1.isString(address)) {
|
|
45347
|
-
throw TypeError('address must be a string');
|
|
45348
|
-
}
|
|
45349
|
-
return ({
|
|
45350
|
-
address,
|
|
45351
|
-
family: family || (address.indexOf('.') < 0 ? 6 : 4)
|
|
45352
|
-
});
|
|
45353
|
-
};
|
|
45354
|
-
|
|
45355
|
-
const buildAddressEntry = (address, family) => resolveFamily(utils$1.isObject(address) ? address : {address, family});
|
|
44976
|
+
const isHttpAdapterSupported = typeof process !== 'undefined' && utils.kindOf(process) === 'process';
|
|
45356
44977
|
|
|
45357
44978
|
/*eslint consistent-return:0*/
|
|
45358
44979
|
var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
45359
|
-
return
|
|
45360
|
-
let
|
|
45361
|
-
const
|
|
44980
|
+
return new Promise(function dispatchHttpRequest(resolvePromise, rejectPromise) {
|
|
44981
|
+
let data = config.data;
|
|
44982
|
+
const responseType = config.responseType;
|
|
44983
|
+
const responseEncoding = config.responseEncoding;
|
|
45362
44984
|
const method = config.method.toUpperCase();
|
|
44985
|
+
let isFinished;
|
|
45363
44986
|
let isDone;
|
|
45364
44987
|
let rejected = false;
|
|
45365
44988
|
let req;
|
|
45366
44989
|
|
|
45367
|
-
if (lookup) {
|
|
45368
|
-
const _lookup = callbackify(lookup, (value) => utils$1.isArray(value) ? value : [value]);
|
|
45369
|
-
// hotfix to support opt.all option which is required for node 20.x
|
|
45370
|
-
lookup = (hostname, opt, cb) => {
|
|
45371
|
-
_lookup(hostname, opt, (err, arg0, arg1) => {
|
|
45372
|
-
if (err) {
|
|
45373
|
-
return cb(err);
|
|
45374
|
-
}
|
|
45375
|
-
|
|
45376
|
-
const addresses = utils$1.isArray(arg0) ? arg0.map(addr => buildAddressEntry(addr)) : [buildAddressEntry(arg0, arg1)];
|
|
45377
|
-
|
|
45378
|
-
opt.all ? cb(err, addresses) : cb(err, addresses[0].address, addresses[0].family);
|
|
45379
|
-
});
|
|
45380
|
-
};
|
|
45381
|
-
}
|
|
45382
|
-
|
|
45383
44990
|
// temporary internal emitter until the AxiosRequest class will be implemented
|
|
45384
44991
|
const emitter = new EventEmitter$1();
|
|
45385
44992
|
|
|
45386
|
-
|
|
44993
|
+
function onFinished() {
|
|
44994
|
+
if (isFinished) return;
|
|
44995
|
+
isFinished = true;
|
|
44996
|
+
|
|
45387
44997
|
if (config.cancelToken) {
|
|
45388
44998
|
config.cancelToken.unsubscribe(abort);
|
|
45389
44999
|
}
|
|
@@ -45393,15 +45003,28 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
45393
45003
|
}
|
|
45394
45004
|
|
|
45395
45005
|
emitter.removeAllListeners();
|
|
45396
|
-
}
|
|
45006
|
+
}
|
|
45007
|
+
|
|
45008
|
+
function done(value, isRejected) {
|
|
45009
|
+
if (isDone) return;
|
|
45397
45010
|
|
|
45398
|
-
onDone((value, isRejected) => {
|
|
45399
45011
|
isDone = true;
|
|
45012
|
+
|
|
45400
45013
|
if (isRejected) {
|
|
45401
45014
|
rejected = true;
|
|
45402
45015
|
onFinished();
|
|
45403
45016
|
}
|
|
45404
|
-
|
|
45017
|
+
|
|
45018
|
+
isRejected ? rejectPromise(value) : resolvePromise(value);
|
|
45019
|
+
}
|
|
45020
|
+
|
|
45021
|
+
const resolve = function resolve(value) {
|
|
45022
|
+
done(value);
|
|
45023
|
+
};
|
|
45024
|
+
|
|
45025
|
+
const reject = function reject(value) {
|
|
45026
|
+
done(value, true);
|
|
45027
|
+
};
|
|
45405
45028
|
|
|
45406
45029
|
function abort(reason) {
|
|
45407
45030
|
emitter.emit('abort', !reason || reason.type ? new CanceledError(null, config, req) : reason);
|
|
@@ -45418,7 +45041,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
45418
45041
|
|
|
45419
45042
|
// Parse url
|
|
45420
45043
|
const fullPath = buildFullPath(config.baseURL, config.url);
|
|
45421
|
-
const parsed = new URL(fullPath
|
|
45044
|
+
const parsed = new URL(fullPath);
|
|
45422
45045
|
const protocol = parsed.protocol || supportedProtocols[0];
|
|
45423
45046
|
|
|
45424
45047
|
if (protocol === 'data:') {
|
|
@@ -45445,7 +45068,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
45445
45068
|
convertedData = convertedData.toString(responseEncoding);
|
|
45446
45069
|
|
|
45447
45070
|
if (!responseEncoding || responseEncoding === 'utf8') {
|
|
45448
|
-
|
|
45071
|
+
data = utils.stripBOM(convertedData);
|
|
45449
45072
|
}
|
|
45450
45073
|
} else if (responseType === 'stream') {
|
|
45451
45074
|
convertedData = stream.Readable.from(convertedData);
|
|
@@ -45476,41 +45099,19 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
45476
45099
|
// Only set header if it hasn't been set in config
|
|
45477
45100
|
headers.set('User-Agent', 'axios/' + VERSION, false);
|
|
45478
45101
|
|
|
45479
|
-
const
|
|
45102
|
+
const onDownloadProgress = config.onDownloadProgress;
|
|
45103
|
+
const onUploadProgress = config.onUploadProgress;
|
|
45480
45104
|
const maxRate = config.maxRate;
|
|
45481
45105
|
let maxUploadRate = undefined;
|
|
45482
45106
|
let maxDownloadRate = undefined;
|
|
45483
45107
|
|
|
45484
|
-
// support for
|
|
45485
|
-
if (utils
|
|
45486
|
-
const userBoundary = headers.getContentType(/boundary=([-_\w\d]{10,70})/i);
|
|
45487
|
-
|
|
45488
|
-
data = formDataToStream(data, (formHeaders) => {
|
|
45489
|
-
headers.set(formHeaders);
|
|
45490
|
-
}, {
|
|
45491
|
-
tag: `axios-${VERSION}-boundary`,
|
|
45492
|
-
boundary: userBoundary && userBoundary[1] || undefined
|
|
45493
|
-
});
|
|
45494
|
-
// support for https://www.npmjs.com/package/form-data api
|
|
45495
|
-
} else if (utils$1.isFormData(data) && utils$1.isFunction(data.getHeaders)) {
|
|
45108
|
+
// support for https://www.npmjs.com/package/form-data api
|
|
45109
|
+
if (utils.isFormData(data) && utils.isFunction(data.getHeaders)) {
|
|
45496
45110
|
headers.set(data.getHeaders());
|
|
45497
|
-
|
|
45498
|
-
if (
|
|
45499
|
-
try {
|
|
45500
|
-
const knownLength = await util$1.promisify(data.getLength).call(data);
|
|
45501
|
-
Number.isFinite(knownLength) && knownLength >= 0 && headers.setContentLength(knownLength);
|
|
45502
|
-
/*eslint no-empty:0*/
|
|
45503
|
-
} catch (e) {
|
|
45504
|
-
}
|
|
45505
|
-
}
|
|
45506
|
-
} else if (utils$1.isBlob(data) || utils$1.isFile(data)) {
|
|
45507
|
-
data.size && headers.setContentType(data.type || 'application/octet-stream');
|
|
45508
|
-
headers.setContentLength(data.size || 0);
|
|
45509
|
-
data = stream.Readable.from(readBlob(data));
|
|
45510
|
-
} else if (data && !utils$1.isStream(data)) {
|
|
45511
|
-
if (Buffer.isBuffer(data)) ; else if (utils$1.isArrayBuffer(data)) {
|
|
45111
|
+
} else if (data && !utils.isStream(data)) {
|
|
45112
|
+
if (Buffer.isBuffer(data)) ; else if (utils.isArrayBuffer(data)) {
|
|
45512
45113
|
data = Buffer.from(new Uint8Array(data));
|
|
45513
|
-
} else if (utils
|
|
45114
|
+
} else if (utils.isString(data)) {
|
|
45514
45115
|
data = Buffer.from(data, 'utf-8');
|
|
45515
45116
|
} else {
|
|
45516
45117
|
return reject(new AxiosError(
|
|
@@ -45521,7 +45122,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
45521
45122
|
}
|
|
45522
45123
|
|
|
45523
45124
|
// Add Content-Length header if data exists
|
|
45524
|
-
headers.
|
|
45125
|
+
headers.set('Content-Length', data.length, false);
|
|
45525
45126
|
|
|
45526
45127
|
if (config.maxBodyLength > -1 && data.length > config.maxBodyLength) {
|
|
45527
45128
|
return reject(new AxiosError(
|
|
@@ -45532,9 +45133,9 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
45532
45133
|
}
|
|
45533
45134
|
}
|
|
45534
45135
|
|
|
45535
|
-
const contentLength = utils
|
|
45136
|
+
const contentLength = utils.toFiniteNumber(headers.getContentLength());
|
|
45536
45137
|
|
|
45537
|
-
if (utils
|
|
45138
|
+
if (utils.isArray(maxRate)) {
|
|
45538
45139
|
maxUploadRate = maxRate[0];
|
|
45539
45140
|
maxDownloadRate = maxRate[1];
|
|
45540
45141
|
} else {
|
|
@@ -45542,21 +45143,20 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
45542
45143
|
}
|
|
45543
45144
|
|
|
45544
45145
|
if (data && (onUploadProgress || maxUploadRate)) {
|
|
45545
|
-
if (!utils
|
|
45146
|
+
if (!utils.isStream(data)) {
|
|
45546
45147
|
data = stream.Readable.from(data, {objectMode: false});
|
|
45547
45148
|
}
|
|
45548
45149
|
|
|
45549
45150
|
data = stream.pipeline([data, new AxiosTransformStream({
|
|
45550
|
-
|
|
45551
|
-
|
|
45552
|
-
|
|
45553
|
-
|
|
45554
|
-
|
|
45555
|
-
|
|
45556
|
-
|
|
45557
|
-
|
|
45558
|
-
|
|
45559
|
-
));
|
|
45151
|
+
length: contentLength,
|
|
45152
|
+
maxRate: utils.toFiniteNumber(maxUploadRate)
|
|
45153
|
+
})], utils.noop);
|
|
45154
|
+
|
|
45155
|
+
onUploadProgress && data.on('progress', progress => {
|
|
45156
|
+
onUploadProgress(Object.assign(progress, {
|
|
45157
|
+
upload: true
|
|
45158
|
+
}));
|
|
45159
|
+
});
|
|
45560
45160
|
}
|
|
45561
45161
|
|
|
45562
45162
|
// HTTP basic authentication
|
|
@@ -45603,18 +45203,14 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
45603
45203
|
agents: { http: config.httpAgent, https: config.httpsAgent },
|
|
45604
45204
|
auth,
|
|
45605
45205
|
protocol,
|
|
45606
|
-
family,
|
|
45607
45206
|
beforeRedirect: dispatchBeforeRedirect,
|
|
45608
45207
|
beforeRedirects: {}
|
|
45609
45208
|
};
|
|
45610
45209
|
|
|
45611
|
-
// cacheable-lookup integration hotfix
|
|
45612
|
-
!utils$1.isUndefined(lookup) && (options.lookup = lookup);
|
|
45613
|
-
|
|
45614
45210
|
if (config.socketPath) {
|
|
45615
45211
|
options.socketPath = config.socketPath;
|
|
45616
45212
|
} else {
|
|
45617
|
-
options.hostname = parsed.hostname
|
|
45213
|
+
options.hostname = parsed.hostname;
|
|
45618
45214
|
options.port = parsed.port;
|
|
45619
45215
|
setProxy(options, config.proxy, protocol + '//' + parsed.hostname + (parsed.port ? ':' + parsed.port : '') + options.path);
|
|
45620
45216
|
}
|
|
@@ -45655,18 +45251,17 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
45655
45251
|
|
|
45656
45252
|
const responseLength = +res.headers['content-length'];
|
|
45657
45253
|
|
|
45658
|
-
if (onDownloadProgress
|
|
45254
|
+
if (onDownloadProgress) {
|
|
45659
45255
|
const transformStream = new AxiosTransformStream({
|
|
45660
|
-
|
|
45256
|
+
length: utils.toFiniteNumber(responseLength),
|
|
45257
|
+
maxRate: utils.toFiniteNumber(maxDownloadRate)
|
|
45661
45258
|
});
|
|
45662
45259
|
|
|
45663
|
-
onDownloadProgress && transformStream.on('progress',
|
|
45664
|
-
|
|
45665
|
-
|
|
45666
|
-
|
|
45667
|
-
|
|
45668
|
-
)
|
|
45669
|
-
));
|
|
45260
|
+
onDownloadProgress && transformStream.on('progress', progress => {
|
|
45261
|
+
onDownloadProgress(Object.assign(progress, {
|
|
45262
|
+
download: true
|
|
45263
|
+
}));
|
|
45264
|
+
});
|
|
45670
45265
|
|
|
45671
45266
|
streams.push(transformStream);
|
|
45672
45267
|
}
|
|
@@ -45685,21 +45280,13 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
45685
45280
|
delete res.headers['content-encoding'];
|
|
45686
45281
|
}
|
|
45687
45282
|
|
|
45688
|
-
switch (
|
|
45283
|
+
switch (res.headers['content-encoding']) {
|
|
45689
45284
|
/*eslint default-case:0*/
|
|
45690
45285
|
case 'gzip':
|
|
45691
45286
|
case 'x-gzip':
|
|
45692
45287
|
case 'compress':
|
|
45693
45288
|
case 'x-compress':
|
|
45694
|
-
// add the unzipper to the body stream processing pipeline
|
|
45695
|
-
streams.push(zlib.createUnzip(zlibOptions));
|
|
45696
|
-
|
|
45697
|
-
// remove the content-encoding in order to not confuse downstream operations
|
|
45698
|
-
delete res.headers['content-encoding'];
|
|
45699
|
-
break;
|
|
45700
45289
|
case 'deflate':
|
|
45701
|
-
streams.push(new ZlibHeaderTransformStream());
|
|
45702
|
-
|
|
45703
45290
|
// add the unzipper to the body stream processing pipeline
|
|
45704
45291
|
streams.push(zlib.createUnzip(zlibOptions));
|
|
45705
45292
|
|
|
@@ -45714,7 +45301,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
45714
45301
|
}
|
|
45715
45302
|
}
|
|
45716
45303
|
|
|
45717
|
-
responseStream = streams.length > 1 ? stream.pipeline(streams, utils
|
|
45304
|
+
responseStream = streams.length > 1 ? stream.pipeline(streams, utils.noop) : streams[0];
|
|
45718
45305
|
|
|
45719
45306
|
const offListeners = stream.finished(responseStream, () => {
|
|
45720
45307
|
offListeners();
|
|
@@ -45756,7 +45343,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
45756
45343
|
}
|
|
45757
45344
|
|
|
45758
45345
|
const err = new AxiosError(
|
|
45759
|
-
'
|
|
45346
|
+
'maxContentLength size of ' + config.maxContentLength + ' exceeded',
|
|
45760
45347
|
AxiosError.ERR_BAD_RESPONSE,
|
|
45761
45348
|
config,
|
|
45762
45349
|
lastRequest
|
|
@@ -45776,12 +45363,12 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
45776
45363
|
if (responseType !== 'arraybuffer') {
|
|
45777
45364
|
responseData = responseData.toString(responseEncoding);
|
|
45778
45365
|
if (!responseEncoding || responseEncoding === 'utf8') {
|
|
45779
|
-
responseData = utils
|
|
45366
|
+
responseData = utils.stripBOM(responseData);
|
|
45780
45367
|
}
|
|
45781
45368
|
}
|
|
45782
45369
|
response.data = responseData;
|
|
45783
45370
|
} catch (err) {
|
|
45784
|
-
|
|
45371
|
+
reject(AxiosError.from(err, null, config, response.request, response));
|
|
45785
45372
|
}
|
|
45786
45373
|
settle(resolve, reject, response);
|
|
45787
45374
|
});
|
|
@@ -45818,7 +45405,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
45818
45405
|
// This is forcing a int timeout to avoid problems if the `req` interface doesn't handle other types.
|
|
45819
45406
|
const timeout = parseInt(config.timeout, 10);
|
|
45820
45407
|
|
|
45821
|
-
if (
|
|
45408
|
+
if (isNaN(timeout)) {
|
|
45822
45409
|
reject(new AxiosError(
|
|
45823
45410
|
'error trying to parse `config.timeout` to int',
|
|
45824
45411
|
AxiosError.ERR_BAD_OPTION_VALUE,
|
|
@@ -45853,7 +45440,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
45853
45440
|
|
|
45854
45441
|
|
|
45855
45442
|
// Send the request
|
|
45856
|
-
if (utils
|
|
45443
|
+
if (utils.isStream(data)) {
|
|
45857
45444
|
let ended = false;
|
|
45858
45445
|
let errored = false;
|
|
45859
45446
|
|
|
@@ -45879,235 +45466,72 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
45879
45466
|
});
|
|
45880
45467
|
};
|
|
45881
45468
|
|
|
45882
|
-
|
|
45883
|
-
|
|
45884
|
-
|
|
45885
|
-
return (
|
|
45886
|
-
origin.protocol === url.protocol &&
|
|
45887
|
-
origin.host === url.host &&
|
|
45888
|
-
(isMSIE || origin.port === url.port)
|
|
45889
|
-
);
|
|
45890
|
-
})(
|
|
45891
|
-
new URL(platform.origin),
|
|
45892
|
-
platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
|
|
45893
|
-
) : () => true;
|
|
45894
|
-
|
|
45895
|
-
var cookies = platform.hasStandardBrowserEnv ?
|
|
45896
|
-
|
|
45897
|
-
// Standard browser envs support document.cookie
|
|
45898
|
-
{
|
|
45899
|
-
write(name, value, expires, path, domain, secure) {
|
|
45900
|
-
const cookie = [name + '=' + encodeURIComponent(value)];
|
|
45901
|
-
|
|
45902
|
-
utils$1.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());
|
|
45903
|
-
|
|
45904
|
-
utils$1.isString(path) && cookie.push('path=' + path);
|
|
45905
|
-
|
|
45906
|
-
utils$1.isString(domain) && cookie.push('domain=' + domain);
|
|
45907
|
-
|
|
45908
|
-
secure === true && cookie.push('secure');
|
|
45909
|
-
|
|
45910
|
-
document.cookie = cookie.join('; ');
|
|
45911
|
-
},
|
|
45912
|
-
|
|
45913
|
-
read(name) {
|
|
45914
|
-
const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
|
|
45915
|
-
return (match ? decodeURIComponent(match[3]) : null);
|
|
45916
|
-
},
|
|
45917
|
-
|
|
45918
|
-
remove(name) {
|
|
45919
|
-
this.write(name, '', Date.now() - 86400000);
|
|
45920
|
-
}
|
|
45921
|
-
}
|
|
45922
|
-
|
|
45923
|
-
:
|
|
45924
|
-
|
|
45925
|
-
// Non-standard browser env (web workers, react-native) lack needed support.
|
|
45926
|
-
{
|
|
45927
|
-
write() {},
|
|
45928
|
-
read() {
|
|
45929
|
-
return null;
|
|
45930
|
-
},
|
|
45931
|
-
remove() {}
|
|
45932
|
-
};
|
|
45933
|
-
|
|
45934
|
-
const headersToObject = (thing) => thing instanceof AxiosHeaders ? { ...thing } : thing;
|
|
45935
|
-
|
|
45936
|
-
/**
|
|
45937
|
-
* Config-specific merge-function which creates a new config-object
|
|
45938
|
-
* by merging two configuration objects together.
|
|
45939
|
-
*
|
|
45940
|
-
* @param {Object} config1
|
|
45941
|
-
* @param {Object} config2
|
|
45942
|
-
*
|
|
45943
|
-
* @returns {Object} New object resulting from merging config2 to config1
|
|
45944
|
-
*/
|
|
45945
|
-
function mergeConfig(config1, config2) {
|
|
45946
|
-
// eslint-disable-next-line no-param-reassign
|
|
45947
|
-
config2 = config2 || {};
|
|
45948
|
-
const config = {};
|
|
45469
|
+
function progressEventReducer(listener, isDownloadStream) {
|
|
45470
|
+
let bytesNotified = 0;
|
|
45471
|
+
const _speedometer = speedometer(50, 250);
|
|
45949
45472
|
|
|
45950
|
-
|
|
45951
|
-
|
|
45952
|
-
|
|
45953
|
-
|
|
45954
|
-
|
|
45955
|
-
|
|
45956
|
-
return source.slice();
|
|
45957
|
-
}
|
|
45958
|
-
return source;
|
|
45959
|
-
}
|
|
45473
|
+
return e => {
|
|
45474
|
+
const loaded = e.loaded;
|
|
45475
|
+
const total = e.lengthComputable ? e.total : undefined;
|
|
45476
|
+
const progressBytes = loaded - bytesNotified;
|
|
45477
|
+
const rate = _speedometer(progressBytes);
|
|
45478
|
+
const inRange = loaded <= total;
|
|
45960
45479
|
|
|
45961
|
-
|
|
45962
|
-
function mergeDeepProperties(a, b, prop , caseless) {
|
|
45963
|
-
if (!utils$1.isUndefined(b)) {
|
|
45964
|
-
return getMergedValue(a, b, prop , caseless);
|
|
45965
|
-
} else if (!utils$1.isUndefined(a)) {
|
|
45966
|
-
return getMergedValue(undefined, a, prop , caseless);
|
|
45967
|
-
}
|
|
45968
|
-
}
|
|
45480
|
+
bytesNotified = loaded;
|
|
45969
45481
|
|
|
45970
|
-
|
|
45971
|
-
|
|
45972
|
-
|
|
45973
|
-
|
|
45974
|
-
|
|
45975
|
-
|
|
45482
|
+
const data = {
|
|
45483
|
+
loaded,
|
|
45484
|
+
total,
|
|
45485
|
+
progress: total ? (loaded / total) : undefined,
|
|
45486
|
+
bytes: progressBytes,
|
|
45487
|
+
rate: rate ? rate : undefined,
|
|
45488
|
+
estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
|
|
45489
|
+
event: e
|
|
45490
|
+
};
|
|
45976
45491
|
|
|
45977
|
-
|
|
45978
|
-
function defaultToConfig2(a, b) {
|
|
45979
|
-
if (!utils$1.isUndefined(b)) {
|
|
45980
|
-
return getMergedValue(undefined, b);
|
|
45981
|
-
} else if (!utils$1.isUndefined(a)) {
|
|
45982
|
-
return getMergedValue(undefined, a);
|
|
45983
|
-
}
|
|
45984
|
-
}
|
|
45492
|
+
data[isDownloadStream ? 'download' : 'upload'] = true;
|
|
45985
45493
|
|
|
45986
|
-
|
|
45987
|
-
function mergeDirectKeys(a, b, prop) {
|
|
45988
|
-
if (prop in config2) {
|
|
45989
|
-
return getMergedValue(a, b);
|
|
45990
|
-
} else if (prop in config1) {
|
|
45991
|
-
return getMergedValue(undefined, a);
|
|
45992
|
-
}
|
|
45993
|
-
}
|
|
45994
|
-
|
|
45995
|
-
const mergeMap = {
|
|
45996
|
-
url: valueFromConfig2,
|
|
45997
|
-
method: valueFromConfig2,
|
|
45998
|
-
data: valueFromConfig2,
|
|
45999
|
-
baseURL: defaultToConfig2,
|
|
46000
|
-
transformRequest: defaultToConfig2,
|
|
46001
|
-
transformResponse: defaultToConfig2,
|
|
46002
|
-
paramsSerializer: defaultToConfig2,
|
|
46003
|
-
timeout: defaultToConfig2,
|
|
46004
|
-
timeoutMessage: defaultToConfig2,
|
|
46005
|
-
withCredentials: defaultToConfig2,
|
|
46006
|
-
withXSRFToken: defaultToConfig2,
|
|
46007
|
-
adapter: defaultToConfig2,
|
|
46008
|
-
responseType: defaultToConfig2,
|
|
46009
|
-
xsrfCookieName: defaultToConfig2,
|
|
46010
|
-
xsrfHeaderName: defaultToConfig2,
|
|
46011
|
-
onUploadProgress: defaultToConfig2,
|
|
46012
|
-
onDownloadProgress: defaultToConfig2,
|
|
46013
|
-
decompress: defaultToConfig2,
|
|
46014
|
-
maxContentLength: defaultToConfig2,
|
|
46015
|
-
maxBodyLength: defaultToConfig2,
|
|
46016
|
-
beforeRedirect: defaultToConfig2,
|
|
46017
|
-
transport: defaultToConfig2,
|
|
46018
|
-
httpAgent: defaultToConfig2,
|
|
46019
|
-
httpsAgent: defaultToConfig2,
|
|
46020
|
-
cancelToken: defaultToConfig2,
|
|
46021
|
-
socketPath: defaultToConfig2,
|
|
46022
|
-
responseEncoding: defaultToConfig2,
|
|
46023
|
-
validateStatus: mergeDirectKeys,
|
|
46024
|
-
headers: (a, b , prop) => mergeDeepProperties(headersToObject(a), headersToObject(b),prop, true)
|
|
45494
|
+
listener(data);
|
|
46025
45495
|
};
|
|
46026
|
-
|
|
46027
|
-
utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
|
|
46028
|
-
const merge = mergeMap[prop] || mergeDeepProperties;
|
|
46029
|
-
const configValue = merge(config1[prop], config2[prop], prop);
|
|
46030
|
-
(utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
|
46031
|
-
});
|
|
46032
|
-
|
|
46033
|
-
return config;
|
|
46034
45496
|
}
|
|
46035
45497
|
|
|
46036
|
-
var resolveConfig = (config) => {
|
|
46037
|
-
const newConfig = mergeConfig({}, config);
|
|
46038
|
-
|
|
46039
|
-
let {data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth} = newConfig;
|
|
46040
|
-
|
|
46041
|
-
newConfig.headers = headers = AxiosHeaders.from(headers);
|
|
46042
|
-
|
|
46043
|
-
newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url), config.params, config.paramsSerializer);
|
|
46044
|
-
|
|
46045
|
-
// HTTP basic authentication
|
|
46046
|
-
if (auth) {
|
|
46047
|
-
headers.set('Authorization', 'Basic ' +
|
|
46048
|
-
btoa((auth.username || '') + ':' + (auth.password ? unescape(encodeURIComponent(auth.password)) : ''))
|
|
46049
|
-
);
|
|
46050
|
-
}
|
|
46051
|
-
|
|
46052
|
-
let contentType;
|
|
46053
|
-
|
|
46054
|
-
if (utils$1.isFormData(data)) {
|
|
46055
|
-
if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
|
|
46056
|
-
headers.setContentType(undefined); // Let the browser set it
|
|
46057
|
-
} else if ((contentType = headers.getContentType()) !== false) {
|
|
46058
|
-
// fix semicolon duplication issue for ReactNative FormData implementation
|
|
46059
|
-
const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];
|
|
46060
|
-
headers.setContentType([type || 'multipart/form-data', ...tokens].join('; '));
|
|
46061
|
-
}
|
|
46062
|
-
}
|
|
46063
|
-
|
|
46064
|
-
// Add xsrf header
|
|
46065
|
-
// This is only done if running in a standard browser environment.
|
|
46066
|
-
// Specifically not if we're in a web worker, or react-native.
|
|
46067
|
-
|
|
46068
|
-
if (platform.hasStandardBrowserEnv) {
|
|
46069
|
-
withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
|
|
46070
|
-
|
|
46071
|
-
if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(newConfig.url))) {
|
|
46072
|
-
// Add xsrf header
|
|
46073
|
-
const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
|
|
46074
|
-
|
|
46075
|
-
if (xsrfValue) {
|
|
46076
|
-
headers.set(xsrfHeaderName, xsrfValue);
|
|
46077
|
-
}
|
|
46078
|
-
}
|
|
46079
|
-
}
|
|
46080
|
-
|
|
46081
|
-
return newConfig;
|
|
46082
|
-
};
|
|
46083
|
-
|
|
46084
45498
|
const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
|
|
46085
45499
|
|
|
46086
45500
|
var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
46087
45501
|
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
|
46088
|
-
|
|
46089
|
-
|
|
46090
|
-
const
|
|
46091
|
-
let {responseType, onUploadProgress, onDownloadProgress} = _config;
|
|
45502
|
+
let requestData = config.data;
|
|
45503
|
+
const requestHeaders = AxiosHeaders.from(config.headers).normalize();
|
|
45504
|
+
const responseType = config.responseType;
|
|
46092
45505
|
let onCanceled;
|
|
46093
|
-
let uploadThrottled, downloadThrottled;
|
|
46094
|
-
let flushUpload, flushDownload;
|
|
46095
|
-
|
|
46096
45506
|
function done() {
|
|
46097
|
-
|
|
46098
|
-
|
|
45507
|
+
if (config.cancelToken) {
|
|
45508
|
+
config.cancelToken.unsubscribe(onCanceled);
|
|
45509
|
+
}
|
|
46099
45510
|
|
|
46100
|
-
|
|
45511
|
+
if (config.signal) {
|
|
45512
|
+
config.signal.removeEventListener('abort', onCanceled);
|
|
45513
|
+
}
|
|
45514
|
+
}
|
|
46101
45515
|
|
|
46102
|
-
|
|
45516
|
+
if (utils.isFormData(requestData) && (platform.isStandardBrowserWebWorkerEnv)) {
|
|
45517
|
+
requestHeaders.setContentType(false); // Let the browser set it
|
|
46103
45518
|
}
|
|
46104
45519
|
|
|
46105
45520
|
let request = new XMLHttpRequest();
|
|
46106
45521
|
|
|
46107
|
-
|
|
45522
|
+
// HTTP basic authentication
|
|
45523
|
+
if (config.auth) {
|
|
45524
|
+
const username = config.auth.username || '';
|
|
45525
|
+
const password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
|
|
45526
|
+
requestHeaders.set('Authorization', 'Basic ' + btoa(username + ':' + password));
|
|
45527
|
+
}
|
|
45528
|
+
|
|
45529
|
+
const fullPath = buildFullPath(config.baseURL, config.url);
|
|
45530
|
+
|
|
45531
|
+
request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
|
|
46108
45532
|
|
|
46109
45533
|
// Set the request timeout in MS
|
|
46110
|
-
request.timeout =
|
|
45534
|
+
request.timeout = config.timeout;
|
|
46111
45535
|
|
|
46112
45536
|
function onloadend() {
|
|
46113
45537
|
if (!request) {
|
|
@@ -46187,10 +45611,10 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
|
46187
45611
|
|
|
46188
45612
|
// Handle timeout
|
|
46189
45613
|
request.ontimeout = function handleTimeout() {
|
|
46190
|
-
let timeoutErrorMessage =
|
|
46191
|
-
const transitional =
|
|
46192
|
-
if (
|
|
46193
|
-
timeoutErrorMessage =
|
|
45614
|
+
let timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
|
|
45615
|
+
const transitional = config.transitional || transitionalDefaults;
|
|
45616
|
+
if (config.timeoutErrorMessage) {
|
|
45617
|
+
timeoutErrorMessage = config.timeoutErrorMessage;
|
|
46194
45618
|
}
|
|
46195
45619
|
reject(new AxiosError(
|
|
46196
45620
|
timeoutErrorMessage,
|
|
@@ -46207,37 +45631,32 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
|
46207
45631
|
|
|
46208
45632
|
// Add headers to the request
|
|
46209
45633
|
if ('setRequestHeader' in request) {
|
|
46210
|
-
utils
|
|
45634
|
+
utils.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
|
|
46211
45635
|
request.setRequestHeader(key, val);
|
|
46212
45636
|
});
|
|
46213
45637
|
}
|
|
46214
45638
|
|
|
46215
45639
|
// Add withCredentials to request if needed
|
|
46216
|
-
if (!utils
|
|
46217
|
-
request.withCredentials = !!
|
|
45640
|
+
if (!utils.isUndefined(config.withCredentials)) {
|
|
45641
|
+
request.withCredentials = !!config.withCredentials;
|
|
46218
45642
|
}
|
|
46219
45643
|
|
|
46220
45644
|
// Add responseType to request if needed
|
|
46221
45645
|
if (responseType && responseType !== 'json') {
|
|
46222
|
-
request.responseType =
|
|
45646
|
+
request.responseType = config.responseType;
|
|
46223
45647
|
}
|
|
46224
45648
|
|
|
46225
45649
|
// Handle progress if needed
|
|
46226
|
-
if (onDownloadProgress) {
|
|
46227
|
-
(
|
|
46228
|
-
request.addEventListener('progress', downloadThrottled);
|
|
45650
|
+
if (typeof config.onDownloadProgress === 'function') {
|
|
45651
|
+
request.addEventListener('progress', progressEventReducer(config.onDownloadProgress, true));
|
|
46229
45652
|
}
|
|
46230
45653
|
|
|
46231
45654
|
// Not all browsers support upload events
|
|
46232
|
-
if (onUploadProgress && request.upload) {
|
|
46233
|
-
(
|
|
46234
|
-
|
|
46235
|
-
request.upload.addEventListener('progress', uploadThrottled);
|
|
46236
|
-
|
|
46237
|
-
request.upload.addEventListener('loadend', flushUpload);
|
|
45655
|
+
if (typeof config.onUploadProgress === 'function' && request.upload) {
|
|
45656
|
+
request.upload.addEventListener('progress', progressEventReducer(config.onUploadProgress));
|
|
46238
45657
|
}
|
|
46239
45658
|
|
|
46240
|
-
if (
|
|
45659
|
+
if (config.cancelToken || config.signal) {
|
|
46241
45660
|
// Handle cancellation
|
|
46242
45661
|
// eslint-disable-next-line func-names
|
|
46243
45662
|
onCanceled = cancel => {
|
|
@@ -46249,13 +45668,13 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
|
46249
45668
|
request = null;
|
|
46250
45669
|
};
|
|
46251
45670
|
|
|
46252
|
-
|
|
46253
|
-
if (
|
|
46254
|
-
|
|
45671
|
+
config.cancelToken && config.cancelToken.subscribe(onCanceled);
|
|
45672
|
+
if (config.signal) {
|
|
45673
|
+
config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled);
|
|
46255
45674
|
}
|
|
46256
45675
|
}
|
|
46257
45676
|
|
|
46258
|
-
const protocol = parseProtocol(
|
|
45677
|
+
const protocol = parseProtocol(fullPath);
|
|
46259
45678
|
|
|
46260
45679
|
if (protocol && platform.protocols.indexOf(protocol) === -1) {
|
|
46261
45680
|
reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
|
|
@@ -46268,362 +45687,13 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
|
46268
45687
|
});
|
|
46269
45688
|
};
|
|
46270
45689
|
|
|
46271
|
-
const composeSignals = (signals, timeout) => {
|
|
46272
|
-
const {length} = (signals = signals ? signals.filter(Boolean) : []);
|
|
46273
|
-
|
|
46274
|
-
if (timeout || length) {
|
|
46275
|
-
let controller = new AbortController();
|
|
46276
|
-
|
|
46277
|
-
let aborted;
|
|
46278
|
-
|
|
46279
|
-
const onabort = function (reason) {
|
|
46280
|
-
if (!aborted) {
|
|
46281
|
-
aborted = true;
|
|
46282
|
-
unsubscribe();
|
|
46283
|
-
const err = reason instanceof Error ? reason : this.reason;
|
|
46284
|
-
controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));
|
|
46285
|
-
}
|
|
46286
|
-
};
|
|
46287
|
-
|
|
46288
|
-
let timer = timeout && setTimeout(() => {
|
|
46289
|
-
timer = null;
|
|
46290
|
-
onabort(new AxiosError(`timeout ${timeout} of ms exceeded`, AxiosError.ETIMEDOUT));
|
|
46291
|
-
}, timeout);
|
|
46292
|
-
|
|
46293
|
-
const unsubscribe = () => {
|
|
46294
|
-
if (signals) {
|
|
46295
|
-
timer && clearTimeout(timer);
|
|
46296
|
-
timer = null;
|
|
46297
|
-
signals.forEach(signal => {
|
|
46298
|
-
signal.unsubscribe ? signal.unsubscribe(onabort) : signal.removeEventListener('abort', onabort);
|
|
46299
|
-
});
|
|
46300
|
-
signals = null;
|
|
46301
|
-
}
|
|
46302
|
-
};
|
|
46303
|
-
|
|
46304
|
-
signals.forEach((signal) => signal.addEventListener('abort', onabort));
|
|
46305
|
-
|
|
46306
|
-
const {signal} = controller;
|
|
46307
|
-
|
|
46308
|
-
signal.unsubscribe = () => utils$1.asap(unsubscribe);
|
|
46309
|
-
|
|
46310
|
-
return signal;
|
|
46311
|
-
}
|
|
46312
|
-
};
|
|
46313
|
-
|
|
46314
|
-
const streamChunk = function* (chunk, chunkSize) {
|
|
46315
|
-
let len = chunk.byteLength;
|
|
46316
|
-
|
|
46317
|
-
if (!chunkSize || len < chunkSize) {
|
|
46318
|
-
yield chunk;
|
|
46319
|
-
return;
|
|
46320
|
-
}
|
|
46321
|
-
|
|
46322
|
-
let pos = 0;
|
|
46323
|
-
let end;
|
|
46324
|
-
|
|
46325
|
-
while (pos < len) {
|
|
46326
|
-
end = pos + chunkSize;
|
|
46327
|
-
yield chunk.slice(pos, end);
|
|
46328
|
-
pos = end;
|
|
46329
|
-
}
|
|
46330
|
-
};
|
|
46331
|
-
|
|
46332
|
-
const readBytes = async function* (iterable, chunkSize) {
|
|
46333
|
-
for await (const chunk of readStream(iterable)) {
|
|
46334
|
-
yield* streamChunk(chunk, chunkSize);
|
|
46335
|
-
}
|
|
46336
|
-
};
|
|
46337
|
-
|
|
46338
|
-
const readStream = async function* (stream) {
|
|
46339
|
-
if (stream[Symbol.asyncIterator]) {
|
|
46340
|
-
yield* stream;
|
|
46341
|
-
return;
|
|
46342
|
-
}
|
|
46343
|
-
|
|
46344
|
-
const reader = stream.getReader();
|
|
46345
|
-
try {
|
|
46346
|
-
for (;;) {
|
|
46347
|
-
const {done, value} = await reader.read();
|
|
46348
|
-
if (done) {
|
|
46349
|
-
break;
|
|
46350
|
-
}
|
|
46351
|
-
yield value;
|
|
46352
|
-
}
|
|
46353
|
-
} finally {
|
|
46354
|
-
await reader.cancel();
|
|
46355
|
-
}
|
|
46356
|
-
};
|
|
46357
|
-
|
|
46358
|
-
const trackStream = (stream, chunkSize, onProgress, onFinish) => {
|
|
46359
|
-
const iterator = readBytes(stream, chunkSize);
|
|
46360
|
-
|
|
46361
|
-
let bytes = 0;
|
|
46362
|
-
let done;
|
|
46363
|
-
let _onFinish = (e) => {
|
|
46364
|
-
if (!done) {
|
|
46365
|
-
done = true;
|
|
46366
|
-
onFinish && onFinish(e);
|
|
46367
|
-
}
|
|
46368
|
-
};
|
|
46369
|
-
|
|
46370
|
-
return new ReadableStream({
|
|
46371
|
-
async pull(controller) {
|
|
46372
|
-
try {
|
|
46373
|
-
const {done, value} = await iterator.next();
|
|
46374
|
-
|
|
46375
|
-
if (done) {
|
|
46376
|
-
_onFinish();
|
|
46377
|
-
controller.close();
|
|
46378
|
-
return;
|
|
46379
|
-
}
|
|
46380
|
-
|
|
46381
|
-
let len = value.byteLength;
|
|
46382
|
-
if (onProgress) {
|
|
46383
|
-
let loadedBytes = bytes += len;
|
|
46384
|
-
onProgress(loadedBytes);
|
|
46385
|
-
}
|
|
46386
|
-
controller.enqueue(new Uint8Array(value));
|
|
46387
|
-
} catch (err) {
|
|
46388
|
-
_onFinish(err);
|
|
46389
|
-
throw err;
|
|
46390
|
-
}
|
|
46391
|
-
},
|
|
46392
|
-
cancel(reason) {
|
|
46393
|
-
_onFinish(reason);
|
|
46394
|
-
return iterator.return();
|
|
46395
|
-
}
|
|
46396
|
-
}, {
|
|
46397
|
-
highWaterMark: 2
|
|
46398
|
-
})
|
|
46399
|
-
};
|
|
46400
|
-
|
|
46401
|
-
const isFetchSupported = typeof fetch === 'function' && typeof Request === 'function' && typeof Response === 'function';
|
|
46402
|
-
const isReadableStreamSupported = isFetchSupported && typeof ReadableStream === 'function';
|
|
46403
|
-
|
|
46404
|
-
// used only inside the fetch adapter
|
|
46405
|
-
const encodeText = isFetchSupported && (typeof TextEncoder === 'function' ?
|
|
46406
|
-
((encoder) => (str) => encoder.encode(str))(new TextEncoder()) :
|
|
46407
|
-
async (str) => new Uint8Array(await new Response(str).arrayBuffer())
|
|
46408
|
-
);
|
|
46409
|
-
|
|
46410
|
-
const test = (fn, ...args) => {
|
|
46411
|
-
try {
|
|
46412
|
-
return !!fn(...args);
|
|
46413
|
-
} catch (e) {
|
|
46414
|
-
return false
|
|
46415
|
-
}
|
|
46416
|
-
};
|
|
46417
|
-
|
|
46418
|
-
const supportsRequestStream = isReadableStreamSupported && test(() => {
|
|
46419
|
-
let duplexAccessed = false;
|
|
46420
|
-
|
|
46421
|
-
const hasContentType = new Request(platform.origin, {
|
|
46422
|
-
body: new ReadableStream(),
|
|
46423
|
-
method: 'POST',
|
|
46424
|
-
get duplex() {
|
|
46425
|
-
duplexAccessed = true;
|
|
46426
|
-
return 'half';
|
|
46427
|
-
},
|
|
46428
|
-
}).headers.has('Content-Type');
|
|
46429
|
-
|
|
46430
|
-
return duplexAccessed && !hasContentType;
|
|
46431
|
-
});
|
|
46432
|
-
|
|
46433
|
-
const DEFAULT_CHUNK_SIZE = 64 * 1024;
|
|
46434
|
-
|
|
46435
|
-
const supportsResponseStream = isReadableStreamSupported &&
|
|
46436
|
-
test(() => utils$1.isReadableStream(new Response('').body));
|
|
46437
|
-
|
|
46438
|
-
|
|
46439
|
-
const resolvers = {
|
|
46440
|
-
stream: supportsResponseStream && ((res) => res.body)
|
|
46441
|
-
};
|
|
46442
|
-
|
|
46443
|
-
isFetchSupported && (((res) => {
|
|
46444
|
-
['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {
|
|
46445
|
-
!resolvers[type] && (resolvers[type] = utils$1.isFunction(res[type]) ? (res) => res[type]() :
|
|
46446
|
-
(_, config) => {
|
|
46447
|
-
throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config);
|
|
46448
|
-
});
|
|
46449
|
-
});
|
|
46450
|
-
})(new Response));
|
|
46451
|
-
|
|
46452
|
-
const getBodyLength = async (body) => {
|
|
46453
|
-
if (body == null) {
|
|
46454
|
-
return 0;
|
|
46455
|
-
}
|
|
46456
|
-
|
|
46457
|
-
if(utils$1.isBlob(body)) {
|
|
46458
|
-
return body.size;
|
|
46459
|
-
}
|
|
46460
|
-
|
|
46461
|
-
if(utils$1.isSpecCompliantForm(body)) {
|
|
46462
|
-
const _request = new Request(platform.origin, {
|
|
46463
|
-
method: 'POST',
|
|
46464
|
-
body,
|
|
46465
|
-
});
|
|
46466
|
-
return (await _request.arrayBuffer()).byteLength;
|
|
46467
|
-
}
|
|
46468
|
-
|
|
46469
|
-
if(utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
|
|
46470
|
-
return body.byteLength;
|
|
46471
|
-
}
|
|
46472
|
-
|
|
46473
|
-
if(utils$1.isURLSearchParams(body)) {
|
|
46474
|
-
body = body + '';
|
|
46475
|
-
}
|
|
46476
|
-
|
|
46477
|
-
if(utils$1.isString(body)) {
|
|
46478
|
-
return (await encodeText(body)).byteLength;
|
|
46479
|
-
}
|
|
46480
|
-
};
|
|
46481
|
-
|
|
46482
|
-
const resolveBodyLength = async (headers, body) => {
|
|
46483
|
-
const length = utils$1.toFiniteNumber(headers.getContentLength());
|
|
46484
|
-
|
|
46485
|
-
return length == null ? getBodyLength(body) : length;
|
|
46486
|
-
};
|
|
46487
|
-
|
|
46488
|
-
var fetchAdapter = isFetchSupported && (async (config) => {
|
|
46489
|
-
let {
|
|
46490
|
-
url,
|
|
46491
|
-
method,
|
|
46492
|
-
data,
|
|
46493
|
-
signal,
|
|
46494
|
-
cancelToken,
|
|
46495
|
-
timeout,
|
|
46496
|
-
onDownloadProgress,
|
|
46497
|
-
onUploadProgress,
|
|
46498
|
-
responseType,
|
|
46499
|
-
headers,
|
|
46500
|
-
withCredentials = 'same-origin',
|
|
46501
|
-
fetchOptions
|
|
46502
|
-
} = resolveConfig(config);
|
|
46503
|
-
|
|
46504
|
-
responseType = responseType ? (responseType + '').toLowerCase() : 'text';
|
|
46505
|
-
|
|
46506
|
-
let composedSignal = composeSignals([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
|
|
46507
|
-
|
|
46508
|
-
let request;
|
|
46509
|
-
|
|
46510
|
-
const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
|
|
46511
|
-
composedSignal.unsubscribe();
|
|
46512
|
-
});
|
|
46513
|
-
|
|
46514
|
-
let requestContentLength;
|
|
46515
|
-
|
|
46516
|
-
try {
|
|
46517
|
-
if (
|
|
46518
|
-
onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' &&
|
|
46519
|
-
(requestContentLength = await resolveBodyLength(headers, data)) !== 0
|
|
46520
|
-
) {
|
|
46521
|
-
let _request = new Request(url, {
|
|
46522
|
-
method: 'POST',
|
|
46523
|
-
body: data,
|
|
46524
|
-
duplex: "half"
|
|
46525
|
-
});
|
|
46526
|
-
|
|
46527
|
-
let contentTypeHeader;
|
|
46528
|
-
|
|
46529
|
-
if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
|
|
46530
|
-
headers.setContentType(contentTypeHeader);
|
|
46531
|
-
}
|
|
46532
|
-
|
|
46533
|
-
if (_request.body) {
|
|
46534
|
-
const [onProgress, flush] = progressEventDecorator(
|
|
46535
|
-
requestContentLength,
|
|
46536
|
-
progressEventReducer(asyncDecorator(onUploadProgress))
|
|
46537
|
-
);
|
|
46538
|
-
|
|
46539
|
-
data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
|
|
46540
|
-
}
|
|
46541
|
-
}
|
|
46542
|
-
|
|
46543
|
-
if (!utils$1.isString(withCredentials)) {
|
|
46544
|
-
withCredentials = withCredentials ? 'include' : 'omit';
|
|
46545
|
-
}
|
|
46546
|
-
|
|
46547
|
-
// Cloudflare Workers throws when credentials are defined
|
|
46548
|
-
// see https://github.com/cloudflare/workerd/issues/902
|
|
46549
|
-
const isCredentialsSupported = "credentials" in Request.prototype;
|
|
46550
|
-
request = new Request(url, {
|
|
46551
|
-
...fetchOptions,
|
|
46552
|
-
signal: composedSignal,
|
|
46553
|
-
method: method.toUpperCase(),
|
|
46554
|
-
headers: headers.normalize().toJSON(),
|
|
46555
|
-
body: data,
|
|
46556
|
-
duplex: "half",
|
|
46557
|
-
credentials: isCredentialsSupported ? withCredentials : undefined
|
|
46558
|
-
});
|
|
46559
|
-
|
|
46560
|
-
let response = await fetch(request);
|
|
46561
|
-
|
|
46562
|
-
const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
|
|
46563
|
-
|
|
46564
|
-
if (supportsResponseStream && (onDownloadProgress || (isStreamResponse && unsubscribe))) {
|
|
46565
|
-
const options = {};
|
|
46566
|
-
|
|
46567
|
-
['status', 'statusText', 'headers'].forEach(prop => {
|
|
46568
|
-
options[prop] = response[prop];
|
|
46569
|
-
});
|
|
46570
|
-
|
|
46571
|
-
const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
|
|
46572
|
-
|
|
46573
|
-
const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
|
|
46574
|
-
responseContentLength,
|
|
46575
|
-
progressEventReducer(asyncDecorator(onDownloadProgress), true)
|
|
46576
|
-
) || [];
|
|
46577
|
-
|
|
46578
|
-
response = new Response(
|
|
46579
|
-
trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
|
|
46580
|
-
flush && flush();
|
|
46581
|
-
unsubscribe && unsubscribe();
|
|
46582
|
-
}),
|
|
46583
|
-
options
|
|
46584
|
-
);
|
|
46585
|
-
}
|
|
46586
|
-
|
|
46587
|
-
responseType = responseType || 'text';
|
|
46588
|
-
|
|
46589
|
-
let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
|
|
46590
|
-
|
|
46591
|
-
!isStreamResponse && unsubscribe && unsubscribe();
|
|
46592
|
-
|
|
46593
|
-
return await new Promise((resolve, reject) => {
|
|
46594
|
-
settle(resolve, reject, {
|
|
46595
|
-
data: responseData,
|
|
46596
|
-
headers: AxiosHeaders.from(response.headers),
|
|
46597
|
-
status: response.status,
|
|
46598
|
-
statusText: response.statusText,
|
|
46599
|
-
config,
|
|
46600
|
-
request
|
|
46601
|
-
});
|
|
46602
|
-
})
|
|
46603
|
-
} catch (err) {
|
|
46604
|
-
unsubscribe && unsubscribe();
|
|
46605
|
-
|
|
46606
|
-
if (err && err.name === 'TypeError' && /fetch/i.test(err.message)) {
|
|
46607
|
-
throw Object.assign(
|
|
46608
|
-
new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request),
|
|
46609
|
-
{
|
|
46610
|
-
cause: err.cause || err
|
|
46611
|
-
}
|
|
46612
|
-
)
|
|
46613
|
-
}
|
|
46614
|
-
|
|
46615
|
-
throw AxiosError.from(err, err && err.code, config, request);
|
|
46616
|
-
}
|
|
46617
|
-
});
|
|
46618
|
-
|
|
46619
45690
|
const knownAdapters = {
|
|
46620
45691
|
http: httpAdapter,
|
|
46621
|
-
xhr: xhrAdapter
|
|
46622
|
-
fetch: fetchAdapter
|
|
45692
|
+
xhr: xhrAdapter
|
|
46623
45693
|
};
|
|
46624
45694
|
|
|
46625
|
-
utils
|
|
46626
|
-
if
|
|
45695
|
+
utils.forEach(knownAdapters, (fn, value) => {
|
|
45696
|
+
if(fn) {
|
|
46627
45697
|
try {
|
|
46628
45698
|
Object.defineProperty(fn, 'name', {value});
|
|
46629
45699
|
} catch (e) {
|
|
@@ -46633,58 +45703,40 @@ utils$1.forEach(knownAdapters, (fn, value) => {
|
|
|
46633
45703
|
}
|
|
46634
45704
|
});
|
|
46635
45705
|
|
|
46636
|
-
const renderReason = (reason) => `- ${reason}`;
|
|
46637
|
-
|
|
46638
|
-
const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
|
|
46639
|
-
|
|
46640
45706
|
var adapters = {
|
|
46641
45707
|
getAdapter: (adapters) => {
|
|
46642
|
-
adapters = utils
|
|
45708
|
+
adapters = utils.isArray(adapters) ? adapters : [adapters];
|
|
46643
45709
|
|
|
46644
45710
|
const {length} = adapters;
|
|
46645
45711
|
let nameOrAdapter;
|
|
46646
45712
|
let adapter;
|
|
46647
45713
|
|
|
46648
|
-
const rejectedReasons = {};
|
|
46649
|
-
|
|
46650
45714
|
for (let i = 0; i < length; i++) {
|
|
46651
45715
|
nameOrAdapter = adapters[i];
|
|
46652
|
-
|
|
46653
|
-
|
|
46654
|
-
adapter = nameOrAdapter;
|
|
46655
|
-
|
|
46656
|
-
if (!isResolvedHandle(nameOrAdapter)) {
|
|
46657
|
-
adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
|
|
46658
|
-
|
|
46659
|
-
if (adapter === undefined) {
|
|
46660
|
-
throw new AxiosError(`Unknown adapter '${id}'`);
|
|
46661
|
-
}
|
|
46662
|
-
}
|
|
46663
|
-
|
|
46664
|
-
if (adapter) {
|
|
45716
|
+
if((adapter = utils.isString(nameOrAdapter) ? knownAdapters[nameOrAdapter.toLowerCase()] : nameOrAdapter)) {
|
|
46665
45717
|
break;
|
|
46666
45718
|
}
|
|
46667
|
-
|
|
46668
|
-
rejectedReasons[id || '#' + i] = adapter;
|
|
46669
45719
|
}
|
|
46670
45720
|
|
|
46671
45721
|
if (!adapter) {
|
|
46672
|
-
|
|
46673
|
-
|
|
46674
|
-
|
|
46675
|
-
|
|
45722
|
+
if (adapter === false) {
|
|
45723
|
+
throw new AxiosError(
|
|
45724
|
+
`Adapter ${nameOrAdapter} is not supported by the environment`,
|
|
45725
|
+
'ERR_NOT_SUPPORT'
|
|
46676
45726
|
);
|
|
45727
|
+
}
|
|
46677
45728
|
|
|
46678
|
-
|
|
46679
|
-
|
|
46680
|
-
|
|
46681
|
-
|
|
46682
|
-
throw new AxiosError(
|
|
46683
|
-
`There is no suitable adapter to dispatch the request ` + s,
|
|
46684
|
-
'ERR_NOT_SUPPORT'
|
|
45729
|
+
throw new Error(
|
|
45730
|
+
utils.hasOwnProp(knownAdapters, nameOrAdapter) ?
|
|
45731
|
+
`Adapter '${nameOrAdapter}' is not available in the build` :
|
|
45732
|
+
`Unknown adapter '${nameOrAdapter}'`
|
|
46685
45733
|
);
|
|
46686
45734
|
}
|
|
46687
45735
|
|
|
45736
|
+
if (!utils.isFunction(adapter)) {
|
|
45737
|
+
throw new TypeError('adapter is not a function');
|
|
45738
|
+
}
|
|
45739
|
+
|
|
46688
45740
|
return adapter;
|
|
46689
45741
|
},
|
|
46690
45742
|
adapters: knownAdapters
|
|
@@ -46763,6 +45815,107 @@ function dispatchRequest(config) {
|
|
|
46763
45815
|
});
|
|
46764
45816
|
}
|
|
46765
45817
|
|
|
45818
|
+
const headersToObject = (thing) => thing instanceof AxiosHeaders ? thing.toJSON() : thing;
|
|
45819
|
+
|
|
45820
|
+
/**
|
|
45821
|
+
* Config-specific merge-function which creates a new config-object
|
|
45822
|
+
* by merging two configuration objects together.
|
|
45823
|
+
*
|
|
45824
|
+
* @param {Object} config1
|
|
45825
|
+
* @param {Object} config2
|
|
45826
|
+
*
|
|
45827
|
+
* @returns {Object} New object resulting from merging config2 to config1
|
|
45828
|
+
*/
|
|
45829
|
+
function mergeConfig(config1, config2) {
|
|
45830
|
+
// eslint-disable-next-line no-param-reassign
|
|
45831
|
+
config2 = config2 || {};
|
|
45832
|
+
const config = {};
|
|
45833
|
+
|
|
45834
|
+
function getMergedValue(target, source, caseless) {
|
|
45835
|
+
if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
|
|
45836
|
+
return utils.merge.call({caseless}, target, source);
|
|
45837
|
+
} else if (utils.isPlainObject(source)) {
|
|
45838
|
+
return utils.merge({}, source);
|
|
45839
|
+
} else if (utils.isArray(source)) {
|
|
45840
|
+
return source.slice();
|
|
45841
|
+
}
|
|
45842
|
+
return source;
|
|
45843
|
+
}
|
|
45844
|
+
|
|
45845
|
+
// eslint-disable-next-line consistent-return
|
|
45846
|
+
function mergeDeepProperties(a, b, caseless) {
|
|
45847
|
+
if (!utils.isUndefined(b)) {
|
|
45848
|
+
return getMergedValue(a, b, caseless);
|
|
45849
|
+
} else if (!utils.isUndefined(a)) {
|
|
45850
|
+
return getMergedValue(undefined, a, caseless);
|
|
45851
|
+
}
|
|
45852
|
+
}
|
|
45853
|
+
|
|
45854
|
+
// eslint-disable-next-line consistent-return
|
|
45855
|
+
function valueFromConfig2(a, b) {
|
|
45856
|
+
if (!utils.isUndefined(b)) {
|
|
45857
|
+
return getMergedValue(undefined, b);
|
|
45858
|
+
}
|
|
45859
|
+
}
|
|
45860
|
+
|
|
45861
|
+
// eslint-disable-next-line consistent-return
|
|
45862
|
+
function defaultToConfig2(a, b) {
|
|
45863
|
+
if (!utils.isUndefined(b)) {
|
|
45864
|
+
return getMergedValue(undefined, b);
|
|
45865
|
+
} else if (!utils.isUndefined(a)) {
|
|
45866
|
+
return getMergedValue(undefined, a);
|
|
45867
|
+
}
|
|
45868
|
+
}
|
|
45869
|
+
|
|
45870
|
+
// eslint-disable-next-line consistent-return
|
|
45871
|
+
function mergeDirectKeys(a, b, prop) {
|
|
45872
|
+
if (prop in config2) {
|
|
45873
|
+
return getMergedValue(a, b);
|
|
45874
|
+
} else if (prop in config1) {
|
|
45875
|
+
return getMergedValue(undefined, a);
|
|
45876
|
+
}
|
|
45877
|
+
}
|
|
45878
|
+
|
|
45879
|
+
const mergeMap = {
|
|
45880
|
+
url: valueFromConfig2,
|
|
45881
|
+
method: valueFromConfig2,
|
|
45882
|
+
data: valueFromConfig2,
|
|
45883
|
+
baseURL: defaultToConfig2,
|
|
45884
|
+
transformRequest: defaultToConfig2,
|
|
45885
|
+
transformResponse: defaultToConfig2,
|
|
45886
|
+
paramsSerializer: defaultToConfig2,
|
|
45887
|
+
timeout: defaultToConfig2,
|
|
45888
|
+
timeoutMessage: defaultToConfig2,
|
|
45889
|
+
withCredentials: defaultToConfig2,
|
|
45890
|
+
adapter: defaultToConfig2,
|
|
45891
|
+
responseType: defaultToConfig2,
|
|
45892
|
+
xsrfCookieName: defaultToConfig2,
|
|
45893
|
+
xsrfHeaderName: defaultToConfig2,
|
|
45894
|
+
onUploadProgress: defaultToConfig2,
|
|
45895
|
+
onDownloadProgress: defaultToConfig2,
|
|
45896
|
+
decompress: defaultToConfig2,
|
|
45897
|
+
maxContentLength: defaultToConfig2,
|
|
45898
|
+
maxBodyLength: defaultToConfig2,
|
|
45899
|
+
beforeRedirect: defaultToConfig2,
|
|
45900
|
+
transport: defaultToConfig2,
|
|
45901
|
+
httpAgent: defaultToConfig2,
|
|
45902
|
+
httpsAgent: defaultToConfig2,
|
|
45903
|
+
cancelToken: defaultToConfig2,
|
|
45904
|
+
socketPath: defaultToConfig2,
|
|
45905
|
+
responseEncoding: defaultToConfig2,
|
|
45906
|
+
validateStatus: mergeDirectKeys,
|
|
45907
|
+
headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
|
|
45908
|
+
};
|
|
45909
|
+
|
|
45910
|
+
utils.forEach(Object.keys(config1).concat(Object.keys(config2)), function computeConfigValue(prop) {
|
|
45911
|
+
const merge = mergeMap[prop] || mergeDeepProperties;
|
|
45912
|
+
const configValue = merge(config1[prop], config2[prop], prop);
|
|
45913
|
+
(utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
|
45914
|
+
});
|
|
45915
|
+
|
|
45916
|
+
return config;
|
|
45917
|
+
}
|
|
45918
|
+
|
|
46766
45919
|
const validators$1 = {};
|
|
46767
45920
|
|
|
46768
45921
|
// eslint-disable-next-line func-names
|
|
@@ -46812,14 +45965,6 @@ validators$1.transitional = function transitional(validator, version, message) {
|
|
|
46812
45965
|
};
|
|
46813
45966
|
};
|
|
46814
45967
|
|
|
46815
|
-
validators$1.spelling = function spelling(correctSpelling) {
|
|
46816
|
-
return (value, opt) => {
|
|
46817
|
-
// eslint-disable-next-line no-console
|
|
46818
|
-
console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);
|
|
46819
|
-
return true;
|
|
46820
|
-
}
|
|
46821
|
-
};
|
|
46822
|
-
|
|
46823
45968
|
/**
|
|
46824
45969
|
* Assert object's properties type
|
|
46825
45970
|
*
|
|
@@ -46884,34 +46029,7 @@ class Axios {
|
|
|
46884
46029
|
*
|
|
46885
46030
|
* @returns {Promise} The Promise to be fulfilled
|
|
46886
46031
|
*/
|
|
46887
|
-
|
|
46888
|
-
try {
|
|
46889
|
-
return await this._request(configOrUrl, config);
|
|
46890
|
-
} catch (err) {
|
|
46891
|
-
if (err instanceof Error) {
|
|
46892
|
-
let dummy = {};
|
|
46893
|
-
|
|
46894
|
-
Error.captureStackTrace ? Error.captureStackTrace(dummy) : (dummy = new Error());
|
|
46895
|
-
|
|
46896
|
-
// slice off the Error: ... line
|
|
46897
|
-
const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : '';
|
|
46898
|
-
try {
|
|
46899
|
-
if (!err.stack) {
|
|
46900
|
-
err.stack = stack;
|
|
46901
|
-
// match without the 2 top stack lines
|
|
46902
|
-
} else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) {
|
|
46903
|
-
err.stack += '\n' + stack;
|
|
46904
|
-
}
|
|
46905
|
-
} catch (e) {
|
|
46906
|
-
// ignore the case where "stack" is an un-writable property
|
|
46907
|
-
}
|
|
46908
|
-
}
|
|
46909
|
-
|
|
46910
|
-
throw err;
|
|
46911
|
-
}
|
|
46912
|
-
}
|
|
46913
|
-
|
|
46914
|
-
_request(configOrUrl, config) {
|
|
46032
|
+
request(configOrUrl, config) {
|
|
46915
46033
|
/*eslint no-param-reassign:0*/
|
|
46916
46034
|
// Allow for axios('example/url'[, config]) a la fetch API
|
|
46917
46035
|
if (typeof configOrUrl === 'string') {
|
|
@@ -46933,34 +46051,25 @@ class Axios {
|
|
|
46933
46051
|
}, false);
|
|
46934
46052
|
}
|
|
46935
46053
|
|
|
46936
|
-
if (paramsSerializer
|
|
46937
|
-
|
|
46938
|
-
|
|
46939
|
-
|
|
46940
|
-
|
|
46941
|
-
} else {
|
|
46942
|
-
validator.assertOptions(paramsSerializer, {
|
|
46943
|
-
encode: validators.function,
|
|
46944
|
-
serialize: validators.function
|
|
46945
|
-
}, true);
|
|
46946
|
-
}
|
|
46054
|
+
if (paramsSerializer !== undefined) {
|
|
46055
|
+
validator.assertOptions(paramsSerializer, {
|
|
46056
|
+
encode: validators.function,
|
|
46057
|
+
serialize: validators.function
|
|
46058
|
+
}, true);
|
|
46947
46059
|
}
|
|
46948
46060
|
|
|
46949
|
-
validator.assertOptions(config, {
|
|
46950
|
-
baseUrl: validators.spelling('baseURL'),
|
|
46951
|
-
withXsrfToken: validators.spelling('withXSRFToken')
|
|
46952
|
-
}, true);
|
|
46953
|
-
|
|
46954
46061
|
// Set config.method
|
|
46955
46062
|
config.method = (config.method || this.defaults.method || 'get').toLowerCase();
|
|
46956
46063
|
|
|
46064
|
+
let contextHeaders;
|
|
46065
|
+
|
|
46957
46066
|
// Flatten headers
|
|
46958
|
-
|
|
46067
|
+
contextHeaders = headers && utils.merge(
|
|
46959
46068
|
headers.common,
|
|
46960
46069
|
headers[config.method]
|
|
46961
46070
|
);
|
|
46962
46071
|
|
|
46963
|
-
|
|
46072
|
+
contextHeaders && utils.forEach(
|
|
46964
46073
|
['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
|
|
46965
46074
|
(method) => {
|
|
46966
46075
|
delete headers[method];
|
|
@@ -47047,7 +46156,7 @@ class Axios {
|
|
|
47047
46156
|
}
|
|
47048
46157
|
|
|
47049
46158
|
// Provide aliases for supported request methods
|
|
47050
|
-
utils
|
|
46159
|
+
utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
|
|
47051
46160
|
/*eslint func-names:0*/
|
|
47052
46161
|
Axios.prototype[method] = function(url, config) {
|
|
47053
46162
|
return this.request(mergeConfig(config || {}, {
|
|
@@ -47058,7 +46167,7 @@ utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoDa
|
|
|
47058
46167
|
};
|
|
47059
46168
|
});
|
|
47060
46169
|
|
|
47061
|
-
utils
|
|
46170
|
+
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|
47062
46171
|
/*eslint func-names:0*/
|
|
47063
46172
|
|
|
47064
46173
|
function generateHTTPMethod(isForm) {
|
|
@@ -47179,20 +46288,6 @@ class CancelToken {
|
|
|
47179
46288
|
}
|
|
47180
46289
|
}
|
|
47181
46290
|
|
|
47182
|
-
toAbortSignal() {
|
|
47183
|
-
const controller = new AbortController();
|
|
47184
|
-
|
|
47185
|
-
const abort = (err) => {
|
|
47186
|
-
controller.abort(err);
|
|
47187
|
-
};
|
|
47188
|
-
|
|
47189
|
-
this.subscribe(abort);
|
|
47190
|
-
|
|
47191
|
-
controller.signal.unsubscribe = () => this.unsubscribe(abort);
|
|
47192
|
-
|
|
47193
|
-
return controller.signal;
|
|
47194
|
-
}
|
|
47195
|
-
|
|
47196
46291
|
/**
|
|
47197
46292
|
* Returns an object that contains a new `CancelToken` and a function that, when called,
|
|
47198
46293
|
* cancels the `CancelToken`.
|
|
@@ -47244,7 +46339,7 @@ function spread(callback) {
|
|
|
47244
46339
|
* @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
|
|
47245
46340
|
*/
|
|
47246
46341
|
function isAxiosError(payload) {
|
|
47247
|
-
return utils
|
|
46342
|
+
return utils.isObject(payload) && (payload.isAxiosError === true);
|
|
47248
46343
|
}
|
|
47249
46344
|
|
|
47250
46345
|
const HttpStatusCode = {
|
|
@@ -47329,10 +46424,10 @@ function createInstance(defaultConfig) {
|
|
|
47329
46424
|
const instance = bind(Axios.prototype.request, context);
|
|
47330
46425
|
|
|
47331
46426
|
// Copy axios.prototype to instance
|
|
47332
|
-
utils
|
|
46427
|
+
utils.extend(instance, Axios.prototype, context, {allOwnKeys: true});
|
|
47333
46428
|
|
|
47334
46429
|
// Copy context to instance
|
|
47335
|
-
utils
|
|
46430
|
+
utils.extend(instance, context, null, {allOwnKeys: true});
|
|
47336
46431
|
|
|
47337
46432
|
// Factory for creating new instances
|
|
47338
46433
|
instance.create = function create(instanceConfig) {
|
|
@@ -47376,9 +46471,7 @@ axios.mergeConfig = mergeConfig;
|
|
|
47376
46471
|
|
|
47377
46472
|
axios.AxiosHeaders = AxiosHeaders;
|
|
47378
46473
|
|
|
47379
|
-
axios.formToJSON = thing => formDataToJSON(utils
|
|
47380
|
-
|
|
47381
|
-
axios.getAdapter = adapters.getAdapter;
|
|
46474
|
+
axios.formToJSON = thing => formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);
|
|
47382
46475
|
|
|
47383
46476
|
axios.HttpStatusCode = HttpStatusCode;
|
|
47384
46477
|
|