feathers-sequelize
Advanced tools
Comparing version 2.0.0 to 2.0.1
# Change Log | ||
## [v2.0.0](https://github.com/feathersjs/feathers-sequelize/tree/v2.0.0) (2017-05-03) | ||
[Full Changelog](https://github.com/feathersjs/feathers-sequelize/compare/v1.4.5...v2.0.0) | ||
**Closed issues:** | ||
- update\(\) breaks when sequelize configured with raw:true [\#99](https://github.com/feathersjs/feathers-sequelize/issues/99) | ||
- Discuss querying of NULL values [\#96](https://github.com/feathersjs/feathers-sequelize/issues/96) | ||
**Merged pull requests:** | ||
- Update all methods to return plain JS objects [\#106](https://github.com/feathersjs/feathers-sequelize/pull/106) ([DesignByOnyx](https://github.com/DesignByOnyx)) | ||
- Fixed return value of patch method for postgresql dialect [\#104](https://github.com/feathersjs/feathers-sequelize/pull/104) ([msimulcik](https://github.com/msimulcik)) | ||
- Update semistandard to the latest version 🚀 [\#103](https://github.com/feathersjs/feathers-sequelize/pull/103) ([greenkeeper[bot]](https://github.com/integration/greenkeeper)) | ||
- Update dependencies to enable Greenkeeper 🌴 [\#102](https://github.com/feathersjs/feathers-sequelize/pull/102) ([greenkeeper[bot]](https://github.com/integration/greenkeeper)) | ||
## [v1.4.5](https://github.com/feathersjs/feathers-sequelize/tree/v1.4.5) (2017-03-26) | ||
@@ -4,0 +19,0 @@ [Full Changelog](https://github.com/feathersjs/feathers-sequelize/compare/v1.4.4...v1.4.5) |
@@ -119,32 +119,19 @@ 'use strict'; | ||
value: function _get(id, params) { | ||
var promise = undefined; | ||
var where = utils.getWhere(params.query); | ||
if (params.sequelize && params.sequelize.include) { | ||
// If eager-loading is used, we need to use the find method | ||
var where = utils.getWhere(params.query); | ||
// Attach 'where' constraints, if any were used. | ||
var q = _extends({ | ||
raw: this.raw, | ||
where: _extends(_defineProperty({}, this.id, id), where) | ||
}, params.sequelize); | ||
// Attach 'where' constraints, if any were used. | ||
var q = _extends({ | ||
where: _extends({ id: id }, where) | ||
}, params.sequelize); | ||
// findById calls findAll under the hood. We use findAll so that | ||
// eager loading can be used without a separate code path. | ||
return this.Model.findAll(q).then(function (result) { | ||
if (result.length === 0) { | ||
throw new _feathersErrors2.default.NotFound('No record found for id \'' + id + '\''); | ||
} | ||
promise = this.Model.findAll(q).then(function (result) { | ||
if (result.length === 0) { | ||
throw new _feathersErrors2.default.NotFound('No record found for id \'' + id + '\''); | ||
} | ||
return result[0]; | ||
}); | ||
} else { | ||
var options = _extends({ raw: this.raw }, params.sequelize); | ||
promise = this.Model.findById(id, options).then(function (instance) { | ||
if (!instance) { | ||
throw new _feathersErrors2.default.NotFound('No record found for id \'' + id + '\''); | ||
} | ||
return instance; | ||
}); | ||
} | ||
return promise.then((0, _feathersCommons.select)(params, this.id)).catch(utils.errorHandler); | ||
return result[0]; | ||
}).then((0, _feathersCommons.select)(params, this.id)).catch(utils.errorHandler); | ||
} | ||
@@ -177,9 +164,15 @@ | ||
var options = _extends({ raw: this.raw }, params.sequelize); | ||
// Model.create's `raw` option is different from other methods. | ||
// In order to use `raw` consistently to serialize the result, | ||
// we need to shadow the Model.create use of raw, which we provide | ||
// access to by specifying `ignoreSetters`. | ||
var ignoreSetters = Boolean(options.ignoreSetters); | ||
var createOptions = _extends({}, options, { raw: ignoreSetters }); | ||
var isArray = Array.isArray(data); | ||
var promise = undefined; | ||
var promise = void 0; | ||
if (isArray) { | ||
promise = this.Model.bulkCreate(data, options); | ||
promise = this.Model.bulkCreate(data, createOptions); | ||
} else { | ||
promise = this.Model.create(data, options); | ||
promise = this.Model.create(data, createOptions); | ||
} | ||
@@ -186,0 +179,0 @@ |
@@ -66,2 +66,6 @@ 'use strict'; | ||
if (where.$select) { | ||
delete where.$select; | ||
} | ||
Object.keys(where).forEach(function (prop) { | ||
@@ -68,0 +72,0 @@ var value = where[prop]; |
{ | ||
"name": "feathers-sequelize", | ||
"description": "A service adapter for Sequelize an SQL ORM", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"homepage": "https://github.com/feathersjs/feathers-sequelize", | ||
@@ -75,3 +75,3 @@ "main": "lib/", | ||
"body-parser": "^1.14.1", | ||
"chai": "^3.4.1", | ||
"chai": "^4.0.0", | ||
"eslint-if-supported": "^1.0.1", | ||
@@ -78,0 +78,0 @@ "feathers": "^2.0.0", |
Sorry, the diff of this file is not supported yet
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
54939
437