@builderbot/provider-meta 1.3.2-alpha.1 → 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.
Files changed (2) hide show
  1. package/dist/index.cjs +218 -257
  2. package/package.json +3 -3
package/dist/index.cjs CHANGED
@@ -9,6 +9,7 @@ var require$$3 = require('http');
9
9
  var require$$4 = require('https');
10
10
  var require$$5 = require('url');
11
11
  var require$$6 = require('fs');
12
+ var require$$8 = require('crypto');
12
13
  var promises = require('fs/promises');
13
14
  var os = require('os');
14
15
  var require$$0$2 = require('events');
@@ -11670,7 +11671,7 @@ var abs$1 = Math.abs;
11670
11671
  var floor$1 = Math.floor;
11671
11672
 
11672
11673
  /** @type {import('./max')} */
11673
- var max$1 = Math.max;
11674
+ var max$2 = Math.max;
11674
11675
 
11675
11676
  /** @type {import('./min')} */
11676
11677
  var min$1 = Math.min;
@@ -11827,110 +11828,92 @@ function requireObject_getPrototypeOf () {
11827
11828
  return Object_getPrototypeOf;
11828
11829
  }
11829
11830
 
11830
- var implementation;
11831
- var hasRequiredImplementation;
11832
-
11833
- function requireImplementation () {
11834
- if (hasRequiredImplementation) return implementation;
11835
- hasRequiredImplementation = 1;
11836
-
11837
- /* eslint no-invalid-this: 1 */
11831
+ /* eslint no-invalid-this: 1 */
11838
11832
 
11839
- var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
11840
- var toStr = Object.prototype.toString;
11841
- var max = Math.max;
11842
- var funcType = '[object Function]';
11843
-
11844
- var concatty = function concatty(a, b) {
11845
- var arr = [];
11846
-
11847
- for (var i = 0; i < a.length; i += 1) {
11848
- arr[i] = a[i];
11849
- }
11850
- for (var j = 0; j < b.length; j += 1) {
11851
- arr[j + a.length] = b[j];
11852
- }
11833
+ var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
11834
+ var toStr = Object.prototype.toString;
11835
+ var max$1 = Math.max;
11836
+ var funcType = '[object Function]';
11853
11837
 
11854
- return arr;
11855
- };
11838
+ var concatty = function concatty(a, b) {
11839
+ var arr = [];
11856
11840
 
11857
- var slicy = function slicy(arrLike, offset) {
11858
- var arr = [];
11859
- for (var i = offset, j = 0; i < arrLike.length; i += 1, j += 1) {
11860
- arr[j] = arrLike[i];
11861
- }
11862
- return arr;
11863
- };
11841
+ for (var i = 0; i < a.length; i += 1) {
11842
+ arr[i] = a[i];
11843
+ }
11844
+ for (var j = 0; j < b.length; j += 1) {
11845
+ arr[j + a.length] = b[j];
11846
+ }
11864
11847
 
11865
- var joiny = function (arr, joiner) {
11866
- var str = '';
11867
- for (var i = 0; i < arr.length; i += 1) {
11868
- str += arr[i];
11869
- if (i + 1 < arr.length) {
11870
- str += joiner;
11871
- }
11872
- }
11873
- return str;
11874
- };
11848
+ return arr;
11849
+ };
11875
11850
 
11876
- implementation = function bind(that) {
11877
- var target = this;
11878
- if (typeof target !== 'function' || toStr.apply(target) !== funcType) {
11879
- throw new TypeError(ERROR_MESSAGE + target);
11880
- }
11881
- var args = slicy(arguments, 1);
11882
-
11883
- var bound;
11884
- var binder = function () {
11885
- if (this instanceof bound) {
11886
- var result = target.apply(
11887
- this,
11888
- concatty(args, arguments)
11889
- );
11890
- if (Object(result) === result) {
11891
- return result;
11892
- }
11893
- return this;
11894
- }
11895
- return target.apply(
11896
- that,
11897
- concatty(args, arguments)
11898
- );
11851
+ var slicy = function slicy(arrLike, offset) {
11852
+ var arr = [];
11853
+ for (var i = offset, j = 0; i < arrLike.length; i += 1, j += 1) {
11854
+ arr[j] = arrLike[i];
11855
+ }
11856
+ return arr;
11857
+ };
11899
11858
 
11900
- };
11859
+ var joiny = function (arr, joiner) {
11860
+ var str = '';
11861
+ for (var i = 0; i < arr.length; i += 1) {
11862
+ str += arr[i];
11863
+ if (i + 1 < arr.length) {
11864
+ str += joiner;
11865
+ }
11866
+ }
11867
+ return str;
11868
+ };
11901
11869
 
11902
- var boundLength = max(0, target.length - args.length);
11903
- var boundArgs = [];
11904
- for (var i = 0; i < boundLength; i++) {
11905
- boundArgs[i] = '$' + i;
11906
- }
11870
+ var implementation$1 = function bind(that) {
11871
+ var target = this;
11872
+ if (typeof target !== 'function' || toStr.apply(target) !== funcType) {
11873
+ throw new TypeError(ERROR_MESSAGE + target);
11874
+ }
11875
+ var args = slicy(arguments, 1);
11876
+
11877
+ var bound;
11878
+ var binder = function () {
11879
+ if (this instanceof bound) {
11880
+ var result = target.apply(
11881
+ this,
11882
+ concatty(args, arguments)
11883
+ );
11884
+ if (Object(result) === result) {
11885
+ return result;
11886
+ }
11887
+ return this;
11888
+ }
11889
+ return target.apply(
11890
+ that,
11891
+ concatty(args, arguments)
11892
+ );
11907
11893
 
11908
- bound = Function('binder', 'return function (' + joiny(boundArgs, ',') + '){ return binder.apply(this,arguments); }')(binder);
11894
+ };
11909
11895
 
11910
- if (target.prototype) {
11911
- var Empty = function Empty() {};
11912
- Empty.prototype = target.prototype;
11913
- bound.prototype = new Empty();
11914
- Empty.prototype = null;
11915
- }
11896
+ var boundLength = max$1(0, target.length - args.length);
11897
+ var boundArgs = [];
11898
+ for (var i = 0; i < boundLength; i++) {
11899
+ boundArgs[i] = '$' + i;
11900
+ }
11916
11901
 
11917
- return bound;
11918
- };
11919
- return implementation;
11920
- }
11902
+ bound = Function('binder', 'return function (' + joiny(boundArgs, ',') + '){ return binder.apply(this,arguments); }')(binder);
11921
11903
 
11922
- var functionBind;
11923
- var hasRequiredFunctionBind;
11904
+ if (target.prototype) {
11905
+ var Empty = function Empty() {};
11906
+ Empty.prototype = target.prototype;
11907
+ bound.prototype = new Empty();
11908
+ Empty.prototype = null;
11909
+ }
11924
11910
 
11925
- function requireFunctionBind () {
11926
- if (hasRequiredFunctionBind) return functionBind;
11927
- hasRequiredFunctionBind = 1;
11911
+ return bound;
11912
+ };
11928
11913
 
11929
- var implementation = requireImplementation();
11914
+ var implementation = implementation$1;
11930
11915
 
11931
- functionBind = Function.prototype.bind || implementation;
11932
- return functionBind;
11933
- }
11916
+ var functionBind = Function.prototype.bind || implementation;
11934
11917
 
