feathers-levelup
Advanced tools
Comparing version 1.0.1 to 1.1.0
@@ -244,10 +244,9 @@ 'use strict'; | ||
value: function find(params) { | ||
var _this3 = this; | ||
var paginate = typeof params.paginate !== 'undefined' ? params.paginate : this.paginate; | ||
// Call the internal find with query parameter that include pagination | ||
var result = this._find(params, function (query) { | ||
return (0, _feathersQueryFilters2.default)(query, _this3.paginate); | ||
return (0, _feathersQueryFilters2.default)(query, paginate); | ||
}); | ||
if (!this.paginate.default) { | ||
if (!paginate.default) { | ||
return result.then(function (page) { | ||
@@ -262,7 +261,12 @@ return page.data; | ||
key: 'get', | ||
value: function get(id) { | ||
var _this4 = this; | ||
value: function get() { | ||
return this._get.apply(this, arguments); | ||
} | ||
}, { | ||
key: '_get', | ||
value: function _get(id) { | ||
var _this3 = this; | ||
return new Promise(function (resolve, reject) { | ||
_this4.db.get(id, function (err, data) { | ||
_this3.db.get(id, function (err, data) { | ||
if (err) { | ||
@@ -285,3 +289,3 @@ if (err.notFound) { | ||
value: function _create(data) { | ||
var _this5 = this; | ||
var _this4 = this; | ||
@@ -295,3 +299,3 @@ var current = _.extend({}, data, { | ||
return new Promise(function (resolve, reject) { | ||
_this5.db.put(id, current, function (err) { | ||
_this4.db.put(id, current, function (err) { | ||
if (err) { | ||
@@ -307,7 +311,7 @@ return reject(new _feathersErrors2.default.GeneralError('Internal error creating id \'' + id + '\' (' + err + ')')); | ||
value: function create(data) { | ||
var _this6 = this; | ||
var _this5 = this; | ||
if (Array.isArray(data)) { | ||
return Promise.all(data.map(function (current) { | ||
return _this6._create(current); | ||
return _this5._create(current); | ||
})); | ||
@@ -321,3 +325,3 @@ } | ||
value: function update(id, data) { | ||
var _this7 = this; | ||
var _this6 = this; | ||
@@ -328,7 +332,7 @@ if (id === null || Array.isArray(data)) { | ||
return this.get(id).then(function () { | ||
return this._get(id).then(function () { | ||
return new Promise(function (resolve, reject) { | ||
var current = _.extend({}, data, _defineProperty({}, _this7._id, id)); | ||
var current = _.extend({}, data, _defineProperty({}, _this6._id, id)); | ||
_this7.db.put(id, current, function (err) { | ||
_this6.db.put(id, current, function (err) { | ||
if (err) { | ||
@@ -348,8 +352,8 @@ return reject(new _feathersErrors2.default.GeneralError('Internal error updating id \'' + id + '\' (' + err + ')')); | ||
value: function _patch(id, updateData) { | ||
var _this8 = this; | ||
var _this7 = this; | ||
return this.get(id).then(function (old) { | ||
return this._get(id).then(function (old) { | ||
return new Promise(function (resolve, reject) { | ||
var current = _.extend(old, updateData); | ||
_this8.db.put(id, current, function (err) { | ||
_this7.db.put(id, current, function (err) { | ||
if (err) { | ||
@@ -366,3 +370,3 @@ return reject(new _feathersErrors2.default.GeneralError('Internal error updating id \'' + id + '\' (' + err + ')')); | ||
value: function patch(id, data, params) { | ||
var _this9 = this; | ||
var _this8 = this; | ||
@@ -372,3 +376,3 @@ if (id === null) { | ||
return Promise.all(page.data.map(function (current) { | ||
return _this9._patch(current[_this9._id], data, params); | ||
return _this8._patch(current[_this8._id], data, params); | ||
})); | ||
@@ -386,7 +390,7 @@ }); | ||
value: function _remove(id) { | ||
var _this10 = this; | ||
var _this9 = this; | ||
return this.get(id).then(function (data) { | ||
return this._get(id).then(function (data) { | ||
return new Promise(function (resolve, reject) { | ||
_this10.db.del(id, function (err) { | ||
_this9.db.del(id, function (err) { | ||
if (err) { | ||
@@ -403,3 +407,3 @@ return reject(new _feathersErrors2.default.GeneralError('Internal error removing id \'' + id + '\' (' + err + ')')); | ||
value: function remove(id, params) { | ||
var _this11 = this; | ||
var _this10 = this; | ||
@@ -409,3 +413,3 @@ if (id === null) { | ||
return Promise.all(page.data.map(function (current) { | ||
return _this11._remove(current[_this11._id]); | ||
return _this10._remove(current[_this10._id]); | ||
})); | ||
@@ -412,0 +416,0 @@ }); |
{ | ||
"name": "feathers-levelup", | ||
"description": "LevelDB adapter for Feathers via LevelUP", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"homepage": "https://github.com/feathersjs/feathers-levelup", | ||
@@ -60,3 +60,3 @@ "main": "lib/", | ||
"babel-polyfill": "^6.7.2", | ||
"babel-plugin-add-module-exports": "^0.1.2", | ||
"babel-plugin-add-module-exports": "^0.2.1", | ||
"babel-preset-es2015": "^6.6.0", | ||
@@ -66,3 +66,3 @@ "body-parser": "^1.15.0", | ||
"feathers-rest": "^1.2.3", | ||
"feathers-service-tests": "^0.5.4", | ||
"feathers-service-tests": "^0.6.0", | ||
"feathers-socketio": "^1.3.3", | ||
@@ -69,0 +69,0 @@ "jshint": "^2.9.1", |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
23213
445
1