feat: Add support for scheduled workflows (#7651)
We still need to: But wanted to open the PR for early feedback on the approach
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import { SchedulerOptions } from "@medusajs/orchestration"
|
||||
import {
|
||||
createStep,
|
||||
createWorkflow,
|
||||
StepResponse,
|
||||
} from "@medusajs/workflows-sdk"
|
||||
|
||||
export const createScheduled = (name: string, schedule?: SchedulerOptions) => {
|
||||
const workflowScheduledStepInvoke = jest.fn((input, context) => {
|
||||
return new StepResponse({})
|
||||
})
|
||||
|
||||
const step = createStep("step_1", workflowScheduledStepInvoke)
|
||||
|
||||
createWorkflow(
|
||||
{ name, schedule: schedule ?? "* * * * * *" },
|
||||
function (input) {
|
||||
return step(input)
|
||||
}
|
||||
)
|
||||
|
||||
return workflowScheduledStepInvoke
|
||||
}
|
||||
Reference in New Issue
Block a user