@builderbot/provider-meta 1.3.13 → 1.3.14-alpha.148

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 +15 -15
  2. package/package.json +3 -3
package/dist/index.cjs CHANGED
@@ -11061,7 +11061,7 @@ var mimeDb = require$$0;
11061
11061
  * MIT Licensed
11062
11062
  */
11063
11063
 
11064
- (function (exports) {
11064
+ (function (exports$1) {
11065
11065
 
11066
11066
  /**
11067
11067
  * Module dependencies.
@@ -11084,16 +11084,16 @@ var mimeDb = require$$0;
11084
11084
  * @public
11085
11085
  */
11086
11086
 
11087
- exports.charset = charset;
11088
- exports.charsets = { lookup: charset };
11089
- exports.contentType = contentType;
11090
- exports.extension = extension;
11091
- exports.extensions = Object.create(null);
11092
- exports.lookup = lookup;
11093
- exports.types = Object.create(null);
11087
+ exports$1.charset = charset;
11088
+ exports$1.charsets = { lookup: charset };
11089
+ exports$1.contentType = contentType;
11090
+ exports$1.extension = extension;
11091
+ exports$1.extensions = Object.create(null);
11092
+ exports$1.lookup = lookup;
11093
+ exports$1.types = Object.create(null);
11094
11094
 
11095
11095
  // Populate the extensions/types maps
11096
- populateMaps(exports.extensions, exports.types);
11096
+ populateMaps(exports$1.extensions, exports$1.types);
11097
11097
 
11098
11098
  /**
11099
11099
  * Get the default charset for a MIME type.
@@ -11137,7 +11137,7 @@ var mimeDb = require$$0;
11137
11137
  }
11138
11138
 
11139
11139
  var mime = str.indexOf('/') === -1
11140
- ? exports.lookup(str)
11140
+ ? exports$1.lookup(str)
11141
11141
  : str;
11142
11142
 
11143
11143
  if (!mime) {
@@ -11146,7 +11146,7 @@ var mimeDb = require$$0;
11146
11146
 
11147
11147
  // TODO: use content-type or other module
11148
11148
  if (mime.indexOf('charset') === -1) {
11149
- var charset = exports.charset(mime);
11149
+ var charset = exports$1.charset(mime);
11150
11150
  if (charset) mime += '; charset=' + charset.toLowerCase();
11151
11151
  }
11152
11152
 
@@ -11169,7 +11169,7 @@ var mimeDb = require$$0;
11169
11169
  var match = EXTRACT_TYPE_REGEXP.exec(type);
11170
11170
 
11171
11171
  // get extensions
11172
- var exts = match && exports.extensions[match[1].toLowerCase()];
11172
+ var exts = match && exports$1.extensions[match[1].toLowerCase()];
11173
11173
 
11174
11174
  if (!exts || !exts.length) {
11175
11175
  return false
@@ -11199,7 +11199,7 @@ var mimeDb = require$$0;
11199
11199
  return false
11200
11200
  }
11201
11201
 
11202
- return exports.types[extension] || false
11202
+ return exports$1.types[extension] || false
11203
11203
  }
11204
11204
 
11205
11205
  /**
@@ -13005,8 +13005,8 @@ var FormData$1 = /*@__PURE__*/getDefaultExportFromCjs(form_data);
13005
13005
 
13006
13006
  var dist = {exports: {}};
13007
13007
 
13008
- (function (module, exports) {
13009
- var _events=_interopRequireDefault(require$$0$2);Object.defineProperty(exports,"__esModule",{value:true}),exports.default=void 0;function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d);}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),true).forEach(function(c){_defineProperty(a,c,b[c]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c));});return a}function _defineProperty(a,b,c){return b in a?Object.defineProperty(a,b,{value:c,enumerable:true,configurable:true,writable:true}):a[b]=c,a}const State={IDLE:0,RUNNING:1,STOPPED:2};class Queue extends _events.default{constructor(a={}){super(),_defineProperty(this,"tasks",new Map),_defineProperty(this,"uniqueId",0),_defineProperty(this,"lastRan",0),_defineProperty(this,"currentlyHandled",0),_defineProperty(this,"state",State.IDLE),_defineProperty(this,"options",{concurrent:5,interval:500,start:true}),this.options=_objectSpread(_objectSpread({},this.options),a),this.options.interval=parseInt(this.options.interval,10),this.options.concurrent=parseInt(this.options.concurrent,10);}start(){this.state===State.RUNNING||this.isEmpty||(this.state=State.RUNNING,this.emit("start"),(async()=>{for(;this.shouldRun;)await this.dequeue();})());}stop(){clearTimeout(this.timeoutId),this.state=State.STOPPED,this.emit("stop");}finalize(){this.currentlyHandled-=1,0===this.currentlyHandled&&this.isEmpty&&(this.stop(),this.state=State.IDLE,this.emit("end"));}async execute(){const a=[];this.tasks.forEach((b,c)=>{this.currentlyHandled<this.options.concurrent&&(this.currentlyHandled++,this.tasks.delete(c),a.push(Promise.resolve(b()).then(a=>(this.emit("resolve",a),a)).catch(a=>(this.emit("reject",a),a)).finally(()=>{this.emit("dequeue"),this.finalize();})));});const b=await Promise.all(a);return 1===this.options.concurrent?b[0]:b}dequeue(){const{interval:a}=this.options;return new Promise(b=>{const c=Math.max(0,a-(Date.now()-this.lastRan));clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.lastRan=Date.now(),this.execute().then(b);},c);})}enqueue(a){if(Array.isArray(a))return void a.map(a=>this.enqueue(a));if("function"!=typeof a)throw new Error(`You must provide a function, not ${typeof a}.`);this.uniqueId=(this.uniqueId+1)%Number.MAX_SAFE_INTEGER,this.tasks.set(this.uniqueId,a),this.options.start&&this.state!==State.STOPPED&&this.start();}add(a){this.enqueue(a);}clear(){this.tasks.clear();}get size(){return this.tasks.size}get isEmpty(){return 0===this.size}get shouldRun(){return !this.isEmpty&&this.state!==State.STOPPED}}exports.default=Queue,module.exports=exports.default;
13008
+ (function (module, exports$1) {
13009
+ var _events=_interopRequireDefault(require$$0$2);Object.defineProperty(exports$1,"__esModule",{value:true}),exports$1.default=void 0;function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d);}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),true).forEach(function(c){_defineProperty(a,c,b[c]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c));});return a}function _defineProperty(a,b,c){return b in a?Object.defineProperty(a,b,{value:c,enumerable:true,configurable:true,writable:true}):a[b]=c,a}const State={IDLE:0,RUNNING:1,STOPPED:2};class Queue extends _events.default{constructor(a={}){super(),_defineProperty(this,"tasks",new Map),_defineProperty(this,"uniqueId",0),_defineProperty(this,"lastRan",0),_defineProperty(this,"currentlyHandled",0),_defineProperty(this,"state",State.IDLE),_defineProperty(this,"options",{concurrent:5,interval:500,start:true}),this.options=_objectSpread(_objectSpread({},this.options),a),this.options.interval=parseInt(this.options.interval,10),this.options.concurrent=parseInt(this.options.concurrent,10);}start(){this.state===State.RUNNING||this.isEmpty||(this.state=State.RUNNING,this.emit("start"),(async()=>{for(;this.shouldRun;)await this.dequeue();})());}stop(){clearTimeout(this.timeoutId),this.state=State.STOPPED,this.emit("stop");}finalize(){this.currentlyHandled-=1,0===this.currentlyHandled&&this.isEmpty&&(this.stop(),this.state=State.IDLE,this.emit("end"));}async execute(){const a=[];this.tasks.forEach((b,c)=>{this.currentlyHandled<this.options.concurrent&&(this.currentlyHandled++,this.tasks.delete(c),a.push(Promise.resolve(b()).then(a=>(this.emit("resolve",a),a)).catch(a=>(this.emit("reject",a),a)).finally(()=>{this.emit("dequeue"),this.finalize();})));});const b=await Promise.all(a);return 1===this.options.concurrent?b[0]:b}dequeue(){const{interval:a}=this.options;return new Promise(b=>{const c=Math.max(0,a-(Date.now()-this.lastRan));clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.lastRan=Date.now(),this.execute().then(b);},c);})}enqueue(a){if(Array.isArray(a))return void a.map(a=>this.enqueue(a));if("function"!=typeof a)throw new Error(`You must provide a function, not ${typeof a}.`);this.uniqueId=(this.uniqueId+1)%Number.MAX_SAFE_INTEGER,this.tasks.set(this.uniqueId,a),this.options.start&&this.state!==State.STOPPED&&this.start();}add(a){this.enqueue(a);}clear(){this.tasks.clear();}get size(){return this.tasks.size}get isEmpty(){return 0===this.size}get shouldRun(){return !this.isEmpty&&this.state!==State.STOPPED}}exports$1.default=Queue,module.exports=exports$1.default;
13010
13010
  } (dist, dist.exports));
13011
13011
 
13012
13012
  var distExports = dist.exports;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@builderbot/provider-meta",
3
- "version": "1.3.13",
3
+ "version": "1.3.14-alpha.148",
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.13",
41
+ "@builderbot/bot": "1.3.14-alpha.148",
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": "ac477b513ca06540ffeb6406d89555ad6f92f67f"
64
+ "gitHead": "b19327254ea841420d7487c96cf5dadd054ea65c"
65
65
  }