Comparing version 0.10.1 to 0.10.2
## Change Log | ||
**0.10.1** - <small>_Jun 29, 2016_</small> — [Diff](https://github.com/tgriesser/bookshelf/compare/0.10.0...0.10.1) | ||
**0.10.2** - <small>Sept 22, 2016_</small> — [Diff](https://github.com/tgriesser/bookshelf/compare/0.10.1...0.10.2) | ||
* Fixes memory leak introduced in 0.10.0 caused by binding `this.listeners` in `triggerThen` | ||
* Fixes Bluebird warning when a Promise was internally rejected with a non-error | ||
**0.10.1** - <small>_Sept 14, 2016_</small> — [Diff](https://github.com/tgriesser/bookshelf/compare/0.10.0...0.10.1) | ||
* Allows using knex 0.12 as a peerDependency | ||
@@ -6,0 +11,0 @@ * knex instance used by bookshelf may be swapped out |
@@ -172,4 +172,5 @@ 'use strict'; | ||
var names = eventNames(nameOrNames); | ||
var flatMap = (0, _lodash.flow)(_lodash.map, _lodash.flatten); | ||
var listeners = flatMap(names, (0, _lodash.bind)(this.listeners, this)); | ||
var listeners = (0, _lodash.flatMap)(names, function (name) { | ||
return _this5.listeners(name); | ||
}); | ||
return _promise2.default.map(listeners, function (listener) { | ||
@@ -176,0 +177,0 @@ return listener.apply(_this5, args); |
@@ -113,4 +113,3 @@ 'use strict'; | ||
if (!response || response.length === 0) { | ||
if (options.require) throw new this.constructor.EmptyError('EmptyResponse'); | ||
return _promise2.default.reject(null); | ||
throw new this.constructor.EmptyError('EmptyResponse'); | ||
} | ||
@@ -145,4 +144,6 @@ }) | ||
return this.triggerThen('fetched', this, response, options); | ||
}).catch(function (err) { | ||
if (err !== null) throw err; | ||
}).catch(this.constructor.EmptyError, function (err) { | ||
if (options.require) { | ||
throw err; | ||
} | ||
this.reset([], { silent: true }); | ||
@@ -149,0 +150,0 @@ }).return(this); |
@@ -670,4 +670,3 @@ 'use strict'; | ||
if (!response || response.length === 0) { | ||
if (options.require) throw new this.constructor.NotFoundError('EmptyResponse'); | ||
return _promise2.default.reject(null); | ||
throw new this.constructor.NotFoundError('EmptyResponse'); | ||
} | ||
@@ -705,5 +704,7 @@ }) | ||
return this.triggerThen('fetched', this, response, options); | ||
}).return(this).catch(function (err) { | ||
if (err === null) return err; | ||
throw err; | ||
}).return(this).catch(this.constructor.NotFoundError, function (err) { | ||
if (options.require) { | ||
throw err; | ||
} | ||
return null; | ||
}); | ||
@@ -710,0 +711,0 @@ }), |
{ | ||
"name": "bookshelf", | ||
"version": "0.10.1", | ||
"version": "0.10.2", | ||
"description": "A lightweight ORM for PostgreSQL, MySQL, and SQLite3", | ||
@@ -11,4 +11,4 @@ "main": "bookshelf.js", | ||
"lint": "eslint bookshelf.js src/", | ||
"cover": "npm run lint && istanbul cover _mocha -- --check-leaks -t 5000 -b -R spec test/index.js", | ||
"test": "npm run lint && mocha --check-leaks -t 5000 -b test/index.js", | ||
"cover": "npm run lint && istanbul cover _mocha -- --check-leaks -t 10000 -b -R spec test/index.js", | ||
"test": "npm run lint && mocha --check-leaks -t 10000 -b test/index.js", | ||
"jsdoc": "./scripts/jsdoc.sh", | ||
@@ -34,3 +34,3 @@ "gh-pages": "./scripts/gh-pages.sh", | ||
"babel-runtime": "^6.6.1", | ||
"bluebird": "^2.9.4", | ||
"bluebird": "^3.4.3", | ||
"chalk": "^1.0.0", | ||
@@ -37,0 +37,0 @@ "create-error": "~0.3.1", |
@@ -1,2 +0,2 @@ | ||
# [bookshelf.js](http://bookshelfjs.org) [![Build Status](https://travis-ci.org/tgriesser/bookshelf.svg?branch=master)](https://travis-ci.org/tgriesser/bookshelf) | ||
# [bookshelf.js](http://bookshelfjs.org) [![Build Status](https://travis-ci.org/tgriesser/bookshelf.svg?branch=master)](https://travis-ci.org/tgriesser/bookshelf) [![Dependency Status](https://david-dm.org/tgriesser/bookshelf/status.svg)](https://david-dm.org/tgriesser/bookshelf) [![devDependency Status](https://david-dm.org/tgriesser/bookshelf/dev-status.svg)](https://david-dm.org/tgriesser/bookshelf?type=dev) | ||
@@ -3,0 +3,0 @@ Bookshelf is a JavaScript ORM for Node.js, built on the [Knex](http://knexjs.org) SQL query builder. Featuring both promise based and traditional callback interfaces, providing transaction support, eager/nested-eager relation loading, polymorphic associations, and support for one-to-one, one-to-many, and many-to-many relations. |
@@ -6,3 +6,3 @@ // Events | ||
import events from 'events' | ||
import { flatten, each, map, flow, once as _once, bind } from 'lodash'; | ||
import { each, flatMap, once as _once } from 'lodash'; | ||
@@ -101,7 +101,4 @@ const { EventEmitter } = events; | ||
const names = eventNames(nameOrNames); | ||
const flatMap = flow(map, flatten); | ||
const listeners = flatMap(names, bind(this.listeners, this)); | ||
return Promise.map(listeners, listener => | ||
listener.apply(this, args) | ||
); | ||
const listeners = flatMap(names, name => this.listeners(name)); | ||
return Promise.map(listeners, listener => listener.apply(this, args)); | ||
} | ||
@@ -108,0 +105,0 @@ |
@@ -89,4 +89,3 @@ import { clone, omit, isString, isArray, extend, toArray } from 'lodash'; | ||
if (!response || response.length === 0) { | ||
if (options.require) throw new this.constructor.EmptyError('EmptyResponse'); | ||
return Promise.reject(null); | ||
throw new this.constructor.EmptyError('EmptyResponse'); | ||
} | ||
@@ -123,4 +122,6 @@ }) | ||
}) | ||
.catch(function(err) { | ||
if (err !== null) throw err; | ||
.catch(this.constructor.EmptyError, function(err) { | ||
if (options.require) { | ||
throw err; | ||
} | ||
this.reset([], {silent: true}); | ||
@@ -127,0 +128,0 @@ }) |
@@ -630,4 +630,3 @@ import _ from 'lodash'; | ||
if (!response || response.length === 0) { | ||
if (options.require) throw new this.constructor.NotFoundError('EmptyResponse'); | ||
return Promise.reject(null); | ||
throw new this.constructor.NotFoundError('EmptyResponse'); | ||
} | ||
@@ -669,5 +668,7 @@ }) | ||
.return(this) | ||
.catch(function(err) { | ||
if (err === null) return err; | ||
throw err; | ||
.catch(this.constructor.NotFoundError, function(err) { | ||
if (options.require) { | ||
throw err; | ||
} | ||
return null | ||
}); | ||
@@ -674,0 +675,0 @@ }), |
@@ -16,3 +16,3 @@ var _ = require('lodash'); | ||
afterCreate: function(connection, callback) { | ||
return Promise.promisify(connection.query, connection)("SET sql_mode='TRADITIONAL';", []).then(function() { | ||
return Promise.promisify(connection.query, {context: connection})("SET sql_mode='TRADITIONAL';", []).then(function() { | ||
callback(null, connection); | ||
@@ -19,0 +19,0 @@ }); |
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
768670
106
19898
- Removedbluebird@2.11.0(transitive)
Updatedbluebird@^3.4.3