@jjrawlins/cdk-iam-policy-builder-helper 0.0.0 → 0.0.1
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/.jsii +373 -22
- package/README.md +1 -1
- package/{layerborncdkiampolicybuilderhelper → jjrawlinscdkiampolicybuilderhelper}/go.mod +1 -1
- package/{layerborncdkiampolicybuilderhelper → jjrawlinscdkiampolicybuilderhelper}/jsii/jsii.go +2 -2
- package/jjrawlinscdkiampolicybuilderhelper/version +1 -0
- package/lib/bin/create-actions-json.js +1 -1
- package/lib/bin/download-actions-json.js +1 -1
- package/lib/bin/download-managed-policies-json.js +1 -1
- package/lib/constructs/Actions.d.ts +1151 -0
- package/lib/constructs/Actions.js +1165 -14
- package/methods_list.txt +1118 -1
- package/node_modules/axios/CHANGELOG.md +880 -774
- package/node_modules/axios/README.md +60 -15
- package/node_modules/axios/dist/axios.js +1108 -294
- package/node_modules/axios/dist/axios.js.map +1 -1
- package/node_modules/axios/dist/axios.min.js +1 -1
- package/node_modules/axios/dist/axios.min.js.map +1 -1
- package/node_modules/axios/dist/browser/axios.cjs +764 -308
- package/node_modules/axios/dist/browser/axios.cjs.map +1 -1
- package/node_modules/axios/dist/esm/axios.js +764 -308
- package/node_modules/axios/dist/esm/axios.js.map +1 -1
- package/node_modules/axios/dist/esm/axios.min.js +1 -1
- package/node_modules/axios/dist/esm/axios.min.js.map +1 -1
- package/node_modules/axios/dist/node/axios.cjs +777 -388
- package/node_modules/axios/dist/node/axios.cjs.map +1 -1
- package/node_modules/axios/index.d.cts +5 -2
- package/node_modules/axios/index.d.ts +5 -2
- package/node_modules/axios/lib/adapters/adapters.js +3 -1
- package/node_modules/axios/lib/adapters/fetch.js +229 -0
- package/node_modules/axios/lib/adapters/http.js +26 -16
- package/node_modules/axios/lib/adapters/xhr.js +36 -99
- package/node_modules/axios/lib/core/Axios.js +9 -6
- package/node_modules/axios/lib/core/AxiosHeaders.js +4 -0
- package/node_modules/axios/lib/defaults/index.js +7 -2
- package/node_modules/axios/lib/env/data.js +1 -1
- package/node_modules/axios/lib/helpers/AxiosTransformStream.js +3 -51
- package/node_modules/axios/lib/helpers/composeSignals.js +46 -0
- package/node_modules/axios/lib/helpers/progressEventReducer.js +44 -0
- package/node_modules/axios/lib/helpers/resolveConfig.js +57 -0
- package/node_modules/axios/lib/helpers/throttle.js +30 -19
- package/node_modules/axios/lib/helpers/trackStream.js +67 -0
- package/node_modules/axios/lib/platform/common/utils.js +4 -1
- package/node_modules/axios/lib/utils.js +40 -3
- package/node_modules/axios/package.json +4 -3
- package/package.json +24 -20
- package/layerborncdkiampolicybuilderhelper/version +0 -1
- package/node_modules/@aws-sdk/util-utf8-browser/dist-cjs/index.js +0 -9
- package/node_modules/@aws-sdk/util-utf8-browser/dist-cjs/pureJs.js +0 -47
- package/node_modules/@aws-sdk/util-utf8-browser/dist-cjs/whatwgEncodingApi.js +0 -11
- package/node_modules/@aws-sdk/util-utf8-browser/dist-es/index.js +0 -4
- package/node_modules/@aws-sdk/util-utf8-browser/dist-es/pureJs.js +0 -42
- package/node_modules/@aws-sdk/util-utf8-browser/dist-es/whatwgEncodingApi.js +0 -6
- package/node_modules/@aws-sdk/util-utf8-browser/dist-types/index.d.ts +0 -2
- package/node_modules/@aws-sdk/util-utf8-browser/dist-types/pureJs.d.ts +0 -17
- package/node_modules/@aws-sdk/util-utf8-browser/dist-types/ts3.4/index.d.ts +0 -2
- package/node_modules/@aws-sdk/util-utf8-browser/dist-types/ts3.4/pureJs.d.ts +0 -2
- package/node_modules/@aws-sdk/util-utf8-browser/dist-types/ts3.4/whatwgEncodingApi.d.ts +0 -2
- package/node_modules/@aws-sdk/util-utf8-browser/dist-types/whatwgEncodingApi.d.ts +0 -2
- package/node_modules/combined-stream/yarn.lock +0 -17
- /package/{layerborncdkiampolicybuilderhelper → jjrawlinscdkiampolicybuilderhelper}/LICENSE +0 -0
- /package/{layerborncdkiampolicybuilderhelper → jjrawlinscdkiampolicybuilderhelper}/README.md +0 -0
|
@@ -1,10 +1,144 @@
|
|
|
1
|
-
// Axios v1.
|
|
1
|
+
// Axios v1.7.4 Copyright (c) 2024 Matt Zabriskie and contributors
|
|
2
2
|
(function (global, factory) {
|
|
3
3
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
4
4
|
typeof define === 'function' && define.amd ? define(factory) :
|
|
5
5
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.axios = factory());
|
|
6
6
|
})(this, (function () { 'use strict';
|
|
7
7
|
|
|
8
|
+
function _AsyncGenerator(e) {
|
|
9
|
+
var r, t;
|
|
10
|
+
function resume(r, t) {
|
|
11
|
+
try {
|
|
12
|
+
var n = e[r](t),
|
|
13
|
+
o = n.value,
|
|
14
|
+
u = o instanceof _OverloadYield;
|
|
15
|
+
Promise.resolve(u ? o.v : o).then(function (t) {
|
|
16
|
+
if (u) {
|
|
17
|
+
var i = "return" === r ? "return" : "next";
|
|
18
|
+
if (!o.k || t.done) return resume(i, t);
|
|
19
|
+
t = e[i](t).value;
|
|
20
|
+
}
|
|
21
|
+
settle(n.done ? "return" : "normal", t);
|
|
22
|
+
}, function (e) {
|
|
23
|
+
resume("throw", e);
|
|
24
|
+
});
|
|
25
|
+
} catch (e) {
|
|
26
|
+
settle("throw", e);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function settle(e, n) {
|
|
30
|
+
switch (e) {
|
|
31
|
+
case "return":
|
|
32
|
+
r.resolve({
|
|
33
|
+
value: n,
|
|
34
|
+
done: !0
|
|
35
|
+
});
|
|
36
|
+
break;
|
|
37
|
+
case "throw":
|
|
38
|
+
r.reject(n);
|
|
39
|
+
break;
|
|
40
|
+
default:
|
|
41
|
+
r.resolve({
|
|
42
|
+
value: n,
|
|
43
|
+
done: !1
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
(r = r.next) ? resume(r.key, r.arg) : t = null;
|
|
47
|
+
}
|
|
48
|
+
this._invoke = function (e, n) {
|
|
49
|
+
return new Promise(function (o, u) {
|
|
50
|
+
var i = {
|
|
51
|
+
key: e,
|
|
52
|
+
arg: n,
|
|
53
|
+
resolve: o,
|
|
54
|
+
reject: u,
|
|
55
|
+
next: null
|
|
56
|
+
};
|
|
57
|
+
t ? t = t.next = i : (r = t = i, resume(e, n));
|
|
58
|
+
});
|
|
59
|
+
}, "function" != typeof e.return && (this.return = void 0);
|
|
60
|
+
}
|
|
61
|
+
_AsyncGenerator.prototype["function" == typeof Symbol && Symbol.asyncIterator || "@@asyncIterator"] = function () {
|
|
62
|
+
return this;
|
|
63
|
+
}, _AsyncGenerator.prototype.next = function (e) {
|
|
64
|
+
return this._invoke("next", e);
|
|
65
|
+
}, _AsyncGenerator.prototype.throw = function (e) {
|
|
66
|
+
return this._invoke("throw", e);
|
|
67
|
+
}, _AsyncGenerator.prototype.return = function (e) {
|
|
68
|
+
return this._invoke("return", e);
|
|
69
|
+
};
|
|
70
|
+
function _OverloadYield(t, e) {
|
|
71
|
+
this.v = t, this.k = e;
|
|
72
|
+
}
|
|
73
|
+
function _asyncGeneratorDelegate(t) {
|
|
74
|
+
var e = {},
|
|
75
|
+
n = !1;
|
|
76
|
+
function pump(e, r) {
|
|
77
|
+
return n = !0, r = new Promise(function (n) {
|
|
78
|
+
n(t[e](r));
|
|
79
|
+
}), {
|
|
80
|
+
done: !1,
|
|
81
|
+
value: new _OverloadYield(r, 1)
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
return e["undefined" != typeof Symbol && Symbol.iterator || "@@iterator"] = function () {
|
|
85
|
+
return this;
|
|
86
|
+
}, e.next = function (t) {
|
|
87
|
+
return n ? (n = !1, t) : pump("next", t);
|
|
88
|
+
}, "function" == typeof t.throw && (e.throw = function (t) {
|
|
89
|
+
if (n) throw n = !1, t;
|
|
90
|
+
return pump("throw", t);
|
|
91
|
+
}), "function" == typeof t.return && (e.return = function (t) {
|
|
92
|
+
return n ? (n = !1, t) : pump("return", t);
|
|
93
|
+
}), e;
|
|
94
|
+
}
|
|
95
|
+
function _asyncIterator(r) {
|
|
96
|
+
var n,
|
|
97
|
+
t,
|
|
98
|
+
o,
|
|
99
|
+
e = 2;
|
|
100
|
+
for ("undefined" != typeof Symbol && (t = Symbol.asyncIterator, o = Symbol.iterator); e--;) {
|
|
101
|
+
if (t && null != (n = r[t])) return n.call(r);
|
|
102
|
+
if (o && null != (n = r[o])) return new AsyncFromSyncIterator(n.call(r));
|
|
103
|
+
t = "@@asyncIterator", o = "@@iterator";
|
|
104
|
+
}
|
|
105
|
+
throw new TypeError("Object is not async iterable");
|
|
106
|
+
}
|
|
107
|
+
function AsyncFromSyncIterator(r) {
|
|
108
|
+
function AsyncFromSyncIteratorContinuation(r) {
|
|
109
|
+
if (Object(r) !== r) return Promise.reject(new TypeError(r + " is not an object."));
|
|
110
|
+
var n = r.done;
|
|
111
|
+
return Promise.resolve(r.value).then(function (r) {
|
|
112
|
+
return {
|
|
113
|
+
value: r,
|
|
114
|
+
done: n
|
|
115
|
+
};
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
return AsyncFromSyncIterator = function (r) {
|
|
119
|
+
this.s = r, this.n = r.next;
|
|
120
|
+
}, AsyncFromSyncIterator.prototype = {
|
|
121
|
+
s: null,
|
|
122
|
+
n: null,
|
|
123
|
+
next: function () {
|
|
124
|
+
return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments));
|
|
125
|
+
},
|
|
126
|
+
return: function (r) {
|
|
127
|
+
var n = this.s.return;
|
|
128
|
+
return void 0 === n ? Promise.resolve({
|
|
129
|
+
value: r,
|
|
130
|
+
done: !0
|
|
131
|
+
}) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments));
|
|
132
|
+
},
|
|
133
|
+
throw: function (r) {
|
|
134
|
+
var n = this.s.return;
|
|
135
|
+
return void 0 === n ? Promise.reject(r) : AsyncFromSyncIteratorContinuation(n.apply(this.s, arguments));
|
|
136
|
+
}
|
|
137
|
+
}, new AsyncFromSyncIterator(r);
|
|
138
|
+
}
|
|
139
|
+
function _awaitAsyncGenerator(e) {
|
|
140
|
+
return new _OverloadYield(e, 0);
|
|
141
|
+
}
|
|
8
142
|
function _iterableToArrayLimit(r, l) {
|
|
9
143
|
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
10
144
|
if (null != t) {
|
|
@@ -377,6 +511,11 @@
|
|
|
377
511
|
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
378
512
|
}, _typeof(o);
|
|
379
513
|
}
|
|
514
|
+
function _wrapAsyncGenerator(fn) {
|
|
515
|
+
return function () {
|
|
516
|
+
return new _AsyncGenerator(fn.apply(this, arguments));
|
|
517
|
+
};
|
|
518
|
+
}
|
|
380
519
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
381
520
|
try {
|
|
382
521
|
var info = gen[key](arg);
|
|
@@ -480,6 +619,57 @@
|
|
|
480
619
|
function _nonIterableRest() {
|
|
481
620
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
482
621
|
}
|
|
622
|
+
function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
623
|
+
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
624
|
+
if (!it) {
|
|
625
|
+
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
626
|
+
if (it) o = it;
|
|
627
|
+
var i = 0;
|
|
628
|
+
var F = function () {};
|
|
629
|
+
return {
|
|
630
|
+
s: F,
|
|
631
|
+
n: function () {
|
|
632
|
+
if (i >= o.length) return {
|
|
633
|
+
done: true
|
|
634
|
+
};
|
|
635
|
+
return {
|
|
636
|
+
done: false,
|
|
637
|
+
value: o[i++]
|
|
638
|
+
};
|
|
639
|
+
},
|
|
640
|
+
e: function (e) {
|
|
641
|
+
throw e;
|
|
642
|
+
},
|
|
643
|
+
f: F
|
|
644
|
+
};
|
|
645
|
+
}
|
|
646
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
647
|
+
}
|
|
648
|
+
var normalCompletion = true,
|
|
649
|
+
didErr = false,
|
|
650
|
+
err;
|
|
651
|
+
return {
|
|
652
|
+
s: function () {
|
|
653
|
+
it = it.call(o);
|
|
654
|
+
},
|
|
655
|
+
n: function () {
|
|
656
|
+
var step = it.next();
|
|
657
|
+
normalCompletion = step.done;
|
|
658
|
+
return step;
|
|
659
|
+
},
|
|
660
|
+
e: function (e) {
|
|
661
|
+
didErr = true;
|
|
662
|
+
err = e;
|
|
663
|
+
},
|
|
664
|
+
f: function () {
|
|
665
|
+
try {
|
|
666
|
+
if (!normalCompletion && it.return != null) it.return();
|
|
667
|
+
} finally {
|
|
668
|
+
if (didErr) throw err;
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
};
|
|
672
|
+
}
|
|
483
673
|
|
|
484
674
|
function bind(fn, thisArg) {
|
|
485
675
|
return function wrap() {
|
|
@@ -695,6 +885,12 @@
|
|
|
695
885
|
* @returns {boolean} True if value is a URLSearchParams object, otherwise false
|
|
696
886
|
*/
|
|
697
887
|
var isURLSearchParams = kindOfTest('URLSearchParams');
|
|
888
|
+
var _map = ['ReadableStream', 'Request', 'Response', 'Headers'].map(kindOfTest),
|
|
889
|
+
_map2 = _slicedToArray(_map, 4),
|
|
890
|
+
isReadableStream = _map2[0],
|
|
891
|
+
isRequest = _map2[1],
|
|
892
|
+
isResponse = _map2[2],
|
|
893
|
+
isHeaders = _map2[3];
|
|
698
894
|
|
|
699
895
|
/**
|
|
700
896
|
* Trim excess whitespace off the beginning and end of a string
|
|
@@ -1068,8 +1264,7 @@
|
|
|
1068
1264
|
};
|
|
1069
1265
|
var noop = function noop() {};
|
|
1070
1266
|
var toFiniteNumber = function toFiniteNumber(value, defaultValue) {
|
|
1071
|
-
value = +value;
|
|
1072
|
-
return Number.isFinite(value) ? value : defaultValue;
|
|
1267
|
+
return value != null && Number.isFinite(value = +value) ? value : defaultValue;
|
|
1073
1268
|
};
|
|
1074
1269
|
var ALPHA = 'abcdefghijklmnopqrstuvwxyz';
|
|
1075
1270
|
var DIGIT = '0123456789';
|
|
@@ -1125,6 +1320,34 @@
|
|
|
1125
1320
|
var isThenable = function isThenable(thing) {
|
|
1126
1321
|
return thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing["catch"]);
|
|
1127
1322
|
};
|
|
1323
|
+
|
|
1324
|
+
// original code
|
|
1325
|
+
// https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
|
|
1326
|
+
|
|
1327
|
+
var _setImmediate = function (setImmediateSupported, postMessageSupported) {
|
|
1328
|
+
if (setImmediateSupported) {
|
|
1329
|
+
return setImmediate;
|
|
1330
|
+
}
|
|
1331
|
+
return postMessageSupported ? function (token, callbacks) {
|
|
1332
|
+
_global.addEventListener("message", function (_ref5) {
|
|
1333
|
+
var source = _ref5.source,
|
|
1334
|
+
data = _ref5.data;
|
|
1335
|
+
if (source === _global && data === token) {
|
|
1336
|
+
callbacks.length && callbacks.shift()();
|
|
1337
|
+
}
|
|
1338
|
+
}, false);
|
|
1339
|
+
return function (cb) {
|
|
1340
|
+
callbacks.push(cb);
|
|
1341
|
+
_global.postMessage(token, "*");
|
|
1342
|
+
};
|
|
1343
|
+
}("axios@".concat(Math.random()), []) : function (cb) {
|
|
1344
|
+
return setTimeout(cb);
|
|
1345
|
+
};
|
|
1346
|
+
}(typeof setImmediate === 'function', isFunction(_global.postMessage));
|
|
1347
|
+
var asap = typeof queueMicrotask !== 'undefined' ? queueMicrotask.bind(_global) : typeof process !== 'undefined' && process.nextTick || _setImmediate;
|
|
1348
|
+
|
|
1349
|
+
// *********************
|
|
1350
|
+
|
|
1128
1351
|
var utils$1 = {
|
|
1129
1352
|
isArray: isArray,
|
|
1130
1353
|
isArrayBuffer: isArrayBuffer,
|
|
@@ -1136,6 +1359,10 @@
|
|
|
1136
1359
|
isBoolean: isBoolean,
|
|
1137
1360
|
isObject: isObject,
|
|
1138
1361
|
isPlainObject: isPlainObject,
|
|
1362
|
+
isReadableStream: isReadableStream,
|
|
1363
|
+
isRequest: isRequest,
|
|
1364
|
+
isResponse: isResponse,
|
|
1365
|
+
isHeaders: isHeaders,
|
|
1139
1366
|
isUndefined: isUndefined,
|
|
1140
1367
|
isDate: isDate,
|
|
1141
1368
|
isFile: isFile,
|
|
@@ -1177,7 +1404,9 @@
|
|
|
1177
1404
|
isSpecCompliantForm: isSpecCompliantForm,
|
|
1178
1405
|
toJSONObject: toJSONObject,
|
|
1179
1406
|
isAsyncFn: isAsyncFn,
|
|
1180
|
-
isThenable: isThenable
|
|
1407
|
+
isThenable: isThenable,
|
|
1408
|
+
setImmediate: _setImmediate,
|
|
1409
|
+
asap: asap
|
|
1181
1410
|
};
|
|
1182
1411
|
|
|
1183
1412
|
/**
|
|
@@ -1667,12 +1896,14 @@
|
|
|
1667
1896
|
// eslint-disable-next-line no-undef
|
|
1668
1897
|
self instanceof WorkerGlobalScope && typeof self.importScripts === 'function';
|
|
1669
1898
|
}();
|
|
1899
|
+
var origin = hasBrowserEnv && window.location.href || 'http://localhost';
|
|
1670
1900
|
|
|
1671
1901
|
var utils = /*#__PURE__*/Object.freeze({
|
|
1672
1902
|
__proto__: null,
|
|
1673
1903
|
hasBrowserEnv: hasBrowserEnv,
|
|
1674
1904
|
hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
|
|
1675
|
-
hasStandardBrowserEnv: hasStandardBrowserEnv
|
|
1905
|
+
hasStandardBrowserEnv: hasStandardBrowserEnv,
|
|
1906
|
+
origin: origin
|
|
1676
1907
|
});
|
|
1677
1908
|
|
|
1678
1909
|
var platform = _objectSpread2(_objectSpread2({}, utils), platform$1);
|
|
@@ -1792,7 +2023,7 @@
|
|
|
1792
2023
|
}
|
|
1793
2024
|
var defaults = {
|
|
1794
2025
|
transitional: transitionalDefaults,
|
|
1795
|
-
adapter: ['xhr', 'http'],
|
|
2026
|
+
adapter: ['xhr', 'http', 'fetch'],
|
|
1796
2027
|
transformRequest: [function transformRequest(data, headers) {
|
|
1797
2028
|
var contentType = headers.getContentType() || '';
|
|
1798
2029
|
var hasJSONContentType = contentType.indexOf('application/json') > -1;
|
|
@@ -1804,7 +2035,7 @@
|
|
|
1804
2035
|
if (isFormData) {
|
|
1805
2036
|
return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
|
|
1806
2037
|
}
|
|
1807
|
-
if (utils$1.isArrayBuffer(data) || utils$1.isBuffer(data) || utils$1.isStream(data) || utils$1.isFile(data) || utils$1.isBlob(data)) {
|
|
2038
|
+
if (utils$1.isArrayBuffer(data) || utils$1.isBuffer(data) || utils$1.isStream(data) || utils$1.isFile(data) || utils$1.isBlob(data) || utils$1.isReadableStream(data)) {
|
|
1808
2039
|
return data;
|
|
1809
2040
|
}
|
|
1810
2041
|
if (utils$1.isArrayBufferView(data)) {
|
|
@@ -1836,6 +2067,9 @@
|
|
|
1836
2067
|
var transitional = this.transitional || defaults.transitional;
|
|
1837
2068
|
var forcedJSONParsing = transitional && transitional.forcedJSONParsing;
|
|
1838
2069
|
var JSONRequested = this.responseType === 'json';
|
|
2070
|
+
if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
|
|
2071
|
+
return data;
|
|
2072
|
+
}
|
|
1839
2073
|
if (data && utils$1.isString(data) && (forcedJSONParsing && !this.responseType || JSONRequested)) {
|
|
1840
2074
|
var silentJSONParsing = transitional && transitional.silentJSONParsing;
|
|
1841
2075
|
var strictJSONParsing = !silentJSONParsing && JSONRequested;
|
|
@@ -2004,6 +2238,21 @@
|
|
|
2004
2238
|
setHeaders(header, valueOrRewrite);
|
|
2005
2239
|
} else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
|
2006
2240
|
setHeaders(parseHeaders(header), valueOrRewrite);
|
|
2241
|
+
} else if (utils$1.isHeaders(header)) {
|
|
2242
|
+
var _iterator = _createForOfIteratorHelper(header.entries()),
|
|
2243
|
+
_step;
|
|
2244
|
+
try {
|
|
2245
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
2246
|
+
var _step$value = _slicedToArray(_step.value, 2),
|
|
2247
|
+
key = _step$value[0],
|
|
2248
|
+
value = _step$value[1];
|
|
2249
|
+
setHeader(value, key, rewrite);
|
|
2250
|
+
}
|
|
2251
|
+
} catch (err) {
|
|
2252
|
+
_iterator.e(err);
|
|
2253
|
+
} finally {
|
|
2254
|
+
_iterator.f();
|
|
2255
|
+
}
|
|
2007
2256
|
} else {
|
|
2008
2257
|
header != null && setHeader(valueOrRewrite, header, rewrite);
|
|
2009
2258
|
}
|
|
@@ -2255,6 +2504,196 @@
|
|
|
2255
2504
|
}
|
|
2256
2505
|
}
|
|
2257
2506
|
|
|
2507
|
+
function parseProtocol(url) {
|
|
2508
|
+
var match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
|
|
2509
|
+
return match && match[1] || '';
|
|
2510
|
+
}
|
|
2511
|
+
|
|
2512
|
+
/**
|
|
2513
|
+
* Calculate data maxRate
|
|
2514
|
+
* @param {Number} [samplesCount= 10]
|
|
2515
|
+
* @param {Number} [min= 1000]
|
|
2516
|
+
* @returns {Function}
|
|
2517
|
+
*/
|
|
2518
|
+
function speedometer(samplesCount, min) {
|
|
2519
|
+
samplesCount = samplesCount || 10;
|
|
2520
|
+
var bytes = new Array(samplesCount);
|
|
2521
|
+
var timestamps = new Array(samplesCount);
|
|
2522
|
+
var head = 0;
|
|
2523
|
+
var tail = 0;
|
|
2524
|
+
var firstSampleTS;
|
|
2525
|
+
min = min !== undefined ? min : 1000;
|
|
2526
|
+
return function push(chunkLength) {
|
|
2527
|
+
var now = Date.now();
|
|
2528
|
+
var startedAt = timestamps[tail];
|
|
2529
|
+
if (!firstSampleTS) {
|
|
2530
|
+
firstSampleTS = now;
|
|
2531
|
+
}
|
|
2532
|
+
bytes[head] = chunkLength;
|
|
2533
|
+
timestamps[head] = now;
|
|
2534
|
+
var i = tail;
|
|
2535
|
+
var bytesCount = 0;
|
|
2536
|
+
while (i !== head) {
|
|
2537
|
+
bytesCount += bytes[i++];
|
|
2538
|
+
i = i % samplesCount;
|
|
2539
|
+
}
|
|
2540
|
+
head = (head + 1) % samplesCount;
|
|
2541
|
+
if (head === tail) {
|
|
2542
|
+
tail = (tail + 1) % samplesCount;
|
|
2543
|
+
}
|
|
2544
|
+
if (now - firstSampleTS < min) {
|
|
2545
|
+
return;
|
|
2546
|
+
}
|
|
2547
|
+
var passed = startedAt && now - startedAt;
|
|
2548
|
+
return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
|
|
2549
|
+
};
|
|
2550
|
+
}
|
|
2551
|
+
|
|
2552
|
+
/**
|
|
2553
|
+
* Throttle decorator
|
|
2554
|
+
* @param {Function} fn
|
|
2555
|
+
* @param {Number} freq
|
|
2556
|
+
* @return {Function}
|
|
2557
|
+
*/
|
|
2558
|
+
function throttle(fn, freq) {
|
|
2559
|
+
var timestamp = 0;
|
|
2560
|
+
var threshold = 1000 / freq;
|
|
2561
|
+
var lastArgs;
|
|
2562
|
+
var timer;
|
|
2563
|
+
var invoke = function invoke(args) {
|
|
2564
|
+
var now = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Date.now();
|
|
2565
|
+
timestamp = now;
|
|
2566
|
+
lastArgs = null;
|
|
2567
|
+
if (timer) {
|
|
2568
|
+
clearTimeout(timer);
|
|
2569
|
+
timer = null;
|
|
2570
|
+
}
|
|
2571
|
+
fn.apply(null, args);
|
|
2572
|
+
};
|
|
2573
|
+
var throttled = function throttled() {
|
|
2574
|
+
var now = Date.now();
|
|
2575
|
+
var passed = now - timestamp;
|
|
2576
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
2577
|
+
args[_key] = arguments[_key];
|
|
2578
|
+
}
|
|
2579
|
+
if (passed >= threshold) {
|
|
2580
|
+
invoke(args, now);
|
|
2581
|
+
} else {
|
|
2582
|
+
lastArgs = args;
|
|
2583
|
+
if (!timer) {
|
|
2584
|
+
timer = setTimeout(function () {
|
|
2585
|
+
timer = null;
|
|
2586
|
+
invoke(lastArgs);
|
|
2587
|
+
}, threshold - passed);
|
|
2588
|
+
}
|
|
2589
|
+
}
|
|
2590
|
+
};
|
|
2591
|
+
var flush = function flush() {
|
|
2592
|
+
return lastArgs && invoke(lastArgs);
|
|
2593
|
+
};
|
|
2594
|
+
return [throttled, flush];
|
|
2595
|
+
}
|
|
2596
|
+
|
|
2597
|
+
var progressEventReducer = function progressEventReducer(listener, isDownloadStream) {
|
|
2598
|
+
var freq = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 3;
|
|
2599
|
+
var bytesNotified = 0;
|
|
2600
|
+
var _speedometer = speedometer(50, 250);
|
|
2601
|
+
return throttle(function (e) {
|
|
2602
|
+
var loaded = e.loaded;
|
|
2603
|
+
var total = e.lengthComputable ? e.total : undefined;
|
|
2604
|
+
var progressBytes = loaded - bytesNotified;
|
|
2605
|
+
var rate = _speedometer(progressBytes);
|
|
2606
|
+
var inRange = loaded <= total;
|
|
2607
|
+
bytesNotified = loaded;
|
|
2608
|
+
var data = _defineProperty({
|
|
2609
|
+
loaded: loaded,
|
|
2610
|
+
total: total,
|
|
2611
|
+
progress: total ? loaded / total : undefined,
|
|
2612
|
+
bytes: progressBytes,
|
|
2613
|
+
rate: rate ? rate : undefined,
|
|
2614
|
+
estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
|
|
2615
|
+
event: e,
|
|
2616
|
+
lengthComputable: total != null
|
|
2617
|
+
}, isDownloadStream ? 'download' : 'upload', true);
|
|
2618
|
+
listener(data);
|
|
2619
|
+
}, freq);
|
|
2620
|
+
};
|
|
2621
|
+
var progressEventDecorator = function progressEventDecorator(total, throttled) {
|
|
2622
|
+
var lengthComputable = total != null;
|
|
2623
|
+
return [function (loaded) {
|
|
2624
|
+
return throttled[0]({
|
|
2625
|
+
lengthComputable: lengthComputable,
|
|
2626
|
+
total: total,
|
|
2627
|
+
loaded: loaded
|
|
2628
|
+
});
|
|
2629
|
+
}, throttled[1]];
|
|
2630
|
+
};
|
|
2631
|
+
var asyncDecorator = function asyncDecorator(fn) {
|
|
2632
|
+
return function () {
|
|
2633
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
2634
|
+
args[_key] = arguments[_key];
|
|
2635
|
+
}
|
|
2636
|
+
return utils$1.asap(function () {
|
|
2637
|
+
return fn.apply(void 0, args);
|
|
2638
|
+
});
|
|
2639
|
+
};
|
|
2640
|
+
};
|
|
2641
|
+
|
|
2642
|
+
var isURLSameOrigin = platform.hasStandardBrowserEnv ?
|
|
2643
|
+
// Standard browser envs have full support of the APIs needed to test
|
|
2644
|
+
// whether the request URL is of the same origin as current location.
|
|
2645
|
+
function standardBrowserEnv() {
|
|
2646
|
+
var msie = /(msie|trident)/i.test(navigator.userAgent);
|
|
2647
|
+
var urlParsingNode = document.createElement('a');
|
|
2648
|
+
var originURL;
|
|
2649
|
+
|
|
2650
|
+
/**
|
|
2651
|
+
* Parse a URL to discover its components
|
|
2652
|
+
*
|
|
2653
|
+
* @param {String} url The URL to be parsed
|
|
2654
|
+
* @returns {Object}
|
|
2655
|
+
*/
|
|
2656
|
+
function resolveURL(url) {
|
|
2657
|
+
var href = url;
|
|
2658
|
+
if (msie) {
|
|
2659
|
+
// IE needs attribute set twice to normalize properties
|
|
2660
|
+
urlParsingNode.setAttribute('href', href);
|
|
2661
|
+
href = urlParsingNode.href;
|
|
2662
|
+
}
|
|
2663
|
+
urlParsingNode.setAttribute('href', href);
|
|
2664
|
+
|
|
2665
|
+
// urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
|
|
2666
|
+
return {
|
|
2667
|
+
href: urlParsingNode.href,
|
|
2668
|
+
protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
|
|
2669
|
+
host: urlParsingNode.host,
|
|
2670
|
+
search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
|
|
2671
|
+
hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
|
|
2672
|
+
hostname: urlParsingNode.hostname,
|
|
2673
|
+
port: urlParsingNode.port,
|
|
2674
|
+
pathname: urlParsingNode.pathname.charAt(0) === '/' ? urlParsingNode.pathname : '/' + urlParsingNode.pathname
|
|
2675
|
+
};
|
|
2676
|
+
}
|
|
2677
|
+
originURL = resolveURL(window.location.href);
|
|
2678
|
+
|
|
2679
|
+
/**
|
|
2680
|
+
* Determine if a URL shares the same origin as the current location
|
|
2681
|
+
*
|
|
2682
|
+
* @param {String} requestURL The URL to test
|
|
2683
|
+
* @returns {boolean} True if URL shares the same origin, otherwise false
|
|
2684
|
+
*/
|
|
2685
|
+
return function isURLSameOrigin(requestURL) {
|
|
2686
|
+
var parsed = utils$1.isString(requestURL) ? resolveURL(requestURL) : requestURL;
|
|
2687
|
+
return parsed.protocol === originURL.protocol && parsed.host === originURL.host;
|
|
2688
|
+
};
|
|
2689
|
+
}() :
|
|
2690
|
+
// Non standard browser envs (web workers, react-native) lack needed support.
|
|
2691
|
+
function nonStandardBrowserEnv() {
|
|
2692
|
+
return function isURLSameOrigin() {
|
|
2693
|
+
return true;
|
|
2694
|
+
};
|
|
2695
|
+
}();
|
|
2696
|
+
|
|
2258
2697
|
var cookies = platform.hasStandardBrowserEnv ?
|
|
2259
2698
|
// Standard browser envs support document.cookie
|
|
2260
2699
|
{
|
|
@@ -2326,173 +2765,182 @@
|
|
|
2326
2765
|
return requestedURL;
|
|
2327
2766
|
}
|
|
2328
2767
|
|
|
2329
|
-
var
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
function standardBrowserEnv() {
|
|
2333
|
-
var msie = /(msie|trident)/i.test(navigator.userAgent);
|
|
2334
|
-
var urlParsingNode = document.createElement('a');
|
|
2335
|
-
var originURL;
|
|
2768
|
+
var headersToObject = function headersToObject(thing) {
|
|
2769
|
+
return thing instanceof AxiosHeaders$1 ? _objectSpread2({}, thing) : thing;
|
|
2770
|
+
};
|
|
2336
2771
|
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2772
|
+
/**
|
|
2773
|
+
* Config-specific merge-function which creates a new config-object
|
|
2774
|
+
* by merging two configuration objects together.
|
|
2775
|
+
*
|
|
2776
|
+
* @param {Object} config1
|
|
2777
|
+
* @param {Object} config2
|
|
2778
|
+
*
|
|
2779
|
+
* @returns {Object} New object resulting from merging config2 to config1
|
|
2780
|
+
*/
|
|
2781
|
+
function mergeConfig(config1, config2) {
|
|
2782
|
+
// eslint-disable-next-line no-param-reassign
|
|
2783
|
+
config2 = config2 || {};
|
|
2784
|
+
var config = {};
|
|
2785
|
+
function getMergedValue(target, source, caseless) {
|
|
2786
|
+
if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
|
|
2787
|
+
return utils$1.merge.call({
|
|
2788
|
+
caseless: caseless
|
|
2789
|
+
}, target, source);
|
|
2790
|
+
} else if (utils$1.isPlainObject(source)) {
|
|
2791
|
+
return utils$1.merge({}, source);
|
|
2792
|
+
} else if (utils$1.isArray(source)) {
|
|
2793
|
+
return source.slice();
|
|
2349
2794
|
}
|
|
2350
|
-
|
|
2795
|
+
return source;
|
|
2796
|
+
}
|
|
2351
2797
|
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
hostname: urlParsingNode.hostname,
|
|
2360
|
-
port: urlParsingNode.port,
|
|
2361
|
-
pathname: urlParsingNode.pathname.charAt(0) === '/' ? urlParsingNode.pathname : '/' + urlParsingNode.pathname
|
|
2362
|
-
};
|
|
2798
|
+
// eslint-disable-next-line consistent-return
|
|
2799
|
+
function mergeDeepProperties(a, b, caseless) {
|
|
2800
|
+
if (!utils$1.isUndefined(b)) {
|
|
2801
|
+
return getMergedValue(a, b, caseless);
|
|
2802
|
+
} else if (!utils$1.isUndefined(a)) {
|
|
2803
|
+
return getMergedValue(undefined, a, caseless);
|
|
2804
|
+
}
|
|
2363
2805
|
}
|
|
2364
|
-
originURL = resolveURL(window.location.href);
|
|
2365
2806
|
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
* @returns {boolean} True if URL shares the same origin, otherwise false
|
|
2371
|
-
*/
|
|
2372
|
-
return function isURLSameOrigin(requestURL) {
|
|
2373
|
-
var parsed = utils$1.isString(requestURL) ? resolveURL(requestURL) : requestURL;
|
|
2374
|
-
return parsed.protocol === originURL.protocol && parsed.host === originURL.host;
|
|
2375
|
-
};
|
|
2376
|
-
}() :
|
|
2377
|
-
// Non standard browser envs (web workers, react-native) lack needed support.
|
|
2378
|
-
function nonStandardBrowserEnv() {
|
|
2379
|
-
return function isURLSameOrigin() {
|
|
2380
|
-
return true;
|
|
2381
|
-
};
|
|
2382
|
-
}();
|
|
2383
|
-
|
|
2384
|
-
function parseProtocol(url) {
|
|
2385
|
-
var match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
|
|
2386
|
-
return match && match[1] || '';
|
|
2387
|
-
}
|
|
2388
|
-
|
|
2389
|
-
/**
|
|
2390
|
-
* Calculate data maxRate
|
|
2391
|
-
* @param {Number} [samplesCount= 10]
|
|
2392
|
-
* @param {Number} [min= 1000]
|
|
2393
|
-
* @returns {Function}
|
|
2394
|
-
*/
|
|
2395
|
-
function speedometer(samplesCount, min) {
|
|
2396
|
-
samplesCount = samplesCount || 10;
|
|
2397
|
-
var bytes = new Array(samplesCount);
|
|
2398
|
-
var timestamps = new Array(samplesCount);
|
|
2399
|
-
var head = 0;
|
|
2400
|
-
var tail = 0;
|
|
2401
|
-
var firstSampleTS;
|
|
2402
|
-
min = min !== undefined ? min : 1000;
|
|
2403
|
-
return function push(chunkLength) {
|
|
2404
|
-
var now = Date.now();
|
|
2405
|
-
var startedAt = timestamps[tail];
|
|
2406
|
-
if (!firstSampleTS) {
|
|
2407
|
-
firstSampleTS = now;
|
|
2807
|
+
// eslint-disable-next-line consistent-return
|
|
2808
|
+
function valueFromConfig2(a, b) {
|
|
2809
|
+
if (!utils$1.isUndefined(b)) {
|
|
2810
|
+
return getMergedValue(undefined, b);
|
|
2408
2811
|
}
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2812
|
+
}
|
|
2813
|
+
|
|
2814
|
+
// eslint-disable-next-line consistent-return
|
|
2815
|
+
function defaultToConfig2(a, b) {
|
|
2816
|
+
if (!utils$1.isUndefined(b)) {
|
|
2817
|
+
return getMergedValue(undefined, b);
|
|
2818
|
+
} else if (!utils$1.isUndefined(a)) {
|
|
2819
|
+
return getMergedValue(undefined, a);
|
|
2416
2820
|
}
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2821
|
+
}
|
|
2822
|
+
|
|
2823
|
+
// eslint-disable-next-line consistent-return
|
|
2824
|
+
function mergeDirectKeys(a, b, prop) {
|
|
2825
|
+
if (prop in config2) {
|
|
2826
|
+
return getMergedValue(a, b);
|
|
2827
|
+
} else if (prop in config1) {
|
|
2828
|
+
return getMergedValue(undefined, a);
|
|
2420
2829
|
}
|
|
2421
|
-
|
|
2422
|
-
|
|
2830
|
+
}
|
|
2831
|
+
var mergeMap = {
|
|
2832
|
+
url: valueFromConfig2,
|
|
2833
|
+
method: valueFromConfig2,
|
|
2834
|
+
data: valueFromConfig2,
|
|
2835
|
+
baseURL: defaultToConfig2,
|
|
2836
|
+
transformRequest: defaultToConfig2,
|
|
2837
|
+
transformResponse: defaultToConfig2,
|
|
2838
|
+
paramsSerializer: defaultToConfig2,
|
|
2839
|
+
timeout: defaultToConfig2,
|
|
2840
|
+
timeoutMessage: defaultToConfig2,
|
|
2841
|
+
withCredentials: defaultToConfig2,
|
|
2842
|
+
withXSRFToken: defaultToConfig2,
|
|
2843
|
+
adapter: defaultToConfig2,
|
|
2844
|
+
responseType: defaultToConfig2,
|
|
2845
|
+
xsrfCookieName: defaultToConfig2,
|
|
2846
|
+
xsrfHeaderName: defaultToConfig2,
|
|
2847
|
+
onUploadProgress: defaultToConfig2,
|
|
2848
|
+
onDownloadProgress: defaultToConfig2,
|
|
2849
|
+
decompress: defaultToConfig2,
|
|
2850
|
+
maxContentLength: defaultToConfig2,
|
|
2851
|
+
maxBodyLength: defaultToConfig2,
|
|
2852
|
+
beforeRedirect: defaultToConfig2,
|
|
2853
|
+
transport: defaultToConfig2,
|
|
2854
|
+
httpAgent: defaultToConfig2,
|
|
2855
|
+
httpsAgent: defaultToConfig2,
|
|
2856
|
+
cancelToken: defaultToConfig2,
|
|
2857
|
+
socketPath: defaultToConfig2,
|
|
2858
|
+
responseEncoding: defaultToConfig2,
|
|
2859
|
+
validateStatus: mergeDirectKeys,
|
|
2860
|
+
headers: function headers(a, b) {
|
|
2861
|
+
return mergeDeepProperties(headersToObject(a), headersToObject(b), true);
|
|
2423
2862
|
}
|
|
2424
|
-
var passed = startedAt && now - startedAt;
|
|
2425
|
-
return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
|
|
2426
2863
|
};
|
|
2864
|
+
utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
|
|
2865
|
+
var merge = mergeMap[prop] || mergeDeepProperties;
|
|
2866
|
+
var configValue = merge(config1[prop], config2[prop], prop);
|
|
2867
|
+
utils$1.isUndefined(configValue) && merge !== mergeDirectKeys || (config[prop] = configValue);
|
|
2868
|
+
});
|
|
2869
|
+
return config;
|
|
2427
2870
|
}
|
|
2428
2871
|
|
|
2429
|
-
function
|
|
2430
|
-
var
|
|
2431
|
-
var
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2872
|
+
var resolveConfig = (function (config) {
|
|
2873
|
+
var newConfig = mergeConfig({}, config);
|
|
2874
|
+
var data = newConfig.data,
|
|
2875
|
+
withXSRFToken = newConfig.withXSRFToken,
|
|
2876
|
+
xsrfHeaderName = newConfig.xsrfHeaderName,
|
|
2877
|
+
xsrfCookieName = newConfig.xsrfCookieName,
|
|
2878
|
+
headers = newConfig.headers,
|
|
2879
|
+
auth = newConfig.auth;
|
|
2880
|
+
newConfig.headers = headers = AxiosHeaders$1.from(headers);
|
|
2881
|
+
newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url), config.params, config.paramsSerializer);
|
|
2882
|
+
|
|
2883
|
+
// HTTP basic authentication
|
|
2884
|
+
if (auth) {
|
|
2885
|
+
headers.set('Authorization', 'Basic ' + btoa((auth.username || '') + ':' + (auth.password ? unescape(encodeURIComponent(auth.password)) : '')));
|
|
2886
|
+
}
|
|
2887
|
+
var contentType;
|
|
2888
|
+
if (utils$1.isFormData(data)) {
|
|
2889
|
+
if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
|
|
2890
|
+
headers.setContentType(undefined); // Let the browser set it
|
|
2891
|
+
} else if ((contentType = headers.getContentType()) !== false) {
|
|
2892
|
+
// fix semicolon duplication issue for ReactNative FormData implementation
|
|
2893
|
+
var _ref = contentType ? contentType.split(';').map(function (token) {
|
|
2894
|
+
return token.trim();
|
|
2895
|
+
}).filter(Boolean) : [],
|
|
2896
|
+
_ref2 = _toArray(_ref),
|
|
2897
|
+
type = _ref2[0],
|
|
2898
|
+
tokens = _ref2.slice(1);
|
|
2899
|
+
headers.setContentType([type || 'multipart/form-data'].concat(_toConsumableArray(tokens)).join('; '));
|
|
2900
|
+
}
|
|
2901
|
+
}
|
|
2902
|
+
|
|
2903
|
+
// Add xsrf header
|
|
2904
|
+
// This is only done if running in a standard browser environment.
|
|
2905
|
+
// Specifically not if we're in a web worker, or react-native.
|
|
2906
|
+
|
|
2907
|
+
if (platform.hasStandardBrowserEnv) {
|
|
2908
|
+
withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
|
|
2909
|
+
if (withXSRFToken || withXSRFToken !== false && isURLSameOrigin(newConfig.url)) {
|
|
2910
|
+
// Add xsrf header
|
|
2911
|
+
var xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
|
|
2912
|
+
if (xsrfValue) {
|
|
2913
|
+
headers.set(xsrfHeaderName, xsrfValue);
|
|
2914
|
+
}
|
|
2915
|
+
}
|
|
2916
|
+
}
|
|
2917
|
+
return newConfig;
|
|
2918
|
+
});
|
|
2919
|
+
|
|
2452
2920
|
var isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
|
|
2453
2921
|
var xhrAdapter = isXHRAdapterSupported && function (config) {
|
|
2454
2922
|
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
|
2455
|
-
var
|
|
2456
|
-
var
|
|
2457
|
-
var
|
|
2458
|
-
|
|
2923
|
+
var _config = resolveConfig(config);
|
|
2924
|
+
var requestData = _config.data;
|
|
2925
|
+
var requestHeaders = AxiosHeaders$1.from(_config.headers).normalize();
|
|
2926
|
+
var responseType = _config.responseType,
|
|
2927
|
+
onUploadProgress = _config.onUploadProgress,
|
|
2928
|
+
onDownloadProgress = _config.onDownloadProgress;
|
|
2459
2929
|
var onCanceled;
|
|
2930
|
+
var uploadThrottled, downloadThrottled;
|
|
2931
|
+
var flushUpload, flushDownload;
|
|
2460
2932
|
function done() {
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
}
|
|
2464
|
-
if (config.signal) {
|
|
2465
|
-
config.signal.removeEventListener('abort', onCanceled);
|
|
2466
|
-
}
|
|
2467
|
-
}
|
|
2468
|
-
var contentType;
|
|
2469
|
-
if (utils$1.isFormData(requestData)) {
|
|
2470
|
-
if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
|
|
2471
|
-
requestHeaders.setContentType(false); // Let the browser set it
|
|
2472
|
-
} else if ((contentType = requestHeaders.getContentType()) !== false) {
|
|
2473
|
-
// fix semicolon duplication issue for ReactNative FormData implementation
|
|
2474
|
-
var _ref = contentType ? contentType.split(';').map(function (token) {
|
|
2475
|
-
return token.trim();
|
|
2476
|
-
}).filter(Boolean) : [],
|
|
2477
|
-
_ref2 = _toArray(_ref),
|
|
2478
|
-
type = _ref2[0],
|
|
2479
|
-
tokens = _ref2.slice(1);
|
|
2480
|
-
requestHeaders.setContentType([type || 'multipart/form-data'].concat(_toConsumableArray(tokens)).join('; '));
|
|
2481
|
-
}
|
|
2482
|
-
}
|
|
2483
|
-
var request = new XMLHttpRequest();
|
|
2933
|
+
flushUpload && flushUpload(); // flush events
|
|
2934
|
+
flushDownload && flushDownload(); // flush events
|
|
2484
2935
|
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
var username = config.auth.username || '';
|
|
2488
|
-
var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
|
|
2489
|
-
requestHeaders.set('Authorization', 'Basic ' + btoa(username + ':' + password));
|
|
2936
|
+
_config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
|
|
2937
|
+
_config.signal && _config.signal.removeEventListener('abort', onCanceled);
|
|
2490
2938
|
}
|
|
2491
|
-
var
|
|
2492
|
-
request.open(
|
|
2939
|
+
var request = new XMLHttpRequest();
|
|
2940
|
+
request.open(_config.method.toUpperCase(), _config.url, true);
|
|
2493
2941
|
|
|
2494
2942
|
// Set the request timeout in MS
|
|
2495
|
-
request.timeout =
|
|
2943
|
+
request.timeout = _config.timeout;
|
|
2496
2944
|
function onloadend() {
|
|
2497
2945
|
if (!request) {
|
|
2498
2946
|
return;
|
|
@@ -2565,10 +3013,10 @@
|
|
|
2565
3013
|
|
|
2566
3014
|
// Handle timeout
|
|
2567
3015
|
request.ontimeout = function handleTimeout() {
|
|
2568
|
-
var timeoutErrorMessage =
|
|
2569
|
-
var transitional =
|
|
2570
|
-
if (
|
|
2571
|
-
timeoutErrorMessage =
|
|
3016
|
+
var timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded';
|
|
3017
|
+
var transitional = _config.transitional || transitionalDefaults;
|
|
3018
|
+
if (_config.timeoutErrorMessage) {
|
|
3019
|
+
timeoutErrorMessage = _config.timeoutErrorMessage;
|
|
2572
3020
|
}
|
|
2573
3021
|
reject(new AxiosError(timeoutErrorMessage, transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED, config, request));
|
|
2574
3022
|
|
|
@@ -2576,20 +3024,6 @@
|
|
|
2576
3024
|
request = null;
|
|
2577
3025
|
};
|
|
2578
3026
|
|
|
2579
|
-
// Add xsrf header
|
|
2580
|
-
// This is only done if running in a standard browser environment.
|
|
2581
|
-
// Specifically not if we're in a web worker, or react-native.
|
|
2582
|
-
if (platform.hasStandardBrowserEnv) {
|
|
2583
|
-
withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(config));
|
|
2584
|
-
if (withXSRFToken || withXSRFToken !== false && isURLSameOrigin(fullPath)) {
|
|
2585
|
-
// Add xsrf header
|
|
2586
|
-
var xsrfValue = config.xsrfHeaderName && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
|
|
2587
|
-
if (xsrfValue) {
|
|
2588
|
-
requestHeaders.set(config.xsrfHeaderName, xsrfValue);
|
|
2589
|
-
}
|
|
2590
|
-
}
|
|
2591
|
-
}
|
|
2592
|
-
|
|
2593
3027
|
// Remove Content-Type if data is undefined
|
|
2594
3028
|
requestData === undefined && requestHeaders.setContentType(null);
|
|
2595
3029
|
|
|
@@ -2601,25 +3035,34 @@
|
|
|
2601
3035
|
}
|
|
2602
3036
|
|
|
2603
3037
|
// Add withCredentials to request if needed
|
|
2604
|
-
if (!utils$1.isUndefined(
|
|
2605
|
-
request.withCredentials = !!
|
|
3038
|
+
if (!utils$1.isUndefined(_config.withCredentials)) {
|
|
3039
|
+
request.withCredentials = !!_config.withCredentials;
|
|
2606
3040
|
}
|
|
2607
3041
|
|
|
2608
3042
|
// Add responseType to request if needed
|
|
2609
3043
|
if (responseType && responseType !== 'json') {
|
|
2610
|
-
request.responseType =
|
|
3044
|
+
request.responseType = _config.responseType;
|
|
2611
3045
|
}
|
|
2612
3046
|
|
|
2613
3047
|
// Handle progress if needed
|
|
2614
|
-
if (
|
|
2615
|
-
|
|
3048
|
+
if (onDownloadProgress) {
|
|
3049
|
+
var _progressEventReducer = progressEventReducer(onDownloadProgress, true);
|
|
3050
|
+
var _progressEventReducer2 = _slicedToArray(_progressEventReducer, 2);
|
|
3051
|
+
downloadThrottled = _progressEventReducer2[0];
|
|
3052
|
+
flushDownload = _progressEventReducer2[1];
|
|
3053
|
+
request.addEventListener('progress', downloadThrottled);
|
|
2616
3054
|
}
|
|
2617
3055
|
|
|
2618
3056
|
// Not all browsers support upload events
|
|
2619
|
-
if (
|
|
2620
|
-
|
|
3057
|
+
if (onUploadProgress && request.upload) {
|
|
3058
|
+
var _progressEventReducer3 = progressEventReducer(onUploadProgress);
|
|
3059
|
+
var _progressEventReducer4 = _slicedToArray(_progressEventReducer3, 2);
|
|
3060
|
+
uploadThrottled = _progressEventReducer4[0];
|
|
3061
|
+
flushUpload = _progressEventReducer4[1];
|
|
3062
|
+
request.upload.addEventListener('progress', uploadThrottled);
|
|
3063
|
+
request.upload.addEventListener('loadend', flushUpload);
|
|
2621
3064
|
}
|
|
2622
|
-
if (
|
|
3065
|
+
if (_config.cancelToken || _config.signal) {
|
|
2623
3066
|
// Handle cancellation
|
|
2624
3067
|
// eslint-disable-next-line func-names
|
|
2625
3068
|
onCanceled = function onCanceled(cancel) {
|
|
@@ -2630,12 +3073,12 @@
|
|
|
2630
3073
|
request.abort();
|
|
2631
3074
|
request = null;
|
|
2632
3075
|
};
|
|
2633
|
-
|
|
2634
|
-
if (
|
|
2635
|
-
|
|
3076
|
+
_config.cancelToken && _config.cancelToken.subscribe(onCanceled);
|
|
3077
|
+
if (_config.signal) {
|
|
3078
|
+
_config.signal.aborted ? onCanceled() : _config.signal.addEventListener('abort', onCanceled);
|
|
2636
3079
|
}
|
|
2637
3080
|
}
|
|
2638
|
-
var protocol = parseProtocol(
|
|
3081
|
+
var protocol = parseProtocol(_config.url);
|
|
2639
3082
|
if (protocol && platform.protocols.indexOf(protocol) === -1) {
|
|
2640
3083
|
reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
|
|
2641
3084
|
return;
|
|
@@ -2646,9 +3089,480 @@
|
|
|
2646
3089
|
});
|
|
2647
3090
|
};
|
|
2648
3091
|
|
|
3092
|
+
var composeSignals = function composeSignals(signals, timeout) {
|
|
3093
|
+
var controller = new AbortController();
|
|
3094
|
+
var aborted;
|
|
3095
|
+
var onabort = function onabort(cancel) {
|
|
3096
|
+
if (!aborted) {
|
|
3097
|
+
aborted = true;
|
|
3098
|
+
unsubscribe();
|
|
3099
|
+
var err = cancel instanceof Error ? cancel : this.reason;
|
|
3100
|
+
controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));
|
|
3101
|
+
}
|
|
3102
|
+
};
|
|
3103
|
+
var timer = timeout && setTimeout(function () {
|
|
3104
|
+
onabort(new AxiosError("timeout ".concat(timeout, " of ms exceeded"), AxiosError.ETIMEDOUT));
|
|
3105
|
+
}, timeout);
|
|
3106
|
+
var unsubscribe = function unsubscribe() {
|
|
3107
|
+
if (signals) {
|
|
3108
|
+
timer && clearTimeout(timer);
|
|
3109
|
+
timer = null;
|
|
3110
|
+
signals.forEach(function (signal) {
|
|
3111
|
+
signal && (signal.removeEventListener ? signal.removeEventListener('abort', onabort) : signal.unsubscribe(onabort));
|
|
3112
|
+
});
|
|
3113
|
+
signals = null;
|
|
3114
|
+
}
|
|
3115
|
+
};
|
|
3116
|
+
signals.forEach(function (signal) {
|
|
3117
|
+
return signal && signal.addEventListener && signal.addEventListener('abort', onabort);
|
|
3118
|
+
});
|
|
3119
|
+
var signal = controller.signal;
|
|
3120
|
+
signal.unsubscribe = unsubscribe;
|
|
3121
|
+
return [signal, function () {
|
|
3122
|
+
timer && clearTimeout(timer);
|
|
3123
|
+
timer = null;
|
|
3124
|
+
}];
|
|
3125
|
+
};
|
|
3126
|
+
var composeSignals$1 = composeSignals;
|
|
3127
|
+
|
|
3128
|
+
var streamChunk = /*#__PURE__*/_regeneratorRuntime().mark(function streamChunk(chunk, chunkSize) {
|
|
3129
|
+
var len, pos, end;
|
|
3130
|
+
return _regeneratorRuntime().wrap(function streamChunk$(_context) {
|
|
3131
|
+
while (1) switch (_context.prev = _context.next) {
|
|
3132
|
+
case 0:
|
|
3133
|
+
len = chunk.byteLength;
|
|
3134
|
+
if (!(!chunkSize || len < chunkSize)) {
|
|
3135
|
+
_context.next = 5;
|
|
3136
|
+
break;
|
|
3137
|
+
}
|
|
3138
|
+
_context.next = 4;
|
|
3139
|
+
return chunk;
|
|
3140
|
+
case 4:
|
|
3141
|
+
return _context.abrupt("return");
|
|
3142
|
+
case 5:
|
|
3143
|
+
pos = 0;
|
|
3144
|
+
case 6:
|
|
3145
|
+
if (!(pos < len)) {
|
|
3146
|
+
_context.next = 13;
|
|
3147
|
+
break;
|
|
3148
|
+
}
|
|
3149
|
+
end = pos + chunkSize;
|
|
3150
|
+
_context.next = 10;
|
|
3151
|
+
return chunk.slice(pos, end);
|
|
3152
|
+
case 10:
|
|
3153
|
+
pos = end;
|
|
3154
|
+
_context.next = 6;
|
|
3155
|
+
break;
|
|
3156
|
+
case 13:
|
|
3157
|
+
case "end":
|
|
3158
|
+
return _context.stop();
|
|
3159
|
+
}
|
|
3160
|
+
}, streamChunk);
|
|
3161
|
+
});
|
|
3162
|
+
var readBytes = /*#__PURE__*/function () {
|
|
3163
|
+
var _ref = _wrapAsyncGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(iterable, chunkSize, encode) {
|
|
3164
|
+
var _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, chunk;
|
|
3165
|
+
return _regeneratorRuntime().wrap(function _callee$(_context2) {
|
|
3166
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
3167
|
+
case 0:
|
|
3168
|
+
_iteratorAbruptCompletion = false;
|
|
3169
|
+
_didIteratorError = false;
|
|
3170
|
+
_context2.prev = 2;
|
|
3171
|
+
_iterator = _asyncIterator(iterable);
|
|
3172
|
+
case 4:
|
|
3173
|
+
_context2.next = 6;
|
|
3174
|
+
return _awaitAsyncGenerator(_iterator.next());
|
|
3175
|
+
case 6:
|
|
3176
|
+
if (!(_iteratorAbruptCompletion = !(_step = _context2.sent).done)) {
|
|
3177
|
+
_context2.next = 27;
|
|
3178
|
+
break;
|
|
3179
|
+
}
|
|
3180
|
+
chunk = _step.value;
|
|
3181
|
+
_context2.t0 = _asyncGeneratorDelegate;
|
|
3182
|
+
_context2.t1 = _asyncIterator;
|
|
3183
|
+
_context2.t2 = streamChunk;
|
|
3184
|
+
if (!ArrayBuffer.isView(chunk)) {
|
|
3185
|
+
_context2.next = 15;
|
|
3186
|
+
break;
|
|
3187
|
+
}
|
|
3188
|
+
_context2.t3 = chunk;
|
|
3189
|
+
_context2.next = 18;
|
|
3190
|
+
break;
|
|
3191
|
+
case 15:
|
|
3192
|
+
_context2.next = 17;
|
|
3193
|
+
return _awaitAsyncGenerator(encode(String(chunk)));
|
|
3194
|
+
case 17:
|
|
3195
|
+
_context2.t3 = _context2.sent;
|
|
3196
|
+
case 18:
|
|
3197
|
+
_context2.t4 = _context2.t3;
|
|
3198
|
+
_context2.t5 = chunkSize;
|
|
3199
|
+
_context2.t6 = (0, _context2.t2)(_context2.t4, _context2.t5);
|
|
3200
|
+
_context2.t7 = (0, _context2.t1)(_context2.t6);
|
|
3201
|
+
_context2.t8 = _awaitAsyncGenerator;
|
|
3202
|
+
return _context2.delegateYield((0, _context2.t0)(_context2.t7, _context2.t8), "t9", 24);
|
|
3203
|
+
case 24:
|
|
3204
|
+
_iteratorAbruptCompletion = false;
|
|
3205
|
+
_context2.next = 4;
|
|
3206
|
+
break;
|
|
3207
|
+
case 27:
|
|
3208
|
+
_context2.next = 33;
|
|
3209
|
+
break;
|
|
3210
|
+
case 29:
|
|
3211
|
+
_context2.prev = 29;
|
|
3212
|
+
_context2.t10 = _context2["catch"](2);
|
|
3213
|
+
_didIteratorError = true;
|
|
3214
|
+
_iteratorError = _context2.t10;
|
|
3215
|
+
case 33:
|
|
3216
|
+
_context2.prev = 33;
|
|
3217
|
+
_context2.prev = 34;
|
|
3218
|
+
if (!(_iteratorAbruptCompletion && _iterator["return"] != null)) {
|
|
3219
|
+
_context2.next = 38;
|
|
3220
|
+
break;
|
|
3221
|
+
}
|
|
3222
|
+
_context2.next = 38;
|
|
3223
|
+
return _awaitAsyncGenerator(_iterator["return"]());
|
|
3224
|
+
case 38:
|
|
3225
|
+
_context2.prev = 38;
|
|
3226
|
+
if (!_didIteratorError) {
|
|
3227
|
+
_context2.next = 41;
|
|
3228
|
+
break;
|
|
3229
|
+
}
|
|
3230
|
+
throw _iteratorError;
|
|
3231
|
+
case 41:
|
|
3232
|
+
return _context2.finish(38);
|
|
3233
|
+
case 42:
|
|
3234
|
+
return _context2.finish(33);
|
|
3235
|
+
case 43:
|
|
3236
|
+
case "end":
|
|
3237
|
+
return _context2.stop();
|
|
3238
|
+
}
|
|
3239
|
+
}, _callee, null, [[2, 29, 33, 43], [34,, 38, 42]]);
|
|
3240
|
+
}));
|
|
3241
|
+
return function readBytes(_x, _x2, _x3) {
|
|
3242
|
+
return _ref.apply(this, arguments);
|
|
3243
|
+
};
|
|
3244
|
+
}();
|
|
3245
|
+
var trackStream = function trackStream(stream, chunkSize, onProgress, onFinish, encode) {
|
|
3246
|
+
var iterator = readBytes(stream, chunkSize, encode);
|
|
3247
|
+
var bytes = 0;
|
|
3248
|
+
var done;
|
|
3249
|
+
var _onFinish = function _onFinish(e) {
|
|
3250
|
+
if (!done) {
|
|
3251
|
+
done = true;
|
|
3252
|
+
onFinish && onFinish(e);
|
|
3253
|
+
}
|
|
3254
|
+
};
|
|
3255
|
+
return new ReadableStream({
|
|
3256
|
+
pull: function pull(controller) {
|
|
3257
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
3258
|
+
var _yield$iterator$next, _done, value, len, loadedBytes;
|
|
3259
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context3) {
|
|
3260
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
3261
|
+
case 0:
|
|
3262
|
+
_context3.prev = 0;
|
|
3263
|
+
_context3.next = 3;
|
|
3264
|
+
return iterator.next();
|
|
3265
|
+
case 3:
|
|
3266
|
+
_yield$iterator$next = _context3.sent;
|
|
3267
|
+
_done = _yield$iterator$next.done;
|
|
3268
|
+
value = _yield$iterator$next.value;
|
|
3269
|
+
if (!_done) {
|
|
3270
|
+
_context3.next = 10;
|
|
3271
|
+
break;
|
|
3272
|
+
}
|
|
3273
|
+
_onFinish();
|
|
3274
|
+
controller.close();
|
|
3275
|
+
return _context3.abrupt("return");
|
|
3276
|
+
case 10:
|
|
3277
|
+
len = value.byteLength;
|
|
3278
|
+
if (onProgress) {
|
|
3279
|
+
loadedBytes = bytes += len;
|
|
3280
|
+
onProgress(loadedBytes);
|
|
3281
|
+
}
|
|
3282
|
+
controller.enqueue(new Uint8Array(value));
|
|
3283
|
+
_context3.next = 19;
|
|
3284
|
+
break;
|
|
3285
|
+
case 15:
|
|
3286
|
+
_context3.prev = 15;
|
|
3287
|
+
_context3.t0 = _context3["catch"](0);
|
|
3288
|
+
_onFinish(_context3.t0);
|
|
3289
|
+
throw _context3.t0;
|
|
3290
|
+
case 19:
|
|
3291
|
+
case "end":
|
|
3292
|
+
return _context3.stop();
|
|
3293
|
+
}
|
|
3294
|
+
}, _callee2, null, [[0, 15]]);
|
|
3295
|
+
}))();
|
|
3296
|
+
},
|
|
3297
|
+
cancel: function cancel(reason) {
|
|
3298
|
+
_onFinish(reason);
|
|
3299
|
+
return iterator["return"]();
|
|
3300
|
+
}
|
|
3301
|
+
}, {
|
|
3302
|
+
highWaterMark: 2
|
|
3303
|
+
});
|
|
3304
|
+
};
|
|
3305
|
+
|
|
3306
|
+
var isFetchSupported = typeof fetch === 'function' && typeof Request === 'function' && typeof Response === 'function';
|
|
3307
|
+
var isReadableStreamSupported = isFetchSupported && typeof ReadableStream === 'function';
|
|
3308
|
+
|
|
3309
|
+
// used only inside the fetch adapter
|
|
3310
|
+
var encodeText = isFetchSupported && (typeof TextEncoder === 'function' ? function (encoder) {
|
|
3311
|
+
return function (str) {
|
|
3312
|
+
return encoder.encode(str);
|
|
3313
|
+
};
|
|
3314
|
+
}(new TextEncoder()) : ( /*#__PURE__*/function () {
|
|
3315
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(str) {
|
|
3316
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
3317
|
+
while (1) switch (_context.prev = _context.next) {
|
|
3318
|
+
case 0:
|
|
3319
|
+
_context.t0 = Uint8Array;
|
|
3320
|
+
_context.next = 3;
|
|
3321
|
+
return new Response(str).arrayBuffer();
|
|
3322
|
+
case 3:
|
|
3323
|
+
_context.t1 = _context.sent;
|
|
3324
|
+
return _context.abrupt("return", new _context.t0(_context.t1));
|
|
3325
|
+
case 5:
|
|
3326
|
+
case "end":
|
|
3327
|
+
return _context.stop();
|
|
3328
|
+
}
|
|
3329
|
+
}, _callee);
|
|
3330
|
+
}));
|
|
3331
|
+
return function (_x) {
|
|
3332
|
+
return _ref.apply(this, arguments);
|
|
3333
|
+
};
|
|
3334
|
+
}()));
|
|
3335
|
+
var test = function test(fn) {
|
|
3336
|
+
try {
|
|
3337
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
3338
|
+
args[_key - 1] = arguments[_key];
|
|
3339
|
+
}
|
|
3340
|
+
return !!fn.apply(void 0, args);
|
|
3341
|
+
} catch (e) {
|
|
3342
|
+
return false;
|
|
3343
|
+
}
|
|
3344
|
+
};
|
|
3345
|
+
var supportsRequestStream = isReadableStreamSupported && test(function () {
|
|
3346
|
+
var duplexAccessed = false;
|
|
3347
|
+
var hasContentType = new Request(platform.origin, {
|
|
3348
|
+
body: new ReadableStream(),
|
|
3349
|
+
method: 'POST',
|
|
3350
|
+
get duplex() {
|
|
3351
|
+
duplexAccessed = true;
|
|
3352
|
+
return 'half';
|
|
3353
|
+
}
|
|
3354
|
+
}).headers.has('Content-Type');
|
|
3355
|
+
return duplexAccessed && !hasContentType;
|
|
3356
|
+
});
|
|
3357
|
+
var DEFAULT_CHUNK_SIZE = 64 * 1024;
|
|
3358
|
+
var supportsResponseStream = isReadableStreamSupported && test(function () {
|
|
3359
|
+
return utils$1.isReadableStream(new Response('').body);
|
|
3360
|
+
});
|
|
3361
|
+
var resolvers = {
|
|
3362
|
+
stream: supportsResponseStream && function (res) {
|
|
3363
|
+
return res.body;
|
|
3364
|
+
}
|
|
3365
|
+
};
|
|
3366
|
+
isFetchSupported && function (res) {
|
|
3367
|
+
['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(function (type) {
|
|
3368
|
+
!resolvers[type] && (resolvers[type] = utils$1.isFunction(res[type]) ? function (res) {
|
|
3369
|
+
return res[type]();
|
|
3370
|
+
} : function (_, config) {
|
|
3371
|
+
throw new AxiosError("Response type '".concat(type, "' is not supported"), AxiosError.ERR_NOT_SUPPORT, config);
|
|
3372
|
+
});
|
|
3373
|
+
});
|
|
3374
|
+
}(new Response());
|
|
3375
|
+
var getBodyLength = /*#__PURE__*/function () {
|
|
3376
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(body) {
|
|
3377
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
3378
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
3379
|
+
case 0:
|
|
3380
|
+
if (!(body == null)) {
|
|
3381
|
+
_context2.next = 2;
|
|
3382
|
+
break;
|
|
3383
|
+
}
|
|
3384
|
+
return _context2.abrupt("return", 0);
|
|
3385
|
+
case 2:
|
|
3386
|
+
if (!utils$1.isBlob(body)) {
|
|
3387
|
+
_context2.next = 4;
|
|
3388
|
+
break;
|
|
3389
|
+
}
|
|
3390
|
+
return _context2.abrupt("return", body.size);
|
|
3391
|
+
case 4:
|
|
3392
|
+
if (!utils$1.isSpecCompliantForm(body)) {
|
|
3393
|
+
_context2.next = 8;
|
|
3394
|
+
break;
|
|
3395
|
+
}
|
|
3396
|
+
_context2.next = 7;
|
|
3397
|
+
return new Request(body).arrayBuffer();
|
|
3398
|
+
case 7:
|
|
3399
|
+
return _context2.abrupt("return", _context2.sent.byteLength);
|
|
3400
|
+
case 8:
|
|
3401
|
+
if (!(utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body))) {
|
|
3402
|
+
_context2.next = 10;
|
|
3403
|
+
break;
|
|
3404
|
+
}
|
|
3405
|
+
return _context2.abrupt("return", body.byteLength);
|
|
3406
|
+
case 10:
|
|
3407
|
+
if (utils$1.isURLSearchParams(body)) {
|
|
3408
|
+
body = body + '';
|
|
3409
|
+
}
|
|
3410
|
+
if (!utils$1.isString(body)) {
|
|
3411
|
+
_context2.next = 15;
|
|
3412
|
+
break;
|
|
3413
|
+
}
|
|
3414
|
+
_context2.next = 14;
|
|
3415
|
+
return encodeText(body);
|
|
3416
|
+
case 14:
|
|
3417
|
+
return _context2.abrupt("return", _context2.sent.byteLength);
|
|
3418
|
+
case 15:
|
|
3419
|
+
case "end":
|
|
3420
|
+
return _context2.stop();
|
|
3421
|
+
}
|
|
3422
|
+
}, _callee2);
|
|
3423
|
+
}));
|
|
3424
|
+
return function getBodyLength(_x2) {
|
|
3425
|
+
return _ref2.apply(this, arguments);
|
|
3426
|
+
};
|
|
3427
|
+
}();
|
|
3428
|
+
var resolveBodyLength = /*#__PURE__*/function () {
|
|
3429
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(headers, body) {
|
|
3430
|
+
var length;
|
|
3431
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
3432
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
3433
|
+
case 0:
|
|
3434
|
+
length = utils$1.toFiniteNumber(headers.getContentLength());
|
|
3435
|
+
return _context3.abrupt("return", length == null ? getBodyLength(body) : length);
|
|
3436
|
+
case 2:
|
|
3437
|
+
case "end":
|
|
3438
|
+
return _context3.stop();
|
|
3439
|
+
}
|
|
3440
|
+
}, _callee3);
|
|
3441
|
+
}));
|
|
3442
|
+
return function resolveBodyLength(_x3, _x4) {
|
|
3443
|
+
return _ref3.apply(this, arguments);
|
|
3444
|
+
};
|
|
3445
|
+
}();
|
|
3446
|
+
var fetchAdapter = isFetchSupported && ( /*#__PURE__*/function () {
|
|
3447
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(config) {
|
|
3448
|
+
var _resolveConfig, url, method, data, signal, cancelToken, timeout, onDownloadProgress, onUploadProgress, responseType, headers, _resolveConfig$withCr, withCredentials, fetchOptions, _ref5, _ref6, composedSignal, stopTimeout, finished, request, onFinish, requestContentLength, _request, contentTypeHeader, _progressEventDecorat, _progressEventDecorat2, onProgress, flush, response, isStreamResponse, options, responseContentLength, _ref7, _ref8, _onProgress, _flush, responseData;
|
|
3449
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
3450
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
3451
|
+
case 0:
|
|
3452
|
+
_resolveConfig = resolveConfig(config), url = _resolveConfig.url, method = _resolveConfig.method, data = _resolveConfig.data, signal = _resolveConfig.signal, cancelToken = _resolveConfig.cancelToken, timeout = _resolveConfig.timeout, onDownloadProgress = _resolveConfig.onDownloadProgress, onUploadProgress = _resolveConfig.onUploadProgress, responseType = _resolveConfig.responseType, headers = _resolveConfig.headers, _resolveConfig$withCr = _resolveConfig.withCredentials, withCredentials = _resolveConfig$withCr === void 0 ? 'same-origin' : _resolveConfig$withCr, fetchOptions = _resolveConfig.fetchOptions;
|
|
3453
|
+
responseType = responseType ? (responseType + '').toLowerCase() : 'text';
|
|
3454
|
+
_ref5 = signal || cancelToken || timeout ? composeSignals$1([signal, cancelToken], timeout) : [], _ref6 = _slicedToArray(_ref5, 2), composedSignal = _ref6[0], stopTimeout = _ref6[1];
|
|
3455
|
+
onFinish = function onFinish() {
|
|
3456
|
+
!finished && setTimeout(function () {
|
|
3457
|
+
composedSignal && composedSignal.unsubscribe();
|
|
3458
|
+
});
|
|
3459
|
+
finished = true;
|
|
3460
|
+
};
|
|
3461
|
+
_context4.prev = 4;
|
|
3462
|
+
_context4.t0 = onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head';
|
|
3463
|
+
if (!_context4.t0) {
|
|
3464
|
+
_context4.next = 11;
|
|
3465
|
+
break;
|
|
3466
|
+
}
|
|
3467
|
+
_context4.next = 9;
|
|
3468
|
+
return resolveBodyLength(headers, data);
|
|
3469
|
+
case 9:
|
|
3470
|
+
_context4.t1 = requestContentLength = _context4.sent;
|
|
3471
|
+
_context4.t0 = _context4.t1 !== 0;
|
|
3472
|
+
case 11:
|
|
3473
|
+
if (!_context4.t0) {
|
|
3474
|
+
_context4.next = 15;
|
|
3475
|
+
break;
|
|
3476
|
+
}
|
|
3477
|
+
_request = new Request(url, {
|
|
3478
|
+
method: 'POST',
|
|
3479
|
+
body: data,
|
|
3480
|
+
duplex: "half"
|
|
3481
|
+
});
|
|
3482
|
+
if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
|
|
3483
|
+
headers.setContentType(contentTypeHeader);
|
|
3484
|
+
}
|
|
3485
|
+
if (_request.body) {
|
|
3486
|
+
_progressEventDecorat = progressEventDecorator(requestContentLength, progressEventReducer(asyncDecorator(onUploadProgress))), _progressEventDecorat2 = _slicedToArray(_progressEventDecorat, 2), onProgress = _progressEventDecorat2[0], flush = _progressEventDecorat2[1];
|
|
3487
|
+
data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush, encodeText);
|
|
3488
|
+
}
|
|
3489
|
+
case 15:
|
|
3490
|
+
if (!utils$1.isString(withCredentials)) {
|
|
3491
|
+
withCredentials = withCredentials ? 'include' : 'omit';
|
|
3492
|
+
}
|
|
3493
|
+
request = new Request(url, _objectSpread2(_objectSpread2({}, fetchOptions), {}, {
|
|
3494
|
+
signal: composedSignal,
|
|
3495
|
+
method: method.toUpperCase(),
|
|
3496
|
+
headers: headers.normalize().toJSON(),
|
|
3497
|
+
body: data,
|
|
3498
|
+
duplex: "half",
|
|
3499
|
+
credentials: withCredentials
|
|
3500
|
+
}));
|
|
3501
|
+
_context4.next = 19;
|
|
3502
|
+
return fetch(request);
|
|
3503
|
+
case 19:
|
|
3504
|
+
response = _context4.sent;
|
|
3505
|
+
isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
|
|
3506
|
+
if (supportsResponseStream && (onDownloadProgress || isStreamResponse)) {
|
|
3507
|
+
options = {};
|
|
3508
|
+
['status', 'statusText', 'headers'].forEach(function (prop) {
|
|
3509
|
+
options[prop] = response[prop];
|
|
3510
|
+
});
|
|
3511
|
+
responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
|
|
3512
|
+
_ref7 = onDownloadProgress && progressEventDecorator(responseContentLength, progressEventReducer(asyncDecorator(onDownloadProgress), true)) || [], _ref8 = _slicedToArray(_ref7, 2), _onProgress = _ref8[0], _flush = _ref8[1];
|
|
3513
|
+
response = new Response(trackStream(response.body, DEFAULT_CHUNK_SIZE, _onProgress, function () {
|
|
3514
|
+
_flush && _flush();
|
|
3515
|
+
isStreamResponse && onFinish();
|
|
3516
|
+
}, encodeText), options);
|
|
3517
|
+
}
|
|
3518
|
+
responseType = responseType || 'text';
|
|
3519
|
+
_context4.next = 25;
|
|
3520
|
+
return resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
|
|
3521
|
+
case 25:
|
|
3522
|
+
responseData = _context4.sent;
|
|
3523
|
+
!isStreamResponse && onFinish();
|
|
3524
|
+
stopTimeout && stopTimeout();
|
|
3525
|
+
_context4.next = 30;
|
|
3526
|
+
return new Promise(function (resolve, reject) {
|
|
3527
|
+
settle(resolve, reject, {
|
|
3528
|
+
data: responseData,
|
|
3529
|
+
headers: AxiosHeaders$1.from(response.headers),
|
|
3530
|
+
status: response.status,
|
|
3531
|
+
statusText: response.statusText,
|
|
3532
|
+
config: config,
|
|
3533
|
+
request: request
|
|
3534
|
+
});
|
|
3535
|
+
});
|
|
3536
|
+
case 30:
|
|
3537
|
+
return _context4.abrupt("return", _context4.sent);
|
|
3538
|
+
case 33:
|
|
3539
|
+
_context4.prev = 33;
|
|
3540
|
+
_context4.t2 = _context4["catch"](4);
|
|
3541
|
+
onFinish();
|
|
3542
|
+
if (!(_context4.t2 && _context4.t2.name === 'TypeError' && /fetch/i.test(_context4.t2.message))) {
|
|
3543
|
+
_context4.next = 38;
|
|
3544
|
+
break;
|
|
3545
|
+
}
|
|
3546
|
+
throw Object.assign(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request), {
|
|
3547
|
+
cause: _context4.t2.cause || _context4.t2
|
|
3548
|
+
});
|
|
3549
|
+
case 38:
|
|
3550
|
+
throw AxiosError.from(_context4.t2, _context4.t2 && _context4.t2.code, config, request);
|
|
3551
|
+
case 39:
|
|
3552
|
+
case "end":
|
|
3553
|
+
return _context4.stop();
|
|
3554
|
+
}
|
|
3555
|
+
}, _callee4, null, [[4, 33]]);
|
|
3556
|
+
}));
|
|
3557
|
+
return function (_x5) {
|
|
3558
|
+
return _ref4.apply(this, arguments);
|
|
3559
|
+
};
|
|
3560
|
+
}());
|
|
3561
|
+
|
|
2649
3562
|
var knownAdapters = {
|
|
2650
3563
|
http: httpAdapter,
|
|
2651
|
-
xhr: xhrAdapter
|
|
3564
|
+
xhr: xhrAdapter,
|
|
3565
|
+
fetch: fetchAdapter
|
|
2652
3566
|
};
|
|
2653
3567
|
utils$1.forEach(knownAdapters, function (fn, value) {
|
|
2654
3568
|
if (fn) {
|
|
@@ -2762,111 +3676,7 @@
|
|
|
2762
3676
|
});
|
|
2763
3677
|
}
|
|
2764
3678
|
|
|
2765
|
-
var
|
|
2766
|
-
return thing instanceof AxiosHeaders$1 ? _objectSpread2({}, thing) : thing;
|
|
2767
|
-
};
|
|
2768
|
-
|
|
2769
|
-
/**
|
|
2770
|
-
* Config-specific merge-function which creates a new config-object
|
|
2771
|
-
* by merging two configuration objects together.
|
|
2772
|
-
*
|
|
2773
|
-
* @param {Object} config1
|
|
2774
|
-
* @param {Object} config2
|
|
2775
|
-
*
|
|
2776
|
-
* @returns {Object} New object resulting from merging config2 to config1
|
|
2777
|
-
*/
|
|
2778
|
-
function mergeConfig(config1, config2) {
|
|
2779
|
-
// eslint-disable-next-line no-param-reassign
|
|
2780
|
-
config2 = config2 || {};
|
|
2781
|
-
var config = {};
|
|
2782
|
-
function getMergedValue(target, source, caseless) {
|
|
2783
|
-
if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
|
|
2784
|
-
return utils$1.merge.call({
|
|
2785
|
-
caseless: caseless
|
|
2786
|
-
}, target, source);
|
|
2787
|
-
} else if (utils$1.isPlainObject(source)) {
|
|
2788
|
-
return utils$1.merge({}, source);
|
|
2789
|
-
} else if (utils$1.isArray(source)) {
|
|
2790
|
-
return source.slice();
|
|
2791
|
-
}
|
|
2792
|
-
return source;
|
|
2793
|
-
}
|
|
2794
|
-
|
|
2795
|
-
// eslint-disable-next-line consistent-return
|
|
2796
|
-
function mergeDeepProperties(a, b, caseless) {
|
|
2797
|
-
if (!utils$1.isUndefined(b)) {
|
|
2798
|
-
return getMergedValue(a, b, caseless);
|
|
2799
|
-
} else if (!utils$1.isUndefined(a)) {
|
|
2800
|
-
return getMergedValue(undefined, a, caseless);
|
|
2801
|
-
}
|
|
2802
|
-
}
|
|
2803
|
-
|
|
2804
|
-
// eslint-disable-next-line consistent-return
|
|
2805
|
-
function valueFromConfig2(a, b) {
|
|
2806
|
-
if (!utils$1.isUndefined(b)) {
|
|
2807
|
-
return getMergedValue(undefined, b);
|
|
2808
|
-
}
|
|
2809
|
-
}
|
|
2810
|
-
|
|
2811
|
-
// eslint-disable-next-line consistent-return
|
|
2812
|
-
function defaultToConfig2(a, b) {
|
|
2813
|
-
if (!utils$1.isUndefined(b)) {
|
|
2814
|
-
return getMergedValue(undefined, b);
|
|
2815
|
-
} else if (!utils$1.isUndefined(a)) {
|
|
2816
|
-
return getMergedValue(undefined, a);
|
|
2817
|
-
}
|
|
2818
|
-
}
|
|
2819
|
-
|
|
2820
|
-
// eslint-disable-next-line consistent-return
|
|
2821
|
-
function mergeDirectKeys(a, b, prop) {
|
|
2822
|
-
if (prop in config2) {
|
|
2823
|
-
return getMergedValue(a, b);
|
|
2824
|
-
} else if (prop in config1) {
|
|
2825
|
-
return getMergedValue(undefined, a);
|
|
2826
|
-
}
|
|
2827
|
-
}
|
|
2828
|
-
var mergeMap = {
|
|
2829
|
-
url: valueFromConfig2,
|
|
2830
|
-
method: valueFromConfig2,
|
|
2831
|
-
data: valueFromConfig2,
|
|
2832
|
-
baseURL: defaultToConfig2,
|
|
2833
|
-
transformRequest: defaultToConfig2,
|
|
2834
|
-
transformResponse: defaultToConfig2,
|
|
2835
|
-
paramsSerializer: defaultToConfig2,
|
|
2836
|
-
timeout: defaultToConfig2,
|
|
2837
|
-
timeoutMessage: defaultToConfig2,
|
|
2838
|
-
withCredentials: defaultToConfig2,
|
|
2839
|
-
withXSRFToken: defaultToConfig2,
|
|
2840
|
-
adapter: defaultToConfig2,
|
|
2841
|
-
responseType: defaultToConfig2,
|
|
2842
|
-
xsrfCookieName: defaultToConfig2,
|
|
2843
|
-
xsrfHeaderName: defaultToConfig2,
|
|
2844
|
-
onUploadProgress: defaultToConfig2,
|
|
2845
|
-
onDownloadProgress: defaultToConfig2,
|
|
2846
|
-
decompress: defaultToConfig2,
|
|
2847
|
-
maxContentLength: defaultToConfig2,
|
|
2848
|
-
maxBodyLength: defaultToConfig2,
|
|
2849
|
-
beforeRedirect: defaultToConfig2,
|
|
2850
|
-
transport: defaultToConfig2,
|
|
2851
|
-
httpAgent: defaultToConfig2,
|
|
2852
|
-
httpsAgent: defaultToConfig2,
|
|
2853
|
-
cancelToken: defaultToConfig2,
|
|
2854
|
-
socketPath: defaultToConfig2,
|
|
2855
|
-
responseEncoding: defaultToConfig2,
|
|
2856
|
-
validateStatus: mergeDirectKeys,
|
|
2857
|
-
headers: function headers(a, b) {
|
|
2858
|
-
return mergeDeepProperties(headersToObject(a), headersToObject(b), true);
|
|
2859
|
-
}
|
|
2860
|
-
};
|
|
2861
|
-
utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
|
|
2862
|
-
var merge = mergeMap[prop] || mergeDeepProperties;
|
|
2863
|
-
var configValue = merge(config1[prop], config2[prop], prop);
|
|
2864
|
-
utils$1.isUndefined(configValue) && merge !== mergeDirectKeys || (config[prop] = configValue);
|
|
2865
|
-
});
|
|
2866
|
-
return config;
|
|
2867
|
-
}
|
|
2868
|
-
|
|
2869
|
-
var VERSION = "1.6.8";
|
|
3679
|
+
var VERSION = "1.7.4";
|
|
2870
3680
|
|
|
2871
3681
|
var validators$1 = {};
|
|
2872
3682
|
|
|
@@ -2991,11 +3801,15 @@
|
|
|
2991
3801
|
|
|
2992
3802
|
// slice off the Error: ... line
|
|
2993
3803
|
stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : '';
|
|
2994
|
-
|
|
2995
|
-
_context.t0.stack
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
_context.t0.stack
|
|
3804
|
+
try {
|
|
3805
|
+
if (!_context.t0.stack) {
|
|
3806
|
+
_context.t0.stack = stack;
|
|
3807
|
+
// match without the 2 top stack lines
|
|
3808
|
+
} else if (stack && !String(_context.t0.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) {
|
|
3809
|
+
_context.t0.stack += '\n' + stack;
|
|
3810
|
+
}
|
|
3811
|
+
} catch (e) {
|
|
3812
|
+
// ignore the case where "stack" is an un-writable property
|
|
2999
3813
|
}
|
|
3000
3814
|
}
|
|
3001
3815
|
throw _context.t0;
|