Skip to content

Commit

Permalink
rename child workflow function (#644)
Browse files Browse the repository at this point in the history
Signed-off-by: Fabian Martinez <[email protected]>
  • Loading branch information
famarting authored Nov 20, 2024
1 parent 76866c8 commit 50f61af
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
21 changes: 21 additions & 0 deletions src/workflow/runtime/WorkflowContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ export default class WorkflowContext {
}

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

/**
* Schedule child workflow for execution.
*
* @param orchestrator A reference to the orchestrator function call
* @param input The JSON-serializable input value for the orchestrator function.
* @param instanceId A unique ID to use for the sub-orchestration instance. If not provided, a new GUID will be used.
*
* @returns {Task<TOutput>} A Durable Task that completes when the sub-orchestrator function completes.
*/
public callChildWorkflow<TInput, TOutput>(
orchestrator: TWorkflow | string,
input?: TInput,
instanceId?: string,
): Task<TOutput> {
if (typeof orchestrator === "string") {
return this._innerContext.callSubOrchestrator(orchestrator, input, instanceId);
}
return this._innerContext.callSubOrchestrator(getFunctionName(orchestrator), input, instanceId);
}

/**
* Wait for an event to be raised with the name "name"
*
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/workflow/workflow.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ describe("Workflow", () => {

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

workflowRuntime
Expand Down

0 comments on commit 50f61af

Please sign in to comment.