@pelcro/react-pelcro-js 4.0.0-alpha.110 → 4.0.0-alpha.112
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 +527 -1516
- package/dist/index.esm.js +526 -1516
- 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
|
*
|
|
@@ -29101,11 +29095,7 @@ function findKey(obj, key) {
|
|
|
29101
29095
|
return null;
|
|
29102
29096
|
}
|
|
29103
29097
|
|
|
29104
|
-
const _global =
|
|
29105
|
-
/*eslint no-undef:0*/
|
|
29106
|
-
if (typeof globalThis !== "undefined") return globalThis;
|
|
29107
|
-
return typeof self !== "undefined" ? self : (typeof window !== 'undefined' ? window : global)
|
|
29108
|
-
})();
|
|
29098
|
+
const _global = typeof self === "undefined" ? typeof global === "undefined" ? undefined : global : self;
|
|
29109
29099
|
|
|
29110
29100
|
const isContextDefined = (context) => !isUndefined(context) && context !== _global;
|
|
29111
29101
|
|
|
@@ -29336,7 +29326,7 @@ const matchAll = (regExp, str) => {
|
|
|
29336
29326
|
const isHTMLForm = kindOfTest('HTMLFormElement');
|
|
29337
29327
|
|
|
29338
29328
|
const toCamelCase = str => {
|
|
29339
|
-
return str.toLowerCase().replace(/[
|
|
29329
|
+
return str.toLowerCase().replace(/[_-\s]([a-z\d])(\w*)/g,
|
|
29340
29330
|
function replacer(m, p1, p2) {
|
|
29341
29331
|
return p1.toUpperCase() + p2;
|
|
29342
29332
|
}
|
|
@@ -29360,9 +29350,8 @@ const reduceDescriptors = (obj, reducer) => {
|
|
|
29360
29350
|
const reducedDescriptors = {};
|
|
29361
29351
|
|
|
29362
29352
|
forEach(descriptors, (descriptor, name) => {
|
|
29363
|
-
|
|
29364
|
-
|
|
29365
|
-
reducedDescriptors[name] = ret || descriptor;
|
|
29353
|
+
if (reducer(descriptor, name, obj) !== false) {
|
|
29354
|
+
reducedDescriptors[name] = descriptor;
|
|
29366
29355
|
}
|
|
29367
29356
|
});
|
|
29368
29357
|
|
|
@@ -29417,40 +29406,10 @@ const toObjectSet = (arrayOrString, delimiter) => {
|
|
|
29417
29406
|
const noop$2 = () => {};
|
|
29418
29407
|
|
|
29419
29408
|
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;
|
|
29409
|
+
value = +value;
|
|
29410
|
+
return Number.isFinite(value) ? value : defaultValue;
|
|
29441
29411
|
};
|
|
29442
29412
|
|
|
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
29413
|
const toJSONObject = (obj) => {
|
|
29455
29414
|
const stack = new Array(10);
|
|
29456
29415
|
|
|
@@ -29482,42 +29441,7 @@ const toJSONObject = (obj) => {
|
|
|
29482
29441
|
return visit(obj, 0);
|
|
29483
29442
|
};
|
|
29484
29443
|
|
|
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 = {
|
|
29444
|
+
var utils = {
|
|
29521
29445
|
isArray,
|
|
29522
29446
|
isArrayBuffer,
|
|
29523
29447
|
isBuffer: isBuffer$1,
|
|
@@ -29528,10 +29452,6 @@ var utils$1 = {
|
|
|
29528
29452
|
isBoolean,
|
|
29529
29453
|
isObject,
|
|
29530
29454
|
isPlainObject,
|
|
29531
|
-
isReadableStream,
|
|
29532
|
-
isRequest,
|
|
29533
|
-
isResponse,
|
|
29534
|
-
isHeaders,
|
|
29535
29455
|
isUndefined,
|
|
29536
29456
|
isDate,
|
|
29537
29457
|
isFile,
|
|
@@ -29567,14 +29487,7 @@ var utils$1 = {
|
|
|
29567
29487
|
findKey,
|
|
29568
29488
|
global: _global,
|
|
29569
29489
|
isContextDefined,
|
|
29570
|
-
|
|
29571
|
-
generateString,
|
|
29572
|
-
isSpecCompliantForm,
|
|
29573
|
-
toJSONObject,
|
|
29574
|
-
isAsyncFn,
|
|
29575
|
-
isThenable,
|
|
29576
|
-
setImmediate: _setImmediate,
|
|
29577
|
-
asap
|
|
29490
|
+
toJSONObject
|
|
29578
29491
|
};
|
|
29579
29492
|
|
|
29580
29493
|
/**
|
|
@@ -29602,13 +29515,10 @@ function AxiosError(message, code, config, request, response) {
|
|
|
29602
29515
|
code && (this.code = code);
|
|
29603
29516
|
config && (this.config = config);
|
|
29604
29517
|
request && (this.request = request);
|
|
29605
|
-
|
|
29606
|
-
this.response = response;
|
|
29607
|
-
this.status = response.status ? response.status : null;
|
|
29608
|
-
}
|
|
29518
|
+
response && (this.response = response);
|
|
29609
29519
|
}
|
|
29610
29520
|
|
|
29611
|
-
utils
|
|
29521
|
+
utils.inherits(AxiosError, Error, {
|
|
29612
29522
|
toJSON: function toJSON() {
|
|
29613
29523
|
return {
|
|
29614
29524
|
// Standard
|
|
@@ -29623,9 +29533,9 @@ utils$1.inherits(AxiosError, Error, {
|
|
|
29623
29533
|
columnNumber: this.columnNumber,
|
|
29624
29534
|
stack: this.stack,
|
|
29625
29535
|
// Axios
|
|
29626
|
-
config: utils
|
|
29536
|
+
config: utils.toJSONObject(this.config),
|
|
29627
29537
|
code: this.code,
|
|
29628
|
-
status: this.status
|
|
29538
|
+
status: this.response && this.response.status ? this.response.status : null
|
|
29629
29539
|
};
|
|
29630
29540
|
}
|
|
29631
29541
|
});
|
|
@@ -29658,7 +29568,7 @@ Object.defineProperty(prototype$1, 'isAxiosError', {value: true});
|
|
|
29658
29568
|
AxiosError.from = (error, code, config, request, response, customProps) => {
|
|
29659
29569
|
const axiosError = Object.create(prototype$1);
|
|
29660
29570
|
|
|
29661
|
-
utils
|
|
29571
|
+
utils.toFlatObject(error, axiosError, function filter(obj) {
|
|
29662
29572
|
return obj !== Error.prototype;
|
|
29663
29573
|
}, prop => {
|
|
29664
29574
|
return prop !== 'isAxiosError';
|
|
@@ -41606,7 +41516,7 @@ FormData$1.prototype.toString = function () {
|
|
|
41606
41516
|
* @returns {boolean}
|
|
41607
41517
|
*/
|
|
41608
41518
|
function isVisitable(thing) {
|
|
41609
|
-
return utils
|
|
41519
|
+
return utils.isPlainObject(thing) || utils.isArray(thing);
|
|
41610
41520
|
}
|
|
41611
41521
|
|
|
41612
41522
|
/**
|
|
@@ -41617,7 +41527,7 @@ function isVisitable(thing) {
|
|
|
41617
41527
|
* @returns {string} the key without the brackets.
|
|
41618
41528
|
*/
|
|
41619
41529
|
function removeBrackets(key) {
|
|
41620
|
-
return utils
|
|
41530
|
+
return utils.endsWith(key, '[]') ? key.slice(0, -2) : key;
|
|
41621
41531
|
}
|
|
41622
41532
|
|
|
41623
41533
|
/**
|
|
@@ -41646,13 +41556,24 @@ function renderKey(path, key, dots) {
|
|
|
41646
41556
|
* @returns {boolean}
|
|
41647
41557
|
*/
|
|
41648
41558
|
function isFlatArray(arr) {
|
|
41649
|
-
return utils
|
|
41559
|
+
return utils.isArray(arr) && !arr.some(isVisitable);
|
|
41650
41560
|
}
|
|
41651
41561
|
|
|
41652
|
-
const predicates = utils
|
|
41562
|
+
const predicates = utils.toFlatObject(utils, {}, null, function filter(prop) {
|
|
41653
41563
|
return /^is[A-Z]/.test(prop);
|
|
41654
41564
|
});
|
|
41655
41565
|
|
|
41566
|
+
/**
|
|
41567
|
+
* If the thing is a FormData object, return true, otherwise return false.
|
|
41568
|
+
*
|
|
41569
|
+
* @param {unknown} thing - The thing to check.
|
|
41570
|
+
*
|
|
41571
|
+
* @returns {boolean}
|
|
41572
|
+
*/
|
|
41573
|
+
function isSpecCompliant(thing) {
|
|
41574
|
+
return thing && utils.isFunction(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator];
|
|
41575
|
+
}
|
|
41576
|
+
|
|
41656
41577
|
/**
|
|
41657
41578
|
* Convert a data object to FormData
|
|
41658
41579
|
*
|
|
@@ -41677,7 +41598,7 @@ const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop)
|
|
|
41677
41598
|
* @returns
|
|
41678
41599
|
*/
|
|
41679
41600
|
function toFormData(obj, formData, options) {
|
|
41680
|
-
if (!utils
|
|
41601
|
+
if (!utils.isObject(obj)) {
|
|
41681
41602
|
throw new TypeError('target must be an object');
|
|
41682
41603
|
}
|
|
41683
41604
|
|
|
@@ -41685,13 +41606,13 @@ function toFormData(obj, formData, options) {
|
|
|
41685
41606
|
formData = formData || new (form_data || FormData)();
|
|
41686
41607
|
|
|
41687
41608
|
// eslint-disable-next-line no-param-reassign
|
|
41688
|
-
options = utils
|
|
41609
|
+
options = utils.toFlatObject(options, {
|
|
41689
41610
|
metaTokens: true,
|
|
41690
41611
|
dots: false,
|
|
41691
41612
|
indexes: false
|
|
41692
41613
|
}, false, function defined(option, source) {
|
|
41693
41614
|
// eslint-disable-next-line no-eq-null,eqeqeq
|
|
41694
|
-
return !utils
|
|
41615
|
+
return !utils.isUndefined(source[option]);
|
|
41695
41616
|
});
|
|
41696
41617
|
|
|
41697
41618
|
const metaTokens = options.metaTokens;
|
|
@@ -41700,24 +41621,24 @@ function toFormData(obj, formData, options) {
|
|
|
41700
41621
|
const dots = options.dots;
|
|
41701
41622
|
const indexes = options.indexes;
|
|
41702
41623
|
const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
|
|
41703
|
-
const useBlob = _Blob &&
|
|
41624
|
+
const useBlob = _Blob && isSpecCompliant(formData);
|
|
41704
41625
|
|
|
41705
|
-
if (!utils
|
|
41626
|
+
if (!utils.isFunction(visitor)) {
|
|
41706
41627
|
throw new TypeError('visitor must be a function');
|
|
41707
41628
|
}
|
|
41708
41629
|
|
|
41709
41630
|
function convertValue(value) {
|
|
41710
41631
|
if (value === null) return '';
|
|
41711
41632
|
|
|
41712
|
-
if (utils
|
|
41633
|
+
if (utils.isDate(value)) {
|
|
41713
41634
|
return value.toISOString();
|
|
41714
41635
|
}
|
|
41715
41636
|
|
|
41716
|
-
if (!useBlob && utils
|
|
41637
|
+
if (!useBlob && utils.isBlob(value)) {
|
|
41717
41638
|
throw new AxiosError('Blob is not supported. Use a Buffer instead.');
|
|
41718
41639
|
}
|
|
41719
41640
|
|
|
41720
|
-
if (utils
|
|
41641
|
+
if (utils.isArrayBuffer(value) || utils.isTypedArray(value)) {
|
|
41721
41642
|
return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
|
|
41722
41643
|
}
|
|
41723
41644
|
|
|
@@ -41738,20 +41659,20 @@ function toFormData(obj, formData, options) {
|
|
|
41738
41659
|
let arr = value;
|
|
41739
41660
|
|
|
41740
41661
|
if (value && !path && typeof value === 'object') {
|
|
41741
|
-
if (utils
|
|
41662
|
+
if (utils.endsWith(key, '{}')) {
|
|
41742
41663
|
// eslint-disable-next-line no-param-reassign
|
|
41743
41664
|
key = metaTokens ? key : key.slice(0, -2);
|
|
41744
41665
|
// eslint-disable-next-line no-param-reassign
|
|
41745
41666
|
value = JSON.stringify(value);
|
|
41746
41667
|
} else if (
|
|
41747
|
-
(utils
|
|
41748
|
-
(
|
|
41668
|
+
(utils.isArray(value) && isFlatArray(value)) ||
|
|
41669
|
+
(utils.isFileList(value) || utils.endsWith(key, '[]') && (arr = utils.toArray(value))
|
|
41749
41670
|
)) {
|
|
41750
41671
|
// eslint-disable-next-line no-param-reassign
|
|
41751
41672
|
key = removeBrackets(key);
|
|
41752
41673
|
|
|
41753
41674
|
arr.forEach(function each(el, index) {
|
|
41754
|
-
!(utils
|
|
41675
|
+
!(utils.isUndefined(el) || el === null) && formData.append(
|
|
41755
41676
|
// eslint-disable-next-line no-nested-ternary
|
|
41756
41677
|
indexes === true ? renderKey([key], index, dots) : (indexes === null ? key : key + '[]'),
|
|
41757
41678
|
convertValue(el)
|
|
@@ -41779,7 +41700,7 @@ function toFormData(obj, formData, options) {
|
|
|
41779
41700
|
});
|
|
41780
41701
|
|
|
41781
41702
|
function build(value, path) {
|
|
41782
|
-
if (utils
|
|
41703
|
+
if (utils.isUndefined(value)) return;
|
|
41783
41704
|
|
|
41784
41705
|
if (stack.indexOf(value) !== -1) {
|
|
41785
41706
|
throw Error('Circular reference detected in ' + path.join('.'));
|
|
@@ -41787,9 +41708,9 @@ function toFormData(obj, formData, options) {
|
|
|
41787
41708
|
|
|
41788
41709
|
stack.push(value);
|
|
41789
41710
|
|
|
41790
|
-
utils
|
|
41791
|
-
const result = !(utils
|
|
41792
|
-
formData, el, utils
|
|
41711
|
+
utils.forEach(value, function each(el, key) {
|
|
41712
|
+
const result = !(utils.isUndefined(el) || el === null) && visitor.call(
|
|
41713
|
+
formData, el, utils.isString(key) ? key.trim() : key, path, exposedHelpers
|
|
41793
41714
|
);
|
|
41794
41715
|
|
|
41795
41716
|
if (result === true) {
|
|
@@ -41800,7 +41721,7 @@ function toFormData(obj, formData, options) {
|
|
|
41800
41721
|
stack.pop();
|
|
41801
41722
|
}
|
|
41802
41723
|
|
|
41803
|
-
if (!utils
|
|
41724
|
+
if (!utils.isObject(obj)) {
|
|
41804
41725
|
throw new TypeError('data must be an object');
|
|
41805
41726
|
}
|
|
41806
41727
|
|
|
@@ -41885,7 +41806,7 @@ function encode(val) {
|
|
|
41885
41806
|
*
|
|
41886
41807
|
* @param {string} url The base of the url (e.g., http://www.google.com)
|
|
41887
41808
|
* @param {object} [params] The params to be appended
|
|
41888
|
-
* @param {?
|
|
41809
|
+
* @param {?object} options
|
|
41889
41810
|
*
|
|
41890
41811
|
* @returns {string} The formatted url
|
|
41891
41812
|
*/
|
|
@@ -41897,12 +41818,6 @@ function buildURL(url, params, options) {
|
|
|
41897
41818
|
|
|
41898
41819
|
const _encode = options && options.encode || encode;
|
|
41899
41820
|
|
|
41900
|
-
if (utils$1.isFunction(options)) {
|
|
41901
|
-
options = {
|
|
41902
|
-
serialize: options
|
|
41903
|
-
};
|
|
41904
|
-
}
|
|
41905
|
-
|
|
41906
41821
|
const serializeFn = options && options.serialize;
|
|
41907
41822
|
|
|
41908
41823
|
let serializedParams;
|
|
@@ -41910,7 +41825,7 @@ function buildURL(url, params, options) {
|
|
|
41910
41825
|
if (serializeFn) {
|
|
41911
41826
|
serializedParams = serializeFn(params, options);
|
|
41912
41827
|
} else {
|
|
41913
|
-
serializedParams = utils
|
|
41828
|
+
serializedParams = utils.isURLSearchParams(params) ?
|
|
41914
41829
|
params.toString() :
|
|
41915
41830
|
new AxiosURLSearchParams(params, options).toString(_encode);
|
|
41916
41831
|
}
|
|
@@ -41985,7 +41900,7 @@ class InterceptorManager {
|
|
|
41985
41900
|
* @returns {void}
|
|
41986
41901
|
*/
|
|
41987
41902
|
forEach(fn) {
|
|
41988
|
-
utils
|
|
41903
|
+
utils.forEach(this.handlers, function forEachHandler(h) {
|
|
41989
41904
|
if (h !== null) {
|
|
41990
41905
|
fn(h);
|
|
41991
41906
|
}
|
|
@@ -42001,7 +41916,7 @@ var transitionalDefaults = {
|
|
|
42001
41916
|
|
|
42002
41917
|
var URLSearchParams = url.URLSearchParams;
|
|
42003
41918
|
|
|
42004
|
-
var platform
|
|
41919
|
+
var platform = {
|
|
42005
41920
|
isNode: true,
|
|
42006
41921
|
classes: {
|
|
42007
41922
|
URLSearchParams,
|
|
@@ -42011,68 +41926,10 @@ var platform$1 = {
|
|
|
42011
41926
|
protocols: [ 'http', 'https', 'file', 'data' ]
|
|
42012
41927
|
};
|
|
42013
41928
|
|
|
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
41929
|
function toURLEncodedForm(data, options) {
|
|
42073
41930
|
return toFormData(data, new platform.classes.URLSearchParams(), Object.assign({
|
|
42074
41931
|
visitor: function(value, key, path, helpers) {
|
|
42075
|
-
if (
|
|
41932
|
+
if (utils.isBuffer(value)) {
|
|
42076
41933
|
this.append(key, value.toString('base64'));
|
|
42077
41934
|
return false;
|
|
42078
41935
|
}
|
|
@@ -42094,7 +41951,7 @@ function parsePropPath(name) {
|
|
|
42094
41951
|
// foo.x.y.z
|
|
42095
41952
|
// foo-x-y-z
|
|
42096
41953
|
// foo x y z
|
|
42097
|
-
return utils
|
|
41954
|
+
return utils.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
|
|
42098
41955
|
return match[0] === '[]' ? '' : match[1] || match[0];
|
|
42099
41956
|
});
|
|
42100
41957
|
}
|
|
@@ -42129,15 +41986,12 @@ function arrayToObject(arr) {
|
|
|
42129
41986
|
function formDataToJSON(formData) {
|
|
42130
41987
|
function buildPath(path, value, target, index) {
|
|
42131
41988
|
let name = path[index++];
|
|
42132
|
-
|
|
42133
|
-
if (name === '__proto__') return true;
|
|
42134
|
-
|
|
42135
41989
|
const isNumericKey = Number.isFinite(+name);
|
|
42136
41990
|
const isLast = index >= path.length;
|
|
42137
|
-
name = !name && utils
|
|
41991
|
+
name = !name && utils.isArray(target) ? target.length : name;
|
|
42138
41992
|
|
|
42139
41993
|
if (isLast) {
|
|
42140
|
-
if (utils
|
|
41994
|
+
if (utils.hasOwnProp(target, name)) {
|
|
42141
41995
|
target[name] = [target[name], value];
|
|
42142
41996
|
} else {
|
|
42143
41997
|
target[name] = value;
|
|
@@ -42146,23 +42000,23 @@ function formDataToJSON(formData) {
|
|
|
42146
42000
|
return !isNumericKey;
|
|
42147
42001
|
}
|
|
42148
42002
|
|
|
42149
|
-
if (!target[name] || !utils
|
|
42003
|
+
if (!target[name] || !utils.isObject(target[name])) {
|
|
42150
42004
|
target[name] = [];
|
|
42151
42005
|
}
|
|
42152
42006
|
|
|
42153
42007
|
const result = buildPath(path, value, target[name], index);
|
|
42154
42008
|
|
|
42155
|
-
if (result && utils
|
|
42009
|
+
if (result && utils.isArray(target[name])) {
|
|
42156
42010
|
target[name] = arrayToObject(target[name]);
|
|
42157
42011
|
}
|
|
42158
42012
|
|
|
42159
42013
|
return !isNumericKey;
|
|
42160
42014
|
}
|
|
42161
42015
|
|
|
42162
|
-
if (utils
|
|
42016
|
+
if (utils.isFormData(formData) && utils.isFunction(formData.entries)) {
|
|
42163
42017
|
const obj = {};
|
|
42164
42018
|
|
|
42165
|
-
utils
|
|
42019
|
+
utils.forEachEntry(formData, (name, value) => {
|
|
42166
42020
|
buildPath(parsePropPath(name), value, obj, 0);
|
|
42167
42021
|
});
|
|
42168
42022
|
|
|
@@ -42172,6 +42026,10 @@ function formDataToJSON(formData) {
|
|
|
42172
42026
|
return null;
|
|
42173
42027
|
}
|
|
42174
42028
|
|
|
42029
|
+
const DEFAULT_CONTENT_TYPE = {
|
|
42030
|
+
'Content-Type': undefined
|
|
42031
|
+
};
|
|
42032
|
+
|
|
42175
42033
|
/**
|
|
42176
42034
|
* It takes a string, tries to parse it, and if it fails, it returns the stringified version
|
|
42177
42035
|
* of the input
|
|
@@ -42183,10 +42041,10 @@ function formDataToJSON(formData) {
|
|
|
42183
42041
|
* @returns {string} A stringified version of the rawValue.
|
|
42184
42042
|
*/
|
|
42185
42043
|
function stringifySafely(rawValue, parser, encoder) {
|
|
42186
|
-
if (utils
|
|
42044
|
+
if (utils.isString(rawValue)) {
|
|
42187
42045
|
try {
|
|
42188
42046
|
(parser || JSON.parse)(rawValue);
|
|
42189
|
-
return utils
|
|
42047
|
+
return utils.trim(rawValue);
|
|
42190
42048
|
} catch (e) {
|
|
42191
42049
|
if (e.name !== 'SyntaxError') {
|
|
42192
42050
|
throw e;
|
|
@@ -42201,36 +42059,38 @@ const defaults = {
|
|
|
42201
42059
|
|
|
42202
42060
|
transitional: transitionalDefaults,
|
|
42203
42061
|
|
|
42204
|
-
adapter: ['xhr', 'http'
|
|
42062
|
+
adapter: ['xhr', 'http'],
|
|
42205
42063
|
|
|
42206
42064
|
transformRequest: [function transformRequest(data, headers) {
|
|
42207
42065
|
const contentType = headers.getContentType() || '';
|
|
42208
42066
|
const hasJSONContentType = contentType.indexOf('application/json') > -1;
|
|
42209
|
-
const isObjectPayload = utils
|
|
42067
|
+
const isObjectPayload = utils.isObject(data);
|
|
42210
42068
|
|
|
42211
|
-
if (isObjectPayload && utils
|
|
42069
|
+
if (isObjectPayload && utils.isHTMLForm(data)) {
|
|
42212
42070
|
data = new FormData(data);
|
|
42213
42071
|
}
|
|
42214
42072
|
|
|
42215
|
-
const isFormData = utils
|
|
42073
|
+
const isFormData = utils.isFormData(data);
|
|
42216
42074
|
|
|
42217
42075
|
if (isFormData) {
|
|
42076
|
+
if (!hasJSONContentType) {
|
|
42077
|
+
return data;
|
|
42078
|
+
}
|
|
42218
42079
|
return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
|
|
42219
42080
|
}
|
|
42220
42081
|
|
|
42221
|
-
if (utils
|
|
42222
|
-
utils
|
|
42223
|
-
utils
|
|
42224
|
-
utils
|
|
42225
|
-
utils
|
|
42226
|
-
utils$1.isReadableStream(data)
|
|
42082
|
+
if (utils.isArrayBuffer(data) ||
|
|
42083
|
+
utils.isBuffer(data) ||
|
|
42084
|
+
utils.isStream(data) ||
|
|
42085
|
+
utils.isFile(data) ||
|
|
42086
|
+
utils.isBlob(data)
|
|
42227
42087
|
) {
|
|
42228
42088
|
return data;
|
|
42229
42089
|
}
|
|
42230
|
-
if (utils
|
|
42090
|
+
if (utils.isArrayBufferView(data)) {
|
|
42231
42091
|
return data.buffer;
|
|
42232
42092
|
}
|
|
42233
|
-
if (utils
|
|
42093
|
+
if (utils.isURLSearchParams(data)) {
|
|
42234
42094
|
headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
|
|
42235
42095
|
return data.toString();
|
|
42236
42096
|
}
|
|
@@ -42242,7 +42102,7 @@ const defaults = {
|
|
|
42242
42102
|
return toURLEncodedForm(data, this.formSerializer).toString();
|
|
42243
42103
|
}
|
|
42244
42104
|
|
|
42245
|
-
if ((isFileList = utils
|
|
42105
|
+
if ((isFileList = utils.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
|
|
42246
42106
|
const _FormData = this.env && this.env.FormData;
|
|
42247
42107
|
|
|
42248
42108
|
return toFormData(
|
|
@@ -42266,11 +42126,7 @@ const defaults = {
|
|
|
42266
42126
|
const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
|
|
42267
42127
|
const JSONRequested = this.responseType === 'json';
|
|
42268
42128
|
|
|
42269
|
-
if (utils
|
|
42270
|
-
return data;
|
|
42271
|
-
}
|
|
42272
|
-
|
|
42273
|
-
if (data && utils$1.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
|
|
42129
|
+
if (data && utils.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
|
|
42274
42130
|
const silentJSONParsing = transitional && transitional.silentJSONParsing;
|
|
42275
42131
|
const strictJSONParsing = !silentJSONParsing && JSONRequested;
|
|
42276
42132
|
|
|
@@ -42312,19 +42168,22 @@ const defaults = {
|
|
|
42312
42168
|
|
|
42313
42169
|
headers: {
|
|
42314
42170
|
common: {
|
|
42315
|
-
'Accept': 'application/json, text/plain, */*'
|
|
42316
|
-
'Content-Type': undefined
|
|
42171
|
+
'Accept': 'application/json, text/plain, */*'
|
|
42317
42172
|
}
|
|
42318
42173
|
}
|
|
42319
42174
|
};
|
|
42320
42175
|
|
|
42321
|
-
utils
|
|
42176
|
+
utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
|
|
42322
42177
|
defaults.headers[method] = {};
|
|
42323
42178
|
});
|
|
42324
42179
|
|
|
42180
|
+
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|
42181
|
+
defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
|
|
42182
|
+
});
|
|
42183
|
+
|
|
42325
42184
|
// RawAxiosHeaders whose duplicates are ignored by node
|
|
42326
42185
|
// c.f. https://nodejs.org/api/http.html#http_message_headers
|
|
42327
|
-
const ignoreDuplicateOf = utils
|
|
42186
|
+
const ignoreDuplicateOf = utils.toObjectSet([
|
|
42328
42187
|
'age', 'authorization', 'content-length', 'content-type', 'etag',
|
|
42329
42188
|
'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
|
|
42330
42189
|
'last-modified', 'location', 'max-forwards', 'proxy-authorization',
|
|
@@ -42385,7 +42244,7 @@ function normalizeValue(value) {
|
|
|
42385
42244
|
return value;
|
|
42386
42245
|
}
|
|
42387
42246
|
|
|
42388
|
-
return utils
|
|
42247
|
+
return utils.isArray(value) ? value.map(normalizeValue) : String(value);
|
|
42389
42248
|
}
|
|
42390
42249
|
|
|
42391
42250
|
function parseTokens(str) {
|
|
@@ -42400,24 +42259,22 @@ function parseTokens(str) {
|
|
|
42400
42259
|
return tokens;
|
|
42401
42260
|
}
|
|
42402
42261
|
|
|
42403
|
-
|
|
42262
|
+
function isValidHeaderName(str) {
|
|
42263
|
+
return /^[-_a-zA-Z]+$/.test(str.trim());
|
|
42264
|
+
}
|
|
42404
42265
|
|
|
42405
|
-
function matchHeaderValue(context, value, header, filter
|
|
42406
|
-
if (utils
|
|
42266
|
+
function matchHeaderValue(context, value, header, filter) {
|
|
42267
|
+
if (utils.isFunction(filter)) {
|
|
42407
42268
|
return filter.call(this, value, header);
|
|
42408
42269
|
}
|
|
42409
42270
|
|
|
42410
|
-
if (
|
|
42411
|
-
value = header;
|
|
42412
|
-
}
|
|
42413
|
-
|
|
42414
|
-
if (!utils$1.isString(value)) return;
|
|
42271
|
+
if (!utils.isString(value)) return;
|
|
42415
42272
|
|
|
42416
|
-
if (utils
|
|
42273
|
+
if (utils.isString(filter)) {
|
|
42417
42274
|
return value.indexOf(filter) !== -1;
|
|
42418
42275
|
}
|
|
42419
42276
|
|
|
42420
|
-
if (utils
|
|
42277
|
+
if (utils.isRegExp(filter)) {
|
|
42421
42278
|
return filter.test(value);
|
|
42422
42279
|
}
|
|
42423
42280
|
}
|
|
@@ -42430,7 +42287,7 @@ function formatHeader(header) {
|
|
|
42430
42287
|
}
|
|
42431
42288
|
|
|
42432
42289
|
function buildAccessors(obj, header) {
|
|
42433
|
-
const accessorName = utils
|
|
42290
|
+
const accessorName = utils.toCamelCase(' ' + header);
|
|
42434
42291
|
|
|
42435
42292
|
['get', 'set', 'has'].forEach(methodName => {
|
|
42436
42293
|
Object.defineProperty(obj, methodName + accessorName, {
|
|
@@ -42457,7 +42314,7 @@ class AxiosHeaders {
|
|
|
42457
42314
|
throw new Error('header name must be a non-empty string');
|
|
42458
42315
|
}
|
|
42459
42316
|
|
|
42460
|
-
const key = utils
|
|
42317
|
+
const key = utils.findKey(self, lHeader);
|
|
42461
42318
|
|
|
42462
42319
|
if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) {
|
|
42463
42320
|
self[key || _header] = normalizeValue(_value);
|
|
@@ -42465,16 +42322,12 @@ class AxiosHeaders {
|
|
|
42465
42322
|
}
|
|
42466
42323
|
|
|
42467
42324
|
const setHeaders = (headers, _rewrite) =>
|
|
42468
|
-
utils
|
|
42325
|
+
utils.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
|
|
42469
42326
|
|
|
42470
|
-
if (utils
|
|
42327
|
+
if (utils.isPlainObject(header) || header instanceof this.constructor) {
|
|
42471
42328
|
setHeaders(header, valueOrRewrite);
|
|
42472
|
-
} else if(utils
|
|
42329
|
+
} else if(utils.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
|
42473
42330
|
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
42331
|
} else {
|
|
42479
42332
|
header != null && setHeader(valueOrRewrite, header, rewrite);
|
|
42480
42333
|
}
|
|
@@ -42486,7 +42339,7 @@ class AxiosHeaders {
|
|
|
42486
42339
|
header = normalizeHeader(header);
|
|
42487
42340
|
|
|
42488
42341
|
if (header) {
|
|
42489
|
-
const key = utils
|
|
42342
|
+
const key = utils.findKey(this, header);
|
|
42490
42343
|
|
|
42491
42344
|
if (key) {
|
|
42492
42345
|
const value = this[key];
|
|
@@ -42499,11 +42352,11 @@ class AxiosHeaders {
|
|
|
42499
42352
|
return parseTokens(value);
|
|
42500
42353
|
}
|
|
42501
42354
|
|
|
42502
|
-
if (utils
|
|
42355
|
+
if (utils.isFunction(parser)) {
|
|
42503
42356
|
return parser.call(this, value, key);
|
|
42504
42357
|
}
|
|
42505
42358
|
|
|
42506
|
-
if (utils
|
|
42359
|
+
if (utils.isRegExp(parser)) {
|
|
42507
42360
|
return parser.exec(value);
|
|
42508
42361
|
}
|
|
42509
42362
|
|
|
@@ -42516,9 +42369,9 @@ class AxiosHeaders {
|
|
|
42516
42369
|
header = normalizeHeader(header);
|
|
42517
42370
|
|
|
42518
42371
|
if (header) {
|
|
42519
|
-
const key = utils
|
|
42372
|
+
const key = utils.findKey(this, header);
|
|
42520
42373
|
|
|
42521
|
-
return !!(key &&
|
|
42374
|
+
return !!(key && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
|
|
42522
42375
|
}
|
|
42523
42376
|
|
|
42524
42377
|
return false;
|
|
@@ -42532,7 +42385,7 @@ class AxiosHeaders {
|
|
|
42532
42385
|
_header = normalizeHeader(_header);
|
|
42533
42386
|
|
|
42534
42387
|
if (_header) {
|
|
42535
|
-
const key = utils
|
|
42388
|
+
const key = utils.findKey(self, _header);
|
|
42536
42389
|
|
|
42537
42390
|
if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
|
|
42538
42391
|
delete self[key];
|
|
@@ -42542,7 +42395,7 @@ class AxiosHeaders {
|
|
|
42542
42395
|
}
|
|
42543
42396
|
}
|
|
42544
42397
|
|
|
42545
|
-
if (utils
|
|
42398
|
+
if (utils.isArray(header)) {
|
|
42546
42399
|
header.forEach(deleteHeader);
|
|
42547
42400
|
} else {
|
|
42548
42401
|
deleteHeader(header);
|
|
@@ -42551,28 +42404,16 @@ class AxiosHeaders {
|
|
|
42551
42404
|
return deleted;
|
|
42552
42405
|
}
|
|
42553
42406
|
|
|
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;
|
|
42407
|
+
clear() {
|
|
42408
|
+
return Object.keys(this).forEach(this.delete.bind(this));
|
|
42568
42409
|
}
|
|
42569
42410
|
|
|
42570
42411
|
normalize(format) {
|
|
42571
42412
|
const self = this;
|
|
42572
42413
|
const headers = {};
|
|
42573
42414
|
|
|
42574
|
-
utils
|
|
42575
|
-
const key = utils
|
|
42415
|
+
utils.forEach(this, (value, header) => {
|
|
42416
|
+
const key = utils.findKey(headers, header);
|
|
42576
42417
|
|
|
42577
42418
|
if (key) {
|
|
42578
42419
|
self[key] = normalizeValue(value);
|
|
@@ -42601,8 +42442,8 @@ class AxiosHeaders {
|
|
|
42601
42442
|
toJSON(asStrings) {
|
|
42602
42443
|
const obj = Object.create(null);
|
|
42603
42444
|
|
|
42604
|
-
utils
|
|
42605
|
-
value != null && value !== false && (obj[header] = asStrings && utils
|
|
42445
|
+
utils.forEach(this, (value, header) => {
|
|
42446
|
+
value != null && value !== false && (obj[header] = asStrings && utils.isArray(value) ? value.join(', ') : value);
|
|
42606
42447
|
});
|
|
42607
42448
|
|
|
42608
42449
|
return obj;
|
|
@@ -42649,26 +42490,16 @@ class AxiosHeaders {
|
|
|
42649
42490
|
}
|
|
42650
42491
|
}
|
|
42651
42492
|
|
|
42652
|
-
utils
|
|
42493
|
+
utils.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
|
|
42653
42494
|
|
|
42654
42495
|
return this;
|
|
42655
42496
|
}
|
|
42656
42497
|
}
|
|
42657
42498
|
|
|
42658
|
-
AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent'
|
|
42499
|
+
AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent']);
|
|
42659
42500
|
|
|
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);
|
|
42501
|
+
utils.freezeMethods(AxiosHeaders.prototype);
|
|
42502
|
+
utils.freezeMethods(AxiosHeaders);
|
|
42672
42503
|
|
|
42673
42504
|
/**
|
|
42674
42505
|
* Transform the data for a request or a response
|
|
@@ -42684,7 +42515,7 @@ function transformData(fns, response) {
|
|
|
42684
42515
|
const headers = AxiosHeaders.from(context.headers);
|
|
42685
42516
|
let data = context.data;
|
|
42686
42517
|
|
|
42687
|
-
utils
|
|
42518
|
+
utils.forEach(fns, function transform(fn) {
|
|
42688
42519
|
data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);
|
|
42689
42520
|
});
|
|
42690
42521
|
|
|
@@ -42712,7 +42543,7 @@ function CanceledError(message, config, request) {
|
|
|
42712
42543
|
this.name = 'CanceledError';
|
|
42713
42544
|
}
|
|
42714
42545
|
|
|
42715
|
-
utils
|
|
42546
|
+
utils.inherits(CanceledError, AxiosError, {
|
|
42716
42547
|
__CANCEL__: true
|
|
42717
42548
|
});
|
|
42718
42549
|
|
|
@@ -42764,7 +42595,7 @@ function isAbsoluteURL(url) {
|
|
|
42764
42595
|
*/
|
|
42765
42596
|
function combineURLs(baseURL, relativeURL) {
|
|
42766
42597
|
return relativeURL
|
|
42767
|
-
? baseURL.replace(
|
|
42598
|
+
? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
|
|
42768
42599
|
: baseURL;
|
|
42769
42600
|
}
|
|
42770
42601
|
|
|
@@ -42892,10 +42723,6 @@ function getEnv(key) {
|
|
|
42892
42723
|
|
|
42893
42724
|
var getProxyForUrl_1 = getProxyForUrl;
|
|
42894
42725
|
|
|
42895
|
-
var proxyFromEnv = {
|
|
42896
|
-
getProxyForUrl: getProxyForUrl_1
|
|
42897
|
-
};
|
|
42898
|
-
|
|
42899
42726
|
/**
|
|
42900
42727
|
* Helpers.
|
|
42901
42728
|
*/
|
|
@@ -44732,7 +44559,7 @@ var followRedirects = wrap({ http: http, https: https });
|
|
|
44732
44559
|
var wrap_1 = wrap;
|
|
44733
44560
|
followRedirects.wrap = wrap_1;
|
|
44734
44561
|
|
|
44735
|
-
const VERSION = "1.
|
|
44562
|
+
const VERSION = "1.2.1";
|
|
44736
44563
|
|
|
44737
44564
|
function parseProtocol(url) {
|
|
44738
44565
|
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
|
|
@@ -44787,11 +44614,93 @@ function fromDataURI(uri, asBlob, options) {
|
|
|
44787
44614
|
throw new AxiosError('Unsupported protocol ' + protocol, AxiosError.ERR_NOT_SUPPORT);
|
|
44788
44615
|
}
|
|
44789
44616
|
|
|
44617
|
+
/**
|
|
44618
|
+
* Throttle decorator
|
|
44619
|
+
* @param {Function} fn
|
|
44620
|
+
* @param {Number} freq
|
|
44621
|
+
* @return {Function}
|
|
44622
|
+
*/
|
|
44623
|
+
function throttle(fn, freq) {
|
|
44624
|
+
let timestamp = 0;
|
|
44625
|
+
const threshold = 1000 / freq;
|
|
44626
|
+
let timer = null;
|
|
44627
|
+
return function throttled(force, args) {
|
|
44628
|
+
const now = Date.now();
|
|
44629
|
+
if (force || now - timestamp > threshold) {
|
|
44630
|
+
if (timer) {
|
|
44631
|
+
clearTimeout(timer);
|
|
44632
|
+
timer = null;
|
|
44633
|
+
}
|
|
44634
|
+
timestamp = now;
|
|
44635
|
+
return fn.apply(null, args);
|
|
44636
|
+
}
|
|
44637
|
+
if (!timer) {
|
|
44638
|
+
timer = setTimeout(() => {
|
|
44639
|
+
timer = null;
|
|
44640
|
+
timestamp = Date.now();
|
|
44641
|
+
return fn.apply(null, args);
|
|
44642
|
+
}, threshold - (now - timestamp));
|
|
44643
|
+
}
|
|
44644
|
+
};
|
|
44645
|
+
}
|
|
44646
|
+
|
|
44647
|
+
/**
|
|
44648
|
+
* Calculate data maxRate
|
|
44649
|
+
* @param {Number} [samplesCount= 10]
|
|
44650
|
+
* @param {Number} [min= 1000]
|
|
44651
|
+
* @returns {Function}
|
|
44652
|
+
*/
|
|
44653
|
+
function speedometer(samplesCount, min) {
|
|
44654
|
+
samplesCount = samplesCount || 10;
|
|
44655
|
+
const bytes = new Array(samplesCount);
|
|
44656
|
+
const timestamps = new Array(samplesCount);
|
|
44657
|
+
let head = 0;
|
|
44658
|
+
let tail = 0;
|
|
44659
|
+
let firstSampleTS;
|
|
44660
|
+
|
|
44661
|
+
min = min !== undefined ? min : 1000;
|
|
44662
|
+
|
|
44663
|
+
return function push(chunkLength) {
|
|
44664
|
+
const now = Date.now();
|
|
44665
|
+
|
|
44666
|
+
const startedAt = timestamps[tail];
|
|
44667
|
+
|
|
44668
|
+
if (!firstSampleTS) {
|
|
44669
|
+
firstSampleTS = now;
|
|
44670
|
+
}
|
|
44671
|
+
|
|
44672
|
+
bytes[head] = chunkLength;
|
|
44673
|
+
timestamps[head] = now;
|
|
44674
|
+
|
|
44675
|
+
let i = tail;
|
|
44676
|
+
let bytesCount = 0;
|
|
44677
|
+
|
|
44678
|
+
while (i !== head) {
|
|
44679
|
+
bytesCount += bytes[i++];
|
|
44680
|
+
i = i % samplesCount;
|
|
44681
|
+
}
|
|
44682
|
+
|
|
44683
|
+
head = (head + 1) % samplesCount;
|
|
44684
|
+
|
|
44685
|
+
if (head === tail) {
|
|
44686
|
+
tail = (tail + 1) % samplesCount;
|
|
44687
|
+
}
|
|
44688
|
+
|
|
44689
|
+
if (now - firstSampleTS < min) {
|
|
44690
|
+
return;
|
|
44691
|
+
}
|
|
44692
|
+
|
|
44693
|
+
const passed = startedAt && now - startedAt;
|
|
44694
|
+
|
|
44695
|
+
return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
|
|
44696
|
+
};
|
|
44697
|
+
}
|
|
44698
|
+
|
|
44790
44699
|
const kInternals = Symbol('internals');
|
|
44791
44700
|
|
|
44792
44701
|
class AxiosTransformStream extends stream.Transform{
|
|
44793
44702
|
constructor(options) {
|
|
44794
|
-
options = utils
|
|
44703
|
+
options = utils.toFlatObject(options, {
|
|
44795
44704
|
maxRate: 0,
|
|
44796
44705
|
chunkSize: 64 * 1024,
|
|
44797
44706
|
minChunkSize: 100,
|
|
@@ -44799,15 +44708,19 @@ class AxiosTransformStream extends stream.Transform{
|
|
|
44799
44708
|
ticksRate: 2,
|
|
44800
44709
|
samplesCount: 15
|
|
44801
44710
|
}, null, (prop, source) => {
|
|
44802
|
-
return !utils
|
|
44711
|
+
return !utils.isUndefined(source[prop]);
|
|
44803
44712
|
});
|
|
44804
44713
|
|
|
44805
44714
|
super({
|
|
44806
44715
|
readableHighWaterMark: options.chunkSize
|
|
44807
44716
|
});
|
|
44808
44717
|
|
|
44718
|
+
const self = this;
|
|
44719
|
+
|
|
44809
44720
|
const internals = this[kInternals] = {
|
|
44721
|
+
length: options.length,
|
|
44810
44722
|
timeWindow: options.timeWindow,
|
|
44723
|
+
ticksRate: options.ticksRate,
|
|
44811
44724
|
chunkSize: options.chunkSize,
|
|
44812
44725
|
maxRate: options.maxRate,
|
|
44813
44726
|
minChunkSize: options.minChunkSize,
|
|
@@ -44819,6 +44732,8 @@ class AxiosTransformStream extends stream.Transform{
|
|
|
44819
44732
|
onReadCallback: null
|
|
44820
44733
|
};
|
|
44821
44734
|
|
|
44735
|
+
const _speedometer = speedometer(internals.ticksRate * options.samplesCount, internals.timeWindow);
|
|
44736
|
+
|
|
44822
44737
|
this.on('newListener', event => {
|
|
44823
44738
|
if (event === 'progress') {
|
|
44824
44739
|
if (!internals.isCaptured) {
|
|
@@ -44826,6 +44741,38 @@ class AxiosTransformStream extends stream.Transform{
|
|
|
44826
44741
|
}
|
|
44827
44742
|
}
|
|
44828
44743
|
});
|
|
44744
|
+
|
|
44745
|
+
let bytesNotified = 0;
|
|
44746
|
+
|
|
44747
|
+
internals.updateProgress = throttle(function throttledHandler() {
|
|
44748
|
+
const totalBytes = internals.length;
|
|
44749
|
+
const bytesTransferred = internals.bytesSeen;
|
|
44750
|
+
const progressBytes = bytesTransferred - bytesNotified;
|
|
44751
|
+
if (!progressBytes || self.destroyed) return;
|
|
44752
|
+
|
|
44753
|
+
const rate = _speedometer(progressBytes);
|
|
44754
|
+
|
|
44755
|
+
bytesNotified = bytesTransferred;
|
|
44756
|
+
|
|
44757
|
+
process.nextTick(() => {
|
|
44758
|
+
self.emit('progress', {
|
|
44759
|
+
'loaded': bytesTransferred,
|
|
44760
|
+
'total': totalBytes,
|
|
44761
|
+
'progress': totalBytes ? (bytesTransferred / totalBytes) : undefined,
|
|
44762
|
+
'bytes': progressBytes,
|
|
44763
|
+
'rate': rate ? rate : undefined,
|
|
44764
|
+
'estimated': rate && totalBytes && bytesTransferred <= totalBytes ?
|
|
44765
|
+
(totalBytes - bytesTransferred) / rate : undefined
|
|
44766
|
+
});
|
|
44767
|
+
});
|
|
44768
|
+
}, internals.ticksRate);
|
|
44769
|
+
|
|
44770
|
+
const onFinish = () => {
|
|
44771
|
+
internals.updateProgress(true);
|
|
44772
|
+
};
|
|
44773
|
+
|
|
44774
|
+
this.once('end', onFinish);
|
|
44775
|
+
this.once('error', onFinish);
|
|
44829
44776
|
}
|
|
44830
44777
|
|
|
44831
44778
|
_read(size) {
|
|
@@ -44839,6 +44786,7 @@ class AxiosTransformStream extends stream.Transform{
|
|
|
44839
44786
|
}
|
|
44840
44787
|
|
|
44841
44788
|
_transform(chunk, encoding, callback) {
|
|
44789
|
+
const self = this;
|
|
44842
44790
|
const internals = this[kInternals];
|
|
44843
44791
|
const maxRate = internals.maxRate;
|
|
44844
44792
|
|
|
@@ -44850,14 +44798,16 @@ class AxiosTransformStream extends stream.Transform{
|
|
|
44850
44798
|
const bytesThreshold = (maxRate / divider);
|
|
44851
44799
|
const minChunkSize = internals.minChunkSize !== false ? Math.max(internals.minChunkSize, bytesThreshold * 0.01) : 0;
|
|
44852
44800
|
|
|
44853
|
-
|
|
44801
|
+
function pushChunk(_chunk, _callback) {
|
|
44854
44802
|
const bytes = Buffer.byteLength(_chunk);
|
|
44855
44803
|
internals.bytesSeen += bytes;
|
|
44856
44804
|
internals.bytes += bytes;
|
|
44857
44805
|
|
|
44858
|
-
|
|
44806
|
+
if (internals.isCaptured) {
|
|
44807
|
+
internals.updateProgress();
|
|
44808
|
+
}
|
|
44859
44809
|
|
|
44860
|
-
if (
|
|
44810
|
+
if (self.push(_chunk)) {
|
|
44861
44811
|
process.nextTick(_callback);
|
|
44862
44812
|
} else {
|
|
44863
44813
|
internals.onReadCallback = () => {
|
|
@@ -44865,7 +44815,7 @@ class AxiosTransformStream extends stream.Transform{
|
|
|
44865
44815
|
process.nextTick(_callback);
|
|
44866
44816
|
};
|
|
44867
44817
|
}
|
|
44868
|
-
}
|
|
44818
|
+
}
|
|
44869
44819
|
|
|
44870
44820
|
const transformChunk = (_chunk, _callback) => {
|
|
44871
44821
|
const chunkSize = Buffer.byteLength(_chunk);
|
|
@@ -44922,310 +44872,19 @@ class AxiosTransformStream extends stream.Transform{
|
|
|
44922
44872
|
}
|
|
44923
44873
|
});
|
|
44924
44874
|
}
|
|
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
|
-
|
|
44958
|
-
if (isStringValue) {
|
|
44959
|
-
value = textEncoder.encode(String(value).replace(/\r?\n|\r\n?/g, CRLF));
|
|
44960
|
-
} else {
|
|
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
44875
|
|
|
45030
|
-
|
|
45031
|
-
|
|
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);
|
|
44876
|
+
setLength(length) {
|
|
44877
|
+
this[kInternals].length = +length;
|
|
44878
|
+
return this;
|
|
45066
44879
|
}
|
|
45067
44880
|
}
|
|
45068
44881
|
|
|
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
44882
|
const zlibOptions = {
|
|
45219
44883
|
flush: zlib.constants.Z_SYNC_FLUSH,
|
|
45220
44884
|
finishFlush: zlib.constants.Z_SYNC_FLUSH
|
|
45221
44885
|
};
|
|
45222
44886
|
|
|
45223
|
-
const
|
|
45224
|
-
flush: zlib.constants.BROTLI_OPERATION_FLUSH,
|
|
45225
|
-
finishFlush: zlib.constants.BROTLI_OPERATION_FLUSH
|
|
45226
|
-
};
|
|
45227
|
-
|
|
45228
|
-
const isBrotliSupported = utils$1.isFunction(zlib.createBrotliDecompress);
|
|
44887
|
+
const isBrotliSupported = utils.isFunction(zlib.createBrotliDecompress);
|
|
45229
44888
|
|
|
45230
44889
|
const {http: httpFollow, https: httpsFollow} = followRedirects;
|
|
45231
44890
|
|
|
@@ -45235,14 +44894,6 @@ const supportedProtocols = platform.protocols.map(protocol => {
|
|
|
45235
44894
|
return protocol + ':';
|
|
45236
44895
|
});
|
|
45237
44896
|
|
|
45238
|
-
const flushOnFinish = (stream, [throttled, flush]) => {
|
|
45239
|
-
stream
|
|
45240
|
-
.on('end', flush)
|
|
45241
|
-
.on('error', flush);
|
|
45242
|
-
|
|
45243
|
-
return throttled;
|
|
45244
|
-
};
|
|
45245
|
-
|
|
45246
44897
|
/**
|
|
45247
44898
|
* If the proxy or config beforeRedirects functions are defined, call them with the options
|
|
45248
44899
|
* object.
|
|
@@ -45251,12 +44902,12 @@ const flushOnFinish = (stream, [throttled, flush]) => {
|
|
|
45251
44902
|
*
|
|
45252
44903
|
* @returns {Object<string, any>}
|
|
45253
44904
|
*/
|
|
45254
|
-
function dispatchBeforeRedirect(options
|
|
44905
|
+
function dispatchBeforeRedirect(options) {
|
|
45255
44906
|
if (options.beforeRedirects.proxy) {
|
|
45256
44907
|
options.beforeRedirects.proxy(options);
|
|
45257
44908
|
}
|
|
45258
44909
|
if (options.beforeRedirects.config) {
|
|
45259
|
-
options.beforeRedirects.config(options
|
|
44910
|
+
options.beforeRedirects.config(options);
|
|
45260
44911
|
}
|
|
45261
44912
|
}
|
|
45262
44913
|
|
|
@@ -45272,7 +44923,7 @@ function dispatchBeforeRedirect(options, responseDetails) {
|
|
|
45272
44923
|
function setProxy(options, configProxy, location) {
|
|
45273
44924
|
let proxy = configProxy;
|
|
45274
44925
|
if (!proxy && proxy !== false) {
|
|
45275
|
-
const proxyUrl =
|
|
44926
|
+
const proxyUrl = getProxyForUrl_1(location);
|
|
45276
44927
|
if (proxyUrl) {
|
|
45277
44928
|
proxy = new URL(proxyUrl);
|
|
45278
44929
|
}
|
|
@@ -45313,77 +44964,27 @@ function setProxy(options, configProxy, location) {
|
|
|
45313
44964
|
};
|
|
45314
44965
|
}
|
|
45315
44966
|
|
|
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});
|
|
44967
|
+
const isHttpAdapterSupported = typeof process !== 'undefined' && utils.kindOf(process) === 'process';
|
|
45356
44968
|
|
|
45357
44969
|
/*eslint consistent-return:0*/
|
|
45358
44970
|
var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
45359
|
-
return
|
|
45360
|
-
let
|
|
45361
|
-
const
|
|
44971
|
+
return new Promise(function dispatchHttpRequest(resolvePromise, rejectPromise) {
|
|
44972
|
+
let data = config.data;
|
|
44973
|
+
const responseType = config.responseType;
|
|
44974
|
+
const responseEncoding = config.responseEncoding;
|
|
45362
44975
|
const method = config.method.toUpperCase();
|
|
44976
|
+
let isFinished;
|
|
45363
44977
|
let isDone;
|
|
45364
44978
|
let rejected = false;
|
|
45365
44979
|
let req;
|
|
45366
44980
|
|
|
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
44981
|
// temporary internal emitter until the AxiosRequest class will be implemented
|
|
45384
44982
|
const emitter = new EventEmitter$1();
|
|
45385
44983
|
|
|
45386
|
-
|
|
44984
|
+
function onFinished() {
|
|
44985
|
+
if (isFinished) return;
|
|
44986
|
+
isFinished = true;
|
|
44987
|
+
|
|
45387
44988
|
if (config.cancelToken) {
|
|
45388
44989
|
config.cancelToken.unsubscribe(abort);
|
|
45389
44990
|
}
|
|
@@ -45393,15 +44994,28 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
45393
44994
|
}
|
|
45394
44995
|
|
|
45395
44996
|
emitter.removeAllListeners();
|
|
45396
|
-
}
|
|
44997
|
+
}
|
|
44998
|
+
|
|
44999
|
+
function done(value, isRejected) {
|
|
45000
|
+
if (isDone) return;
|
|
45397
45001
|
|
|
45398
|
-
onDone((value, isRejected) => {
|
|
45399
45002
|
isDone = true;
|
|
45003
|
+
|
|
45400
45004
|
if (isRejected) {
|
|
45401
45005
|
rejected = true;
|
|
45402
45006
|
onFinished();
|
|
45403
45007
|
}
|
|
45404
|
-
|
|
45008
|
+
|
|
45009
|
+
isRejected ? rejectPromise(value) : resolvePromise(value);
|
|
45010
|
+
}
|
|
45011
|
+
|
|
45012
|
+
const resolve = function resolve(value) {
|
|
45013
|
+
done(value);
|
|
45014
|
+
};
|
|
45015
|
+
|
|
45016
|
+
const reject = function reject(value) {
|
|
45017
|
+
done(value, true);
|
|
45018
|
+
};
|
|
45405
45019
|
|
|
45406
45020
|
function abort(reason) {
|
|
45407
45021
|
emitter.emit('abort', !reason || reason.type ? new CanceledError(null, config, req) : reason);
|
|
@@ -45418,7 +45032,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
45418
45032
|
|
|
45419
45033
|
// Parse url
|
|
45420
45034
|
const fullPath = buildFullPath(config.baseURL, config.url);
|
|
45421
|
-
const parsed = new URL(fullPath
|
|
45035
|
+
const parsed = new URL(fullPath);
|
|
45422
45036
|
const protocol = parsed.protocol || supportedProtocols[0];
|
|
45423
45037
|
|
|
45424
45038
|
if (protocol === 'data:') {
|
|
@@ -45445,7 +45059,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
45445
45059
|
convertedData = convertedData.toString(responseEncoding);
|
|
45446
45060
|
|
|
45447
45061
|
if (!responseEncoding || responseEncoding === 'utf8') {
|
|
45448
|
-
|
|
45062
|
+
data = utils.stripBOM(convertedData);
|
|
45449
45063
|
}
|
|
45450
45064
|
} else if (responseType === 'stream') {
|
|
45451
45065
|
convertedData = stream.Readable.from(convertedData);
|
|
@@ -45476,41 +45090,19 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
45476
45090
|
// Only set header if it hasn't been set in config
|
|
45477
45091
|
headers.set('User-Agent', 'axios/' + VERSION, false);
|
|
45478
45092
|
|
|
45479
|
-
const
|
|
45093
|
+
const onDownloadProgress = config.onDownloadProgress;
|
|
45094
|
+
const onUploadProgress = config.onUploadProgress;
|
|
45480
45095
|
const maxRate = config.maxRate;
|
|
45481
45096
|
let maxUploadRate = undefined;
|
|
45482
45097
|
let maxDownloadRate = undefined;
|
|
45483
45098
|
|
|
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)) {
|
|
45099
|
+
// support for https://www.npmjs.com/package/form-data api
|
|
45100
|
+
if (utils.isFormData(data) && utils.isFunction(data.getHeaders)) {
|
|
45496
45101
|
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)) {
|
|
45102
|
+
} else if (data && !utils.isStream(data)) {
|
|
45103
|
+
if (Buffer.isBuffer(data)) ; else if (utils.isArrayBuffer(data)) {
|
|
45512
45104
|
data = Buffer.from(new Uint8Array(data));
|
|
45513
|
-
} else if (utils
|
|
45105
|
+
} else if (utils.isString(data)) {
|
|
45514
45106
|
data = Buffer.from(data, 'utf-8');
|
|
45515
45107
|
} else {
|
|
45516
45108
|
return reject(new AxiosError(
|
|
@@ -45521,7 +45113,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
45521
45113
|
}
|
|
45522
45114
|
|
|
45523
45115
|
// Add Content-Length header if data exists
|
|
45524
|
-
headers.
|
|
45116
|
+
headers.set('Content-Length', data.length, false);
|
|
45525
45117
|
|
|
45526
45118
|
if (config.maxBodyLength > -1 && data.length > config.maxBodyLength) {
|
|
45527
45119
|
return reject(new AxiosError(
|
|
@@ -45532,9 +45124,9 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
45532
45124
|
}
|
|
45533
45125
|
}
|
|
45534
45126
|
|
|
45535
|
-
const contentLength = utils
|
|
45127
|
+
const contentLength = utils.toFiniteNumber(headers.getContentLength());
|
|
45536
45128
|
|
|
45537
|
-
if (utils
|
|
45129
|
+
if (utils.isArray(maxRate)) {
|
|
45538
45130
|
maxUploadRate = maxRate[0];
|
|
45539
45131
|
maxDownloadRate = maxRate[1];
|
|
45540
45132
|
} else {
|
|
@@ -45542,21 +45134,20 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
45542
45134
|
}
|
|
45543
45135
|
|
|
45544
45136
|
if (data && (onUploadProgress || maxUploadRate)) {
|
|
45545
|
-
if (!utils
|
|
45137
|
+
if (!utils.isStream(data)) {
|
|
45546
45138
|
data = stream.Readable.from(data, {objectMode: false});
|
|
45547
45139
|
}
|
|
45548
45140
|
|
|
45549
45141
|
data = stream.pipeline([data, new AxiosTransformStream({
|
|
45550
|
-
|
|
45551
|
-
|
|
45552
|
-
|
|
45553
|
-
|
|
45554
|
-
|
|
45555
|
-
|
|
45556
|
-
|
|
45557
|
-
|
|
45558
|
-
|
|
45559
|
-
));
|
|
45142
|
+
length: contentLength,
|
|
45143
|
+
maxRate: utils.toFiniteNumber(maxUploadRate)
|
|
45144
|
+
})], utils.noop);
|
|
45145
|
+
|
|
45146
|
+
onUploadProgress && data.on('progress', progress => {
|
|
45147
|
+
onUploadProgress(Object.assign(progress, {
|
|
45148
|
+
upload: true
|
|
45149
|
+
}));
|
|
45150
|
+
});
|
|
45560
45151
|
}
|
|
45561
45152
|
|
|
45562
45153
|
// HTTP basic authentication
|
|
@@ -45603,18 +45194,14 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
45603
45194
|
agents: { http: config.httpAgent, https: config.httpsAgent },
|
|
45604
45195
|
auth,
|
|
45605
45196
|
protocol,
|
|
45606
|
-
family,
|
|
45607
45197
|
beforeRedirect: dispatchBeforeRedirect,
|
|
45608
45198
|
beforeRedirects: {}
|
|
45609
45199
|
};
|
|
45610
45200
|
|
|
45611
|
-
// cacheable-lookup integration hotfix
|
|
45612
|
-
!utils$1.isUndefined(lookup) && (options.lookup = lookup);
|
|
45613
|
-
|
|
45614
45201
|
if (config.socketPath) {
|
|
45615
45202
|
options.socketPath = config.socketPath;
|
|
45616
45203
|
} else {
|
|
45617
|
-
options.hostname = parsed.hostname
|
|
45204
|
+
options.hostname = parsed.hostname;
|
|
45618
45205
|
options.port = parsed.port;
|
|
45619
45206
|
setProxy(options, config.proxy, protocol + '//' + parsed.hostname + (parsed.port ? ':' + parsed.port : '') + options.path);
|
|
45620
45207
|
}
|
|
@@ -45655,18 +45242,17 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
45655
45242
|
|
|
45656
45243
|
const responseLength = +res.headers['content-length'];
|
|
45657
45244
|
|
|
45658
|
-
if (onDownloadProgress
|
|
45245
|
+
if (onDownloadProgress) {
|
|
45659
45246
|
const transformStream = new AxiosTransformStream({
|
|
45660
|
-
|
|
45247
|
+
length: utils.toFiniteNumber(responseLength),
|
|
45248
|
+
maxRate: utils.toFiniteNumber(maxDownloadRate)
|
|
45661
45249
|
});
|
|
45662
45250
|
|
|
45663
|
-
onDownloadProgress && transformStream.on('progress',
|
|
45664
|
-
|
|
45665
|
-
|
|
45666
|
-
|
|
45667
|
-
|
|
45668
|
-
)
|
|
45669
|
-
));
|
|
45251
|
+
onDownloadProgress && transformStream.on('progress', progress => {
|
|
45252
|
+
onDownloadProgress(Object.assign(progress, {
|
|
45253
|
+
download: true
|
|
45254
|
+
}));
|
|
45255
|
+
});
|
|
45670
45256
|
|
|
45671
45257
|
streams.push(transformStream);
|
|
45672
45258
|
}
|
|
@@ -45685,21 +45271,11 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
45685
45271
|
delete res.headers['content-encoding'];
|
|
45686
45272
|
}
|
|
45687
45273
|
|
|
45688
|
-
switch (
|
|
45274
|
+
switch (res.headers['content-encoding']) {
|
|
45689
45275
|
/*eslint default-case:0*/
|
|
45690
45276
|
case 'gzip':
|
|
45691
|
-
case 'x-gzip':
|
|
45692
45277
|
case 'compress':
|
|
45693
|
-
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
45278
|
case 'deflate':
|
|
45701
|
-
streams.push(new ZlibHeaderTransformStream());
|
|
45702
|
-
|
|
45703
45279
|
// add the unzipper to the body stream processing pipeline
|
|
45704
45280
|
streams.push(zlib.createUnzip(zlibOptions));
|
|
45705
45281
|
|
|
@@ -45708,13 +45284,13 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
45708
45284
|
break;
|
|
45709
45285
|
case 'br':
|
|
45710
45286
|
if (isBrotliSupported) {
|
|
45711
|
-
streams.push(zlib.createBrotliDecompress(
|
|
45287
|
+
streams.push(zlib.createBrotliDecompress(zlibOptions));
|
|
45712
45288
|
delete res.headers['content-encoding'];
|
|
45713
45289
|
}
|
|
45714
45290
|
}
|
|
45715
45291
|
}
|
|
45716
45292
|
|
|
45717
|
-
responseStream = streams.length > 1 ? stream.pipeline(streams, utils
|
|
45293
|
+
responseStream = streams.length > 1 ? stream.pipeline(streams, utils.noop) : streams[0];
|
|
45718
45294
|
|
|
45719
45295
|
const offListeners = stream.finished(responseStream, () => {
|
|
45720
45296
|
offListeners();
|
|
@@ -45756,7 +45332,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
45756
45332
|
}
|
|
45757
45333
|
|
|
45758
45334
|
const err = new AxiosError(
|
|
45759
|
-
'
|
|
45335
|
+
'maxContentLength size of ' + config.maxContentLength + ' exceeded',
|
|
45760
45336
|
AxiosError.ERR_BAD_RESPONSE,
|
|
45761
45337
|
config,
|
|
45762
45338
|
lastRequest
|
|
@@ -45776,12 +45352,12 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
45776
45352
|
if (responseType !== 'arraybuffer') {
|
|
45777
45353
|
responseData = responseData.toString(responseEncoding);
|
|
45778
45354
|
if (!responseEncoding || responseEncoding === 'utf8') {
|
|
45779
|
-
responseData = utils
|
|
45355
|
+
responseData = utils.stripBOM(responseData);
|
|
45780
45356
|
}
|
|
45781
45357
|
}
|
|
45782
45358
|
response.data = responseData;
|
|
45783
45359
|
} catch (err) {
|
|
45784
|
-
|
|
45360
|
+
reject(AxiosError.from(err, null, config, response.request, response));
|
|
45785
45361
|
}
|
|
45786
45362
|
settle(resolve, reject, response);
|
|
45787
45363
|
});
|
|
@@ -45818,7 +45394,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
45818
45394
|
// This is forcing a int timeout to avoid problems if the `req` interface doesn't handle other types.
|
|
45819
45395
|
const timeout = parseInt(config.timeout, 10);
|
|
45820
45396
|
|
|
45821
|
-
if (
|
|
45397
|
+
if (isNaN(timeout)) {
|
|
45822
45398
|
reject(new AxiosError(
|
|
45823
45399
|
'error trying to parse `config.timeout` to int',
|
|
45824
45400
|
AxiosError.ERR_BAD_OPTION_VALUE,
|
|
@@ -45853,7 +45429,7 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
45853
45429
|
|
|
45854
45430
|
|
|
45855
45431
|
// Send the request
|
|
45856
|
-
if (utils
|
|
45432
|
+
if (utils.isStream(data)) {
|
|
45857
45433
|
let ended = false;
|
|
45858
45434
|
let errored = false;
|
|
45859
45435
|
|
|
@@ -45879,235 +45455,72 @@ var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|
|
45879
45455
|
});
|
|
45880
45456
|
};
|
|
45881
45457
|
|
|
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 = {};
|
|
45949
|
-
|
|
45950
|
-
function getMergedValue(target, source, prop, caseless) {
|
|
45951
|
-
if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
|
|
45952
|
-
return utils$1.merge.call({caseless}, target, source);
|
|
45953
|
-
} else if (utils$1.isPlainObject(source)) {
|
|
45954
|
-
return utils$1.merge({}, source);
|
|
45955
|
-
} else if (utils$1.isArray(source)) {
|
|
45956
|
-
return source.slice();
|
|
45957
|
-
}
|
|
45958
|
-
return source;
|
|
45959
|
-
}
|
|
45458
|
+
function progressEventReducer(listener, isDownloadStream) {
|
|
45459
|
+
let bytesNotified = 0;
|
|
45460
|
+
const _speedometer = speedometer(50, 250);
|
|
45960
45461
|
|
|
45961
|
-
|
|
45962
|
-
|
|
45963
|
-
|
|
45964
|
-
|
|
45965
|
-
|
|
45966
|
-
|
|
45967
|
-
}
|
|
45968
|
-
}
|
|
45462
|
+
return e => {
|
|
45463
|
+
const loaded = e.loaded;
|
|
45464
|
+
const total = e.lengthComputable ? e.total : undefined;
|
|
45465
|
+
const progressBytes = loaded - bytesNotified;
|
|
45466
|
+
const rate = _speedometer(progressBytes);
|
|
45467
|
+
const inRange = loaded <= total;
|
|
45969
45468
|
|
|
45970
|
-
|
|
45971
|
-
function valueFromConfig2(a, b) {
|
|
45972
|
-
if (!utils$1.isUndefined(b)) {
|
|
45973
|
-
return getMergedValue(undefined, b);
|
|
45974
|
-
}
|
|
45975
|
-
}
|
|
45469
|
+
bytesNotified = loaded;
|
|
45976
45470
|
|
|
45977
|
-
|
|
45978
|
-
|
|
45979
|
-
|
|
45980
|
-
|
|
45981
|
-
|
|
45982
|
-
|
|
45983
|
-
|
|
45984
|
-
|
|
45471
|
+
const data = {
|
|
45472
|
+
loaded,
|
|
45473
|
+
total,
|
|
45474
|
+
progress: total ? (loaded / total) : undefined,
|
|
45475
|
+
bytes: progressBytes,
|
|
45476
|
+
rate: rate ? rate : undefined,
|
|
45477
|
+
estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
|
|
45478
|
+
event: e
|
|
45479
|
+
};
|
|
45985
45480
|
|
|
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
|
-
}
|
|
45481
|
+
data[isDownloadStream ? 'download' : 'upload'] = true;
|
|
45994
45482
|
|
|
45995
|
-
|
|
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)
|
|
45483
|
+
listener(data);
|
|
46025
45484
|
};
|
|
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
45485
|
}
|
|
46035
45486
|
|
|
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
45487
|
const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
|
|
46085
45488
|
|
|
46086
45489
|
var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
46087
45490
|
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
|
46088
|
-
|
|
46089
|
-
|
|
46090
|
-
const
|
|
46091
|
-
let {responseType, onUploadProgress, onDownloadProgress} = _config;
|
|
45491
|
+
let requestData = config.data;
|
|
45492
|
+
const requestHeaders = AxiosHeaders.from(config.headers).normalize();
|
|
45493
|
+
const responseType = config.responseType;
|
|
46092
45494
|
let onCanceled;
|
|
46093
|
-
let uploadThrottled, downloadThrottled;
|
|
46094
|
-
let flushUpload, flushDownload;
|
|
46095
|
-
|
|
46096
45495
|
function done() {
|
|
46097
|
-
|
|
46098
|
-
|
|
45496
|
+
if (config.cancelToken) {
|
|
45497
|
+
config.cancelToken.unsubscribe(onCanceled);
|
|
45498
|
+
}
|
|
46099
45499
|
|
|
46100
|
-
|
|
45500
|
+
if (config.signal) {
|
|
45501
|
+
config.signal.removeEventListener('abort', onCanceled);
|
|
45502
|
+
}
|
|
45503
|
+
}
|
|
46101
45504
|
|
|
46102
|
-
|
|
45505
|
+
if (utils.isFormData(requestData) && (platform.isStandardBrowserWebWorkerEnv)) {
|
|
45506
|
+
requestHeaders.setContentType(false); // Let the browser set it
|
|
46103
45507
|
}
|
|
46104
45508
|
|
|
46105
45509
|
let request = new XMLHttpRequest();
|
|
46106
45510
|
|
|
46107
|
-
|
|
45511
|
+
// HTTP basic authentication
|
|
45512
|
+
if (config.auth) {
|
|
45513
|
+
const username = config.auth.username || '';
|
|
45514
|
+
const password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
|
|
45515
|
+
requestHeaders.set('Authorization', 'Basic ' + btoa(username + ':' + password));
|
|
45516
|
+
}
|
|
45517
|
+
|
|
45518
|
+
const fullPath = buildFullPath(config.baseURL, config.url);
|
|
45519
|
+
|
|
45520
|
+
request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
|
|
46108
45521
|
|
|
46109
45522
|
// Set the request timeout in MS
|
|
46110
|
-
request.timeout =
|
|
45523
|
+
request.timeout = config.timeout;
|
|
46111
45524
|
|
|
46112
45525
|
function onloadend() {
|
|
46113
45526
|
if (!request) {
|
|
@@ -46187,10 +45600,10 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
|
46187
45600
|
|
|
46188
45601
|
// Handle timeout
|
|
46189
45602
|
request.ontimeout = function handleTimeout() {
|
|
46190
|
-
let timeoutErrorMessage =
|
|
46191
|
-
const transitional =
|
|
46192
|
-
if (
|
|
46193
|
-
timeoutErrorMessage =
|
|
45603
|
+
let timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
|
|
45604
|
+
const transitional = config.transitional || transitionalDefaults;
|
|
45605
|
+
if (config.timeoutErrorMessage) {
|
|
45606
|
+
timeoutErrorMessage = config.timeoutErrorMessage;
|
|
46194
45607
|
}
|
|
46195
45608
|
reject(new AxiosError(
|
|
46196
45609
|
timeoutErrorMessage,
|
|
@@ -46207,37 +45620,32 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
|
46207
45620
|
|
|
46208
45621
|
// Add headers to the request
|
|
46209
45622
|
if ('setRequestHeader' in request) {
|
|
46210
|
-
utils
|
|
45623
|
+
utils.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
|
|
46211
45624
|
request.setRequestHeader(key, val);
|
|
46212
45625
|
});
|
|
46213
45626
|
}
|
|
46214
45627
|
|
|
46215
45628
|
// Add withCredentials to request if needed
|
|
46216
|
-
if (!utils
|
|
46217
|
-
request.withCredentials = !!
|
|
45629
|
+
if (!utils.isUndefined(config.withCredentials)) {
|
|
45630
|
+
request.withCredentials = !!config.withCredentials;
|
|
46218
45631
|
}
|
|
46219
45632
|
|
|
46220
45633
|
// Add responseType to request if needed
|
|
46221
45634
|
if (responseType && responseType !== 'json') {
|
|
46222
|
-
request.responseType =
|
|
45635
|
+
request.responseType = config.responseType;
|
|
46223
45636
|
}
|
|
46224
45637
|
|
|
46225
45638
|
// Handle progress if needed
|
|
46226
|
-
if (onDownloadProgress) {
|
|
46227
|
-
(
|
|
46228
|
-
request.addEventListener('progress', downloadThrottled);
|
|
45639
|
+
if (typeof config.onDownloadProgress === 'function') {
|
|
45640
|
+
request.addEventListener('progress', progressEventReducer(config.onDownloadProgress, true));
|
|
46229
45641
|
}
|
|
46230
45642
|
|
|
46231
45643
|
// 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);
|
|
45644
|
+
if (typeof config.onUploadProgress === 'function' && request.upload) {
|
|
45645
|
+
request.upload.addEventListener('progress', progressEventReducer(config.onUploadProgress));
|
|
46238
45646
|
}
|
|
46239
45647
|
|
|
46240
|
-
if (
|
|
45648
|
+
if (config.cancelToken || config.signal) {
|
|
46241
45649
|
// Handle cancellation
|
|
46242
45650
|
// eslint-disable-next-line func-names
|
|
46243
45651
|
onCanceled = cancel => {
|
|
@@ -46249,13 +45657,13 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
|
46249
45657
|
request = null;
|
|
46250
45658
|
};
|
|
46251
45659
|
|
|
46252
|
-
|
|
46253
|
-
if (
|
|
46254
|
-
|
|
45660
|
+
config.cancelToken && config.cancelToken.subscribe(onCanceled);
|
|
45661
|
+
if (config.signal) {
|
|
45662
|
+
config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled);
|
|
46255
45663
|
}
|
|
46256
45664
|
}
|
|
46257
45665
|
|
|
46258
|
-
const protocol = parseProtocol(
|
|
45666
|
+
const protocol = parseProtocol(fullPath);
|
|
46259
45667
|
|
|
46260
45668
|
if (protocol && platform.protocols.indexOf(protocol) === -1) {
|
|
46261
45669
|
reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
|
|
@@ -46268,362 +45676,13 @@ var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
|
46268
45676
|
});
|
|
46269
45677
|
};
|
|
46270
45678
|
|
|
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
45679
|
const knownAdapters = {
|
|
46620
45680
|
http: httpAdapter,
|
|
46621
|
-
xhr: xhrAdapter
|
|
46622
|
-
fetch: fetchAdapter
|
|
45681
|
+
xhr: xhrAdapter
|
|
46623
45682
|
};
|
|
46624
45683
|
|
|
46625
|
-
utils
|
|
46626
|
-
if
|
|
45684
|
+
utils.forEach(knownAdapters, (fn, value) => {
|
|
45685
|
+
if(fn) {
|
|
46627
45686
|
try {
|
|
46628
45687
|
Object.defineProperty(fn, 'name', {value});
|
|
46629
45688
|
} catch (e) {
|
|
@@ -46633,58 +45692,40 @@ utils$1.forEach(knownAdapters, (fn, value) => {
|
|
|
46633
45692
|
}
|
|
46634
45693
|
});
|
|
46635
45694
|
|
|
46636
|
-
const renderReason = (reason) => `- ${reason}`;
|
|
46637
|
-
|
|
46638
|
-
const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
|
|
46639
|
-
|
|
46640
45695
|
var adapters = {
|
|
46641
45696
|
getAdapter: (adapters) => {
|
|
46642
|
-
adapters = utils
|
|
45697
|
+
adapters = utils.isArray(adapters) ? adapters : [adapters];
|
|
46643
45698
|
|
|
46644
45699
|
const {length} = adapters;
|
|
46645
45700
|
let nameOrAdapter;
|
|
46646
45701
|
let adapter;
|
|
46647
45702
|
|
|
46648
|
-
const rejectedReasons = {};
|
|
46649
|
-
|
|
46650
45703
|
for (let i = 0; i < length; i++) {
|
|
46651
45704
|
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) {
|
|
45705
|
+
if((adapter = utils.isString(nameOrAdapter) ? knownAdapters[nameOrAdapter.toLowerCase()] : nameOrAdapter)) {
|
|
46665
45706
|
break;
|
|
46666
45707
|
}
|
|
46667
|
-
|
|
46668
|
-
rejectedReasons[id || '#' + i] = adapter;
|
|
46669
45708
|
}
|
|
46670
45709
|
|
|
46671
45710
|
if (!adapter) {
|
|
46672
|
-
|
|
46673
|
-
|
|
46674
|
-
|
|
46675
|
-
|
|
45711
|
+
if (adapter === false) {
|
|
45712
|
+
throw new AxiosError(
|
|
45713
|
+
`Adapter ${nameOrAdapter} is not supported by the environment`,
|
|
45714
|
+
'ERR_NOT_SUPPORT'
|
|
46676
45715
|
);
|
|
45716
|
+
}
|
|
46677
45717
|
|
|
46678
|
-
|
|
46679
|
-
|
|
46680
|
-
|
|
46681
|
-
|
|
46682
|
-
throw new AxiosError(
|
|
46683
|
-
`There is no suitable adapter to dispatch the request ` + s,
|
|
46684
|
-
'ERR_NOT_SUPPORT'
|
|
45718
|
+
throw new Error(
|
|
45719
|
+
utils.hasOwnProp(knownAdapters, nameOrAdapter) ?
|
|
45720
|
+
`Adapter '${nameOrAdapter}' is not available in the build` :
|
|
45721
|
+
`Unknown adapter '${nameOrAdapter}'`
|
|
46685
45722
|
);
|
|
46686
45723
|
}
|
|
46687
45724
|
|
|
45725
|
+
if (!utils.isFunction(adapter)) {
|
|
45726
|
+
throw new TypeError('adapter is not a function');
|
|
45727
|
+
}
|
|
45728
|
+
|
|
46688
45729
|
return adapter;
|
|
46689
45730
|
},
|
|
46690
45731
|
adapters: knownAdapters
|
|
@@ -46763,6 +45804,107 @@ function dispatchRequest(config) {
|
|
|
46763
45804
|
});
|
|
46764
45805
|
}
|
|
46765
45806
|
|
|
45807
|
+
const headersToObject = (thing) => thing instanceof AxiosHeaders ? thing.toJSON() : thing;
|
|
45808
|
+
|
|
45809
|
+
/**
|
|
45810
|
+
* Config-specific merge-function which creates a new config-object
|
|
45811
|
+
* by merging two configuration objects together.
|
|
45812
|
+
*
|
|
45813
|
+
* @param {Object} config1
|
|
45814
|
+
* @param {Object} config2
|
|
45815
|
+
*
|
|
45816
|
+
* @returns {Object} New object resulting from merging config2 to config1
|
|
45817
|
+
*/
|
|
45818
|
+
function mergeConfig(config1, config2) {
|
|
45819
|
+
// eslint-disable-next-line no-param-reassign
|
|
45820
|
+
config2 = config2 || {};
|
|
45821
|
+
const config = {};
|
|
45822
|
+
|
|
45823
|
+
function getMergedValue(target, source, caseless) {
|
|
45824
|
+
if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
|
|
45825
|
+
return utils.merge.call({caseless}, target, source);
|
|
45826
|
+
} else if (utils.isPlainObject(source)) {
|
|
45827
|
+
return utils.merge({}, source);
|
|
45828
|
+
} else if (utils.isArray(source)) {
|
|
45829
|
+
return source.slice();
|
|
45830
|
+
}
|
|
45831
|
+
return source;
|
|
45832
|
+
}
|
|
45833
|
+
|
|
45834
|
+
// eslint-disable-next-line consistent-return
|
|
45835
|
+
function mergeDeepProperties(a, b, caseless) {
|
|
45836
|
+
if (!utils.isUndefined(b)) {
|
|
45837
|
+
return getMergedValue(a, b, caseless);
|
|
45838
|
+
} else if (!utils.isUndefined(a)) {
|
|
45839
|
+
return getMergedValue(undefined, a, caseless);
|
|
45840
|
+
}
|
|
45841
|
+
}
|
|
45842
|
+
|
|
45843
|
+
// eslint-disable-next-line consistent-return
|
|
45844
|
+
function valueFromConfig2(a, b) {
|
|
45845
|
+
if (!utils.isUndefined(b)) {
|
|
45846
|
+
return getMergedValue(undefined, b);
|
|
45847
|
+
}
|
|
45848
|
+
}
|
|
45849
|
+
|
|
45850
|
+
// eslint-disable-next-line consistent-return
|
|
45851
|
+
function defaultToConfig2(a, b) {
|
|
45852
|
+
if (!utils.isUndefined(b)) {
|
|
45853
|
+
return getMergedValue(undefined, b);
|
|
45854
|
+
} else if (!utils.isUndefined(a)) {
|
|
45855
|
+
return getMergedValue(undefined, a);
|
|
45856
|
+
}
|
|
45857
|
+
}
|
|
45858
|
+
|
|
45859
|
+
// eslint-disable-next-line consistent-return
|
|
45860
|
+
function mergeDirectKeys(a, b, prop) {
|
|
45861
|
+
if (prop in config2) {
|
|
45862
|
+
return getMergedValue(a, b);
|
|
45863
|
+
} else if (prop in config1) {
|
|
45864
|
+
return getMergedValue(undefined, a);
|
|
45865
|
+
}
|
|
45866
|
+
}
|
|
45867
|
+
|
|
45868
|
+
const mergeMap = {
|
|
45869
|
+
url: valueFromConfig2,
|
|
45870
|
+
method: valueFromConfig2,
|
|
45871
|
+
data: valueFromConfig2,
|
|
45872
|
+
baseURL: defaultToConfig2,
|
|
45873
|
+
transformRequest: defaultToConfig2,
|
|
45874
|
+
transformResponse: defaultToConfig2,
|
|
45875
|
+
paramsSerializer: defaultToConfig2,
|
|
45876
|
+
timeout: defaultToConfig2,
|
|
45877
|
+
timeoutMessage: defaultToConfig2,
|
|
45878
|
+
withCredentials: defaultToConfig2,
|
|
45879
|
+
adapter: defaultToConfig2,
|
|
45880
|
+
responseType: defaultToConfig2,
|
|
45881
|
+
xsrfCookieName: defaultToConfig2,
|
|
45882
|
+
xsrfHeaderName: defaultToConfig2,
|
|
45883
|
+
onUploadProgress: defaultToConfig2,
|
|
45884
|
+
onDownloadProgress: defaultToConfig2,
|
|
45885
|
+
decompress: defaultToConfig2,
|
|
45886
|
+
maxContentLength: defaultToConfig2,
|
|
45887
|
+
maxBodyLength: defaultToConfig2,
|
|
45888
|
+
beforeRedirect: defaultToConfig2,
|
|
45889
|
+
transport: defaultToConfig2,
|
|
45890
|
+
httpAgent: defaultToConfig2,
|
|
45891
|
+
httpsAgent: defaultToConfig2,
|
|
45892
|
+
cancelToken: defaultToConfig2,
|
|
45893
|
+
socketPath: defaultToConfig2,
|
|
45894
|
+
responseEncoding: defaultToConfig2,
|
|
45895
|
+
validateStatus: mergeDirectKeys,
|
|
45896
|
+
headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
|
|
45897
|
+
};
|
|
45898
|
+
|
|
45899
|
+
utils.forEach(Object.keys(config1).concat(Object.keys(config2)), function computeConfigValue(prop) {
|
|
45900
|
+
const merge = mergeMap[prop] || mergeDeepProperties;
|
|
45901
|
+
const configValue = merge(config1[prop], config2[prop], prop);
|
|
45902
|
+
(utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
|
45903
|
+
});
|
|
45904
|
+
|
|
45905
|
+
return config;
|
|
45906
|
+
}
|
|
45907
|
+
|
|
46766
45908
|
const validators$1 = {};
|
|
46767
45909
|
|
|
46768
45910
|
// eslint-disable-next-line func-names
|
|
@@ -46812,14 +45954,6 @@ validators$1.transitional = function transitional(validator, version, message) {
|
|
|
46812
45954
|
};
|
|
46813
45955
|
};
|
|
46814
45956
|
|
|
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
45957
|
/**
|
|
46824
45958
|
* Assert object's properties type
|
|
46825
45959
|
*
|
|
@@ -46884,34 +46018,7 @@ class Axios {
|
|
|
46884
46018
|
*
|
|
46885
46019
|
* @returns {Promise} The Promise to be fulfilled
|
|
46886
46020
|
*/
|
|
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) {
|
|
46021
|
+
request(configOrUrl, config) {
|
|
46915
46022
|
/*eslint no-param-reassign:0*/
|
|
46916
46023
|
// Allow for axios('example/url'[, config]) a la fetch API
|
|
46917
46024
|
if (typeof configOrUrl === 'string') {
|
|
@@ -46933,34 +46040,25 @@ class Axios {
|
|
|
46933
46040
|
}, false);
|
|
46934
46041
|
}
|
|
46935
46042
|
|
|
46936
|
-
if (paramsSerializer
|
|
46937
|
-
|
|
46938
|
-
|
|
46939
|
-
|
|
46940
|
-
|
|
46941
|
-
} else {
|
|
46942
|
-
validator.assertOptions(paramsSerializer, {
|
|
46943
|
-
encode: validators.function,
|
|
46944
|
-
serialize: validators.function
|
|
46945
|
-
}, true);
|
|
46946
|
-
}
|
|
46043
|
+
if (paramsSerializer !== undefined) {
|
|
46044
|
+
validator.assertOptions(paramsSerializer, {
|
|
46045
|
+
encode: validators.function,
|
|
46046
|
+
serialize: validators.function
|
|
46047
|
+
}, true);
|
|
46947
46048
|
}
|
|
46948
46049
|
|
|
46949
|
-
validator.assertOptions(config, {
|
|
46950
|
-
baseUrl: validators.spelling('baseURL'),
|
|
46951
|
-
withXsrfToken: validators.spelling('withXSRFToken')
|
|
46952
|
-
}, true);
|
|
46953
|
-
|
|
46954
46050
|
// Set config.method
|
|
46955
46051
|
config.method = (config.method || this.defaults.method || 'get').toLowerCase();
|
|
46956
46052
|
|
|
46053
|
+
let contextHeaders;
|
|
46054
|
+
|
|
46957
46055
|
// Flatten headers
|
|
46958
|
-
|
|
46056
|
+
contextHeaders = headers && utils.merge(
|
|
46959
46057
|
headers.common,
|
|
46960
46058
|
headers[config.method]
|
|
46961
46059
|
);
|
|
46962
46060
|
|
|
46963
|
-
|
|
46061
|
+
contextHeaders && utils.forEach(
|
|
46964
46062
|
['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
|
|
46965
46063
|
(method) => {
|
|
46966
46064
|
delete headers[method];
|
|
@@ -47047,7 +46145,7 @@ class Axios {
|
|
|
47047
46145
|
}
|
|
47048
46146
|
|
|
47049
46147
|
// Provide aliases for supported request methods
|
|
47050
|
-
utils
|
|
46148
|
+
utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
|
|
47051
46149
|
/*eslint func-names:0*/
|
|
47052
46150
|
Axios.prototype[method] = function(url, config) {
|
|
47053
46151
|
return this.request(mergeConfig(config || {}, {
|
|
@@ -47058,7 +46156,7 @@ utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoDa
|
|
|
47058
46156
|
};
|
|
47059
46157
|
});
|
|
47060
46158
|
|
|
47061
|
-
utils
|
|
46159
|
+
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|
47062
46160
|
/*eslint func-names:0*/
|
|
47063
46161
|
|
|
47064
46162
|
function generateHTTPMethod(isForm) {
|
|
@@ -47179,20 +46277,6 @@ class CancelToken {
|
|
|
47179
46277
|
}
|
|
47180
46278
|
}
|
|
47181
46279
|
|
|
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
46280
|
/**
|
|
47197
46281
|
* Returns an object that contains a new `CancelToken` and a function that, when called,
|
|
47198
46282
|
* cancels the `CancelToken`.
|
|
@@ -47244,78 +46328,8 @@ function spread(callback) {
|
|
|
47244
46328
|
* @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
|
|
47245
46329
|
*/
|
|
47246
46330
|
function isAxiosError(payload) {
|
|
47247
|
-
return utils
|
|
47248
|
-
}
|
|
47249
|
-
|
|
47250
|
-
const HttpStatusCode = {
|
|
47251
|
-
Continue: 100,
|
|
47252
|
-
SwitchingProtocols: 101,
|
|
47253
|
-
Processing: 102,
|
|
47254
|
-
EarlyHints: 103,
|
|
47255
|
-
Ok: 200,
|
|
47256
|
-
Created: 201,
|
|
47257
|
-
Accepted: 202,
|
|
47258
|
-
NonAuthoritativeInformation: 203,
|
|
47259
|
-
NoContent: 204,
|
|
47260
|
-
ResetContent: 205,
|
|
47261
|
-
PartialContent: 206,
|
|
47262
|
-
MultiStatus: 207,
|
|
47263
|
-
AlreadyReported: 208,
|
|
47264
|
-
ImUsed: 226,
|
|
47265
|
-
MultipleChoices: 300,
|
|
47266
|
-
MovedPermanently: 301,
|
|
47267
|
-
Found: 302,
|
|
47268
|
-
SeeOther: 303,
|
|
47269
|
-
NotModified: 304,
|
|
47270
|
-
UseProxy: 305,
|
|
47271
|
-
Unused: 306,
|
|
47272
|
-
TemporaryRedirect: 307,
|
|
47273
|
-
PermanentRedirect: 308,
|
|
47274
|
-
BadRequest: 400,
|
|
47275
|
-
Unauthorized: 401,
|
|
47276
|
-
PaymentRequired: 402,
|
|
47277
|
-
Forbidden: 403,
|
|
47278
|
-
NotFound: 404,
|
|
47279
|
-
MethodNotAllowed: 405,
|
|
47280
|
-
NotAcceptable: 406,
|
|
47281
|
-
ProxyAuthenticationRequired: 407,
|
|
47282
|
-
RequestTimeout: 408,
|
|
47283
|
-
Conflict: 409,
|
|
47284
|
-
Gone: 410,
|
|
47285
|
-
LengthRequired: 411,
|
|
47286
|
-
PreconditionFailed: 412,
|
|
47287
|
-
PayloadTooLarge: 413,
|
|
47288
|
-
UriTooLong: 414,
|
|
47289
|
-
UnsupportedMediaType: 415,
|
|
47290
|
-
RangeNotSatisfiable: 416,
|
|
47291
|
-
ExpectationFailed: 417,
|
|
47292
|
-
ImATeapot: 418,
|
|
47293
|
-
MisdirectedRequest: 421,
|
|
47294
|
-
UnprocessableEntity: 422,
|
|
47295
|
-
Locked: 423,
|
|
47296
|
-
FailedDependency: 424,
|
|
47297
|
-
TooEarly: 425,
|
|
47298
|
-
UpgradeRequired: 426,
|
|
47299
|
-
PreconditionRequired: 428,
|
|
47300
|
-
TooManyRequests: 429,
|
|
47301
|
-
RequestHeaderFieldsTooLarge: 431,
|
|
47302
|
-
UnavailableForLegalReasons: 451,
|
|
47303
|
-
InternalServerError: 500,
|
|
47304
|
-
NotImplemented: 501,
|
|
47305
|
-
BadGateway: 502,
|
|
47306
|
-
ServiceUnavailable: 503,
|
|
47307
|
-
GatewayTimeout: 504,
|
|
47308
|
-
HttpVersionNotSupported: 505,
|
|
47309
|
-
VariantAlsoNegotiates: 506,
|
|
47310
|
-
InsufficientStorage: 507,
|
|
47311
|
-
LoopDetected: 508,
|
|
47312
|
-
NotExtended: 510,
|
|
47313
|
-
NetworkAuthenticationRequired: 511,
|
|
47314
|
-
};
|
|
47315
|
-
|
|
47316
|
-
Object.entries(HttpStatusCode).forEach(([key, value]) => {
|
|
47317
|
-
HttpStatusCode[value] = key;
|
|
47318
|
-
});
|
|
46331
|
+
return utils.isObject(payload) && (payload.isAxiosError === true);
|
|
46332
|
+
}
|
|
47319
46333
|
|
|
47320
46334
|
/**
|
|
47321
46335
|
* Create an instance of Axios
|
|
@@ -47329,10 +46343,10 @@ function createInstance(defaultConfig) {
|
|
|
47329
46343
|
const instance = bind(Axios.prototype.request, context);
|
|
47330
46344
|
|
|
47331
46345
|
// Copy axios.prototype to instance
|
|
47332
|
-
utils
|
|
46346
|
+
utils.extend(instance, Axios.prototype, context, {allOwnKeys: true});
|
|
47333
46347
|
|
|
47334
46348
|
// Copy context to instance
|
|
47335
|
-
utils
|
|
46349
|
+
utils.extend(instance, context, null, {allOwnKeys: true});
|
|
47336
46350
|
|
|
47337
46351
|
// Factory for creating new instances
|
|
47338
46352
|
instance.create = function create(instanceConfig) {
|
|
@@ -47376,11 +46390,7 @@ axios.mergeConfig = mergeConfig;
|
|
|
47376
46390
|
|
|
47377
46391
|
axios.AxiosHeaders = AxiosHeaders;
|
|
47378
46392
|
|
|
47379
|
-
axios.formToJSON = thing => formDataToJSON(utils
|
|
47380
|
-
|
|
47381
|
-
axios.getAdapter = adapters.getAdapter;
|
|
47382
|
-
|
|
47383
|
-
axios.HttpStatusCode = HttpStatusCode;
|
|
46393
|
+
axios.formToJSON = thing => formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);
|
|
47384
46394
|
|
|
47385
46395
|
axios.default = axios;
|
|
47386
46396
|
|