Comparing version 0.8.7 to 0.8.8
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.8.0 | ||
// Generated by CoffeeScript 1.9.1 | ||
(function() { | ||
@@ -56,3 +56,3 @@ var AdapterBase, async, types, util; | ||
AdapterBase.prototype.setValuesFromDB = function(instance, data, schema, selected_columns) { | ||
var column, parts, property, support_nested, value, _i, _len, _results; | ||
var column, i, len, parts, property, results, support_nested, value; | ||
if (!selected_columns) { | ||
@@ -62,5 +62,5 @@ selected_columns = Object.keys(schema); | ||
support_nested = this.support_nested; | ||
_results = []; | ||
for (_i = 0, _len = selected_columns.length; _i < _len; _i++) { | ||
column = selected_columns[_i]; | ||
results = []; | ||
for (i = 0, len = selected_columns.length; i < len; i++) { | ||
column = selected_columns[i]; | ||
property = schema[column]; | ||
@@ -74,5 +74,5 @@ parts = property._parts; | ||
} | ||
_results.push(util.setPropertyOfPath(instance, parts, value)); | ||
results.push(util.setPropertyOfPath(instance, parts, value)); | ||
} | ||
return _results; | ||
return results; | ||
}; | ||
@@ -98,8 +98,8 @@ | ||
AdapterBase.prototype._convertToGroupInstance = function(model, data, group_by, group_fields) { | ||
var expr, field, instance, op, property, schema, _i, _len; | ||
var expr, field, i, instance, len, op, property, schema; | ||
instance = {}; | ||
if (group_by) { | ||
schema = this._connection.models[model]._schema; | ||
for (_i = 0, _len = group_by.length; _i < _len; _i++) { | ||
field = group_by[_i]; | ||
for (i = 0, len = group_by.length; i < len; i++) { | ||
field = group_by[i]; | ||
property = schema[field]; | ||
@@ -106,0 +106,0 @@ if (property) { |
@@ -1,6 +0,6 @@ | ||
// Generated by CoffeeScript 1.8.0 | ||
// Generated by CoffeeScript 1.9.1 | ||
(function() { | ||
var AdapterBase, MongoDBAdapter, ObjectID, async, error, mongodb, types, _, _buildGroupFields, _buildWhere, _buildWhereSingle, _convertValueToObjectID, _objectIdToString, | ||
__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; }; | ||
var AdapterBase, MongoDBAdapter, ObjectID, _, _buildGroupFields, _buildWhere, _buildWhereSingle, _convertValueToObjectID, _objectIdToString, async, error, mongodb, types, | ||
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; | ||
@@ -273,6 +273,6 @@ try { | ||
MongoDBAdapter = (function(_super) { | ||
MongoDBAdapter = (function(superClass) { | ||
var _getMongoDBColName; | ||
__extends(MongoDBAdapter, _super); | ||
extend(MongoDBAdapter, superClass); | ||
@@ -311,8 +311,8 @@ MongoDBAdapter.prototype.key_type = types.String; | ||
MongoDBAdapter.prototype.applySchema = function(model, callback) { | ||
var collection, column, index, indexes, obj, property, _i, _len, _ref, _ref1; | ||
var collection, column, i, index, indexes, len, obj, property, ref, ref1; | ||
collection = this._collection(model); | ||
indexes = []; | ||
_ref = this._connection.models[model]._schema; | ||
for (column in _ref) { | ||
property = _ref[column]; | ||
ref = this._connection.models[model]._schema; | ||
for (column in ref) { | ||
property = ref[column]; | ||
if (property.unique) { | ||
@@ -340,5 +340,5 @@ if (property.required) { | ||
} | ||
_ref1 = this._connection.models[model]._indexes; | ||
for (_i = 0, _len = _ref1.length; _i < _len; _i++) { | ||
index = _ref1[_i]; | ||
ref1 = this._connection.models[model]._indexes; | ||
for (i = 0, len = ref1.length; i < len; i++) { | ||
index = ref1[i]; | ||
if (index.options.unique) { | ||
@@ -423,3 +423,3 @@ indexes.push([ | ||
}, function(error, result) { | ||
var column, id, key, _ref; | ||
var column, id, key, ref; | ||
if ((error != null ? error.code : void 0) === 11000) { | ||
@@ -441,3 +441,3 @@ column = ''; | ||
} | ||
id = _objectIdToString(result != null ? (_ref = result[0]) != null ? _ref._id : void 0 : void 0); | ||
id = _objectIdToString(result != null ? (ref = result[0]) != null ? ref._id : void 0 : void 0); | ||
if (id) { | ||
@@ -504,4 +504,4 @@ delete data._id; | ||
MongoDBAdapter.prototype._buildUpdateOps = function(schema, update_ops, data, path, object) { | ||
var column, property, value, _results; | ||
_results = []; | ||
var column, property, results, value; | ||
results = []; | ||
for (column in object) { | ||
@@ -512,13 +512,13 @@ value = object[column]; | ||
if (value != null) { | ||
_results.push(update_ops.$set[path + column] = value); | ||
results.push(update_ops.$set[path + column] = value); | ||
} else { | ||
_results.push(update_ops.$unset[path + column] = ''); | ||
results.push(update_ops.$unset[path + column] = ''); | ||
} | ||
} else if (typeof object[column] === 'object') { | ||
_results.push(this._buildUpdateOps(schema, update_ops, data, path + column + '.', object[column])); | ||
results.push(this._buildUpdateOps(schema, update_ops, data, path + column + '.', object[column])); | ||
} else { | ||
_results.push(void 0); | ||
results.push(void 0); | ||
} | ||
} | ||
return _results; | ||
return results; | ||
}; | ||
@@ -693,3 +693,3 @@ | ||
return callback(null, result.map(function(record) { | ||
var group, _i, _len, _ref; | ||
var group, i, len, ref; | ||
if (options.group_by) { | ||
@@ -699,5 +699,5 @@ if (options.group_by.length === 1) { | ||
} else { | ||
_ref = options.group_by; | ||
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | ||
group = _ref[_i]; | ||
ref = options.group_by; | ||
for (i = 0, len = ref.length; i < len; i++) { | ||
group = ref[i]; | ||
record[group] = record._id[group]; | ||
@@ -704,0 +704,0 @@ } |
@@ -1,6 +0,6 @@ | ||
// Generated by CoffeeScript 1.8.0 | ||
// Generated by CoffeeScript 1.9.1 | ||
(function() { | ||
var MySQLAdapter, SQLAdapterBase, e, mysql, types, _, _propertyToSQL, _typeToSQL, | ||
__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; }; | ||
var MySQLAdapter, SQLAdapterBase, _, _propertyToSQL, _typeToSQL, e, mysql, types, | ||
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; | ||
@@ -59,6 +59,6 @@ try { | ||
MySQLAdapter = (function(_super) { | ||
MySQLAdapter = (function(superClass) { | ||
var _processSaveError; | ||
__extends(MySQLAdapter, _super); | ||
extend(MySQLAdapter, superClass); | ||
@@ -71,2 +71,14 @@ MySQLAdapter.prototype.key_type = types.Integer; | ||
MySQLAdapter.prototype._convertValueType = function(value, property_type) { | ||
if (property_type === types.Date) { | ||
value = new Date(value); | ||
} else if (property_type === types.Number) { | ||
value = Number(value); | ||
if (isNaN(value)) { | ||
value = Number.MAX_VALUE; | ||
} | ||
} | ||
return value; | ||
}; | ||
function MySQLAdapter(connection) { | ||
@@ -81,3 +93,3 @@ this._connection = connection; | ||
MySQLAdapter.prototype._createTable = function(model, callback) { | ||
var column, column_sql, columns, index, integrity, model_class, order, property, sql, tableName, unique, _i, _j, _len, _len1, _ref, _ref1, _ref2, _ref3; | ||
var column, column_sql, columns, index, integrity, j, k, len, len1, model_class, order, property, ref, ref1, ref2, ref3, sql, tableName, unique; | ||
model_class = this._connection.models[model]; | ||
@@ -87,5 +99,5 @@ tableName = model_class.tableName; | ||
sql.push('id INT NOT NULL AUTO_INCREMENT UNIQUE PRIMARY KEY'); | ||
_ref = model_class._schema; | ||
for (column in _ref) { | ||
property = _ref[column]; | ||
ref = model_class._schema; | ||
for (column in ref) { | ||
property = ref[column]; | ||
column_sql = _propertyToSQL(property); | ||
@@ -96,9 +108,9 @@ if (column_sql) { | ||
} | ||
_ref1 = model_class._indexes; | ||
for (_i = 0, _len = _ref1.length; _i < _len; _i++) { | ||
index = _ref1[_i]; | ||
ref1 = model_class._indexes; | ||
for (j = 0, len = ref1.length; j < len; j++) { | ||
index = ref1[j]; | ||
columns = []; | ||
_ref2 = index.columns; | ||
for (column in _ref2) { | ||
order = _ref2[column]; | ||
ref2 = index.columns; | ||
for (column in ref2) { | ||
order = ref2[column]; | ||
order = order === -1 ? 'DESC' : 'ASC'; | ||
@@ -108,7 +120,7 @@ columns.push(column + ' ' + order); | ||
unique = index.options.unique ? 'UNIQUE ' : ''; | ||
sql.push("" + unique + "INDEX " + index.options.name + " (" + (columns.join(',')) + ")"); | ||
sql.push(unique + "INDEX " + index.options.name + " (" + (columns.join(',')) + ")"); | ||
} | ||
_ref3 = model_class._integrities; | ||
for (_j = 0, _len1 = _ref3.length; _j < _len1; _j++) { | ||
integrity = _ref3[_j]; | ||
ref3 = model_class._integrities; | ||
for (k = 0, len1 = ref3.length; k < len1; k++) { | ||
integrity = ref3[k]; | ||
if (integrity.type === 'child_nullify') { | ||
@@ -243,6 +255,6 @@ sql.push("FOREIGN KEY (" + integrity.column + ") REFERENCES " + integrity.parent.tableName + "(id) ON DELETE SET NULL"); | ||
MySQLAdapter.prototype.create = function(model, data, callback) { | ||
var fields, places, sql, tableName, values, _ref; | ||
var fields, places, ref, sql, tableName, values; | ||
tableName = this._connection.models[model].tableName; | ||
values = []; | ||
_ref = this._buildUpdateSet(model, data, values, true), fields = _ref[0], places = _ref[1]; | ||
ref = this._buildUpdateSet(model, data, values, true), fields = ref[0], places = ref[1]; | ||
sql = "INSERT INTO " + tableName + " (" + fields + ") VALUES (" + places + ")"; | ||
@@ -270,4 +282,4 @@ return this._query(sql, values, function(error, result) { | ||
return function(item) { | ||
var places_sub, _ref; | ||
_ref = _this._buildUpdateSet(model, item, values, true), fields = _ref[0], places_sub = _ref[1]; | ||
var places_sub, ref; | ||
ref = _this._buildUpdateSet(model, item, values, true), fields = ref[0], places_sub = ref[1]; | ||
return places.push('(' + places_sub + ')'); | ||
@@ -365,3 +377,3 @@ }; | ||
if ((options.near != null) && (field = Object.keys(options.near)[0])) { | ||
order_by = "" + field + "_distance"; | ||
order_by = field + "_distance"; | ||
location = options.near[field]; | ||
@@ -477,4 +489,4 @@ select += ",GLENGTH(LINESTRING(" + field + ",POINT(" + location[0] + "," + location[1] + "))) AS " + field + "_distance"; | ||
return this._query(sql, params, function(error, result) { | ||
var _ref; | ||
if (error && ((_ref = error.code) === 'ER_ROW_IS_REFERENCED_' || _ref === 'ER_ROW_IS_REFERENCED_2')) { | ||
var ref; | ||
if (error && ((ref = error.code) === 'ER_ROW_IS_REFERENCED_' || ref === 'ER_ROW_IS_REFERENCED_2')) { | ||
return callback(new Error('rejected')); | ||
@@ -481,0 +493,0 @@ } |
@@ -1,6 +0,6 @@ | ||
// Generated by CoffeeScript 1.8.0 | ||
// Generated by CoffeeScript 1.9.1 | ||
(function() { | ||
var PostgreSQLAdapter, SQLAdapterBase, async, e, pg, types, _, _propertyToSQL, _typeToSQL, | ||
__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; }; | ||
var PostgreSQLAdapter, SQLAdapterBase, _, _propertyToSQL, _typeToSQL, async, e, pg, types, | ||
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; | ||
@@ -59,6 +59,6 @@ try { | ||
PostgreSQLAdapter = (function(_super) { | ||
PostgreSQLAdapter = (function(superClass) { | ||
var _processSaveError; | ||
__extends(PostgreSQLAdapter, _super); | ||
extend(PostgreSQLAdapter, superClass); | ||
@@ -86,3 +86,3 @@ PostgreSQLAdapter.prototype.key_type = types.Integer; | ||
PostgreSQLAdapter.prototype._createTable = function(model, callback) { | ||
var column, column_sql, integrity, model_class, property, sql, tableName, _i, _len, _ref, _ref1; | ||
var column, column_sql, i, integrity, len, model_class, property, ref, ref1, sql, tableName; | ||
model_class = this._connection.models[model]; | ||
@@ -92,5 +92,5 @@ tableName = model_class.tableName; | ||
sql.push('id SERIAL PRIMARY KEY'); | ||
_ref = model_class._schema; | ||
for (column in _ref) { | ||
property = _ref[column]; | ||
ref = model_class._schema; | ||
for (column in ref) { | ||
property = ref[column]; | ||
column_sql = _propertyToSQL(property); | ||
@@ -101,5 +101,5 @@ if (column_sql) { | ||
} | ||
_ref1 = model_class._integrities; | ||
for (_i = 0, _len = _ref1.length; _i < _len; _i++) { | ||
integrity = _ref1[_i]; | ||
ref1 = model_class._integrities; | ||
for (i = 0, len = ref1.length; i < len; i++) { | ||
integrity = ref1[i]; | ||
if (integrity.type === 'child_nullify') { | ||
@@ -120,7 +120,7 @@ sql.push("FOREIGN KEY (" + integrity.column + ") REFERENCES " + integrity.parent.tableName + "(id) ON DELETE SET NULL"); | ||
return async.forEach(model_class._indexes, function(index, callback) { | ||
var columns, order, unique, _ref2; | ||
var columns, order, ref2, unique; | ||
columns = []; | ||
_ref2 = index.columns; | ||
for (column in _ref2) { | ||
order = _ref2[column]; | ||
ref2 = index.columns; | ||
for (column in ref2) { | ||
order = ref2[column]; | ||
order = order === -1 ? 'DESC' : 'ASC'; | ||
@@ -186,3 +186,3 @@ columns.push(column + ' ' + order); | ||
column = key[1]; | ||
key = column.match(new RegExp("" + tableName + "_([^']*)_key")); | ||
key = column.match(new RegExp(tableName + "_([^']*)_key")); | ||
if (key != null) { | ||
@@ -240,6 +240,6 @@ column = key[1]; | ||
PostgreSQLAdapter.prototype.create = function(model, data, callback) { | ||
var fields, places, sql, tableName, values, _ref; | ||
var fields, places, ref, sql, tableName, values; | ||
tableName = this._connection.models[model].tableName; | ||
values = []; | ||
_ref = this._buildUpdateSet(model, data, values, true), fields = _ref[0], places = _ref[1]; | ||
ref = this._buildUpdateSet(model, data, values, true), fields = ref[0], places = ref[1]; | ||
sql = "INSERT INTO " + tableName + " (" + fields + ") VALUES (" + places + ") RETURNING id"; | ||
@@ -268,4 +268,4 @@ return this._query(sql, values, function(error, result) { | ||
return function(item) { | ||
var places_sub, _ref; | ||
_ref = _this._buildUpdateSet(model, item, values, true), fields = _ref[0], places_sub = _ref[1]; | ||
var places_sub, ref; | ||
ref = _this._buildUpdateSet(model, item, values, true), fields = ref[0], places_sub = ref[1]; | ||
return places.push('(' + places_sub + ')'); | ||
@@ -272,0 +272,0 @@ }; |
@@ -1,6 +0,6 @@ | ||
// Generated by CoffeeScript 1.8.0 | ||
// Generated by CoffeeScript 1.9.1 | ||
(function() { | ||
var AdapterBase, RedisAdapter, async, error, redis, tableize, types, _, | ||
__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; }; | ||
var AdapterBase, RedisAdapter, _, async, error, redis, tableize, types, | ||
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; | ||
@@ -25,4 +25,4 @@ try { | ||
RedisAdapter = (function(_super) { | ||
__extends(RedisAdapter, _super); | ||
RedisAdapter = (function(superClass) { | ||
extend(RedisAdapter, superClass); | ||
@@ -34,3 +34,3 @@ RedisAdapter.prototype.key_type = types.Integer; | ||
if (conditions.length === 0) { | ||
this._client.keys("" + table + ":*", function(error, keys) { | ||
this._client.keys(table + ":*", function(error, keys) { | ||
return callback(null, keys); | ||
@@ -51,6 +51,6 @@ }); | ||
callback(null, conditions.id.$in.map(function(id) { | ||
return "" + table + ":" + id; | ||
return table + ":" + id; | ||
})); | ||
} else { | ||
callback(null, ["" + table + ":" + conditions.id]); | ||
callback(null, [table + ":" + conditions.id]); | ||
} | ||
@@ -112,3 +112,3 @@ return; | ||
data.$_$ = ''; | ||
return this._client.incr("" + (tableize(model)) + ":_lastid", (function(_this) { | ||
return this._client.incr((tableize(model)) + ":_lastid", (function(_this) { | ||
return function(error, id) { | ||
@@ -118,3 +118,3 @@ if (error) { | ||
} | ||
return _this._client.hmset("" + (tableize(model)) + ":" + id, data, function(error) { | ||
return _this._client.hmset((tableize(model)) + ":" + id, data, function(error) { | ||
if (error) { | ||
@@ -135,3 +135,3 @@ return callback(RedisAdapter.wrapError('unknown error', error)); | ||
var key; | ||
key = "" + (tableize(model)) + ":" + data.id; | ||
key = (tableize(model)) + ":" + data.id; | ||
delete data.id; | ||
@@ -198,3 +198,3 @@ data.$_$ = ''; | ||
RedisAdapter.prototype.findById = function(model, id, options, callback) { | ||
return this._client.hgetall("" + (tableize(model)) + ":" + id, (function(_this) { | ||
return this._client.hgetall((tableize(model)) + ":" + id, (function(_this) { | ||
return function(error, result) { | ||
@@ -201,0 +201,0 @@ if (error) { |
@@ -1,6 +0,6 @@ | ||
// Generated by CoffeeScript 1.8.0 | ||
// Generated by CoffeeScript 1.9.1 | ||
(function() { | ||
var AdapterBase, SQLAdapterBase, types, | ||
__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; | ||
@@ -11,4 +11,4 @@ AdapterBase = require('./base'); | ||
SQLAdapterBase = (function(_super) { | ||
__extends(SQLAdapterBase, _super); | ||
SQLAdapterBase = (function(superClass) { | ||
extend(SQLAdapterBase, superClass); | ||
@@ -25,2 +25,11 @@ function SQLAdapterBase() { | ||
SQLAdapterBase.prototype._convertValueType = function(value, property_type) { | ||
if (property_type === types.Date) { | ||
value = new Date(value); | ||
} else if (property_type === types.Number) { | ||
value = Number(value); | ||
} | ||
return value; | ||
}; | ||
SQLAdapterBase.prototype._buildWhereSingle = function(property, key, value, params) { | ||
@@ -43,3 +52,3 @@ var keys, op, property_type, sub_key, values; | ||
})(this)); | ||
return "" + (key.replace('.', '_')) + " IN (" + (values.join(',')) + ")"; | ||
return (key.replace('.', '_')) + " IN (" + (values.join(',')) + ")"; | ||
} else if (typeof value === 'object' && value !== null && (keys = Object.keys(value)).length === 1) { | ||
@@ -63,3 +72,3 @@ sub_key = keys[0]; | ||
})(this)); | ||
return "" + (key.replace('.', '_')) + " IN (" + (values.join(',')) + ")"; | ||
return (key.replace('.', '_')) + " IN (" + (values.join(',')) + ")"; | ||
case '$gt': | ||
@@ -89,8 +98,5 @@ op = '>'; | ||
} else if (value === null) { | ||
return "" + (key.replace('.', '_')) + " IS NULL"; | ||
return (key.replace('.', '_')) + " IS NULL"; | ||
} | ||
if (property_type === types.Date) { | ||
value = new Date(value); | ||
} | ||
params.push(value); | ||
params.push(this._convertValueType(value, property_type)); | ||
return key.replace('.', '_') + op + this._param_place_holder(params.length); | ||
@@ -185,3 +191,3 @@ }; | ||
expr = group_fields[field]; | ||
selects.push("" + (this._buildGroupExpr(expr)) + " as " + field); | ||
selects.push((this._buildGroupExpr(expr)) + " as " + field); | ||
} | ||
@@ -188,0 +194,0 @@ return selects.join(','); |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.8.0 | ||
// Generated by CoffeeScript 1.9.1 | ||
(function() { | ||
@@ -8,3 +8,3 @@ var SQLite3Adapter_createAdapter; | ||
module.exports = function(connection) { | ||
var adapter, _super_connect; | ||
var _super_connect, adapter; | ||
adapter = SQLite3Adapter_createAdapter(connection); | ||
@@ -11,0 +11,0 @@ _super_connect = adapter.connect; |
@@ -1,6 +0,6 @@ | ||
// Generated by CoffeeScript 1.8.0 | ||
// Generated by CoffeeScript 1.9.1 | ||
(function() { | ||
var SQLAdapterBase, SQLite3Adapter, async, e, sqlite3, types, _, _propertyToSQL, _typeToSQL, | ||
__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; }; | ||
var SQLAdapterBase, SQLite3Adapter, _, _propertyToSQL, _typeToSQL, async, e, sqlite3, types, | ||
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; | ||
@@ -59,6 +59,6 @@ try { | ||
SQLite3Adapter = (function(_super) { | ||
SQLite3Adapter = (function(superClass) { | ||
var _processSaveError; | ||
__extends(SQLite3Adapter, _super); | ||
extend(SQLite3Adapter, superClass); | ||
@@ -78,3 +78,3 @@ SQLite3Adapter.prototype.key_type = types.Integer; | ||
SQLite3Adapter.prototype._createTable = function(model, callback) { | ||
var column, column_sql, integrity, model_class, property, sql, tableName, _i, _len, _ref, _ref1; | ||
var column, column_sql, integrity, j, len, model_class, property, ref, ref1, sql, tableName; | ||
model_class = this._connection.models[model]; | ||
@@ -84,5 +84,5 @@ tableName = model_class.tableName; | ||
sql.push('id INTEGER PRIMARY KEY AUTOINCREMENT'); | ||
_ref = model_class._schema; | ||
for (column in _ref) { | ||
property = _ref[column]; | ||
ref = model_class._schema; | ||
for (column in ref) { | ||
property = ref[column]; | ||
column_sql = _propertyToSQL(property); | ||
@@ -93,5 +93,5 @@ if (column_sql) { | ||
} | ||
_ref1 = model_class._integrities; | ||
for (_i = 0, _len = _ref1.length; _i < _len; _i++) { | ||
integrity = _ref1[_i]; | ||
ref1 = model_class._integrities; | ||
for (j = 0, len = ref1.length; j < len; j++) { | ||
integrity = ref1[j]; | ||
if (integrity.type === 'child_nullify') { | ||
@@ -112,7 +112,7 @@ sql.push("FOREIGN KEY (" + integrity.column + ") REFERENCES " + integrity.parent.tableName + "(id) ON DELETE SET NULL"); | ||
return async.forEach(model_class._indexes, function(index, callback) { | ||
var columns, order, unique, _ref2; | ||
var columns, order, ref2, unique; | ||
columns = []; | ||
_ref2 = index.columns; | ||
for (column in _ref2) { | ||
order = _ref2[column]; | ||
ref2 = index.columns; | ||
for (column in ref2) { | ||
order = ref2[column]; | ||
order = order === -1 ? 'DESC' : 'ASC'; | ||
@@ -187,6 +187,6 @@ columns.push(column + ' ' + order); | ||
SQLite3Adapter.prototype._buildUpdateSetOfColumn = function(property, data, values, fields, places, insert) { | ||
var dbname, _ref; | ||
var dbname, ref; | ||
dbname = property._dbname; | ||
if (property.type === types.Date) { | ||
values.push((_ref = data[dbname]) != null ? _ref.getTime() : void 0); | ||
values.push((ref = data[dbname]) != null ? ref.getTime() : void 0); | ||
} else { | ||
@@ -231,6 +231,6 @@ values.push(data[dbname]); | ||
SQLite3Adapter.prototype.create = function(model, data, callback) { | ||
var fields, places, sql, tableName, values, _ref; | ||
var fields, places, ref, sql, tableName, values; | ||
tableName = this._connection.models[model].tableName; | ||
values = []; | ||
_ref = this._buildUpdateSet(model, data, values, true), fields = _ref[0], places = _ref[1]; | ||
ref = this._buildUpdateSet(model, data, values, true), fields = ref[0], places = ref[1]; | ||
sql = "INSERT INTO " + tableName + " (" + fields + ") VALUES (" + places + ")"; | ||
@@ -246,3 +246,29 @@ return this._query('run', sql, values, function(error) { | ||
SQLite3Adapter.prototype.createBulk = function(model, data, callback) { | ||
return this._createBulkDefault(model, data, callback); | ||
var fields, places, sql, tableName, values; | ||
tableName = this._connection.models[model].tableName; | ||
values = []; | ||
fields = void 0; | ||
places = []; | ||
data.forEach((function(_this) { | ||
return function(item) { | ||
var places_sub, ref; | ||
ref = _this._buildUpdateSet(model, item, values, true), fields = ref[0], places_sub = ref[1]; | ||
return places.push('(' + places_sub + ')'); | ||
}; | ||
})(this)); | ||
sql = "INSERT INTO " + tableName + " (" + fields + ") VALUES " + (places.join(',')); | ||
return this._query('run', sql, values, function(error) { | ||
var id; | ||
if (error) { | ||
return _processSaveError(error, callback); | ||
} | ||
if (id = this.lastID) { | ||
id = id - data.length + 1; | ||
return callback(null, data.map(function(item, i) { | ||
return id + i; | ||
})); | ||
} else { | ||
return callback(new Error('unexpected result')); | ||
} | ||
}); | ||
}; | ||
@@ -249,0 +275,0 @@ |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.8.0 | ||
// Generated by CoffeeScript 1.9.1 | ||
(function() { | ||
@@ -13,3 +13,3 @@ var CommandConsole, commander, cormo_console, resolve; | ||
function CommandConsole(argv) { | ||
var cwd, e, load, loads, path, program, _i, _len; | ||
var cwd, e, i, len, load, loads, path, program; | ||
loads = []; | ||
@@ -30,4 +30,4 @@ program = new commander.Command('cormo'); | ||
cwd = process.cwd(); | ||
for (_i = 0, _len = loads.length; _i < _len; _i++) { | ||
load = loads[_i]; | ||
for (i = 0, len = loads.length; i < len; i++) { | ||
load = loads[i]; | ||
console.log("Loading module '" + load + "'..."); | ||
@@ -34,0 +34,0 @@ try { |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.8.0 | ||
// Generated by CoffeeScript 1.9.1 | ||
(function() { | ||
@@ -3,0 +3,0 @@ var Command, path; |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.8.0 | ||
// Generated by CoffeeScript 1.9.1 | ||
(function() { | ||
@@ -3,0 +3,0 @@ var CommandRemoteConsole, net; |
@@ -1,4 +0,4 @@ | ||
// Generated by CoffeeScript 1.8.0 | ||
// Generated by CoffeeScript 1.9.1 | ||
(function() { | ||
var ConnectionAssociation, Promise, bindDomain, inflector, types, _; | ||
var ConnectionAssociation, Promise, _, bindDomain, inflector, types; | ||
@@ -233,7 +233,7 @@ _ = require('underscore'); | ||
return function(item) { | ||
var models, options, target_model, this_model, _ref, _ref1; | ||
var models, options, ref, ref1, target_model, this_model; | ||
this_model = item.this_model; | ||
options = item.options; | ||
if (typeof item.target_model_or_column === 'string') { | ||
if ((_ref = item.options) != null ? _ref.connection : void 0) { | ||
if ((ref = item.options) != null ? ref.connection : void 0) { | ||
models = item.options.connection.models; | ||
@@ -243,3 +243,3 @@ } else { | ||
} | ||
if ((_ref1 = item.options) != null ? _ref1.type : void 0) { | ||
if ((ref1 = item.options) != null ? ref1.type : void 0) { | ||
target_model = item.options.type; | ||
@@ -306,5 +306,5 @@ options.as = item.target_model_or_column; | ||
return query.exec().then(function(records) { | ||
var array, _name; | ||
var array, name; | ||
if (records.length > 0) { | ||
array = result[_name = integrity.child._name] || (result[_name] = []); | ||
array = result[name = integrity.child._name] || (result[name] = []); | ||
[].push.apply(array, records.map(function(record) { | ||
@@ -508,3 +508,3 @@ return record.id; | ||
return function() { | ||
var association, record, _ref, _ref1; | ||
var association, record, ref, ref1; | ||
record = Array.isArray(records) ? records[0] : records; | ||
@@ -521,5 +521,5 @@ if (!record) { | ||
} else if (options.model) { | ||
association = (_ref = options.model._associations) != null ? _ref[column] : void 0; | ||
association = (ref = options.model._associations) != null ? ref[column] : void 0; | ||
} else { | ||
association = (_ref1 = record.constructor._associations) != null ? _ref1[column] : void 0; | ||
association = (ref1 = record.constructor._associations) != null ? ref1[column] : void 0; | ||
} | ||
@@ -526,0 +526,0 @@ if (!association) { |
@@ -1,6 +0,6 @@ | ||
// Generated by CoffeeScript 1.8.0 | ||
// Generated by CoffeeScript 1.9.1 | ||
(function() { | ||
var Connection, EventEmitter, Model, Promise, bindDomain, inspect, redis, _, _use, | ||
__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; }; | ||
var Connection, EventEmitter, Model, Promise, _, _use, bindDomain, inspect, redis, | ||
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; | ||
@@ -23,4 +23,4 @@ EventEmitter = require('events').EventEmitter; | ||
Connection = (function(_super) { | ||
__extends(Connection, _super); | ||
Connection = (function(superClass) { | ||
extend(Connection, superClass); | ||
@@ -67,10 +67,10 @@ function Connection(adapter_name, settings) { | ||
Connection.prototype._checkArchive = function() { | ||
var model, modelClass, _Archive, _ref, _results; | ||
_ref = this.models; | ||
_results = []; | ||
for (model in _ref) { | ||
modelClass = _ref[model]; | ||
var _Archive, model, modelClass, ref, results; | ||
ref = this.models; | ||
results = []; | ||
for (model in ref) { | ||
modelClass = ref[model]; | ||
if (modelClass.archive && !modelClass._connection.models.hasOwnProperty('_Archive')) { | ||
_results.push(_Archive = (function(_super1) { | ||
__extends(_Archive, _super1); | ||
results.push(_Archive = (function(superClass1) { | ||
extend(_Archive, superClass1); | ||
@@ -93,6 +93,6 @@ function _Archive() { | ||
} else { | ||
_results.push(void 0); | ||
results.push(void 0); | ||
} | ||
} | ||
return _results; | ||
return results; | ||
}; | ||
@@ -99,0 +99,0 @@ |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.8.0 | ||
// Generated by CoffeeScript 1.9.1 | ||
(function() { | ||
@@ -86,3 +86,3 @@ var ConnectionManipulate, Promise, bindDomain, inflector, types; | ||
ConnectionManipulate.prototype._manipulateConvertIds = function(id_to_record_map, model, data) { | ||
var column, property, record, _ref, _results; | ||
var column, property, record, ref, results; | ||
model = inflector.camelize(model); | ||
@@ -93,9 +93,9 @@ if (!this.models[model]) { | ||
model = this.models[model]; | ||
_ref = model._schema; | ||
_results = []; | ||
for (column in _ref) { | ||
property = _ref[column]; | ||
ref = model._schema; | ||
results = []; | ||
for (column in ref) { | ||
property = ref[column]; | ||
if (property.record_id && data.hasOwnProperty(column)) { | ||
if (property.array && Array.isArray(data[column])) { | ||
_results.push(data[column] = data[column].map(function(value) { | ||
results.push(data[column] = data[column].map(function(value) { | ||
var record; | ||
@@ -112,12 +112,12 @@ record = id_to_record_map[value]; | ||
if (record) { | ||
_results.push(data[column] = record.id); | ||
results.push(data[column] = record.id); | ||
} else { | ||
_results.push(void 0); | ||
results.push(void 0); | ||
} | ||
} | ||
} else { | ||
_results.push(void 0); | ||
results.push(void 0); | ||
} | ||
} | ||
return _results; | ||
return results; | ||
}; | ||
@@ -124,0 +124,0 @@ |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.8.0 | ||
// Generated by CoffeeScript 1.9.1 | ||
(function() { | ||
@@ -3,0 +3,0 @@ exports.Connection = require('./connection'); |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.8.0 | ||
// Generated by CoffeeScript 1.9.1 | ||
(function() { | ||
@@ -3,0 +3,0 @@ var ModelCache, Promise, bindDomain, tableize; |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.8.0 | ||
// Generated by CoffeeScript 1.9.1 | ||
(function() { | ||
@@ -71,4 +71,4 @@ var ModelCallback; | ||
ModelCallback.prototype._runCallbacks = function(name, type) { | ||
var callbacks, _ref; | ||
callbacks = (_ref = this.constructor._callbacks_map) != null ? _ref[name] : void 0; | ||
var callbacks, ref; | ||
callbacks = (ref = this.constructor._callbacks_map) != null ? ref[name] : void 0; | ||
callbacks = callbacks != null ? callbacks.filter(function(callback) { | ||
@@ -75,0 +75,0 @@ return callback.type === type; |
@@ -1,6 +0,6 @@ | ||
// Generated by CoffeeScript 1.8.0 | ||
// Generated by CoffeeScript 1.9.1 | ||
(function() { | ||
var ColumnProperty, Model, Promise, tableize, types, util, _, _pf_get, _pf_getChanged, _pf_getPrevious, _pf_isDirty, _pf_reset, _pf_set, _use, | ||
__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; }; | ||
var ColumnProperty, Model, Promise, _, _pf_get, _pf_getChanged, _pf_getPrevious, _pf_isDirty, _pf_reset, _pf_set, _use, tableize, types, util, | ||
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; | ||
@@ -53,4 +53,4 @@ _ = require('underscore'); | ||
var NewModel, property; | ||
NewModel = (function(_super) { | ||
__extends(NewModel, _super); | ||
NewModel = (function(superClass) { | ||
extend(NewModel, superClass); | ||
@@ -143,3 +143,3 @@ function NewModel() { | ||
Model.column = function(path, property) { | ||
var i, parts, subcolumn, subproperty, type, _i, _ref; | ||
var i, j, parts, ref, subcolumn, subproperty, type; | ||
this._checkConnection(); | ||
@@ -177,3 +177,3 @@ if (typeof property === 'object' && !Array.isArray(property) && (!property.type || property.type.type)) { | ||
parts = path.split('.'); | ||
for (i = _i = 0, _ref = parts.length - 1; 0 <= _ref ? _i < _ref : _i > _ref; i = 0 <= _ref ? ++_i : --_i) { | ||
for (i = j = 0, ref = parts.length - 1; 0 <= ref ? j < ref : j > ref; i = 0 <= ref ? ++j : --j) { | ||
this._intermediate_paths[parts.slice(0, +i + 1 || 9e9).join('.')] = 1; | ||
@@ -219,3 +219,3 @@ } | ||
function Model(data) { | ||
var adapter, column, ctor, id, last, obj, parts, path, property, schema, selected_columns, selected_columns_raw, value, _i, _len, _ref, _ref1, _ref2; | ||
var adapter, column, ctor, id, j, last, len, obj, parts, path, property, ref, ref1, ref2, schema, selected_columns, selected_columns_raw, value; | ||
data = data || {}; | ||
@@ -236,6 +236,6 @@ ctor = this.constructor; | ||
}); | ||
_ref = Object.keys(ctor._intermediate_paths).sort(); | ||
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | ||
path = _ref[_i]; | ||
_ref1 = util.getLeafOfPath(this, path), obj = _ref1[0], last = _ref1[1]; | ||
ref = Object.keys(ctor._intermediate_paths).sort(); | ||
for (j = 0, len = ref.length; j < len; j++) { | ||
path = ref[j]; | ||
ref1 = util.getLeafOfPath(this, path), obj = ref1[0], last = ref1[1]; | ||
this._intermediates[path] = {}; | ||
@@ -246,3 +246,3 @@ this._defineProperty(obj, last, path, false); | ||
property = schema[column]; | ||
_ref2 = util.getLeafOfPath(this, property._parts), obj = _ref2[0], last = _ref2[1]; | ||
ref2 = util.getLeafOfPath(this, property._parts), obj = ref2[0], last = ref2[1]; | ||
this._defineProperty(obj, last, column, false); | ||
@@ -304,7 +304,7 @@ } | ||
Model._collapseNestedNulls = function(instance, selected_columns_raw, intermediates) { | ||
var has_non_null, key, last, obj, path, value, _i, _len, _ref, _ref1, _ref2, _results; | ||
_ref = Object.keys(this._intermediate_paths); | ||
_results = []; | ||
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | ||
path = _ref[_i]; | ||
var has_non_null, j, key, last, len, obj, path, ref, ref1, ref2, results, value; | ||
ref = Object.keys(this._intermediate_paths); | ||
results = []; | ||
for (j = 0, len = ref.length; j < len; j++) { | ||
path = ref[j]; | ||
if (selected_columns_raw && selected_columns_raw.indexOf(path) === -1) { | ||
@@ -317,8 +317,8 @@ continue; | ||
} else { | ||
_ref1 = util.getLeafOfPath(instance, path), obj = _ref1[0], last = _ref1[1]; | ||
ref1 = util.getLeafOfPath(instance, path), obj = ref1[0], last = ref1[1]; | ||
} | ||
has_non_null = false; | ||
_ref2 = obj[last]; | ||
for (key in _ref2) { | ||
value = _ref2[key]; | ||
ref2 = obj[last]; | ||
for (key in ref2) { | ||
value = ref2[key]; | ||
if (value != null) { | ||
@@ -329,8 +329,8 @@ has_non_null = true; | ||
if (!has_non_null) { | ||
_results.push(obj[last] = null); | ||
results.push(obj[last] = null); | ||
} else { | ||
_results.push(void 0); | ||
results.push(void 0); | ||
} | ||
} | ||
return _results; | ||
return results; | ||
}; | ||
@@ -376,3 +376,3 @@ | ||
Model.prototype.set = function(path, value) { | ||
var k, last, obj, parts, prev_value, v, _ref, _ref1, _results, _results1; | ||
var k, last, obj, parts, prev_value, ref, ref1, results, results1, v; | ||
if (this._intermediates.hasOwnProperty(path)) { | ||
@@ -383,8 +383,8 @@ obj = this._intermediates[path]; | ||
} | ||
_results = []; | ||
results = []; | ||
for (k in value) { | ||
v = value[k]; | ||
_results.push(obj[k] = v); | ||
results.push(obj[k] = v); | ||
} | ||
return _results; | ||
return results; | ||
} else { | ||
@@ -399,12 +399,12 @@ parts = path.split('.'); | ||
} | ||
_ref = util.getLeafOfPath(this, parts), obj = _ref[0], last = _ref[1]; | ||
ref = util.getLeafOfPath(this, parts), obj = ref[0], last = ref[1]; | ||
this._defineProperty(obj, last, path, true); | ||
util.setPropertyOfPath(this._attributes, parts, value); | ||
_results1 = []; | ||
results1 = []; | ||
while (parts.length > 1) { | ||
parts.pop(); | ||
_ref1 = util.getLeafOfPath(this, parts), obj = _ref1[0], last = _ref1[1]; | ||
_results1.push(this._defineProperty(obj, last, parts.join('.'), true)); | ||
ref1 = util.getLeafOfPath(this, parts), obj = ref1[0], last = ref1[1]; | ||
results1.push(this._defineProperty(obj, last, parts.join('.'), true)); | ||
} | ||
return _results1; | ||
return results1; | ||
} | ||
@@ -414,6 +414,6 @@ }; | ||
Model.prototype.reset = function() { | ||
var path, value, _ref; | ||
_ref = this._prev_attributes; | ||
for (path in _ref) { | ||
value = _ref[path]; | ||
var path, ref, value; | ||
ref = this._prev_attributes; | ||
for (path in ref) { | ||
value = ref[path]; | ||
this.set(path, value); | ||
@@ -479,3 +479,3 @@ } | ||
return function(column) { | ||
return "" + column + ": " + _this._schema[column].type; | ||
return column + ": " + _this._schema[column].type; | ||
}; | ||
@@ -482,0 +482,0 @@ })(this)).join(', '); |
@@ -1,4 +0,4 @@ | ||
// Generated by CoffeeScript 1.8.0 | ||
// Generated by CoffeeScript 1.9.1 | ||
(function() { | ||
var ModelPersistence, Promise, inflector, util, _; | ||
var ModelPersistence, Promise, _, inflector, util; | ||
@@ -5,0 +5,0 @@ _ = require('underscore'); |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.8.0 | ||
// Generated by CoffeeScript 1.9.1 | ||
(function() { | ||
@@ -3,0 +3,0 @@ var ModelQuery, Query, bindDomain; |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.8.0 | ||
// Generated by CoffeeScript 1.9.1 | ||
(function() { | ||
@@ -3,0 +3,0 @@ var ModelTimestamp; |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.8.0 | ||
// Generated by CoffeeScript 1.9.1 | ||
(function() { | ||
@@ -51,4 +51,4 @@ var ModelValidate, Promise, types, util; | ||
ModelValidate._validateColumn = function(data, column, property) { | ||
var error, i, last, obj, v, value, _i, _len, _ref; | ||
_ref = util.getLeafOfPath(data, property._parts, false), obj = _ref[0], last = _ref[1]; | ||
var error, i, j, last, len, obj, ref, v, value; | ||
ref = util.getLeafOfPath(data, property._parts, false), obj = ref[0], last = ref[1]; | ||
value = obj != null ? obj[last] : void 0; | ||
@@ -61,3 +61,3 @@ if (value != null) { | ||
try { | ||
for (i = _i = 0, _len = value.length; _i < _len; i = ++_i) { | ||
for (i = j = 0, len = value.length; j < len; i = ++j) { | ||
v = value[i]; | ||
@@ -64,0 +64,0 @@ value[i] = this._validateType(column, property.type, v); |
@@ -1,4 +0,4 @@ | ||
// Generated by CoffeeScript 1.8.0 | ||
// Generated by CoffeeScript 1.9.1 | ||
(function() { | ||
var Promise, Query, bindDomain, _; | ||
var Promise, Query, _, bindDomain; | ||
@@ -208,8 +208,8 @@ _ = require('underscore'); | ||
Query.prototype.endif = function() { | ||
var condition, _i, _len, _ref; | ||
var condition, i, len, ref; | ||
this._ifs.pop(); | ||
this._current_if = true; | ||
_ref = this._ifs; | ||
for (_i = 0, _len = _ref.length; _i < _len; _i++) { | ||
condition = _ref[_i]; | ||
ref = this._ifs; | ||
for (i = 0, len = ref.length; i < len; i++) { | ||
condition = ref[i]; | ||
this._current_if && (this._current_if = condition); | ||
@@ -294,5 +294,5 @@ } | ||
records = _this._preserve_order_ids.map(function(id) { | ||
var record, _i, _len; | ||
for (_i = 0, _len = records.length; _i < _len; _i++) { | ||
record = records[_i]; | ||
var i, len, record; | ||
for (i = 0, len = records.length; i < len; i++) { | ||
record = records[i]; | ||
if (record.id === id) { | ||
@@ -375,6 +375,6 @@ return record; | ||
Query.prototype._validateAndBuildSaveData = function(errors, data, updates, path, object) { | ||
var column, error, model, property, schema, temp, _results; | ||
var column, error, model, property, results, schema, temp; | ||
model = this._model; | ||
schema = model._schema; | ||
_results = []; | ||
results = []; | ||
for (column in object) { | ||
@@ -389,3 +389,3 @@ property = schema[path + column]; | ||
} | ||
_results.push(model._buildSaveDataColumn(data, updates, path + column, property, true)); | ||
results.push(model._buildSaveDataColumn(data, updates, path + column, property, true)); | ||
} else if (!object[column] && model._intermediate_paths[column]) { | ||
@@ -399,10 +399,10 @@ column += '.'; | ||
}); | ||
_results.push(this._validateAndBuildSaveData(errors, data, updates, path + column, temp)); | ||
results.push(this._validateAndBuildSaveData(errors, data, updates, path + column, temp)); | ||
} else if (typeof object[column] === 'object') { | ||
_results.push(this._validateAndBuildSaveData(errors, data, updates, path + column + '.', object[column])); | ||
results.push(this._validateAndBuildSaveData(errors, data, updates, path + column + '.', object[column])); | ||
} else { | ||
_results.push(void 0); | ||
results.push(void 0); | ||
} | ||
} | ||
return _results; | ||
return results; | ||
}; | ||
@@ -409,0 +409,0 @@ |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.8.0 | ||
// Generated by CoffeeScript 1.9.1 | ||
(function() { | ||
@@ -3,0 +3,0 @@ var GeoPoint, Integer, RecordID; |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.8.0 | ||
// Generated by CoffeeScript 1.9.1 | ||
(function() { | ||
@@ -52,3 +52,3 @@ var Connection, Model, Promise, addArgCompleter, coffee, evalCoffee, fs, path, prettyErrorMessage, repl, setupContext, util, vm; | ||
argsMatch = obj.toString().match(/^function\s*[^\(]*\(\s*([^\)]*)\)/m); | ||
rli.output.write("" + (line.trim()) + " \u001b[35m" + argsMatch[1] + "\u001b[39m\r\n"); | ||
rli.output.write((line.trim()) + " \u001b[35m" + argsMatch[1] + "\u001b[39m\r\n"); | ||
rli._refreshLine(); | ||
@@ -100,3 +100,3 @@ } | ||
setupContext = function(context, options) { | ||
var connection, key, model, modelClass, object, _ref, _ref1; | ||
var connection, key, model, modelClass, object, ref, ref1; | ||
context.Connection = Connection; | ||
@@ -106,5 +106,5 @@ context.Model = Model; | ||
if (connection) { | ||
_ref = connection.models; | ||
for (model in _ref) { | ||
modelClass = _ref[model]; | ||
ref = connection.models; | ||
for (model in ref) { | ||
modelClass = ref[model]; | ||
context[model] = modelClass; | ||
@@ -127,5 +127,5 @@ } | ||
}); | ||
_ref1 = exports["public"]; | ||
for (key in _ref1) { | ||
object = _ref1[key]; | ||
ref1 = exports["public"]; | ||
for (key in ref1) { | ||
object = ref1[key]; | ||
context[key] = object; | ||
@@ -132,0 +132,0 @@ } |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.8.0 | ||
// Generated by CoffeeScript 1.9.1 | ||
(function() { | ||
@@ -8,3 +8,3 @@ var Promise; | ||
exports.getLeafOfPath = function(obj, path, create_object) { | ||
var last, part, parts, _i, _j, _len, _len1; | ||
var i, j, last, len, len1, part, parts; | ||
parts = Array.isArray(path) ? path.slice(0) : path.split('.'); | ||
@@ -14,9 +14,9 @@ last = parts.pop(); | ||
if (create_object !== false) { | ||
for (_i = 0, _len = parts.length; _i < _len; _i++) { | ||
part = parts[_i]; | ||
for (i = 0, len = parts.length; i < len; i++) { | ||
part = parts[i]; | ||
obj = obj[part] || (obj[part] = {}); | ||
} | ||
} else { | ||
for (_j = 0, _len1 = parts.length; _j < _len1; _j++) { | ||
part = parts[_j]; | ||
for (j = 0, len1 = parts.length; j < len1; j++) { | ||
part = parts[j]; | ||
obj = obj[part]; | ||
@@ -33,4 +33,4 @@ if (!obj) { | ||
exports.getPropertyOfPath = function(obj, path) { | ||
var last, _ref; | ||
_ref = exports.getLeafOfPath(obj, path, false), obj = _ref[0], last = _ref[1]; | ||
var last, ref; | ||
ref = exports.getLeafOfPath(obj, path, false), obj = ref[0], last = ref[1]; | ||
return obj != null ? obj[last] : void 0; | ||
@@ -40,4 +40,4 @@ }; | ||
exports.setPropertyOfPath = function(obj, path, value) { | ||
var last, _ref; | ||
_ref = exports.getLeafOfPath(obj, path), obj = _ref[0], last = _ref[1]; | ||
var last, ref; | ||
ref = exports.getLeafOfPath(obj, path), obj = ref[0], last = ref[1]; | ||
obj[last] = value; | ||
@@ -44,0 +44,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.8.0 | ||
// Generated by CoffeeScript 1.9.1 | ||
(function() { | ||
@@ -3,0 +3,0 @@ var inflect; |
{ | ||
"name": "cormo", | ||
"description": "ORM framework for Node.js", | ||
"version": "0.8.7", | ||
"version": "0.8.8", | ||
"keywords": [ | ||
@@ -30,22 +30,26 @@ "orm", | ||
}, | ||
"engines": { | ||
"node": ">= 0.10" | ||
}, | ||
"dependencies": { | ||
"async": "~0.9.0", | ||
"bluebird": "~2.3.4", | ||
"commander": "~2.3.0", | ||
"bluebird": "~2.9.13", | ||
"commander": "~2.6.0", | ||
"inflect": "~0.3.0", | ||
"underscore": "~1.7.0" | ||
"underscore": "~1.8.2" | ||
}, | ||
"devDependencies": { | ||
"benchmark": "~1.0.0", | ||
"chai": "~1.9.2", | ||
"coffee-coverage": "~0.4.2", | ||
"coffee-script": "~1.8.0", | ||
"crojsdoc": "~0.8.8", | ||
"microtime": "~1.0.1", | ||
"mocha": "~1.21.4", | ||
"mongodb": "~1.4.18", | ||
"mysql": "~2.5.4", | ||
"pg": "~3.5.0", | ||
"redis": "~0.12.1" | ||
"chai": "~2.1.0", | ||
"coffee-coverage": "~0.4.5", | ||
"coffee-script": "~1.9.1", | ||
"crojsdoc": "~0.8.11", | ||
"microtime": "~1.2.0", | ||
"mocha": "~2.1.0", | ||
"mongodb": "~1.4.32", | ||
"mysql": "~2.5.5", | ||
"pg": "~4.3.0", | ||
"redis": "~0.12.1", | ||
"sqlite3": "~3.0.5" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
252178
5580
12
+ Addedbluebird@2.9.34(transitive)
+ Addedcommander@2.6.0(transitive)
+ Addedunderscore@1.8.3(transitive)
- Removedbluebird@2.3.11(transitive)
- Removedcommander@2.3.0(transitive)
- Removedunderscore@1.7.0(transitive)
Updatedbluebird@~2.9.13
Updatedcommander@~2.6.0
Updatedunderscore@~1.8.2