@wiajs/req 1.7.28 → 1.7.30
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/node/req.cjs +124 -119
- package/dist/req.js +66 -63
- package/dist/req.min.js +3 -3
- package/dist/web/req.cjs +1911 -2397
- package/dist/web/req.mjs +1917 -2421
- package/lib/adapters/http.js +48 -40
- package/lib/adapters/xhr.js +3 -3
- package/lib/cancel/CancelToken.js +40 -40
- package/lib/core/Axios.js +11 -11
- package/lib/core/AxiosHeaders.js +3 -3
- package/lib/core/InterceptorManager.js +3 -3
- package/lib/helpers/AxiosTransformStream.js +34 -34
- package/lib/helpers/formDataToStream.js +18 -18
- package/lib/platform/node/classes/URLSearchParams.js +1 -1
- package/package.json +226 -214
package/dist/web/req.mjs
CHANGED
|
@@ -1,233 +1,183 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @wia/req v1.7.
|
|
3
|
-
* (c) 2024 Sibyl Yu, Matt Zabriskie and contributors
|
|
2
|
+
* @wia/req v1.7.30
|
|
3
|
+
* (c) 2024-2025 Sibyl Yu, Matt Zabriskie and contributors
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
function bind$1(fn, thisArg) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
function bind$1(fn, thisArg) {
|
|
7
|
+
return function wrap() {
|
|
8
|
+
return fn.apply(thisArg, arguments);
|
|
9
|
+
};
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
// utils is a library of generic helper functions non-specific to axios
|
|
13
|
-
|
|
14
|
-
const {
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return (thing) => kindOf$1(thing) === type
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
const typeOfTest$1 = type => thing => typeof thing === type;
|
|
28
|
-
|
|
12
|
+
// utils is a library of generic helper functions non-specific to axios
|
|
13
|
+
const { toString: toString$1 } = Object.prototype;
|
|
14
|
+
const { getPrototypeOf: getPrototypeOf$1 } = Object;
|
|
15
|
+
const kindOf$1 = ((cache)=>(thing)=>{
|
|
16
|
+
const str = toString$1.call(thing);
|
|
17
|
+
return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
|
|
18
|
+
})(Object.create(null));
|
|
19
|
+
const kindOfTest$1 = (type)=>{
|
|
20
|
+
type = type.toLowerCase();
|
|
21
|
+
return (thing)=>kindOf$1(thing) === type;
|
|
22
|
+
};
|
|
23
|
+
const typeOfTest$1 = (type)=>(thing)=>typeof thing === type;
|
|
29
24
|
/**
|
|
30
25
|
* Determine if a value is an Array
|
|
31
26
|
*
|
|
32
27
|
* @param {Object} val The value to test
|
|
33
28
|
*
|
|
34
29
|
* @returns {boolean} True if value is an Array, otherwise false
|
|
35
|
-
*/
|
|
36
|
-
const {isArray: isArray$1} = Array;
|
|
37
|
-
|
|
30
|
+
*/ const { isArray: isArray$1 } = Array;
|
|
38
31
|
/**
|
|
39
32
|
* Determine if a value is undefined
|
|
40
33
|
*
|
|
41
34
|
* @param {*} val The value to test
|
|
42
35
|
*
|
|
43
36
|
* @returns {boolean} True if the value is undefined, otherwise false
|
|
44
|
-
*/
|
|
45
|
-
const isUndefined$1 = typeOfTest$1('undefined');
|
|
46
|
-
|
|
37
|
+
*/ const isUndefined$1 = typeOfTest$1('undefined');
|
|
47
38
|
/**
|
|
48
39
|
* Determine if a value is a Buffer
|
|
49
40
|
*
|
|
50
41
|
* @param {*} val The value to test
|
|
51
42
|
*
|
|
52
43
|
* @returns {boolean} True if value is a Buffer, otherwise false
|
|
53
|
-
*/
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
&& isFunction$1(val.constructor.isBuffer) && val.constructor.isBuffer(val);
|
|
57
|
-
}
|
|
58
|
-
|
|
44
|
+
*/ function isBuffer$1(val) {
|
|
45
|
+
return val !== null && !isUndefined$1(val) && val.constructor !== null && !isUndefined$1(val.constructor) && isFunction$1(val.constructor.isBuffer) && val.constructor.isBuffer(val);
|
|
46
|
+
}
|
|
59
47
|
/**
|
|
60
48
|
* Determine if a value is an ArrayBuffer
|
|
61
49
|
*
|
|
62
50
|
* @param {*} val The value to test
|
|
63
51
|
*
|
|
64
52
|
* @returns {boolean} True if value is an ArrayBuffer, otherwise false
|
|
65
|
-
*/
|
|
66
|
-
const isArrayBuffer$1 = kindOfTest$1('ArrayBuffer');
|
|
67
|
-
|
|
68
|
-
|
|
53
|
+
*/ const isArrayBuffer$1 = kindOfTest$1('ArrayBuffer');
|
|
69
54
|
/**
|
|
70
55
|
* Determine if a value is a view on an ArrayBuffer
|
|
71
56
|
*
|
|
72
57
|
* @param {*} val The value to test
|
|
73
58
|
*
|
|
74
59
|
* @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
|
|
75
|
-
*/
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
85
|
-
|
|
60
|
+
*/ function isArrayBufferView$1(val) {
|
|
61
|
+
let result;
|
|
62
|
+
if (typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView) {
|
|
63
|
+
result = ArrayBuffer.isView(val);
|
|
64
|
+
} else {
|
|
65
|
+
result = val && val.buffer && isArrayBuffer$1(val.buffer);
|
|
66
|
+
}
|
|
67
|
+
return result;
|
|
68
|
+
}
|
|
86
69
|
/**
|
|
87
70
|
* Determine if a value is a String
|
|
88
71
|
*
|
|
89
72
|
* @param {*} val The value to test
|
|
90
73
|
*
|
|
91
74
|
* @returns {boolean} True if value is a String, otherwise false
|
|
92
|
-
*/
|
|
93
|
-
const isString$1 = typeOfTest$1('string');
|
|
94
|
-
|
|
75
|
+
*/ const isString$1 = typeOfTest$1('string');
|
|
95
76
|
/**
|
|
96
77
|
* Determine if a value is a Function
|
|
97
78
|
*
|
|
98
79
|
* @param {*} val The value to test
|
|
99
80
|
* @returns {boolean} True if value is a Function, otherwise false
|
|
100
|
-
*/
|
|
101
|
-
const isFunction$1 = typeOfTest$1('function');
|
|
102
|
-
|
|
81
|
+
*/ const isFunction$1 = typeOfTest$1('function');
|
|
103
82
|
/**
|
|
104
83
|
* Determine if a value is a Number
|
|
105
84
|
*
|
|
106
85
|
* @param {*} val The value to test
|
|
107
86
|
*
|
|
108
87
|
* @returns {boolean} True if value is a Number, otherwise false
|
|
109
|
-
*/
|
|
110
|
-
const isNumber$1 = typeOfTest$1('number');
|
|
111
|
-
|
|
88
|
+
*/ const isNumber$1 = typeOfTest$1('number');
|
|
112
89
|
/**
|
|
113
90
|
* Determine if a value is an Object
|
|
114
91
|
*
|
|
115
92
|
* @param {*} thing The value to test
|
|
116
93
|
*
|
|
117
94
|
* @returns {boolean} True if value is an Object, otherwise false
|
|
118
|
-
*/
|
|
119
|
-
const isObject$1 = (thing) => thing !== null && typeof thing === 'object';
|
|
120
|
-
|
|
95
|
+
*/ const isObject$1 = (thing)=>thing !== null && typeof thing === 'object';
|
|
121
96
|
/**
|
|
122
97
|
* Determine if a value is a Boolean
|
|
123
98
|
*
|
|
124
99
|
* @param {*} thing The value to test
|
|
125
100
|
* @returns {boolean} True if value is a Boolean, otherwise false
|
|
126
|
-
*/
|
|
127
|
-
const isBoolean$1 = thing => thing === true || thing === false;
|
|
128
|
-
|
|
101
|
+
*/ const isBoolean$1 = (thing)=>thing === true || thing === false;
|
|
129
102
|
/**
|
|
130
103
|
* Determine if a value is a plain Object
|
|
131
104
|
*
|
|
132
105
|
* @param {*} val The value to test
|
|
133
106
|
*
|
|
134
107
|
* @returns {boolean} True if value is a plain Object, otherwise false
|
|
135
|
-
*/
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val);
|
|
143
|
-
};
|
|
144
|
-
|
|
108
|
+
*/ const isPlainObject$1 = (val)=>{
|
|
109
|
+
if (kindOf$1(val) !== 'object') {
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
const prototype = getPrototypeOf$1(val);
|
|
113
|
+
return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val);
|
|
114
|
+
};
|
|
145
115
|
/**
|
|
146
116
|
* Determine if a value is a Date
|
|
147
117
|
*
|
|
148
118
|
* @param {*} val The value to test
|
|
149
119
|
*
|
|
150
120
|
* @returns {boolean} True if value is a Date, otherwise false
|
|
151
|
-
*/
|
|
152
|
-
const isDate$1 = kindOfTest$1('Date');
|
|
153
|
-
|
|
121
|
+
*/ const isDate$1 = kindOfTest$1('Date');
|
|
154
122
|
/**
|
|
155
123
|
* Determine if a value is a File
|
|
156
124
|
*
|
|
157
125
|
* @param {*} val The value to test
|
|
158
126
|
*
|
|
159
127
|
* @returns {boolean} True if value is a File, otherwise false
|
|
160
|
-
*/
|
|
161
|
-
const isFile$1 = kindOfTest$1('File');
|
|
162
|
-
|
|
128
|
+
*/ const isFile$1 = kindOfTest$1('File');
|
|
163
129
|
/**
|
|
164
130
|
* Determine if a value is a Blob
|
|
165
131
|
*
|
|
166
132
|
* @param {*} val The value to test
|
|
167
133
|
*
|
|
168
134
|
* @returns {boolean} True if value is a Blob, otherwise false
|
|
169
|
-
*/
|
|
170
|
-
const isBlob$1 = kindOfTest$1('Blob');
|
|
171
|
-
|
|
135
|
+
*/ const isBlob$1 = kindOfTest$1('Blob');
|
|
172
136
|
/**
|
|
173
137
|
* Determine if a value is a FileList
|
|
174
138
|
*
|
|
175
139
|
* @param {*} val The value to test
|
|
176
140
|
*
|
|
177
141
|
* @returns {boolean} True if value is a File, otherwise false
|
|
178
|
-
*/
|
|
179
|
-
const isFileList$1 = kindOfTest$1('FileList');
|
|
180
|
-
|
|
142
|
+
*/ const isFileList$1 = kindOfTest$1('FileList');
|
|
181
143
|
/**
|
|
182
144
|
* Determine if a value is a Stream
|
|
183
145
|
*
|
|
184
146
|
* @param {*} val The value to test
|
|
185
147
|
*
|
|
186
148
|
* @returns {boolean} True if value is a Stream, otherwise false
|
|
187
|
-
*/
|
|
188
|
-
const isStream$1 = (val) => isObject$1(val) && isFunction$1(val.pipe);
|
|
189
|
-
|
|
149
|
+
*/ const isStream$1 = (val)=>isObject$1(val) && isFunction$1(val.pipe);
|
|
190
150
|
/**
|
|
191
151
|
* Determine if a value is a FormData
|
|
192
152
|
*
|
|
193
153
|
* @param {*} thing The value to test
|
|
194
154
|
*
|
|
195
155
|
* @returns {boolean} True if value is an FormData, otherwise false
|
|
196
|
-
*/
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
isFunction$1(thing.append) && (
|
|
202
|
-
(kind = kindOf$1(thing)) === 'formdata' ||
|
|
203
|
-
// detect form-data instance
|
|
204
|
-
(kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]')
|
|
205
|
-
)
|
|
206
|
-
)
|
|
207
|
-
)
|
|
208
|
-
};
|
|
209
|
-
|
|
156
|
+
*/ const isFormData$1 = (thing)=>{
|
|
157
|
+
let kind;
|
|
158
|
+
return thing && (typeof FormData === 'function' && thing instanceof FormData || isFunction$1(thing.append) && ((kind = kindOf$1(thing)) === 'formdata' || // detect form-data instance
|
|
159
|
+
kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]'));
|
|
160
|
+
};
|
|
210
161
|
/**
|
|
211
162
|
* Determine if a value is a URLSearchParams object
|
|
212
163
|
*
|
|
213
164
|
* @param {*} val The value to test
|
|
214
165
|
*
|
|
215
166
|
* @returns {boolean} True if value is a URLSearchParams object, otherwise false
|
|
216
|
-
*/
|
|
217
|
-
const
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
167
|
+
*/ const isURLSearchParams$1 = kindOfTest$1('URLSearchParams');
|
|
168
|
+
const [isReadableStream$1, isRequest$1, isResponse$1, isHeaders$1] = [
|
|
169
|
+
'ReadableStream',
|
|
170
|
+
'Request',
|
|
171
|
+
'Response',
|
|
172
|
+
'Headers'
|
|
173
|
+
].map(kindOfTest$1);
|
|
221
174
|
/**
|
|
222
175
|
* Trim excess whitespace off the beginning and end of a string
|
|
223
176
|
*
|
|
224
177
|
* @param {String} str The String to trim
|
|
225
178
|
*
|
|
226
179
|
* @returns {String} The String freed of excess whitespace
|
|
227
|
-
*/
|
|
228
|
-
const trim$1 = (str) => str.trim ?
|
|
229
|
-
str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
|
|
230
|
-
|
|
180
|
+
*/ const trim$1 = (str)=>str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
|
|
231
181
|
/**
|
|
232
182
|
* Iterate over an Array or an Object invoking a function for each item.
|
|
233
183
|
*
|
|
@@ -242,62 +192,53 @@ const trim$1 = (str) => str.trim ?
|
|
|
242
192
|
*
|
|
243
193
|
* @param {Boolean} [allOwnKeys = false]
|
|
244
194
|
* @returns {any}
|
|
245
|
-
*/
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
obj
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
const _global$1 = (() => {
|
|
294
|
-
/*eslint no-undef:0*/
|
|
295
|
-
if (typeof globalThis !== "undefined") return globalThis;
|
|
296
|
-
return typeof self !== "undefined" ? self : (typeof window !== 'undefined' ? window : global)
|
|
297
|
-
})();
|
|
298
|
-
|
|
299
|
-
const isContextDefined$1 = (context) => !isUndefined$1(context) && context !== _global$1;
|
|
300
|
-
|
|
195
|
+
*/ function forEach$1(obj, fn, { allOwnKeys = false } = {}) {
|
|
196
|
+
// Don't bother if no value provided
|
|
197
|
+
if (obj === null || typeof obj === 'undefined') {
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
let i;
|
|
201
|
+
let l;
|
|
202
|
+
// Force an array if not already something iterable
|
|
203
|
+
if (typeof obj !== 'object') {
|
|
204
|
+
/*eslint no-param-reassign:0*/ obj = [
|
|
205
|
+
obj
|
|
206
|
+
];
|
|
207
|
+
}
|
|
208
|
+
if (isArray$1(obj)) {
|
|
209
|
+
// Iterate over array values
|
|
210
|
+
for(i = 0, l = obj.length; i < l; i++){
|
|
211
|
+
fn.call(null, obj[i], i, obj);
|
|
212
|
+
}
|
|
213
|
+
} else {
|
|
214
|
+
// Iterate over object keys
|
|
215
|
+
const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
|
|
216
|
+
const len = keys.length;
|
|
217
|
+
let key;
|
|
218
|
+
for(i = 0; i < len; i++){
|
|
219
|
+
key = keys[i];
|
|
220
|
+
fn.call(null, obj[key], key, obj);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
function findKey$1(obj, key) {
|
|
225
|
+
key = key.toLowerCase();
|
|
226
|
+
const keys = Object.keys(obj);
|
|
227
|
+
let i = keys.length;
|
|
228
|
+
let _key;
|
|
229
|
+
while(i-- > 0){
|
|
230
|
+
_key = keys[i];
|
|
231
|
+
if (key === _key.toLowerCase()) {
|
|
232
|
+
return _key;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
return null;
|
|
236
|
+
}
|
|
237
|
+
const _global$1 = (()=>{
|
|
238
|
+
/*eslint no-undef:0*/ if (typeof globalThis !== "undefined") return globalThis;
|
|
239
|
+
return typeof self !== "undefined" ? self : typeof window !== 'undefined' ? window : global;
|
|
240
|
+
})();
|
|
241
|
+
const isContextDefined$1 = (context)=>!isUndefined$1(context) && context !== _global$1;
|
|
301
242
|
/**
|
|
302
243
|
* Accepts varargs expecting each argument to be an object, then
|
|
303
244
|
* immutably merges the properties of each object and returns result.
|
|
@@ -315,29 +256,26 @@ const isContextDefined$1 = (context) => !isUndefined$1(context) && context !== _
|
|
|
315
256
|
* @param {Object} obj1 Object to merge
|
|
316
257
|
*
|
|
317
258
|
* @returns {Object} Result of all merge properties
|
|
318
|
-
*/
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
return result;
|
|
339
|
-
}
|
|
340
|
-
|
|
259
|
+
*/ function merge$1() {
|
|
260
|
+
const { caseless } = isContextDefined$1(this) && this || {};
|
|
261
|
+
const result = {};
|
|
262
|
+
const assignValue = (val, key)=>{
|
|
263
|
+
const targetKey = caseless && findKey$1(result, key) || key;
|
|
264
|
+
if (isPlainObject$1(result[targetKey]) && isPlainObject$1(val)) {
|
|
265
|
+
result[targetKey] = merge$1(result[targetKey], val);
|
|
266
|
+
} else if (isPlainObject$1(val)) {
|
|
267
|
+
result[targetKey] = merge$1({}, val);
|
|
268
|
+
} else if (isArray$1(val)) {
|
|
269
|
+
result[targetKey] = val.slice();
|
|
270
|
+
} else {
|
|
271
|
+
result[targetKey] = val;
|
|
272
|
+
}
|
|
273
|
+
};
|
|
274
|
+
for(let i = 0, l = arguments.length; i < l; i++){
|
|
275
|
+
arguments[i] && forEach$1(arguments[i], assignValue);
|
|
276
|
+
}
|
|
277
|
+
return result;
|
|
278
|
+
}
|
|
341
279
|
/**
|
|
342
280
|
* Extends object a by mutably adding to it the properties of object b.
|
|
343
281
|
*
|
|
@@ -347,32 +285,30 @@ function merge$1(/* obj1, obj2, obj3, ... */) {
|
|
|
347
285
|
*
|
|
348
286
|
* @param {Boolean} [allOwnKeys]
|
|
349
287
|
* @returns {Object} The resulting value of object a
|
|
350
|
-
*/
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
288
|
+
*/ const extend$1 = (a, b, thisArg, { allOwnKeys } = {})=>{
|
|
289
|
+
forEach$1(b, (val, key)=>{
|
|
290
|
+
if (thisArg && isFunction$1(val)) {
|
|
291
|
+
a[key] = bind$1(val, thisArg);
|
|
292
|
+
} else {
|
|
293
|
+
a[key] = val;
|
|
294
|
+
}
|
|
295
|
+
}, {
|
|
296
|
+
allOwnKeys
|
|
297
|
+
});
|
|
298
|
+
return a;
|
|
299
|
+
};
|
|
362
300
|
/**
|
|
363
301
|
* Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
|
|
364
302
|
*
|
|
365
303
|
* @param {string} content with BOM
|
|
366
304
|
*
|
|
367
305
|
* @returns {string} content value without BOM
|
|
368
|
-
*/
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
};
|
|
375
|
-
|
|
306
|
+
*/ const stripBOM$1 = (content)=>{
|
|
307
|
+
if (content.charCodeAt(0) === 0xFEFF) {
|
|
308
|
+
content = content.slice(1);
|
|
309
|
+
}
|
|
310
|
+
return content;
|
|
311
|
+
};
|
|
376
312
|
/**
|
|
377
313
|
* Inherit the prototype methods from one constructor into another
|
|
378
314
|
* @param {function} constructor
|
|
@@ -381,16 +317,14 @@ const stripBOM$1 = (content) => {
|
|
|
381
317
|
* @param {object} [descriptors]
|
|
382
318
|
*
|
|
383
319
|
* @returns {void}
|
|
384
|
-
*/
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
};
|
|
393
|
-
|
|
320
|
+
*/ const inherits$1 = (constructor, superConstructor, props, descriptors)=>{
|
|
321
|
+
constructor.prototype = Object.create(superConstructor.prototype, descriptors);
|
|
322
|
+
constructor.prototype.constructor = constructor;
|
|
323
|
+
Object.defineProperty(constructor, 'super', {
|
|
324
|
+
value: superConstructor.prototype
|
|
325
|
+
});
|
|
326
|
+
props && Object.assign(constructor.prototype, props);
|
|
327
|
+
};
|
|
394
328
|
/**
|
|
395
329
|
* Resolve object with deep prototype chain to a flat object
|
|
396
330
|
* @param {Object} sourceObj source object
|
|
@@ -399,33 +333,28 @@ const inherits$1 = (constructor, superConstructor, props, descriptors) => {
|
|
|
399
333
|
* @param {Function} [propFilter]
|
|
400
334
|
*
|
|
401
335
|
* @returns {Object}
|
|
402
|
-
*/
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
} while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);
|
|
425
|
-
|
|
426
|
-
return destObj;
|
|
427
|
-
};
|
|
428
|
-
|
|
336
|
+
*/ const toFlatObject$1 = (sourceObj, destObj, filter, propFilter)=>{
|
|
337
|
+
let props;
|
|
338
|
+
let i;
|
|
339
|
+
let prop;
|
|
340
|
+
const merged = {};
|
|
341
|
+
destObj = destObj || {};
|
|
342
|
+
// eslint-disable-next-line no-eq-null,eqeqeq
|
|
343
|
+
if (sourceObj == null) return destObj;
|
|
344
|
+
do {
|
|
345
|
+
props = Object.getOwnPropertyNames(sourceObj);
|
|
346
|
+
i = props.length;
|
|
347
|
+
while(i-- > 0){
|
|
348
|
+
prop = props[i];
|
|
349
|
+
if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
|
|
350
|
+
destObj[prop] = sourceObj[prop];
|
|
351
|
+
merged[prop] = true;
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
sourceObj = filter !== false && getPrototypeOf$1(sourceObj);
|
|
355
|
+
}while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype)
|
|
356
|
+
return destObj;
|
|
357
|
+
};
|
|
429
358
|
/**
|
|
430
359
|
* Determines whether a string ends with the characters of a specified string
|
|
431
360
|
*
|
|
@@ -434,37 +363,32 @@ const toFlatObject$1 = (sourceObj, destObj, filter, propFilter) => {
|
|
|
434
363
|
* @param {Number} [position= 0]
|
|
435
364
|
*
|
|
436
365
|
* @returns {boolean}
|
|
437
|
-
*/
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
};
|
|
447
|
-
|
|
448
|
-
|
|
366
|
+
*/ const endsWith$1 = (str, searchString, position)=>{
|
|
367
|
+
str = String(str);
|
|
368
|
+
if (position === undefined || position > str.length) {
|
|
369
|
+
position = str.length;
|
|
370
|
+
}
|
|
371
|
+
position -= searchString.length;
|
|
372
|
+
const lastIndex = str.indexOf(searchString, position);
|
|
373
|
+
return lastIndex !== -1 && lastIndex === position;
|
|
374
|
+
};
|
|
449
375
|
/**
|
|
450
376
|
* Returns new array from array like object or null if failed
|
|
451
377
|
*
|
|
452
378
|
* @param {*} [thing]
|
|
453
379
|
*
|
|
454
380
|
* @returns {?Array}
|
|
455
|
-
*/
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
};
|
|
467
|
-
|
|
381
|
+
*/ const toArray$1 = (thing)=>{
|
|
382
|
+
if (!thing) return null;
|
|
383
|
+
if (isArray$1(thing)) return thing;
|
|
384
|
+
let i = thing.length;
|
|
385
|
+
if (!isNumber$1(i)) return null;
|
|
386
|
+
const arr = new Array(i);
|
|
387
|
+
while(i-- > 0){
|
|
388
|
+
arr[i] = thing[i];
|
|
389
|
+
}
|
|
390
|
+
return arr;
|
|
391
|
+
};
|
|
468
392
|
/**
|
|
469
393
|
* Checking if the Uint8Array exists and if it does, it returns a function that checks if the
|
|
470
394
|
* thing passed in is an instance of Uint8Array
|
|
@@ -472,15 +396,13 @@ const toArray$1 = (thing) => {
|
|
|
472
396
|
* @param {TypedArray}
|
|
473
397
|
*
|
|
474
398
|
* @returns {Array}
|
|
475
|
-
*/
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
})(typeof Uint8Array !== 'undefined' && getPrototypeOf$1(Uint8Array));
|
|
483
|
-
|
|
399
|
+
*/ // eslint-disable-next-line func-names
|
|
400
|
+
const isTypedArray$1 = ((TypedArray)=>{
|
|
401
|
+
// eslint-disable-next-line func-names
|
|
402
|
+
return (thing)=>{
|
|
403
|
+
return TypedArray && thing instanceof TypedArray;
|
|
404
|
+
};
|
|
405
|
+
})(typeof Uint8Array !== 'undefined' && getPrototypeOf$1(Uint8Array));
|
|
484
406
|
/**
|
|
485
407
|
* For each entry in the object, call the function with the key and value.
|
|
486
408
|
*
|
|
@@ -488,20 +410,15 @@ const isTypedArray$1 = (TypedArray => {
|
|
|
488
410
|
* @param {Function} fn - The function to call for each entry.
|
|
489
411
|
*
|
|
490
412
|
* @returns {void}
|
|
491
|
-
*/
|
|
492
|
-
const
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
const pair = result.value;
|
|
501
|
-
fn.call(obj, pair[0], pair[1]);
|
|
502
|
-
}
|
|
503
|
-
};
|
|
504
|
-
|
|
413
|
+
*/ const forEachEntry$1 = (obj, fn)=>{
|
|
414
|
+
const generator = obj && obj[Symbol.iterator];
|
|
415
|
+
const iterator = generator.call(obj);
|
|
416
|
+
let result;
|
|
417
|
+
while((result = iterator.next()) && !result.done){
|
|
418
|
+
const pair = result.value;
|
|
419
|
+
fn.call(obj, pair[0], pair[1]);
|
|
420
|
+
}
|
|
421
|
+
};
|
|
505
422
|
/**
|
|
506
423
|
* It takes a regular expression and a string, and returns an array of all the matches
|
|
507
424
|
*
|
|
@@ -509,280 +426,221 @@ const forEachEntry$1 = (obj, fn) => {
|
|
|
509
426
|
* @param {string} str - The string to search.
|
|
510
427
|
*
|
|
511
428
|
* @returns {Array<boolean>}
|
|
512
|
-
*/
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
arr
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
const toCamelCase$1 = str => {
|
|
528
|
-
return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,
|
|
529
|
-
function replacer(m, p1, p2) {
|
|
530
|
-
return p1.toUpperCase() + p2;
|
|
531
|
-
}
|
|
532
|
-
);
|
|
533
|
-
};
|
|
534
|
-
|
|
535
|
-
/* Creating a function that will check if an object has a property. */
|
|
536
|
-
const hasOwnProperty$1 = (({hasOwnProperty}) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype);
|
|
537
|
-
|
|
429
|
+
*/ const matchAll$1 = (regExp, str)=>{
|
|
430
|
+
let matches;
|
|
431
|
+
const arr = [];
|
|
432
|
+
while((matches = regExp.exec(str)) !== null){
|
|
433
|
+
arr.push(matches);
|
|
434
|
+
}
|
|
435
|
+
return arr;
|
|
436
|
+
};
|
|
437
|
+
/* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */ const isHTMLForm$1 = kindOfTest$1('HTMLFormElement');
|
|
438
|
+
const toCamelCase$1 = (str)=>{
|
|
439
|
+
return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g, function replacer(m, p1, p2) {
|
|
440
|
+
return p1.toUpperCase() + p2;
|
|
441
|
+
});
|
|
442
|
+
};
|
|
443
|
+
/* Creating a function that will check if an object has a property. */ const hasOwnProperty$1 = (({ hasOwnProperty })=>(obj, prop)=>hasOwnProperty.call(obj, prop))(Object.prototype);
|
|
538
444
|
/**
|
|
539
445
|
* Determine if a value is a RegExp object
|
|
540
446
|
*
|
|
541
447
|
* @param {*} val The value to test
|
|
542
448
|
*
|
|
543
449
|
* @returns {boolean} True if value is a RegExp object, otherwise false
|
|
544
|
-
*/
|
|
545
|
-
const
|
|
546
|
-
|
|
547
|
-
const
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
});
|
|
557
|
-
|
|
558
|
-
Object.defineProperties(obj, reducedDescriptors);
|
|
559
|
-
};
|
|
560
|
-
|
|
450
|
+
*/ const isRegExp$1 = kindOfTest$1('RegExp');
|
|
451
|
+
const reduceDescriptors$1 = (obj, reducer)=>{
|
|
452
|
+
const descriptors = Object.getOwnPropertyDescriptors(obj);
|
|
453
|
+
const reducedDescriptors = {};
|
|
454
|
+
forEach$1(descriptors, (descriptor, name)=>{
|
|
455
|
+
let ret;
|
|
456
|
+
if ((ret = reducer(descriptor, name, obj)) !== false) {
|
|
457
|
+
reducedDescriptors[name] = ret || descriptor;
|
|
458
|
+
}
|
|
459
|
+
});
|
|
460
|
+
Object.defineProperties(obj, reducedDescriptors);
|
|
461
|
+
};
|
|
561
462
|
/**
|
|
562
463
|
* Makes all methods read-only
|
|
563
464
|
* @param {Object} obj
|
|
564
|
-
*/
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
DIGIT: DIGIT$1,
|
|
618
|
-
ALPHA: ALPHA$1,
|
|
619
|
-
ALPHA_DIGIT: ALPHA$1 + ALPHA$1.toUpperCase() + DIGIT$1
|
|
620
|
-
};
|
|
621
|
-
|
|
622
|
-
const generateString$1 = (size = 16, alphabet = ALPHABET$1.ALPHA_DIGIT) => {
|
|
623
|
-
let str = '';
|
|
624
|
-
const {length} = alphabet;
|
|
625
|
-
while (size--) {
|
|
626
|
-
str += alphabet[Math.random() * length|0];
|
|
627
|
-
}
|
|
628
|
-
|
|
629
|
-
return str;
|
|
630
|
-
};
|
|
631
|
-
|
|
465
|
+
*/ const freezeMethods$1 = (obj)=>{
|
|
466
|
+
reduceDescriptors$1(obj, (descriptor, name)=>{
|
|
467
|
+
// skip restricted props in strict mode
|
|
468
|
+
if (isFunction$1(obj) && [
|
|
469
|
+
'arguments',
|
|
470
|
+
'caller',
|
|
471
|
+
'callee'
|
|
472
|
+
].indexOf(name) !== -1) {
|
|
473
|
+
return false;
|
|
474
|
+
}
|
|
475
|
+
const value = obj[name];
|
|
476
|
+
if (!isFunction$1(value)) return;
|
|
477
|
+
descriptor.enumerable = false;
|
|
478
|
+
if ('writable' in descriptor) {
|
|
479
|
+
descriptor.writable = false;
|
|
480
|
+
return;
|
|
481
|
+
}
|
|
482
|
+
if (!descriptor.set) {
|
|
483
|
+
descriptor.set = ()=>{
|
|
484
|
+
throw Error('Can not rewrite read-only method \'' + name + '\'');
|
|
485
|
+
};
|
|
486
|
+
}
|
|
487
|
+
});
|
|
488
|
+
};
|
|
489
|
+
const toObjectSet$1 = (arrayOrString, delimiter)=>{
|
|
490
|
+
const obj = {};
|
|
491
|
+
const define = (arr)=>{
|
|
492
|
+
arr.forEach((value)=>{
|
|
493
|
+
obj[value] = true;
|
|
494
|
+
});
|
|
495
|
+
};
|
|
496
|
+
isArray$1(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
|
|
497
|
+
return obj;
|
|
498
|
+
};
|
|
499
|
+
const noop$1 = ()=>{};
|
|
500
|
+
const toFiniteNumber$1 = (value, defaultValue)=>{
|
|
501
|
+
return value != null && Number.isFinite(value = +value) ? value : defaultValue;
|
|
502
|
+
};
|
|
503
|
+
const ALPHA$1 = 'abcdefghijklmnopqrstuvwxyz';
|
|
504
|
+
const DIGIT$1 = '0123456789';
|
|
505
|
+
const ALPHABET$1 = {
|
|
506
|
+
DIGIT: DIGIT$1,
|
|
507
|
+
ALPHA: ALPHA$1,
|
|
508
|
+
ALPHA_DIGIT: ALPHA$1 + ALPHA$1.toUpperCase() + DIGIT$1
|
|
509
|
+
};
|
|
510
|
+
const generateString$1 = (size = 16, alphabet = ALPHABET$1.ALPHA_DIGIT)=>{
|
|
511
|
+
let str = '';
|
|
512
|
+
const { length } = alphabet;
|
|
513
|
+
while(size--){
|
|
514
|
+
str += alphabet[Math.random() * length | 0];
|
|
515
|
+
}
|
|
516
|
+
return str;
|
|
517
|
+
};
|
|
632
518
|
/**
|
|
633
519
|
* If the thing is a FormData object, return true, otherwise return false.
|
|
634
520
|
*
|
|
635
521
|
* @param {unknown} thing - The thing to check.
|
|
636
522
|
*
|
|
637
523
|
* @returns {boolean}
|
|
638
|
-
*/
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
const
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
}
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
}
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
toFlatObject: toFlatObject$1,
|
|
759
|
-
kindOf: kindOf$1,
|
|
760
|
-
kindOfTest: kindOfTest$1,
|
|
761
|
-
endsWith: endsWith$1,
|
|
762
|
-
toArray: toArray$1,
|
|
763
|
-
forEachEntry: forEachEntry$1,
|
|
764
|
-
matchAll: matchAll$1,
|
|
765
|
-
isHTMLForm: isHTMLForm$1,
|
|
766
|
-
hasOwnProperty: hasOwnProperty$1,
|
|
767
|
-
hasOwnProp: hasOwnProperty$1, // an alias to avoid ESLint no-prototype-builtins detection
|
|
768
|
-
reduceDescriptors: reduceDescriptors$1,
|
|
769
|
-
freezeMethods: freezeMethods$1,
|
|
770
|
-
toObjectSet: toObjectSet$1,
|
|
771
|
-
toCamelCase: toCamelCase$1,
|
|
772
|
-
noop: noop$1,
|
|
773
|
-
toFiniteNumber: toFiniteNumber$1,
|
|
774
|
-
findKey: findKey$1,
|
|
775
|
-
global: _global$1,
|
|
776
|
-
isContextDefined: isContextDefined$1,
|
|
777
|
-
ALPHABET: ALPHABET$1,
|
|
778
|
-
generateString: generateString$1,
|
|
779
|
-
isSpecCompliantForm: isSpecCompliantForm$1,
|
|
780
|
-
toJSONObject: toJSONObject$1,
|
|
781
|
-
isAsyncFn: isAsyncFn$1,
|
|
782
|
-
isThenable: isThenable$1,
|
|
783
|
-
setImmediate: _setImmediate$1,
|
|
784
|
-
asap: asap$1,
|
|
785
|
-
createErrorType: createErrorType$1
|
|
524
|
+
*/ function isSpecCompliantForm$1(thing) {
|
|
525
|
+
return !!(thing && isFunction$1(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator]);
|
|
526
|
+
}
|
|
527
|
+
const toJSONObject$1 = (obj)=>{
|
|
528
|
+
const stack = new Array(10);
|
|
529
|
+
const visit = (source, i)=>{
|
|
530
|
+
if (isObject$1(source)) {
|
|
531
|
+
if (stack.indexOf(source) >= 0) {
|
|
532
|
+
return;
|
|
533
|
+
}
|
|
534
|
+
if (!('toJSON' in source)) {
|
|
535
|
+
stack[i] = source;
|
|
536
|
+
const target = isArray$1(source) ? [] : {};
|
|
537
|
+
forEach$1(source, (value, key)=>{
|
|
538
|
+
const reducedValue = visit(value, i + 1);
|
|
539
|
+
!isUndefined$1(reducedValue) && (target[key] = reducedValue);
|
|
540
|
+
});
|
|
541
|
+
stack[i] = undefined;
|
|
542
|
+
return target;
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
return source;
|
|
546
|
+
};
|
|
547
|
+
return visit(obj, 0);
|
|
548
|
+
};
|
|
549
|
+
const isAsyncFn$1 = kindOfTest$1('AsyncFunction');
|
|
550
|
+
const isThenable$1 = (thing)=>thing && (isObject$1(thing) || isFunction$1(thing)) && isFunction$1(thing.then) && isFunction$1(thing.catch);
|
|
551
|
+
// original code
|
|
552
|
+
// https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
|
|
553
|
+
const _setImmediate$1 = ((setImmediateSupported, postMessageSupported)=>{
|
|
554
|
+
if (setImmediateSupported) {
|
|
555
|
+
return setImmediate;
|
|
556
|
+
}
|
|
557
|
+
return postMessageSupported ? ((token, callbacks)=>{
|
|
558
|
+
_global$1.addEventListener("message", ({ source, data })=>{
|
|
559
|
+
if (source === _global$1 && data === token) {
|
|
560
|
+
callbacks.length && callbacks.shift()();
|
|
561
|
+
}
|
|
562
|
+
}, false);
|
|
563
|
+
return (cb)=>{
|
|
564
|
+
callbacks.push(cb);
|
|
565
|
+
_global$1.postMessage(token, "*");
|
|
566
|
+
};
|
|
567
|
+
})(`axios@${Math.random()}`, []) : (cb)=>setTimeout(cb);
|
|
568
|
+
})(typeof setImmediate === 'function', isFunction$1(_global$1.postMessage));
|
|
569
|
+
const asap$1 = typeof queueMicrotask !== 'undefined' ? queueMicrotask.bind(_global$1) : typeof process !== 'undefined' && process.nextTick || _setImmediate$1;
|
|
570
|
+
function createErrorType$1(code, message, baseClass) {
|
|
571
|
+
// Create constructor
|
|
572
|
+
function CustomError(properties) {
|
|
573
|
+
Error.captureStackTrace(this, this.constructor);
|
|
574
|
+
Object.assign(this, properties || {});
|
|
575
|
+
this.code = code;
|
|
576
|
+
this.message = this.cause ? `${message}: ${this.cause.message}` : message;
|
|
577
|
+
}
|
|
578
|
+
// Attach constructor and set default properties
|
|
579
|
+
CustomError.prototype = new (baseClass || Error)();
|
|
580
|
+
CustomError.prototype.constructor = CustomError;
|
|
581
|
+
CustomError.prototype.name = `Error [${code}]`;
|
|
582
|
+
return CustomError;
|
|
583
|
+
}
|
|
584
|
+
// *********************
|
|
585
|
+
const utils$2 = {
|
|
586
|
+
isArray: isArray$1,
|
|
587
|
+
isArrayBuffer: isArrayBuffer$1,
|
|
588
|
+
isBuffer: isBuffer$1,
|
|
589
|
+
isFormData: isFormData$1,
|
|
590
|
+
isArrayBufferView: isArrayBufferView$1,
|
|
591
|
+
isString: isString$1,
|
|
592
|
+
isNumber: isNumber$1,
|
|
593
|
+
isBoolean: isBoolean$1,
|
|
594
|
+
isObject: isObject$1,
|
|
595
|
+
isPlainObject: isPlainObject$1,
|
|
596
|
+
isReadableStream: isReadableStream$1,
|
|
597
|
+
isRequest: isRequest$1,
|
|
598
|
+
isResponse: isResponse$1,
|
|
599
|
+
isHeaders: isHeaders$1,
|
|
600
|
+
isUndefined: isUndefined$1,
|
|
601
|
+
isDate: isDate$1,
|
|
602
|
+
isFile: isFile$1,
|
|
603
|
+
isBlob: isBlob$1,
|
|
604
|
+
isRegExp: isRegExp$1,
|
|
605
|
+
isFunction: isFunction$1,
|
|
606
|
+
isStream: isStream$1,
|
|
607
|
+
isURLSearchParams: isURLSearchParams$1,
|
|
608
|
+
isTypedArray: isTypedArray$1,
|
|
609
|
+
isFileList: isFileList$1,
|
|
610
|
+
forEach: forEach$1,
|
|
611
|
+
merge: merge$1,
|
|
612
|
+
extend: extend$1,
|
|
613
|
+
trim: trim$1,
|
|
614
|
+
stripBOM: stripBOM$1,
|
|
615
|
+
inherits: inherits$1,
|
|
616
|
+
toFlatObject: toFlatObject$1,
|
|
617
|
+
kindOf: kindOf$1,
|
|
618
|
+
kindOfTest: kindOfTest$1,
|
|
619
|
+
endsWith: endsWith$1,
|
|
620
|
+
toArray: toArray$1,
|
|
621
|
+
forEachEntry: forEachEntry$1,
|
|
622
|
+
matchAll: matchAll$1,
|
|
623
|
+
isHTMLForm: isHTMLForm$1,
|
|
624
|
+
hasOwnProperty: hasOwnProperty$1,
|
|
625
|
+
hasOwnProp: hasOwnProperty$1,
|
|
626
|
+
reduceDescriptors: reduceDescriptors$1,
|
|
627
|
+
freezeMethods: freezeMethods$1,
|
|
628
|
+
toObjectSet: toObjectSet$1,
|
|
629
|
+
toCamelCase: toCamelCase$1,
|
|
630
|
+
noop: noop$1,
|
|
631
|
+
toFiniteNumber: toFiniteNumber$1,
|
|
632
|
+
findKey: findKey$1,
|
|
633
|
+
global: _global$1,
|
|
634
|
+
isContextDefined: isContextDefined$1,
|
|
635
|
+
ALPHABET: ALPHABET$1,
|
|
636
|
+
generateString: generateString$1,
|
|
637
|
+
isSpecCompliantForm: isSpecCompliantForm$1,
|
|
638
|
+
toJSONObject: toJSONObject$1,
|
|
639
|
+
isAsyncFn: isAsyncFn$1,
|
|
640
|
+
isThenable: isThenable$1,
|
|
641
|
+
setImmediate: _setImmediate$1,
|
|
642
|
+
asap: asap$1,
|
|
643
|
+
createErrorType: createErrorType$1
|
|
786
644
|
};
|
|
787
645
|
|
|
788
646
|
/**
|
|
@@ -795,92 +653,81 @@ const utils$2 = {
|
|
|
795
653
|
* @param {Object} [response] The response.
|
|
796
654
|
*
|
|
797
655
|
* @returns {Error} The created error.
|
|
798
|
-
*/
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
this.
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
Object.
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
return
|
|
873
|
-
});
|
|
874
|
-
|
|
875
|
-
AxiosError$2.call(axiosError, error.message, code, config, request, response);
|
|
876
|
-
|
|
877
|
-
axiosError.cause = error;
|
|
878
|
-
|
|
879
|
-
axiosError.name = error.name;
|
|
880
|
-
|
|
881
|
-
customProps && Object.assign(axiosError, customProps);
|
|
882
|
-
|
|
883
|
-
return axiosError;
|
|
656
|
+
*/ function AxiosError$2(message, code, config, request, response) {
|
|
657
|
+
Error.call(this);
|
|
658
|
+
if (Error.captureStackTrace) {
|
|
659
|
+
Error.captureStackTrace(this, this.constructor);
|
|
660
|
+
} else {
|
|
661
|
+
this.stack = new Error().stack;
|
|
662
|
+
}
|
|
663
|
+
this.message = message;
|
|
664
|
+
this.name = 'AxiosError';
|
|
665
|
+
code && (this.code = code);
|
|
666
|
+
config && (this.config = config);
|
|
667
|
+
request && (this.request = request);
|
|
668
|
+
if (response) {
|
|
669
|
+
this.response = response;
|
|
670
|
+
this.status = response.status ? response.status : null;
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
utils$2.inherits(AxiosError$2, Error, {
|
|
674
|
+
toJSON: function toJSON() {
|
|
675
|
+
return {
|
|
676
|
+
// Standard
|
|
677
|
+
message: this.message,
|
|
678
|
+
name: this.name,
|
|
679
|
+
// Microsoft
|
|
680
|
+
description: this.description,
|
|
681
|
+
number: this.number,
|
|
682
|
+
// Mozilla
|
|
683
|
+
fileName: this.fileName,
|
|
684
|
+
lineNumber: this.lineNumber,
|
|
685
|
+
columnNumber: this.columnNumber,
|
|
686
|
+
stack: this.stack,
|
|
687
|
+
// Axios
|
|
688
|
+
config: utils$2.toJSONObject(this.config),
|
|
689
|
+
code: this.code,
|
|
690
|
+
status: this.status
|
|
691
|
+
};
|
|
692
|
+
}
|
|
693
|
+
});
|
|
694
|
+
const prototype$3 = AxiosError$2.prototype;
|
|
695
|
+
const descriptors$1 = {};
|
|
696
|
+
[
|
|
697
|
+
'ERR_BAD_OPTION_VALUE',
|
|
698
|
+
'ERR_BAD_OPTION',
|
|
699
|
+
'ECONNABORTED',
|
|
700
|
+
'ETIMEDOUT',
|
|
701
|
+
'ERR_NETWORK',
|
|
702
|
+
'ERR_FR_TOO_MANY_REDIRECTS',
|
|
703
|
+
'ERR_DEPRECATED',
|
|
704
|
+
'ERR_BAD_RESPONSE',
|
|
705
|
+
'ERR_BAD_REQUEST',
|
|
706
|
+
'ERR_CANCELED',
|
|
707
|
+
'ERR_NOT_SUPPORT',
|
|
708
|
+
'ERR_INVALID_URL'
|
|
709
|
+
].forEach((code)=>{
|
|
710
|
+
descriptors$1[code] = {
|
|
711
|
+
value: code
|
|
712
|
+
};
|
|
713
|
+
});
|
|
714
|
+
Object.defineProperties(AxiosError$2, descriptors$1);
|
|
715
|
+
Object.defineProperty(prototype$3, 'isAxiosError', {
|
|
716
|
+
value: true
|
|
717
|
+
});
|
|
718
|
+
// eslint-disable-next-line func-names
|
|
719
|
+
AxiosError$2.from = (error, code, config, request, response, customProps)=>{
|
|
720
|
+
const axiosError = Object.create(prototype$3);
|
|
721
|
+
utils$2.toFlatObject(error, axiosError, function filter(obj) {
|
|
722
|
+
return obj !== Error.prototype;
|
|
723
|
+
}, (prop)=>{
|
|
724
|
+
return prop !== 'isAxiosError';
|
|
725
|
+
});
|
|
726
|
+
AxiosError$2.call(axiosError, error.message, code, config, request, response);
|
|
727
|
+
axiosError.cause = error;
|
|
728
|
+
axiosError.name = error.name;
|
|
729
|
+
customProps && Object.assign(axiosError, customProps);
|
|
730
|
+
return axiosError;
|
|
884
731
|
};
|
|
885
732
|
|
|
886
733
|
// eslint-disable-next-line strict
|
|
@@ -892,22 +739,18 @@ const HttpAdapter = null;
|
|
|
892
739
|
* @param {string} thing - The object or array to be visited.
|
|
893
740
|
*
|
|
894
741
|
* @returns {boolean}
|
|
895
|
-
*/
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
}
|
|
899
|
-
|
|
742
|
+
*/ function isVisitable$1(thing) {
|
|
743
|
+
return utils$2.isPlainObject(thing) || utils$2.isArray(thing);
|
|
744
|
+
}
|
|
900
745
|
/**
|
|
901
746
|
* It removes the brackets from the end of a string
|
|
902
747
|
*
|
|
903
748
|
* @param {string} key - The key of the parameter.
|
|
904
749
|
*
|
|
905
750
|
* @returns {string} the key without the brackets.
|
|
906
|
-
*/
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
}
|
|
910
|
-
|
|
751
|
+
*/ function removeBrackets$1(key) {
|
|
752
|
+
return utils$2.endsWith(key, '[]') ? key.slice(0, -2) : key;
|
|
753
|
+
}
|
|
911
754
|
/**
|
|
912
755
|
* It takes a path, a key, and a boolean, and returns a string
|
|
913
756
|
*
|
|
@@ -916,31 +759,26 @@ function removeBrackets$1(key) {
|
|
|
916
759
|
* @param {string} dots - If true, the key will be rendered with dots instead of brackets.
|
|
917
760
|
*
|
|
918
761
|
* @returns {string} The path to the current key.
|
|
919
|
-
*/
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
}
|
|
928
|
-
|
|
762
|
+
*/ function renderKey$1(path, key, dots) {
|
|
763
|
+
if (!path) return key;
|
|
764
|
+
return path.concat(key).map(function each(token, i) {
|
|
765
|
+
// eslint-disable-next-line no-param-reassign
|
|
766
|
+
token = removeBrackets$1(token);
|
|
767
|
+
return !dots && i ? '[' + token + ']' : token;
|
|
768
|
+
}).join(dots ? '.' : '');
|
|
769
|
+
}
|
|
929
770
|
/**
|
|
930
771
|
* If the array is an array and none of its elements are visitable, then it's a flat array.
|
|
931
772
|
*
|
|
932
773
|
* @param {Array<any>} arr - The array to check
|
|
933
774
|
*
|
|
934
775
|
* @returns {boolean}
|
|
935
|
-
*/
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
}
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
return /^is[A-Z]/.test(prop);
|
|
942
|
-
});
|
|
943
|
-
|
|
776
|
+
*/ function isFlatArray$1(arr) {
|
|
777
|
+
return utils$2.isArray(arr) && !arr.some(isVisitable$1);
|
|
778
|
+
}
|
|
779
|
+
const predicates$1 = utils$2.toFlatObject(utils$2, {}, null, function filter(prop) {
|
|
780
|
+
return /^is[A-Z]/.test(prop);
|
|
781
|
+
});
|
|
944
782
|
/**
|
|
945
783
|
* Convert a data object to FormData
|
|
946
784
|
*
|
|
@@ -953,9 +791,7 @@ const predicates$1 = utils$2.toFlatObject(utils$2, {}, null, function filter(pro
|
|
|
953
791
|
* @param {?Boolean} [options.indexes = false]
|
|
954
792
|
*
|
|
955
793
|
* @returns {Object}
|
|
956
|
-
**/
|
|
957
|
-
|
|
958
|
-
/**
|
|
794
|
+
**/ /**
|
|
959
795
|
* It converts an object into a FormData object
|
|
960
796
|
*
|
|
961
797
|
* @param {Object<any, any>} obj - The object to convert to form data.
|
|
@@ -963,56 +799,47 @@ const predicates$1 = utils$2.toFlatObject(utils$2, {}, null, function filter(pro
|
|
|
963
799
|
* @param {Object<string, any>} options
|
|
964
800
|
*
|
|
965
801
|
* @returns
|
|
966
|
-
*/
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
if (utils$2.isArrayBuffer(value) || utils$2.isTypedArray(value)) {
|
|
1009
|
-
return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
|
|
1010
|
-
}
|
|
1011
|
-
|
|
1012
|
-
return value;
|
|
1013
|
-
}
|
|
1014
|
-
|
|
1015
|
-
/**
|
|
802
|
+
*/ function toFormData$2(obj, formData, options) {
|
|
803
|
+
if (!utils$2.isObject(obj)) {
|
|
804
|
+
throw new TypeError('target must be an object');
|
|
805
|
+
}
|
|
806
|
+
// eslint-disable-next-line no-param-reassign
|
|
807
|
+
formData = formData || new (FormData)();
|
|
808
|
+
// eslint-disable-next-line no-param-reassign
|
|
809
|
+
options = utils$2.toFlatObject(options, {
|
|
810
|
+
metaTokens: true,
|
|
811
|
+
dots: false,
|
|
812
|
+
indexes: false
|
|
813
|
+
}, false, function defined(option, source) {
|
|
814
|
+
// eslint-disable-next-line no-eq-null,eqeqeq
|
|
815
|
+
return !utils$2.isUndefined(source[option]);
|
|
816
|
+
});
|
|
817
|
+
const metaTokens = options.metaTokens;
|
|
818
|
+
// eslint-disable-next-line no-use-before-define
|
|
819
|
+
const visitor = options.visitor || defaultVisitor;
|
|
820
|
+
const dots = options.dots;
|
|
821
|
+
const indexes = options.indexes;
|
|
822
|
+
const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
|
|
823
|
+
const useBlob = _Blob && utils$2.isSpecCompliantForm(formData);
|
|
824
|
+
if (!utils$2.isFunction(visitor)) {
|
|
825
|
+
throw new TypeError('visitor must be a function');
|
|
826
|
+
}
|
|
827
|
+
function convertValue(value) {
|
|
828
|
+
if (value === null) return '';
|
|
829
|
+
if (utils$2.isDate(value)) {
|
|
830
|
+
return value.toISOString();
|
|
831
|
+
}
|
|
832
|
+
if (!useBlob && utils$2.isBlob(value)) {
|
|
833
|
+
throw new AxiosError$2('Blob is not supported. Use a Buffer instead.');
|
|
834
|
+
}
|
|
835
|
+
if (utils$2.isArrayBuffer(value) || utils$2.isTypedArray(value)) {
|
|
836
|
+
return useBlob && typeof Blob === 'function' ? new Blob([
|
|
837
|
+
value
|
|
838
|
+
]) : Buffer.from(value);
|
|
839
|
+
}
|
|
840
|
+
return value;
|
|
841
|
+
}
|
|
842
|
+
/**
|
|
1016
843
|
* Default visitor.
|
|
1017
844
|
*
|
|
1018
845
|
* @param {*} value
|
|
@@ -1021,80 +848,59 @@ function toFormData$2(obj, formData, options) {
|
|
|
1021
848
|
* @this {FormData}
|
|
1022
849
|
*
|
|
1023
850
|
* @returns {boolean} return true to visit the each prop of the value recursively
|
|
1024
|
-
*/
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
return false;
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
if (
|
|
1073
|
-
|
|
1074
|
-
}
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
utils$2.forEach(value, function each(el, key) {
|
|
1079
|
-
const result = !(utils$2.isUndefined(el) || el === null) && visitor.call(
|
|
1080
|
-
formData, el, utils$2.isString(key) ? key.trim() : key, path, exposedHelpers
|
|
1081
|
-
);
|
|
1082
|
-
|
|
1083
|
-
if (result === true) {
|
|
1084
|
-
build(el, path ? path.concat(key) : [key]);
|
|
1085
|
-
}
|
|
1086
|
-
});
|
|
1087
|
-
|
|
1088
|
-
stack.pop();
|
|
1089
|
-
}
|
|
1090
|
-
|
|
1091
|
-
if (!utils$2.isObject(obj)) {
|
|
1092
|
-
throw new TypeError('data must be an object');
|
|
1093
|
-
}
|
|
1094
|
-
|
|
1095
|
-
build(obj);
|
|
1096
|
-
|
|
1097
|
-
return formData;
|
|
851
|
+
*/ function defaultVisitor(value, key, path) {
|
|
852
|
+
let arr = value;
|
|
853
|
+
if (value && !path && typeof value === 'object') {
|
|
854
|
+
if (utils$2.endsWith(key, '{}')) {
|
|
855
|
+
// eslint-disable-next-line no-param-reassign
|
|
856
|
+
key = metaTokens ? key : key.slice(0, -2);
|
|
857
|
+
// eslint-disable-next-line no-param-reassign
|
|
858
|
+
value = JSON.stringify(value);
|
|
859
|
+
} else if (utils$2.isArray(value) && isFlatArray$1(value) || (utils$2.isFileList(value) || utils$2.endsWith(key, '[]')) && (arr = utils$2.toArray(value))) {
|
|
860
|
+
// eslint-disable-next-line no-param-reassign
|
|
861
|
+
key = removeBrackets$1(key);
|
|
862
|
+
arr.forEach(function each(el, index) {
|
|
863
|
+
!(utils$2.isUndefined(el) || el === null) && formData.append(// eslint-disable-next-line no-nested-ternary
|
|
864
|
+
indexes === true ? renderKey$1([
|
|
865
|
+
key
|
|
866
|
+
], index, dots) : indexes === null ? key : key + '[]', convertValue(el));
|
|
867
|
+
});
|
|
868
|
+
return false;
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
if (isVisitable$1(value)) {
|
|
872
|
+
return true;
|
|
873
|
+
}
|
|
874
|
+
formData.append(renderKey$1(path, key, dots), convertValue(value));
|
|
875
|
+
return false;
|
|
876
|
+
}
|
|
877
|
+
const stack = [];
|
|
878
|
+
const exposedHelpers = Object.assign(predicates$1, {
|
|
879
|
+
defaultVisitor,
|
|
880
|
+
convertValue,
|
|
881
|
+
isVisitable: isVisitable$1
|
|
882
|
+
});
|
|
883
|
+
function build(value, path) {
|
|
884
|
+
if (utils$2.isUndefined(value)) return;
|
|
885
|
+
if (stack.indexOf(value) !== -1) {
|
|
886
|
+
throw Error('Circular reference detected in ' + path.join('.'));
|
|
887
|
+
}
|
|
888
|
+
stack.push(value);
|
|
889
|
+
utils$2.forEach(value, function each(el, key) {
|
|
890
|
+
const result = !(utils$2.isUndefined(el) || el === null) && visitor.call(formData, el, utils$2.isString(key) ? key.trim() : key, path, exposedHelpers);
|
|
891
|
+
if (result === true) {
|
|
892
|
+
build(el, path ? path.concat(key) : [
|
|
893
|
+
key
|
|
894
|
+
]);
|
|
895
|
+
}
|
|
896
|
+
});
|
|
897
|
+
stack.pop();
|
|
898
|
+
}
|
|
899
|
+
if (!utils$2.isObject(obj)) {
|
|
900
|
+
throw new TypeError('data must be an object');
|
|
901
|
+
}
|
|
902
|
+
build(obj);
|
|
903
|
+
return formData;
|
|
1098
904
|
}
|
|
1099
905
|
|
|
1100
906
|
/**
|
|
@@ -1104,22 +910,20 @@ function toFormData$2(obj, formData, options) {
|
|
|
1104
910
|
* @param {string} str - The string to encode.
|
|
1105
911
|
*
|
|
1106
912
|
* @returns {string} The encoded string.
|
|
1107
|
-
*/
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
}
|
|
1122
|
-
|
|
913
|
+
*/ function encode$2(str) {
|
|
914
|
+
const charMap = {
|
|
915
|
+
'!': '%21',
|
|
916
|
+
"'": '%27',
|
|
917
|
+
'(': '%28',
|
|
918
|
+
')': '%29',
|
|
919
|
+
'~': '%7E',
|
|
920
|
+
'%20': '+',
|
|
921
|
+
'%00': '\x00'
|
|
922
|
+
};
|
|
923
|
+
return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
|
|
924
|
+
return charMap[match];
|
|
925
|
+
});
|
|
926
|
+
}
|
|
1123
927
|
/**
|
|
1124
928
|
* It takes a params object and converts it to a FormData object
|
|
1125
929
|
*
|
|
@@ -1127,27 +931,24 @@ function encode$2(str) {
|
|
|
1127
931
|
* @param {Object<string, any>} options - The options object passed to the Axios constructor.
|
|
1128
932
|
*
|
|
1129
933
|
* @returns {void}
|
|
1130
|
-
*/
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
return
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
return this._pairs.map(function each(pair) {
|
|
1149
|
-
return _encode(pair[0]) + '=' + _encode(pair[1]);
|
|
1150
|
-
}, '').join('&');
|
|
934
|
+
*/ function AxiosURLSearchParams$1(params, options) {
|
|
935
|
+
this._pairs = [];
|
|
936
|
+
params && toFormData$2(params, this, options);
|
|
937
|
+
}
|
|
938
|
+
const prototype$2 = AxiosURLSearchParams$1.prototype;
|
|
939
|
+
prototype$2.append = function append(name, value) {
|
|
940
|
+
this._pairs.push([
|
|
941
|
+
name,
|
|
942
|
+
value
|
|
943
|
+
]);
|
|
944
|
+
};
|
|
945
|
+
prototype$2.toString = function toString(encoder) {
|
|
946
|
+
const _encode = encoder ? function(value) {
|
|
947
|
+
return encoder.call(this, value, encode$2);
|
|
948
|
+
} : encode$2;
|
|
949
|
+
return this._pairs.map(function each(pair) {
|
|
950
|
+
return _encode(pair[0]) + '=' + _encode(pair[1]);
|
|
951
|
+
}, '').join('&');
|
|
1151
952
|
};
|
|
1152
953
|
|
|
1153
954
|
/**
|
|
@@ -1157,17 +958,9 @@ prototype$2.toString = function toString(encoder) {
|
|
|
1157
958
|
* @param {string} val The value to be encoded.
|
|
1158
959
|
*
|
|
1159
960
|
* @returns {string} The encoded value.
|
|
1160
|
-
*/
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
replace(/%3A/gi, ':').
|
|
1164
|
-
replace(/%24/g, '$').
|
|
1165
|
-
replace(/%2C/gi, ',').
|
|
1166
|
-
replace(/%20/g, '+').
|
|
1167
|
-
replace(/%5B/gi, '[').
|
|
1168
|
-
replace(/%5D/gi, ']');
|
|
1169
|
-
}
|
|
1170
|
-
|
|
961
|
+
*/ function encode$1(val) {
|
|
962
|
+
return encodeURIComponent(val).replace(/%3A/gi, ':').replace(/%24/g, '$').replace(/%2C/gi, ',').replace(/%20/g, '+').replace(/%5B/gi, '[').replace(/%5D/gi, ']');
|
|
963
|
+
}
|
|
1171
964
|
/**
|
|
1172
965
|
* Build a URL by appending params to the end
|
|
1173
966
|
*
|
|
@@ -1176,87 +969,66 @@ function encode$1(val) {
|
|
|
1176
969
|
* @param {?object} options
|
|
1177
970
|
*
|
|
1178
971
|
* @returns {string} The formatted url
|
|
1179
|
-
*/
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
if (serializedParams) {
|
|
1201
|
-
const hashmarkIndex = url.indexOf("#");
|
|
1202
|
-
|
|
1203
|
-
if (hashmarkIndex !== -1) {
|
|
1204
|
-
url = url.slice(0, hashmarkIndex);
|
|
1205
|
-
}
|
|
1206
|
-
url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
|
|
1207
|
-
}
|
|
1208
|
-
|
|
1209
|
-
return url;
|
|
972
|
+
*/ function buildURL(url, params, options) {
|
|
973
|
+
/*eslint no-param-reassign:0*/ if (!params) {
|
|
974
|
+
return url;
|
|
975
|
+
}
|
|
976
|
+
const _encode = options && options.encode || encode$1;
|
|
977
|
+
const serializeFn = options && options.serialize;
|
|
978
|
+
let serializedParams;
|
|
979
|
+
if (serializeFn) {
|
|
980
|
+
serializedParams = serializeFn(params, options);
|
|
981
|
+
} else {
|
|
982
|
+
serializedParams = utils$2.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams$1(params, options).toString(_encode);
|
|
983
|
+
}
|
|
984
|
+
if (serializedParams) {
|
|
985
|
+
const hashmarkIndex = url.indexOf("#");
|
|
986
|
+
if (hashmarkIndex !== -1) {
|
|
987
|
+
url = url.slice(0, hashmarkIndex);
|
|
988
|
+
}
|
|
989
|
+
url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
|
|
990
|
+
}
|
|
991
|
+
return url;
|
|
1210
992
|
}
|
|
1211
993
|
|
|
1212
|
-
class InterceptorManager {
|
|
1213
|
-
|
|
1214
|
-
this.handlers = [];
|
|
1215
|
-
}
|
|
1216
|
-
|
|
1217
|
-
/**
|
|
994
|
+
let InterceptorManager = class InterceptorManager {
|
|
995
|
+
/**
|
|
1218
996
|
* Add a new interceptor to the stack
|
|
1219
997
|
*
|
|
1220
998
|
* @param {Function} fulfilled The function to handle `then` for a `Promise`
|
|
1221
999
|
* @param {Function} rejected The function to handle `reject` for a `Promise`
|
|
1222
1000
|
*
|
|
1223
1001
|
* @return {Number} An ID used to remove interceptor later
|
|
1224
|
-
*/
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
/**
|
|
1002
|
+
*/ use(fulfilled, rejected, options) {
|
|
1003
|
+
this.handlers.push({
|
|
1004
|
+
fulfilled,
|
|
1005
|
+
rejected,
|
|
1006
|
+
synchronous: options ? options.synchronous : false,
|
|
1007
|
+
runWhen: options ? options.runWhen : null
|
|
1008
|
+
});
|
|
1009
|
+
return this.handlers.length - 1;
|
|
1010
|
+
}
|
|
1011
|
+
/**
|
|
1236
1012
|
* Remove an interceptor from the stack
|
|
1237
1013
|
*
|
|
1238
1014
|
* @param {Number} id The ID that was returned by `use`
|
|
1239
1015
|
*
|
|
1240
1016
|
* @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
|
|
1241
|
-
*/
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
}
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
/**
|
|
1017
|
+
*/ eject(id) {
|
|
1018
|
+
if (this.handlers[id]) {
|
|
1019
|
+
this.handlers[id] = null;
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
1022
|
+
/**
|
|
1249
1023
|
* Clear all interceptors from the stack
|
|
1250
1024
|
*
|
|
1251
1025
|
* @returns {void}
|
|
1252
|
-
*/
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
}
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
/**
|
|
1026
|
+
*/ clear() {
|
|
1027
|
+
if (this.handlers) {
|
|
1028
|
+
this.handlers = [];
|
|
1029
|
+
}
|
|
1030
|
+
}
|
|
1031
|
+
/**
|
|
1260
1032
|
* Iterate over all the registered interceptors
|
|
1261
1033
|
*
|
|
1262
1034
|
* This method is particularly useful for skipping over any
|
|
@@ -1265,22 +1037,23 @@ class InterceptorManager {
|
|
|
1265
1037
|
* @param {Function} fn The function to call for each interceptor
|
|
1266
1038
|
*
|
|
1267
1039
|
* @returns {void}
|
|
1268
|
-
*/
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
}
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1040
|
+
*/ forEach(fn) {
|
|
1041
|
+
utils$2.forEach(this.handlers, function forEachHandler(h) {
|
|
1042
|
+
if (h !== null) {
|
|
1043
|
+
fn(h);
|
|
1044
|
+
}
|
|
1045
|
+
});
|
|
1046
|
+
}
|
|
1047
|
+
constructor(){
|
|
1048
|
+
this.handlers = [];
|
|
1049
|
+
}
|
|
1050
|
+
};
|
|
1278
1051
|
const InterceptorManager$1 = InterceptorManager;
|
|
1279
1052
|
|
|
1280
|
-
const transitionalDefaults = {
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1053
|
+
const transitionalDefaults = {
|
|
1054
|
+
silentJSONParsing: true,
|
|
1055
|
+
forcedJSONParsing: true,
|
|
1056
|
+
clarifyTimeoutError: false
|
|
1284
1057
|
};
|
|
1285
1058
|
|
|
1286
1059
|
function bind(fn, thisArg) {
|
|
@@ -2147,8 +1920,7 @@ const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop)
|
|
|
2147
1920
|
// eslint-disable-next-line no-param-reassign
|
|
2148
1921
|
key = removeBrackets(key);
|
|
2149
1922
|
arr.forEach(function each(el, index) {
|
|
2150
|
-
!(utils$1.isUndefined(el) || el === null) && formData.append(
|
|
2151
|
-
indexes === true ? renderKey([
|
|
1923
|
+
!(utils$1.isUndefined(el) || el === null) && formData.append(indexes === true ? renderKey([
|
|
2152
1924
|
key
|
|
2153
1925
|
], index, dots) : indexes === null ? key : key + '[]', convertValue(el));
|
|
2154
1926
|
});
|
|
@@ -2261,10 +2033,8 @@ const platform$1 = {
|
|
|
2261
2033
|
]
|
|
2262
2034
|
};
|
|
2263
2035
|
|
|
2264
|
-
const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
|
|
2265
|
-
|
|
2266
|
-
const _navigator = typeof navigator === 'object' && navigator || undefined;
|
|
2267
|
-
|
|
2036
|
+
const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
|
|
2037
|
+
const _navigator = typeof navigator === 'object' && navigator || undefined;
|
|
2268
2038
|
/**
|
|
2269
2039
|
* Determine if we're running in a standard browser environment
|
|
2270
2040
|
*
|
|
@@ -2281,10 +2051,11 @@ const _navigator = typeof navigator === 'object' && navigator || undefined;
|
|
|
2281
2051
|
* navigator.product -> 'NativeScript' or 'NS'
|
|
2282
2052
|
*
|
|
2283
2053
|
* @returns {boolean}
|
|
2284
|
-
*/
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2054
|
+
*/ const hasStandardBrowserEnv = hasBrowserEnv && (!_navigator || [
|
|
2055
|
+
'ReactNative',
|
|
2056
|
+
'NativeScript',
|
|
2057
|
+
'NS'
|
|
2058
|
+
].indexOf(_navigator.product) < 0);
|
|
2288
2059
|
/**
|
|
2289
2060
|
* Determine if we're running in a standard browser webWorker environment
|
|
2290
2061
|
*
|
|
@@ -2293,16 +2064,10 @@ const hasStandardBrowserEnv = hasBrowserEnv &&
|
|
|
2293
2064
|
* filtered out due to its judgment standard
|
|
2294
2065
|
* `typeof window !== 'undefined' && typeof document !== 'undefined'`.
|
|
2295
2066
|
* This leads to a problem when axios post `FormData` in webWorker
|
|
2296
|
-
*/
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
// eslint-disable-next-line no-undef
|
|
2301
|
-
self instanceof WorkerGlobalScope &&
|
|
2302
|
-
typeof self.importScripts === 'function'
|
|
2303
|
-
);
|
|
2304
|
-
})();
|
|
2305
|
-
|
|
2067
|
+
*/ const hasStandardBrowserWebWorkerEnv = (()=>{
|
|
2068
|
+
return typeof WorkerGlobalScope !== 'undefined' && // eslint-disable-next-line no-undef
|
|
2069
|
+
self instanceof WorkerGlobalScope && typeof self.importScripts === 'function';
|
|
2070
|
+
})();
|
|
2306
2071
|
const origin = hasBrowserEnv && window.location.href || 'http://localhost';
|
|
2307
2072
|
|
|
2308
2073
|
const utils = /*#__PURE__*/Object.freeze({
|
|
@@ -2314,22 +2079,21 @@ const utils = /*#__PURE__*/Object.freeze({
|
|
|
2314
2079
|
origin: origin
|
|
2315
2080
|
});
|
|
2316
2081
|
|
|
2317
|
-
const platform = {
|
|
2318
|
-
|
|
2319
|
-
|
|
2082
|
+
const platform = {
|
|
2083
|
+
...utils,
|
|
2084
|
+
...platform$1
|
|
2320
2085
|
};
|
|
2321
2086
|
|
|
2322
|
-
function toURLEncodedForm(data, options) {
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
}
|
|
2332
|
-
}, options));
|
|
2087
|
+
function toURLEncodedForm(data, options) {
|
|
2088
|
+
return toFormData$2(data, new platform.classes.URLSearchParams(), Object.assign({
|
|
2089
|
+
visitor: function(value, key, path, helpers) {
|
|
2090
|
+
if (platform.isNode && utils$2.isBuffer(value)) {
|
|
2091
|
+
this.append(key, value.toString('base64'));
|
|
2092
|
+
return false;
|
|
2093
|
+
}
|
|
2094
|
+
return helpers.defaultVisitor.apply(this, arguments);
|
|
2095
|
+
}
|
|
2096
|
+
}, options));
|
|
2333
2097
|
}
|
|
2334
2098
|
|
|
2335
2099
|
/**
|
|
@@ -2338,88 +2102,74 @@ function toURLEncodedForm(data, options) {
|
|
|
2338
2102
|
* @param {string} name - The name of the property to get.
|
|
2339
2103
|
*
|
|
2340
2104
|
* @returns An array of strings.
|
|
2341
|
-
*/
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
}
|
|
2351
|
-
|
|
2105
|
+
*/ function parsePropPath(name) {
|
|
2106
|
+
// foo[x][y][z]
|
|
2107
|
+
// foo.x.y.z
|
|
2108
|
+
// foo-x-y-z
|
|
2109
|
+
// foo x y z
|
|
2110
|
+
return utils$2.matchAll(/\w+|\[(\w*)]/g, name).map((match)=>{
|
|
2111
|
+
return match[0] === '[]' ? '' : match[1] || match[0];
|
|
2112
|
+
});
|
|
2113
|
+
}
|
|
2352
2114
|
/**
|
|
2353
2115
|
* Convert an array to an object.
|
|
2354
2116
|
*
|
|
2355
2117
|
* @param {Array<any>} arr - The array to convert to an object.
|
|
2356
2118
|
*
|
|
2357
2119
|
* @returns An object with the same keys and values as the array.
|
|
2358
|
-
*/
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
}
|
|
2371
|
-
|
|
2120
|
+
*/ function arrayToObject(arr) {
|
|
2121
|
+
const obj = {};
|
|
2122
|
+
const keys = Object.keys(arr);
|
|
2123
|
+
let i;
|
|
2124
|
+
const len = keys.length;
|
|
2125
|
+
let key;
|
|
2126
|
+
for(i = 0; i < len; i++){
|
|
2127
|
+
key = keys[i];
|
|
2128
|
+
obj[key] = arr[key];
|
|
2129
|
+
}
|
|
2130
|
+
return obj;
|
|
2131
|
+
}
|
|
2372
2132
|
/**
|
|
2373
2133
|
* It takes a FormData object and returns a JavaScript object
|
|
2374
2134
|
*
|
|
2375
2135
|
* @param {string} formData The FormData object to convert to JSON.
|
|
2376
2136
|
*
|
|
2377
2137
|
* @returns {Object<string, any> | null} The converted object.
|
|
2378
|
-
*/
|
|
2379
|
-
function
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
if (
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
const obj = {};
|
|
2414
|
-
|
|
2415
|
-
utils$2.forEachEntry(formData, (name, value) => {
|
|
2416
|
-
buildPath(parsePropPath(name), value, obj, 0);
|
|
2417
|
-
});
|
|
2418
|
-
|
|
2419
|
-
return obj;
|
|
2420
|
-
}
|
|
2421
|
-
|
|
2422
|
-
return null;
|
|
2138
|
+
*/ function formDataToJSON(formData) {
|
|
2139
|
+
function buildPath(path, value, target, index) {
|
|
2140
|
+
let name = path[index++];
|
|
2141
|
+
if (name === '__proto__') return true;
|
|
2142
|
+
const isNumericKey = Number.isFinite(+name);
|
|
2143
|
+
const isLast = index >= path.length;
|
|
2144
|
+
name = !name && utils$2.isArray(target) ? target.length : name;
|
|
2145
|
+
if (isLast) {
|
|
2146
|
+
if (utils$2.hasOwnProp(target, name)) {
|
|
2147
|
+
target[name] = [
|
|
2148
|
+
target[name],
|
|
2149
|
+
value
|
|
2150
|
+
];
|
|
2151
|
+
} else {
|
|
2152
|
+
target[name] = value;
|
|
2153
|
+
}
|
|
2154
|
+
return !isNumericKey;
|
|
2155
|
+
}
|
|
2156
|
+
if (!target[name] || !utils$2.isObject(target[name])) {
|
|
2157
|
+
target[name] = [];
|
|
2158
|
+
}
|
|
2159
|
+
const result = buildPath(path, value, target[name], index);
|
|
2160
|
+
if (result && utils$2.isArray(target[name])) {
|
|
2161
|
+
target[name] = arrayToObject(target[name]);
|
|
2162
|
+
}
|
|
2163
|
+
return !isNumericKey;
|
|
2164
|
+
}
|
|
2165
|
+
if (utils$2.isFormData(formData) && utils$2.isFunction(formData.entries)) {
|
|
2166
|
+
const obj = {};
|
|
2167
|
+
utils$2.forEachEntry(formData, (name, value)=>{
|
|
2168
|
+
buildPath(parsePropPath(name), value, obj, 0);
|
|
2169
|
+
});
|
|
2170
|
+
return obj;
|
|
2171
|
+
}
|
|
2172
|
+
return null;
|
|
2423
2173
|
}
|
|
2424
2174
|
|
|
2425
2175
|
/**
|
|
@@ -2431,158 +2181,147 @@ function formDataToJSON(formData) {
|
|
|
2431
2181
|
* @param {Function} encoder - A function that takes a value and returns a string.
|
|
2432
2182
|
*
|
|
2433
2183
|
* @returns {string} A stringified version of the rawValue.
|
|
2434
|
-
*/
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
}
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
}
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
}
|
|
2522
|
-
|
|
2523
|
-
if (data && utils$2.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
|
|
2524
|
-
const silentJSONParsing = transitional && transitional.silentJSONParsing;
|
|
2525
|
-
const strictJSONParsing = !silentJSONParsing && JSONRequested;
|
|
2526
|
-
|
|
2527
|
-
try {
|
|
2528
|
-
return JSON.parse(data);
|
|
2529
|
-
} catch (e) {
|
|
2530
|
-
if (strictJSONParsing) {
|
|
2531
|
-
if (e.name === 'SyntaxError') {
|
|
2532
|
-
throw AxiosError$2.from(e, AxiosError$2.ERR_BAD_RESPONSE, this, null, this.response);
|
|
2533
|
-
}
|
|
2534
|
-
throw e;
|
|
2535
|
-
}
|
|
2536
|
-
}
|
|
2537
|
-
}
|
|
2538
|
-
|
|
2539
|
-
return data;
|
|
2540
|
-
}],
|
|
2541
|
-
|
|
2542
|
-
/**
|
|
2184
|
+
*/ function stringifySafely(rawValue, parser, encoder) {
|
|
2185
|
+
if (utils$2.isString(rawValue)) {
|
|
2186
|
+
try {
|
|
2187
|
+
(parser || JSON.parse)(rawValue);
|
|
2188
|
+
return utils$2.trim(rawValue);
|
|
2189
|
+
} catch (e) {
|
|
2190
|
+
if (e.name !== 'SyntaxError') {
|
|
2191
|
+
throw e;
|
|
2192
|
+
}
|
|
2193
|
+
}
|
|
2194
|
+
}
|
|
2195
|
+
return (encoder || JSON.stringify)(rawValue);
|
|
2196
|
+
}
|
|
2197
|
+
const defaults = {
|
|
2198
|
+
transitional: transitionalDefaults,
|
|
2199
|
+
adapter: [
|
|
2200
|
+
'xhr',
|
|
2201
|
+
'http',
|
|
2202
|
+
'fetch'
|
|
2203
|
+
],
|
|
2204
|
+
transformRequest: [
|
|
2205
|
+
function transformRequest(data, headers) {
|
|
2206
|
+
const contentType = headers.getContentType() || '';
|
|
2207
|
+
const hasJSONContentType = contentType.indexOf('application/json') > -1;
|
|
2208
|
+
const isObjectPayload = utils$2.isObject(data);
|
|
2209
|
+
if (isObjectPayload && utils$2.isHTMLForm(data)) {
|
|
2210
|
+
data = new FormData(data);
|
|
2211
|
+
}
|
|
2212
|
+
const isFormData = utils$2.isFormData(data);
|
|
2213
|
+
if (isFormData) {
|
|
2214
|
+
return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
|
|
2215
|
+
}
|
|
2216
|
+
if (utils$2.isArrayBuffer(data) || utils$2.isBuffer(data) || utils$2.isStream(data) || utils$2.isFile(data) || utils$2.isBlob(data) || utils$2.isReadableStream(data)) {
|
|
2217
|
+
return data;
|
|
2218
|
+
}
|
|
2219
|
+
if (utils$2.isArrayBufferView(data)) {
|
|
2220
|
+
return data.buffer;
|
|
2221
|
+
}
|
|
2222
|
+
if (utils$2.isURLSearchParams(data)) {
|
|
2223
|
+
headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
|
|
2224
|
+
return data.toString();
|
|
2225
|
+
}
|
|
2226
|
+
let isFileList;
|
|
2227
|
+
if (isObjectPayload) {
|
|
2228
|
+
if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
|
|
2229
|
+
return toURLEncodedForm(data, this.formSerializer).toString();
|
|
2230
|
+
}
|
|
2231
|
+
if ((isFileList = utils$2.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
|
|
2232
|
+
const _FormData = this.env && this.env.FormData;
|
|
2233
|
+
return toFormData$2(isFileList ? {
|
|
2234
|
+
'files[]': data
|
|
2235
|
+
} : data, _FormData && new _FormData(), this.formSerializer);
|
|
2236
|
+
}
|
|
2237
|
+
}
|
|
2238
|
+
if (isObjectPayload || hasJSONContentType) {
|
|
2239
|
+
headers.setContentType('application/json', false);
|
|
2240
|
+
return stringifySafely(data);
|
|
2241
|
+
}
|
|
2242
|
+
return data;
|
|
2243
|
+
}
|
|
2244
|
+
],
|
|
2245
|
+
transformResponse: [
|
|
2246
|
+
function transformResponse(data) {
|
|
2247
|
+
const transitional = this.transitional || defaults.transitional;
|
|
2248
|
+
const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
|
|
2249
|
+
const JSONRequested = this.responseType === 'json';
|
|
2250
|
+
if (utils$2.isResponse(data) || utils$2.isReadableStream(data)) {
|
|
2251
|
+
return data;
|
|
2252
|
+
}
|
|
2253
|
+
if (data && utils$2.isString(data) && (forcedJSONParsing && !this.responseType || JSONRequested)) {
|
|
2254
|
+
const silentJSONParsing = transitional && transitional.silentJSONParsing;
|
|
2255
|
+
const strictJSONParsing = !silentJSONParsing && JSONRequested;
|
|
2256
|
+
try {
|
|
2257
|
+
return JSON.parse(data);
|
|
2258
|
+
} catch (e) {
|
|
2259
|
+
if (strictJSONParsing) {
|
|
2260
|
+
if (e.name === 'SyntaxError') {
|
|
2261
|
+
throw AxiosError$2.from(e, AxiosError$2.ERR_BAD_RESPONSE, this, null, this.response);
|
|
2262
|
+
}
|
|
2263
|
+
throw e;
|
|
2264
|
+
}
|
|
2265
|
+
}
|
|
2266
|
+
}
|
|
2267
|
+
return data;
|
|
2268
|
+
}
|
|
2269
|
+
],
|
|
2270
|
+
/**
|
|
2543
2271
|
* A timeout in milliseconds to abort a request. If set to 0 (default) a
|
|
2544
2272
|
* timeout is not created.
|
|
2545
|
-
*/
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
});
|
|
2574
|
-
|
|
2273
|
+
*/ timeout: 0,
|
|
2274
|
+
xsrfCookieName: 'XSRF-TOKEN',
|
|
2275
|
+
xsrfHeaderName: 'X-XSRF-TOKEN',
|
|
2276
|
+
maxContentLength: -1,
|
|
2277
|
+
maxBodyLength: -1,
|
|
2278
|
+
env: {
|
|
2279
|
+
FormData: platform.classes.FormData,
|
|
2280
|
+
Blob: platform.classes.Blob
|
|
2281
|
+
},
|
|
2282
|
+
validateStatus: function validateStatus(status) {
|
|
2283
|
+
return status >= 200 && status < 300;
|
|
2284
|
+
},
|
|
2285
|
+
headers: {
|
|
2286
|
+
common: {
|
|
2287
|
+
'Accept': 'application/json, text/plain, */*',
|
|
2288
|
+
'Content-Type': undefined
|
|
2289
|
+
}
|
|
2290
|
+
}
|
|
2291
|
+
};
|
|
2292
|
+
utils$2.forEach([
|
|
2293
|
+
'delete',
|
|
2294
|
+
'get',
|
|
2295
|
+
'head',
|
|
2296
|
+
'post',
|
|
2297
|
+
'put',
|
|
2298
|
+
'patch'
|
|
2299
|
+
], (method)=>{
|
|
2300
|
+
defaults.headers[method] = {};
|
|
2301
|
+
});
|
|
2575
2302
|
const defaults$1 = defaults;
|
|
2576
2303
|
|
|
2577
|
-
// RawAxiosHeaders whose duplicates are ignored by node
|
|
2578
|
-
// c.f. https://nodejs.org/api/http.html#http_message_headers
|
|
2579
|
-
const ignoreDuplicateOf = utils$2.toObjectSet([
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2304
|
+
// RawAxiosHeaders whose duplicates are ignored by node
|
|
2305
|
+
// c.f. https://nodejs.org/api/http.html#http_message_headers
|
|
2306
|
+
const ignoreDuplicateOf = utils$2.toObjectSet([
|
|
2307
|
+
'age',
|
|
2308
|
+
'authorization',
|
|
2309
|
+
'content-length',
|
|
2310
|
+
'content-type',
|
|
2311
|
+
'etag',
|
|
2312
|
+
'expires',
|
|
2313
|
+
'from',
|
|
2314
|
+
'host',
|
|
2315
|
+
'if-modified-since',
|
|
2316
|
+
'if-unmodified-since',
|
|
2317
|
+
'last-modified',
|
|
2318
|
+
'location',
|
|
2319
|
+
'max-forwards',
|
|
2320
|
+
'proxy-authorization',
|
|
2321
|
+
'referer',
|
|
2322
|
+
'retry-after',
|
|
2323
|
+
'user-agent'
|
|
2324
|
+
]);
|
|
2586
2325
|
/**
|
|
2587
2326
|
* Parse headers into an object
|
|
2588
2327
|
*
|
|
@@ -2596,346 +2335,270 @@ const ignoreDuplicateOf = utils$2.toObjectSet([
|
|
|
2596
2335
|
* @param {String} rawHeaders Headers needing to be parsed
|
|
2597
2336
|
*
|
|
2598
2337
|
* @returns {Object} Headers parsed into an object
|
|
2599
|
-
*/
|
|
2600
|
-
const
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
return parsed;
|
|
2627
|
-
};
|
|
2338
|
+
*/ const parseHeaders = ((rawHeaders)=>{
|
|
2339
|
+
const parsed = {};
|
|
2340
|
+
let key;
|
|
2341
|
+
let val;
|
|
2342
|
+
let i;
|
|
2343
|
+
rawHeaders && rawHeaders.split('\n').forEach(function parser(line) {
|
|
2344
|
+
i = line.indexOf(':');
|
|
2345
|
+
key = line.substring(0, i).trim().toLowerCase();
|
|
2346
|
+
val = line.substring(i + 1).trim();
|
|
2347
|
+
if (!key || parsed[key] && ignoreDuplicateOf[key]) {
|
|
2348
|
+
return;
|
|
2349
|
+
}
|
|
2350
|
+
if (key === 'set-cookie') {
|
|
2351
|
+
if (parsed[key]) {
|
|
2352
|
+
parsed[key].push(val);
|
|
2353
|
+
} else {
|
|
2354
|
+
parsed[key] = [
|
|
2355
|
+
val
|
|
2356
|
+
];
|
|
2357
|
+
}
|
|
2358
|
+
} else {
|
|
2359
|
+
parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
|
|
2360
|
+
}
|
|
2361
|
+
});
|
|
2362
|
+
return parsed;
|
|
2363
|
+
});
|
|
2628
2364
|
|
|
2629
|
-
const $internals = Symbol('internals');
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
return value;
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
function
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
function buildAccessors(obj, header) {
|
|
2687
|
-
const accessorName = utils$2.toCamelCase(' ' + header);
|
|
2688
|
-
['get', 'set', 'has'].forEach(methodName => {
|
|
2689
|
-
Object.defineProperty(obj, methodName + accessorName, {
|
|
2690
|
-
value: function (arg1, arg2, arg3) {
|
|
2691
|
-
return this[methodName].call(this, header, arg1, arg2, arg3);
|
|
2692
|
-
},
|
|
2693
|
-
configurable: true,
|
|
2694
|
-
});
|
|
2695
|
-
});
|
|
2696
|
-
}
|
|
2697
|
-
|
|
2698
|
-
let AxiosHeaders$1 = class AxiosHeaders {
|
|
2699
|
-
constructor(headers) {
|
|
2700
|
-
headers && this.set(headers);
|
|
2701
|
-
}
|
|
2702
|
-
|
|
2703
|
-
/**
|
|
2365
|
+
const $internals = Symbol('internals');
|
|
2366
|
+
function normalizeHeader(header) {
|
|
2367
|
+
return header && String(header).trim().toLowerCase();
|
|
2368
|
+
}
|
|
2369
|
+
function normalizeValue(value) {
|
|
2370
|
+
if (value === false || value == null) {
|
|
2371
|
+
return value;
|
|
2372
|
+
}
|
|
2373
|
+
return utils$2.isArray(value) ? value.map(normalizeValue) : String(value);
|
|
2374
|
+
}
|
|
2375
|
+
function parseTokens(str) {
|
|
2376
|
+
const tokens = Object.create(null);
|
|
2377
|
+
const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
|
|
2378
|
+
let match;
|
|
2379
|
+
while(match = tokensRE.exec(str)){
|
|
2380
|
+
tokens[match[1]] = match[2];
|
|
2381
|
+
}
|
|
2382
|
+
return tokens;
|
|
2383
|
+
}
|
|
2384
|
+
const isValidHeaderName = (str)=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
|
|
2385
|
+
function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
|
|
2386
|
+
if (utils$2.isFunction(filter)) {
|
|
2387
|
+
return filter.call(this, value, header);
|
|
2388
|
+
}
|
|
2389
|
+
if (isHeaderNameFilter) {
|
|
2390
|
+
value = header;
|
|
2391
|
+
}
|
|
2392
|
+
if (!utils$2.isString(value)) return;
|
|
2393
|
+
if (utils$2.isString(filter)) {
|
|
2394
|
+
return value.indexOf(filter) !== -1;
|
|
2395
|
+
}
|
|
2396
|
+
if (utils$2.isRegExp(filter)) {
|
|
2397
|
+
return filter.test(value);
|
|
2398
|
+
}
|
|
2399
|
+
}
|
|
2400
|
+
function formatHeader(header) {
|
|
2401
|
+
return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str)=>{
|
|
2402
|
+
return char.toUpperCase() + str;
|
|
2403
|
+
});
|
|
2404
|
+
}
|
|
2405
|
+
function buildAccessors(obj, header) {
|
|
2406
|
+
const accessorName = utils$2.toCamelCase(' ' + header);
|
|
2407
|
+
[
|
|
2408
|
+
'get',
|
|
2409
|
+
'set',
|
|
2410
|
+
'has'
|
|
2411
|
+
].forEach((methodName)=>{
|
|
2412
|
+
Object.defineProperty(obj, methodName + accessorName, {
|
|
2413
|
+
value: function(arg1, arg2, arg3) {
|
|
2414
|
+
return this[methodName].call(this, header, arg1, arg2, arg3);
|
|
2415
|
+
},
|
|
2416
|
+
configurable: true
|
|
2417
|
+
});
|
|
2418
|
+
});
|
|
2419
|
+
}
|
|
2420
|
+
let AxiosHeaders$1 = class AxiosHeaders {
|
|
2421
|
+
/**
|
|
2704
2422
|
*
|
|
2705
2423
|
* @param {*} header
|
|
2706
2424
|
* @param {*} valueOrRewrite
|
|
2707
2425
|
* @param {*} rewrite true:无论源值是否存在均赋值,false:源值如存在不覆盖,
|
|
2708
2426
|
* undefined:源值不为 false 直接赋值,false 不赋值
|
|
2709
2427
|
* @returns
|
|
2710
|
-
*/
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
}
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
}
|
|
2885
|
-
|
|
2886
|
-
static from(thing) {
|
|
2887
|
-
return thing instanceof this ? thing : new this(thing);
|
|
2888
|
-
}
|
|
2889
|
-
|
|
2890
|
-
static concat(first, ...targets) {
|
|
2891
|
-
const computed = new this(first);
|
|
2892
|
-
|
|
2893
|
-
targets.forEach(target => computed.set(target));
|
|
2894
|
-
|
|
2895
|
-
return computed;
|
|
2896
|
-
}
|
|
2897
|
-
|
|
2898
|
-
static accessor(header) {
|
|
2899
|
-
const internals =
|
|
2900
|
-
(this[$internals] =
|
|
2901
|
-
this[$internals] =
|
|
2902
|
-
{
|
|
2903
|
-
accessors: {},
|
|
2904
|
-
});
|
|
2905
|
-
|
|
2906
|
-
const accessors = internals.accessors;
|
|
2907
|
-
const prototype = this.prototype;
|
|
2908
|
-
|
|
2909
|
-
function defineAccessor(_header) {
|
|
2910
|
-
const lHeader = normalizeHeader(_header);
|
|
2911
|
-
|
|
2912
|
-
if (!accessors[lHeader]) {
|
|
2913
|
-
buildAccessors(prototype, _header);
|
|
2914
|
-
accessors[lHeader] = true;
|
|
2915
|
-
}
|
|
2916
|
-
}
|
|
2917
|
-
|
|
2918
|
-
utils$2.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
|
|
2919
|
-
|
|
2920
|
-
return this;
|
|
2921
|
-
}
|
|
2922
|
-
};
|
|
2923
|
-
|
|
2924
|
-
AxiosHeaders$1.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
|
|
2925
|
-
|
|
2926
|
-
// reserved names hotfix
|
|
2927
|
-
utils$2.reduceDescriptors(AxiosHeaders$1.prototype, ({value}, key) => {
|
|
2928
|
-
let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
|
|
2929
|
-
return {
|
|
2930
|
-
get: () => value,
|
|
2931
|
-
set(headerValue) {
|
|
2932
|
-
this[mapped] = headerValue;
|
|
2933
|
-
},
|
|
2934
|
-
};
|
|
2935
|
-
});
|
|
2936
|
-
|
|
2937
|
-
utils$2.freezeMethods(AxiosHeaders$1);
|
|
2938
|
-
|
|
2428
|
+
*/ set(header, valueOrRewrite, rewrite) {
|
|
2429
|
+
const self = this;
|
|
2430
|
+
function setHeader(_value, _header, _rewrite) {
|
|
2431
|
+
const lHeader = normalizeHeader(_header);
|
|
2432
|
+
if (!lHeader) {
|
|
2433
|
+
throw new Error('header name must be a non-empty string');
|
|
2434
|
+
}
|
|
2435
|
+
const key = utils$2.findKey(self, lHeader);
|
|
2436
|
+
if (!key || self[key] === undefined || _rewrite === true || _rewrite === undefined && self[key] !== false) {
|
|
2437
|
+
self[key || _header] = normalizeValue(_value);
|
|
2438
|
+
}
|
|
2439
|
+
}
|
|
2440
|
+
const setHeaders = (headers, _rewrite)=>utils$2.forEach(headers, (_value, _header)=>setHeader(_value, _header, _rewrite));
|
|
2441
|
+
if (utils$2.isPlainObject(header) || header instanceof this.constructor) {
|
|
2442
|
+
setHeaders(header, valueOrRewrite);
|
|
2443
|
+
} else if (utils$2.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
|
2444
|
+
setHeaders(parseHeaders(header), valueOrRewrite);
|
|
2445
|
+
} else if (utils$2.isHeaders(header)) {
|
|
2446
|
+
for (const [key, value] of header.entries()){
|
|
2447
|
+
setHeader(value, key, rewrite);
|
|
2448
|
+
}
|
|
2449
|
+
} else {
|
|
2450
|
+
header != null && setHeader(valueOrRewrite, header, rewrite);
|
|
2451
|
+
}
|
|
2452
|
+
return this;
|
|
2453
|
+
}
|
|
2454
|
+
get(header, parser) {
|
|
2455
|
+
header = normalizeHeader(header);
|
|
2456
|
+
if (header) {
|
|
2457
|
+
const key = utils$2.findKey(this, header);
|
|
2458
|
+
if (key) {
|
|
2459
|
+
const value = this[key];
|
|
2460
|
+
if (!parser) {
|
|
2461
|
+
return value;
|
|
2462
|
+
}
|
|
2463
|
+
if (parser === true) {
|
|
2464
|
+
return parseTokens(value);
|
|
2465
|
+
}
|
|
2466
|
+
if (utils$2.isFunction(parser)) {
|
|
2467
|
+
return parser.call(this, value, key);
|
|
2468
|
+
}
|
|
2469
|
+
if (utils$2.isRegExp(parser)) {
|
|
2470
|
+
return parser.exec(value);
|
|
2471
|
+
}
|
|
2472
|
+
throw new TypeError('parser must be boolean|regexp|function');
|
|
2473
|
+
}
|
|
2474
|
+
}
|
|
2475
|
+
}
|
|
2476
|
+
has(header, matcher) {
|
|
2477
|
+
header = normalizeHeader(header);
|
|
2478
|
+
if (header) {
|
|
2479
|
+
const key = utils$2.findKey(this, header);
|
|
2480
|
+
return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
|
|
2481
|
+
}
|
|
2482
|
+
return false;
|
|
2483
|
+
}
|
|
2484
|
+
delete(header, matcher) {
|
|
2485
|
+
const self = this;
|
|
2486
|
+
let deleted = false;
|
|
2487
|
+
function deleteHeader(_header) {
|
|
2488
|
+
_header = normalizeHeader(_header);
|
|
2489
|
+
if (_header) {
|
|
2490
|
+
const key = utils$2.findKey(self, _header);
|
|
2491
|
+
if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
|
|
2492
|
+
delete self[key];
|
|
2493
|
+
deleted = true;
|
|
2494
|
+
}
|
|
2495
|
+
}
|
|
2496
|
+
}
|
|
2497
|
+
if (utils$2.isArray(header)) {
|
|
2498
|
+
header.forEach(deleteHeader);
|
|
2499
|
+
} else {
|
|
2500
|
+
deleteHeader(header);
|
|
2501
|
+
}
|
|
2502
|
+
return deleted;
|
|
2503
|
+
}
|
|
2504
|
+
clear(matcher) {
|
|
2505
|
+
const keys = Object.keys(this);
|
|
2506
|
+
let i = keys.length;
|
|
2507
|
+
let deleted = false;
|
|
2508
|
+
while(i--){
|
|
2509
|
+
const key = keys[i];
|
|
2510
|
+
if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
|
|
2511
|
+
delete this[key];
|
|
2512
|
+
deleted = true;
|
|
2513
|
+
}
|
|
2514
|
+
}
|
|
2515
|
+
return deleted;
|
|
2516
|
+
}
|
|
2517
|
+
normalize(format) {
|
|
2518
|
+
const self = this;
|
|
2519
|
+
const headers = {};
|
|
2520
|
+
utils$2.forEach(this, (value, header)=>{
|
|
2521
|
+
const key = utils$2.findKey(headers, header);
|
|
2522
|
+
if (key) {
|
|
2523
|
+
self[key] = normalizeValue(value);
|
|
2524
|
+
delete self[header];
|
|
2525
|
+
return;
|
|
2526
|
+
}
|
|
2527
|
+
const normalized = format ? formatHeader(header) : String(header).trim();
|
|
2528
|
+
if (normalized !== header) {
|
|
2529
|
+
delete self[header];
|
|
2530
|
+
}
|
|
2531
|
+
self[normalized] = normalizeValue(value);
|
|
2532
|
+
headers[normalized] = true;
|
|
2533
|
+
});
|
|
2534
|
+
return this;
|
|
2535
|
+
}
|
|
2536
|
+
concat(...targets) {
|
|
2537
|
+
return this.constructor.concat(this, ...targets);
|
|
2538
|
+
}
|
|
2539
|
+
toJSON(asStrings) {
|
|
2540
|
+
const obj = Object.create(null);
|
|
2541
|
+
utils$2.forEach(this, (value, header)=>{
|
|
2542
|
+
value != null && value !== false && (obj[header] = asStrings && utils$2.isArray(value) ? value.join(', ') : value);
|
|
2543
|
+
});
|
|
2544
|
+
return obj;
|
|
2545
|
+
}
|
|
2546
|
+
[Symbol.iterator]() {
|
|
2547
|
+
return Object.entries(this.toJSON())[Symbol.iterator]();
|
|
2548
|
+
}
|
|
2549
|
+
toString() {
|
|
2550
|
+
return Object.entries(this.toJSON()).map(([header, value])=>header + ': ' + value).join('\n');
|
|
2551
|
+
}
|
|
2552
|
+
get [Symbol.toStringTag]() {
|
|
2553
|
+
return 'AxiosHeaders';
|
|
2554
|
+
}
|
|
2555
|
+
static from(thing) {
|
|
2556
|
+
return thing instanceof this ? thing : new this(thing);
|
|
2557
|
+
}
|
|
2558
|
+
static concat(first, ...targets) {
|
|
2559
|
+
const computed = new this(first);
|
|
2560
|
+
targets.forEach((target)=>computed.set(target));
|
|
2561
|
+
return computed;
|
|
2562
|
+
}
|
|
2563
|
+
static accessor(header) {
|
|
2564
|
+
const internals = this[$internals] = this[$internals] = {
|
|
2565
|
+
accessors: {}
|
|
2566
|
+
};
|
|
2567
|
+
const accessors = internals.accessors;
|
|
2568
|
+
const prototype = this.prototype;
|
|
2569
|
+
function defineAccessor(_header) {
|
|
2570
|
+
const lHeader = normalizeHeader(_header);
|
|
2571
|
+
if (!accessors[lHeader]) {
|
|
2572
|
+
buildAccessors(prototype, _header);
|
|
2573
|
+
accessors[lHeader] = true;
|
|
2574
|
+
}
|
|
2575
|
+
}
|
|
2576
|
+
utils$2.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
|
|
2577
|
+
return this;
|
|
2578
|
+
}
|
|
2579
|
+
constructor(headers){
|
|
2580
|
+
headers && this.set(headers);
|
|
2581
|
+
}
|
|
2582
|
+
};
|
|
2583
|
+
AxiosHeaders$1.accessor([
|
|
2584
|
+
'Content-Type',
|
|
2585
|
+
'Content-Length',
|
|
2586
|
+
'Accept',
|
|
2587
|
+
'Accept-Encoding',
|
|
2588
|
+
'User-Agent',
|
|
2589
|
+
'Authorization'
|
|
2590
|
+
]);
|
|
2591
|
+
// reserved names hotfix
|
|
2592
|
+
utils$2.reduceDescriptors(AxiosHeaders$1.prototype, ({ value }, key)=>{
|
|
2593
|
+
let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
|
|
2594
|
+
return {
|
|
2595
|
+
get: ()=>value,
|
|
2596
|
+
set (headerValue) {
|
|
2597
|
+
this[mapped] = headerValue;
|
|
2598
|
+
}
|
|
2599
|
+
};
|
|
2600
|
+
});
|
|
2601
|
+
utils$2.freezeMethods(AxiosHeaders$1);
|
|
2939
2602
|
const AxiosHeaders$2 = AxiosHeaders$1;
|
|
2940
2603
|
|
|
2941
2604
|
/**
|
|
@@ -2945,24 +2608,20 @@ const AxiosHeaders$2 = AxiosHeaders$1;
|
|
|
2945
2608
|
* @param {?Object} response The response object
|
|
2946
2609
|
*
|
|
2947
2610
|
* @returns {*} The resulting transformed data
|
|
2948
|
-
*/
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
headers.normalize();
|
|
2960
|
-
|
|
2961
|
-
return data;
|
|
2611
|
+
*/ function transformData(fns, response) {
|
|
2612
|
+
const config = this || defaults$1;
|
|
2613
|
+
const context = response || config;
|
|
2614
|
+
const headers = AxiosHeaders$2.from(context.headers);
|
|
2615
|
+
let data = context.data;
|
|
2616
|
+
utils$2.forEach(fns, function transform(fn) {
|
|
2617
|
+
data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);
|
|
2618
|
+
});
|
|
2619
|
+
headers.normalize();
|
|
2620
|
+
return data;
|
|
2962
2621
|
}
|
|
2963
2622
|
|
|
2964
|
-
function isCancel$1(value) {
|
|
2965
|
-
|
|
2623
|
+
function isCancel$1(value) {
|
|
2624
|
+
return !!(value && value.__CANCEL__);
|
|
2966
2625
|
}
|
|
2967
2626
|
|
|
2968
2627
|
/**
|
|
@@ -2973,15 +2632,13 @@ function isCancel$1(value) {
|
|
|
2973
2632
|
* @param {Object=} request The request.
|
|
2974
2633
|
*
|
|
2975
2634
|
* @returns {CanceledError} The created error.
|
|
2976
|
-
*/
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
utils$2.inherits(CanceledError$1, AxiosError$2, {
|
|
2984
|
-
__CANCEL__: true
|
|
2635
|
+
*/ function CanceledError$1(message, config, request) {
|
|
2636
|
+
// eslint-disable-next-line no-eq-null,eqeqeq
|
|
2637
|
+
AxiosError$2.call(this, message == null ? 'canceled' : message, AxiosError$2.ERR_CANCELED, config, request);
|
|
2638
|
+
this.name = 'CanceledError';
|
|
2639
|
+
}
|
|
2640
|
+
utils$2.inherits(CanceledError$1, AxiosError$2, {
|
|
2641
|
+
__CANCEL__: true
|
|
2985
2642
|
});
|
|
2986
2643
|
|
|
2987
2644
|
/**
|
|
@@ -2990,12 +2647,11 @@ utils$2.inherits(CanceledError$1, AxiosError$2, {
|
|
|
2990
2647
|
* @param {string} url The URL to test
|
|
2991
2648
|
*
|
|
2992
2649
|
* @returns {boolean} True if the specified URL is absolute, otherwise false
|
|
2993
|
-
*/
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
|
|
2650
|
+
*/ function isAbsoluteURL(url) {
|
|
2651
|
+
// A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
|
|
2652
|
+
// RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
|
|
2653
|
+
// by any combination of letters, digits, plus, period, or hyphen.
|
|
2654
|
+
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
|
|
2999
2655
|
}
|
|
3000
2656
|
|
|
3001
2657
|
/**
|
|
@@ -3005,11 +2661,8 @@ function isAbsoluteURL(url) {
|
|
|
3005
2661
|
* @param {string} relativeURL The relative URL
|
|
3006
2662
|
*
|
|
3007
2663
|
* @returns {string} The combined URL
|
|
3008
|
-
*/
|
|
3009
|
-
|
|
3010
|
-
return relativeURL
|
|
3011
|
-
? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '')
|
|
3012
|
-
: baseURL;
|
|
2664
|
+
*/ function combineURLs(baseURL, relativeURL) {
|
|
2665
|
+
return relativeURL ? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '') : baseURL;
|
|
3013
2666
|
}
|
|
3014
2667
|
|
|
3015
2668
|
/**
|
|
@@ -3021,96 +2674,76 @@ function combineURLs(baseURL, relativeURL) {
|
|
|
3021
2674
|
* @param {string} requestedURL Absolute or relative URL to combine
|
|
3022
2675
|
*
|
|
3023
2676
|
* @returns {string} The combined full path
|
|
3024
|
-
*/
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
return requestedURL;
|
|
2677
|
+
*/ function buildFullPath(baseURL, requestedURL) {
|
|
2678
|
+
if (baseURL && !isAbsoluteURL(requestedURL)) {
|
|
2679
|
+
return combineURLs(baseURL, requestedURL);
|
|
2680
|
+
}
|
|
2681
|
+
return requestedURL;
|
|
3030
2682
|
}
|
|
3031
2683
|
|
|
3032
|
-
const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
|
|
3033
|
-
class XhrAdapter {
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
stream() {}
|
|
3043
|
-
}
|
|
3044
|
-
|
|
2684
|
+
const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
|
|
2685
|
+
let XhrAdapter = class XhrAdapter {
|
|
2686
|
+
init(config) {}
|
|
2687
|
+
request() {}
|
|
2688
|
+
stream() {}
|
|
2689
|
+
constructor(config){
|
|
2690
|
+
this.init(config);
|
|
2691
|
+
}
|
|
2692
|
+
};
|
|
3045
2693
|
const XhrAdapter$1 = isXHRAdapterSupported && XhrAdapter;
|
|
3046
2694
|
|
|
3047
|
-
const knownAdapters = {
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
};
|
|
3051
|
-
|
|
2695
|
+
const knownAdapters = {
|
|
2696
|
+
http: HttpAdapter,
|
|
2697
|
+
xhr: XhrAdapter$1
|
|
2698
|
+
};
|
|
3052
2699
|
/**
|
|
3053
2700
|
* define adapter's name and adapterName to http or xhr
|
|
3054
2701
|
* browser: httpAdapter is null!
|
|
3055
|
-
*/
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
2702
|
+
*/ utils$2.forEach(knownAdapters, (val, key)=>{
|
|
2703
|
+
if (val) {
|
|
2704
|
+
try {
|
|
2705
|
+
Object.defineProperty(val, 'name', {
|
|
2706
|
+
value: key
|
|
2707
|
+
});
|
|
2708
|
+
} catch (e) {
|
|
2709
|
+
// eslint-disable-next-line no-empty
|
|
2710
|
+
}
|
|
2711
|
+
Object.defineProperty(val, 'adapterName', {
|
|
2712
|
+
value: key
|
|
2713
|
+
});
|
|
2714
|
+
}
|
|
2715
|
+
});
|
|
2716
|
+
const adapters = {
|
|
2717
|
+
/**
|
|
3069
2718
|
* get http or xhr adapter
|
|
3070
2719
|
* @param {*} adapters user pass or ['xhr', 'http']
|
|
3071
2720
|
* @returns
|
|
3072
|
-
*/
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
}
|
|
3099
|
-
|
|
3100
|
-
throw new Error(
|
|
3101
|
-
utils$2.hasOwnProp(knownAdapters, nameOrAdapter)
|
|
3102
|
-
? `Adapter '${nameOrAdapter}' is not available in the build`
|
|
3103
|
-
: `Unknown adapter '${nameOrAdapter}'`
|
|
3104
|
-
);
|
|
3105
|
-
}
|
|
3106
|
-
|
|
3107
|
-
if (!utils$2.isFunction(adapter)) {
|
|
3108
|
-
throw new TypeError('adapter is not a function');
|
|
3109
|
-
}
|
|
3110
|
-
|
|
3111
|
-
return adapter;
|
|
3112
|
-
},
|
|
3113
|
-
adapters: knownAdapters,
|
|
2721
|
+
*/ getAdapter: (adapters)=>{
|
|
2722
|
+
adapters = utils$2.isArray(adapters) ? adapters : [
|
|
2723
|
+
adapters
|
|
2724
|
+
];
|
|
2725
|
+
const { length } = adapters;
|
|
2726
|
+
let nameOrAdapter;
|
|
2727
|
+
let adapter;
|
|
2728
|
+
// find not null adapter
|
|
2729
|
+
for(let i = 0; i < length; i++){
|
|
2730
|
+
nameOrAdapter = adapters[i];
|
|
2731
|
+
if (adapter = utils$2.isString(nameOrAdapter) ? knownAdapters[nameOrAdapter.toLowerCase()] : nameOrAdapter) {
|
|
2732
|
+
break;
|
|
2733
|
+
}
|
|
2734
|
+
}
|
|
2735
|
+
if (!adapter) {
|
|
2736
|
+
if (adapter === false) {
|
|
2737
|
+
throw new AxiosError$2(`Adapter ${nameOrAdapter} is not supported by the environment`, 'ERR_NOT_SUPPORT');
|
|
2738
|
+
}
|
|
2739
|
+
throw new Error(utils$2.hasOwnProp(knownAdapters, nameOrAdapter) ? `Adapter '${nameOrAdapter}' is not available in the build` : `Unknown adapter '${nameOrAdapter}'`);
|
|
2740
|
+
}
|
|
2741
|
+
if (!utils$2.isFunction(adapter)) {
|
|
2742
|
+
throw new TypeError('adapter is not a function');
|
|
2743
|
+
}
|
|
2744
|
+
return adapter;
|
|
2745
|
+
},
|
|
2746
|
+
adapters: knownAdapters
|
|
3114
2747
|
};
|
|
3115
2748
|
|
|
3116
2749
|
/**
|
|
@@ -3119,82 +2752,70 @@ const adapters = {
|
|
|
3119
2752
|
* @param {Object} config The config that is to be used for the request
|
|
3120
2753
|
*
|
|
3121
2754
|
* @returns {void}
|
|
3122
|
-
*/
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
}
|
|
3131
|
-
}
|
|
3132
|
-
|
|
2755
|
+
*/ function throwIfCancellationRequested(config) {
|
|
2756
|
+
if (config.cancelToken) {
|
|
2757
|
+
config.cancelToken.throwIfRequested();
|
|
2758
|
+
}
|
|
2759
|
+
if (config.signal && config.signal.aborted) {
|
|
2760
|
+
throw new CanceledError$1(null, config);
|
|
2761
|
+
}
|
|
2762
|
+
}
|
|
3133
2763
|
/**
|
|
3134
2764
|
* Dispatch a request to the server using the configured adapter.
|
|
3135
2765
|
* 请求如有异常,需向外抛出异常,不拦截
|
|
3136
2766
|
* @param {object} config The config that is to be used for the request
|
|
3137
2767
|
*
|
|
3138
2768
|
* @returns {Promise<*>} The Promise to be fulfilled
|
|
3139
|
-
*/
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
})
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
if (reason.response.data && !reason.response.body) reason.response.body = reason.response.data;
|
|
3185
|
-
reason.response.headers = AxiosHeaders$2.from(reason.response.headers);
|
|
3186
|
-
}
|
|
3187
|
-
}
|
|
3188
|
-
|
|
3189
|
-
return Promise.reject(reason)
|
|
3190
|
-
}
|
|
3191
|
-
);
|
|
3192
|
-
}
|
|
3193
|
-
return R
|
|
2769
|
+
*/ function dispatchRequest(config) {
|
|
2770
|
+
let R;
|
|
2771
|
+
throwIfCancellationRequested(config);
|
|
2772
|
+
config.headers = AxiosHeaders$2.from(config.headers);
|
|
2773
|
+
// Transform request data
|
|
2774
|
+
config.data = transformData.call(config, config.transformRequest);
|
|
2775
|
+
if ([
|
|
2776
|
+
'post',
|
|
2777
|
+
'put',
|
|
2778
|
+
'patch'
|
|
2779
|
+
].indexOf(config.method) !== -1) {
|
|
2780
|
+
config.headers.setContentType('application/x-www-form-urlencoded', false);
|
|
2781
|
+
}
|
|
2782
|
+
const Adapter = adapters.getAdapter(config.adapter || defaults$1.adapter);
|
|
2783
|
+
const adapter = new Adapter(config);
|
|
2784
|
+
if (config.stream) R = adapter.request(this);
|
|
2785
|
+
else {
|
|
2786
|
+
R = adapter.request(this).then((response)=>{
|
|
2787
|
+
throwIfCancellationRequested(config);
|
|
2788
|
+
// Transform response data
|
|
2789
|
+
response.data = transformData.call(config, config.transformResponse, response);
|
|
2790
|
+
// ! body === data
|
|
2791
|
+
Object.defineProperty(response, 'body', {
|
|
2792
|
+
get () {
|
|
2793
|
+
return response.data;
|
|
2794
|
+
}
|
|
2795
|
+
});
|
|
2796
|
+
// if (response.data && !response.body) response.body = response.data
|
|
2797
|
+
response.headers = AxiosHeaders$2.from(response.headers);
|
|
2798
|
+
return response;
|
|
2799
|
+
}, (reason)=>{
|
|
2800
|
+
if (!isCancel$1(reason)) {
|
|
2801
|
+
throwIfCancellationRequested(config);
|
|
2802
|
+
// Transform response data
|
|
2803
|
+
if (reason && reason.response) {
|
|
2804
|
+
reason.response.data = transformData.call(config, config.transformResponse, reason.response);
|
|
2805
|
+
// body === data
|
|
2806
|
+
if (reason.response.data && !reason.response.body) reason.response.body = reason.response.data;
|
|
2807
|
+
reason.response.headers = AxiosHeaders$2.from(reason.response.headers);
|
|
2808
|
+
}
|
|
2809
|
+
}
|
|
2810
|
+
return Promise.reject(reason);
|
|
2811
|
+
});
|
|
2812
|
+
}
|
|
2813
|
+
return R;
|
|
3194
2814
|
}
|
|
3195
2815
|
|
|
3196
|
-
const headersToObject = (thing)
|
|
3197
|
-
|
|
2816
|
+
const headersToObject = (thing)=>thing instanceof AxiosHeaders$2 ? {
|
|
2817
|
+
...thing
|
|
2818
|
+
} : thing;
|
|
3198
2819
|
/**
|
|
3199
2820
|
* Config-specific merge-function which creates a new config-object
|
|
3200
2821
|
* by merging two configuration objects together.
|
|
@@ -3203,111 +2824,108 @@ const headersToObject = (thing) => thing instanceof AxiosHeaders$2 ? { ...thing
|
|
|
3203
2824
|
* @param {Object} config2
|
|
3204
2825
|
*
|
|
3205
2826
|
* @returns {Object} New object resulting from merging config2 to config1
|
|
3206
|
-
*/
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
}
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
}
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
utils$2.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
|
|
3290
|
-
const merge = mergeMap[prop] || mergeDeepProperties;
|
|
3291
|
-
const configValue = merge(config1[prop], config2[prop], prop);
|
|
3292
|
-
(utils$2.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
|
3293
|
-
});
|
|
3294
|
-
|
|
3295
|
-
return config;
|
|
2827
|
+
*/ function mergeConfig$1(config1, config2) {
|
|
2828
|
+
// eslint-disable-next-line no-param-reassign
|
|
2829
|
+
config2 = config2 || {};
|
|
2830
|
+
const config = {};
|
|
2831
|
+
function getMergedValue(target, source, caseless) {
|
|
2832
|
+
if (utils$2.isPlainObject(target) && utils$2.isPlainObject(source)) {
|
|
2833
|
+
return utils$2.merge.call({
|
|
2834
|
+
caseless
|
|
2835
|
+
}, target, source);
|
|
2836
|
+
} else if (utils$2.isPlainObject(source)) {
|
|
2837
|
+
return utils$2.merge({}, source);
|
|
2838
|
+
} else if (utils$2.isArray(source)) {
|
|
2839
|
+
return source.slice();
|
|
2840
|
+
}
|
|
2841
|
+
return source;
|
|
2842
|
+
}
|
|
2843
|
+
// eslint-disable-next-line consistent-return
|
|
2844
|
+
function mergeDeepProperties(a, b, caseless) {
|
|
2845
|
+
if (!utils$2.isUndefined(b)) {
|
|
2846
|
+
return getMergedValue(a, b, caseless);
|
|
2847
|
+
} else if (!utils$2.isUndefined(a)) {
|
|
2848
|
+
return getMergedValue(undefined, a, caseless);
|
|
2849
|
+
}
|
|
2850
|
+
}
|
|
2851
|
+
// eslint-disable-next-line consistent-return
|
|
2852
|
+
function valueFromConfig2(a, b) {
|
|
2853
|
+
if (!utils$2.isUndefined(b)) {
|
|
2854
|
+
return getMergedValue(undefined, b);
|
|
2855
|
+
}
|
|
2856
|
+
}
|
|
2857
|
+
// eslint-disable-next-line consistent-return
|
|
2858
|
+
function defaultToConfig2(a, b) {
|
|
2859
|
+
if (!utils$2.isUndefined(b)) {
|
|
2860
|
+
return getMergedValue(undefined, b);
|
|
2861
|
+
} else if (!utils$2.isUndefined(a)) {
|
|
2862
|
+
return getMergedValue(undefined, a);
|
|
2863
|
+
}
|
|
2864
|
+
}
|
|
2865
|
+
// eslint-disable-next-line consistent-return
|
|
2866
|
+
function mergeDirectKeys(a, b, prop) {
|
|
2867
|
+
if (prop in config2) {
|
|
2868
|
+
return getMergedValue(a, b);
|
|
2869
|
+
} else if (prop in config1) {
|
|
2870
|
+
return getMergedValue(undefined, a);
|
|
2871
|
+
}
|
|
2872
|
+
}
|
|
2873
|
+
const mergeMap = {
|
|
2874
|
+
url: valueFromConfig2,
|
|
2875
|
+
method: valueFromConfig2,
|
|
2876
|
+
data: valueFromConfig2,
|
|
2877
|
+
baseURL: defaultToConfig2,
|
|
2878
|
+
transformRequest: defaultToConfig2,
|
|
2879
|
+
transformResponse: defaultToConfig2,
|
|
2880
|
+
paramsSerializer: defaultToConfig2,
|
|
2881
|
+
timeout: defaultToConfig2,
|
|
2882
|
+
timeoutMessage: defaultToConfig2,
|
|
2883
|
+
withCredentials: defaultToConfig2,
|
|
2884
|
+
withXSRFToken: defaultToConfig2,
|
|
2885
|
+
adapter: defaultToConfig2,
|
|
2886
|
+
responseType: defaultToConfig2,
|
|
2887
|
+
xsrfCookieName: defaultToConfig2,
|
|
2888
|
+
xsrfHeaderName: defaultToConfig2,
|
|
2889
|
+
onUploadProgress: defaultToConfig2,
|
|
2890
|
+
onDownloadProgress: defaultToConfig2,
|
|
2891
|
+
decompress: defaultToConfig2,
|
|
2892
|
+
maxContentLength: defaultToConfig2,
|
|
2893
|
+
maxBodyLength: defaultToConfig2,
|
|
2894
|
+
beforeRedirect: defaultToConfig2,
|
|
2895
|
+
transport: defaultToConfig2,
|
|
2896
|
+
httpAgent: defaultToConfig2,
|
|
2897
|
+
httpsAgent: defaultToConfig2,
|
|
2898
|
+
cancelToken: defaultToConfig2,
|
|
2899
|
+
socketPath: defaultToConfig2,
|
|
2900
|
+
responseEncoding: defaultToConfig2,
|
|
2901
|
+
validateStatus: mergeDirectKeys,
|
|
2902
|
+
headers: (a, b)=>mergeDeepProperties(headersToObject(a), headersToObject(b), true)
|
|
2903
|
+
};
|
|
2904
|
+
utils$2.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
|
|
2905
|
+
const merge = mergeMap[prop] || mergeDeepProperties;
|
|
2906
|
+
const configValue = merge(config1[prop], config2[prop], prop);
|
|
2907
|
+
utils$2.isUndefined(configValue) && merge !== mergeDirectKeys || (config[prop] = configValue);
|
|
2908
|
+
});
|
|
2909
|
+
return config;
|
|
3296
2910
|
}
|
|
3297
2911
|
|
|
3298
2912
|
const VERSION$1 = "1.7.7";
|
|
3299
2913
|
|
|
3300
|
-
const validators$1 = {};
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
2914
|
+
const validators$1 = {};
|
|
2915
|
+
// eslint-disable-next-line func-names
|
|
2916
|
+
[
|
|
2917
|
+
'object',
|
|
2918
|
+
'boolean',
|
|
2919
|
+
'number',
|
|
2920
|
+
'function',
|
|
2921
|
+
'string',
|
|
2922
|
+
'symbol'
|
|
2923
|
+
].forEach((type, i)=>{
|
|
2924
|
+
validators$1[type] = function validator(thing) {
|
|
2925
|
+
return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;
|
|
2926
|
+
};
|
|
2927
|
+
});
|
|
2928
|
+
const deprecatedWarnings = {};
|
|
3311
2929
|
/**
|
|
3312
2930
|
* Transitional option validator
|
|
3313
2931
|
*
|
|
@@ -3316,44 +2934,30 @@ const deprecatedWarnings = {};
|
|
|
3316
2934
|
* @param {string?} message - some message with additional info
|
|
3317
2935
|
*
|
|
3318
2936
|
* @returns {function}
|
|
3319
|
-
*/
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
}
|
|
3344
|
-
|
|
3345
|
-
return validator ? validator(value, opt, opts) : true;
|
|
3346
|
-
};
|
|
3347
|
-
};
|
|
3348
|
-
|
|
3349
|
-
validators$1.spelling = function spelling(correctSpelling) {
|
|
3350
|
-
return (value, opt) => {
|
|
3351
|
-
// eslint-disable-next-line no-console
|
|
3352
|
-
console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);
|
|
3353
|
-
return true;
|
|
3354
|
-
}
|
|
3355
|
-
};
|
|
3356
|
-
|
|
2937
|
+
*/ validators$1.transitional = function transitional(validator, version, message) {
|
|
2938
|
+
function formatMessage(opt, desc) {
|
|
2939
|
+
return '[Axios v' + VERSION$1 + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : '');
|
|
2940
|
+
}
|
|
2941
|
+
// eslint-disable-next-line func-names
|
|
2942
|
+
return (value, opt, opts)=>{
|
|
2943
|
+
if (validator === false) {
|
|
2944
|
+
throw new AxiosError$2(formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')), AxiosError$2.ERR_DEPRECATED);
|
|
2945
|
+
}
|
|
2946
|
+
if (version && !deprecatedWarnings[opt]) {
|
|
2947
|
+
deprecatedWarnings[opt] = true;
|
|
2948
|
+
// eslint-disable-next-line no-console
|
|
2949
|
+
console.warn(formatMessage(opt, ' has been deprecated since v' + version + ' and will be removed in the near future'));
|
|
2950
|
+
}
|
|
2951
|
+
return validator ? validator(value, opt, opts) : true;
|
|
2952
|
+
};
|
|
2953
|
+
};
|
|
2954
|
+
validators$1.spelling = function spelling(correctSpelling) {
|
|
2955
|
+
return (value, opt)=>{
|
|
2956
|
+
// eslint-disable-next-line no-console
|
|
2957
|
+
console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);
|
|
2958
|
+
return true;
|
|
2959
|
+
};
|
|
2960
|
+
};
|
|
3357
2961
|
/**
|
|
3358
2962
|
* Assert object's properties type
|
|
3359
2963
|
*
|
|
@@ -3362,58 +2966,42 @@ validators$1.spelling = function spelling(correctSpelling) {
|
|
|
3362
2966
|
* @param {boolean?} allowUnknown
|
|
3363
2967
|
*
|
|
3364
2968
|
* @returns {object}
|
|
3365
|
-
*/
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
const validator = {
|
|
3391
|
-
assertOptions,
|
|
3392
|
-
validators: validators$1
|
|
2969
|
+
*/ function assertOptions(options, schema, allowUnknown) {
|
|
2970
|
+
if (typeof options !== 'object') {
|
|
2971
|
+
throw new AxiosError$2('options must be an object', AxiosError$2.ERR_BAD_OPTION_VALUE);
|
|
2972
|
+
}
|
|
2973
|
+
const keys = Object.keys(options);
|
|
2974
|
+
let i = keys.length;
|
|
2975
|
+
while(i-- > 0){
|
|
2976
|
+
const opt = keys[i];
|
|
2977
|
+
const validator = schema[opt];
|
|
2978
|
+
if (validator) {
|
|
2979
|
+
const value = options[opt];
|
|
2980
|
+
const result = value === undefined || validator(value, opt, options);
|
|
2981
|
+
if (result !== true) {
|
|
2982
|
+
throw new AxiosError$2('option ' + opt + ' must be ' + result, AxiosError$2.ERR_BAD_OPTION_VALUE);
|
|
2983
|
+
}
|
|
2984
|
+
continue;
|
|
2985
|
+
}
|
|
2986
|
+
if (allowUnknown !== true) {
|
|
2987
|
+
throw new AxiosError$2('Unknown option ' + opt, AxiosError$2.ERR_BAD_OPTION);
|
|
2988
|
+
}
|
|
2989
|
+
}
|
|
2990
|
+
}
|
|
2991
|
+
const validator = {
|
|
2992
|
+
assertOptions,
|
|
2993
|
+
validators: validators$1
|
|
3393
2994
|
};
|
|
3394
2995
|
|
|
3395
|
-
const {validators} = validator;
|
|
3396
|
-
|
|
2996
|
+
const { validators } = validator;
|
|
3397
2997
|
/**
|
|
3398
2998
|
* Create a new instance of Axios
|
|
3399
2999
|
*
|
|
3400
3000
|
* @param {Object} instanceConfig The default config for the instance
|
|
3401
3001
|
*
|
|
3402
3002
|
* @return {Axios} A new instance of Axios
|
|
3403
|
-
*/
|
|
3404
|
-
|
|
3405
|
-
constructor(instanceConfig) {
|
|
3406
|
-
this.defaults = instanceConfig;
|
|
3407
|
-
this.config = this.defaults; // !+++
|
|
3408
|
-
this.interceptors = {
|
|
3409
|
-
request: new InterceptorManager$1(),
|
|
3410
|
-
response: new InterceptorManager$1(),
|
|
3411
|
-
};
|
|
3412
|
-
|
|
3413
|
-
this.init(); // !+++
|
|
3414
|
-
}
|
|
3415
|
-
|
|
3416
|
-
/**
|
|
3003
|
+
*/ let Axios$1 = class Axios {
|
|
3004
|
+
/**
|
|
3417
3005
|
* !+++
|
|
3418
3006
|
* config 属性直接挂在到实例上,方便读取、设置、修改
|
|
3419
3007
|
* 需注意,不要与其属性、方法冲突!!!
|
|
@@ -3426,252 +3014,222 @@ let Axios$1 = class Axios {
|
|
|
3426
3014
|
put(url[, data[, config]])
|
|
3427
3015
|
patch(url[, data[, config]])
|
|
3428
3016
|
getUri([config])
|
|
3429
|
-
*/
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
|
|
3472
|
-
|
|
3473
|
-
|
|
3474
|
-
|
|
3475
|
-
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
})
|
|
3481
|
-
);
|
|
3482
|
-
}
|
|
3483
|
-
|
|
3484
|
-
/**
|
|
3017
|
+
*/ init() {
|
|
3018
|
+
const m = this;
|
|
3019
|
+
[
|
|
3020
|
+
'url',
|
|
3021
|
+
'method',
|
|
3022
|
+
'baseURL',
|
|
3023
|
+
'transformRequest',
|
|
3024
|
+
'transformResponse',
|
|
3025
|
+
'headers',
|
|
3026
|
+
'params',
|
|
3027
|
+
'paramsSerializer',
|
|
3028
|
+
'body',
|
|
3029
|
+
'data',
|
|
3030
|
+
'timeout',
|
|
3031
|
+
'withCredentials',
|
|
3032
|
+
'adapter',
|
|
3033
|
+
'auth',
|
|
3034
|
+
'responseType',
|
|
3035
|
+
'responseEncoding',
|
|
3036
|
+
'xsrfCookieName',
|
|
3037
|
+
'xsrfHeaderName',
|
|
3038
|
+
'onUploadProgress',
|
|
3039
|
+
'onDownloadProgress',
|
|
3040
|
+
'maxContentLength',
|
|
3041
|
+
'maxBodyLength',
|
|
3042
|
+
'validateStatus',
|
|
3043
|
+
'maxRedirects',
|
|
3044
|
+
'beforeRedirect',
|
|
3045
|
+
'socketPath',
|
|
3046
|
+
'httpAgent',
|
|
3047
|
+
'httpsAgent',
|
|
3048
|
+
'agent',
|
|
3049
|
+
'cancelToken',
|
|
3050
|
+
'signal',
|
|
3051
|
+
'decompress',
|
|
3052
|
+
'insecureHTTPParser',
|
|
3053
|
+
'transitional',
|
|
3054
|
+
'env',
|
|
3055
|
+
'formSerializer',
|
|
3056
|
+
'maxRate'
|
|
3057
|
+
].forEach((p)=>Object.defineProperty(m, p, {
|
|
3058
|
+
enumerable: true,
|
|
3059
|
+
get () {
|
|
3060
|
+
return m.config[p];
|
|
3061
|
+
},
|
|
3062
|
+
set (value) {
|
|
3063
|
+
m.config[p] = value;
|
|
3064
|
+
}
|
|
3065
|
+
}));
|
|
3066
|
+
}
|
|
3067
|
+
/**
|
|
3485
3068
|
* Dispatch a request
|
|
3486
3069
|
* 启动执行请求,返回 Promise 实例
|
|
3487
3070
|
* @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
|
|
3488
3071
|
* @param {?Object} config
|
|
3489
3072
|
* @returns {Promise} The Promise to be fulfilled
|
|
3490
|
-
*/
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
}
|
|
3516
|
-
}
|
|
3517
|
-
|
|
3518
|
-
/**
|
|
3073
|
+
*/ async request(configOrUrl, config) {
|
|
3074
|
+
try {
|
|
3075
|
+
return await this._request(configOrUrl, config);
|
|
3076
|
+
} catch (err) {
|
|
3077
|
+
if (err instanceof Error) {
|
|
3078
|
+
let dummy = {};
|
|
3079
|
+
Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error();
|
|
3080
|
+
// slice off the Error: ... line
|
|
3081
|
+
const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, '') : '';
|
|
3082
|
+
try {
|
|
3083
|
+
if (!err.stack) {
|
|
3084
|
+
err.stack = stack;
|
|
3085
|
+
// match without the 2 top stack lines
|
|
3086
|
+
} else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ''))) {
|
|
3087
|
+
err.stack += '\n' + stack;
|
|
3088
|
+
}
|
|
3089
|
+
} catch (e) {
|
|
3090
|
+
// ignore the case where "stack" is an un-writable property
|
|
3091
|
+
}
|
|
3092
|
+
}
|
|
3093
|
+
throw err // 抛出异常
|
|
3094
|
+
;
|
|
3095
|
+
}
|
|
3096
|
+
}
|
|
3097
|
+
/**
|
|
3519
3098
|
* 执行请求
|
|
3520
3099
|
* @param {*} configOrUrl
|
|
3521
3100
|
* @param {*} config
|
|
3522
3101
|
* @param {boolean} [stream = false] - 是否返回 stream
|
|
3523
3102
|
* @returns
|
|
3524
|
-
*/
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
}
|
|
3655
|
-
}
|
|
3656
|
-
|
|
3657
|
-
try {
|
|
3658
|
-
promise = dispatchRequest.call(this, newConfig);
|
|
3659
|
-
i = 0;
|
|
3660
|
-
len = responseInterceptorChain.length;
|
|
3661
|
-
|
|
3662
|
-
// 按顺序执行响应 hook
|
|
3663
|
-
while (i < len) promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);
|
|
3664
|
-
|
|
3665
|
-
R = promise;
|
|
3666
|
-
} catch (error) {
|
|
3667
|
-
R = Promise.reject(error);
|
|
3668
|
-
}
|
|
3669
|
-
}
|
|
3670
|
-
|
|
3671
|
-
return R
|
|
3672
|
-
}
|
|
3673
|
-
|
|
3674
|
-
/**
|
|
3103
|
+
*/ _request(configOrUrl, config, stream = false) {
|
|
3104
|
+
let R = null;
|
|
3105
|
+
/* eslint no-param-reassign:0 */ // Allow for axios('example/url'[, config]) a la fetch API
|
|
3106
|
+
if (typeof configOrUrl === 'string') {
|
|
3107
|
+
config = config || {};
|
|
3108
|
+
config.url = configOrUrl;
|
|
3109
|
+
} else {
|
|
3110
|
+
config = configOrUrl || {};
|
|
3111
|
+
}
|
|
3112
|
+
// ! body as data alias, body ==> data,内部保持data不变
|
|
3113
|
+
if (!config.data && config.body) {
|
|
3114
|
+
config.data = config.body;
|
|
3115
|
+
// config.body = undefined;
|
|
3116
|
+
}
|
|
3117
|
+
config = mergeConfig$1(this.defaults, config);
|
|
3118
|
+
const { transitional, paramsSerializer, headers } = config;
|
|
3119
|
+
if (transitional !== undefined) {
|
|
3120
|
+
validator.assertOptions(transitional, {
|
|
3121
|
+
silentJSONParsing: validators.transitional(validators.boolean),
|
|
3122
|
+
forcedJSONParsing: validators.transitional(validators.boolean),
|
|
3123
|
+
clarifyTimeoutError: validators.transitional(validators.boolean)
|
|
3124
|
+
}, false);
|
|
3125
|
+
}
|
|
3126
|
+
if (paramsSerializer) {
|
|
3127
|
+
if (utils$2.isFunction(paramsSerializer)) {
|
|
3128
|
+
config.paramsSerializer = {
|
|
3129
|
+
serialize: paramsSerializer
|
|
3130
|
+
};
|
|
3131
|
+
} else {
|
|
3132
|
+
validator.assertOptions(paramsSerializer, {
|
|
3133
|
+
encode: validators.function,
|
|
3134
|
+
serialize: validators.function
|
|
3135
|
+
}, true);
|
|
3136
|
+
}
|
|
3137
|
+
}
|
|
3138
|
+
validator.assertOptions(config, {
|
|
3139
|
+
baseUrl: validators.spelling('baseURL'),
|
|
3140
|
+
withXsrfToken: validators.spelling('withXSRFToken')
|
|
3141
|
+
}, true);
|
|
3142
|
+
// Set config.method
|
|
3143
|
+
config.method = (config.method || this.defaults.method || 'get').toLowerCase();
|
|
3144
|
+
// Flatten headers,方法头覆盖通用头
|
|
3145
|
+
const contextHeaders = headers && utils$2.merge(headers.common, headers[config.method]);
|
|
3146
|
+
headers && utils$2.forEach([
|
|
3147
|
+
'delete',
|
|
3148
|
+
'get',
|
|
3149
|
+
'head',
|
|
3150
|
+
'post',
|
|
3151
|
+
'put',
|
|
3152
|
+
'patch',
|
|
3153
|
+
'common'
|
|
3154
|
+
], (method)=>{
|
|
3155
|
+
delete headers[method];
|
|
3156
|
+
});
|
|
3157
|
+
// 源值存在,则不覆盖,contextHeaders 优先于 headers
|
|
3158
|
+
config.headers = AxiosHeaders$2.concat(contextHeaders, headers);
|
|
3159
|
+
// filter out skipped interceptors
|
|
3160
|
+
const requestInterceptorChain = [] // 请求拦截器,hook
|
|
3161
|
+
;
|
|
3162
|
+
let synchronousRequestInterceptors = true;
|
|
3163
|
+
this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
|
|
3164
|
+
if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {
|
|
3165
|
+
return;
|
|
3166
|
+
}
|
|
3167
|
+
synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
|
|
3168
|
+
requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
|
|
3169
|
+
});
|
|
3170
|
+
const responseInterceptorChain = [] // 响应拦截器,hook
|
|
3171
|
+
;
|
|
3172
|
+
this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
|
|
3173
|
+
responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
|
|
3174
|
+
});
|
|
3175
|
+
let promise;
|
|
3176
|
+
let i = 0;
|
|
3177
|
+
let len;
|
|
3178
|
+
debugger;
|
|
3179
|
+
// 执行dispatchRequest
|
|
3180
|
+
// !+++ stream
|
|
3181
|
+
if (stream) {
|
|
3182
|
+
config.stream = true;
|
|
3183
|
+
R = dispatchRequest.call(this, config) // not promise
|
|
3184
|
+
;
|
|
3185
|
+
} else if (!synchronousRequestInterceptors) {
|
|
3186
|
+
// 异步拦截器
|
|
3187
|
+
const chain = [
|
|
3188
|
+
dispatchRequest.bind(this),
|
|
3189
|
+
undefined
|
|
3190
|
+
] // dispatchRequest 放入运行链
|
|
3191
|
+
;
|
|
3192
|
+
chain.unshift(...requestInterceptorChain) // !*** 插入头
|
|
3193
|
+
;
|
|
3194
|
+
chain.push(...responseInterceptorChain) // !*** 加入尾
|
|
3195
|
+
;
|
|
3196
|
+
len = chain.length;
|
|
3197
|
+
promise = Promise.resolve(config) // promise 对象
|
|
3198
|
+
;
|
|
3199
|
+
// 传入config配置,按顺序执行
|
|
3200
|
+
while(i < len)promise = promise.then(chain[i++], chain[i++]);
|
|
3201
|
+
R = promise;
|
|
3202
|
+
} else {
|
|
3203
|
+
// 同步拦截器
|
|
3204
|
+
len = requestInterceptorChain.length;
|
|
3205
|
+
let newConfig = config;
|
|
3206
|
+
i = 0;
|
|
3207
|
+
// 按加入顺序运行 request 拦截器
|
|
3208
|
+
while(i < len){
|
|
3209
|
+
const onFulfilled = requestInterceptorChain[i++];
|
|
3210
|
+
const onRejected = requestInterceptorChain[i++];
|
|
3211
|
+
try {
|
|
3212
|
+
newConfig = onFulfilled(newConfig) // 执行
|
|
3213
|
+
;
|
|
3214
|
+
} catch (error) {
|
|
3215
|
+
onRejected.call(this, error);
|
|
3216
|
+
break;
|
|
3217
|
+
}
|
|
3218
|
+
}
|
|
3219
|
+
try {
|
|
3220
|
+
promise = dispatchRequest.call(this, newConfig);
|
|
3221
|
+
i = 0;
|
|
3222
|
+
len = responseInterceptorChain.length;
|
|
3223
|
+
// 按顺序执行响应 hook
|
|
3224
|
+
while(i < len)promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);
|
|
3225
|
+
R = promise;
|
|
3226
|
+
} catch (error) {
|
|
3227
|
+
R = Promise.reject(error);
|
|
3228
|
+
}
|
|
3229
|
+
}
|
|
3230
|
+
return R;
|
|
3231
|
+
}
|
|
3232
|
+
/**
|
|
3675
3233
|
* !+++
|
|
3676
3234
|
* 类似 request 库,返回 stream
|
|
3677
3235
|
* stream 模式下,拦截器无效
|
|
@@ -3680,111 +3238,110 @@ let Axios$1 = class Axios {
|
|
|
3680
3238
|
* @param {*} configOrUrl
|
|
3681
3239
|
* @param {*} config
|
|
3682
3240
|
* @returns
|
|
3683
|
-
*/
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
/**
|
|
3241
|
+
*/ stream(configOrUrl, config) {
|
|
3242
|
+
return this._request(configOrUrl, config, true);
|
|
3243
|
+
}
|
|
3244
|
+
/**
|
|
3689
3245
|
*
|
|
3690
3246
|
* @param {*} config
|
|
3691
3247
|
* @returns
|
|
3692
|
-
*/
|
|
3693
|
-
|
|
3694
|
-
|
|
3695
|
-
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3248
|
+
*/ getUri(config) {
|
|
3249
|
+
config = mergeConfig$1(this.defaults, config);
|
|
3250
|
+
const fullPath = buildFullPath(config.baseURL, config.url);
|
|
3251
|
+
return buildURL(fullPath, config.params, config.paramsSerializer);
|
|
3252
|
+
}
|
|
3253
|
+
constructor(instanceConfig){
|
|
3254
|
+
this.defaults = instanceConfig;
|
|
3255
|
+
this.config = this.defaults // !+++
|
|
3256
|
+
;
|
|
3257
|
+
this.interceptors = {
|
|
3258
|
+
request: new InterceptorManager$1(),
|
|
3259
|
+
response: new InterceptorManager$1()
|
|
3260
|
+
};
|
|
3261
|
+
this.init() // !+++
|
|
3262
|
+
;
|
|
3263
|
+
}
|
|
3264
|
+
};
|
|
3265
|
+
// Provide aliases for supported request methods
|
|
3266
|
+
utils$2.forEach([
|
|
3267
|
+
'head',
|
|
3268
|
+
'options'
|
|
3269
|
+
], function forEachMethodNoData(method) {
|
|
3270
|
+
/* eslint func-names:0 */ Axios$1.prototype[method] = function(url, config) {
|
|
3271
|
+
return this.request(mergeConfig$1(config || {}, {
|
|
3272
|
+
method,
|
|
3273
|
+
url,
|
|
3274
|
+
data: (config || {}).data
|
|
3275
|
+
}));
|
|
3276
|
+
};
|
|
3277
|
+
});
|
|
3278
|
+
// delete、get, 与 axios不同,第二个参数为 params,而不是 data
|
|
3279
|
+
utils$2.forEach([
|
|
3280
|
+
'delete',
|
|
3281
|
+
'get'
|
|
3282
|
+
], function forEachMethodNoData(method) {
|
|
3283
|
+
Axios$1.prototype[method] = function(url, params, config) {
|
|
3284
|
+
return this.request(mergeConfig$1(config || {}, {
|
|
3285
|
+
method,
|
|
3286
|
+
url,
|
|
3287
|
+
params
|
|
3288
|
+
}));
|
|
3289
|
+
};
|
|
3290
|
+
});
|
|
3291
|
+
utils$2.forEach([
|
|
3292
|
+
'post',
|
|
3293
|
+
'put',
|
|
3294
|
+
'patch'
|
|
3295
|
+
], function forEachMethodWithData(method) {
|
|
3296
|
+
function generateHTTPMethod(isForm) {
|
|
3297
|
+
return function httpMethod(url, data, config) {
|
|
3298
|
+
return this.request(mergeConfig$1(config || {}, {
|
|
3299
|
+
method,
|
|
3300
|
+
headers: isForm ? {
|
|
3301
|
+
'Content-Type': 'multipart/form-data'
|
|
3302
|
+
} : {},
|
|
3303
|
+
url,
|
|
3304
|
+
data
|
|
3305
|
+
}));
|
|
3306
|
+
};
|
|
3307
|
+
}
|
|
3308
|
+
Axios$1.prototype[method] = generateHTTPMethod();
|
|
3309
|
+
Axios$1.prototype[`${method}Form`] = generateHTTPMethod(true);
|
|
3310
|
+
});
|
|
3311
|
+
// stream get, 与 axios不同,第二个参数为 params,而不是 data
|
|
3312
|
+
utils$2.forEach([
|
|
3313
|
+
'gets'
|
|
3314
|
+
], function forEachMethodNoData(method) {
|
|
3315
|
+
Axios$1.prototype[method] = function(url, params, config) {
|
|
3316
|
+
return this.stream(mergeConfig$1(config || {}, {
|
|
3317
|
+
method,
|
|
3318
|
+
url,
|
|
3319
|
+
params,
|
|
3320
|
+
data: (config || {}).data
|
|
3321
|
+
}));
|
|
3322
|
+
};
|
|
3323
|
+
});
|
|
3324
|
+
// stream post put patch
|
|
3325
|
+
utils$2.forEach([
|
|
3326
|
+
'posts',
|
|
3327
|
+
'puts',
|
|
3328
|
+
'patchs'
|
|
3329
|
+
], function forEachMethodWithData(method) {
|
|
3330
|
+
function generateStreamMethod(isForm) {
|
|
3331
|
+
return function httpMethod(url, data, config) {
|
|
3332
|
+
return this.stream(mergeConfig$1(config || {}, {
|
|
3333
|
+
method,
|
|
3334
|
+
headers: isForm ? {
|
|
3335
|
+
'Content-Type': 'multipart/form-data'
|
|
3336
|
+
} : {},
|
|
3337
|
+
url,
|
|
3338
|
+
data
|
|
3339
|
+
}));
|
|
3340
|
+
};
|
|
3341
|
+
}
|
|
3342
|
+
Axios$1.prototype[method] = generateStreamMethod();
|
|
3343
|
+
Axios$1.prototype[`${method}Forms`] = generateStreamMethod(true);
|
|
3344
|
+
});
|
|
3788
3345
|
const Axios$2 = Axios$1;
|
|
3789
3346
|
|
|
3790
3347
|
/**
|
|
@@ -3793,130 +3350,103 @@ const Axios$2 = Axios$1;
|
|
|
3793
3350
|
* @param {Function} executor The executor function.
|
|
3794
3351
|
*
|
|
3795
3352
|
* @returns {CancelToken}
|
|
3796
|
-
*/
|
|
3797
|
-
|
|
3798
|
-
constructor(executor) {
|
|
3799
|
-
if (typeof executor !== 'function') {
|
|
3800
|
-
throw new TypeError('executor must be a function.');
|
|
3801
|
-
}
|
|
3802
|
-
|
|
3803
|
-
let resolvePromise;
|
|
3804
|
-
|
|
3805
|
-
this.promise = new Promise(function promiseExecutor(resolve) {
|
|
3806
|
-
resolvePromise = resolve;
|
|
3807
|
-
});
|
|
3808
|
-
|
|
3809
|
-
const token = this;
|
|
3810
|
-
|
|
3811
|
-
// eslint-disable-next-line func-names
|
|
3812
|
-
this.promise.then(cancel => {
|
|
3813
|
-
if (!token._listeners) return;
|
|
3814
|
-
|
|
3815
|
-
let i = token._listeners.length;
|
|
3816
|
-
|
|
3817
|
-
while (i-- > 0) {
|
|
3818
|
-
token._listeners[i](cancel);
|
|
3819
|
-
}
|
|
3820
|
-
token._listeners = null;
|
|
3821
|
-
});
|
|
3822
|
-
|
|
3823
|
-
// eslint-disable-next-line func-names
|
|
3824
|
-
this.promise.then = onfulfilled => {
|
|
3825
|
-
let _resolve;
|
|
3826
|
-
// eslint-disable-next-line func-names
|
|
3827
|
-
const promise = new Promise(resolve => {
|
|
3828
|
-
token.subscribe(resolve);
|
|
3829
|
-
_resolve = resolve;
|
|
3830
|
-
}).then(onfulfilled);
|
|
3831
|
-
|
|
3832
|
-
promise.cancel = function reject() {
|
|
3833
|
-
token.unsubscribe(_resolve);
|
|
3834
|
-
};
|
|
3835
|
-
|
|
3836
|
-
return promise;
|
|
3837
|
-
};
|
|
3838
|
-
|
|
3839
|
-
executor(function cancel(message, config, request) {
|
|
3840
|
-
if (token.reason) {
|
|
3841
|
-
// Cancellation has already been requested
|
|
3842
|
-
return;
|
|
3843
|
-
}
|
|
3844
|
-
|
|
3845
|
-
token.reason = new CanceledError$1(message, config, request);
|
|
3846
|
-
resolvePromise(token.reason);
|
|
3847
|
-
});
|
|
3848
|
-
}
|
|
3849
|
-
|
|
3850
|
-
/**
|
|
3353
|
+
*/ let CancelToken$1 = class CancelToken {
|
|
3354
|
+
/**
|
|
3851
3355
|
* Throws a `CanceledError` if cancellation has been requested.
|
|
3852
|
-
*/
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
}
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
/**
|
|
3356
|
+
*/ throwIfRequested() {
|
|
3357
|
+
if (this.reason) {
|
|
3358
|
+
throw this.reason;
|
|
3359
|
+
}
|
|
3360
|
+
}
|
|
3361
|
+
/**
|
|
3860
3362
|
* Subscribe to the cancel signal
|
|
3861
|
-
*/
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
}
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
/**
|
|
3363
|
+
*/ subscribe(listener) {
|
|
3364
|
+
if (this.reason) {
|
|
3365
|
+
listener(this.reason);
|
|
3366
|
+
return;
|
|
3367
|
+
}
|
|
3368
|
+
if (this._listeners) {
|
|
3369
|
+
this._listeners.push(listener);
|
|
3370
|
+
} else {
|
|
3371
|
+
this._listeners = [
|
|
3372
|
+
listener
|
|
3373
|
+
];
|
|
3374
|
+
}
|
|
3375
|
+
}
|
|
3376
|
+
/**
|
|
3877
3377
|
* Unsubscribe from the cancel signal
|
|
3878
|
-
*/
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
3892
|
-
|
|
3893
|
-
|
|
3894
|
-
|
|
3895
|
-
}
|
|
3896
|
-
|
|
3897
|
-
this.subscribe(abort);
|
|
3898
|
-
|
|
3899
|
-
controller.signal.unsubscribe = () => this.unsubscribe(abort);
|
|
3900
|
-
|
|
3901
|
-
return controller.signal;
|
|
3902
|
-
}
|
|
3903
|
-
|
|
3904
|
-
/**
|
|
3378
|
+
*/ unsubscribe(listener) {
|
|
3379
|
+
if (!this._listeners) {
|
|
3380
|
+
return;
|
|
3381
|
+
}
|
|
3382
|
+
const index = this._listeners.indexOf(listener);
|
|
3383
|
+
if (index !== -1) {
|
|
3384
|
+
this._listeners.splice(index, 1);
|
|
3385
|
+
}
|
|
3386
|
+
}
|
|
3387
|
+
toAbortSignal() {
|
|
3388
|
+
const controller = new AbortController();
|
|
3389
|
+
const abort = (err)=>{
|
|
3390
|
+
controller.abort(err);
|
|
3391
|
+
};
|
|
3392
|
+
this.subscribe(abort);
|
|
3393
|
+
controller.signal.unsubscribe = ()=>this.unsubscribe(abort);
|
|
3394
|
+
return controller.signal;
|
|
3395
|
+
}
|
|
3396
|
+
/**
|
|
3905
3397
|
* Returns an object that contains a new `CancelToken` and a function that, when called,
|
|
3906
3398
|
* cancels the `CancelToken`.
|
|
3907
|
-
*/
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
}
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
|
|
3399
|
+
*/ static source() {
|
|
3400
|
+
let cancel;
|
|
3401
|
+
const token = new CancelToken(function executor(c) {
|
|
3402
|
+
cancel = c;
|
|
3403
|
+
});
|
|
3404
|
+
return {
|
|
3405
|
+
token,
|
|
3406
|
+
cancel
|
|
3407
|
+
};
|
|
3408
|
+
}
|
|
3409
|
+
constructor(executor){
|
|
3410
|
+
if (typeof executor !== 'function') {
|
|
3411
|
+
throw new TypeError('executor must be a function.');
|
|
3412
|
+
}
|
|
3413
|
+
let resolvePromise;
|
|
3414
|
+
this.promise = new Promise(function promiseExecutor(resolve) {
|
|
3415
|
+
resolvePromise = resolve;
|
|
3416
|
+
});
|
|
3417
|
+
const token = this;
|
|
3418
|
+
// eslint-disable-next-line func-names
|
|
3419
|
+
this.promise.then((cancel)=>{
|
|
3420
|
+
if (!token._listeners) return;
|
|
3421
|
+
let i = token._listeners.length;
|
|
3422
|
+
while(i-- > 0){
|
|
3423
|
+
token._listeners[i](cancel);
|
|
3424
|
+
}
|
|
3425
|
+
token._listeners = null;
|
|
3426
|
+
});
|
|
3427
|
+
// eslint-disable-next-line func-names
|
|
3428
|
+
this.promise.then = (onfulfilled)=>{
|
|
3429
|
+
let _resolve;
|
|
3430
|
+
// eslint-disable-next-line func-names
|
|
3431
|
+
const promise = new Promise((resolve)=>{
|
|
3432
|
+
token.subscribe(resolve);
|
|
3433
|
+
_resolve = resolve;
|
|
3434
|
+
}).then(onfulfilled);
|
|
3435
|
+
promise.cancel = function reject() {
|
|
3436
|
+
token.unsubscribe(_resolve);
|
|
3437
|
+
};
|
|
3438
|
+
return promise;
|
|
3439
|
+
};
|
|
3440
|
+
executor(function cancel(message, config, request) {
|
|
3441
|
+
if (token.reason) {
|
|
3442
|
+
// Cancellation has already been requested
|
|
3443
|
+
return;
|
|
3444
|
+
}
|
|
3445
|
+
token.reason = new CanceledError$1(message, config, request);
|
|
3446
|
+
resolvePromise(token.reason);
|
|
3447
|
+
});
|
|
3448
|
+
}
|
|
3449
|
+
};
|
|
3920
3450
|
const CancelToken$2 = CancelToken$1;
|
|
3921
3451
|
|
|
3922
3452
|
/**
|
|
@@ -3939,11 +3469,10 @@ const CancelToken$2 = CancelToken$1;
|
|
|
3939
3469
|
* @param {Function} callback
|
|
3940
3470
|
*
|
|
3941
3471
|
* @returns {Function}
|
|
3942
|
-
*/
|
|
3943
|
-
function
|
|
3944
|
-
|
|
3945
|
-
|
|
3946
|
-
};
|
|
3472
|
+
*/ function spread$1(callback) {
|
|
3473
|
+
return function wrap(arr) {
|
|
3474
|
+
return callback.apply(null, arr);
|
|
3475
|
+
};
|
|
3947
3476
|
}
|
|
3948
3477
|
|
|
3949
3478
|
/**
|
|
@@ -3952,9 +3481,8 @@ function spread$1(callback) {
|
|
|
3952
3481
|
* @param {*} payload The value to test
|
|
3953
3482
|
*
|
|
3954
3483
|
* @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
|
|
3955
|
-
*/
|
|
3956
|
-
|
|
3957
|
-
return utils$2.isObject(payload) && (payload.isAxiosError === true);
|
|
3484
|
+
*/ function isAxiosError$1(payload) {
|
|
3485
|
+
return utils$2.isObject(payload) && payload.isAxiosError === true;
|
|
3958
3486
|
}
|
|
3959
3487
|
|
|
3960
3488
|
/**
|
|
@@ -3963,86 +3491,54 @@ function isAxiosError$1(payload) {
|
|
|
3963
3491
|
* @param {Object} defaultConfig The default config for the instance
|
|
3964
3492
|
*
|
|
3965
3493
|
* @returns {Axios} A new instance of Axios
|
|
3966
|
-
*/
|
|
3967
|
-
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
//
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
req.
|
|
3990
|
-
|
|
3991
|
-
|
|
3992
|
-
req.
|
|
3993
|
-
|
|
3994
|
-
req.
|
|
3995
|
-
|
|
3996
|
-
req.
|
|
3997
|
-
|
|
3998
|
-
|
|
3999
|
-
req.
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
req.
|
|
4006
|
-
|
|
4007
|
-
req.
|
|
4008
|
-
|
|
4009
|
-
// Expose isAxiosError
|
|
4010
|
-
req.isAxiosError = isAxiosError$1;
|
|
4011
|
-
|
|
4012
|
-
// Expose mergeConfig
|
|
4013
|
-
req.mergeConfig = mergeConfig$1;
|
|
4014
|
-
|
|
4015
|
-
req.AxiosHeaders = AxiosHeaders$2;
|
|
4016
|
-
|
|
4017
|
-
req.formToJSON = thing => formDataToJSON(utils$2.isHTMLForm(thing) ? new FormData(thing) : thing);
|
|
4018
|
-
|
|
4019
|
-
req.getAdapter = adapters.getAdapter;
|
|
4020
|
-
|
|
4021
|
-
req.default = req;
|
|
4022
|
-
|
|
4023
|
-
// this module should only have a default export
|
|
3494
|
+
*/ function createInstance(defaultConfig) {
|
|
3495
|
+
const context = new Axios$2(defaultConfig);
|
|
3496
|
+
const instance = bind$1(Axios$2.prototype.request, context);
|
|
3497
|
+
// Copy axios.prototype to instance
|
|
3498
|
+
utils$2.extend(instance, Axios$2.prototype, context, {
|
|
3499
|
+
allOwnKeys: true
|
|
3500
|
+
});
|
|
3501
|
+
// Copy context to instance
|
|
3502
|
+
utils$2.extend(instance, context, null, {
|
|
3503
|
+
allOwnKeys: true
|
|
3504
|
+
});
|
|
3505
|
+
// Factory for creating new instances
|
|
3506
|
+
instance.create = function create(instanceConfig) {
|
|
3507
|
+
return createInstance(mergeConfig$1(defaultConfig, instanceConfig));
|
|
3508
|
+
};
|
|
3509
|
+
return instance;
|
|
3510
|
+
}
|
|
3511
|
+
// Create the default instance to be exported
|
|
3512
|
+
const req = createInstance(defaults$1);
|
|
3513
|
+
// Expose Axios class to allow class inheritance
|
|
3514
|
+
req.Axios = Axios$2;
|
|
3515
|
+
// Expose Cancel & CancelToken
|
|
3516
|
+
req.CanceledError = CanceledError$1;
|
|
3517
|
+
req.CancelToken = CancelToken$2;
|
|
3518
|
+
req.isCancel = isCancel$1;
|
|
3519
|
+
req.VERSION = VERSION$1;
|
|
3520
|
+
req.toFormData = toFormData$2;
|
|
3521
|
+
// Expose AxiosError class
|
|
3522
|
+
req.AxiosError = AxiosError$2;
|
|
3523
|
+
// alias for CanceledError for backward compatibility
|
|
3524
|
+
req.Cancel = req.CanceledError;
|
|
3525
|
+
// Expose all/spread
|
|
3526
|
+
req.all = (promises)=>Promise.all(promises);
|
|
3527
|
+
req.spread = spread$1;
|
|
3528
|
+
// Expose isAxiosError
|
|
3529
|
+
req.isAxiosError = isAxiosError$1;
|
|
3530
|
+
// Expose mergeConfig
|
|
3531
|
+
req.mergeConfig = mergeConfig$1;
|
|
3532
|
+
req.AxiosHeaders = AxiosHeaders$2;
|
|
3533
|
+
req.formToJSON = (thing)=>formDataToJSON(utils$2.isHTMLForm(thing) ? new FormData(thing) : thing);
|
|
3534
|
+
req.getAdapter = adapters.getAdapter;
|
|
3535
|
+
req.default = req;
|
|
3536
|
+
// this module should only have a default export
|
|
4024
3537
|
const req$1 = req;
|
|
4025
3538
|
|
|
4026
|
-
// This module is intended to unwrap Axios default export as named.
|
|
4027
|
-
// Keep top-level export same with static properties
|
|
4028
|
-
// so that it can keep same with es module or cjs
|
|
4029
|
-
const {
|
|
4030
|
-
Axios,
|
|
4031
|
-
AxiosError,
|
|
4032
|
-
CanceledError,
|
|
4033
|
-
isCancel,
|
|
4034
|
-
CancelToken,
|
|
4035
|
-
VERSION,
|
|
4036
|
-
all,
|
|
4037
|
-
Cancel,
|
|
4038
|
-
isAxiosError,
|
|
4039
|
-
spread,
|
|
4040
|
-
toFormData,
|
|
4041
|
-
AxiosHeaders,
|
|
4042
|
-
HttpStatusCode,
|
|
4043
|
-
formToJSON,
|
|
4044
|
-
getAdapter,
|
|
4045
|
-
mergeConfig,
|
|
4046
|
-
} = req$1;
|
|
3539
|
+
// This module is intended to unwrap Axios default export as named.
|
|
3540
|
+
// Keep top-level export same with static properties
|
|
3541
|
+
// so that it can keep same with es module or cjs
|
|
3542
|
+
const { Axios, AxiosError, CanceledError, isCancel, CancelToken, VERSION, all, Cancel, isAxiosError, spread, toFormData, AxiosHeaders, HttpStatusCode, formToJSON, getAdapter, mergeConfig } = req$1;
|
|
4047
3543
|
|
|
4048
3544
|
export { Axios, AxiosError, AxiosHeaders, Cancel, CancelToken, CanceledError, HttpStatusCode, VERSION, all, req$1 as default, formToJSON, getAdapter, isAxiosError, isCancel, mergeConfig, spread, toFormData };
|