- [
10eaa2309c
] - feat: enable rollup cache feature (#700) (Nick Schot) - [
73bb9d1817
] - deps: update outdated dependencies (#704) (Zachary Golba) - [
5ba179700d
] - fix: gracefully shutdown workers instead of waiting for the timeout to pass (fixes #702) (#703) (Nick Schot) - [
df96fd669b
] - feat: expands knex query coverage on models (#691) (Will Viles) - [
dd200af8a2
] - docs: clarify after action behavior (#690) (Nick Schot) - [
b636bf527d
] - docs: fix typos (#689) (Nick Schot) - [
608409d670
] - docs: add code of conduct and contributing documentation (#671) (Zachary Golba) - [
61bb4f4b04
] - feat: source code & test app debugger (#685) (Will Viles) - [
7858af506c
] - fix: serialized responses containing a self join is missing attributes (#675) (Zachary Golba) - [
2e223dfc8e
] - feat: allow creating model instance with a specific id (#679) (Jame) - [
33a0ef3194
] - deps: update babel-plugin-istanbul to version 4.0.0 (#680) (Greenkeeper) - [
9c50ed46d2
] - deps: update eslint-config-airbnb-base to version 11.1.0 (#677) (Greenkeeper) - [
ed943b506a
] - deps: update eslint to version 3.15.0 (#676) (Greenkeeper) - [
1e703f1a1e
] - deps: update third party type definitions (#670) (Zachary Golba) - [
c44ec71414
] - deps: update fb-watchman to version 2.0.0 (#673) (Greenkeeper) - [
478d4d27c5
] - dx: add .nvmrc file (#672) (Zachary Golba) - [
8b9c4772f3
] - deps: update source-map-support to version 0.4.11 (#667) (Greenkeeper) - [
8035ab7dd8
] - deps: update inflection to version 1.12.0 (#669) (Greenkeeper) - [
1ed30b373c
] - deps: update fb-watchman to version 1.9.2 (#668) (Greenkeeper) - [
41793aedc8
] - deps: update eslint to version 3.14.1 (#665) (Greenkeeper) - [
f3cd85926a
] - test: properly test against pg driver on appveyor (#664) (Zachary Golba) - [
65821af0c1
] - release: v1.1.7 🔧 (#663) (Zachary Golba)
- [
d9c538ea3e
] - fix: children one layer deep cannot resolve their parent controller (#662) (Zachary Golba) - [
c8f0254397
] - deps: update eslint to version 3.14.0 (#656) (Greenkeeper) - [
bcf2c2fbff
] - fix: properly set environment before running db:* commands (#661) (Zachary Golba) - [
083e112a6b
] - release: v1.1.6 🔧 (#660) (Zachary Golba)
- [
6f1f16a2dc
] - fix: recursive readdir is broken (#659) (Zachary Golba) - [
d6b2d6cfa4
] - release: v1.1.5 🔧 (#658) (Zachary Golba)
- [
ddbcd9e43b
] - fix: sort not working (#657) (Nick Schot) - [
20eea5c71b
] - deps: update babel-core to version 6.22.1 (#654) (Greenkeeper) - [
f83bdf413c
] - deps: update ora to version 1.1.0 (#655) (Greenkeeper) - [
4ee7b28724
] - deps: update babel-plugin-transform-es2015-modules-commonjs to version 6.22.0 (#653) (Greenkeeper) - [
c5bd0cc02a
] - deps: update babel-core to version 6.22.0 (#652) (Greenkeeper) - [
26594fdf10
] - chore: add gitter integrations (#651) (Zachary Golba) - [
cdebc089ec
] - deps: update flow-bin to version 0.38.0 (#647) (Greenkeeper) - [
4e40c2b550
] - release: v1.1.4 🔧 (#650) (Zachary Golba)
- [
d1c5e8d00e
] - fix: cli and compilation errors (#649) (Zachary Golba) - [
06d9fc7f65
] - fix: make sure result is an instance of query in resource enhancer (#648) (Nick Schot) - [
4f4bd16c12
] - deps: update nyc to version 10.1.2 (#646) (Greenkeeper) - [
d6c9ab49fc
] - release: v1.1.3 🔧 (#644) (Zachary Golba)
Due to a change in the way the cli modules are bundled, you may need to uninstall and reinstall lux globally before upgrading your application.
npm uninstall -g lux-framework
npm cache clean
npm install -g lux-framework@latest
- [
89dff6162c
] - fix: we should check for lux under the dependency key in package.json not root (#643) (Zachary Golba) - [
b7c66cb41f
] - fix: make sure dates are correctly validated & parsed (#639) (Nick Schot) - [
00273c8279
] - deps: update ora to version 1.0.0 (#641) (Greenkeeper) - [
fe2b860abd
] - deps: update source-map-support to version 0.4.10 (#642) (Greenkeeper) - [
f41fc048b9
] - deps: integrate rollup-plugin-lux (#632) (Zachary Golba) - [
e4ed011b0a
] - deps: update eslint-plugin-flowtype to version 2.30.0 (#636) (Greenkeeper) - [
df95938f3f
] - deps: update source-map-support to version 0.4.9 (#634) (Greenkeeper) - [
ebbcf577bd
] - fix: migration generator indexes (#625) (Nick Schot) - [
93aa5c47bd
] - fix: make pages consistent when using sort on non-unique attributes (#633) (Nick Schot) - [
d1589ab8f3
] - test: allow appveyor builds to fail with pg driver (#635) (Zachary Golba) - [
682d6fef56
] - chore: improve ci config and process (#627) (Zachary Golba) - [
d0795c36fa
] - deps: update rollup to version 0.41.4 (#630) (Greenkeeper) - [
20d6f0dbe7
] - deps: update ansi-regex to version 2.1.1 (#629) (Greenkeeper) - [
016938c401
] - deps: update rollup to version 0.41.3 (#628) (Greenkeeper) - [
e7d069ffe7
] - deps: update rollup to version 0.41.1 (#616) (Greenkeeper) - [
1626cd882c
] - deps: update ora to version 0.4.1 (#623) (Greenkeeper) - [
60b33a6a33
] - deps: update eslint to version 3.13.1 (#622) (Greenkeeper) - [
b050cfaf03
] - deps: update eslint-config-airbnb-base to version 11.0.1 (#619) (Greenkeeper) - [
5a879d467e
] - deps: update eslint to version 3.13.0 (#615) (Greenkeeper) - [
fbbf198e2b
] - deps: update babel-plugin-istanbul to version 3.1.2 (#611) (Greenkeeper) - [
4c5e326afa
] - release: v1.1.2 🔧 (#609) (Zachary Golba)
🎉 Happy New Year!
- [
f828e8effa
] - fix: database is undefined when using the postgresql driver (#605) (Zachary Golba) - [
46ed68b35a
] - deps: update third party type definitions (#604) (Zachary Golba) - [
914a4b831d
] - deps: update sinon to version 1.17.7 (#602) (Greenkeeper) - [
d3ffda9156
] - deps: update eslint-plugin-flowtype to version 2.29.2 (#595) (Greenkeeper) - [
f5b002e3dd
] - release: v1.1.1 🔧 (#594) (Zachary Golba)
- [
c54cc20844
] - fix: options request does not work with query params (#573) (Zachary Golba) - [
93df71f3c9
] - deps: update babel-plugin-istanbul to version 3.0.0 (#591) (Greenkeeper) - [
0f724109fa
] - deps: update source-map-support to version 0.4.8 🚀 (#590) (Greenkeeper) - [
fdb7a9e7fc
] - deps: update flow-bin to version 0.37.4 🚀 (#587) (Greenkeeper) - [
302a10fd61
] - docs: remove irrelevant doc comments from query class (#578) (Zachary Golba) - [
ccb645c0f0
] - refactor: lint binary and scripts (#576) (Zachary Golba) - [
20c381fd75
] - deps: update test-app dependencies (#577) (Zachary Golba) - [
4fad8cbdf5
] - deps: update babel-preset-lux to version 2.0.1 (#570) (Zachary Golba) - [
ac08ca4fea
] - deps: update ora to version 0.4.0 (#575) (Greenkeeper) - [
557e2c2805
] - deps: update babel-core to version 6.21.0 (#567) (Greenkeeper) - [
c94b2597df
] - deps: update remark-lint to version 5.4.0 (#572) (Greenkeeper) - [
8ab08b3bba
] - deps: update eslint to version 3.12.1 (#564) (Greenkeeper) - [
a139b81b8e
] - deps: update eslint-config-airbnb-base to version 11.0.0 🚀 (#560) (Greenkeeper) - [
821a2c49af
] - deps: update rollup to version 0.37.0 (#561) (Greenkeeper) - [
7eab2633d0
] - deps: update flow-bin to version 0.37.0 🚀 (#563) (Greenkeeper) - [
ae4c4df189
] - deps: update rollup-plugin-babel to version 2.7.1 (#565) (Greenkeeper) - [
f94ac5234c
] - docs: add more api docs and improve existing content (#559) (Zachary Golba)
This release introduces a public transaction api to the model class. Changes are backwards compatible with the previous model api.
Internally, all methods that modify the state of the database are wrapped in
transactions. If the transaction fails, all calls to create
, save
, or
update
will be rolled back to the state before the transaction began.
Example:
import User from 'app/models/user';
// This internally uses a transaction.
await User.create({
firstName: 'New',
lastName: 'User'
});
You have the ability to manually specify the transaction that will be used for a
create
, update
, or save
call with the static and instance method, transacting
.
Example:
import { Model } from 'lux-framework';
import Profile from 'app/models/profile';
class User extends Model {
static hasOne = {
profile: {
inverse: 'user'
}
};
static hooks = {
async beforeCreate(user, trx) {
// If the transaction fails the profile instance will not be persisted.
user.profile = await Profile
.transacting(trx)
.create();
}
};
}
You can also manually trigger create a transaction if you plan on creating many model instances as once.
Example:
import User from 'app/models/user';
User.transaction(trx => (
Promise.all([
User
.transacting(trx)
.create({
firstName: 'New',
lastName: 'User'
}),
User
.transacting(trx)
.create({
firstName: 'New',
lastName: 'User'
}),
User
.transacting(trx)
.create({
firstName: 'New',
lastName: 'User'
})
])
));
- [
3f15362600
] - deps: update babel-core to version 6.20.0 (#556) (Greenkeeper) - [
9a20c5ce11
] - deps: update eslint to version 3.12.0 (#557) (Greenkeeper) - [
7f53cd230c
] - docs: fix broken logo in readme (#555) (Zachary Golba) - [
590956ed52
] - docs: add preliminary guide files (#554) (Zachary Golba) - [
16d224b4e7
] - feat: use transactions when writing to the database (#527) (Zachary Golba) - [
9e89b042cd
] - deps: update eslint-plugin-flowtype to version 2.29.1 (#549) (Greenkeeper) - [
5b3e91e5f9
] - deps: update eslint to version 3.11.1 (#547) (Greenkeeper) - [
4eb0c9b926
] - deps: update eslint-plugin-flowtype to version 2.28.2 (#546) (Greenkeeper) - [
42f1707ac8
] - deps: update eslint to version 3.11.0 🚀 (#539) (Greenkeeper) - [
39adf76c3a
] - deps: update rollup to version 0.36.4 (#536) (Greenkeeper) - [
23189f535b
] - deps: update flow-bin to version 0.36.0 🚀 (#537) (Greenkeeper) - [
394d3132e7
] - deps: update nyc to version 10.0.0 (#535) (Greenkeeper) - [
ef33526860
] - deps: update mocha to version 3.2.0 (#538) (Greenkeeper) - [
760ae5f68c
] - release: 1.0.5 🔧 (#534) (Zachary Golba)
- [
45c18600c4
] - deps: update babel-eslint to version 7.1.1 (#533) (Greenkeeper) - [
0720dda77f
] - deps: update eslint to version 3.10.2 (#532) (Greenkeeper) - [
dbdcc5a2de
] - fix: query parameters are not added to custom routes (#528) (Nick Schot) - [
4530d0ce8d
] - deps: update nyc to version 9.0.1 (#530) (Greenkeeper) - [
8d36091058
] - deps: update eslint to version 3.10.1 (#529) (Greenkeeper) - [
c586f350f6
] - docs: use master branch for appveyor badge (#526) (Zachary Golba) - [
e93b45ca4b
] - deps: update test-app dependencies (#525) (Zachary Golba) - [
0bbb7af65c
] - release: 1.0.4 🔧 (#524) (Zachary Golba)
- [
7d2ff0d316
] - fix: ids in json payloads should be cast to number (#523) (Zachary Golba) - [
8cca55e756
] - fix: empty 1:1 relationships are not returned in correct format (#521) (Zachary Golba) - [
6919517b37
] - test: prevent ci builds from failing due to time constraints (#520) (Zachary Golba) - [
090f871f18
] - fix: passing value null in post to type number throws type error (#516) (Zachary Golba) - [
6cd3e68b6e
] - deps: update flow-bin to version 0.35.0 🚀 (#517) (Greenkeeper) - [
cd4f63fe4a
] - deps: update eslint to version 3.10.0 (#518) (Greenkeeper) - [
b97d093c9a
] - fix: default values override all falsy attribute values (#515) (Zachary Golba) - [
6f4e17078c
] - dx: use flow-typed instead of custom type declarations when possible (#514) (Zachary Golba) - [
44b88250a2
] - docs: use shields.io for project status badges in readme (#513) (Zachary Golba) - [
2e9c3353b1
] - release: 1.0.3 🔧 (#512) (Zachary Golba)
- [
53378f622b
] - fix: dynamic segments are not parsed on model-less resources (#510) (Zachary Golba) - [
56321bb7df
] - fix: small typos in model initialize-class.js (#505) (Nick Schot) - [
7769865731
] - chore: use codecov bash uploader (#511) (Zachary Golba) - [
edb4635b8c
] - fix: some strings in request body cast to another type (#506) (Zachary Golba) - [
dea08354ab
] - deps: update eslint-config-airbnb-base to version 10.0.1 🚀 (#503) (Greenkeeper) - [
b7435570fc
] - deps: update eslint-plugin-import to version 2.2.0 (#504) (Greenkeeper) - [
18ba638610
] - deps: update babel-plugin-transform-es2015-modules-commonjs to version 6.18.0 (#500) (Zachary Golba) - [
59a16f19ca
] - deps: update eslint to version 3.9.1 (#501) (Zachary Golba) - [
e12eb406d2
] - deps: update eslint-plugin-import to version 2.1.0 (#498) (Greenkeeper) - [
7b1c48b4aa
] - deps: update eslint to version 3.9.0 🚀 (#489) (Greenkeeper) - [
61c37cc4de
] - deps: update source-map-support to version 0.4.6 (#492) (Greenkeeper) - [
055bf5f5fe
] - deps: update babel-core to version 6.18.2 (#496) (Greenkeeper) - [
63db399c8c
] - deps: update nyc to version 8.4.0 (#497) (Greenkeeper) - [
26ba4e5a21
] - deps: update remark-lint to version 5.2.0 (#494) (Greenkeeper) - [
46f223b77f
] - deps: update flow-bin to version 0.34.0 (#490) (Greenkeeper) - [
71214e17ff
] - deps: update remark-cli to version 2.1.0 (#488) (Greenkeeper) - [
748b26b577
] - deps: update babel-eslint to version 7.1.0 (#487) (Greenkeeper) - [
d98139e08c
] - deps: update eslint-plugin-flowtype to version 2.25.0 (#486) (Greenkeeper) - [
40bea0b2d1
] - deps: update eslint-plugin-flowtype to version 2.24.0 (#485) (Greenkeeper) - [
edaec79e12
] - deps: update babel-core to version 6.18.0 (#483) (Greenkeeper) - [
ce25efdad7
] - deps: update eslint-plugin-flowtype to version 2.23.1 (#484) (Greenkeeper) - [
be7fef2034
] - deps: update eslint-plugin-flowtype to version 2.22.0 (#481) (Greenkeeper) - [
3e578257f9
] - release: 1.0.2 🔧 (#480) (Zachary Golba)
- [
bbf68000ea
] - fix: controllers are not properly resolving for resources with custom paths (#478) (Zachary Golba) - [
1a52cc1cec
] - deps: update eslint-plugin-flowtype to version 2.21.0 (#479) (Greenkeeper) - [
fe35b45935
] - release: 1.0.1 🔧 (#477) (Zachary Golba)
- [
f27eab4e66
] - fix: readdir error is causing cli commands to fail (#476) (Zachary Golba) - [
2deea84ab9
] - release: 1.0.0 🎉 (#472) (Zachary Golba)
- [
34d9478323
] - deps: update test-app dependencies (#475) (Zachary Golba) - [
71dc913fb8
] - chore: add markdown linter (#474) (Zachary Golba) - [
0f1aa9fe69
] - deps: update nyc to version 8.3.2 (#473) (Greenkeeper) - [
0ca4477935
] - docs: fix link to guides in readme (#471) (Chris Watts) - [
ea471aad7f
] - fix: eslint config in compiler inherits from lux .eslintrc.json (#469) (Zachary Golba) - [
2c74a0cc9c
] - docs: add logo to readme (#470) (Zachary Golba) - [
6656b9aca5
] - docs: finalize public api docs for 1.0 release (#418) (Zachary Golba) - [
7af75be54f
] - deps: update source-map-support to version 0.4.5 (#468) (Greenkeeper) - [
362b196db3
] - deps: update eslint to version 3.8.1 (#467) (Greenkeeper) - [
d8833a9968
] - deps: update eslint-config-airbnb-base to version 9.0.0 🚀 (#464) (Greenkeeper) - [
e0cde3bc20
] - deps: update babel-plugin-istanbul to version 2.0.3 (#465) (Greenkeeper) - [
0b9b017a26
] - test: improve logger test coverage (#452) (Zachary Golba) - [
a343f87273
] - refactor: ensure tableName is statically evaluated (#462) (Zachary Golba) - [
fd60ff7b77
] - deps: update source-map-support to version 0.4.4 (#463) (Greenkeeper) - [
b86a4cbe3d
] - deps: update test-app dependencies (#461) (Zachary Golba) - [
54db513fa3
] - feat: expose controller and action in public request api (#460) (Zachary Golba) - [
e289ffc142
] - feat: add after-action middleware hook to controller (#459) (Zachary Golba) - [
b74b52ff75
] - deps: update mocha to version 3.1.2 (#458) (Zachary Golba) - [
c14625a38c
] - deps: update eslint to version 3.8.0 🚀 (#457) (Greenkeeper) - [
0a6c953345
] - fix: namespaced resources without root controllers/serializers is not… (#454) (Zachary Golba) - [
a2bee41294
] - fix: compiler does not properly format class names for nested namespaces (#449) (Zachary Golba) - [
adc723040c
] - deps: update eslint-plugin-import to version 2.0.1 (#451) (Greenkeeper) - [
c8995a2f75
] - test: add unit tests for route definitions (#443) (Zachary Golba) - [
ec18b7ac96
] - deps: update mocha to version 3.1.1 (#448) (Greenkeeper) - [
f6a868bd77
] - deps: update rollup to version 0.36.3 (#447) (Greenkeeper) - [
3dfc2907e2
] - fix: remove unused plugins in lib/babel-hook (#444) (Zachary Golba) - [
e7316c0df3
] - fix: use path.sep to resolve root tmp dirs in fs tests (#442) (Zachary Golba) - [
345e8c6b73
] - test: add unit tests for controller utils (#441) (Zachary Golba) - [
a4d9952984
] - refactor: make watcher a child of the fs package (#412) (Zachary Golba) - [
20480fa1c9
] - deps: update test-app dependencies (#440) (Zachary Golba) - [
b3445ce5a4
] - deps: update nyc to version 8.3.1 (#439) (Greenkeeper) - [
1bfd98e77a
] - test: run flow on appveyor builds (#432) (Zachary Golba) - [
9e2f84bd2d
] - refactor: use airbnb eslint rules (#434) (Zachary Golba) - [
57101cfaf1
] - deps: update eslint-plugin-flowtype to version 2.20.0 (#438) (Greenkeeper) - [
bf213b49b8
] - deps: update eslint to version 3.7.1 (#437) (Zachary Golba) - [
84b7bd0d14
] - deps: update babel-preset-lux to version 1.3.0 (#436) (Greenkeeper) - [
eaeb9eb983
] - test: enable parallel circleci builds (#435) (Zachary Golba) - [
c8f05ee180
] - deps: update babel-core to version 6.17.0 (#433) (Greenkeeper) - [
856aeae646
] - test: switch to circleci (#431) (Zachary Golba) - [
0a49d14f1e
] - deps: update source-map-support to version 0.4.3 (#428) (Greenkeeper) - [
339c35c864
] - deps: update babel-core to version 6.16.0 (#427) (Zachary Golba) - [
c3483ac1dc
] - chore(package): update babel-core to version 6.16.0 (greenkeeperio-bot) - [
17780a1c6c
] - deps: update babel-plugin-transform-es2015-modules-commonjs to version 6.16.0 (#430) (Greenkeeper) - [
fd7bbe2f90
] - deps: update flow-bin to version 0.33.0 🚀 (#429) (Greenkeeper) - [
d3c67a51c8
] - deps: update rollup to version 0.36.1 (#426) (Greenkeeper) - [
de8c3f16bb
] - chore: change ecmaVersion to 2017 in .eslintrc.json (#425) (Zachary Golba) - [
32064c964e
] - deps: update babel-eslint to version 7.0.0 (#424) (Greenkeeper) - [
5fb4a42192
] - deps: update mocha to version 3.1.0 (#423) (Greenkeeper) - [
c7fe135343
] - deps: update eslint to version 3.6.1 (#422) (Greenkeeper) - [
0e6ec39138
] - refactor: cleanup unecessary controller props (#420) (Zachary Golba) - [
a12bcad4c9
] - deps: update node-fetch to version 1.6.3 (#421) (Zachary Golba) - [
85fc7fc82f
] - chore(package): update node-fetch to version 1.6.3 (greenkeeperio-bot) - [
28b03d63f7
] - docs: update examples (#419) (Zachary Golba) - [
6b2f86da48
] - deps: update sinon to version 1.17.6 (#416) (Zachary Golba) - [
15c5ca0c0c
] - deps: update node-fetch to version 1.6.2 (#415) (Greenkeeper) - [
aa81af568c
] - deps: update eslint to version 3.6.0 (#414) (Greenkeeper) - [
f0d660c599
] - fix: application keys being overwritten (#411) (Zachary Golba) - [
585584d2f7
] - test: improve luxify test coverage (#409) (Zachary Golba) - [
73579fb570
] - test: add unit tests for route namespaces (#410) (Zachary Golba) - [
29dab32f86
] - test: refactor serializer tests to improve coverage (#408) (Zachary Golba) - [
999f64933c
] - deps: update mysql2 to v1.1.0 in test-app (#413) (Zachary Golba) - [
233d4a716c
] - test: add unit tests for relationships module in database package (#407) (Zachary Golba) - [
ade16b5d5e
] - deps: update eslint-plugin-flowtype to version 2.19.0 (#406) (Greenkeeper) - [
a11ee86f27
] - deps: update rollup to version 0.36.0 (Greenkeeper) - [
4d35d593bf
] - test: improve overall test coverage (#287) (Zachary Golba) - [
cd1e822817
] - deps: update eslint-plugin-flowtype to version 2.18.2 (#397) (Greenkeeper) - [
bf5571db8f
] - deps: update test-app dependencies (#395) (Zachary Golba) - [
007fd125ae
] - deps: update eslint-plugin-flowtype to version 2.18.1 (#389) (Greenkeeper) - [
b0bb089ae3
] - deps: update eslint-plugin-flowtype to version 2.17.1 (#387) (Greenkeeper) - [
d1e42c47f4
] - chore: switch to bcryptjs instead of native bcrypt in social-network example (#383) (Zachary Golba) - [
e4966fd1f7
] - chore: fix authentication in social-network example (#378) (Zachary Golba) - [
bbbe317a44
] - deps: update eslint to version 3.5.0 (#373) (Greenkeeper) - [
271722efd2
] - deps: update eslint-plugin-flowtype to version 2.16.1 (#372) (Greenkeeper) - [
7a3b836d51
] - deps: update rollup-plugin-eslint to version 3.0.0 (#370) (Greenkeeper) - [
c823ce4da2
] - chore: use bcrypt in social network example (#371) (Adrien Montfort) - [
bc7eba0e44
] - deps: update eslint-plugin-flowtype to version 2.16.0 (#369) (Greenkeeper) - [
15e21ec3bf
] - deps: update rollup-plugin-json to version 2.0.2 (#368) (Greenkeeper) - [
9f1e3ef7db
] - deps: update eslint-plugin-flowtype to version 2.15.0 (#367) (Greenkeeper) - [
38081786f6
] - deps: update eslint-plugin-flowtype to version 2.14.3 (#366) (Greenkeeper) - [
77b623a257
] - release: 1.0.0-rc.7 (#363) (Zachary Golba)
This release implements a fix for a regression in 1.0.0-rc.6
where model migrations would include the formatted filename as the table name (i.e '2016050414243335_create_posts'
instead of 'posts'
).
- [
7bd0f4d87b
] - chore: update example applications (#361) (Zachary Golba) - [
9bcecc5650
] - release: 1.0.0-rc.6 (#360) (Zachary Golba)
This release contains a number of bug fixes related to overriding default behavior such as custom actions, model-less controllers, etc. In addition to bug fixes this release contains some awesome new features.
Route definitions have changed quite a bit with the implementation of router namespaces. In order to upgrade you will have to remove any calls to this.route
within the app/routes.js
file.
Previously, this.route
was a means of defining custom routes or just defining individual routes rather than a whole resource. It did not scale well to multiple namespaces and was kind of a clunky API to begin with.
To define a custom route within a resource you may do the following:
export default function routes() {
// Arbitrary Routes (i.e /{route})
// GET /health => ApplicationController#health
this.get('health');
this.resource('posts', function () {
// Member Routes (i.e /posts/:id/{route})
this.member(function () {
// GET /posts/1/comments => PostsController#comments()
this.get('comments');
// POST /posts/1/comments => PostsController#createComment()
this.post('comments', 'createComment');
});
// Collection Routes (i.e /posts/{route})
this.collection(function () {
// GET /posts/drafts => PostsController#drafts()
this.get('drafts');
});
});
}
To only define a subset of routes for a given resource you may now do the following as shortcut:
export default function routes() {
// GET /posts => 200 OK
// GET /posts/1 => 200 OK
// POST /posts => 404 Not Found
// PATCH /posts/1 => 404 Not Found
// DELETE /posts/1 => 404 Not Found
this.resource('posts', {
only: ['show', 'index']
});
}
You now have the ability to define namespaces with your routes. Common uses cases for defining a namespace within your routes include admin-only routes, requiring payment from a user, api versioning, etc.
Generators
To generate a resource within a namespace, include the namespace as part of the name argument passed to the generate
command.
Example:
lux generate resource admin/posts
The command above will result in the following files being created:
app/controllers/admin/posts
app/serializers/admin/posts
If you do not already have an ApplicationController
or ApplicationSerializer
for a namespace, they will automatically be generated.
Also, the generate
command will omit namespaces when generating a Model
or Migration
. If you generate a resource in a namespace that already has a Model
, you will be given the choice to either overwrite or skip the Model
or Migration
files.
Controllers
You can think of a namespace as if it is it's own Lux application that you are mounting into it's parent namespace. Similar to how a Controller
works in previous versions, a Controller
within a namespace will merge it's middleware with the ApplicationController
for the namespace it is a part of. If the Controller
is the ApplicationController
for a namespace, it will merge it's middleware with the ApplicationController
of parent namespace if possible.
Example:
/*********************
* Namespace: 'Root' *
* Path: '/' *
*********************/
import { Controller } from 'lux-framework';
class ApplicationController extends Controller {
beforeAction = [
async function sayHello({ logger }) {
logger.info('Hello world!');
}
];
}
class PostsController extends Controller {
index() {
return Post.isPublic();
}
}
A GET
request to /posts
will result in the following functions (in this order) handling the request:
sayHello
PostsController#index
The PostsController#index
action only gives us the posts that are publicly available. This is what we want, but we should have a way for user's with admin access to be able to see what has not been published yet. To accomplish this we will use a namespace.
/**********************
* Namespace: 'admin' *
* Path: '/admin' *
**********************/
import { Controller } from 'lux-framework';
class AdminApplicationController extends Controller {
beforeAction = [
async function authenticate() {
// Authenticate request...
}
];
}
class AdminPostsController extends Controller {
index() {
return Post.all();
}
}
A GET
request to /admin/posts
will result in the following functions (in this order) handling the request:
sayHello
authenticate
AdminPostsController#index
As you can see in the example above, namespaces allow you to isolate middleware functions in a beforeAction
array to only execute at certain paths of your application. This is done behind the scenes with Lux and does not require you to use inheritance between your controllers. Inheritance is 100% opt-in so feel free to start from scratch while still gaining the benefit of shared middleware functions.
Sometimes it can be nice to use inheritance if we're only slightly changing the behavior of a Controller
. Let's look at an example where the AdminPostsController
extends the PostsController
.
import PostsController from 'app/controllers/posts';
class AdminPostsController extends PostsController {
index(request, response) {
return super.index(request, response).unscope('isPublic');
}
}
In the example above we are able to simply remove the isPublic
scope from the #index()
action because we are using inheritance. This would be very helpful if we added additional logic to the #index()
route that would have otherwise had to duplicate across posts
routes in other namespaces.
Keep in mind, inheritance can be an anti-pattern if it takes you more work to override methods than it would be to start fresh.
Serializers
Serializers within a namespace work very similar to a Controller
. The main difference being that it is not required to have a Serializer
within each namespace. Serializers will resolve to their closest ancestor. That means that if you have a PostsSerializer
for a posts
resource at the root namespace, requests to /admin/posts
will fall back to use the PostsSerializer
if a AdminPostsSerializer
is not found at app/serializers/admin/posts.js
.
Serializers within a namespace are great for versioning an api. Over time some fields may become deprecated in your responses and using serializers in a namespace is a great way to solve this problem.
Example:
/**********************
* Namespace: 'v1' *
* Path: '/v1' *
**********************/
import { Serializer } from 'lux-framework';
class V1PostsSerializer extends Serializer {
attributes = [
'body',
'title',
'deprecated'
];
hasOne = [
'author'
];
haMany = [
'comments'
];
}
As you can see above we have a V1PostsSerializer
that has an attribute that we no longer wish to include in responses in the v2
namespace. We can use a namespaces to help us accomplish this task.
/**********************
* Namespace: 'v2' *
* Path: '/v2' *
**********************/
import V1PostsSerializer from 'app/serializers/v1/posts';
class V2PostsSerializer extends V1PostsSerializer {
attributes = [
'body',
'title'
];
}
🎉 It's that simple. Requests to /v1/posts
will include the deprecated
attribute while requests to /v2/posts
will not.
Defining Namespaces
To define a namespace in your application, you must specify it in the app/routes.js
file.
function routes() {
this.resource('posts');
this.namespace('admin', function () {
this.resource('posts');
});
}
There is no limit to how many levels you nest namespaces. Lux will flatten the execution of functions nested within namespaces during application boot so feel free to go crazy.
function routes() {
this.namespace('a', function () {
this.resource('posts');
this.namespace('b', function () {
this.resource('posts');
this.namespace('c', function () {
this.resource('posts');
this.namespace('d', function () {
this.resource('posts');
});
});
});
});
}
Previously, the only means of checking persistence was by checking if a Model has an dirty attributes. This was unsuitable for determining wether or not a record has been persisted to the database yet.
We have added Model#isNew
and Model#persisted
to handle this.
Example:
import Post from 'app/models/posts';
let post = await Post.first();
/**
* Check existing record's persistence...
*/
post.isDirty
// => false
post.isNew
// => false
post.persisted
// => true
/**
* Check an existing record's persistence after an attribute has been changed...
*/
post.title = 'add ability to check if model has been saved';
// => 'add ability to check if model has been saved'
post.isDirty
// => true
post.isNew
// => false
post.persisted
// => false
await post.save();
/**
* Check a recently saved record's persistence...
*/
post.isDirty
// => false
post.isNew
// => false
post.persisted
// => true
post = new Post({
title: 'I have yet to be saved.'
});
/**
* Check the persistence of a record that has yet to be saved...
*/
post.isDirty
// => false
post.isNew
// => true
post.persisted
// => false
/**
* Check a new record that was created via the #create() method...
*/
post = await Post.create({
title: 'I have yet to be saved.'
});
post.isDirty
// => false
post.isNew
// => false
post.persisted
// => true
🎉 You can now do distinct queries on a Model.
import Post from 'app/models/post';
Post.distinct('title' /*, 'body', ...etc */).where({
isPublic: true
});
// SELECT DISTINCT "posts"."title" AS "title" FROM "posts" WHERE "posts"."is_public" = TRUE
- [
361acd467f
] - deps: update babel-preset-lux to version 1.2.0 (#359) (Greenkeeper) - [
1adeb907df
] - feat: router namespaces (#338) (Zachary Golba) - [
1f9094e5db
] - chore: add appveyor badge to readme (#358) (Zachary Golba) - [
af75c59062
] - chore: remove unnecessary event emitter decl (#357) (Zachary Golba) - [
ce5568297d
] - deps: update flow-bin to version 0.32.0 🚀 (#356) (Greenkeeper) - [
48d1cf8cd9
] - chore: improve ci set up (#350) (Zachary Golba) - [
58a4c6ed04
] - deps: update rollup to version 0.34.13 (#355) (Greenkeeper) - [
603c45a5ec
] - deps: update rollup to version 0.34.11 (#353) (Greenkeeper) - [
0e05e3d9b9
] - fix: lux console fails when running on an npm linked version of the master branch (#349) (Zachary Golba) - [
5d492f5cea
] - feat: add #distinct() query method (#346) (Zachary Golba) - [
d9e00625e6
] - feat: add ability to check if model has been saved (#347) (Zachary Golba) - [
6474d516b5
] - deps: update eslint to version 3.4.0 (#345) (Greenkeeper) - [
482bfe272a
] - deps: update eslint-plugin-flowtype to version 2.11.4 (#344) (Greenkeeper) - [
0e66aa5405
] - deps: update flow-bin to version 0.31.1 🚀 (#341) (Greenkeeper) - [
6e88a55c08
] - deps: update babel-plugin-transform-es2015-modules-commonjs to version 6.14.0 (#343) (Greenkeeper) - [
15b648aa77
] - deps: update babel-core to version 6.14.0 (#342) (Greenkeeper) - [
d33e6e67c3
] - deps: update eslint-plugin-flowtype to version 2.11.1 (#339) (Greenkeeper) - [
56e329f968
] - docs: small readme typos/rephrasings (#330) (Kevin Barrett) - [
bace2de2bd
] - fix: errors occuring during application boot fail silently (#316) (Zachary Golba) - [
b8c5815045
] - deps: update rollup to version 0.34.10 (#328) (Greenkeeper) - [
20f18a3459
] - Feat: Ignoring build/dist folder (#327) (Adam Pash) - [
98dcfe05ce
] - deps: update eslint-plugin-flowtype to version 2.7.1 (#326) (Greenkeeper) - [
d28529ffc6
] - deps: update rollup to version 0.34.9 (#324) (Greenkeeper) - [
86ea773e88
] - deps: update eslint to version 3.3.1 (#323) (Greenkeeper) - [
6501ad00a0
] - Fix: Environment variables overwritten by lux CLI (#322) (Adam Pash) - [
9868b3d54d
] - Feat: Added ssl for database; fixed port (#319) (Adam Pash) - [
55cc30ae2b
] - Feat: Added minimum node version to package.json template (#321) (Adam Pash) - [
612b9ced7a
] - deps: update eslint-plugin-flowtype to version 2.7.0 (#318) (Greenkeeper) - [
039dda77f2
] - deps: update rollup to version 0.34.8 (#317) (Greenkeeper) - [
2b2829fbca
] - fix: model-less controllers prevent applications from starting (#315) (Zachary Golba) - [
2c90cfa994
] - deps: update test-app dependencies (#314) (Zachary Golba) - [
e9df74a9ef
] - chore: update examples (#313) (Zachary Golba) - [
d1fbddc7b0
] - release: 1.0.0-rc.5 (#312) (Zachary Golba)
This release contains a number of bug fixes as well as some new features. Big shout out to @adampash, a new member of the Postlight team. 👏 Awesome job these past 2 weeks!
Previously, you would have to use relative paths for importing modules within the app
directory. Now, app
is alias so you can import modules from the app
directory without having to write out the relative path (../../../
).
import { Controller } from 'lux-framework';
import Post from 'app/models/post';
class PostsController extends Controller {
show({ params: { id } }) {
return Post.find(id);
}
}
export default PostsController;
You now have the ability to setup CORS headers in your config file. These headers are added to the request before it is parsed. Doing so, prevents request that fail before reaching your ApplicationController
from not having the CORS headers set. This should allow for a more graceful error handling experience on the client.
Here is an example of how you may want to configure CORS for your application:
export default {
server: {
cors: {
origin: '*',
enabled: true,
headers: [
'Accept',
'Content-Type'
],
methods: [
'GET',
'POST',
'PATCH',
'DELETE',
'HEAD',
'OPTIONS'
]
}
},
logging: {
level: 'DEBUG',
format: 'text',
enabled: true,
filter: {
params: [
'email',
'password'
]
}
}
};
You may now use connection strings to configure your database connection. You may now specify a full config object as we have supported in previous versions, a config object containing driver
and url
properties, or a config object containing only the driver
property if your environment variables contain a DATABASE_URL
.
The following three examples are equivalent:
Example A:
// ./config/database.js
export default {
development: {
port: 5432,
host: '127.0.0.1',
driver: 'pg',
username: 'postgres',
password: '********',
database: 'lux_test'
}
}
Example B:
// ./config/database.js
export default {
development: {
driver: 'pg',
url: 'postgres://postgres:********@127.0.0.1:5432/lux_test'
}
}
Example C:
# ~/.bash_profile
export DATABASE_URL='postgres://postgres:********@127.0.0.1:5432/lux_test'
// ./config/database.js
export default {
development: {
driver: 'pg'
}
}
In prior versions, it could be a pain to upgrade due to differing config files based on when you first generated your Lux application. Now, you can have an easier time upgrading as default values for config options are used internally.
- [
30e3e2e6b9
] - fix: id null check fails if using postgres (#308) (Adam Pash) - [
d01c27eae5
] - feat: adding support for urls in database config (#307) (Adam Pash) - [
bf6a518239
] - deps: update eslint to version 3.3.0 (#310) (Greenkeeper) - [
fb22a31c8a
] - deps: update eslint-plugin-flowtype to version 2.6.4 (#305) (Greenkeeper) - [
8b416b748b
] - deps: update eslint-plugin-flowtype to version 2.6.3 (#303) (Greenkeeper) - [
fd1d01ec1b
] - feat: added CORS to config (#302) (Adam Pash) - [
a04c0fdda9
] - fix: camel cased relationships do not resolve correctly (#300) (Zachary Golba) - [
c90377052f
] - deps: update eslint-plugin-flowtype to version 2.6.1 (#301) (Greenkeeper) - [
386cd24270
] - feat: setting default configuration (#299) (Adam Pash) - [
99b48107d0
] - deps: update eslint-plugin-flowtype to version 2.4.1 (#296) (Greenkeeper) - [
d11aafc5f8
] - fix: pad function is failing due to negative values (#295) (Zachary Golba) - [
164daec01a
] - fix: lining up stats in debug logger when ms length differs (#292) (Adam Pash) - [
e33f742d0e
] - feat: aliased app dir for easier imports (#293) (Adam Pash) - [
14a9cea1f6
] - feat: added default fallback for CLI (#271) (Adam Pash) - [
4ff3f81218
] - deps: update mocha to version 3.0.2 (#291) (Greenkeeper) - [
9e658e9daa
] - chore: enable flow on windows (#286) (Zachary Golba) - [
cceb67995d
] - release: 1.0.0-rc.4 (#285) (Zachary Golba)
This release contains a fix for a number of bugs introduced in 1.0.0-rc.3
. In addition to bug fixes this release introduces a couple new features.
You can now generate utility functions via the command line!
$ lux generate util do-something
create app/utils/do-something.js
// app/utils/do-something.js
export default function doSomething() {
}
You can now generate middleware functions via the command line!
$ lux generate middleware do-something
create app/middleware/do-something.js
// app/middleware/do-something.js
export default function doSomething(/*request, response*/) {
}
Make sure the following directories exist:
app/middleware
app/utils
Also, 1.0.0-rc.3
introduced some changes to config files so make sure that the files in your config/environments
directory match the following format:
// config/environments/development.js
export default {
logging: {
level: 'DEBUG',
format: 'text',
enabled: true,
filter: {
params: []
}
}
};
// config/environments/test.js
export default {
logging: {
level: 'WARN',
format: 'text',
enabled: false,
filter: {
params: []
}
}
};
// config/environments/production.js
export default {
logging: {
level: 'INFO',
format: 'json',
enabled: true,
filter: {
params: []
}
}
};
- [
62431679b2
] - deps: update rollup to version 0.34.7 (#284) (Greenkeeper) - [
0c12e8b754
] - fix: indentation is off when using model generators (#281) (Zachary Golba) - [
4d89474fce
] - refactor: remove bluebird in favor of native apis (#279) (Zachary Golba) - [
241ae8993d
] - refactor: improve third party type declarations (#276) (Zachary Golba) - [
5de7a0d6c3
] - fix: empty n:m relationships loads every record instead of an empty array (#277) (Zachary Golba) - [
48d2fb7377
] - deps: update rollup to version 0.34.5 (#275) (Greenkeeper) - [
6ea44c3aef
] - deps: update babel-core to version 6.13.2 (#273) (Greenkeeper) - [
329309d9ec
] - fix: empty 'fields' params cause all keys of a resource to be exposed (#270) (Zachary Golba) - [
a412aa7493
] - deps: update test-app dependencies (#268) (Zachary Golba) - [
35f301c1d8
] - deps: update babel-core to version 6.13.1 (#267) (Greenkeeper) - [
d0f4f2bfd3
] - Feat: Added generator for utils (#262) (Adam Pash) - [
2ead12a73a
] - deps: update mocha to version 3.0.1 (#265) (Greenkeeper) - [
94abf145d1
] - Feat: Added generator for middleware (#261) (Adam Pash) - [
d9d008111c
] - release: 1.0.0-rc.3 (#264) (Zachary Golba)
Shout out to @adampash for fixing a bug that prevents newly created Lux apps from successfully being built! 👏
- Newly created Lux projects no longer fail to build due to invalid config files.
- [
6b598748d0
] - Fix: Quoting quotes inside config template (#260) (Adam Pash) - [
74416748e4
] - release: 1.0.0-rc.2 (#253) (Zachary Golba)
- Invalid parameters and malformed request bodies no longer fail silently.
- Controller's now accept relationships for
create
andupdate
actions.
- [
1172d562c5
] - fix: do not allow public route definitions to set private params (#252) (Zachary Golba) - [
278ab5dda3
] - fix: allow show action to be chained (#251) (Zachary Golba) - [
4777e1a22e
] - chore: update example apps (#250) (Zachary Golba) - [
5f55d63b57
] - deps: update eslint to version 3.2.2 (#248) (Greenkeeper) - [
831a61c7a1
] - deps: update rollup to version 0.34.3 (#249) (Greenkeeper) - [
e49e7df0e6
] - deps: update all dependencies (#247) (Zachary Golba) - [
f41007d873
] - deps: update eslint to version 3.2.1 (#245) (Greenkeeper) - [
62ee4be098
] - deps: update rollup-plugin-multi-entry to version 2.0.1 (#246) (Greenkeeper) - [
32aa4484d0
] - deps: update rollup to version 0.34.2 (#244) (Greenkeeper) - [
82fb3ce32e
] - deps: update mocha to version 3.0.0 (#243) (Greenkeeper) - [
e4de52d116
] - refactor: add better relationship support and refactor type systems (#229) (Zachary Golba) - [
e5e4c7afde
] - deps: update rollup-plugin-node-resolve to version 2.0.0 (#242) (Greenkeeper) - [
edefdb50be
] - deps: update rollup-plugin-node-resolve to version 1.7.3 (#241) (Greenkeeper) - [
2d35a05c43
] - deps: update ora to version 0.3.0 (#239) (Greenkeeper) - [
6787f15135
] - deps: update eslint to version 3.2.0 (#237) (Greenkeeper) - [
aab024dc10
] - deps: update flow-bin to version 0.30.0 (#238) (Greenkeeper) - [
4fcf1fcb54
] - deps: update rollup-plugin-node-resolve to version 1.7.2 (#236) (Greenkeeper) - [
dff620b617
] - deps: update eslint-plugin-flowtype to version 2.4.0 (#235) (Greenkeeper) - [
c1e1d69956
] - deps: update babel-plugin-transform-es2015-modules-commonjs to version 6.11.5 (#234) (Greenkeeper) - [
8c2494cd4b
] - deps: update babel-core to version 6.11.4 (#233) (Greenkeeper) - [
7682b8720a
] - deps: update eslint to version 3.1.1 (#231) (Greenkeeper) - [
6b62779f27
] - fix: pluralize fields resource name (#216) (Louis Person) - [
44025b35f7
] - deps: update documentation (package) to version 4.0.0-beta8 (#228) (Zachary Golba) - [
ef8a1f6e22
] - deps: update pg to version 6.0.2 in test-app (#227) (Zachary Golba) - [
4247194886
] - feat: deduce domain protocol from connection (#217) (Louis Person) - [
cb5e45d342
] - deps: update eslint to version 3.1.0 (#226) (Greenkeeper) - [
d8ef797d46
] - refactor: remove response stream in favor of res.end() (#225) (Zachary Golba) - [
a8a5406995
] - feat: improve log messages and data (#213) (Zachary Golba) - [
6cd3474a53
] - deps: update flow-bin to version 0.29.0 (#224) (Greenkeeper) - [
2960a4148a
] - deps: update source-map-support to version 0.4.2 (#220) (Greenkeeper) - [
c06a677c81
] - deps: update eslint-plugin-flowtype to version 2.3.1 (#219) (Greenkeeper) - [
e69f04f6d9
] - feat: check directory for valid directory structure (#215) (kev5873) - [
a7960f6bea
] - deps: update rollup to version 0.34.1 (#214) (Greenkeeper) - [
9c7e24a6dd
] - refactor: add flow comment to the top of decl files (#212) (Zachary Golba) - [
fc325ea65b
] - refactor: improve and simplify eslint rules (#209) (Zachary Golba) - [
a8460e5d4c
] - fix: resource IDs must be strings (#211) (Louis Person) - [
fd0a593bb1
] - deps: update rollup to version 0.34.0 (#210) (Greenkeeper) - [
4cc248bed4
] - deps: update test-app dependencies (#208) (Zachary Golba) - [
81a30f76b9
] - feat: improve proxy decl (#207) (Zachary Golba) - [
99523b7a0d
] - deps: update babel-eslint to version 6.1.2 (#206) (Greenkeeper) - [
eca77d5e9f
] - deps: update rollup to version 0.33.2 (#205) (Greenkeeper) - [
4bb1878b91
] - deps: update babel-eslint to version 6.1.1 (#204) (Greenkeeper) - [
3bb6e07431
] - fix: errors is a top level member (#203) (Louis Person) - [
370630c8d4
] - deps: update rollup to version 0.33.1 (#202) (Greenkeeper) - [
3eb6790091
] - deps: update rollup-plugin-multi-entry to version 2.0.0 🚀 (#199) (Greenkeeper) - [
dc2e232b94
] - deps: update flow-bin to version 0.28.0 🚀 (#201) (Greenkeeper) - [
000bf415a2
] - deps: update eslint to version 3.0.1 (#200) (Greenkeeper) - [
14b7bab46c
] - docs: update CHANGELOG.md to include docker images (#198) (Zachary Golba) - [
236c3961f0
] - docs: update ROADMAP.md (#197) (Zachary Golba) - [
1d3a7b29ae
] - docs: update testing section of README.md (#196) (Zachary Golba) - [
266b2120a2
] - release: 1.0.0-rc.1 (#195) (Zachary Golba)
Happy Independence Day 🇺🇸
This release brings a few bug fixes and some of the features tracked in the 1.0 milestone. Special thanks to @kev5873 for finding and fixing a bug related to generating a new project with more than one dash in the title!
🐳 We now have images on Docker Hub for seamless Lux development and deploying.
You are now able to query for a single record similar to Query#find
but with all chainable query methods rather than just WHERE 'id' = ?
.
Async/Await
const post = await Post
.first()
.where({ isPublic: true });
console.log(post);
// => Post {}
Promise
Post
.first()
.where({ isPublic: true })
.then(post => console.log(post));
// => Post {}
Models now return a Promise
when accessing a relationship. If the related record have been eager loaded with includes it will immediately resolve to the eager loaded value. Otherwise, it will load the related records from the database and resolve with the result.
Async/Await
const post = await Post.find(1);
console.log(await post.author);
// => Author {}
Promise
Post.find(1)
.then(post => post.author)
.then(author => console.log(author));
// => Author {}
- [
32c1b92d04
] - deps: update moment to version 2.14.1 (#194) (Greenkeeper) - [
e43e2e6c00
] - deps: update eslint to version 3.0.0 (#192) (Greenkeeper) - [
40863b4fbd
] - fix: display correct error messages from flow script (#191) (Zachary Golba) - [
5aeb903196
] - feat: return a promise from relationships (#190) (Zachary Golba) - [
38d7a9bcbf
] - feat: add Query#first and Query#last (#189) (Zachary Golba) - [
bceb825976
] - fix: fixes #187 issue with class name generation with multiple dashes (#188) (kev5873) - [
620ab46eae
] - chore(package): update source-map-support to version 0.4.1 (#186) (Greenkeeper) - [
22dfbaf03b
] - release: 1.0.0-rc (#185) (Zachary Golba)
🔅🎊🎈 This is the final set of functionality that will be added in 1.0! The remainder of pull requests from now until the 1.0 release will just be bug fixes or adding polish (Dockerfile, Website, Quick Start Guide, API docs, etc.). These issues can be tracked in the 1.0 milestone.
In addition to features, this release includes bug fixes and general performance improvements.
You can now debug your application rails style with a custom repl that has your application built and loaded as global variables.
To start the repl, run lux console
or lux c
in your
> User.find(1).then(user => {
console.log(`${user.name} is working as expected.`);
});
// => Promise
// 'Stephen Curry is working as expected.'
> PostsController.beforeAction
// => [[Function], [Function], [Function]]
> routes
// => Router {...routes}
Lux now intelligently observes the return value (or resolved Promise
value for async functions) of your applications middleware and controller actions to serialize and respond with the correct data and status codes. Throwing an error at any point in time will cause a 500
and will be caught and handled gracefully (stack traces included when running outside of production).
These are a few example edge cases where returning a Model or an Array of Models may not be what you want to do.
import { Controller } from 'lux-framework';
class ApplicationController extends Controller {
beforeAction = [
/**
* If any request is sent to this application with `?bad=true` the server
* will respond with 400 (Bad Request) and the latter actions will not be
* called. Otherwise, the request will be handled normally.
*/
function isGood(req) {
if (req.params.bad) {
return 400;
}
}
];
/**
* This will return 204 (No Content) and is equivalent to `return 204`.
*/
health() {
return true;
}
/**
* This will return 401 (Unauthorized) and is equivalent to `return 204`.
*/
topSecret() {
return false;
}
/**
* This will return 200 (OK) with the string 'bar'.
*/
foo() {
return 'bar';
}
/**
* This will return 200 (OK) with the following JSON.
*
* {
* "foo": "bar"
* }
*/
fooJSON() {
return {
foo: 'bar'
};
}
/**
* This will return 404 (Not Found). Returning undefined will also result in
* a 404 unless the function returning undefined is called from beforeAction.
*/
notFound() {
return null;
}
}
export default ApplicationController;
Lux now is 100% compatible with Windows!
NOTE: Travis-CI does not enable us to run our test suite on Windows. This shouldn't be an issue for development but it is highly recommend that you run Lux in a Docker container if your a deploying to Windows in production.
-
lux serve
does not start in cluster mode by default. To run your application as a cluster runlux serve -c
orlux serve --cluster
. -
Commands that require an application build (
serve
,db:*
, etc) now prefer strict mode and require you to specify--use-weak
if you do not want to run in strict mode (you should pretty much always use strict mode).
The Lux CLI in 1.0 is not backwards compatible with previous beta versions so please perform a local upgrade before upgrading Lux globally.
Route definitions now must call this.route
and this.resource
rather than having route
and resource
as arguments to the function in ./app/routes.js
. This is the initial ground work for implementing router namespaces.
// ./app/routes.js
export default function routes() {
this.resource('post');
this.resource('users');
this.route('users/login', {
action: 'login',
method: 'POST'
});
this.route('users/logout', {
action: 'logout',
method: 'DELETE'
});
}
- [
81f52fc1c8
] - feat: add luxify function for converting traditional middleware (#183) (Zachary Golba) - [
39ce152574
] - fix: index names sometimes exceed max length in generated migrations (#182) (Zachary Golba) - [
fb5a71a897
] - feat: add custom repl for debugging (#180) (Zachary Golba) - [
c2b0b30d01
] - feat: do not cluster by default use -c || --cluster (#179) (Zachary Golba) - [
785ebf1c39
] - fix: regression from #177 local lux not being used in cli (#178) (Zachary Golba) - [
67b9940e5c
] - feat: add windows support (#177) (Zachary Golba) - [
c4ab5e0b3b
] - deps: update rollup to version 0.33.0 (#176) (Greenkeeper) - [
a7e860dd97
] - deps: update rollup-plugin-babel to version 2.6.1 (#172) (Greenkeeper) - [
68e7d8fafe
] - deps: update rollup-plugin-json to version 2.0.1 (#173) (Greenkeeper) - [
7abf664c99
] - deps: update rollup-plugin-eslint to version 2.0.2 (#175) (Greenkeeper) - [
f4e17aabf9
] - deps: update rollup-plugin-node-resolve to version 1.7.1 (#174) (Greenkeeper) - [
c2a77c68d5
] - deps: update rollup to version 0.32.4 (#171) (Greenkeeper) - [
b23873109b
] - deps: update rollup-plugin-babel to version 2.6.0 (#169) (Greenkeeper) - [
7ed59ab595
] - deps: update rollup to version 0.32.2 (#168) (Greenkeeper) - [
b25237a647
] - refactor: use process.cwd() instead of process.env.PWD (#167) (Zachary Golba) - [
5bab51a38b
] - deps: update babel-eslint to version 6.1.0 (#165) (Greenkeeper) - [
53cb1e53e2
] - deps: update rollup to version 0.32.1 (#164) (Greenkeeper) - [
022b2e954c
] - deps: upgrade pg version in test-app (#166) (Zachary Golba) - [
ef3f9ce8d3
] - fix: ensure lux is not an external dependency (#163) (Zachary Golba) - [
fba8654d2e
] - deps: update test-app dependencies (#162) (Zachary Golba) - [
84160c9149
] - deps: update babel-core to version 6.10.4 (#161) (Greenkeeper) - [
7ee935afa1
] - deps: update babel-eslint to version 6.0.5 (#160) (Greenkeeper) - [
cd53552aca
] - deps: update eslint to version 2.13.1 (#159) (Greenkeeper) - [
8e6a23dad3
] - refactor: improve build process and stack traces (#158) (Zachary Golba) - [
6748638ca6
] - refactor: rename serializer methods and return objects (#155) (Zachary Golba) - [
7597031076
] - feat: ensure Application#port is a number (#156) (Zachary Golba) - [
2d83f30df6
] - deps: update rollup to version 0.32.0 (#154) (Greenkeeper) - [
64250ebe5b
] - refactor: separate responsibilities in req/res flow (#153) (Zachary Golba)
- [
30a60c10ca
] - chore: bump version to 0.0.1-beta.13 (Zachary Golba) - [
a569225072
] - feat: match ember-data jsonapi pagination implementation (#151) (Zachary Golba) - [
ea4786b791
] - deps: update mysql2 to version 1.0.0-rc.5 in test-app (#150) (Zachary Golba) - [
9b78c19540
] - style: change tabs to spaces in .eslintrc.js (#149) (Zachary Golba) - [
853d81a5d5
] - deps: update bluebird to version 3.4.1 (#147) (Greenkeeper) - [
873f92dcac
] - deps: update eslint to version 2.13.0 (#146) (Greenkeeper)
- [
723c403598
] - feat: generate basic .eslintrc.json withlux new
cmd (Zachary Golba) - [
952fa65db3
] - deps: update rollup to version 0.31.2 (#141) (Greenkeeper) - [
07bdc43db1
] - docs: update CHANGELOG.md (Zachary Golba)
This is the last big set of breaking changes before a stable 1.0.0
release
and moving forward we will strictly follow semantic versioning.
If all goes well in this release the next release will be 1.0.0-rc
and will
only contain a few more features geared towards application profiling.
- [
30f962c003
] - deps: update dependencies (Zachary Golba) - [
b6700be793
] - refactor: move query proxy to initializer function (Zachary Golba) - [
b53c58a06f
] - chore: update examples (Zachary Golba) - [
2d0f2ef941
] - feat: support n:m relationships (Zachary Golba) - [
93e3c0a14b
] - feat: add chainable query interface (Zachary Golba) - [
425b8de4cc
] - feat: use watchman for file watcher with fs.watch fallback (Zachary Golba) - [
97bed29798
] - refactor: remove all decorators from private and public APIs (Zachary Golba) - [
53e257ae66
] - refactor: use lux babel preset (Zachary Golba) - [
2512e857b2
] - refactor: use streams for Logger (Zachary Golba) - [
4341f5cebd
] - refactor: use rollup for build (Zachary Golba) - [
6bc225ac87
] - feat: add file watcher (Zachary Golba) - [
5425c512e8
] - feat: add process manager (Zachary Golba) - [
7d0463a3f0
] - feat: tree-shaking, native es6, and start of HMR work (Zachary Golba) - [
82eab320d2
] - docs: start api documentation (Zachary Golba) - [
7e4a38c781
] - deps: update eslint to version 2.12.0 (#140) (Greenkeeper) - [
6b8b29aea3
] - deps: update eslint to version 2.11.1 (#139) (Greenkeeper) - [
ef8b36cb2f
] - deps: update babel-core to version 6.9.1 (#137) (Greenkeeper) - [
c5c812dc62
] - deps: update eslint to version 2.11.0 (#135) (Greenkeeper) - [
24033dcfb3
] - chore: update eslint config (#133) (Zachary Golba) - [
ed58e7a685
] - deps: update mocha to version 2.5.3 (#132) (Greenkeeper) - [
c76c51b802
] - deps: update mocha to version 2.5.2 (#130) (Greenkeeper)
For the sake of proper namespacing, Lux no longer exports the Application
class as a default
export. To upgrade simply use a named import of
Application
within your ./app/index.js
file.
import { Application } from 'lux-framework';
class MyApp extends Application {
}
export default MyApp;
You could also use a namespaced import of Lux if you are worried about collisions.
import Lux from 'lux-framework';
class MyApp extends Lux.Application {
}
export default MyApp;
Models now support scopes and have a chainable query interface. More docs will
soon be available on this but for now it should be as simple as replacing calls
to Model.findAll
with Model.where
.
Decorators are no longer used to declare custom actions on your controller. For
an easy upgrade simply remove the @action
at the top of your custom actions.
import { Controller } from 'lux-framework';
import Post from '../models/post';
class PostsController extends Controller {
drafts() {
return Post.drafts();
}
}
export default PostsController;
Route declarations no longer support an arrow function export since arrow
functions do not have a name
property.
// ./app/routes.js
export default function routes(route, resource) {
resource('posts');
}
The db seed function no longer support an arrow function export since arrow
functions do not have a name
property.
// ./db/seed.js
export default function seed() {
resource('posts');
}
Config files found in ./config/environments
now only require a single option
log
.
// ./config/environments/development.js
export default {
log: true
};
Lux now uses a special babel preset to only transpile features that are missing from Node 6.X. That means that ~95% of ES2015 syntax is actually using a native implementation. You can expect a performance boost in this release 🐇.
{
"presets": ["lux"]
}
Update your package.json
to only include the following base packages required
for a Lux application (plus the ones you installed yourself).
{
"babel-core": "6.9.1",
"babel-preset-lux": "1.0.0",
"knex": "0.11.5",
"lux-framework": "0.0.1-beta.11",
"sqlite3": "3.1.4"
}
- [
f2b63501c9
] - chore: bump version to 0.0.1-beta.10 (Zachary Golba) - [
00a139653b
] - refactor: use webpack for build (#121) (Zachary Golba) - [
47cfa90f02
] - deps: update mocha to version 2.5.1 (#128) (Greenkeeper) - [
bbf73047eb
] - docs: remove node-orm2 references from ROADMAP.md (#126) (Zachary Golba) - [
4338d05c3b
] - docs: fix broken links in CHANGELOG.md (#125) (Zachary Golba) - [
50c18275a0
] - docs: update code sample in README.md (#124) (Zachary Golba) - [
940b53a7ed
] - chore: add CHANGELOG.md (#123) (Zachary Golba) - [
8837cb5064
] - fix: NODE_ENV is not being passed down to child processes (#122) (Zachary Golba) - [
c9f2aef952
] - feat: confirm overwriting files with lux generate cmd (#120) (Zachary Golba) - [
06dffaf0cd
] - chore: .editorconfig file (#119) (Joan Piedra) - [
a7f191003d
] - feat: improve error handling on missing controller & serializer files (#118) (Joan Piedra) - [
1dd3ab64c4
] - refactor: remove Base package (#117) (Zachary Golba) - [
0f64cc864a
] - fix: hasMany relationships are not eager loading properly (#116) (Zachary Golba) - [
11cb766267
] - fix: select statement not being optimized by fields param (#115) (Zachary Golba) - [
ad3564fc8b
] - fix: pagination links break with an empty table (#114) (Zachary Golba) - [
1b84009543
] - fix: ignore hidden and non .js files in loader (#113) (Joan Piedra) - [
6d97ca7545
] - fix: using ?include is not working with multiple resources (#112) (Zachary Golba) - [
ef8e779867
] - fix: defaultValue is not accounted for in #108 (#111) (Zachary Golba) - [
71a1be6ccc
] - fix: column data not consistent across all dbms (#108) (Zachary Golba) - [
7c897ae0f2
] - fix: multiple 'hasMany' 'type' values are incorrect in serialized data (#109) (Zachary Golba) - [
a03cde5195
] - chore: update example apps (#105) (Zachary Golba) - [
824caab17f
] - deps: update ora to version 0.2.3 (#101) (Greenkeeper)
- [
4002a5a64d
] - chore: bump version to 0.0.1-beta.9 (#97) (Zachary Golba) - [
a7e54aa4da
] - fix: middleware functions added in 'beforeAction' not executing (#95) (Zachary Golba) - [
b16557647e
] - fix: migration generator does not change - to _ (#96) (Zachary Golba) - [
81cdd2108b
] - fix: remove short -db flag from lux new cmd (#93) (Zachary Golba) - [
71f4593fbb
] - refactor: use chalk instead of colors (#92) (Zachary Golba) - [
786872becb
] - fix: config generator uses double quotes (#89) (Zachary Golba) - [
2fb314ad1b
] - deps: update bluebird to version 3.4.0 (#91) (Zachary Golba) - [
d95fb392c2
] - deps: update babel-preset-es2015 to version 6.9.0 (#90) (Zachary Golba) - [
6c7b42ddad
] - deps: update babel-runtime to version 6.9.0 (#88) (Greenkeeper) - [
095d12a100
] - deps: update babel-plugin-transform-runtime to version 6.9.0 (#87) (Greenkeeper) - [
9ef804ecd9
] - deps: update babel-core to version 6.9.0 (#86) (Greenkeeper) - [
23251651e9
] - chore: add keywords to package.json (#81) (Zachary Golba) - [
418cadb662
] - chore: add dependencies badge to README.md (#80) (Zachary Golba) - [
af3e72b73e
] - deps: Update all dependencies 🌴 (#79) (Greenkeeper) - [
2560584a4f
] - chore: update roadmap to reflect changes in #65 (#78) (Zachary Golba)
- [
6416c6c309
] - feat: implement custom orm on top of knex.js (#65) (Zachary Golba) - [
d117376a46
] - test: add sudo and correct g++ version for node 4+ in .travis.yml (#70) (Zachary Golba) - [
9a293bd117
] - feat: use js instead of json for config files (#67) (John-Henry Liberty) - [
720f0e1323
] - test: update travis to use npm link (#68) (John-Henry Liberty) - [
2fc214c045
] - feat: use local lux install if one exists (#66) (Zachary Golba)
- [
e35c430cdc
] - chore: bump version to 0.0.1-beta.7 (#64) (Zachary Golba) - [
ec0b60b191
] - fix: HEAD and OPTIONS request result in a 404 (#63) (Zachary Golba)
- [
4079b07269
] - chore: bump version to 0.0.1-beta.6 (#61) (Zachary Golba) - [
b94c526e87
] - fix: serialize hasMany relationships (#60) (Zachary Golba) - [
2f5aa41c1a
] - chore: test on node 6 (#58) (Zachary Golba) - [
e26a900e43
] - docs: add ROADMAP.md (#57) (Zachary Golba)
- [
8a21b472e0
] - chore: bump version to 0.0.1-beta.5 (#55) (Zachary Golba) - [
909e732b9a
] - chore: update dependencies (#54) (Zachary Golba) - [
47ef4b87a8
] - fix: miss-match session key/secret error (#53) (Zachary Golba) - [
e70a032c0f
] - fix: strings w/ commas interpreted as an array for POST/PATCH (#49) (Zachary Golba) - [
23da23d74d
] - docs: add npm package badge to README (#47) (Zachary Golba) - [
0788e468a6
] - test: add unit/integration tests (#39) (Zachary Golba) - [
498c951917
] - chore: add Gitter badge (#46) (The Gitter Badger)
- [
77dcdbe03b
] - chore: bump version to 0.0.1-beta.4 (#45) (Zachary Golba) - [
7c529fa235
] - fix: correct typo in README (#44) (Nic Young) - [
0880a71d89
] - fix: globally disable orm2 cache (Zachary Golba) - [
0bd7c8dfde
] - fix: make ora a runtime dependency (#40) (Zachary Golba) - [
30ca0c27d5
] - feat: add spinner for long running task (#38) (Albert Yu)
- [
03958b98d1
] - chore: bump version to 0.0.1-beta.3 (#37) (Zachary Golba) - [
10b782be1f
] - fix: logger date incorrect (#35) (kev5873) - [
e9897371be
] - chore: Link to Medium Article in Readme (#33) (Zachary Golba)
- [
c073253cd0
] - fix: listening message dispatched before workers are ready (#34) (Zachary Golba)
- [
5a734e79ce
] - fix: shebang line not finding node on linux (#32) (Zachary Golba)
- [
4a193b86d2
] - Initial Commit (Zachary Golba)