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