feat(workflows-sdk): Allow primitive values to be passed as well as WorkflowDataProperties (#5953)

* feat(workflows-sdk): Allow primitive values to be passed as well as WorkflowDataProperties

* feat(workflows-sdk): improve playground tests

* Create nine-shrimps-reply.md
This commit is contained in:
Adrien de Peretti
2023-12-22 07:39:28 +01:00
committed by GitHub
parent bfd10dadaf
commit a0dd18c12a
3 changed files with 15 additions and 9 deletions
@@ -0,0 +1,28 @@
import { createStep, createWorkflow, StepResponse } from "./composer"
const step1 = createStep("step1", async (input: {}, context) => {
return new StepResponse({ step1: "step1" })
})
const step2 = createStep(
"step2",
async (input: { test: string; test2: 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({ test: "test", test2: step1Res.step1 })
})
workflow()
.run({})
.then((res) => {
console.log(res.result) // result: { step2: { test: "test", test2: "step1" } }
})