Skip to content

Commit

Permalink
Release 0.15.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardograca committed Jun 13, 2019
1 parent 92a9d5a commit 7c9b302
Show file tree
Hide file tree
Showing 29 changed files with 3,266 additions and 2,622 deletions.
32 changes: 32 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,37 @@
## Change Log

**0.15.0** <small>_Jun 13, 2019_</small> - [Diff](https://github.com/bookshelf/bookshelf/compare/0.14.2...0.15.0)

#### Breaking changes

- This version requires Node.js 6+
- Remove code that has been deprecated for a long time: [#1956](https://github.com/bookshelf/bookshelf/pull/1956)

#### Bug fixes

- `once` removes all events after it has been triggered: [#1972](https://github.com/bookshelf/bookshelf/pull/1972)
- Pagination details are wrong when selecting distinct values of a column: [#1950](https://github.com/bookshelf/bookshelf/pull/1950)
- Fix missing attributes in some events: [#1934](https://github.com/bookshelf/bookshelf/pull/1934)

#### Test Suite

- Fix Docker-compose.yml default postgres user: [#1972](https://github.com/bookshelf/bookshelf/pull/1972)
- Fix JSON tests on PostgreSQL 10+: [#1955](https://github.com/bookshelf/bookshelf/pull/1955)

#### Documentation

- Update and fix a lot of doclets: [#1951](https://github.com/bookshelf/bookshelf/pull/1951)
- Update README.md: [#1940](https://github.com/bookshelf/bookshelf/pull/1940)

#### Dependencies

- Update husky to version 2.4.1: [#1984](https://github.com/bookshelf/bookshelf/pull/1984)
- Bump supported knex version to 0.17: [#1982](https://github.com/bookshelf/bookshelf/pull/1982)
- Update mocha to version 6.1.1: [#1968](https://github.com/bookshelf/bookshelf/pull/1968)
- Update eslint-config-prettier to 4.1.0: [#1957](https://github.com/bookshelf/bookshelf/pull/1957)
- Update sinon to version 7.2.4: [#1947](https://github.com/bookshelf/bookshelf/pull/1947)
- Update eslint to version 5.1.0: [#1930](https://github.com/bookshelf/bookshelf/pull/1930)

**0.14.2** <small>_Dec 17, 2018_</small> - [Diff](https://github.com/bookshelf/bookshelf/compare/0.14.1...0.14.2)

#### Bug fixes
Expand Down
3,041 changes: 1,655 additions & 1,386 deletions docs/api.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/bookshelf.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ <h1 class="page-title">bookshelf.js</h1>
<a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>

on
December 17, 2018
June 13, 2019

</div>
</footer>
Expand Down
13 changes: 13 additions & 0 deletions docs/images/bookshelf-icon.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/fork-me-right-dusk-blue@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
51 changes: 42 additions & 9 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ <h2>Home</h2><ul><li><a href="#introduction">Introduction</a></li>
<li><a href="#plugins">Plugins</a></li>
<li><a href="#community-plugins">Community plugins</a></li>
<li><a href="#support">Support</a></li>
<li><a href="#contributing">Contributing</a></li>
<li><a href="#faq">F.A.Q.</a></li><li><a href="#changelog">Change log</a></li></ul>

</nav>
Expand Down Expand Up @@ -100,21 +101,21 @@ <h1 id="bookshelfjs">bookshelf.js</h1><p><a href="https://www.npmjs.com/package/
<a href="https://travis-ci.org/bookshelf/bookshelf"><img src="https://api.travis-ci.org/bookshelf/bookshelf.svg?branch=master" alt="Build Status"></a>
<a href="https://david-dm.org/bookshelf/bookshelf"><img src="https://david-dm.org/bookshelf/bookshelf/status.svg" alt="Dependency Status"></a>
<a href="https://david-dm.org/bookshelf/bookshelf?type=dev"><img src="https://david-dm.org/bookshelf/bookshelf/dev-status.svg" alt="devDependency Status"></a></p>
<p>Bookshelf is a JavaScript ORM for Node.js, built on the <a href="http://knexjs.org">Knex</a> 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.</p>
<p>It is designed to work well with PostgreSQL, MySQL, and SQLite3.</p>
<p>Bookshelf is a JavaScript ORM for Node.js, built on the <a href="http://knexjs.org">Knex</a> SQL query builder. It features both Promise-based and traditional callback interfaces, transaction support, eager/nested-eager relation loading, polymorphic associations, and support for one-to-one, one-to-many, and many-to-many relations.</p>
<p>It is designed to work with PostgreSQL, MySQL, and SQLite3.</p>
<p><a href="http://bookshelfjs.org">Website and documentation</a>. The project is <a href="http://github.com/bookshelf/bookshelf/">hosted on GitHub</a>, and has a comprehensive <a href="https://travis-ci.org/bookshelf/bookshelf">test suite</a>.</p>
<h2 id="introduction">Introduction</h2><p>Bookshelf aims to provide a simple library for common tasks when querying databases in JavaScript, and forming relations between these objects, taking a lot of ideas from the the <a href="http://en.wikipedia.org/wiki/Data_mapper_pattern">Data Mapper Pattern</a>.</p>
<p>With a concise, literate codebase, Bookshelf is simple to read, understand, and extend. It doesn't force you to use any specific validation scheme, provides flexible and efficient relation/nested-relation loading, and first class transaction support.</p>
<p>It's a lean Object Relational Mapper, allowing you to drop down to the raw knex interface whenever you need a custom query that doesn't quite fit with the stock conventions.</p>
<h2 id="installation">Installation</h2><p>You'll need to install a copy of <a href="http://knexjs.org/">knex.js</a>, and either mysql, pg, or sqlite3 from npm.</p>
<pre class="prettyprint source lang-js"><code>$ npm install knex@0.13 --save
<p>With a concise, literate codebase, Bookshelf is simple to read, understand, and extend. It doesn't force you to use any specific validation scheme, and provides flexible, efficient relation/nested-relation loading and first-class transaction support.</p>
<p>It's a lean object-relational mapper, allowing you to drop down to the raw Knex interface whenever you need a custom query that doesn't quite fit with the stock conventions.</p>
<h2 id="installation">Installation</h2><p>You'll need to install a copy of <a href="http://knexjs.org/">Knex</a>, and either <code>mysql</code>, <code>pg</code>, or <code>sqlite3</code> from npm.</p>
<pre class="prettyprint source lang-js"><code>$ npm install knex --save
$ npm install bookshelf --save

# Then add one of the following:
$ npm install pg
$ npm install mysql
$ npm install mariasql
$ npm install sqlite3</code></pre><p>The Bookshelf library is initialized by passing an initialized <a href="http://knexjs.org/">Knex</a> client instance. The <a href="http://knexjs.org/">knex documentation</a> provides a number of examples for different databases.</p>
$ npm install sqlite3</code></pre><p>The Bookshelf library is initialized by passing an initialized <a href="http://knexjs.org/">Knex</a> client instance. The <a href="http://knexjs.org/">Knex documentation</a> provides a number of examples for different databases.</p>
<pre class="prettyprint source lang-js"><code>var knex = require('knex')({
client: 'mysql',
connection: {
Expand Down Expand Up @@ -194,6 +195,12 @@ <h2 id="community-plugins">Community plugins</h2><ul>
<li><a href="https://github.com/ericclemmons/bookshelf-manager">bookshelf-manager</a> - Model &amp; Collection manager to make it easy to create &amp; save deep, nested JSON structures from API requests.</li>
</ul>
<h2 id="support">Support</h2><p>Have questions about the library? Come join us in the <a href="http://webchat.freenode.net/?channels=bookshelf">#bookshelf freenode IRC channel</a> for support on <a href="http://knexjs.org/">knex.js</a> and bookshelf.js, or post an issue on <a href="http://stackoverflow.com/questions/tagged/bookshelf.js">Stack Overflow</a> or in the GitHub <a href="https://github.com/bookshelf/bookshelf/issues">issue tracker</a>.</p>
<h2 id="contributing">Contributing</h2><p>If you want to contribute to Bookshelf you'll usually want to report an issue or submit a
pull-request. For this purpose the <a href="https://github.com/bookshelf/bookshelf/">online repository</a> is
available on GitHub.</p>
<p>For further help setting up your local development environment or learning how you can contribute to
Bookshelf you should read the <a href="https://github.com/bookshelf/bookshelf/blob/master/.github/CONTRIBUTING.md">Contributing document</a>
available on GitHub.</p>
<h2 id="faq">F.A.Q.</h2><h3 id="can-i-use-standard-nodejs-style-callbacks">Can I use standard node.js style callbacks?</h3><p>Yes - you can call <code>.asCallback(function(err, resp) {</code> on any &quot;sync&quot; method and use the standard <code>(err, result)</code> style callback interface if you prefer.</p>
<h3 id="my-relations-dont-seem-to-be-loading-whats-up">My relations don't seem to be loading, what's up?</h3><p>Make sure you check that the type is correct for the initial parameters passed to the initial model being fetched. For example <code>new Model({id: '1'}).load([relations...])</code> will not return the same as <code>Model({id: 1}).load([relations...])</code> - notice that the id is a string in one case and a number in the other. This can be a common mistake if retrieving the id from a url parameter.</p>
<p>This is only an issue if you're eager loading data with load without first fetching the original model. <code>Model({id: '1'}).fetch({withRelated: [relations...]})</code> should work just fine.</p>
Expand Down Expand Up @@ -235,7 +242,33 @@ <h3 id="which-opensource-projects-are-using-bookshelf">Which open-source project


<section id="changelog" class="changelog">
<h2>Change Log</h2><p><strong>0.14.2</strong> <small><em>Dec 17, 2018</em></small> - <a href="https://github.com/bookshelf/bookshelf/compare/0.14.1...0.14.2">Diff</a></p>
<h2>Change Log</h2><p><strong>0.15.0</strong> <small><em>Jun 13, 2019</em></small> - <a href="https://github.com/bookshelf/bookshelf/compare/0.14.2...0.15.0">Diff</a></p>
<h4>Breaking changes</h4><ul>
<li>This version requires Node.js 6+</li>
<li>Remove code that has been deprecated for a long time: <a href="https://github.com/bookshelf/bookshelf/pull/1956">#1956</a></li>
</ul>
<h4>Bug fixes</h4><ul>
<li><code>once</code> removes all events after it has been triggered: <a href="https://github.com/bookshelf/bookshelf/pull/1972">#1972</a></li>
<li>Pagination details are wrong when selecting distinct values of a column: <a href="https://github.com/bookshelf/bookshelf/pull/1950">#1950</a></li>
<li>Fix missing attributes in some events: <a href="https://github.com/bookshelf/bookshelf/pull/1934">#1934</a></li>
</ul>
<h4>Test Suite</h4><ul>
<li>Fix Docker-compose.yml default postgres user: <a href="https://github.com/bookshelf/bookshelf/pull/1972">#1972</a></li>
<li>Fix JSON tests on PostgreSQL 10+: <a href="https://github.com/bookshelf/bookshelf/pull/1955">#1955</a></li>
</ul>
<h4>Documentation</h4><ul>
<li>Update and fix a lot of doclets: <a href="https://github.com/bookshelf/bookshelf/pull/1951">#1951</a></li>
<li>Update README.md: <a href="https://github.com/bookshelf/bookshelf/pull/1940">#1940</a></li>
</ul>
<h4>Dependencies</h4><ul>
<li>Update husky to version 2.4.1: <a href="https://github.com/bookshelf/bookshelf/pull/1984">#1984</a></li>
<li>Bump supported knex version to 0.17: <a href="https://github.com/bookshelf/bookshelf/pull/1982">#1982</a></li>
<li>Update mocha to version 6.1.1: <a href="https://github.com/bookshelf/bookshelf/pull/1968">#1968</a></li>
<li>Update eslint-config-prettier to 4.1.0: <a href="https://github.com/bookshelf/bookshelf/pull/1957">#1957</a></li>
<li>Update sinon to version 7.2.4: <a href="https://github.com/bookshelf/bookshelf/pull/1947">#1947</a></li>
<li>Update eslint to version 5.1.0: <a href="https://github.com/bookshelf/bookshelf/pull/1930">#1930</a></li>
</ul>
<p><strong>0.14.2</strong> <small><em>Dec 17, 2018</em></small> - <a href="https://github.com/bookshelf/bookshelf/compare/0.14.1...0.14.2">Diff</a></p>
<h4>Bug fixes</h4><ul>
<li>Fix crash when using <code>groupBy</code> with table qualifier in pagination plugin: <a href="https://github.com/bookshelf/bookshelf/pull/1928">#1928</a></li>
<li>Fix <code>undefined</code> transaction object with Knex 0.15+: <a href="https://github.com/bookshelf/bookshelf/pull/1926">#1926</a></li>
Expand Down Expand Up @@ -843,7 +876,7 @@ <h4>Other changes</h4><ul>
<a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>

on
December 17, 2018
June 13, 2019

</div>
</footer>
Expand Down
29 changes: 16 additions & 13 deletions docs/lib_base_collection.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ <h1 class="page-title">lib/base/collection.js</h1>
const inherits = require('util').inherits;

const Events = require('./events');
const Promise = require('./promise');
const Promise = require('bluebird');
const ModelBase = require('./model');
const extend = require('../extend');

Expand All @@ -100,14 +100,14 @@ <h1 class="page-title">lib/base/collection.js</h1>
}

/**
* Registers an event listener.
*
* @method CollectionBase#on
* @example
*
* const ships = new bookshelf.Collection;
* ships.on('fetched', function(collection, response) {
* const ships = new bookshelf.Collection
* ships.on('fetched', function(collection) {
* // Do something after the data has been fetched from the database
* })
*
* @see Events#on
*/

Expand Down Expand Up @@ -513,16 +513,19 @@ <h1 class="page-title">lib/base/collection.js</h1>
};

/**
* @method
* @description
* Remove a {@link Model model}, or an array of models, from the collection. Note that this does not remove the affected
* models from the database. For that purpose you have to use the model's {@link Model#destroy destroy} method.
*
* If you wish to actually remove all the models in a collection from the database you can use this method:
*
* Remove a {@link Model model} (or an array of models) from the collection,
* but does not remove the model from the database, use the model's {@link
* Model#destroy destroy} method for this.
* myCollection.invokeThen('destroy').then(() => {
* // models have been destroyed
* })
*
* @param {Model|Model[]} models The model, or models, to be removed.
* @param {Object} options
* @returns {Model|Model[]} The same value passed as `models` argument.
* @param {Object} [options] Set of options for the operation.
* @param {Boolean} [options.silent] If set to `true` will not trigger a `remove` event on the removed model.
* @returns {Model|Model[]} The same value passed in the `models` argument.
*/
CollectionBase.prototype.remove = function(models, options) {
const singular = !Array.isArray(models);
Expand Down Expand Up @@ -993,7 +996,7 @@ <h1 class="page-title">lib/base/collection.js</h1>
<a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>

on
December 17, 2018
June 13, 2019

</div>
</footer>
Expand Down
47 changes: 23 additions & 24 deletions docs/lib_base_events.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ <h1 class="page-title">lib/base/events.js</h1>

'use strict';

const Promise = require('./promise');
const Promise = require('bluebird');
const events = require('events');
const _ = require('lodash');
const EventEmitter = events.EventEmitter;
Expand All @@ -91,21 +91,17 @@ <h1 class="page-title">lib/base/events.js</h1>
*/
class Events extends EventEmitter {
/**
* @method Events#on
* @description
* Register an event listener. The callback will be invoked whenever the event
* is fired. The event string may also be a space-delimited list of several
* event names.
* Registers an event listener. The callback will be invoked whenever the event is fired. The event string may also be
* a space-delimited list of several event names.
*
* @param {string} nameOrNames
* The name of the event or space separated list of events to register a
* callback for.
* @param {function} callback
* That callback to invoke whenever the event is fired.
* @method Events#on
* @param {string} nameOrNames The name or space separated names of events to register a callback for.
* @param {function} callback That callback to invoke whenever the event is fired.
* @return {mixed} The object where this is called on is returned to allow chaining this method call.
*/
on(nameOrNames, handler) {
on(nameOrNames, callback) {
eventNames(nameOrNames).forEach((name) => {
super.on(name, handler);
super.on(name, callback);
});
return this;
}
Expand All @@ -119,13 +115,19 @@ <h1 class="page-title">lib/base/events.js</h1>
* @param {string} nameOrNames
* The name of the event or space separated list of events to stop listening
* to.
* @param {function} callback That callback to remove.
*/
off(nameOrNames) {
off(nameOrNames, callback) {
if (nameOrNames == null) {
return this.removeAllListeners();
}

eventNames(nameOrNames).forEach((name) => this.removeAllListeners(name));
eventNames(nameOrNames).forEach((name) => {
if (callback === undefined) {
return this.removeAllListeners(name);
}
return this.removeListener(name, callback);
});
return this;
}

Expand All @@ -150,8 +152,6 @@ <h1 class="page-title">lib/base/events.js</h1>
}

/**
* @method Events#triggerThen
* @description
* A promise version of {@link Events#trigger}, returning a promise which
* resolves with all return values from triggered event handlers. If any of the
* event handlers throw an `Error` or return a rejected promise, the promise
Expand All @@ -160,13 +160,12 @@ <h1 class="page-title">lib/base/events.js</h1>
* {@link Model@event:destroying "destroying"} events, and can be helpful when needing
* async event handlers (e.g. for validations).
*
* @method Events#triggerThen
* @param {string} name
* The event name, or a whitespace-separated list of event names, to be
* triggered.
* @param {...mixed} [args]
* Arguments to be passed to any registered event handlers.
* @returns Promise&lt;mixed[]>
* A promise resolving the the resolved return values of any triggered handlers.
* The event name or a whitespace-separated list of event names to be triggered.
* @param {...mixed} [args] Arguments to be passed to any registered event handlers.
* @returns {Promise}
* A promise resolving to the return values of any triggered handlers.
*/
triggerThen(nameOrNames) {
const names = eventNames(nameOrNames);
Expand Down Expand Up @@ -220,7 +219,7 @@ <h1 class="page-title">lib/base/events.js</h1>
<a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>

on
December 17, 2018
June 13, 2019

</div>
</footer>
Expand Down

0 comments on commit 7c9b302

Please sign in to comment.