Files
medusa-store/packages/workflows-sdk/src/utils/_playground.ts
Adrien de Peretti f611865553 fix(workflows-sdk): Fix StepFunction typings and custom step name (#6468)
* fix(workflows=sdk): Fix StepFunction typings and custom step name

* Create smart-nails-switch.md

* fixes

* fixes

* fixes

---------

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
2024-02-22 11:59:53 +01:00

53 lines
1.2 KiB
TypeScript

import { createStep, createWorkflow, StepResponse } from "./composer"
const step1 = createStep("step1", async (input: {}, context) => {
return new StepResponse({ step1: ["step1"] })
})
const step2 = createStep(
"step2",
async (input: { filters: { id: string[] } }, context) => {
return new StepResponse({ step2: input })
}
)
const step3 = createStep("step3", async () => {
return new StepResponse({ step3: "step3" })
})
const workflow = createWorkflow("workflow", function () {
const step1Res = step1()
step3()
return step2({ filters: { id: step1Res.step1 } })
})
workflow()
.run({})
.then((res) => {
console.log(res.result)
})
/*const step1 = createStep("step1", async (input: {}, context) => {
return new StepResponse({ step1: ["step1"] })
})
const step2 = createStep("step2", async (input: string[], context) => {
return new StepResponse({ step2: input })
})
const step3 = createStep("step3", async () => {
return new StepResponse({ step3: "step3" })
})
const workflow = createWorkflow("workflow", function () {
const step1Res = step1()
step3()
return step2(step1Res.step1)
})
workflow()
.run({})
.then((res) => {
console.log(res.result)
})*/