@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:
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 Parameter | Default type |
|---|---|
TName extends string | string |
TData | unknown |
Constructors
Constructor
new ContractError<TName, TData>(args): ContractError<TName, TData>;Defined in: packages/contract/dist/errors.d.mts:47
Parameters
| Parameter | Type |
|---|---|
args | { cause?: unknown; data: TData; errorName: TName; message: string; } |
args.cause? | unknown |
args.data | TData |
args.errorName | TName |
args.message | string |
Returns
ContractError<TName, TData>
Overrides
ContractError_base<{
/ Declared error name — the ApplicationFailure.type discriminator. /errorName: TName; / Structured payload validated against the declared data schema. /
data: TData;
cause?: unknown;
}>.constructorProperties
| Property | Modifier | Type | Description | Inherited from | Defined in |
|---|---|---|---|---|---|
_tag | readonly | "@temporal-contract/ContractError" | - | ContractError_base._tag | node_modules/.pnpm/unthrown@4.1.0/node_modules/unthrown/dist/index.d.mts:1456 |
cause? | public | unknown | - | WorkflowNotFoundError.cause | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24 |
data | readonly | TData | - | ContractError_base.data | packages/contract/dist/errors.d.mts:44 |
errorName | readonly | TName | Declared error name — the ApplicationFailure.type discriminator. | ContractError_base.errorName | packages/contract/dist/errors.d.mts:43 |
message | public | string | - | ContractError_base.message | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075 |
name | public | string | - | ContractError_base.name | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074 |
stack? | public | string | - | ContractError_base.stack | node_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: readonlyIssue[];queryName:string; }>
Constructors
Constructor
new QueryValidationError(
queryName,
direction,
issues): QueryValidationError;Defined in: packages/client/src/errors.ts:185
Parameters
| Parameter | Type |
|---|---|
queryName | string |
direction | "input" | "output" |
issues | readonly Issue[] |
Returns
Overrides
TaggedError("@temporal-contract/QueryValidationError", {
name: "QueryValidationError",
})<{
queryName: string;
direction: "input" | "output";
issues: ReadonlyArray<StandardSchemaV1.Issue>;
}>.constructorProperties
| Property | Modifier | Type | Inherited from | Defined in |
|---|---|---|---|---|
_tag | readonly | "@temporal-contract/QueryValidationError" | TaggedError("@temporal-contract/QueryValidationError", { name: "QueryValidationError", })._tag | node_modules/.pnpm/unthrown@4.1.0/node_modules/unthrown/dist/index.d.mts:1456 |
cause? | public | unknown | TaggedError("@temporal-contract/QueryValidationError", { name: "QueryValidationError", }).cause | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24 |
direction | readonly | "input" | "output" | TaggedError("@temporal-contract/QueryValidationError", { name: "QueryValidationError", }).direction | packages/client/src/errors.ts:182 |
issues | readonly | readonly Issue[] | TaggedError("@temporal-contract/QueryValidationError", { name: "QueryValidationError", }).issues | packages/client/src/errors.ts:183 |
message | public | string | TaggedError("@temporal-contract/QueryValidationError", { name: "QueryValidationError", }).message | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075 |
name | public | string | TaggedError("@temporal-contract/QueryValidationError", { name: "QueryValidationError", }).name | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074 |
queryName | readonly | string | TaggedError("@temporal-contract/QueryValidationError", { name: "QueryValidationError", }).queryName | packages/client/src/errors.ts:181 |
stack? | public | string | TaggedError("@temporal-contract/QueryValidationError", { name: "QueryValidationError", }).stack | node_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
new RuntimeClientError(operation, cause?): RuntimeClientError;Defined in: packages/client/src/errors.ts:42
Parameters
| Parameter | Type |
|---|---|
operation | string |
cause? | unknown |
Returns
Overrides
TaggedError("@temporal-contract/RuntimeClientError", {
name: "RuntimeClientError",
})<{
operation: string;
cause?: unknown;
}>.constructorProperties
| Property | Modifier | Type | Inherited from | Defined in |
|---|---|---|---|---|
_tag | readonly | "@temporal-contract/RuntimeClientError" | TaggedError("@temporal-contract/RuntimeClientError", { name: "RuntimeClientError", })._tag | node_modules/.pnpm/unthrown@4.1.0/node_modules/unthrown/dist/index.d.mts:1456 |
cause? | public | unknown | WorkflowNotFoundError.cause | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24 |
message | public | string | TaggedError("@temporal-contract/RuntimeClientError", { name: "RuntimeClientError", }).message | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075 |
name | public | string | TaggedError("@temporal-contract/RuntimeClientError", { name: "RuntimeClientError", }).name | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074 |
operation | readonly | string | TaggedError("@temporal-contract/RuntimeClientError", { name: "RuntimeClientError", }).operation | packages/client/src/errors.ts:39 |
stack? | public | string | TaggedError("@temporal-contract/RuntimeClientError", { name: "RuntimeClientError", }).stack | node_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: readonlyIssue[];signalName:string; }>
Constructors
Constructor
new SignalValidationError(signalName, issues): SignalValidationError;Defined in: packages/client/src/errors.ts:204
Parameters
| Parameter | Type |
|---|---|
signalName | string |
issues | readonly Issue[] |
Returns
Overrides
TaggedError("@temporal-contract/SignalValidationError", {
name: "SignalValidationError",
})<{
signalName: string;
issues: ReadonlyArray<StandardSchemaV1.Issue>;
}>.constructorProperties
| Property | Modifier | Type | Inherited from | Defined in |
|---|---|---|---|---|
_tag | readonly | "@temporal-contract/SignalValidationError" | TaggedError("@temporal-contract/SignalValidationError", { name: "SignalValidationError", })._tag | node_modules/.pnpm/unthrown@4.1.0/node_modules/unthrown/dist/index.d.mts:1456 |
cause? | public | unknown | TaggedError("@temporal-contract/SignalValidationError", { name: "SignalValidationError", }).cause | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24 |
issues | readonly | readonly Issue[] | TaggedError("@temporal-contract/SignalValidationError", { name: "SignalValidationError", }).issues | packages/client/src/errors.ts:202 |
message | public | string | TaggedError("@temporal-contract/SignalValidationError", { name: "SignalValidationError", }).message | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075 |
name | public | string | TaggedError("@temporal-contract/SignalValidationError", { name: "SignalValidationError", }).name | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074 |
signalName | readonly | string | TaggedError("@temporal-contract/SignalValidationError", { name: "SignalValidationError", }).signalName | packages/client/src/errors.ts:201 |
stack? | public | string | TaggedError("@temporal-contract/SignalValidationError", { name: "SignalValidationError", }).stack | node_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
new TechnicalError(message, cause?): TechnicalError;Defined in: packages/contract/dist/errors.d.mts:18
Parameters
| Parameter | Type |
|---|---|
message | string |
cause? | unknown |
Returns
Overrides
TechnicalError_base<{
cause?: unknown;
}>.constructorProperties
| Property | Modifier | Type | Inherited from | Defined in |
|---|---|---|---|---|
_tag | readonly | "@temporal-contract/TechnicalError" | TechnicalError_base._tag | node_modules/.pnpm/unthrown@4.1.0/node_modules/unthrown/dist/index.d.mts:1456 |
cause? | public | unknown | WorkflowNotFoundError.cause | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24 |
message | public | string | TechnicalError_base.message | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075 |
name | public | string | TechnicalError_base.name | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074 |
stack? | public | string | TechnicalError_base.stack | node_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
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
schedule | readonly | TypedScheduleClient<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()
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
| Parameter | Type |
|---|---|
workflowName | TWorkflowName |
__namedParameters | TypedWorkflowStartOptions<TContract, TWorkflowName> |
Returns
AsyncResult<ClientInferOutput<TContract["workflows"][TWorkflowName]>, | WorkflowNotFoundError | WorkflowValidationError | WorkflowAlreadyStartedError | RuntimeClientError | WorkflowContractErrorsOf<TContract["workflows"][TWorkflowName]> | WorkflowFailedError | WorkflowExecutionNotFoundError>
Example
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()
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
| Parameter | Type |
|---|---|
workflowName | TWorkflowName |
workflowId | string |
Returns
AsyncResult<TypedWorkflowHandle<TContract["workflows"][TWorkflowName]>, | WorkflowNotFoundError | RuntimeClientError>
Example
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()
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:
argsagainst the workflow's input schemasignalArgsagainst 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
| Parameter | Type |
|---|---|
workflowName | TWorkflowName |
__namedParameters | TypedSignalWithStartOptions<TContract, TWorkflowName, TSignalName> |
Returns
AsyncResult<TypedWorkflowHandleWithSignaledRunId<TContract["workflows"][TWorkflowName]>, | WorkflowNotFoundError | WorkflowValidationError | WorkflowAlreadyStartedError | RuntimeClientError | SignalValidationError>
Example
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()
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
| Parameter | Type |
|---|---|
workflowName | TWorkflowName |
__namedParameters | TypedWorkflowStartOptions<TContract, TWorkflowName> |
Returns
AsyncResult<TypedWorkflowHandle<TContract["workflows"][TWorkflowName]>, | WorkflowNotFoundError | WorkflowValidationError | WorkflowAlreadyStartedError | RuntimeClientError>
Example
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()
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
Clientlacks 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
| Parameter | Type |
|---|---|
__namedParameters | CreateTypedClientOptions<TContract> |
Returns
AsyncResult<TypedClient<TContract>, TechnicalError>
Example
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()
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
| Parameter | Type |
|---|---|
contract | TContract |
client | Client |
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
new TypedScheduleClient<TContract>(contract, scheduleClient): TypedScheduleClient<TContract>;Defined in: packages/client/src/schedule.ts:110
Parameters
| Parameter | Type |
|---|---|
contract | TContract |
scheduleClient | ScheduleClient |
Returns
TypedScheduleClient<TContract>
Methods
create()
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
| Parameter | Type |
|---|---|
workflowName | TWorkflowName |
options | TypedScheduleCreateOptions<TContract, TWorkflowName> |
Returns
AsyncResult<TypedScheduleHandle, | WorkflowNotFoundError | WorkflowValidationError | RuntimeClientError>
getHandle()
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
| Parameter | Type |
|---|---|
scheduleId | string |
Returns
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: readonlyIssue[];updateName:string; }>
Constructors
Constructor
new UpdateValidationError(
updateName,
direction,
issues): UpdateValidationError;Defined in: packages/client/src/errors.ts:220
Parameters
| Parameter | Type |
|---|---|
updateName | string |
direction | "input" | "output" |
issues | readonly Issue[] |
Returns
Overrides
TaggedError("@temporal-contract/UpdateValidationError", {
name: "UpdateValidationError",
})<{
updateName: string;
direction: "input" | "output";
issues: ReadonlyArray<StandardSchemaV1.Issue>;
}>.constructorProperties
| Property | Modifier | Type | Inherited from | Defined in |
|---|---|---|---|---|
_tag | readonly | "@temporal-contract/UpdateValidationError" | TaggedError("@temporal-contract/UpdateValidationError", { name: "UpdateValidationError", })._tag | node_modules/.pnpm/unthrown@4.1.0/node_modules/unthrown/dist/index.d.mts:1456 |
cause? | public | unknown | TaggedError("@temporal-contract/UpdateValidationError", { name: "UpdateValidationError", }).cause | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24 |
direction | readonly | "input" | "output" | TaggedError("@temporal-contract/UpdateValidationError", { name: "UpdateValidationError", }).direction | packages/client/src/errors.ts:217 |
issues | readonly | readonly Issue[] | TaggedError("@temporal-contract/UpdateValidationError", { name: "UpdateValidationError", }).issues | packages/client/src/errors.ts:218 |
message | public | string | TaggedError("@temporal-contract/UpdateValidationError", { name: "UpdateValidationError", }).message | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075 |
name | public | string | TaggedError("@temporal-contract/UpdateValidationError", { name: "UpdateValidationError", }).name | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074 |
stack? | public | string | TaggedError("@temporal-contract/UpdateValidationError", { name: "UpdateValidationError", }).stack | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076 |
updateName | readonly | string | TaggedError("@temporal-contract/UpdateValidationError", { name: "UpdateValidationError", }).updateName | packages/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
new WorkflowAlreadyStartedError(
workflowType,
workflowId,
cause?): WorkflowAlreadyStartedError;Defined in: packages/client/src/errors.ts:84
Parameters
| Parameter | Type |
|---|---|
workflowType | string |
workflowId | string |
cause? | unknown |
Returns
Overrides
TaggedError(
"@temporal-contract/WorkflowAlreadyStartedError",
{ name: "WorkflowAlreadyStartedError" },
)<{
workflowType: string;
workflowId: string;
cause?: unknown;
}>.constructorProperties
| Property | Modifier | Type | Inherited from | Defined in |
|---|---|---|---|---|
_tag | readonly | "@temporal-contract/WorkflowAlreadyStartedError" | TaggedError( "@temporal-contract/WorkflowAlreadyStartedError", { name: "WorkflowAlreadyStartedError" }, )._tag | node_modules/.pnpm/unthrown@4.1.0/node_modules/unthrown/dist/index.d.mts:1456 |
cause? | public | unknown | WorkflowNotFoundError.cause | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24 |
message | public | string | TaggedError( "@temporal-contract/WorkflowAlreadyStartedError", { name: "WorkflowAlreadyStartedError" }, ).message | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075 |
name | public | string | TaggedError( "@temporal-contract/WorkflowAlreadyStartedError", { name: "WorkflowAlreadyStartedError" }, ).name | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074 |
stack? | public | string | TaggedError( "@temporal-contract/WorkflowAlreadyStartedError", { name: "WorkflowAlreadyStartedError" }, ).stack | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076 |
workflowId | readonly | string | TaggedError( "@temporal-contract/WorkflowAlreadyStartedError", { name: "WorkflowAlreadyStartedError" }, ).workflowId | packages/client/src/errors.ts:81 |
workflowType | readonly | string | TaggedError( "@temporal-contract/WorkflowAlreadyStartedError", { name: "WorkflowAlreadyStartedError" }, ).workflowType | packages/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
new WorkflowExecutionNotFoundError(
workflowId,
runId?,
cause?): WorkflowExecutionNotFoundError;Defined in: packages/client/src/errors.ts:110
Parameters
| Parameter | Type |
|---|---|
workflowId | string |
runId? | string |
cause? | unknown |
Returns
WorkflowExecutionNotFoundError
Overrides
TaggedError(
"@temporal-contract/WorkflowExecutionNotFoundError",
{ name: "WorkflowExecutionNotFoundError" },
)<{
workflowId: string;
runId?: string | undefined;
cause?: unknown;
}>.constructorProperties
| Property | Modifier | Type | Inherited from | Defined in |
|---|---|---|---|---|
_tag | readonly | "@temporal-contract/WorkflowExecutionNotFoundError" | TaggedError( "@temporal-contract/WorkflowExecutionNotFoundError", { name: "WorkflowExecutionNotFoundError" }, )._tag | node_modules/.pnpm/unthrown@4.1.0/node_modules/unthrown/dist/index.d.mts:1456 |
cause? | public | unknown | WorkflowNotFoundError.cause | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24 |
message | public | string | TaggedError( "@temporal-contract/WorkflowExecutionNotFoundError", { name: "WorkflowExecutionNotFoundError" }, ).message | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075 |
name | public | string | TaggedError( "@temporal-contract/WorkflowExecutionNotFoundError", { name: "WorkflowExecutionNotFoundError" }, ).name | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074 |
runId? | readonly | string | TaggedError( "@temporal-contract/WorkflowExecutionNotFoundError", { name: "WorkflowExecutionNotFoundError" }, ).runId | packages/client/src/errors.ts:107 |
stack? | public | string | TaggedError( "@temporal-contract/WorkflowExecutionNotFoundError", { name: "WorkflowExecutionNotFoundError" }, ).stack | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076 |
workflowId | readonly | string | TaggedError( "@temporal-contract/WorkflowExecutionNotFoundError", { name: "WorkflowExecutionNotFoundError" }, ).workflowId | packages/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
new WorkflowFailedError(workflowId, cause?): WorkflowFailedError;Defined in: packages/client/src/errors.ts:141
Parameters
| Parameter | Type |
|---|---|
workflowId | string |
cause? | TemporalFailure |
Returns
Overrides
TaggedError("@temporal-contract/WorkflowFailedError", {
name: "WorkflowFailedError",
})<{
workflowId: string;
cause?: TemporalFailure | undefined;
}>.constructorProperties
| Property | Modifier | Type | Inherited from | Defined in |
|---|---|---|---|---|
_tag | readonly | "@temporal-contract/WorkflowFailedError" | TaggedError("@temporal-contract/WorkflowFailedError", { name: "WorkflowFailedError", })._tag | node_modules/.pnpm/unthrown@4.1.0/node_modules/unthrown/dist/index.d.mts:1456 |
cause? | public | TemporalFailure | WorkflowNotFoundError.cause | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24 |
message | public | string | TaggedError("@temporal-contract/WorkflowFailedError", { name: "WorkflowFailedError", }).message | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075 |
name | public | string | TaggedError("@temporal-contract/WorkflowFailedError", { name: "WorkflowFailedError", }).name | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074 |
stack? | public | string | TaggedError("@temporal-contract/WorkflowFailedError", { name: "WorkflowFailedError", }).stack | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076 |
workflowId | readonly | string | TaggedError("@temporal-contract/WorkflowFailedError", { name: "WorkflowFailedError", }).workflowId | packages/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
new WorkflowNotFoundError(workflowName, availableWorkflows): WorkflowNotFoundError;Defined in: packages/client/src/errors.ts:59
Parameters
| Parameter | Type |
|---|---|
workflowName | string |
availableWorkflows | string[] |
Returns
Overrides
TaggedError("@temporal-contract/WorkflowNotFoundError", {
name: "WorkflowNotFoundError",
})<{
workflowName: string;
availableWorkflows: string[];
}>.constructorProperties
| Property | Modifier | Type | Inherited from | Defined in |
|---|---|---|---|---|
_tag | readonly | "@temporal-contract/WorkflowNotFoundError" | TaggedError("@temporal-contract/WorkflowNotFoundError", { name: "WorkflowNotFoundError", })._tag | node_modules/.pnpm/unthrown@4.1.0/node_modules/unthrown/dist/index.d.mts:1456 |
availableWorkflows | readonly | string[] | TaggedError("@temporal-contract/WorkflowNotFoundError", { name: "WorkflowNotFoundError", }).availableWorkflows | packages/client/src/errors.ts:57 |
cause? | public | unknown | TaggedError("@temporal-contract/WorkflowNotFoundError", { name: "WorkflowNotFoundError", }).cause | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24 |
message | public | string | TaggedError("@temporal-contract/WorkflowNotFoundError", { name: "WorkflowNotFoundError", }).message | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075 |
name | public | string | TaggedError("@temporal-contract/WorkflowNotFoundError", { name: "WorkflowNotFoundError", }).name | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074 |
stack? | public | string | TaggedError("@temporal-contract/WorkflowNotFoundError", { name: "WorkflowNotFoundError", }).stack | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076 |
workflowName | readonly | string | TaggedError("@temporal-contract/WorkflowNotFoundError", { name: "WorkflowNotFoundError", }).workflowName | packages/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: readonlyIssue[];workflowName:string; }>
Constructors
Constructor
new WorkflowValidationError(
workflowName,
direction,
issues): WorkflowValidationError;Defined in: packages/client/src/errors.ts:165
Parameters
| Parameter | Type |
|---|---|
workflowName | string |
direction | "input" | "output" |
issues | readonly Issue[] |
Returns
Overrides
TaggedError(
"@temporal-contract/WorkflowValidationError",
{ name: "WorkflowValidationError" },
)<{
workflowName: string;
direction: "input" | "output";
issues: ReadonlyArray<StandardSchemaV1.Issue>;
}>.constructorProperties
| Property | Modifier | Type | Inherited from | Defined in |
|---|---|---|---|---|
_tag | readonly | "@temporal-contract/WorkflowValidationError" | TaggedError( "@temporal-contract/WorkflowValidationError", { name: "WorkflowValidationError" }, )._tag | node_modules/.pnpm/unthrown@4.1.0/node_modules/unthrown/dist/index.d.mts:1456 |
cause? | public | unknown | TaggedError( "@temporal-contract/WorkflowValidationError", { name: "WorkflowValidationError" }, ).cause | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24 |
direction | readonly | "input" | "output" | TaggedError( "@temporal-contract/WorkflowValidationError", { name: "WorkflowValidationError" }, ).direction | packages/client/src/errors.ts:162 |
issues | readonly | readonly Issue[] | TaggedError( "@temporal-contract/WorkflowValidationError", { name: "WorkflowValidationError" }, ).issues | packages/client/src/errors.ts:163 |
message | public | string | TaggedError( "@temporal-contract/WorkflowValidationError", { name: "WorkflowValidationError" }, ).message | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075 |
name | public | string | TaggedError( "@temporal-contract/WorkflowValidationError", { name: "WorkflowValidationError" }, ).name | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074 |
stack? | public | string | TaggedError( "@temporal-contract/WorkflowValidationError", { name: "WorkflowValidationError" }, ).stack | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076 |
workflowName | readonly | string | TaggedError( "@temporal-contract/WorkflowValidationError", { name: "WorkflowValidationError" }, ).workflowName | packages/client/src/errors.ts:161 |
Type Aliases
AnyContractError
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
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
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
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
| Parameter | Type |
|---|---|
args | ClientInferInput<TActivity> |
Returns
Promise<ClientInferOutput<TActivity>>
ClientInferInput
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
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
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
| Parameter | Type |
|---|---|
args | ClientInferInput<TQuery> |
Returns
AsyncResult<ClientInferOutput<TQuery>, Error>
ClientInferSignal
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
| Parameter | Type |
|---|---|
args | ClientInferInput<TSignal> |
Returns
AsyncResult<void, Error>
ClientInferUpdate
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
| Parameter | Type |
|---|---|
args | ClientInferInput<TUpdate> |
Returns
AsyncResult<ClientInferOutput<TUpdate>, Error>
ClientInferWorkflow
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
| Parameter | Type |
|---|---|
args | ClientInferInput<TWorkflow> |
Returns
Promise<ClientInferOutput<TWorkflow>>
ClientInferWorkflowActivities
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
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
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
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
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
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
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
| Parameter | Type |
|---|---|
args | ClientInterceptorArgs |
next | ClientInterceptorNext |
Returns
AsyncResult<unknown, ClientCallError>
Example
Retry a transient failure once
const retryOnce: ClientInterceptor = (args, next) =>
next().flatMapErr((error) =>
error instanceof RuntimeClientError ? next() : Err(error).toAsync(),
);ClientInterceptorArgs
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
{
input: unknown;
operation: "startWorkflow" | "executeWorkflow";
workflowId: string;
workflowName: string;
}| Name | Type | Description | Defined in |
|---|---|---|---|
input | unknown | The (not yet validated) workflow input. | packages/client/src/interceptors.ts:62 |
operation | "startWorkflow" | "executeWorkflow" | Workflow-lifecycle operations. | packages/client/src/interceptors.ts:58 |
workflowId | string | - | packages/client/src/interceptors.ts:60 |
workflowName | string | - | packages/client/src/interceptors.ts:59 |
Type Literal
{
input: unknown;
operation: "signalWithStart";
signalInput: unknown;
signalName: string;
workflowId: string;
workflowName: string;
}| Name | Type | Description | Defined in |
|---|---|---|---|
input | unknown | The (not yet validated) workflow input. | packages/client/src/interceptors.ts:69 |
operation | "signalWithStart" | - | packages/client/src/interceptors.ts:65 |
signalInput | unknown | The (not yet validated) signal input. | packages/client/src/interceptors.ts:72 |
signalName | string | - | packages/client/src/interceptors.ts:70 |
workflowId | string | - | packages/client/src/interceptors.ts:67 |
workflowName | string | - | packages/client/src/interceptors.ts:66 |
Type Literal
{
input: unknown;
name: string;
operation: "signal" | "query" | "update";
workflowId: string;
workflowName: string;
}| Name | Type | Description | Defined in |
|---|---|---|---|
input | unknown | The (not yet validated) payload. | packages/client/src/interceptors.ts:82 |
name | string | The 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 |
workflowId | string | - | packages/client/src/interceptors.ts:78 |
workflowName | string | - | packages/client/src/interceptors.ts:77 |
ClientInterceptorNext
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
| Parameter | Type |
|---|---|
patch? | { input?: unknown; signalInput?: unknown; } |
patch.input? | unknown |
patch.signalInput? | unknown |
Returns
AsyncResult<unknown, ClientCallError>
ContractErrorUnion
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
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
| Property | Type | Description | Defined in |
|---|---|---|---|
client | Client | The underlying @temporalio/client Client. | packages/client/src/client.ts:379 |
contract | TContract | The 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
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
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
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
| Property | Type | Description | Defined in |
|---|---|---|---|
action? | TypedScheduleActionOverrides | Workflow-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 |
args | ClientInferInput<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 |
scheduleId | string | Schedule 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 |
spec | ScheduleSpec | When 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
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
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
delete | public | () => AsyncResult<void, RuntimeClientError> | Delete the schedule. | packages/client/src/schedule.ts:99 |
describe | public | () => AsyncResult<ScheduleDescription, RuntimeClientError> | Fetch the schedule's current description from the server. | packages/client/src/schedule.ts:101 |
pause | public | (note?) => AsyncResult<void, RuntimeClientError> | Pause the schedule. Optional note becomes part of the audit trail. | packages/client/src/schedule.ts:93 |
scheduleId | readonly | string | This schedule's identifier. | packages/client/src/schedule.ts:91 |
trigger | public | (overlap?) => AsyncResult<void, RuntimeClientError> | Fire the schedule's action immediately. | packages/client/src/schedule.ts:97 |
unpause | public | (note?) => AsyncResult<void, RuntimeClientError> | Resume a paused schedule. | packages/client/src/schedule.ts:95 |
TypedSearchAttributeMap
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
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
| Name | Type | Description | Defined in |
|---|---|---|---|
args | ClientInferInput<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 |
signalArgs | TContract["workflows"][TWorkflowName]["signals"][TSignalName] extends SignalDefinition ? ClientInferInput<TContract["workflows"][TWorkflowName]["signals"][TSignalName]> : never | - | packages/client/src/client.ts:170 |
signalName | TSignalName | - | 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
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
| Property | Type | Description | Defined in |
|---|---|---|---|
cancel | () => AsyncResult<void, | WorkflowExecutionNotFoundError | RuntimeClientError> | Cancel workflow with Result pattern | packages/client/src/client.ts:279 |
describe | () => AsyncResult<Awaited<ReturnType<WorkflowHandle["describe"]>>, | WorkflowExecutionNotFoundError | RuntimeClientError> | Get workflow execution description including status and metadata | packages/client/src/client.ts:284 |
fetchHistory | () => AsyncResult<Awaited<ReturnType<WorkflowHandle["fetchHistory"]>>, | WorkflowExecutionNotFoundError | RuntimeClientError> | Fetch the workflow execution history | packages/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 pattern | packages/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 |
workflowId | string | - | packages/client/src/client.ts:201 |
TypedWorkflowHandleWithSignaledRunId
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
| Name | Type | Description | Defined in |
|---|---|---|---|
signaledRunId | string | The 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
type TypedWorkflowStartOptions<TContract, TWorkflowName> = Omit<WorkflowStartOptions, "taskQueue" | "args" | "searchAttributes" | "typedSearchAttributes"> & object;Defined in: packages/client/src/client.ts:139
Type Declaration
| Name | Type | Description | Defined in |
|---|---|---|---|
args | ClientInferInput<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
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()
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
| Parameter | Type |
|---|---|
workflowDef | TWorkflow |
instance | TypedSearchAttributes |
Returns
Partial<TypedSearchAttributeMap<TWorkflow>>
Example
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
}