Skip to content

Commit

Permalink
Release 0.15.2
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardograca committed Mar 28, 2020
1 parent 1079783 commit f41834e
Show file tree
Hide file tree
Showing 30 changed files with 493 additions and 325 deletions.
21 changes: 21 additions & 0 deletions .db-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module.exports = {
mysql: {
database: 'bookshelf_test',
user: 'root',
password: 'root',
encoding: 'utf8'
},

postgres: {
user: 'postgres',
database: 'bookshelf_test',
host: 'localhost',
port: 5432,
charset: 'utf8',
ssl: false
},

sqlite3: {
filename: ':memory:'
}
};
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
## Change Log

**0.15.2** <small>_Mar 28, 2020_</small> - [Diff](https://github.com/bookshelf/bookshelf/compare/0.15.1...0.15.2)

#### Bug fixes

- Fix attributes that are changed during event hook not being persisted: [#2063](https://github.com/bookshelf/bookshelf/pull/2063)

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

- Update husky to version 2.4.1: [#1984](https://github.com/bookshelf/bookshelf/pull/1984)
Expand Down
370 changes: 199 additions & 171 deletions docs/api.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/bookshelf.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@ <h1 class="page-title">bookshelf.js</h1>
<footer>
<div>
Documentation generated by
<a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
<a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a>

on
June 13, 2019
March 28, 2020

</div>
</footer>
Expand Down
13 changes: 0 additions & 13 deletions docs/images/bookshelf-icon.svg

This file was deleted.

Binary file removed docs/images/fork-me-right-dusk-blue@2x.png
Binary file not shown.
223 changes: 153 additions & 70 deletions docs/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/lib_base_collection.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -993,10 +993,10 @@ <h1 class="page-title">lib/base/collection.js</h1>
<footer>
<div>
Documentation generated by
<a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
<a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a>

on
June 13, 2019
March 28, 2020

</div>
</footer>
Expand Down
4 changes: 2 additions & 2 deletions docs/lib_base_events.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -216,10 +216,10 @@ <h1 class="page-title">lib/base/events.js</h1>
<footer>
<div>
Documentation generated by
<a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
<a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a>

on
June 13, 2019
March 28, 2020

</div>
</footer>
Expand Down
9 changes: 6 additions & 3 deletions docs/lib_base_model.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,10 @@ <h1 class="page-title">lib/base/model.js</h1>
*/
ModelBase.prototype.clone = function() {
const model = new this.constructor(this.attributes);
Object.assign(model.relations, _.mapValues(this.relations, (r) => r.clone()));
Object.assign(
model.relations,
_.mapValues(this.relations, (r) => r.clone())
);
model._previousAttributes = _.clone(this._previousAttributes);
model.changed = _.clone(this.changed);
return model;
Expand Down Expand Up @@ -944,10 +947,10 @@ <h1 class="page-title">lib/base/model.js</h1>
<footer>
<div>
Documentation generated by
<a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
<a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a>

on
June 13, 2019
March 28, 2020

</div>
</footer>
Expand Down
4 changes: 2 additions & 2 deletions docs/lib_base_relation.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,10 @@ <h1 class="page-title">lib/base/relation.js</h1>
<footer>
<div>
Documentation generated by
<a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
<a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a>

on
June 13, 2019
March 28, 2020

</div>
</footer>
Expand Down
4 changes: 2 additions & 2 deletions docs/lib_bookshelf.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -451,10 +451,10 @@ <h1 class="page-title">lib/bookshelf.js</h1>
<footer>
<div>
Documentation generated by
<a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
<a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a>

on
June 13, 2019
March 28, 2020

</div>
</footer>
Expand Down
4 changes: 2 additions & 2 deletions docs/lib_collection.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -548,10 +548,10 @@ <h1 class="page-title">lib/collection.js</h1>
<footer>
<div>
Documentation generated by
<a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
<a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a>

on
June 13, 2019
March 28, 2020

</div>
</footer>
Expand Down
12 changes: 7 additions & 5 deletions docs/lib_model.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -1048,7 +1048,9 @@ <h1 class="page-title">lib/model.js</h1>
Helpers.saveConstraints(this, this.relatedData);
}

const attributesToSave = method === 'update' &amp;&amp; options.patch ? attrs : this.attributes;
const getAttributesToSave = function(method, options, model) {
return method === 'update' &amp;&amp; options.patch ? attrs : model.attributes;
};

// Gives access to the `query` object in the `options`, in case we need it
// in any event handlers.
Expand Down Expand Up @@ -1113,12 +1115,12 @@ <h1 class="page-title">lib/model.js</h1>
return this.triggerThen(
method === 'insert' ? 'saving creating' : 'saving updating',
this,
attributesToSave,
getAttributesToSave(method, options, this),
options
)
.bind(this)
.then(function() {
return sync[options.method](attributesToSave);
return sync[options.method](getAttributesToSave(method, options, this));
})
.then(function(resp) {
// After a successful database save, the id is updated if the model was created
Expand Down Expand Up @@ -1521,10 +1523,10 @@ <h1 class="page-title">lib/model.js</h1>
<footer>
<div>
Documentation generated by
<a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
<a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a>

on
June 13, 2019
March 28, 2020

</div>
</footer>
Expand Down
4 changes: 2 additions & 2 deletions docs/lib_plugins_case-converter.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,10 @@ <h1 class="page-title">lib/plugins/case-converter.js</h1>
<footer>
<div>
Documentation generated by
<a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
<a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a>

on
June 13, 2019
March 28, 2020

</div>
</footer>
Expand Down
4 changes: 2 additions & 2 deletions docs/lib_plugins_pagination.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -301,10 +301,10 @@ <h1 class="page-title">lib/plugins/pagination.js</h1>
<footer>
<div>
Documentation generated by
<a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
<a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a>

on
June 13, 2019
March 28, 2020

</div>
</footer>
Expand Down
4 changes: 2 additions & 2 deletions docs/lib_plugins_processor.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,10 @@ <h1 class="page-title">lib/plugins/processor.js</h1>
<footer>
<div>
Documentation generated by
<a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
<a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a>

on
June 13, 2019
March 28, 2020

</div>
</footer>
Expand Down
4 changes: 2 additions & 2 deletions docs/lib_relation.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -1036,10 +1036,10 @@ <h1 class="page-title">lib/relation.js</h1>
<footer>
<div>
Documentation generated by
<a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
<a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a>

on
June 13, 2019
March 28, 2020

</div>
</footer>
Expand Down
4 changes: 2 additions & 2 deletions docs/lib_sync.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -325,10 +325,10 @@ <h1 class="page-title">lib/sync.js</h1>
<footer>
<div>
Documentation generated by
<a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
<a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a>

on
June 13, 2019
March 28, 2020

</div>
</footer>
Expand Down
5 changes: 4 additions & 1 deletion docs/scripts/prettify/prettify.js
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,10 @@ window.PR_SHOULD_USE_CONTINUATION = !0;
);
k(
x(
[['pln', /^\s+/, q, ' \t\r\n'], ['atv', /^(?:"[^"]*"?|'[^']*'?)/, q, '"\'']],
[
['pln', /^\s+/, q, ' \t\r\n'],
['atv', /^(?:"[^"]*"?|'[^']*'?)/, q, '"\'']
],
[
['tag', /^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],
['atn', /^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],
Expand Down
4 changes: 2 additions & 2 deletions docs/tutorial-associations.html
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@ <h3>More details about this topic on the following sections:</h3>
<footer>
<div>
Documentation generated by
<a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
<a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a>

on
June 13, 2019
March 28, 2020

</div>
</footer>
Expand Down
29 changes: 20 additions & 9 deletions docs/tutorial-events.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ <h2>Events</h2>
<p>The way this is done is by attaching event handlers to a model that will listen for these events. If the event
handlers return Promises, the handlers will wait for the Promise to be resolved or rejected before progressing. If
the promise is rejected, the process will be interrupted.</p>
<h3>Listening to events</h3><p>In order to attach an event listener to a model you can do it in the <a href="api.html#Model-instance-initialize"><code>Model's initialize</code></a>
<h3>Listening to events</h3>
<p>In order to attach an event listener to a model you can do it in the <a href="api.html#Model-instance-initialize"><code>Model's initialize</code></a>
method like so:</p>
<pre class="prettyprint source lang-js"><code>const User = bookshelf.Model.extend({
tableName: 'users',
Expand All @@ -89,9 +90,12 @@ <h3>Listening to events</h3><p>In order to attach an event listener to a model y
// This is fired after a model is updated
})
}
})</code></pre><p>You can attach multiple event listeners for the same event by calling the <a href="api.html#Model-instance-on"><code>on</code></a> method multiple times
})
</code></pre>
<p>You can attach multiple event listeners for the same event by calling the <a href="api.html#Model-instance-on"><code>on</code></a> method multiple times
and the listeners will run sequentially.</p>
<h3>Available save events</h3><p>The available <a href="api.html#Model"><code>model</code></a> save related events are:</p>
<h3>Available save events</h3>
<p>The available <a href="api.html#Model"><code>model</code></a> save related events are:</p>
<ul>
<li><a href="api.html#Model-event-saving"><code>saving</code></a></li>
<li><a href="api.html#Model-event-creating"><code>creating</code></a></li>
Expand All @@ -117,7 +121,9 @@ <h3>Available save events</h3><p>The available <a href="api.html#Model"><code>mo
// This won't be reached if the previous event threw an error
})
}
})</code></pre><p>This feature can be used to perform validation before saving a model. For example, checking if an email address
})
</code></pre>
<p>This feature can be used to perform validation before saving a model. For example, checking if an email address
already exists and preventing the model from being saved if it does:</p>
<pre class="prettyprint source lang-js"><code>const User = bookshelf.Model.extend({
tableName: 'users',
Expand All @@ -129,15 +135,19 @@ <h3>Available save events</h3><p>The available <a href="api.html#Model"><code>mo
})
})
}
})</code></pre><h3>Available fetch related events</h3><p>The available <a href="api.html#Model"><code>model</code></a> data retrieval related events are:</p>
})
</code></pre>
<h3>Available fetch related events</h3>
<p>The available <a href="api.html#Model"><code>model</code></a> data retrieval related events are:</p>
<ul>
<li><a href="api.html#Model-event-fetching"><code>fetching</code></a></li>
<li><a href="api.html#Model-instance-fetching:collection"><code>fetching:collection</code></a></li>
<li><a href="api.html#Model-event-counting"><code>counting</code></a></li>
<li><a href="api.html#Model-event-fetched"><code>fetched</code></a></li>
<li><a href="api.html#Model-instance-fetched:collection"><code>fetched:collection</code></a></li>
</ul>
<h3>Available destroy related events</h3><p>The available <a href="api.html#Model"><code>model</code></a> destruction related events are:</p>
<h3>Available destroy related events</h3>
<p>The available <a href="api.html#Model"><code>model</code></a> destruction related events are:</p>
<ul>
<li><a href="api.html#Model-event-destroying"><code>destroying</code></a></li>
<li><a href="api.html#Model-event-destroyed"><code>destroyed</code></a></li>
Expand All @@ -153,7 +163,8 @@ <h3>Available destroy related events</h3><p>The available <a href="api.html#Mode
log(`Destroyed model with attributes: ${previousAttributes}`)
})
}
})</code></pre></section>
})
</code></pre></section>

