Skip to content

@temporal-contract/client


@temporal-contract/client

Classes

QueryValidationError

Defined in: packages/client/src/errors.ts:64

Thrown when query input or output validation fails

Extends

  • TypedClientError

Constructors

Constructor
ts
new QueryValidationError(
   queryName, 
   direction, 
   issues): QueryValidationError;

Defined in: packages/client/src/errors.ts:65

Parameters
ParameterType
queryNamestring
direction"output" | "input"
issuesreadonly Issue[]
Returns

QueryValidationError

Overrides
ts
TypedClientError.constructor

Properties

PropertyModifierTypeDescriptionInherited fromDefined in
cause?publicunknown-TypedClientError.causenode_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.error.d.ts:26
directionreadonly"output" | "input"--packages/client/src/errors.ts:67
issuesreadonlyreadonly Issue[]--packages/client/src/errors.ts:68
messagepublicstring-TypedClientError.messagenode_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1077
namepublicstring-TypedClientError.namenode_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1076
queryNamereadonlystring--packages/client/src/errors.ts:66
stack?publicstring-TypedClientError.stacknode_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1078
stackTraceLimitstaticnumberThe Error.stackTraceLimit property specifies the number of stack frames collected by a stack trace (whether generated by new Error().stack or Error.captureStackTrace(obj)). The default value is 10 but may be set to any valid JavaScript number. Changes will affect any stack trace captured after the value has been changed. If set to a non-number value, or set to a negative number, stack traces will not capture any frames.TypedClientError.stackTraceLimitnode_modules/.pnpm/@types+node@25.3.2/node_modules/@types/node/globals.d.ts:67

Methods

captureStackTrace()
ts
static captureStackTrace(targetObject, constructorOpt?): void;

Defined in: node_modules/.pnpm/@types+node@25.3.2/node_modules/@types/node/globals.d.ts:51

Creates a .stack property on targetObject, which when accessed returns a string representing the location in the code at which Error.captureStackTrace() was called.

js
const myObject = {};
Error.captureStackTrace(myObject);
myObject.stack;  // Similar to `new Error().stack`

The first line of the trace will be prefixed with ${myObject.name}: ${myObject.message}.

The optional constructorOpt argument accepts a function. If given, all frames above constructorOpt, including constructorOpt, will be omitted from the generated stack trace.

The constructorOpt argument is useful for hiding implementation details of error generation from the user. For instance:

js
function a() {
  b();
}

function b() {
  c();
}

function c() {
  // Create an error without stack trace to avoid calculating the stack trace twice.
  const { stackTraceLimit } = Error;
  Error.stackTraceLimit = 0;
  const error = new Error();
  Error.stackTraceLimit = stackTraceLimit;

  // Capture the stack trace above function b
  Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
  throw error;
}

a();
Parameters
ParameterType
targetObjectobject
constructorOpt?Function
Returns

void

Inherited from
ts
TypedClientError.captureStackTrace
prepareStackTrace()
ts
static prepareStackTrace(err, stackTraces): any;

Defined in: node_modules/.pnpm/@types+node@25.3.2/node_modules/@types/node/globals.d.ts:55

Parameters
ParameterType
errError
stackTracesCallSite[]
Returns

any

See

https://v8.dev/docs/stack-trace-api#customizing-stack-traces

Inherited from
ts
TypedClientError.prepareStackTrace

SignalValidationError

Defined in: packages/client/src/errors.ts:77

Thrown when signal input validation fails

Extends

  • TypedClientError

Constructors

Constructor
ts
new SignalValidationError(signalName, issues): SignalValidationError;

Defined in: packages/client/src/errors.ts:78

Parameters
ParameterType
signalNamestring
issuesreadonly Issue[]
Returns

SignalValidationError

Overrides
ts
TypedClientError.constructor

Properties

PropertyModifierTypeDescriptionInherited fromDefined in
cause?publicunknown-TypedClientError.causenode_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.error.d.ts:26
issuesreadonlyreadonly Issue[]--packages/client/src/errors.ts:80
messagepublicstring-TypedClientError.messagenode_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1077
namepublicstring-TypedClientError.namenode_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1076
signalNamereadonlystring--packages/client/src/errors.ts:79
stack?publicstring-TypedClientError.stacknode_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1078
stackTraceLimitstaticnumberThe Error.stackTraceLimit property specifies the number of stack frames collected by a stack trace (whether generated by new Error().stack or Error.captureStackTrace(obj)). The default value is 10 but may be set to any valid JavaScript number. Changes will affect any stack trace captured after the value has been changed. If set to a non-number value, or set to a negative number, stack traces will not capture any frames.TypedClientError.stackTraceLimitnode_modules/.pnpm/@types+node@25.3.2/node_modules/@types/node/globals.d.ts:67

Methods

captureStackTrace()
ts
static captureStackTrace(targetObject, constructorOpt?): void;

Defined in: node_modules/.pnpm/@types+node@25.3.2/node_modules/@types/node/globals.d.ts:51

Creates a .stack property on targetObject, which when accessed returns a string representing the location in the code at which Error.captureStackTrace() was called.

js
const myObject = {};
Error.captureStackTrace(myObject);
myObject.stack;  // Similar to `new Error().stack`

The first line of the trace will be prefixed with ${myObject.name}: ${myObject.message}.

The optional constructorOpt argument accepts a function. If given, all frames above constructorOpt, including constructorOpt, will be omitted from the generated stack trace.

The constructorOpt argument is useful for hiding implementation details of error generation from the user. For instance:

js
function a() {
  b();
}

function b() {
  c();
}

function c() {
  // Create an error without stack trace to avoid calculating the stack trace twice.
  const { stackTraceLimit } = Error;
  Error.stackTraceLimit = 0;
  const error = new Error();
  Error.stackTraceLimit = stackTraceLimit;

  // Capture the stack trace above function b
  Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
  throw error;
}

a();
Parameters
ParameterType
targetObjectobject
constructorOpt?Function
Returns

void

Inherited from
ts
TypedClientError.captureStackTrace
prepareStackTrace()
ts
static prepareStackTrace(err, stackTraces): any;

Defined in: node_modules/.pnpm/@types+node@25.3.2/node_modules/@types/node/globals.d.ts:55

Parameters
ParameterType
errError
stackTracesCallSite[]
Returns

any

See

https://v8.dev/docs/stack-trace-api#customizing-stack-traces

Inherited from
ts
TypedClientError.prepareStackTrace

TypedClient

Defined in: packages/client/src/client.ts:115

Typed Temporal client with Result/Future pattern based on a contract

Provides type-safe methods to start and execute workflows defined in the contract, with explicit error handling using Result pattern.

Type Parameters

Type Parameter
TContract extends ContractDefinition

Methods

executeWorkflow()
ts
executeWorkflow<TWorkflowName>(workflowName, __namedParameters): Future<Result<ClientInferOutput<TContract["workflows"][TWorkflowName]>, 
  | WorkflowNotFoundError
  | WorkflowValidationError
  | RuntimeClientError>>;

Defined in: packages/client/src/client.ts:235

Execute a workflow (start and wait for result) with Future/Result pattern

Type Parameters
Type Parameter
TWorkflowName extends string | number | symbol
Parameters
ParameterType
workflowNameTWorkflowName
__namedParametersTypedWorkflowStartOptions<TContract, TWorkflowName>
Returns

Future<Result<ClientInferOutput<TContract["workflows"][TWorkflowName]>, | WorkflowNotFoundError | WorkflowValidationError | RuntimeClientError>>

Example
ts
const result = await client.executeWorkflow('processOrder', {
  workflowId: 'order-123',
  args: { orderId: 'ORD-123' },
  workflowExecutionTimeout: '1 day',
  retry: { maximumAttempts: 3 },
});

result.match({
  Ok: (output) => console.log('Order processed:', output.status),
  Error: (error) => console.error('Processing failed:', error),
});
getHandle()
ts
getHandle<TWorkflowName>(workflowName, workflowId): Future<Result<TypedWorkflowHandle<TContract["workflows"][TWorkflowName]>, WorkflowNotFoundError | RuntimeClientError>>;

Defined in: packages/client/src/client.ts:306

Get a handle to an existing workflow with Future/Result pattern

Type Parameters
Type Parameter
TWorkflowName extends string | number | symbol
Parameters
ParameterType
workflowNameTWorkflowName
workflowIdstring
Returns

Future<Result<TypedWorkflowHandle<TContract["workflows"][TWorkflowName]>, WorkflowNotFoundError | RuntimeClientError>>

Example
ts
const handleResult = await client.getHandle('processOrder', 'order-123');
handleResult.match({
  Ok: async (handle) => {
    const result = await handle.result();
    // ... handle result
  },
  Error: (error) => console.error('Failed to get handle:', error),
});
startWorkflow()
ts
startWorkflow<TWorkflowName>(workflowName, __namedParameters): Future<Result<TypedWorkflowHandle<TContract["workflows"][TWorkflowName]>, 
  | WorkflowNotFoundError
  | WorkflowValidationError
  | RuntimeClientError>>;

Defined in: packages/client/src/client.ts:169

Start a workflow and return a typed handle with Future pattern

Type Parameters
Type Parameter
TWorkflowName extends string | number | symbol
Parameters
ParameterType
workflowNameTWorkflowName
__namedParametersTypedWorkflowStartOptions<TContract, TWorkflowName>
Returns

Future<Result<TypedWorkflowHandle<TContract["workflows"][TWorkflowName]>, | WorkflowNotFoundError | WorkflowValidationError | RuntimeClientError>>

Example
ts
const handleResult = await client.startWorkflow('processOrder', {
  workflowId: 'order-123',
  args: { orderId: 'ORD-123' },
  workflowExecutionTimeout: '1 day',
  retry: { maximumAttempts: 3 },
});

handleResult.match({
  Ok: async (handle) => {
    const result = await handle.result();
    // ... handle result
  },
  Error: (error) => console.error('Failed to start:', error),
});
create()
ts
static create<TContract>(contract, client): TypedClient<TContract>;

Defined in: packages/client/src/client.ts:141

Create a typed Temporal client with boxed pattern from a contract

Type Parameters
Type Parameter
TContract extends ContractDefinition
Parameters
ParameterType
contractTContract
clientClient
Returns

TypedClient<TContract>

Example
ts
const connection = await Connection.connect();
const temporalClient = new Client({ connection });
const client = TypedClient.create(myContract, temporalClient);

const result = await client.executeWorkflow('processOrder', {
  workflowId: 'order-123',
  args: { ... },
});

result.match({
  Ok: (output) => console.log('Success:', output),
  Error: (error) => console.error('Failed:', error),
});

UpdateValidationError

Defined in: packages/client/src/errors.ts:89

Thrown when update input or output validation fails

Extends

  • TypedClientError

Constructors

Constructor
ts
new UpdateValidationError(
   updateName, 
   direction, 
   issues): UpdateValidationError;

Defined in: packages/client/src/errors.ts:90

Parameters
ParameterType
updateNamestring
direction"output" | "input"
issuesreadonly Issue[]
Returns

UpdateValidationError

Overrides
ts
TypedClientError.constructor

Properties

PropertyModifierTypeDescriptionInherited fromDefined in
cause?publicunknown-TypedClientError.causenode_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.error.d.ts:26
directionreadonly"output" | "input"--packages/client/src/errors.ts:92
issuesreadonlyreadonly Issue[]--packages/client/src/errors.ts:93
messagepublicstring-TypedClientError.messagenode_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1077
namepublicstring-TypedClientError.namenode_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1076
stack?publicstring-TypedClientError.stacknode_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1078
updateNamereadonlystring--packages/client/src/errors.ts:91
stackTraceLimitstaticnumberThe Error.stackTraceLimit property specifies the number of stack frames collected by a stack trace (whether generated by new Error().stack or Error.captureStackTrace(obj)). The default value is 10 but may be set to any valid JavaScript number. Changes will affect any stack trace captured after the value has been changed. If set to a non-number value, or set to a negative number, stack traces will not capture any frames.TypedClientError.stackTraceLimitnode_modules/.pnpm/@types+node@25.3.2/node_modules/@types/node/globals.d.ts:67

Methods

captureStackTrace()
ts
static captureStackTrace(targetObject, constructorOpt?): void;

Defined in: node_modules/.pnpm/@types+node@25.3.2/node_modules/@types/node/globals.d.ts:51

Creates a .stack property on targetObject, which when accessed returns a string representing the location in the code at which Error.captureStackTrace() was called.

js
const myObject = {};
Error.captureStackTrace(myObject);
myObject.stack;  // Similar to `new Error().stack`

The first line of the trace will be prefixed with ${myObject.name}: ${myObject.message}.

The optional constructorOpt argument accepts a function. If given, all frames above constructorOpt, including constructorOpt, will be omitted from the generated stack trace.

The constructorOpt argument is useful for hiding implementation details of error generation from the user. For instance:

js
function a() {
  b();
}

function b() {
  c();
}

function c() {
  // Create an error without stack trace to avoid calculating the stack trace twice.
  const { stackTraceLimit } = Error;
  Error.stackTraceLimit = 0;
  const error = new Error();
  Error.stackTraceLimit = stackTraceLimit;

  // Capture the stack trace above function b
  Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
  throw error;
}

a();
Parameters
ParameterType
targetObjectobject
constructorOpt?Function
Returns

void

Inherited from
ts
TypedClientError.captureStackTrace
prepareStackTrace()
ts
static prepareStackTrace(err, stackTraces): any;

Defined in: node_modules/.pnpm/@types+node@25.3.2/node_modules/@types/node/globals.d.ts:55

Parameters
ParameterType
errError
stackTracesCallSite[]
Returns

any

See

https://v8.dev/docs/stack-trace-api#customizing-stack-traces

Inherited from
ts
TypedClientError.prepareStackTrace

WorkflowNotFoundError

Defined in: packages/client/src/errors.ts:35

Thrown when a workflow is not found in the contract

Extends

  • TypedClientError

Constructors

Constructor
ts
new WorkflowNotFoundError(workflowName, availableWorkflows): WorkflowNotFoundError;

Defined in: packages/client/src/errors.ts:36

Parameters
ParameterType
workflowNamestring
availableWorkflowsstring[]
Returns

WorkflowNotFoundError

Overrides
ts
TypedClientError.constructor

Properties

PropertyModifierTypeDescriptionInherited fromDefined in
availableWorkflowsreadonlystring[]--packages/client/src/errors.ts:38
cause?publicunknown-TypedClientError.causenode_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.error.d.ts:26
messagepublicstring-TypedClientError.messagenode_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1077
namepublicstring-TypedClientError.namenode_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1076
stack?publicstring-TypedClientError.stacknode_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1078
workflowNamereadonlystring--packages/client/src/errors.ts:37
stackTraceLimitstaticnumberThe Error.stackTraceLimit property specifies the number of stack frames collected by a stack trace (whether generated by new Error().stack or Error.captureStackTrace(obj)). The default value is 10 but may be set to any valid JavaScript number. Changes will affect any stack trace captured after the value has been changed. If set to a non-number value, or set to a negative number, stack traces will not capture any frames.TypedClientError.stackTraceLimitnode_modules/.pnpm/@types+node@25.3.2/node_modules/@types/node/globals.d.ts:67

Methods

captureStackTrace()
ts
static captureStackTrace(targetObject, constructorOpt?): void;

Defined in: node_modules/.pnpm/@types+node@25.3.2/node_modules/@types/node/globals.d.ts:51

Creates a .stack property on targetObject, which when accessed returns a string representing the location in the code at which Error.captureStackTrace() was called.

js
const myObject = {};
Error.captureStackTrace(myObject);
myObject.stack;  // Similar to `new Error().stack`

The first line of the trace will be prefixed with ${myObject.name}: ${myObject.message}.

The optional constructorOpt argument accepts a function. If given, all frames above constructorOpt, including constructorOpt, will be omitted from the generated stack trace.

The constructorOpt argument is useful for hiding implementation details of error generation from the user. For instance:

js
function a() {
  b();
}

function b() {
  c();
}

function c() {
  // Create an error without stack trace to avoid calculating the stack trace twice.
  const { stackTraceLimit } = Error;
  Error.stackTraceLimit = 0;
  const error = new Error();
  Error.stackTraceLimit = stackTraceLimit;

  // Capture the stack trace above function b
  Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
  throw error;
}

a();
Parameters
ParameterType
targetObjectobject
constructorOpt?Function
Returns

void

Inherited from
ts
TypedClientError.captureStackTrace
prepareStackTrace()
ts
static prepareStackTrace(err, stackTraces): any;

Defined in: node_modules/.pnpm/@types+node@25.3.2/node_modules/@types/node/globals.d.ts:55

Parameters
ParameterType
errError
stackTracesCallSite[]
Returns

any

See

https://v8.dev/docs/stack-trace-api#customizing-stack-traces

Inherited from
ts
TypedClientError.prepareStackTrace

WorkflowValidationError

Defined in: packages/client/src/errors.ts:49

Thrown when workflow input or output validation fails

Extends

  • TypedClientError

Constructors

Constructor
ts
new WorkflowValidationError(
   workflowName, 
   direction, 
   issues): WorkflowValidationError;

Defined in: packages/client/src/errors.ts:50

Parameters
ParameterType
workflowNamestring
direction"output" | "input"
issuesreadonly Issue[]
Returns

WorkflowValidationError

Overrides
ts
TypedClientError.constructor

Properties

PropertyModifierTypeDescriptionInherited fromDefined in
cause?publicunknown-TypedClientError.causenode_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.error.d.ts:26
directionreadonly"output" | "input"--packages/client/src/errors.ts:52
issuesreadonlyreadonly Issue[]--packages/client/src/errors.ts:53
messagepublicstring-TypedClientError.messagenode_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1077
namepublicstring-TypedClientError.namenode_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1076
stack?publicstring-TypedClientError.stacknode_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1078
workflowNamereadonlystring--packages/client/src/errors.ts:51
stackTraceLimitstaticnumberThe Error.stackTraceLimit property specifies the number of stack frames collected by a stack trace (whether generated by new Error().stack or Error.captureStackTrace(obj)). The default value is 10 but may be set to any valid JavaScript number. Changes will affect any stack trace captured after the value has been changed. If set to a non-number value, or set to a negative number, stack traces will not capture any frames.TypedClientError.stackTraceLimitnode_modules/.pnpm/@types+node@25.3.2/node_modules/@types/node/globals.d.ts:67

Methods

captureStackTrace()
ts
static captureStackTrace(targetObject, constructorOpt?): void;

Defined in: node_modules/.pnpm/@types+node@25.3.2/node_modules/@types/node/globals.d.ts:51

Creates a .stack property on targetObject, which when accessed returns a string representing the location in the code at which Error.captureStackTrace() was called.

js
const myObject = {};
Error.captureStackTrace(myObject);
myObject.stack;  // Similar to `new Error().stack`

The first line of the trace will be prefixed with ${myObject.name}: ${myObject.message}.

The optional constructorOpt argument accepts a function. If given, all frames above constructorOpt, including constructorOpt, will be omitted from the generated stack trace.

The constructorOpt argument is useful for hiding implementation details of error generation from the user. For instance:

js
function a() {
  b();
}

function b() {
  c();
}

function c() {
  // Create an error without stack trace to avoid calculating the stack trace twice.
  const { stackTraceLimit } = Error;
  Error.stackTraceLimit = 0;
  const error = new Error();
  Error.stackTraceLimit = stackTraceLimit;

  // Capture the stack trace above function b
  Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
  throw error;
}

a();
Parameters
ParameterType
targetObjectobject
constructorOpt?Function
Returns

void

Inherited from
ts
TypedClientError.captureStackTrace
prepareStackTrace()
ts
static prepareStackTrace(err, stackTraces): any;

Defined in: node_modules/.pnpm/@types+node@25.3.2/node_modules/@types/node/globals.d.ts:55

Parameters
ParameterType
errError
stackTracesCallSite[]
Returns

any

See

https://v8.dev/docs/stack-trace-api#customizing-stack-traces

Inherited from
ts
TypedClientError.prepareStackTrace

Type Aliases

ClientInferActivities

ts
type ClientInferActivities<TContract> = TContract["activities"] extends Record<string, ActivityDefinition> ? { [K in keyof TContract["activities"]]: ClientInferActivity<TContract["activities"][K]> } : object;

Defined in: packages/client/src/types.ts:88

Infer all activities from a contract (client perspective)

Type Parameters

Type Parameter
TContract extends ContractDefinition

ClientInferActivity()

ts
type ClientInferActivity<TActivity> = (args) => Promise<ClientInferOutput<TActivity>>;

Defined in: packages/client/src/types.ts:46

