Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mutual

Package Overview
Dependencies
Maintainers
3
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mutual - npm Package Compare versions

Comparing version 0.4.18 to 0.4.19

dump.rdb

30

lib/channel.js

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

// Generated by CoffeeScript 1.8.0
// Generated by CoffeeScript 1.9.3
(function() {

@@ -19,11 +19,11 @@ var Channel;

Channel.prototype.fire = function(message) {
var handler, _i, _len, _ref, _results;
var handler, i, len, ref, results;
this["package"](message);
_ref = this.handlers;
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
handler = _ref[_i];
_results.push(handler(message));
ref = this.handlers;
results = [];
for (i = 0, len = ref.length; i < len; i++) {
handler = ref[i];
results.push(handler(message));
}
return _results;
return results;
};

@@ -38,12 +38,12 @@

return this.handlers = (function() {
var _i, _len, _ref, _results;
_ref = this.handlers;
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
_handler = _ref[_i];
var i, len, ref, results;
ref = this.handlers;
results = [];
for (i = 0, len = ref.length; i < len; i++) {
_handler = ref[i];
if (_handler !== handler) {
_results.push(_handler);
results.push(_handler);
}
}
return _results;
return results;
}).call(this);

@@ -50,0 +50,0 @@ };

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

// Generated by CoffeeScript 1.8.0
// Generated by CoffeeScript 1.9.3
(function() {
var DurableChannel, EventChannel, Redis, RemoteQueue, Transport, randomKey,
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
hasProp = {}.hasOwnProperty;

@@ -17,4 +17,4 @@ randomKey = require("key-forge").randomKey;

DurableChannel = (function(_super) {
__extends(DurableChannel, _super);
DurableChannel = (function(superClass) {
extend(DurableChannel, superClass);

@@ -43,3 +43,3 @@ function DurableChannel(options) {

this.queue = new RemoteQueue({
name: "" + this.name + ".queue",
name: this.name + ".queue",
transport: this.transport

@@ -57,5 +57,5 @@ });

DurableChannel.prototype["package"] = function(_arg) {
DurableChannel.prototype["package"] = function(arg) {
var content, message, requestId, timeout, to;
content = _arg.content, to = _arg.to, requestId = _arg.requestId, timeout = _arg.timeout;
content = arg.content, to = arg.to, requestId = arg.requestId, timeout = arg.timeout;
return message = {

@@ -75,3 +75,3 @@ id: randomKey(16),

return _this.transport._acquire(function(client) {
return client.hget("" + channel + ".messages", id, function(err, data) {
return client.hget(channel + ".messages", id, function(err, data) {
_this.transport._release(client);

@@ -89,3 +89,3 @@ return events.callback(err, data != null ? JSON.parse(data) : null);

return _this.transport._acquire(function(client) {
return client.hset("" + channel + ".messages", id, JSON.stringify(message), function(err, data) {
return client.hset(channel + ".messages", id, JSON.stringify(message), function(err, data) {
_this.transport._release(client);

@@ -103,3 +103,3 @@ return events.callback(err, data);

return _this.transport._acquire(function(client) {
return client.hdel("" + channel + ".messages", id, function(err, data) {
return client.hdel(channel + ".messages", id, function(err, data) {
_this.transport._release(client);

@@ -116,3 +116,3 @@ return events.callback(err, data);

return queue = new RemoteQueue({
name: "" + name + ".queue",
name: name + ".queue",
transport: this.transport

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

return _this.transport._acquire(function(client) {
return client.zadd(["" + name + ".pending", Date.now() + timeout, "" + channel + "::" + id], function(err, data) {
return client.zadd([name + ".pending", Date.now() + timeout, channel + "::" + id], function(err, data) {
_this.transport._release(client);

@@ -143,3 +143,3 @@ return events.callback(err, data);

return _this.transport._acquire(function(client) {
return client.zrem(["" + name + ".pending", "" + channel + "::" + id], function(err, data) {
return client.zrem([name + ".pending", channel + "::" + id], function(err, data) {
_this.transport._release(client);

@@ -159,3 +159,3 @@ return events.callback(err, data);

return _this.transport._acquire(function(client) {
return client.zscore(["" + name + ".pending", "" + channel + "::" + id], function(err, data) {
return client.zscore([name + ".pending", channel + "::" + id], function(err, data) {
_this.transport._release(client);

@@ -178,3 +178,3 @@ return events.callback(err, data);

return _this.transport._acquire(function(client) {
return client.zrangebyscore(["" + _this.name + ".pending", 0, Date.now()], function(err, data) {
return client.zrangebyscore([_this.name + ".pending", 0, Date.now()], function(err, data) {
_this.transport._release(client);

@@ -191,20 +191,20 @@ return events.callback(err, data);

return _this.events.source(function(events) {
var expiredMessage, expiredMessageTokens, returned, _events, _i, _len, _results;
returned = 0;
_results = [];
for (_i = 0, _len = expiredMessages.length; _i < _len; _i++) {
expiredMessage = expiredMessages[_i];
expiredMessageTokens = expiredMessage.split("::");
_events = _this.expireMessage(expiredMessageTokens[0], expiredMessageTokens[1]);
_events.on("success", function() {
returned++;
if (returned === expiredMessages.length) {
return events.emit("success");
}
});
_results.push(_events.on("error", function(err) {
return events.emit("error", err);
}));
}
return _results;
var iterate, iterationCount;
iterationCount = 0;
return (iterate = function() {
var _events, expiredMessageTokens;
if (iterationCount < expiredMessages.length) {
expiredMessageTokens = expiredMessages[iterationCount].split("::");
iterationCount++;
_events = _this.expireMessage(expiredMessageTokens[0], expiredMessageTokens[1]);
_events.on("success", function() {
return iterate();
});
return _events.on("error", function() {
return iterate();
});
} else {
return events.emit("success");
}
})();
});

@@ -265,5 +265,5 @@ });

DurableChannel.prototype.send = function(_arg) {
DurableChannel.prototype.send = function(arg) {
var content, message, timeout, to;
content = _arg.content, to = _arg.to, timeout = _arg.timeout;
content = arg.content, to = arg.to, timeout = arg.timeout;
message = this["package"]({

@@ -289,5 +289,5 @@ content: content,

DurableChannel.prototype.reply = function(_arg) {
DurableChannel.prototype.reply = function(arg) {
var message, response, timeout;
message = _arg.message, response = _arg.response, timeout = _arg.timeout;
message = arg.message, response = arg.response, timeout = arg.timeout;
return this.events.serially((function(_this) {

@@ -398,4 +398,4 @@ return function(go) {

return go(function() {
var _ref, _ref1;
if (((_ref = _this.channels["message"]) != null ? (_ref1 = _ref.handlers) != null ? _ref1.length : void 0 : void 0) > 0) {
var ref, ref1;
if (((ref = _this.channels["message"]) != null ? (ref1 = ref.handlers) != null ? ref1.length : void 0 : void 0) > 0) {
return _this.queue.once("message", messageHandler);

@@ -424,3 +424,3 @@ }

clearTimeout(this.timeoutMonitor);
return this.transport.end("" + this.name + ".queue", !this.isTransportShared);
return this.transport.end(this.name + ".queue", !this.isTransportShared);
};

@@ -427,0 +427,0 @@

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

// Generated by CoffeeScript 1.8.0
// Generated by CoffeeScript 1.9.3
(function() {
var Attributes, Channel, EventChannel, PatternSet, include, merge, overload, type, w, _ref,
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
__slice = [].slice;
var Attributes, Channel, EventChannel, PatternSet, include, merge, overload, ref, type, w,
bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
hasProp = {}.hasOwnProperty,
slice = [].slice;
_ref = require("fairmont"), include = _ref.include, Attributes = _ref.Attributes, merge = _ref.merge, type = _ref.type, w = _ref.w;
ref = require("fairmont"), include = ref.include, Attributes = ref.Attributes, merge = ref.merge, type = ref.type, w = ref.w;

@@ -17,4 +17,4 @@ Channel = require("./channel");

EventChannel = (function(_super) {
__extends(EventChannel, _super);
EventChannel = (function(superClass) {
extend(EventChannel, superClass);

@@ -24,3 +24,3 @@ include(EventChannel, Attributes);

function EventChannel() {
this.callback = __bind(this.callback, this);
this.callback = bind(this.callback, this);
EventChannel.__super__.constructor.apply(this, arguments);

@@ -32,4 +32,4 @@ this.channels = {};

return _this._patterns.match(message.event, function(event) {
var _ref1;
return (_ref1 = _this.channels[event]) != null ? _ref1.fire(message.content) : void 0;
var ref1;
return (ref1 = _this.channels[event]) != null ? ref1.fire(message.content) : void 0;
});

@@ -42,6 +42,6 @@ };

match("string", "function", function(name, handler) {
var _base;
var base;
this._patterns.add(name);
if ((_base = this.channels)[name] == null) {
_base[name] = new Channel;
if ((base = this.channels)[name] == null) {
base[name] = new Channel;
}

@@ -70,3 +70,3 @@ this.channels[name].receive(handler);

var args;
args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
handler.apply(null, args);

@@ -104,3 +104,3 @@ return _this.remove(name, _handler);

message = merge(message, {
event: "" + name + "." + message.event
event: name + "." + message.event
});

@@ -141,4 +141,4 @@ }

EventChannel.prototype.remove = function(event, handler) {
var _ref1;
return (_ref1 = this.channels[event]) != null ? _ref1.remove(handler) : void 0;
var ref1;
return (ref1 = this.channels[event]) != null ? ref1.remove(handler) : void 0;
};

@@ -148,5 +148,5 @@

var error, results;
error = arguments[0], results = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
error = arguments[0], results = 2 <= arguments.length ? slice.call(arguments, 1) : [];
if (error == null) {
return this.emit.apply(this, ["success"].concat(__slice.call(results)));
return this.emit.apply(this, ["success"].concat(slice.call(results)));
} else {

@@ -163,4 +163,4 @@ return this.emit("error", error);

var args, event;
event = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
emit.call.apply(emit, [this, event].concat(__slice.call(args)));
event = arguments[0], args = 2 <= arguments.length ? slice.call(arguments, 1) : [];
emit.call.apply(emit, [this, event].concat(slice.call(args)));
args = (function() {

@@ -192,6 +192,6 @@ switch (args.length) {

EventChannel.prototype.serially = function() {
var accumulate, args, builder, events, functions, go, _ref1;
args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
var accumulate, args, builder, events, functions, go, ref1;
args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
if (args.length === 2) {
(_ref1 = args[0], accumulate = _ref1.accumulate), builder = args[1];
(ref1 = args[0], accumulate = ref1.accumulate), builder = args[1];
} else {

@@ -208,3 +208,3 @@ builder = args[0];

return function(arg) {
var count, results, _fn;
var _fn, count, results;
results = [];

@@ -259,3 +259,3 @@ count = 0;

_fn = function(arg) {
var called, errors, finish, fn, name, record_error, results, returned, _i, _len, _ref1, _results;
var called, errors, finish, fn, j, len, name, record_error, ref1, results, results1, returned;
results = {};

@@ -290,7 +290,7 @@ errors = {};

}
_results = [];
for (_i = 0, _len = functions.length; _i < _len; _i++) {
_ref1 = functions[_i], name = _ref1[0], fn = _ref1[1];
_results.push((function(name, fn) {
var rval, success, _error;
results1 = [];
for (j = 0, len = functions.length; j < len; j++) {
ref1 = functions[j], name = ref1[0], fn = ref1[1];
results1.push((function(name, fn) {
var _error, rval, success;
success = function(result) {

@@ -319,3 +319,3 @@ if (name != null) {

}
return _results;
return results1;
};

@@ -329,12 +329,12 @@ _fn(arg);

var fn, fns, rval;
fns = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
fns = 1 <= arguments.length ? slice.call(arguments, 0) : [];
rval = (function() {
var _i, _len, _results;
_results = [];
for (_i = 0, _len = fns.length; _i < _len; _i++) {
fn = fns[_i];
_results.push((function(_this) {
var j, len, results1;
results1 = [];
for (j = 0, len = fns.length; j < len; j++) {
fn = fns[j];
results1.push((function(_this) {
return function() {
var args;
args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
return _this.source(function(events) {

@@ -345,7 +345,7 @@ var series;

}, function(step) {
var arg, i, _j, _len1, _results1;
_results1 = [];
for (i = _j = 0, _len1 = args.length; _j < _len1; i = ++_j) {
var arg, i, k, len1, results2;
results2 = [];
for (i = k = 0, len1 = args.length; k < len1; i = ++k) {
arg = args[i];
_results1.push((function(arg) {
results2.push((function(arg) {
return step(function() {

@@ -356,3 +356,3 @@ return arg;

}
return _results1;
return results2;
})();

@@ -363,3 +363,3 @@ series.on("error", function(error) {

return series.on("success", function(results) {
return fn.apply(null, __slice.call(results).concat([events.callback]));
return fn.apply(null, slice.call(results).concat([events.callback]));
});

@@ -370,3 +370,3 @@ });

}
return _results;
return results1;
}).call(this);

@@ -373,0 +373,0 @@ if (rval.length < 2) {

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

// Generated by CoffeeScript 1.8.0
// Generated by CoffeeScript 1.9.3
(function() {

@@ -3,0 +3,0 @@ var getter;

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

// Generated by CoffeeScript 1.8.0
// Generated by CoffeeScript 1.9.3
(function() {

@@ -13,4 +13,4 @@ var Pattern, PatternSet;

PatternSet.prototype.add = function(specification) {
var _base;
return (_base = this._patterns)[specification] != null ? _base[specification] : _base[specification] = new Pattern(specification);
var base;
return (base = this._patterns)[specification] != null ? base[specification] : base[specification] = new Pattern(specification);
};

@@ -23,7 +23,7 @@

PatternSet.prototype.match = function(target, callback) {
var pattern, results, specification, _ref;
var pattern, ref, results, specification;
results = [];
_ref = this._patterns;
for (specification in _ref) {
pattern = _ref[specification];
ref = this._patterns;
for (specification in ref) {
pattern = ref[specification];
if (pattern.match(target)) {

@@ -30,0 +30,0 @@ if (callback != null) {

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

// Generated by CoffeeScript 1.8.0
// Generated by CoffeeScript 1.9.3
(function() {
var Pattern, memoize, _match, _parse,
__slice = [].slice;
var Pattern, _match, _parse, memoize,
slice = [].slice;

@@ -14,3 +14,3 @@ memoize = require("fairmont").memoize;

error = _error;
throw new Error("" + string + " is not a valid pattern");
throw new Error(string + " is not a valid pattern");
}

@@ -28,4 +28,4 @@ };

} else {
p = pattern[0], px = 2 <= pattern.length ? __slice.call(pattern, 1) : [];
t = target[0], tx = 2 <= target.length ? __slice.call(target, 1) : [];
p = pattern[0], px = 2 <= pattern.length ? slice.call(pattern, 1) : [];
t = target[0], tx = 2 <= target.length ? slice.call(target, 1) : [];
if (p === "*") {

@@ -32,0 +32,0 @@ if (_match(px, tx)) {

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

// Generated by CoffeeScript 1.8.0
// Generated by CoffeeScript 1.9.3
(function() {

@@ -3,0 +3,0 @@ var EventChannel, Promisifier, promise;

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

// Generated by CoffeeScript 1.8.0
// Generated by CoffeeScript 1.9.3
(function() {
var EventChannel, Pool, RedisTransport, redis, toError, type, _ref,
__slice = [].slice;
var EventChannel, Pool, RedisTransport, redis, ref, toError, type,
slice = [].slice;

@@ -10,3 +10,3 @@ redis = require("redis");

_ref = require("fairmont"), type = _ref.type, toError = _ref.toError;
ref = require("fairmont"), type = ref.type, toError = ref.toError;

@@ -130,3 +130,3 @@ EventChannel = require("./event-channel");

name = (type(name)) === "array" ? name : [name];
client.brpop.apply(client, __slice.call(name).concat([_this.blockTimeout], [_events.callback]));
client.brpop.apply(client, slice.call(name).concat([_this.blockTimeout], [_events.callback]));
return _events.on("success", function(results) {

@@ -133,0 +133,0 @@ if ((_this.ending[name] != null) && _this.ending[name] === true) {

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

// Generated by CoffeeScript 1.8.0
// Generated by CoffeeScript 1.9.3
(function() {
var EventChannel, RemoteChannel,
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
hasProp = {}.hasOwnProperty;
EventChannel = require("./event-channel");
RemoteChannel = (function(_super) {
__extends(RemoteChannel, _super);
RemoteChannel = (function(superClass) {
extend(RemoteChannel, superClass);

@@ -12,0 +12,0 @@ RemoteChannel.prototype.isListening = false;

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

// Generated by CoffeeScript 1.8.0
// Generated by CoffeeScript 1.9.3
(function() {
var RemoteChannel, RemoteQueue,
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
hasProp = {}.hasOwnProperty;
RemoteChannel = require("./remote-channel");
RemoteQueue = (function(_super) {
__extends(RemoteQueue, _super);
RemoteQueue = (function(superClass) {
extend(RemoteQueue, superClass);

@@ -34,5 +34,5 @@ function RemoteQueue() {

return _this.transport.dequeue(_this.name).on("success", function(message) {
var _ref, _ref1;
var ref, ref1;
_this.fire(message);
if (((_ref = _this.channels[message.event]) != null ? (_ref1 = _ref.handlers) != null ? _ref1.length : void 0 : void 0) > 0) {
if (((ref = _this.channels[message.event]) != null ? (ref1 = ref.handlers) != null ? ref1.length : void 0 : void 0) > 0) {
return setImmediate(_dequeue);

@@ -39,0 +39,0 @@ }

{
"name": "mutual",
"version": "0.4.18",
"version": "0.4.19",
"description": "Scala-inspired Actors that use Redis as a message transport",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

Sorry, the diff of this file is not supported yet

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