@imtbl/sdk 0.4.2 → 0.4.4-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/blockchain_data.d.ts +1971 -0
- package/dist/blockchain_data.js +2528 -0
- package/dist/browser/checkout.js +2 -0
- package/dist/checkout_sdk.d.ts +1188 -0
- package/dist/checkout_sdk.js +16511 -0
- package/dist/checkout_widgets.d.ts +15382 -0
- package/dist/checkout_widgets.js +276 -0
- package/dist/erc20.d.ts +296 -0
- package/dist/erc20.js +371 -0
- package/dist/erc721_permissioned_mintable.d.ts +486 -0
- package/dist/erc721_permissioned_mintable.js +1364 -0
- package/dist/immutablex_client.js +1 -1
- package/dist/index.browser.js +61 -8
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +29273 -10680
- package/dist/index.d.ts +25293 -6786
- package/dist/index.js +29311 -10713
- package/dist/orderbook.d.ts +252 -0
- package/dist/orderbook.js +1983 -0
- package/dist/passport.d.ts +2 -1
- package/dist/passport.js +106 -3243
- package/package.json +25 -1
package/dist/passport.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import globalAxios$1 from 'axios';
|
|
1
2
|
import { ImmutableX, Config, generateLegacyStarkPrivateKey, createStarkSigner } from '@imtbl/core-sdk';
|
|
2
3
|
import { UserManager } from 'oidc-client-ts';
|
|
3
|
-
import axios$2 from 'axios';
|
|
4
4
|
import jwt_decode from 'jwt-decode';
|
|
5
5
|
import * as crypto from 'crypto';
|
|
6
6
|
import { Magic } from 'magic-sdk';
|
|
@@ -13,3214 +13,6 @@ import { EventEmitter } from 'events';
|
|
|
13
13
|
import { walletContracts } from '@0xsequence/abi';
|
|
14
14
|
import { encodeSignature } from '@0xsequence/config';
|
|
15
15
|
|
|
16
|
-
function bind$1(fn, thisArg) {
|
|
17
|
-
return function wrap() {
|
|
18
|
-
return fn.apply(thisArg, arguments);
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// utils is a library of generic helper functions non-specific to axios
|
|
23
|
-
|
|
24
|
-
const {toString: toString$1} = Object.prototype;
|
|
25
|
-
const {getPrototypeOf: getPrototypeOf$1} = Object;
|
|
26
|
-
|
|
27
|
-
const kindOf$1 = (cache => thing => {
|
|
28
|
-
const str = toString$1.call(thing);
|
|
29
|
-
return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
|
|
30
|
-
})(Object.create(null));
|
|
31
|
-
|
|
32
|
-
const kindOfTest$1 = (type) => {
|
|
33
|
-
type = type.toLowerCase();
|
|
34
|
-
return (thing) => kindOf$1(thing) === type
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
const typeOfTest$1 = type => thing => typeof thing === type;
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Determine if a value is an Array
|
|
41
|
-
*
|
|
42
|
-
* @param {Object} val The value to test
|
|
43
|
-
*
|
|
44
|
-
* @returns {boolean} True if value is an Array, otherwise false
|
|
45
|
-
*/
|
|
46
|
-
const {isArray: isArray$1} = Array;
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Determine if a value is undefined
|
|
50
|
-
*
|
|
51
|
-
* @param {*} val The value to test
|
|
52
|
-
*
|
|
53
|
-
* @returns {boolean} True if the value is undefined, otherwise false
|
|
54
|
-
*/
|
|
55
|
-
const isUndefined$1 = typeOfTest$1('undefined');
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Determine if a value is a Buffer
|
|
59
|
-
*
|
|
60
|
-
* @param {*} val The value to test
|
|
61
|
-
*
|
|
62
|
-
* @returns {boolean} True if value is a Buffer, otherwise false
|
|
63
|
-
*/
|
|
64
|
-
function isBuffer$1(val) {
|
|
65
|
-
return val !== null && !isUndefined$1(val) && val.constructor !== null && !isUndefined$1(val.constructor)
|
|
66
|
-
&& isFunction$1(val.constructor.isBuffer) && val.constructor.isBuffer(val);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Determine if a value is an ArrayBuffer
|
|
71
|
-
*
|
|
72
|
-
* @param {*} val The value to test
|
|
73
|
-
*
|
|
74
|
-
* @returns {boolean} True if value is an ArrayBuffer, otherwise false
|
|
75
|
-
*/
|
|
76
|
-
const isArrayBuffer$1 = kindOfTest$1('ArrayBuffer');
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Determine if a value is a view on an ArrayBuffer
|
|
81
|
-
*
|
|
82
|
-
* @param {*} val The value to test
|
|
83
|
-
*
|
|
84
|
-
* @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
|
|
85
|
-
*/
|
|
86
|
-
function isArrayBufferView$1(val) {
|
|
87
|
-
let result;
|
|
88
|
-
if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
|
|
89
|
-
result = ArrayBuffer.isView(val);
|
|
90
|
-
} else {
|
|
91
|
-
result = (val) && (val.buffer) && (isArrayBuffer$1(val.buffer));
|
|
92
|
-
}
|
|
93
|
-
return result;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Determine if a value is a String
|
|
98
|
-
*
|
|
99
|
-
* @param {*} val The value to test
|
|
100
|
-
*
|
|
101
|
-
* @returns {boolean} True if value is a String, otherwise false
|
|
102
|
-
*/
|
|
103
|
-
const isString$1 = typeOfTest$1('string');
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Determine if a value is a Function
|
|
107
|
-
*
|
|
108
|
-
* @param {*} val The value to test
|
|
109
|
-
* @returns {boolean} True if value is a Function, otherwise false
|
|
110
|
-
*/
|
|
111
|
-
const isFunction$1 = typeOfTest$1('function');
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* Determine if a value is a Number
|
|
115
|
-
*
|
|
116
|
-
* @param {*} val The value to test
|
|
117
|
-
*
|
|
118
|
-
* @returns {boolean} True if value is a Number, otherwise false
|
|
119
|
-
*/
|
|
120
|
-
const isNumber$1 = typeOfTest$1('number');
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* Determine if a value is an Object
|
|
124
|
-
*
|
|
125
|
-
* @param {*} thing The value to test
|
|
126
|
-
*
|
|
127
|
-
* @returns {boolean} True if value is an Object, otherwise false
|
|
128
|
-
*/
|
|
129
|
-
const isObject$1 = (thing) => thing !== null && typeof thing === 'object';
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Determine if a value is a Boolean
|
|
133
|
-
*
|
|
134
|
-
* @param {*} thing The value to test
|
|
135
|
-
* @returns {boolean} True if value is a Boolean, otherwise false
|
|
136
|
-
*/
|
|
137
|
-
const isBoolean$1 = thing => thing === true || thing === false;
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* Determine if a value is a plain Object
|
|
141
|
-
*
|
|
142
|
-
* @param {*} val The value to test
|
|
143
|
-
*
|
|
144
|
-
* @returns {boolean} True if value is a plain Object, otherwise false
|
|
145
|
-
*/
|
|
146
|
-
const isPlainObject$1 = (val) => {
|
|
147
|
-
if (kindOf$1(val) !== 'object') {
|
|
148
|
-
return false;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
const prototype = getPrototypeOf$1(val);
|
|
152
|
-
return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val);
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* Determine if a value is a Date
|
|
157
|
-
*
|
|
158
|
-
* @param {*} val The value to test
|
|
159
|
-
*
|
|
160
|
-
* @returns {boolean} True if value is a Date, otherwise false
|
|
161
|
-
*/
|
|
162
|
-
const isDate$1 = kindOfTest$1('Date');
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* Determine if a value is a File
|
|
166
|
-
*
|
|
167
|
-
* @param {*} val The value to test
|
|
168
|
-
*
|
|
169
|
-
* @returns {boolean} True if value is a File, otherwise false
|
|
170
|
-
*/
|
|
171
|
-
const isFile$1 = kindOfTest$1('File');
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* Determine if a value is a Blob
|
|
175
|
-
*
|
|
176
|
-
* @param {*} val The value to test
|
|
177
|
-
*
|
|
178
|
-
* @returns {boolean} True if value is a Blob, otherwise false
|
|
179
|
-
*/
|
|
180
|
-
const isBlob$1 = kindOfTest$1('Blob');
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* Determine if a value is a FileList
|
|
184
|
-
*
|
|
185
|
-
* @param {*} val The value to test
|
|
186
|
-
*
|
|
187
|
-
* @returns {boolean} True if value is a File, otherwise false
|
|
188
|
-
*/
|
|
189
|
-
const isFileList$1 = kindOfTest$1('FileList');
|
|
190
|
-
|
|
191
|
-
/**
|
|
192
|
-
* Determine if a value is a Stream
|
|
193
|
-
*
|
|
194
|
-
* @param {*} val The value to test
|
|
195
|
-
*
|
|
196
|
-
* @returns {boolean} True if value is a Stream, otherwise false
|
|
197
|
-
*/
|
|
198
|
-
const isStream$1 = (val) => isObject$1(val) && isFunction$1(val.pipe);
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
* Determine if a value is a FormData
|
|
202
|
-
*
|
|
203
|
-
* @param {*} thing The value to test
|
|
204
|
-
*
|
|
205
|
-
* @returns {boolean} True if value is an FormData, otherwise false
|
|
206
|
-
*/
|
|
207
|
-
const isFormData$1 = (thing) => {
|
|
208
|
-
let kind;
|
|
209
|
-
return thing && (
|
|
210
|
-
(typeof FormData === 'function' && thing instanceof FormData) || (
|
|
211
|
-
isFunction$1(thing.append) && (
|
|
212
|
-
(kind = kindOf$1(thing)) === 'formdata' ||
|
|
213
|
-
// detect form-data instance
|
|
214
|
-
(kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]')
|
|
215
|
-
)
|
|
216
|
-
)
|
|
217
|
-
)
|
|
218
|
-
};
|
|
219
|
-
|
|
220
|
-
/**
|
|
221
|
-
* Determine if a value is a URLSearchParams object
|
|
222
|
-
*
|
|
223
|
-
* @param {*} val The value to test
|
|
224
|
-
*
|
|
225
|
-
* @returns {boolean} True if value is a URLSearchParams object, otherwise false
|
|
226
|
-
*/
|
|
227
|
-
const isURLSearchParams$1 = kindOfTest$1('URLSearchParams');
|
|
228
|
-
|
|
229
|
-
/**
|
|
230
|
-
* Trim excess whitespace off the beginning and end of a string
|
|
231
|
-
*
|
|
232
|
-
* @param {String} str The String to trim
|
|
233
|
-
*
|
|
234
|
-
* @returns {String} The String freed of excess whitespace
|
|
235
|
-
*/
|
|
236
|
-
const trim$1 = (str) => str.trim ?
|
|
237
|
-
str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
|
|
238
|
-
|
|
239
|
-
/**
|
|
240
|
-
* Iterate over an Array or an Object invoking a function for each item.
|
|
241
|
-
*
|
|
242
|
-
* If `obj` is an Array callback will be called passing
|
|
243
|
-
* the value, index, and complete array for each item.
|
|
244
|
-
*
|
|
245
|
-
* If 'obj' is an Object callback will be called passing
|
|
246
|
-
* the value, key, and complete object for each property.
|
|
247
|
-
*
|
|
248
|
-
* @param {Object|Array} obj The object to iterate
|
|
249
|
-
* @param {Function} fn The callback to invoke for each item
|
|
250
|
-
*
|
|
251
|
-
* @param {Boolean} [allOwnKeys = false]
|
|
252
|
-
* @returns {any}
|
|
253
|
-
*/
|
|
254
|
-
function forEach$1(obj, fn, {allOwnKeys = false} = {}) {
|
|
255
|
-
// Don't bother if no value provided
|
|
256
|
-
if (obj === null || typeof obj === 'undefined') {
|
|
257
|
-
return;
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
let i;
|
|
261
|
-
let l;
|
|
262
|
-
|
|
263
|
-
// Force an array if not already something iterable
|
|
264
|
-
if (typeof obj !== 'object') {
|
|
265
|
-
/*eslint no-param-reassign:0*/
|
|
266
|
-
obj = [obj];
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
if (isArray$1(obj)) {
|
|
270
|
-
// Iterate over array values
|
|
271
|
-
for (i = 0, l = obj.length; i < l; i++) {
|
|
272
|
-
fn.call(null, obj[i], i, obj);
|
|
273
|
-
}
|
|
274
|
-
} else {
|
|
275
|
-
// Iterate over object keys
|
|
276
|
-
const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
|
|
277
|
-
const len = keys.length;
|
|
278
|
-
let key;
|
|
279
|
-
|
|
280
|
-
for (i = 0; i < len; i++) {
|
|
281
|
-
key = keys[i];
|
|
282
|
-
fn.call(null, obj[key], key, obj);
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
function findKey$1(obj, key) {
|
|
288
|
-
key = key.toLowerCase();
|
|
289
|
-
const keys = Object.keys(obj);
|
|
290
|
-
let i = keys.length;
|
|
291
|
-
let _key;
|
|
292
|
-
while (i-- > 0) {
|
|
293
|
-
_key = keys[i];
|
|
294
|
-
if (key === _key.toLowerCase()) {
|
|
295
|
-
return _key;
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
return null;
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
const _global$1 = (() => {
|
|
302
|
-
/*eslint no-undef:0*/
|
|
303
|
-
if (typeof globalThis !== "undefined") return globalThis;
|
|
304
|
-
return typeof self !== "undefined" ? self : (typeof window !== 'undefined' ? window : global)
|
|
305
|
-
})();
|
|
306
|
-
|
|
307
|
-
const isContextDefined$1 = (context) => !isUndefined$1(context) && context !== _global$1;
|
|
308
|
-
|
|
309
|
-
/**
|
|
310
|
-
* Accepts varargs expecting each argument to be an object, then
|
|
311
|
-
* immutably merges the properties of each object and returns result.
|
|
312
|
-
*
|
|
313
|
-
* When multiple objects contain the same key the later object in
|
|
314
|
-
* the arguments list will take precedence.
|
|
315
|
-
*
|
|
316
|
-
* Example:
|
|
317
|
-
*
|
|
318
|
-
* ```js
|
|
319
|
-
* var result = merge({foo: 123}, {foo: 456});
|
|
320
|
-
* console.log(result.foo); // outputs 456
|
|
321
|
-
* ```
|
|
322
|
-
*
|
|
323
|
-
* @param {Object} obj1 Object to merge
|
|
324
|
-
*
|
|
325
|
-
* @returns {Object} Result of all merge properties
|
|
326
|
-
*/
|
|
327
|
-
function merge$1(/* obj1, obj2, obj3, ... */) {
|
|
328
|
-
const {caseless} = isContextDefined$1(this) && this || {};
|
|
329
|
-
const result = {};
|
|
330
|
-
const assignValue = (val, key) => {
|
|
331
|
-
const targetKey = caseless && findKey$1(result, key) || key;
|
|
332
|
-
if (isPlainObject$1(result[targetKey]) && isPlainObject$1(val)) {
|
|
333
|
-
result[targetKey] = merge$1(result[targetKey], val);
|
|
334
|
-
} else if (isPlainObject$1(val)) {
|
|
335
|
-
result[targetKey] = merge$1({}, val);
|
|
336
|
-
} else if (isArray$1(val)) {
|
|
337
|
-
result[targetKey] = val.slice();
|
|
338
|
-
} else {
|
|
339
|
-
result[targetKey] = val;
|
|
340
|
-
}
|
|
341
|
-
};
|
|
342
|
-
|
|
343
|
-
for (let i = 0, l = arguments.length; i < l; i++) {
|
|
344
|
-
arguments[i] && forEach$1(arguments[i], assignValue);
|
|
345
|
-
}
|
|
346
|
-
return result;
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
/**
|
|
350
|
-
* Extends object a by mutably adding to it the properties of object b.
|
|
351
|
-
*
|
|
352
|
-
* @param {Object} a The object to be extended
|
|
353
|
-
* @param {Object} b The object to copy properties from
|
|
354
|
-
* @param {Object} thisArg The object to bind function to
|
|
355
|
-
*
|
|
356
|
-
* @param {Boolean} [allOwnKeys]
|
|
357
|
-
* @returns {Object} The resulting value of object a
|
|
358
|
-
*/
|
|
359
|
-
const extend$1 = (a, b, thisArg, {allOwnKeys}= {}) => {
|
|
360
|
-
forEach$1(b, (val, key) => {
|
|
361
|
-
if (thisArg && isFunction$1(val)) {
|
|
362
|
-
a[key] = bind$1(val, thisArg);
|
|
363
|
-
} else {
|
|
364
|
-
a[key] = val;
|
|
365
|
-
}
|
|
366
|
-
}, {allOwnKeys});
|
|
367
|
-
return a;
|
|
368
|
-
};
|
|
369
|
-
|
|
370
|
-
/**
|
|
371
|
-
* Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
|
|
372
|
-
*
|
|
373
|
-
* @param {string} content with BOM
|
|
374
|
-
*
|
|
375
|
-
* @returns {string} content value without BOM
|
|
376
|
-
*/
|
|
377
|
-
const stripBOM$1 = (content) => {
|
|
378
|
-
if (content.charCodeAt(0) === 0xFEFF) {
|
|
379
|
-
content = content.slice(1);
|
|
380
|
-
}
|
|
381
|
-
return content;
|
|
382
|
-
};
|
|
383
|
-
|
|
384
|
-
/**
|
|
385
|
-
* Inherit the prototype methods from one constructor into another
|
|
386
|
-
* @param {function} constructor
|
|
387
|
-
* @param {function} superConstructor
|
|
388
|
-
* @param {object} [props]
|
|
389
|
-
* @param {object} [descriptors]
|
|
390
|
-
*
|
|
391
|
-
* @returns {void}
|
|
392
|
-
*/
|
|
393
|
-
const inherits$1 = (constructor, superConstructor, props, descriptors) => {
|
|
394
|
-
constructor.prototype = Object.create(superConstructor.prototype, descriptors);
|
|
395
|
-
constructor.prototype.constructor = constructor;
|
|
396
|
-
Object.defineProperty(constructor, 'super', {
|
|
397
|
-
value: superConstructor.prototype
|
|
398
|
-
});
|
|
399
|
-
props && Object.assign(constructor.prototype, props);
|
|
400
|
-
};
|
|
401
|
-
|
|
402
|
-
/**
|
|
403
|
-
* Resolve object with deep prototype chain to a flat object
|
|
404
|
-
* @param {Object} sourceObj source object
|
|
405
|
-
* @param {Object} [destObj]
|
|
406
|
-
* @param {Function|Boolean} [filter]
|
|
407
|
-
* @param {Function} [propFilter]
|
|
408
|
-
*
|
|
409
|
-
* @returns {Object}
|
|
410
|
-
*/
|
|
411
|
-
const toFlatObject$1 = (sourceObj, destObj, filter, propFilter) => {
|
|
412
|
-
let props;
|
|
413
|
-
let i;
|
|
414
|
-
let prop;
|
|
415
|
-
const merged = {};
|
|
416
|
-
|
|
417
|
-
destObj = destObj || {};
|
|
418
|
-
// eslint-disable-next-line no-eq-null,eqeqeq
|
|
419
|
-
if (sourceObj == null) return destObj;
|
|
420
|
-
|
|
421
|
-
do {
|
|
422
|
-
props = Object.getOwnPropertyNames(sourceObj);
|
|
423
|
-
i = props.length;
|
|
424
|
-
while (i-- > 0) {
|
|
425
|
-
prop = props[i];
|
|
426
|
-
if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
|
|
427
|
-
destObj[prop] = sourceObj[prop];
|
|
428
|
-
merged[prop] = true;
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
sourceObj = filter !== false && getPrototypeOf$1(sourceObj);
|
|
432
|
-
} while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);
|
|
433
|
-
|
|
434
|
-
return destObj;
|
|
435
|
-
};
|
|
436
|
-
|
|
437
|
-
/**
|
|
438
|
-
* Determines whether a string ends with the characters of a specified string
|
|
439
|
-
*
|
|
440
|
-
* @param {String} str
|
|
441
|
-
* @param {String} searchString
|
|
442
|
-
* @param {Number} [position= 0]
|
|
443
|
-
*
|
|
444
|
-
* @returns {boolean}
|
|
445
|
-
*/
|
|
446
|
-
const endsWith$1 = (str, searchString, position) => {
|
|
447
|
-
str = String(str);
|
|
448
|
-
if (position === undefined || position > str.length) {
|
|
449
|
-
position = str.length;
|
|
450
|
-
}
|
|
451
|
-
position -= searchString.length;
|
|
452
|
-
const lastIndex = str.indexOf(searchString, position);
|
|
453
|
-
return lastIndex !== -1 && lastIndex === position;
|
|
454
|
-
};
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
/**
|
|
458
|
-
* Returns new array from array like object or null if failed
|
|
459
|
-
*
|
|
460
|
-
* @param {*} [thing]
|
|
461
|
-
*
|
|
462
|
-
* @returns {?Array}
|
|
463
|
-
*/
|
|
464
|
-
const toArray$1 = (thing) => {
|
|
465
|
-
if (!thing) return null;
|
|
466
|
-
if (isArray$1(thing)) return thing;
|
|
467
|
-
let i = thing.length;
|
|
468
|
-
if (!isNumber$1(i)) return null;
|
|
469
|
-
const arr = new Array(i);
|
|
470
|
-
while (i-- > 0) {
|
|
471
|
-
arr[i] = thing[i];
|
|
472
|
-
}
|
|
473
|
-
return arr;
|
|
474
|
-
};
|
|
475
|
-
|
|
476
|
-
/**
|
|
477
|
-
* Checking if the Uint8Array exists and if it does, it returns a function that checks if the
|
|
478
|
-
* thing passed in is an instance of Uint8Array
|
|
479
|
-
*
|
|
480
|
-
* @param {TypedArray}
|
|
481
|
-
*
|
|
482
|
-
* @returns {Array}
|
|
483
|
-
*/
|
|
484
|
-
// eslint-disable-next-line func-names
|
|
485
|
-
const isTypedArray$1 = (TypedArray => {
|
|
486
|
-
// eslint-disable-next-line func-names
|
|
487
|
-
return thing => {
|
|
488
|
-
return TypedArray && thing instanceof TypedArray;
|
|
489
|
-
};
|
|
490
|
-
})(typeof Uint8Array !== 'undefined' && getPrototypeOf$1(Uint8Array));
|
|
491
|
-
|
|
492
|
-
/**
|
|
493
|
-
* For each entry in the object, call the function with the key and value.
|
|
494
|
-
*
|
|
495
|
-
* @param {Object<any, any>} obj - The object to iterate over.
|
|
496
|
-
* @param {Function} fn - The function to call for each entry.
|
|
497
|
-
*
|
|
498
|
-
* @returns {void}
|
|
499
|
-
*/
|
|
500
|
-
const forEachEntry$1 = (obj, fn) => {
|
|
501
|
-
const generator = obj && obj[Symbol.iterator];
|
|
502
|
-
|
|
503
|
-
const iterator = generator.call(obj);
|
|
504
|
-
|
|
505
|
-
let result;
|
|
506
|
-
|
|
507
|
-
while ((result = iterator.next()) && !result.done) {
|
|
508
|
-
const pair = result.value;
|
|
509
|
-
fn.call(obj, pair[0], pair[1]);
|
|
510
|
-
}
|
|
511
|
-
};
|
|
512
|
-
|
|
513
|
-
/**
|
|
514
|
-
* It takes a regular expression and a string, and returns an array of all the matches
|
|
515
|
-
*
|
|
516
|
-
* @param {string} regExp - The regular expression to match against.
|
|
517
|
-
* @param {string} str - The string to search.
|
|
518
|
-
*
|
|
519
|
-
* @returns {Array<boolean>}
|
|
520
|
-
*/
|
|
521
|
-
const matchAll$1 = (regExp, str) => {
|
|
522
|
-
let matches;
|
|
523
|
-
const arr = [];
|
|
524
|
-
|
|
525
|
-
while ((matches = regExp.exec(str)) !== null) {
|
|
526
|
-
arr.push(matches);
|
|
527
|
-
}
|
|
528
|
-
|
|
529
|
-
return arr;
|
|
530
|
-
};
|
|
531
|
-
|
|
532
|
-
/* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */
|
|
533
|
-
const isHTMLForm$1 = kindOfTest$1('HTMLFormElement');
|
|
534
|
-
|
|
535
|
-
const toCamelCase$1 = str => {
|
|
536
|
-
return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,
|
|
537
|
-
function replacer(m, p1, p2) {
|
|
538
|
-
return p1.toUpperCase() + p2;
|
|
539
|
-
}
|
|
540
|
-
);
|
|
541
|
-
};
|
|
542
|
-
|
|
543
|
-
/* Creating a function that will check if an object has a property. */
|
|
544
|
-
const hasOwnProperty$1 = (({hasOwnProperty}) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype);
|
|
545
|
-
|
|
546
|
-
/**
|
|
547
|
-
* Determine if a value is a RegExp object
|
|
548
|
-
*
|
|
549
|
-
* @param {*} val The value to test
|
|
550
|
-
*
|
|
551
|
-
* @returns {boolean} True if value is a RegExp object, otherwise false
|
|
552
|
-
*/
|
|
553
|
-
const isRegExp$1 = kindOfTest$1('RegExp');
|
|
554
|
-
|
|
555
|
-
const reduceDescriptors$1 = (obj, reducer) => {
|
|
556
|
-
const descriptors = Object.getOwnPropertyDescriptors(obj);
|
|
557
|
-
const reducedDescriptors = {};
|
|
558
|
-
|
|
559
|
-
forEach$1(descriptors, (descriptor, name) => {
|
|
560
|
-
if (reducer(descriptor, name, obj) !== false) {
|
|
561
|
-
reducedDescriptors[name] = descriptor;
|
|
562
|
-
}
|
|
563
|
-
});
|
|
564
|
-
|
|
565
|
-
Object.defineProperties(obj, reducedDescriptors);
|
|
566
|
-
};
|
|
567
|
-
|
|
568
|
-
/**
|
|
569
|
-
* Makes all methods read-only
|
|
570
|
-
* @param {Object} obj
|
|
571
|
-
*/
|
|
572
|
-
|
|
573
|
-
const freezeMethods$1 = (obj) => {
|
|
574
|
-
reduceDescriptors$1(obj, (descriptor, name) => {
|
|
575
|
-
// skip restricted props in strict mode
|
|
576
|
-
if (isFunction$1(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
|
|
577
|
-
return false;
|
|
578
|
-
}
|
|
579
|
-
|
|
580
|
-
const value = obj[name];
|
|
581
|
-
|
|
582
|
-
if (!isFunction$1(value)) return;
|
|
583
|
-
|
|
584
|
-
descriptor.enumerable = false;
|
|
585
|
-
|
|
586
|
-
if ('writable' in descriptor) {
|
|
587
|
-
descriptor.writable = false;
|
|
588
|
-
return;
|
|
589
|
-
}
|
|
590
|
-
|
|
591
|
-
if (!descriptor.set) {
|
|
592
|
-
descriptor.set = () => {
|
|
593
|
-
throw Error('Can not rewrite read-only method \'' + name + '\'');
|
|
594
|
-
};
|
|
595
|
-
}
|
|
596
|
-
});
|
|
597
|
-
};
|
|
598
|
-
|
|
599
|
-
const toObjectSet$1 = (arrayOrString, delimiter) => {
|
|
600
|
-
const obj = {};
|
|
601
|
-
|
|
602
|
-
const define = (arr) => {
|
|
603
|
-
arr.forEach(value => {
|
|
604
|
-
obj[value] = true;
|
|
605
|
-
});
|
|
606
|
-
};
|
|
607
|
-
|
|
608
|
-
isArray$1(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
|
|
609
|
-
|
|
610
|
-
return obj;
|
|
611
|
-
};
|
|
612
|
-
|
|
613
|
-
const noop$1 = () => {};
|
|
614
|
-
|
|
615
|
-
const toFiniteNumber$1 = (value, defaultValue) => {
|
|
616
|
-
value = +value;
|
|
617
|
-
return Number.isFinite(value) ? value : defaultValue;
|
|
618
|
-
};
|
|
619
|
-
|
|
620
|
-
const ALPHA$1 = 'abcdefghijklmnopqrstuvwxyz';
|
|
621
|
-
|
|
622
|
-
const DIGIT$1 = '0123456789';
|
|
623
|
-
|
|
624
|
-
const ALPHABET$1 = {
|
|
625
|
-
DIGIT: DIGIT$1,
|
|
626
|
-
ALPHA: ALPHA$1,
|
|
627
|
-
ALPHA_DIGIT: ALPHA$1 + ALPHA$1.toUpperCase() + DIGIT$1
|
|
628
|
-
};
|
|
629
|
-
|
|
630
|
-
const generateString$1 = (size = 16, alphabet = ALPHABET$1.ALPHA_DIGIT) => {
|
|
631
|
-
let str = '';
|
|
632
|
-
const {length} = alphabet;
|
|
633
|
-
while (size--) {
|
|
634
|
-
str += alphabet[Math.random() * length|0];
|
|
635
|
-
}
|
|
636
|
-
|
|
637
|
-
return str;
|
|
638
|
-
};
|
|
639
|
-
|
|
640
|
-
/**
|
|
641
|
-
* If the thing is a FormData object, return true, otherwise return false.
|
|
642
|
-
*
|
|
643
|
-
* @param {unknown} thing - The thing to check.
|
|
644
|
-
*
|
|
645
|
-
* @returns {boolean}
|
|
646
|
-
*/
|
|
647
|
-
function isSpecCompliantForm$1(thing) {
|
|
648
|
-
return !!(thing && isFunction$1(thing.append) && thing[Symbol.toStringTag] === 'FormData' && thing[Symbol.iterator]);
|
|
649
|
-
}
|
|
650
|
-
|
|
651
|
-
const toJSONObject$1 = (obj) => {
|
|
652
|
-
const stack = new Array(10);
|
|
653
|
-
|
|
654
|
-
const visit = (source, i) => {
|
|
655
|
-
|
|
656
|
-
if (isObject$1(source)) {
|
|
657
|
-
if (stack.indexOf(source) >= 0) {
|
|
658
|
-
return;
|
|
659
|
-
}
|
|
660
|
-
|
|
661
|
-
if(!('toJSON' in source)) {
|
|
662
|
-
stack[i] = source;
|
|
663
|
-
const target = isArray$1(source) ? [] : {};
|
|
664
|
-
|
|
665
|
-
forEach$1(source, (value, key) => {
|
|
666
|
-
const reducedValue = visit(value, i + 1);
|
|
667
|
-
!isUndefined$1(reducedValue) && (target[key] = reducedValue);
|
|
668
|
-
});
|
|
669
|
-
|
|
670
|
-
stack[i] = undefined;
|
|
671
|
-
|
|
672
|
-
return target;
|
|
673
|
-
}
|
|
674
|
-
}
|
|
675
|
-
|
|
676
|
-
return source;
|
|
677
|
-
};
|
|
678
|
-
|
|
679
|
-
return visit(obj, 0);
|
|
680
|
-
};
|
|
681
|
-
|
|
682
|
-
const isAsyncFn$1 = kindOfTest$1('AsyncFunction');
|
|
683
|
-
|
|
684
|
-
const isThenable$1 = (thing) =>
|
|
685
|
-
thing && (isObject$1(thing) || isFunction$1(thing)) && isFunction$1(thing.then) && isFunction$1(thing.catch);
|
|
686
|
-
|
|
687
|
-
var utils$1 = {
|
|
688
|
-
isArray: isArray$1,
|
|
689
|
-
isArrayBuffer: isArrayBuffer$1,
|
|
690
|
-
isBuffer: isBuffer$1,
|
|
691
|
-
isFormData: isFormData$1,
|
|
692
|
-
isArrayBufferView: isArrayBufferView$1,
|
|
693
|
-
isString: isString$1,
|
|
694
|
-
isNumber: isNumber$1,
|
|
695
|
-
isBoolean: isBoolean$1,
|
|
696
|
-
isObject: isObject$1,
|
|
697
|
-
isPlainObject: isPlainObject$1,
|
|
698
|
-
isUndefined: isUndefined$1,
|
|
699
|
-
isDate: isDate$1,
|
|
700
|
-
isFile: isFile$1,
|
|
701
|
-
isBlob: isBlob$1,
|
|
702
|
-
isRegExp: isRegExp$1,
|
|
703
|
-
isFunction: isFunction$1,
|
|
704
|
-
isStream: isStream$1,
|
|
705
|
-
isURLSearchParams: isURLSearchParams$1,
|
|
706
|
-
isTypedArray: isTypedArray$1,
|
|
707
|
-
isFileList: isFileList$1,
|
|
708
|
-
forEach: forEach$1,
|
|
709
|
-
merge: merge$1,
|
|
710
|
-
extend: extend$1,
|
|
711
|
-
trim: trim$1,
|
|
712
|
-
stripBOM: stripBOM$1,
|
|
713
|
-
inherits: inherits$1,
|
|
714
|
-
toFlatObject: toFlatObject$1,
|
|
715
|
-
kindOf: kindOf$1,
|
|
716
|
-
kindOfTest: kindOfTest$1,
|
|
717
|
-
endsWith: endsWith$1,
|
|
718
|
-
toArray: toArray$1,
|
|
719
|
-
forEachEntry: forEachEntry$1,
|
|
720
|
-
matchAll: matchAll$1,
|
|
721
|
-
isHTMLForm: isHTMLForm$1,
|
|
722
|
-
hasOwnProperty: hasOwnProperty$1,
|
|
723
|
-
hasOwnProp: hasOwnProperty$1, // an alias to avoid ESLint no-prototype-builtins detection
|
|
724
|
-
reduceDescriptors: reduceDescriptors$1,
|
|
725
|
-
freezeMethods: freezeMethods$1,
|
|
726
|
-
toObjectSet: toObjectSet$1,
|
|
727
|
-
toCamelCase: toCamelCase$1,
|
|
728
|
-
noop: noop$1,
|
|
729
|
-
toFiniteNumber: toFiniteNumber$1,
|
|
730
|
-
findKey: findKey$1,
|
|
731
|
-
global: _global$1,
|
|
732
|
-
isContextDefined: isContextDefined$1,
|
|
733
|
-
ALPHABET: ALPHABET$1,
|
|
734
|
-
generateString: generateString$1,
|
|
735
|
-
isSpecCompliantForm: isSpecCompliantForm$1,
|
|
736
|
-
toJSONObject: toJSONObject$1,
|
|
737
|
-
isAsyncFn: isAsyncFn$1,
|
|
738
|
-
isThenable: isThenable$1
|
|
739
|
-
};
|
|
740
|
-
|
|
741
|
-
/**
|
|
742
|
-
* Create an Error with the specified message, config, error code, request and response.
|
|
743
|
-
*
|
|
744
|
-
* @param {string} message The error message.
|
|
745
|
-
* @param {string} [code] The error code (for example, 'ECONNABORTED').
|
|
746
|
-
* @param {Object} [config] The config.
|
|
747
|
-
* @param {Object} [request] The request.
|
|
748
|
-
* @param {Object} [response] The response.
|
|
749
|
-
*
|
|
750
|
-
* @returns {Error} The created error.
|
|
751
|
-
*/
|
|
752
|
-
function AxiosError$1(message, code, config, request, response) {
|
|
753
|
-
Error.call(this);
|
|
754
|
-
|
|
755
|
-
if (Error.captureStackTrace) {
|
|
756
|
-
Error.captureStackTrace(this, this.constructor);
|
|
757
|
-
} else {
|
|
758
|
-
this.stack = (new Error()).stack;
|
|
759
|
-
}
|
|
760
|
-
|
|
761
|
-
this.message = message;
|
|
762
|
-
this.name = 'AxiosError';
|
|
763
|
-
code && (this.code = code);
|
|
764
|
-
config && (this.config = config);
|
|
765
|
-
request && (this.request = request);
|
|
766
|
-
response && (this.response = response);
|
|
767
|
-
}
|
|
768
|
-
|
|
769
|
-
utils$1.inherits(AxiosError$1, Error, {
|
|
770
|
-
toJSON: function toJSON() {
|
|
771
|
-
return {
|
|
772
|
-
// Standard
|
|
773
|
-
message: this.message,
|
|
774
|
-
name: this.name,
|
|
775
|
-
// Microsoft
|
|
776
|
-
description: this.description,
|
|
777
|
-
number: this.number,
|
|
778
|
-
// Mozilla
|
|
779
|
-
fileName: this.fileName,
|
|
780
|
-
lineNumber: this.lineNumber,
|
|
781
|
-
columnNumber: this.columnNumber,
|
|
782
|
-
stack: this.stack,
|
|
783
|
-
// Axios
|
|
784
|
-
config: utils$1.toJSONObject(this.config),
|
|
785
|
-
code: this.code,
|
|
786
|
-
status: this.response && this.response.status ? this.response.status : null
|
|
787
|
-
};
|
|
788
|
-
}
|
|
789
|
-
});
|
|
790
|
-
|
|
791
|
-
const prototype$1$1 = AxiosError$1.prototype;
|
|
792
|
-
const descriptors$1 = {};
|
|
793
|
-
|
|
794
|
-
[
|
|
795
|
-
'ERR_BAD_OPTION_VALUE',
|
|
796
|
-
'ERR_BAD_OPTION',
|
|
797
|
-
'ECONNABORTED',
|
|
798
|
-
'ETIMEDOUT',
|
|
799
|
-
'ERR_NETWORK',
|
|
800
|
-
'ERR_FR_TOO_MANY_REDIRECTS',
|
|
801
|
-
'ERR_DEPRECATED',
|
|
802
|
-
'ERR_BAD_RESPONSE',
|
|
803
|
-
'ERR_BAD_REQUEST',
|
|
804
|
-
'ERR_CANCELED',
|
|
805
|
-
'ERR_NOT_SUPPORT',
|
|
806
|
-
'ERR_INVALID_URL'
|
|
807
|
-
// eslint-disable-next-line func-names
|
|
808
|
-
].forEach(code => {
|
|
809
|
-
descriptors$1[code] = {value: code};
|
|
810
|
-
});
|
|
811
|
-
|
|
812
|
-
Object.defineProperties(AxiosError$1, descriptors$1);
|
|
813
|
-
Object.defineProperty(prototype$1$1, 'isAxiosError', {value: true});
|
|
814
|
-
|
|
815
|
-
// eslint-disable-next-line func-names
|
|
816
|
-
AxiosError$1.from = (error, code, config, request, response, customProps) => {
|
|
817
|
-
const axiosError = Object.create(prototype$1$1);
|
|
818
|
-
|
|
819
|
-
utils$1.toFlatObject(error, axiosError, function filter(obj) {
|
|
820
|
-
return obj !== Error.prototype;
|
|
821
|
-
}, prop => {
|
|
822
|
-
return prop !== 'isAxiosError';
|
|
823
|
-
});
|
|
824
|
-
|
|
825
|
-
AxiosError$1.call(axiosError, error.message, code, config, request, response);
|
|
826
|
-
|
|
827
|
-
axiosError.cause = error;
|
|
828
|
-
|
|
829
|
-
axiosError.name = error.name;
|
|
830
|
-
|
|
831
|
-
customProps && Object.assign(axiosError, customProps);
|
|
832
|
-
|
|
833
|
-
return axiosError;
|
|
834
|
-
};
|
|
835
|
-
|
|
836
|
-
// eslint-disable-next-line strict
|
|
837
|
-
var httpAdapter$1 = null;
|
|
838
|
-
|
|
839
|
-
/**
|
|
840
|
-
* Determines if the given thing is a array or js object.
|
|
841
|
-
*
|
|
842
|
-
* @param {string} thing - The object or array to be visited.
|
|
843
|
-
*
|
|
844
|
-
* @returns {boolean}
|
|
845
|
-
*/
|
|
846
|
-
function isVisitable$1(thing) {
|
|
847
|
-
return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
|
|
848
|
-
}
|
|
849
|
-
|
|
850
|
-
/**
|
|
851
|
-
* It removes the brackets from the end of a string
|
|
852
|
-
*
|
|
853
|
-
* @param {string} key - The key of the parameter.
|
|
854
|
-
*
|
|
855
|
-
* @returns {string} the key without the brackets.
|
|
856
|
-
*/
|
|
857
|
-
function removeBrackets$1(key) {
|
|
858
|
-
return utils$1.endsWith(key, '[]') ? key.slice(0, -2) : key;
|
|
859
|
-
}
|
|
860
|
-
|
|
861
|
-
/**
|
|
862
|
-
* It takes a path, a key, and a boolean, and returns a string
|
|
863
|
-
*
|
|
864
|
-
* @param {string} path - The path to the current key.
|
|
865
|
-
* @param {string} key - The key of the current object being iterated over.
|
|
866
|
-
* @param {string} dots - If true, the key will be rendered with dots instead of brackets.
|
|
867
|
-
*
|
|
868
|
-
* @returns {string} The path to the current key.
|
|
869
|
-
*/
|
|
870
|
-
function renderKey$1(path, key, dots) {
|
|
871
|
-
if (!path) return key;
|
|
872
|
-
return path.concat(key).map(function each(token, i) {
|
|
873
|
-
// eslint-disable-next-line no-param-reassign
|
|
874
|
-
token = removeBrackets$1(token);
|
|
875
|
-
return !dots && i ? '[' + token + ']' : token;
|
|
876
|
-
}).join(dots ? '.' : '');
|
|
877
|
-
}
|
|
878
|
-
|
|
879
|
-
/**
|
|
880
|
-
* If the array is an array and none of its elements are visitable, then it's a flat array.
|
|
881
|
-
*
|
|
882
|
-
* @param {Array<any>} arr - The array to check
|
|
883
|
-
*
|
|
884
|
-
* @returns {boolean}
|
|
885
|
-
*/
|
|
886
|
-
function isFlatArray$1(arr) {
|
|
887
|
-
return utils$1.isArray(arr) && !arr.some(isVisitable$1);
|
|
888
|
-
}
|
|
889
|
-
|
|
890
|
-
const predicates$1 = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
|
|
891
|
-
return /^is[A-Z]/.test(prop);
|
|
892
|
-
});
|
|
893
|
-
|
|
894
|
-
/**
|
|
895
|
-
* Convert a data object to FormData
|
|
896
|
-
*
|
|
897
|
-
* @param {Object} obj
|
|
898
|
-
* @param {?Object} [formData]
|
|
899
|
-
* @param {?Object} [options]
|
|
900
|
-
* @param {Function} [options.visitor]
|
|
901
|
-
* @param {Boolean} [options.metaTokens = true]
|
|
902
|
-
* @param {Boolean} [options.dots = false]
|
|
903
|
-
* @param {?Boolean} [options.indexes = false]
|
|
904
|
-
*
|
|
905
|
-
* @returns {Object}
|
|
906
|
-
**/
|
|
907
|
-
|
|
908
|
-
/**
|
|
909
|
-
* It converts an object into a FormData object
|
|
910
|
-
*
|
|
911
|
-
* @param {Object<any, any>} obj - The object to convert to form data.
|
|
912
|
-
* @param {string} formData - The FormData object to append to.
|
|
913
|
-
* @param {Object<string, any>} options
|
|
914
|
-
*
|
|
915
|
-
* @returns
|
|
916
|
-
*/
|
|
917
|
-
function toFormData$1(obj, formData, options) {
|
|
918
|
-
if (!utils$1.isObject(obj)) {
|
|
919
|
-
throw new TypeError('target must be an object');
|
|
920
|
-
}
|
|
921
|
-
|
|
922
|
-
// eslint-disable-next-line no-param-reassign
|
|
923
|
-
formData = formData || new (FormData)();
|
|
924
|
-
|
|
925
|
-
// eslint-disable-next-line no-param-reassign
|
|
926
|
-
options = utils$1.toFlatObject(options, {
|
|
927
|
-
metaTokens: true,
|
|
928
|
-
dots: false,
|
|
929
|
-
indexes: false
|
|
930
|
-
}, false, function defined(option, source) {
|
|
931
|
-
// eslint-disable-next-line no-eq-null,eqeqeq
|
|
932
|
-
return !utils$1.isUndefined(source[option]);
|
|
933
|
-
});
|
|
934
|
-
|
|
935
|
-
const metaTokens = options.metaTokens;
|
|
936
|
-
// eslint-disable-next-line no-use-before-define
|
|
937
|
-
const visitor = options.visitor || defaultVisitor;
|
|
938
|
-
const dots = options.dots;
|
|
939
|
-
const indexes = options.indexes;
|
|
940
|
-
const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
|
|
941
|
-
const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
|
|
942
|
-
|
|
943
|
-
if (!utils$1.isFunction(visitor)) {
|
|
944
|
-
throw new TypeError('visitor must be a function');
|
|
945
|
-
}
|
|
946
|
-
|
|
947
|
-
function convertValue(value) {
|
|
948
|
-
if (value === null) return '';
|
|
949
|
-
|
|
950
|
-
if (utils$1.isDate(value)) {
|
|
951
|
-
return value.toISOString();
|
|
952
|
-
}
|
|
953
|
-
|
|
954
|
-
if (!useBlob && utils$1.isBlob(value)) {
|
|
955
|
-
throw new AxiosError$1('Blob is not supported. Use a Buffer instead.');
|
|
956
|
-
}
|
|
957
|
-
|
|
958
|
-
if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
|
|
959
|
-
return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
|
|
960
|
-
}
|
|
961
|
-
|
|
962
|
-
return value;
|
|
963
|
-
}
|
|
964
|
-
|
|
965
|
-
/**
|
|
966
|
-
* Default visitor.
|
|
967
|
-
*
|
|
968
|
-
* @param {*} value
|
|
969
|
-
* @param {String|Number} key
|
|
970
|
-
* @param {Array<String|Number>} path
|
|
971
|
-
* @this {FormData}
|
|
972
|
-
*
|
|
973
|
-
* @returns {boolean} return true to visit the each prop of the value recursively
|
|
974
|
-
*/
|
|
975
|
-
function defaultVisitor(value, key, path) {
|
|
976
|
-
let arr = value;
|
|
977
|
-
|
|
978
|
-
if (value && !path && typeof value === 'object') {
|
|
979
|
-
if (utils$1.endsWith(key, '{}')) {
|
|
980
|
-
// eslint-disable-next-line no-param-reassign
|
|
981
|
-
key = metaTokens ? key : key.slice(0, -2);
|
|
982
|
-
// eslint-disable-next-line no-param-reassign
|
|
983
|
-
value = JSON.stringify(value);
|
|
984
|
-
} else if (
|
|
985
|
-
(utils$1.isArray(value) && isFlatArray$1(value)) ||
|
|
986
|
-
((utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value))
|
|
987
|
-
)) {
|
|
988
|
-
// eslint-disable-next-line no-param-reassign
|
|
989
|
-
key = removeBrackets$1(key);
|
|
990
|
-
|
|
991
|
-
arr.forEach(function each(el, index) {
|
|
992
|
-
!(utils$1.isUndefined(el) || el === null) && formData.append(
|
|
993
|
-
// eslint-disable-next-line no-nested-ternary
|
|
994
|
-
indexes === true ? renderKey$1([key], index, dots) : (indexes === null ? key : key + '[]'),
|
|
995
|
-
convertValue(el)
|
|
996
|
-
);
|
|
997
|
-
});
|
|
998
|
-
return false;
|
|
999
|
-
}
|
|
1000
|
-
}
|
|
1001
|
-
|
|
1002
|
-
if (isVisitable$1(value)) {
|
|
1003
|
-
return true;
|
|
1004
|
-
}
|
|
1005
|
-
|
|
1006
|
-
formData.append(renderKey$1(path, key, dots), convertValue(value));
|
|
1007
|
-
|
|
1008
|
-
return false;
|
|
1009
|
-
}
|
|
1010
|
-
|
|
1011
|
-
const stack = [];
|
|
1012
|
-
|
|
1013
|
-
const exposedHelpers = Object.assign(predicates$1, {
|
|
1014
|
-
defaultVisitor,
|
|
1015
|
-
convertValue,
|
|
1016
|
-
isVisitable: isVisitable$1
|
|
1017
|
-
});
|
|
1018
|
-
|
|
1019
|
-
function build(value, path) {
|
|
1020
|
-
if (utils$1.isUndefined(value)) return;
|
|
1021
|
-
|
|
1022
|
-
if (stack.indexOf(value) !== -1) {
|
|
1023
|
-
throw Error('Circular reference detected in ' + path.join('.'));
|
|
1024
|
-
}
|
|
1025
|
-
|
|
1026
|
-
stack.push(value);
|
|
1027
|
-
|
|
1028
|
-
utils$1.forEach(value, function each(el, key) {
|
|
1029
|
-
const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(
|
|
1030
|
-
formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers
|
|
1031
|
-
);
|
|
1032
|
-
|
|
1033
|
-
if (result === true) {
|
|
1034
|
-
build(el, path ? path.concat(key) : [key]);
|
|
1035
|
-
}
|
|
1036
|
-
});
|
|
1037
|
-
|
|
1038
|
-
stack.pop();
|
|
1039
|
-
}
|
|
1040
|
-
|
|
1041
|
-
if (!utils$1.isObject(obj)) {
|
|
1042
|
-
throw new TypeError('data must be an object');
|
|
1043
|
-
}
|
|
1044
|
-
|
|
1045
|
-
build(obj);
|
|
1046
|
-
|
|
1047
|
-
return formData;
|
|
1048
|
-
}
|
|
1049
|
-
|
|
1050
|
-
/**
|
|
1051
|
-
* It encodes a string by replacing all characters that are not in the unreserved set with
|
|
1052
|
-
* their percent-encoded equivalents
|
|
1053
|
-
*
|
|
1054
|
-
* @param {string} str - The string to encode.
|
|
1055
|
-
*
|
|
1056
|
-
* @returns {string} The encoded string.
|
|
1057
|
-
*/
|
|
1058
|
-
function encode$1$1(str) {
|
|
1059
|
-
const charMap = {
|
|
1060
|
-
'!': '%21',
|
|
1061
|
-
"'": '%27',
|
|
1062
|
-
'(': '%28',
|
|
1063
|
-
')': '%29',
|
|
1064
|
-
'~': '%7E',
|
|
1065
|
-
'%20': '+',
|
|
1066
|
-
'%00': '\x00'
|
|
1067
|
-
};
|
|
1068
|
-
return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
|
|
1069
|
-
return charMap[match];
|
|
1070
|
-
});
|
|
1071
|
-
}
|
|
1072
|
-
|
|
1073
|
-
/**
|
|
1074
|
-
* It takes a params object and converts it to a FormData object
|
|
1075
|
-
*
|
|
1076
|
-
* @param {Object<string, any>} params - The parameters to be converted to a FormData object.
|
|
1077
|
-
* @param {Object<string, any>} options - The options object passed to the Axios constructor.
|
|
1078
|
-
*
|
|
1079
|
-
* @returns {void}
|
|
1080
|
-
*/
|
|
1081
|
-
function AxiosURLSearchParams$1(params, options) {
|
|
1082
|
-
this._pairs = [];
|
|
1083
|
-
|
|
1084
|
-
params && toFormData$1(params, this, options);
|
|
1085
|
-
}
|
|
1086
|
-
|
|
1087
|
-
const prototype$2 = AxiosURLSearchParams$1.prototype;
|
|
1088
|
-
|
|
1089
|
-
prototype$2.append = function append(name, value) {
|
|
1090
|
-
this._pairs.push([name, value]);
|
|
1091
|
-
};
|
|
1092
|
-
|
|
1093
|
-
prototype$2.toString = function toString(encoder) {
|
|
1094
|
-
const _encode = encoder ? function(value) {
|
|
1095
|
-
return encoder.call(this, value, encode$1$1);
|
|
1096
|
-
} : encode$1$1;
|
|
1097
|
-
|
|
1098
|
-
return this._pairs.map(function each(pair) {
|
|
1099
|
-
return _encode(pair[0]) + '=' + _encode(pair[1]);
|
|
1100
|
-
}, '').join('&');
|
|
1101
|
-
};
|
|
1102
|
-
|
|
1103
|
-
/**
|
|
1104
|
-
* It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their
|
|
1105
|
-
* URI encoded counterparts
|
|
1106
|
-
*
|
|
1107
|
-
* @param {string} val The value to be encoded.
|
|
1108
|
-
*
|
|
1109
|
-
* @returns {string} The encoded value.
|
|
1110
|
-
*/
|
|
1111
|
-
function encode$2(val) {
|
|
1112
|
-
return encodeURIComponent(val).
|
|
1113
|
-
replace(/%3A/gi, ':').
|
|
1114
|
-
replace(/%24/g, '$').
|
|
1115
|
-
replace(/%2C/gi, ',').
|
|
1116
|
-
replace(/%20/g, '+').
|
|
1117
|
-
replace(/%5B/gi, '[').
|
|
1118
|
-
replace(/%5D/gi, ']');
|
|
1119
|
-
}
|
|
1120
|
-
|
|
1121
|
-
/**
|
|
1122
|
-
* Build a URL by appending params to the end
|
|
1123
|
-
*
|
|
1124
|
-
* @param {string} url The base of the url (e.g., http://www.google.com)
|
|
1125
|
-
* @param {object} [params] The params to be appended
|
|
1126
|
-
* @param {?object} options
|
|
1127
|
-
*
|
|
1128
|
-
* @returns {string} The formatted url
|
|
1129
|
-
*/
|
|
1130
|
-
function buildURL$1(url, params, options) {
|
|
1131
|
-
/*eslint no-param-reassign:0*/
|
|
1132
|
-
if (!params) {
|
|
1133
|
-
return url;
|
|
1134
|
-
}
|
|
1135
|
-
|
|
1136
|
-
const _encode = options && options.encode || encode$2;
|
|
1137
|
-
|
|
1138
|
-
const serializeFn = options && options.serialize;
|
|
1139
|
-
|
|
1140
|
-
let serializedParams;
|
|
1141
|
-
|
|
1142
|
-
if (serializeFn) {
|
|
1143
|
-
serializedParams = serializeFn(params, options);
|
|
1144
|
-
} else {
|
|
1145
|
-
serializedParams = utils$1.isURLSearchParams(params) ?
|
|
1146
|
-
params.toString() :
|
|
1147
|
-
new AxiosURLSearchParams$1(params, options).toString(_encode);
|
|
1148
|
-
}
|
|
1149
|
-
|
|
1150
|
-
if (serializedParams) {
|
|
1151
|
-
const hashmarkIndex = url.indexOf("#");
|
|
1152
|
-
|
|
1153
|
-
if (hashmarkIndex !== -1) {
|
|
1154
|
-
url = url.slice(0, hashmarkIndex);
|
|
1155
|
-
}
|
|
1156
|
-
url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
|
|
1157
|
-
}
|
|
1158
|
-
|
|
1159
|
-
return url;
|
|
1160
|
-
}
|
|
1161
|
-
|
|
1162
|
-
let InterceptorManager$2 = class InterceptorManager {
|
|
1163
|
-
constructor() {
|
|
1164
|
-
this.handlers = [];
|
|
1165
|
-
}
|
|
1166
|
-
|
|
1167
|
-
/**
|
|
1168
|
-
* Add a new interceptor to the stack
|
|
1169
|
-
*
|
|
1170
|
-
* @param {Function} fulfilled The function to handle `then` for a `Promise`
|
|
1171
|
-
* @param {Function} rejected The function to handle `reject` for a `Promise`
|
|
1172
|
-
*
|
|
1173
|
-
* @return {Number} An ID used to remove interceptor later
|
|
1174
|
-
*/
|
|
1175
|
-
use(fulfilled, rejected, options) {
|
|
1176
|
-
this.handlers.push({
|
|
1177
|
-
fulfilled,
|
|
1178
|
-
rejected,
|
|
1179
|
-
synchronous: options ? options.synchronous : false,
|
|
1180
|
-
runWhen: options ? options.runWhen : null
|
|
1181
|
-
});
|
|
1182
|
-
return this.handlers.length - 1;
|
|
1183
|
-
}
|
|
1184
|
-
|
|
1185
|
-
/**
|
|
1186
|
-
* Remove an interceptor from the stack
|
|
1187
|
-
*
|
|
1188
|
-
* @param {Number} id The ID that was returned by `use`
|
|
1189
|
-
*
|
|
1190
|
-
* @returns {Boolean} `true` if the interceptor was removed, `false` otherwise
|
|
1191
|
-
*/
|
|
1192
|
-
eject(id) {
|
|
1193
|
-
if (this.handlers[id]) {
|
|
1194
|
-
this.handlers[id] = null;
|
|
1195
|
-
}
|
|
1196
|
-
}
|
|
1197
|
-
|
|
1198
|
-
/**
|
|
1199
|
-
* Clear all interceptors from the stack
|
|
1200
|
-
*
|
|
1201
|
-
* @returns {void}
|
|
1202
|
-
*/
|
|
1203
|
-
clear() {
|
|
1204
|
-
if (this.handlers) {
|
|
1205
|
-
this.handlers = [];
|
|
1206
|
-
}
|
|
1207
|
-
}
|
|
1208
|
-
|
|
1209
|
-
/**
|
|
1210
|
-
* Iterate over all the registered interceptors
|
|
1211
|
-
*
|
|
1212
|
-
* This method is particularly useful for skipping over any
|
|
1213
|
-
* interceptors that may have become `null` calling `eject`.
|
|
1214
|
-
*
|
|
1215
|
-
* @param {Function} fn The function to call for each interceptor
|
|
1216
|
-
*
|
|
1217
|
-
* @returns {void}
|
|
1218
|
-
*/
|
|
1219
|
-
forEach(fn) {
|
|
1220
|
-
utils$1.forEach(this.handlers, function forEachHandler(h) {
|
|
1221
|
-
if (h !== null) {
|
|
1222
|
-
fn(h);
|
|
1223
|
-
}
|
|
1224
|
-
});
|
|
1225
|
-
}
|
|
1226
|
-
};
|
|
1227
|
-
|
|
1228
|
-
var InterceptorManager$1$1 = InterceptorManager$2;
|
|
1229
|
-
|
|
1230
|
-
var transitionalDefaults$1 = {
|
|
1231
|
-
silentJSONParsing: true,
|
|
1232
|
-
forcedJSONParsing: true,
|
|
1233
|
-
clarifyTimeoutError: false
|
|
1234
|
-
};
|
|
1235
|
-
|
|
1236
|
-
var URLSearchParams$1$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams$1;
|
|
1237
|
-
|
|
1238
|
-
var FormData$1$1 = typeof FormData !== 'undefined' ? FormData : null;
|
|
1239
|
-
|
|
1240
|
-
var Blob$1$1 = typeof Blob !== 'undefined' ? Blob : null;
|
|
1241
|
-
|
|
1242
|
-
/**
|
|
1243
|
-
* Determine if we're running in a standard browser environment
|
|
1244
|
-
*
|
|
1245
|
-
* This allows axios to run in a web worker, and react-native.
|
|
1246
|
-
* Both environments support XMLHttpRequest, but not fully standard globals.
|
|
1247
|
-
*
|
|
1248
|
-
* web workers:
|
|
1249
|
-
* typeof window -> undefined
|
|
1250
|
-
* typeof document -> undefined
|
|
1251
|
-
*
|
|
1252
|
-
* react-native:
|
|
1253
|
-
* navigator.product -> 'ReactNative'
|
|
1254
|
-
* nativescript
|
|
1255
|
-
* navigator.product -> 'NativeScript' or 'NS'
|
|
1256
|
-
*
|
|
1257
|
-
* @returns {boolean}
|
|
1258
|
-
*/
|
|
1259
|
-
const isStandardBrowserEnv$1 = (() => {
|
|
1260
|
-
let product;
|
|
1261
|
-
if (typeof navigator !== 'undefined' && (
|
|
1262
|
-
(product = navigator.product) === 'ReactNative' ||
|
|
1263
|
-
product === 'NativeScript' ||
|
|
1264
|
-
product === 'NS')
|
|
1265
|
-
) {
|
|
1266
|
-
return false;
|
|
1267
|
-
}
|
|
1268
|
-
|
|
1269
|
-
return typeof window !== 'undefined' && typeof document !== 'undefined';
|
|
1270
|
-
})();
|
|
1271
|
-
|
|
1272
|
-
/**
|
|
1273
|
-
* Determine if we're running in a standard browser webWorker environment
|
|
1274
|
-
*
|
|
1275
|
-
* Although the `isStandardBrowserEnv` method indicates that
|
|
1276
|
-
* `allows axios to run in a web worker`, the WebWorker will still be
|
|
1277
|
-
* filtered out due to its judgment standard
|
|
1278
|
-
* `typeof window !== 'undefined' && typeof document !== 'undefined'`.
|
|
1279
|
-
* This leads to a problem when axios post `FormData` in webWorker
|
|
1280
|
-
*/
|
|
1281
|
-
const isStandardBrowserWebWorkerEnv$1 = (() => {
|
|
1282
|
-
return (
|
|
1283
|
-
typeof WorkerGlobalScope !== 'undefined' &&
|
|
1284
|
-
// eslint-disable-next-line no-undef
|
|
1285
|
-
self instanceof WorkerGlobalScope &&
|
|
1286
|
-
typeof self.importScripts === 'function'
|
|
1287
|
-
);
|
|
1288
|
-
})();
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
var platform$1 = {
|
|
1292
|
-
isBrowser: true,
|
|
1293
|
-
classes: {
|
|
1294
|
-
URLSearchParams: URLSearchParams$1$1,
|
|
1295
|
-
FormData: FormData$1$1,
|
|
1296
|
-
Blob: Blob$1$1
|
|
1297
|
-
},
|
|
1298
|
-
isStandardBrowserEnv: isStandardBrowserEnv$1,
|
|
1299
|
-
isStandardBrowserWebWorkerEnv: isStandardBrowserWebWorkerEnv$1,
|
|
1300
|
-
protocols: ['http', 'https', 'file', 'blob', 'url', 'data']
|
|
1301
|
-
};
|
|
1302
|
-
|
|
1303
|
-
function toURLEncodedForm$1(data, options) {
|
|
1304
|
-
return toFormData$1(data, new platform$1.classes.URLSearchParams(), Object.assign({
|
|
1305
|
-
visitor: function(value, key, path, helpers) {
|
|
1306
|
-
if (platform$1.isNode && utils$1.isBuffer(value)) {
|
|
1307
|
-
this.append(key, value.toString('base64'));
|
|
1308
|
-
return false;
|
|
1309
|
-
}
|
|
1310
|
-
|
|
1311
|
-
return helpers.defaultVisitor.apply(this, arguments);
|
|
1312
|
-
}
|
|
1313
|
-
}, options));
|
|
1314
|
-
}
|
|
1315
|
-
|
|
1316
|
-
/**
|
|
1317
|
-
* It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
|
|
1318
|
-
*
|
|
1319
|
-
* @param {string} name - The name of the property to get.
|
|
1320
|
-
*
|
|
1321
|
-
* @returns An array of strings.
|
|
1322
|
-
*/
|
|
1323
|
-
function parsePropPath$1(name) {
|
|
1324
|
-
// foo[x][y][z]
|
|
1325
|
-
// foo.x.y.z
|
|
1326
|
-
// foo-x-y-z
|
|
1327
|
-
// foo x y z
|
|
1328
|
-
return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
|
|
1329
|
-
return match[0] === '[]' ? '' : match[1] || match[0];
|
|
1330
|
-
});
|
|
1331
|
-
}
|
|
1332
|
-
|
|
1333
|
-
/**
|
|
1334
|
-
* Convert an array to an object.
|
|
1335
|
-
*
|
|
1336
|
-
* @param {Array<any>} arr - The array to convert to an object.
|
|
1337
|
-
*
|
|
1338
|
-
* @returns An object with the same keys and values as the array.
|
|
1339
|
-
*/
|
|
1340
|
-
function arrayToObject$1(arr) {
|
|
1341
|
-
const obj = {};
|
|
1342
|
-
const keys = Object.keys(arr);
|
|
1343
|
-
let i;
|
|
1344
|
-
const len = keys.length;
|
|
1345
|
-
let key;
|
|
1346
|
-
for (i = 0; i < len; i++) {
|
|
1347
|
-
key = keys[i];
|
|
1348
|
-
obj[key] = arr[key];
|
|
1349
|
-
}
|
|
1350
|
-
return obj;
|
|
1351
|
-
}
|
|
1352
|
-
|
|
1353
|
-
/**
|
|
1354
|
-
* It takes a FormData object and returns a JavaScript object
|
|
1355
|
-
*
|
|
1356
|
-
* @param {string} formData The FormData object to convert to JSON.
|
|
1357
|
-
*
|
|
1358
|
-
* @returns {Object<string, any> | null} The converted object.
|
|
1359
|
-
*/
|
|
1360
|
-
function formDataToJSON$1(formData) {
|
|
1361
|
-
function buildPath(path, value, target, index) {
|
|
1362
|
-
let name = path[index++];
|
|
1363
|
-
const isNumericKey = Number.isFinite(+name);
|
|
1364
|
-
const isLast = index >= path.length;
|
|
1365
|
-
name = !name && utils$1.isArray(target) ? target.length : name;
|
|
1366
|
-
|
|
1367
|
-
if (isLast) {
|
|
1368
|
-
if (utils$1.hasOwnProp(target, name)) {
|
|
1369
|
-
target[name] = [target[name], value];
|
|
1370
|
-
} else {
|
|
1371
|
-
target[name] = value;
|
|
1372
|
-
}
|
|
1373
|
-
|
|
1374
|
-
return !isNumericKey;
|
|
1375
|
-
}
|
|
1376
|
-
|
|
1377
|
-
if (!target[name] || !utils$1.isObject(target[name])) {
|
|
1378
|
-
target[name] = [];
|
|
1379
|
-
}
|
|
1380
|
-
|
|
1381
|
-
const result = buildPath(path, value, target[name], index);
|
|
1382
|
-
|
|
1383
|
-
if (result && utils$1.isArray(target[name])) {
|
|
1384
|
-
target[name] = arrayToObject$1(target[name]);
|
|
1385
|
-
}
|
|
1386
|
-
|
|
1387
|
-
return !isNumericKey;
|
|
1388
|
-
}
|
|
1389
|
-
|
|
1390
|
-
if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
|
|
1391
|
-
const obj = {};
|
|
1392
|
-
|
|
1393
|
-
utils$1.forEachEntry(formData, (name, value) => {
|
|
1394
|
-
buildPath(parsePropPath$1(name), value, obj, 0);
|
|
1395
|
-
});
|
|
1396
|
-
|
|
1397
|
-
return obj;
|
|
1398
|
-
}
|
|
1399
|
-
|
|
1400
|
-
return null;
|
|
1401
|
-
}
|
|
1402
|
-
|
|
1403
|
-
const DEFAULT_CONTENT_TYPE$1 = {
|
|
1404
|
-
'Content-Type': undefined
|
|
1405
|
-
};
|
|
1406
|
-
|
|
1407
|
-
/**
|
|
1408
|
-
* It takes a string, tries to parse it, and if it fails, it returns the stringified version
|
|
1409
|
-
* of the input
|
|
1410
|
-
*
|
|
1411
|
-
* @param {any} rawValue - The value to be stringified.
|
|
1412
|
-
* @param {Function} parser - A function that parses a string into a JavaScript object.
|
|
1413
|
-
* @param {Function} encoder - A function that takes a value and returns a string.
|
|
1414
|
-
*
|
|
1415
|
-
* @returns {string} A stringified version of the rawValue.
|
|
1416
|
-
*/
|
|
1417
|
-
function stringifySafely$1(rawValue, parser, encoder) {
|
|
1418
|
-
if (utils$1.isString(rawValue)) {
|
|
1419
|
-
try {
|
|
1420
|
-
(parser || JSON.parse)(rawValue);
|
|
1421
|
-
return utils$1.trim(rawValue);
|
|
1422
|
-
} catch (e) {
|
|
1423
|
-
if (e.name !== 'SyntaxError') {
|
|
1424
|
-
throw e;
|
|
1425
|
-
}
|
|
1426
|
-
}
|
|
1427
|
-
}
|
|
1428
|
-
|
|
1429
|
-
return (encoder || JSON.stringify)(rawValue);
|
|
1430
|
-
}
|
|
1431
|
-
|
|
1432
|
-
const defaults$2 = {
|
|
1433
|
-
|
|
1434
|
-
transitional: transitionalDefaults$1,
|
|
1435
|
-
|
|
1436
|
-
adapter: ['xhr', 'http'],
|
|
1437
|
-
|
|
1438
|
-
transformRequest: [function transformRequest(data, headers) {
|
|
1439
|
-
const contentType = headers.getContentType() || '';
|
|
1440
|
-
const hasJSONContentType = contentType.indexOf('application/json') > -1;
|
|
1441
|
-
const isObjectPayload = utils$1.isObject(data);
|
|
1442
|
-
|
|
1443
|
-
if (isObjectPayload && utils$1.isHTMLForm(data)) {
|
|
1444
|
-
data = new FormData(data);
|
|
1445
|
-
}
|
|
1446
|
-
|
|
1447
|
-
const isFormData = utils$1.isFormData(data);
|
|
1448
|
-
|
|
1449
|
-
if (isFormData) {
|
|
1450
|
-
if (!hasJSONContentType) {
|
|
1451
|
-
return data;
|
|
1452
|
-
}
|
|
1453
|
-
return hasJSONContentType ? JSON.stringify(formDataToJSON$1(data)) : data;
|
|
1454
|
-
}
|
|
1455
|
-
|
|
1456
|
-
if (utils$1.isArrayBuffer(data) ||
|
|
1457
|
-
utils$1.isBuffer(data) ||
|
|
1458
|
-
utils$1.isStream(data) ||
|
|
1459
|
-
utils$1.isFile(data) ||
|
|
1460
|
-
utils$1.isBlob(data)
|
|
1461
|
-
) {
|
|
1462
|
-
return data;
|
|
1463
|
-
}
|
|
1464
|
-
if (utils$1.isArrayBufferView(data)) {
|
|
1465
|
-
return data.buffer;
|
|
1466
|
-
}
|
|
1467
|
-
if (utils$1.isURLSearchParams(data)) {
|
|
1468
|
-
headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
|
|
1469
|
-
return data.toString();
|
|
1470
|
-
}
|
|
1471
|
-
|
|
1472
|
-
let isFileList;
|
|
1473
|
-
|
|
1474
|
-
if (isObjectPayload) {
|
|
1475
|
-
if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
|
|
1476
|
-
return toURLEncodedForm$1(data, this.formSerializer).toString();
|
|
1477
|
-
}
|
|
1478
|
-
|
|
1479
|
-
if ((isFileList = utils$1.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
|
|
1480
|
-
const _FormData = this.env && this.env.FormData;
|
|
1481
|
-
|
|
1482
|
-
return toFormData$1(
|
|
1483
|
-
isFileList ? {'files[]': data} : data,
|
|
1484
|
-
_FormData && new _FormData(),
|
|
1485
|
-
this.formSerializer
|
|
1486
|
-
);
|
|
1487
|
-
}
|
|
1488
|
-
}
|
|
1489
|
-
|
|
1490
|
-
if (isObjectPayload || hasJSONContentType ) {
|
|
1491
|
-
headers.setContentType('application/json', false);
|
|
1492
|
-
return stringifySafely$1(data);
|
|
1493
|
-
}
|
|
1494
|
-
|
|
1495
|
-
return data;
|
|
1496
|
-
}],
|
|
1497
|
-
|
|
1498
|
-
transformResponse: [function transformResponse(data) {
|
|
1499
|
-
const transitional = this.transitional || defaults$2.transitional;
|
|
1500
|
-
const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
|
|
1501
|
-
const JSONRequested = this.responseType === 'json';
|
|
1502
|
-
|
|
1503
|
-
if (data && utils$1.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
|
|
1504
|
-
const silentJSONParsing = transitional && transitional.silentJSONParsing;
|
|
1505
|
-
const strictJSONParsing = !silentJSONParsing && JSONRequested;
|
|
1506
|
-
|
|
1507
|
-
try {
|
|
1508
|
-
return JSON.parse(data);
|
|
1509
|
-
} catch (e) {
|
|
1510
|
-
if (strictJSONParsing) {
|
|
1511
|
-
if (e.name === 'SyntaxError') {
|
|
1512
|
-
throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_RESPONSE, this, null, this.response);
|
|
1513
|
-
}
|
|
1514
|
-
throw e;
|
|
1515
|
-
}
|
|
1516
|
-
}
|
|
1517
|
-
}
|
|
1518
|
-
|
|
1519
|
-
return data;
|
|
1520
|
-
}],
|
|
1521
|
-
|
|
1522
|
-
/**
|
|
1523
|
-
* A timeout in milliseconds to abort a request. If set to 0 (default) a
|
|
1524
|
-
* timeout is not created.
|
|
1525
|
-
*/
|
|
1526
|
-
timeout: 0,
|
|
1527
|
-
|
|
1528
|
-
xsrfCookieName: 'XSRF-TOKEN',
|
|
1529
|
-
xsrfHeaderName: 'X-XSRF-TOKEN',
|
|
1530
|
-
|
|
1531
|
-
maxContentLength: -1,
|
|
1532
|
-
maxBodyLength: -1,
|
|
1533
|
-
|
|
1534
|
-
env: {
|
|
1535
|
-
FormData: platform$1.classes.FormData,
|
|
1536
|
-
Blob: platform$1.classes.Blob
|
|
1537
|
-
},
|
|
1538
|
-
|
|
1539
|
-
validateStatus: function validateStatus(status) {
|
|
1540
|
-
return status >= 200 && status < 300;
|
|
1541
|
-
},
|
|
1542
|
-
|
|
1543
|
-
headers: {
|
|
1544
|
-
common: {
|
|
1545
|
-
'Accept': 'application/json, text/plain, */*'
|
|
1546
|
-
}
|
|
1547
|
-
}
|
|
1548
|
-
};
|
|
1549
|
-
|
|
1550
|
-
utils$1.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
|
|
1551
|
-
defaults$2.headers[method] = {};
|
|
1552
|
-
});
|
|
1553
|
-
|
|
1554
|
-
utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|
1555
|
-
defaults$2.headers[method] = utils$1.merge(DEFAULT_CONTENT_TYPE$1);
|
|
1556
|
-
});
|
|
1557
|
-
|
|
1558
|
-
var defaults$1$1 = defaults$2;
|
|
1559
|
-
|
|
1560
|
-
// RawAxiosHeaders whose duplicates are ignored by node
|
|
1561
|
-
// c.f. https://nodejs.org/api/http.html#http_message_headers
|
|
1562
|
-
const ignoreDuplicateOf$1 = utils$1.toObjectSet([
|
|
1563
|
-
'age', 'authorization', 'content-length', 'content-type', 'etag',
|
|
1564
|
-
'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
|
|
1565
|
-
'last-modified', 'location', 'max-forwards', 'proxy-authorization',
|
|
1566
|
-
'referer', 'retry-after', 'user-agent'
|
|
1567
|
-
]);
|
|
1568
|
-
|
|
1569
|
-
/**
|
|
1570
|
-
* Parse headers into an object
|
|
1571
|
-
*
|
|
1572
|
-
* ```
|
|
1573
|
-
* Date: Wed, 27 Aug 2014 08:58:49 GMT
|
|
1574
|
-
* Content-Type: application/json
|
|
1575
|
-
* Connection: keep-alive
|
|
1576
|
-
* Transfer-Encoding: chunked
|
|
1577
|
-
* ```
|
|
1578
|
-
*
|
|
1579
|
-
* @param {String} rawHeaders Headers needing to be parsed
|
|
1580
|
-
*
|
|
1581
|
-
* @returns {Object} Headers parsed into an object
|
|
1582
|
-
*/
|
|
1583
|
-
var parseHeaders$1 = rawHeaders => {
|
|
1584
|
-
const parsed = {};
|
|
1585
|
-
let key;
|
|
1586
|
-
let val;
|
|
1587
|
-
let i;
|
|
1588
|
-
|
|
1589
|
-
rawHeaders && rawHeaders.split('\n').forEach(function parser(line) {
|
|
1590
|
-
i = line.indexOf(':');
|
|
1591
|
-
key = line.substring(0, i).trim().toLowerCase();
|
|
1592
|
-
val = line.substring(i + 1).trim();
|
|
1593
|
-
|
|
1594
|
-
if (!key || (parsed[key] && ignoreDuplicateOf$1[key])) {
|
|
1595
|
-
return;
|
|
1596
|
-
}
|
|
1597
|
-
|
|
1598
|
-
if (key === 'set-cookie') {
|
|
1599
|
-
if (parsed[key]) {
|
|
1600
|
-
parsed[key].push(val);
|
|
1601
|
-
} else {
|
|
1602
|
-
parsed[key] = [val];
|
|
1603
|
-
}
|
|
1604
|
-
} else {
|
|
1605
|
-
parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
|
|
1606
|
-
}
|
|
1607
|
-
});
|
|
1608
|
-
|
|
1609
|
-
return parsed;
|
|
1610
|
-
};
|
|
1611
|
-
|
|
1612
|
-
const $internals$1 = Symbol('internals');
|
|
1613
|
-
|
|
1614
|
-
function normalizeHeader$1(header) {
|
|
1615
|
-
return header && String(header).trim().toLowerCase();
|
|
1616
|
-
}
|
|
1617
|
-
|
|
1618
|
-
function normalizeValue$1(value) {
|
|
1619
|
-
if (value === false || value == null) {
|
|
1620
|
-
return value;
|
|
1621
|
-
}
|
|
1622
|
-
|
|
1623
|
-
return utils$1.isArray(value) ? value.map(normalizeValue$1) : String(value);
|
|
1624
|
-
}
|
|
1625
|
-
|
|
1626
|
-
function parseTokens$1(str) {
|
|
1627
|
-
const tokens = Object.create(null);
|
|
1628
|
-
const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
|
|
1629
|
-
let match;
|
|
1630
|
-
|
|
1631
|
-
while ((match = tokensRE.exec(str))) {
|
|
1632
|
-
tokens[match[1]] = match[2];
|
|
1633
|
-
}
|
|
1634
|
-
|
|
1635
|
-
return tokens;
|
|
1636
|
-
}
|
|
1637
|
-
|
|
1638
|
-
const isValidHeaderName$1 = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
|
|
1639
|
-
|
|
1640
|
-
function matchHeaderValue$1(context, value, header, filter, isHeaderNameFilter) {
|
|
1641
|
-
if (utils$1.isFunction(filter)) {
|
|
1642
|
-
return filter.call(this, value, header);
|
|
1643
|
-
}
|
|
1644
|
-
|
|
1645
|
-
if (isHeaderNameFilter) {
|
|
1646
|
-
value = header;
|
|
1647
|
-
}
|
|
1648
|
-
|
|
1649
|
-
if (!utils$1.isString(value)) return;
|
|
1650
|
-
|
|
1651
|
-
if (utils$1.isString(filter)) {
|
|
1652
|
-
return value.indexOf(filter) !== -1;
|
|
1653
|
-
}
|
|
1654
|
-
|
|
1655
|
-
if (utils$1.isRegExp(filter)) {
|
|
1656
|
-
return filter.test(value);
|
|
1657
|
-
}
|
|
1658
|
-
}
|
|
1659
|
-
|
|
1660
|
-
function formatHeader$1(header) {
|
|
1661
|
-
return header.trim()
|
|
1662
|
-
.toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => {
|
|
1663
|
-
return char.toUpperCase() + str;
|
|
1664
|
-
});
|
|
1665
|
-
}
|
|
1666
|
-
|
|
1667
|
-
function buildAccessors$1(obj, header) {
|
|
1668
|
-
const accessorName = utils$1.toCamelCase(' ' + header);
|
|
1669
|
-
|
|
1670
|
-
['get', 'set', 'has'].forEach(methodName => {
|
|
1671
|
-
Object.defineProperty(obj, methodName + accessorName, {
|
|
1672
|
-
value: function(arg1, arg2, arg3) {
|
|
1673
|
-
return this[methodName].call(this, header, arg1, arg2, arg3);
|
|
1674
|
-
},
|
|
1675
|
-
configurable: true
|
|
1676
|
-
});
|
|
1677
|
-
});
|
|
1678
|
-
}
|
|
1679
|
-
|
|
1680
|
-
let AxiosHeaders$2 = class AxiosHeaders {
|
|
1681
|
-
constructor(headers) {
|
|
1682
|
-
headers && this.set(headers);
|
|
1683
|
-
}
|
|
1684
|
-
|
|
1685
|
-
set(header, valueOrRewrite, rewrite) {
|
|
1686
|
-
const self = this;
|
|
1687
|
-
|
|
1688
|
-
function setHeader(_value, _header, _rewrite) {
|
|
1689
|
-
const lHeader = normalizeHeader$1(_header);
|
|
1690
|
-
|
|
1691
|
-
if (!lHeader) {
|
|
1692
|
-
throw new Error('header name must be a non-empty string');
|
|
1693
|
-
}
|
|
1694
|
-
|
|
1695
|
-
const key = utils$1.findKey(self, lHeader);
|
|
1696
|
-
|
|
1697
|
-
if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) {
|
|
1698
|
-
self[key || _header] = normalizeValue$1(_value);
|
|
1699
|
-
}
|
|
1700
|
-
}
|
|
1701
|
-
|
|
1702
|
-
const setHeaders = (headers, _rewrite) =>
|
|
1703
|
-
utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
|
|
1704
|
-
|
|
1705
|
-
if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
|
|
1706
|
-
setHeaders(header, valueOrRewrite);
|
|
1707
|
-
} else if(utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName$1(header)) {
|
|
1708
|
-
setHeaders(parseHeaders$1(header), valueOrRewrite);
|
|
1709
|
-
} else {
|
|
1710
|
-
header != null && setHeader(valueOrRewrite, header, rewrite);
|
|
1711
|
-
}
|
|
1712
|
-
|
|
1713
|
-
return this;
|
|
1714
|
-
}
|
|
1715
|
-
|
|
1716
|
-
get(header, parser) {
|
|
1717
|
-
header = normalizeHeader$1(header);
|
|
1718
|
-
|
|
1719
|
-
if (header) {
|
|
1720
|
-
const key = utils$1.findKey(this, header);
|
|
1721
|
-
|
|
1722
|
-
if (key) {
|
|
1723
|
-
const value = this[key];
|
|
1724
|
-
|
|
1725
|
-
if (!parser) {
|
|
1726
|
-
return value;
|
|
1727
|
-
}
|
|
1728
|
-
|
|
1729
|
-
if (parser === true) {
|
|
1730
|
-
return parseTokens$1(value);
|
|
1731
|
-
}
|
|
1732
|
-
|
|
1733
|
-
if (utils$1.isFunction(parser)) {
|
|
1734
|
-
return parser.call(this, value, key);
|
|
1735
|
-
}
|
|
1736
|
-
|
|
1737
|
-
if (utils$1.isRegExp(parser)) {
|
|
1738
|
-
return parser.exec(value);
|
|
1739
|
-
}
|
|
1740
|
-
|
|
1741
|
-
throw new TypeError('parser must be boolean|regexp|function');
|
|
1742
|
-
}
|
|
1743
|
-
}
|
|
1744
|
-
}
|
|
1745
|
-
|
|
1746
|
-
has(header, matcher) {
|
|
1747
|
-
header = normalizeHeader$1(header);
|
|
1748
|
-
|
|
1749
|
-
if (header) {
|
|
1750
|
-
const key = utils$1.findKey(this, header);
|
|
1751
|
-
|
|
1752
|
-
return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue$1(this, this[key], key, matcher)));
|
|
1753
|
-
}
|
|
1754
|
-
|
|
1755
|
-
return false;
|
|
1756
|
-
}
|
|
1757
|
-
|
|
1758
|
-
delete(header, matcher) {
|
|
1759
|
-
const self = this;
|
|
1760
|
-
let deleted = false;
|
|
1761
|
-
|
|
1762
|
-
function deleteHeader(_header) {
|
|
1763
|
-
_header = normalizeHeader$1(_header);
|
|
1764
|
-
|
|
1765
|
-
if (_header) {
|
|
1766
|
-
const key = utils$1.findKey(self, _header);
|
|
1767
|
-
|
|
1768
|
-
if (key && (!matcher || matchHeaderValue$1(self, self[key], key, matcher))) {
|
|
1769
|
-
delete self[key];
|
|
1770
|
-
|
|
1771
|
-
deleted = true;
|
|
1772
|
-
}
|
|
1773
|
-
}
|
|
1774
|
-
}
|
|
1775
|
-
|
|
1776
|
-
if (utils$1.isArray(header)) {
|
|
1777
|
-
header.forEach(deleteHeader);
|
|
1778
|
-
} else {
|
|
1779
|
-
deleteHeader(header);
|
|
1780
|
-
}
|
|
1781
|
-
|
|
1782
|
-
return deleted;
|
|
1783
|
-
}
|
|
1784
|
-
|
|
1785
|
-
clear(matcher) {
|
|
1786
|
-
const keys = Object.keys(this);
|
|
1787
|
-
let i = keys.length;
|
|
1788
|
-
let deleted = false;
|
|
1789
|
-
|
|
1790
|
-
while (i--) {
|
|
1791
|
-
const key = keys[i];
|
|
1792
|
-
if(!matcher || matchHeaderValue$1(this, this[key], key, matcher, true)) {
|
|
1793
|
-
delete this[key];
|
|
1794
|
-
deleted = true;
|
|
1795
|
-
}
|
|
1796
|
-
}
|
|
1797
|
-
|
|
1798
|
-
return deleted;
|
|
1799
|
-
}
|
|
1800
|
-
|
|
1801
|
-
normalize(format) {
|
|
1802
|
-
const self = this;
|
|
1803
|
-
const headers = {};
|
|
1804
|
-
|
|
1805
|
-
utils$1.forEach(this, (value, header) => {
|
|
1806
|
-
const key = utils$1.findKey(headers, header);
|
|
1807
|
-
|
|
1808
|
-
if (key) {
|
|
1809
|
-
self[key] = normalizeValue$1(value);
|
|
1810
|
-
delete self[header];
|
|
1811
|
-
return;
|
|
1812
|
-
}
|
|
1813
|
-
|
|
1814
|
-
const normalized = format ? formatHeader$1(header) : String(header).trim();
|
|
1815
|
-
|
|
1816
|
-
if (normalized !== header) {
|
|
1817
|
-
delete self[header];
|
|
1818
|
-
}
|
|
1819
|
-
|
|
1820
|
-
self[normalized] = normalizeValue$1(value);
|
|
1821
|
-
|
|
1822
|
-
headers[normalized] = true;
|
|
1823
|
-
});
|
|
1824
|
-
|
|
1825
|
-
return this;
|
|
1826
|
-
}
|
|
1827
|
-
|
|
1828
|
-
concat(...targets) {
|
|
1829
|
-
return this.constructor.concat(this, ...targets);
|
|
1830
|
-
}
|
|
1831
|
-
|
|
1832
|
-
toJSON(asStrings) {
|
|
1833
|
-
const obj = Object.create(null);
|
|
1834
|
-
|
|
1835
|
-
utils$1.forEach(this, (value, header) => {
|
|
1836
|
-
value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
|
|
1837
|
-
});
|
|
1838
|
-
|
|
1839
|
-
return obj;
|
|
1840
|
-
}
|
|
1841
|
-
|
|
1842
|
-
[Symbol.iterator]() {
|
|
1843
|
-
return Object.entries(this.toJSON())[Symbol.iterator]();
|
|
1844
|
-
}
|
|
1845
|
-
|
|
1846
|
-
toString() {
|
|
1847
|
-
return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\n');
|
|
1848
|
-
}
|
|
1849
|
-
|
|
1850
|
-
get [Symbol.toStringTag]() {
|
|
1851
|
-
return 'AxiosHeaders';
|
|
1852
|
-
}
|
|
1853
|
-
|
|
1854
|
-
static from(thing) {
|
|
1855
|
-
return thing instanceof this ? thing : new this(thing);
|
|
1856
|
-
}
|
|
1857
|
-
|
|
1858
|
-
static concat(first, ...targets) {
|
|
1859
|
-
const computed = new this(first);
|
|
1860
|
-
|
|
1861
|
-
targets.forEach((target) => computed.set(target));
|
|
1862
|
-
|
|
1863
|
-
return computed;
|
|
1864
|
-
}
|
|
1865
|
-
|
|
1866
|
-
static accessor(header) {
|
|
1867
|
-
const internals = this[$internals$1] = (this[$internals$1] = {
|
|
1868
|
-
accessors: {}
|
|
1869
|
-
});
|
|
1870
|
-
|
|
1871
|
-
const accessors = internals.accessors;
|
|
1872
|
-
const prototype = this.prototype;
|
|
1873
|
-
|
|
1874
|
-
function defineAccessor(_header) {
|
|
1875
|
-
const lHeader = normalizeHeader$1(_header);
|
|
1876
|
-
|
|
1877
|
-
if (!accessors[lHeader]) {
|
|
1878
|
-
buildAccessors$1(prototype, _header);
|
|
1879
|
-
accessors[lHeader] = true;
|
|
1880
|
-
}
|
|
1881
|
-
}
|
|
1882
|
-
|
|
1883
|
-
utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
|
|
1884
|
-
|
|
1885
|
-
return this;
|
|
1886
|
-
}
|
|
1887
|
-
};
|
|
1888
|
-
|
|
1889
|
-
AxiosHeaders$2.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
|
|
1890
|
-
|
|
1891
|
-
utils$1.freezeMethods(AxiosHeaders$2.prototype);
|
|
1892
|
-
utils$1.freezeMethods(AxiosHeaders$2);
|
|
1893
|
-
|
|
1894
|
-
var AxiosHeaders$1$1 = AxiosHeaders$2;
|
|
1895
|
-
|
|
1896
|
-
/**
|
|
1897
|
-
* Transform the data for a request or a response
|
|
1898
|
-
*
|
|
1899
|
-
* @param {Array|Function} fns A single function or Array of functions
|
|
1900
|
-
* @param {?Object} response The response object
|
|
1901
|
-
*
|
|
1902
|
-
* @returns {*} The resulting transformed data
|
|
1903
|
-
*/
|
|
1904
|
-
function transformData$1(fns, response) {
|
|
1905
|
-
const config = this || defaults$1$1;
|
|
1906
|
-
const context = response || config;
|
|
1907
|
-
const headers = AxiosHeaders$1$1.from(context.headers);
|
|
1908
|
-
let data = context.data;
|
|
1909
|
-
|
|
1910
|
-
utils$1.forEach(fns, function transform(fn) {
|
|
1911
|
-
data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);
|
|
1912
|
-
});
|
|
1913
|
-
|
|
1914
|
-
headers.normalize();
|
|
1915
|
-
|
|
1916
|
-
return data;
|
|
1917
|
-
}
|
|
1918
|
-
|
|
1919
|
-
function isCancel$1(value) {
|
|
1920
|
-
return !!(value && value.__CANCEL__);
|
|
1921
|
-
}
|
|
1922
|
-
|
|
1923
|
-
/**
|
|
1924
|
-
* A `CanceledError` is an object that is thrown when an operation is canceled.
|
|
1925
|
-
*
|
|
1926
|
-
* @param {string=} message The message.
|
|
1927
|
-
* @param {Object=} config The config.
|
|
1928
|
-
* @param {Object=} request The request.
|
|
1929
|
-
*
|
|
1930
|
-
* @returns {CanceledError} The created error.
|
|
1931
|
-
*/
|
|
1932
|
-
function CanceledError$1(message, config, request) {
|
|
1933
|
-
// eslint-disable-next-line no-eq-null,eqeqeq
|
|
1934
|
-
AxiosError$1.call(this, message == null ? 'canceled' : message, AxiosError$1.ERR_CANCELED, config, request);
|
|
1935
|
-
this.name = 'CanceledError';
|
|
1936
|
-
}
|
|
1937
|
-
|
|
1938
|
-
utils$1.inherits(CanceledError$1, AxiosError$1, {
|
|
1939
|
-
__CANCEL__: true
|
|
1940
|
-
});
|
|
1941
|
-
|
|
1942
|
-
/**
|
|
1943
|
-
* Resolve or reject a Promise based on response status.
|
|
1944
|
-
*
|
|
1945
|
-
* @param {Function} resolve A function that resolves the promise.
|
|
1946
|
-
* @param {Function} reject A function that rejects the promise.
|
|
1947
|
-
* @param {object} response The response.
|
|
1948
|
-
*
|
|
1949
|
-
* @returns {object} The response.
|
|
1950
|
-
*/
|
|
1951
|
-
function settle$1(resolve, reject, response) {
|
|
1952
|
-
const validateStatus = response.config.validateStatus;
|
|
1953
|
-
if (!response.status || !validateStatus || validateStatus(response.status)) {
|
|
1954
|
-
resolve(response);
|
|
1955
|
-
} else {
|
|
1956
|
-
reject(new AxiosError$1(
|
|
1957
|
-
'Request failed with status code ' + response.status,
|
|
1958
|
-
[AxiosError$1.ERR_BAD_REQUEST, AxiosError$1.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
|
|
1959
|
-
response.config,
|
|
1960
|
-
response.request,
|
|
1961
|
-
response
|
|
1962
|
-
));
|
|
1963
|
-
}
|
|
1964
|
-
}
|
|
1965
|
-
|
|
1966
|
-
var cookies$1 = platform$1.isStandardBrowserEnv ?
|
|
1967
|
-
|
|
1968
|
-
// Standard browser envs support document.cookie
|
|
1969
|
-
(function standardBrowserEnv() {
|
|
1970
|
-
return {
|
|
1971
|
-
write: function write(name, value, expires, path, domain, secure) {
|
|
1972
|
-
const cookie = [];
|
|
1973
|
-
cookie.push(name + '=' + encodeURIComponent(value));
|
|
1974
|
-
|
|
1975
|
-
if (utils$1.isNumber(expires)) {
|
|
1976
|
-
cookie.push('expires=' + new Date(expires).toGMTString());
|
|
1977
|
-
}
|
|
1978
|
-
|
|
1979
|
-
if (utils$1.isString(path)) {
|
|
1980
|
-
cookie.push('path=' + path);
|
|
1981
|
-
}
|
|
1982
|
-
|
|
1983
|
-
if (utils$1.isString(domain)) {
|
|
1984
|
-
cookie.push('domain=' + domain);
|
|
1985
|
-
}
|
|
1986
|
-
|
|
1987
|
-
if (secure === true) {
|
|
1988
|
-
cookie.push('secure');
|
|
1989
|
-
}
|
|
1990
|
-
|
|
1991
|
-
document.cookie = cookie.join('; ');
|
|
1992
|
-
},
|
|
1993
|
-
|
|
1994
|
-
read: function read(name) {
|
|
1995
|
-
const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
|
|
1996
|
-
return (match ? decodeURIComponent(match[3]) : null);
|
|
1997
|
-
},
|
|
1998
|
-
|
|
1999
|
-
remove: function remove(name) {
|
|
2000
|
-
this.write(name, '', Date.now() - 86400000);
|
|
2001
|
-
}
|
|
2002
|
-
};
|
|
2003
|
-
})() :
|
|
2004
|
-
|
|
2005
|
-
// Non standard browser env (web workers, react-native) lack needed support.
|
|
2006
|
-
(function nonStandardBrowserEnv() {
|
|
2007
|
-
return {
|
|
2008
|
-
write: function write() {},
|
|
2009
|
-
read: function read() { return null; },
|
|
2010
|
-
remove: function remove() {}
|
|
2011
|
-
};
|
|
2012
|
-
})();
|
|
2013
|
-
|
|
2014
|
-
/**
|
|
2015
|
-
* Determines whether the specified URL is absolute
|
|
2016
|
-
*
|
|
2017
|
-
* @param {string} url The URL to test
|
|
2018
|
-
*
|
|
2019
|
-
* @returns {boolean} True if the specified URL is absolute, otherwise false
|
|
2020
|
-
*/
|
|
2021
|
-
function isAbsoluteURL$1(url) {
|
|
2022
|
-
// A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
|
|
2023
|
-
// RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
|
|
2024
|
-
// by any combination of letters, digits, plus, period, or hyphen.
|
|
2025
|
-
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
|
|
2026
|
-
}
|
|
2027
|
-
|
|
2028
|
-
/**
|
|
2029
|
-
* Creates a new URL by combining the specified URLs
|
|
2030
|
-
*
|
|
2031
|
-
* @param {string} baseURL The base URL
|
|
2032
|
-
* @param {string} relativeURL The relative URL
|
|
2033
|
-
*
|
|
2034
|
-
* @returns {string} The combined URL
|
|
2035
|
-
*/
|
|
2036
|
-
function combineURLs$1(baseURL, relativeURL) {
|
|
2037
|
-
return relativeURL
|
|
2038
|
-
? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
|
|
2039
|
-
: baseURL;
|
|
2040
|
-
}
|
|
2041
|
-
|
|
2042
|
-
/**
|
|
2043
|
-
* Creates a new URL by combining the baseURL with the requestedURL,
|
|
2044
|
-
* only when the requestedURL is not already an absolute URL.
|
|
2045
|
-
* If the requestURL is absolute, this function returns the requestedURL untouched.
|
|
2046
|
-
*
|
|
2047
|
-
* @param {string} baseURL The base URL
|
|
2048
|
-
* @param {string} requestedURL Absolute or relative URL to combine
|
|
2049
|
-
*
|
|
2050
|
-
* @returns {string} The combined full path
|
|
2051
|
-
*/
|
|
2052
|
-
function buildFullPath$1(baseURL, requestedURL) {
|
|
2053
|
-
if (baseURL && !isAbsoluteURL$1(requestedURL)) {
|
|
2054
|
-
return combineURLs$1(baseURL, requestedURL);
|
|
2055
|
-
}
|
|
2056
|
-
return requestedURL;
|
|
2057
|
-
}
|
|
2058
|
-
|
|
2059
|
-
var isURLSameOrigin$1 = platform$1.isStandardBrowserEnv ?
|
|
2060
|
-
|
|
2061
|
-
// Standard browser envs have full support of the APIs needed to test
|
|
2062
|
-
// whether the request URL is of the same origin as current location.
|
|
2063
|
-
(function standardBrowserEnv() {
|
|
2064
|
-
const msie = /(msie|trident)/i.test(navigator.userAgent);
|
|
2065
|
-
const urlParsingNode = document.createElement('a');
|
|
2066
|
-
let originURL;
|
|
2067
|
-
|
|
2068
|
-
/**
|
|
2069
|
-
* Parse a URL to discover it's components
|
|
2070
|
-
*
|
|
2071
|
-
* @param {String} url The URL to be parsed
|
|
2072
|
-
* @returns {Object}
|
|
2073
|
-
*/
|
|
2074
|
-
function resolveURL(url) {
|
|
2075
|
-
let href = url;
|
|
2076
|
-
|
|
2077
|
-
if (msie) {
|
|
2078
|
-
// IE needs attribute set twice to normalize properties
|
|
2079
|
-
urlParsingNode.setAttribute('href', href);
|
|
2080
|
-
href = urlParsingNode.href;
|
|
2081
|
-
}
|
|
2082
|
-
|
|
2083
|
-
urlParsingNode.setAttribute('href', href);
|
|
2084
|
-
|
|
2085
|
-
// urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
|
|
2086
|
-
return {
|
|
2087
|
-
href: urlParsingNode.href,
|
|
2088
|
-
protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
|
|
2089
|
-
host: urlParsingNode.host,
|
|
2090
|
-
search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
|
|
2091
|
-
hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
|
|
2092
|
-
hostname: urlParsingNode.hostname,
|
|
2093
|
-
port: urlParsingNode.port,
|
|
2094
|
-
pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
|
|
2095
|
-
urlParsingNode.pathname :
|
|
2096
|
-
'/' + urlParsingNode.pathname
|
|
2097
|
-
};
|
|
2098
|
-
}
|
|
2099
|
-
|
|
2100
|
-
originURL = resolveURL(window.location.href);
|
|
2101
|
-
|
|
2102
|
-
/**
|
|
2103
|
-
* Determine if a URL shares the same origin as the current location
|
|
2104
|
-
*
|
|
2105
|
-
* @param {String} requestURL The URL to test
|
|
2106
|
-
* @returns {boolean} True if URL shares the same origin, otherwise false
|
|
2107
|
-
*/
|
|
2108
|
-
return function isURLSameOrigin(requestURL) {
|
|
2109
|
-
const parsed = (utils$1.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
|
|
2110
|
-
return (parsed.protocol === originURL.protocol &&
|
|
2111
|
-
parsed.host === originURL.host);
|
|
2112
|
-
};
|
|
2113
|
-
})() :
|
|
2114
|
-
|
|
2115
|
-
// Non standard browser envs (web workers, react-native) lack needed support.
|
|
2116
|
-
(function nonStandardBrowserEnv() {
|
|
2117
|
-
return function isURLSameOrigin() {
|
|
2118
|
-
return true;
|
|
2119
|
-
};
|
|
2120
|
-
})();
|
|
2121
|
-
|
|
2122
|
-
function parseProtocol$1(url) {
|
|
2123
|
-
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
|
|
2124
|
-
return match && match[1] || '';
|
|
2125
|
-
}
|
|
2126
|
-
|
|
2127
|
-
/**
|
|
2128
|
-
* Calculate data maxRate
|
|
2129
|
-
* @param {Number} [samplesCount= 10]
|
|
2130
|
-
* @param {Number} [min= 1000]
|
|
2131
|
-
* @returns {Function}
|
|
2132
|
-
*/
|
|
2133
|
-
function speedometer$1(samplesCount, min) {
|
|
2134
|
-
samplesCount = samplesCount || 10;
|
|
2135
|
-
const bytes = new Array(samplesCount);
|
|
2136
|
-
const timestamps = new Array(samplesCount);
|
|
2137
|
-
let head = 0;
|
|
2138
|
-
let tail = 0;
|
|
2139
|
-
let firstSampleTS;
|
|
2140
|
-
|
|
2141
|
-
min = min !== undefined ? min : 1000;
|
|
2142
|
-
|
|
2143
|
-
return function push(chunkLength) {
|
|
2144
|
-
const now = Date.now();
|
|
2145
|
-
|
|
2146
|
-
const startedAt = timestamps[tail];
|
|
2147
|
-
|
|
2148
|
-
if (!firstSampleTS) {
|
|
2149
|
-
firstSampleTS = now;
|
|
2150
|
-
}
|
|
2151
|
-
|
|
2152
|
-
bytes[head] = chunkLength;
|
|
2153
|
-
timestamps[head] = now;
|
|
2154
|
-
|
|
2155
|
-
let i = tail;
|
|
2156
|
-
let bytesCount = 0;
|
|
2157
|
-
|
|
2158
|
-
while (i !== head) {
|
|
2159
|
-
bytesCount += bytes[i++];
|
|
2160
|
-
i = i % samplesCount;
|
|
2161
|
-
}
|
|
2162
|
-
|
|
2163
|
-
head = (head + 1) % samplesCount;
|
|
2164
|
-
|
|
2165
|
-
if (head === tail) {
|
|
2166
|
-
tail = (tail + 1) % samplesCount;
|
|
2167
|
-
}
|
|
2168
|
-
|
|
2169
|
-
if (now - firstSampleTS < min) {
|
|
2170
|
-
return;
|
|
2171
|
-
}
|
|
2172
|
-
|
|
2173
|
-
const passed = startedAt && now - startedAt;
|
|
2174
|
-
|
|
2175
|
-
return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
|
|
2176
|
-
};
|
|
2177
|
-
}
|
|
2178
|
-
|
|
2179
|
-
function progressEventReducer$1(listener, isDownloadStream) {
|
|
2180
|
-
let bytesNotified = 0;
|
|
2181
|
-
const _speedometer = speedometer$1(50, 250);
|
|
2182
|
-
|
|
2183
|
-
return e => {
|
|
2184
|
-
const loaded = e.loaded;
|
|
2185
|
-
const total = e.lengthComputable ? e.total : undefined;
|
|
2186
|
-
const progressBytes = loaded - bytesNotified;
|
|
2187
|
-
const rate = _speedometer(progressBytes);
|
|
2188
|
-
const inRange = loaded <= total;
|
|
2189
|
-
|
|
2190
|
-
bytesNotified = loaded;
|
|
2191
|
-
|
|
2192
|
-
const data = {
|
|
2193
|
-
loaded,
|
|
2194
|
-
total,
|
|
2195
|
-
progress: total ? (loaded / total) : undefined,
|
|
2196
|
-
bytes: progressBytes,
|
|
2197
|
-
rate: rate ? rate : undefined,
|
|
2198
|
-
estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
|
|
2199
|
-
event: e
|
|
2200
|
-
};
|
|
2201
|
-
|
|
2202
|
-
data[isDownloadStream ? 'download' : 'upload'] = true;
|
|
2203
|
-
|
|
2204
|
-
listener(data);
|
|
2205
|
-
};
|
|
2206
|
-
}
|
|
2207
|
-
|
|
2208
|
-
const isXHRAdapterSupported$1 = typeof XMLHttpRequest !== 'undefined';
|
|
2209
|
-
|
|
2210
|
-
var xhrAdapter$1 = isXHRAdapterSupported$1 && function (config) {
|
|
2211
|
-
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
|
2212
|
-
let requestData = config.data;
|
|
2213
|
-
const requestHeaders = AxiosHeaders$1$1.from(config.headers).normalize();
|
|
2214
|
-
const responseType = config.responseType;
|
|
2215
|
-
let onCanceled;
|
|
2216
|
-
function done() {
|
|
2217
|
-
if (config.cancelToken) {
|
|
2218
|
-
config.cancelToken.unsubscribe(onCanceled);
|
|
2219
|
-
}
|
|
2220
|
-
|
|
2221
|
-
if (config.signal) {
|
|
2222
|
-
config.signal.removeEventListener('abort', onCanceled);
|
|
2223
|
-
}
|
|
2224
|
-
}
|
|
2225
|
-
|
|
2226
|
-
if (utils$1.isFormData(requestData)) {
|
|
2227
|
-
if (platform$1.isStandardBrowserEnv || platform$1.isStandardBrowserWebWorkerEnv) {
|
|
2228
|
-
requestHeaders.setContentType(false); // Let the browser set it
|
|
2229
|
-
} else {
|
|
2230
|
-
requestHeaders.setContentType('multipart/form-data;', false); // mobile/desktop app frameworks
|
|
2231
|
-
}
|
|
2232
|
-
}
|
|
2233
|
-
|
|
2234
|
-
let request = new XMLHttpRequest();
|
|
2235
|
-
|
|
2236
|
-
// HTTP basic authentication
|
|
2237
|
-
if (config.auth) {
|
|
2238
|
-
const username = config.auth.username || '';
|
|
2239
|
-
const password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';
|
|
2240
|
-
requestHeaders.set('Authorization', 'Basic ' + btoa(username + ':' + password));
|
|
2241
|
-
}
|
|
2242
|
-
|
|
2243
|
-
const fullPath = buildFullPath$1(config.baseURL, config.url);
|
|
2244
|
-
|
|
2245
|
-
request.open(config.method.toUpperCase(), buildURL$1(fullPath, config.params, config.paramsSerializer), true);
|
|
2246
|
-
|
|
2247
|
-
// Set the request timeout in MS
|
|
2248
|
-
request.timeout = config.timeout;
|
|
2249
|
-
|
|
2250
|
-
function onloadend() {
|
|
2251
|
-
if (!request) {
|
|
2252
|
-
return;
|
|
2253
|
-
}
|
|
2254
|
-
// Prepare the response
|
|
2255
|
-
const responseHeaders = AxiosHeaders$1$1.from(
|
|
2256
|
-
'getAllResponseHeaders' in request && request.getAllResponseHeaders()
|
|
2257
|
-
);
|
|
2258
|
-
const responseData = !responseType || responseType === 'text' || responseType === 'json' ?
|
|
2259
|
-
request.responseText : request.response;
|
|
2260
|
-
const response = {
|
|
2261
|
-
data: responseData,
|
|
2262
|
-
status: request.status,
|
|
2263
|
-
statusText: request.statusText,
|
|
2264
|
-
headers: responseHeaders,
|
|
2265
|
-
config,
|
|
2266
|
-
request
|
|
2267
|
-
};
|
|
2268
|
-
|
|
2269
|
-
settle$1(function _resolve(value) {
|
|
2270
|
-
resolve(value);
|
|
2271
|
-
done();
|
|
2272
|
-
}, function _reject(err) {
|
|
2273
|
-
reject(err);
|
|
2274
|
-
done();
|
|
2275
|
-
}, response);
|
|
2276
|
-
|
|
2277
|
-
// Clean up request
|
|
2278
|
-
request = null;
|
|
2279
|
-
}
|
|
2280
|
-
|
|
2281
|
-
if ('onloadend' in request) {
|
|
2282
|
-
// Use onloadend if available
|
|
2283
|
-
request.onloadend = onloadend;
|
|
2284
|
-
} else {
|
|
2285
|
-
// Listen for ready state to emulate onloadend
|
|
2286
|
-
request.onreadystatechange = function handleLoad() {
|
|
2287
|
-
if (!request || request.readyState !== 4) {
|
|
2288
|
-
return;
|
|
2289
|
-
}
|
|
2290
|
-
|
|
2291
|
-
// The request errored out and we didn't get a response, this will be
|
|
2292
|
-
// handled by onerror instead
|
|
2293
|
-
// With one exception: request that using file: protocol, most browsers
|
|
2294
|
-
// will return status as 0 even though it's a successful request
|
|
2295
|
-
if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
|
|
2296
|
-
return;
|
|
2297
|
-
}
|
|
2298
|
-
// readystate handler is calling before onerror or ontimeout handlers,
|
|
2299
|
-
// so we should call onloadend on the next 'tick'
|
|
2300
|
-
setTimeout(onloadend);
|
|
2301
|
-
};
|
|
2302
|
-
}
|
|
2303
|
-
|
|
2304
|
-
// Handle browser request cancellation (as opposed to a manual cancellation)
|
|
2305
|
-
request.onabort = function handleAbort() {
|
|
2306
|
-
if (!request) {
|
|
2307
|
-
return;
|
|
2308
|
-
}
|
|
2309
|
-
|
|
2310
|
-
reject(new AxiosError$1('Request aborted', AxiosError$1.ECONNABORTED, config, request));
|
|
2311
|
-
|
|
2312
|
-
// Clean up request
|
|
2313
|
-
request = null;
|
|
2314
|
-
};
|
|
2315
|
-
|
|
2316
|
-
// Handle low level network errors
|
|
2317
|
-
request.onerror = function handleError() {
|
|
2318
|
-
// Real errors are hidden from us by the browser
|
|
2319
|
-
// onerror should only fire if it's a network error
|
|
2320
|
-
reject(new AxiosError$1('Network Error', AxiosError$1.ERR_NETWORK, config, request));
|
|
2321
|
-
|
|
2322
|
-
// Clean up request
|
|
2323
|
-
request = null;
|
|
2324
|
-
};
|
|
2325
|
-
|
|
2326
|
-
// Handle timeout
|
|
2327
|
-
request.ontimeout = function handleTimeout() {
|
|
2328
|
-
let timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
|
|
2329
|
-
const transitional = config.transitional || transitionalDefaults$1;
|
|
2330
|
-
if (config.timeoutErrorMessage) {
|
|
2331
|
-
timeoutErrorMessage = config.timeoutErrorMessage;
|
|
2332
|
-
}
|
|
2333
|
-
reject(new AxiosError$1(
|
|
2334
|
-
timeoutErrorMessage,
|
|
2335
|
-
transitional.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED,
|
|
2336
|
-
config,
|
|
2337
|
-
request));
|
|
2338
|
-
|
|
2339
|
-
// Clean up request
|
|
2340
|
-
request = null;
|
|
2341
|
-
};
|
|
2342
|
-
|
|
2343
|
-
// Add xsrf header
|
|
2344
|
-
// This is only done if running in a standard browser environment.
|
|
2345
|
-
// Specifically not if we're in a web worker, or react-native.
|
|
2346
|
-
if (platform$1.isStandardBrowserEnv) {
|
|
2347
|
-
// Add xsrf header
|
|
2348
|
-
const xsrfValue = (config.withCredentials || isURLSameOrigin$1(fullPath))
|
|
2349
|
-
&& config.xsrfCookieName && cookies$1.read(config.xsrfCookieName);
|
|
2350
|
-
|
|
2351
|
-
if (xsrfValue) {
|
|
2352
|
-
requestHeaders.set(config.xsrfHeaderName, xsrfValue);
|
|
2353
|
-
}
|
|
2354
|
-
}
|
|
2355
|
-
|
|
2356
|
-
// Remove Content-Type if data is undefined
|
|
2357
|
-
requestData === undefined && requestHeaders.setContentType(null);
|
|
2358
|
-
|
|
2359
|
-
// Add headers to the request
|
|
2360
|
-
if ('setRequestHeader' in request) {
|
|
2361
|
-
utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
|
|
2362
|
-
request.setRequestHeader(key, val);
|
|
2363
|
-
});
|
|
2364
|
-
}
|
|
2365
|
-
|
|
2366
|
-
// Add withCredentials to request if needed
|
|
2367
|
-
if (!utils$1.isUndefined(config.withCredentials)) {
|
|
2368
|
-
request.withCredentials = !!config.withCredentials;
|
|
2369
|
-
}
|
|
2370
|
-
|
|
2371
|
-
// Add responseType to request if needed
|
|
2372
|
-
if (responseType && responseType !== 'json') {
|
|
2373
|
-
request.responseType = config.responseType;
|
|
2374
|
-
}
|
|
2375
|
-
|
|
2376
|
-
// Handle progress if needed
|
|
2377
|
-
if (typeof config.onDownloadProgress === 'function') {
|
|
2378
|
-
request.addEventListener('progress', progressEventReducer$1(config.onDownloadProgress, true));
|
|
2379
|
-
}
|
|
2380
|
-
|
|
2381
|
-
// Not all browsers support upload events
|
|
2382
|
-
if (typeof config.onUploadProgress === 'function' && request.upload) {
|
|
2383
|
-
request.upload.addEventListener('progress', progressEventReducer$1(config.onUploadProgress));
|
|
2384
|
-
}
|
|
2385
|
-
|
|
2386
|
-
if (config.cancelToken || config.signal) {
|
|
2387
|
-
// Handle cancellation
|
|
2388
|
-
// eslint-disable-next-line func-names
|
|
2389
|
-
onCanceled = cancel => {
|
|
2390
|
-
if (!request) {
|
|
2391
|
-
return;
|
|
2392
|
-
}
|
|
2393
|
-
reject(!cancel || cancel.type ? new CanceledError$1(null, config, request) : cancel);
|
|
2394
|
-
request.abort();
|
|
2395
|
-
request = null;
|
|
2396
|
-
};
|
|
2397
|
-
|
|
2398
|
-
config.cancelToken && config.cancelToken.subscribe(onCanceled);
|
|
2399
|
-
if (config.signal) {
|
|
2400
|
-
config.signal.aborted ? onCanceled() : config.signal.addEventListener('abort', onCanceled);
|
|
2401
|
-
}
|
|
2402
|
-
}
|
|
2403
|
-
|
|
2404
|
-
const protocol = parseProtocol$1(fullPath);
|
|
2405
|
-
|
|
2406
|
-
if (protocol && platform$1.protocols.indexOf(protocol) === -1) {
|
|
2407
|
-
reject(new AxiosError$1('Unsupported protocol ' + protocol + ':', AxiosError$1.ERR_BAD_REQUEST, config));
|
|
2408
|
-
return;
|
|
2409
|
-
}
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
// Send the request
|
|
2413
|
-
request.send(requestData || null);
|
|
2414
|
-
});
|
|
2415
|
-
};
|
|
2416
|
-
|
|
2417
|
-
const knownAdapters$1 = {
|
|
2418
|
-
http: httpAdapter$1,
|
|
2419
|
-
xhr: xhrAdapter$1
|
|
2420
|
-
};
|
|
2421
|
-
|
|
2422
|
-
utils$1.forEach(knownAdapters$1, (fn, value) => {
|
|
2423
|
-
if(fn) {
|
|
2424
|
-
try {
|
|
2425
|
-
Object.defineProperty(fn, 'name', {value});
|
|
2426
|
-
} catch (e) {
|
|
2427
|
-
// eslint-disable-next-line no-empty
|
|
2428
|
-
}
|
|
2429
|
-
Object.defineProperty(fn, 'adapterName', {value});
|
|
2430
|
-
}
|
|
2431
|
-
});
|
|
2432
|
-
|
|
2433
|
-
var adapters$1 = {
|
|
2434
|
-
getAdapter: (adapters) => {
|
|
2435
|
-
adapters = utils$1.isArray(adapters) ? adapters : [adapters];
|
|
2436
|
-
|
|
2437
|
-
const {length} = adapters;
|
|
2438
|
-
let nameOrAdapter;
|
|
2439
|
-
let adapter;
|
|
2440
|
-
|
|
2441
|
-
for (let i = 0; i < length; i++) {
|
|
2442
|
-
nameOrAdapter = adapters[i];
|
|
2443
|
-
if((adapter = utils$1.isString(nameOrAdapter) ? knownAdapters$1[nameOrAdapter.toLowerCase()] : nameOrAdapter)) {
|
|
2444
|
-
break;
|
|
2445
|
-
}
|
|
2446
|
-
}
|
|
2447
|
-
|
|
2448
|
-
if (!adapter) {
|
|
2449
|
-
if (adapter === false) {
|
|
2450
|
-
throw new AxiosError$1(
|
|
2451
|
-
`Adapter ${nameOrAdapter} is not supported by the environment`,
|
|
2452
|
-
'ERR_NOT_SUPPORT'
|
|
2453
|
-
);
|
|
2454
|
-
}
|
|
2455
|
-
|
|
2456
|
-
throw new Error(
|
|
2457
|
-
utils$1.hasOwnProp(knownAdapters$1, nameOrAdapter) ?
|
|
2458
|
-
`Adapter '${nameOrAdapter}' is not available in the build` :
|
|
2459
|
-
`Unknown adapter '${nameOrAdapter}'`
|
|
2460
|
-
);
|
|
2461
|
-
}
|
|
2462
|
-
|
|
2463
|
-
if (!utils$1.isFunction(adapter)) {
|
|
2464
|
-
throw new TypeError('adapter is not a function');
|
|
2465
|
-
}
|
|
2466
|
-
|
|
2467
|
-
return adapter;
|
|
2468
|
-
},
|
|
2469
|
-
adapters: knownAdapters$1
|
|
2470
|
-
};
|
|
2471
|
-
|
|
2472
|
-
/**
|
|
2473
|
-
* Throws a `CanceledError` if cancellation has been requested.
|
|
2474
|
-
*
|
|
2475
|
-
* @param {Object} config The config that is to be used for the request
|
|
2476
|
-
*
|
|
2477
|
-
* @returns {void}
|
|
2478
|
-
*/
|
|
2479
|
-
function throwIfCancellationRequested$1(config) {
|
|
2480
|
-
if (config.cancelToken) {
|
|
2481
|
-
config.cancelToken.throwIfRequested();
|
|
2482
|
-
}
|
|
2483
|
-
|
|
2484
|
-
if (config.signal && config.signal.aborted) {
|
|
2485
|
-
throw new CanceledError$1(null, config);
|
|
2486
|
-
}
|
|
2487
|
-
}
|
|
2488
|
-
|
|
2489
|
-
/**
|
|
2490
|
-
* Dispatch a request to the server using the configured adapter.
|
|
2491
|
-
*
|
|
2492
|
-
* @param {object} config The config that is to be used for the request
|
|
2493
|
-
*
|
|
2494
|
-
* @returns {Promise} The Promise to be fulfilled
|
|
2495
|
-
*/
|
|
2496
|
-
function dispatchRequest$1(config) {
|
|
2497
|
-
throwIfCancellationRequested$1(config);
|
|
2498
|
-
|
|
2499
|
-
config.headers = AxiosHeaders$1$1.from(config.headers);
|
|
2500
|
-
|
|
2501
|
-
// Transform request data
|
|
2502
|
-
config.data = transformData$1.call(
|
|
2503
|
-
config,
|
|
2504
|
-
config.transformRequest
|
|
2505
|
-
);
|
|
2506
|
-
|
|
2507
|
-
if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {
|
|
2508
|
-
config.headers.setContentType('application/x-www-form-urlencoded', false);
|
|
2509
|
-
}
|
|
2510
|
-
|
|
2511
|
-
const adapter = adapters$1.getAdapter(config.adapter || defaults$1$1.adapter);
|
|
2512
|
-
|
|
2513
|
-
return adapter(config).then(function onAdapterResolution(response) {
|
|
2514
|
-
throwIfCancellationRequested$1(config);
|
|
2515
|
-
|
|
2516
|
-
// Transform response data
|
|
2517
|
-
response.data = transformData$1.call(
|
|
2518
|
-
config,
|
|
2519
|
-
config.transformResponse,
|
|
2520
|
-
response
|
|
2521
|
-
);
|
|
2522
|
-
|
|
2523
|
-
response.headers = AxiosHeaders$1$1.from(response.headers);
|
|
2524
|
-
|
|
2525
|
-
return response;
|
|
2526
|
-
}, function onAdapterRejection(reason) {
|
|
2527
|
-
if (!isCancel$1(reason)) {
|
|
2528
|
-
throwIfCancellationRequested$1(config);
|
|
2529
|
-
|
|
2530
|
-
// Transform response data
|
|
2531
|
-
if (reason && reason.response) {
|
|
2532
|
-
reason.response.data = transformData$1.call(
|
|
2533
|
-
config,
|
|
2534
|
-
config.transformResponse,
|
|
2535
|
-
reason.response
|
|
2536
|
-
);
|
|
2537
|
-
reason.response.headers = AxiosHeaders$1$1.from(reason.response.headers);
|
|
2538
|
-
}
|
|
2539
|
-
}
|
|
2540
|
-
|
|
2541
|
-
return Promise.reject(reason);
|
|
2542
|
-
});
|
|
2543
|
-
}
|
|
2544
|
-
|
|
2545
|
-
const headersToObject$1 = (thing) => thing instanceof AxiosHeaders$1$1 ? thing.toJSON() : thing;
|
|
2546
|
-
|
|
2547
|
-
/**
|
|
2548
|
-
* Config-specific merge-function which creates a new config-object
|
|
2549
|
-
* by merging two configuration objects together.
|
|
2550
|
-
*
|
|
2551
|
-
* @param {Object} config1
|
|
2552
|
-
* @param {Object} config2
|
|
2553
|
-
*
|
|
2554
|
-
* @returns {Object} New object resulting from merging config2 to config1
|
|
2555
|
-
*/
|
|
2556
|
-
function mergeConfig$1(config1, config2) {
|
|
2557
|
-
// eslint-disable-next-line no-param-reassign
|
|
2558
|
-
config2 = config2 || {};
|
|
2559
|
-
const config = {};
|
|
2560
|
-
|
|
2561
|
-
function getMergedValue(target, source, caseless) {
|
|
2562
|
-
if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
|
|
2563
|
-
return utils$1.merge.call({caseless}, target, source);
|
|
2564
|
-
} else if (utils$1.isPlainObject(source)) {
|
|
2565
|
-
return utils$1.merge({}, source);
|
|
2566
|
-
} else if (utils$1.isArray(source)) {
|
|
2567
|
-
return source.slice();
|
|
2568
|
-
}
|
|
2569
|
-
return source;
|
|
2570
|
-
}
|
|
2571
|
-
|
|
2572
|
-
// eslint-disable-next-line consistent-return
|
|
2573
|
-
function mergeDeepProperties(a, b, caseless) {
|
|
2574
|
-
if (!utils$1.isUndefined(b)) {
|
|
2575
|
-
return getMergedValue(a, b, caseless);
|
|
2576
|
-
} else if (!utils$1.isUndefined(a)) {
|
|
2577
|
-
return getMergedValue(undefined, a, caseless);
|
|
2578
|
-
}
|
|
2579
|
-
}
|
|
2580
|
-
|
|
2581
|
-
// eslint-disable-next-line consistent-return
|
|
2582
|
-
function valueFromConfig2(a, b) {
|
|
2583
|
-
if (!utils$1.isUndefined(b)) {
|
|
2584
|
-
return getMergedValue(undefined, b);
|
|
2585
|
-
}
|
|
2586
|
-
}
|
|
2587
|
-
|
|
2588
|
-
// eslint-disable-next-line consistent-return
|
|
2589
|
-
function defaultToConfig2(a, b) {
|
|
2590
|
-
if (!utils$1.isUndefined(b)) {
|
|
2591
|
-
return getMergedValue(undefined, b);
|
|
2592
|
-
} else if (!utils$1.isUndefined(a)) {
|
|
2593
|
-
return getMergedValue(undefined, a);
|
|
2594
|
-
}
|
|
2595
|
-
}
|
|
2596
|
-
|
|
2597
|
-
// eslint-disable-next-line consistent-return
|
|
2598
|
-
function mergeDirectKeys(a, b, prop) {
|
|
2599
|
-
if (prop in config2) {
|
|
2600
|
-
return getMergedValue(a, b);
|
|
2601
|
-
} else if (prop in config1) {
|
|
2602
|
-
return getMergedValue(undefined, a);
|
|
2603
|
-
}
|
|
2604
|
-
}
|
|
2605
|
-
|
|
2606
|
-
const mergeMap = {
|
|
2607
|
-
url: valueFromConfig2,
|
|
2608
|
-
method: valueFromConfig2,
|
|
2609
|
-
data: valueFromConfig2,
|
|
2610
|
-
baseURL: defaultToConfig2,
|
|
2611
|
-
transformRequest: defaultToConfig2,
|
|
2612
|
-
transformResponse: defaultToConfig2,
|
|
2613
|
-
paramsSerializer: defaultToConfig2,
|
|
2614
|
-
timeout: defaultToConfig2,
|
|
2615
|
-
timeoutMessage: defaultToConfig2,
|
|
2616
|
-
withCredentials: defaultToConfig2,
|
|
2617
|
-
adapter: defaultToConfig2,
|
|
2618
|
-
responseType: defaultToConfig2,
|
|
2619
|
-
xsrfCookieName: defaultToConfig2,
|
|
2620
|
-
xsrfHeaderName: defaultToConfig2,
|
|
2621
|
-
onUploadProgress: defaultToConfig2,
|
|
2622
|
-
onDownloadProgress: defaultToConfig2,
|
|
2623
|
-
decompress: defaultToConfig2,
|
|
2624
|
-
maxContentLength: defaultToConfig2,
|
|
2625
|
-
maxBodyLength: defaultToConfig2,
|
|
2626
|
-
beforeRedirect: defaultToConfig2,
|
|
2627
|
-
transport: defaultToConfig2,
|
|
2628
|
-
httpAgent: defaultToConfig2,
|
|
2629
|
-
httpsAgent: defaultToConfig2,
|
|
2630
|
-
cancelToken: defaultToConfig2,
|
|
2631
|
-
socketPath: defaultToConfig2,
|
|
2632
|
-
responseEncoding: defaultToConfig2,
|
|
2633
|
-
validateStatus: mergeDirectKeys,
|
|
2634
|
-
headers: (a, b) => mergeDeepProperties(headersToObject$1(a), headersToObject$1(b), true)
|
|
2635
|
-
};
|
|
2636
|
-
|
|
2637
|
-
utils$1.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
|
|
2638
|
-
const merge = mergeMap[prop] || mergeDeepProperties;
|
|
2639
|
-
const configValue = merge(config1[prop], config2[prop], prop);
|
|
2640
|
-
(utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
|
2641
|
-
});
|
|
2642
|
-
|
|
2643
|
-
return config;
|
|
2644
|
-
}
|
|
2645
|
-
|
|
2646
|
-
const VERSION$1 = "1.4.0";
|
|
2647
|
-
|
|
2648
|
-
const validators$1$1 = {};
|
|
2649
|
-
|
|
2650
|
-
// eslint-disable-next-line func-names
|
|
2651
|
-
['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach((type, i) => {
|
|
2652
|
-
validators$1$1[type] = function validator(thing) {
|
|
2653
|
-
return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;
|
|
2654
|
-
};
|
|
2655
|
-
});
|
|
2656
|
-
|
|
2657
|
-
const deprecatedWarnings$1 = {};
|
|
2658
|
-
|
|
2659
|
-
/**
|
|
2660
|
-
* Transitional option validator
|
|
2661
|
-
*
|
|
2662
|
-
* @param {function|boolean?} validator - set to false if the transitional option has been removed
|
|
2663
|
-
* @param {string?} version - deprecated version / removed since version
|
|
2664
|
-
* @param {string?} message - some message with additional info
|
|
2665
|
-
*
|
|
2666
|
-
* @returns {function}
|
|
2667
|
-
*/
|
|
2668
|
-
validators$1$1.transitional = function transitional(validator, version, message) {
|
|
2669
|
-
function formatMessage(opt, desc) {
|
|
2670
|
-
return '[Axios v' + VERSION$1 + '] Transitional option \'' + opt + '\'' + desc + (message ? '. ' + message : '');
|
|
2671
|
-
}
|
|
2672
|
-
|
|
2673
|
-
// eslint-disable-next-line func-names
|
|
2674
|
-
return (value, opt, opts) => {
|
|
2675
|
-
if (validator === false) {
|
|
2676
|
-
throw new AxiosError$1(
|
|
2677
|
-
formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')),
|
|
2678
|
-
AxiosError$1.ERR_DEPRECATED
|
|
2679
|
-
);
|
|
2680
|
-
}
|
|
2681
|
-
|
|
2682
|
-
if (version && !deprecatedWarnings$1[opt]) {
|
|
2683
|
-
deprecatedWarnings$1[opt] = true;
|
|
2684
|
-
// eslint-disable-next-line no-console
|
|
2685
|
-
console.warn(
|
|
2686
|
-
formatMessage(
|
|
2687
|
-
opt,
|
|
2688
|
-
' has been deprecated since v' + version + ' and will be removed in the near future'
|
|
2689
|
-
)
|
|
2690
|
-
);
|
|
2691
|
-
}
|
|
2692
|
-
|
|
2693
|
-
return validator ? validator(value, opt, opts) : true;
|
|
2694
|
-
};
|
|
2695
|
-
};
|
|
2696
|
-
|
|
2697
|
-
/**
|
|
2698
|
-
* Assert object's properties type
|
|
2699
|
-
*
|
|
2700
|
-
* @param {object} options
|
|
2701
|
-
* @param {object} schema
|
|
2702
|
-
* @param {boolean?} allowUnknown
|
|
2703
|
-
*
|
|
2704
|
-
* @returns {object}
|
|
2705
|
-
*/
|
|
2706
|
-
|
|
2707
|
-
function assertOptions$1(options, schema, allowUnknown) {
|
|
2708
|
-
if (typeof options !== 'object') {
|
|
2709
|
-
throw new AxiosError$1('options must be an object', AxiosError$1.ERR_BAD_OPTION_VALUE);
|
|
2710
|
-
}
|
|
2711
|
-
const keys = Object.keys(options);
|
|
2712
|
-
let i = keys.length;
|
|
2713
|
-
while (i-- > 0) {
|
|
2714
|
-
const opt = keys[i];
|
|
2715
|
-
const validator = schema[opt];
|
|
2716
|
-
if (validator) {
|
|
2717
|
-
const value = options[opt];
|
|
2718
|
-
const result = value === undefined || validator(value, opt, options);
|
|
2719
|
-
if (result !== true) {
|
|
2720
|
-
throw new AxiosError$1('option ' + opt + ' must be ' + result, AxiosError$1.ERR_BAD_OPTION_VALUE);
|
|
2721
|
-
}
|
|
2722
|
-
continue;
|
|
2723
|
-
}
|
|
2724
|
-
if (allowUnknown !== true) {
|
|
2725
|
-
throw new AxiosError$1('Unknown option ' + opt, AxiosError$1.ERR_BAD_OPTION);
|
|
2726
|
-
}
|
|
2727
|
-
}
|
|
2728
|
-
}
|
|
2729
|
-
|
|
2730
|
-
var validator$1 = {
|
|
2731
|
-
assertOptions: assertOptions$1,
|
|
2732
|
-
validators: validators$1$1
|
|
2733
|
-
};
|
|
2734
|
-
|
|
2735
|
-
const validators$2 = validator$1.validators;
|
|
2736
|
-
|
|
2737
|
-
/**
|
|
2738
|
-
* Create a new instance of Axios
|
|
2739
|
-
*
|
|
2740
|
-
* @param {Object} instanceConfig The default config for the instance
|
|
2741
|
-
*
|
|
2742
|
-
* @return {Axios} A new instance of Axios
|
|
2743
|
-
*/
|
|
2744
|
-
let Axios$2 = class Axios {
|
|
2745
|
-
constructor(instanceConfig) {
|
|
2746
|
-
this.defaults = instanceConfig;
|
|
2747
|
-
this.interceptors = {
|
|
2748
|
-
request: new InterceptorManager$1$1(),
|
|
2749
|
-
response: new InterceptorManager$1$1()
|
|
2750
|
-
};
|
|
2751
|
-
}
|
|
2752
|
-
|
|
2753
|
-
/**
|
|
2754
|
-
* Dispatch a request
|
|
2755
|
-
*
|
|
2756
|
-
* @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
|
|
2757
|
-
* @param {?Object} config
|
|
2758
|
-
*
|
|
2759
|
-
* @returns {Promise} The Promise to be fulfilled
|
|
2760
|
-
*/
|
|
2761
|
-
request(configOrUrl, config) {
|
|
2762
|
-
/*eslint no-param-reassign:0*/
|
|
2763
|
-
// Allow for axios('example/url'[, config]) a la fetch API
|
|
2764
|
-
if (typeof configOrUrl === 'string') {
|
|
2765
|
-
config = config || {};
|
|
2766
|
-
config.url = configOrUrl;
|
|
2767
|
-
} else {
|
|
2768
|
-
config = configOrUrl || {};
|
|
2769
|
-
}
|
|
2770
|
-
|
|
2771
|
-
config = mergeConfig$1(this.defaults, config);
|
|
2772
|
-
|
|
2773
|
-
const {transitional, paramsSerializer, headers} = config;
|
|
2774
|
-
|
|
2775
|
-
if (transitional !== undefined) {
|
|
2776
|
-
validator$1.assertOptions(transitional, {
|
|
2777
|
-
silentJSONParsing: validators$2.transitional(validators$2.boolean),
|
|
2778
|
-
forcedJSONParsing: validators$2.transitional(validators$2.boolean),
|
|
2779
|
-
clarifyTimeoutError: validators$2.transitional(validators$2.boolean)
|
|
2780
|
-
}, false);
|
|
2781
|
-
}
|
|
2782
|
-
|
|
2783
|
-
if (paramsSerializer != null) {
|
|
2784
|
-
if (utils$1.isFunction(paramsSerializer)) {
|
|
2785
|
-
config.paramsSerializer = {
|
|
2786
|
-
serialize: paramsSerializer
|
|
2787
|
-
};
|
|
2788
|
-
} else {
|
|
2789
|
-
validator$1.assertOptions(paramsSerializer, {
|
|
2790
|
-
encode: validators$2.function,
|
|
2791
|
-
serialize: validators$2.function
|
|
2792
|
-
}, true);
|
|
2793
|
-
}
|
|
2794
|
-
}
|
|
2795
|
-
|
|
2796
|
-
// Set config.method
|
|
2797
|
-
config.method = (config.method || this.defaults.method || 'get').toLowerCase();
|
|
2798
|
-
|
|
2799
|
-
let contextHeaders;
|
|
2800
|
-
|
|
2801
|
-
// Flatten headers
|
|
2802
|
-
contextHeaders = headers && utils$1.merge(
|
|
2803
|
-
headers.common,
|
|
2804
|
-
headers[config.method]
|
|
2805
|
-
);
|
|
2806
|
-
|
|
2807
|
-
contextHeaders && utils$1.forEach(
|
|
2808
|
-
['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
|
|
2809
|
-
(method) => {
|
|
2810
|
-
delete headers[method];
|
|
2811
|
-
}
|
|
2812
|
-
);
|
|
2813
|
-
|
|
2814
|
-
config.headers = AxiosHeaders$1$1.concat(contextHeaders, headers);
|
|
2815
|
-
|
|
2816
|
-
// filter out skipped interceptors
|
|
2817
|
-
const requestInterceptorChain = [];
|
|
2818
|
-
let synchronousRequestInterceptors = true;
|
|
2819
|
-
this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
|
|
2820
|
-
if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {
|
|
2821
|
-
return;
|
|
2822
|
-
}
|
|
2823
|
-
|
|
2824
|
-
synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
|
|
2825
|
-
|
|
2826
|
-
requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
|
|
2827
|
-
});
|
|
2828
|
-
|
|
2829
|
-
const responseInterceptorChain = [];
|
|
2830
|
-
this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
|
|
2831
|
-
responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
|
|
2832
|
-
});
|
|
2833
|
-
|
|
2834
|
-
let promise;
|
|
2835
|
-
let i = 0;
|
|
2836
|
-
let len;
|
|
2837
|
-
|
|
2838
|
-
if (!synchronousRequestInterceptors) {
|
|
2839
|
-
const chain = [dispatchRequest$1.bind(this), undefined];
|
|
2840
|
-
chain.unshift.apply(chain, requestInterceptorChain);
|
|
2841
|
-
chain.push.apply(chain, responseInterceptorChain);
|
|
2842
|
-
len = chain.length;
|
|
2843
|
-
|
|
2844
|
-
promise = Promise.resolve(config);
|
|
2845
|
-
|
|
2846
|
-
while (i < len) {
|
|
2847
|
-
promise = promise.then(chain[i++], chain[i++]);
|
|
2848
|
-
}
|
|
2849
|
-
|
|
2850
|
-
return promise;
|
|
2851
|
-
}
|
|
2852
|
-
|
|
2853
|
-
len = requestInterceptorChain.length;
|
|
2854
|
-
|
|
2855
|
-
let newConfig = config;
|
|
2856
|
-
|
|
2857
|
-
i = 0;
|
|
2858
|
-
|
|
2859
|
-
while (i < len) {
|
|
2860
|
-
const onFulfilled = requestInterceptorChain[i++];
|
|
2861
|
-
const onRejected = requestInterceptorChain[i++];
|
|
2862
|
-
try {
|
|
2863
|
-
newConfig = onFulfilled(newConfig);
|
|
2864
|
-
} catch (error) {
|
|
2865
|
-
onRejected.call(this, error);
|
|
2866
|
-
break;
|
|
2867
|
-
}
|
|
2868
|
-
}
|
|
2869
|
-
|
|
2870
|
-
try {
|
|
2871
|
-
promise = dispatchRequest$1.call(this, newConfig);
|
|
2872
|
-
} catch (error) {
|
|
2873
|
-
return Promise.reject(error);
|
|
2874
|
-
}
|
|
2875
|
-
|
|
2876
|
-
i = 0;
|
|
2877
|
-
len = responseInterceptorChain.length;
|
|
2878
|
-
|
|
2879
|
-
while (i < len) {
|
|
2880
|
-
promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);
|
|
2881
|
-
}
|
|
2882
|
-
|
|
2883
|
-
return promise;
|
|
2884
|
-
}
|
|
2885
|
-
|
|
2886
|
-
getUri(config) {
|
|
2887
|
-
config = mergeConfig$1(this.defaults, config);
|
|
2888
|
-
const fullPath = buildFullPath$1(config.baseURL, config.url);
|
|
2889
|
-
return buildURL$1(fullPath, config.params, config.paramsSerializer);
|
|
2890
|
-
}
|
|
2891
|
-
};
|
|
2892
|
-
|
|
2893
|
-
// Provide aliases for supported request methods
|
|
2894
|
-
utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
|
|
2895
|
-
/*eslint func-names:0*/
|
|
2896
|
-
Axios$2.prototype[method] = function(url, config) {
|
|
2897
|
-
return this.request(mergeConfig$1(config || {}, {
|
|
2898
|
-
method,
|
|
2899
|
-
url,
|
|
2900
|
-
data: (config || {}).data
|
|
2901
|
-
}));
|
|
2902
|
-
};
|
|
2903
|
-
});
|
|
2904
|
-
|
|
2905
|
-
utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|
2906
|
-
/*eslint func-names:0*/
|
|
2907
|
-
|
|
2908
|
-
function generateHTTPMethod(isForm) {
|
|
2909
|
-
return function httpMethod(url, data, config) {
|
|
2910
|
-
return this.request(mergeConfig$1(config || {}, {
|
|
2911
|
-
method,
|
|
2912
|
-
headers: isForm ? {
|
|
2913
|
-
'Content-Type': 'multipart/form-data'
|
|
2914
|
-
} : {},
|
|
2915
|
-
url,
|
|
2916
|
-
data
|
|
2917
|
-
}));
|
|
2918
|
-
};
|
|
2919
|
-
}
|
|
2920
|
-
|
|
2921
|
-
Axios$2.prototype[method] = generateHTTPMethod();
|
|
2922
|
-
|
|
2923
|
-
Axios$2.prototype[method + 'Form'] = generateHTTPMethod(true);
|
|
2924
|
-
});
|
|
2925
|
-
|
|
2926
|
-
var Axios$1$1 = Axios$2;
|
|
2927
|
-
|
|
2928
|
-
/**
|
|
2929
|
-
* A `CancelToken` is an object that can be used to request cancellation of an operation.
|
|
2930
|
-
*
|
|
2931
|
-
* @param {Function} executor The executor function.
|
|
2932
|
-
*
|
|
2933
|
-
* @returns {CancelToken}
|
|
2934
|
-
*/
|
|
2935
|
-
let CancelToken$2 = class CancelToken {
|
|
2936
|
-
constructor(executor) {
|
|
2937
|
-
if (typeof executor !== 'function') {
|
|
2938
|
-
throw new TypeError('executor must be a function.');
|
|
2939
|
-
}
|
|
2940
|
-
|
|
2941
|
-
let resolvePromise;
|
|
2942
|
-
|
|
2943
|
-
this.promise = new Promise(function promiseExecutor(resolve) {
|
|
2944
|
-
resolvePromise = resolve;
|
|
2945
|
-
});
|
|
2946
|
-
|
|
2947
|
-
const token = this;
|
|
2948
|
-
|
|
2949
|
-
// eslint-disable-next-line func-names
|
|
2950
|
-
this.promise.then(cancel => {
|
|
2951
|
-
if (!token._listeners) return;
|
|
2952
|
-
|
|
2953
|
-
let i = token._listeners.length;
|
|
2954
|
-
|
|
2955
|
-
while (i-- > 0) {
|
|
2956
|
-
token._listeners[i](cancel);
|
|
2957
|
-
}
|
|
2958
|
-
token._listeners = null;
|
|
2959
|
-
});
|
|
2960
|
-
|
|
2961
|
-
// eslint-disable-next-line func-names
|
|
2962
|
-
this.promise.then = onfulfilled => {
|
|
2963
|
-
let _resolve;
|
|
2964
|
-
// eslint-disable-next-line func-names
|
|
2965
|
-
const promise = new Promise(resolve => {
|
|
2966
|
-
token.subscribe(resolve);
|
|
2967
|
-
_resolve = resolve;
|
|
2968
|
-
}).then(onfulfilled);
|
|
2969
|
-
|
|
2970
|
-
promise.cancel = function reject() {
|
|
2971
|
-
token.unsubscribe(_resolve);
|
|
2972
|
-
};
|
|
2973
|
-
|
|
2974
|
-
return promise;
|
|
2975
|
-
};
|
|
2976
|
-
|
|
2977
|
-
executor(function cancel(message, config, request) {
|
|
2978
|
-
if (token.reason) {
|
|
2979
|
-
// Cancellation has already been requested
|
|
2980
|
-
return;
|
|
2981
|
-
}
|
|
2982
|
-
|
|
2983
|
-
token.reason = new CanceledError$1(message, config, request);
|
|
2984
|
-
resolvePromise(token.reason);
|
|
2985
|
-
});
|
|
2986
|
-
}
|
|
2987
|
-
|
|
2988
|
-
/**
|
|
2989
|
-
* Throws a `CanceledError` if cancellation has been requested.
|
|
2990
|
-
*/
|
|
2991
|
-
throwIfRequested() {
|
|
2992
|
-
if (this.reason) {
|
|
2993
|
-
throw this.reason;
|
|
2994
|
-
}
|
|
2995
|
-
}
|
|
2996
|
-
|
|
2997
|
-
/**
|
|
2998
|
-
* Subscribe to the cancel signal
|
|
2999
|
-
*/
|
|
3000
|
-
|
|
3001
|
-
subscribe(listener) {
|
|
3002
|
-
if (this.reason) {
|
|
3003
|
-
listener(this.reason);
|
|
3004
|
-
return;
|
|
3005
|
-
}
|
|
3006
|
-
|
|
3007
|
-
if (this._listeners) {
|
|
3008
|
-
this._listeners.push(listener);
|
|
3009
|
-
} else {
|
|
3010
|
-
this._listeners = [listener];
|
|
3011
|
-
}
|
|
3012
|
-
}
|
|
3013
|
-
|
|
3014
|
-
/**
|
|
3015
|
-
* Unsubscribe from the cancel signal
|
|
3016
|
-
*/
|
|
3017
|
-
|
|
3018
|
-
unsubscribe(listener) {
|
|
3019
|
-
if (!this._listeners) {
|
|
3020
|
-
return;
|
|
3021
|
-
}
|
|
3022
|
-
const index = this._listeners.indexOf(listener);
|
|
3023
|
-
if (index !== -1) {
|
|
3024
|
-
this._listeners.splice(index, 1);
|
|
3025
|
-
}
|
|
3026
|
-
}
|
|
3027
|
-
|
|
3028
|
-
/**
|
|
3029
|
-
* Returns an object that contains a new `CancelToken` and a function that, when called,
|
|
3030
|
-
* cancels the `CancelToken`.
|
|
3031
|
-
*/
|
|
3032
|
-
static source() {
|
|
3033
|
-
let cancel;
|
|
3034
|
-
const token = new CancelToken(function executor(c) {
|
|
3035
|
-
cancel = c;
|
|
3036
|
-
});
|
|
3037
|
-
return {
|
|
3038
|
-
token,
|
|
3039
|
-
cancel
|
|
3040
|
-
};
|
|
3041
|
-
}
|
|
3042
|
-
};
|
|
3043
|
-
|
|
3044
|
-
var CancelToken$1$1 = CancelToken$2;
|
|
3045
|
-
|
|
3046
|
-
/**
|
|
3047
|
-
* Syntactic sugar for invoking a function and expanding an array for arguments.
|
|
3048
|
-
*
|
|
3049
|
-
* Common use case would be to use `Function.prototype.apply`.
|
|
3050
|
-
*
|
|
3051
|
-
* ```js
|
|
3052
|
-
* function f(x, y, z) {}
|
|
3053
|
-
* var args = [1, 2, 3];
|
|
3054
|
-
* f.apply(null, args);
|
|
3055
|
-
* ```
|
|
3056
|
-
*
|
|
3057
|
-
* With `spread` this example can be re-written.
|
|
3058
|
-
*
|
|
3059
|
-
* ```js
|
|
3060
|
-
* spread(function(x, y, z) {})([1, 2, 3]);
|
|
3061
|
-
* ```
|
|
3062
|
-
*
|
|
3063
|
-
* @param {Function} callback
|
|
3064
|
-
*
|
|
3065
|
-
* @returns {Function}
|
|
3066
|
-
*/
|
|
3067
|
-
function spread$1(callback) {
|
|
3068
|
-
return function wrap(arr) {
|
|
3069
|
-
return callback.apply(null, arr);
|
|
3070
|
-
};
|
|
3071
|
-
}
|
|
3072
|
-
|
|
3073
|
-
/**
|
|
3074
|
-
* Determines whether the payload is an error thrown by Axios
|
|
3075
|
-
*
|
|
3076
|
-
* @param {*} payload The value to test
|
|
3077
|
-
*
|
|
3078
|
-
* @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
|
|
3079
|
-
*/
|
|
3080
|
-
function isAxiosError$1(payload) {
|
|
3081
|
-
return utils$1.isObject(payload) && (payload.isAxiosError === true);
|
|
3082
|
-
}
|
|
3083
|
-
|
|
3084
|
-
const HttpStatusCode$2 = {
|
|
3085
|
-
Continue: 100,
|
|
3086
|
-
SwitchingProtocols: 101,
|
|
3087
|
-
Processing: 102,
|
|
3088
|
-
EarlyHints: 103,
|
|
3089
|
-
Ok: 200,
|
|
3090
|
-
Created: 201,
|
|
3091
|
-
Accepted: 202,
|
|
3092
|
-
NonAuthoritativeInformation: 203,
|
|
3093
|
-
NoContent: 204,
|
|
3094
|
-
ResetContent: 205,
|
|
3095
|
-
PartialContent: 206,
|
|
3096
|
-
MultiStatus: 207,
|
|
3097
|
-
AlreadyReported: 208,
|
|
3098
|
-
ImUsed: 226,
|
|
3099
|
-
MultipleChoices: 300,
|
|
3100
|
-
MovedPermanently: 301,
|
|
3101
|
-
Found: 302,
|
|
3102
|
-
SeeOther: 303,
|
|
3103
|
-
NotModified: 304,
|
|
3104
|
-
UseProxy: 305,
|
|
3105
|
-
Unused: 306,
|
|
3106
|
-
TemporaryRedirect: 307,
|
|
3107
|
-
PermanentRedirect: 308,
|
|
3108
|
-
BadRequest: 400,
|
|
3109
|
-
Unauthorized: 401,
|
|
3110
|
-
PaymentRequired: 402,
|
|
3111
|
-
Forbidden: 403,
|
|
3112
|
-
NotFound: 404,
|
|
3113
|
-
MethodNotAllowed: 405,
|
|
3114
|
-
NotAcceptable: 406,
|
|
3115
|
-
ProxyAuthenticationRequired: 407,
|
|
3116
|
-
RequestTimeout: 408,
|
|
3117
|
-
Conflict: 409,
|
|
3118
|
-
Gone: 410,
|
|
3119
|
-
LengthRequired: 411,
|
|
3120
|
-
PreconditionFailed: 412,
|
|
3121
|
-
PayloadTooLarge: 413,
|
|
3122
|
-
UriTooLong: 414,
|
|
3123
|
-
UnsupportedMediaType: 415,
|
|
3124
|
-
RangeNotSatisfiable: 416,
|
|
3125
|
-
ExpectationFailed: 417,
|
|
3126
|
-
ImATeapot: 418,
|
|
3127
|
-
MisdirectedRequest: 421,
|
|
3128
|
-
UnprocessableEntity: 422,
|
|
3129
|
-
Locked: 423,
|
|
3130
|
-
FailedDependency: 424,
|
|
3131
|
-
TooEarly: 425,
|
|
3132
|
-
UpgradeRequired: 426,
|
|
3133
|
-
PreconditionRequired: 428,
|
|
3134
|
-
TooManyRequests: 429,
|
|
3135
|
-
RequestHeaderFieldsTooLarge: 431,
|
|
3136
|
-
UnavailableForLegalReasons: 451,
|
|
3137
|
-
InternalServerError: 500,
|
|
3138
|
-
NotImplemented: 501,
|
|
3139
|
-
BadGateway: 502,
|
|
3140
|
-
ServiceUnavailable: 503,
|
|
3141
|
-
GatewayTimeout: 504,
|
|
3142
|
-
HttpVersionNotSupported: 505,
|
|
3143
|
-
VariantAlsoNegotiates: 506,
|
|
3144
|
-
InsufficientStorage: 507,
|
|
3145
|
-
LoopDetected: 508,
|
|
3146
|
-
NotExtended: 510,
|
|
3147
|
-
NetworkAuthenticationRequired: 511,
|
|
3148
|
-
};
|
|
3149
|
-
|
|
3150
|
-
Object.entries(HttpStatusCode$2).forEach(([key, value]) => {
|
|
3151
|
-
HttpStatusCode$2[value] = key;
|
|
3152
|
-
});
|
|
3153
|
-
|
|
3154
|
-
var HttpStatusCode$1$1 = HttpStatusCode$2;
|
|
3155
|
-
|
|
3156
|
-
/**
|
|
3157
|
-
* Create an instance of Axios
|
|
3158
|
-
*
|
|
3159
|
-
* @param {Object} defaultConfig The default config for the instance
|
|
3160
|
-
*
|
|
3161
|
-
* @returns {Axios} A new instance of Axios
|
|
3162
|
-
*/
|
|
3163
|
-
function createInstance$1(defaultConfig) {
|
|
3164
|
-
const context = new Axios$1$1(defaultConfig);
|
|
3165
|
-
const instance = bind$1(Axios$1$1.prototype.request, context);
|
|
3166
|
-
|
|
3167
|
-
// Copy axios.prototype to instance
|
|
3168
|
-
utils$1.extend(instance, Axios$1$1.prototype, context, {allOwnKeys: true});
|
|
3169
|
-
|
|
3170
|
-
// Copy context to instance
|
|
3171
|
-
utils$1.extend(instance, context, null, {allOwnKeys: true});
|
|
3172
|
-
|
|
3173
|
-
// Factory for creating new instances
|
|
3174
|
-
instance.create = function create(instanceConfig) {
|
|
3175
|
-
return createInstance$1(mergeConfig$1(defaultConfig, instanceConfig));
|
|
3176
|
-
};
|
|
3177
|
-
|
|
3178
|
-
return instance;
|
|
3179
|
-
}
|
|
3180
|
-
|
|
3181
|
-
// Create the default instance to be exported
|
|
3182
|
-
const axios$1 = createInstance$1(defaults$1$1);
|
|
3183
|
-
|
|
3184
|
-
// Expose Axios class to allow class inheritance
|
|
3185
|
-
axios$1.Axios = Axios$1$1;
|
|
3186
|
-
|
|
3187
|
-
// Expose Cancel & CancelToken
|
|
3188
|
-
axios$1.CanceledError = CanceledError$1;
|
|
3189
|
-
axios$1.CancelToken = CancelToken$1$1;
|
|
3190
|
-
axios$1.isCancel = isCancel$1;
|
|
3191
|
-
axios$1.VERSION = VERSION$1;
|
|
3192
|
-
axios$1.toFormData = toFormData$1;
|
|
3193
|
-
|
|
3194
|
-
// Expose AxiosError class
|
|
3195
|
-
axios$1.AxiosError = AxiosError$1;
|
|
3196
|
-
|
|
3197
|
-
// alias for CanceledError for backward compatibility
|
|
3198
|
-
axios$1.Cancel = axios$1.CanceledError;
|
|
3199
|
-
|
|
3200
|
-
// Expose all/spread
|
|
3201
|
-
axios$1.all = function all(promises) {
|
|
3202
|
-
return Promise.all(promises);
|
|
3203
|
-
};
|
|
3204
|
-
|
|
3205
|
-
axios$1.spread = spread$1;
|
|
3206
|
-
|
|
3207
|
-
// Expose isAxiosError
|
|
3208
|
-
axios$1.isAxiosError = isAxiosError$1;
|
|
3209
|
-
|
|
3210
|
-
// Expose mergeConfig
|
|
3211
|
-
axios$1.mergeConfig = mergeConfig$1;
|
|
3212
|
-
|
|
3213
|
-
axios$1.AxiosHeaders = AxiosHeaders$1$1;
|
|
3214
|
-
|
|
3215
|
-
axios$1.formToJSON = thing => formDataToJSON$1(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
|
|
3216
|
-
|
|
3217
|
-
axios$1.HttpStatusCode = HttpStatusCode$1$1;
|
|
3218
|
-
|
|
3219
|
-
axios$1.default = axios$1;
|
|
3220
|
-
|
|
3221
|
-
// this module should only have a default export
|
|
3222
|
-
var globalAxios$1 = axios$1;
|
|
3223
|
-
|
|
3224
16
|
/* tslint:disable */
|
|
3225
17
|
/* eslint-disable */
|
|
3226
18
|
/**
|
|
@@ -3312,7 +104,7 @@ let Configuration$1 = class Configuration {
|
|
|
3312
104
|
/* tslint:disable */
|
|
3313
105
|
/* eslint-disable */
|
|
3314
106
|
/**
|
|
3315
|
-
* Immutable
|
|
107
|
+
* Immutable zkEVM API
|
|
3316
108
|
* Immutable Multi Rollup API
|
|
3317
109
|
*
|
|
3318
110
|
* The version of the OpenAPI document: 1.0.0
|
|
@@ -3324,7 +116,7 @@ let Configuration$1 = class Configuration {
|
|
|
3324
116
|
*/
|
|
3325
117
|
// Some imports not used depending on template conditions
|
|
3326
118
|
// @ts-ignore
|
|
3327
|
-
const BASE_PATH$1 = "https://
|
|
119
|
+
const BASE_PATH$1 = "https://api.sandbox.immutable.com".replace(/\/+$/, "");
|
|
3328
120
|
/**
|
|
3329
121
|
*
|
|
3330
122
|
* @export
|
|
@@ -3361,7 +153,7 @@ let RequiredError$1 = class RequiredError extends Error {
|
|
|
3361
153
|
/* tslint:disable */
|
|
3362
154
|
/* eslint-disable */
|
|
3363
155
|
/**
|
|
3364
|
-
* Immutable
|
|
156
|
+
* Immutable zkEVM API
|
|
3365
157
|
* Immutable Multi Rollup API
|
|
3366
158
|
*
|
|
3367
159
|
* The version of the OpenAPI document: 1.0.0
|
|
@@ -3459,7 +251,7 @@ const createRequestFunction$1 = function (axiosArgs, globalAxios, BASE_PATH, con
|
|
|
3459
251
|
/* tslint:disable */
|
|
3460
252
|
/* eslint-disable */
|
|
3461
253
|
/**
|
|
3462
|
-
* Immutable
|
|
254
|
+
* Immutable zkEVM API
|
|
3463
255
|
* Immutable Multi Rollup API
|
|
3464
256
|
*
|
|
3465
257
|
* The version of the OpenAPI document: 1.0.0
|
|
@@ -3654,7 +446,7 @@ class ActivitiesApi extends BaseAPI$1 {
|
|
|
3654
446
|
/* tslint:disable */
|
|
3655
447
|
/* eslint-disable */
|
|
3656
448
|
/**
|
|
3657
|
-
* Immutable
|
|
449
|
+
* Immutable zkEVM API
|
|
3658
450
|
* Immutable Multi Rollup API
|
|
3659
451
|
*
|
|
3660
452
|
* The version of the OpenAPI document: 1.0.0
|
|
@@ -3749,7 +541,7 @@ class ChainsApi extends BaseAPI$1 {
|
|
|
3749
541
|
/* tslint:disable */
|
|
3750
542
|
/* eslint-disable */
|
|
3751
543
|
/**
|
|
3752
|
-
* Immutable
|
|
544
|
+
* Immutable zkEVM API
|
|
3753
545
|
* Immutable Multi Rollup API
|
|
3754
546
|
*
|
|
3755
547
|
* The version of the OpenAPI document: 1.0.0
|
|
@@ -3905,7 +697,7 @@ class CollectionsApi extends BaseAPI$1 {
|
|
|
3905
697
|
/* tslint:disable */
|
|
3906
698
|
/* eslint-disable */
|
|
3907
699
|
/**
|
|
3908
|
-
* Immutable
|
|
700
|
+
* Immutable zkEVM API
|
|
3909
701
|
* Immutable Multi Rollup API
|
|
3910
702
|
*
|
|
3911
703
|
* The version of the OpenAPI document: 1.0.0
|
|
@@ -4015,7 +807,7 @@ class NftOwnersApi extends BaseAPI$1 {
|
|
|
4015
807
|
/* tslint:disable */
|
|
4016
808
|
/* eslint-disable */
|
|
4017
809
|
/**
|
|
4018
|
-
* Immutable
|
|
810
|
+
* Immutable zkEVM API
|
|
4019
811
|
* Immutable Multi Rollup API
|
|
4020
812
|
*
|
|
4021
813
|
* The version of the OpenAPI document: 1.0.0
|
|
@@ -4252,7 +1044,7 @@ class NftsApi extends BaseAPI$1 {
|
|
|
4252
1044
|
/* tslint:disable */
|
|
4253
1045
|
/* eslint-disable */
|
|
4254
1046
|
/**
|
|
4255
|
-
* Immutable
|
|
1047
|
+
* Immutable zkEVM API
|
|
4256
1048
|
* Immutable Multi Rollup API
|
|
4257
1049
|
*
|
|
4258
1050
|
* The version of the OpenAPI document: 1.0.0
|
|
@@ -4302,6 +1094,40 @@ const OrdersApiAxiosParamCreator = function (configuration) {
|
|
|
4302
1094
|
options: localVarRequestOptions,
|
|
4303
1095
|
};
|
|
4304
1096
|
},
|
|
1097
|
+
/**
|
|
1098
|
+
* Retrieve signed fulfillment data based on the list of order IDs and corresponding fees.
|
|
1099
|
+
* @summary Retrieve fulfillment data for orders
|
|
1100
|
+
* @param {string} chainName
|
|
1101
|
+
* @param {Array<FulfillmentDataRequestInner>} fulfillmentDataRequestInner
|
|
1102
|
+
* @param {*} [options] Override http request option.
|
|
1103
|
+
* @throws {RequiredError}
|
|
1104
|
+
*/
|
|
1105
|
+
fulfillmentData: async (chainName, fulfillmentDataRequestInner, options = {}) => {
|
|
1106
|
+
// verify required parameter 'chainName' is not null or undefined
|
|
1107
|
+
assertParamExists$1('fulfillmentData', 'chainName', chainName);
|
|
1108
|
+
// verify required parameter 'fulfillmentDataRequestInner' is not null or undefined
|
|
1109
|
+
assertParamExists$1('fulfillmentData', 'fulfillmentDataRequestInner', fulfillmentDataRequestInner);
|
|
1110
|
+
const localVarPath = `/v1/chains/{chain_name}/orders/fulfillment_data`
|
|
1111
|
+
.replace(`{${"chain_name"}}`, encodeURIComponent(String(chainName)));
|
|
1112
|
+
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
|
1113
|
+
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL$1);
|
|
1114
|
+
let baseOptions;
|
|
1115
|
+
if (configuration) {
|
|
1116
|
+
baseOptions = configuration.baseOptions;
|
|
1117
|
+
}
|
|
1118
|
+
const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
|
|
1119
|
+
const localVarHeaderParameter = {};
|
|
1120
|
+
const localVarQueryParameter = {};
|
|
1121
|
+
localVarHeaderParameter['Content-Type'] = 'application/json';
|
|
1122
|
+
setSearchParams$1(localVarUrlObj, localVarQueryParameter);
|
|
1123
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
1124
|
+
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
1125
|
+
localVarRequestOptions.data = serializeDataIfNeeded$1(fulfillmentDataRequestInner, localVarRequestOptions, configuration);
|
|
1126
|
+
return {
|
|
1127
|
+
url: toPathString$1(localVarUrlObj),
|
|
1128
|
+
options: localVarRequestOptions,
|
|
1129
|
+
};
|
|
1130
|
+
},
|
|
4305
1131
|
/**
|
|
4306
1132
|
* Get a single listing by ID
|
|
4307
1133
|
* @summary Get a single listing by ID
|
|
@@ -4417,6 +1243,18 @@ const OrdersApiFp = function (configuration) {
|
|
|
4417
1243
|
const localVarAxiosArgs = await localVarAxiosParamCreator.createListing(chainName, createListingRequestBody, options);
|
|
4418
1244
|
return createRequestFunction$1(localVarAxiosArgs, globalAxios$1, BASE_PATH$1, configuration);
|
|
4419
1245
|
},
|
|
1246
|
+
/**
|
|
1247
|
+
* Retrieve signed fulfillment data based on the list of order IDs and corresponding fees.
|
|
1248
|
+
* @summary Retrieve fulfillment data for orders
|
|
1249
|
+
* @param {string} chainName
|
|
1250
|
+
* @param {Array<FulfillmentDataRequestInner>} fulfillmentDataRequestInner
|
|
1251
|
+
* @param {*} [options] Override http request option.
|
|
1252
|
+
* @throws {RequiredError}
|
|
1253
|
+
*/
|
|
1254
|
+
async fulfillmentData(chainName, fulfillmentDataRequestInner, options) {
|
|
1255
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.fulfillmentData(chainName, fulfillmentDataRequestInner, options);
|
|
1256
|
+
return createRequestFunction$1(localVarAxiosArgs, globalAxios$1, BASE_PATH$1, configuration);
|
|
1257
|
+
},
|
|
4420
1258
|
/**
|
|
4421
1259
|
* Get a single listing by ID
|
|
4422
1260
|
* @summary Get a single listing by ID
|
|
@@ -4468,6 +1306,17 @@ class OrdersApi extends BaseAPI$1 {
|
|
|
4468
1306
|
createListing(requestParameters, options) {
|
|
4469
1307
|
return OrdersApiFp(this.configuration).createListing(requestParameters.chainName, requestParameters.createListingRequestBody, options).then((request) => request(this.axios, this.basePath));
|
|
4470
1308
|
}
|
|
1309
|
+
/**
|
|
1310
|
+
* Retrieve signed fulfillment data based on the list of order IDs and corresponding fees.
|
|
1311
|
+
* @summary Retrieve fulfillment data for orders
|
|
1312
|
+
* @param {OrdersApiFulfillmentDataRequest} requestParameters Request parameters.
|
|
1313
|
+
* @param {*} [options] Override http request option.
|
|
1314
|
+
* @throws {RequiredError}
|
|
1315
|
+
* @memberof OrdersApi
|
|
1316
|
+
*/
|
|
1317
|
+
fulfillmentData(requestParameters, options) {
|
|
1318
|
+
return OrdersApiFp(this.configuration).fulfillmentData(requestParameters.chainName, requestParameters.fulfillmentDataRequestInner, options).then((request) => request(this.axios, this.basePath));
|
|
1319
|
+
}
|
|
4471
1320
|
/**
|
|
4472
1321
|
* Get a single listing by ID
|
|
4473
1322
|
* @summary Get a single listing by ID
|
|
@@ -4495,7 +1344,7 @@ class OrdersApi extends BaseAPI$1 {
|
|
|
4495
1344
|
/* tslint:disable */
|
|
4496
1345
|
/* eslint-disable */
|
|
4497
1346
|
/**
|
|
4498
|
-
* Immutable
|
|
1347
|
+
* Immutable zkEVM API
|
|
4499
1348
|
* Immutable Multi Rollup API
|
|
4500
1349
|
*
|
|
4501
1350
|
* The version of the OpenAPI document: 1.0.0
|
|
@@ -4608,7 +1457,7 @@ class MultiRollupApiClients {
|
|
|
4608
1457
|
}
|
|
4609
1458
|
|
|
4610
1459
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
4611
|
-
const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-0.
|
|
1460
|
+
const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-0.4.4-alpha.1' };
|
|
4612
1461
|
const createConfig = ({ basePath, headers, }) => {
|
|
4613
1462
|
if (!basePath.trim()) {
|
|
4614
1463
|
throw Error('basePath can not be empty');
|
|
@@ -4638,10 +1487,10 @@ const multiRollupConfig = {
|
|
|
4638
1487
|
}),
|
|
4639
1488
|
getSandbox: () => ({
|
|
4640
1489
|
indexer: createConfig({
|
|
4641
|
-
basePath: 'https://
|
|
1490
|
+
basePath: 'https://api.sandbox.immutable.com',
|
|
4642
1491
|
}),
|
|
4643
1492
|
orderBook: createConfig({
|
|
4644
|
-
basePath: 'https://
|
|
1493
|
+
basePath: 'https://api.sandbox.immutable.com',
|
|
4645
1494
|
}),
|
|
4646
1495
|
passport: createConfig({
|
|
4647
1496
|
basePath: 'https://api.sandbox.immutable.com',
|
|
@@ -4664,7 +1513,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
4664
1513
|
chainID,
|
|
4665
1514
|
coreContractAddress,
|
|
4666
1515
|
registrationContractAddress,
|
|
4667
|
-
sdkVersion: 'ts-immutable-sdk-0.
|
|
1516
|
+
sdkVersion: 'ts-immutable-sdk-0.4.4-alpha.1',
|
|
4668
1517
|
});
|
|
4669
1518
|
/**
|
|
4670
1519
|
* Sets `sdkVersion` at the time of build
|
|
@@ -9115,7 +5964,7 @@ class AuthManager {
|
|
|
9115
5964
|
}
|
|
9116
5965
|
async loginWithDeviceFlow() {
|
|
9117
5966
|
return withPassportError(async () => {
|
|
9118
|
-
const response = await
|
|
5967
|
+
const response = await globalAxios$1.post(`${this.config.authenticationDomain}/oauth/device/code`, {
|
|
9119
5968
|
client_id: this.config.oidcConfiguration.clientId,
|
|
9120
5969
|
scope: this.config.oidcConfiguration.scope,
|
|
9121
5970
|
audience: this.config.oidcConfiguration.audience,
|
|
@@ -9148,7 +5997,7 @@ class AuthManager {
|
|
|
9148
5997
|
return user;
|
|
9149
5998
|
}
|
|
9150
5999
|
catch (error) {
|
|
9151
|
-
if (
|
|
6000
|
+
if (globalAxios$1.isAxiosError(error)) {
|
|
9152
6001
|
const responseError = error.response?.data;
|
|
9153
6002
|
switch (responseError.error) {
|
|
9154
6003
|
case 'authorization_pending':
|
|
@@ -9173,7 +6022,7 @@ class AuthManager {
|
|
|
9173
6022
|
}
|
|
9174
6023
|
/* eslint-enable no-await-in-loop */
|
|
9175
6024
|
async getDeviceFlowToken(deviceCode) {
|
|
9176
|
-
const response = await
|
|
6025
|
+
const response = await globalAxios$1.post(`${this.config.authenticationDomain}/oauth/token`, {
|
|
9177
6026
|
client_id: this.config.oidcConfiguration.clientId,
|
|
9178
6027
|
grant_type: 'urn:ietf:params:oauth:grant-type:device_code',
|
|
9179
6028
|
device_code: deviceCode,
|
|
@@ -9224,7 +6073,7 @@ class AuthManager {
|
|
|
9224
6073
|
}, PassportErrorType.AUTHENTICATION_ERROR);
|
|
9225
6074
|
}
|
|
9226
6075
|
async getPKCEToken(authorizationCode, codeVerifier) {
|
|
9227
|
-
const response = await
|
|
6076
|
+
const response = await globalAxios$1.post(`${this.config.authenticationDomain}/oauth/token`, {
|
|
9228
6077
|
client_id: this.config.oidcConfiguration.clientId,
|
|
9229
6078
|
grant_type: 'authorization_code',
|
|
9230
6079
|
code_verifier: codeVerifier,
|
|
@@ -9249,7 +6098,7 @@ class AuthManager {
|
|
|
9249
6098
|
}, PassportErrorType.AUTHENTICATION_ERROR);
|
|
9250
6099
|
}
|
|
9251
6100
|
async refreshToken(refreshToken) {
|
|
9252
|
-
const response = await
|
|
6101
|
+
const response = await globalAxios$1.post(`${this.config.authenticationDomain}/oauth/token`, {
|
|
9253
6102
|
client_id: this.config.oidcConfiguration.clientId,
|
|
9254
6103
|
grant_type: 'refresh_token',
|
|
9255
6104
|
refresh_token: refreshToken,
|
|
@@ -9400,7 +6249,7 @@ const transformGuardianTransactions = (txs) => {
|
|
|
9400
6249
|
gasLimit: t.gasLimit ? convertBigNumberishToString(t.gasLimit) : '0',
|
|
9401
6250
|
target: t.to ?? ethers.constants.AddressZero,
|
|
9402
6251
|
value: t.value ? convertBigNumberishToString(t.value) : '0',
|
|
9403
|
-
data: t.data ? t.data.toString() : '
|
|
6252
|
+
data: t.data ? t.data.toString() : '0x',
|
|
9404
6253
|
}));
|
|
9405
6254
|
}
|
|
9406
6255
|
catch (error) {
|
|
@@ -9411,6 +6260,7 @@ const transformGuardianTransactions = (txs) => {
|
|
|
9411
6260
|
class GuardianClient {
|
|
9412
6261
|
transactionAPI;
|
|
9413
6262
|
confirmationScreen;
|
|
6263
|
+
// TODO: ID-977, make this rollup agnostic
|
|
9414
6264
|
imxEtherAddress;
|
|
9415
6265
|
constructor({ imxPublicApiDomain, accessToken, confirmationScreen, imxEtherAddress, }) {
|
|
9416
6266
|
this.confirmationScreen = confirmationScreen;
|
|
@@ -10086,8 +6936,8 @@ class PassportConfiguration {
|
|
|
10086
6936
|
this.magicProviderId = 'fSMzaRQ4O7p4fttl7pCyGVtJS_G70P8SNsLXtPPGHo0=';
|
|
10087
6937
|
this.passportDomain = 'https://passport.sandbox.immutable.com';
|
|
10088
6938
|
this.imxPublicApiDomain = 'https://api.sandbox.immutable.com';
|
|
10089
|
-
this.zkEvmRpcUrl = 'https://
|
|
10090
|
-
this.zkEvmChainId = 'eip155:
|
|
6939
|
+
this.zkEvmRpcUrl = 'https://rpc.testnet.immutable.com';
|
|
6940
|
+
this.zkEvmChainId = 'eip155:13372';
|
|
10091
6941
|
this.relayerUrl = 'https://api.sandbox.immutable.com/relayer-mr';
|
|
10092
6942
|
this.multiRollupConfig = multiRollupConfig.getSandbox();
|
|
10093
6943
|
break;
|
|
@@ -10287,8 +7137,10 @@ class TypedEventEmitter {
|
|
|
10287
7137
|
|
|
10288
7138
|
class RelayerClient {
|
|
10289
7139
|
config;
|
|
10290
|
-
|
|
7140
|
+
user;
|
|
7141
|
+
constructor({ config, user }) {
|
|
10291
7142
|
this.config = config;
|
|
7143
|
+
this.user = user;
|
|
10292
7144
|
}
|
|
10293
7145
|
async postToRelayer(request) {
|
|
10294
7146
|
const body = {
|
|
@@ -10299,6 +7151,7 @@ class RelayerClient {
|
|
|
10299
7151
|
const response = await fetch(`${this.config.relayerUrl}/v1/transactions`, {
|
|
10300
7152
|
method: 'POST',
|
|
10301
7153
|
headers: {
|
|
7154
|
+
Authorization: `Bearer ${this.user.accessToken}`,
|
|
10302
7155
|
'Content-Type': 'application/json',
|
|
10303
7156
|
},
|
|
10304
7157
|
body: JSON.stringify(body),
|
|
@@ -10548,11 +7401,12 @@ class ZkEvmProvider {
|
|
|
10548
7401
|
config;
|
|
10549
7402
|
confirmationScreen;
|
|
10550
7403
|
magicAdapter;
|
|
10551
|
-
relayerClient;
|
|
10552
7404
|
transactionAPI;
|
|
10553
7405
|
multiRollupApiClients;
|
|
10554
7406
|
jsonRpcProvider; // Used for read
|
|
10555
7407
|
eventEmitter;
|
|
7408
|
+
guardianClient;
|
|
7409
|
+
relayerClient;
|
|
10556
7410
|
magicProvider; // Used for signing
|
|
10557
7411
|
user;
|
|
10558
7412
|
constructor({ authManager, magicAdapter, config, confirmationScreen, multiRollupApiClients, }) {
|
|
@@ -10560,7 +7414,6 @@ class ZkEvmProvider {
|
|
|
10560
7414
|
this.magicAdapter = magicAdapter;
|
|
10561
7415
|
this.config = config;
|
|
10562
7416
|
this.confirmationScreen = confirmationScreen;
|
|
10563
|
-
this.relayerClient = new RelayerClient({ config });
|
|
10564
7417
|
this.transactionAPI = new TransactionsApi(new Configuration({
|
|
10565
7418
|
basePath: this.config.imxPublicApiDomain,
|
|
10566
7419
|
}));
|
|
@@ -10568,8 +7421,12 @@ class ZkEvmProvider {
|
|
|
10568
7421
|
this.multiRollupApiClients = multiRollupApiClients;
|
|
10569
7422
|
this.eventEmitter = new TypedEventEmitter();
|
|
10570
7423
|
}
|
|
7424
|
+
isPassport = true;
|
|
10571
7425
|
isLoggedIn() {
|
|
10572
|
-
return this.magicProvider !== undefined
|
|
7426
|
+
return this.magicProvider !== undefined
|
|
7427
|
+
&& this.user !== undefined
|
|
7428
|
+
&& this.relayerClient !== undefined
|
|
7429
|
+
&& this.guardianClient !== undefined;
|
|
10573
7430
|
}
|
|
10574
7431
|
async performRequest(request) {
|
|
10575
7432
|
switch (request.method) {
|
|
@@ -10585,6 +7442,16 @@ class ZkEvmProvider {
|
|
|
10585
7442
|
});
|
|
10586
7443
|
this.user = user;
|
|
10587
7444
|
this.magicProvider = magicProvider;
|
|
7445
|
+
this.relayerClient = new RelayerClient({
|
|
7446
|
+
config: this.config,
|
|
7447
|
+
user: this.user,
|
|
7448
|
+
});
|
|
7449
|
+
this.guardianClient = new GuardianClient({
|
|
7450
|
+
imxPublicApiDomain: this.config.imxPublicApiDomain,
|
|
7451
|
+
accessToken: this.user.accessToken,
|
|
7452
|
+
confirmationScreen: this.confirmationScreen,
|
|
7453
|
+
imxEtherAddress: this.user.zkEvm.ethAddress,
|
|
7454
|
+
});
|
|
10588
7455
|
this.eventEmitter.emit(ProviderEvent.ACCOUNTS_CHANGED, [this.user.zkEvm.ethAddress]);
|
|
10589
7456
|
return [this.user.zkEvm.ethAddress];
|
|
10590
7457
|
}
|
|
@@ -10592,16 +7459,10 @@ class ZkEvmProvider {
|
|
|
10592
7459
|
if (!this.isLoggedIn()) {
|
|
10593
7460
|
throw new JsonRpcError(ProviderErrorCode.UNAUTHORIZED, 'Unauthorised - call eth_requestAccounts first');
|
|
10594
7461
|
}
|
|
10595
|
-
const guardianClient = new GuardianClient({
|
|
10596
|
-
imxPublicApiDomain: this.config.imxPublicApiDomain,
|
|
10597
|
-
accessToken: this.user.accessToken,
|
|
10598
|
-
confirmationScreen: this.confirmationScreen,
|
|
10599
|
-
imxEtherAddress: this.user?.imx?.ethAddress || '',
|
|
10600
|
-
});
|
|
10601
7462
|
return sendTransaction({
|
|
10602
7463
|
params: request.params || [],
|
|
10603
7464
|
magicProvider: this.magicProvider,
|
|
10604
|
-
guardianClient,
|
|
7465
|
+
guardianClient: this.guardianClient,
|
|
10605
7466
|
jsonRpcProvider: this.jsonRpcProvider,
|
|
10606
7467
|
config: this.config,
|
|
10607
7468
|
relayerClient: this.relayerClient,
|
|
@@ -10782,8 +7643,10 @@ class Passport {
|
|
|
10782
7643
|
async connectImxWithCredentials(tokenResponse) {
|
|
10783
7644
|
return this.passportImxProviderFactory.getProviderWithCredentials(tokenResponse);
|
|
10784
7645
|
}
|
|
10785
|
-
// TODO ID-926 Make method public once development has been finalised
|
|
10786
7646
|
connectEvm() {
|
|
7647
|
+
if (this.config.network === Networks.PRODUCTION) {
|
|
7648
|
+
throw new Error('EVM is not supported on production network');
|
|
7649
|
+
}
|
|
10787
7650
|
return new ZkEvmProvider({
|
|
10788
7651
|
authManager: this.authManager,
|
|
10789
7652
|
magicAdapter: this.magicAdapter,
|