File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff 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 *
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments