Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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;
define(Pool, {
instance: {
/**@lends patio.ConnectionPool.prototype*/
/**
* ConnectionPool object used internall by the {@link patio.Database} class;
* @constructs;
* @param options
*/
constructor: function (options) {
options = options || {};
if (!options.createConnection || !isFunction(options.createConnection)) {
throw new Error("patio.adapters.clients.ConnectionPool : create connection CB required.");
}
define = comb.define,
merge = comb.merge,
hitch = comb.hitch,
when = comb.when,
isBoolean = comb.isBoolean,
isEmpty = comb.isEmpty,
isArray = comb.isArray,
isUndefined = comb.isUndefined,
isPromiseLike = comb.isPromiseLike,
isUndefinedOrNull = comb.isUndefinedOrNull,
argsToArray = comb.argsToArray,
isFunction = comb.isFunction,
format = comb.string.format,
Promise = comb.Promise,
isNull = comb.isNull,
Queue = comb.collections.Queue,
sql = require("../sql").sql,
PromiseList = comb.PromiseList,
errors = require("../errors"),
NotImplemented = errors.NotImplemented,
stream = require("stream"),
PassThroughStream = stream.PassThrough,
utils = require("../utils"),
pipeAll = utils.pipeAll,
resolveOrPromisfyFunction = utils.resolveOrPromisfyFunction;
var Database = define(null, {
instance: {
/**@lends patio.Database.prototype*/
/**
isBoolean = comb.isBoolean,
isString = comb.isString,
argsToArray = comb.argsToArray,
isInstanceOf = comb.isInstanceOf,
isHash = comb.isHash,
when = comb.when,
merge = comb.merge,
toArray = comb.array.toArray,
ModelError = require("./errors").ModelError,
plugins = require("./plugins"),
isUndefinedOrNull = comb.isUndefinedOrNull,
AssociationPlugin = plugins.AssociationPlugin,
QueryPlugin = plugins.QueryPlugin,
Promise = comb.Promise,
PromiseList = comb.PromiseList,
HashTable = comb.collections.HashTable,
hitch = comb.hitch,
Middleware = comb.plugins.Middleware,
EventEmitter = require("events").EventEmitter,
util = require("util"),
define = comb.define,
patio;
var MODELS = new HashTable();
var applyColumnTransformMethod = function (val, meth) {
return !isUndefinedOrNull(meth) ? isFunction(val[meth]) ? val[meth] : isFunction(comb[meth]) ? comb[meth](val) : val : val;
};
var Model = define([QueryPlugin, Middleware], {
instance: {
"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
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;
define(Pool, {
instance: {
/**@lends patio.ConnectionPool.prototype*/
/**
* ConnectionPool object used internall by the {@link patio.Database} class;
* @constructs;
* @param options
*/
constructor: function (options) {
options = options || {};
"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 || {};