feat(orchestration, workflows-sdk): Add events management and implementation to manage async workflows (#5951)
* 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>
This commit is contained in:
co-authored by
Carlos R. L. Rodrigues
Carlos R. L. Rodrigues
parent
99a4f94db5
commit
bf63c4e6a3
@@ -0,0 +1,27 @@
|
||||
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
|
||||
Reference in New Issue
Block a user