feat: support for synchronous custom step handling #2408
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.
Summary
This PR changes the way
function_executed
events handle auto acknowledgement. These changes lift the auto ack logic into a middleware that is then registered to thefunction
listener.The
function
listener exposes anautoAcknowledge
flag, when enabled (default) the auto ack middleware is added, when disabled the auto ack middleware is not added. This allows thefunction
listener to support dynamic options use cases, functions used as dynamic inputs mustcomplete
orfail
before acknowledging the request (this provides a crisp user experience).Example
Manual tests
These changes were manually tested against
Testing
npm install
&npm run build
npm install path/to/the/bolt-js/project
to install the built package in a project with a custom step like bolt-js-custom-step-template{ autoAcknowledge: false }
ack
input parameter in your handlerawait ack();
for this specfic handlerRequirements (place an
x
in each[ ]
)