New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

arch-stream

Package Overview
Dependencies
Maintainers
1
Versions
108
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

arch-stream - npm Package Compare versions

Comparing version 0.0.88 to 0.0.89

4

dist/arch-stream.min.js

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

/*! arch-stream v0.0.88 https://github.com/falsandtru/arch-stream | (c) 2015, falsandtru | MIT License (https://opensource.org/licenses/MIT) */
define="function"==typeof define&&define.amd?define:function(){"use strict";var t="arch-stream",e={};return function r(i,n,o){return o?void o.apply(this,n.map(function(t){switch(t){case"require":return"function"==typeof require?require:void 0;case"exports":return-1===i.indexOf("/")?e[i]="undefined"==typeof exports?self[i]=self[i]||{}:exports:e[i]=e.hasOwnProperty(i)?e[i]:{};default:return".d"===t.slice(-2)&&{}||e.hasOwnProperty(t)&&e[t]||"function"==typeof require&&require(t)||self[t]}})):void r(t,i,n)}}();var __extends=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)};define("src/lib/thenable",["require","exports"],function(t,e){"use strict";function r(t){return!!t&&"object"==typeof t&&void 0!==t.then}e.isThenable=r}),define("src/lib/tick",["require","exports"],function(t,e){"use strict";var r;!function(t){function e(t){void n.push(t),void i()}function r(){void i(),void--o;for(var t=n.length;t-- >0;)void n.shift()()}function i(){if(0!==n.length)for(;o<s.length;)void setTimeout(r,s[o%s.length]),void++o}t.queue=e;var n=[],o=0,s=[0,4,10,20,25].reverse()}(r||(r={}));var i=Function("return typeof process === 'object' && typeof window !== 'object'")();e.Tick=i?Function("return fn => process.nextTick(fn)")():r.queue}),define("src/lib/message",["require","exports","src/lib/thenable","src/lib/tick"],function(t,e,r,i){"use strict";function n(t){return t}var o=Object.create(null),s=function(){function t(t,e){void 0===e&&(e=n),this.parent=t,this.listener=e,this.memory_=o,this.collection_=[],this.transform_=!1,this.listeners_=[],t&&(this.parent.child_=this)}return t.prototype.root=function(){return this.parent?this.parent.root():this},t.prototype.collect_=function(){if(this.collection_.length>0)return this.collection_;var t=this,e=[];do void e.push(t);while(t=t.child_);return this.collection_=e},t.prototype.transport_=function(t,e){function i(t,i,c){function u(t){o=!0,i=c?t:i,s&&n.child_&&void n.child_.send(i,e)}return t.every(function(t){n=t,n.memory_=i;var e=n.listener(n.memory_);return r.isThenable(e)?(o=!1,void e.then(u,u),o):(i=c?e:i,!0)})}var n,o=!1,s=!1,c=i(this.collect_(),t,this.transform_);s=!0,c&&"function"==typeof e&&void e(t)},t.prototype.clone=function(){function e(r){return r.parent?new t(e(r.parent),r.listener):new t(void 0,r.listener)}return e(this)},t.prototype.connect=function(t){return this.parent.child_=t,t.parent=this.parent,this},t.prototype.send=function(t,e,r){var n=this;switch(!0){case"function"==typeof e:return this.send(t,!1,e);case e===!0:return void i.Tick(function(){return n.transport_(t,r)}),this;case e===!1:default:return void this.transport_(t,r),this}},t.prototype.recv=function(e){var r=new t(this);return this.listener=e,this.collection_=[],this.memory_!==o&&void this.send(this.memory_),r},t.prototype.trans=function(t){return this.transform_=!0,this.recv(t)},t.prototype.then=function(e,r){var i=this,o=new t;return this.child_=void 0,this.listener=n,this.listeners_.push(o),this.trans(function(t){var e=i.listeners_;i.listeners_=[],function r(){try{for(;e.length>0;)e.shift().send(t)}catch(i){void console.error(i,i+""),void r()}}()}),o.trans(e||n)},t}();e.Message=s}),define("src/lib/throttle",["require","exports"],function(t,e){"use strict";var r=function(){function t(){this.queue_=[],this.processing_=[],this.limit_=1/0,this.volume_=1/0}return t.prototype.isDrainable_=function(){return this.processing_.length<this.volume_},t.prototype.discharger_=function(t,e){},t.prototype.flow=function(t,e,r){void 0===e&&(e=1/0),void 0===r&&(r=function(){}),this.volume_=t,this.limit_=e,this.discharger_=r},t.prototype.enqueue=function(t){if(this.isDrainable_())return void this.processing_.push(t),void this.resolver_(t),!0;this.queue_.push(t);do void this.discharger_(this.queue_,this.processing_);while(this.processing_.length+this.queue_.length>this.limit_);return!1},t.prototype.dequeue=function(t){var e=this.processing_.indexOf(t);e>0?void this.processing_.splice(e,1):void this.processing_.shift(),this.queue_.length>0&&this.isDrainable_()&&void this.enqueue(this.queue_.shift())},t.prototype.register=function(t){this.resolver_=t},t}();Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=r}),define("src/lib/noop",["require","exports"],function(t,e){"use strict";function r(){}e.noop=r}),define("src/stream/modular",["require","exports","src/lib/throttle","src/lib/tick","src/lib/noop"],function(t,e,r,i,n){"use strict";var o=function(){function t(t,e,r){var n=this;void 0===e&&(e=1),this.procs=t,this.count=e,this.branched=r,this.read=this.read.bind(this),this.write=this.write.bind(this),void i.Tick(function(t){return 0<n.count&&n.count<1/0&&n.throwCountDeprivedError()})}return t.prototype.compose_=function(){this.last_=this.procs.map(function(t){return t.clone()}).reduce(function(t,e){return t.connect(e.root())&&e}),this.first_=this.last_.root()},t.prototype.wrap=function(t){function e(e){return function(r){return t(r,e)}}void this.compose_();var r=this.last_;do r=r.parent,r.listener=e(r.listener);while(r.parent);return this.procs=[this.last_],this},t.prototype.read_=function(t){void--this.count,this.count<0&&void this.throwCountExceededError(),void this.compose_(),void this.last_.recv(t)},t.prototype.read=function(t){var e=this;void 0===t&&(t=n.noop);var r=!1;return void this.read_(function(n){e.flow_&&void i.Tick(function(){return void e.flow_.dequeue(n)}),r&&void t(n)}),r=!0,this},t.prototype.write_=function(t,e){void this.first_.send(t,e)},t.prototype.write=function(t,e){return this.flow_?void this.flow_.enqueue(t):void this.write_(t,e),this},t.prototype.flow=function(t,e,i){var n=this;return void 0===e&&(e=1/0),this.flow_=new r["default"],void this.flow_.flow(t,e,i),void this.flow_.register(function(t){return n.write_(t)}),this},t.prototype.throwCountExceededError=function(){throw new Error("ArchStream: Import and read counts are exeeded.")},t.prototype.throwCountDeprivedError=function(){throw this.count=0,new Error("ArchStream: Import and read counts are not deprived.")},t}();e.ModularStream=o}),define("src/stream/compose",["require","exports","src/stream/modular"],function(t,e,r){"use strict";var i=function(){function t(t){this.extract_=t,this.procs_=[],this.branched_=0}return t.prototype.register=function(t){var e=this.procs_.length;return void t.reduceRight(function(t,r,i){return t[i+e]=r,t},this.procs_),this},t.prototype["import"]=function(e,r){var i=this;return void this.throwErrorIfNotImportable_(e,r),r&&(e=(new t)["import"](e)["export"]().wrap(function(t,e){return i.extract_(t)instanceof r?e(t):0})),void--e.count,e.count<0&&void e.throwCountExceededError(),void this.register(e.procs),this},t.prototype["export"]=function(t){return new r.ModularStream(this.procs_,t,this.branched_)},t.prototype.throwErrorIfNotImportable_=function(t,e){e?((t.branched>0||this.branched_>1)&&(void--t.count,void this.throwConditionalImportError()),this.branched_=1):(t.branched>0&&this.branched_>0&&(void--t.count,void this.throwConditionalImportError()),this.branched_=t.branched>0?t.branched+1:t.branched)},t.prototype.throwConditionalImportError=function(){throw new Error("ArchStream: Conditional import cannot call from different streams.")},t}();e.ComposeStream=i}),define("src/stream/transform",["require","exports","src/lib/message","src/stream/compose","src/stream/modular"],function(t,e,r,i,n){"use strict";var o=function(){function t(t,e){var i=this;void 0===e&&(e=new r.Message),this.parent_=t,this.message_=e,this.proxies_=[],this.parent_&&void this.parent_.proxies_.reduce(function(t,e){return i.proxy(function(){return e})},void 0)}return t.prototype.pipe=function(e){return new t(this,this.message_.recv(e))},t.prototype["import"]=function(t,e){return t instanceof n.ModularStream?(new i.ComposeStream)["import"](t,e):new i.ComposeStream(t)},t.prototype["export"]=function(t){return(new i.ComposeStream).register([this.message_])["export"](t)},t.prototype.proxy=function(e){function r(e,i,n){function o(t){return Array.isArray(t)?t:[t]}var s=e.proxies_.filter(function(t){return"function"==typeof t[i]}).reduce(function(t,e){return o(e[i].apply(void 0,t)||t)},n),c="pipe";switch(i){case c:return t.prototype[i].call(e,s[0]);case"import":throw new Error("ArchStream: `import` method cannot extend by proxy.");case"export":return(u=t.prototype[i]).call.apply(u,[r(e,c,s)].concat(n));default:return r(e,c,s)}var u}var i=this,n="function"==typeof e?e():e;return this.proxies_.push(n),void Object.keys(n).filter(function(t){return t.length>0&&"_"!==t[0]&&"_"!==t[t.length-1]}).filter(function(t){return"function"==typeof n[t]}).reduce(function(t,e){return i[e]=function(){for(var t=[],n=0;n<arguments.length;n++)t[n-0]=arguments[n];return r(i,e,t)}},void 0),this},t}();e.ArchStream=o}),define("src/proxy/case",["require","exports"],function(t,e){"use strict";function r(t,e){function r(){for(var t=[],r=0;r<arguments.length;r++)t[r-0]=arguments[r];return function(r){var n=+i[e(r)+""];n>-1&&n<t.length&&t[n](r)}}var i=Object.create(null);return void t.reduce(function(t,e,r){return i[e+""]=r},void 0),function(t){return{pipe:r}}}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=r}),define("src/proxy/hook",["require","exports","src/lib/noop"],function(t,e,r){"use strict";function i(t){function e(){for(var t=[],e=0;e<arguments.length;e++)t[e-0]=arguments[e];return t.map(function(t){return function(e){n(e),t(e),s(e)}})}var i=t.pre,n=void 0===i?r.noop:i,o=t.post,s=void 0===o?r.noop:o;return function(t){return{pipe:e}}}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=i}),define("src/proxy/responsibility",["require","exports","src/lib/noop"],function(t,e,r){"use strict";function i(){function t(t,i){return e.pipe=function(){for(var e=[],r=0;r<arguments.length;r++)e[r-0]=arguments[r];return e.map(function(e){return function(r){if(!(i(r)instanceof t))throw TypeError("ArchStream: ResponsibilityProxy: Uncovered internal entity.\n "+i(r).constructor);e(r)}})},e["export"]=function(){return function(e){i(e)instanceof t&&void Object.freeze(i(e))}},r.noop}var e;return function(r){return e={rule:t}}}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=i}),define("src/lib/proxy",["require","exports","src/proxy/case","src/proxy/hook","src/proxy/responsibility"],function(t,e,r,i,n){"use strict";e.Proxy={Case:r["default"],Hook:i["default"],Responsibility:n["default"]}}),define("src/lib/concat",["require","exports"],function(t,e){"use strict";function r(t,e){for(var r=0,i=e.length,n=t.length;i>r;++r)t[r+n]=e[r];return t}e.concat=r}),define("src/lib/observable",["require","exports","src/lib/concat"],function(t,e,r){"use strict";var i=function(){function t(){this.node_={parent:void 0,childrenMap:Object.create(null),childrenList:[],registers:[]}}return t.prototype.monitor=function(t,e,r){var i=this;return void 0===r&&(r=e),void this.throwTypeErrorIfInvalidSubscriber_(e,t),void this.seekNode_(t).registers.push([t,r,!0,e]),function(){return i.off(t,r)}},t.prototype.on=function(t,e,r){var i=this;return void 0===r&&(r=e),void this.throwTypeErrorIfInvalidSubscriber_(e,t),void this.seekNode_(t).registers.push([t,r,!1,function(t){return e(t)}]),function(){return i.off(t,r)}},t.prototype.off=function(t,e){switch(typeof e){case"function":return void void this.seekNode_(t).registers.some(function(t,r,i){var n=t[1];if(e!==n)return!1;switch(r){case 0:return!void i.shift();case i.length-1:return!void i.pop();default:return!void i.splice(r,1)}});case"undefined":var r=this.seekNode_(t);return r.childrenMap=Object.create(null),r.childrenList=[],void(r.registers=[]);default:throw this.throwTypeErrorIfInvalidSubscriber_(e,t)}},t.prototype.once=function(t,e){var r=this;return void this.throwTypeErrorIfInvalidSubscriber_(e,t),this.on(t,function(i){return void r.off(t,e),e(i)},e)},t.prototype.emit=function(t,e,r){void this.drain_(t,e,r)},t.prototype.reflect=function(t,e){var r;return void this.emit(t,e,function(t,e){return r=e}),r},t.prototype.drain_=function(t,e,r){var i=[];if(void this.refsBelow_(this.seekNode_(t)).reduce(function(t,n){var o=n[2],s=n[3];if(!o)try{var c=s(e);r&&(i[i.length]=c)}catch(u){void 0!==u&&null!==u&&void console.error(u,u+"")}},void 0),void this.refsAbove_(this.seekNode_(t)).reduce(function(t,r){var i=r[2],n=r[3];if(i)try{void n(e)}catch(o){void 0!==o&&null!==o&&void console.error(o,o+"")}},void 0),r)try{void r(e,i)}catch(n){void console.error(n,n+"")}},t.prototype.refs=function(t){return this.refsBelow_(this.seekNode_(t))},t.prototype.refsAbove_=function(t){var e=t.parent,i=t.registers;for(i=r.concat([],i);e;)i=r.concat(i,e.registers),e=e.parent;return i},t.prototype.refsBelow_=function(t){var e=t.childrenList,i=t.childrenMap,n=t.registers;n=r.concat([],n);for(var o=0;o<e.length;++o){var s=e[o],c=this.refsBelow_(i[s]);n=r.concat(n,c),0===c.length&&(delete i[s],void e.splice(e.indexOf(s),1),void--o)}return n},t.prototype.seekNode_=function(t){for(var e=this.node_,r=0,i=t;r<i.length;r++){var n=i[r],o=e.childrenMap;o[n+""]||(void e.childrenList.push(n+""),e.childrenList=e.childrenList.sort(),o[n+""]={parent:e,childrenMap:Object.create(null),childrenList:[],registers:[]}),e=o[n+""]}return e},t.prototype.throwTypeErrorIfInvalidSubscriber_=function(t,e){switch(typeof t){case"function":return;default:throw new TypeError("ArchStream: Observable: Invalid subscriber.\n "+t)}},t}();e.Observable=i}),define("src/lib/fingerprint",["require","exports"],function(t,e){"use strict";function r(){return n(o([s(window.navigator),s(window.screen),s((new Date).getTimezoneOffset())].join()))}function i(){return n(o([s(process)].join()))}function n(t){return t.split("").reduce(function(t,e,r){return(+e*r+t)%1e9||t-+e},0)}function o(t){return t.split("").map(function(t){return t.charCodeAt(0)}).join("")}function s(t,e){if(void 0===e&&(e=5),e>0&&t&&"object"==typeof t){var r="{";for(var i in t)r+='"'+i+'": '+s(t[i],e-1)+",";return r+="}"}return!t||t.toString?'"'+t+'"':'"'+Object.prototype.toString.call(t)+'"'}e.FINGERPRINT="object"==typeof window?r():i(),e.browser=r,e.server=i,e.hash=n,e.str2digit=o,e.stringify=s}),define("src/lib/uuid",["require","exports","src/lib/fingerprint"],function(t,e,r){"use strict";function i(){var t=s=s*Date.now()%1e15;if(16>t||t>1e15)throw new Error("ArchStream: uuid: Invalid uuid dynamic seed.");return o.map(function(e){if("x"!==e&&"y"!==e)return e;var r=Math.random()*t%16|0,i="x"==e?r:3&r|8;return i.toString(16)}).join("").toLowerCase()}var n=r.FINGERPRINT*Date.now()%1e15;if(!n||"number"!=typeof n||100>n||n>1e15)throw new Error("ArchStream: uuid: Invalid uuid static seed.\n "+r.FINGERPRINT);var o="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".split(""),s=n;e.v4=i}),define("src/lib/map",["require","exports","src/lib/uuid"],function(t,e,r){"use strict";function i(t,e){return e?0===t.length?"":"_"+t.join(o):t+""}function n(t,e,r){return void 0===r&&(r=""),e?""===t?[]:t.slice(1).split(o).map(function(t){return"number"===r?+t:t}):"number"===r?+t:t}var o=""+r.v4(),s=function(){function t(){this.map_=Object.create(null),this.type_="",void this.reset_()}return t.prototype.get=function(t){return this.map_[i(t,this.multiKey_)]},t.prototype.set=function(t,e){return void 0===this.multiKey_&&(this.multiKey_=Array.isArray(t)),this.type_||(this.multiKey_?t.length>0&&(this.type_=typeof t[0]):this.type_=typeof t),void this.reset_(),this.map_[i(t,this.multiKey_)]=e},t.prototype.has=function(t){return!!this.map_[i(t,this.multiKey_)]||i(t,this.multiKey_)in this.map_},t.prototype["delete"]=function(t){return void this.reset_(),delete this.map_[i(t,this.multiKey_)],this},t.prototype.clear=function(){return void this.reset_(),this.map_=Object.create(null),this},t.prototype.reset_=function(){this.size_=NaN,this.entries_=void 0},Object.defineProperty(t.prototype,"size",{get:function(){return this.size_>=0?this.size_:this.size_=Object.keys(this.map_).length},enumerable:!0,configurable:!0}),t.prototype.entries=function(){var t=this;return this.entries_?this.entries_:this.entries_=Object.keys(this.map_).map(function(e){return[n(e,t.multiKey_,t.type_),t.get(n(e,t.multiKey_,t.type_))]})},t}();e.Map=s;var c=function(t){function e(){t.apply(this,arguments)}return __extends(e,t),e}(s);e.MultiMap=c}),define("src/lib/set",["require","exports","src/lib/map"],function(t,e,r){"use strict";var i=function(t){function e(e){t.call(this),this.replacer_=e}return __extends(e,t),e.prototype.add=function(t,e){if(!this.has(t))return this.set(t,e);if(!this.replacer_)throw new Error("Cannot overwrite value of set without replacer.");return this.set(t,this.replacer_(this.get(t),e))},e}(r.Map);e.Set=i;var n=function(t){function e(){t.apply(this,arguments)}return __extends(e,t),e}(i);e.MultiSet=n}),define("src/lib/supervisor",["require","exports","src/lib/observable","src/lib/set","src/lib/tick","src/lib/thenable","src/lib/concat","src/lib/noop"],function(t,e,r,i,n,o,s,c){"use strict";function u(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(var r=0;r<t.length;++r)if(t[r]!==e[r])return!1;return!0}var a=function(){function t(t){var e=this,n=void 0===t?{}:t,o=n.name,s=void 0===o?"anonymous":o,u=n.dependencies,a=void 0===u?[]:u,h=n.retry,p=void 0===h?!1:h,d=n.timeout,f=void 0===d?0:d,l=n.destructor,v=void 0===l?c.noop:l;this.deps=new i.MultiSet,this.events={exec:new r.Observable,fail:new r.Observable,loss:new r.Observable,exit:new r.Observable},this.procs=new r.Observable,this.alive=!0,this.registerable=!0,this.scheduled=!1,this.workerSharedResource={procs:this.procs,resolvedDependencies:[],rejectedDependencies:[],dependenciesStack:[]},this.queue=[],this.name=s,void a.reduce(function(t,r){var i=r[0],n=r[1];return void e.deps.set(i,n)},void 0),this.retry=p,this.timeout=f,this.destructor_=v,void++this.constructor.count}return t.prototype.destructor=function(t){for(void this.checkState(),this.alive=!1;this.queue.length>0;){var e=this.queue.shift(),r=e[0],i=e[1];void this.events.loss.emit(r,[r,void 0,i])}try{void this.destructor_(t)}catch(n){void console.error(n,n+"")}void--this.constructor.count,void Object.freeze(this)},t.prototype.schedule=function(){var t=this;this.scheduled||(void n.Tick(function(e){t.alive&&(t.scheduled=!1,void t.drain())}),this.scheduled=!0)},t.prototype.register=function(t,e,r){if(void this.checkState(),!this.registerable)throw new Error("ArchStream: Supervisor: Supervisor "+this.name+" cannot register process during the exiting.");return t=s.concat([],t),void this.schedule(),new l(this,this.workerSharedResource,t,e,r,this.deps.get(t)||[]).terminate},t.prototype.call=function(t,e,r,i){var n=this;void 0===r&&(r=this.timeout),void this.checkState(),t=s.concat([],t),void this.queue.push([t,e,i,r,Date.now()]),void this.schedule(),r>0&&void setTimeout(function(){return n.drain(t)},r+9)},t.prototype.cast=function(t,e,r){void 0===r&&(r=this.retry);var i=this.procs.reflect(t,new d(e));return 0===i.length&&void this.events.fail.emit(t,[t,void 0,e]),i.length>0||!r?i:this.cast(t,e,!1)},t.prototype.refs=function(t){return this.procs.refs(t).map(function(t){var e=(t[0],t[1]),r=e(void 0);return[r.namespace,r.process,r.terminate]})},t.prototype.terminate=function(t,e){void this.checkState(),void 0===t&&(this.registerable=!1),void this.procs.emit(t||[],new f(e)),void this.procs.off(t||[]),void 0===t&&void this.destructor(e)},t.prototype.checkState=function(){if(!this.alive)throw new Error("ArchStream: Supervisor: Supervisor "+this.name+" already exited.")},t.prototype.drain=function(t){if(void 0===t&&(t=[]),this.alive)for(var e,r=Date.now(),i=function(i){var o=n.queue[i],s=o[0],c=o[1],u=o[2],a=o[3],h=o[4],p=t.every(function(t,e){return t===s[e]})?n.procs.reflect(s,new d(c)):[];if(0===p.length&&void n.events.fail.emit(s,[s,void 0,c]),0===p.length&&h+a>r)return e=i,"continue";if(0===i?void n.queue.shift():void n.queue.splice(i,1),void--i,0===p.length&&void n.events.loss.emit(s,[s,void 0,c]),!u)return e=i,"continue";try{void u(c,p)}catch(f){void console.error(f,f+"")}e=i},n=this,o=0;o<this.queue.length;++o)i(o),o=e},t.count=0,t.procs=0,t}();e.Supervisor=a;var h=function(){function t(){}return t}(),p=function(t){function e(e){t.call(this),this.namespace=e}return __extends(e,t),e}(h),d=function(t){function e(e){t.call(this),this.data=e}return __extends(e,t),e}(h),f=function(t){function e(e){t.call(this),this.reason=e}return __extends(e,t),e}(h),l=function(){function t(e,r,i,n,o,s){var c=this;this.sv=e,this.sharedResource=r,this.namespace=i,this.process=n,this.parallel=o,this.dependencies=s,this.alive=!0,this.called=!1,this.receive=function(e){return t.prototype.receive.call(c,e)},this.terminate=function(e){return t.prototype.terminate.call(c,e)},this.sharedResource.allRefsCache=void 0,this.sharedResource.rejectedDependencies=[],void++this.sv.constructor.procs,void this.sharedResource.procs.on(i,this.receive)}return t.prototype.destructor=function(t){void this.checkState(),void this.sharedResource.procs.off(this.namespace,this.receive),this.alive=!1,void--this.sv.constructor.procs,this.sharedResource.allRefsCache=void 0,this.sharedResource.resolvedDependencies=[],void Object.freeze(this),void this.sv.events.exit.emit(this.namespace,[this.namespace,this.process,t])},t.prototype.tryDependencyResolving=function(t){if(this.receive(new p(this.namespace)))return this.sharedResource.resolvedDependencies=s.concat(this.sharedResource.resolvedDependencies,this.sharedResource.dependenciesStack),void(this.sharedResource.dependenciesStack=[]);throw this.sharedResource.rejectedDependencies=s.concat(this.sharedResource.rejectedDependencies,this.sharedResource.dependenciesStack),void(this.sharedResource.dependenciesStack=[])},t.prototype.receive=function(t){var e=this;if(void this.checkState(),void 0===t)return this;if(t instanceof p){if(t.namespace.length!==this.namespace.length)return!1;for(var r=0,i=this.sharedResource.resolvedDependencies;r<i.length;r++){var n=i[r];if(u(this.namespace,n))return!0}for(var s=0,c=this.sharedResource.rejectedDependencies;s<c.length;s++){var a=c[s];if(u(this.namespace,a))return!1}for(var h=0,l=this.sharedResource.dependenciesStack;h<l.length;h++){var v=l[h];if(u(this.namespace,v))return!0}return void this.sharedResource.dependenciesStack.push(this.namespace),this.dependencies.every(function(t){return(e.sharedResource.allRefsCache=e.sharedResource.allRefsCache||e.sharedResource.procs.refs([])).some(function(e){var r=e[0],i=e[1];return u(r,t)&&!!i(new p(t))})})}if(t instanceof d){if(this.parallel<0)throw void 0;void this.tryDependencyResolving(t),this.called||(this.called=!0,void this.sv.events.exec.emit(this.namespace,[this.namespace,this.process]));try{var y=this.process(t.data);return o.isThenable(y)&&(void--this.parallel,void y.then(function(t){return e.alive?void++e.parallel:void 0},function(t){return e.alive&&e.terminate(t)})),y}catch(_){throw void void this.terminate(_)}}if(t instanceof f)throw void void this.terminate(t.reason);throw new TypeError("ArchStream: Supervisor: Invalid command: "+t)},t.prototype.terminate=function(t){void this.destructor(t)},t.prototype.checkState=function(){if(!this.alive)throw new Error("ArchStream: Supervisor: Process "+this.namespace+"/"+this.process+" already exited.")},t}()}),define("src/lib/timer",["require","exports"],function(t,e){"use strict";function r(t){var e=t.begin,i=void 0===e?0:e,n=t.end,o=void 0===n?864e5:n,s=t.step,c=void 0===s?function(t){return 3*(t||1)}:s,u=t.precond,a=void 0===u?function(){return!0}:u,h=t.task,p=void 0===h?function(){}:h,d=t.postcond,f=void 0===d?function(){return!0}:d,l=t.complete,v=void 0===l?function(){return 0}:l,y=t.error,_=void 0===y?function(){return 0}:y,m=t.timeout,b=void 0===m?function(){return 0}:m,w=t.since,x=void 0===w?Date.now():w;i=0>i?0:i,void setTimeout(function(){try{if(a()){var t=p();if(f())return void v(t)}}catch(e){return void _(e)}var n=Date.now(),s=c(n-x);return 0>=o-(n-x)?void b():void void r({precond:a,task:p,postcond:f,complete:v,timeout:b,begin:i+s,end:o,step:c,since:x})},i)}e.Timer=r}),define("src/lib/monad",["require","exports"],function(t,e){"use strict";var r=function(){function t(t){this.thunk=t}return t.prototype.extract=function(t){return this.evaluate().extract(t)},t.prototype.evaluate=function(){return this.memory_=this.memory_||this.thunk()},t.prototype.assert=function(t){return this},t}();e.Monad=r}),define("src/lib/maybe.impl",["require","exports","src/lib/monad"],function(t,e,r){"use strict";var i=function(t){function e(e){t.call(this,e),this.thunk=e}return __extends(e,t),e.prototype.bind=function(t){var r=this;return new e(function(){var i=r.evaluate();if(i instanceof n)return t(i.extract());if(i instanceof o)return i;if(i instanceof e)return i.bind(t);throw new TypeError("ArchStream: Maybe: Invalid monad value.\n "+i)})},e.prototype.extract=function(e){return t.prototype.extract.call(this,e)},e.prototype.assert=function(t){return this},e}(r.Monad);e.Maybe=i;var n=function(t){function e(e){t.call(this),this.val_=e}return __extends(e,t),e.prototype.bind=function(t){var e=this;return new i(function(){return e}).bind(t)},e.prototype.extract=function(t){return this.val_},e.prototype.assert=function(t){return this},e}(i);e.Just=n;var o=function(t){function e(){t.apply(this,arguments)}return __extends(e,t),e.prototype.bind=function(t){return this},e.prototype.extract=function(t){if(!t)throw void 0;return t()},e.prototype.assert=function(t){return this},e}(i);e.Nothing=o}),define("src/lib/maybe",["require","exports","src/lib/maybe.impl"],function(t,e,r){"use strict";var i;!function(t){function e(t){return new r.Just(t)}t.Just=e,t.Nothing=new r.Nothing,t.Return=e}(i=e.Maybe||(e.Maybe={})),e.Just=i.Just,e.Nothing=i.Nothing,e.Return=e.Just}),define("src/lib/either.impl",["require","exports","src/lib/monad"],function(t,e,r){"use strict";var i=function(t){function e(e){t.call(this,e),this.thunk=e}return __extends(e,t),e.prototype.bind=function(t){var r=this;return new e(function(){var i=r.evaluate();if(i instanceof n)return i;if(i instanceof o)return t(i.extract());if(i instanceof e)return i.bind(t);throw new TypeError("ArchStream: Either: Invalid monad value.\n "+i)})},e.prototype.extract=function(e){return t.prototype.extract.call(this,e)},e.prototype.assert=function(t){return this},e}(r.Monad);e.Either=i;var n=function(t){function e(e){t.call(this),this.val_=e}return __extends(e,t),e.prototype.bind=function(t){return this},e.prototype.extract=function(t){if(!t)throw this.val_;return t(this.val_)},e.prototype.assert=function(t){return this},e}(i);e.Left=n;var o=function(t){function e(e){t.call(this),this.val_=e}return __extends(e,t),e.prototype.bind=function(t){var e=this;return new i(function(){return e}).bind(t)},e.prototype.extract=function(t){return this.val_},e.prototype.assert=function(t){return this},e}(i);e.Right=o}),define("src/lib/either",["require","exports","src/lib/either.impl"],function(t,e,r){"use strict";var i;!function(t){function e(t){return new r.Left(t)}function i(t){return new r.Right(t)}t.Left=e,t.Right=i,t.Return=i}(i=e.Either||(e.Either={})),e.Left=i.Left,e.Right=i.Right,e.Return=i.Return}),define("src/lib/sqid",["require","exports"],function(t,e){"use strict";function r(t){return void 0===t?(1e15+ ++i+"").slice(1):(1e15+t+"").slice(1)}var i=0;e.sqid=r}),define("src/lib/assign",["require","exports"],function(t,e){"use strict";function r(t){for(var e=[],i=1;i<arguments.length;i++)e[i-1]=arguments[i];if(void 0===t||null===t)throw new TypeError("ArchStream: assign: Cannot merge objects into "+t+".");for(var n=Object(t),o=0;o<e.length;o++){var s=e[o];if(void 0!==s&&null!==s){s=Object(s);for(var c=0,u=Object.keys(Object(s));c<u.length;c++){var a=u[c],h=Object.getOwnPropertyDescriptor(s,a);if(void 0!==h&&h.enumerable){var p=s[a];n[a];if(!p||"object"!=typeof p){n[a]=p;continue}if(Array.isArray(p)){n[a]=p.slice();continue}n[a]=r({},p)}}}}return n}e.assign=r}),define("src/lib/extend",["require","exports"],function(t,e){"use strict";function r(t){for(var e=[],i=1;i<arguments.length;i++)e[i-1]=arguments[i];if(void 0===t||null===t)throw new TypeError("ArchStream: extend: Cannot merge objects into "+t+".");for(var n=Object(t),o=0;o<e.length;o++){var s=e[o];if(void 0!==s&&null!==s){s=Object(s);for(var c=0,u=Object.keys(Object(s));c<u.length;c++){var a=u[c],h=Object.getOwnPropertyDescriptor(s,a);if(void 0!==h&&h.enumerable){var p=s[a],d=n[a];if(!p||"object"!=typeof p){n[a]=p;continue}if(Array.isArray(p)){n[a]=p.slice();continue}if(d&&p&&"object"==typeof d&&!Array.isArray(d)){n[a]=r(d,p);continue}n[a]=r({},p)}}}}return n}e.extend=r}),define("src/export",["require","exports","src/stream/transform","src/lib/message","src/lib/proxy","src/lib/proxy","src/lib/supervisor","src/lib/observable","src/lib/map","src/lib/set","src/lib/tick","src/lib/timer","src/lib/maybe","src/lib/either","src/lib/fingerprint","src/lib/uuid","src/lib/sqid","src/lib/assign","src/lib/extend","src/lib/concat","./typings/arch-stream.d"],function(t,e,r,i,n,o,s,c,u,a,h,p,d,f,l,v,y,_,m,b){"use strict";function w(){return new r.ArchStream}function x(){return new i.Message}e.Proxy=o.Proxy,e.Supervisor=s.Supervisor,e.Observable=c.Observable,e.Map=u.Map,e.MultiMap=u.MultiMap,e.Set=a.Set,e.MultiSet=a.MultiSet,e.Tick=h.Tick,e.Timer=p.Timer,e.Maybe=d.Maybe,e.Just=d.Just,e.Nothing=d.Nothing,e.Either=f.Either,e.Left=f.Left,e.Right=f.Right,e.FINGERPRINT=l.FINGERPRINT,e.uuid=v.v4,e.sqid=y.sqid,e.assign=_.assign,e.extend=m.extend,e.concat=b.concat;var g={Msg:x,Proxy:n.Proxy};Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=w;var w;!function(t){t.Msg=g.Msg,t.Proxy=g.Proxy}(w||(w={})),e.Msg=x}),define("arch-stream",["require","exports","src/export","src/export"],function(t,e,r,i){"use strict";function n(t){for(var r in t)e.hasOwnProperty(r)||(e[r]=t[r])}n(r),e["default"]=i["default"]});
/*! arch-stream v0.0.89 https://github.com/falsandtru/arch-stream | (c) 2015, falsandtru | MIT License (https://opensource.org/licenses/MIT) */
define="function"==typeof define&&define.amd?define:function(){"use strict";var t="arch-stream",e={};return function r(i,n,o){return o?void o.apply(this,n.map(function(t){switch(t){case"require":return"function"==typeof require?require:void 0;case"exports":return-1===i.indexOf("/")?e[i]="undefined"==typeof exports?self[i]=self[i]||{}:exports:e[i]=e.hasOwnProperty(i)?e[i]:{};default:return".d"===t.slice(-2)&&{}||e.hasOwnProperty(t)&&e[t]||"function"==typeof require&&require(t)||self[t]}})):void r(t,i,n)}}();var __extends=this&&this.__extends||function(t,e){function r(){this.constructor=t}for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i]);t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)};define("src/lib/thenable",["require","exports"],function(t,e){"use strict";function r(t){return!!t&&"object"==typeof t&&void 0!==t.then}e.isThenable=r}),define("src/lib/tick",["require","exports"],function(t,e){"use strict";var r;!function(t){function e(t){void n.push(t),void i()}function r(){void i(),void--o;for(var t=n.length;t-- >0;)void n.shift()()}function i(){if(0!==n.length)for(;o<s.length;)void setTimeout(r,s[o%s.length]),void++o}t.queue=e;var n=[],o=0,s=[0,4,10,20,25].reverse()}(r||(r={}));var i=Function("return typeof process === 'object' && typeof window !== 'object'")();e.Tick=i?Function("return fn => process.nextTick(fn)")():r.queue}),define("src/lib/message",["require","exports","src/lib/thenable","src/lib/tick"],function(t,e,r,i){"use strict";function n(t){return t}var o=Object.create(null),s=function(){function t(t,e){void 0===e&&(e=n),this.parent=t,this.listener=e,this.memory_=o,this.collection_=[],this.transform_=!1,this.listeners_=[],t&&(this.parent.child_=this)}return t.prototype.root=function(){return this.parent?this.parent.root():this},t.prototype.collect_=function(){if(this.collection_.length>0)return this.collection_;var t=this,e=[];do void e.push(t);while(t=t.child_);return this.collection_=e},t.prototype.transport_=function(t,e){function i(t,i,c){function u(t){o=!0,i=c?t:i,s&&n.child_&&void n.child_.send(i,e)}return t.every(function(t){n=t,n.memory_=i;var e=n.listener(n.memory_);return r.isThenable(e)?(o=!1,void e.then(u,u),o):(i=c?e:i,!0)})}var n,o=!1,s=!1,c=i(this.collect_(),t,this.transform_);s=!0,c&&"function"==typeof e&&void e(t)},t.prototype.clone=function(){function e(r){return r.parent?new t(e(r.parent),r.listener):new t(void 0,r.listener)}return e(this)},t.prototype.connect=function(t){return this.parent.child_=t,t.parent=this.parent,this},t.prototype.send=function(t,e,r){var n=this;switch(!0){case"function"==typeof e:return this.send(t,!1,e);case e===!0:return void i.Tick(function(){return n.transport_(t,r)}),this;case e===!1:default:return void this.transport_(t,r),this}},t.prototype.recv=function(e){var r=new t(this);return this.listener=e,this.collection_=[],this.memory_!==o&&void this.send(this.memory_),r},t.prototype.trans=function(t){return this.transform_=!0,this.recv(t)},t.prototype.then=function(e,r){var i=this,o=new t;return this.child_=void 0,this.listener=n,this.listeners_.push(o),this.trans(function(t){var e=i.listeners_;i.listeners_=[],function r(){try{for(;e.length>0;)e.shift().send(t)}catch(i){void console.error(i,i+""),void r()}}()}),o.trans(e||n)},t}();e.Message=s}),define("src/lib/throttle",["require","exports"],function(t,e){"use strict";var r=function(){function t(){this.queue_=[],this.processing_=[],this.limit_=1/0,this.volume_=1/0}return t.prototype.isDrainable_=function(){return this.processing_.length<this.volume_},t.prototype.discharger_=function(t,e){},t.prototype.flow=function(t,e,r){void 0===e&&(e=1/0),void 0===r&&(r=function(){}),this.volume_=t,this.limit_=e,this.discharger_=r},t.prototype.enqueue=function(t){if(this.isDrainable_())return void this.processing_.push(t),void this.resolver_(t),!0;this.queue_.push(t);do void this.discharger_(this.queue_,this.processing_);while(this.processing_.length+this.queue_.length>this.limit_);return!1},t.prototype.dequeue=function(t){var e=this.processing_.indexOf(t);e>0?void this.processing_.splice(e,1):void this.processing_.shift(),this.queue_.length>0&&this.isDrainable_()&&void this.enqueue(this.queue_.shift())},t.prototype.register=function(t){this.resolver_=t},t}();Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=r}),define("src/lib/noop",["require","exports"],function(t,e){"use strict";function r(){}e.noop=r}),define("src/stream/modular",["require","exports","src/lib/throttle","src/lib/tick","src/lib/noop"],function(t,e,r,i,n){"use strict";var o=function(){function t(t,e,r){var n=this;void 0===e&&(e=1),this.procs=t,this.count=e,this.branched=r,this.read=this.read.bind(this),this.write=this.write.bind(this),void i.Tick(function(t){return 0<n.count&&n.count<1/0&&n.throwCountDeprivedError()})}return t.prototype.compose_=function(){this.last_=this.procs.map(function(t){return t.clone()}).reduce(function(t,e){return t.connect(e.root())&&e}),this.first_=this.last_.root()},t.prototype.wrap=function(t){function e(e){return function(r){return t(r,e)}}void this.compose_();var r=this.last_;do r=r.parent,r.listener=e(r.listener);while(r.parent);return this.procs=[this.last_],this},t.prototype.read_=function(t){void--this.count,this.count<0&&void this.throwCountExceededError(),void this.compose_(),void this.last_.recv(t)},t.prototype.read=function(t){var e=this;void 0===t&&(t=n.noop);var r=!1;return void this.read_(function(n){e.flow_&&void i.Tick(function(){return void e.flow_.dequeue(n)}),r&&void t(n)}),r=!0,this},t.prototype.write_=function(t,e){void this.first_.send(t,e)},t.prototype.write=function(t,e){return this.flow_?void this.flow_.enqueue(t):void this.write_(t,e),this},t.prototype.flow=function(t,e,i){var n=this;return void 0===e&&(e=1/0),this.flow_=new r["default"],void this.flow_.flow(t,e,i),void this.flow_.register(function(t){return n.write_(t)}),this},t.prototype.throwCountExceededError=function(){throw new Error("ArchStream: Import and read counts are exeeded.")},t.prototype.throwCountDeprivedError=function(){throw this.count=0,new Error("ArchStream: Import and read counts are not deprived.")},t}();e.ModularStream=o}),define("src/stream/compose",["require","exports","src/stream/modular"],function(t,e,r){"use strict";var i=function(){function t(t){this.extract_=t,this.procs_=[],this.branched_=0}return t.prototype.register=function(t){var e=this.procs_.length;return void t.reduceRight(function(t,r,i){return t[i+e]=r,t},this.procs_),this},t.prototype["import"]=function(e,r){var i=this;return void this.throwErrorIfNotImportable_(e,r),r&&(e=(new t)["import"](e)["export"]().wrap(function(t,e){return i.extract_(t)instanceof r?e(t):0})),void--e.count,e.count<0&&void e.throwCountExceededError(),void this.register(e.procs),this},t.prototype["export"]=function(t){return new r.ModularStream(this.procs_,t,this.branched_)},t.prototype.throwErrorIfNotImportable_=function(t,e){e?((t.branched>0||this.branched_>1)&&(void--t.count,void this.throwConditionalImportError()),this.branched_=1):(t.branched>0&&this.branched_>0&&(void--t.count,void this.throwConditionalImportError()),this.branched_=t.branched>0?t.branched+1:t.branched)},t.prototype.throwConditionalImportError=function(){throw new Error("ArchStream: Conditional import cannot call from different streams.")},t}();e.ComposeStream=i}),define("src/stream/transform",["require","exports","src/lib/message","src/stream/compose","src/stream/modular"],function(t,e,r,i,n){"use strict";var o=function(){function t(t,e){var i=this;void 0===e&&(e=new r.Message),this.parent_=t,this.message_=e,this.proxies_=[],this.parent_&&void this.parent_.proxies_.reduce(function(t,e){return i.proxy(function(){return e})},void 0)}return t.prototype.pipe=function(e){return new t(this,this.message_.recv(e))},t.prototype["import"]=function(t,e){return t instanceof n.ModularStream?(new i.ComposeStream)["import"](t,e):new i.ComposeStream(t)},t.prototype["export"]=function(t){return(new i.ComposeStream).register([this.message_])["export"](t)},t.prototype.proxy=function(e){function r(e,i,n){function o(t){return Array.isArray(t)?t:[t]}var s=e.proxies_.filter(function(t){return"function"==typeof t[i]}).reduce(function(t,e){return o(e[i].apply(void 0,t)||t)},n),c="pipe";switch(i){case c:return t.prototype[i].call(e,s[0]);case"import":throw new Error("ArchStream: `import` method cannot extend by proxy.");case"export":return(u=t.prototype[i]).call.apply(u,[r(e,c,s)].concat(n));default:return r(e,c,s)}var u}var i=this,n="function"==typeof e?e():e;return this.proxies_.push(n),void Object.keys(n).filter(function(t){return t.length>0&&"_"!==t[0]&&"_"!==t[t.length-1]}).filter(function(t){return"function"==typeof n[t]}).reduce(function(t,e){return i[e]=function(){for(var t=[],n=0;n<arguments.length;n++)t[n-0]=arguments[n];return r(i,e,t)}},void 0),this},t}();e.ArchStream=o}),define("src/proxy/case",["require","exports"],function(t,e){"use strict";function r(t,e){function r(){for(var t=[],r=0;r<arguments.length;r++)t[r-0]=arguments[r];return function(r){var n=+i[e(r)+""];n>-1&&n<t.length&&t[n](r)}}var i=Object.create(null);return void t.reduce(function(t,e,r){return i[e+""]=r},void 0),function(t){return{pipe:r}}}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=r}),define("src/proxy/hook",["require","exports","src/lib/noop"],function(t,e,r){"use strict";function i(t){function e(){for(var t=[],e=0;e<arguments.length;e++)t[e-0]=arguments[e];return t.map(function(t){return function(e){n(e),t(e),s(e)}})}var i=t.pre,n=void 0===i?r.noop:i,o=t.post,s=void 0===o?r.noop:o;return function(t){return{pipe:e}}}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=i}),define("src/proxy/responsibility",["require","exports","src/lib/noop"],function(t,e,r){"use strict";function i(){function t(t,i){return e.pipe=function(){for(var e=[],r=0;r<arguments.length;r++)e[r-0]=arguments[r];return e.map(function(e){return function(r){if(!(i(r)instanceof t))throw TypeError("ArchStream: ResponsibilityProxy: Uncovered internal entity.\n "+i(r).constructor);e(r)}})},e["export"]=function(){return function(e){i(e)instanceof t&&void Object.freeze(i(e))}},r.noop}var e;return function(r){return e={rule:t}}}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=i}),define("src/lib/proxy",["require","exports","src/proxy/case","src/proxy/hook","src/proxy/responsibility"],function(t,e,r,i,n){"use strict";e.Proxy={Case:r["default"],Hook:i["default"],Responsibility:n["default"]}}),define("src/lib/concat",["require","exports"],function(t,e){"use strict";function r(t,e){for(var r=0,i=e.length,n=t.length;i>r;++r)t[r+n]=e[r];return t}e.concat=r}),define("src/lib/observable",["require","exports","src/lib/concat"],function(t,e,r){"use strict";var i=function(){function t(){this.node_={parent:void 0,childrenMap:Object.create(null),childrenList:[],registers:[]}}return t.prototype.monitor=function(t,e,r){var i=this;return void 0===r&&(r=e),void this.throwTypeErrorIfInvalidSubscriber_(e,t),void this.seekNode_(t).registers.push([t,r,!0,e]),function(){return i.off(t,r)}},t.prototype.on=function(t,e,r){var i=this;return void 0===r&&(r=e),void this.throwTypeErrorIfInvalidSubscriber_(e,t),void this.seekNode_(t).registers.push([t,r,!1,function(t){return e(t)}]),function(){return i.off(t,r)}},t.prototype.off=function(t,e){switch(typeof e){case"function":return void void this.seekNode_(t).registers.some(function(t,r,i){var n=t[1];if(e!==n)return!1;switch(r){case 0:return!void i.shift();case i.length-1:return!void i.pop();default:return!void i.splice(r,1)}});case"undefined":var r=this.seekNode_(t);return r.childrenMap=Object.create(null),r.childrenList=[],void(r.registers=[]);default:throw this.throwTypeErrorIfInvalidSubscriber_(e,t)}},t.prototype.once=function(t,e){var r=this;return void this.throwTypeErrorIfInvalidSubscriber_(e,t),this.on(t,function(i){return void r.off(t,e),e(i)},e)},t.prototype.emit=function(t,e,r){void this.drain_(t,e,r)},t.prototype.reflect=function(t,e){var r;return void this.emit(t,e,function(t,e){return r=e}),r},t.prototype.drain_=function(t,e,r){var i=[];if(void this.refsBelow_(this.seekNode_(t)).reduce(function(t,n){var o=n[2],s=n[3];if(!o)try{var c=s(e);r&&(i[i.length]=c)}catch(u){void 0!==u&&null!==u&&void console.error(u,u+"")}},void 0),void this.refsAbove_(this.seekNode_(t)).reduce(function(t,r){var i=r[2],n=r[3];if(i)try{void n(e)}catch(o){void 0!==o&&null!==o&&void console.error(o,o+"")}},void 0),r)try{void r(e,i)}catch(n){void console.error(n,n+"")}},t.prototype.refs=function(t){return this.refsBelow_(this.seekNode_(t))},t.prototype.refsAbove_=function(t){var e=t.parent,i=t.registers;for(i=r.concat([],i);e;)i=r.concat(i,e.registers),e=e.parent;return i},t.prototype.refsBelow_=function(t){var e=t.childrenList,i=t.childrenMap,n=t.registers;n=r.concat([],n);for(var o=0;o<e.length;++o){var s=e[o],c=this.refsBelow_(i[s]);n=r.concat(n,c),0===c.length&&(delete i[s],void e.splice(e.indexOf(s),1),void--o)}return n},t.prototype.seekNode_=function(t){for(var e=this.node_,r=0,i=t;r<i.length;r++){var n=i[r],o=e.childrenMap;o[n+""]||(void e.childrenList.push(n+""),e.childrenList=e.childrenList.sort(),o[n+""]={parent:e,childrenMap:Object.create(null),childrenList:[],registers:[]}),e=o[n+""]}return e},t.prototype.throwTypeErrorIfInvalidSubscriber_=function(t,e){switch(typeof t){case"function":return;default:throw new TypeError("ArchStream: Observable: Invalid subscriber.\n "+t)}},t}();e.Observable=i}),define("src/lib/fingerprint",["require","exports"],function(t,e){"use strict";function r(){return n(o([s(window.navigator),s(window.screen),s((new Date).getTimezoneOffset())].join()))}function i(){return n(o([s(process)].join()))}function n(t){return t.split("").reduce(function(t,e,r){return(+e*r+t)%1e9||t-+e},0)}function o(t){return t.split("").map(function(t){return t.charCodeAt(0)}).join("")}function s(t,e){if(void 0===e&&(e=5),e>0&&t&&"object"==typeof t){var r="{";for(var i in t)r+='"'+i+'": '+s(t[i],e-1)+",";return r+="}"}return!t||t.toString?'"'+t+'"':'"'+Object.prototype.toString.call(t)+'"'}e.FINGERPRINT="object"==typeof window?r():i(),e.browser=r,e.server=i,e.hash=n,e.str2digit=o,e.stringify=s}),define("src/lib/uuid",["require","exports","src/lib/fingerprint"],function(t,e,r){"use strict";function i(){var t=s=s*Date.now()%1e15;if(16>t||t>1e15)throw new Error("ArchStream: uuid: Invalid uuid dynamic seed.");return o.map(function(e){if("x"!==e&&"y"!==e)return e;var r=Math.random()*t%16|0,i="x"==e?r:3&r|8;return i.toString(16)}).join("").toLowerCase()}var n=r.FINGERPRINT*Date.now()%1e15;if(!n||"number"!=typeof n||100>n||n>1e15)throw new Error("ArchStream: uuid: Invalid uuid static seed.\n "+r.FINGERPRINT);var o="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".split(""),s=n;e.v4=i}),define("src/lib/map",["require","exports","src/lib/uuid"],function(t,e,r){"use strict";function i(t,e){return e?0===t.length?"":"_"+t.join(o):t+""}function n(t,e,r){return void 0===r&&(r=""),e?""===t?[]:t.slice(1).split(o).map(function(t){return"number"===r?+t:t}):"number"===r?+t:t}var o=""+r.v4(),s=function(){function t(){this.map_=Object.create(null),this.type_="",void this.reset_()}return t.prototype.get=function(t){return this.map_[i(t,this.multiKey_)]},t.prototype.set=function(t,e){return void 0===this.multiKey_&&(this.multiKey_=Array.isArray(t)),this.type_||(this.multiKey_?t.length>0&&(this.type_=typeof t[0]):this.type_=typeof t),void this.reset_(),this.map_[i(t,this.multiKey_)]=e},t.prototype.has=function(t){return!!this.map_[i(t,this.multiKey_)]||i(t,this.multiKey_)in this.map_},t.prototype["delete"]=function(t){return void this.reset_(),delete this.map_[i(t,this.multiKey_)],this},t.prototype.clear=function(){return void this.reset_(),this.map_=Object.create(null),this},t.prototype.reset_=function(){this.size_=NaN,this.entries_=void 0},Object.defineProperty(t.prototype,"size",{get:function(){return this.size_>=0?this.size_:this.size_=Object.keys(this.map_).length},enumerable:!0,configurable:!0}),t.prototype.entries=function(){var t=this;return this.entries_?this.entries_:this.entries_=Object.keys(this.map_).map(function(e){return[n(e,t.multiKey_,t.type_),t.get(n(e,t.multiKey_,t.type_))]})},t}();e.Map=s;var c=function(t){function e(){t.apply(this,arguments)}return __extends(e,t),e}(s);e.MultiMap=c}),define("src/lib/set",["require","exports","src/lib/map"],function(t,e,r){"use strict";var i=function(t){function e(e){t.call(this),this.replacer_=e}return __extends(e,t),e.prototype.add=function(t,e){if(!this.has(t))return this.set(t,e);if(!this.replacer_)throw new Error("Cannot overwrite value of set without replacer.");return this.set(t,this.replacer_(this.get(t),e))},e}(r.Map);e.Set=i;var n=function(t){function e(){t.apply(this,arguments)}return __extends(e,t),e}(i);e.MultiSet=n}),define("src/lib/supervisor",["require","exports","src/lib/observable","src/lib/set","src/lib/tick","src/lib/thenable","src/lib/concat","src/lib/noop"],function(t,e,r,i,n,o,s,c){"use strict";function u(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(var r=0;r<t.length;++r)if(t[r]!==e[r])return!1;return!0}var a=function(){function t(t){var e=this,n=void 0===t?{}:t,o=n.name,s=void 0===o?"anonymous":o,u=n.dependencies,a=void 0===u?[]:u,h=n.retry,p=void 0===h?!1:h,d=n.timeout,f=void 0===d?0:d,l=n.destructor,v=void 0===l?c.noop:l;this.deps=new i.MultiSet,this.events={exec:new r.Observable,fail:new r.Observable,loss:new r.Observable,exit:new r.Observable},this.procs=new r.Observable,this.alive=!0,this.registerable=!0,this.scheduled=!1,this.workerSharedResource={procs:this.procs,resolvedDependencies:[],rejectedDependencies:[],dependenciesStack:[]},this.queue=[],this.name=s,void a.reduce(function(t,r){var i=r[0],n=r[1];return void e.deps.set(i,n)},void 0),this.retry=p,this.timeout=f,this.destructor_=v,void++this.constructor.count}return t.prototype.destructor=function(t){for(void this.checkState(),this.alive=!1;this.queue.length>0;){var e=this.queue.shift(),r=e[0],i=e[1];void this.events.loss.emit(r,[r,void 0,i])}try{void this.destructor_(t)}catch(n){void console.error(n,n+"")}void--this.constructor.count,void Object.freeze(this)},t.prototype.schedule=function(){var t=this;this.scheduled||(void n.Tick(function(e){t.alive&&(t.scheduled=!1,void t.drain())}),this.scheduled=!0)},t.prototype.register=function(t,e,r){if(void this.checkState(),!this.registerable)throw new Error("ArchStream: Supervisor: Supervisor "+this.name+" cannot register process during the exiting.");return t=s.concat([],t),void this.schedule(),new l(this,this.workerSharedResource,t,e,r,this.deps.get(t)||[]).terminate},t.prototype.call=function(t,e,r,i){var n=this;void 0===r&&(r=this.timeout),void this.checkState(),t=s.concat([],t),void this.queue.push([t,e,i,r,Date.now()]),void this.schedule(),r>0&&void setTimeout(function(){return n.drain(t)},r+9)},t.prototype.cast=function(t,e,r){void 0===r&&(r=this.retry);var i=this.procs.reflect(t,new d(e));return 0===i.length&&void this.events.fail.emit(t,[t,void 0,e]),i.length>0||!r?i:this.cast(t,e,!1)},t.prototype.refs=function(t){return this.procs.refs(t).map(function(t){var e=(t[0],t[1]),r=e(void 0);return[r.namespace,r.process,r.terminate]})},t.prototype.terminate=function(t,e){void this.checkState(),void 0===t&&(this.registerable=!1),void this.procs.emit(t||[],new f(e)),void this.procs.off(t||[]),void 0===t&&void this.destructor(e)},t.prototype.checkState=function(){if(!this.alive)throw new Error("ArchStream: Supervisor: Supervisor "+this.name+" already exited.")},t.prototype.drain=function(t){if(void 0===t&&(t=[]),this.alive)for(var e,r=Date.now(),i=function(i){var o=n.queue[i],s=o[0],c=o[1],u=o[2],a=o[3],h=o[4],p=t.every(function(t,e){return t===s[e]})?n.procs.reflect(s,new d(c)):[];if(0===p.length&&void n.events.fail.emit(s,[s,void 0,c]),0===p.length&&h+a>r)return e=i,"continue";if(0===i?void n.queue.shift():void n.queue.splice(i,1),void--i,0===p.length&&void n.events.loss.emit(s,[s,void 0,c]),!u)return e=i,"continue";try{void u(c,p)}catch(f){void console.error(f,f+"")}e=i},n=this,o=0;o<this.queue.length;++o)i(o),o=e},t.count=0,t.procs=0,t}();e.Supervisor=a;var h=function(){function t(){}return t}(),p=function(t){function e(e){t.call(this),this.namespace=e}return __extends(e,t),e}(h),d=function(t){function e(e){t.call(this),this.data=e}return __extends(e,t),e}(h),f=function(t){function e(e){t.call(this),this.reason=e}return __extends(e,t),e}(h),l=function(){function t(e,r,i,n,o,s){var c=this;this.sv=e,this.sharedResource=r,this.namespace=i,this.process=n,this.parallel=o,this.dependencies=s,this.alive=!0,this.called=!1,this.receive=function(e){return t.prototype.receive.call(c,e)},this.terminate=function(e){return t.prototype.terminate.call(c,e)},this.sharedResource.allRefsCache=void 0,this.sharedResource.rejectedDependencies=[],void++this.sv.constructor.procs,void this.sharedResource.procs.on(i,this.receive)}return t.prototype.destructor=function(t){void this.checkState(),void this.sharedResource.procs.off(this.namespace,this.receive),this.alive=!1,void--this.sv.constructor.procs,this.sharedResource.allRefsCache=void 0,this.sharedResource.resolvedDependencies=[],void Object.freeze(this),void this.sv.events.exit.emit(this.namespace,[this.namespace,this.process,t])},t.prototype.tryDependencyResolving=function(t){if(this.receive(new p(this.namespace)))return this.sharedResource.resolvedDependencies=s.concat(this.sharedResource.resolvedDependencies,this.sharedResource.dependenciesStack),void(this.sharedResource.dependenciesStack=[]);throw this.sharedResource.rejectedDependencies=s.concat(this.sharedResource.rejectedDependencies,this.sharedResource.dependenciesStack),void(this.sharedResource.dependenciesStack=[])},t.prototype.receive=function(t){var e=this;if(void this.checkState(),void 0===t)return this;if(t instanceof p){if(t.namespace.length!==this.namespace.length)return!1;for(var r=0,i=this.sharedResource.resolvedDependencies;r<i.length;r++){var n=i[r];if(u(this.namespace,n))return!0}for(var s=0,c=this.sharedResource.rejectedDependencies;s<c.length;s++){var a=c[s];if(u(this.namespace,a))return!1}for(var h=0,l=this.sharedResource.dependenciesStack;h<l.length;h++){var v=l[h];if(u(this.namespace,v))return!0}return void this.sharedResource.dependenciesStack.push(this.namespace),this.dependencies.every(function(t){return(e.sharedResource.allRefsCache=e.sharedResource.allRefsCache||e.sharedResource.procs.refs([])).some(function(e){var r=e[0],i=e[1];return u(r,t)&&!!i(new p(t))})})}if(t instanceof d){if(this.parallel<0)throw void 0;void this.tryDependencyResolving(t),this.called||(this.called=!0,void this.sv.events.exec.emit(this.namespace,[this.namespace,this.process]));try{var y=this.process(t.data);return o.isThenable(y)&&(void--this.parallel,void y.then(function(t){return e.alive?void++e.parallel:void 0},function(t){return e.alive&&e.terminate(t)})),y}catch(_){throw void void this.terminate(_)}}if(t instanceof f)throw void void this.terminate(t.reason);throw new TypeError("ArchStream: Supervisor: Invalid command: "+t)},t.prototype.terminate=function(t){void this.destructor(t)},t.prototype.checkState=function(){if(!this.alive)throw new Error("ArchStream: Supervisor: Process "+this.namespace+"/"+this.process+" already exited.")},t}()}),define("src/lib/timer",["require","exports"],function(t,e){"use strict";function r(t){var e=t.begin,i=void 0===e?0:e,n=t.end,o=void 0===n?864e5:n,s=t.step,c=void 0===s?function(t){return 3*(t||1)}:s,u=t.precond,a=void 0===u?function(){return!0}:u,h=t.task,p=void 0===h?function(){}:h,d=t.postcond,f=void 0===d?function(){return!0}:d,l=t.complete,v=void 0===l?function(){return 0}:l,y=t.error,_=void 0===y?function(){return 0}:y,m=t.timeout,b=void 0===m?function(){return 0}:m,w=t.since,x=void 0===w?Date.now():w;i=0>i?0:i,void setTimeout(function(){try{if(a()){var t=p();if(f())return void v(t)}}catch(e){return void _(e)}var n=Date.now(),s=c(n-x);return 0>=o-(n-x)?void b():void void r({precond:a,task:p,postcond:f,complete:v,timeout:b,begin:i+s,end:o,step:c,since:x})},i)}e.Timer=r}),define("src/lib/monad",["require","exports"],function(t,e){"use strict";var r=function(){function t(t){this.thunk=t}return t.prototype.extract=function(t){return this.evaluate().extract(t)},t.prototype.evaluate=function(){return this.memory_=this.memory_||this.thunk()},t.prototype.assert=function(t){return this},t}();e.Monad=r}),define("src/lib/maybe.impl",["require","exports","src/lib/monad"],function(t,e,r){"use strict";var i=function(t){function e(e){t.call(this,e),this.thunk=e}return __extends(e,t),e.prototype.bind=function(t){var r=this;return new e(function(){var i=r.evaluate();if(i instanceof n)return t(i.extract());if(i instanceof o)return i;if(i instanceof e)return i.bind(t);throw new TypeError("ArchStream: Maybe: Invalid monad value.\n "+i)})},e.prototype.extract=function(e){return t.prototype.extract.call(this,e)},e.prototype.assert=function(t){return this},e}(r.Monad);e.Maybe=i;var n=function(t){function e(e){t.call(this),this.val_=e}return __extends(e,t),e.prototype.bind=function(t){var e=this;return new i(function(){return e}).bind(t)},e.prototype.extract=function(t){return this.val_},e.prototype.assert=function(t){return this},e}(i);e.Just=n;var o=function(t){function e(){t.apply(this,arguments)}return __extends(e,t),e.prototype.bind=function(t){return this},e.prototype.extract=function(t){if(!t)throw void 0;return t()},e.prototype.assert=function(t){return this},e}(i);e.Nothing=o}),define("src/lib/maybe",["require","exports","src/lib/maybe.impl"],function(t,e,r){"use strict";var i;!function(t){function e(t){return new r.Just(t)}t.Just=e,t.Nothing=new r.Nothing,t.Return=e}(i=e.Maybe||(e.Maybe={})),e.Just=i.Just,e.Nothing=i.Nothing,e.Return=e.Just}),define("src/lib/either.impl",["require","exports","src/lib/monad"],function(t,e,r){"use strict";var i=function(t){function e(e){t.call(this,e),this.thunk=e}return __extends(e,t),e.prototype.bind=function(t){var r=this;return new e(function(){var i=r.evaluate();if(i instanceof n)return i;if(i instanceof o)return t(i.extract());if(i instanceof e)return i.bind(t);throw new TypeError("ArchStream: Either: Invalid monad value.\n "+i)})},e.prototype.extract=function(e){return t.prototype.extract.call(this,e)},e.prototype.assert=function(t){return this},e}(r.Monad);e.Either=i;var n=function(t){function e(e){t.call(this),this.val_=e}return __extends(e,t),e.prototype.bind=function(t){return this},e.prototype.extract=function(t){if(!t)throw this.val_;return t(this.val_)},e.prototype.assert=function(t){return this},e}(i);e.Left=n;var o=function(t){function e(e){t.call(this),this.val_=e}return __extends(e,t),e.prototype.bind=function(t){var e=this;return new i(function(){return e}).bind(t)},e.prototype.extract=function(t){return this.val_},e.prototype.assert=function(t){return this},e}(i);e.Right=o}),define("src/lib/either",["require","exports","src/lib/either.impl"],function(t,e,r){"use strict";var i;!function(t){function e(t){return new r.Left(t)}function i(t){return new r.Right(t)}t.Left=e,t.Right=i,t.Return=i}(i=e.Either||(e.Either={})),e.Left=i.Left,e.Right=i.Right,e.Return=i.Return}),define("src/lib/sqid",["require","exports"],function(t,e){"use strict";function r(t){return void 0===t?(1e15+ ++i+"").slice(1):(1e15+t+"").slice(1)}var i=0;e.sqid=r}),define("src/lib/assign",["require","exports"],function(t,e){"use strict";function r(t){for(var e=[],i=1;i<arguments.length;i++)e[i-1]=arguments[i];if(void 0===t||null===t)throw new TypeError("ArchStream: assign: Cannot merge objects into "+t+".");for(var n=Object(t),o=0;o<e.length;o++){var s=e[o];if(void 0!==s&&null!==s){s=Object(s);for(var c=0,u=Object.keys(Object(s));c<u.length;c++){var a=u[c],h=Object.getOwnPropertyDescriptor(s,a);if(void 0!==h&&h.enumerable){var p=s[a];n[a];p&&"object"==typeof p?n[a]=Array.isArray(p)?p.slice():r({},p):n[a]=p}}}}return n}e.assign=r}),define("src/lib/extend",["require","exports"],function(t,e){"use strict";function r(t){for(var e=[],i=1;i<arguments.length;i++)e[i-1]=arguments[i];if(void 0===t||null===t)throw new TypeError("ArchStream: extend: Cannot merge objects into "+t+".");for(var n=Object(t),o=0;o<e.length;o++){var s=e[o];if(void 0!==s&&null!==s){s=Object(s);for(var c=0,u=Object.keys(Object(s));c<u.length;c++){var a=u[c],h=Object.getOwnPropertyDescriptor(s,a);if(void 0!==h&&h.enumerable){var p=s[a],d=n[a];p&&"object"==typeof p?n[a]=Array.isArray(p)?p.slice():r(d&&"object"==typeof d&&!Array.isArray(d)?d:{},p):n[a]=p}}}}return n}e.extend=r}),define("src/export",["require","exports","src/stream/transform","src/lib/message","src/lib/proxy","src/lib/proxy","src/lib/supervisor","src/lib/observable","src/lib/map","src/lib/set","src/lib/tick","src/lib/timer","src/lib/maybe","src/lib/either","src/lib/fingerprint","src/lib/uuid","src/lib/sqid","src/lib/assign","src/lib/extend","src/lib/concat","./typings/arch-stream.d"],function(t,e,r,i,n,o,s,c,u,a,h,p,d,f,l,v,y,_,m,b){"use strict";function w(){return new r.ArchStream}function x(){return new i.Message}e.Proxy=o.Proxy,e.Supervisor=s.Supervisor,e.Observable=c.Observable,e.Map=u.Map,e.MultiMap=u.MultiMap,e.Set=a.Set,e.MultiSet=a.MultiSet,e.Tick=h.Tick,e.Timer=p.Timer,e.Maybe=d.Maybe,e.Just=d.Just,e.Nothing=d.Nothing,e.Either=f.Either,e.Left=f.Left,e.Right=f.Right,e.FINGERPRINT=l.FINGERPRINT,e.uuid=v.v4,e.sqid=y.sqid,e.assign=_.assign,e.extend=m.extend,e.concat=b.concat;var g={Msg:x,Proxy:n.Proxy};Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=w;var w;!function(t){t.Msg=g.Msg,t.Proxy=g.Proxy}(w||(w={})),e.Msg=x}),define("arch-stream",["require","exports","src/export","src/export"],function(t,e,r,i){"use strict";function n(t){for(var r in t)e.hasOwnProperty(r)||(e[r]=t[r])}n(r),e["default"]=i["default"]});
{
"name": "arch-stream",
"version": "0.0.88",
"version": "0.0.89",
"description": "Pipeline stream for software architecture of Domain-Driven Design and Data-Oriented Design.",

@@ -5,0 +5,0 @@ "private": false,

@@ -19,11 +19,10 @@ export function assign<T extends Object>(target: T | {}, ...sources: T[]): T {

const prevValue = to[nextKey];
if (!nextValue || typeof nextValue !== 'object') {
if (nextValue && typeof nextValue === 'object') {
to[nextKey] = Array.isArray(nextValue)
? nextValue.slice()
: assign({}, nextValue);
}
else {
to[nextKey] = nextValue;
continue;
}
if (Array.isArray(nextValue)) {
to[nextKey] = nextValue.slice();
continue;
}
to[nextKey] = assign({}, nextValue);
}

@@ -30,0 +29,0 @@ }

@@ -19,15 +19,10 @@ export function extend<T extends Object>(target: T | {}, ...sources: T[]): T {

const prevValue = to[nextKey];
if (!nextValue || typeof nextValue !== 'object') {
if (nextValue && typeof nextValue === 'object') {
to[nextKey] = Array.isArray(nextValue)
? nextValue.slice()
: extend(prevValue && typeof prevValue === 'object' && !Array.isArray(prevValue) ? prevValue : {}, nextValue);
}
else {
to[nextKey] = nextValue;
continue;
}
if (Array.isArray(nextValue)) {
to[nextKey] = nextValue.slice();
continue;
}
if (prevValue && nextValue && typeof prevValue === 'object' && !Array.isArray(prevValue)) {
to[nextKey] = extend(prevValue, nextValue);
continue;
}
to[nextKey] = extend({}, nextValue);
}

@@ -34,0 +29,0 @@ }

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc