diff --git a/.changeset/real-ears-eat.md b/.changeset/real-ears-eat.md new file mode 100644 index 0000000000..cb640f7182 --- /dev/null +++ b/.changeset/real-ears-eat.md @@ -0,0 +1,5 @@ +--- +"@medusajs/workflows-sdk": patch +--- + +Expose getName method to the workflow diff --git a/packages/workflows-sdk/src/utils/composer/create-workflow.ts b/packages/workflows-sdk/src/utils/composer/create-workflow.ts index 199d7ff183..d44a47f629 100644 --- a/packages/workflows-sdk/src/utils/composer/create-workflow.ts +++ b/packages/workflows-sdk/src/utils/composer/create-workflow.ts @@ -4,19 +4,19 @@ import { WorkflowManager, } from "@medusajs/orchestration" import { LoadedModule, MedusaContainer } from "@medusajs/types" -import { exportWorkflow, FlowRunOptions, WorkflowResult } from "../../helper" +import { FlowRunOptions, WorkflowResult, exportWorkflow } from "../../helper" +import { + SymbolInputReference, + SymbolMedusaWorkflowComposerContext, + SymbolWorkflowStep, + resolveValue, +} from "./helpers" +import { proxify } from "./helpers/proxy" import { CreateWorkflowComposerContext, WorkflowData, WorkflowDataProperties, } from "./type" -import { - resolveValue, - SymbolInputReference, - SymbolMedusaWorkflowComposerContext, - SymbolWorkflowStep, -} from "./helpers" -import { proxify } from "./helpers/proxy" global[SymbolMedusaWorkflowComposerContext] = null @@ -81,7 +81,9 @@ type ReturnWorkflow> = { > > } -} & THooks +} & THooks & { + getName: () => string + } /** * This function creates a workflow with the provided name and a constructor function. @@ -259,5 +261,7 @@ export function createWorkflow< } } + mainFlow.getName = () => name + return mainFlow as ReturnWorkflow }