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>
This commit is contained in:
co-authored by
Oli Juhl
parent
72a17d6cd7
commit
f611865553
@@ -1,12 +1,12 @@
|
||||
import { createStep, createWorkflow, StepResponse } from "./composer"
|
||||
|
||||
const step1 = createStep("step1", async (input: {}, context) => {
|
||||
return new StepResponse({ step1: "step1" })
|
||||
return new StepResponse({ step1: ["step1"] })
|
||||
})
|
||||
|
||||
const step2 = createStep(
|
||||
"step2",
|
||||
async (input: { test: string; test2: string }, context) => {
|
||||
async (input: { filters: { id: string[] } }, context) => {
|
||||
return new StepResponse({ step2: input })
|
||||
}
|
||||
)
|
||||
@@ -18,24 +18,35 @@ const step3 = createStep("step3", async () => {
|
||||
const workflow = createWorkflow("workflow", function () {
|
||||
const step1Res = step1()
|
||||
step3()
|
||||
return step2({ test: "test", test2: step1Res.step1 })
|
||||
return step2({ filters: { id: step1Res.step1 } })
|
||||
})
|
||||
|
||||
workflow()
|
||||
.run({})
|
||||
.then((res) => {
|
||||
console.log(res.result) // result: { step2: { test: "test", test2: "step1" } }
|
||||
console.log(res.result)
|
||||
})
|
||||
|
||||
/*type type0 = typeof workflow extends ReturnWorkflow<infer T, infer R, infer X>
|
||||
? T
|
||||
: never
|
||||
/*const step1 = createStep("step1", async (input: {}, context) => {
|
||||
return new StepResponse({ step1: ["step1"] })
|
||||
})
|
||||
|
||||
function run<
|
||||
TWorkflow extends ReturnWorkflow<any, any, any>,
|
||||
TData = TWorkflow extends ReturnWorkflow<infer T, infer R, infer X>
|
||||
? T
|
||||
: never
|
||||
>(name: string, options: FlowRunOptions<TData>) {}
|
||||
const step2 = createStep("step2", async (input: string[], context) => {
|
||||
return new StepResponse({ step2: input })
|
||||
})
|
||||
|
||||
const test = run<typeof workflow>("workflow", { input: "string" })*/
|
||||
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)
|
||||
})*/
|
||||
|
||||
Reference in New Issue
Block a user