Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function addCall(name, cb) {
return function () {
if (name in stats) {
stats[name].push(comb(arguments).toArray());
} else {
stats[name] = [comb(arguments).toArray()];
}
return cb.apply(this, arguments);
}
}
for (var key in proto) {
proto[key] = addCall(key, proto[key]);
}
return comb.merge({
reset: function reset() {
stats = {};
},
calledWith: function (name, args) {
return stats[name].some(function (called) {
return JSON.stringify(called) === JSON.stringify(args);
});
},
getCallCount: function (name) {
return (stats[name] || []).length;
}
}, proto);
}
return when(queue.queue, this.__subscribeHandler(), rpcQueue.queue).chain(function (q) {
q = q[0];
var ret = new Promise(),
correlationId = uuid.v4();
requests[correlationId] = ret;
rpcQueue.publish(msg, comb.merge({replyTo: q.name, correlationId: correlationId}, opts)).addErrback(ret.errback);
return ret.promise();
}).classic(cb);
},
hare.connectionOptions = function subsribeOptions(opts) {
comb.merge(CONNECTION_OPTIONS, opts || {});
return hare;
};
mappedColumn: function (name, table, condition, opts) {
opts = opts || {};
if (name) {
name = sql.stringToIdentifier(name);
if (table && condition) {
opts = comb.merge({joinType: "left", table: table, condition: condition, column: name}, opts);
this._mappedColumns[name] = opts;
} else {
throw new ModelError("mapped column requires a table and join condition");
}
}
return this;
},
var comb = require("comb"), inheritance = require("./inheritance");
/**
* @ignore
* @namespace
* @name patio.plugins
*/
comb.merge(exports, {
QueryPlugin:require("./query").QueryPlugin,
CachePlugin:require("./cache").CachePlugin,
AssociationPlugin:require("./association").AssociationPlugin,
TimeStampPlugin:require("./timestamp"),
ClassTableInheritancePlugin:inheritance.ClassTableInheritance,
ColumnMapper:require("./columnMapper.js"),
ValidatorPlugin:require("./validation.js")
});
hare.queueOptions = function subsribeOptions(opts) {
comb.merge(SUBSCRIBE_OPTIONS, opts || {});
return hare;
};