Comparing version 0.2.3 to 0.2.4
@@ -1,2 +0,2 @@ | ||
// Bookshelf.js 0.2.3 | ||
// Bookshelf.js 0.2.4 | ||
@@ -28,3 +28,3 @@ // (c) 2013 Tim Griesser | ||
// Keep in sync with `package.json`. | ||
Bookshelf.VERSION = '0.2.3'; | ||
Bookshelf.VERSION = '0.2.4'; | ||
@@ -419,10 +419,16 @@ // We're using `Backbone.Events` rather than `EventEmitter`, | ||
// In case we need to reference the `previousAttributes` for the model | ||
// in the following event handlers. | ||
options.previousAttributes = model._previousAttributes; | ||
model._reset(); | ||
return when.all([ | ||
model.triggerThen((method === 'insert' ? 'created' : 'updated'), model, resp, options), | ||
model.triggerThen('saved', model, resp, options) | ||
]).then(function() { | ||
return model._reset(); | ||
}); | ||
}) | ||
.ensure(function() { model.resetQuery(); }); | ||
]); | ||
}).then(function() { | ||
return model; | ||
}); | ||
}, | ||
@@ -444,4 +450,2 @@ | ||
}); | ||
}).ensure(function() { | ||
model.resetQuery(); | ||
}); | ||
@@ -464,3 +468,4 @@ }, | ||
for (var key in relations) { | ||
attrs[key] = relations[key].toJSON(); | ||
var relation = relations[key]; | ||
attrs[key] = relation.toJSON ? relation.toJSON() : relation; | ||
} | ||
@@ -950,5 +955,4 @@ return attrs; | ||
}()).then(function() { | ||
syncing.resetQuery(); | ||
return sync.query.select(columns); | ||
}).ensure(function() { | ||
syncing.resetQuery(); | ||
}); | ||
@@ -959,10 +963,6 @@ }, | ||
insert: function() { | ||
var syncing = this.syncing; | ||
var syncing = this.syncing.resetQuery(); | ||
return this.query | ||
.idAttribute(syncing.idAttribute) | ||
.insert(syncing.format(extendNull(syncing.attributes))) | ||
.then(function(resp) { | ||
syncing._previousAttributes = extendNull(syncing.attributes); | ||
return resp; | ||
}); | ||
.insert(syncing.format(extendNull(syncing.attributes))); | ||
}, | ||
@@ -972,10 +972,6 @@ | ||
update: function(attrs, options) { | ||
var syncing = this.syncing; | ||
var syncing = this.syncing.resetQuery(); | ||
return this.query | ||
.where(syncing.idAttribute, syncing.id) | ||
.update(syncing.format(extendNull(syncing.attributes))) | ||
.then(function(resp) { | ||
syncing._previousAttributes = extendNull(syncing.attributes); | ||
return resp; | ||
}); | ||
.update(syncing.format(extendNull(syncing.attributes))); | ||
}, | ||
@@ -985,6 +981,6 @@ | ||
del: function() { | ||
var wheres, syncing = this.syncing; | ||
if (this.syncing.id != null) { | ||
var wheres, syncing = this.syncing.resetQuery(); | ||
if (syncing.id != null) { | ||
wheres = {}; | ||
wheres[this.syncing.idAttribute] = this.syncing.id; | ||
wheres[syncing.idAttribute] = syncing.id; | ||
} | ||
@@ -991,0 +987,0 @@ if (!wheres && this.query.wheres.length === 0) { |
{ | ||
"name": "bookshelf", | ||
"version": "0.2.3", | ||
"version": "0.2.4", | ||
"description": "A lightweight Active Record ORM for PostgreSQL, MySQL, and SQLite3, influenced by Backbone.js", | ||
@@ -10,3 +10,6 @@ "main": "bookshelf.js", | ||
"homepage": "http://bookshelfjs.org", | ||
"repository": "https://github.com/tgriesser/bookshelf", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/tgriesser/bookshelf.git" | ||
}, | ||
"keywords": [ | ||
@@ -20,18 +23,14 @@ "orm", | ||
], | ||
"repository":{ | ||
"type": "git", | ||
"url": "https://github.com/tgriesser/bookshelf.git" | ||
}, | ||
"dependencies": { | ||
"backbone": "1.0.x", | ||
"knex": ">=0.1.8", | ||
"underscore": "~1.4.4", | ||
"backbone": "~1.0.0", | ||
"inflection": "~1.2.x", | ||
"when": "~2.1.0", | ||
"trigger-then": ">=0.1.1" | ||
"when": "~2.2.1", | ||
"trigger-then": "~0.1.1", | ||
"underscore": "~1.5.1", | ||
"knex": "~0.1.8" | ||
}, | ||
"devDependencies": { | ||
"mocha": "1.7.x", | ||
"mocha": "~1.12.0", | ||
"mysql": "~2.0.0-alpha7", | ||
"pg": "~0.15.1", | ||
"pg": "~2.3.0", | ||
"sqlite3": "~2.1.7", | ||
@@ -43,3 +42,3 @@ "objectdump": "~0.3.0", | ||
"name": "Tim Griesser", | ||
"web": "https://github.com/tgriesser" | ||
"web": "https://github.com/tgriesser" | ||
}, | ||
@@ -46,0 +45,0 @@ "license": "MIT", |
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
170858
4592
+ Addedgeneric-pool@2.0.4(transitive)
+ Addedknex@0.1.8(transitive)
+ Addedtrigger-then@0.1.1(transitive)
+ Addedunderscore@1.5.2(transitive)
+ Addedwhen@2.2.1(transitive)
- Removedcolorette@2.0.19(transitive)
- Removedcommander@10.0.1(transitive)
- Removeddebug@4.3.4(transitive)
- Removedescalade@3.2.0(transitive)
- Removedesm@3.2.25(transitive)
- Removedfunction-bind@1.1.2(transitive)
- Removedget-package-type@0.1.0(transitive)
- Removedgetopts@2.3.0(transitive)
- Removedhasown@2.0.2(transitive)
- Removedinterpret@2.2.0(transitive)
- Removedis-core-module@2.15.1(transitive)
- Removedknex@3.1.0(transitive)
- Removedlodash@4.17.21(transitive)
- Removedms@2.1.2(transitive)
- Removedpath-parse@1.0.7(transitive)
- Removedpg-connection-string@2.6.2(transitive)
- Removedrechoir@0.8.0(transitive)
- Removedresolve@1.22.8(transitive)
- Removedresolve-from@5.0.0(transitive)
- Removedsupports-preserve-symlinks-flag@1.0.0(transitive)
- Removedtarn@3.0.2(transitive)
- Removedtildify@2.0.0(transitive)
- Removedtrigger-then@0.3.0(transitive)
- Removedwhen@2.1.1(transitive)
Updatedbackbone@~1.0.0
Updatedknex@~0.1.8
Updatedtrigger-then@~0.1.1
Updatedunderscore@~1.5.1
Updatedwhen@~2.2.1