Socket
Socket
Sign inDemoInstall

feathers-sequelize

Package Overview
Dependencies
Maintainers
2
Versions
84
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

feathers-sequelize - npm Package Compare versions

Comparing version 1.3.3 to 1.4.0

mocha.opts

8

CHANGELOG.md
# Change Log
## [Unreleased](https://github.com/feathersjs/feathers-sequelize/tree/HEAD)
[Full Changelog](https://github.com/feathersjs/feathers-sequelize/compare/v1.3.2...HEAD)
**Merged pull requests:**
- Update service tests, id and events option [\#65](https://github.com/feathersjs/feathers-sequelize/pull/65) ([greenkeeperio-bot](https://github.com/greenkeeperio-bot))
## [v1.3.2](https://github.com/feathersjs/feathers-sequelize/tree/v1.3.2) (2016-08-25)

@@ -4,0 +12,0 @@ [Full Changelog](https://github.com/feathersjs/feathers-sequelize/compare/v1.3.1...v1.3.2)

2

example/app.js

@@ -49,3 +49,3 @@ import path from 'path';

// A basic error handler, just like Express
app.use(function(error, req, res, next){
app.use(function (error, req, res, next) {
res.json(error);

@@ -52,0 +52,0 @@ });

@@ -7,4 +7,2 @@ 'use strict';

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

@@ -32,2 +30,4 @@

var _feathersCommons = require('feathers-commons');
var _utils = require('./utils');

@@ -41,2 +41,4 @@

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

@@ -70,9 +72,8 @@

value: function _find(params) {
var getFilter = arguments.length <= 1 || arguments[1] === undefined ? _feathersQueryFilters2.default : arguments[1];
var getFilter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _feathersQueryFilters2.default;
var _getFilter = getFilter(params.query || {});
var _getFilter = getFilter(params.query || {}),
filters = _getFilter.filters,
query = _getFilter.query;
var filters = _getFilter.filters;
var query = _getFilter.query;
var where = utils.getWhere(query);

@@ -82,3 +83,4 @@ var order = utils.getOrder(filters.$sort);

var q = _extends({
where: where, order: order,
where: where,
order: order,
limit: filters.$limit,

@@ -126,3 +128,3 @@ offset: filters.$skip

return instance;
}).catch(utils.errorHandler);
}).then((0, _feathersCommons.select)(params, this.id)).catch(utils.errorHandler);
}

@@ -147,3 +149,3 @@

value: function get(id, params) {
return this._get(id, params);
return this._get(id, params).then((0, _feathersCommons.select)(params, this.id));
}

@@ -159,3 +161,3 @@ }, {

return this.Model.create(data, options).catch(utils.errorHandler);
return this.Model.create(data, options).then((0, _feathersCommons.select)(params, this.id)).catch(utils.errorHandler);
}

@@ -167,18 +169,14 @@ }, {

var where = _extends({}, params.query);
var patchQuery = {};
var where = _extends({}, (0, _feathersQueryFilters2.default)(params.query || {}).query);
var mapIds = function mapIds(page) {
return page.data.map(function (current) {
return current[_this.id];
});
};
// Account for potentially modified data
Object.keys(where).forEach(function (key) {
if (where[key] !== undefined && data[key] !== undefined && _typeof(data[key]) !== 'object') {
patchQuery[key] = data[key];
} else {
patchQuery[key] = where[key];
}
});
// By default we will just query for the one id. For multi patch
// we create a list of the ids of all items that will be changed
// to re-query them after the update
var ids = id === null ? this._find(params).then(mapIds) : Promise.resolve([id]);
var patchParams = _extends({}, params, {
query: patchQuery
});
if (id !== null) {

@@ -190,5 +188,13 @@ where[this.id] = id;

return this.Model.update((0, _lodash2.default)(data, this.id), options).then(function () {
return _this._getOrFind(id, patchParams);
}).catch(utils.errorHandler);
return ids.then(function (idList) {
// Create a new query that re-queries all ids that
// were originally changed
var findParams = _extends({}, params, {
query: _defineProperty({}, _this.id, { $in: idList })
});
return _this.Model.update((0, _lodash2.default)(data, _this.id), options).then(function () {
return _this._getOrFind(id, findParams);
});
}).then((0, _feathersCommons.select)(params, this.id)).catch(utils.errorHandler);
}

@@ -219,3 +225,3 @@ }, {

return instance.update(copy, options);
}).catch(utils.errorHandler);
}).then((0, _feathersCommons.select)(params, this.id)).catch(utils.errorHandler);
}

