//native
import * as wmill from "windmill-client"
// windmill-client errors only carry the status text: throw the response body, which says why
wmill.OpenAPI.interceptors.response.use(async (response) => {
if (!response.ok) {
throw new Error(`${response.status} ${await response.text()}`)
}
return response
})
export type DynSelect_path = string
export async function path() {
const paths = await wmill.FlowService.listFlowPaths({
workspace: wmill.getWorkspace(),
})
return paths.map((p) => ({ value: p, label: p }))
}
/**
* Run Flow by Path and Wait for Result
* Run a flow and return its result. Holds one HTTP request open, so for runs longer than the instance's request timeout use Run Flow by Path followed by Wait for Job.
*/
export async function main(
path: DynSelect_path,
args: { [key: string]: any } | undefined
) {
return await wmill.JobService.runWaitResultFlowByPath({
workspace: wmill.getWorkspace(),
path,
requestBody: args ?? {},
})
}
Submitted by hugo989 5 hours ago