feat(orchestration): skip on permanent failure (#12027)

What:
 - Added step config `skipOnPermanentFailure`. Skip all the next steps when the current step fails. If a string is used, the workflow will resume from the given step.
 - Fix `continueOnPermanentFailure` to continue the execution of the flow when a step fails.
 
```ts
createWorkflow("some-workflow", () => {
  errorStep().config({
    skipOnPermanentFailure: true,
  })
  nextStep1() // skipped
  nextStep2() // skipped
})


createWorkflow("some-workflow", () => {
  errorStep().config({
    skipOnPermanentFailure: "resume-from-here",
  });
  nextStep1(); // skipped
  nextStep2(); // skipped
  nextStep3().config({ name: "resume-from-here" }); // executed
  nextStep4(); // executed
});
```
This commit is contained in:
Carlos R. L. Rodrigues
2025-04-17 09:49:58 -03:00
committed by GitHub
parent 1c5e82af51
commit e180253d60
7 changed files with 219 additions and 18 deletions

View File

@@ -0,0 +1,7 @@
---
"@medusajs/orchestration": patch
"@medusajs/workflows-sdk": patch
"@medusajs/types": patch
---
feat(workflows-sdk,orchestrator): step skip on permanent failure