seatable-html-page-sdk 0.0.9-beta.1 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +546 -339
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/es/apis/html-page-api.js +58 -0
- package/es/apis/html-page-api.js.map +1 -1
- package/es/sdk.js +16 -6
- package/es/sdk.js.map +1 -1
- package/lib/apis/html-page-api.js +58 -0
- package/lib/apis/html-page-api.js.map +1 -1
- package/lib/sdk.js +16 -6
- package/lib/sdk.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -4,6 +4,13 @@
|
|
|
4
4
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.HTMLPageSDK = factory());
|
|
5
5
|
})(this, (function () { 'use strict';
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Create a bound version of a function with a specified `this` context
|
|
9
|
+
*
|
|
10
|
+
* @param {Function} fn - The function to bind
|
|
11
|
+
* @param {*} thisArg - The value to be passed as the `this` parameter
|
|
12
|
+
* @returns {Function} A new function that will call the original function with the specified `this` context
|
|
13
|
+
*/
|
|
7
14
|
function bind(fn, thisArg) {
|
|
8
15
|
return function wrap() {
|
|
9
16
|
return fn.apply(thisArg, arguments);
|
|
@@ -12,30 +19,30 @@
|
|
|
12
19
|
|
|
13
20
|
// utils is a library of generic helper functions non-specific to axios
|
|
14
21
|
|
|
15
|
-
const {toString} = Object.prototype;
|
|
16
|
-
const {getPrototypeOf} = Object;
|
|
17
|
-
const {iterator, toStringTag} = Symbol;
|
|
22
|
+
const { toString } = Object.prototype;
|
|
23
|
+
const { getPrototypeOf } = Object;
|
|
24
|
+
const { iterator, toStringTag } = Symbol;
|
|
18
25
|
|
|
19
|
-
const kindOf = (cache => thing => {
|
|
20
|
-
|
|
21
|
-
|
|
26
|
+
const kindOf = ((cache) => (thing) => {
|
|
27
|
+
const str = toString.call(thing);
|
|
28
|
+
return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
|
|
22
29
|
})(Object.create(null));
|
|
23
30
|
|
|
24
31
|
const kindOfTest = (type) => {
|
|
25
32
|
type = type.toLowerCase();
|
|
26
|
-
return (thing) => kindOf(thing) === type
|
|
33
|
+
return (thing) => kindOf(thing) === type;
|
|
27
34
|
};
|
|
28
35
|
|
|
29
|
-
const typeOfTest = type => thing => typeof thing === type;
|
|
36
|
+
const typeOfTest = (type) => (thing) => typeof thing === type;
|
|
30
37
|
|
|
31
38
|
/**
|
|
32
|
-
* Determine if a value is
|
|
39
|
+
* Determine if a value is a non-null object
|
|
33
40
|
*
|
|
34
41
|
* @param {Object} val The value to test
|
|
35
42
|
*
|
|
36
43
|
* @returns {boolean} True if value is an Array, otherwise false
|
|
37
44
|
*/
|
|
38
|
-
const {isArray} = Array;
|
|
45
|
+
const { isArray } = Array;
|
|
39
46
|
|
|
40
47
|
/**
|
|
41
48
|
* Determine if a value is undefined
|
|
@@ -44,7 +51,7 @@
|
|
|
44
51
|
*
|
|
45
52
|
* @returns {boolean} True if the value is undefined, otherwise false
|
|
46
53
|
*/
|
|
47
|
-
const isUndefined = typeOfTest(
|
|
54
|
+
const isUndefined = typeOfTest("undefined");
|
|
48
55
|
|
|
49
56
|
/**
|
|
50
57
|
* Determine if a value is a Buffer
|
|
@@ -54,8 +61,14 @@
|
|
|
54
61
|
* @returns {boolean} True if value is a Buffer, otherwise false
|
|
55
62
|
*/
|
|
56
63
|
function isBuffer(val) {
|
|
57
|
-
return
|
|
58
|
-
|
|
64
|
+
return (
|
|
65
|
+
val !== null &&
|
|
66
|
+
!isUndefined(val) &&
|
|
67
|
+
val.constructor !== null &&
|
|
68
|
+
!isUndefined(val.constructor) &&
|
|
69
|
+
isFunction$1(val.constructor.isBuffer) &&
|
|
70
|
+
val.constructor.isBuffer(val)
|
|
71
|
+
);
|
|
59
72
|
}
|
|
60
73
|
|
|
61
74
|
/**
|
|
@@ -65,8 +78,7 @@
|
|
|
65
78
|
*
|
|
66
79
|
* @returns {boolean} True if value is an ArrayBuffer, otherwise false
|
|
67
80
|
*/
|
|
68
|
-
const isArrayBuffer = kindOfTest(
|
|
69
|
-
|
|
81
|
+
const isArrayBuffer = kindOfTest("ArrayBuffer");
|
|
70
82
|
|
|
71
83
|
/**
|
|
72
84
|
* Determine if a value is a view on an ArrayBuffer
|
|
@@ -77,10 +89,10 @@
|
|
|
77
89
|
*/
|
|
78
90
|
function isArrayBufferView(val) {
|
|
79
91
|
let result;
|
|
80
|
-
if (
|
|
92
|
+
if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) {
|
|
81
93
|
result = ArrayBuffer.isView(val);
|
|
82
94
|
} else {
|
|
83
|
-
result =
|
|
95
|
+
result = val && val.buffer && isArrayBuffer(val.buffer);
|
|
84
96
|
}
|
|
85
97
|
return result;
|
|
86
98
|
}
|
|
@@ -92,7 +104,7 @@
|
|
|
92
104
|
*
|
|
93
105
|
* @returns {boolean} True if value is a String, otherwise false
|
|
94
106
|
*/
|
|
95
|
-
const isString = typeOfTest(
|
|
107
|
+
const isString = typeOfTest("string");
|
|
96
108
|
|
|
97
109
|
/**
|
|
98
110
|
* Determine if a value is a Function
|
|
@@ -100,7 +112,7 @@
|
|
|
100
112
|
* @param {*} val The value to test
|
|
101
113
|
* @returns {boolean} True if value is a Function, otherwise false
|
|
102
114
|
*/
|
|
103
|
-
const isFunction$1 = typeOfTest(
|
|
115
|
+
const isFunction$1 = typeOfTest("function");
|
|
104
116
|
|
|
105
117
|
/**
|
|
106
118
|
* Determine if a value is a Number
|
|
@@ -109,7 +121,7 @@
|
|
|
109
121
|
*
|
|
110
122
|
* @returns {boolean} True if value is a Number, otherwise false
|
|
111
123
|
*/
|
|
112
|
-
const isNumber = typeOfTest(
|
|
124
|
+
const isNumber = typeOfTest("number");
|
|
113
125
|
|
|
114
126
|
/**
|
|
115
127
|
* Determine if a value is an Object
|
|
@@ -118,7 +130,7 @@
|
|
|
118
130
|
*
|
|
119
131
|
* @returns {boolean} True if value is an Object, otherwise false
|
|
120
132
|
*/
|
|
121
|
-
const isObject = (thing) => thing !== null && typeof thing ===
|
|
133
|
+
const isObject = (thing) => thing !== null && typeof thing === "object";
|
|
122
134
|
|
|
123
135
|
/**
|
|
124
136
|
* Determine if a value is a Boolean
|
|
@@ -126,7 +138,7 @@
|
|
|
126
138
|
* @param {*} thing The value to test
|
|
127
139
|
* @returns {boolean} True if value is a Boolean, otherwise false
|
|
128
140
|
*/
|
|
129
|
-
const isBoolean = thing => thing === true || thing === false;
|
|
141
|
+
const isBoolean = (thing) => thing === true || thing === false;
|
|
130
142
|
|
|
131
143
|
/**
|
|
132
144
|
* Determine if a value is a plain Object
|
|
@@ -136,12 +148,18 @@
|
|
|
136
148
|
* @returns {boolean} True if value is a plain Object, otherwise false
|
|
137
149
|
*/
|
|
138
150
|
const isPlainObject = (val) => {
|
|
139
|
-
if (kindOf(val) !==
|
|
151
|
+
if (kindOf(val) !== "object") {
|
|
140
152
|
return false;
|
|
141
153
|
}
|
|
142
154
|
|
|
143
155
|
const prototype = getPrototypeOf(val);
|
|
144
|
-
return (
|
|
156
|
+
return (
|
|
157
|
+
(prototype === null ||
|
|
158
|
+
prototype === Object.prototype ||
|
|
159
|
+
Object.getPrototypeOf(prototype) === null) &&
|
|
160
|
+
!(toStringTag in val) &&
|
|
161
|
+
!(iterator in val)
|
|
162
|
+
);
|
|
145
163
|
};
|
|
146
164
|
|
|
147
165
|
/**
|
|
@@ -158,7 +176,10 @@
|
|
|
158
176
|
}
|
|
159
177
|
|
|
160
178
|
try {
|
|
161
|
-
return
|
|
179
|
+
return (
|
|
180
|
+
Object.keys(val).length === 0 &&
|
|
181
|
+
Object.getPrototypeOf(val) === Object.prototype
|
|
182
|
+
);
|
|
162
183
|
} catch (e) {
|
|
163
184
|
// Fallback for any other objects that might cause RangeError with Object.keys()
|
|
164
185
|
return false;
|
|
@@ -172,7 +193,7 @@
|
|
|
172
193
|
*
|
|
173
194
|
* @returns {boolean} True if value is a Date, otherwise false
|
|
174
195
|
*/
|
|
175
|
-
const isDate = kindOfTest(
|
|
196
|
+
const isDate = kindOfTest("Date");
|
|
176
197
|
|
|
177
198
|
/**
|
|
178
199
|
* Determine if a value is a File
|
|
@@ -181,7 +202,7 @@
|
|
|
181
202
|
*
|
|
182
203
|
* @returns {boolean} True if value is a File, otherwise false
|
|
183
204
|
*/
|
|
184
|
-
const isFile = kindOfTest(
|
|
205
|
+
const isFile = kindOfTest("File");
|
|
185
206
|
|
|
186
207
|
/**
|
|
187
208
|
* Determine if a value is a Blob
|
|
@@ -190,7 +211,7 @@
|
|
|
190
211
|
*
|
|
191
212
|
* @returns {boolean} True if value is a Blob, otherwise false
|
|
192
213
|
*/
|
|
193
|
-
const isBlob = kindOfTest(
|
|
214
|
+
const isBlob = kindOfTest("Blob");
|
|
194
215
|
|
|
195
216
|
/**
|
|
196
217
|
* Determine if a value is a FileList
|
|
@@ -199,7 +220,7 @@
|
|
|
199
220
|
*
|
|
200
221
|
* @returns {boolean} True if value is a File, otherwise false
|
|
201
222
|
*/
|
|
202
|
-
const isFileList = kindOfTest(
|
|
223
|
+
const isFileList = kindOfTest("FileList");
|
|
203
224
|
|
|
204
225
|
/**
|
|
205
226
|
* Determine if a value is a Stream
|
|
@@ -219,15 +240,16 @@
|
|
|
219
240
|
*/
|
|
220
241
|
const isFormData = (thing) => {
|
|
221
242
|
let kind;
|
|
222
|
-
return
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
243
|
+
return (
|
|
244
|
+
thing &&
|
|
245
|
+
((typeof FormData === "function" && thing instanceof FormData) ||
|
|
246
|
+
(isFunction$1(thing.append) &&
|
|
247
|
+
((kind = kindOf(thing)) === "formdata" ||
|
|
248
|
+
// detect form-data instance
|
|
249
|
+
(kind === "object" &&
|
|
250
|
+
isFunction$1(thing.toString) &&
|
|
251
|
+
thing.toString() === "[object FormData]"))))
|
|
252
|
+
);
|
|
231
253
|
};
|
|
232
254
|
|
|
233
255
|
/**
|
|
@@ -237,9 +259,14 @@
|
|
|
237
259
|
*
|
|
238
260
|
* @returns {boolean} True if value is a URLSearchParams object, otherwise false
|
|
239
261
|
*/
|
|
240
|
-
const isURLSearchParams = kindOfTest(
|
|
262
|
+
const isURLSearchParams = kindOfTest("URLSearchParams");
|
|
241
263
|
|
|
242
|
-
const [isReadableStream, isRequest, isResponse, isHeaders] = [
|
|
264
|
+
const [isReadableStream, isRequest, isResponse, isHeaders] = [
|
|
265
|
+
"ReadableStream",
|
|
266
|
+
"Request",
|
|
267
|
+
"Response",
|
|
268
|
+
"Headers",
|
|
269
|
+
].map(kindOfTest);
|
|
243
270
|
|
|
244
271
|
/**
|
|
245
272
|
* Trim excess whitespace off the beginning and end of a string
|
|
@@ -248,8 +275,8 @@
|
|
|
248
275
|
*
|
|
249
276
|
* @returns {String} The String freed of excess whitespace
|
|
250
277
|
*/
|
|
251
|
-
const trim = (str) =>
|
|
252
|
-
str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
|
|
278
|
+
const trim = (str) =>
|
|
279
|
+
str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
|
|
253
280
|
|
|
254
281
|
/**
|
|
255
282
|
* Iterate over an Array or an Object invoking a function for each item.
|
|
@@ -260,15 +287,16 @@
|
|
|
260
287
|
* If 'obj' is an Object callback will be called passing
|
|
261
288
|
* the value, key, and complete object for each property.
|
|
262
289
|
*
|
|
263
|
-
* @param {Object|Array} obj The object to iterate
|
|
290
|
+
* @param {Object|Array<unknown>} obj The object to iterate
|
|
264
291
|
* @param {Function} fn The callback to invoke for each item
|
|
265
292
|
*
|
|
266
|
-
* @param {
|
|
293
|
+
* @param {Object} [options]
|
|
294
|
+
* @param {Boolean} [options.allOwnKeys = false]
|
|
267
295
|
* @returns {any}
|
|
268
296
|
*/
|
|
269
|
-
function forEach(obj, fn, {allOwnKeys = false} = {}) {
|
|
297
|
+
function forEach(obj, fn, { allOwnKeys = false } = {}) {
|
|
270
298
|
// Don't bother if no value provided
|
|
271
|
-
if (obj === null || typeof obj ===
|
|
299
|
+
if (obj === null || typeof obj === "undefined") {
|
|
272
300
|
return;
|
|
273
301
|
}
|
|
274
302
|
|
|
@@ -276,7 +304,7 @@
|
|
|
276
304
|
let l;
|
|
277
305
|
|
|
278
306
|
// Force an array if not already something iterable
|
|
279
|
-
if (typeof obj !==
|
|
307
|
+
if (typeof obj !== "object") {
|
|
280
308
|
/*eslint no-param-reassign:0*/
|
|
281
309
|
obj = [obj];
|
|
282
310
|
}
|
|
@@ -293,7 +321,9 @@
|
|
|
293
321
|
}
|
|
294
322
|
|
|
295
323
|
// Iterate over object keys
|
|
296
|
-
const keys = allOwnKeys
|
|
324
|
+
const keys = allOwnKeys
|
|
325
|
+
? Object.getOwnPropertyNames(obj)
|
|
326
|
+
: Object.keys(obj);
|
|
297
327
|
const len = keys.length;
|
|
298
328
|
let key;
|
|
299
329
|
|
|
@@ -305,7 +335,7 @@
|
|
|
305
335
|
}
|
|
306
336
|
|
|
307
337
|
function findKey(obj, key) {
|
|
308
|
-
if (isBuffer(obj)){
|
|
338
|
+
if (isBuffer(obj)) {
|
|
309
339
|
return null;
|
|
310
340
|
}
|
|
311
341
|
|
|
@@ -325,10 +355,15 @@
|
|
|
325
355
|
const _global = (() => {
|
|
326
356
|
/*eslint no-undef:0*/
|
|
327
357
|
if (typeof globalThis !== "undefined") return globalThis;
|
|
328
|
-
return typeof self !== "undefined"
|
|
358
|
+
return typeof self !== "undefined"
|
|
359
|
+
? self
|
|
360
|
+
: typeof window !== "undefined"
|
|
361
|
+
? window
|
|
362
|
+
: global;
|
|
329
363
|
})();
|
|
330
364
|
|
|
331
|
-
const isContextDefined = (context) =>
|
|
365
|
+
const isContextDefined = (context) =>
|
|
366
|
+
!isUndefined(context) && context !== _global;
|
|
332
367
|
|
|
333
368
|
/**
|
|
334
369
|
* Accepts varargs expecting each argument to be an object, then
|
|
@@ -340,7 +375,7 @@
|
|
|
340
375
|
* Example:
|
|
341
376
|
*
|
|
342
377
|
* ```js
|
|
343
|
-
*
|
|
378
|
+
* const result = merge({foo: 123}, {foo: 456});
|
|
344
379
|
* console.log(result.foo); // outputs 456
|
|
345
380
|
* ```
|
|
346
381
|
*
|
|
@@ -349,10 +384,15 @@
|
|
|
349
384
|
* @returns {Object} Result of all merge properties
|
|
350
385
|
*/
|
|
351
386
|
function merge(/* obj1, obj2, obj3, ... */) {
|
|
352
|
-
const {caseless, skipUndefined} = isContextDefined(this) && this || {};
|
|
387
|
+
const { caseless, skipUndefined } = (isContextDefined(this) && this) || {};
|
|
353
388
|
const result = {};
|
|
354
389
|
const assignValue = (val, key) => {
|
|
355
|
-
|
|
390
|
+
// Skip dangerous property names to prevent prototype pollution
|
|
391
|
+
if (key === "__proto__" || key === "constructor" || key === "prototype") {
|
|
392
|
+
return;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
const targetKey = (caseless && findKey(result, key)) || key;
|
|
356
396
|
if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
|
|
357
397
|
result[targetKey] = merge(result[targetKey], val);
|
|
358
398
|
} else if (isPlainObject(val)) {
|
|
@@ -377,17 +417,32 @@
|
|
|
377
417
|
* @param {Object} b The object to copy properties from
|
|
378
418
|
* @param {Object} thisArg The object to bind function to
|
|
379
419
|
*
|
|
380
|
-
* @param {
|
|
420
|
+
* @param {Object} [options]
|
|
421
|
+
* @param {Boolean} [options.allOwnKeys]
|
|
381
422
|
* @returns {Object} The resulting value of object a
|
|
382
423
|
*/
|
|
383
|
-
const extend = (a, b, thisArg, {allOwnKeys}= {}) => {
|
|
384
|
-
forEach(
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
424
|
+
const extend = (a, b, thisArg, { allOwnKeys } = {}) => {
|
|
425
|
+
forEach(
|
|
426
|
+
b,
|
|
427
|
+
(val, key) => {
|
|
428
|
+
if (thisArg && isFunction$1(val)) {
|
|
429
|
+
Object.defineProperty(a, key, {
|
|
430
|
+
value: bind(val, thisArg),
|
|
431
|
+
writable: true,
|
|
432
|
+
enumerable: true,
|
|
433
|
+
configurable: true,
|
|
434
|
+
});
|
|
435
|
+
} else {
|
|
436
|
+
Object.defineProperty(a, key, {
|
|
437
|
+
value: val,
|
|
438
|
+
writable: true,
|
|
439
|
+
enumerable: true,
|
|
440
|
+
configurable: true,
|
|
441
|
+
});
|
|
442
|
+
}
|
|
443
|
+
},
|
|
444
|
+
{ allOwnKeys },
|
|
445
|
+
);
|
|
391
446
|
return a;
|
|
392
447
|
};
|
|
393
448
|
|
|
@@ -399,7 +454,7 @@
|
|
|
399
454
|
* @returns {string} content value without BOM
|
|
400
455
|
*/
|
|
401
456
|
const stripBOM = (content) => {
|
|
402
|
-
if (content.charCodeAt(0) ===
|
|
457
|
+
if (content.charCodeAt(0) === 0xfeff) {
|
|
403
458
|
content = content.slice(1);
|
|
404
459
|
}
|
|
405
460
|
return content;
|
|
@@ -415,10 +470,18 @@
|
|
|
415
470
|
* @returns {void}
|
|
416
471
|
*/
|
|
417
472
|
const inherits = (constructor, superConstructor, props, descriptors) => {
|
|
418
|
-
constructor.prototype = Object.create(
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
473
|
+
constructor.prototype = Object.create(
|
|
474
|
+
superConstructor.prototype,
|
|
475
|
+
descriptors,
|
|
476
|
+
);
|
|
477
|
+
Object.defineProperty(constructor.prototype, "constructor", {
|
|
478
|
+
value: constructor,
|
|
479
|
+
writable: true,
|
|
480
|
+
enumerable: false,
|
|
481
|
+
configurable: true,
|
|
482
|
+
});
|
|
483
|
+
Object.defineProperty(constructor, "super", {
|
|
484
|
+
value: superConstructor.prototype,
|
|
422
485
|
});
|
|
423
486
|
props && Object.assign(constructor.prototype, props);
|
|
424
487
|
};
|
|
@@ -447,13 +510,20 @@
|
|
|
447
510
|
i = props.length;
|
|
448
511
|
while (i-- > 0) {
|
|
449
512
|
prop = props[i];
|
|
450
|
-
if (
|
|
513
|
+
if (
|
|
514
|
+
(!propFilter || propFilter(prop, sourceObj, destObj)) &&
|
|
515
|
+
!merged[prop]
|
|
516
|
+
) {
|
|
451
517
|
destObj[prop] = sourceObj[prop];
|
|
452
518
|
merged[prop] = true;
|
|
453
519
|
}
|
|
454
520
|
}
|
|
455
521
|
sourceObj = filter !== false && getPrototypeOf(sourceObj);
|
|
456
|
-
} while (
|
|
522
|
+
} while (
|
|
523
|
+
sourceObj &&
|
|
524
|
+
(!filter || filter(sourceObj, destObj)) &&
|
|
525
|
+
sourceObj !== Object.prototype
|
|
526
|
+
);
|
|
457
527
|
|
|
458
528
|
return destObj;
|
|
459
529
|
};
|
|
@@ -477,7 +547,6 @@
|
|
|
477
547
|
return lastIndex !== -1 && lastIndex === position;
|
|
478
548
|
};
|
|
479
549
|
|
|
480
|
-
|
|
481
550
|
/**
|
|
482
551
|
* Returns new array from array like object or null if failed
|
|
483
552
|
*
|
|
@@ -506,12 +575,12 @@
|
|
|
506
575
|
* @returns {Array}
|
|
507
576
|
*/
|
|
508
577
|
// eslint-disable-next-line func-names
|
|
509
|
-
const isTypedArray = (TypedArray => {
|
|
578
|
+
const isTypedArray = ((TypedArray) => {
|
|
510
579
|
// eslint-disable-next-line func-names
|
|
511
|
-
return thing => {
|
|
580
|
+
return (thing) => {
|
|
512
581
|
return TypedArray && thing instanceof TypedArray;
|
|
513
582
|
};
|
|
514
|
-
})(typeof Uint8Array !==
|
|
583
|
+
})(typeof Uint8Array !== "undefined" && getPrototypeOf(Uint8Array));
|
|
515
584
|
|
|
516
585
|
/**
|
|
517
586
|
* For each entry in the object, call the function with the key and value.
|
|
@@ -554,18 +623,22 @@
|
|
|
554
623
|
};
|
|
555
624
|
|
|
556
625
|
/* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */
|
|
557
|
-
const isHTMLForm = kindOfTest(
|
|
626
|
+
const isHTMLForm = kindOfTest("HTMLFormElement");
|
|
558
627
|
|
|
559
|
-
const toCamelCase = str => {
|
|
560
|
-
return str
|
|
561
|
-
|
|
628
|
+
const toCamelCase = (str) => {
|
|
629
|
+
return str
|
|
630
|
+
.toLowerCase()
|
|
631
|
+
.replace(/[-_\s]([a-z\d])(\w*)/g, function replacer(m, p1, p2) {
|
|
562
632
|
return p1.toUpperCase() + p2;
|
|
563
|
-
}
|
|
564
|
-
);
|
|
633
|
+
});
|
|
565
634
|
};
|
|
566
635
|
|
|
567
636
|
/* Creating a function that will check if an object has a property. */
|
|
568
|
-
const hasOwnProperty$1 = (
|
|
637
|
+
const hasOwnProperty$1 = (
|
|
638
|
+
({ hasOwnProperty }) =>
|
|
639
|
+
(obj, prop) =>
|
|
640
|
+
hasOwnProperty.call(obj, prop)
|
|
641
|
+
)(Object.prototype);
|
|
569
642
|
|
|
570
643
|
/**
|
|
571
644
|
* Determine if a value is a RegExp object
|
|
@@ -574,7 +647,7 @@
|
|
|
574
647
|
*
|
|
575
648
|
* @returns {boolean} True if value is a RegExp object, otherwise false
|
|
576
649
|
*/
|
|
577
|
-
const isRegExp = kindOfTest(
|
|
650
|
+
const isRegExp = kindOfTest("RegExp");
|
|
578
651
|
|
|
579
652
|
const reduceDescriptors = (obj, reducer) => {
|
|
580
653
|
const descriptors = Object.getOwnPropertyDescriptors(obj);
|
|
@@ -598,7 +671,10 @@
|
|
|
598
671
|
const freezeMethods = (obj) => {
|
|
599
672
|
reduceDescriptors(obj, (descriptor, name) => {
|
|
600
673
|
// skip restricted props in strict mode
|
|
601
|
-
if (
|
|
674
|
+
if (
|
|
675
|
+
isFunction$1(obj) &&
|
|
676
|
+
["arguments", "caller", "callee"].indexOf(name) !== -1
|
|
677
|
+
) {
|
|
602
678
|
return false;
|
|
603
679
|
}
|
|
604
680
|
|
|
@@ -608,14 +684,14 @@
|
|
|
608
684
|
|
|
609
685
|
descriptor.enumerable = false;
|
|
610
686
|
|
|
611
|
-
if (
|
|
687
|
+
if ("writable" in descriptor) {
|
|
612
688
|
descriptor.writable = false;
|
|
613
689
|
return;
|
|
614
690
|
}
|
|
615
691
|
|
|
616
692
|
if (!descriptor.set) {
|
|
617
693
|
descriptor.set = () => {
|
|
618
|
-
throw Error(
|
|
694
|
+
throw Error("Can not rewrite read-only method '" + name + "'");
|
|
619
695
|
};
|
|
620
696
|
}
|
|
621
697
|
});
|
|
@@ -625,12 +701,14 @@
|
|
|
625
701
|
const obj = {};
|
|
626
702
|
|
|
627
703
|
const define = (arr) => {
|
|
628
|
-
arr.forEach(value => {
|
|
704
|
+
arr.forEach((value) => {
|
|
629
705
|
obj[value] = true;
|
|
630
706
|
});
|
|
631
707
|
};
|
|
632
708
|
|
|
633
|
-
isArray(arrayOrString)
|
|
709
|
+
isArray(arrayOrString)
|
|
710
|
+
? define(arrayOrString)
|
|
711
|
+
: define(String(arrayOrString).split(delimiter));
|
|
634
712
|
|
|
635
713
|
return obj;
|
|
636
714
|
};
|
|
@@ -638,11 +716,11 @@
|
|
|
638
716
|
const noop = () => {};
|
|
639
717
|
|
|
640
718
|
const toFiniteNumber = (value, defaultValue) => {
|
|
641
|
-
return value != null && Number.isFinite(value = +value)
|
|
719
|
+
return value != null && Number.isFinite((value = +value))
|
|
720
|
+
? value
|
|
721
|
+
: defaultValue;
|
|
642
722
|
};
|
|
643
723
|
|
|
644
|
-
|
|
645
|
-
|
|
646
724
|
/**
|
|
647
725
|
* If the thing is a FormData object, return true, otherwise return false.
|
|
648
726
|
*
|
|
@@ -651,14 +729,18 @@
|
|
|
651
729
|
* @returns {boolean}
|
|
652
730
|
*/
|
|
653
731
|
function isSpecCompliantForm(thing) {
|
|
654
|
-
return !!(
|
|
732
|
+
return !!(
|
|
733
|
+
thing &&
|
|
734
|
+
isFunction$1(thing.append) &&
|
|
735
|
+
thing[toStringTag] === "FormData" &&
|
|
736
|
+
thing[iterator]
|
|
737
|
+
);
|
|
655
738
|
}
|
|
656
739
|
|
|
657
740
|
const toJSONObject = (obj) => {
|
|
658
741
|
const stack = new Array(10);
|
|
659
742
|
|
|
660
743
|
const visit = (source, i) => {
|
|
661
|
-
|
|
662
744
|
if (isObject(source)) {
|
|
663
745
|
if (stack.indexOf(source) >= 0) {
|
|
664
746
|
return;
|
|
@@ -669,7 +751,7 @@
|
|
|
669
751
|
return source;
|
|
670
752
|
}
|
|
671
753
|
|
|
672
|
-
if(!(
|
|
754
|
+
if (!("toJSON" in source)) {
|
|
673
755
|
stack[i] = source;
|
|
674
756
|
const target = isArray(source) ? [] : {};
|
|
675
757
|
|
|
@@ -690,10 +772,13 @@
|
|
|
690
772
|
return visit(obj, 0);
|
|
691
773
|
};
|
|
692
774
|
|
|
693
|
-
const isAsyncFn = kindOfTest(
|
|
775
|
+
const isAsyncFn = kindOfTest("AsyncFunction");
|
|
694
776
|
|
|
695
777
|
const isThenable = (thing) =>
|
|
696
|
-
thing &&
|
|
778
|
+
thing &&
|
|
779
|
+
(isObject(thing) || isFunction$1(thing)) &&
|
|
780
|
+
isFunction$1(thing.then) &&
|
|
781
|
+
isFunction$1(thing.catch);
|
|
697
782
|
|
|
698
783
|
// original code
|
|
699
784
|
// https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
|
|
@@ -703,32 +788,35 @@
|
|
|
703
788
|
return setImmediate;
|
|
704
789
|
}
|
|
705
790
|
|
|
706
|
-
return postMessageSupported
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
791
|
+
return postMessageSupported
|
|
792
|
+
? ((token, callbacks) => {
|
|
793
|
+
_global.addEventListener(
|
|
794
|
+
"message",
|
|
795
|
+
({ source, data }) => {
|
|
796
|
+
if (source === _global && data === token) {
|
|
797
|
+
callbacks.length && callbacks.shift()();
|
|
798
|
+
}
|
|
799
|
+
},
|
|
800
|
+
false,
|
|
801
|
+
);
|
|
712
802
|
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
isFunction$1(_global.postMessage)
|
|
721
|
-
);
|
|
803
|
+
return (cb) => {
|
|
804
|
+
callbacks.push(cb);
|
|
805
|
+
_global.postMessage(token, "*");
|
|
806
|
+
};
|
|
807
|
+
})(`axios@${Math.random()}`, [])
|
|
808
|
+
: (cb) => setTimeout(cb);
|
|
809
|
+
})(typeof setImmediate === "function", isFunction$1(_global.postMessage));
|
|
722
810
|
|
|
723
|
-
const asap =
|
|
724
|
-
|
|
811
|
+
const asap =
|
|
812
|
+
typeof queueMicrotask !== "undefined"
|
|
813
|
+
? queueMicrotask.bind(_global)
|
|
814
|
+
: (typeof process !== "undefined" && process.nextTick) || _setImmediate;
|
|
725
815
|
|
|
726
816
|
// *********************
|
|
727
817
|
|
|
728
|
-
|
|
729
818
|
const isIterable = (thing) => thing != null && isFunction$1(thing[iterator]);
|
|
730
819
|
|
|
731
|
-
|
|
732
820
|
var utils$1 = {
|
|
733
821
|
isArray,
|
|
734
822
|
isArrayBuffer,
|
|
@@ -786,113 +874,78 @@
|
|
|
786
874
|
isThenable,
|
|
787
875
|
setImmediate: _setImmediate,
|
|
788
876
|
asap,
|
|
789
|
-
isIterable
|
|
877
|
+
isIterable,
|
|
790
878
|
};
|
|
791
879
|
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
*
|
|
801
|
-
* @returns {Error} The created error.
|
|
802
|
-
*/
|
|
803
|
-
function AxiosError(message, code, config, request, response) {
|
|
804
|
-
Error.call(this);
|
|
880
|
+
class AxiosError extends Error {
|
|
881
|
+
static from(error, code, config, request, response, customProps) {
|
|
882
|
+
const axiosError = new AxiosError(error.message, code || error.code, config, request, response);
|
|
883
|
+
axiosError.cause = error;
|
|
884
|
+
axiosError.name = error.name;
|
|
885
|
+
customProps && Object.assign(axiosError, customProps);
|
|
886
|
+
return axiosError;
|
|
887
|
+
}
|
|
805
888
|
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
889
|
+
/**
|
|
890
|
+
* Create an Error with the specified message, config, error code, request and response.
|
|
891
|
+
*
|
|
892
|
+
* @param {string} message The error message.
|
|
893
|
+
* @param {string} [code] The error code (for example, 'ECONNABORTED').
|
|
894
|
+
* @param {Object} [config] The config.
|
|
895
|
+
* @param {Object} [request] The request.
|
|
896
|
+
* @param {Object} [response] The response.
|
|
897
|
+
*
|
|
898
|
+
* @returns {Error} The created error.
|
|
899
|
+
*/
|
|
900
|
+
constructor(message, code, config, request, response) {
|
|
901
|
+
super(message);
|
|
902
|
+
this.name = 'AxiosError';
|
|
903
|
+
this.isAxiosError = true;
|
|
904
|
+
code && (this.code = code);
|
|
905
|
+
config && (this.config = config);
|
|
906
|
+
request && (this.request = request);
|
|
907
|
+
if (response) {
|
|
908
|
+
this.response = response;
|
|
909
|
+
this.status = response.status;
|
|
910
|
+
}
|
|
911
|
+
}
|
|
811
912
|
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
913
|
+
toJSON() {
|
|
914
|
+
return {
|
|
915
|
+
// Standard
|
|
916
|
+
message: this.message,
|
|
917
|
+
name: this.name,
|
|
918
|
+
// Microsoft
|
|
919
|
+
description: this.description,
|
|
920
|
+
number: this.number,
|
|
921
|
+
// Mozilla
|
|
922
|
+
fileName: this.fileName,
|
|
923
|
+
lineNumber: this.lineNumber,
|
|
924
|
+
columnNumber: this.columnNumber,
|
|
925
|
+
stack: this.stack,
|
|
926
|
+
// Axios
|
|
927
|
+
config: utils$1.toJSONObject(this.config),
|
|
928
|
+
code: this.code,
|
|
929
|
+
status: this.status,
|
|
930
|
+
};
|
|
931
|
+
}
|
|
821
932
|
}
|
|
822
933
|
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
config: utils$1.toJSONObject(this.config),
|
|
839
|
-
code: this.code,
|
|
840
|
-
status: this.status
|
|
841
|
-
};
|
|
842
|
-
}
|
|
843
|
-
});
|
|
844
|
-
|
|
845
|
-
const prototype$1 = AxiosError.prototype;
|
|
846
|
-
const descriptors = {};
|
|
847
|
-
|
|
848
|
-
[
|
|
849
|
-
'ERR_BAD_OPTION_VALUE',
|
|
850
|
-
'ERR_BAD_OPTION',
|
|
851
|
-
'ECONNABORTED',
|
|
852
|
-
'ETIMEDOUT',
|
|
853
|
-
'ERR_NETWORK',
|
|
854
|
-
'ERR_FR_TOO_MANY_REDIRECTS',
|
|
855
|
-
'ERR_DEPRECATED',
|
|
856
|
-
'ERR_BAD_RESPONSE',
|
|
857
|
-
'ERR_BAD_REQUEST',
|
|
858
|
-
'ERR_CANCELED',
|
|
859
|
-
'ERR_NOT_SUPPORT',
|
|
860
|
-
'ERR_INVALID_URL'
|
|
861
|
-
// eslint-disable-next-line func-names
|
|
862
|
-
].forEach(code => {
|
|
863
|
-
descriptors[code] = {value: code};
|
|
864
|
-
});
|
|
865
|
-
|
|
866
|
-
Object.defineProperties(AxiosError, descriptors);
|
|
867
|
-
Object.defineProperty(prototype$1, 'isAxiosError', {value: true});
|
|
868
|
-
|
|
869
|
-
// eslint-disable-next-line func-names
|
|
870
|
-
AxiosError.from = (error, code, config, request, response, customProps) => {
|
|
871
|
-
const axiosError = Object.create(prototype$1);
|
|
872
|
-
|
|
873
|
-
utils$1.toFlatObject(error, axiosError, function filter(obj) {
|
|
874
|
-
return obj !== Error.prototype;
|
|
875
|
-
}, prop => {
|
|
876
|
-
return prop !== 'isAxiosError';
|
|
877
|
-
});
|
|
878
|
-
|
|
879
|
-
const msg = error && error.message ? error.message : 'Error';
|
|
880
|
-
|
|
881
|
-
// Prefer explicit code; otherwise copy the low-level error's code (e.g. ECONNREFUSED)
|
|
882
|
-
const errCode = code == null && error ? error.code : code;
|
|
883
|
-
AxiosError.call(axiosError, msg, errCode, config, request, response);
|
|
884
|
-
|
|
885
|
-
// Chain the original error on the standard field; non-enumerable to avoid JSON noise
|
|
886
|
-
if (error && axiosError.cause == null) {
|
|
887
|
-
Object.defineProperty(axiosError, 'cause', { value: error, configurable: true });
|
|
888
|
-
}
|
|
889
|
-
|
|
890
|
-
axiosError.name = (error && error.name) || 'Error';
|
|
891
|
-
|
|
892
|
-
customProps && Object.assign(axiosError, customProps);
|
|
893
|
-
|
|
894
|
-
return axiosError;
|
|
895
|
-
};
|
|
934
|
+
// This can be changed to static properties as soon as the parser options in .eslint.cjs are updated.
|
|
935
|
+
AxiosError.ERR_BAD_OPTION_VALUE = 'ERR_BAD_OPTION_VALUE';
|
|
936
|
+
AxiosError.ERR_BAD_OPTION = 'ERR_BAD_OPTION';
|
|
937
|
+
AxiosError.ECONNABORTED = 'ECONNABORTED';
|
|
938
|
+
AxiosError.ETIMEDOUT = 'ETIMEDOUT';
|
|
939
|
+
AxiosError.ERR_NETWORK = 'ERR_NETWORK';
|
|
940
|
+
AxiosError.ERR_FR_TOO_MANY_REDIRECTS = 'ERR_FR_TOO_MANY_REDIRECTS';
|
|
941
|
+
AxiosError.ERR_DEPRECATED = 'ERR_DEPRECATED';
|
|
942
|
+
AxiosError.ERR_BAD_RESPONSE = 'ERR_BAD_RESPONSE';
|
|
943
|
+
AxiosError.ERR_BAD_REQUEST = 'ERR_BAD_REQUEST';
|
|
944
|
+
AxiosError.ERR_CANCELED = 'ERR_CANCELED';
|
|
945
|
+
AxiosError.ERR_NOT_SUPPORT = 'ERR_NOT_SUPPORT';
|
|
946
|
+
AxiosError.ERR_INVALID_URL = 'ERR_INVALID_URL';
|
|
947
|
+
|
|
948
|
+
var AxiosError$1 = AxiosError;
|
|
896
949
|
|
|
897
950
|
// eslint-disable-next-line strict
|
|
898
951
|
var httpAdapter = null;
|
|
@@ -1017,7 +1070,7 @@
|
|
|
1017
1070
|
}
|
|
1018
1071
|
|
|
1019
1072
|
if (!useBlob && utils$1.isBlob(value)) {
|
|
1020
|
-
throw new AxiosError('Blob is not supported. Use a Buffer instead.');
|
|
1073
|
+
throw new AxiosError$1('Blob is not supported. Use a Buffer instead.');
|
|
1021
1074
|
}
|
|
1022
1075
|
|
|
1023
1076
|
if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
|
|
@@ -1191,29 +1244,26 @@
|
|
|
1191
1244
|
* @returns {string} The formatted url
|
|
1192
1245
|
*/
|
|
1193
1246
|
function buildURL(url, params, options) {
|
|
1194
|
-
/*eslint no-param-reassign:0*/
|
|
1195
1247
|
if (!params) {
|
|
1196
1248
|
return url;
|
|
1197
1249
|
}
|
|
1198
|
-
|
|
1250
|
+
|
|
1199
1251
|
const _encode = options && options.encode || encode;
|
|
1200
1252
|
|
|
1201
|
-
|
|
1202
|
-
options
|
|
1203
|
-
|
|
1204
|
-
};
|
|
1205
|
-
}
|
|
1253
|
+
const _options = utils$1.isFunction(options) ? {
|
|
1254
|
+
serialize: options
|
|
1255
|
+
} : options;
|
|
1206
1256
|
|
|
1207
|
-
const serializeFn =
|
|
1257
|
+
const serializeFn = _options && _options.serialize;
|
|
1208
1258
|
|
|
1209
1259
|
let serializedParams;
|
|
1210
1260
|
|
|
1211
1261
|
if (serializeFn) {
|
|
1212
|
-
serializedParams = serializeFn(params,
|
|
1262
|
+
serializedParams = serializeFn(params, _options);
|
|
1213
1263
|
} else {
|
|
1214
1264
|
serializedParams = utils$1.isURLSearchParams(params) ?
|
|
1215
1265
|
params.toString() :
|
|
1216
|
-
new AxiosURLSearchParams(params,
|
|
1266
|
+
new AxiosURLSearchParams(params, _options).toString(_encode);
|
|
1217
1267
|
}
|
|
1218
1268
|
|
|
1219
1269
|
if (serializedParams) {
|
|
@@ -1238,6 +1288,7 @@
|
|
|
1238
1288
|
*
|
|
1239
1289
|
* @param {Function} fulfilled The function to handle `then` for a `Promise`
|
|
1240
1290
|
* @param {Function} rejected The function to handle `reject` for a `Promise`
|
|
1291
|
+
* @param {Object} options The options for the interceptor, synchronous and runWhen
|
|
1241
1292
|
*
|
|
1242
1293
|
* @return {Number} An ID used to remove interceptor later
|
|
1243
1294
|
*/
|
|
@@ -1256,7 +1307,7 @@
|
|
|
1256
1307
|
*
|
|
1257
1308
|
* @param {Number} id The ID that was returned by `use`
|
|
1258
1309
|
*
|
|
1259
|
-
* @returns {
|
|
1310
|
+
* @returns {void}
|
|
1260
1311
|
*/
|
|
1261
1312
|
eject(id) {
|
|
1262
1313
|
if (this.handlers[id]) {
|
|
@@ -1299,7 +1350,8 @@
|
|
|
1299
1350
|
var transitionalDefaults = {
|
|
1300
1351
|
silentJSONParsing: true,
|
|
1301
1352
|
forcedJSONParsing: true,
|
|
1302
|
-
clarifyTimeoutError: false
|
|
1353
|
+
clarifyTimeoutError: false,
|
|
1354
|
+
legacyInterceptorReqResOrdering: true
|
|
1303
1355
|
};
|
|
1304
1356
|
|
|
1305
1357
|
var URLSearchParams$1 = typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;
|
|
@@ -1587,7 +1639,7 @@
|
|
|
1587
1639
|
} catch (e) {
|
|
1588
1640
|
if (strictJSONParsing) {
|
|
1589
1641
|
if (e.name === 'SyntaxError') {
|
|
1590
|
-
throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);
|
|
1642
|
+
throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_RESPONSE, this, null, this.response);
|
|
1591
1643
|
}
|
|
1592
1644
|
throw e;
|
|
1593
1645
|
}
|
|
@@ -2021,24 +2073,24 @@
|
|
|
2021
2073
|
return !!(value && value.__CANCEL__);
|
|
2022
2074
|
}
|
|
2023
2075
|
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2076
|
+
class CanceledError extends AxiosError$1 {
|
|
2077
|
+
/**
|
|
2078
|
+
* A `CanceledError` is an object that is thrown when an operation is canceled.
|
|
2079
|
+
*
|
|
2080
|
+
* @param {string=} message The message.
|
|
2081
|
+
* @param {Object=} config The config.
|
|
2082
|
+
* @param {Object=} request The request.
|
|
2083
|
+
*
|
|
2084
|
+
* @returns {CanceledError} The created error.
|
|
2085
|
+
*/
|
|
2086
|
+
constructor(message, config, request) {
|
|
2087
|
+
super(message == null ? 'canceled' : message, AxiosError$1.ERR_CANCELED, config, request);
|
|
2088
|
+
this.name = 'CanceledError';
|
|
2089
|
+
this.__CANCEL__ = true;
|
|
2090
|
+
}
|
|
2037
2091
|
}
|
|
2038
2092
|
|
|
2039
|
-
|
|
2040
|
-
__CANCEL__: true
|
|
2041
|
-
});
|
|
2093
|
+
var CanceledError$1 = CanceledError;
|
|
2042
2094
|
|
|
2043
2095
|
/**
|
|
2044
2096
|
* Resolve or reject a Promise based on response status.
|
|
@@ -2054,9 +2106,9 @@
|
|
|
2054
2106
|
if (!response.status || !validateStatus || validateStatus(response.status)) {
|
|
2055
2107
|
resolve(response);
|
|
2056
2108
|
} else {
|
|
2057
|
-
reject(new AxiosError(
|
|
2109
|
+
reject(new AxiosError$1(
|
|
2058
2110
|
'Request failed with status code ' + response.status,
|
|
2059
|
-
[AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
|
|
2111
|
+
[AxiosError$1.ERR_BAD_REQUEST, AxiosError$1.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
|
|
2060
2112
|
response.config,
|
|
2061
2113
|
response.request,
|
|
2062
2114
|
response
|
|
@@ -2222,27 +2274,38 @@
|
|
|
2222
2274
|
|
|
2223
2275
|
// Standard browser envs support document.cookie
|
|
2224
2276
|
{
|
|
2225
|
-
write(name, value, expires, path, domain, secure) {
|
|
2226
|
-
|
|
2277
|
+
write(name, value, expires, path, domain, secure, sameSite) {
|
|
2278
|
+
if (typeof document === 'undefined') return;
|
|
2227
2279
|
|
|
2228
|
-
|
|
2280
|
+
const cookie = [`${name}=${encodeURIComponent(value)}`];
|
|
2229
2281
|
|
|
2230
|
-
utils$1.
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2282
|
+
if (utils$1.isNumber(expires)) {
|
|
2283
|
+
cookie.push(`expires=${new Date(expires).toUTCString()}`);
|
|
2284
|
+
}
|
|
2285
|
+
if (utils$1.isString(path)) {
|
|
2286
|
+
cookie.push(`path=${path}`);
|
|
2287
|
+
}
|
|
2288
|
+
if (utils$1.isString(domain)) {
|
|
2289
|
+
cookie.push(`domain=${domain}`);
|
|
2290
|
+
}
|
|
2291
|
+
if (secure === true) {
|
|
2292
|
+
cookie.push('secure');
|
|
2293
|
+
}
|
|
2294
|
+
if (utils$1.isString(sameSite)) {
|
|
2295
|
+
cookie.push(`SameSite=${sameSite}`);
|
|
2296
|
+
}
|
|
2235
2297
|
|
|
2236
2298
|
document.cookie = cookie.join('; ');
|
|
2237
2299
|
},
|
|
2238
2300
|
|
|
2239
2301
|
read(name) {
|
|
2240
|
-
|
|
2241
|
-
|
|
2302
|
+
if (typeof document === 'undefined') return null;
|
|
2303
|
+
const match = document.cookie.match(new RegExp('(?:^|; )' + name + '=([^;]*)'));
|
|
2304
|
+
return match ? decodeURIComponent(match[1]) : null;
|
|
2242
2305
|
},
|
|
2243
2306
|
|
|
2244
2307
|
remove(name) {
|
|
2245
|
-
this.write(name, '', Date.now() - 86400000);
|
|
2308
|
+
this.write(name, '', Date.now() - 86400000, '/');
|
|
2246
2309
|
}
|
|
2247
2310
|
}
|
|
2248
2311
|
|
|
@@ -2268,6 +2331,10 @@
|
|
|
2268
2331
|
// A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
|
|
2269
2332
|
// RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
|
|
2270
2333
|
// by any combination of letters, digits, plus, period, or hyphen.
|
|
2334
|
+
if (typeof url !== 'string') {
|
|
2335
|
+
return false;
|
|
2336
|
+
}
|
|
2337
|
+
|
|
2271
2338
|
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
|
|
2272
2339
|
}
|
|
2273
2340
|
|
|
@@ -2303,7 +2370,8 @@
|
|
|
2303
2370
|
return requestedURL;
|
|
2304
2371
|
}
|
|
2305
2372
|
|
|
2306
|
-
const headersToObject = (thing) =>
|
|
2373
|
+
const headersToObject = (thing) =>
|
|
2374
|
+
thing instanceof AxiosHeaders$1 ? { ...thing } : thing;
|
|
2307
2375
|
|
|
2308
2376
|
/**
|
|
2309
2377
|
* Config-specific merge-function which creates a new config-object
|
|
@@ -2321,7 +2389,7 @@
|
|
|
2321
2389
|
|
|
2322
2390
|
function getMergedValue(target, source, prop, caseless) {
|
|
2323
2391
|
if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
|
|
2324
|
-
return utils$1.merge.call({caseless}, target, source);
|
|
2392
|
+
return utils$1.merge.call({ caseless }, target, source);
|
|
2325
2393
|
} else if (utils$1.isPlainObject(source)) {
|
|
2326
2394
|
return utils$1.merge({}, source);
|
|
2327
2395
|
} else if (utils$1.isArray(source)) {
|
|
@@ -2330,12 +2398,11 @@
|
|
|
2330
2398
|
return source;
|
|
2331
2399
|
}
|
|
2332
2400
|
|
|
2333
|
-
|
|
2334
|
-
function mergeDeepProperties(a, b, prop , caseless) {
|
|
2401
|
+
function mergeDeepProperties(a, b, prop, caseless) {
|
|
2335
2402
|
if (!utils$1.isUndefined(b)) {
|
|
2336
|
-
return getMergedValue(a, b, prop
|
|
2403
|
+
return getMergedValue(a, b, prop, caseless);
|
|
2337
2404
|
} else if (!utils$1.isUndefined(a)) {
|
|
2338
|
-
return getMergedValue(undefined, a, prop
|
|
2405
|
+
return getMergedValue(undefined, a, prop, caseless);
|
|
2339
2406
|
}
|
|
2340
2407
|
}
|
|
2341
2408
|
|
|
@@ -2393,14 +2460,27 @@
|
|
|
2393
2460
|
socketPath: defaultToConfig2,
|
|
2394
2461
|
responseEncoding: defaultToConfig2,
|
|
2395
2462
|
validateStatus: mergeDirectKeys,
|
|
2396
|
-
headers: (a, b
|
|
2463
|
+
headers: (a, b, prop) =>
|
|
2464
|
+
mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true),
|
|
2397
2465
|
};
|
|
2398
2466
|
|
|
2399
|
-
utils$1.forEach(
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2467
|
+
utils$1.forEach(
|
|
2468
|
+
Object.keys({ ...config1, ...config2 }),
|
|
2469
|
+
function computeConfigValue(prop) {
|
|
2470
|
+
if (
|
|
2471
|
+
prop === "__proto__" ||
|
|
2472
|
+
prop === "constructor" ||
|
|
2473
|
+
prop === "prototype"
|
|
2474
|
+
)
|
|
2475
|
+
return;
|
|
2476
|
+
const merge = utils$1.hasOwnProp(mergeMap, prop)
|
|
2477
|
+
? mergeMap[prop]
|
|
2478
|
+
: mergeDeepProperties;
|
|
2479
|
+
const configValue = merge(config1[prop], config2[prop], prop);
|
|
2480
|
+
(utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) ||
|
|
2481
|
+
(config[prop] = configValue);
|
|
2482
|
+
},
|
|
2483
|
+
);
|
|
2404
2484
|
|
|
2405
2485
|
return config;
|
|
2406
2486
|
}
|
|
@@ -2545,7 +2625,7 @@
|
|
|
2545
2625
|
return;
|
|
2546
2626
|
}
|
|
2547
2627
|
|
|
2548
|
-
reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request));
|
|
2628
|
+
reject(new AxiosError$1('Request aborted', AxiosError$1.ECONNABORTED, config, request));
|
|
2549
2629
|
|
|
2550
2630
|
// Clean up request
|
|
2551
2631
|
request = null;
|
|
@@ -2557,7 +2637,7 @@
|
|
|
2557
2637
|
// (message may be empty; when present, surface it)
|
|
2558
2638
|
// See https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/error_event
|
|
2559
2639
|
const msg = event && event.message ? event.message : 'Network Error';
|
|
2560
|
-
const err = new AxiosError(msg, AxiosError.ERR_NETWORK, config, request);
|
|
2640
|
+
const err = new AxiosError$1(msg, AxiosError$1.ERR_NETWORK, config, request);
|
|
2561
2641
|
// attach the underlying event for consumers who want details
|
|
2562
2642
|
err.event = event || null;
|
|
2563
2643
|
reject(err);
|
|
@@ -2571,9 +2651,9 @@
|
|
|
2571
2651
|
if (_config.timeoutErrorMessage) {
|
|
2572
2652
|
timeoutErrorMessage = _config.timeoutErrorMessage;
|
|
2573
2653
|
}
|
|
2574
|
-
reject(new AxiosError(
|
|
2654
|
+
reject(new AxiosError$1(
|
|
2575
2655
|
timeoutErrorMessage,
|
|
2576
|
-
transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,
|
|
2656
|
+
transitional.clarifyTimeoutError ? AxiosError$1.ETIMEDOUT : AxiosError$1.ECONNABORTED,
|
|
2577
2657
|
config,
|
|
2578
2658
|
request));
|
|
2579
2659
|
|
|
@@ -2623,7 +2703,7 @@
|
|
|
2623
2703
|
if (!request) {
|
|
2624
2704
|
return;
|
|
2625
2705
|
}
|
|
2626
|
-
reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);
|
|
2706
|
+
reject(!cancel || cancel.type ? new CanceledError$1(null, config, request) : cancel);
|
|
2627
2707
|
request.abort();
|
|
2628
2708
|
request = null;
|
|
2629
2709
|
};
|
|
@@ -2637,7 +2717,7 @@
|
|
|
2637
2717
|
const protocol = parseProtocol(_config.url);
|
|
2638
2718
|
|
|
2639
2719
|
if (protocol && platform.protocols.indexOf(protocol) === -1) {
|
|
2640
|
-
reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
|
|
2720
|
+
reject(new AxiosError$1('Unsupported protocol ' + protocol + ':', AxiosError$1.ERR_BAD_REQUEST, config));
|
|
2641
2721
|
return;
|
|
2642
2722
|
}
|
|
2643
2723
|
|
|
@@ -2660,13 +2740,13 @@
|
|
|
2660
2740
|
aborted = true;
|
|
2661
2741
|
unsubscribe();
|
|
2662
2742
|
const err = reason instanceof Error ? reason : this.reason;
|
|
2663
|
-
controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));
|
|
2743
|
+
controller.abort(err instanceof AxiosError$1 ? err : new CanceledError$1(err instanceof Error ? err.message : err));
|
|
2664
2744
|
}
|
|
2665
2745
|
};
|
|
2666
2746
|
|
|
2667
2747
|
let timer = timeout && setTimeout(() => {
|
|
2668
2748
|
timer = null;
|
|
2669
|
-
onabort(new AxiosError(`timeout ${timeout}
|
|
2749
|
+
onabort(new AxiosError$1(`timeout of ${timeout}ms exceeded`, AxiosError$1.ETIMEDOUT));
|
|
2670
2750
|
}, timeout);
|
|
2671
2751
|
|
|
2672
2752
|
const unsubscribe = () => {
|
|
@@ -2852,7 +2932,7 @@
|
|
|
2852
2932
|
return method.call(res);
|
|
2853
2933
|
}
|
|
2854
2934
|
|
|
2855
|
-
throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config);
|
|
2935
|
+
throw new AxiosError$1(`Response type '${type}' is not supported`, AxiosError$1.ERR_NOT_SUPPORT, config);
|
|
2856
2936
|
});
|
|
2857
2937
|
});
|
|
2858
2938
|
})());
|
|
@@ -3018,14 +3098,14 @@
|
|
|
3018
3098
|
|
|
3019
3099
|
if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
|
|
3020
3100
|
throw Object.assign(
|
|
3021
|
-
new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request),
|
|
3101
|
+
new AxiosError$1('Network Error', AxiosError$1.ERR_NETWORK, config, request, err && err.response),
|
|
3022
3102
|
{
|
|
3023
3103
|
cause: err.cause || err
|
|
3024
3104
|
}
|
|
3025
3105
|
)
|
|
3026
3106
|
}
|
|
3027
3107
|
|
|
3028
|
-
throw AxiosError.from(err, err && err.code, config, request);
|
|
3108
|
+
throw AxiosError$1.from(err, err && err.code, config, request, err && err.response);
|
|
3029
3109
|
}
|
|
3030
3110
|
}
|
|
3031
3111
|
};
|
|
@@ -3033,7 +3113,7 @@
|
|
|
3033
3113
|
const seedCache = new Map();
|
|
3034
3114
|
|
|
3035
3115
|
const getFetch = (config) => {
|
|
3036
|
-
let env = config
|
|
3116
|
+
let env = (config && config.env) || {};
|
|
3037
3117
|
const {fetch, Request, Response} = env;
|
|
3038
3118
|
const seeds = [
|
|
3039
3119
|
Request, Response, fetch
|
|
@@ -3056,6 +3136,15 @@
|
|
|
3056
3136
|
|
|
3057
3137
|
getFetch();
|
|
3058
3138
|
|
|
3139
|
+
/**
|
|
3140
|
+
* Known adapters mapping.
|
|
3141
|
+
* Provides environment-specific adapters for Axios:
|
|
3142
|
+
* - `http` for Node.js
|
|
3143
|
+
* - `xhr` for browsers
|
|
3144
|
+
* - `fetch` for fetch API-based requests
|
|
3145
|
+
*
|
|
3146
|
+
* @type {Object<string, Function|Object>}
|
|
3147
|
+
*/
|
|
3059
3148
|
const knownAdapters = {
|
|
3060
3149
|
http: httpAdapter,
|
|
3061
3150
|
xhr: xhrAdapter,
|
|
@@ -3064,71 +3153,107 @@
|
|
|
3064
3153
|
}
|
|
3065
3154
|
};
|
|
3066
3155
|
|
|
3156
|
+
// Assign adapter names for easier debugging and identification
|
|
3067
3157
|
utils$1.forEach(knownAdapters, (fn, value) => {
|
|
3068
3158
|
if (fn) {
|
|
3069
3159
|
try {
|
|
3070
|
-
Object.defineProperty(fn, 'name', {value});
|
|
3160
|
+
Object.defineProperty(fn, 'name', { value });
|
|
3071
3161
|
} catch (e) {
|
|
3072
3162
|
// eslint-disable-next-line no-empty
|
|
3073
3163
|
}
|
|
3074
|
-
Object.defineProperty(fn, 'adapterName', {value});
|
|
3164
|
+
Object.defineProperty(fn, 'adapterName', { value });
|
|
3075
3165
|
}
|
|
3076
3166
|
});
|
|
3077
3167
|
|
|
3168
|
+
/**
|
|
3169
|
+
* Render a rejection reason string for unknown or unsupported adapters
|
|
3170
|
+
*
|
|
3171
|
+
* @param {string} reason
|
|
3172
|
+
* @returns {string}
|
|
3173
|
+
*/
|
|
3078
3174
|
const renderReason = (reason) => `- ${reason}`;
|
|
3079
3175
|
|
|
3176
|
+
/**
|
|
3177
|
+
* Check if the adapter is resolved (function, null, or false)
|
|
3178
|
+
*
|
|
3179
|
+
* @param {Function|null|false} adapter
|
|
3180
|
+
* @returns {boolean}
|
|
3181
|
+
*/
|
|
3080
3182
|
const isResolvedHandle = (adapter) => utils$1.isFunction(adapter) || adapter === null || adapter === false;
|
|
3081
3183
|
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3184
|
+
/**
|
|
3185
|
+
* Get the first suitable adapter from the provided list.
|
|
3186
|
+
* Tries each adapter in order until a supported one is found.
|
|
3187
|
+
* Throws an AxiosError if no adapter is suitable.
|
|
3188
|
+
*
|
|
3189
|
+
* @param {Array<string|Function>|string|Function} adapters - Adapter(s) by name or function.
|
|
3190
|
+
* @param {Object} config - Axios request configuration
|
|
3191
|
+
* @throws {AxiosError} If no suitable adapter is available
|
|
3192
|
+
* @returns {Function} The resolved adapter function
|
|
3193
|
+
*/
|
|
3194
|
+
function getAdapter(adapters, config) {
|
|
3195
|
+
adapters = utils$1.isArray(adapters) ? adapters : [adapters];
|
|
3089
3196
|
|
|
3090
|
-
|
|
3197
|
+
const { length } = adapters;
|
|
3198
|
+
let nameOrAdapter;
|
|
3199
|
+
let adapter;
|
|
3091
3200
|
|
|
3092
|
-
|
|
3093
|
-
nameOrAdapter = adapters[i];
|
|
3094
|
-
let id;
|
|
3201
|
+
const rejectedReasons = {};
|
|
3095
3202
|
|
|
3096
|
-
|
|
3203
|
+
for (let i = 0; i < length; i++) {
|
|
3204
|
+
nameOrAdapter = adapters[i];
|
|
3205
|
+
let id;
|
|
3097
3206
|
|
|
3098
|
-
|
|
3099
|
-
adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
|
|
3207
|
+
adapter = nameOrAdapter;
|
|
3100
3208
|
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
}
|
|
3104
|
-
}
|
|
3209
|
+
if (!isResolvedHandle(nameOrAdapter)) {
|
|
3210
|
+
adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
|
|
3105
3211
|
|
|
3106
|
-
if (adapter
|
|
3107
|
-
|
|
3212
|
+
if (adapter === undefined) {
|
|
3213
|
+
throw new AxiosError$1(`Unknown adapter '${id}'`);
|
|
3108
3214
|
}
|
|
3215
|
+
}
|
|
3109
3216
|
|
|
3110
|
-
|
|
3217
|
+
if (adapter && (utils$1.isFunction(adapter) || (adapter = adapter.get(config)))) {
|
|
3218
|
+
break;
|
|
3111
3219
|
}
|
|
3112
3220
|
|
|
3113
|
-
|
|
3221
|
+
rejectedReasons[id || '#' + i] = adapter;
|
|
3222
|
+
}
|
|
3114
3223
|
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
)
|
|
3224
|
+
if (!adapter) {
|
|
3225
|
+
const reasons = Object.entries(rejectedReasons)
|
|
3226
|
+
.map(([id, state]) => `adapter ${id} ` +
|
|
3227
|
+
(state === false ? 'is not supported by the environment' : 'is not available in the build')
|
|
3228
|
+
);
|
|
3119
3229
|
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3230
|
+
let s = length ?
|
|
3231
|
+
(reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) :
|
|
3232
|
+
'as no adapter specified';
|
|
3123
3233
|
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3234
|
+
throw new AxiosError$1(
|
|
3235
|
+
`There is no suitable adapter to dispatch the request ` + s,
|
|
3236
|
+
'ERR_NOT_SUPPORT'
|
|
3237
|
+
);
|
|
3238
|
+
}
|
|
3129
3239
|
|
|
3130
|
-
|
|
3131
|
-
|
|
3240
|
+
return adapter;
|
|
3241
|
+
}
|
|
3242
|
+
|
|
3243
|
+
/**
|
|
3244
|
+
* Exports Axios adapters and utility to resolve an adapter
|
|
3245
|
+
*/
|
|
3246
|
+
var adapters = {
|
|
3247
|
+
/**
|
|
3248
|
+
* Resolve an adapter from a list of adapter names or functions.
|
|
3249
|
+
* @type {Function}
|
|
3250
|
+
*/
|
|
3251
|
+
getAdapter,
|
|
3252
|
+
|
|
3253
|
+
/**
|
|
3254
|
+
* Exposes all known adapters
|
|
3255
|
+
* @type {Object<string, Function|Object>}
|
|
3256
|
+
*/
|
|
3132
3257
|
adapters: knownAdapters
|
|
3133
3258
|
};
|
|
3134
3259
|
|
|
@@ -3145,7 +3270,7 @@
|
|
|
3145
3270
|
}
|
|
3146
3271
|
|
|
3147
3272
|
if (config.signal && config.signal.aborted) {
|
|
3148
|
-
throw new CanceledError(null, config);
|
|
3273
|
+
throw new CanceledError$1(null, config);
|
|
3149
3274
|
}
|
|
3150
3275
|
}
|
|
3151
3276
|
|
|
@@ -3205,7 +3330,7 @@
|
|
|
3205
3330
|
});
|
|
3206
3331
|
}
|
|
3207
3332
|
|
|
3208
|
-
const VERSION = "1.
|
|
3333
|
+
const VERSION = "1.13.5";
|
|
3209
3334
|
|
|
3210
3335
|
const validators$1 = {};
|
|
3211
3336
|
|
|
@@ -3235,9 +3360,9 @@
|
|
|
3235
3360
|
// eslint-disable-next-line func-names
|
|
3236
3361
|
return (value, opt, opts) => {
|
|
3237
3362
|
if (validator === false) {
|
|
3238
|
-
throw new AxiosError(
|
|
3363
|
+
throw new AxiosError$1(
|
|
3239
3364
|
formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')),
|
|
3240
|
-
AxiosError.ERR_DEPRECATED
|
|
3365
|
+
AxiosError$1.ERR_DEPRECATED
|
|
3241
3366
|
);
|
|
3242
3367
|
}
|
|
3243
3368
|
|
|
@@ -3276,7 +3401,7 @@
|
|
|
3276
3401
|
|
|
3277
3402
|
function assertOptions(options, schema, allowUnknown) {
|
|
3278
3403
|
if (typeof options !== 'object') {
|
|
3279
|
-
throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE);
|
|
3404
|
+
throw new AxiosError$1('options must be an object', AxiosError$1.ERR_BAD_OPTION_VALUE);
|
|
3280
3405
|
}
|
|
3281
3406
|
const keys = Object.keys(options);
|
|
3282
3407
|
let i = keys.length;
|
|
@@ -3287,12 +3412,12 @@
|
|
|
3287
3412
|
const value = options[opt];
|
|
3288
3413
|
const result = value === undefined || validator(value, opt, options);
|
|
3289
3414
|
if (result !== true) {
|
|
3290
|
-
throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE);
|
|
3415
|
+
throw new AxiosError$1('option ' + opt + ' must be ' + result, AxiosError$1.ERR_BAD_OPTION_VALUE);
|
|
3291
3416
|
}
|
|
3292
3417
|
continue;
|
|
3293
3418
|
}
|
|
3294
3419
|
if (allowUnknown !== true) {
|
|
3295
|
-
throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION);
|
|
3420
|
+
throw new AxiosError$1('Unknown option ' + opt, AxiosError$1.ERR_BAD_OPTION);
|
|
3296
3421
|
}
|
|
3297
3422
|
}
|
|
3298
3423
|
}
|
|
@@ -3373,7 +3498,8 @@
|
|
|
3373
3498
|
validator.assertOptions(transitional, {
|
|
3374
3499
|
silentJSONParsing: validators.transitional(validators.boolean),
|
|
3375
3500
|
forcedJSONParsing: validators.transitional(validators.boolean),
|
|
3376
|
-
clarifyTimeoutError: validators.transitional(validators.boolean)
|
|
3501
|
+
clarifyTimeoutError: validators.transitional(validators.boolean),
|
|
3502
|
+
legacyInterceptorReqResOrdering: validators.transitional(validators.boolean)
|
|
3377
3503
|
}, false);
|
|
3378
3504
|
}
|
|
3379
3505
|
|
|
@@ -3430,7 +3556,14 @@
|
|
|
3430
3556
|
|
|
3431
3557
|
synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
|
|
3432
3558
|
|
|
3433
|
-
|
|
3559
|
+
const transitional = config.transitional || transitionalDefaults;
|
|
3560
|
+
const legacyInterceptorReqResOrdering = transitional && transitional.legacyInterceptorReqResOrdering;
|
|
3561
|
+
|
|
3562
|
+
if (legacyInterceptorReqResOrdering) {
|
|
3563
|
+
requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
|
|
3564
|
+
} else {
|
|
3565
|
+
requestInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
|
|
3566
|
+
}
|
|
3434
3567
|
});
|
|
3435
3568
|
|
|
3436
3569
|
const responseInterceptorChain = [];
|
|
@@ -3585,7 +3718,7 @@
|
|
|
3585
3718
|
return;
|
|
3586
3719
|
}
|
|
3587
3720
|
|
|
3588
|
-
token.reason = new CanceledError(message, config, request);
|
|
3721
|
+
token.reason = new CanceledError$1(message, config, request);
|
|
3589
3722
|
resolvePromise(token.reason);
|
|
3590
3723
|
});
|
|
3591
3724
|
}
|
|
@@ -3669,7 +3802,7 @@
|
|
|
3669
3802
|
*
|
|
3670
3803
|
* ```js
|
|
3671
3804
|
* function f(x, y, z) {}
|
|
3672
|
-
*
|
|
3805
|
+
* const args = [1, 2, 3];
|
|
3673
3806
|
* f.apply(null, args);
|
|
3674
3807
|
* ```
|
|
3675
3808
|
*
|
|
@@ -3764,6 +3897,12 @@
|
|
|
3764
3897
|
LoopDetected: 508,
|
|
3765
3898
|
NotExtended: 510,
|
|
3766
3899
|
NetworkAuthenticationRequired: 511,
|
|
3900
|
+
WebServerIsDown: 521,
|
|
3901
|
+
ConnectionTimedOut: 522,
|
|
3902
|
+
OriginIsUnreachable: 523,
|
|
3903
|
+
TimeoutOccurred: 524,
|
|
3904
|
+
SslHandshakeFailed: 525,
|
|
3905
|
+
InvalidSslCertificate: 526,
|
|
3767
3906
|
};
|
|
3768
3907
|
|
|
3769
3908
|
Object.entries(HttpStatusCode).forEach(([key, value]) => {
|
|
@@ -3804,14 +3943,14 @@
|
|
|
3804
3943
|
axios.Axios = Axios$1;
|
|
3805
3944
|
|
|
3806
3945
|
// Expose Cancel & CancelToken
|
|
3807
|
-
axios.CanceledError = CanceledError;
|
|
3946
|
+
axios.CanceledError = CanceledError$1;
|
|
3808
3947
|
axios.CancelToken = CancelToken$1;
|
|
3809
3948
|
axios.isCancel = isCancel;
|
|
3810
3949
|
axios.VERSION = VERSION;
|
|
3811
3950
|
axios.toFormData = toFormData;
|
|
3812
3951
|
|
|
3813
3952
|
// Expose AxiosError class
|
|
3814
|
-
axios.AxiosError = AxiosError;
|
|
3953
|
+
axios.AxiosError = AxiosError$1;
|
|
3815
3954
|
|
|
3816
3955
|
// alias for CanceledError for backward compatibility
|
|
3817
3956
|
axios.Cancel = axios.CanceledError;
|
|
@@ -3953,6 +4092,64 @@
|
|
|
3953
4092
|
};
|
|
3954
4093
|
return this._sendDelete(url, data);
|
|
3955
4094
|
}
|
|
4095
|
+
getUploadLink(page_id) {
|
|
4096
|
+
let upload_type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'file';
|
|
4097
|
+
const url = `${this.server}api/v2.1/universal-apps/${this.appUuid}/html-page-upload-link/`;
|
|
4098
|
+
return this.req.get(url, {
|
|
4099
|
+
params: {
|
|
4100
|
+
page_id,
|
|
4101
|
+
upload_type
|
|
4102
|
+
}
|
|
4103
|
+
});
|
|
4104
|
+
}
|
|
4105
|
+
uploadAsset(upload_link, form_data) {
|
|
4106
|
+
return axios$1.create()({
|
|
4107
|
+
method: 'post',
|
|
4108
|
+
url: `${upload_link}?ret-json=1`,
|
|
4109
|
+
data: form_data
|
|
4110
|
+
});
|
|
4111
|
+
}
|
|
4112
|
+
async upload(pageId, file) {
|
|
4113
|
+
let upload_type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'file';
|
|
4114
|
+
let uploadLinkRes = null;
|
|
4115
|
+
try {
|
|
4116
|
+
uploadLinkRes = await this.getUploadLink(pageId, upload_type);
|
|
4117
|
+
} catch (error) {
|
|
4118
|
+
throw new Error(`Failed to get upload link: ${error.message}`);
|
|
4119
|
+
}
|
|
4120
|
+
if (!uploadLinkRes || !uploadLinkRes.data) {
|
|
4121
|
+
throw new Error('Failed to get upload link: empty response');
|
|
4122
|
+
}
|
|
4123
|
+
const {
|
|
4124
|
+
upload_link,
|
|
4125
|
+
parent_path,
|
|
4126
|
+
img_relative_path,
|
|
4127
|
+
file_relative_path,
|
|
4128
|
+
asset_parent_url
|
|
4129
|
+
} = uploadLinkRes.data;
|
|
4130
|
+
const relativePath = upload_type === 'image' ? img_relative_path : file_relative_path;
|
|
4131
|
+
const formData = new FormData();
|
|
4132
|
+
formData.append('parent_dir', parent_path);
|
|
4133
|
+
formData.append('relative_path', relativePath);
|
|
4134
|
+
formData.append('file', file, file.name);
|
|
4135
|
+
let uploadRes = null;
|
|
4136
|
+
try {
|
|
4137
|
+
uploadRes = await this.uploadAsset(upload_link, formData);
|
|
4138
|
+
} catch (error) {
|
|
4139
|
+
throw new Error(`Failed to get upload link: ${error.message}`);
|
|
4140
|
+
}
|
|
4141
|
+
const uploadedFile = uploadRes?.data?.[0];
|
|
4142
|
+
if (!uploadedFile) {
|
|
4143
|
+
throw new Error('Failed to upload file: empty response');
|
|
4144
|
+
}
|
|
4145
|
+
const url = `${asset_parent_url}/${relativePath}/${encodeURIComponent(uploadedFile.name)}`;
|
|
4146
|
+
return {
|
|
4147
|
+
name: uploadedFile.name,
|
|
4148
|
+
size: uploadedFile.size,
|
|
4149
|
+
type: upload_type,
|
|
4150
|
+
url
|
|
4151
|
+
};
|
|
4152
|
+
}
|
|
3956
4153
|
}
|
|
3957
4154
|
|
|
3958
4155
|
const POST_MESSAGE_TYPE = {
|
|
@@ -4306,10 +4503,9 @@
|
|
|
4306
4503
|
addRow(_ref2) {
|
|
4307
4504
|
let {
|
|
4308
4505
|
tableName,
|
|
4309
|
-
rowData
|
|
4310
|
-
rowLinksData
|
|
4506
|
+
rowData
|
|
4311
4507
|
} = _ref2;
|
|
4312
|
-
return this.htmlPageAPI.addRow(this.options.pageId, tableName, rowData
|
|
4508
|
+
return this.htmlPageAPI.addRow(this.options.pageId, tableName, rowData);
|
|
4313
4509
|
}
|
|
4314
4510
|
updateRow(_ref3) {
|
|
4315
4511
|
let {
|
|
@@ -4340,10 +4536,9 @@
|
|
|
4340
4536
|
batchAddRows(_ref5) {
|
|
4341
4537
|
let {
|
|
4342
4538
|
tableName,
|
|
4343
|
-
rowsData
|
|
4344
|
-
rowsLinksData
|
|
4539
|
+
rowsData
|
|
4345
4540
|
} = _ref5;
|
|
4346
|
-
return this.htmlPageAPI.addRows(this.options.pageId, tableName, rowsData
|
|
4541
|
+
return this.htmlPageAPI.addRows(this.options.pageId, tableName, rowsData);
|
|
4347
4542
|
}
|
|
4348
4543
|
batchUpdateRows(_ref6) {
|
|
4349
4544
|
let {
|
|
@@ -4359,6 +4554,18 @@
|
|
|
4359
4554
|
} = _ref7;
|
|
4360
4555
|
return this.htmlPageAPI.deleteRows(this.options.pageId, tableName, rowsIds);
|
|
4361
4556
|
}
|
|
4557
|
+
uploadFile(_ref8) {
|
|
4558
|
+
let {
|
|
4559
|
+
file
|
|
4560
|
+
} = _ref8;
|
|
4561
|
+
return this.htmlPageAPI.upload(this.options.pageId, file);
|
|
4562
|
+
}
|
|
4563
|
+
uploadImage(_ref9) {
|
|
4564
|
+
let {
|
|
4565
|
+
file
|
|
4566
|
+
} = _ref9;
|
|
4567
|
+
return this.htmlPageAPI.upload(this.options.pageId, file, 'image');
|
|
4568
|
+
}
|
|
4362
4569
|
}
|
|
4363
4570
|
|
|
4364
4571
|
return HTMLPageSDK;
|