Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"use strict";
var _Options = require("./_options"),
Queue = require("./queue"),
Exchange = require("./exchange"),
amqp = require("amqp"),
comb = require("comb"),
LOGGER = comb.logger("hare"),
isHash = comb.isHash,
Promise = comb.Promise,
Rpc = require("./rpc");
var SUBSCRIBE_OPTIONS = {},
CONNECTION_OPTIONS = {};
function errorHandler(err) {
if (LOGGER.appenders && LOGGER.appenders.length) {
LOGGER.error.apply(LOGGER, arguments);
} else {
console.error(err.stack || err);
}
}
var connect = (function connectWrapper() {
isUndefined = comb.isUndefined,
isUndefinedOrNull = comb.isUndefinedOrNull,
isFunction = comb.isFunction,
isInstanceOf = comb.isInstanceOf,
sql = require("../sql").sql,
array = comb.array,
isBoolean = comb.isBoolean,
when = comb.when,
zip = array.zip,
Promise = comb.Promise,
PromiseList = comb.PromiseList,
OneToMany = require("./oneToMany"),
pluralize = comb.pluralize,
AssociationError = require("../errors").AssociationError;
var LOGGER = comb.logger("comb.associations.ManyToMany");
/**
* @class Class to define a manyToMany association.
*
* <br>
* <b>NOT to be instantiated directly</b>
* Its just documented for reference.
*
* @name ManyToMany
* @augments patio.associations.OneToMany
* @memberOf patio.associations
*
* @param {String} options.joinTable the joinTable of the association.
*
*
* @property {String} joinTable the join table used in the relation.
* */
"use strict";
var comb = require("comb"),
merge = comb.merge,
extender = require("extender"),
argsToArray = comb.argsToArray,
isArray = comb.isArray,
LOGGER = comb.logger("werker.worker");
var errorHandler = comb(function errorHandler(message, err) {
if (message instanceof Error) {
err = message;
message = err.message;
}
if (isArray(err)) {
err.forEach(function (err) {
LOGGER.warn(err.stack || err);
});
} else if (err) {
LOGGER.warn(err.stack || err);
} else if (message) {
LOGGER.warn(message);
} else {
LOGGER.error(new Error("UNKNOWN"));
"use strict";
var comb = require("comb"),
Queue = require("./queue"),
_Options = require("./_options"),
_GetConnection = require("./_getConnection"),
Promise = comb.Promise,
when = comb.when,
LOGGER = comb.logger("hare.exchange");
var ExchangeQueue = comb.define(Queue, {
instance: {
constructor: function (name, exchange) {
this._super(arguments);
this._exchange = exchange;
this.exchange(exchange.exchangeName);
},
publish: function (routingKey, message, opts) {
var argLength = arguments.length;
if (argLength === 1) {
message = routingKey;
routingKey = this.queueName || this.get("routingKey") || '';
Model = model.Model,
plugins = require("./plugins"),
comb = require("comb"),
Time = require("./time"),
date = comb.date,
SQL = require("./sql").sql,
Promise = comb.Promise,
PromiseList = comb.PromiseList,
singleton = comb.singleton,
isFunction = comb.isFunction,
executeInOrder = comb.executeInOrder,
argsToArray = comb.argsToArray,
isString = comb.isString,
patio = exports;
var LOGGER = comb.logger("patio");
var Patio = singleton([EventEmitter, Time], {
instance: {
/**
* @lends patio.prototype
*/
__camelize: false,
__underscore: false,
__inImportOfModels: false,
__parseInt8: false,
"use strict";
var comb = require("comb"),
Promise = comb.Promise,
PromiseList = comb.PromiseList,
isFunction = comb.isFunction,
Queue = comb.collections.Queue,
merge = comb.merge,
define = comb.define,
Pool = comb.collections.Pool,
LOGGER = comb.logger("werker.pool");
define(Pool, {
instance: {
ttlTimeout: 1000,
/**
* WorkerPool to create a pool of workers.
* @constructs
* @param options
*/
constructor: function (options) {
options = options || {};
if (!options.createWorker || !isFunction(options.createWorker)) {
isFunction = comb.isFunction,
isNull = comb.isNull,
merge = comb.merge,
define = comb.define,
graph = require("./graph"),
actions = require("./actions"),
features = require("./features"),
query = require("./query"),
sql = require("./sql"),
SQL = require("../sql").sql,
AliasedExpression = SQL.AliasedExpression,
Identifier = SQL.Identifier,
QualifiedIdentifier = SQL.QualifiedIdentifier;
var LOGGER = comb.logger("patio.Dataset");
define([actions, graph, features, query, sql], {
instance: {
/**@lends patio.Dataset.prototype*/
/**
* Class that is used for querying/retrieving datasets from a database.
*
* <p> Dynamically generated methods include
* </p><ul>
* <li>Join methods from {@link patio.Dataset.CONDITIONED_JOIN_TYPES} and
* {@link patio.Dataset.UNCONDITIONED_JOIN_TYPES}, these methods handle the type call
* to {@link patio.Dataset#joinTable}, so to invoke include all arguments that
* {@link patio.Dataset#joinTable} requires except the type parameter. The default list includes.
* <ul>
* <li>Conditioned join types that accept conditions.</li></ul></li></ul>