Merge branch 'release/2.14.1' into production
This commit is contained in:
commit
a5c8e2eb58
47
CHANGES.md
47
CHANGES.md
|
@ -1,3 +1,11 @@
|
||||||
|
2015-01-15, Version 2.14.1
|
||||||
|
==========================
|
||||||
|
|
||||||
|
* Fix detection of `util.inspect` version (Miroslav Bajtoš)
|
||||||
|
|
||||||
|
* fix recursive calls if create belongsTo model in beforeCreate hook (Clark Wang)
|
||||||
|
|
||||||
|
|
||||||
2015-01-14, Version 2.14.0
|
2015-01-14, Version 2.14.0
|
||||||
==========================
|
==========================
|
||||||
|
|
||||||
|
@ -321,16 +329,9 @@
|
||||||
|
|
||||||
* Emit deleted event on delete for embedsMany relations (Jaka Hudoklin)
|
* Emit deleted event on delete for embedsMany relations (Jaka Hudoklin)
|
||||||
|
|
||||||
* Make sure falsy value is kept for properties not predefined (Raymond Feng)
|
|
||||||
|
|
||||||
* Add ping() to test connections (Raymond Feng)
|
* Add ping() to test connections (Raymond Feng)
|
||||||
|
|
||||||
|
|
||||||
2014-08-21, Version 2.5.1
|
|
||||||
=========================
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
2014-08-21, Version 2.5.2
|
2014-08-21, Version 2.5.2
|
||||||
=========================
|
=========================
|
||||||
|
|
||||||
|
@ -338,6 +339,12 @@
|
||||||
|
|
||||||
* Make sure falsy value is kept for properties not predefined (Raymond Feng)
|
* Make sure falsy value is kept for properties not predefined (Raymond Feng)
|
||||||
|
|
||||||
|
|
||||||
|
2014-08-21, Version 2.5.1
|
||||||
|
=========================
|
||||||
|
|
||||||
|
* Bump version (Raymond Feng)
|
||||||
|
|
||||||
* Fix side-effects of PR #237 - see #242 (Fabien Franzen)
|
* Fix side-effects of PR #237 - see #242 (Fabien Franzen)
|
||||||
|
|
||||||
|
|
||||||
|
@ -902,14 +909,6 @@
|
||||||
|
|
||||||
* JSDoc improvements (Rand McKinney)
|
* JSDoc improvements (Rand McKinney)
|
||||||
|
|
||||||
* validations: include more details in `err.message` (Miroslav Bajtoš)
|
|
||||||
|
|
||||||
|
|
||||||
2014-05-27, Version 1.5.4
|
|
||||||
=========================
|
|
||||||
|
|
||||||
* Bump version (Raymond Feng)
|
|
||||||
|
|
||||||
* Keep undefined/null values for the array type (Raymond Feng)
|
* Keep undefined/null values for the array type (Raymond Feng)
|
||||||
|
|
||||||
* Remove JSDocs for scopeMethods.add(acInst) and scopeMethods.remove(acInst) (crandmck)
|
* Remove JSDocs for scopeMethods.add(acInst) and scopeMethods.remove(acInst) (crandmck)
|
||||||
|
@ -945,6 +944,24 @@
|
||||||
* Remove remoting metadata (Ritchie Martori)
|
* Remove remoting metadata (Ritchie Martori)
|
||||||
|
|
||||||
|
|
||||||
|
2014-05-27, Version 1.5.4
|
||||||
|
=========================
|
||||||
|
|
||||||
|
* Bump version (Raymond Feng)
|
||||||
|
|
||||||
|
* Keep undefined/null values for the array type (Raymond Feng)
|
||||||
|
|
||||||
|
* Remove JSDocs for scopeMethods.add(acInst) and scopeMethods.remove(acInst) (crandmck)
|
||||||
|
|
||||||
|
* Copy info from api-model.md to JSDoc (crandmck)
|
||||||
|
|
||||||
|
* validations: include more details in `err.message` (Miroslav Bajtoš)
|
||||||
|
|
||||||
|
* Add a path to show customer.orders(query, cb) (Raymond Feng)
|
||||||
|
|
||||||
|
* Add support for logical operator (AND/OR) (Raymond Feng)
|
||||||
|
|
||||||
|
|
||||||
2014-05-20, Version 1.5.2
|
2014-05-20, Version 1.5.2
|
||||||
=========================
|
=========================
|
||||||
|
|
||||||
|
|
|
@ -441,8 +441,9 @@ ModelBaseClass.prototype.reset = function () {
|
||||||
// Node v0.11+ allows custom inspect functions to return an object
|
// Node v0.11+ allows custom inspect functions to return an object
|
||||||
// instead of string. That way options like `showHidden` and `colors`
|
// instead of string. That way options like `showHidden` and `colors`
|
||||||
// can be preserved.
|
// can be preserved.
|
||||||
var versionParts = process.versions.node
|
var versionParts = process.versions && process.versions.node ?
|
||||||
.split(/\./g).map(function(v) { return +v; });
|
process.versions.node.split(/\./g).map(function(v) { return +v; }) :
|
||||||
|
[1, 0, 0]; // browserify ships 1.0-compatible version of util.inspect
|
||||||
|
|
||||||
var INSPECT_SUPPORTS_OBJECT_RETVAL =
|
var INSPECT_SUPPORTS_OBJECT_RETVAL =
|
||||||
versionParts[0] > 0 ||
|
versionParts[0] > 0 ||
|
||||||
|
|
|
@ -1193,11 +1193,16 @@ BelongsTo.prototype.create = function(targetModelData, cb) {
|
||||||
modelTo.create(targetModelData, function(err, targetModel) {
|
modelTo.create(targetModelData, function(err, targetModel) {
|
||||||
if(!err) {
|
if(!err) {
|
||||||
modelInstance[fk] = targetModel[pk];
|
modelInstance[fk] = targetModel[pk];
|
||||||
modelInstance.save(function(err, inst) {
|
if (modelInstance.isNewRecord()) {
|
||||||
if (cb && err) return cb && cb(err);
|
|
||||||
self.resetCache(targetModel);
|
self.resetCache(targetModel);
|
||||||
cb && cb(err, targetModel);
|
cb && cb(err, targetModel);
|
||||||
});
|
} else {
|
||||||
|
modelInstance.save(function(err, inst) {
|
||||||
|
if (cb && err) return cb && cb(err);
|
||||||
|
self.resetCache(targetModel);
|
||||||
|
cb && cb(err, targetModel);
|
||||||
|
});
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
cb && cb(err);
|
cb && cb(err);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "loopback-datasource-juggler",
|
"name": "loopback-datasource-juggler",
|
||||||
"version": "2.14.0",
|
"version": "2.14.1",
|
||||||
"description": "LoopBack DataSoure Juggler",
|
"description": "LoopBack DataSoure Juggler",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"StrongLoop",
|
"StrongLoop",
|
||||||
|
|
|
@ -1657,6 +1657,23 @@ describe('relations', function () {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should allow to create belongsTo model in beforeCreate hook', function (done) {
|
||||||
|
var mind;
|
||||||
|
Fear.beforeCreate = function (next) {
|
||||||
|
this.mind.create(function (err, m) {
|
||||||
|
mind = m;
|
||||||
|
if (err) next(err); else next();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
Fear.create(function (err, fear) {
|
||||||
|
should.not.exists(err);
|
||||||
|
should.exists(fear);
|
||||||
|
fear.mindId.should.be.equal(mind.id);
|
||||||
|
should.exists(fear.mind());
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('belongsTo with scope', function () {
|
describe('belongsTo with scope', function () {
|
||||||
|
@ -1680,7 +1697,10 @@ describe('relations', function () {
|
||||||
p.personId.should.equal(person.id);
|
p.personId.should.equal(person.id);
|
||||||
person.name.should.equal('Fred');
|
person.name.should.equal('Fred');
|
||||||
person.passportNotes.should.equal('Some notes...');
|
person.passportNotes.should.equal('Some notes...');
|
||||||
done();
|
p.save(function (err, passport) {
|
||||||
|
should.not.exists(err);
|
||||||
|
done();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue