@builderbot/provider-venom 1.3.13 → 1.3.14

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 +62 -41
  2. package/package.json +3 -3
package/dist/index.cjs CHANGED
@@ -10744,7 +10744,7 @@ var mimeDb = require$$0;
10744
10744
  * MIT Licensed
10745
10745
  */
10746
10746
 
10747
- (function (exports) {
10747
+ (function (exports$1) {
10748
10748
 
10749
10749
  /**
10750
10750
  * Module dependencies.
@@ -10767,16 +10767,16 @@ var mimeDb = require$$0;
10767
10767
  * @public
10768
10768
  */
10769
10769
 
10770
- exports.charset = charset;
10771
- exports.charsets = { lookup: charset };
10772
- exports.contentType = contentType;
10773
- exports.extension = extension;
10774
- exports.extensions = Object.create(null);
10775
- exports.lookup = lookup;
10776
- exports.types = Object.create(null);
10770
+ exports$1.charset = charset;
10771
+ exports$1.charsets = { lookup: charset };
10772
+ exports$1.contentType = contentType;
10773
+ exports$1.extension = extension;
10774
+ exports$1.extensions = Object.create(null);
10775
+ exports$1.lookup = lookup;
10776
+ exports$1.types = Object.create(null);
10777
10777
 
10778
10778
  // Populate the extensions/types maps
10779
- populateMaps(exports.extensions, exports.types);
10779
+ populateMaps(exports$1.extensions, exports$1.types);
10780
10780
 
10781
10781
  /**
10782
10782
  * Get the default charset for a MIME type.
@@ -10820,7 +10820,7 @@ var mimeDb = require$$0;
10820
10820
  }
10821
10821
 
10822
10822
  var mime = str.indexOf('/') === -1
10823
- ? exports.lookup(str)
10823
+ ? exports$1.lookup(str)
10824
10824
  : str;
10825
10825
 
10826
10826
  if (!mime) {
@@ -10829,7 +10829,7 @@ var mimeDb = require$$0;
10829
10829
 
10830
10830
  // TODO: use content-type or other module
10831
10831
  if (mime.indexOf('charset') === -1) {
10832
- var charset = exports.charset(mime);
10832
+ var charset = exports$1.charset(mime);
10833
10833
  if (charset) mime += '; charset=' + charset.toLowerCase();
10834
10834
  }
10835
10835
 
@@ -10852,7 +10852,7 @@ var mimeDb = require$$0;
10852
10852
  var match = EXTRACT_TYPE_REGEXP.exec(type);
10853
10853
 
10854
10854
  // get extensions
10855
- var exts = match && exports.extensions[match[1].toLowerCase()];
10855
+ var exts = match && exports$1.extensions[match[1].toLowerCase()];
10856
10856
 
10857
10857
  if (!exts || !exts.length) {
10858
10858
  return false
@@ -10882,7 +10882,7 @@ var mimeDb = require$$0;
10882
10882
  return false
10883
10883
  }
10884
10884
 
10885
- return exports.types[extension] || false
10885
+ return exports$1.types[extension] || false
10886
10886
  }
10887
10887
 
10888
10888
  /**
@@ -11902,7 +11902,7 @@ function retry () {
11902
11902
  }
11903
11903
  }
11904
11904
 
11905
- (function (exports) {
11905
+ (function (exports$1) {
11906
11906
  // This is adapted from https://github.com/normalize/mz
11907
11907
  // Copyright (c) 2014-2016 Jonathan Ong me@jongleberry.com and Contributors
11908
11908
  const u = universalify$1.fromCallback;
@@ -11957,16 +11957,16 @@ function retry () {
11957
11957
  });
11958
11958
 
11959
11959
  // Export cloned fs:
11960
- Object.assign(exports, fs);
11960
+ Object.assign(exports$1, fs);
11961
11961
 
11962
11962
  // Universalify async methods:
11963
11963
  api.forEach(method => {
11964
- exports[method] = u(fs[method]);
11964
+ exports$1[method] = u(fs[method]);
11965
11965
  });
11966
11966
 
11967
11967
  // We differ from mz/fs in that we still ship the old, broken, fs.exists()
11968
11968
  // since we are a drop-in replacement for the native module
11969
- exports.exists = function (filename, callback) {
11969
+ exports$1.exists = function (filename, callback) {
11970
11970
  if (typeof callback === 'function') {
11971
11971
  return fs.exists(filename, callback)
11972
11972
  }
@@ -11977,7 +11977,7 @@ function retry () {
11977
11977
 
11978
11978
  // fs.read(), fs.write(), fs.readv(), & fs.writev() need special treatment due to multiple callback args
11979
11979
 
11980
- exports.read = function (fd, buffer, offset, length, position, callback) {
11980
+ exports$1.read = function (fd, buffer, offset, length, position, callback) {
11981
11981
  if (typeof callback === 'function') {
11982
11982
  return fs.read(fd, buffer, offset, length, position, callback)
11983
11983
  }
@@ -11994,7 +11994,7 @@ function retry () {
11994
11994
  // OR
11995
11995
  // fs.write(fd, string[, position[, encoding]], callback)
11996
11996
  // We need to handle both cases, so we use ...args
11997
- exports.write = function (fd, buffer, ...args) {
11997
+ exports$1.write = function (fd, buffer, ...args) {
11998
11998
  if (typeof args[args.length - 1] === 'function') {
11999
11999
  return fs.write(fd, buffer, ...args)
12000
12000
  }
@@ -12010,7 +12010,7 @@ function retry () {
12010
12010
  // Function signature is
12011
12011
  // s.readv(fd, buffers[, position], callback)
12012
12012
  // We need to handle the optional arg, so we use ...args
12013
- exports.readv = function (fd, buffers, ...args) {
12013
+ exports$1.readv = function (fd, buffers, ...args) {
12014
12014
  if (typeof args[args.length - 1] === 'function') {
12015
12015
  return fs.readv(fd, buffers, ...args)
12016
12016
  }
@@ -12026,7 +12026,7 @@ function retry () {
12026
12026
  // Function signature is
12027
12027
  // s.writev(fd, buffers[, position], callback)
12028
12028
  // We need to handle the optional arg, so we use ...args
12029
- exports.writev = function (fd, buffers, ...args) {
12029
+ exports$1.writev = function (fd, buffers, ...args) {
12030
12030
  if (typeof args[args.length - 1] === 'function') {
12031
12031
  return fs.writev(fd, buffers, ...args)
12032
12032
  }
@@ -12041,7 +12041,7 @@ function retry () {
12041
12041
 
12042
12042
  // fs.realpath.native sometimes not available if fs is monkey-patched
12043
12043
  if (typeof fs.realpath.native === 'function') {
12044
- exports.realpath.native = u(fs.realpath.native);
12044
+ exports$1.realpath.native = u(fs.realpath.native);
12045
12045
  } else {
12046
12046
  process.emitWarning(
12047
12047
  'fs.realpath.native is not a function. Is fs being monkey-patched?',
@@ -12316,12 +12316,41 @@ var stat$4 = {
12316
12316
  areIdentical: areIdentical$2
12317
12317
  };
12318
12318
 
12319
+ // https://github.com/jprichardson/node-fs-extra/issues/1056
12320
+ // Performing parallel operations on each item of an async iterator is
12321
+ // surprisingly hard; you need to have handlers in place to avoid getting an
12322
+ // UnhandledPromiseRejectionWarning.
12323
+ // NOTE: This function does not presently handle return values, only errors
12324
+ async function asyncIteratorConcurrentProcess$1 (iterator, fn) {
12325
+ const promises = [];
12326
+ for await (const item of iterator) {
12327
+ promises.push(
12328
+ fn(item).then(
12329
+ () => null,
12330
+ (err) => err ?? new Error('unknown error')
12331
+ )
12332
+ );
12333
+ }
12334
+ await Promise.all(
12335
+ promises.map((promise) =>
12336
+ promise.then((possibleErr) => {
12337
+ if (possibleErr !== null) throw possibleErr
12338
+ })
12339
+ )
12340
+ );
12341
+ }
12342
+
12343
+ var async = {
12344
+ asyncIteratorConcurrentProcess: asyncIteratorConcurrentProcess$1
12345
+ };
12346
+
12319
12347
  const fs$b = fs$h;
12320
12348
  const path$9 = require$$1;
12321
12349
  const { mkdirs: mkdirs$1 } = mkdirs$2;
12322
12350
  const { pathExists: pathExists$5 } = pathExists_1;
12323
12351
  const { utimesMillis } = utimes;
12324
12352
  const stat$3 = stat$4;
12353
+ const { asyncIteratorConcurrentProcess } = async;
12325
12354
 
12326
12355
  async function copy$2 (src, dest, opts = {}) {
12327
12356
  if (typeof opts === 'function') {
@@ -12429,28 +12458,20 @@ async function onDir$1 (srcStat, destStat, src, dest, opts) {
12429
12458
  await fs$b.mkdir(dest);
12430
12459
  }
12431
12460
 
12432
- const promises = [];
12433
-
12434
- // loop through the files in the current directory to copy everything
12435
- for await (const item of await fs$b.opendir(src)) {
12461
+ // iterate through the files in the current directory to copy everything
12462
+ await asyncIteratorConcurrentProcess(await fs$b.opendir(src), async (item) => {
12436
12463
  const srcItem = path$9.join(src, item.name);
12437
12464
  const destItem = path$9.join(dest, item.name);
12438
12465
 
12439
- promises.push(
12440
- runFilter(srcItem, destItem, opts).then(include => {
12441
- if (include) {
12442
- // only copy the item if it matches the filter function
12443
- return stat$3.checkPaths(srcItem, destItem, 'copy', opts).then(({ destStat }) => {
12444
- // If the item is a copyable file, `getStatsAndPerformCopy` will copy it
12445
- // If the item is a directory, `getStatsAndPerformCopy` will call `onDir` recursively
12446
- return getStatsAndPerformCopy(destStat, srcItem, destItem, opts)
12447
- })
12448
- }
12449
- })
12450
- );
12451
- }
12452
-
12453
- await Promise.all(promises);
12466
+ const include = await runFilter(srcItem, destItem, opts);
12467
+ // only copy the item if it matches the filter function
12468
+ if (include) {
12469
+ const { destStat } = await stat$3.checkPaths(srcItem, destItem, 'copy', opts);
12470
+ // If the item is a copyable file, `getStatsAndPerformCopy` will copy it
12471
+ // If the item is a directory, `getStatsAndPerformCopy` will call `onDir` recursively
12472
+ await getStatsAndPerformCopy(destStat, srcItem, destItem, opts);
12473
+ }
12474
+ });
12454
12475
 
12455
12476
  if (!destStat) {
12456
12477
  await fs$b.chmod(dest, srcStat.mode);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@builderbot/provider-venom",
3
- "version": "1.3.13",
3
+ "version": "1.3.14",
4
4
  "description": "Now I’m the model of a modern major general / The venerated Virginian veteran whose men are all / Lining up, to put me up on a pedestal / Writin’ letters to relatives / Embellishin’ my elegance and eloquence / But the elephant is in the room / The truth is in ya face when ya hear the British cannons go / BOOM",
5
5
  "keywords": [],
6
6
  "author": "Leifer Mendez <leifer33@gmail.com>",
@@ -31,7 +31,7 @@
31
31
  },
32
32
  "homepage": "https://github.com/codigoencasa/bot-whatsapp#readme",
33
33
  "devDependencies": {
34
- "@builderbot/bot": "1.3.13",
34
+ "@builderbot/bot": "1.3.14",
35
35
  "@jest/globals": "^29.7.0",
36
36
  "@rollup/plugin-commonjs": "^25.0.7",
37
37
  "@rollup/plugin-json": "^6.1.0",
@@ -60,5 +60,5 @@
60
60
  "sharp": "0.33.3",
61
61
  "venom-bot": "~5.3.0"
62
62
  },
63
- "gitHead": "ac477b513ca06540ffeb6406d89555ad6f92f67f"
63
+ "gitHead": "b9bacfa917364b27d22fe7398c1219cbd28b2a22"
64
64
  }