Releases: hemerajs/hemera
Releases · hemerajs/hemera
[email protected]
Removed dependencies lodash, hoek and fastparellel and use built-in functions.
[email protected]
I'm really happy to announce the new Hemera 5 release!
This release is a ground-breaking refactoring of the core. The goal was to simplify but also make the lifecycle of extensions and middlwares more predictable.
In summary:
- Refactor extension lifecycle and handling
- Refactor plugin management
- Simplify payload validator and codec interface
- Brand new Documentation with https://docusaurus.io/
Breaking changes:
- Removed
Reply.end()
- Removed
hemera.root
property - Removed
Hemera.reply()
in favor ofhemera.reply.next()
to send multiple responses in a row - Removed configuration properties
crashOnFatal
,shouldCrash
. The developer is responsible to catch these errors - Removed
CodecPipeline
- Removed
encoder
,decoder
. We provide setter functions for client and server encoding - Remove support to register multiple plugins at once with
hemera.use
- Remove
plugin$
, plugins property, removehemera.setOption()
,hemera.setConfig()
methods - Remove functionality to to send a response inside
serverPreResponse
. This was confusing because the payload is already set at this point - Load plugins only on
hemera.ready()
not whenhemera.use()
is called - We break the support of simple return values in
add
ormiddlewares
without the use of callback or promises
New features:
- Implement schemaCompiler to archive better abstraction for payload validators
- Support for async schemaCompiler
- Encapsulate extensions, codec and schemaCompiler
- Provide setter functions for client and server encoding
Modified packages
hemera-joi
Remove post validation- Remove support for
hemera-nsq
andhemera-controlplane
hemera-plugin
you can skip the creation of a plugin scope withscoped:false
Bug fixes
- Fixed issue in add middleware. Passed errors didn't lead to cancellation
[email protected]
Breaking changes
- Use of callback-style with
act(...)
won't return a promise anymore ratherundefined
- Use of promise-style with
act(...)
will return to a fulfilled promise a context object with two propertiesdata
andcontext
. On a rejection, only the error is returned.data
message responsecontext
hemera instance with the right meta$, context$ and trace$ informations.
Migration Guide
Don't mix callback and promise style and work in case of promise with the result object
Before
const result = await hemera.act({
topic: "math",
cmd: "add"
}, async function (err, resp) {
// code ...
})
After with promise
const result = await hemera.act({
topic: "math",
cmd: "add"
})
// code ...
result.data
result.context
After with callback
hemera.act({
topic: "math",
cmd: "add"
}, function (err, resp) {
// code ...
})
[email protected]
- Refactor tracing
- Fixed tracing propagation
[email protected]
- Support of custom parent span via
context$
- Remove hemera version from span tags
- Use pattern as span operation name
- Add
HEMERA_OP_TYPE
,HEMERA_ACT_EXPECTEDMSG
andHEMERA_CONTEXT
tags
[email protected]
- Implement
onAdd
extensions #188 - Expose
matchedAction
which represent the matched action behind the pattern
[email protected]
- Add promise support for
close
method - Stop emitting
close
errors rather pass them via callback or promise style
[email protected]
- Upgrade to latest NATS driver
- Upgrade Pino logger
- Implement
expectedMessages$
flag #185 - Update docs
- Make request-reply
sid
inside act-context public
[email protected]
Add promise support for hemera.ready()
when no callback is passed.
[email protected]
- Upgrade nats-hemera dependencies
- Upgrade dev-dependencies from Repository