Socket
Socket
Sign inDemoInstall

storage-based-queue

Package Overview
Dependencies
8
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.2.4 to 1.2.5

.npmignore

68

CHANGES.md

@@ -5,42 +5,58 @@ # Release Notes:

* Async support added to many processes.
* All test cases has been re-writen for async calls.
* Localforage library added to dependencies for will support the three type (localstorage, indexeddb, websql) storages.
* In memory database adapter added.
* Channel logic moved to Channel class from queue class.
* Worker registration way has been changed slightly.
* Worker dependencies management moved to another method.
* Plugin infrastructure added. After which different storage modules can be used (AsyncStorage (React Native) supported from now).
* ESLint integrated.
* Network activities check removed. This control left to developer because there is different development environments (Browser, React Native etc.).
* Added new `merge()` method to container class for some configuration objects to be merge.
* debug npm package removed from dependencies.
- Async support added to many processes.
- All test cases has been re-writen for async calls.
- Localforage library added to dependencies for will support the three type (localstorage, indexeddb, websql) storages.
- In memory database adapter added.
- Channel logic moved to Channel class from queue class.
- Worker registration way has been changed slightly.
- Worker dependencies management moved to another method.
- Plugin infrastructure added. After which different storage modules can be used (AsyncStorage (React Native) supported from now).
- ESLint integrated.
- Network activities check removed. This control left to developer because there is different development environments (Browser, React Native etc.).
- Added new `merge()` method to container class for some configuration objects to be merge.
- debug npm package removed from dependencies.
## Changes for v1.0.1:
* Container class removed from channel class and the workers were taken directly from the Queue class.
* Emojis replaced with ascii characters in console.
* Console outputs improved.
- Container class removed from channel class and the workers were taken directly from the Queue class.
- Emojis replaced with ascii characters in console.
- Console outputs improved.
## Changes for v1.0.2:
* Removed old tests
- Removed old tests
## Changes for v1.1.1:
* Some unused declarations has been deleted [(#80e26ee)](https://github.com/atayahmet/storage-based-queue/commit/80e26ee)
* Flowtype interfaces folder moved to src folder. [(#e1630c8)](https://github.com/atayahmet/storage-based-queue/commit/e1630c8)
* InMemory adapter default storage was made.
* Removed LocalForage library from dependencies. Just supported the `localstorage` and `inmemory` storage. [(#5694a6e)](https://github.com/atayahmet/storage-based-queue/commit/5694a6e)
* Status method added to channel class for check if channel working. [(#38f4e92)](https://github.com/atayahmet/storage-based-queue/commit/38f4e92)
- Some unused declarations has been deleted [(#80e26ee)](https://github.com/atayahmet/storage-based-queue/commit/80e26ee)
- Flowtype interfaces folder moved to src folder. [(#e1630c8)](https://github.com/atayahmet/storage-based-queue/commit/e1630c8)
- InMemory adapter default storage was made.
- Removed LocalForage library from dependencies. Just supported the `localstorage` and `inmemory` storage. [(#5694a6e)](https://github.com/atayahmet/storage-based-queue/commit/5694a6e)
- Status method added to channel class for check if channel working. [(#38f4e92)](https://github.com/atayahmet/storage-based-queue/commit/38f4e92)
## Changes for v1.2.0:
* Added native browser worker support. (with polyfill) [(#bce43fa)](https://github.com/atayahmet/storage-based-queue/commit/bce43fa)
- Added native browser worker support. (with polyfill) [(#bce43fa)](https://github.com/atayahmet/storage-based-queue/commit/bce43fa)
## Changes for v1.2.1:
* `"job not found"` message color changed [(#350c978)](https://github.com/atayahmet/storage-based-queue/commit/350c978)
* index.js file added to adapters folder [(#13f2efa)](https://github.com/atayahmet/storage-based-queue/commit/13f2efa)
* .babelrc deleted for avoid "Unknown plugin "transform-runtime" error.
* Main file path in package.json has been changed as `lib/index.js`.
- `"job not found"` message color changed [(#350c978)](https://github.com/atayahmet/storage-based-queue/commit/350c978)
- index.js file added to adapters folder [(#13f2efa)](https://github.com/atayahmet/storage-based-queue/commit/13f2efa)
- .babelrc deleted for avoid "Unknown plugin "transform-runtime" error.
- Main file path in package.json has been changed as `lib/index.js`.
## Changes for v1.2.2:
- Version upgraded for npm publish.
## Changes for v1.2.3:
- Version upgraded for npm publish.
## Changes for v1.2.4:
- dev environment fix [(#822851c)](https://github.com/atayahmet/storage-based-queue/commit/822851c)
## Changes for v1.2.5:
- Bug fix: status() method at channel class.

@@ -1,1 +0,1 @@

!function i(a,u,c){function s(t,e){if(!u[t]){if(!a[t]){var r="function"==typeof require&&require;if(!e&&r)return r(t,!0);if(f)return f(t,!0);var n=new Error("Cannot find module '"+t+"'");throw n.code="MODULE_NOT_FOUND",n}var o=u[t]={exports:{}};a[t][0].call(o.exports,function(e){return s(a[t][1][e]||e)},o,o.exports,i,a,u,c)}return u[t].exports}for(var f="function"==typeof require&&require,e=0;e<c.length;e++)s(c[e]);return s}({1:[function(e,t,r){t.exports=e("regenerator-runtime")},{"regenerator-runtime":7}],2:[function(e,t,r){var a=/\b(Array|Date|Object|Math|JSON)\b/g;t.exports=function(e,t){var r,n,o,i=function(e){for(var t=[],r=0;r<e.length;r++)~t.indexOf(e[r])||t.push(e[r]);return t}(e.replace(/\.\w+|\w+ *\(|"[^"]*"|'[^']*'|\/([^/]+)\//g,"").replace(a,"").match(/[a-zA-Z_]\w*/g)||[]);return t&&"string"==typeof t&&(r=t,t=function(e){return r+e}),t?(n=i,o=t,e.replace(/\.\w+|\w+ *\(|"[^"]*"|'[^']*'|\/([^/]+)\/|[a-zA-Z_]\w*/g,function(e){return"("==e[e.length-1]?o(e):~n.indexOf(e)?o(e):e})):i}},{}],3:[function(e,t,r){var i=e("to-function");t.exports=function(e,t){var r,n={};t=i(t);for(var o=0;o<e.length;++o)n[r=t(e[o],o)]=n[r]||[],n[r].push(e[o]);return n}},{"to-function":9}],4:[function(e,r,t){!function(e,t){"use strict";"object"==typeof r&&"object"==typeof r.exports?r.exports=t():"function"==typeof define&&define.amd?define([],t):e.objectPath=t()}(this,function(){"use strict";var t=Object.prototype.toString;function i(e,t){return null!=e&&Object.prototype.hasOwnProperty.call(e,t)}function f(e){if(!e)return!0;if(p(e)&&0===e.length)return!0;if("string"!=typeof e){for(var t in e)if(i(e,t))return!1;return!0}return!1}function l(e){return t.call(e)}var p=Array.isArray||function(e){return"[object Array]"===t.call(e)};function h(e){var t=parseInt(e);return t.toString()===e?t:e}function e(o){o=o||{};var a=function(r){return Object.keys(a).reduce(function(e,t){return"create"===t||"function"==typeof a[t]&&(e[t]=a[t].bind(a,r)),e},{})};function u(e,t){return o.includeInheritedProps||"number"==typeof t&&Array.isArray(e)||i(e,t)}function c(e,t){if(u(e,t))return e[t]}function s(e,t,r,n){if("number"==typeof t&&(t=[t]),!t||0===t.length)return e;if("string"==typeof t)return s(e,t.split(".").map(h),r,n);var o=t[0],i=c(e,o);return 1===t.length?(void 0!==i&&n||(e[o]=r),i):(void 0===i&&("number"==typeof t[1]?e[o]=[]:e[o]={}),s(e[o],t.slice(1),r,n))}return a.has=function(e,t){if("number"==typeof t?t=[t]:"string"==typeof t&&(t=t.split(".")),!t||0===t.length)return!!e;for(var r=0;r<t.length;r++){var n=h(t[r]);if(!("number"==typeof n&&p(e)&&n<e.length||(o.includeInheritedProps?n in Object(e):i(e,n))))return!1;e=e[n]}return!0},a.ensureExists=function(e,t,r){return s(e,t,r,!0)},a.set=function(e,t,r,n){return s(e,t,r,n)},a.insert=function(e,t,r,n){var o=a.get(e,t);n=~~n,p(o)||(o=[],a.set(e,t,o)),o.splice(n,0,r)},a.empty=function(e,t){var r,n;if(!f(t)&&(null!=e&&(r=a.get(e,t)))){if("string"==typeof r)return a.set(e,t,"");if("boolean"==typeof(i=r)||"[object Boolean]"===l(i))return a.set(e,t,!1);if("number"==typeof r)return a.set(e,t,0);if(p(r))r.length=0;else{if("object"!=typeof(o=r)||"[object Object]"!==l(o))return a.set(e,t,null);for(n in r)u(r,n)&&delete r[n]}var o,i}},a.push=function(e,t){var r=a.get(e,t);p(r)||(r=[],a.set(e,t,r)),r.push.apply(r,Array.prototype.slice.call(arguments,2))},a.coalesce=function(e,t,r){for(var n,o=0,i=t.length;o<i;o++)if(void 0!==(n=a.get(e,t[o])))return n;return r},a.get=function(e,t,r){if("number"==typeof t&&(t=[t]),!t||0===t.length)return e;if(null==e)return r;if("string"==typeof t)return a.get(e,t.split("."),r);var n=h(t[0]),o=c(e,n);return void 0===o?r:1===t.length?o:a.get(e[n],t.slice(1),r)},a.del=function(e,t){if("number"==typeof t&&(t=[t]),null==e)return e;if(f(t))return e;if("string"==typeof t)return a.del(e,t.split("."));var r=h(t[0]);return u(e,r)?1!==t.length?a.del(e[r],t.slice(1)):(p(e)?e.splice(r,1):delete e[r],e):e},a}var r=e();return r.create=e,r.withInheritedProps=e({includeInheritedProps:!0}),r})},{}],5:[function(require,module,exports){(function(global){"use strict";function doEval(self,__pseudoworker_script){(function(){eval(__pseudoworker_script)}).call(global)}function PseudoWorker(r){var n,o,i=[],a=[],u=[],c=[],s=[],t=!1,f=this;function l(e,t){for(var r=-1;++r<e.length;)e[r]&&t(e[r])}function p(e){var t,r=(t=e,function(e){e({type:"error",error:t,message:t.message})});"function"==typeof f.onerror&&r(f.onerror),o&&"function"==typeof o.onerror&&r(o.onerror),l(a,r),l(c,r)}function h(t){function e(e){try{e({data:t})}catch(e){p(e)}}o&&"function"==typeof o.onmessage&&e(o.onmessage),l(u,e)}function d(t){function e(e){e({data:t})}"function"==typeof f.onmessage&&e(f.onmessage),l(i,e)}function y(e,t){"message"===e?u.push(t):"error"===e&&c.push(t)}var v=new XMLHttpRequest;return v.open("GET",r),v.onreadystatechange=function(){if(4===v.readyState)if(200<=v.status&&v.status<400){n=v.responseText,doEval(o={postMessage:d,addEventListener:y},n);var e=s;s=[];for(var t=0;t<e.length;t++)h(e[t])}else p(new Error("cannot find script "+r))},v.send(),f.postMessage=function(e){if(void 0===e)throw new Error("postMessage() requires an argument");t||(n?h(e):s.push(e))},f.addEventListener=function(e,t){"message"===e?i.push(t):"error"===e&&a.push(t)},f.removeEventListener=function(e,t){var r;if("message"===e)r=i;else{if("error"!==e)return;r=a}for(var n=-1;++n<r.length;)if(r[n]===t){delete r[n];break}},f.terminate=function(){t=!0},f}module.exports=PseudoWorker}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],6:[function(r,n,e){(function(e){"use strict";var t=r("./");"undefined"==typeof Worker&&(e.Worker=t),n.exports=t}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./":5}],7:[function(e,t,r){var n=function(){return this}()||Function("return this")(),o=n.regeneratorRuntime&&0<=Object.getOwnPropertyNames(n).indexOf("regeneratorRuntime"),i=o&&n.regeneratorRuntime;if(n.regeneratorRuntime=void 0,t.exports=e("./runtime"),o)n.regeneratorRuntime=i;else try{delete n.regeneratorRuntime}catch(e){n.regeneratorRuntime=void 0}},{"./runtime":8}],8:[function(e,C,t){!function(e){"use strict";var c,t=Object.prototype,s=t.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},o=r.iterator||"@@iterator",n=r.asyncIterator||"@@asyncIterator",i=r.toStringTag||"@@toStringTag",a="object"==typeof C,u=e.regeneratorRuntime;if(u)a&&(C.exports=u);else{(u=e.regeneratorRuntime=a?C.exports:{}).wrap=m;var l="suspendedStart",p="suspendedYield",h="executing",d="completed",y={},f={};f[o]=function(){return this};var v=Object.getPrototypeOf,g=v&&v(v(E([])));g&&g!==t&&s.call(g,o)&&(f=g);var b=_.prototype=x.prototype=Object.create(f);k.prototype=b.constructor=_,_.constructor=k,_[i]=k.displayName="GeneratorFunction",u.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===k||"GeneratorFunction"===(t.displayName||t.name))},u.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,_):(e.__proto__=_,i in e||(e[i]="GeneratorFunction")),e.prototype=Object.create(b),e},u.awrap=function(e){return{__await:e}},O(j.prototype),j.prototype[n]=function(){return this},u.AsyncIterator=j,u.async=function(e,t,r,n){var o=new j(m(e,t,r,n));return u.isGeneratorFunction(t)?o:o.next().then(function(e){return e.done?e.value:o.next()})},O(b),b[i]="Generator",b[o]=function(){return this},b.toString=function(){return"[object Generator]"},u.keys=function(r){var n=[];for(var e in r)n.push(e);return n.reverse(),function e(){for(;n.length;){var t=n.pop();if(t in r)return e.value=t,e.done=!1,e}return e.done=!0,e}},u.values=E,L.prototype={constructor:L,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=c,this.done=!1,this.delegate=null,this.method="next",this.arg=c,this.tryEntries.forEach(T),!e)for(var t in this)"t"===t.charAt(0)&&s.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=c)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var n=this;function e(e,t){return i.type="throw",i.arg=r,n.next=e,t&&(n.method="next",n.arg=c),!!t}for(var t=this.tryEntries.length-1;0<=t;--t){var o=this.tryEntries[t],i=o.completion;if("root"===o.tryLoc)return e("end");if(o.tryLoc<=this.prev){var a=s.call(o,"catchLoc"),u=s.call(o,"finallyLoc");if(a&&u){if(this.prev<o.catchLoc)return e(o.catchLoc,!0);if(this.prev<o.finallyLoc)return e(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return e(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return e(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;0<=r;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&s.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),T(r),y}},catch:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;T(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:E(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=c),y}}}function m(e,t,r,n){var i,a,u,c,o=t&&t.prototype instanceof x?t:x,s=Object.create(o.prototype),f=new L(n||[]);return s._invoke=(i=e,a=r,u=f,c=l,function(e,t){if(c===h)throw new Error("Generator is already running");if(c===d){if("throw"===e)throw t;return A()}for(u.method=e,u.arg=t;;){var r=u.delegate;if(r){var n=P(r,u);if(n){if(n===y)continue;return n}}if("next"===u.method)u.sent=u._sent=u.arg;else if("throw"===u.method){if(c===l)throw c=d,u.arg;u.dispatchException(u.arg)}else"return"===u.method&&u.abrupt("return",u.arg);c=h;var o=w(i,a,u);if("normal"===o.type){if(c=u.done?d:p,o.arg===y)continue;return{value:o.arg,done:u.done}}"throw"===o.type&&(c=d,u.method="throw",u.arg=o.arg)}}),s}function w(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}function x(){}function k(){}function _(){}function O(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function j(c){var t;this._invoke=function(r,n){function e(){return new Promise(function(e,t){!function t(e,r,n,o){var i=w(c[e],c,r);if("throw"!==i.type){var a=i.arg,u=a.value;return u&&"object"==typeof u&&s.call(u,"__await")?Promise.resolve(u.__await).then(function(e){t("next",e,n,o)},function(e){t("throw",e,n,o)}):Promise.resolve(u).then(function(e){a.value=e,n(a)},o)}o(i.arg)}(r,n,e,t)})}return t=t?t.then(e,e):e()}}function P(e,t){var r=e.iterator[t.method];if(r===c){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=c,P(e,t),"throw"===t.method))return y;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return y}var n=w(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,y;var o=n.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=c),t.delegate=null,y):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,y)}function S(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function T(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function E(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,n=function e(){for(;++r<t.length;)if(s.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=c,e.done=!0,e};return n.next=n}}return{next:A}}function A(){return{value:c,done:!0}}}(function(){return this}()||Function("return this")())},{}],9:[function(t,e,r){var i;try{i=t("props")}catch(e){i=t("component-props")}function n(e){switch({}.toString.call(e)){case"[object Object]":return function(e){var r={};for(var t in e)r[t]="string"==typeof e[t]?o(e[t]):n(e[t]);return function(e){if("object"!=typeof e)return!1;for(var t in r){if(!(t in e))return!1;if(!r[t](e[t]))return!1}return!0}}(e);case"[object Function]":return e;case"[object String]":return/^ *\W+/.test(r=e)?new Function("_","return _ "+r):new Function("_","return "+function(e){var t,r,n,o=i(e);if(!o.length)return"_."+e;for(r=0;r<o.length;r++)n=o[r],e=a(n,e,t="('function' == typeof "+(t="_."+n)+" ? "+t+"() : "+t+")");return e}(r));case"[object RegExp]":return t=e,function(e){return t.test(e)};default:return o(e)}var t,r}function o(t){return function(e){return t===e}}function a(e,t,r){return t.replace(new RegExp("(\\.)?"+e,"g"),function(e,t){return t?e:r})}e.exports=n},{"component-props":2,props:2}],10:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.LocalStorageAdapter=r.InMemoryAdapter=void 0;var n=i(e("./inmemory")),o=i(e("./localstorage"));function i(e){return e&&e.__esModule?e:{default:e}}r.InMemoryAdapter=n.default,r.LocalStorageAdapter=o.default},{"./inmemory":11,"./localstorage":12}],11:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n,o=e("babel-runtime/regenerator"),a=(n=o)&&n.__esModule?n:{default:n},u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},c=function(){function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}}();function s(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}function f(e){return function(){var u=e.apply(this,arguments);return new Promise(function(i,a){return function t(e,r){try{var n=u[e](r),o=n.value}catch(e){return void a(e)}if(!n.done)return Promise.resolve(o).then(function(e){t("next",e)},function(e){t("throw",e)});i(o)}("next")})}}var i=function(){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),this.store={},this.config=e,this.prefix=this.config.get("prefix")}var r,n,o,i;return c(t,[{key:"get",value:(i=f(a.default.mark(function e(t){var r;return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=this.storageName(t),e.abrupt("return",[].concat(s(this.getCollection(r))));case 2:case"end":return e.stop()}},e,this)})),function(e){return i.apply(this,arguments)})},{key:"set",value:(o=f(a.default.mark(function e(t,r){return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.store[this.storageName(t)]=[].concat(s(r)),e.abrupt("return",r);case 2:case"end":return e.stop()}},e,this)})),function(e,t){return o.apply(this,arguments)})},{key:"has",value:(n=f(a.default.mark(function e(t){return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Object.prototype.hasOwnProperty.call(this.store,this.storageName(t)));case 1:case"end":return e.stop()}},e,this)})),function(e){return n.apply(this,arguments)})},{key:"clear",value:(r=f(a.default.mark(function e(t){var r;return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.has(t);case 2:if(!e.sent){e.next=6;break}e.t0=delete this.store[this.storageName(t)],e.next=7;break;case 6:e.t0=!1;case 7:return r=e.t0,this.store=u({},this.store),e.abrupt("return",r);case 10:case"end":return e.stop()}},e,this)})),function(e){return r.apply(this,arguments)})},{key:"storageName",value:function(e){return e.startsWith(this.getPrefix())?e:this.getPrefix()+"_"+e}},{key:"getPrefix",value:function(){return this.config.get("prefix")}},{key:"getCollection",value:function(e){return Object.prototype.hasOwnProperty.call(this.store,e)||(this.store[e]=[]),this.store[e]}}]),t}();r.default=i},{"babel-runtime/regenerator":1}],12:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n,o=e("babel-runtime/regenerator"),a=(n=o)&&n.__esModule?n:{default:n},u=function(){function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}}();function c(e){return function(){var u=e.apply(this,arguments);return new Promise(function(i,a){return function t(e,r){try{var n=u[e](r),o=n.value}catch(e){return void a(e)}if(!n.done)return Promise.resolve(o).then(function(e){t("next",e)},function(e){t("throw",e)});i(o)}("next")})}}var i=function(){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),this.config=e,this.prefix=this.config.get("prefix")}var r,n,o,i;return u(t,[{key:"get",value:(i=c(a.default.mark(function e(t){var r;return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=localStorage.getItem(this.storageName(t)),e.abrupt("return",JSON.parse(r)||[]);case 2:case"end":return e.stop()}},e,this)})),function(e){return i.apply(this,arguments)})},{key:"set",value:(o=c(a.default.mark(function e(t,r){return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return localStorage.setItem(this.storageName(t),JSON.stringify(r)),e.abrupt("return",r);case 2:case"end":return e.stop()}},e,this)})),function(e,t){return o.apply(this,arguments)})},{key:"has",value:(n=c(a.default.mark(function e(t){return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Object.prototype.hasOwnProperty.call(localStorage,this.storageName(t)));case 1:case"end":return e.stop()}},e,this)})),function(e){return n.apply(this,arguments)})},{key:"clear",value:(r=c(a.default.mark(function e(t){var r;return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.has(t);case 2:if(!e.sent){e.next=6;break}e.t0=delete localStorage[this.storageName(t)],e.next=7;break;case 6:e.t0=!1;case 7:return r=e.t0,e.abrupt("return",r);case 9:case"end":return e.stop()}},e,this)})),function(e){return r.apply(this,arguments)})},{key:"storageName",value:function(e){return e.startsWith(this.getPrefix())?e:this.getPrefix()+"_"+e}},{key:"getPrefix",value:function(){return this.config.get("prefix")}}]),t}();r.default=i},{"babel-runtime/regenerator":1}],13:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var l=n(e("babel-runtime/regenerator")),p=function(){function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}}(),h=n(e("./event")),d=n(e("./storage-capsule")),y=n(e("./queue")),v=e("./utils"),g=e("./helpers"),b=e("./console");function n(e){return e&&e.__esModule?e:{default:e}}function m(e){return function(){var u=e.apply(this,arguments);return new Promise(function(i,a){return function t(e,r){try{var n=u[e](r),o=n.value}catch(e){return void a(e)}if(!n.done)return Promise.resolve(o).then(function(e){t("next",e)},function(e){t("throw",e)});i(o)}("next")})}}var w=Symbol("channel-name"),o=function(){function o(e,t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,o),this.stopped=!0,this.running=!1,this.event=new h.default,this.config=t,this[w]=e;var r=y.default.drivers,n=new d.default(t,r.storage);this.storage=n.channel(e)}var t,r,n,e,i,a,u,c,s,f;return p(o,[{key:"name",value:function(){return this[w]}},{key:"add",value:(f=m(l.default.mark(function e(t){var r;return l.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,g.canMultiple.call(this,t);case 2:if(e.sent){e.next=4;break}return e.abrupt("return",!1);case 4:return e.next=6,g.saveTask.call(this,t);case 6:if(!(r=e.sent)||!this.stopped||!0!==this.running){e.next=10;break}return e.next=10,this.start();case 10:return g.logProxy.call(this,b.taskAddedLog,t),e.abrupt("return",r);case 12:case"end":return e.stop()}},e,this)})),function(e){return f.apply(this,arguments)})},{key:"next",value:(s=m(l.default.mark(function e(){return l.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.stopped){e.next=3;break}return g.statusOff.call(this),e.abrupt("return",g.stopQueue.call(this));case 3:return g.logProxy.call(this,b.nextTaskLog,"next"),e.next=6,this.start();case 6:return e.abrupt("return",!0);case 7:case"end":return e.stop()}},e,this)})),function(){return s.apply(this,arguments)})},{key:"start",value:(c=m(l.default.mark(function e(){return l.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.stopped=!1,g.logProxy.call(this,b.queueStartLog,"start"),e.next=4,g.createTimeout.call(this);case 4:return e.t0=e.sent,this.running=0<e.t0,e.abrupt("return",this.running);case 7:case"end":return e.stop()}},e,this)})),function(){return c.apply(this,arguments)})},{key:"stop",value:function(){g.logProxy.call(this,b.queueStoppingLog,"stop"),this.stopped=!0}},{key:"forceStop",value:function(){g.stopQueue.call(this)}},{key:"status",value:function(){return this.running}},{key:"isEmpty",value:(u=m(l.default.mark(function e(){return l.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.count();case 2:return e.t0=e.sent,e.abrupt("return",e.t0<1);case 4:case"end":return e.stop()}},e,this)})),function(){return u.apply(this,arguments)})},{key:"count",value:(a=m(l.default.mark(function e(){return l.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,g.getTasksWithoutFreezed.call(this);case 2:return e.abrupt("return",e.sent.length);case 3:case"end":return e.stop()}},e,this)})),function(){return a.apply(this,arguments)})},{key:"countByTag",value:(i=m(l.default.mark(function e(t){return l.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,g.getTasksWithoutFreezed.call(this);case 2:return e.t0=function(e){return e.tag===t},e.abrupt("return",e.sent.filter(e.t0).length);case 4:case"end":return e.stop()}},e,this)})),function(e){return i.apply(this,arguments)})},{key:"clear",value:(e=m(l.default.mark(function e(){return l.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.name()){e.next=2;break}return e.abrupt("return",!1);case 2:return e.next=4,this.storage.clear(this.name());case 4:return e.abrupt("return",!0);case 5:case"end":return e.stop()}},e,this)})),function(){return e.apply(this,arguments)})},{key:"clearByTag",value:(n=m(l.default.mark(function e(t){var n,r,o,i=this;return l.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=this,e.next=3,g.db.call(n).all();case 3:return r=e.sent,o=r.filter(v.utilClearByTag.bind(t)).map(function(){var t=m(l.default.mark(function e(t){var r;return l.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,g.db.call(n).delete(t._id);case 2:return r=e.sent,e.abrupt("return",r);case 4:case"end":return e.stop()}},e,i)}));return function(e){return t.apply(this,arguments)}}()),e.next=7,Promise.all(o);case 7:case"end":return e.stop()}},e,this)})),function(e){return n.apply(this,arguments)})},{key:"has",value:(r=m(l.default.mark(function e(t){return l.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,g.getTasksWithoutFreezed.call(this);case 2:return e.t0=function(e){return e._id===t},e.t1=e.sent.findIndex(e.t0),e.t2=-1,e.abrupt("return",e.t1>e.t2);case 6:case"end":return e.stop()}},e,this)})),function(e){return r.apply(this,arguments)})},{key:"hasByTag",value:(t=m(l.default.mark(function e(t){return l.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,g.getTasksWithoutFreezed.call(this);case 2:return e.t0=function(e){return e.tag===t},e.t1=e.sent.findIndex(e.t0),e.t2=-1,e.abrupt("return",e.t1>e.t2);case 6:case"end":return e.stop()}},e,this)})),function(e){return t.apply(this,arguments)})},{key:"on",value:function(e,t){var r;(r=this.event).on.apply(r,[e,t]),g.logProxy.call(this,b.eventCreatedLog,e)}}]),o}();r.default=o},{"./console":15,"./event":19,"./helpers":20,"./queue":22,"./storage-capsule":23,"./utils":24,"babel-runtime/regenerator":1}],14:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n,o=function(){function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}}(),i=e("./enum/config.data"),a=(n=i)&&n.__esModule?n:{default:n};var u=function(){function t(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),this.config=a.default,this.merge(e)}return o(t,[{key:"set",value:function(e,t){this.config[e]=t}},{key:"get",value:function(e){return this.config[e]}},{key:"has",value:function(e){return Object.prototype.hasOwnProperty.call(this.config,e)}},{key:"merge",value:function(e){this.config=Object.assign({},this.config,e)}},{key:"remove",value:function(e){return delete this.config[e]}},{key:"all",value:function(){return this.config}}]),t}();r.default=u},{"./enum/config.data":17}],15:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var u=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,o=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(n=(a=u.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(e){o=!0,i=e}finally{try{!n&&u.return&&u.return()}finally{if(o)throw i}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")};r.log=c,r.taskAddedLog=function(e){var t=u(e,1)[0];c("%c"+String.fromCharCode(43)+" ("+t.handler+") -> "+o.default.get(i.default,"queue.created"),"color: green;font-weight: bold;")},r.queueStartLog=function(e){var t=u(e,1)[0];c("%c"+String.fromCharCode(8211)+" ("+t+") -> "+o.default.get(i.default,"queue.starting"),"color: #3fa5f3;font-weight: bold;")},r.nextTaskLog=function(e){var t=u(e,1)[0];c("%c"+String.fromCharCode(187)+" ("+t+") -> "+o.default.get(i.default,"queue.next"),"color: #3fa5f3;font-weight: bold;")},r.queueStoppingLog=function(e){var t=u(e,1)[0];c("%c"+String.fromCharCode(8226)+" ("+t+") -> "+o.default.get(i.default,"queue.stopping"),"color: #ff7f94;font-weight: bold;")},r.queueStoppedLog=function(e){var t=u(e,1)[0];c("%c"+String.fromCharCode(8226)+" ("+t+") -> "+o.default.get(i.default,"queue.stopped"),"color: #ff7f94;font-weight: bold;")},r.queueEmptyLog=function(e){c("%c"+u(e,1)[0]+" "+o.default.get(i.default,"queue.empty"),"color: #ff7f94;font-weight: bold;")},r.eventCreatedLog=function(e){c("%c("+u(e,1)[0]+") -> "+o.default.get(i.default,"event.created"),"color: #66cee3;font-weight: bold;")},r.eventFiredLog=function(e){var t=u(e,2),r=t[0],n=t[1];c("%c("+r+") -> "+o.default.get(i.default,"event."+n),"color: #a0dc3c;font-weight: bold;")},r.notFoundLog=function(e){var t=u(e,1)[0];c("%c"+String.fromCharCode(215)+" ("+t+") -> "+o.default.get(i.default,"queue.not-found"),"color: #b92e2e;font-weight: bold;")},r.workerRunninLog=function(e){var t=u(e,5),r=t[0],n=t[1],o=t[2],i=t[3],a=t[4];console.groupCollapsed((r.name||o.handler)+" - "+o.label),c("%cchannel: "+i,"color: blue;"),c("%clabel: "+(o.label||""),"color: blue;"),c("%chandler: "+o.handler,"color: blue;"),c("%cpriority: "+o.priority,"color: blue;"),c("%cunique: "+(o.unique||"false"),"color: blue;"),c("%cretry: "+(n.retry||"1"),"color: blue;"),c("%ctried: "+(o.tried?o.tried+1:"1"),"color: blue;"),c("%ctag: "+(o.tag||""),"color: blue;"),c("%cargs:","color: blue;"),c(o.args||""),console.groupCollapsed("dependencies"),c.apply(void 0,function(e){{if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}}(a[r.name]||[])),console.groupEnd()},r.workerDoneLog=function(e){var t=u(e,3),r=t[0],n=t[1],o=t[2];!0===r?c("%c"+String.fromCharCode(10003)+" Task completed!","color: green;"):!r&&n.tried<o.retry?c("%cTask will be retried!","color: #d8410c;"):c("%c"+String.fromCharCode(10005)+" Task failed and freezed!","color: #ef6363;");console.groupEnd()},r.workerFailedLog=function(){c("%c"+String.fromCharCode(10005)+" Task failed!","color: red;"),console.groupEnd()};var o=n(e("object-path")),i=n(e("./enum/log.events"));function n(e){return e&&e.__esModule?e:{default:e}}function c(){var e;(e=console).log.apply(e,arguments)}},{"./enum/log.events":18,"object-path":4}],16:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}}();var o=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.store={}}return n(e,[{key:"has",value:function(e){return Object.prototype.hasOwnProperty.call(this.store,e)}},{key:"get",value:function(e){return this.store[e]}},{key:"all",value:function(){return this.store}},{key:"bind",value:function(e,t){this.store[e]=t}},{key:"merge",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};this.store=Object.assign({},this.store,e)}},{key:"remove",value:function(e){return!!this.has(e)&&delete this.store[e]}},{key:"removeAll",value:function(){this.store={}}}]),e}();r.default=o},{}],17:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default={defaultStorage:"localstorage",prefix:"sq_jobs",timeout:1e3,limit:-1,principle:"fifo",debug:!0}},{}],18:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default={queue:{created:"New task created.",next:"Next task processing.",starting:"Queue listener starting.",stopping:"Queue listener stopping.",stopped:"Queue listener stopped.",empty:"channel is empty...","not-found":"worker not found",offline:"Disconnected",online:"Connected"},event:{created:"New event created",fired:"Event fired.","wildcard-fired":"Wildcard event fired."}}},{}],19:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}}();var o=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.store={},this.verifierPattern=/^[a-z0-9-_]+:before$|after$|retry$|\*$/,this.wildcards=["*","error"],this.emptyFunc=function(){},this.store.before={},this.store.after={},this.store.retry={},this.store.wildcard={},this.store.error=this.emptyFunc,this.store["*"]=this.emptyFunc}return n(e,[{key:"on",value:function(e,t){if("function"!=typeof t)throw new Error("Event should be an function");this.isValid(e)&&this.add(e,t)}},{key:"emit",value:function(e,t){if(-1<this.wildcards.indexOf(e))this.wildcard.apply(this,[e].concat([e,t]));else{var r=this.getType(e),n=this.getName(e);if(this.store[r])(this.store[r][n]||this.emptyFunc).call(null,t)}this.wildcard("*",e,t)}},{key:"wildcard",value:function(e,t,r){this.store.wildcard[e]&&this.store.wildcard[e].call(null,t,r)}},{key:"add",value:function(e,t){if(-1<this.wildcards.indexOf(e))this.store.wildcard[e]=t;else{var r=this.getType(e),n=this.getName(e);this.store[r][n]=t}}},{key:"has",value:function(e){try{var t=e.split(":");return 1<t.length?!!this.store[t[1]][t[0]]:!!this.store.wildcard[t[0]]}catch(e){return!1}}},{key:"getName",value:function(e){return e.match(/(.*):.*/)[1]}},{key:"getType",value:function(e){return e.match(/^[a-z0-9-_]+:(.*)/)[1]}},{key:"isValid",value:function(e){return this.verifierPattern.test(e)||-1<this.wildcards.indexOf(e)}}]),e}();r.default=o},{}],20:[function(e,t,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};Object.defineProperty(r,"__esModule",{value:!0}),r.canMultiple=r.createTimeout=r.successJobHandler=r.retryProcess=r.lockTask=r.failedJobHandler=r.removeTask=r.saveTask=r.getTasksWithoutFreezed=void 0;var o,i,a,u,c,s,f,l,p,h=_(e("babel-runtime/regenerator")),d="function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?function(e){return void 0===e?"undefined":n(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":void 0===e?"undefined":n(e)},y=(r.getTasksWithoutFreezed=(o=j(h.default.mark(function e(){return h.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,S.call(this).all();case 2:return e.t0=x.excludeSpecificTasks.bind(["freezed"]),e.abrupt("return",e.sent.filter(e.t0));case 4:case"end":return e.stop()}},e,this)})),function(){return o.apply(this,arguments)}),r.saveTask=(i=j(h.default.mark(function e(t){var r;return h.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,S.call(this).save(P(t));case 2:return r=e.sent,e.abrupt("return",r);case 4:case"end":return e.stop()}},e,this)})),function(e){return i.apply(this,arguments)}),r.removeTask=(a=j(h.default.mark(function e(t){var r;return h.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,S.call(this).delete(t);case 2:return r=e.sent,e.abrupt("return",r);case 4:case"end":return e.stop()}},e,this)})),function(e){return a.apply(this,arguments)})),v=r.failedJobHandler=(u=j(h.default.mark(function e(t){return h.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",function(){var e=j(h.default.mark(function e(){return h.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return y.call(this,t._id),this.event.emit("error",t),T.call(this,k.workerFailedLog),e.next=5,this.next();case 5:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}());case 1:case"end":return e.stop()}},e,this)})),function(e){return u.apply(this,arguments)}),g=r.lockTask=(c=j(h.default.mark(function e(t){var r;return h.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,S.call(this).update(t._id,{locked:!0});case 2:return r=e.sent,e.abrupt("return",r);case 4:case"end":return e.stop()}},e,this)})),function(e){return c.apply(this,arguments)}),b=r.retryProcess=(s=j(h.default.mark(function e(t,r){var n,o;return h.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return L.call(this,t,"retry"),(n=M.call(this,t,r)).locked=!1,e.next=5,S.call(this).update(t._id,n);case 5:return o=e.sent,e.abrupt("return",o);case 7:case"end":return e.stop()}},e,this)})),function(e,t){return s.apply(this,arguments)}),m=r.successJobHandler=(f=j(h.default.mark(function e(r,n){var o;return h.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return o=this,e.abrupt("return",function(){var t=j(h.default.mark(function e(t){return h.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!t){e.next=4;break}C.call(o,r),e.next=6;break;case 4:return e.next=6,b.call(o,r,n);case 6:return A.call(o,"after",n,r.args),L.call(o,r,"after"),T.call(o,k.workerDoneLog,t,r,n),e.next=11,o.next();case 11:case"end":return e.stop()}},e,this)}));return function(e){return t.apply(this,arguments)}}());case 2:case"end":return e.stop()}},e,this)})),function(e,t){return f.apply(this,arguments)});r.createTimeout=(l=j(h.default.mark(function e(){var t,r,n,o,i,a;return h.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return clearTimeout(this.currentTimeout),e.next=3,S.call(this).fetch();case 3:if(void 0!==(t=e.sent.shift())){e.next=8;break}return T.call(this,k.queueEmptyLog,this.name()),E.call(this),e.abrupt("return",1);case 8:if(w.default.worker.has(t.handler)){e.next=16;break}return T.call(this,k.notFoundLog,t.handler),e.next=12,v.call(this,t);case 12:return e.t0=this,e.next=15,e.sent.call(e.t0);case 15:return e.abrupt("return",1);case 16:return r=w.default.worker.get(t.handler),n="object"===(void 0===r?"undefined":d(r))?new Worker(r.uri):new r,o=this.config.get("timeout"),i=[t,r,n],e.next=22,q.call.apply(q,[this].concat(i));case 22:return e.t1=this,a=e.sent.bind(e.t1),this.currentTimeout=setTimeout(a,o),e.abrupt("return",this.currentTimeout);case 26:case"end":return e.stop()}},e,this)})),function(){return l.apply(this,arguments)}),r.canMultiple=(p=j(h.default.mark(function e(t){return h.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("object"===(void 0===t?"undefined":d(t))&&!0===t.unique){e.next=2;break}return e.abrupt("return",!0);case 2:return e.next=4,this.hasByTag(t.tag);case 4:return e.t0=e.sent,e.abrupt("return",!1===e.t0);case 6:case"end":return e.stop()}},e,this)})),function(e){return p.apply(this,arguments)});r.checkPriority=P,r.db=S,r.logProxy=T,r.dispatchEvents=L,r.stopQueue=E,r.fireJobInlineEvent=A,r.successProcess=C,r.updateRetry=M,r.loopHandler=q,r.statusOff=function(){this.running=!1};var w=_(e("./queue")),x=(_(e("./channel")),_(e("./storage-capsule")),e("./utils")),k=e("./console");function _(e){return e&&e.__esModule?e:{default:e}}function O(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}function j(e){return function(){var u=e.apply(this,arguments);return new Promise(function(i,a){return function t(e,r){try{var n=u[e](r),o=n.value}catch(e){return void a(e)}if(!n.done)return Promise.resolve(o).then(function(e){t("next",e)},function(e){t("throw",e)});i(o)}("next")})}}function P(e){return e.priority=e.priority||0,"number"!=typeof e.priority&&(e.priority=0),e}function S(){return this.storage.channel(this.name())}function T(e){if(this.config.get("debug")&&"function"==typeof e){for(var t=arguments.length,r=Array(1<t?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];e(r)}}function L(t,e){var r=this;return"tag"in t&&([[t.tag+":"+e,"fired"],[t.tag+":*","wildcard-fired"]].forEach(function(e){r.event.emit(e[0],t),T.call.apply(T,[r,k.eventFiredLog].concat(O(e)))}),!0)}function E(){this.stop(),clearTimeout(this.currentTimeout),T.call(this,k.queueStoppedLog,"stop")}function A(e,t,r){return!(!(0,x.hasMethod)(t,e)||!(0,x.isFunction)(t[e]))&&(t[e].call(t,r),!0)}function C(e){y.call(this,e._id)}function M(e,t){return"retry"in t||(t.retry=1),"tried"in e||(e.tried=0,e.retry=t.retry),e.tried+=1,e.tried>=t.retry&&(e.freezed=!0),e}function q(a,u,c){return e=j(h.default.mark(function e(){var t,r,n,o,i;return h.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=void 0,r=this,e.next=4,g.call(r,a);case 4:return A.call(this,"before",c,a.args),L.call(this,a,"before"),n=w.default.workerDeps[a.handler],o=Object.values(n||{}),T.call(this,k.workerRunninLog,u,c,a,r.name(),w.default.workerDeps),c instanceof Worker?(c.postMessage({args:a.args,dependencies:o}),t=new Promise(function(t){c.onmessage=function(e){t(u.handler(e)),c.terminate()}})):t=(i=c.handle).call.apply(i,[c,a.args].concat(O(o))),e.t1=t,e.next=13,m.call(r,a,c);case 13:return e.t2=r,e.t3=e.sent.bind(e.t2),e.t0=e.t1.then.call(e.t1,e.t3),e.next=18,v.call(r,a);case 18:e.t4=r,e.t5=e.sent.bind(e.t4),e.t0.catch.call(e.t0,e.t5);case 21:case"end":return e.stop()}},e,this)})),function(){return e.apply(this,arguments)};var e}},{"./channel":13,"./console":15,"./queue":22,"./storage-capsule":23,"./utils":24,"babel-runtime/regenerator":1}],21:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),e("pseudo-worker/polyfill");var n,o=e("./queue"),i=(n=o)&&n.__esModule?n:{default:n};"undefined"!=typeof window&&(window.Queue=i.default),r.default=i.default},{"./queue":22,"pseudo-worker/polyfill":6}],22:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e};r.default=c;var o=u(e("./channel")),i=u(e("./container")),a=u(e("./config"));function u(e){return e&&e.__esModule?e:{default:e}}function c(e){this.config=new a.default(e)}c.FIFO="fifo",c.LIFO="lifo",c.drivers={},c.workerDeps={},c.worker=new i.default,c.prototype.container=new i.default,c.prototype.create=function(e){return this.container.has(e)||this.container.bind(e,new o.default(e,this.config)),this.container.get(e)},c.prototype.channel=function(e){if(!this.container.has(e))throw new Error('"'+e+'" channel not found');return this.container.get(e)},c.prototype.setTimeout=function(e){this.config.set("timeout",e)},c.prototype.setLimit=function(e){this.config.set("limit",e)},c.prototype.setPrefix=function(e){this.config.set("prefix",e)},c.prototype.setPrinciple=function(e){this.config.set("principle",e)},c.prototype.setDebug=function(e){this.config.set("debug",e)},c.prototype.setStorage=function(e){this.config.set("storage",e)},c.workers=function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};if(!(e instanceof Object))throw new Error("The parameters should be object.");c.worker.merge(e)},c.deps=function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};if(!(e instanceof Object))throw new Error("The parameters should be object.");c.workerDeps=e},c.use=function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};c.drivers=n({},c.drivers,e)}},{"./channel":13,"./config":14,"./container":16}],23:[function(e,t,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};Object.defineProperty(r,"__esModule",{value:!0});var c=o(e("babel-runtime/regenerator")),s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},f="function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?function(e){return void 0===e?"undefined":n(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":void 0===e?"undefined":n(e)},l=function(){function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}}(),p=o(e("group-by")),h=e("./adapters"),d=e("./utils");function o(e){return e&&e.__esModule?e:{default:e}}function y(e){return function(){var u=e.apply(this,arguments);return new Promise(function(i,a){return function t(e,r){try{var n=u[e](r),o=n.value}catch(e){return void a(e)}if(!n.done)return Promise.resolve(o).then(function(e){t("next",e)},function(e){t("throw",e)});i(o)}("next")})}}var i=function(){function r(e,t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,r),this.config=e,this.storage=this.initialize(t)}var t,e,n,o,i,a,u;return l(r,[{key:"initialize",value:function(e){return"object"===(void 0===e?"undefined":f(e))?e:"function"==typeof e?new e(this.config):"localstorage"===this.config.get("storage")?new h.LocalStorageAdapter(this.config):new h.InMemoryAdapter(this.config)}},{key:"channel",value:function(e){return this.storageChannel=e,this}},{key:"fetch",value:(u=y(c.default.mark(function e(){var t,r;return c.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.all();case 2:return e.t0=d.excludeSpecificTasks,t=e.sent.filter(e.t0),r=(0,p.default)(t,"priority"),e.abrupt("return",Object.keys(r).map(function(e){return parseInt(e,10)}).sort(function(e,t){return t-e}).reduce(this.reduceTasks(r),[]));case 6:case"end":return e.stop()}},e,this)})),function(){return u.apply(this,arguments)})},{key:"save",value:(a=y(c.default.mark(function e(t){var r,n;return c.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("object"===(void 0===t?"undefined":f(t))){e.next=2;break}return e.abrupt("return",!1);case 2:return e.next=4,this.storage.get(this.storageChannel);case 4:return r=e.sent,e.next=7,this.isExceeded();case 7:if(!e.sent){e.next=10;break}return console.warn("Task limit exceeded: The '"+this.storageChannel+"' channel limit is "+this.config.get("limit")),e.abrupt("return",!1);case 10:return n=this.prepareTask(t),r.push(n),e.next=14,this.storage.set(this.storageChannel,r);case 14:return e.abrupt("return",n._id);case 15:case"end":return e.stop()}},e,this)})),function(e){return a.apply(this,arguments)})},{key:"update",value:(i=y(c.default.mark(function e(t,r){var n,o;return c.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.all();case 2:if(n=e.sent,!((o=n.findIndex(function(e){return e._id===t}))<0)){e.next=6;break}return e.abrupt("return",!1);case 6:return n[o]=Object.assign({},n[o],r),e.next=9,this.storage.set(this.storageChannel,n);case 9:return e.abrupt("return",!0);case 10:case"end":return e.stop()}},e,this)})),function(e,t){return i.apply(this,arguments)})},{key:"delete",value:(o=y(c.default.mark(function e(t){var r,n;return c.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.all();case 2:if(r=e.sent,!((n=r.findIndex(function(e){return e._id===t}))<0)){e.next=6;break}return e.abrupt("return",!1);case 6:return delete r[n],e.next=9,this.storage.set(this.storageChannel,r.filter(function(e){return e}));case 9:return e.abrupt("return",!0);case 10:case"end":return e.stop()}},e,this)})),function(e){return o.apply(this,arguments)})},{key:"all",value:(n=y(c.default.mark(function e(){var t;return c.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.storage.get(this.storageChannel);case 2:return t=e.sent,e.abrupt("return",t);case 4:case"end":return e.stop()}},e,this)})),function(){return n.apply(this,arguments)})},{key:"generateId",value:function(){return(65536*(1+Math.random())).toString(16)}},{key:"prepareTask",value:function(e){var t=s({},e);return t.createdAt=Date.now(),t._id=this.generateId(),t}},{key:"reduceTasks",value:function(r){var n=this;return function(e,t){return"lifo"===n.config.get("principle")?e.concat(r[t].sort(d.lifo)):e.concat(r[t].sort(d.fifo))}.bind(this)}},{key:"isExceeded",value:(e=y(c.default.mark(function e(){var t,r;return c.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=this.config.get("limit"),e.next=3,this.all();case 3:return e.t0=d.excludeSpecificTasks,r=e.sent.filter(e.t0),e.abrupt("return",!(-1===t||t>r.length));case 6:case"end":return e.stop()}},e,this)})),function(){return e.apply(this,arguments)})},{key:"clear",value:(t=y(c.default.mark(function e(t){return c.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.storage.clear(t);case 2:case"end":return e.stop()}},e,this)})),function(e){return t.apply(this,arguments)})}]),r}();r.default=i},{"./adapters":10,"./utils":24,"babel-runtime/regenerator":1,"group-by":3}],24:[function(e,t,r){"use strict";function n(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function o(t){var e=Array.isArray(this)?this:["freezed","locked"],r=[];return e.forEach(function(e){r.push(!1===n(t,e)||!1===t[e])}),!(-1<r.indexOf(!1))}Object.defineProperty(r,"__esModule",{value:!0}),r.hasProperty=n,r.hasMethod=function(e,t){return e instanceof Object&&t in e},r.isFunction=function(e){return e instanceof Function},r.excludeSpecificTasks=o,r.utilClearByTag=function(e){if(!o.call(["locked"],e))return!1;return e.tag===this},r.fifo=function(e,t){return e.createdAt-t.createdAt},r.lifo=function(e,t){return t.createdAt-e.createdAt}},{}]},{},[21]);
!function i(a,u,c){function s(t,e){if(!u[t]){if(!a[t]){var r="function"==typeof require&&require;if(!e&&r)return r(t,!0);if(f)return f(t,!0);var n=new Error("Cannot find module '"+t+"'");throw n.code="MODULE_NOT_FOUND",n}var o=u[t]={exports:{}};a[t][0].call(o.exports,function(e){return s(a[t][1][e]||e)},o,o.exports,i,a,u,c)}return u[t].exports}for(var f="function"==typeof require&&require,e=0;e<c.length;e++)s(c[e]);return s}({1:[function(e,t,r){t.exports=e("regenerator-runtime")},{"regenerator-runtime":7}],2:[function(e,t,r){var a=/\b(Array|Date|Object|Math|JSON)\b/g;t.exports=function(e,t){var r,n,o,i=function(e){for(var t=[],r=0;r<e.length;r++)~t.indexOf(e[r])||t.push(e[r]);return t}(e.replace(/\.\w+|\w+ *\(|"[^"]*"|'[^']*'|\/([^/]+)\//g,"").replace(a,"").match(/[a-zA-Z_]\w*/g)||[]);return t&&"string"==typeof t&&(r=t,t=function(e){return r+e}),t?(n=i,o=t,e.replace(/\.\w+|\w+ *\(|"[^"]*"|'[^']*'|\/([^/]+)\/|[a-zA-Z_]\w*/g,function(e){return"("==e[e.length-1]?o(e):~n.indexOf(e)?o(e):e})):i}},{}],3:[function(e,t,r){var i=e("to-function");t.exports=function(e,t){var r,n={};t=i(t);for(var o=0;o<e.length;++o)n[r=t(e[o],o)]=n[r]||[],n[r].push(e[o]);return n}},{"to-function":9}],4:[function(e,r,t){!function(e,t){"use strict";"object"==typeof r&&"object"==typeof r.exports?r.exports=t():"function"==typeof define&&define.amd?define([],t):e.objectPath=t()}(this,function(){"use strict";var t=Object.prototype.toString;function i(e,t){return null!=e&&Object.prototype.hasOwnProperty.call(e,t)}function f(e){if(!e)return!0;if(p(e)&&0===e.length)return!0;if("string"!=typeof e){for(var t in e)if(i(e,t))return!1;return!0}return!1}function l(e){return t.call(e)}var p=Array.isArray||function(e){return"[object Array]"===t.call(e)};function h(e){var t=parseInt(e);return t.toString()===e?t:e}function e(o){o=o||{};var a=function(r){return Object.keys(a).reduce(function(e,t){return"create"===t||"function"==typeof a[t]&&(e[t]=a[t].bind(a,r)),e},{})};function u(e,t){return o.includeInheritedProps||"number"==typeof t&&Array.isArray(e)||i(e,t)}function c(e,t){if(u(e,t))return e[t]}function s(e,t,r,n){if("number"==typeof t&&(t=[t]),!t||0===t.length)return e;if("string"==typeof t)return s(e,t.split(".").map(h),r,n);var o=t[0],i=c(e,o);return 1===t.length?(void 0!==i&&n||(e[o]=r),i):(void 0===i&&("number"==typeof t[1]?e[o]=[]:e[o]={}),s(e[o],t.slice(1),r,n))}return a.has=function(e,t){if("number"==typeof t?t=[t]:"string"==typeof t&&(t=t.split(".")),!t||0===t.length)return!!e;for(var r=0;r<t.length;r++){var n=h(t[r]);if(!("number"==typeof n&&p(e)&&n<e.length||(o.includeInheritedProps?n in Object(e):i(e,n))))return!1;e=e[n]}return!0},a.ensureExists=function(e,t,r){return s(e,t,r,!0)},a.set=function(e,t,r,n){return s(e,t,r,n)},a.insert=function(e,t,r,n){var o=a.get(e,t);n=~~n,p(o)||(o=[],a.set(e,t,o)),o.splice(n,0,r)},a.empty=function(e,t){var r,n;if(!f(t)&&(null!=e&&(r=a.get(e,t)))){if("string"==typeof r)return a.set(e,t,"");if("boolean"==typeof(i=r)||"[object Boolean]"===l(i))return a.set(e,t,!1);if("number"==typeof r)return a.set(e,t,0);if(p(r))r.length=0;else{if("object"!=typeof(o=r)||"[object Object]"!==l(o))return a.set(e,t,null);for(n in r)u(r,n)&&delete r[n]}var o,i}},a.push=function(e,t){var r=a.get(e,t);p(r)||(r=[],a.set(e,t,r)),r.push.apply(r,Array.prototype.slice.call(arguments,2))},a.coalesce=function(e,t,r){for(var n,o=0,i=t.length;o<i;o++)if(void 0!==(n=a.get(e,t[o])))return n;return r},a.get=function(e,t,r){if("number"==typeof t&&(t=[t]),!t||0===t.length)return e;if(null==e)return r;if("string"==typeof t)return a.get(e,t.split("."),r);var n=h(t[0]),o=c(e,n);return void 0===o?r:1===t.length?o:a.get(e[n],t.slice(1),r)},a.del=function(e,t){if("number"==typeof t&&(t=[t]),null==e)return e;if(f(t))return e;if("string"==typeof t)return a.del(e,t.split("."));var r=h(t[0]);return u(e,r)?1!==t.length?a.del(e[r],t.slice(1)):(p(e)?e.splice(r,1):delete e[r],e):e},a}var r=e();return r.create=e,r.withInheritedProps=e({includeInheritedProps:!0}),r})},{}],5:[function(require,module,exports){(function(global){"use strict";function doEval(self,__pseudoworker_script){(function(){eval(__pseudoworker_script)}).call(global)}function PseudoWorker(r){var n,o,i=[],a=[],u=[],c=[],s=[],f=!1,l=this;function p(e,t){for(var r=-1;++r<e.length;)e[r]&&t(e[r])}function h(e){var t,r=(t=e,function(e){e({type:"error",error:t,message:t.message})});"function"==typeof l.onerror&&r(l.onerror),o&&"function"==typeof o.onerror&&r(o.onerror),p(a,r),p(c,r)}function d(t){function e(e){try{e({data:t})}catch(e){h(e)}}o&&"function"==typeof o.onmessage&&e(o.onmessage),p(u,e)}function y(){f=!0}function v(t){function e(e){e({data:t})}f||("function"==typeof l.onmessage&&e(l.onmessage),p(i,e))}function g(e,t){"message"===e?u.push(t):"error"===e&&c.push(t)}var b=new XMLHttpRequest;return b.open("GET",r),b.onreadystatechange=function(){if(4===b.readyState)if(200<=b.status&&b.status<400){n=b.responseText,doEval(o={postMessage:v,addEventListener:g,close:y},n);var e=s;s=[];for(var t=0;t<e.length;t++)d(e[t])}else h(new Error("cannot find script "+r))},b.send(),l.postMessage=function(e){if(void 0===e)throw new Error("postMessage() requires an argument");f||(n?d(e):s.push(e))},l.addEventListener=function(e,t){"message"===e?i.push(t):"error"===e&&a.push(t)},l.removeEventListener=function(e,t){var r;if("message"===e)r=i;else{if("error"!==e)return;r=a}for(var n=-1;++n<r.length;)if(r[n]===t){delete r[n];break}},l.terminate=y,l}module.exports=PseudoWorker}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],6:[function(r,n,e){(function(e){"use strict";var t=r("./");"undefined"==typeof Worker&&(e.Worker=t),n.exports=t}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./":5}],7:[function(e,t,r){var n=function(){return this}()||Function("return this")(),o=n.regeneratorRuntime&&0<=Object.getOwnPropertyNames(n).indexOf("regeneratorRuntime"),i=o&&n.regeneratorRuntime;if(n.regeneratorRuntime=void 0,t.exports=e("./runtime"),o)n.regeneratorRuntime=i;else try{delete n.regeneratorRuntime}catch(e){n.regeneratorRuntime=void 0}},{"./runtime":8}],8:[function(e,C,t){!function(e){"use strict";var c,t=Object.prototype,s=t.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},o=r.iterator||"@@iterator",n=r.asyncIterator||"@@asyncIterator",i=r.toStringTag||"@@toStringTag",a="object"==typeof C,u=e.regeneratorRuntime;if(u)a&&(C.exports=u);else{(u=e.regeneratorRuntime=a?C.exports:{}).wrap=m;var l="suspendedStart",p="suspendedYield",h="executing",d="completed",y={},f={};f[o]=function(){return this};var v=Object.getPrototypeOf,g=v&&v(v(E([])));g&&g!==t&&s.call(g,o)&&(f=g);var b=_.prototype=x.prototype=Object.create(f);k.prototype=b.constructor=_,_.constructor=k,_[i]=k.displayName="GeneratorFunction",u.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===k||"GeneratorFunction"===(t.displayName||t.name))},u.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,_):(e.__proto__=_,i in e||(e[i]="GeneratorFunction")),e.prototype=Object.create(b),e},u.awrap=function(e){return{__await:e}},O(j.prototype),j.prototype[n]=function(){return this},u.AsyncIterator=j,u.async=function(e,t,r,n){var o=new j(m(e,t,r,n));return u.isGeneratorFunction(t)?o:o.next().then(function(e){return e.done?e.value:o.next()})},O(b),b[i]="Generator",b[o]=function(){return this},b.toString=function(){return"[object Generator]"},u.keys=function(r){var n=[];for(var e in r)n.push(e);return n.reverse(),function e(){for(;n.length;){var t=n.pop();if(t in r)return e.value=t,e.done=!1,e}return e.done=!0,e}},u.values=E,L.prototype={constructor:L,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=c,this.done=!1,this.delegate=null,this.method="next",this.arg=c,this.tryEntries.forEach(T),!e)for(var t in this)"t"===t.charAt(0)&&s.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=c)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var n=this;function e(e,t){return i.type="throw",i.arg=r,n.next=e,t&&(n.method="next",n.arg=c),!!t}for(var t=this.tryEntries.length-1;0<=t;--t){var o=this.tryEntries[t],i=o.completion;if("root"===o.tryLoc)return e("end");if(o.tryLoc<=this.prev){var a=s.call(o,"catchLoc"),u=s.call(o,"finallyLoc");if(a&&u){if(this.prev<o.catchLoc)return e(o.catchLoc,!0);if(this.prev<o.finallyLoc)return e(o.finallyLoc)}else if(a){if(this.prev<o.catchLoc)return e(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return e(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;0<=r;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&s.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),T(r),y}},catch:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;T(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:E(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=c),y}}}function m(e,t,r,n){var i,a,u,c,o=t&&t.prototype instanceof x?t:x,s=Object.create(o.prototype),f=new L(n||[]);return s._invoke=(i=e,a=r,u=f,c=l,function(e,t){if(c===h)throw new Error("Generator is already running");if(c===d){if("throw"===e)throw t;return A()}for(u.method=e,u.arg=t;;){var r=u.delegate;if(r){var n=P(r,u);if(n){if(n===y)continue;return n}}if("next"===u.method)u.sent=u._sent=u.arg;else if("throw"===u.method){if(c===l)throw c=d,u.arg;u.dispatchException(u.arg)}else"return"===u.method&&u.abrupt("return",u.arg);c=h;var o=w(i,a,u);if("normal"===o.type){if(c=u.done?d:p,o.arg===y)continue;return{value:o.arg,done:u.done}}"throw"===o.type&&(c=d,u.method="throw",u.arg=o.arg)}}),s}function w(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}function x(){}function k(){}function _(){}function O(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function j(c){var t;this._invoke=function(r,n){function e(){return new Promise(function(e,t){!function t(e,r,n,o){var i=w(c[e],c,r);if("throw"!==i.type){var a=i.arg,u=a.value;return u&&"object"==typeof u&&s.call(u,"__await")?Promise.resolve(u.__await).then(function(e){t("next",e,n,o)},function(e){t("throw",e,n,o)}):Promise.resolve(u).then(function(e){a.value=e,n(a)},o)}o(i.arg)}(r,n,e,t)})}return t=t?t.then(e,e):e()}}function P(e,t){var r=e.iterator[t.method];if(r===c){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=c,P(e,t),"throw"===t.method))return y;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return y}var n=w(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,y;var o=n.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=c),t.delegate=null,y):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,y)}function S(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function T(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function E(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,n=function e(){for(;++r<t.length;)if(s.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=c,e.done=!0,e};return n.next=n}}return{next:A}}function A(){return{value:c,done:!0}}}(function(){return this}()||Function("return this")())},{}],9:[function(t,e,r){var i;try{i=t("props")}catch(e){i=t("component-props")}function n(e){switch({}.toString.call(e)){case"[object Object]":return function(e){var r={};for(var t in e)r[t]="string"==typeof e[t]?o(e[t]):n(e[t]);return function(e){if("object"!=typeof e)return!1;for(var t in r){if(!(t in e))return!1;if(!r[t](e[t]))return!1}return!0}}(e);case"[object Function]":return e;case"[object String]":return/^ *\W+/.test(r=e)?new Function("_","return _ "+r):new Function("_","return "+function(e){var t,r,n,o=i(e);if(!o.length)return"_."+e;for(r=0;r<o.length;r++)n=o[r],e=a(n,e,t="('function' == typeof "+(t="_."+n)+" ? "+t+"() : "+t+")");return e}(r));case"[object RegExp]":return t=e,function(e){return t.test(e)};default:return o(e)}var t,r}function o(t){return function(e){return t===e}}function a(e,t,r){return t.replace(new RegExp("(\\.)?"+e,"g"),function(e,t){return t?e:r})}e.exports=n},{"component-props":2,props:2}],10:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.LocalStorageAdapter=r.InMemoryAdapter=void 0;var n=i(e("./inmemory")),o=i(e("./localstorage"));function i(e){return e&&e.__esModule?e:{default:e}}r.InMemoryAdapter=n.default,r.LocalStorageAdapter=o.default},{"./inmemory":11,"./localstorage":12}],11:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n,o=e("babel-runtime/regenerator"),a=(n=o)&&n.__esModule?n:{default:n},u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},c=function(){function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}}();function s(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}function f(e){return function(){var u=e.apply(this,arguments);return new Promise(function(i,a){return function t(e,r){try{var n=u[e](r),o=n.value}catch(e){return void a(e)}if(!n.done)return Promise.resolve(o).then(function(e){t("next",e)},function(e){t("throw",e)});i(o)}("next")})}}var i=function(){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),this.store={},this.config=e,this.prefix=this.config.get("prefix")}var r,n,o,i;return c(t,[{key:"get",value:(i=f(a.default.mark(function e(t){var r;return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=this.storageName(t),e.abrupt("return",[].concat(s(this.getCollection(r))));case 2:case"end":return e.stop()}},e,this)})),function(e){return i.apply(this,arguments)})},{key:"set",value:(o=f(a.default.mark(function e(t,r){return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.store[this.storageName(t)]=[].concat(s(r)),e.abrupt("return",r);case 2:case"end":return e.stop()}},e,this)})),function(e,t){return o.apply(this,arguments)})},{key:"has",value:(n=f(a.default.mark(function e(t){return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Object.prototype.hasOwnProperty.call(this.store,this.storageName(t)));case 1:case"end":return e.stop()}},e,this)})),function(e){return n.apply(this,arguments)})},{key:"clear",value:(r=f(a.default.mark(function e(t){var r;return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.has(t);case 2:if(!e.sent){e.next=6;break}e.t0=delete this.store[this.storageName(t)],e.next=7;break;case 6:e.t0=!1;case 7:return r=e.t0,this.store=u({},this.store),e.abrupt("return",r);case 10:case"end":return e.stop()}},e,this)})),function(e){return r.apply(this,arguments)})},{key:"storageName",value:function(e){return e.startsWith(this.getPrefix())?e:this.getPrefix()+"_"+e}},{key:"getPrefix",value:function(){return this.config.get("prefix")}},{key:"getCollection",value:function(e){return Object.prototype.hasOwnProperty.call(this.store,e)||(this.store[e]=[]),this.store[e]}}]),t}();r.default=i},{"babel-runtime/regenerator":1}],12:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n,o=e("babel-runtime/regenerator"),a=(n=o)&&n.__esModule?n:{default:n},u=function(){function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}}();function c(e){return function(){var u=e.apply(this,arguments);return new Promise(function(i,a){return function t(e,r){try{var n=u[e](r),o=n.value}catch(e){return void a(e)}if(!n.done)return Promise.resolve(o).then(function(e){t("next",e)},function(e){t("throw",e)});i(o)}("next")})}}var i=function(){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),this.config=e,this.prefix=this.config.get("prefix")}var r,n,o,i;return u(t,[{key:"get",value:(i=c(a.default.mark(function e(t){var r;return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=localStorage.getItem(this.storageName(t)),e.abrupt("return",JSON.parse(r)||[]);case 2:case"end":return e.stop()}},e,this)})),function(e){return i.apply(this,arguments)})},{key:"set",value:(o=c(a.default.mark(function e(t,r){return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return localStorage.setItem(this.storageName(t),JSON.stringify(r)),e.abrupt("return",r);case 2:case"end":return e.stop()}},e,this)})),function(e,t){return o.apply(this,arguments)})},{key:"has",value:(n=c(a.default.mark(function e(t){return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Object.prototype.hasOwnProperty.call(localStorage,this.storageName(t)));case 1:case"end":return e.stop()}},e,this)})),function(e){return n.apply(this,arguments)})},{key:"clear",value:(r=c(a.default.mark(function e(t){var r;return a.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.has(t);case 2:if(!e.sent){e.next=6;break}e.t0=delete localStorage[this.storageName(t)],e.next=7;break;case 6:e.t0=!1;case 7:return r=e.t0,e.abrupt("return",r);case 9:case"end":return e.stop()}},e,this)})),function(e){return r.apply(this,arguments)})},{key:"storageName",value:function(e){return e.startsWith(this.getPrefix())?e:this.getPrefix()+"_"+e}},{key:"getPrefix",value:function(){return this.config.get("prefix")}}]),t}();r.default=i},{"babel-runtime/regenerator":1}],13:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var l=n(e("babel-runtime/regenerator")),p=function(){function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}}(),h=n(e("./event")),d=n(e("./storage-capsule")),y=n(e("./queue")),v=e("./utils"),g=e("./helpers"),b=e("./console");function n(e){return e&&e.__esModule?e:{default:e}}function m(e){return function(){var u=e.apply(this,arguments);return new Promise(function(i,a){return function t(e,r){try{var n=u[e](r),o=n.value}catch(e){return void a(e)}if(!n.done)return Promise.resolve(o).then(function(e){t("next",e)},function(e){t("throw",e)});i(o)}("next")})}}var w=Symbol("channel-name"),o=function(){function o(e,t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,o),this.stopped=!0,this.running=!1,this.event=new h.default,this.config=t,this[w]=e;var r=y.default.drivers,n=new d.default(t,r.storage);this.storage=n.channel(e)}var t,r,n,e,i,a,u,c,s,f;return p(o,[{key:"name",value:function(){return this[w]}},{key:"add",value:(f=m(l.default.mark(function e(t){var r;return l.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,g.canMultiple.call(this,t);case 2:if(e.sent){e.next=4;break}return e.abrupt("return",!1);case 4:return e.next=6,g.saveTask.call(this,t);case 6:if(!(r=e.sent)||!this.stopped||!0!==this.running){e.next=10;break}return e.next=10,this.start();case 10:return g.logProxy.call(this,b.taskAddedLog,t),e.abrupt("return",r);case 12:case"end":return e.stop()}},e,this)})),function(e){return f.apply(this,arguments)})},{key:"next",value:(s=m(l.default.mark(function e(){return l.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.stopped){e.next=3;break}return g.statusOff.call(this),e.abrupt("return",g.stopQueue.call(this));case 3:return g.logProxy.call(this,b.nextTaskLog,"next"),e.next=6,this.start();case 6:return e.abrupt("return",!0);case 7:case"end":return e.stop()}},e,this)})),function(){return s.apply(this,arguments)})},{key:"start",value:(c=m(l.default.mark(function e(){return l.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.stopped=!1,g.logProxy.call(this,b.queueStartLog,"start"),e.next=4,g.createTimeout.call(this);case 4:return e.t0=e.sent,this.running=0<e.t0,e.abrupt("return",this.running);case 7:case"end":return e.stop()}},e,this)})),function(){return c.apply(this,arguments)})},{key:"stop",value:function(){g.logProxy.call(this,b.queueStoppingLog,"stop"),this.stopped=!0}},{key:"forceStop",value:function(){g.stopQueue.call(this)}},{key:"status",value:function(){return this.running}},{key:"isEmpty",value:(u=m(l.default.mark(function e(){return l.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.count();case 2:return e.t0=e.sent,e.abrupt("return",e.t0<1);case 4:case"end":return e.stop()}},e,this)})),function(){return u.apply(this,arguments)})},{key:"count",value:(a=m(l.default.mark(function e(){return l.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,g.getTasksWithoutFreezed.call(this);case 2:return e.abrupt("return",e.sent.length);case 3:case"end":return e.stop()}},e,this)})),function(){return a.apply(this,arguments)})},{key:"countByTag",value:(i=m(l.default.mark(function e(t){return l.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,g.getTasksWithoutFreezed.call(this);case 2:return e.t0=function(e){return e.tag===t},e.abrupt("return",e.sent.filter(e.t0).length);case 4:case"end":return e.stop()}},e,this)})),function(e){return i.apply(this,arguments)})},{key:"clear",value:(e=m(l.default.mark(function e(){return l.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.name()){e.next=2;break}return e.abrupt("return",!1);case 2:return e.next=4,this.storage.clear(this.name());case 4:return e.abrupt("return",!0);case 5:case"end":return e.stop()}},e,this)})),function(){return e.apply(this,arguments)})},{key:"clearByTag",value:(n=m(l.default.mark(function e(t){var n,r,o,i=this;return l.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=this,e.next=3,g.db.call(n).all();case 3:return r=e.sent,o=r.filter(v.utilClearByTag.bind(t)).map(function(){var t=m(l.default.mark(function e(t){var r;return l.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,g.db.call(n).delete(t._id);case 2:return r=e.sent,e.abrupt("return",r);case 4:case"end":return e.stop()}},e,i)}));return function(e){return t.apply(this,arguments)}}()),e.next=7,Promise.all(o);case 7:case"end":return e.stop()}},e,this)})),function(e){return n.apply(this,arguments)})},{key:"has",value:(r=m(l.default.mark(function e(t){return l.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,g.getTasksWithoutFreezed.call(this);case 2:return e.t0=function(e){return e._id===t},e.t1=e.sent.findIndex(e.t0),e.t2=-1,e.abrupt("return",e.t1>e.t2);case 6:case"end":return e.stop()}},e,this)})),function(e){return r.apply(this,arguments)})},{key:"hasByTag",value:(t=m(l.default.mark(function e(t){return l.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,g.getTasksWithoutFreezed.call(this);case 2:return e.t0=function(e){return e.tag===t},e.t1=e.sent.findIndex(e.t0),e.t2=-1,e.abrupt("return",e.t1>e.t2);case 6:case"end":return e.stop()}},e,this)})),function(e){return t.apply(this,arguments)})},{key:"on",value:function(e,t){var r;(r=this.event).on.apply(r,[e,t]),g.logProxy.call(this,b.eventCreatedLog,e)}}]),o}();r.default=o},{"./console":15,"./event":19,"./helpers":20,"./queue":22,"./storage-capsule":23,"./utils":24,"babel-runtime/regenerator":1}],14:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n,o=function(){function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}}(),i=e("./enum/config.data"),a=(n=i)&&n.__esModule?n:{default:n};var u=function(){function t(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),this.config=a.default,this.merge(e)}return o(t,[{key:"set",value:function(e,t){this.config[e]=t}},{key:"get",value:function(e){return this.config[e]}},{key:"has",value:function(e){return Object.prototype.hasOwnProperty.call(this.config,e)}},{key:"merge",value:function(e){this.config=Object.assign({},this.config,e)}},{key:"remove",value:function(e){return delete this.config[e]}},{key:"all",value:function(){return this.config}}]),t}();r.default=u},{"./enum/config.data":17}],15:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var u=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,o=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(n=(a=u.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(e){o=!0,i=e}finally{try{!n&&u.return&&u.return()}finally{if(o)throw i}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")};r.log=c,r.taskAddedLog=function(e){var t=u(e,1)[0];c("%c"+String.fromCharCode(43)+" ("+t.handler+") -> "+o.default.get(i.default,"queue.created"),"color: green;font-weight: bold;")},r.queueStartLog=function(e){var t=u(e,1)[0];c("%c"+String.fromCharCode(8211)+" ("+t+") -> "+o.default.get(i.default,"queue.starting"),"color: #3fa5f3;font-weight: bold;")},r.nextTaskLog=function(e){var t=u(e,1)[0];c("%c"+String.fromCharCode(187)+" ("+t+") -> "+o.default.get(i.default,"queue.next"),"color: #3fa5f3;font-weight: bold;")},r.queueStoppingLog=function(e){var t=u(e,1)[0];c("%c"+String.fromCharCode(8226)+" ("+t+") -> "+o.default.get(i.default,"queue.stopping"),"color: #ff7f94;font-weight: bold;")},r.queueStoppedLog=function(e){var t=u(e,1)[0];c("%c"+String.fromCharCode(8226)+" ("+t+") -> "+o.default.get(i.default,"queue.stopped"),"color: #ff7f94;font-weight: bold;")},r.queueEmptyLog=function(e){c("%c"+u(e,1)[0]+" "+o.default.get(i.default,"queue.empty"),"color: #ff7f94;font-weight: bold;")},r.eventCreatedLog=function(e){c("%c("+u(e,1)[0]+") -> "+o.default.get(i.default,"event.created"),"color: #66cee3;font-weight: bold;")},r.eventFiredLog=function(e){var t=u(e,2),r=t[0],n=t[1];c("%c("+r+") -> "+o.default.get(i.default,"event."+n),"color: #a0dc3c;font-weight: bold;")},r.notFoundLog=function(e){var t=u(e,1)[0];c("%c"+String.fromCharCode(215)+" ("+t+") -> "+o.default.get(i.default,"queue.not-found"),"color: #b92e2e;font-weight: bold;")},r.workerRunninLog=function(e){var t=u(e,5),r=t[0],n=t[1],o=t[2],i=t[3],a=t[4];console.groupCollapsed((r.name||o.handler)+" - "+o.label),c("%cchannel: "+i,"color: blue;"),c("%clabel: "+(o.label||""),"color: blue;"),c("%chandler: "+o.handler,"color: blue;"),c("%cpriority: "+o.priority,"color: blue;"),c("%cunique: "+(o.unique||"false"),"color: blue;"),c("%cretry: "+(n.retry||"1"),"color: blue;"),c("%ctried: "+(o.tried?o.tried+1:"1"),"color: blue;"),c("%ctag: "+(o.tag||""),"color: blue;"),c("%cargs:","color: blue;"),c(o.args||""),console.groupCollapsed("dependencies"),c.apply(void 0,function(e){{if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}}(a[r.name]||[])),console.groupEnd()},r.workerDoneLog=function(e){var t=u(e,3),r=t[0],n=t[1],o=t[2];!0===r?c("%c"+String.fromCharCode(10003)+" Task completed!","color: green;"):!r&&n.tried<o.retry?c("%cTask will be retried!","color: #d8410c;"):c("%c"+String.fromCharCode(10005)+" Task failed and freezed!","color: #ef6363;");console.groupEnd()},r.workerFailedLog=function(){c("%c"+String.fromCharCode(10005)+" Task failed!","color: red;"),console.groupEnd()};var o=n(e("object-path")),i=n(e("./enum/log.events"));function n(e){return e&&e.__esModule?e:{default:e}}function c(){var e;(e=console).log.apply(e,arguments)}},{"./enum/log.events":18,"object-path":4}],16:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}}();var o=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.store={}}return n(e,[{key:"has",value:function(e){return Object.prototype.hasOwnProperty.call(this.store,e)}},{key:"get",value:function(e){return this.store[e]}},{key:"all",value:function(){return this.store}},{key:"bind",value:function(e,t){this.store[e]=t}},{key:"merge",value:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};this.store=Object.assign({},this.store,e)}},{key:"remove",value:function(e){return!!this.has(e)&&delete this.store[e]}},{key:"removeAll",value:function(){this.store={}}}]),e}();r.default=o},{}],17:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default={defaultStorage:"localstorage",prefix:"sq_jobs",timeout:1e3,limit:-1,principle:"fifo",debug:!0}},{}],18:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default={queue:{created:"New task created.",next:"Next task processing.",starting:"Queue listener starting.",stopping:"Queue listener stopping.",stopped:"Queue listener stopped.",empty:"channel is empty...","not-found":"worker not found",offline:"Disconnected",online:"Connected"},event:{created:"New event created",fired:"Event fired.","wildcard-fired":"Wildcard event fired."}}},{}],19:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}}();var o=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.store={},this.verifierPattern=/^[a-z0-9-_]+:before$|after$|retry$|\*$/,this.wildcards=["*","error"],this.emptyFunc=function(){},this.store.before={},this.store.after={},this.store.retry={},this.store.wildcard={},this.store.error=this.emptyFunc,this.store["*"]=this.emptyFunc}return n(e,[{key:"on",value:function(e,t){if("function"!=typeof t)throw new Error("Event should be an function");this.isValid(e)&&this.add(e,t)}},{key:"emit",value:function(e,t){if(-1<this.wildcards.indexOf(e))this.wildcard.apply(this,[e].concat([e,t]));else{var r=this.getType(e),n=this.getName(e);if(this.store[r])(this.store[r][n]||this.emptyFunc).call(null,t)}this.wildcard("*",e,t)}},{key:"wildcard",value:function(e,t,r){this.store.wildcard[e]&&this.store.wildcard[e].call(null,t,r)}},{key:"add",value:function(e,t){if(-1<this.wildcards.indexOf(e))this.store.wildcard[e]=t;else{var r=this.getType(e),n=this.getName(e);this.store[r][n]=t}}},{key:"has",value:function(e){try{var t=e.split(":");return 1<t.length?!!this.store[t[1]][t[0]]:!!this.store.wildcard[t[0]]}catch(e){return!1}}},{key:"getName",value:function(e){return e.match(/(.*):.*/)[1]}},{key:"getType",value:function(e){return e.match(/^[a-z0-9-_]+:(.*)/)[1]}},{key:"isValid",value:function(e){return this.verifierPattern.test(e)||-1<this.wildcards.indexOf(e)}}]),e}();r.default=o},{}],20:[function(e,t,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};Object.defineProperty(r,"__esModule",{value:!0}),r.canMultiple=r.createTimeout=r.successJobHandler=r.retryProcess=r.lockTask=r.failedJobHandler=r.removeTask=r.saveTask=r.getTasksWithoutFreezed=void 0;var o,i,a,u,c,s,f,l,p,h=_(e("babel-runtime/regenerator")),d="function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?function(e){return void 0===e?"undefined":n(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":void 0===e?"undefined":n(e)},y=(r.getTasksWithoutFreezed=(o=j(h.default.mark(function e(){return h.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,S.call(this).all();case 2:return e.t0=x.excludeSpecificTasks.bind(["freezed"]),e.abrupt("return",e.sent.filter(e.t0));case 4:case"end":return e.stop()}},e,this)})),function(){return o.apply(this,arguments)}),r.saveTask=(i=j(h.default.mark(function e(t){var r;return h.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,S.call(this).save(P(t));case 2:return r=e.sent,e.abrupt("return",r);case 4:case"end":return e.stop()}},e,this)})),function(e){return i.apply(this,arguments)}),r.removeTask=(a=j(h.default.mark(function e(t){var r;return h.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,S.call(this).delete(t);case 2:return r=e.sent,e.abrupt("return",r);case 4:case"end":return e.stop()}},e,this)})),function(e){return a.apply(this,arguments)})),v=r.failedJobHandler=(u=j(h.default.mark(function e(t){return h.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",function(){var e=j(h.default.mark(function e(){return h.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return y.call(this,t._id),this.event.emit("error",t),T.call(this,k.workerFailedLog),e.next=5,this.next();case 5:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}());case 1:case"end":return e.stop()}},e,this)})),function(e){return u.apply(this,arguments)}),g=r.lockTask=(c=j(h.default.mark(function e(t){var r;return h.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,S.call(this).update(t._id,{locked:!0});case 2:return r=e.sent,e.abrupt("return",r);case 4:case"end":return e.stop()}},e,this)})),function(e){return c.apply(this,arguments)}),b=r.retryProcess=(s=j(h.default.mark(function e(t,r){var n,o;return h.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return L.call(this,t,"retry"),(n=M.call(this,t,r)).locked=!1,e.next=5,S.call(this).update(t._id,n);case 5:return o=e.sent,e.abrupt("return",o);case 7:case"end":return e.stop()}},e,this)})),function(e,t){return s.apply(this,arguments)}),m=r.successJobHandler=(f=j(h.default.mark(function e(r,n){var o;return h.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return o=this,e.abrupt("return",function(){var t=j(h.default.mark(function e(t){return h.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!t){e.next=4;break}C.call(o,r),e.next=6;break;case 4:return e.next=6,b.call(o,r,n);case 6:return A.call(o,"after",n,r.args),L.call(o,r,"after"),T.call(o,k.workerDoneLog,t,r,n),e.next=11,o.next();case 11:case"end":return e.stop()}},e,this)}));return function(e){return t.apply(this,arguments)}}());case 2:case"end":return e.stop()}},e,this)})),function(e,t){return f.apply(this,arguments)});r.createTimeout=(l=j(h.default.mark(function e(){var t,r,n,o,i,a;return h.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return clearTimeout(this.currentTimeout),e.next=3,S.call(this).fetch();case 3:if(void 0!==(t=e.sent.shift())){e.next=8;break}return T.call(this,k.queueEmptyLog,this.name()),E.call(this),e.abrupt("return",1);case 8:if(w.default.worker.has(t.handler)){e.next=16;break}return T.call(this,k.notFoundLog,t.handler),e.next=12,v.call(this,t);case 12:return e.t0=this,e.next=15,e.sent.call(e.t0);case 15:return e.abrupt("return",1);case 16:return r=w.default.worker.get(t.handler),n="object"===(void 0===r?"undefined":d(r))?new Worker(r.uri):new r,o=this.config.get("timeout"),i=[t,r,n],e.next=22,q.call.apply(q,[this].concat(i));case 22:return e.t1=this,a=e.sent.bind(e.t1),this.currentTimeout=setTimeout(a,o),e.abrupt("return",this.currentTimeout);case 26:case"end":return e.stop()}},e,this)})),function(){return l.apply(this,arguments)}),r.canMultiple=(p=j(h.default.mark(function e(t){return h.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("object"===(void 0===t?"undefined":d(t))&&!0===t.unique){e.next=2;break}return e.abrupt("return",!0);case 2:return e.next=4,this.hasByTag(t.tag);case 4:return e.t0=e.sent,e.abrupt("return",!1===e.t0);case 6:case"end":return e.stop()}},e,this)})),function(e){return p.apply(this,arguments)});r.checkPriority=P,r.db=S,r.logProxy=T,r.dispatchEvents=L,r.stopQueue=E,r.fireJobInlineEvent=A,r.successProcess=C,r.updateRetry=M,r.loopHandler=q,r.statusOff=function(){this.running=!1};var w=_(e("./queue")),x=(_(e("./channel")),_(e("./storage-capsule")),e("./utils")),k=e("./console");function _(e){return e&&e.__esModule?e:{default:e}}function O(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}function j(e){return function(){var u=e.apply(this,arguments);return new Promise(function(i,a){return function t(e,r){try{var n=u[e](r),o=n.value}catch(e){return void a(e)}if(!n.done)return Promise.resolve(o).then(function(e){t("next",e)},function(e){t("throw",e)});i(o)}("next")})}}function P(e){return e.priority=e.priority||0,"number"!=typeof e.priority&&(e.priority=0),e}function S(){return this.storage.channel(this.name())}function T(e){if(this.config.get("debug")&&"function"==typeof e){for(var t=arguments.length,r=Array(1<t?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];e(r)}}function L(t,e){var r=this;return"tag"in t&&([[t.tag+":"+e,"fired"],[t.tag+":*","wildcard-fired"]].forEach(function(e){r.event.emit(e[0],t),T.call.apply(T,[r,k.eventFiredLog].concat(O(e)))}),!0)}function E(){this.stop(),this.running=!1,clearTimeout(this.currentTimeout),T.call(this,k.queueStoppedLog,"stop")}function A(e,t,r){return!(!(0,x.hasMethod)(t,e)||!(0,x.isFunction)(t[e]))&&(t[e].call(t,r),!0)}function C(e){y.call(this,e._id)}function M(e,t){return"retry"in t||(t.retry=1),"tried"in e||(e.tried=0,e.retry=t.retry),e.tried+=1,e.tried>=t.retry&&(e.freezed=!0),e}function q(a,u,c){return e=j(h.default.mark(function e(){var t,r,n,o,i;return h.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=void 0,r=this,e.next=4,g.call(r,a);case 4:return A.call(this,"before",c,a.args),L.call(this,a,"before"),n=w.default.workerDeps[a.handler],o=Object.values(n||{}),T.call(this,k.workerRunninLog,u,c,a,r.name(),w.default.workerDeps),c instanceof Worker?(c.postMessage({args:a.args,dependencies:o}),t=new Promise(function(t){c.onmessage=function(e){t(u.handler(e)),c.terminate()}})):t=(i=c.handle).call.apply(i,[c,a.args].concat(O(o))),e.t1=t,e.next=13,m.call(r,a,c);case 13:return e.t2=r,e.t3=e.sent.bind(e.t2),e.t0=e.t1.then.call(e.t1,e.t3),e.next=18,v.call(r,a);case 18:e.t4=r,e.t5=e.sent.bind(e.t4),e.t0.catch.call(e.t0,e.t5);case 21:case"end":return e.stop()}},e,this)})),function(){return e.apply(this,arguments)};var e}},{"./channel":13,"./console":15,"./queue":22,"./storage-capsule":23,"./utils":24,"babel-runtime/regenerator":1}],21:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),e("pseudo-worker/polyfill");var n,o=e("./queue"),i=(n=o)&&n.__esModule?n:{default:n};"undefined"!=typeof window&&(window.Queue=i.default),r.default=i.default},{"./queue":22,"pseudo-worker/polyfill":6}],22:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e};r.default=c;var o=u(e("./channel")),i=u(e("./container")),a=u(e("./config"));function u(e){return e&&e.__esModule?e:{default:e}}function c(e){this.config=new a.default(e)}c.FIFO="fifo",c.LIFO="lifo",c.drivers={},c.workerDeps={},c.worker=new i.default,c.prototype.container=new i.default,c.prototype.create=function(e){return this.container.has(e)||this.container.bind(e,new o.default(e,this.config)),this.container.get(e)},c.prototype.channel=function(e){if(!this.container.has(e))throw new Error('"'+e+'" channel not found');return this.container.get(e)},c.prototype.setTimeout=function(e){this.config.set("timeout",e)},c.prototype.setLimit=function(e){this.config.set("limit",e)},c.prototype.setPrefix=function(e){this.config.set("prefix",e)},c.prototype.setPrinciple=function(e){this.config.set("principle",e)},c.prototype.setDebug=function(e){this.config.set("debug",e)},c.prototype.setStorage=function(e){this.config.set("storage",e)},c.workers=function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};if(!(e instanceof Object))throw new Error("The parameters should be object.");c.worker.merge(e)},c.deps=function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};if(!(e instanceof Object))throw new Error("The parameters should be object.");c.workerDeps=e},c.use=function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};c.drivers=n({},c.drivers,e)}},{"./channel":13,"./config":14,"./container":16}],23:[function(e,t,r){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};Object.defineProperty(r,"__esModule",{value:!0});var c=o(e("babel-runtime/regenerator")),s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},f="function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?function(e){return void 0===e?"undefined":n(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":void 0===e?"undefined":n(e)},l=function(){function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}}(),p=o(e("group-by")),h=e("./adapters"),d=e("./utils");function o(e){return e&&e.__esModule?e:{default:e}}function y(e){return function(){var u=e.apply(this,arguments);return new Promise(function(i,a){return function t(e,r){try{var n=u[e](r),o=n.value}catch(e){return void a(e)}if(!n.done)return Promise.resolve(o).then(function(e){t("next",e)},function(e){t("throw",e)});i(o)}("next")})}}var i=function(){function r(e,t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,r),this.config=e,this.storage=this.initialize(t)}var t,e,n,o,i,a,u;return l(r,[{key:"initialize",value:function(e){return"object"===(void 0===e?"undefined":f(e))?e:"function"==typeof e?new e(this.config):"localstorage"===this.config.get("storage")?new h.LocalStorageAdapter(this.config):new h.InMemoryAdapter(this.config)}},{key:"channel",value:function(e){return this.storageChannel=e,this}},{key:"fetch",value:(u=y(c.default.mark(function e(){var t,r;return c.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.all();case 2:return e.t0=d.excludeSpecificTasks,t=e.sent.filter(e.t0),r=(0,p.default)(t,"priority"),e.abrupt("return",Object.keys(r).map(function(e){return parseInt(e,10)}).sort(function(e,t){return t-e}).reduce(this.reduceTasks(r),[]));case 6:case"end":return e.stop()}},e,this)})),function(){return u.apply(this,arguments)})},{key:"save",value:(a=y(c.default.mark(function e(t){var r,n;return c.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("object"===(void 0===t?"undefined":f(t))){e.next=2;break}return e.abrupt("return",!1);case 2:return e.next=4,this.storage.get(this.storageChannel);case 4:return r=e.sent,e.next=7,this.isExceeded();case 7:if(!e.sent){e.next=10;break}return console.warn("Task limit exceeded: The '"+this.storageChannel+"' channel limit is "+this.config.get("limit")),e.abrupt("return",!1);case 10:return n=this.prepareTask(t),r.push(n),e.next=14,this.storage.set(this.storageChannel,r);case 14:return e.abrupt("return",n._id);case 15:case"end":return e.stop()}},e,this)})),function(e){return a.apply(this,arguments)})},{key:"update",value:(i=y(c.default.mark(function e(t,r){var n,o;return c.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.all();case 2:if(n=e.sent,!((o=n.findIndex(function(e){return e._id===t}))<0)){e.next=6;break}return e.abrupt("return",!1);case 6:return n[o]=Object.assign({},n[o],r),e.next=9,this.storage.set(this.storageChannel,n);case 9:return e.abrupt("return",!0);case 10:case"end":return e.stop()}},e,this)})),function(e,t){return i.apply(this,arguments)})},{key:"delete",value:(o=y(c.default.mark(function e(t){var r,n;return c.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.all();case 2:if(r=e.sent,!((n=r.findIndex(function(e){return e._id===t}))<0)){e.next=6;break}return e.abrupt("return",!1);case 6:return delete r[n],e.next=9,this.storage.set(this.storageChannel,r.filter(function(e){return e}));case 9:return e.abrupt("return",!0);case 10:case"end":return e.stop()}},e,this)})),function(e){return o.apply(this,arguments)})},{key:"all",value:(n=y(c.default.mark(function e(){var t;return c.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.storage.get(this.storageChannel);case 2:return t=e.sent,e.abrupt("return",t);case 4:case"end":return e.stop()}},e,this)})),function(){return n.apply(this,arguments)})},{key:"generateId",value:function(){return(65536*(1+Math.random())).toString(16)}},{key:"prepareTask",value:function(e){var t=s({},e);return t.createdAt=Date.now(),t._id=this.generateId(),t}},{key:"reduceTasks",value:function(r){var n=this;return function(e,t){return"lifo"===n.config.get("principle")?e.concat(r[t].sort(d.lifo)):e.concat(r[t].sort(d.fifo))}.bind(this)}},{key:"isExceeded",value:(e=y(c.default.mark(function e(){var t,r;return c.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=this.config.get("limit"),e.next=3,this.all();case 3:return e.t0=d.excludeSpecificTasks,r=e.sent.filter(e.t0),e.abrupt("return",!(-1===t||t>r.length));case 6:case"end":return e.stop()}},e,this)})),function(){return e.apply(this,arguments)})},{key:"clear",value:(t=y(c.default.mark(function e(t){return c.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.storage.clear(t);case 2:case"end":return e.stop()}},e,this)})),function(e){return t.apply(this,arguments)})}]),r}();r.default=i},{"./adapters":10,"./utils":24,"babel-runtime/regenerator":1,"group-by":3}],24:[function(e,t,r){"use strict";function n(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function o(t){var e=Array.isArray(this)?this:["freezed","locked"],r=[];return e.forEach(function(e){r.push(!1===n(t,e)||!1===t[e])}),!(-1<r.indexOf(!1))}Object.defineProperty(r,"__esModule",{value:!0}),r.hasProperty=n,r.hasMethod=function(e,t){return e instanceof Object&&t in e},r.isFunction=function(e){return e instanceof Function},r.excludeSpecificTasks=o,r.utilClearByTag=function(e){if(!o.call(["locked"],e))return!1;return e.tag===this},r.fifo=function(e,t){return e.createdAt-t.createdAt},r.lifo=function(e,t){return t.createdAt-e.createdAt}},{}]},{},[21]);

@@ -199,2 +199,4 @@ function _asyncToGenerator(fn) {

this.running = false;
clearTimeout(this.currentTimeout);

@@ -201,0 +203,0 @@

{
"name": "storage-based-queue",
"version": "1.2.4",
"description":
"Simple client queue mechanism. Create it and run asynchronously with worker class in browser.",
"version": "1.2.5",
"description": "Simple client queue mechanism. Create it and run asynchronously with worker class in browser.",
"homepage": "https://github.com/atayahmet/storage-based-queue",

@@ -67,3 +66,5 @@ "main": "lib/index.js",

{
"presets": ["es2015"]
"presets": [
"es2015"
]
}

@@ -70,0 +71,0 @@ ]

@@ -143,2 +143,4 @@ /* @flow */

this.running = false;
clearTimeout(this.currentTimeout);

@@ -145,0 +147,0 @@

@@ -40,7 +40,17 @@ import Config from '../src/config';

it('should return channel status, ->status()', async () => {
const channel = new Channel('channe-status', config);
it('should return channel status, ->status()', async (done) => {
const channel = new Channel('channe-status', config);
expect(channel.status()).toBeFalsy();
expect(await channel.start()).toBeTruthy();
expect(channel.status()).toBeTruthy();
channel.forceStop();
expect(channel.status()).toBeFalsy();
await channel.start();
channel.stop();
channel.next();
setTimeout(() => {
expect(channel.status()).toBeFalsy();
done();
}, defaultTimeout + 1);
});

@@ -47,0 +57,0 @@

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc