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.8 to 0.0.9

lib/globs.js

4

CHANGELOG.md
# Changelog
## 0.0.9
Update
## 0.0.8

@@ -4,0 +8,0 @@

104

dist/arch-stream.js

@@ -1,5 +0,31 @@

/*! arch-stream v0.0.8 | (c) 2015, falsandtru | MIT Licence */
/*! arch-stream v0.0.9 | (c) 2015, falsandtru | MIT Licence */
require=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
'use strict';
function bind(target, key, descriptor) {
target[key] = target[key].bind(target);
}
Object.defineProperty(exports, '__esModule', { value: true });
exports.default = bind;
},{}],2:[function(_dereq_,module,exports){
'use strict';
var __decorate = this && this.__decorate || function (decorators, target, key, desc) {
if (typeof Reflect === 'object' && typeof Reflect.decorate === 'function')
return Reflect.decorate(decorators, target, key, desc);
switch (arguments.length) {
case 2:
return decorators.reduceRight(function (o, d) {
return d && d(o) || o;
}, target);
case 3:
return decorators.reduceRight(function (o, d) {
return d && d(target, key), void 0;
}, void 0);
case 4:
return decorators.reduceRight(function (o, d) {
return d && d(target, key, o) || o;
}, desc);
}
};
var tick_1 = _dereq_('./tick');
var bind_1 = _dereq_('../decorator/bind');
var EMPTY = {};

@@ -14,23 +40,2 @@ var Message = function () {

this.memory_ = EMPTY;
this.send = function (self) {
return function (data, async) {
if (!async) {
self.trampoline_(data);
} else {
tick_1.default(self.trampoline_.bind(self, data));
}
return self;
};
}(this);
this.recv = function (self) {
return function (callback) {
self.listener_ = callback;
self.collection_ = void 0;
var msg = new Message(self);
if (self.memory_ !== EMPTY) {
self.send(self.memory_);
}
return msg;
};
}(this);
if (parent_) {

@@ -89,5 +94,24 @@ this.parent_.child_ = this;

};
Message.prototype.send = function (data, async) {
if (!async) {
this.trampoline_(data);
} else {
tick_1.default(this.trampoline_.bind(this, data));
}
return this;
};
Message.prototype.recv = function (callback) {
this.listener_ = callback;
this.collection_ = void 0;
var msg = new Message(this);
if (this.memory_ !== EMPTY) {
this.send(this.memory_);
}
return msg;
};
Message.prototype.then = function (done, _) {
return this.recv(done);
};
Object.defineProperty(Message.prototype, 'send', __decorate([bind_1.default], Message.prototype, 'send', Object.getOwnPropertyDescriptor(Message.prototype, 'send')));
Object.defineProperty(Message.prototype, 'recv', __decorate([bind_1.default], Message.prototype, 'recv', Object.getOwnPropertyDescriptor(Message.prototype, 'recv')));
return Message;

@@ -103,3 +127,3 @@ }();

}
},{"./tick":4}],2:[function(_dereq_,module,exports){
},{"../decorator/bind":1,"./tick":5}],3:[function(_dereq_,module,exports){
'use strict';

@@ -115,3 +139,3 @@ var case_1 = _dereq_('../proxy/case');

};
},{"../proxy/case":5,"../proxy/hook":6,"../proxy/responsibility":7}],3:[function(_dereq_,module,exports){
},{"../proxy/case":6,"../proxy/hook":7,"../proxy/responsibility":8}],4:[function(_dereq_,module,exports){
'use strict';

@@ -175,3 +199,3 @@ var Throttle = function () {

exports.default = Throttle;
},{}],4:[function(_dereq_,module,exports){
},{}],5:[function(_dereq_,module,exports){
'use strict';

@@ -223,3 +247,3 @@ var Tick;

exports.default = IS_NODE ? Function('return fn => process.nextTick(fn)')() : Tick.queue;
},{}],5:[function(_dereq_,module,exports){
},{}],6:[function(_dereq_,module,exports){
'use strict';

@@ -248,3 +272,3 @@ function default_1(definition) {

exports.default = default_1;
},{}],6:[function(_dereq_,module,exports){
},{}],7:[function(_dereq_,module,exports){
'use strict';

@@ -275,3 +299,3 @@ function default_1(hooks) {

}
},{}],7:[function(_dereq_,module,exports){
},{}],8:[function(_dereq_,module,exports){
'use strict';

@@ -281,5 +305,6 @@ function default_1() {

return function (shadow) {
return proxy = { for: define };
return proxy = { rule: define };
};
function define(type, extract) {
var registered = proxy.pipe;
proxy.pipe = function () {

@@ -290,11 +315,10 @@ var args = [];

}
var cascade = registered && registered.apply(void 0, args)[0];
return args.map(function (callback) {
return function (entity) {
return extract(entity) instanceof type ? callback(entity) : callback;
return extract(entity) instanceof type ? (registered ? cascade : callback)(entity) : callback;
};
});
};
return function (_) {
return noop;
};
return noop;
}

@@ -307,3 +331,3 @@ }

}
},{}],8:[function(_dereq_,module,exports){
},{}],9:[function(_dereq_,module,exports){
'use strict';

@@ -338,3 +362,3 @@ var modular_1 = _dereq_('./modular');

exports.default = ComposeStream;
},{"./modular":9}],9:[function(_dereq_,module,exports){
},{"./modular":10}],10:[function(_dereq_,module,exports){
'use strict';

@@ -420,3 +444,3 @@ var throttle_1 = _dereq_('../lib/throttle');

exports.default = ModularStream;
},{"../lib/throttle":3,"../lib/tick":4}],10:[function(_dereq_,module,exports){
},{"../lib/throttle":4,"../lib/tick":5}],11:[function(_dereq_,module,exports){
'use strict';

@@ -450,3 +474,3 @@ var message_1 = _dereq_('../lib/message');

}, args);
return ArchStream.prototype.pipe.call(this, params[0]);
return method !== 'export' ? ArchStream.prototype.pipe.call(this, params[0]) : ArchStream.prototype.pipe.call(this, params[0]).export();
function toArray(target) {

@@ -461,3 +485,3 @@ return Array.isArray(target) ? target : [target];

Object.keys(proxy).filter(function (prop) {
return typeof proxy[prop] === 'function' && prop !== 'import' && prop !== 'export';
return typeof proxy[prop] === 'function';
}).forEach(function (method) {

@@ -487,3 +511,3 @@ return _this[method] = function () {

exports.default = ArchStream;
},{"../lib/message":1,"./compose":8}],"arch-stream":[function(_dereq_,module,exports){
},{"../lib/message":2,"./compose":9}],"arch-stream":[function(_dereq_,module,exports){
'use strict';

@@ -515,3 +539,3 @@ var transform_1 = _dereq_('./stream/transform');

module.exports = Package;
},{"./lib/message":1,"./lib/proxy":2,"./lib/tick":4,"./stream/transform":10}]},{},["arch-stream",1,2,3,4,5,6,7,8,9,10]);
},{"./lib/message":2,"./lib/proxy":3,"./lib/tick":5,"./stream/transform":11}]},{},[1,"arch-stream",2,3,4,5,6,7,8,9,10,11]);
typeof module === "object" && module && "exports" in module && (module.exports = require("arch-stream"));

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

