Skip to main content

Interface: UpdatableWorkflowHandle<T>

nexus.UpdatableWorkflowHandle

A WorkflowHandle that can additionally back the current Nexus Operation with a Workflow Update. Returned by TemporalNexusClient.getWorkflowHandle.

update lives on this interface rather than on WorkflowHandle so that the handles returned by startWorkflow and signalWithStartWorkflow do not advertise it: the Workflow run they refer to already backs the operation, and a Nexus Operation handler invocation may only start one async backing operation.

Workflow Updates as Nexus Operations are experimental.

Type parameters​

Name
T

Hierarchy​

Properties​

runId​

• Optional Readonly runId: string

Inherited from​

WorkflowHandle.runId


workflowId​

• Readonly workflowId: string

Inherited from​

WorkflowHandle.workflowId

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>

Inherited from​

WorkflowHandle.query


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>

Inherited from​

WorkflowHandle.signal


update​

▸ update<Ret, Args, Name>(def, options): Promise<TemporalOperationResult<Ret>>

Sends an Update to this Workflow as the backing operation for the current Nexus Operation.

The Update request is augmented with the Nexus Operation's request ID (for deduplication), its request links, and a completion callback carrying the operation token, so the Update's completion is delivered back to the Nexus caller.

Only asynchronous, ACCEPTED-stage Updates are supported: this method returns once the Update is accepted, yielding an asynchronous TemporalOperationResult whose completion is delivered via the callback. If the Update has already completed by the time it is accepted (for example a retried request with the same Update ID, or an Update that completes immediately), a synchronous result is returned instead; if that completed Update failed (e.g. validation rejection, which is non-retryable), it surfaces as a failed Nexus Operation.

options.waitForStage is required and must be ACCEPTED, so options are always passed, even for an Update that takes no arguments. If the Update takes arguments, options.args is also required; an Update that takes no arguments accepts no args.

Workflow Updates as Nexus Operations are experimental.

Type parameters​

NameType
RetRet
Argsextends [any, ...any[]]
Nameextends string = string

Parameters​

NameType
defstring | UpdateDefinition<Ret, Args, Name>
optionsNexusUpdateWorkflowOptions & { args: Args }

Returns​

Promise<TemporalOperationResult<Ret>>

▸ update<Ret, Args, Name>(def, options): Promise<TemporalOperationResult<Ret>>

Type parameters​

NameType
RetRet
Argsextends [] = []
Nameextends string = string

Parameters​

NameType
defstring | UpdateDefinition<Ret, Args, Name>
optionsNexusUpdateWorkflowOptions & { args?: Args }

Returns​

Promise<TemporalOperationResult<Ret>>