refactor(query): middleware naming and supervisor work #25
+708
−473
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR cleans up some of the middleware naming and wrapping them all inside a named export
mdw
. This should make the officially supported middleware a little more discoverable while also simplifying the naming conventions for them.None of the previous names have been removed, merely deprecated, with plans to remove entirely in a later version.
Similarly, we have refactored the
ctx.json
Result
type to better matcheffection
'sResult
type. Instead ofctx.json.data
we havectx.json.value
andctx.json.error
respectively.ctx.json.data
has not been removed, but has been marked as deprecated.Hopefully this transition for users is smooth.
Further, I spent some time improving our generic
supervise()
function which will try to always keep anOperation
alive. This is in an effort to create fault tolerant structured concurrency.I also implemented
LogContext
which is a channel for us to send log events to in the case where it is impossible to return aResult
-- like with supervisors. This allows end-users to not only send events through the logger, but also to listen to those events and do something with them (like send to log drains).