/*! arch-stream v0.0.8 | (c) 2015, falsandtru | MIT Licence */
require=function t(e,r,n){function o(u,s){if(!r[u]){if(!e[u]){var c="function"==typeof require&&require;if(!s&&c)return c(u,!0);if(i)return i(u,!0);var f=new Error("Cannot find module '"+u+"'");throw f.code="MODULE_NOT_FOUND",f}var p=r[u]={exports:{}};e[u][0].call(p.exports,function(t){var r=e[u][1][t];return o(r?r:t)},p,p.exports,t,e,r,n)}return r[u].exports}for(var i="function"==typeof require&&require,u=0;u<n.length;u++)o(n[u]);return o}({1:[function(t,e,r){"use strict";function n(t){return t}function o(t){return!!t&&"object"==typeof t&&"then"in t}var i=t("./tick"),u={},s=function(){function t(e,r){void 0===r&&(r=n),this.parent_=e,this.listener_=r,this.memory_=u,this.send=function(t){return function(e,r){return r?i["default"](t.trampoline_.bind(t,e)):t.trampoline_(e),t}}(this),this.recv=function(e){return function(r){e.listener_=r,e.collection_=void 0;var n=new t(e);return e.memory_!==u&&e.send(e.memory_),n}}(this),e&&(this.parent_.child_=this)}return t.prototype.root=function(){return this.parent_?this.parent_.root():this},t.prototype.collect_=function(){var t=this,e=[];do e.push(t),t=t.child_;while(t);return this.collection_=e,e},t.prototype.trampoline_=function(t){for(var e=this.collection_?this.collection_:this.collect_(),r=!1,n=0;n<e.length;n++){var i=e[n];i.memory_=t;var u=i.listener_(t);if(o(u)){var s=!1,c=c||function(){s=!0,r&&i.child_&&i.child_.trampoline_(t)};if(u.then(c,c),!s)break}}r=!0},t.prototype.clone_=function(e){return e.parent_?new t(this.clone_(e.parent_),e.listener_):new t(void 0,e.listener_)},t.prototype.clone=function(){return this.clone_(this)},t.prototype.connect=function(t){return this.parent_.child_=t,t.parent_=this.parent_,this},t.prototype.then=function(t,e){return this.recv(t)},t}();Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=s},{"./tick":4}],2:[function(t,e,r){"use strict";var n=t("../proxy/case"),o=t("../proxy/hook"),i=t("../proxy/responsibility");Object.defineProperty(r,"__esModule",{value:!0}),r["default"]={Case:n["default"],Hook:o["default"],Responsibility:i["default"]}},{"../proxy/case":5,"../proxy/hook":6,"../proxy/responsibility":7}],3:[function(t,e,r){"use strict";var n=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(){return null}),this.volume_=t,this.limit_=e,this.discharger_=r},t.prototype.enqueue=function(t){if(this.isDrainable_())return this.processing_.push(t),this.resolver_(t),!0;this.queue_.push(t);do 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?this.processing_.splice(e,1):this.processing_.shift(),this.queue_.length>0&&this.isDrainable_()&&this.enqueue(this.queue_.shift())},t.prototype.register=function(t){this.resolver_=t},t}();Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=n},{}],4:[function(t,e,r){"use strict";var n;!function(t){function e(t){i.push(t),n()}function r(){--u,n();for(var t=i.length;t-->0;)i.shift()()}function n(){if(0!==i.length)if(o)for(;2>u;)Promise.resolve().then(r),++u;else for(;u<s.length;)setTimeout(r,s[u%s.length]),++u}t.queue=e;var o="function"==typeof Promise,i=[],u=0,s=[0,4,10,20,25].reverse()}(n||(n={}));var o=Function("return typeof process === 'object' && typeof window !== 'object'")();Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=o?Function("return fn => process.nextTick(fn)")():n.queue},{}],5:[function(t,e,r){"use strict";function n(t){function e(){for(var t=[],e=0;e<arguments.length;e++)t[e-0]=arguments[e];return function(e){var r=+o[n(e)];return r>-1&&r<t.length?t[r](e):t}}var r=t.index,n=t.indexer,o=Object.create(null);return r.forEach(function(t,e){return o[t]=e}),function(t){return{pipe:e}}}Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=n},{}],6:[function(t,e,r){"use strict";function n(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),u(e)}})}var r=t.pre,n=void 0===r?o:r,i=t.post,u=void 0===i?o:i;return function(t){return{pipe:e}}}function o(){}Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=n},{}],7:[function(t,e,r){"use strict";function n(){function t(t,r){return e.pipe=function(){for(var e=[],n=0;n<arguments.length;n++)e[n-0]=arguments[n];return e.map(function(e){return function(n){return r(n)instanceof t?e(n):e}})},function(t){return o}}var e;return function(r){return e={"for":t}}}function o(){}Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=n},{}],8:[function(t,e,r){"use strict";var n=t("./modular"),o=function(){function t(t){this.procs_=[],t&&this.register_([t])}return t.prototype.register_=function(t){for(var e=this.procs_,r=this.procs_.length,n=t.length;n--;)e[n+r]=t[n]},t.prototype["import"]=function(t){return--t.count<0&&t.throwCountExceededError(),this.register_(t.procs),this},t.prototype["export"]=function(t){return new n["default"](this.procs_,t)},t}();Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=o},{"./modular":9}],9:[function(t,e,r){"use strict";var n=t("../lib/throttle"),o=t("../lib/tick"),i=function(){function t(t,e){var r=this;void 0===e&&(e=1),this.procs=t,this.count=e,o["default"](function(t){return 0<r.count&&r.count<1/0&&r.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.throwCountExceededError=function(){throw new Error("Import and read counts are exeeded.")},t.prototype.throwCountDeprivedError=function(){throw this.count=0,new Error("Import and read counts are not deprived.")},t.prototype.flow=function(t,e,r){var o=this;return void 0===e&&(e=1/0),this.flow_=new n["default"],this.flow_.flow(t,e,r),this.flow_.register(function(t){return o.write_(t)}),this},t.prototype.read_=function(t){--this.count<0&&this.throwCountExceededError(),this.compose_(),this.last_.recv(t)},t.prototype.read=function(t){var e=this,r=!1;return this.read_(function(n){e.flow_&&o["default"](function(){return e.flow_.dequeue(n)}),r&&t(n)}),r=!0,this},t.prototype.write_=function(t){this.first_.send(t)},t.prototype.write=function(t){return this.flow_?this.flow_.enqueue(t):this.write_(t),this},t}();Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=i},{"../lib/throttle":3,"../lib/tick":4}],10:[function(t,e,r){"use strict";var n=t("../lib/message"),o=t("./compose"),i=function(){function t(t,e,r){var o=this;void 0===e&&(e=new n["default"]),void 0===r&&(r=[]),this.parent_=t,this.message_=e,this.proxies_=[],this.parent_&&r.unshift.apply(r,t.proxies_),r.forEach(function(t){return o.proxy(t)})}return t.prototype.proxy_=function(e,r){function n(t){return Array.isArray(t)?t:[t]}var o=this.proxies_.filter(function(t){return"function"==typeof t[e]}).reduce(function(t,r){return n(r[e].apply(r,t))},r);return t.prototype.pipe.call(this,o[0])},t.prototype.proxy=function(t){var e=this,r="function"==typeof t?t():t;return this.proxies_.push(r),Object.keys(r).filter(function(t){return"function"==typeof r[t]&&"import"!==t&&"export"!==t}).forEach(function(t){return e[t]=function(){for(var r=[],n=0;n<arguments.length;n++)r[n-0]=arguments[n];return e.proxy_(t,r)}}),this},t.prototype.pipe=function(e){return new t(this,this.message_.recv(e))},t.prototype["import"]=function(t){return(new o["default"])["import"](t)},t.prototype["export"]=function(t){return new o["default"](this.message_)["export"](t)},t}();Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=i},{"../lib/message":1,"./compose":8}],"arch-stream":[function(t,e,r){"use strict";function n(){return new i["default"]}function o(){return new u["default"]}var n,i=t("./stream/transform"),u=t("./lib/message"),s=t("./lib/proxy"),c=t("./lib/tick"),f={"default":n,Msg:o,Proxy:s["default"],Tick:c["default"],ArchStream:i["default"],Message:u["default"]};!function(t){t.Msg=f.Msg,t.Proxy=f.Proxy,t.Tick=f.Tick}(n||(n={})),e.exports=f},{"./lib/message":1,"./lib/proxy":2,"./lib/tick":4,"./stream/transform":10}]},{},["arch-stream",1,2,3,4,5,6,7,8,9,10]),"object"==typeof module&&module&&"exports"in module&&(module.exports=require("arch-stream"));
/*! arch-stream v0.0.9 | (c) 2015, falsandtru | MIT Licence */
require=function t(e,r,n){function o(u,s){if(!r[u]){if(!e[u]){var c="function"==typeof require&&require;if(!s&&c)return c(u,!0);if(i)return i(u,!0);var f=new Error("Cannot find module '"+u+"'");throw f.code="MODULE_NOT_FOUND",f}var p=r[u]={exports:{}};e[u][0].call(p.exports,function(t){var r=e[u][1][t];return o(r?r:t)},p,p.exports,t,e,r,n)}return r[u].exports}for(var i="function"==typeof require&&require,u=0;u<n.length;u++)o(n[u]);return o}({1:[function(t,e,r){"use strict";function n(t,e,r){t[e]=t[e].bind(t)}Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=n},{}],2:[function(t,e,r){"use strict";function n(t){return t}function o(t){return!!t&&"object"==typeof t&&"then"in t}var i=this&&this.__decorate||function(t,e,r,n){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(t,e,r,n);switch(arguments.length){case 2:return t.reduceRight(function(t,e){return e&&e(t)||t},e);case 3:return t.reduceRight(function(t,n){return void(n&&n(e,r))},void 0);case 4:return t.reduceRight(function(t,n){return n&&n(e,r,t)||t},n)}},u=t("./tick"),s=t("../decorator/bind"),c={},f=function(){function t(t,e){void 0===e&&(e=n),this.parent_=t,this.listener_=e,this.memory_=c,t&&(this.parent_.child_=this)}return t.prototype.root=function(){return this.parent_?this.parent_.root():this},t.prototype.collect_=function(){var t=this,e=[];do e.push(t),t=t.child_;while(t);return this.collection_=e,e},t.prototype.trampoline_=function(t){for(var e=this.collection_?this.collection_:this.collect_(),r=!1,n=0;n<e.length;n++){var i=e[n];i.memory_=t;var u=i.listener_(t);if(o(u)){var s=!1,c=c||function(){s=!0,r&&i.child_&&i.child_.trampoline_(t)};if(u.then(c,c),!s)break}}r=!0},t.prototype.clone_=function(e){return e.parent_?new t(this.clone_(e.parent_),e.listener_):new t(void 0,e.listener_)},t.prototype.clone=function(){return this.clone_(this)},t.prototype.connect=function(t){return this.parent_.child_=t,t.parent_=this.parent_,this},t.prototype.send=function(t,e){return e?u["default"](this.trampoline_.bind(this,t)):this.trampoline_(t),this},t.prototype.recv=function(e){this.listener_=e,this.collection_=void 0;var r=new t(this);return this.memory_!==c&&this.send(this.memory_),r},t.prototype.then=function(t,e){return this.recv(t)},Object.defineProperty(t.prototype,"send",i([s["default"]],t.prototype,"send",Object.getOwnPropertyDescriptor(t.prototype,"send"))),Object.defineProperty(t.prototype,"recv",i([s["default"]],t.prototype,"recv",Object.getOwnPropertyDescriptor(t.prototype,"recv"))),t}();Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=f},{"../decorator/bind":1,"./tick":5}],3:[function(t,e,r){"use strict";var n=t("../proxy/case"),o=t("../proxy/hook"),i=t("../proxy/responsibility");Object.defineProperty(r,"__esModule",{value:!0}),r["default"]={Case:n["default"],Hook:o["default"],Responsibility:i["default"]}},{"../proxy/case":6,"../proxy/hook":7,"../proxy/responsibility":8}],4:[function(t,e,r){"use strict";var n=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(){return null}),this.volume_=t,this.limit_=e,this.discharger_=r},t.prototype.enqueue=function(t){if(this.isDrainable_())return this.processing_.push(t),this.resolver_(t),!0;this.queue_.push(t);do 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?this.processing_.splice(e,1):this.processing_.shift(),this.queue_.length>0&&this.isDrainable_()&&this.enqueue(this.queue_.shift())},t.prototype.register=function(t){this.resolver_=t},t}();Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=n},{}],5:[function(t,e,r){"use strict";var n;!function(t){function e(t){i.push(t),n()}function r(){--u,n();for(var t=i.length;t-->0;)i.shift()()}function n(){if(0!==i.length)if(o)for(;2>u;)Promise.resolve().then(r),++u;else for(;u<s.length;)setTimeout(r,s[u%s.length]),++u}t.queue=e;var o="function"==typeof Promise,i=[],u=0,s=[0,4,10,20,25].reverse()}(n||(n={}));var o=Function("return typeof process === 'object' && typeof window !== 'object'")();Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=o?Function("return fn => process.nextTick(fn)")():n.queue},{}],6:[function(t,e,r){"use strict";function n(t){function e(){for(var t=[],e=0;e<arguments.length;e++)t[e-0]=arguments[e];return function(e){var r=+o[n(e)];return r>-1&&r<t.length?t[r](e):t}}var r=t.index,n=t.indexer,o=Object.create(null);return r.forEach(function(t,e){return o[t]=e}),function(t){return{pipe:e}}}Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=n},{}],7:[function(t,e,r){"use strict";function n(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),u(e)}})}var r=t.pre,n=void 0===r?o:r,i=t.post,u=void 0===i?o:i;return function(t){return{pipe:e}}}function o(){}Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=n},{}],8:[function(t,e,r){"use strict";function n(){function t(t,r){var n=e.pipe;return e.pipe=function(){for(var e=[],o=0;o<arguments.length;o++)e[o-0]=arguments[o];var i=n&&n.apply(void 0,e)[0];return e.map(function(e){return function(o){return r(o)instanceof t?(n?i:e)(o):e}})},o}var e;return function(r){return e={rule:t}}}function o(){}Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=n},{}],9:[function(t,e,r){"use strict";var n=t("./modular"),o=function(){function t(t){this.procs_=[],t&&this.register_([t])}return t.prototype.register_=function(t){for(var e=this.procs_,r=this.procs_.length,n=t.length;n--;)e[n+r]=t[n]},t.prototype["import"]=function(t){return--t.count<0&&t.throwCountExceededError(),this.register_(t.procs),this},t.prototype["export"]=function(t){return new n["default"](this.procs_,t)},t}();Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=o},{"./modular":10}],10:[function(t,e,r){"use strict";var n=t("../lib/throttle"),o=t("../lib/tick"),i=function(){function t(t,e){var r=this;void 0===e&&(e=1),this.procs=t,this.count=e,o["default"](function(t){return 0<r.count&&r.count<1/0&&r.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.throwCountExceededError=function(){throw new Error("Import and read counts are exeeded.")},t.prototype.throwCountDeprivedError=function(){throw this.count=0,new Error("Import and read counts are not deprived.")},t.prototype.flow=function(t,e,r){var o=this;return void 0===e&&(e=1/0),this.flow_=new n["default"],this.flow_.flow(t,e,r),this.flow_.register(function(t){return o.write_(t)}),this},t.prototype.read_=function(t){--this.count<0&&this.throwCountExceededError(),this.compose_(),this.last_.recv(t)},t.prototype.read=function(t){var e=this,r=!1;return this.read_(function(n){e.flow_&&o["default"](function(){return e.flow_.dequeue(n)}),r&&t(n)}),r=!0,this},t.prototype.write_=function(t){this.first_.send(t)},t.prototype.write=function(t){return this.flow_?this.flow_.enqueue(t):this.write_(t),this},t}();Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=i},{"../lib/throttle":4,"../lib/tick":5}],11:[function(t,e,r){"use strict";var n=t("../lib/message"),o=t("./compose"),i=function(){function t(t,e,r){var o=this;void 0===e&&(e=new n["default"]),void 0===r&&(r=[]),this.parent_=t,this.message_=e,this.proxies_=[],this.parent_&&r.unshift.apply(r,t.proxies_),r.forEach(function(t){return o.proxy(t)})}return t.prototype.proxy_=function(e,r){function n(t){return Array.isArray(t)?t:[t]}var o=this.proxies_.filter(function(t){return"function"==typeof t[e]}).reduce(function(t,r){return n(r[e].apply(r,t))},r);return"export"!==e?t.prototype.pipe.call(this,o[0]):t.prototype.pipe.call(this,o[0])["export"]()},t.prototype.proxy=function(t){var e=this,r="function"==typeof t?t():t;return this.proxies_.push(r),Object.keys(r).filter(function(t){return"function"==typeof r[t]}).forEach(function(t){return e[t]=function(){for(var r=[],n=0;n<arguments.length;n++)r[n-0]=arguments[n];return e.proxy_(t,r)}}),this},t.prototype.pipe=function(e){return new t(this,this.message_.recv(e))},t.prototype["import"]=function(t){return(new o["default"])["import"](t)},t.prototype["export"]=function(t){return new o["default"](this.message_)["export"](t)},t}();Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=i},{"../lib/message":2,"./compose":9}],"arch-stream":[function(t,e,r){"use strict";function n(){return new i["default"]}function o(){return new u["default"]}var n,i=t("./stream/transform"),u=t("./lib/message"),s=t("./lib/proxy"),c=t("./lib/tick"),f={"default":n,Msg:o,Proxy:s["default"],Tick:c["default"],ArchStream:i["default"],Message:u["default"]};!function(t){t.Msg=f.Msg,t.Proxy=f.Proxy,t.Tick=f.Tick}(n||(n={})),e.exports=f},{"./lib/message":2,"./lib/proxy":3,"./lib/tick":5,"./stream/transform":11}]},{},[1,"arch-stream",2,3,4,5,6,7,8,9,10,11]),"object"==typeof module&&module&&"exports"in module&&(module.exports=require("arch-stream"));
const gulp = require('gulp');
const shell = cmd => require('child_process').execSync(cmd, {stdio:[0,1,2]});
const spawn = cmd => require('child_process').spawn(cmd.split(' ')[0], cmd.split(' ').slice(1))
const glob = require('./tools/globs');
const glob = require('./lib/globs');
const fs = require('fs');

@@ -27,6 +27,2 @@ const del = require('del');

}),
typings: {
src: 'typings/local/*.d.ts',
dest: 'dist/'
},
source: {

@@ -274,7 +270,2 @@ lint: {

gulp.task('copy', function () {
return gulp.src(config.ts.typings.src)
.pipe(gulp.dest(config.ts.typings.dest));
});
gulp.task('install', function () {

@@ -329,3 +320,2 @@ shell('npm i');

seq(
'copy',
'ts:dist',

@@ -332,0 +322,0 @@ 'browserify:dist',

@@ -198,3 +198,2 @@ # memo

pipeメソッドを基底とし、メソッドの変更は多重適用される。
import/exportメソッドは変更不可。
ストリームの型の拡張が不完全なため複数プロキシ適用時のメソッドの型情報が誤っている場合がある。

@@ -201,0 +200,0 @@

{
"name": "arch-stream",
"version": "0.0.8",
"version": "0.0.9",
"description": "Modular stream for domain and data oriented program architecture design.",

@@ -16,5 +16,2 @@ "private": false,

],
"typings": [
"./dist/arch-stream.d.ts"
],
"main": "./dist/arch-stream.min.js",

@@ -29,2 +26,3 @@ "scripts": {

"test",
"lib",
"*.js",

@@ -52,4 +50,4 @@ "*.json",

"gulp-typescript": "^2.9.2",
"gulp-uglify": "^1.4.1",
"karma": "^0.13.10",
"gulp-uglify": "^1.4.2",
"karma": "^0.13.11",
"karma-chrome-launcher": "^0.2.1",

@@ -65,2 +63,3 @@ "karma-coverage": "^0.5.2",

"mocha": "^2.3.3",
"npm-check-updates": "^2.3.2",
"power-assert": "^1.1.0",

@@ -67,0 +66,0 @@ "run-sequence": "^1.1.4",

@@ -113,2 +113,3 @@ # ArchStream

```
#### Hook

@@ -138,2 +139,3 @@

- pipe > read
- proxy -> import
- import > pipe

@@ -140,0 +142,0 @@ - import > read

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

var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
switch (arguments.length) {
case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
}
};
var tick_1 = require('./tick');
var bind_1 = require('../decorator/bind');
var EMPTY = {};

@@ -14,26 +23,2 @@ var Message = (function () {

this.memory_ = EMPTY;
this.send = (function (self) {
return function (data, async) {
assert(typeof async === 'boolean' || async === void 0);
if (!async) {
self.trampoline_(data);
}
else {
tick_1.default(self.trampoline_.bind(self, data));
}
return self;
};
})(this);
this.recv = (function (self) {
return function (callback) {
assert(self.listener_ === identity);
self.listener_ = callback;
self.collection_ = void 0;
var msg = new Message(self);
if (self.memory_ !== EMPTY) {
self.send(self.memory_);
}
return msg;
};
})(this);
if (parent_) {

@@ -102,5 +87,33 @@ assert(parent_.child_ === void 0);

};
Message.prototype.send = function (data, async) {
assert(typeof async === 'boolean' || async === void 0);
if (!async) {
this.trampoline_(data);
}
else {
tick_1.default(this.trampoline_.bind(this, data));
}
return this;
};
Message.prototype.recv = function (callback) {
assert(this.listener_ === identity);
this.listener_ = callback;
this.collection_ = void 0;
var msg = new Message(this);
if (this.memory_ !== EMPTY) {
this.send(this.memory_);
}
return msg;
};
Message.prototype.then = function (done, _) {
return this.recv(done);
};
Object.defineProperty(Message.prototype, "send",
__decorate([
bind_1.default
], Message.prototype, "send", Object.getOwnPropertyDescriptor(Message.prototype, "send")));
Object.defineProperty(Message.prototype, "recv",
__decorate([
bind_1.default
], Message.prototype, "recv", Object.getOwnPropertyDescriptor(Message.prototype, "recv")));
return Message;

@@ -107,0 +120,0 @@ })();

import { Message as IMessage, ICallback } from 'arch-stream';
import Tick from './tick';
import bind from '../decorator/bind';

@@ -93,27 +94,25 @@ const EMPTY = <any>{};

public send = ((self: Message<T>) =>
function (data: T, async?: boolean): Message<T> {
assert(typeof async === 'boolean' || async === void 0);
if (!async) {
self.trampoline_(data);
}
else {
Tick(self.trampoline_.bind(self, data));
}
return self;
@bind
public send(data: T, async?: boolean): Message<T> {
assert(typeof async === 'boolean' || async === void 0);
if (!async) {
this.trampoline_(data);
}
)(this);
else {
Tick(this.trampoline_.bind(this, data));
}
return this;
}
public recv = ((self: Message<T>) =>
function (callback: (data: T) => any): Message<T> {
assert(self.listener_ === identity);
self.listener_ = callback;
self.collection_ = void 0;
const msg = new Message<T>(self);
if (self.memory_ !== EMPTY) {
self.send(self.memory_);
}
return msg;
@bind
public recv(callback: (data: T) => any): Message<T> {
assert(this.listener_ === identity);
this.listener_ = callback;
this.collection_ = void 0;
const msg = new Message<T>(this);
if (this.memory_ !== EMPTY) {
this.send(this.memory_);
}
)(this);
return msg;
}

@@ -120,0 +119,0 @@ public then(done: ICallback<T>, _?: ICallback<T>): Message<T> {

@@ -10,3 +10,3 @@ declare let process: {};

let Queue: ((...args) => any)[] = [];
const Queue: ((...args) => any)[] = [];
let Reservation = 0;

@@ -13,0 +13,0 @@ const Delays = [0, 4, 10, 20, 25].reverse();

function default_1() {
var proxy;
return function (shadow) { return proxy = {
for: define
rule: define
}; };
function define(type, extract) {
var registered = proxy.pipe;
proxy.pipe = function () {

@@ -12,6 +13,7 @@ var args = [];

}
var cascade = registered && registered.apply(void 0, args)[0];
return args.map(function (callback) {
return function (entity) {
return extract(entity) instanceof type
? callback(entity)
? (registered ? cascade : callback)(entity)
: callback;

@@ -21,3 +23,3 @@ };

};
return function (_) { return noop; };
return noop;
}

@@ -24,0 +26,0 @@ }

import { ICallback, ITransformStream } from 'arch-stream';
interface ResponsibilityProxy<T, U> {
for<V extends Object>(type: new (...args) => V, extract: (entity: T) => V): U&ITransformStream<T, U>;
pipe(callback: ICallback<T>): U&ITransformStream<T, U>;
rule<V extends Object>(
type: new (...args) => V,
extract: (entity: T) => V
): U&ResponsibilityProxy<T, U>&ITransformStream<T, U&ResponsibilityProxy<T, U>>;
}

@@ -10,3 +12,3 @@ export default function <T>() {

return <U>(shadow?: ITransformStream<T, U>) => proxy = <ResponsibilityProxy<T, U>>{
for: define
rule: define
};

@@ -18,10 +20,13 @@

): ICallback<T>|ICallback<T>[]|ITransformStream<T, {}> {
proxy.pipe = (...args: ICallback<T>[]) =>
args.map(callback =>
const registered = proxy.pipe;
proxy.pipe = (...args: ICallback<T>[]) => {
const cascade = registered && registered(...args)[0];
return args.map(callback =>
(entity: T) =>
extract(entity) instanceof type
? callback(entity)
? (registered ? cascade : callback)(entity)
: callback
);
return _ => noop;
};
return noop;
}

@@ -28,0 +33,0 @@ }

@@ -28,3 +28,5 @@ var message_1 = require('../lib/message');

assert(params.length === 1);
return ArchStream.prototype.pipe.call(this, params[0]);
return method !== 'export'
? ArchStream.prototype.pipe.call(this, params[0])
: ArchStream.prototype.pipe.call(this, params[0]).export();
function toArray(target) {

@@ -39,3 +41,3 @@ return Array.isArray(target) ? target : [target];

Object.keys(proxy)
.filter(function (prop) { return typeof proxy[prop] === 'function' && prop !== 'import' && prop !== 'export'; })
.filter(function (prop) { return typeof proxy[prop] === 'function'; })
.forEach(function (method) { return _this[method] = function () {

@@ -42,0 +44,0 @@ var args = [];

@@ -31,3 +31,5 @@ import { ArchStream as IArchStream, ITransformStream, ICallback } from 'arch-stream';

assert(params.length === 1);
return ArchStream.prototype.pipe.call(this, params[0]);
return method !== 'export'
? ArchStream.prototype.pipe.call(this, params[0])
: ArchStream.prototype.pipe.call(this, params[0]).export();

@@ -42,3 +44,3 @@ function toArray<T>(target: T|T[]): T[] {

Object.keys(proxy)
.filter(prop => typeof proxy[prop] === 'function' && prop !== 'import' && prop !== 'export')
.filter(prop => typeof proxy[prop] === 'function')
.forEach(method => this[method] = (...args: any[]) => this.proxy_<S>(method, args));

@@ -45,0 +47,0 @@ return <ArchStream<T>&S>this;

@@ -12,3 +12,3 @@ import A, { Proxy } from 'arch-stream';

.proxy(Proxy.Responsibility<Entity>())
.for(Entity, e => e)
.rule(Entity, e => e)
.pipe(e => ++e.val)

@@ -24,3 +24,3 @@ .pipe(e => ++e.val)

.proxy(Proxy.Responsibility<Entity>())
.for(Entity, e => e)
.rule(Entity, e => e)
.pipe(e => ++e.val)

@@ -33,4 +33,18 @@ .pipe(e => ++e.val)

it('multiple', function (done) {
A<Entity>()
.proxy(Proxy.Responsibility<Entity>())
.rule(Entity, e => e)
.pipe(e => ++e.val)
.rule(Entity, e => e)
.pipe(e => ++e.val)
.rule(Entity, e => null)
.pipe(e => ++e.val)
.export()
.read(e => assert(e.val === 2) || done())
.write(new Entity());
});
});
});

@@ -16,3 +16,3 @@ import A, { Proxy } from 'arch-stream';

.proxy(Proxy.Responsibility<Entity>())
.for(Entity, e => e)
.rule(Entity, e => e)
.pipe(e => e.state = 'resolved')

@@ -32,3 +32,3 @@ .pipe(_ => _, e => e.state = 'rejected')

.proxy(Proxy.Responsibility<Entity>())
.for(Entity, e => e)
.rule(Entity, e => e)
.pipe(e => e.state = 'resolved')

@@ -35,0 +35,0 @@ .pipe(_ => _, e => e.state = 'rejected')

@@ -5,4 +5,5 @@ {

"module": "commonjs",
"comments": false
"comments": false,
"experimentalDecorators": true
}
}

@@ -77,3 +77,3 @@ /**

interface ResponsibilityProxy<T, U> extends IProxy<T, U, {}> {
for<V extends Object>(type: new (...args: any[]) => V, extract: (entity: T) => V): U&ITransformStream<T, U>;
rule<V extends Object>(type: new (...args: any[]) => V, extract: (entity: T) => V): U&ResponsibilityProxy<T, U>&ITransformStream<T, U&ResponsibilityProxy<T, U>>;
}

@@ -80,0 +80,0 @@

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