@@ -228,3 +234,3 @@ }, {

return this._getOrFind(id, params).then(function (data) {
var where = _extends({}, params.query);
var where = _extends({}, (0, _feathersQueryFilters2.default)(params.query || {}).query);

@@ -240,3 +246,3 @@ if (id !== null) {

});
}).catch(utils.errorHandler);
}).then((0, _feathersCommons.select)(params, this.id)).catch(utils.errorHandler);
}

@@ -243,0 +249,0 @@ }]);

@@ -52,3 +52,3 @@ 'use strict';

function getOrder() {
var sort = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
var sort = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

@@ -55,0 +55,0 @@ var order = [];

{
"name": "feathers-sequelize",
"description": "A service adapter for Sequelize an SQL ORM",
"version": "1.3.3",
"version": "1.4.0",
"homepage": "https://github.com/feathersjs/feathers-sequelize",

@@ -34,3 +34,3 @@ "main": "lib/",

"engines": {
"node": ">= 0.12.0"
"node": ">= 4"
},

@@ -44,8 +44,17 @@ "scripts": {

"release:major": "npm version major && npm publish",
"compile": "rm -rf lib/ && babel -d lib/ src/",
"compile": "rimraf lib/ && babel -d lib/ src/",
"watch": "babel --watch -d lib/ src/",
"jshint": "jshint src/. test/. --config",
"mocha": "mocha test/ --compilers js:babel-core/register",
"test": "npm run jshint && npm run mocha"
"lint": "eslint-if-supported semistandard --fix",
"mocha": "mocha --opts mocha.opts --timeout 5000",
"test": "npm run lint && npm run coverage",
"coverage": "istanbul cover node_modules/mocha/bin/_mocha -- --opts mocha.opts"
},
"semistandard": {
"env": [
"mocha"
],
"ignore": [
"/lib"
]
},
"directories": {

@@ -55,2 +64,3 @@ "lib": "lib"

"dependencies": {
"feathers-commons": "^0.8.4",
"feathers-errors": "^2.0.1",

@@ -66,13 +76,16 @@ "feathers-query-filters": "^2.0.0",

"babel-plugin-transform-object-assign": "^6.1.18",
"babel-preset-es2015": "^6.1.2",
"babel-preset-es2015": "^6.18.0",
"body-parser": "^1.14.1",
"chai": "^3.4.1",
"eslint-if-supported": "^1.0.1",
"feathers": "^2.0.0",
"feathers-rest": "^1.3.0",
"feathers-service-tests": "^0.8.0",
"jshint": "^2.8.0",
"feathers-service-tests": "^0.9.0",
"istanbul": "^1.1.0-alpha.1",
"mocha": "^3.0.0",
"sequelize": "^3.23.6",
"sqlite3": "^3.1.1"
"rimraf": "^2.5.4",
"semistandard": "^9.1.0",
"sequelize": "^3.25.0",
"sqlite3": "^3.1.7"
}
}
# feathers-sequelize
[![Build Status](https://travis-ci.org/feathersjs/feathers-sequelize.png?branch=master)](https://travis-ci.org/feathersjs/feathers-sequelize)
[![Code Climate](https://codeclimate.com/github/feathersjs/feathers-sequelize.png)](https://codeclimate.com/github/feathersjs/feathers-sequelize)
[![Test Coverage](https://codeclimate.com/github/feathersjs/feathers-sequelize/badges/coverage.svg)](https://codeclimate.com/github/feathersjs/feathers-sequelize/coverage)
[![Dependency Status](https://img.shields.io/david/feathersjs/feathers-sequelize.svg?style=flat-square)](https://david-dm.org/feathersjs/feathers-sequelize)
[![Download Status](https://img.shields.io/npm/dm/feathers-sequelize.svg?style=flat-square)](https://www.npmjs.com/package/feathers-sequelize)
[![Slack Status](http://slack.feathersjs.com/badge.svg)](http://slack.feathersjs.com)

@@ -5,0 +10,0 @@ > A service adapter for [Sequelize](http://sequelizejs.com), an SQL ORM

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc