Skip to content

Commit 50f61af

Browse files
authored
rename child workflow function (#644)
Signed-off-by: Fabian Martinez <[email protected]>
1 parent 76866c8 commit 50f61af

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

src/workflow/runtime/WorkflowContext.ts

+21
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ export default class WorkflowContext {
9696
}
9797

9898
/**
99+
* Deprecated, use callChildWorkflow
99100
* Schedule sub-orchestrator function for execution.
100101
*
101102
* @param orchestrator A reference to the orchestrator function call
@@ -115,6 +116,26 @@ export default class WorkflowContext {
115116
return this._innerContext.callSubOrchestrator(getFunctionName(orchestrator), input, instanceId);
116117
}
117118

119+
/**
120+
* Schedule child workflow for execution.
121+
*
122+
* @param orchestrator A reference to the orchestrator function call
123+
* @param input The JSON-serializable input value for the orchestrator function.
124+
* @param instanceId A unique ID to use for the sub-orchestration instance. If not provided, a new GUID will be used.
125+
*
126+
* @returns {Task<TOutput>} A Durable Task that completes when the sub-orchestrator function completes.
127+
*/
128+
public callChildWorkflow<TInput, TOutput>(
129+
orchestrator: TWorkflow | string,
130+
input?: TInput,
131+
instanceId?: string,
132+
): Task<TOutput> {
133+
if (typeof orchestrator === "string") {
134+
return this._innerContext.callSubOrchestrator(orchestrator, input, instanceId);
135+
}
136+
return this._innerContext.callSubOrchestrator(getFunctionName(orchestrator), input, instanceId);
137+
}
138+
118139
/**
119140
* Wait for an event to be raised with the name "name"
120141
*

test/e2e/workflow/workflow.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ describe("Workflow", () => {
139139

140140
const parentWorkflow: TWorkflow = async function* (ctx: WorkflowContext): any {
141141
// Call sub-orchestration
142-
yield ctx.callSubWorkflow(childWorkflow);
142+
yield ctx.callChildWorkflow(childWorkflow);
143143
};
144144

145145
workflowRuntime

0 commit comments

Comments
 (0)