-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(workflows-sdk): run, registerStepSuccess and registerStepFailure shortcut #6164
Conversation
🦋 Changeset detectedLatest commit: 8ab1a56 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
2 Ignored Deployments
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…usa into feat/workflows-sdk-shortcut
@carlos-r-l-rodrigues do you think I should merge so that I can include it in our pr? |
I would love to give it a spin 👍 |
@olivermrbl sure, you can look at the tests to see the usage. But at somepoint everything will go through the engine, so it will always go through the enigine run method which among other things accept the container as part of the options 👍 |
This is great! And if there's no container, it will try to use the loaded modules under the hood right? So for example: const createSomething = createSomethingWorkflow()
const { result, errors } = await createSomething.run({
input: { ... }
}) |
yes, or you can do // Here it will use the loaded modules
const { result, errors } = await createSomethingWorkflow.run({
input: { ... }
}) no need for the first step |
Love it 😍 |
We have to support both ways: const wf = myWorkflow();
wf.run({}) and myWorkflow.run({}) The first one is an instance of LocalWorkflows that is the only way you can extend it. const wf = myWorkflow();
wf.addStep(...)
wf.run({}) |
@carlos-r-l-rodrigues, makes sense! |
What
Currently, when exporting a workflow using the workflowExport util, it is mandatory to first call the resulted function passing the container before being able to call run, registerStepSuccess or failure on it. Now, it is possible to either continue that way, or to directly call the run, registerStepSuccess or failure on the exported workflow and at that moment it is possible to pass a container if needed
e.g
or