Skip to main content

Class: Client

Defined in: node_modules/@temporalio/client/lib/client.d.ts:39

High level SDK client.

Extends​

  • BaseClient

Constructors​

Constructor​

new Client(options?): Client

Defined in: node_modules/@temporalio/client/lib/client.d.ts:65

Parameters​

options?​

ClientOptions

Returns​

Client

Overrides​

BaseClient.constructor

Properties​

activity​

readonly activity: ActivityClient

Defined in: node_modules/@temporalio/client/lib/client.d.ts:48

Activity sub-client - use to start and interact with Activities and to perform asynchronous Activity completion


connection​

readonly connection: ConnectionLike

Defined in: node_modules/@temporalio/client/lib/base-client.d.ts:43

The underlying Connection | connection or NativeConnection | native connection used by this client.

Clients are cheap to create, but connections are expensive. Where it makes sense, a single connection may and should be reused by multiple Clients.

Inherited from​

BaseClient.connection


nexus​

readonly nexus: NexusClient

Defined in: node_modules/@temporalio/client/lib/client.d.ts:64

Experimental

Nexus sub-client - use to start and interact with standalone Nexus operations.

Standalone Nexus operations are a new API and susceptible to change.


options​

readonly options: LoadedClientOptions

Defined in: node_modules/@temporalio/client/lib/client.d.ts:40


schedule​

readonly schedule: ScheduleClient

Defined in: node_modules/@temporalio/client/lib/client.d.ts:52

Schedule sub-client - use to start and interact with Schedules


taskQueue​

readonly taskQueue: TaskQueueClient

Defined in: node_modules/@temporalio/client/lib/client.d.ts:58

Experimental

Task Queue sub-client - use to perform operations on Task Queues

The Worker Versioning API is still being designed. Major changes are expected.


workflow​

readonly workflow: WorkflowClient

Defined in: node_modules/@temporalio/client/lib/client.d.ts:44

Workflow sub-client - use to start and interact with Workflows

Accessors​

workflowService​

Get Signature​

get workflowService(): WorkflowService

Defined in: node_modules/@temporalio/client/lib/client.d.ts:72

Raw gRPC access to the Temporal service.

NOTE: The namespace provided in options is not automatically set on requests made via this service object.

Returns​

WorkflowService

Methods​

withAbortSignal()​

withAbortSignal<R>(abortSignal, fn): Promise<R>

Defined in: node_modules/@temporalio/client/lib/base-client.d.ts:76

Set an AbortSignal that, when aborted, cancels any ongoing service requests executed in fn's scope. This will locally result in the request call throwing a _grpc.ServiceError|ServiceError with code _grpc.status.CANCELLED|CANCELLED; see isGrpcCancelledError.

This method is only a convenience wrapper around Connection.withAbortSignal.

Type Parameters​

R​

R

Parameters​

abortSignal​

AbortSignal

fn​

() => Promise<R>

Returns​

Promise<R>

value returned from fn

See​

https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal

Inherited from​

BaseClient.withAbortSignal


withDeadline()​

withDeadline<R>(deadline, fn): Promise<R>

Defined in: node_modules/@temporalio/client/lib/base-client.d.ts:64

Set a deadline for any service requests executed in fn's scope.

The deadline is a point in time after which any pending gRPC request will be considered as failed; this will locally result in the request call throwing a _grpc.ServiceError|ServiceError with code _grpc.status.DEADLINE_EXCEEDED|DEADLINE_EXCEEDED; see isGrpcDeadlineError.

It is stronly recommended to explicitly set deadlines. If no deadline is set, then it is possible for the client to end up waiting forever for a response.

This method is only a convenience wrapper around Connection.withDeadline.

Type Parameters​

R​

R

Parameters​

deadline​

number | Date

a point in time after which the request will be considered as failed; either a Date object, or a number of milliseconds since the Unix epoch (UTC).

fn​

() => Promise<R>

Returns​

Promise<R>

the value returned from fn

See​

https://grpc.io/docs/guides/deadlines/

Inherited from​

BaseClient.withDeadline


withMetadata()​

withMetadata<R>(metadata, fn): Promise<R>

Defined in: node_modules/@temporalio/client/lib/base-client.d.ts:84

Set metadata for any service requests executed in fn's scope.

This method is only a convenience wrapper around Connection.withMetadata.

Type Parameters​

R​

R

Parameters​

metadata​

Metadata

fn​

() => Promise<R>

Returns​

Promise<R>

returned value of fn

Inherited from​

BaseClient.withMetadata