feat(workflows-sdk): run, registerStepSuccess and registerStepFailure shortcut (#6164)

**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
```ts
const workflow = exportWorkflow("id" as any, "result_step", prepare)
const wfRunner = workflow(container)
wfRunner.run(...) // Here the container is not expected
```
or
```ts
const workflow = exportWorkflow("id" as any, "result_step", prepare)
workflow.run(...) // Here we can now pass an optional container 
```
This commit is contained in:
Adrien de Peretti
2024-01-22 20:14:18 +01:00
committed by GitHub
parent 4792c55226
commit 738e9115ec
3 changed files with 375 additions and 131 deletions
+5
View File
@@ -0,0 +1,5 @@
---
"@medusajs/workflows-sdk": patch
---
feat(workflows-sdk): run, registerStepSuccess and registerStepFailure shortcut