Skip to content

@temporal-contract/client


@temporal-contract/client

Classes

ContractError

Defined in: packages/contract/dist/errors.d.mts:42

A typed domain error declared on a contract's errors map.

One class covers every declared error; the errorName field is the per-error discriminant (it equals the key in the contract's errors map and the ApplicationFailure.type on the wire). Narrow a union with it:

ts
if (result.isErr() && result.error instanceof ContractError) {
  switch (result.error.errorName) {
    case "PaymentDeclined":
      result.error.data; // { reason: string }
  }
}

The unthrown _tag ("@temporal-contract/ContractError") discriminates a ContractError from the other tagged errors in a Result's error channel (e.g. via matchTags); errorName then narrows to the concrete declared error.

Extends

  • ContractError_base<{ cause?: unknown; data: TData; errorName: TName; }>

Type Parameters

Type ParameterDefault type
TName extends stringstring
TDataunknown

Constructors

Constructor
ts
new ContractError<TName, TData>(args): ContractError<TName, TData>;

Defined in: packages/contract/dist/errors.d.mts:47

Parameters
ParameterType
args{ cause?: unknown; data: TData; errorName: TName; message: string; }
args.cause?unknown
args.dataTData
args.errorNameTName
args.messagestring
Returns

ContractError<TName, TData>

Overrides
ts
ContractError_base<{
  / Declared error namethe ApplicationFailure.type discriminator. /errorName: TName; / Structured payload validated against the declared data schema. /
  data: TData;
  cause?: unknown;
}>.constructor

Properties

PropertyModifierTypeDescriptionInherited fromDefined in
_tagreadonly"@temporal-contract/ContractError"-ContractError_base._tagnode_modules/.pnpm/unthrown@4.1.0/node_modules/unthrown/dist/index.d.mts:1456
cause?publicunknown-WorkflowNotFoundError.causenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24
datareadonlyTData-ContractError_base.datapackages/contract/dist/errors.d.mts:44
errorNamereadonlyTNameDeclared error name — the ApplicationFailure.type discriminator.ContractError_base.errorNamepackages/contract/dist/errors.d.mts:43
messagepublicstring-ContractError_base.messagenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075
namepublicstring-ContractError_base.namenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074
stack?publicstring-ContractError_base.stacknode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076

QueryValidationError

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

Thrown when query input or output validation fails

Extends

  • TaggedErrorInstance<"@temporal-contract/QueryValidationError", { direction: "input" | "output"; issues: readonly Issue[]; queryName: string; }>

Constructors

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

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

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

QueryValidationError

Overrides
ts
TaggedError("@temporal-contract/QueryValidationError", {
  name: "QueryValidationError",
})<{
  queryName: string;
  direction: "input" | "output";
  issues: ReadonlyArray<StandardSchemaV1.Issue>;
}>.constructor

Properties

PropertyModifierTypeInherited fromDefined in
_tagreadonly"@temporal-contract/QueryValidationError"TaggedError("@temporal-contract/QueryValidationError", { name: "QueryValidationError", })._tagnode_modules/.pnpm/unthrown@4.1.0/node_modules/unthrown/dist/index.d.mts:1456
cause?publicunknownTaggedError("@temporal-contract/QueryValidationError", { name: "QueryValidationError", }).causenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24
directionreadonly"input" | "output"TaggedError("@temporal-contract/QueryValidationError", { name: "QueryValidationError", }).directionpackages/client/src/errors.ts:182
issuesreadonlyreadonly Issue[]TaggedError("@temporal-contract/QueryValidationError", { name: "QueryValidationError", }).issuespackages/client/src/errors.ts:183
messagepublicstringTaggedError("@temporal-contract/QueryValidationError", { name: "QueryValidationError", }).messagenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075
namepublicstringTaggedError("@temporal-contract/QueryValidationError", { name: "QueryValidationError", }).namenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074
queryNamereadonlystringTaggedError("@temporal-contract/QueryValidationError", { name: "QueryValidationError", }).queryNamepackages/client/src/errors.ts:181
stack?publicstringTaggedError("@temporal-contract/QueryValidationError", { name: "QueryValidationError", }).stacknode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076

RuntimeClientError

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

Generic runtime failure wrapper when no specific error type applies

Extends

  • TaggedErrorInstance<"@temporal-contract/RuntimeClientError", { cause?: unknown; operation: string; }>

Constructors

Constructor
ts
new RuntimeClientError(operation, cause?): RuntimeClientError;

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

Parameters
ParameterType
operationstring
cause?unknown
Returns

RuntimeClientError

Overrides
ts
TaggedError("@temporal-contract/RuntimeClientError", {
  name: "RuntimeClientError",
})<{
  operation: string;
  cause?: unknown;
}>.constructor

Properties

PropertyModifierTypeInherited fromDefined in
_tagreadonly"@temporal-contract/RuntimeClientError"TaggedError("@temporal-contract/RuntimeClientError", { name: "RuntimeClientError", })._tagnode_modules/.pnpm/unthrown@4.1.0/node_modules/unthrown/dist/index.d.mts:1456
cause?publicunknownWorkflowNotFoundError.causenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24
messagepublicstringTaggedError("@temporal-contract/RuntimeClientError", { name: "RuntimeClientError", }).messagenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075
namepublicstringTaggedError("@temporal-contract/RuntimeClientError", { name: "RuntimeClientError", }).namenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074
operationreadonlystringTaggedError("@temporal-contract/RuntimeClientError", { name: "RuntimeClientError", }).operationpackages/client/src/errors.ts:39
stack?publicstringTaggedError("@temporal-contract/RuntimeClientError", { name: "RuntimeClientError", }).stacknode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076

SignalValidationError

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

Thrown when signal input validation fails

Extends

  • TaggedErrorInstance<"@temporal-contract/SignalValidationError", { issues: readonly Issue[]; signalName: string; }>

Constructors

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

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

Parameters
ParameterType
signalNamestring
issuesreadonly Issue[]
Returns

SignalValidationError

Overrides
ts
TaggedError("@temporal-contract/SignalValidationError", {
  name: "SignalValidationError",
})<{
  signalName: string;
  issues: ReadonlyArray<StandardSchemaV1.Issue>;
}>.constructor

Properties

PropertyModifierTypeInherited fromDefined in
_tagreadonly"@temporal-contract/SignalValidationError"TaggedError("@temporal-contract/SignalValidationError", { name: "SignalValidationError", })._tagnode_modules/.pnpm/unthrown@4.1.0/node_modules/unthrown/dist/index.d.mts:1456
cause?publicunknownTaggedError("@temporal-contract/SignalValidationError", { name: "SignalValidationError", }).causenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24
issuesreadonlyreadonly Issue[]TaggedError("@temporal-contract/SignalValidationError", { name: "SignalValidationError", }).issuespackages/client/src/errors.ts:202
messagepublicstringTaggedError("@temporal-contract/SignalValidationError", { name: "SignalValidationError", }).messagenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075
namepublicstringTaggedError("@temporal-contract/SignalValidationError", { name: "SignalValidationError", }).namenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074
signalNamereadonlystringTaggedError("@temporal-contract/SignalValidationError", { name: "SignalValidationError", }).signalNamepackages/client/src/errors.ts:201
stack?publicstringTaggedError("@temporal-contract/SignalValidationError", { name: "SignalValidationError", }).stacknode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076

TechnicalError

Defined in: packages/contract/dist/errors.d.mts:15

Error for technical/runtime failures that cannot be prevented by TypeScript — connection failures, missing runtime capabilities, worker bundling errors. Surfaced on the Err channel of the creation factories (TypedClient.create, createWorker), never thrown: it is a modeled error (it lives in the E channel of a Result), not a Defect.

Mirrors amqp-contract's TechnicalError — the org-wide shape for Typed*.create() factories returning AsyncResult<_, TechnicalError>.

Extends

  • TechnicalError_base<{ cause?: unknown; }>

Constructors

Constructor
ts
new TechnicalError(message, cause?): TechnicalError;

Defined in: packages/contract/dist/errors.d.mts:18

Parameters
ParameterType
messagestring
cause?unknown
Returns

TechnicalError

Overrides
ts
TechnicalError_base<{
  cause?: unknown;
}>.constructor

Properties

PropertyModifierTypeInherited fromDefined in
_tagreadonly"@temporal-contract/TechnicalError"TechnicalError_base._tagnode_modules/.pnpm/unthrown@4.1.0/node_modules/unthrown/dist/index.d.mts:1456
cause?publicunknownWorkflowNotFoundError.causenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24
messagepublicstringTechnicalError_base.messagenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075
namepublicstringTechnicalError_base.namenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074
stack?publicstringTechnicalError_base.stacknode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076

TypedClient

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

Typed Temporal client with unthrown Result/AsyncResult 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

Properties

PropertyModifierTypeDescriptionDefined in
schedulereadonlyTypedScheduleClient<TContract>Typed wrapper around Temporal's client.schedule.create(...) and related lifecycle methods. Fires the underlying startWorkflow action with args validated against the contract's input schema. Requires @temporalio/client 1.16+. The Schedule API was added in 1.16; on older versions this property is unset and any access throws. The package's peer dep allows the whole ^1 range to stay permissive about the installed Temporal version, so consumers on < 1.16 who never touch schedules keep working — the constructor below fails fast with a clear message for anyone who does reach for the Schedule API too early. Example const result = await client.schedule.create("processOrder", { scheduleId: "daily-sweep", spec: { cronExpressions: ["0 2 * * *"] }, args: { orderId: "sweep" }, }); await result.match({ ok: async (handle) => { await handle.pause("maintenance"); }, err: (error) => console.error("schedule create failed", error), defect: (cause) => console.error("unexpected failure", cause), });packages/client/src/client.ts:422

Methods

executeWorkflow()
ts
executeWorkflow<TWorkflowName>(workflowName, __namedParameters): AsyncResult<ClientInferOutput<TContract["workflows"][TWorkflowName]>, 
  | WorkflowNotFoundError
  | WorkflowValidationError
  | WorkflowAlreadyStartedError
  | RuntimeClientError
  | WorkflowContractErrorsOf<TContract["workflows"][TWorkflowName]>
  | WorkflowFailedError
  | WorkflowExecutionNotFoundError>;

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

Execute a workflow (start and wait for result) with AsyncResult pattern

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

AsyncResult<ClientInferOutput<TContract["workflows"][TWorkflowName]>, | WorkflowNotFoundError | WorkflowValidationError | WorkflowAlreadyStartedError | RuntimeClientError | WorkflowContractErrorsOf<TContract["workflows"][TWorkflowName]> | WorkflowFailedError | WorkflowExecutionNotFoundError>

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

await result.match({
  ok: (output) => console.log('Order processed:', output.status),
  err: (error) => console.error('Processing failed:', error),
  defect: (cause) => console.error('Unexpected failure:', cause),
});
getHandle()
ts
getHandle<TWorkflowName>(workflowName, workflowId): AsyncResult<TypedWorkflowHandle<TContract["workflows"][TWorkflowName]>, 
  | WorkflowNotFoundError
  | RuntimeClientError>;

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

Get a handle to an existing workflow with AsyncResult pattern

Type Parameters
Type Parameter
TWorkflowName extends string
Parameters
ParameterType
workflowNameTWorkflowName
workflowIdstring
Returns

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

Example
ts
const handleResult = await client.getHandle('processOrder', 'order-123');
await handleResult.match({
  ok: async (handle) => {
    const result = await handle.result();
    // ... handle result
  },
  err: (error) => console.error('Failed to get handle:', error),
  defect: (cause) => console.error('Unexpected failure:', cause),
});
signalWithStart()
ts
signalWithStart<TWorkflowName, TSignalName>(workflowName, __namedParameters): AsyncResult<TypedWorkflowHandleWithSignaledRunId<TContract["workflows"][TWorkflowName]>, 
  | WorkflowNotFoundError
  | WorkflowValidationError
  | WorkflowAlreadyStartedError
  | RuntimeClientError
  | SignalValidationError>;

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

Send a signal to a workflow, starting it first if it doesn't already exist.

Validates both halves of the call against the contract:

  • args against the workflow's input schema
  • signalArgs against the named signal's input schema

Returns a TypedWorkflowHandleWithSignaledRunId — the same shape as startWorkflow's handle, plus a signaledRunId field for correlating the signal with the (possibly pre-existing) workflow execution chain.

Type Parameters
Type Parameter
TWorkflowName extends string
TSignalName extends string
Parameters
ParameterType
workflowNameTWorkflowName
__namedParametersTypedSignalWithStartOptions<TContract, TWorkflowName, TSignalName>
Returns

AsyncResult<TypedWorkflowHandleWithSignaledRunId<TContract["workflows"][TWorkflowName]>, | WorkflowNotFoundError | WorkflowValidationError | WorkflowAlreadyStartedError | RuntimeClientError | SignalValidationError>

Example
ts
const result = await client.signalWithStart('processOrder', {
  workflowId: 'order-123',
  args: { orderId: 'ORD-123', customerId: 'CUST-1' },
  signalName: 'cancel',
  signalArgs: { reason: 'duplicate' },
});

await result.match({
  ok: (handle) => console.log('signaled run', handle.signaledRunId),
  err: (error) => console.error('signalWithStart failed', error),
  defect: (cause) => console.error('unexpected failure', cause),
});
startWorkflow()
ts
startWorkflow<TWorkflowName>(workflowName, __namedParameters): AsyncResult<TypedWorkflowHandle<TContract["workflows"][TWorkflowName]>, 
  | WorkflowNotFoundError
  | WorkflowValidationError
  | WorkflowAlreadyStartedError
  | RuntimeClientError>;

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

Start a workflow and return a typed handle with AsyncResult pattern

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

AsyncResult<TypedWorkflowHandle<TContract["workflows"][TWorkflowName]>, | WorkflowNotFoundError | WorkflowValidationError | WorkflowAlreadyStartedError | RuntimeClientError>

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

await handleResult.match({
  ok: async (handle) => {
    const result = await handle.result();
    // ... handle result
  },
  err: (error) => console.error('Failed to start:', error),
  defect: (cause) => console.error('Unexpected failure:', cause),
});
create()
ts
static create<TContract>(__namedParameters): AsyncResult<TypedClient<TContract>, TechnicalError>;

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

Create a typed Temporal client with unthrown pattern from a contract.

Returns AsyncResult<TypedClient, TechnicalError> — errors-as-values from the very first call, matching the org-wide Typed*.create() factory shape (amqp-contract's TypedAmqpClient.create). Modeled failures on the Err channel:

  • the underlying Client lacks the Schedule API (@temporalio/client < 1.16);
  • the connection cannot be established (when the client's connection exposes ensureConnected, it is awaited eagerly so a bad address/namespace surfaces here instead of on the first operation).
Type Parameters
Type Parameter
TContract extends ContractDefinition
Parameters
ParameterType
__namedParametersCreateTypedClientOptions<TContract>
Returns

AsyncResult<TypedClient<TContract>, TechnicalError>

Example
ts
const connection = await Connection.connect();
const temporalClient = new Client({ connection });
const clientResult = await TypedClient.create({
  contract: myContract,
  client: temporalClient,
});
if (clientResult.isErr()) {
  console.error('client setup failed', clientResult.error);
  return;
}
const client = clientResult.value;

const result = await client.executeWorkflow('processOrder', {
  workflowId: 'order-123',
  args: { ... },
});
createOrThrow()
ts
static createOrThrow<TContract>(
   contract, 
   client, 
   interceptors?): TypedClient<TContract>;

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

Create a typed client synchronously, throwing on failure — the pre-AsyncResult behavior.

Type Parameters
Type Parameter
TContract extends ContractDefinition
Parameters
ParameterType
contractTContract
clientClient
interceptors?readonly ClientInterceptor[]
Returns

TypedClient<TContract>

Deprecated

Use TypedClient.create, which returns AsyncResult<TypedClient, TechnicalError> and also validates the connection eagerly. This throwing alias exists to ease migration and will be removed in a future major.


TypedScheduleClient

Defined in: packages/client/src/schedule.ts:109

Typed wrapper around Temporal's ScheduleClient. Exposed as typedClient.schedule — keeps the typed-client surface organized the same way Temporal's own Client.schedule does.

Type Parameters

Type Parameter
TContract extends ContractDefinition

Constructors

Constructor
ts
new TypedScheduleClient<TContract>(contract, scheduleClient): TypedScheduleClient<TContract>;

Defined in: packages/client/src/schedule.ts:110

Parameters
ParameterType
contractTContract
scheduleClientScheduleClient
Returns

TypedScheduleClient<TContract>

Methods

create()
ts
create<TWorkflowName>(workflowName, options): AsyncResult<TypedScheduleHandle, 
  | WorkflowNotFoundError
  | WorkflowValidationError
  | RuntimeClientError>;

Defined in: packages/client/src/schedule.ts:124

Create a new schedule that, on each fire, starts the named contract workflow with validated args.

Validates args against the workflow's input schema before dispatching the create request to Temporal. The workflow's taskQueue and workflowType are pulled from the contract automatically; the typed options shape omits them so call sites don't have to repeat themselves.

Type Parameters
Type Parameter
TWorkflowName extends string
Parameters
ParameterType
workflowNameTWorkflowName
optionsTypedScheduleCreateOptions<TContract, TWorkflowName>
Returns

AsyncResult<TypedScheduleHandle, | WorkflowNotFoundError | WorkflowValidationError | RuntimeClientError>

getHandle()
ts
getHandle(scheduleId): TypedScheduleHandle;

Defined in: packages/client/src/schedule.ts:209

Get a typed handle to an existing schedule. Does not validate that the schedule exists — handle methods (describe, pause, etc.) will surface a RuntimeClientError if the underlying ID is unknown.

Parameters
ParameterType
scheduleIdstring
Returns

TypedScheduleHandle


UpdateValidationError

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

Thrown when update input or output validation fails

Extends

  • TaggedErrorInstance<"@temporal-contract/UpdateValidationError", { direction: "input" | "output"; issues: readonly Issue[]; updateName: string; }>

Constructors

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

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

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

UpdateValidationError

Overrides
ts
TaggedError("@temporal-contract/UpdateValidationError", {
  name: "UpdateValidationError",
})<{
  updateName: string;
  direction: "input" | "output";
  issues: ReadonlyArray<StandardSchemaV1.Issue>;
}>.constructor

Properties

PropertyModifierTypeInherited fromDefined in
_tagreadonly"@temporal-contract/UpdateValidationError"TaggedError("@temporal-contract/UpdateValidationError", { name: "UpdateValidationError", })._tagnode_modules/.pnpm/unthrown@4.1.0/node_modules/unthrown/dist/index.d.mts:1456
cause?publicunknownTaggedError("@temporal-contract/UpdateValidationError", { name: "UpdateValidationError", }).causenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24
directionreadonly"input" | "output"TaggedError("@temporal-contract/UpdateValidationError", { name: "UpdateValidationError", }).directionpackages/client/src/errors.ts:217
issuesreadonlyreadonly Issue[]TaggedError("@temporal-contract/UpdateValidationError", { name: "UpdateValidationError", }).issuespackages/client/src/errors.ts:218
messagepublicstringTaggedError("@temporal-contract/UpdateValidationError", { name: "UpdateValidationError", }).messagenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075
namepublicstringTaggedError("@temporal-contract/UpdateValidationError", { name: "UpdateValidationError", }).namenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074
stack?publicstringTaggedError("@temporal-contract/UpdateValidationError", { name: "UpdateValidationError", }).stacknode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076
updateNamereadonlystringTaggedError("@temporal-contract/UpdateValidationError", { name: "UpdateValidationError", }).updateNamepackages/client/src/errors.ts:216

WorkflowAlreadyStartedError

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

Discriminated variant of RuntimeClientError surfaced when starting a workflow collides with an existing execution — Temporal's WorkflowExecutionAlreadyStartedError. The most common cause is a workflowId reuse policy that rejects duplicates while a previous run is still in retention.

Distinguishing this from RuntimeClientError lets idempotent callers branch on it explicitly (e.g. fetch the existing handle and continue) without inspecting error.cause against a Temporal SDK class.

Extends

  • TaggedErrorInstance<"@temporal-contract/WorkflowAlreadyStartedError", { cause?: unknown; workflowId: string; workflowType: string; }>

Constructors

Constructor
ts
new WorkflowAlreadyStartedError(
   workflowType, 
   workflowId, 
   cause?): WorkflowAlreadyStartedError;

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

Parameters
ParameterType
workflowTypestring
workflowIdstring
cause?unknown
Returns

WorkflowAlreadyStartedError

Overrides
ts
TaggedError(
  "@temporal-contract/WorkflowAlreadyStartedError",
  { name: "WorkflowAlreadyStartedError" },
)<{
  workflowType: string;
  workflowId: string;
  cause?: unknown;
}>.constructor

Properties

PropertyModifierTypeInherited fromDefined in
_tagreadonly"@temporal-contract/WorkflowAlreadyStartedError"TaggedError( "@temporal-contract/WorkflowAlreadyStartedError", { name: "WorkflowAlreadyStartedError" }, )._tagnode_modules/.pnpm/unthrown@4.1.0/node_modules/unthrown/dist/index.d.mts:1456
cause?publicunknownWorkflowNotFoundError.causenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24
messagepublicstringTaggedError( "@temporal-contract/WorkflowAlreadyStartedError", { name: "WorkflowAlreadyStartedError" }, ).messagenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075
namepublicstringTaggedError( "@temporal-contract/WorkflowAlreadyStartedError", { name: "WorkflowAlreadyStartedError" }, ).namenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074
stack?publicstringTaggedError( "@temporal-contract/WorkflowAlreadyStartedError", { name: "WorkflowAlreadyStartedError" }, ).stacknode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076
workflowIdreadonlystringTaggedError( "@temporal-contract/WorkflowAlreadyStartedError", { name: "WorkflowAlreadyStartedError" }, ).workflowIdpackages/client/src/errors.ts:81
workflowTypereadonlystringTaggedError( "@temporal-contract/WorkflowAlreadyStartedError", { name: "WorkflowAlreadyStartedError" }, ).workflowTypepackages/client/src/errors.ts:80

WorkflowExecutionNotFoundError

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

Discriminated variant of RuntimeClientError surfaced when an operation targets a workflow execution that doesn't exist in the namespace — Temporal's WorkflowNotFoundError (distinct from this package's contract-level WorkflowNotFoundError).

Returned from:

  • handle methods: signal, query, executeUpdate, result, terminate, cancel, describe, fetchHistory
  • executeWorkflow (when the underlying execute call hits a missing execution mid-flight)

Extends

  • TaggedErrorInstance<"@temporal-contract/WorkflowExecutionNotFoundError", { cause?: unknown; runId?: string; workflowId: string; }>

Constructors

Constructor
ts
new WorkflowExecutionNotFoundError(
   workflowId, 
   runId?, 
   cause?): WorkflowExecutionNotFoundError;

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

Parameters
ParameterType
workflowIdstring
runId?string
cause?unknown
Returns

WorkflowExecutionNotFoundError

Overrides
ts
TaggedError(
  "@temporal-contract/WorkflowExecutionNotFoundError",
  { name: "WorkflowExecutionNotFoundError" },
)<{
  workflowId: string;
  runId?: string | undefined;
  cause?: unknown;
}>.constructor

Properties

PropertyModifierTypeInherited fromDefined in
_tagreadonly"@temporal-contract/WorkflowExecutionNotFoundError"TaggedError( "@temporal-contract/WorkflowExecutionNotFoundError", { name: "WorkflowExecutionNotFoundError" }, )._tagnode_modules/.pnpm/unthrown@4.1.0/node_modules/unthrown/dist/index.d.mts:1456
cause?publicunknownWorkflowNotFoundError.causenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24
messagepublicstringTaggedError( "@temporal-contract/WorkflowExecutionNotFoundError", { name: "WorkflowExecutionNotFoundError" }, ).messagenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075
namepublicstringTaggedError( "@temporal-contract/WorkflowExecutionNotFoundError", { name: "WorkflowExecutionNotFoundError" }, ).namenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074
runId?readonlystringTaggedError( "@temporal-contract/WorkflowExecutionNotFoundError", { name: "WorkflowExecutionNotFoundError" }, ).runIdpackages/client/src/errors.ts:107
stack?publicstringTaggedError( "@temporal-contract/WorkflowExecutionNotFoundError", { name: "WorkflowExecutionNotFoundError" }, ).stacknode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076
workflowIdreadonlystringTaggedError( "@temporal-contract/WorkflowExecutionNotFoundError", { name: "WorkflowExecutionNotFoundError" }, ).workflowIdpackages/client/src/errors.ts:106

WorkflowFailedError

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

Discriminated variant of RuntimeClientError surfaced when waiting on a workflow's result and the workflow completes with a failure — Temporal's WorkflowFailedError.

cause is the unwrapped underlying TemporalFailure (typically an ApplicationFailure, CancelledFailure, TerminatedFailure, or TimeoutFailure) lifted from Temporal's wrapper, so callers can branch on the failure category in one step (err.cause instanceof ApplicationFailure) instead of unwrapping twice via the SDK wrapper. The SDK declares WorkflowFailedError.cause as the wider Error | undefined (since cause lives on Error), but the runtime guarantee — driven by Temporal's wire format — is that it is always a TemporalFailure subclass when the wrapper is surfaced. classifyResultError narrows that wider static type to the public TemporalFailure union with a cast, so consumers see the precise leaf-failure typing instead of a bare Error.

Returned from executeWorkflow and handle.result().

Extends

  • TaggedErrorInstance<"@temporal-contract/WorkflowFailedError", { cause?: TemporalFailure; workflowId: string; }>

Constructors

Constructor
ts
new WorkflowFailedError(workflowId, cause?): WorkflowFailedError;

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

Parameters
ParameterType
workflowIdstring
cause?TemporalFailure
Returns

WorkflowFailedError

Overrides
ts
TaggedError("@temporal-contract/WorkflowFailedError", {
  name: "WorkflowFailedError",
})<{
  workflowId: string;
  cause?: TemporalFailure | undefined;
}>.constructor

Properties

PropertyModifierTypeInherited fromDefined in
_tagreadonly"@temporal-contract/WorkflowFailedError"TaggedError("@temporal-contract/WorkflowFailedError", { name: "WorkflowFailedError", })._tagnode_modules/.pnpm/unthrown@4.1.0/node_modules/unthrown/dist/index.d.mts:1456
cause?publicTemporalFailureWorkflowNotFoundError.causenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24
messagepublicstringTaggedError("@temporal-contract/WorkflowFailedError", { name: "WorkflowFailedError", }).messagenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075
namepublicstringTaggedError("@temporal-contract/WorkflowFailedError", { name: "WorkflowFailedError", }).namenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074
stack?publicstringTaggedError("@temporal-contract/WorkflowFailedError", { name: "WorkflowFailedError", }).stacknode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076
workflowIdreadonlystringTaggedError("@temporal-contract/WorkflowFailedError", { name: "WorkflowFailedError", }).workflowIdpackages/client/src/errors.ts:138

WorkflowNotFoundError

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

Thrown when a workflow is not found in the contract

Extends

  • TaggedErrorInstance<"@temporal-contract/WorkflowNotFoundError", { availableWorkflows: string[]; workflowName: string; }>

Constructors

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

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

Parameters
ParameterType
workflowNamestring
availableWorkflowsstring[]
Returns

WorkflowNotFoundError

Overrides
ts
TaggedError("@temporal-contract/WorkflowNotFoundError", {
  name: "WorkflowNotFoundError",
})<{
  workflowName: string;
  availableWorkflows: string[];
}>.constructor

Properties

PropertyModifierTypeInherited fromDefined in
_tagreadonly"@temporal-contract/WorkflowNotFoundError"TaggedError("@temporal-contract/WorkflowNotFoundError", { name: "WorkflowNotFoundError", })._tagnode_modules/.pnpm/unthrown@4.1.0/node_modules/unthrown/dist/index.d.mts:1456
availableWorkflowsreadonlystring[]TaggedError("@temporal-contract/WorkflowNotFoundError", { name: "WorkflowNotFoundError", }).availableWorkflowspackages/client/src/errors.ts:57
cause?publicunknownTaggedError("@temporal-contract/WorkflowNotFoundError", { name: "WorkflowNotFoundError", }).causenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24
messagepublicstringTaggedError("@temporal-contract/WorkflowNotFoundError", { name: "WorkflowNotFoundError", }).messagenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075
namepublicstringTaggedError("@temporal-contract/WorkflowNotFoundError", { name: "WorkflowNotFoundError", }).namenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074
stack?publicstringTaggedError("@temporal-contract/WorkflowNotFoundError", { name: "WorkflowNotFoundError", }).stacknode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076
workflowNamereadonlystringTaggedError("@temporal-contract/WorkflowNotFoundError", { name: "WorkflowNotFoundError", }).workflowNamepackages/client/src/errors.ts:56

WorkflowValidationError

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

Thrown when workflow input or output validation fails

Extends

  • TaggedErrorInstance<"@temporal-contract/WorkflowValidationError", { direction: "input" | "output"; issues: readonly Issue[]; workflowName: string; }>

Constructors

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

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

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

WorkflowValidationError

Overrides
ts
TaggedError(
  "@temporal-contract/WorkflowValidationError",
  { name: "WorkflowValidationError" },
)<{
  workflowName: string;
  direction: "input" | "output";
  issues: ReadonlyArray<StandardSchemaV1.Issue>;
}>.constructor

Properties

PropertyModifierTypeInherited fromDefined in
_tagreadonly"@temporal-contract/WorkflowValidationError"TaggedError( "@temporal-contract/WorkflowValidationError", { name: "WorkflowValidationError" }, )._tagnode_modules/.pnpm/unthrown@4.1.0/node_modules/unthrown/dist/index.d.mts:1456
cause?publicunknownTaggedError( "@temporal-contract/WorkflowValidationError", { name: "WorkflowValidationError" }, ).causenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24
directionreadonly"input" | "output"TaggedError( "@temporal-contract/WorkflowValidationError", { name: "WorkflowValidationError" }, ).directionpackages/client/src/errors.ts:162
issuesreadonlyreadonly Issue[]TaggedError( "@temporal-contract/WorkflowValidationError", { name: "WorkflowValidationError" }, ).issuespackages/client/src/errors.ts:163
messagepublicstringTaggedError( "@temporal-contract/WorkflowValidationError", { name: "WorkflowValidationError" }, ).messagenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075
namepublicstringTaggedError( "@temporal-contract/WorkflowValidationError", { name: "WorkflowValidationError" }, ).namenode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074
stack?publicstringTaggedError( "@temporal-contract/WorkflowValidationError", { name: "WorkflowValidationError" }, ).stacknode_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076
workflowNamereadonlystringTaggedError( "@temporal-contract/WorkflowValidationError", { name: "WorkflowValidationError" }, ).workflowNamepackages/client/src/errors.ts:161

Type Aliases

AnyContractError

ts
type AnyContractError = ContractError<string, unknown>;

Defined in: packages/contract/dist/errors.d.mts:58

Widest ContractError instantiation — useful as a constraint or for instanceof-style narrowing before discriminating on errorName.


ClientCallError

ts
type ClientCallError = 
  | WorkflowNotFoundError
  | WorkflowValidationError
  | WorkflowAlreadyStartedError
  | WorkflowFailedError
  | WorkflowExecutionNotFoundError
  | SignalValidationError
  | QueryValidationError
  | UpdateValidationError
  | RuntimeClientError
  | AnyContractError;

Defined in: packages/client/src/interceptors.ts:39

Union of every modeled error a typed-client operation can surface. The interceptor chain is typed against this widened union; each public method narrows it back to its precise union at the boundary (types are erased through the chain and restored at the edge — same approach as amqp-contract's call()).


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:77

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:35

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/contract/dist/types-Cx9CLFXa.d.mts:260

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/contract/dist/types-Cx9CLFXa.d.mts:267

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) => AsyncResult<ClientInferOutput<TQuery>, Error>;

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

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

Type Parameters

Type Parameter
TQuery extends QueryDefinition

Parameters

ParameterType
argsClientInferInput<TQuery>

Returns

AsyncResult<ClientInferOutput<TQuery>, Error>


ClientInferSignal

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

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

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

Type Parameters

Type Parameter
TSignal extends SignalDefinition

Parameters

ParameterType
argsClientInferInput<TSignal>

Returns

AsyncResult<void, Error>


ClientInferUpdate

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

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

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

Type Parameters

Type Parameter
TUpdate extends UpdateDefinition

Parameters

ParameterType
argsClientInferInput<TUpdate>

Returns

AsyncResult<ClientInferOutput<TUpdate>, Error>


ClientInferWorkflow

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

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

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

Type Parameters

Type Parameter
TWorkflow extends AnyWorkflowDefinition

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:87

Infer activities from a workflow definition (client perspective)

Type Parameters

Type Parameter
T extends AnyWorkflowDefinition

ClientInferWorkflowContextActivities

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

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

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"] & string

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:107

Infer queries from a workflow definition (client perspective)

Type Parameters

Type Parameter
T extends AnyWorkflowDefinition

ClientInferWorkflows

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

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

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:97

Infer signals from a workflow definition (client perspective)

Type Parameters

Type Parameter
T extends AnyWorkflowDefinition

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:117

Infer updates from a workflow definition (client perspective)

Type Parameters

Type Parameter
T extends AnyWorkflowDefinition

ClientInterceptor

ts
type ClientInterceptor = (args, next) => AsyncResult<unknown, ClientCallError>;

Defined in: packages/client/src/interceptors.ts:107

A client-side interceptor. See the module doc for semantics; the array passed to TypedClient.create composes outermost-first.

Parameters

ParameterType
argsClientInterceptorArgs
nextClientInterceptorNext

Returns

AsyncResult<unknown, ClientCallError>

Example

Retry a transient failure once

ts
const retryOnce: ClientInterceptor = (args, next) =>
  next().flatMapErr((error) =>
    error instanceof RuntimeClientError ? next() : Err(error).toAsync(),
  );

ClientInterceptorArgs

ts
type ClientInterceptorArgs = 
  | {
  input: unknown;
  operation: "startWorkflow" | "executeWorkflow";
  workflowId: string;
  workflowName: string;
}
  | {
  input: unknown;
  operation: "signalWithStart";
  signalInput: unknown;
  signalName: string;
  workflowId: string;
  workflowName: string;
}
  | {
  input: unknown;
  name: string;
  operation: "signal" | "query" | "update";
  workflowId: string;
  workflowName: string;
};

Defined in: packages/client/src/interceptors.ts:55

Invocation description handed to every interceptor — a discriminated union over the wrapped operations.

Union Members

Type Literal
ts
{
  input: unknown;
  operation: "startWorkflow" | "executeWorkflow";
  workflowId: string;
  workflowName: string;
}
NameTypeDescriptionDefined in
inputunknownThe (not yet validated) workflow input.packages/client/src/interceptors.ts:62
operation"startWorkflow" | "executeWorkflow"Workflow-lifecycle operations.packages/client/src/interceptors.ts:58
workflowIdstring-packages/client/src/interceptors.ts:60
workflowNamestring-packages/client/src/interceptors.ts:59

Type Literal
ts
{
  input: unknown;
  operation: "signalWithStart";
  signalInput: unknown;
  signalName: string;
  workflowId: string;
  workflowName: string;
}
NameTypeDescriptionDefined in
inputunknownThe (not yet validated) workflow input.packages/client/src/interceptors.ts:69
operation"signalWithStart"-packages/client/src/interceptors.ts:65
signalInputunknownThe (not yet validated) signal input.packages/client/src/interceptors.ts:72
signalNamestring-packages/client/src/interceptors.ts:70
workflowIdstring-packages/client/src/interceptors.ts:67
workflowNamestring-packages/client/src/interceptors.ts:66

Type Literal
ts
{
  input: unknown;
  name: string;
  operation: "signal" | "query" | "update";
  workflowId: string;
  workflowName: string;
}
NameTypeDescriptionDefined in
inputunknownThe (not yet validated) payload.packages/client/src/interceptors.ts:82
namestringThe signal / query / update name on the contract.packages/client/src/interceptors.ts:80
operation"signal" | "query" | "update"Handle-level interactions with a running workflow.packages/client/src/interceptors.ts:76
workflowIdstring-packages/client/src/interceptors.ts:78
workflowNamestring-packages/client/src/interceptors.ts:77

ClientInterceptorNext

ts
type ClientInterceptorNext = (patch?) => AsyncResult<unknown, ClientCallError>;

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

Continuation invoked by a ClientInterceptor. An optional patch is shallow-merged over the current invocation (input, and signalInput for signalWithStart) before the next stage runs.

Parameters

ParameterType
patch?{ input?: unknown; signalInput?: unknown; }
patch.input?unknown
patch.signalInput?unknown

Returns

AsyncResult<unknown, ClientCallError>


ContractErrorUnion

ts
type ContractErrorUnion<TErrors> = { [K in keyof TErrors & string]: ContractError<K, InferErrorData<TErrors[K]>> }[keyof TErrors & string];

Defined in: packages/contract/dist/errors.d.mts:74

Consumer-side union of ContractError instances for a declared errors map — data is typed with each schema's output (post-transform) shape. This is the union surfaced on the error channel of workflow-side activity calls and client-side workflow results.

Type Parameters

Type Parameter
TErrors extends Record<string, ErrorDefinition>

CreateTypedClientOptions

ts
type CreateTypedClientOptions<TContract> = object;

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

Options for TypedClient.create — the single options-object shape shared by the org's Typed*.create() factories.

Type Parameters

Type Parameter
TContract extends ContractDefinition

Properties

PropertyTypeDescriptionDefined in
clientClientThe underlying @temporalio/client Client.packages/client/src/client.ts:379
contractTContractThe contract this client is typed against.packages/client/src/client.ts:377
interceptors?readonly ClientInterceptor[]Client-side interceptors wrapping startWorkflow / executeWorkflow / signalWithStart and handle-level signal / query / update, outermost-first. See ClientInterceptor.packages/client/src/client.ts:385

TemporalFailure

ts
type TemporalFailure = 
  | ApplicationFailure
  | CancelledFailure
  | TerminatedFailure
  | TimeoutFailure
  | ChildWorkflowFailure
  | ServerFailure
  | ActivityFailure;

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

Union of the actionable Temporal failure types that can surface as the cause of a WorkflowFailedError. These all extend Temporal's internal TemporalFailure base class — we list them by leaf type rather than by the base class so consumer code can use a single switch (true) over instanceof discriminants without an exhaustiveness escape hatch.

Re-exported from the package entry point so consumers can import it directly: import type { TemporalFailure } from "@temporal-contract/client".


TypedScheduleActionOverrides

ts
type TypedScheduleActionOverrides = Pick<ScheduleOptionsStartWorkflowAction<never>, 
  | "workflowId"
  | "workflowExecutionTimeout"
  | "workflowRunTimeout"
  | "workflowTaskTimeout"
  | "retry"
  | "memo"
  | "staticDetails"
  | "staticSummary">;

Defined in: packages/client/src/schedule.ts:27

Workflow-action–level overrides forwarded to Temporal's ScheduleOptionsStartWorkflowAction. These live under a nested action field so the workflow-level memo (per-action workflow metadata) can be set independently from the schedule-level memo (metadata on the schedule itself) — Temporal honours both, and they have separate lifecycles.

workflowType and taskQueue are owned by the contract and not exposed.


TypedScheduleCreateOptions

ts
type TypedScheduleCreateOptions<TContract, TWorkflowName> = object;

Defined in: packages/client/src/schedule.ts:48

Options for TypedScheduleClient.create.

scheduleId and spec come from Temporal's ScheduleOptions. args is typed against the destination workflow's input schema. policies, state, and memo mirror Temporal's own schedule-level options. Workflow-action–level overrides nest under action so memo and other fields with the same name don't collide between the two scopes.

Type Parameters

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

Properties

PropertyTypeDescriptionDefined in
action?TypedScheduleActionOverridesWorkflow-action–level overrides. workflowType and taskQueue are derived from the contract, so they don't appear here. Note that action.memo is a workflow-level memo applied to each spawned run, distinct from the top-level memo (which is metadata on the schedule itself).packages/client/src/schedule.ts:80
argsClientInferInput<TContract["workflows"][TWorkflowName]>Workflow input — validated against the contract's input schema.packages/client/src/schedule.ts:57
memo?ScheduleOptions["memo"]Schedule-level memo (non-indexed metadata on the schedule itself).packages/client/src/schedule.ts:72
policies?ScheduleOptions["policies"]Temporal schedule policies (overlap, catchupWindow, pauseOnFailure, etc.).packages/client/src/schedule.ts:68
scheduleIdstringSchedule ID. Recommended to use a meaningful business identifier.packages/client/src/schedule.ts:53
searchAttributes?TypedSearchAttributeMap<TContract["workflows"][TWorkflowName]>Indexed search attributes for each workflow run spawned by this schedule. Keys and value types are constrained to those declared on the destination workflow's contract via defineSearchAttribute. Translated to Temporal's typedSearchAttributes and attached to the schedule's startWorkflow action so each spawned run is indexed identically to one started directly via client.startWorkflow.packages/client/src/schedule.ts:66
specScheduleSpecWhen the schedule should fire (cron, interval, calendar).packages/client/src/schedule.ts:55
state?ScheduleOptions["state"]Temporal schedule state (paused, note, limited, etc.).packages/client/src/schedule.ts:70

TypedScheduleHandle

ts
type TypedScheduleHandle = object;

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

Typed handle to a schedule. Mirrors Temporal's ScheduleHandle lifecycle methods (pause, unpause, trigger, describe, delete) wrapped in the unthrown AsyncResult pattern so call sites match the rest of the typed client.

Properties

PropertyModifierTypeDescriptionDefined in
deletepublic() => AsyncResult<void, RuntimeClientError>Delete the schedule.packages/client/src/schedule.ts:99
describepublic() => AsyncResult<ScheduleDescription, RuntimeClientError>Fetch the schedule's current description from the server.packages/client/src/schedule.ts:101
pausepublic(note?) => AsyncResult<void, RuntimeClientError>Pause the schedule. Optional note becomes part of the audit trail.packages/client/src/schedule.ts:93
scheduleIdreadonlystringThis schedule's identifier.packages/client/src/schedule.ts:91
triggerpublic(overlap?) => AsyncResult<void, RuntimeClientError>Fire the schedule's action immediately.packages/client/src/schedule.ts:97
unpausepublic(note?) => AsyncResult<void, RuntimeClientError>Resume a paused schedule.packages/client/src/schedule.ts:95

TypedSearchAttributeMap

ts
type TypedSearchAttributeMap<TWorkflow> = TWorkflow["searchAttributes"] extends Record<string, SearchAttributeDefinition> ? { [K in keyof TWorkflow["searchAttributes"]]?: SearchAttributeKindToType<TWorkflow["searchAttributes"][K]["kind"]> } : never;

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

Type Parameters

Type Parameter
TWorkflow extends AnyWorkflowDefinition

TypedSignalWithStartOptions

ts
type TypedSignalWithStartOptions<TContract, TWorkflowName, TSignalName> = Omit<WorkflowSignalWithStartOptions, 
  | "taskQueue"
  | "args"
  | "signal"
  | "signalArgs"
  | "searchAttributes"
  | "typedSearchAttributes"> & object;

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

Options for TypedClient.signalWithStart — typed against both the workflow's input schema and the named signal's input schema.

Type Declaration

NameTypeDescriptionDefined in
argsClientInferInput<TContract["workflows"][TWorkflowName]>-packages/client/src/client.ts:168
searchAttributes?TypedSearchAttributeMap<TContract["workflows"][TWorkflowName]>Indexed search attributes for the started workflow. Keys and value types are constrained to those declared on the workflow's contract via defineSearchAttribute. Translated to Temporal's typedSearchAttributes before the signalWithStart request is dispatched.packages/client/src/client.ts:179
signalArgsTContract["workflows"][TWorkflowName]["signals"][TSignalName] extends SignalDefinition ? ClientInferInput<TContract["workflows"][TWorkflowName]["signals"][TSignalName]> : never-packages/client/src/client.ts:170
signalNameTSignalName-packages/client/src/client.ts:169

Type Parameters

Type Parameter
TContract extends ContractDefinition
TWorkflowName extends keyof TContract["workflows"] & string
TSignalName extends SignalNamesOf<TContract["workflows"][TWorkflowName]>

TypedWorkflowHandle

ts
type TypedWorkflowHandle<TWorkflow> = object;

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

Typed workflow handle with validated results using unthrown Result/AsyncResult

Type Parameters

Type Parameter
TWorkflow extends AnyWorkflowDefinition

Properties

PropertyTypeDescriptionDefined in
cancel() => AsyncResult<void, | WorkflowExecutionNotFoundError | RuntimeClientError>Cancel workflow with Result patternpackages/client/src/client.ts:279
describe() => AsyncResult<Awaited<ReturnType<WorkflowHandle["describe"]>>, | WorkflowExecutionNotFoundError | RuntimeClientError>Get workflow execution description including status and metadatapackages/client/src/client.ts:284
fetchHistory() => AsyncResult<Awaited<ReturnType<WorkflowHandle["fetchHistory"]>>, | WorkflowExecutionNotFoundError | RuntimeClientError>Fetch the workflow execution historypackages/client/src/client.ts:292
queries{ [K in keyof ClientInferWorkflowQueries<TWorkflow>]: ClientInferWorkflowQueries<TWorkflow>[K] extends (args: infer Args) => AsyncResult<infer R, Error> ? (args: Args) => AsyncResult<R, QueryValidationError | WorkflowExecutionNotFoundError | RuntimeClientError> : never }Type-safe queries based on workflow definition with Result pattern Each query returns AsyncResult<T, Error> instead of Promise<T>packages/client/src/client.ts:207
result() => AsyncResult<ClientInferOutput<TWorkflow>, | WorkflowContractErrorsOf<TWorkflow> | WorkflowValidationError | WorkflowFailedError | WorkflowExecutionNotFoundError | RuntimeClientError>Get workflow result with Result pattern. When the workflow declares contract errors, a failed execution whose failure matches a declared error surfaces as that typed error instead of the generic WorkflowFailedError.packages/client/src/client.ts:260
signals{ [K in keyof ClientInferWorkflowSignals<TWorkflow>]: ClientInferWorkflowSignals<TWorkflow>[K] extends (args: infer Args) => AsyncResult<void, Error> ? (args: Args) => AsyncResult<void, SignalValidationError | WorkflowExecutionNotFoundError | RuntimeClientError> : never }Type-safe signals based on workflow definition with Result pattern Each signal returns AsyncResult<void, Error> instead of Promise<void>packages/client/src/client.ts:224
terminate(reason?) => AsyncResult<void, | WorkflowExecutionNotFoundError | RuntimeClientError>Terminate workflow with Result patternpackages/client/src/client.ts:272
updates{ [K in keyof ClientInferWorkflowUpdates<TWorkflow>]: ClientInferWorkflowUpdates<TWorkflow>[K] extends (args: infer Args) => AsyncResult<infer R, Error> ? (args: Args) => AsyncResult<R, UpdateValidationError | WorkflowExecutionNotFoundError | RuntimeClientError> : never }Type-safe updates based on workflow definition with Result pattern Each update returns AsyncResult<T, Error> instead of Promise<T>packages/client/src/client.ts:241
workflowIdstring-packages/client/src/client.ts:201

TypedWorkflowHandleWithSignaledRunId

ts
type TypedWorkflowHandleWithSignaledRunId<TWorkflow> = TypedWorkflowHandle<TWorkflow> & object;

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

Typed workflow handle returned by signalWithStart. Adds signaledRunId to the standard handle so callers can correlate the signal with the (possibly pre-existing) workflow execution chain.

Type Declaration

NameTypeDescriptionDefined in
signaledRunIdstringThe Run Id of the bound Workflow at the time of signalWithStart. Since signalWithStart may have signaled an existing Workflow Chain, this is not necessarily the firstExecutionRunId.packages/client/src/client.ts:194

Type Parameters

Type Parameter
TWorkflow extends AnyWorkflowDefinition

TypedWorkflowStartOptions

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

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

Type Declaration

NameTypeDescriptionDefined in
argsClientInferInput<TContract["workflows"][TWorkflowName]>-packages/client/src/client.ts:146
searchAttributes?TypedSearchAttributeMap<TContract["workflows"][TWorkflowName]>Indexed search attributes for the started workflow. Keys and value types are constrained to those declared on the workflow's contract via defineSearchAttribute. Translated to Temporal's typedSearchAttributes before the start request is dispatched.packages/client/src/client.ts:153

Type Parameters

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

WorkflowContractErrorsOf

ts
type WorkflowContractErrorsOf<TWorkflow> = TWorkflow extends object ? ContractErrorUnion<TErrors> : never;

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

Union of typed ContractErrors declared on a workflow's errors map, or never when the workflow declares none — in which case the member simply vanishes from the surfaced error union.

Surfaced by executeWorkflow and handle.result() when the execution failed with a matching ApplicationFailure (type = declared error name, details[0] validating against the declared data schema).

Type Parameters

Type Parameter
TWorkflow extends AnyWorkflowDefinition

Functions

readTypedSearchAttributes()

ts
function readTypedSearchAttributes<TWorkflow>(workflowDef, instance): Partial<TypedSearchAttributeMap<TWorkflow>>;

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

Read declared search attributes off a TypedSearchAttributes instance — the read-side counterpart to the write-side searchAttributes option on startWorkflow / signalWithStart / executeWorkflow / schedule.create.

Use it on the result of handle.describe() (or a schedule's describe) to recover the typed shape of indexed attributes. The Temporal SDK only exposes a .get(key) accessor on TypedSearchAttributes and requires the caller to reconstruct each SearchAttributeKey from the contract's declared kind — this helper does that lookup once for every declared attribute, returning a Partial<TypedSearchAttributeMap<TWorkflow>> (each declared key may or may not have been set on the workflow).

Workflows without declared searchAttributes get an empty object back.

Type Parameters

Type Parameter
TWorkflow extends AnyWorkflowDefinition

Parameters

ParameterType
workflowDefTWorkflow
instanceTypedSearchAttributes

Returns

Partial<TypedSearchAttributeMap<TWorkflow>>

Example

ts
const description = await handle.describe();
if (description.isOk()) {
  const attrs = readTypedSearchAttributes(
    myContract.workflows.processOrder,
    description.value.typedSearchAttributes,
  );
  // attrs.customerId: string | undefined
  // attrs.priority:   number | undefined
}

Released under the MIT License.