* feat(orchestration, workflows-sdk): Add events management and implementation to manage async workflows * Create fresh-boxes-scream.md * cleanup * fix: resolveValue input ref * resolve value recursive * chore: resolve result value only for new api * chore: save checkpoint before scheduling * features * fix: beginTransaction checking existing transaction --------- Co-authored-by: Carlos R. L. Rodrigues <rodrigolr@gmail.com> Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>
28 lines
730 B
TypeScript
28 lines
730 B
TypeScript
import { LocalWorkflow } from "@medusajs/orchestration"
|
|
import { LoadedModule, MedusaContainer } from "@medusajs/types"
|
|
import { ExportedWorkflow } from "./helper"
|
|
|
|
export class MedusaWorkflow {
|
|
static workflows: Record<
|
|
string,
|
|
(
|
|
container?: LoadedModule[] | MedusaContainer
|
|
) => Omit<
|
|
LocalWorkflow,
|
|
"run" | "registerStepSuccess" | "registerStepFailure"
|
|
> &
|
|
ExportedWorkflow
|
|
> = {}
|
|
|
|
static registerWorkflow(workflowId, exportedWorkflow) {
|
|
MedusaWorkflow.workflows[workflowId] = exportedWorkflow
|
|
}
|
|
|
|
static getWorkflow(workflowId) {
|
|
return MedusaWorkflow.workflows[workflowId]
|
|
}
|
|
}
|
|
|
|
global.MedusaWorkflow ??= MedusaWorkflow
|
|
exports.MedusaWorkflow = global.MedusaWorkflow
|