Infer activity function signature from client perspective Client sends z.output and receives z.input

Type Parameters

Type Parameter
TActivity extends ActivityDefinition

Parameters

ParameterType
argsClientInferInput<TActivity>

Returns

Promise<ClientInferOutput<TActivity>>


ClientInferInput

ts
type ClientInferInput<T> = StandardSchemaV1.InferInput<T["input"]>;

Defined in: packages/client/src/types.ts:17

Infer input type from a definition (client perspective) Client sends the input type (before input schema parsing/transformation)

Type Parameters

Type Parameter
T extends object

ClientInferOutput

ts
type ClientInferOutput<T> = StandardSchemaV1.InferOutput<T["output"]>;

Defined in: packages/client/src/types.ts:25

Infer output type from a definition (client perspective) Client receives the output type (after output schema parsing/transformation)

Type Parameters

Type Parameter
T extends object

ClientInferQuery()

ts
type ClientInferQuery<TQuery> = (args) => Future<Result<ClientInferOutput<TQuery>, Error>>;

Defined in: packages/client/src/types.ts:62

Infer query handler signature from client perspective Client sends z.output and receives z.input wrapped in Future<Result<T, Error>>

Type Parameters

Type Parameter
TQuery extends QueryDefinition

Parameters

ParameterType
argsClientInferInput<TQuery>

Returns

Future<Result<ClientInferOutput<TQuery>, Error>>


ClientInferSignal()

ts
type ClientInferSignal<TSignal> = (args) => Future<Result<void, Error>>;

Defined in: packages/client/src/types.ts:54

Infer signal handler signature from client perspective Client sends z.output and returns Future<Result<void, Error>>

Type Parameters

Type Parameter
TSignal extends SignalDefinition

Parameters

ParameterType
argsClientInferInput<TSignal>

Returns

Future<Result<void, Error>>


ClientInferUpdate()

ts
type ClientInferUpdate<TUpdate> = (args) => Future<Result<ClientInferOutput<TUpdate>, Error>>;

Defined in: packages/client/src/types.ts:70

Infer update handler signature from client perspective Client sends z.output and receives z.input wrapped in Future<Result<T, Error>>

Type Parameters

Type Parameter
TUpdate extends UpdateDefinition

Parameters

ParameterType
argsClientInferInput<TUpdate>

Returns

Future<Result<ClientInferOutput<TUpdate>, Error>>


ClientInferWorkflow()

ts
type ClientInferWorkflow<TWorkflow> = (args) => Promise<ClientInferOutput<TWorkflow>>;

Defined in: packages/client/src/types.ts:38

Infer workflow function signature from client perspective Client sends z.output and receives z.input

Type Parameters

Type Parameter
TWorkflow extends WorkflowDefinition

Parameters

ParameterType
argsClientInferInput<TWorkflow>

Returns

Promise<ClientInferOutput<TWorkflow>>


ClientInferWorkflowActivities

ts
type ClientInferWorkflowActivities<T> = T["activities"] extends Record<string, ActivityDefinition> ? { [K in keyof T["activities"]]: ClientInferActivity<T["activities"][K]> } : object;

Defined in: packages/client/src/types.ts:98

Infer activities from a workflow definition (client perspective)

Type Parameters

Type Parameter
T extends WorkflowDefinition

ClientInferWorkflowContextActivities

ts
type ClientInferWorkflowContextActivities<TContract, TWorkflowName> = ClientInferWorkflowActivities<TContract["workflows"][TWorkflowName]> & ClientInferActivities<TContract>;

Defined in: packages/client/src/types.ts:139

Infer all activities available in a workflow context (client perspective) Combines workflow-specific activities with global activities

Type Parameters

Type Parameter
TContract extends ContractDefinition
TWorkflowName extends keyof TContract["workflows"]

ClientInferWorkflowQueries

ts
type ClientInferWorkflowQueries<T> = T["queries"] extends Record<string, QueryDefinition> ? { [K in keyof T["queries"]]: ClientInferQuery<T["queries"][K]> } : object;

Defined in: packages/client/src/types.ts:118

Infer queries from a workflow definition (client perspective)

Type Parameters

Type Parameter
T extends WorkflowDefinition

ClientInferWorkflows

