Feathers spring 2019 news and v4 beta test
A lot has been happening under the hood the past few months š and Iām happy to share the pre-release of Feathers v4 (Crow) and some great articles, modules and videos š¦
v4 beta test
The core modules for Feathers v4 (Crow) are code complete, published as pre
releases and ready to be tested. Any feedback, questions and issue reports are greatly appreciated (many thanks to anybody who already has š). The work-in progress documentation can be found at crow.docs.feathersjs.com.
feathers upgrade
Just like in the previous version, the @feathersjs/cli
comes with an upgrade command that applies most of the changes necessary to upgrade from a v3 application generated with the @feathersjs/cli
to v4 (some manual steps might be necessary and are documented in the migration guide).
To test the pre-release you can run the following upgrade command š
npm i @feathersjs/cli@pre -g
cd myapp
feathers upgrade
More details on what this will do and the potential manual steps are outlined in the v4 (Crow) migration guide. Below is a brief summary of the new features and changes in v4.
Common versioning
All modules in the @feathersjs
namespace now have the same version number. So any @feathersjs/
dependency for this upcoming version will be v4 (4.0.0-pre.x
for the prerelease), the next one v5 (Dove) etc. This is the same versioning that projects like Babel and React already use for all their submodules and will hopefully make it more clear what version is currently being used.
The database adapters will continue to be versioned independently since they can usually be used with any Feathers version.
Authentication
The @feathersjs/authentication-*
modules have been completely rewritten to include more secure defaults, be easier to customize, framework independent and no longer rely on PassportJS. It comes with:
- An extensible authentication service that can register strategies and create authentication tokens (JWT by default but pluggable for anything else)
- Protocol independent, fully customizable authentication strategies with local, JWT and oAuth authentication built-in
- Better oAuth authentication that supports 180+ providers out of the box without any additional setup (just add the provider key and secret in the configuration)
- Built-in oAuth account linking and cross-domain oAuth redirects
- A more usable authentication client that automatically includes the information you usually want (like the current user) and reliably handles re-authenticating real-time connections.
Feathers core
In addition to the authentication system updates, Feathers v4 core modules include the following features and changes:
- Always up-to-date TypeScript definitions in each core repository that no longer have to be installed separately
- Services can be registered at the root level, e.g.
app.use('/', myService)
- Event emitting can be turned off in hooks by setting
context.event = null
- A global
disconnect
event that notifies about any real-time client disconnection - Returning
feathers.SKIP
in a hook has been removed since it made hook flows hard to debug and allowed to circumvent important Feathers internals. The common use cases forfeathers.SKIP
can now be handled with features like the hook-less service methods.
Database adapters
The latest versions of the Feathers database adapters include some important security and usability updates by requiring to explicitly enable certain functionality that was previously available by default. They can be used with v3 and v4 of Feathers core.
get
,remove
,update
andpatch
now always include thequery
. If the record does not match that query, even if theid
is valid, aNotFound
error will be thrown.- The database adapters now support calling their service methods without any hooks by adding a
_
in front of the method name as_find
,_get
,_create
,_patch
,_update
and_remove
. - Creating, updating or removing multiple records at once needs to be enabled and secured explicitly.
- Non-standard query parameters have to be explicitly whitelisted.