Comparing version 0.7.5 to 0.7.6
// Generated by CoffeeScript 1.7.1 | ||
(function() { | ||
var AdapterBase, async, types, _bindDomain; | ||
var AdapterBase, async, types, util, _bindDomain; | ||
@@ -9,2 +9,4 @@ async = require('async'); | ||
util = require('../util'); | ||
_bindDomain = function(fn) { | ||
@@ -64,5 +66,26 @@ var d; | ||
AdapterBase.prototype._refineRawInstance = function(model, data, selected_columns) { | ||
var id; | ||
var column, dont_eliminate_null, id, instance, parts, property, schema, support_nested, value, _i, _len; | ||
dont_eliminate_null = !this._connection.models[model].eliminate_null; | ||
schema = this._connection.models[model]._schema; | ||
if (!selected_columns) { | ||
selected_columns = Object.keys(schema); | ||
} | ||
support_nested = this.support_nested; | ||
id = this._getModelID(data); | ||
Object.defineProperty(data, 'id', { | ||
instance = {}; | ||
for (_i = 0, _len = selected_columns.length; _i < _len; _i++) { | ||
column = selected_columns[_i]; | ||
property = schema[column]; | ||
parts = property._parts; | ||
value = support_nested ? util.getPropertyOfPath(data, parts) : data[property._dbname]; | ||
if (value != null) { | ||
value = this.valueToModel(value, property); | ||
} else { | ||
value = null; | ||
} | ||
if ((value != null) || dont_eliminate_null) { | ||
util.setPropertyOfPath(instance, parts, value); | ||
} | ||
} | ||
Object.defineProperty(instance, 'id', { | ||
configurable: false, | ||
@@ -73,3 +96,3 @@ enumerable: true, | ||
}); | ||
return data; | ||
return instance; | ||
}; | ||
@@ -76,0 +99,0 @@ |
@@ -17,9 +17,9 @@ // Generated by CoffeeScript 1.7.1 | ||
_ = require('underscore'); | ||
AdapterBase = require('./base'); | ||
types = require('../types'); | ||
async = require('async'); | ||
_ = require('underscore'); | ||
types = require('../types'); | ||
@@ -417,27 +417,2 @@ _convertValueToObjectID = function(value, key) { | ||
MongoDBAdapter.prototype._refineRawInstance = function(model, data, selected_columns) { | ||
var column, dont_eliminate_null, id, schema, value, _i, _len; | ||
dont_eliminate_null = !this._connection.models[model].eliminate_null; | ||
schema = this._connection.models[model]._schema; | ||
if (!selected_columns) { | ||
selected_columns = Object.keys(schema); | ||
} | ||
id = _objectIdToString(data._id); | ||
delete data._id; | ||
for (_i = 0, _len = selected_columns.length; _i < _len; _i++) { | ||
column = selected_columns[_i]; | ||
value = this.valueToModel(data[column], schema[column]); | ||
if ((value != null) || dont_eliminate_null) { | ||
data[column] = value; | ||
} | ||
} | ||
Object.defineProperty(data, 'id', { | ||
configurable: false, | ||
enumerable: true, | ||
writable: false, | ||
value: id | ||
}); | ||
return data; | ||
}; | ||
MongoDBAdapter.prototype.create = function(model, data, callback) { | ||
@@ -444,0 +419,0 @@ return this._collection(model).insert(data, { |
@@ -186,29 +186,2 @@ // Generated by CoffeeScript 1.7.1 | ||
SQLAdapterBase.prototype._refineRawInstance = function(model, data, selected_columns) { | ||
var column, id, schema, _i, _len; | ||
schema = this._connection.models[model]._schema; | ||
if (!selected_columns) { | ||
selected_columns = Object.keys(schema); | ||
} | ||
id = this._getModelID(data); | ||
for (_i = 0, _len = selected_columns.length; _i < _len; _i++) { | ||
column = selected_columns[_i]; | ||
data[column] = this.valueToModel(data[column], schema[column]); | ||
} | ||
Object.defineProperty(data, 'id', { | ||
configurable: false, | ||
enumerable: true, | ||
writable: false, | ||
value: id | ||
}); | ||
if (this._connection.models[model].eliminate_null) { | ||
for (column in data) { | ||
if (data[column] == null) { | ||
delete data[column]; | ||
} | ||
} | ||
} | ||
return data; | ||
}; | ||
return SQLAdapterBase; | ||
@@ -215,0 +188,0 @@ |
{ | ||
"name": "cormo", | ||
"description": "ORM framework for Node.js", | ||
"version": "0.7.5", | ||
"version": "0.7.6", | ||
"keywords": [ | ||
@@ -6,0 +6,0 @@ "orm", |
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
246934
5859