11935
11918
  var functionCall;
11936
11919
  var hasRequiredFunctionCall;
@@ -11975,7 +11958,7 @@ function requireActualApply () {
11975
11958
  if (hasRequiredActualApply) return actualApply;
11976
11959
  hasRequiredActualApply = 1;
11977
11960
 
11978
- var bind = requireFunctionBind();
11961
+ var bind = functionBind;
11979
11962
 
11980
11963
  var $apply = requireFunctionApply();
11981
11964
  var $call = requireFunctionCall();
@@ -11993,7 +11976,7 @@ function requireCallBindApplyHelpers () {
11993
11976
  if (hasRequiredCallBindApplyHelpers) return callBindApplyHelpers;
11994
11977
  hasRequiredCallBindApplyHelpers = 1;
11995
11978
 
11996
- var bind = requireFunctionBind();
11979
+ var bind = functionBind;
11997
11980
  var $TypeError = requireType();
11998
11981
 
11999
11982
  var $call = requireFunctionCall();
@@ -12082,21 +12065,12 @@ function requireGetProto () {
12082
12065
  return getProto$1;
12083
12066
  }
12084
12067
 
12085
- var hasown;
12086
- var hasRequiredHasown;
12068
+ var call = Function.prototype.call;
12069
+ var $hasOwn = Object.prototype.hasOwnProperty;
12070
+ var bind$1 = functionBind;
12087
12071
 
12088
- function requireHasown () {
12089
- if (hasRequiredHasown) return hasown;
12090
- hasRequiredHasown = 1;
12091
-
12092
- var call = Function.prototype.call;
12093
- var $hasOwn = Object.prototype.hasOwnProperty;
12094
- var bind = requireFunctionBind();
12095
-
12096
- /** @type {import('.')} */
12097
- hasown = bind.call(call, $hasOwn);
12098
- return hasown;
12099
- }
12072
+ /** @type {import('.')} */
12073
+ var hasown = bind$1.call(call, $hasOwn);
12100
12074
 
12101
12075
  var undefined$1;
12102
12076
 
@@ -12112,7 +12086,7 @@ var $URIError = uri;
12112
12086
 
12113
12087
  var abs = abs$1;
12114
12088
  var floor = floor$1;
12115
- var max = max$1;
12089
+ var max = max$2;
12116
12090
  var min = min$1;
12117
12091
  var pow = pow$1;
12118
12092
  var round = round$1;
@@ -12338,8 +12312,8 @@ var LEGACY_ALIASES = {
12338
12312
  '%WeakSetPrototype%': ['WeakSet', 'prototype']
12339
12313
  };
12340
12314
 
12341
- var bind = requireFunctionBind();
12342
- var hasOwn$1 = requireHasown();
12315
+ var bind = functionBind;
12316
+ var hasOwn$2 = hasown;
12343
12317
  var $concat = bind.call($call, Array.prototype.concat);
12344
12318
  var $spliceApply = bind.call($apply, Array.prototype.splice);
12345
12319
  var $replace = bind.call($call, String.prototype.replace);
@@ -12368,12 +12342,12 @@ var stringToPath = function stringToPath(string) {
12368
12342
  var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {
12369
12343
  var intrinsicName = name;
12370
12344
  var alias;
12371
- if (hasOwn$1(LEGACY_ALIASES, intrinsicName)) {
12345
+ if (hasOwn$2(LEGACY_ALIASES, intrinsicName)) {
12372
12346
  alias = LEGACY_ALIASES[intrinsicName];
12373
12347
  intrinsicName = '%' + alias[0] + '%';
12374
12348
  }
12375
12349
 
12376
- if (hasOwn$1(INTRINSICS, intrinsicName)) {
12350
+ if (hasOwn$2(INTRINSICS, intrinsicName)) {
12377
12351
  var value = INTRINSICS[intrinsicName];
12378
12352
  if (value === needsEval) {
12379
12353
  value = doEval(intrinsicName);
@@ -12437,14 +12411,14 @@ var getIntrinsic = function GetIntrinsic(name, allowMissing) {
12437
12411
  intrinsicBaseName += '.' + part;
12438
12412
  intrinsicRealName = '%' + intrinsicBaseName + '%';
12439
12413
 
12440
- if (hasOwn$1(INTRINSICS, intrinsicRealName)) {
12414
+ if (hasOwn$2(INTRINSICS, intrinsicRealName)) {
12441
12415
  value = INTRINSICS[intrinsicRealName];
12442
12416
  } else if (value != null) {
12443
12417
  if (!(part in value)) {
12444
12418
  if (!allowMissing) {
12445
12419
  throw new $TypeError$1('base intrinsic for ' + name + ' exists, but the property is not available.');
12446
12420
  }
12447
- return void 0;
12421
+ return void undefined$1;
12448
12422
  }
12449
12423
  if ($gOPD && (i + 1) >= parts.length) {
12450
12424
  var desc = $gOPD(value, part);
@@ -12463,7 +12437,7 @@ var getIntrinsic = function GetIntrinsic(name, allowMissing) {
12463
12437
  value = value[part];
12464
12438
  }
12465
12439
  } else {
12466
- isOwn = hasOwn$1(value, part);
12440
+ isOwn = hasOwn$2(value, part);
12467
12441
  value = value[part];
12468
12442
  }
12469
12443
 
@@ -12496,7 +12470,7 @@ var GetIntrinsic = getIntrinsic;
12496
12470
  var $defineProperty = GetIntrinsic('%Object.defineProperty%', true);
12497
12471
 
12498
12472
  var hasToStringTag = requireShams()();
12499
- var hasOwn = requireHasown();
12473
+ var hasOwn$1 = hasown;
12500
12474
  var $TypeError = requireType();
12501
12475
 
12502
12476
  var toStringTag = hasToStringTag ? Symbol.toStringTag : null;
@@ -12511,7 +12485,7 @@ var esSetTostringtag = function setToStringTag(object, value) {
12511
12485
  ) {
12512
12486
  throw new $TypeError('if provided, the `overrideIfSet` and `nonConfigurable` options must be booleans');
12513
12487
  }
12514
- if (toStringTag && (overrideIfSet || !hasOwn(object, toStringTag))) {
12488
+ if (toStringTag && (overrideIfSet || !hasOwn$1(object, toStringTag))) {
12515
12489
  if ($defineProperty) {
12516
12490
  $defineProperty(object, toStringTag, {
12517
12491
  configurable: !nonConfigurable,
@@ -12526,11 +12500,9 @@ var esSetTostringtag = function setToStringTag(object, value) {
12526
12500
  };
12527
12501
 
12528
12502
  // populates missing values
12529
- var populate$1 = function(dst, src) {
12530
-
12531
- Object.keys(src).forEach(function(prop)
12532
- {
12533
- dst[prop] = dst[prop] || src[prop];
12503
+ var populate$1 = function (dst, src) {
12504
+ Object.keys(src).forEach(function (prop) {
12505
+ dst[prop] = dst[prop] || src[prop]; // eslint-disable-line no-param-reassign
12534
12506
  });
12535
12507
 
12536
12508
  return dst;
@@ -12544,24 +12516,20 @@ var https = require$$4;
12544
12516
  var parseUrl = require$$5.parse;
12545
12517
  var fs = require$$6;
12546
12518
  var Stream = require$$0$1.Stream;
12519
+ var crypto = require$$8;
12547
12520
  var mime = mimeTypes;
12548
12521
  var asynckit = asynckit$1;
12549
12522
  var setToStringTag = esSetTostringtag;
12523
+ var hasOwn = hasown;
12550
12524
  var populate = populate$1;
12551
12525
 
12552
- // Public API
12553
- var form_data = FormData;
12554
-
12555
- // make it a Stream
12556
- util.inherits(FormData, CombinedStream);
12557
-
12558
12526
  /**
12559
12527
  * Create readable "multipart/form-data" streams.
12560
12528
  * Can be used to submit forms
12561
12529
  * and file uploads to other web applications.
12562
12530
  *
12563
12531
  * @constructor
12564
- * @param {Object} options - Properties to be added/overriden for FormData and CombinedStream
12532
+ * @param {object} options - Properties to be added/overriden for FormData and CombinedStream
12565
12533
  */
12566
12534
  function FormData(options) {
12567
12535
  if (!(this instanceof FormData)) {
@@ -12574,35 +12542,39 @@ function FormData(options) {
12574
12542
 
12575
12543
  CombinedStream.call(this);
12576
12544
 
12577
- options = options || {};
12578
- for (var option in options) {
12545
+ options = options || {}; // eslint-disable-line no-param-reassign
12546
+ for (var option in options) { // eslint-disable-line no-restricted-syntax
12579
12547
  this[option] = options[option];
12580
12548
  }
12581
12549
  }
12582
12550
 
12551
+ // make it a Stream
12552
+ util.inherits(FormData, CombinedStream);
12553
+
12583
12554
  FormData.LINE_BREAK = '\r\n';
12584
12555
  FormData.DEFAULT_CONTENT_TYPE = 'application/octet-stream';
12585
12556
 
12586
- FormData.prototype.append = function(field, value, options) {
12587
-
12588
- options = options || {};
12557
+ FormData.prototype.append = function (field, value, options) {
12558
+ options = options || {}; // eslint-disable-line no-param-reassign
12589
12559
 
12590
12560
  // allow filename as single option
12591
- if (typeof options == 'string') {
12592
- options = {filename: options};
12561
+ if (typeof options === 'string') {
12562
+ options = { filename: options }; // eslint-disable-line no-param-reassign
12593
12563
  }
12594
12564
 
12595
12565
  var append = CombinedStream.prototype.append.bind(this);
12596
12566
 
12597
12567
  // all that streamy business can't handle numbers
12598
- if (typeof value == 'number') {
12599
- value = '' + value;
12568
+ if (typeof value === 'number' || value == null) {
12569
+ value = String(value); // eslint-disable-line no-param-reassign
12600
12570
  }
12601
12571
 
12602
12572
  // https://github.com/felixge/node-form-data/issues/38
12603
12573
  if (Array.isArray(value)) {
12604
- // Please convert your array into string
12605
- // the way web server expects it
12574
+ /*
12575
+ * Please convert your array into string
12576
+ * the way web server expects it
12577
+ */
12606
12578
  this._error(new Error('Arrays are not supported.'));
12607
12579
  return;
12608
12580
  }
@@ -12618,15 +12590,17 @@ FormData.prototype.append = function(field, value, options) {
12618
12590
  this._trackLength(header, value, options);
12619
12591
  };
12620
12592
 
12621
- FormData.prototype._trackLength = function(header, value, options) {
12593
+ FormData.prototype._trackLength = function (header, value, options) {
12622
12594
  var valueLength = 0;
12623
12595
 
12624
- // used w/ getLengthSync(), when length is known.
12625
- // e.g. for streaming directly from a remote server,
12626
- // w/ a known file a size, and not wanting to wait for
12627
- // incoming file to finish to get its size.
12596
+ /*
12597
+ * used w/ getLengthSync(), when length is known.
12598
+ * e.g. for streaming directly from a remote server,
12599
+ * w/ a known file a size, and not wanting to wait for
12600
+ * incoming file to finish to get its size.
12601
+ */
12628
12602
  if (options.knownLength != null) {
12629
- valueLength += +options.knownLength;
12603
+ valueLength += Number(options.knownLength);
12630
12604
  } else if (Buffer.isBuffer(value)) {
12631
12605
  valueLength = value.length;
12632
12606
  } else if (typeof value === 'string') {
@@ -12636,12 +12610,10 @@ FormData.prototype._trackLength = function(header, value, options) {
12636
12610
  this._valueLength += valueLength;
12637
12611
 
12638
12612
  // @check why add CRLF? does this account for custom/multiple CRLFs?
12639
- this._overheadLength +=
12640
- Buffer.byteLength(header) +
12641
- FormData.LINE_BREAK.length;
12613
+ this._overheadLength += Buffer.byteLength(header) + FormData.LINE_BREAK.length;
12642
12614
 
12643
12615
  // empty or either doesn't have path or not an http response or not a stream
12644
- if (!value || ( !value.path && !(value.readable && Object.prototype.hasOwnProperty.call(value, 'httpVersion')) && !(value instanceof Stream))) {
12616
+ if (!value || (!value.path && !(value.readable && hasOwn(value, 'httpVersion')) && !(value instanceof Stream))) {
12645
12617
  return;
12646
12618
  }
12647
12619
 
@@ -12651,9 +12623,8 @@ FormData.prototype._trackLength = function(header, value, options) {
12651
12623
  }
12652
12624
  };
12653
12625
 
12654
- FormData.prototype._lengthRetriever = function(value, callback) {
12655
- if (Object.prototype.hasOwnProperty.call(value, 'fd')) {
12656
-
12626
+ FormData.prototype._lengthRetriever = function (value, callback) {
12627
+ if (hasOwn(value, 'fd')) {
12657
12628
  // take read range into a account
12658
12629
  // `end` = Infinity –> read file till the end
12659
12630
  //
@@ -12662,54 +12633,52 @@ FormData.prototype._lengthRetriever = function(value, callback) {
12662
12633
  // Fix it when node fixes it.
12663
12634
  // https://github.com/joyent/node/issues/7819
12664
12635
  if (value.end != undefined && value.end != Infinity && value.start != undefined) {
12665
-
12666
12636
  // when end specified
12667
12637
  // no need to calculate range
12668
12638
  // inclusive, starts with 0
12669
- callback(null, value.end + 1 - (value.start ? value.start : 0));
12639
+ callback(null, value.end + 1 - (value.start ? value.start : 0)); // eslint-disable-line callback-return
12670
12640
 
12671
- // not that fast snoopy
12641
+ // not that fast snoopy
12672
12642
  } else {
12673
12643
  // still need to fetch file size from fs
12674
- fs.stat(value.path, function(err, stat) {
12675
-
12676
- var fileSize;
12677
-
12644
+ fs.stat(value.path, function (err, stat) {
12678
12645
  if (err) {
12679
12646
  callback(err);
12680
12647
  return;
12681
12648
  }
12682
12649
 
12683
12650
  // update final size based on the range options
12684
- fileSize = stat.size - (value.start ? value.start : 0);
12651
+ var fileSize = stat.size - (value.start ? value.start : 0);
12685
12652
  callback(null, fileSize);
12686
12653
  });
12687
12654
  }
12688
12655
 
12689
- // or http response
12690
- } else if (Object.prototype.hasOwnProperty.call(value, 'httpVersion')) {
12691
- callback(null, +value.headers['content-length']);
12656
+ // or http response
12657
+ } else if (hasOwn(value, 'httpVersion')) {
12658
+ callback(null, Number(value.headers['content-length'])); // eslint-disable-line callback-return
12692
12659
 
12693
- // or request stream http://github.com/mikeal/request
12694
- } else if (Object.prototype.hasOwnProperty.call(value, 'httpModule')) {
12660
+ // or request stream http://github.com/mikeal/request
12661
+ } else if (hasOwn(value, 'httpModule')) {
12695
12662
  // wait till response come back
12696
- value.on('response', function(response) {
12663
+ value.on('response', function (response) {
12697
12664
  value.pause();
12698
- callback(null, +response.headers['content-length']);
12665
+ callback(null, Number(response.headers['content-length']));
12699
12666
  });
12700
12667
  value.resume();
12701
12668
 
12702
- // something else
12669
+ // something else
12703
12670
  } else {
12704
- callback('Unknown stream');
12671
+ callback('Unknown stream'); // eslint-disable-line callback-return
12705
12672
  }
12706
12673
  };
12707
12674
 
12708
- FormData.prototype._multiPartHeader = function(field, value, options) {
12709
- // custom header specified (as string)?
12710
- // it becomes responsible for boundary
12711
- // (e.g. to handle extra CRLFs on .NET servers)
12712
- if (typeof options.header == 'string') {
12675
+ FormData.prototype._multiPartHeader = function (field, value, options) {
12676
+ /*
12677
+ * custom header specified (as string)?
12678
+ * it becomes responsible for boundary
12679
+ * (e.g. to handle extra CRLFs on .NET servers)
12680
+ */
12681
+ if (typeof options.header === 'string') {
12713
12682
  return options.header;
12714
12683
  }
12715
12684
 
@@ -12717,7 +12686,7 @@ FormData.prototype._multiPartHeader = function(field, value, options) {
12717
12686
  var contentType = this._getContentType(value, options);
12718
12687
 
12719
12688
  var contents = '';
12720
- var headers = {
12689
+ var headers = {
12721
12690
  // add custom disposition as third element or keep it two elements if not
12722
12691
  'Content-Disposition': ['form-data', 'name="' + field + '"'].concat(contentDisposition || []),
12723
12692
  // if no content type. allow it to be empty array
@@ -12725,18 +12694,18 @@ FormData.prototype._multiPartHeader = function(field, value, options) {
12725
12694
  };
12726
12695
 
12727
12696
  // allow custom headers.
12728
- if (typeof options.header == 'object') {
12697
+ if (typeof options.header === 'object') {
12729
12698
  populate(headers, options.header);
12730
12699
  }
12731
12700
 
12732
12701
  var header;
12733
- for (var prop in headers) {
12734
- if (Object.prototype.hasOwnProperty.call(headers, prop)) {
12702
+ for (var prop in headers) { // eslint-disable-line no-restricted-syntax
12703
+ if (hasOwn(headers, prop)) {
12735
12704
  header = headers[prop];
12736
12705
 
12737
12706
  // skip nullish headers.
12738
12707
  if (header == null) {
12739
- continue;
12708
+ continue; // eslint-disable-line no-restricted-syntax, no-continue
12740
12709
  }
12741
12710
 
12742
12711
  // convert all headers to arrays.
@@ -12754,49 +12723,45 @@ FormData.prototype._multiPartHeader = function(field, value, options) {
12754
12723
  return '--' + this.getBoundary() + FormData.LINE_BREAK + contents + FormData.LINE_BREAK;
12755
12724
  };
12756
12725
 
12757
- FormData.prototype._getContentDisposition = function(value, options) {
12758
-
12759
- var filename
12760
- , contentDisposition
12761
- ;
12726
+ FormData.prototype._getContentDisposition = function (value, options) { // eslint-disable-line consistent-return
12727
+ var filename;
12762
12728
 
12763
12729
  if (typeof options.filepath === 'string') {
12764
12730
  // custom filepath for relative paths
12765
12731
  filename = path.normalize(options.filepath).replace(/\\/g, '/');
12766
- } else if (options.filename || value.name || value.path) {
12767
- // custom filename take precedence
12768
- // formidable and the browser add a name property
12769
- // fs- and request- streams have path property
12770
- filename = path.basename(options.filename || value.name || value.path);
12771
- } else if (value.readable && Object.prototype.hasOwnProperty.call(value, 'httpVersion')) {
12732
+ } else if (options.filename || (value && (value.name || value.path))) {
12733
+ /*
12734
+ * custom filename take precedence
12735
+ * formidable and the browser add a name property
12736
+ * fs- and request- streams have path property
12737
+ */
12738
+ filename = path.basename(options.filename || (value && (value.name || value.path)));
12739
+ } else if (value && value.readable && hasOwn(value, 'httpVersion')) {
12772
12740
  // or try http response
12773
12741
  filename = path.basename(value.client._httpMessage.path || '');
12774
12742
  }
12775
12743
 
12776
12744
  if (filename) {
12777
- contentDisposition = 'filename="' + filename + '"';
12745
+ return 'filename="' + filename + '"';
12778
12746
  }
12779
-
12780
- return contentDisposition;
12781
12747
  };
12782
12748
 
12783
- FormData.prototype._getContentType = function(value, options) {
12784
-
12749
+ FormData.prototype._getContentType = function (value, options) {
12785
12750
  // use custom content-type above all
12786
12751
  var contentType = options.contentType;
12787
12752
 
12788
12753
  // or try `name` from formidable, browser
12789
- if (!contentType && value.name) {
12754
+ if (!contentType && value && value.name) {
12790
12755
  contentType = mime.lookup(value.name);
12791
12756
  }
12792
12757
 
12793
12758
  // or try `path` from fs-, request- streams
12794
- if (!contentType && value.path) {
12759
+ if (!contentType && value && value.path) {
12795
12760
  contentType = mime.lookup(value.path);
12796
12761
  }
12797
12762
 
12798
12763
  // or if it's http-reponse
12799
- if (!contentType && value.readable && Object.prototype.hasOwnProperty.call(value, 'httpVersion')) {
12764
+ if (!contentType && value && value.readable && hasOwn(value, 'httpVersion')) {
12800
12765
  contentType = value.headers['content-type'];
12801
12766
  }
12802
12767
 
@@ -12806,18 +12771,18 @@ FormData.prototype._getContentType = function(value, options) {
12806
12771
  }
12807
12772
 
12808
12773
  // fallback to the default content type if `value` is not simple value
12809
- if (!contentType && typeof value == 'object') {
12774
+ if (!contentType && value && typeof value === 'object') {
12810
12775
  contentType = FormData.DEFAULT_CONTENT_TYPE;
12811
12776
  }
12812
12777
 
12813
12778
  return contentType;
12814
12779
  };
12815
12780
 
12816
- FormData.prototype._multiPartFooter = function() {
12817
- return function(next) {
12781
+ FormData.prototype._multiPartFooter = function () {
12782
+ return function (next) {
12818
12783
  var footer = FormData.LINE_BREAK;
12819
12784
 
12820
- var lastPart = (this._streams.length === 0);
12785
+ var lastPart = this._streams.length === 0;
12821
12786
  if (lastPart) {
12822
12787
  footer += this._lastBoundary();
12823
12788
  }
@@ -12826,18 +12791,18 @@ FormData.prototype._multiPartFooter = function() {
12826
12791
  }.bind(this);
12827
12792
  };
12828
12793
 
12829
- FormData.prototype._lastBoundary = function() {
12794
+ FormData.prototype._lastBoundary = function () {
12830
12795
  return '--' + this.getBoundary() + '--' + FormData.LINE_BREAK;
12831
12796
  };
12832
12797
 
12833
- FormData.prototype.getHeaders = function(userHeaders) {
12798
+ FormData.prototype.getHeaders = function (userHeaders) {
12834
12799
  var header;
12835
12800
  var formHeaders = {
12836
12801
  'content-type': 'multipart/form-data; boundary=' + this.getBoundary()
12837
12802
  };
12838
12803
 
12839
- for (header in userHeaders) {
12840
- if (Object.prototype.hasOwnProperty.call(userHeaders, header)) {
12804
+ for (header in userHeaders) { // eslint-disable-line no-restricted-syntax
12805
+ if (hasOwn(userHeaders, header)) {
12841
12806
  formHeaders[header.toLowerCase()] = userHeaders[header];
12842
12807
  }
12843
12808
  }
@@ -12845,11 +12810,14 @@ FormData.prototype.getHeaders = function(userHeaders) {
12845
12810
  return formHeaders;
12846
12811
  };
12847
12812
 
12848
- FormData.prototype.setBoundary = function(boundary) {
12813
+ FormData.prototype.setBoundary = function (boundary) {
12814
+ if (typeof boundary !== 'string') {
12815
+ throw new TypeError('FormData boundary must be a string');
12816
+ }
12849
12817
  this._boundary = boundary;
12850
12818
  };
12851
12819
 
12852
- FormData.prototype.getBoundary = function() {
12820
+ FormData.prototype.getBoundary = function () {
12853
12821
  if (!this._boundary) {
12854
12822
  this._generateBoundary();
12855
12823
  }
@@ -12857,60 +12825,55 @@ FormData.prototype.getBoundary = function() {
12857
12825
  return this._boundary;
12858
12826
  };
12859
12827
 
12860
- FormData.prototype.getBuffer = function() {
12861
- var dataBuffer = new Buffer.alloc(0);
12828
+ FormData.prototype.getBuffer = function () {
12829
+ var dataBuffer = new Buffer.alloc(0); // eslint-disable-line new-cap
12862
12830
  var boundary = this.getBoundary();
12863
12831
 
12864
12832
  // Create the form content. Add Line breaks to the end of data.
12865
12833
  for (var i = 0, len = this._streams.length; i < len; i++) {
12866
12834
  if (typeof this._streams[i] !== 'function') {
12867
-
12868
12835
  // Add content to the buffer.
12869
- if(Buffer.isBuffer(this._streams[i])) {
12870
- dataBuffer = Buffer.concat( [dataBuffer, this._streams[i]]);
12871
- }else {
12872
- dataBuffer = Buffer.concat( [dataBuffer, Buffer.from(this._streams[i])]);
12836
+ if (Buffer.isBuffer(this._streams[i])) {
12837
+ dataBuffer = Buffer.concat([dataBuffer, this._streams[i]]);
12838
+ } else {
12839
+ dataBuffer = Buffer.concat([dataBuffer, Buffer.from(this._streams[i])]);
12873
12840
  }
12874
12841
 
12875
12842
  // Add break after content.
12876
- if (typeof this._streams[i] !== 'string' || this._streams[i].substring( 2, boundary.length + 2 ) !== boundary) {
12877
- dataBuffer = Buffer.concat( [dataBuffer, Buffer.from(FormData.LINE_BREAK)] );
12843
+ if (typeof this._streams[i] !== 'string' || this._streams[i].substring(2, boundary.length + 2) !== boundary) {
12844
+ dataBuffer = Buffer.concat([dataBuffer, Buffer.from(FormData.LINE_BREAK)]);
12878
12845
  }
12879
12846
  }
12880
12847
  }
12881
12848
 
12882
12849
  // Add the footer and return the Buffer object.
12883
- return Buffer.concat( [dataBuffer, Buffer.from(this._lastBoundary())] );
12850
+ return Buffer.concat([dataBuffer, Buffer.from(this._lastBoundary())]);
12884
12851
  };
12885
12852
 
12886
- FormData.prototype._generateBoundary = function() {
12853
+ FormData.prototype._generateBoundary = function () {
12887
12854
  // This generates a 50 character boundary similar to those used by Firefox.
12888
- // They are optimized for boyer-moore parsing.
12889
- var boundary = '--------------------------';
12890
- for (var i = 0; i < 24; i++) {
12891
- boundary += Math.floor(Math.random() * 10).toString(16);
12892
- }
12893
12855
 
12894
- this._boundary = boundary;
12856
+ // They are optimized for boyer-moore parsing.
12857
+ this._boundary = '--------------------------' + crypto.randomBytes(12).toString('hex');
12895
12858
  };
12896
12859
 
12897
12860
  // Note: getLengthSync DOESN'T calculate streams length
12898
- // As workaround one can calculate file size manually
12899
- // and add it as knownLength option
12900
- FormData.prototype.getLengthSync = function() {
12861
+ // As workaround one can calculate file size manually and add it as knownLength option
12862
+ FormData.prototype.getLengthSync = function () {
12901
12863
  var knownLength = this._overheadLength + this._valueLength;
12902
12864
 
12903
- // Don't get confused, there are 3 "internal" streams for each keyval pair
12904
- // so it basically checks if there is any value added to the form
12865
+ // 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
12905
12866
  if (this._streams.length) {
12906
12867
  knownLength += this._lastBoundary().length;
12907
12868
  }
12908
12869
 
12909
12870
  // https://github.com/form-data/form-data/issues/40
12910
12871
  if (!this.hasKnownLength()) {
12911
- // Some async length retrievers are present
12912
- // therefore synchronous length calculation is false.
12913
- // Please use getLength(callback) to get proper length
12872
+ /*
12873
+ * Some async length retrievers are present
12874
+ * therefore synchronous length calculation is false.
12875
+ * Please use getLength(callback) to get proper length
12876
+ */
12914
12877
  this._error(new Error('Cannot calculate proper length in synchronous way.'));
12915
12878
  }
12916
12879
 
@@ -12920,7 +12883,7 @@ FormData.prototype.getLengthSync = function() {
12920
12883
  // Public API to check if length of added values is known
12921
12884
  // https://github.com/form-data/form-data/issues/196
12922
12885
  // https://github.com/form-data/form-data/issues/262
12923
- FormData.prototype.hasKnownLength = function() {
12886
+ FormData.prototype.hasKnownLength = function () {
12924
12887
  var hasKnownLength = true;
12925
12888
 
12926
12889
  if (this._valuesToMeasure.length) {
@@ -12930,7 +12893,7 @@ FormData.prototype.hasKnownLength = function() {
12930
12893
  return hasKnownLength;
12931
12894
  };
12932
12895
 
12933
- FormData.prototype.getLength = function(cb) {
12896
+ FormData.prototype.getLength = function (cb) {
12934
12897
  var knownLength = this._overheadLength + this._valueLength;
12935
12898
 
12936
12899
  if (this._streams.length) {
@@ -12942,13 +12905,13 @@ FormData.prototype.getLength = function(cb) {
12942
12905
  return;
12943
12906
  }
12944
12907
 
12945
- asynckit.parallel(this._valuesToMeasure, this._lengthRetriever, function(err, values) {
12908
+ asynckit.parallel(this._valuesToMeasure, this._lengthRetriever, function (err, values) {
12946
12909
  if (err) {
12947
12910
  cb(err);
12948
12911
  return;
12949
12912
  }
12950
12913
 
12951
- values.forEach(function(length) {
12914
+ values.forEach(function (length) {
12952
12915
  knownLength += length;
12953
12916
  });
12954
12917
 
@@ -12956,31 +12919,26 @@ FormData.prototype.getLength = function(cb) {
12956
12919
  });
12957
12920
  };
12958
12921
 
12959
- FormData.prototype.submit = function(params, cb) {
12960
- var request
12961
- , options
12962
- , defaults = {method: 'post'}
12963
- ;
12922
+ FormData.prototype.submit = function (params, cb) {
12923
+ var request;
12924
+ var options;
12925
+ var defaults = { method: 'post' };
12964
12926
 
12965
- // parse provided url if it's string
12966
- // or treat it as options object
12967
- if (typeof params == 'string') {
12968
-
12969
- params = parseUrl(params);
12927
+ // parse provided url if it's string or treat it as options object
12928
+ if (typeof params === 'string') {
12929
+ params = parseUrl(params); // eslint-disable-line no-param-reassign
12930
+ /* eslint sort-keys: 0 */
12970
12931
  options = populate({
12971
12932
  port: params.port,
12972
12933
  path: params.pathname,
12973
12934
  host: params.hostname,
12974
12935
  protocol: params.protocol
12975
12936
  }, defaults);
12976
-
12977
- // use custom params
12978
- } else {
12979
-
12937
+ } else { // use custom params
12980
12938
  options = populate(params, defaults);
12981
12939
  // if no port provided use default one
12982
12940
  if (!options.port) {
12983
- options.port = options.protocol == 'https:' ? 443 : 80;
12941
+ options.port = options.protocol === 'https:' ? 443 : 80;
12984
12942
  }
12985
12943
  }
12986
12944
 
@@ -12988,14 +12946,14 @@ FormData.prototype.submit = function(params, cb) {
12988
12946
  options.headers = this.getHeaders(params.headers);
12989
12947
 
12990
12948
  // https if specified, fallback to http in any other case
12991
- if (options.protocol == 'https:') {
12949
+ if (options.protocol === 'https:') {
12992
12950
  request = https.request(options);
12993
12951
  } else {
12994
12952
  request = http.request(options);
12995
12953
  }
12996
12954
 
12997
12955
  // get content length and fire away
12998
- this.getLength(function(err, length) {
12956
+ this.getLength(function (err, length) {
12999
12957
  if (err && err !== 'Unknown stream') {
13000
12958
  this._error(err);
13001
12959
  return;
@@ -13014,7 +12972,7 @@ FormData.prototype.submit = function(params, cb) {
13014
12972
  request.removeListener('error', callback);
13015
12973
  request.removeListener('response', onResponse);
13016
12974
 
13017
- return cb.call(this, error, responce);
12975
+ return cb.call(this, error, responce); // eslint-disable-line no-invalid-this
13018
12976
  };
13019
12977
 
13020
12978
  onResponse = callback.bind(this, null);
@@ -13027,7 +12985,7 @@ FormData.prototype.submit = function(params, cb) {
13027
12985
  return request;
13028
12986
  };
13029
12987
 
13030
- FormData.prototype._error = function(err) {
12988
+ FormData.prototype._error = function (err) {
13031
12989
  if (!this.error) {
13032
12990
  this.error = err;
13033
12991
  this.pause();
@@ -13040,6 +12998,9 @@ FormData.prototype.toString = function () {
13040
12998
  };
13041
12999
  setToStringTag(FormData, 'FormData');
13042
13000
 
13001
+ // Public API
13002
+ var form_data = FormData;
13003
+
13043
13004
  var FormData$1 = /*@__PURE__*/getDefaultExportFromCjs(form_data);
13044
13005
 
13045
13006
  var dist = {exports: {}};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@builderbot/provider-meta",
3
- "version": "1.3.2-alpha.1",
3
+ "version": "1.3.3",
4
4
  "description": "> TODO: description",
5
5
  "author": "vicente1992 <vic_ortiz20@hotmail.es>",
6
6
  "homepage": "https://github.com/vicente1992/bot-whatsapp#readme",
@@ -38,7 +38,7 @@
38
38
  "queue-promise": "^2.2.1"
39
39
  },
40
40
  "devDependencies": {
41
- "@builderbot/bot": "^1.3.2-alpha.1",
41
+ "@builderbot/bot": "1.3.2-y.0",
42
42
  "@jest/globals": "^29.7.0",
43
43
  "@rollup/plugin-commonjs": "^25.0.7",
44
44
  "@rollup/plugin-json": "^6.1.0",
@@ -61,5 +61,5 @@
61
61
  "tslib": "^2.6.2",
62
62
  "tsm": "^2.3.0"
63
63
  },
64
- "gitHead": "6c5cdc5619203336ab3b56025cd9081474bc5a3e"
64
+ "gitHead": "8c3712b1fa4ffdaf7999b6f64a566cde74d67d69"
65
65
  }