Skip to main content

Class: WorkflowClient

client.WorkflowClient

Client for starting Workflow executions and creating Workflow handles

Constructors#

constructor#

new WorkflowClient(service?, options?)

Parameters#

NameType
service?WorkflowService
options?WorkflowClientOptions

Properties#

options#

Readonly options: Required<WorkflowClientOptions>


service#

Readonly service: WorkflowService

Methods#

createWorkflowHandle#

createWorkflowHandle<T>(name, options?): WorkflowHandle<T>

Create a WorkflowHandle for starting a new Workflow execution

Type parameters#

NameType
Textends Workflow

Parameters#

NameTypeDescription
namestringworkflow type name (the exported function name in the Node.js SDK)
options?Partial<WorkflowOptions>used to start the Workflow

Returns#

WorkflowHandle<T>

createWorkflowHandle<T>(func, options?): WorkflowHandle<T>

Create a WorkflowHandle for starting a new Workflow execution

Type parameters#

NameType
Textends Workflow

Parameters#

NameTypeDescription
funcTan exported function
options?Partial<WorkflowOptions>used to start the Workflow

Returns#

WorkflowHandle<T>

createWorkflowHandle<T>(execution): WorkflowHandle<T>

Create a WorkflowHandle for an existing Workflow execution

Type parameters#

NameType
Textends Workflow

Parameters#

NameType
executionValidWorkflowExecution

Returns#

WorkflowHandle<T>


execute#

execute<T>(workflowTypeOrFunc, opts, ...args): Promise<WorkflowResultType<T>>

Starts a new Workflow execution and awaits its completion

Type parameters#

NameType
Textends Workflow

Parameters#

NameType
workflowTypeOrFuncstring | T
optsPartial<WorkflowOptions>
...argsParameters<T>

Returns#

Promise<WorkflowResultType<T>>


result#

result<T>(__namedParameters, opts?): Promise<WorkflowResultType<T>>

Gets the result of a Workflow execution.

Follows the chain of execution in case Workflow continues as new, or has a cron schedule or retry policy.

Type parameters#

NameType
Textends Workflow

Parameters#

NameType
__namedParametersValidWorkflowExecution
opts?WorkflowResultOptions

Returns#

Promise<WorkflowResultType<T>>


start#

start<T>(workflowTypeOrFunc, opts, ...args): Promise<string>

Start a new Workflow execution. Resolves with the execution runId.

Type parameters#

NameType
Textends Workflow

Parameters#

NameType
workflowTypeOrFuncstring | T
optsPartial<WorkflowOptions>
...argsParameters<T>

Returns#

Promise<string>