Skip to main content

Interface: WorkflowHandleWithSignaledRunId<T>

client.WorkflowHandleWithSignaledRunId

This interface is exactly the same as WorkflowHandle except it includes the signaledRunId returned from signalWithStart.

Type parameters​

NameType
Textends Workflow = Workflow

Hierarchy​

Properties​

client​

• Readonly client: WorkflowClient

Readonly accessor to the underlying WorkflowClient

Inherited from​

WorkflowHandle.client


signaledRunId​

• Readonly signaledRunId: string

The Run Id of the bound Workflow at the time of WorkflowClient.signalWithStart.

Since signalWithStart may have signaled an existing Workflow Chain, signaledRunId might not be the firstExecutionRunId.


workflowId​

• Readonly workflowId: string

The workflowId of the current Workflow

Inherited from​

WorkflowHandle.workflowId

Methods​

cancel​

▸ cancel(): Promise<IRequestCancelWorkflowExecutionResponse>

Cancel a running Workflow.

When a Workflow is cancelled, the root scope throws CancelledFailure with message: 'Workflow canceled'. That means that all cancellable scopes will throw CancelledFailure.

Cancellation may be propagated to Activities depending on ActivityOptions#cancellationType, after which Activity calls may throw an ActivityFailure, and isCancellation(error) will be true (see isCancellation).

Cancellation may be propagated to Child Workflows depending on ChildWorkflowOptions#cancellationType, after which calls to executeChild and ChildWorkflowHandle#result will throw, and isCancellation(error) will be true (see isCancellation).

Returns​

Promise<IRequestCancelWorkflowExecutionResponse>

Inherited from​

WorkflowHandle.cancel


describe​

▸ describe(): Promise<WorkflowExecutionDescription>

Describe the current workflow execution

Returns​

Promise<WorkflowExecutionDescription>

Inherited from​

WorkflowHandle.describe


executeUpdate​

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

Start an Update and wait for the result.

Type parameters​

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

Parameters​

NameTypeDescription
defstring | UpdateDefinition<Ret, Args, Name>an Update definition as returned from defineUpdate
optionsWorkflowUpdateOptions & { args: Args }Update arguments

Returns​

Promise<Ret>

Throws

WorkflowUpdateFailedError if Update validation fails or if ApplicationFailure is thrown in the Update handler.

Throws

WorkflowUpdateRPCTimeoutOrCancelledError if this Update call timed out or was cancelled. This doesn't mean the update itself was timed out or cancelled.

Example

const updateResult = await handle.executeUpdate(incrementAndGetValueUpdate, { args: [2] });

Inherited from​

WorkflowHandle.executeUpdate

▸ executeUpdate<Ret, Args, Name>(def, options?): Promise<Ret>

Type parameters​

NameType
RetRet
Argsextends []
Nameextends string = string

Parameters​

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

Returns​

Promise<Ret>

Inherited from​

WorkflowHandle.executeUpdate


fetchHistory​

▸ fetchHistory(): Promise<IHistory>

Return a workflow execution's history

Returns​

Promise<IHistory>

Inherited from​

WorkflowHandle.fetchHistory


getUpdateHandle​

▸ getUpdateHandle<Ret>(updateId, options?): WorkflowUpdateHandle<Ret>

Get a handle to an Update of this Workflow.

Type parameters​

Name
Ret

Parameters​

NameType
updateIdstring
options?GetWorkflowUpdateHandleOptions

Returns​

WorkflowUpdateHandle<Ret>

Inherited from​

WorkflowHandle.getUpdateHandle


query​

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

Query a running or completed Workflow.

Type parameters​

NameType
RetRet
Argsextends any[] = []

Parameters​

NameTypeDescription
defstring | QueryDefinition<Ret, Args, string>a query definition as returned from defineQuery or query name (string)
...argsArgs-

Returns​

Promise<Ret>

Example

await handle.query(getValueQuery);
await handle.query<number, []>('getValue');

Inherited from​

WorkflowHandle.query


queryWithOptions​

▸ queryWithOptions<Ret, Args>(queryName, options): Promise<Ret>

Query a running or completed Workflow by Query name with additional options, including call-site TypeInfo.

Type parameters​

NameType
RetRet
Argsextends any[] = []

Parameters​

NameType
queryNamestring
optionsWorkflowQueryOptions<Args>

Returns​

Promise<Ret>

Inherited from​

WorkflowHandle.queryWithOptions


result​

▸ result(): Promise<WorkflowResultType<T>>

Promise that resolves when Workflow execution completes

Returns​

Promise<WorkflowResultType<T>>

Inherited from​

WorkflowHandle.result


signal​

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

Signal a running Workflow.

To provide call-site TypeInfo when signaling by name, use signalWithOptions.

Type parameters​

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

Parameters​

NameTypeDescription
defstring | SignalDefinition<Args, Name>a signal definition as returned from defineSignal, or a signal name
...argsArgs-

Returns​

Promise<void>

Example

await handle.signal(incrementSignal, 3);

Inherited from​

WorkflowHandle.signal


signalWithOptions​

▸ signalWithOptions<Args>(signalName, options): Promise<void>

Signal a running Workflow by Signal name with additional options, including call-site TypeInfo.

Type parameters​

NameType
Argsextends any[] = []

Parameters​

NameType
signalNamestring
optionsWorkflowSignalOptions<Args>

Returns​

Promise<void>

Inherited from​

WorkflowHandle.signalWithOptions


startUpdate​

▸ startUpdate<Ret, Args, Name>(def, options): Promise<WorkflowUpdateHandle<Ret>>

Start an Update and receive a handle to the Update. The Update validator (if present) is run before the handle is returned.

Type parameters​

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

Parameters​

NameTypeDescription
defstring | UpdateDefinition<Ret, Args, Name>an Update definition as returned from defineUpdate
optionsWorkflowUpdateOptions & { args: Args ; waitForStage: "ACCEPTED" }update arguments, and update lifecycle stage to wait for Currently, startUpdate always waits until a worker is accepting tasks for the workflow and the update is accepted or rejected, and the options object must be at least ts { waitForStage: WorkflowUpdateStage.ACCEPTED } If the update takes arguments, then the options object must additionally contain an args property with an array of argument values.

Returns​

Promise<WorkflowUpdateHandle<Ret>>

Throws

WorkflowUpdateFailedError if Update validation fails.

Throws

WorkflowUpdateRPCTimeoutOrCancelledError if this Update call timed out or was cancelled. This doesn't mean the update itself was timed out or cancelled.

Example

const updateHandle = await handle.startUpdate(incrementAndGetValueUpdate, {
args: [2],
waitForStage: 'ACCEPTED',
});
const updateResult = await updateHandle.result();

Inherited from​

WorkflowHandle.startUpdate

▸ startUpdate<Ret, Args, Name>(def, options): Promise<WorkflowUpdateHandle<Ret>>

Type parameters​

NameType
RetRet
Argsextends []
Nameextends string = string

Parameters​

NameType
defstring | UpdateDefinition<Ret, Args, Name>
optionsWorkflowUpdateOptions & { args?: Args ; waitForStage: "ACCEPTED" }

Returns​

Promise<WorkflowUpdateHandle<Ret>>

Inherited from​

WorkflowHandle.startUpdate


terminate​

▸ terminate(reason?): Promise<ITerminateWorkflowExecutionResponse>

Terminate a running Workflow

Parameters​

NameType
reason?string

Returns​

Promise<ITerminateWorkflowExecutionResponse>

Inherited from​

WorkflowHandle.terminate