@builderbot/provider-evolution-api 1.3.2-y.0 → 1.3.3
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.cjs +272 -271
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -8,7 +8,7 @@ var require$$3 = require('http');
|
|
|
8
8
|
var require$$4 = require('https');
|
|
9
9
|
var require$$0$1 = require('url');
|
|
10
10
|
var fs$1 = require('fs');
|
|
11
|
-
var
|
|
11
|
+
var require$$8 = require('crypto');
|
|
12
12
|
var require$$4$1 = require('assert');
|
|
13
13
|
var require$$1$2 = require('tty');
|
|
14
14
|
var require$$0$2 = require('os');
|
|
@@ -66,7 +66,7 @@ var json = function (opts={}) {
|
|
|
66
66
|
};
|
|
67
67
|
};
|
|
68
68
|
|
|
69
|
-
function bind$
|
|
69
|
+
function bind$2(fn, thisArg) {
|
|
70
70
|
return function wrap() {
|
|
71
71
|
return fn.apply(thisArg, arguments);
|
|
72
72
|
};
|
|
@@ -206,6 +206,27 @@ const isPlainObject = (val) => {
|
|
|
206
206
|
return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(toStringTag$1 in val) && !(iterator in val);
|
|
207
207
|
};
|
|
208
208
|
|
|
209
|
+
/**
|
|
210
|
+
* Determine if a value is an empty object (safely handles Buffers)
|
|
211
|
+
*
|
|
212
|
+
* @param {*} val The value to test
|
|
213
|
+
*
|
|
214
|
+
* @returns {boolean} True if value is an empty object, otherwise false
|
|
215
|
+
*/
|
|
216
|
+
const isEmptyObject = (val) => {
|
|
217
|
+
// Early return for non-objects or Buffers to prevent RangeError
|
|
218
|
+
if (!isObject(val) || isBuffer$1(val)) {
|
|
219
|
+
return false;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
try {
|
|
223
|
+
return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
|
|
224
|
+
} catch (e) {
|
|
225
|
+
// Fallback for any other objects that might cause RangeError with Object.keys()
|
|
226
|
+
return false;
|
|
227
|
+
}
|
|
228
|
+
};
|
|
229
|
+
|
|
209
230
|
/**
|
|
210
231
|
* Determine if a value is a Date
|
|
211
232
|
*
|
|
@@ -328,6 +349,11 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) {
|
|
|
328
349
|
fn.call(null, obj[i], i, obj);
|
|
329
350
|
}
|
|
330
351
|
} else {
|
|
352
|
+
// Buffer check
|
|
353
|
+
if (isBuffer$1(obj)) {
|
|
354
|
+
return;
|
|
355
|
+
}
|
|
356
|
+
|
|
331
357
|
// Iterate over object keys
|
|
332
358
|
const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
|
|
333
359
|
const len = keys.length;
|
|
@@ -341,6 +367,10 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) {
|
|
|
341
367
|
}
|
|
342
368
|
|
|
343
369
|
function findKey(obj, key) {
|
|
370
|
+
if (isBuffer$1(obj)){
|
|
371
|
+
return null;
|
|
372
|
+
}
|
|
373
|
+
|
|
344
374
|
key = key.toLowerCase();
|
|
345
375
|
const keys = Object.keys(obj);
|
|
346
376
|
let i = keys.length;
|
|
@@ -415,7 +445,7 @@ function merge(/* obj1, obj2, obj3, ... */) {
|
|
|
415
445
|
const extend = (a, b, thisArg, {allOwnKeys}= {}) => {
|
|
416
446
|
forEach(b, (val, key) => {
|
|
417
447
|
if (thisArg && isFunction$1(val)) {
|
|
418
|
-
a[key] = bind$
|
|
448
|
+
a[key] = bind$2(val, thisArg);
|
|
419
449
|
} else {
|
|
420
450
|
a[key] = val;
|
|
421
451
|
}
|
|
@@ -694,6 +724,11 @@ const toJSONObject = (obj) => {
|
|
|
694
724
|
return;
|
|
695
725
|
}
|
|
696
726
|
|
|
727
|
+
//Buffer check
|
|
728
|
+
if (isBuffer$1(source)) {
|
|
729
|
+
return source;
|
|
730
|
+
}
|
|
731
|
+
|
|
697
732
|
if(!('toJSON' in source)) {
|
|
698
733
|
stack[i] = source;
|
|
699
734
|
const target = isArray(source) ? [] : {};
|
|
@@ -765,6 +800,7 @@ var utils$1 = {
|
|
|
765
800
|
isBoolean,
|
|
766
801
|
isObject,
|
|
767
802
|
isPlainObject,
|
|
803
|
+
isEmptyObject,
|
|
768
804
|
isReadableStream,
|
|
769
805
|
isRequest,
|
|
770
806
|
isResponse,
|
|
@@ -12563,7 +12599,7 @@ var abs$1 = Math.abs;
|
|
|
12563
12599
|
var floor$1 = Math.floor;
|
|
12564
12600
|
|
|
12565
12601
|
/** @type {import('./max')} */
|
|
12566
|
-
var max$
|
|
12602
|
+
var max$2 = Math.max;
|
|
12567
12603
|
|
|
12568
12604
|
/** @type {import('./min')} */
|
|
12569
12605
|
var min$1 = Math.min;
|
|
@@ -12720,110 +12756,92 @@ function requireObject_getPrototypeOf () {
|
|
|
12720
12756
|
return Object_getPrototypeOf;
|
|
12721
12757
|
}
|
|
12722
12758
|
|
|
12723
|
-
|
|
12724
|
-
var hasRequiredImplementation;
|
|
12725
|
-
|
|
12726
|
-
function requireImplementation () {
|
|
12727
|
-
if (hasRequiredImplementation) return implementation;
|
|
12728
|
-
hasRequiredImplementation = 1;
|
|
12729
|
-
|
|
12730
|
-
/* eslint no-invalid-this: 1 */
|
|
12731
|
-
|
|
12732
|
-
var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
|
|
12733
|
-
var toStr = Object.prototype.toString;
|
|
12734
|
-
var max = Math.max;
|
|
12735
|
-
var funcType = '[object Function]';
|
|
12759
|
+
/* eslint no-invalid-this: 1 */
|
|
12736
12760
|
|
|
12737
|
-
|
|
12738
|
-
|
|
12739
|
-
|
|
12740
|
-
|
|
12741
|
-
arr[i] = a[i];
|
|
12742
|
-
}
|
|
12743
|
-
for (var j = 0; j < b.length; j += 1) {
|
|
12744
|
-
arr[j + a.length] = b[j];
|
|
12745
|
-
}
|
|
12761
|
+
var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
|
|
12762
|
+
var toStr = Object.prototype.toString;
|
|
12763
|
+
var max$1 = Math.max;
|
|
12764
|
+
var funcType = '[object Function]';
|
|
12746
12765
|
|
|
12747
|
-
|
|
12748
|
-
|
|
12766
|
+
var concatty = function concatty(a, b) {
|
|
12767
|
+
var arr = [];
|
|
12749
12768
|
|
|
12750
|
-
|
|
12751
|
-
|
|
12752
|
-
|
|
12753
|
-
|
|
12754
|
-
|
|
12755
|
-
|
|
12756
|
-
};
|
|
12769
|
+
for (var i = 0; i < a.length; i += 1) {
|
|
12770
|
+
arr[i] = a[i];
|
|
12771
|
+
}
|
|
12772
|
+
for (var j = 0; j < b.length; j += 1) {
|
|
12773
|
+
arr[j + a.length] = b[j];
|
|
12774
|
+
}
|
|
12757
12775
|
|
|
12758
|
-
|
|
12759
|
-
|
|
12760
|
-
for (var i = 0; i < arr.length; i += 1) {
|
|
12761
|
-
str += arr[i];
|
|
12762
|
-
if (i + 1 < arr.length) {
|
|
12763
|
-
str += joiner;
|
|
12764
|
-
}
|
|
12765
|
-
}
|
|
12766
|
-
return str;
|
|
12767
|
-
};
|
|
12776
|
+
return arr;
|
|
12777
|
+
};
|
|
12768
12778
|
|
|
12769
|
-
|
|
12770
|
-
|
|
12771
|
-
|
|
12772
|
-
|
|
12773
|
-
|
|
12774
|
-
|
|
12775
|
-
|
|
12776
|
-
var bound;
|
|
12777
|
-
var binder = function () {
|
|
12778
|
-
if (this instanceof bound) {
|
|
12779
|
-
var result = target.apply(
|
|
12780
|
-
this,
|
|
12781
|
-
concatty(args, arguments)
|
|
12782
|
-
);
|
|
12783
|
-
if (Object(result) === result) {
|
|
12784
|
-
return result;
|
|
12785
|
-
}
|
|
12786
|
-
return this;
|
|
12787
|
-
}
|
|
12788
|
-
return target.apply(
|
|
12789
|
-
that,
|
|
12790
|
-
concatty(args, arguments)
|
|
12791
|
-
);
|
|
12779
|
+
var slicy = function slicy(arrLike, offset) {
|
|
12780
|
+
var arr = [];
|
|
12781
|
+
for (var i = offset, j = 0; i < arrLike.length; i += 1, j += 1) {
|
|
12782
|
+
arr[j] = arrLike[i];
|
|
12783
|
+
}
|
|
12784
|
+
return arr;
|
|
12785
|
+
};
|
|
12792
12786
|
|
|
12793
|
-
|
|
12787
|
+
var joiny = function (arr, joiner) {
|
|
12788
|
+
var str = '';
|
|
12789
|
+
for (var i = 0; i < arr.length; i += 1) {
|
|
12790
|
+
str += arr[i];
|
|
12791
|
+
if (i + 1 < arr.length) {
|
|
12792
|
+
str += joiner;
|
|
12793
|
+
}
|
|
12794
|
+
}
|
|
12795
|
+
return str;
|
|
12796
|
+
};
|
|
12794
12797
|
|
|
12795
|
-
|
|
12796
|
-
|
|
12797
|
-
|
|
12798
|
-
|
|
12799
|
-
|
|
12798
|
+
var implementation$1 = function bind(that) {
|
|
12799
|
+
var target = this;
|
|
12800
|
+
if (typeof target !== 'function' || toStr.apply(target) !== funcType) {
|
|
12801
|
+
throw new TypeError(ERROR_MESSAGE + target);
|
|
12802
|
+
}
|
|
12803
|
+
var args = slicy(arguments, 1);
|
|
12804
|
+
|
|
12805
|
+
var bound;
|
|
12806
|
+
var binder = function () {
|
|
12807
|
+
if (this instanceof bound) {
|
|
12808
|
+
var result = target.apply(
|
|
12809
|
+
this,
|
|
12810
|
+
concatty(args, arguments)
|
|
12811
|
+
);
|
|
12812
|
+
if (Object(result) === result) {
|
|
12813
|
+
return result;
|
|
12814
|
+
}
|
|
12815
|
+
return this;
|
|
12816
|
+
}
|
|
12817
|
+
return target.apply(
|
|
12818
|
+
that,
|
|
12819
|
+
concatty(args, arguments)
|
|
12820
|
+
);
|
|
12800
12821
|
|
|
12801
|
-
|
|
12822
|
+
};
|
|
12802
12823
|
|
|
12803
|
-
|
|
12804
|
-
|
|
12805
|
-
|
|
12806
|
-
|
|
12807
|
-
|
|
12808
|
-
}
|
|
12824
|
+
var boundLength = max$1(0, target.length - args.length);
|
|
12825
|
+
var boundArgs = [];
|
|
12826
|
+
for (var i = 0; i < boundLength; i++) {
|
|
12827
|
+
boundArgs[i] = '$' + i;
|
|
12828
|
+
}
|
|
12809
12829
|
|
|
12810
|
-
|
|
12811
|
-
};
|
|
12812
|
-
return implementation;
|
|
12813
|
-
}
|
|
12830
|
+
bound = Function('binder', 'return function (' + joiny(boundArgs, ',') + '){ return binder.apply(this,arguments); }')(binder);
|
|
12814
12831
|
|
|
12815
|
-
|
|
12816
|
-
var
|
|
12832
|
+
if (target.prototype) {
|
|
12833
|
+
var Empty = function Empty() {};
|
|
12834
|
+
Empty.prototype = target.prototype;
|
|
12835
|
+
bound.prototype = new Empty();
|
|
12836
|
+
Empty.prototype = null;
|
|
12837
|
+
}
|
|
12817
12838
|
|
|
12818
|
-
|
|
12819
|
-
|
|
12820
|
-
hasRequiredFunctionBind = 1;
|
|
12839
|
+
return bound;
|
|
12840
|
+
};
|
|
12821
12841
|
|
|
12822
|
-
|
|
12842
|
+
var implementation = implementation$1;
|
|
12823
12843
|
|
|
12824
|
-
|
|
12825
|
-
return functionBind;
|
|
12826
|
-
}
|
|
12844
|
+
var functionBind = Function.prototype.bind || implementation;
|
|
12827
12845
|
|
|
12828
12846
|
var functionCall;
|
|
12829
12847
|
var hasRequiredFunctionCall;
|
|
@@ -12868,7 +12886,7 @@ function requireActualApply () {
|
|
|
12868
12886
|
if (hasRequiredActualApply) return actualApply;
|
|
12869
12887
|
hasRequiredActualApply = 1;
|
|
12870
12888
|
|
|
12871
|
-
var bind =
|
|
12889
|
+
var bind = functionBind;
|
|
12872
12890
|
|
|
12873
12891
|
var $apply = requireFunctionApply();
|
|
12874
12892
|
var $call = requireFunctionCall();
|
|
@@ -12886,7 +12904,7 @@ function requireCallBindApplyHelpers () {
|
|
|
12886
12904
|
if (hasRequiredCallBindApplyHelpers) return callBindApplyHelpers;
|
|
12887
12905
|
hasRequiredCallBindApplyHelpers = 1;
|
|
12888
12906
|
|
|
12889
|
-
var bind =
|
|
12907
|
+
var bind = functionBind;
|
|
12890
12908
|
var $TypeError = requireType();
|
|
12891
12909
|
|
|
12892
12910
|
var $call = requireFunctionCall();
|
|
@@ -12975,21 +12993,12 @@ function requireGetProto () {
|
|
|
12975
12993
|
return getProto$1;
|
|
12976
12994
|
}
|
|
12977
12995
|
|
|
12978
|
-
var
|
|
12979
|
-
var
|
|
12980
|
-
|
|
12981
|
-
function requireHasown () {
|
|
12982
|
-
if (hasRequiredHasown) return hasown;
|
|
12983
|
-
hasRequiredHasown = 1;
|
|
12984
|
-
|
|
12985
|
-
var call = Function.prototype.call;
|
|
12986
|
-
var $hasOwn = Object.prototype.hasOwnProperty;
|
|
12987
|
-
var bind = requireFunctionBind();
|
|
12996
|
+
var call = Function.prototype.call;
|
|
12997
|
+
var $hasOwn = Object.prototype.hasOwnProperty;
|
|
12998
|
+
var bind$1 = functionBind;
|
|
12988
12999
|
|
|
12989
|
-
|
|
12990
|
-
|
|
12991
|
-
return hasown;
|
|
12992
|
-
}
|
|
13000
|
+
/** @type {import('.')} */
|
|
13001
|
+
var hasown = bind$1.call(call, $hasOwn);
|
|
12993
13002
|
|
|
12994
13003
|
var undefined$1;
|
|
12995
13004
|
|
|
@@ -13005,7 +13014,7 @@ var $URIError = uri;
|
|
|
13005
13014
|
|
|
13006
13015
|
var abs = abs$1;
|
|
13007
13016
|
var floor = floor$1;
|
|
13008
|
-
var max = max$
|
|
13017
|
+
var max = max$2;
|
|
13009
13018
|
var min = min$1;
|
|
13010
13019
|
var pow = pow$1;
|
|
13011
13020
|
var round = round$1;
|
|
@@ -13231,8 +13240,8 @@ var LEGACY_ALIASES = {
|
|
|
13231
13240
|
'%WeakSetPrototype%': ['WeakSet', 'prototype']
|
|
13232
13241
|
};
|
|
13233
13242
|
|
|
13234
|
-
var bind =
|
|
13235
|
-
var hasOwn$
|
|
13243
|
+
var bind = functionBind;
|
|
13244
|
+
var hasOwn$2 = hasown;
|
|
13236
13245
|
var $concat = bind.call($call, Array.prototype.concat);
|
|
13237
13246
|
var $spliceApply = bind.call($apply, Array.prototype.splice);
|
|
13238
13247
|
var $replace = bind.call($call, String.prototype.replace);
|
|
@@ -13261,12 +13270,12 @@ var stringToPath = function stringToPath(string) {
|
|
|
13261
13270
|
var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {
|
|
13262
13271
|
var intrinsicName = name;
|
|
13263
13272
|
var alias;
|
|
13264
|
-
if (hasOwn$
|
|
13273
|
+
if (hasOwn$2(LEGACY_ALIASES, intrinsicName)) {
|
|
13265
13274
|
alias = LEGACY_ALIASES[intrinsicName];
|
|
13266
13275
|
intrinsicName = '%' + alias[0] + '%';
|
|
13267
13276
|
}
|
|
13268
13277
|
|
|
13269
|
-
if (hasOwn$
|
|
13278
|
+
if (hasOwn$2(INTRINSICS, intrinsicName)) {
|
|
13270
13279
|
var value = INTRINSICS[intrinsicName];
|
|
13271
13280
|
if (value === needsEval) {
|
|
13272
13281
|
value = doEval(intrinsicName);
|
|
@@ -13330,14 +13339,14 @@ var getIntrinsic = function GetIntrinsic(name, allowMissing) {
|
|
|
13330
13339
|
intrinsicBaseName += '.' + part;
|
|
13331
13340
|
intrinsicRealName = '%' + intrinsicBaseName + '%';
|
|
13332
13341
|
|
|
13333
|
-
if (hasOwn$
|
|
13342
|
+
if (hasOwn$2(INTRINSICS, intrinsicRealName)) {
|
|
13334
13343
|
value = INTRINSICS[intrinsicRealName];
|
|
13335
13344
|
} else if (value != null) {
|
|
13336
13345
|
if (!(part in value)) {
|
|
13337
13346
|
if (!allowMissing) {
|
|
13338
13347
|
throw new $TypeError$1('base intrinsic for ' + name + ' exists, but the property is not available.');
|
|
13339
13348
|
}
|
|
13340
|
-
return void
|
|
13349
|
+
return void undefined$1;
|
|
13341
13350
|
}
|
|
13342
13351
|
if ($gOPD && (i + 1) >= parts.length) {
|
|
13343
13352
|
var desc = $gOPD(value, part);
|
|
@@ -13356,7 +13365,7 @@ var getIntrinsic = function GetIntrinsic(name, allowMissing) {
|
|
|
13356
13365
|
value = value[part];
|
|
13357
13366
|
}
|
|
13358
13367
|
} else {
|
|
13359
|
-
isOwn = hasOwn$
|
|
13368
|
+
isOwn = hasOwn$2(value, part);
|
|
13360
13369
|
value = value[part];
|
|
13361
13370
|
}
|
|
13362
13371
|
|
|
@@ -13389,7 +13398,7 @@ var GetIntrinsic = getIntrinsic;
|
|
|
13389
13398
|
var $defineProperty = GetIntrinsic('%Object.defineProperty%', true);
|
|
13390
13399
|
|
|
13391
13400
|
var hasToStringTag = requireShams()();
|
|
13392
|
-
var hasOwn =
|
|
13401
|
+
var hasOwn$1 = hasown;
|
|
13393
13402
|
var $TypeError = requireType();
|
|
13394
13403
|
|
|
13395
13404
|
var toStringTag = hasToStringTag ? Symbol.toStringTag : null;
|
|
@@ -13404,7 +13413,7 @@ var esSetTostringtag = function setToStringTag(object, value) {
|
|
|
13404
13413
|
) {
|
|
13405
13414
|
throw new $TypeError('if provided, the `overrideIfSet` and `nonConfigurable` options must be booleans');
|
|
13406
13415
|
}
|
|
13407
|
-
if (toStringTag && (overrideIfSet || !hasOwn(object, toStringTag))) {
|
|
13416
|
+
if (toStringTag && (overrideIfSet || !hasOwn$1(object, toStringTag))) {
|
|
13408
13417
|
if ($defineProperty) {
|
|
13409
13418
|
$defineProperty(object, toStringTag, {
|
|
13410
13419
|
configurable: !nonConfigurable,
|
|
@@ -13419,11 +13428,9 @@ var esSetTostringtag = function setToStringTag(object, value) {
|
|
|
13419
13428
|
};
|
|
13420
13429
|
|
|
13421
13430
|
// populates missing values
|
|
13422
|
-
var populate$1 = function(dst, src) {
|
|
13423
|
-
|
|
13424
|
-
|
|
13425
|
-
{
|
|
13426
|
-
dst[prop] = dst[prop] || src[prop];
|
|
13431
|
+
var populate$1 = function (dst, src) {
|
|
13432
|
+
Object.keys(src).forEach(function (prop) {
|
|
13433
|
+
dst[prop] = dst[prop] || src[prop]; // eslint-disable-line no-param-reassign
|
|
13427
13434
|
});
|
|
13428
13435
|
|
|
13429
13436
|
return dst;
|
|
@@ -13437,24 +13444,20 @@ var https$2 = require$$4;
|
|
|
13437
13444
|
var parseUrl$2 = require$$0$1.parse;
|
|
13438
13445
|
var fs = fs$1;
|
|
13439
13446
|
var Stream = stream.Stream;
|
|
13447
|
+
var crypto = require$$8;
|
|
13440
13448
|
var mime = mimeTypes;
|
|
13441
13449
|
var asynckit = asynckit$1;
|
|
13442
13450
|
var setToStringTag = esSetTostringtag;
|
|
13451
|
+
var hasOwn = hasown;
|
|
13443
13452
|
var populate = populate$1;
|
|
13444
13453
|
|
|
13445
|
-
// Public API
|
|
13446
|
-
var form_data = FormData$1;
|
|
13447
|
-
|
|
13448
|
-
// make it a Stream
|
|
13449
|
-
util.inherits(FormData$1, CombinedStream);
|
|
13450
|
-
|
|
13451
13454
|
/**
|
|
13452
13455
|
* Create readable "multipart/form-data" streams.
|
|
13453
13456
|
* Can be used to submit forms
|
|
13454
13457
|
* and file uploads to other web applications.
|
|
13455
13458
|
*
|
|
13456
13459
|
* @constructor
|
|
13457
|
-
* @param {
|
|
13460
|
+
* @param {object} options - Properties to be added/overriden for FormData and CombinedStream
|
|
13458
13461
|
*/
|
|
13459
13462
|
function FormData$1(options) {
|
|
13460
13463
|
if (!(this instanceof FormData$1)) {
|
|
@@ -13467,35 +13470,39 @@ function FormData$1(options) {
|
|
|
13467
13470
|
|
|
13468
13471
|
CombinedStream.call(this);
|
|
13469
13472
|
|
|
13470
|
-
options = options || {};
|
|
13471
|
-
for (var option in options) {
|
|
13473
|
+
options = options || {}; // eslint-disable-line no-param-reassign
|
|
13474
|
+
for (var option in options) { // eslint-disable-line no-restricted-syntax
|
|
13472
13475
|
this[option] = options[option];
|
|
13473
13476
|
}
|
|
13474
13477
|
}
|
|
13475
13478
|
|
|
13479
|
+
// make it a Stream
|
|
13480
|
+
util.inherits(FormData$1, CombinedStream);
|
|
13481
|
+
|
|
13476
13482
|
FormData$1.LINE_BREAK = '\r\n';
|
|
13477
13483
|
FormData$1.DEFAULT_CONTENT_TYPE = 'application/octet-stream';
|
|
13478
13484
|
|
|
13479
|
-
FormData$1.prototype.append = function(field, value, options) {
|
|
13480
|
-
|
|
13481
|
-
options = options || {};
|
|
13485
|
+
FormData$1.prototype.append = function (field, value, options) {
|
|
13486
|
+
options = options || {}; // eslint-disable-line no-param-reassign
|
|
13482
13487
|
|
|
13483
13488
|
// allow filename as single option
|
|
13484
|
-
if (typeof options
|
|
13485
|
-
options = {filename: options};
|
|
13489
|
+
if (typeof options === 'string') {
|
|
13490
|
+
options = { filename: options }; // eslint-disable-line no-param-reassign
|
|
13486
13491
|
}
|
|
13487
13492
|
|
|
13488
13493
|
var append = CombinedStream.prototype.append.bind(this);
|
|
13489
13494
|
|
|
13490
13495
|
// all that streamy business can't handle numbers
|
|
13491
|
-
if (typeof value
|
|
13492
|
-
value =
|
|
13496
|
+
if (typeof value === 'number' || value == null) {
|
|
13497
|
+
value = String(value); // eslint-disable-line no-param-reassign
|
|
13493
13498
|
}
|
|
13494
13499
|
|
|
13495
13500
|
// https://github.com/felixge/node-form-data/issues/38
|
|
13496
13501
|
if (Array.isArray(value)) {
|
|
13497
|
-
|
|
13498
|
-
|
|
13502
|
+
/*
|
|
13503
|
+
* Please convert your array into string
|
|
13504
|
+
* the way web server expects it
|
|
13505
|
+
*/
|
|
13499
13506
|
this._error(new Error('Arrays are not supported.'));
|
|
13500
13507
|
return;
|
|
13501
13508
|
}
|
|
@@ -13511,15 +13518,17 @@ FormData$1.prototype.append = function(field, value, options) {
|
|
|
13511
13518
|
this._trackLength(header, value, options);
|
|
13512
13519
|
};
|
|
13513
13520
|
|
|
13514
|
-
FormData$1.prototype._trackLength = function(header, value, options) {
|
|
13521
|
+
FormData$1.prototype._trackLength = function (header, value, options) {
|
|
13515
13522
|
var valueLength = 0;
|
|
13516
13523
|
|
|
13517
|
-
|
|
13518
|
-
|
|
13519
|
-
|
|
13520
|
-
|
|
13524
|
+
/*
|
|
13525
|
+
* used w/ getLengthSync(), when length is known.
|
|
13526
|
+
* e.g. for streaming directly from a remote server,
|
|
13527
|
+
* w/ a known file a size, and not wanting to wait for
|
|
13528
|
+
* incoming file to finish to get its size.
|
|
13529
|
+
*/
|
|
13521
13530
|
if (options.knownLength != null) {
|
|
13522
|
-
valueLength +=
|
|
13531
|
+
valueLength += Number(options.knownLength);
|
|
13523
13532
|
} else if (Buffer.isBuffer(value)) {
|
|
13524
13533
|
valueLength = value.length;
|
|
13525
13534
|
} else if (typeof value === 'string') {
|
|
@@ -13529,12 +13538,10 @@ FormData$1.prototype._trackLength = function(header, value, options) {
|
|
|
13529
13538
|
this._valueLength += valueLength;
|
|
13530
13539
|
|
|
13531
13540
|
// @check why add CRLF? does this account for custom/multiple CRLFs?
|
|
13532
|
-
this._overheadLength +=
|
|
13533
|
-
Buffer.byteLength(header) +
|
|
13534
|
-
FormData$1.LINE_BREAK.length;
|
|
13541
|
+
this._overheadLength += Buffer.byteLength(header) + FormData$1.LINE_BREAK.length;
|
|
13535
13542
|
|
|
13536
13543
|
// empty or either doesn't have path or not an http response or not a stream
|
|
13537
|
-
if (!value || (
|
|
13544
|
+
if (!value || (!value.path && !(value.readable && hasOwn(value, 'httpVersion')) && !(value instanceof Stream))) {
|
|
13538
13545
|
return;
|
|
13539
13546
|
}
|
|
13540
13547
|
|
|
@@ -13544,9 +13551,8 @@ FormData$1.prototype._trackLength = function(header, value, options) {
|
|
|
13544
13551
|
}
|
|
13545
13552
|
};
|
|
13546
13553
|
|
|
13547
|
-
FormData$1.prototype._lengthRetriever = function(value, callback) {
|
|
13548
|
-
if (
|
|
13549
|
-
|
|
13554
|
+
FormData$1.prototype._lengthRetriever = function (value, callback) {
|
|
13555
|
+
if (hasOwn(value, 'fd')) {
|
|
13550
13556
|
// take read range into a account
|
|
13551
13557
|
// `end` = Infinity –> read file till the end
|
|
13552
13558
|
//
|
|
@@ -13555,54 +13561,52 @@ FormData$1.prototype._lengthRetriever = function(value, callback) {
|
|
|
13555
13561
|
// Fix it when node fixes it.
|
|
13556
13562
|
// https://github.com/joyent/node/issues/7819
|
|
13557
13563
|
if (value.end != undefined && value.end != Infinity && value.start != undefined) {
|
|
13558
|
-
|
|
13559
13564
|
// when end specified
|
|
13560
13565
|
// no need to calculate range
|
|
13561
13566
|
// inclusive, starts with 0
|
|
13562
|
-
callback(null, value.end + 1 - (value.start ? value.start : 0));
|
|
13567
|
+
callback(null, value.end + 1 - (value.start ? value.start : 0)); // eslint-disable-line callback-return
|
|
13563
13568
|
|
|
13564
|
-
|
|
13569
|
+
// not that fast snoopy
|
|
13565
13570
|
} else {
|
|
13566
13571
|
// still need to fetch file size from fs
|
|
13567
|
-
fs.stat(value.path, function(err, stat) {
|
|
13568
|
-
|
|
13569
|
-
var fileSize;
|
|
13570
|
-
|
|
13572
|
+
fs.stat(value.path, function (err, stat) {
|
|
13571
13573
|
if (err) {
|
|
13572
13574
|
callback(err);
|
|
13573
13575
|
return;
|
|
13574
13576
|
}
|
|
13575
13577
|
|
|
13576
13578
|
// update final size based on the range options
|
|
13577
|
-
fileSize = stat.size - (value.start ? value.start : 0);
|
|
13579
|
+
var fileSize = stat.size - (value.start ? value.start : 0);
|
|
13578
13580
|
callback(null, fileSize);
|
|
13579
13581
|
});
|
|
13580
13582
|
}
|
|
13581
13583
|
|
|
13582
|
-
|
|
13583
|
-
} else if (
|
|
13584
|
-
callback(null,
|
|
13584
|
+
// or http response
|
|
13585
|
+
} else if (hasOwn(value, 'httpVersion')) {
|
|
13586
|
+
callback(null, Number(value.headers['content-length'])); // eslint-disable-line callback-return
|
|
13585
13587
|
|
|
13586
|
-
|
|
13587
|
-
} else if (
|
|
13588
|
+
// or request stream http://github.com/mikeal/request
|
|
13589
|
+
} else if (hasOwn(value, 'httpModule')) {
|
|
13588
13590
|
// wait till response come back
|
|
13589
|
-
value.on('response', function(response) {
|
|
13591
|
+
value.on('response', function (response) {
|
|
13590
13592
|
value.pause();
|
|
13591
|
-
callback(null,
|
|
13593
|
+
callback(null, Number(response.headers['content-length']));
|
|
13592
13594
|
});
|
|
13593
13595
|
value.resume();
|
|
13594
13596
|
|
|
13595
|
-
|
|
13597
|
+
// something else
|
|
13596
13598
|
} else {
|
|
13597
|
-
callback('Unknown stream');
|
|
13599
|
+
callback('Unknown stream'); // eslint-disable-line callback-return
|
|
13598
13600
|
}
|
|
13599
13601
|
};
|
|
13600
13602
|
|
|
13601
|
-
FormData$1.prototype._multiPartHeader = function(field, value, options) {
|
|
13602
|
-
|
|
13603
|
-
|
|
13604
|
-
|
|
13605
|
-
|
|
13603
|
+
FormData$1.prototype._multiPartHeader = function (field, value, options) {
|
|
13604
|
+
/*
|
|
13605
|
+
* custom header specified (as string)?
|
|
13606
|
+
* it becomes responsible for boundary
|
|
13607
|
+
* (e.g. to handle extra CRLFs on .NET servers)
|
|
13608
|
+
*/
|
|
13609
|
+
if (typeof options.header === 'string') {
|
|
13606
13610
|
return options.header;
|
|
13607
13611
|
}
|
|
13608
13612
|
|
|
@@ -13610,7 +13614,7 @@ FormData$1.prototype._multiPartHeader = function(field, value, options) {
|
|
|
13610
13614
|
var contentType = this._getContentType(value, options);
|
|
13611
13615
|
|
|
13612
13616
|
var contents = '';
|
|
13613
|
-
var headers
|
|
13617
|
+
var headers = {
|
|
13614
13618
|
// add custom disposition as third element or keep it two elements if not
|
|
13615
13619
|
'Content-Disposition': ['form-data', 'name="' + field + '"'].concat(contentDisposition || []),
|
|
13616
13620
|
// if no content type. allow it to be empty array
|
|
@@ -13618,18 +13622,18 @@ FormData$1.prototype._multiPartHeader = function(field, value, options) {
|
|
|
13618
13622
|
};
|
|
13619
13623
|
|
|
13620
13624
|
// allow custom headers.
|
|
13621
|
-
if (typeof options.header
|
|
13625
|
+
if (typeof options.header === 'object') {
|
|
13622
13626
|
populate(headers, options.header);
|
|
13623
13627
|
}
|
|
13624
13628
|
|
|
13625
13629
|
var header;
|
|
13626
|
-
for (var prop in headers) {
|
|
13627
|
-
if (
|
|
13630
|
+
for (var prop in headers) { // eslint-disable-line no-restricted-syntax
|
|
13631
|
+
if (hasOwn(headers, prop)) {
|
|
13628
13632
|
header = headers[prop];
|
|
13629
13633
|
|
|
13630
13634
|
// skip nullish headers.
|
|
13631
13635
|
if (header == null) {
|
|
13632
|
-
continue;
|
|
13636
|
+
continue; // eslint-disable-line no-restricted-syntax, no-continue
|
|
13633
13637
|
}
|
|
13634
13638
|
|
|
13635
13639
|
// convert all headers to arrays.
|
|
@@ -13647,49 +13651,45 @@ FormData$1.prototype._multiPartHeader = function(field, value, options) {
|
|
|
13647
13651
|
return '--' + this.getBoundary() + FormData$1.LINE_BREAK + contents + FormData$1.LINE_BREAK;
|
|
13648
13652
|
};
|
|
13649
13653
|
|
|
13650
|
-
FormData$1.prototype._getContentDisposition = function(value, options) {
|
|
13651
|
-
|
|
13652
|
-
var filename
|
|
13653
|
-
, contentDisposition
|
|
13654
|
-
;
|
|
13654
|
+
FormData$1.prototype._getContentDisposition = function (value, options) { // eslint-disable-line consistent-return
|
|
13655
|
+
var filename;
|
|
13655
13656
|
|
|
13656
13657
|
if (typeof options.filepath === 'string') {
|
|
13657
13658
|
// custom filepath for relative paths
|
|
13658
13659
|
filename = path.normalize(options.filepath).replace(/\\/g, '/');
|
|
13659
|
-
} else if (options.filename || value.name || value.path) {
|
|
13660
|
-
|
|
13661
|
-
|
|
13662
|
-
|
|
13663
|
-
|
|
13664
|
-
|
|
13660
|
+
} else if (options.filename || (value && (value.name || value.path))) {
|
|
13661
|
+
/*
|
|
13662
|
+
* custom filename take precedence
|
|
13663
|
+
* formidable and the browser add a name property
|
|
13664
|
+
* fs- and request- streams have path property
|
|
13665
|
+
*/
|
|
13666
|
+
filename = path.basename(options.filename || (value && (value.name || value.path)));
|
|
13667
|
+
} else if (value && value.readable && hasOwn(value, 'httpVersion')) {
|
|
13665
13668
|
// or try http response
|
|
13666
13669
|
filename = path.basename(value.client._httpMessage.path || '');
|
|
13667
13670
|
}
|
|
13668
13671
|
|
|
13669
13672
|
if (filename) {
|
|
13670
|
-
|
|
13673
|
+
return 'filename="' + filename + '"';
|
|
13671
13674
|
}
|
|
13672
|
-
|
|
13673
|
-
return contentDisposition;
|
|
13674
13675
|
};
|
|
13675
13676
|
|
|
13676
|
-
FormData$1.prototype._getContentType = function(value, options) {
|
|
13677
|
-
|
|
13677
|
+
FormData$1.prototype._getContentType = function (value, options) {
|
|
13678
13678
|
// use custom content-type above all
|
|
13679
13679
|
var contentType = options.contentType;
|
|
13680
13680
|
|
|
13681
13681
|
// or try `name` from formidable, browser
|
|
13682
|
-
if (!contentType && value.name) {
|
|
13682
|
+
if (!contentType && value && value.name) {
|
|
13683
13683
|
contentType = mime.lookup(value.name);
|
|
13684
13684
|
}
|
|
13685
13685
|
|
|
13686
13686
|
// or try `path` from fs-, request- streams
|
|
13687
|
-
if (!contentType && value.path) {
|
|
13687
|
+
if (!contentType && value && value.path) {
|
|
13688
13688
|
contentType = mime.lookup(value.path);
|
|
13689
13689
|
}
|
|
13690
13690
|
|
|
13691
13691
|
// or if it's http-reponse
|
|
13692
|
-
if (!contentType && value.readable &&
|
|
13692
|
+
if (!contentType && value && value.readable && hasOwn(value, 'httpVersion')) {
|
|
13693
13693
|
contentType = value.headers['content-type'];
|
|
13694
13694
|
}
|
|
13695
13695
|
|
|
@@ -13699,18 +13699,18 @@ FormData$1.prototype._getContentType = function(value, options) {
|
|
|
13699
13699
|
}
|
|
13700
13700
|
|
|
13701
13701
|
// fallback to the default content type if `value` is not simple value
|
|
13702
|
-
if (!contentType && typeof value
|
|
13702
|
+
if (!contentType && value && typeof value === 'object') {
|
|
13703
13703
|
contentType = FormData$1.DEFAULT_CONTENT_TYPE;
|
|
13704
13704
|
}
|
|
13705
13705
|
|
|
13706
13706
|
return contentType;
|
|
13707
13707
|
};
|
|
13708
13708
|
|
|
13709
|
-
FormData$1.prototype._multiPartFooter = function() {
|
|
13710
|
-
return function(next) {
|
|
13709
|
+
FormData$1.prototype._multiPartFooter = function () {
|
|
13710
|
+
return function (next) {
|
|
13711
13711
|
var footer = FormData$1.LINE_BREAK;
|
|
13712
13712
|
|
|
13713
|
-
var lastPart =
|
|
13713
|
+
var lastPart = this._streams.length === 0;
|
|
13714
13714
|
if (lastPart) {
|
|
13715
13715
|
footer += this._lastBoundary();
|
|
13716
13716
|
}
|
|
@@ -13719,18 +13719,18 @@ FormData$1.prototype._multiPartFooter = function() {
|
|
|
13719
13719
|
}.bind(this);
|
|
13720
13720
|
};
|
|
13721
13721
|
|
|
13722
|
-
FormData$1.prototype._lastBoundary = function() {
|
|
13722
|
+
FormData$1.prototype._lastBoundary = function () {
|
|
13723
13723
|
return '--' + this.getBoundary() + '--' + FormData$1.LINE_BREAK;
|
|
13724
13724
|
};
|
|
13725
13725
|
|
|
13726
|
-
FormData$1.prototype.getHeaders = function(userHeaders) {
|
|
13726
|
+
FormData$1.prototype.getHeaders = function (userHeaders) {
|
|
13727
13727
|
var header;
|
|
13728
13728
|
var formHeaders = {
|
|
13729
13729
|
'content-type': 'multipart/form-data; boundary=' + this.getBoundary()
|
|
13730
13730
|
};
|
|
13731
13731
|
|
|
13732
|
-
for (header in userHeaders) {
|
|
13733
|
-
if (
|
|
13732
|
+
for (header in userHeaders) { // eslint-disable-line no-restricted-syntax
|
|
13733
|
+
if (hasOwn(userHeaders, header)) {
|
|
13734
13734
|
formHeaders[header.toLowerCase()] = userHeaders[header];
|
|
13735
13735
|
}
|
|
13736
13736
|
}
|
|
@@ -13738,11 +13738,14 @@ FormData$1.prototype.getHeaders = function(userHeaders) {
|
|
|
13738
13738
|
return formHeaders;
|
|
13739
13739
|
};
|
|
13740
13740
|
|
|
13741
|
-
FormData$1.prototype.setBoundary = function(boundary) {
|
|
13741
|
+
FormData$1.prototype.setBoundary = function (boundary) {
|
|
13742
|
+
if (typeof boundary !== 'string') {
|
|
13743
|
+
throw new TypeError('FormData boundary must be a string');
|
|
13744
|
+
}
|
|
13742
13745
|
this._boundary = boundary;
|
|
13743
13746
|
};
|
|
13744
13747
|
|
|
13745
|
-
FormData$1.prototype.getBoundary = function() {
|
|
13748
|
+
FormData$1.prototype.getBoundary = function () {
|
|
13746
13749
|
if (!this._boundary) {
|
|
13747
13750
|
this._generateBoundary();
|
|
13748
13751
|
}
|
|
@@ -13750,60 +13753,55 @@ FormData$1.prototype.getBoundary = function() {
|
|
|
13750
13753
|
return this._boundary;
|
|
13751
13754
|
};
|
|
13752
13755
|
|
|
13753
|
-
FormData$1.prototype.getBuffer = function() {
|
|
13754
|
-
var dataBuffer = new Buffer.alloc(0);
|
|
13756
|
+
FormData$1.prototype.getBuffer = function () {
|
|
13757
|
+
var dataBuffer = new Buffer.alloc(0); // eslint-disable-line new-cap
|
|
13755
13758
|
var boundary = this.getBoundary();
|
|
13756
13759
|
|
|
13757
13760
|
// Create the form content. Add Line breaks to the end of data.
|
|
13758
13761
|
for (var i = 0, len = this._streams.length; i < len; i++) {
|
|
13759
13762
|
if (typeof this._streams[i] !== 'function') {
|
|
13760
|
-
|
|
13761
13763
|
// Add content to the buffer.
|
|
13762
|
-
if(Buffer.isBuffer(this._streams[i])) {
|
|
13763
|
-
dataBuffer = Buffer.concat(
|
|
13764
|
-
}else {
|
|
13765
|
-
dataBuffer = Buffer.concat(
|
|
13764
|
+
if (Buffer.isBuffer(this._streams[i])) {
|
|
13765
|
+
dataBuffer = Buffer.concat([dataBuffer, this._streams[i]]);
|
|
13766
|
+
} else {
|
|
13767
|
+
dataBuffer = Buffer.concat([dataBuffer, Buffer.from(this._streams[i])]);
|
|
13766
13768
|
}
|
|
13767
13769
|
|
|
13768
13770
|
// Add break after content.
|
|
13769
|
-
if (typeof this._streams[i] !== 'string' || this._streams[i].substring(
|
|
13770
|
-
dataBuffer = Buffer.concat(
|
|
13771
|
+
if (typeof this._streams[i] !== 'string' || this._streams[i].substring(2, boundary.length + 2) !== boundary) {
|
|
13772
|
+
dataBuffer = Buffer.concat([dataBuffer, Buffer.from(FormData$1.LINE_BREAK)]);
|
|
13771
13773
|
}
|
|
13772
13774
|
}
|
|
13773
13775
|
}
|
|
13774
13776
|
|
|
13775
13777
|
// Add the footer and return the Buffer object.
|
|
13776
|
-
return Buffer.concat(
|
|
13778
|
+
return Buffer.concat([dataBuffer, Buffer.from(this._lastBoundary())]);
|
|
13777
13779
|
};
|
|
13778
13780
|
|
|
13779
|
-
FormData$1.prototype._generateBoundary = function() {
|
|
13781
|
+
FormData$1.prototype._generateBoundary = function () {
|
|
13780
13782
|
// This generates a 50 character boundary similar to those used by Firefox.
|
|
13781
|
-
// They are optimized for boyer-moore parsing.
|
|
13782
|
-
var boundary = '--------------------------';
|
|
13783
|
-
for (var i = 0; i < 24; i++) {
|
|
13784
|
-
boundary += Math.floor(Math.random() * 10).toString(16);
|
|
13785
|
-
}
|
|
13786
13783
|
|
|
13787
|
-
|
|
13784
|
+
// They are optimized for boyer-moore parsing.
|
|
13785
|
+
this._boundary = '--------------------------' + crypto.randomBytes(12).toString('hex');
|
|
13788
13786
|
};
|
|
13789
13787
|
|
|
13790
13788
|
// Note: getLengthSync DOESN'T calculate streams length
|
|
13791
|
-
// As workaround one can calculate file size manually
|
|
13792
|
-
|
|
13793
|
-
FormData$1.prototype.getLengthSync = function() {
|
|
13789
|
+
// As workaround one can calculate file size manually and add it as knownLength option
|
|
13790
|
+
FormData$1.prototype.getLengthSync = function () {
|
|
13794
13791
|
var knownLength = this._overheadLength + this._valueLength;
|
|
13795
13792
|
|
|
13796
|
-
// Don't get confused, there are 3 "internal" streams for each keyval pair
|
|
13797
|
-
// so it basically checks if there is any value added to the form
|
|
13793
|
+
// Don't get confused, there are 3 "internal" streams for each keyval pair so it basically checks if there is any value added to the form
|
|
13798
13794
|
if (this._streams.length) {
|
|
13799
13795
|
knownLength += this._lastBoundary().length;
|
|
13800
13796
|
}
|
|
13801
13797
|
|
|
13802
13798
|
// https://github.com/form-data/form-data/issues/40
|
|
13803
13799
|
if (!this.hasKnownLength()) {
|
|
13804
|
-
|
|
13805
|
-
|
|
13806
|
-
|
|
13800
|
+
/*
|
|
13801
|
+
* Some async length retrievers are present
|
|
13802
|
+
* therefore synchronous length calculation is false.
|
|
13803
|
+
* Please use getLength(callback) to get proper length
|
|
13804
|
+
*/
|
|
13807
13805
|
this._error(new Error('Cannot calculate proper length in synchronous way.'));
|
|
13808
13806
|
}
|
|
13809
13807
|
|
|
@@ -13813,7 +13811,7 @@ FormData$1.prototype.getLengthSync = function() {
|
|
|
13813
13811
|
// Public API to check if length of added values is known
|
|
13814
13812
|
// https://github.com/form-data/form-data/issues/196
|
|
13815
13813
|
// https://github.com/form-data/form-data/issues/262
|
|
13816
|
-
FormData$1.prototype.hasKnownLength = function() {
|
|
13814
|
+
FormData$1.prototype.hasKnownLength = function () {
|
|
13817
13815
|
var hasKnownLength = true;
|
|
13818
13816
|
|
|
13819
13817
|
if (this._valuesToMeasure.length) {
|
|
@@ -13823,7 +13821,7 @@ FormData$1.prototype.hasKnownLength = function() {
|
|
|
13823
13821
|
return hasKnownLength;
|
|
13824
13822
|
};
|
|
13825
13823
|
|
|
13826
|
-
FormData$1.prototype.getLength = function(cb) {
|
|
13824
|
+
FormData$1.prototype.getLength = function (cb) {
|
|
13827
13825
|
var knownLength = this._overheadLength + this._valueLength;
|
|
13828
13826
|
|
|
13829
13827
|
if (this._streams.length) {
|
|
@@ -13835,13 +13833,13 @@ FormData$1.prototype.getLength = function(cb) {
|
|
|
13835
13833
|
return;
|
|
13836
13834
|
}
|
|
13837
13835
|
|
|
13838
|
-
asynckit.parallel(this._valuesToMeasure, this._lengthRetriever, function(err, values) {
|
|
13836
|
+
asynckit.parallel(this._valuesToMeasure, this._lengthRetriever, function (err, values) {
|
|
13839
13837
|
if (err) {
|
|
13840
13838
|
cb(err);
|
|
13841
13839
|
return;
|
|
13842
13840
|
}
|
|
13843
13841
|
|
|
13844
|
-
values.forEach(function(length) {
|
|
13842
|
+
values.forEach(function (length) {
|
|
13845
13843
|
knownLength += length;
|
|
13846
13844
|
});
|
|
13847
13845
|
|
|
@@ -13849,31 +13847,26 @@ FormData$1.prototype.getLength = function(cb) {
|
|
|
13849
13847
|
});
|
|
13850
13848
|
};
|
|
13851
13849
|
|
|
13852
|
-
FormData$1.prototype.submit = function(params, cb) {
|
|
13853
|
-
var request
|
|
13854
|
-
|
|
13855
|
-
|
|
13856
|
-
;
|
|
13857
|
-
|
|
13858
|
-
// parse provided url if it's string
|
|
13859
|
-
// or treat it as options object
|
|
13860
|
-
if (typeof params == 'string') {
|
|
13850
|
+
FormData$1.prototype.submit = function (params, cb) {
|
|
13851
|
+
var request;
|
|
13852
|
+
var options;
|
|
13853
|
+
var defaults = { method: 'post' };
|
|
13861
13854
|
|
|
13862
|
-
|
|
13855
|
+
// parse provided url if it's string or treat it as options object
|
|
13856
|
+
if (typeof params === 'string') {
|
|
13857
|
+
params = parseUrl$2(params); // eslint-disable-line no-param-reassign
|
|
13858
|
+
/* eslint sort-keys: 0 */
|
|
13863
13859
|
options = populate({
|
|
13864
13860
|
port: params.port,
|
|
13865
13861
|
path: params.pathname,
|
|
13866
13862
|
host: params.hostname,
|
|
13867
13863
|
protocol: params.protocol
|
|
13868
13864
|
}, defaults);
|
|
13869
|
-
|
|
13870
|
-
// use custom params
|
|
13871
|
-
} else {
|
|
13872
|
-
|
|
13865
|
+
} else { // use custom params
|
|
13873
13866
|
options = populate(params, defaults);
|
|
13874
13867
|
// if no port provided use default one
|
|
13875
13868
|
if (!options.port) {
|
|
13876
|
-
options.port = options.protocol
|
|
13869
|
+
options.port = options.protocol === 'https:' ? 443 : 80;
|
|
13877
13870
|
}
|
|
13878
13871
|
}
|
|
13879
13872
|
|
|
@@ -13881,14 +13874,14 @@ FormData$1.prototype.submit = function(params, cb) {
|
|
|
13881
13874
|
options.headers = this.getHeaders(params.headers);
|
|
13882
13875
|
|
|
13883
13876
|
// https if specified, fallback to http in any other case
|
|
13884
|
-
if (options.protocol
|
|
13877
|
+
if (options.protocol === 'https:') {
|
|
13885
13878
|
request = https$2.request(options);
|
|
13886
13879
|
} else {
|
|
13887
13880
|
request = http$2.request(options);
|
|
13888
13881
|
}
|
|
13889
13882
|
|
|
13890
13883
|
// get content length and fire away
|
|
13891
|
-
this.getLength(function(err, length) {
|
|
13884
|
+
this.getLength(function (err, length) {
|
|
13892
13885
|
if (err && err !== 'Unknown stream') {
|
|
13893
13886
|
this._error(err);
|
|
13894
13887
|
return;
|
|
@@ -13907,7 +13900,7 @@ FormData$1.prototype.submit = function(params, cb) {
|
|
|
13907
13900
|
request.removeListener('error', callback);
|
|
13908
13901
|
request.removeListener('response', onResponse);
|
|
13909
13902
|
|
|
13910
|
-
return cb.call(this, error, responce);
|
|
13903
|
+
return cb.call(this, error, responce); // eslint-disable-line no-invalid-this
|
|
13911
13904
|
};
|
|
13912
13905
|
|
|
13913
13906
|
onResponse = callback.bind(this, null);
|
|
@@ -13920,7 +13913,7 @@ FormData$1.prototype.submit = function(params, cb) {
|
|
|
13920
13913
|
return request;
|
|
13921
13914
|
};
|
|
13922
13915
|
|
|
13923
|
-
FormData$1.prototype._error = function(err) {
|
|
13916
|
+
FormData$1.prototype._error = function (err) {
|
|
13924
13917
|
if (!this.error) {
|
|
13925
13918
|
this.error = err;
|
|
13926
13919
|
this.pause();
|
|
@@ -13933,6 +13926,9 @@ FormData$1.prototype.toString = function () {
|
|
|
13933
13926
|
};
|
|
13934
13927
|
setToStringTag(FormData$1, 'FormData');
|
|
13935
13928
|
|
|
13929
|
+
// Public API
|
|
13930
|
+
var form_data = FormData$1;
|
|
13931
|
+
|
|
13936
13932
|
var FormData$2 = /*@__PURE__*/getDefaultExportFromCjs(form_data);
|
|
13937
13933
|
|
|
13938
13934
|
/**
|
|
@@ -14050,6 +14046,10 @@ function toFormData$1(obj, formData, options) {
|
|
|
14050
14046
|
return value.toISOString();
|
|
14051
14047
|
}
|
|
14052
14048
|
|
|
14049
|
+
if (utils$1.isBoolean(value)) {
|
|
14050
|
+
return value.toString();
|
|
14051
|
+
}
|
|
14052
|
+
|
|
14053
14053
|
if (!useBlob && utils$1.isBlob(value)) {
|
|
14054
14054
|
throw new AxiosError$1('Blob is not supported. Use a Buffer instead.');
|
|
14055
14055
|
}
|
|
@@ -14352,7 +14352,7 @@ const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
|
|
|
14352
14352
|
let str = '';
|
|
14353
14353
|
const {length} = alphabet;
|
|
14354
14354
|
const randomValues = new Uint32Array(size);
|
|
14355
|
-
|
|
14355
|
+
require$$8.randomFillSync(randomValues);
|
|
14356
14356
|
for (let i = 0; i < size; i++) {
|
|
14357
14357
|
str += alphabet[randomValues[i] % length];
|
|
14358
14358
|
}
|
|
@@ -14432,7 +14432,7 @@ var platform = {
|
|
|
14432
14432
|
};
|
|
14433
14433
|
|
|
14434
14434
|
function toURLEncodedForm(data, options) {
|
|
14435
|
-
return toFormData$1(data, new platform.classes.URLSearchParams(),
|
|
14435
|
+
return toFormData$1(data, new platform.classes.URLSearchParams(), {
|
|
14436
14436
|
visitor: function(value, key, path, helpers) {
|
|
14437
14437
|
if (platform.isNode && utils$1.isBuffer(value)) {
|
|
14438
14438
|
this.append(key, value.toString('base64'));
|
|
@@ -14440,8 +14440,9 @@ function toURLEncodedForm(data, options) {
|
|
|
14440
14440
|
}
|
|
14441
14441
|
|
|
14442
14442
|
return helpers.defaultVisitor.apply(this, arguments);
|
|
14443
|
-
}
|
|
14444
|
-
|
|
14443
|
+
},
|
|
14444
|
+
...options
|
|
14445
|
+
});
|
|
14445
14446
|
}
|
|
14446
14447
|
|
|
14447
14448
|
/**
|
|
@@ -17186,7 +17187,7 @@ followRedirects$1.exports.wrap = wrap;
|
|
|
17186
17187
|
var followRedirectsExports = followRedirects$1.exports;
|
|
17187
17188
|
var followRedirects = /*@__PURE__*/getDefaultExportFromCjs(followRedirectsExports);
|
|
17188
17189
|
|
|
17189
|
-
const VERSION$1 = "1.
|
|
17190
|
+
const VERSION$1 = "1.11.0";
|
|
17190
17191
|
|
|
17191
17192
|
function parseProtocol(url) {
|
|
17192
17193
|
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
|
|
@@ -17604,7 +17605,7 @@ function throttle(fn, freq) {
|
|
|
17604
17605
|
clearTimeout(timer);
|
|
17605
17606
|
timer = null;
|
|
17606
17607
|
}
|
|
17607
|
-
fn
|
|
17608
|
+
fn(...args);
|
|
17608
17609
|
};
|
|
17609
17610
|
|
|
17610
17611
|
const throttled = (...args) => {
|
|
@@ -18478,7 +18479,7 @@ function mergeConfig$1(config1, config2) {
|
|
|
18478
18479
|
headers: (a, b , prop) => mergeDeepProperties(headersToObject(a), headersToObject(b),prop, true)
|
|
18479
18480
|
};
|
|
18480
18481
|
|
|
18481
|
-
utils$1.forEach(Object.keys(
|
|
18482
|
+
utils$1.forEach(Object.keys({...config1, ...config2}), function computeConfigValue(prop) {
|
|
18482
18483
|
const merge = mergeMap[prop] || mergeDeepProperties;
|
|
18483
18484
|
const configValue = merge(config1[prop], config2[prop], prop);
|
|
18484
18485
|
(utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
|
|
@@ -19011,7 +19012,7 @@ var fetchAdapter = isFetchSupported && (async (config) => {
|
|
|
19011
19012
|
credentials: isCredentialsSupported ? withCredentials : undefined
|
|
19012
19013
|
});
|
|
19013
19014
|
|
|
19014
|
-
let response = await fetch(request);
|
|
19015
|
+
let response = await fetch(request, fetchOptions);
|
|
19015
19016
|
|
|
19016
19017
|
const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
|
|
19017
19018
|
|
|
@@ -19454,8 +19455,8 @@ let Axios$1 = class Axios {
|
|
|
19454
19455
|
|
|
19455
19456
|
if (!synchronousRequestInterceptors) {
|
|
19456
19457
|
const chain = [dispatchRequest.bind(this), undefined];
|
|
19457
|
-
chain.unshift
|
|
19458
|
-
chain.push
|
|
19458
|
+
chain.unshift(...requestInterceptorChain);
|
|
19459
|
+
chain.push(...responseInterceptorChain);
|
|
19459
19460
|
len = chain.length;
|
|
19460
19461
|
|
|
19461
19462
|
promise = Promise.resolve(config);
|
|
@@ -19787,7 +19788,7 @@ Object.entries(HttpStatusCode$1).forEach(([key, value]) => {
|
|
|
19787
19788
|
*/
|
|
19788
19789
|
function createInstance(defaultConfig) {
|
|
19789
19790
|
const context = new Axios$1(defaultConfig);
|
|
19790
|
-
const instance = bind$
|
|
19791
|
+
const instance = bind$2(Axios$1.prototype.request, context);
|
|
19791
19792
|
|
|
19792
19793
|
// Copy axios.prototype to instance
|
|
19793
19794
|
utils$1.extend(instance, Axios$1.prototype, context, {allOwnKeys: true});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@builderbot/provider-evolution-api",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.3",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"author": "aurik3 <aurik3@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/aurik3/bot-whatsapp#readme",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"queue-promise": "^2.2.1"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@builderbot/bot": "
|
|
43
|
+
"@builderbot/bot": "1.3.2-y.0",
|
|
44
44
|
"@jest/globals": "^29.7.0",
|
|
45
45
|
"@rollup/plugin-commonjs": "^25.0.7",
|
|
46
46
|
"@rollup/plugin-json": "^6.1.0",
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"tslib": "^2.6.2",
|
|
66
66
|
"tsm": "^2.3.0"
|
|
67
67
|
},
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "8c3712b1fa4ffdaf7999b6f64a566cde74d67d69"
|
|
69
69
|
}
|