</article>

Expand All @@ -164,10 +175,10 @@ <h3>Available destroy related events</h3><p>The available <a href="api.html#Mode
<footer>
<div>
Documentation generated by
<a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
<a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a>

on
June 13, 2019
March 28, 2020

</div>
</footer>
Expand Down
12 changes: 8 additions & 4 deletions docs/tutorial-many-to-many.html
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ <h2>Many-to-many</h2>
books: function() {
return this.belongsToMany(Book);
}
});</code></pre><p>A Knex migration for the above relationship could be created with:</p>
});
</code></pre>
<p>A Knex migration for the above relationship could be created with:</p>
<pre class="prettyprint source lang-js"><code>exports.up = function(knex, Promise) {
return knex.schema.createTable('books', function(table) {
table.increments('id').primary();
Expand All @@ -104,7 +106,9 @@ <h2>Many-to-many</h2>
return knex.schema.dropTable('authors_books')
.dropTable('authors')
.dropTable('books');
};</code></pre><p>See <a href="tutorial-associations.html">Associations</a>.</p></section>
};
</code></pre>
<p>See <a href="tutorial-associations.html">Associations</a>.</p></section>

</article>

Expand All @@ -115,10 +119,10 @@ <h2>Many-to-many</h2>
<footer>
<div>
Documentation generated by
<a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
<a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a>

on
June 13, 2019
March 28, 2020

</div>
</footer>
Expand Down
Loading

0 comments on commit f41834e

Please sign in to comment.