Skip to main content

Interface: WorkflowHandle<T>

nexus.WorkflowHandle

A handle to a running workflow that is returned by the startWorkflow helper. This handle should be returned by WorkflowRunOperationStartHandler implementations.

The type parameter T carries the workflow's result type for downstream type inference in WorkflowRunOperationHandler. It is encoded in the workflowResultType brand so that WorkflowHandle<string> and WorkflowHandle<number> are structurally distinct.

Type parameters

Name
T

Hierarchy

Properties

runId

Optional Readonly runId: string


workflowId

Readonly workflowId: string

Methods

query

query<Ret, Args>(def, ...args): Promise<Ret>

Queries the Workflow as part of this Nexus Operation.

A Query resolves immediately and writes nothing to history, so this backs a synchronous operation: there is no operation token and nothing to cancel. The link the server returns for the Workflow that processed the Query is attached to the operation's outbound links, so the caller's NexusOperation history event points back at that Workflow.

Type parameters

NameType
RetRet
Argsextends any[] = []

Parameters

NameType
defstring | QueryDefinition<Ret, Args, string>
...argsArgs

Returns

Promise<Ret>


signal

signal<Args, Name>(def, ...args): Promise<void>

Type parameters

NameType
Argsextends any[] = []
Nameextends string = string

Parameters

NameType
defstring | SignalDefinition<Args, Name>
...argsArgs

Returns

Promise<void>