feat(workflows-sdk): get name method (#5714)

This commit is contained in:
Carlos R. L. Rodrigues authored and GitHub committed 2023-11-24 16:39:27 +00:00
1 parent 74117ad48b
commit ffb0c7b4cd
2 files changed
+18 -9

No files matched your search

+5
View File
@@ -0,0 +1,5 @@
---
"@medusajs/workflows-sdk": patch
---
Expose getName method to the workflow
@@ -4,19 +4,19 @@ import {
WorkflowManager, WorkflowManager,
} from "@medusajs/orchestration" } from "@medusajs/orchestration"
import { LoadedModule, MedusaContainer } from "@medusajs/types" 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 { import {
CreateWorkflowComposerContext, CreateWorkflowComposerContext,
WorkflowData, WorkflowData,
WorkflowDataProperties, WorkflowDataProperties,
} from "./type" } from "./type"
import {
resolveValue,
SymbolInputReference,
SymbolMedusaWorkflowComposerContext,
SymbolWorkflowStep,
} from "./helpers"
import { proxify } from "./helpers/proxy"
global[SymbolMedusaWorkflowComposerContext] = null global[SymbolMedusaWorkflowComposerContext] = null
@@ -81,7 +81,9 @@ type ReturnWorkflow<TData, TResult, THooks extends Record<string, Function>> = {
> >
> >
} }
} & THooks } & THooks & {
getName: () => string
}
/** /**
* This function creates a workflow with the provided name and a constructor function. * 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<TData, TResult, THooks> return mainFlow as ReturnWorkflow<TData, TResult, THooks>
} }