Comparing version 0.7.6 to 0.7.7
{ | ||
"name": "salad", | ||
"main": "build/salad.js", | ||
"version": "0.7.6", | ||
"version": "0.7.7", | ||
"homepage": "https://github.com/komola/salad", | ||
@@ -6,0 +6,0 @@ "authors": [ |
(function() { | ||
var __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; }, | ||
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; | ||
__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; }; | ||
@@ -300,37 +299,5 @@ Salad.DAO.Sequelize = (function(_super) { | ||
Sequelize.prototype._buildOptions = function(options) { | ||
var attribs, conditions, contains, containsOr, elm, key, newConditions, nullCondition, option, order, pairs, params, queryGenerator, tableName, truthyConditions, val, value, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2, _ref3, _ref4, _ref5; | ||
var attribs, contains, elm, key, option, order, params, queryGenerator, tableName, val, _i, _j, _len, _len1, _ref, _ref1, _ref2, _ref3; | ||
params = {}; | ||
if (_.keys(options.conditions).length > 0) { | ||
pairs = []; | ||
_ref = options.conditions; | ||
for (key in _ref) { | ||
conditions = _ref[key]; | ||
if (_.isArray(conditions) && __indexOf.call(conditions, null) >= 0) { | ||
truthyConditions = {}; | ||
truthyConditions[key] = _.filter(conditions, (function(_this) { | ||
return function(elm) { | ||
return elm !== null; | ||
}; | ||
})(this)); | ||
nullCondition = {}; | ||
nullCondition[key] = null; | ||
conditions = App.sequelize.or(nullCondition, truthyConditions); | ||
pairs.push(conditions); | ||
} else { | ||
newConditions = {}; | ||
newConditions[key] = conditions; | ||
pairs.push(newConditions); | ||
} | ||
} | ||
for (_i = 0, _len = pairs.length; _i < _len; _i++) { | ||
value = pairs[_i]; | ||
if (!(((_ref1 = value.args) != null ? _ref1.length : void 0) > 1)) { | ||
continue; | ||
} | ||
containsOr = true; | ||
break; | ||
} | ||
if (containsOr) { | ||
options.conditions = App.sequelize.and.apply(null, pairs); | ||
} | ||
params.where = options.conditions; | ||
@@ -346,5 +313,5 @@ } | ||
order = []; | ||
_ref2 = options.order; | ||
for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) { | ||
elm = _ref2[_j]; | ||
_ref = options.order; | ||
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | ||
elm = _ref[_i]; | ||
order.push(["\"" + elm.field + "\"", elm.type.toUpperCase()]); | ||
@@ -357,7 +324,7 @@ } | ||
attribs = (function() { | ||
var _k, _len2, _ref3, _results; | ||
_ref3 = options.contains; | ||
var _j, _len1, _ref1, _results; | ||
_ref1 = options.contains; | ||
_results = []; | ||
for (_k = 0, _len2 = _ref3.length; _k < _len2; _k++) { | ||
contains = _ref3[_k]; | ||
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { | ||
contains = _ref1[_j]; | ||
_results.push("'" + contains.value + "' = ANY(\"" + tableName + "\".\"" + contains.field + "\")"); | ||
@@ -368,5 +335,5 @@ } | ||
if (params.where) { | ||
_ref3 = params.where; | ||
for (key in _ref3) { | ||
val = _ref3[key]; | ||
_ref1 = params.where; | ||
for (key in _ref1) { | ||
val = _ref1[key]; | ||
queryGenerator = this.daoModelInstance.daoFactoryManager.sequelize.queryInterface.QueryGenerator; | ||
@@ -383,7 +350,7 @@ key = queryGenerator.quoteIdentifier(key); | ||
} | ||
if (((_ref4 = options.includes) != null ? _ref4.length : void 0) > 0) { | ||
if (((_ref2 = options.includes) != null ? _ref2.length : void 0) > 0) { | ||
params.include = []; | ||
_ref5 = options.includes; | ||
for (_k = 0, _len2 = _ref5.length; _k < _len2; _k++) { | ||
option = _ref5[_k]; | ||
_ref3 = options.includes; | ||
for (_j = 0, _len1 = _ref3.length; _j < _len1; _j++) { | ||
option = _ref3[_j]; | ||
option = this._transformInclude(option); | ||
@@ -390,0 +357,0 @@ params.include.push(option); |
{ | ||
"name": "salad", | ||
"main": "./index.js", | ||
"version": "0.7.6", | ||
"version": "0.7.7", | ||
"description": "", | ||
@@ -6,0 +6,0 @@ "homepage": "http://github.com/komola/salad", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
411445
5995