ts
type ClientInferWorkflows<TContract> = { [K in keyof TContract["workflows"]]: ClientInferWorkflow<TContract["workflows"][K]> };

Defined in: packages/client/src/types.ts:81

Infer all workflows from a contract (client perspective)

Type Parameters

Type Parameter
TContract extends ContractDefinition

ClientInferWorkflowSignals

ts
type ClientInferWorkflowSignals<T> = T["signals"] extends Record<string, SignalDefinition> ? { [K in keyof T["signals"]]: ClientInferSignal<T["signals"][K]> } : object;

Defined in: packages/client/src/types.ts:108

Infer signals from a workflow definition (client perspective)

Type Parameters

Type Parameter
T extends WorkflowDefinition

ClientInferWorkflowUpdates

ts
type ClientInferWorkflowUpdates<T> = T["updates"] extends Record<string, UpdateDefinition> ? { [K in keyof T["updates"]]: ClientInferUpdate<T["updates"][K]> } : object;

Defined in: packages/client/src/types.ts:128

Infer updates from a workflow definition (client perspective)

Type Parameters

Type Parameter
T extends WorkflowDefinition

TypedWorkflowHandle

ts
type TypedWorkflowHandle<TWorkflow> = object;

Defined in: packages/client/src/client.ts:38

Typed workflow handle with validated results using Result/Future pattern

Type Parameters

Type Parameter
TWorkflow extends WorkflowDefinition

Properties

PropertyTypeDescriptionDefined in
cancel() => Future<Result<void, RuntimeClientError>>Cancel workflow with Result patternpackages/client/src/client.ts:92
describe() => Future<Result<Awaited<ReturnType<WorkflowHandle["describe"]>>, RuntimeClientError>>Get workflow execution description including status and metadatapackages/client/src/client.ts:97
fetchHistory() => Future<Result<Awaited<ReturnType<WorkflowHandle["fetchHistory"]>>, RuntimeClientError>>Fetch the workflow execution historypackages/client/src/client.ts:104
queries{ [K in keyof ClientInferWorkflowQueries<TWorkflow>]: ClientInferWorkflowQueries<TWorkflow>[K] extends (args: infer Args) => Future<Result<infer R, Error>> ? (args: Args) => Future<Result<R, QueryValidationError | RuntimeClientError>> : never }Type-safe queries based on workflow definition with Result pattern Each query returns Future<Result<T, Error>> instead of Promise<T>packages/client/src/client.ts:45
result() => Future<Result<ClientInferOutput<TWorkflow>, | WorkflowValidationError | RuntimeClientError>>Get workflow result with Result patternpackages/client/src/client.ts:80
signals{ [K in keyof ClientInferWorkflowSignals<TWorkflow>]: ClientInferWorkflowSignals<TWorkflow>[K] extends (args: infer Args) => Future<Result<void, Error>> ? (args: Args) => Future<Result<void, SignalValidationError | RuntimeClientError>> : never }Type-safe signals based on workflow definition with Result pattern Each signal returns Future<Result<void, Error>> instead of Promise<void>packages/client/src/client.ts:57
terminate(reason?) => Future<Result<void, RuntimeClientError>>Terminate workflow with Result patternpackages/client/src/client.ts:87
updates{ [K in keyof ClientInferWorkflowUpdates<TWorkflow>]: ClientInferWorkflowUpdates<TWorkflow>[K] extends (args: infer Args) => Future<Result<infer R, Error>> ? (args: Args) => Future<Result<R, UpdateValidationError | RuntimeClientError>> : never }Type-safe updates based on workflow definition with Result pattern Each update returns Future<Result<T, Error>> instead of Promise<T>packages/client/src/client.ts:69
workflowIdstring-packages/client/src/client.ts:39

TypedWorkflowStartOptions

ts
type TypedWorkflowStartOptions<TContract, TWorkflowName> = Omit<WorkflowStartOptions, "taskQueue" | "args"> & object;

Defined in: packages/client/src/client.ts:28

Type Declaration

NameTypeDefined in
argsClientInferInput<TContract["workflows"][TWorkflowName]>packages/client/src/client.ts:32

Type Parameters

Type Parameter
TContract extends ContractDefinition
TWorkflowName extends keyof TContract["workflows"]

Released under the MIT License.