extra-request 3.0.1 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/dist/es2015/index.min.mjs +2 -2
- package/dist/es2015/index.min.mjs.map +1 -1
- package/dist/es2015/index.mjs +197 -30
- package/dist/es2015/index.mjs.map +1 -1
- package/dist/es2015/index.umd.js +199 -32
- package/dist/es2015/index.umd.js.map +1 -1
- package/dist/es2015/index.umd.min.js +2 -2
- package/dist/es2015/index.umd.min.js.map +1 -1
- package/dist/es2018/index.min.mjs +2 -2
- package/dist/es2018/index.min.mjs.map +1 -1
- package/dist/es2018/index.mjs +197 -30
- package/dist/es2018/index.mjs.map +1 -1
- package/dist/es2018/index.umd.js +199 -32
- package/dist/es2018/index.umd.js.map +1 -1
- package/dist/es2018/index.umd.min.js +2 -2
- package/dist/es2018/index.umd.min.js.map +1 -1
- package/lib/es2015/transformers/form-data-field.js +2 -1
- package/lib/es2015/transformers/form-data-field.js.map +1 -1
- package/lib/es2018/transformers/form-data-field.js +2 -1
- package/lib/es2018/transformers/form-data-field.js.map +1 -1
- package/package.json +24 -25
package/dist/es2015/index.umd.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
3
3
|
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
|
4
4
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ExtraRequest = {}));
|
|
5
|
-
}(this, (function (exports) { 'use strict';
|
|
5
|
+
})(this, (function (exports) { 'use strict';
|
|
6
6
|
|
|
7
7
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
8
8
|
|
|
@@ -38,6 +38,11 @@
|
|
|
38
38
|
abortController_browser.AbortController = void 0;
|
|
39
39
|
abortController_browser.AbortController = globalThis.AbortController;
|
|
40
40
|
|
|
41
|
+
var abortError_browser = {};
|
|
42
|
+
|
|
43
|
+
abortError_browser.AbortError = void 0;
|
|
44
|
+
abortError_browser.AbortError = globalThis.DOMException;
|
|
45
|
+
|
|
41
46
|
var blob_browser = {};
|
|
42
47
|
|
|
43
48
|
blob_browser.Blob = void 0;
|
|
@@ -64,6 +69,7 @@
|
|
|
64
69
|
__exportStar(response_browser, exports);
|
|
65
70
|
__exportStar(formData_browser, exports);
|
|
66
71
|
__exportStar(abortController_browser, exports);
|
|
72
|
+
__exportStar(abortError_browser, exports);
|
|
67
73
|
__exportStar(blob_browser, exports);
|
|
68
74
|
__exportStar(eventSource_browser, exports);
|
|
69
75
|
|
|
@@ -121,8 +127,8 @@
|
|
|
121
127
|
const null_1$1 = _null;
|
|
122
128
|
const undefined_1$2 = _undefined;
|
|
123
129
|
function isAsyncIterable(val) {
|
|
124
|
-
return null_1$1.isntNull(val)
|
|
125
|
-
&& undefined_1$2.isntUndefined(val)
|
|
130
|
+
return (0, null_1$1.isntNull)(val)
|
|
131
|
+
&& (0, undefined_1$2.isntUndefined)(val)
|
|
126
132
|
&& typeof val[Symbol.asyncIterator] === 'function';
|
|
127
133
|
}
|
|
128
134
|
asyncIterable.isAsyncIterable = isAsyncIterable;
|
|
@@ -172,7 +178,7 @@
|
|
|
172
178
|
char.isntChar = char.isChar = void 0;
|
|
173
179
|
const string_1$1 = string;
|
|
174
180
|
function isChar(val) {
|
|
175
|
-
return string_1$1.isString(val)
|
|
181
|
+
return (0, string_1$1.isString)(val)
|
|
176
182
|
&& val.length === 1;
|
|
177
183
|
}
|
|
178
184
|
char.isChar = isChar;
|
|
@@ -201,6 +207,18 @@
|
|
|
201
207
|
}
|
|
202
208
|
_enum.inEnum = inEnum;
|
|
203
209
|
|
|
210
|
+
var error = {};
|
|
211
|
+
|
|
212
|
+
error.isntError = error.isError = void 0;
|
|
213
|
+
function isError(val) {
|
|
214
|
+
return val instanceof Error;
|
|
215
|
+
}
|
|
216
|
+
error.isError = isError;
|
|
217
|
+
function isntError(val) {
|
|
218
|
+
return !isError(val);
|
|
219
|
+
}
|
|
220
|
+
error.isntError = isntError;
|
|
221
|
+
|
|
204
222
|
var falsy = {};
|
|
205
223
|
|
|
206
224
|
falsy.isntFalsy = falsy.isFalsy = void 0;
|
|
@@ -231,8 +249,8 @@
|
|
|
231
249
|
const null_1 = _null;
|
|
232
250
|
const undefined_1$1 = _undefined;
|
|
233
251
|
function isIterable(val) {
|
|
234
|
-
return null_1.isntNull(val)
|
|
235
|
-
&& undefined_1$1.isntUndefined(val)
|
|
252
|
+
return (0, null_1.isntNull)(val)
|
|
253
|
+
&& (0, undefined_1$1.isntUndefined)(val)
|
|
236
254
|
&& typeof val[Symbol.iterator] === 'function';
|
|
237
255
|
}
|
|
238
256
|
iterable.isIterable = isIterable;
|
|
@@ -245,19 +263,167 @@
|
|
|
245
263
|
|
|
246
264
|
var object = {};
|
|
247
265
|
|
|
248
|
-
|
|
266
|
+
/**
|
|
267
|
+
* lodash (Custom Build) <https://lodash.com/>
|
|
268
|
+
* Build: `lodash modularize exports="npm" -o ./`
|
|
269
|
+
* Copyright jQuery Foundation and other contributors <https://jquery.org/>
|
|
270
|
+
* Released under MIT license <https://lodash.com/license>
|
|
271
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
272
|
+
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
273
|
+
*/
|
|
274
|
+
|
|
275
|
+
/** `Object#toString` result references. */
|
|
276
|
+
var objectTag = '[object Object]';
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* Checks if `value` is a host object in IE < 9.
|
|
280
|
+
*
|
|
281
|
+
* @private
|
|
282
|
+
* @param {*} value The value to check.
|
|
283
|
+
* @returns {boolean} Returns `true` if `value` is a host object, else `false`.
|
|
284
|
+
*/
|
|
285
|
+
function isHostObject(value) {
|
|
286
|
+
// Many host objects are `Object` objects that can coerce to strings
|
|
287
|
+
// despite having improperly defined `toString` methods.
|
|
288
|
+
var result = false;
|
|
289
|
+
if (value != null && typeof value.toString != 'function') {
|
|
290
|
+
try {
|
|
291
|
+
result = !!(value + '');
|
|
292
|
+
} catch (e) {}
|
|
293
|
+
}
|
|
294
|
+
return result;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* Creates a unary function that invokes `func` with its argument transformed.
|
|
299
|
+
*
|
|
300
|
+
* @private
|
|
301
|
+
* @param {Function} func The function to wrap.
|
|
302
|
+
* @param {Function} transform The argument transform.
|
|
303
|
+
* @returns {Function} Returns the new function.
|
|
304
|
+
*/
|
|
305
|
+
function overArg(func, transform) {
|
|
306
|
+
return function(arg) {
|
|
307
|
+
return func(transform(arg));
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
/** Used for built-in method references. */
|
|
312
|
+
var funcProto = Function.prototype,
|
|
313
|
+
objectProto = Object.prototype;
|
|
314
|
+
|
|
315
|
+
/** Used to resolve the decompiled source of functions. */
|
|
316
|
+
var funcToString = funcProto.toString;
|
|
317
|
+
|
|
318
|
+
/** Used to check objects for own properties. */
|
|
319
|
+
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
320
|
+
|
|
321
|
+
/** Used to infer the `Object` constructor. */
|
|
322
|
+
var objectCtorString = funcToString.call(Object);
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* Used to resolve the
|
|
326
|
+
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
327
|
+
* of values.
|
|
328
|
+
*/
|
|
329
|
+
var objectToString = objectProto.toString;
|
|
330
|
+
|
|
331
|
+
/** Built-in value references. */
|
|
332
|
+
var getPrototype = overArg(Object.getPrototypeOf, Object);
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
|
336
|
+
* and has a `typeof` result of "object".
|
|
337
|
+
*
|
|
338
|
+
* @static
|
|
339
|
+
* @memberOf _
|
|
340
|
+
* @since 4.0.0
|
|
341
|
+
* @category Lang
|
|
342
|
+
* @param {*} value The value to check.
|
|
343
|
+
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
|
344
|
+
* @example
|
|
345
|
+
*
|
|
346
|
+
* _.isObjectLike({});
|
|
347
|
+
* // => true
|
|
348
|
+
*
|
|
349
|
+
* _.isObjectLike([1, 2, 3]);
|
|
350
|
+
* // => true
|
|
351
|
+
*
|
|
352
|
+
* _.isObjectLike(_.noop);
|
|
353
|
+
* // => false
|
|
354
|
+
*
|
|
355
|
+
* _.isObjectLike(null);
|
|
356
|
+
* // => false
|
|
357
|
+
*/
|
|
358
|
+
function isObjectLike(value) {
|
|
359
|
+
return !!value && typeof value == 'object';
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* Checks if `value` is a plain object, that is, an object created by the
|
|
364
|
+
* `Object` constructor or one with a `[[Prototype]]` of `null`.
|
|
365
|
+
*
|
|
366
|
+
* @static
|
|
367
|
+
* @memberOf _
|
|
368
|
+
* @since 0.8.0
|
|
369
|
+
* @category Lang
|
|
370
|
+
* @param {*} value The value to check.
|
|
371
|
+
* @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
|
|
372
|
+
* @example
|
|
373
|
+
*
|
|
374
|
+
* function Foo() {
|
|
375
|
+
* this.a = 1;
|
|
376
|
+
* }
|
|
377
|
+
*
|
|
378
|
+
* _.isPlainObject(new Foo);
|
|
379
|
+
* // => false
|
|
380
|
+
*
|
|
381
|
+
* _.isPlainObject([1, 2, 3]);
|
|
382
|
+
* // => false
|
|
383
|
+
*
|
|
384
|
+
* _.isPlainObject({ 'x': 0, 'y': 0 });
|
|
385
|
+
* // => true
|
|
386
|
+
*
|
|
387
|
+
* _.isPlainObject(Object.create(null));
|
|
388
|
+
* // => true
|
|
389
|
+
*/
|
|
390
|
+
function isPlainObject$1(value) {
|
|
391
|
+
if (!isObjectLike(value) ||
|
|
392
|
+
objectToString.call(value) != objectTag || isHostObject(value)) {
|
|
393
|
+
return false;
|
|
394
|
+
}
|
|
395
|
+
var proto = getPrototype(value);
|
|
396
|
+
if (proto === null) {
|
|
397
|
+
return true;
|
|
398
|
+
}
|
|
399
|
+
var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
|
|
400
|
+
return (typeof Ctor == 'function' &&
|
|
401
|
+
Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString);
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
var lodash_isplainobject = isPlainObject$1;
|
|
405
|
+
|
|
406
|
+
var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
|
|
407
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
408
|
+
};object.isntEmptyObject = object.isEmptyObject = object.isntPlainObject = object.isPlainObject = object.isntObject = object.isObject = void 0;
|
|
409
|
+
const lodash_isplainobject_1 = __importDefault(lodash_isplainobject);
|
|
249
410
|
function isObject(val) {
|
|
250
|
-
return val !== null
|
|
411
|
+
return val !== null
|
|
412
|
+
&& typeof val === 'object';
|
|
251
413
|
}
|
|
252
414
|
object.isObject = isObject;
|
|
253
415
|
function isntObject(val) {
|
|
254
416
|
return !isObject(val);
|
|
255
417
|
}
|
|
256
418
|
object.isntObject = isntObject;
|
|
257
|
-
function
|
|
258
|
-
return
|
|
419
|
+
function isPlainObject(val) {
|
|
420
|
+
return (0, lodash_isplainobject_1.default)(val);
|
|
421
|
+
}
|
|
422
|
+
object.isPlainObject = isPlainObject;
|
|
423
|
+
function isntPlainObject(val) {
|
|
424
|
+
return !isPlainObject(val);
|
|
259
425
|
}
|
|
260
|
-
object.
|
|
426
|
+
object.isntPlainObject = isntPlainObject;
|
|
261
427
|
function isEmptyObject(val) {
|
|
262
428
|
return Object.keys(val).length === 0;
|
|
263
429
|
}
|
|
@@ -286,16 +452,16 @@
|
|
|
286
452
|
const number_1 = number;
|
|
287
453
|
const undefined_1 = _undefined;
|
|
288
454
|
function isJsonRpcId(val) {
|
|
289
|
-
return string_1.isString(val) || number_1.isNumber(val);
|
|
455
|
+
return (0, string_1.isString)(val) || (0, number_1.isNumber)(val);
|
|
290
456
|
}
|
|
291
457
|
function isJsonRpcParams(val) {
|
|
292
|
-
return array_1.isArray(val) || object_1.isObject(val);
|
|
458
|
+
return (0, array_1.isArray)(val) || (0, object_1.isObject)(val);
|
|
293
459
|
}
|
|
294
460
|
function isJsonRpcNotification(val) {
|
|
295
|
-
return object_1.
|
|
296
|
-
&& string_1.isString(val.jsonrpc)
|
|
297
|
-
&& string_1.isString(val.method)
|
|
298
|
-
&& undefined_1.isUndefined(val.id)
|
|
461
|
+
return (0, object_1.isPlainObject)(val)
|
|
462
|
+
&& (0, string_1.isString)(val.jsonrpc)
|
|
463
|
+
&& (0, string_1.isString)(val.method)
|
|
464
|
+
&& (0, undefined_1.isUndefined)(val.id)
|
|
299
465
|
&& isJsonRpcParams(val.params);
|
|
300
466
|
}
|
|
301
467
|
jsonRpc.isJsonRpcNotification = isJsonRpcNotification;
|
|
@@ -304,9 +470,9 @@
|
|
|
304
470
|
}
|
|
305
471
|
jsonRpc.isntJsonRpcNotification = isntJsonRpcNotification;
|
|
306
472
|
function isJsonRpcRequest(val) {
|
|
307
|
-
return object_1.
|
|
308
|
-
&& string_1.isString(val.jsonrpc)
|
|
309
|
-
&& string_1.isString(val.method)
|
|
473
|
+
return (0, object_1.isPlainObject)(val)
|
|
474
|
+
&& (0, string_1.isString)(val.jsonrpc)
|
|
475
|
+
&& (0, string_1.isString)(val.method)
|
|
310
476
|
&& isJsonRpcId(val.id)
|
|
311
477
|
&& isJsonRpcParams(val.params);
|
|
312
478
|
}
|
|
@@ -316,10 +482,10 @@
|
|
|
316
482
|
}
|
|
317
483
|
jsonRpc.isntJsonRpcRequest = isntJsonRpcRequest;
|
|
318
484
|
function isJsonRpcSuccess(val) {
|
|
319
|
-
return object_1.
|
|
320
|
-
&& string_1.isString(val.jsonrpc)
|
|
321
|
-
&& string_1.isString(val.id)
|
|
322
|
-
&&
|
|
485
|
+
return (0, object_1.isPlainObject)(val)
|
|
486
|
+
&& (0, string_1.isString)(val.jsonrpc)
|
|
487
|
+
&& (0, string_1.isString)(val.id)
|
|
488
|
+
&& 'result' in val;
|
|
323
489
|
}
|
|
324
490
|
jsonRpc.isJsonRpcSuccess = isJsonRpcSuccess;
|
|
325
491
|
function isntJsonRpcSuccess(val) {
|
|
@@ -327,8 +493,8 @@
|
|
|
327
493
|
}
|
|
328
494
|
jsonRpc.isntJsonRpcSuccess = isntJsonRpcSuccess;
|
|
329
495
|
function isJsonRpcError(val) {
|
|
330
|
-
return object_1.
|
|
331
|
-
&& string_1.isString(val.jsonrpc)
|
|
496
|
+
return (0, object_1.isPlainObject)(val)
|
|
497
|
+
&& (0, string_1.isString)(val.jsonrpc)
|
|
332
498
|
&& isJsonRpcId(val.id)
|
|
333
499
|
&& isJsonRpcErrorObject(val.error);
|
|
334
500
|
}
|
|
@@ -338,10 +504,10 @@
|
|
|
338
504
|
}
|
|
339
505
|
jsonRpc.isntJsonRpcError = isntJsonRpcError;
|
|
340
506
|
function isJsonRpcErrorObject(val) {
|
|
341
|
-
return object_1.
|
|
342
|
-
&& number_1.isNumber(val.code)
|
|
343
|
-
&& string_1.isString(val.message)
|
|
344
|
-
&& (undefined_1.isUndefined(val.data) || object_1.isObject(val.data));
|
|
507
|
+
return (0, object_1.isPlainObject)(val)
|
|
508
|
+
&& (0, number_1.isNumber)(val.code)
|
|
509
|
+
&& (0, string_1.isString)(val.message)
|
|
510
|
+
&& ((0, undefined_1.isUndefined)(val.data) || (0, object_1.isObject)(val.data));
|
|
345
511
|
}
|
|
346
512
|
|
|
347
513
|
var json$1 = {};
|
|
@@ -393,6 +559,7 @@
|
|
|
393
559
|
__exportStar(char, exports);
|
|
394
560
|
__exportStar(date, exports);
|
|
395
561
|
__exportStar(_enum, exports);
|
|
562
|
+
__exportStar(error, exports);
|
|
396
563
|
__exportStar(falsy, exports);
|
|
397
564
|
__exportStar(_function, exports);
|
|
398
565
|
__exportStar(iterable, exports);
|
|
@@ -675,7 +842,7 @@
|
|
|
675
842
|
const formData = options.payload instanceof es2018$2.FormData
|
|
676
843
|
? cloneFormData(options.payload)
|
|
677
844
|
: new es2018$2.FormData();
|
|
678
|
-
if (
|
|
845
|
+
if (es2018$1.isArray(value)) {
|
|
679
846
|
value.forEach(x => formData.append(name, x));
|
|
680
847
|
}
|
|
681
848
|
else {
|
|
@@ -790,5 +957,5 @@
|
|
|
790
957
|
|
|
791
958
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
792
959
|
|
|
793
|
-
}))
|
|
960
|
+
}));
|
|
794
961
|
//# sourceMappingURL=index.umd.js.map
|