The changes in dogwater 2.0.0 focus around the ability to define and use models on a per-plugin basis. It has also been brought into the world of node.js v4+, now taking advantage of ES6 features in line with the current hapi style guide. You should also find improved docs, tests, code, and a leaner, meaner API.
Breaking Changes
Drops supports for hapi pre-v10 and node.js pre-v4. #39
server.plugins.dogwater no longer exposes collections, connections, the schema, and a teardown method. Instead just access these goodies on server.waterline. #44
Waterline is now a peer dependency, so you'll have to include it in your root project. Dogwater is compatible with Waterline v0.10.x through v0.12.x at the time of writing. #38
Waterline is initialized during server initialization (consistent with onPreStart server extension and server.dependency(deps, after) callback) rather than during plugin registration. #37
Support for fixtures has been dropped. If you'd like to continue using fixtures, work waterline-fixtures or equivalent into your server initialization cycle. #40
request.collections should be replaced with request.collections([all]). Pass all as true to obtain access to every collection registered with dogwater, or omit all to obtain access only to the collections defined within the same plugin/realm as request.route. #37
Model definitions no longer may be specified as functions in order to access the ORM. Instead use server.dogwater() with server.waterline in scope or reference the ORM within collection lifecycle callbacks and methods as this.waterline. #43
New Features
Dogwater may be registered multiple times, and should be registered in any plugin that would like to use any of its features.
server.dogwater(config) allows plugins to define adapters, connections, and their own models. See the readme for more detailed info.
server.collections([all]) provides sandboxed (or not sandboxed) access to the collections defined in the active plugin/realm.
request.collections([all]) provides sandboxed (or not sandboxed) access to the collections defined in the realm/plugin of request.route.
The teardownOnStop registration option may be used to specify whether or not Waterline connections should be torn-down when the server stops. Defaults true.
Summary
The changes in dogwater 2.0.0 focus around the ability to define and use models on a per-plugin basis. It has also been brought into the world of node.js v4+, now taking advantage of ES6 features in line with the current hapi style guide. You should also find improved docs, tests, code, and a leaner, meaner API.
Breaking Changes
server.plugins.dogwater
no longer exposes collections, connections, the schema, and a teardown method. Instead just access these goodies onserver.waterline
. #44onPreStart
server extension andserver.dependency(deps, after)
callback) rather than during plugin registration. #37request.collections
should be replaced withrequest.collections([all])
. Passall
astrue
to obtain access to every collection registered with dogwater, or omitall
to obtain access only to the collections defined within the same plugin/realm asrequest.route
. #37server.dogwater()
withserver.waterline
in scope or reference the ORM within collection lifecycle callbacks and methods asthis.waterline
. #43New Features
server.dogwater(config)
allows plugins to define adapters, connections, and their own models. See the readme for more detailed info.server.collections([all])
provides sandboxed (or not sandboxed) access to the collections defined in the active plugin/realm.request.collections([all])
provides sandboxed (or not sandboxed) access to the collections defined in the realm/plugin ofrequest.route
.teardownOnStop
registration option may be used to specify whether or not Waterline connections should be torn-down when the server stops. Defaultstrue
.