Skip to content

Commit

Permalink
Release 3.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardogama committed Dec 28, 2019
1 parent 2a358a6 commit 710fca8
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 75 deletions.
125 changes: 74 additions & 51 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,153 +1,176 @@
# Changelog

## [3.0.0](https://github.com/seegno/bookshelf-json-columns/tree/) (2019-12-28)

[Full Changelog](https://github.com/seegno/bookshelf-json-columns/compare/2.1.1...3.0.0)

**Closed issues:**

- Not compatible with Bookshelf new version [#55](https://github.com/seegno/bookshelf-json-columns/issues/55)

**Merged pull requests:**

- Add support for Bookshelf 1.0.0 [#56](https://github.com/seegno/bookshelf-json-columns/pull/56) ([ricardogama](https://github.com/ricardogama))

## [2.1.1](https://github.com/seegno/bookshelf-json-columns/tree/2.1.1) (2017-07-18)

[Full Changelog](https://github.com/seegno/bookshelf-json-columns/compare/2.1.0...2.1.1)

**Merged pull requests:**

- Fix parsing empty strings [\#50](https://github.com/seegno/bookshelf-json-columns/pull/50) ([zhongzhi107](https://github.com/zhongzhi107))
- Fix parsing empty strings [#50](https://github.com/seegno/bookshelf-json-columns/pull/50) ([zhongzhi107](https://github.com/zhongzhi107))

## [2.1.0](https://github.com/seegno/bookshelf-json-columns/tree/2.1.0) (2017-03-01)

[Full Changelog](https://github.com/seegno/bookshelf-json-columns/compare/2.0.1...2.1.0)

**Closed issues:**

- Why is parse on fetch limited to sqlite? [\#46](https://github.com/seegno/bookshelf-json-columns/issues/46)
- Why is parse on fetch limited to sqlite? [#46](https://github.com/seegno/bookshelf-json-columns/issues/46)

**Merged pull requests:**

- Stringify on save for MySQL [\#48](https://github.com/seegno/bookshelf-json-columns/pull/48) ([pandapaul](https://github.com/pandapaul))
- Add support for MySQL [\#47](https://github.com/seegno/bookshelf-json-columns/pull/47) ([ricardogama](https://github.com/ricardogama))
- Add lcov reporter to .nycrc [\#45](https://github.com/seegno/bookshelf-json-columns/pull/45) ([abelsoares](https://github.com/abelsoares))
- Add support for MySQL [#47](https://github.com/seegno/bookshelf-json-columns/pull/47) ([ricardogama](https://github.com/ricardogama))
- Add lcov reporter to .nycrc [#45](https://github.com/seegno/bookshelf-json-columns/pull/45) ([abelsoares](https://github.com/abelsoares))

## [2.0.1](https://github.com/seegno/bookshelf-json-columns/tree/2.0.1) (2016-11-11)

[Full Changelog](https://github.com/seegno/bookshelf-json-columns/compare/2.0.0...2.0.1)

**Closed issues:**

- model.refresh is not working properly | bug [\#42](https://github.com/seegno/bookshelf-json-columns/issues/42)
- Malformed array literal [\#41](https://github.com/seegno/bookshelf-json-columns/issues/41)
- model.refresh is not working properly | bug [#42](https://github.com/seegno/bookshelf-json-columns/issues/42)
- Malformed array literal [#41](https://github.com/seegno/bookshelf-json-columns/issues/41)

**Merged pull requests:**

- Add user to postgres knexfile [\#44](https://github.com/seegno/bookshelf-json-columns/pull/44) ([ricardogama](https://github.com/ricardogama))
- Fix parsing on saving through query [\#43](https://github.com/seegno/bookshelf-json-columns/pull/43) ([ricardogama](https://github.com/ricardogama))
- Add user to postgres knexfile [#44](https://github.com/seegno/bookshelf-json-columns/pull/44) ([ricardogama](https://github.com/ricardogama))
- Fix parsing on saving through query [#43](https://github.com/seegno/bookshelf-json-columns/pull/43) ([ricardogama](https://github.com/ricardogama))

## [2.0.0](https://github.com/seegno/bookshelf-json-columns/tree/2.0.0) (2016-10-25)

[Full Changelog](https://github.com/seegno/bookshelf-json-columns/compare/1.2.2...2.0.0)

**Closed issues:**

- Idea: automatic string to Date conversion [\#34](https://github.com/seegno/bookshelf-json-columns/issues/34)
- Idea: automatic string to Date conversion [#34](https://github.com/seegno/bookshelf-json-columns/issues/34)

**Merged pull requests:**

- Add .nycrc to .npmignore [\#40](https://github.com/seegno/bookshelf-json-columns/pull/40) ([ricardogama](https://github.com/ricardogama))
- Remove knex client duplicate condition [\#39](https://github.com/seegno/bookshelf-json-columns/pull/39) ([ricardogama](https://github.com/ricardogama))
- Add node version badge [\#38](https://github.com/seegno/bookshelf-json-columns/pull/38) ([ricardogama](https://github.com/ricardogama))
- Add .npmignore [\#37](https://github.com/seegno/bookshelf-json-columns/pull/37) ([abelsoares](https://github.com/abelsoares))
- Update dependencies versions [\#36](https://github.com/seegno/bookshelf-json-columns/pull/36) ([ricardogama](https://github.com/ricardogama))
- Update jsonColumns option to be a class property [\#35](https://github.com/seegno/bookshelf-json-columns/pull/35) ([ricardogama](https://github.com/ricardogama))
- Test against Node.js 6 [\#33](https://github.com/seegno/bookshelf-json-columns/pull/33) ([MarkHerhold](https://github.com/MarkHerhold))
- Add release script [\#24](https://github.com/seegno/bookshelf-json-columns/pull/24) ([ricardogama](https://github.com/ricardogama))
- Add .nycrc to .npmignore [#40](https://github.com/seegno/bookshelf-json-columns/pull/40) ([ricardogama](https://github.com/ricardogama))
- Remove knex client duplicate condition [#39](https://github.com/seegno/bookshelf-json-columns/pull/39) ([ricardogama](https://github.com/ricardogama))
- Add node version badge [#38](https://github.com/seegno/bookshelf-json-columns/pull/38) ([ricardogama](https://github.com/ricardogama))
- Add .npmignore [#37](https://github.com/seegno/bookshelf-json-columns/pull/37) ([abelsoares](https://github.com/abelsoares))
- Update dependencies versions [#36](https://github.com/seegno/bookshelf-json-columns/pull/36) ([ricardogama](https://github.com/ricardogama))
- Update jsonColumns option to be a class property [#35](https://github.com/seegno/bookshelf-json-columns/pull/35) ([ricardogama](https://github.com/ricardogama))
- Test against Node.js 6 [#33](https://github.com/seegno/bookshelf-json-columns/pull/33) ([MarkHerhold](https://github.com/MarkHerhold))
- Add release script [#24](https://github.com/seegno/bookshelf-json-columns/pull/24) ([ricardogama](https://github.com/ricardogama))

## [1.2.2](https://github.com/seegno/bookshelf-json-columns/tree/1.2.2) (2016-09-20)

[Full Changelog](https://github.com/seegno/bookshelf-json-columns/compare/1.2.1...1.2.2)

**Closed issues:**

- issue when saving a null value [\#31](https://github.com/seegno/bookshelf-json-columns/issues/31)
- issue when saving a null value [#31](https://github.com/seegno/bookshelf-json-columns/issues/31)

**Merged pull requests:**

- Fix stringifying null values with patch option [\#32](https://github.com/seegno/bookshelf-json-columns/pull/32) ([ricardogama](https://github.com/ricardogama))
- Fix stringifying null values with patch option [#32](https://github.com/seegno/bookshelf-json-columns/pull/32) ([ricardogama](https://github.com/ricardogama))

## [1.2.1](https://github.com/seegno/bookshelf-json-columns/tree/1.2.1) (2016-08-29)

[Full Changelog](https://github.com/seegno/bookshelf-json-columns/compare/1.2.0...1.2.1)

**Closed issues:**

- `array.includes` is undefined in non-ES2015 environments [\#28](https://github.com/seegno/bookshelf-json-columns/issues/28)
- `array.includes` is undefined in non-ES2015 environments [#28](https://github.com/seegno/bookshelf-json-columns/issues/28)

**Merged pull requests:**

- Update eslint version [\#30](https://github.com/seegno/bookshelf-json-columns/pull/30) ([ricardogama](https://github.com/ricardogama))
- Add babel-plugin-array-includes [\#29](https://github.com/seegno/bookshelf-json-columns/pull/29) ([ricardogama](https://github.com/ricardogama))
- Update eslint version [#30](https://github.com/seegno/bookshelf-json-columns/pull/30) ([ricardogama](https://github.com/ricardogama))
- Add babel-plugin-array-includes [#29](https://github.com/seegno/bookshelf-json-columns/pull/29) ([ricardogama](https://github.com/ricardogama))

## [1.2.0](https://github.com/seegno/bookshelf-json-columns/tree/1.2.0) (2016-08-29)

[Full Changelog](https://github.com/seegno/bookshelf-json-columns/compare/1.1.1...1.2.0)

**Closed issues:**

- Working for updates? [\#25](https://github.com/seegno/bookshelf-json-columns/issues/25)
- Working for updates? [#25](https://github.com/seegno/bookshelf-json-columns/issues/25)

**Merged pull requests:**

- Add support for update with patch option [\#27](https://github.com/seegno/bookshelf-json-columns/pull/27) ([ricardogama](https://github.com/ricardogama))
- Add support for update with patch option [#27](https://github.com/seegno/bookshelf-json-columns/pull/27) ([ricardogama](https://github.com/ricardogama))

## [1.1.1](https://github.com/seegno/bookshelf-json-columns/tree/1.1.1) (2016-08-23)

[Full Changelog](https://github.com/seegno/bookshelf-json-columns/compare/1.1.0...1.1.1)

**Closed issues:**

- Add Bookshelf as peer dependency [\#21](https://github.com/seegno/bookshelf-json-columns/issues/21)
- Improve documentation contributing section [\#19](https://github.com/seegno/bookshelf-json-columns/issues/19)
- Add Bookshelf as peer dependency [#21](https://github.com/seegno/bookshelf-json-columns/issues/21)
- Improve documentation contributing section [#19](https://github.com/seegno/bookshelf-json-columns/issues/19)

**Merged pull requests:**

- adding support for sqlite3 [\#26](https://github.com/seegno/bookshelf-json-columns/pull/26) ([csepulv](https://github.com/csepulv))
- Add bookshelf as peer dependency [\#23](https://github.com/seegno/bookshelf-json-columns/pull/23) ([ricardogama](https://github.com/ricardogama))
- Fix typo and files notation on README.md [\#22](https://github.com/seegno/bookshelf-json-columns/pull/22) ([ricardogama](https://github.com/ricardogama))
- Improve contributing section [\#20](https://github.com/seegno/bookshelf-json-columns/pull/20) ([abelsoares](https://github.com/abelsoares))
- adding support for sqlite3 [#26](https://github.com/seegno/bookshelf-json-columns/pull/26) ([csepulv](https://github.com/csepulv))
- Add bookshelf as peer dependency [#23](https://github.com/seegno/bookshelf-json-columns/pull/23) ([ricardogama](https://github.com/ricardogama))
- Fix typo and files notation on README.md [#22](https://github.com/seegno/bookshelf-json-columns/pull/22) ([ricardogama](https://github.com/ricardogama))
- Improve contributing section [#20](https://github.com/seegno/bookshelf-json-columns/pull/20) ([abelsoares](https://github.com/abelsoares))

## [1.1.0](https://github.com/seegno/bookshelf-json-columns/tree/1.1.0) (2016-06-07)

[Full Changelog](https://github.com/seegno/bookshelf-json-columns/compare/1.0.1...1.1.0)

**Closed issues:**

- What is this plugin for [\#15](https://github.com/seegno/bookshelf-json-columns/issues/15)
- What is this plugin for [#15](https://github.com/seegno/bookshelf-json-columns/issues/15)

**Merged pull requests:**

- Add master branch to travis image url [\#18](https://github.com/seegno/bookshelf-json-columns/pull/18) ([ricardogama](https://github.com/ricardogama))
- Add JSON columns parsing with SQLite client [\#17](https://github.com/seegno/bookshelf-json-columns/pull/17) ([ricardogama](https://github.com/ricardogama))
- Update coveralls image badge to square [\#14](https://github.com/seegno/bookshelf-json-columns/pull/14) ([ruimarinho](https://github.com/ruimarinho))
- Add master branch to travis image url [#18](https://github.com/seegno/bookshelf-json-columns/pull/18) ([ricardogama](https://github.com/ricardogama))
- Add JSON columns parsing with SQLite client [#17](https://github.com/seegno/bookshelf-json-columns/pull/17) ([ricardogama](https://github.com/ricardogama))
- Update coveralls image badge to square [#14](https://github.com/seegno/bookshelf-json-columns/pull/14) ([ruimarinho](https://github.com/ruimarinho))

## [1.0.1](https://github.com/seegno/bookshelf-json-columns/tree/1.0.1) (2016-04-21)

[Full Changelog](https://github.com/seegno/bookshelf-json-columns/compare/1.0.0...1.0.1)

**Merged pull requests:**

- Update lint script to only check staged files [\#13](https://github.com/seegno/bookshelf-json-columns/pull/13) ([ricardogama](https://github.com/ricardogama))
- Add isparta options [\#12](https://github.com/seegno/bookshelf-json-columns/pull/12) ([ricardogama](https://github.com/ricardogama))
- Update lint script to only check staged files [#13](https://github.com/seegno/bookshelf-json-columns/pull/13) ([ricardogama](https://github.com/ricardogama))
- Add isparta options [#12](https://github.com/seegno/bookshelf-json-columns/pull/12) ([ricardogama](https://github.com/ricardogama))

## [1.0.0](https://github.com/seegno/bookshelf-json-columns/tree/1.0.0) (2016-04-21)

[Full Changelog](https://github.com/seegno/bookshelf-json-columns/compare/0.1.0...1.0.0)

**Closed issues:**

- Supporting JSON Arrays [\#7](https://github.com/seegno/bookshelf-json-columns/issues/7)
- Unable to get plugin working [\#6](https://github.com/seegno/bookshelf-json-columns/issues/6)
- Supporting JSON Arrays [#7](https://github.com/seegno/bookshelf-json-columns/issues/7)
- Unable to get plugin working [#6](https://github.com/seegno/bookshelf-json-columns/issues/6)

**Merged pull requests:**

- Add initialize method extension note to README.md [\#11](https://github.com/seegno/bookshelf-json-columns/pull/11) ([ricardogama](https://github.com/ricardogama))
- Add coveralls [\#10](https://github.com/seegno/bookshelf-json-columns/pull/10) ([ricardogama](https://github.com/ricardogama))
- Update changelog script [\#9](https://github.com/seegno/bookshelf-json-columns/pull/9) ([ricardogama](https://github.com/ricardogama))
- Update eslint modules versions and configuration [\#8](https://github.com/seegno/bookshelf-json-columns/pull/8) ([ricardogama](https://github.com/ricardogama))
- Add initialize method extension note to README.md [#11](https://github.com/seegno/bookshelf-json-columns/pull/11) ([ricardogama](https://github.com/ricardogama))
- Add coveralls [#10](https://github.com/seegno/bookshelf-json-columns/pull/10) ([ricardogama](https://github.com/ricardogama))
- Update changelog script [#9](https://github.com/seegno/bookshelf-json-columns/pull/9) ([ricardogama](https://github.com/ricardogama))
- Update eslint modules versions and configuration [#8](https://github.com/seegno/bookshelf-json-columns/pull/8) ([ricardogama](https://github.com/ricardogama))

## [0.1.0](https://github.com/seegno/bookshelf-json-columns/tree/0.1.0) (2015-12-16)
**Closed issues:**

- Travis configuration [\#2](https://github.com/seegno/bookshelf-json-columns/issues/2)
[Full Changelog](https://github.com/seegno/bookshelf-json-columns/compare/2146ca3ac6ef42faa30e84bc5029220634187f92...0.1.0)

**Merged pull requests:**
**Closed issues:**

- Fix travis configuration [\#5](https://github.com/seegno/bookshelf-json-columns/pull/5) ([ricardogama](https://github.com/ricardogama))
- Fix `changelog` script [\#4](https://github.com/seegno/bookshelf-json-columns/pull/4) ([ricardogama](https://github.com/ricardogama))
- Add travis configuration file [\#3](https://github.com/seegno/bookshelf-json-columns/pull/3) ([ricardogama](https://github.com/ricardogama))
- Add initial code [\#1](https://github.com/seegno/bookshelf-json-columns/pull/1) ([ricardogama](https://github.com/ricardogama))
- Travis configuration [#2](https://github.com/seegno/bookshelf-json-columns/issues/2)

**Merged pull requests:**

- Fix travis configuration [#5](https://github.com/seegno/bookshelf-json-columns/pull/5) ([ricardogama](https://github.com/ricardogama))
- Fix `changelog` script [#4](https://github.com/seegno/bookshelf-json-columns/pull/4) ([ricardogama](https://github.com/ricardogama))
- Add travis configuration file [#3](https://github.com/seegno/bookshelf-json-columns/pull/3) ([ricardogama](https://github.com/ricardogama))
- Add initial code [#1](https://github.com/seegno/bookshelf-json-columns/pull/1) ([ricardogama](https://github.com/ricardogama))

\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
- _This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)_
27 changes: 5 additions & 22 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < argument
*/

function stringify(model, attributes, options) {
// Do not stringify with `patch` option.
if (options && options.patch) {
return;
}

// Mark json columns as stringfied.
options.parseJsonColumns = true;

Expand All @@ -33,20 +28,17 @@ function stringify(model, attributes, options) {
function parse(model, response) {
let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};

// Do not parse with `patch` option.
if (options.patch) {
return;
}

// Do not parse on `fetched` event after saving.
// eslint-disable-next-line no-underscore-dangle
if (!options.parseJsonColumns && options.query && options.query._method !== 'select') {
return;
}

this.constructor.jsonColumns.forEach(column => {
if (this.attributes[column]) {
this.attributes[column] = JSON.parse(this.attributes[column]);
const value = this.attributes[column];

if (value && typeof value === 'string') {
this.attributes[column] = JSON.parse(value);
}
});
}
Expand Down Expand Up @@ -107,16 +99,7 @@ exports.default = Bookshelf => {
}
});

return Model.save.call(this, attributes, options).then(model => {
// Parse JSON columns.
Object.keys(attributes).forEach(attribute => {
if (this.constructor.jsonColumns.indexOf(attribute) !== -1 && model.attributes[attribute]) {
model.attributes[attribute] = JSON.parse(model.attributes[attribute]);
}
});

return model;
});
return Model.save.call(this, attributes, options);
}
});

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bookshelf-json-columns",
"version": "2.1.1",
"version": "3.0.0",
"description": "Parse JSON columns with Bookshelf.js",
"license": "MIT",
"author": {
Expand Down Expand Up @@ -28,7 +28,7 @@
},
"scripts": {
"build": "rm -rf dist/* && ./node_modules/.bin/babel src/ --out-dir dist/",
"changelog": "github_changelog_generator --bug-labels --enhancement-labels --future-release=$npm_config_release --header-label='# Changelog'",
"changelog": "github_changelog_generator --user seegno --project bookshelf-json-columns --bug-labels --enhancement-labels --future-release=$npm_config_release --header-label='# Changelog'",
"coveralls": "npm run cover && cat ./test/coverage/lcov.info | coveralls",
"cover": "NODE_ENV=test nyc mocha $npm_package_options_mocha",
"lint": "git diff --cached --name-only --diff-filter=ACMRTUXB | grep -E '\\.(js)(\\..+)?$' | xargs eslint",
Expand Down

0 comments on commit 710fca8

Please sign in to comment.