@temporal-contract/client
@temporal-contract/client
Classes
ActivityAlreadyStartedError
Defined in: packages/client/src/errors.ts:485
Surfaced on the Err channel when starting a standalone activity collides with a running execution under the same activity ID — Temporal's ActivityExecutionAlreadyStartedError (the default idConflictPolicy: "FAIL"), or a closed one the idReusePolicy rejects.
Extends
TaggedErrorInstance<"@temporal-contract/ActivityAlreadyStartedError", {activityId:string;activityType:string;cause?:unknown; }>
Constructors
Constructor
new ActivityAlreadyStartedError(
activityType,
activityId,
cause?
): ActivityAlreadyStartedError;Defined in: packages/client/src/errors.ts:492
Parameters
| Parameter | Type |
|---|---|
activityType | string |
activityId | string |
cause? | unknown |
Returns
Overrides
TaggedError(ACTIVITY_ALREADY_STARTED_ERROR_TAG, {
name: "ActivityAlreadyStartedError",
})<{
activityType: string;
activityId: string;
cause?: unknown;
}>.constructorProperties
| Property | Modifier | Type | Inherited from | Defined in |
|---|---|---|---|---|
_tag | readonly | "@temporal-contract/ActivityAlreadyStartedError" | TaggedError(ACTIVITY_ALREADY_STARTED_ERROR_TAG, { name: "ActivityAlreadyStartedError", })._tag | node_modules/.pnpm/unthrown@5.11.0/node_modules/unthrown/dist/index.d.mts:2332 |
activityId | readonly | string | TaggedError(ACTIVITY_ALREADY_STARTED_ERROR_TAG, { name: "ActivityAlreadyStartedError", }).activityId | packages/client/src/errors.ts:489 |
activityType | readonly | string | TaggedError(ACTIVITY_ALREADY_STARTED_ERROR_TAG, { name: "ActivityAlreadyStartedError", }).activityType | packages/client/src/errors.ts:488 |
cause? | public | unknown | ActivityValidationError.cause | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24 |
message | public | string | TaggedError(ACTIVITY_ALREADY_STARTED_ERROR_TAG, { name: "ActivityAlreadyStartedError", }).message | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075 |
name | public | string | TaggedError(ACTIVITY_ALREADY_STARTED_ERROR_TAG, { name: "ActivityAlreadyStartedError", }).name | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074 |
stack? | public | string | TaggedError(ACTIVITY_ALREADY_STARTED_ERROR_TAG, { name: "ActivityAlreadyStartedError", }).stack | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076 |
ActivityCancelledError
Defined in: packages/client/src/errors.ts:545
Surfaced on the Err channel when the awaited standalone activity ended Canceled. cause keeps the original CancelledFailure. Like WorkflowCancelledError, give it its own matcher arm so a deliberate cancel isn't reported as a breakage.
Extends
TaggedErrorInstance<"@temporal-contract/ActivityCancelledError", {activityId:string;cause?:CancelledFailure; }>
Constructors
Constructor
new ActivityCancelledError(activityId, cause?): ActivityCancelledError;Defined in: packages/client/src/errors.ts:551
Parameters
| Parameter | Type |
|---|---|
activityId | string |
cause? | CancelledFailure |
Returns
Overrides
TaggedError(ACTIVITY_CANCELLED_ERROR_TAG, {
name: "ActivityCancelledError",
})<{
activityId: string;
cause?: CancelledFailure | undefined;
}>.constructorProperties
| Property | Modifier | Type | Inherited from | Defined in |
|---|---|---|---|---|
_tag | readonly | "@temporal-contract/ActivityCancelledError" | TaggedError(ACTIVITY_CANCELLED_ERROR_TAG, { name: "ActivityCancelledError", })._tag | node_modules/.pnpm/unthrown@5.11.0/node_modules/unthrown/dist/index.d.mts:2332 |
activityId | readonly | string | TaggedError(ACTIVITY_CANCELLED_ERROR_TAG, { name: "ActivityCancelledError", }).activityId | packages/client/src/errors.ts:548 |
cause? | public | CancelledFailure | ActivityValidationError.cause | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24 |
message | public | string | TaggedError(ACTIVITY_CANCELLED_ERROR_TAG, { name: "ActivityCancelledError", }).message | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075 |
name | public | string | TaggedError(ACTIVITY_CANCELLED_ERROR_TAG, { name: "ActivityCancelledError", }).name | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074 |
stack? | public | string | TaggedError(ACTIVITY_CANCELLED_ERROR_TAG, { name: "ActivityCancelledError", }).stack | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076 |
ActivityExecutionNotFoundError
Defined in: packages/client/src/errors.ts:503
Surfaced on the Err channel when an operation targets a standalone activity execution that doesn't exist in the namespace — Temporal's ActivityNotFoundError. Returned from every activity handle method.
Extends
TaggedErrorInstance<"@temporal-contract/ActivityExecutionNotFoundError", {activityId:string;cause?:unknown;runId?:string; }>
Constructors
Constructor
new ActivityExecutionNotFoundError(
activityId,
runId?,
cause?
): ActivityExecutionNotFoundError;Defined in: packages/client/src/errors.ts:511
Parameters
| Parameter | Type |
|---|---|
activityId | string |
runId? | string |
cause? | unknown |
Returns
ActivityExecutionNotFoundError
Overrides
TaggedError(
ACTIVITY_EXECUTION_NOT_FOUND_ERROR_TAG,
{ name: "ActivityExecutionNotFoundError" },
)<{
activityId: string;
runId?: string | undefined;
cause?: unknown;
}>.constructorProperties
| Property | Modifier | Type | Inherited from | Defined in |
|---|---|---|---|---|
_tag | readonly | "@temporal-contract/ActivityExecutionNotFoundError" | TaggedError( ACTIVITY_EXECUTION_NOT_FOUND_ERROR_TAG, { name: "ActivityExecutionNotFoundError" }, )._tag | node_modules/.pnpm/unthrown@5.11.0/node_modules/unthrown/dist/index.d.mts:2332 |
activityId | readonly | string | TaggedError( ACTIVITY_EXECUTION_NOT_FOUND_ERROR_TAG, { name: "ActivityExecutionNotFoundError" }, ).activityId | packages/client/src/errors.ts:507 |
cause? | public | unknown | ActivityValidationError.cause | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24 |
message | public | string | TaggedError( ACTIVITY_EXECUTION_NOT_FOUND_ERROR_TAG, { name: "ActivityExecutionNotFoundError" }, ).message | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075 |
name | public | string | TaggedError( ACTIVITY_EXECUTION_NOT_FOUND_ERROR_TAG, { name: "ActivityExecutionNotFoundError" }, ).name | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074 |
runId? | readonly | string | TaggedError( ACTIVITY_EXECUTION_NOT_FOUND_ERROR_TAG, { name: "ActivityExecutionNotFoundError" }, ).runId | packages/client/src/errors.ts:508 |
stack? | public | string | TaggedError( ACTIVITY_EXECUTION_NOT_FOUND_ERROR_TAG, { name: "ActivityExecutionNotFoundError" }, ).stack | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076 |
ActivityFailedError
Defined in: packages/client/src/errors.ts:525
Surfaced on the Err channel when a standalone activity completes with a failure that is neither one of its declared contract errors nor a cancel/terminate/timeout outcome — Temporal's ActivityExecutionFailedError, with cause the unwrapped failure.
Returned from executeActivity and the activity handle's result().
Extends
TaggedErrorInstance<"@temporal-contract/ActivityFailedError", {activityId:string;cause?:TemporalFailure; }>
Constructors
Constructor
new ActivityFailedError(activityId, cause?): ActivityFailedError;Defined in: packages/client/src/errors.ts:531
Parameters
| Parameter | Type |
|---|---|
activityId | string |
cause? | TemporalFailure |
Returns
Overrides
TaggedError(ACTIVITY_FAILED_ERROR_TAG, {
name: "ActivityFailedError",
})<{
activityId: string;
cause?: TemporalFailure | undefined;
}>.constructorProperties
| Property | Modifier | Type | Inherited from | Defined in |
|---|---|---|---|---|
_tag | readonly | "@temporal-contract/ActivityFailedError" | TaggedError(ACTIVITY_FAILED_ERROR_TAG, { name: "ActivityFailedError", })._tag | node_modules/.pnpm/unthrown@5.11.0/node_modules/unthrown/dist/index.d.mts:2332 |
activityId | readonly | string | TaggedError(ACTIVITY_FAILED_ERROR_TAG, { name: "ActivityFailedError", }).activityId | packages/client/src/errors.ts:528 |
cause? | public | TemporalFailure | ActivityValidationError.cause | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24 |
message | public | string | TaggedError(ACTIVITY_FAILED_ERROR_TAG, { name: "ActivityFailedError", }).message | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075 |
name | public | string | TaggedError(ACTIVITY_FAILED_ERROR_TAG, { name: "ActivityFailedError", }).name | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074 |
stack? | public | string | TaggedError(ACTIVITY_FAILED_ERROR_TAG, { name: "ActivityFailedError", }).stack | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076 |
ActivityTerminatedError
Defined in: packages/client/src/errors.ts:562
Surfaced on the Err channel when the awaited standalone activity was terminated. cause keeps the original TerminatedFailure, whose message carries the terminate reason.
Extends
TaggedErrorInstance<"@temporal-contract/ActivityTerminatedError", {activityId:string;cause?:TerminatedFailure; }>
Constructors
Constructor
new ActivityTerminatedError(activityId, cause?): ActivityTerminatedError;Defined in: packages/client/src/errors.ts:568
Parameters
| Parameter | Type |
|---|---|
activityId | string |
cause? | TerminatedFailure |
Returns
Overrides
TaggedError(ACTIVITY_TERMINATED_ERROR_TAG, {
name: "ActivityTerminatedError",
})<{
activityId: string;
cause?: TerminatedFailure | undefined;
}>.constructorProperties
| Property | Modifier | Type | Inherited from | Defined in |
|---|---|---|---|---|
_tag | readonly | "@temporal-contract/ActivityTerminatedError" | TaggedError(ACTIVITY_TERMINATED_ERROR_TAG, { name: "ActivityTerminatedError", })._tag | node_modules/.pnpm/unthrown@5.11.0/node_modules/unthrown/dist/index.d.mts:2332 |
activityId | readonly | string | TaggedError(ACTIVITY_TERMINATED_ERROR_TAG, { name: "ActivityTerminatedError", }).activityId | packages/client/src/errors.ts:565 |
cause? | public | TerminatedFailure | ActivityValidationError.cause | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24 |
message | public | string | TaggedError(ACTIVITY_TERMINATED_ERROR_TAG, { name: "ActivityTerminatedError", }).message | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075 |
name | public | string | TaggedError(ACTIVITY_TERMINATED_ERROR_TAG, { name: "ActivityTerminatedError", }).name | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074 |
stack? | public | string | TaggedError(ACTIVITY_TERMINATED_ERROR_TAG, { name: "ActivityTerminatedError", }).stack | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076 |
ActivityTimeoutError
Defined in: packages/client/src/errors.ts:581
Surfaced on the Err channel when the awaited standalone activity timed out. cause keeps the original TimeoutFailure, whose timeoutType names which timeout fired.
Extends
TaggedErrorInstance<"@temporal-contract/ActivityTimeoutError", {activityId:string;cause?:TimeoutFailure; }>
Constructors
Constructor
new ActivityTimeoutError(activityId, cause?): ActivityTimeoutError;Defined in: packages/client/src/errors.ts:587
Parameters
| Parameter | Type |
|---|---|
activityId | string |
cause? | TimeoutFailure |
Returns
Overrides
TaggedError(ACTIVITY_TIMEOUT_ERROR_TAG, {
name: "ActivityTimeoutError",
})<{
activityId: string;
cause?: TimeoutFailure | undefined;
}>.constructorProperties
| Property | Modifier | Type | Inherited from | Defined in |
|---|---|---|---|---|
_tag | readonly | "@temporal-contract/ActivityTimeoutError" | TaggedError(ACTIVITY_TIMEOUT_ERROR_TAG, { name: "ActivityTimeoutError", })._tag | node_modules/.pnpm/unthrown@5.11.0/node_modules/unthrown/dist/index.d.mts:2332 |
activityId | readonly | string | TaggedError(ACTIVITY_TIMEOUT_ERROR_TAG, { name: "ActivityTimeoutError", }).activityId | packages/client/src/errors.ts:584 |
cause? | public | TimeoutFailure | ActivityValidationError.cause | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24 |
message | public | string | TaggedError(ACTIVITY_TIMEOUT_ERROR_TAG, { name: "ActivityTimeoutError", }).message | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075 |
name | public | string | TaggedError(ACTIVITY_TIMEOUT_ERROR_TAG, { name: "ActivityTimeoutError", }).name | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074 |
stack? | public | string | TaggedError(ACTIVITY_TIMEOUT_ERROR_TAG, { name: "ActivityTimeoutError", }).stack | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076 |
ActivityValidationError
Defined in: packages/client/src/errors.ts:597
Surfaced on the Err channel when a standalone activity's input (before the start) or output (on receive) fails its contract schema.
Extends
TaggedErrorInstance<"@temporal-contract/ActivityValidationError", {activityId:string;activityName:string;direction:"input"|"output";issues: readonlyIssue[]; }>
Constructors
Constructor
new ActivityValidationError(
activityName,
direction,
issues,
activityId
): ActivityValidationError;Defined in: packages/client/src/errors.ts:605
Parameters
| Parameter | Type |
|---|---|
activityName | string |
direction | "input" | "output" |
issues | readonly Issue[] |
activityId | string |
Returns
Overrides
TaggedError(ACTIVITY_VALIDATION_ERROR_TAG, {
name: "ActivityValidationError",
})<{
activityName: string;
direction: "input" | "output";
issues: ReadonlyArray<StandardSchemaV1.Issue>;
activityId: string;
}>.constructorProperties
| Property | Modifier | Type | Inherited from | Defined in |
|---|---|---|---|---|
_tag | readonly | "@temporal-contract/ActivityValidationError" | TaggedError(ACTIVITY_VALIDATION_ERROR_TAG, { name: "ActivityValidationError", })._tag | node_modules/.pnpm/unthrown@5.11.0/node_modules/unthrown/dist/index.d.mts:2332 |
activityId | readonly | string | TaggedError(ACTIVITY_VALIDATION_ERROR_TAG, { name: "ActivityValidationError", }).activityId | packages/client/src/errors.ts:603 |
activityName | readonly | string | TaggedError(ACTIVITY_VALIDATION_ERROR_TAG, { name: "ActivityValidationError", }).activityName | packages/client/src/errors.ts:600 |
cause? | public | unknown | TaggedError(ACTIVITY_VALIDATION_ERROR_TAG, { name: "ActivityValidationError", }).cause | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24 |
direction | readonly | "input" | "output" | TaggedError(ACTIVITY_VALIDATION_ERROR_TAG, { name: "ActivityValidationError", }).direction | packages/client/src/errors.ts:601 |
issues | readonly | readonly Issue[] | TaggedError(ACTIVITY_VALIDATION_ERROR_TAG, { name: "ActivityValidationError", }).issues | packages/client/src/errors.ts:602 |
message | public | string | TaggedError(ACTIVITY_VALIDATION_ERROR_TAG, { name: "ActivityValidationError", }).message | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075 |
name | public | string | TaggedError(ACTIVITY_VALIDATION_ERROR_TAG, { name: "ActivityValidationError", }).name | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074 |
stack? | public | string | TaggedError(ACTIVITY_VALIDATION_ERROR_TAG, { name: "ActivityValidationError", }).stack | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076 |
ContractClient
Defined in: packages/client/src/client.ts:309
Contract-scoped typed Temporal client with unthrown Result/AsyncResult pattern.
Provides type-safe methods to start and execute workflows defined in the bound contract, with explicit error handling using the Result pattern. Obtained from TypedClient.for — the connection-scoped root — and inherits its underlying Client. Not constructible directly: the class is exported for type annotations only.
Workflow, signal and update names are constrained to the contract's declarations at the type level; a name that slips past the types (a cast, a raw call) is a defect carrying a TechnicalError, not a modeled Err.
Type Parameters
| Type Parameter |
|---|
TContract extends ContractDefinition |
Properties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
contract | readonly | TContract | The contract this client is bound to — handy for logging, metrics labels, and plumbing the same contract into workers/tests without threading a second reference around. | packages/client/src/client.ts:315 |
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. Example import { SCHEDULE_CREATE_PATTERNS, SCHEDULE_NOT_FOUND_ERROR_TAG, } from "@temporal-contract/client"; import { P } from "unthrown"; const result = await contractClient.schedule .create("processOrder", { scheduleId: "daily-sweep", spec: { cronExpressions: ["0 2 * * *"] }, args: { orderId: "sweep" }, }) .flatMap((handle) => handle.pause("maintenance")); result.match({ ok: () => console.log("schedule created, paused"), errCases: (matcher) => matcher.with(...SCHEDULE_CREATE_PATTERNS, P.tag(SCHEDULE_NOT_FOUND_ERROR_TAG), (error) => console.error("schedule setup failed", error), ), defect: (cause) => console.error("unexpected failure", cause), }); | packages/client/src/client.ts:348 |
Accessors
taskQueue
Get Signature
get taskQueue(): TContract["taskQueue"];Defined in: packages/client/src/client.ts:383
The task queue this client dispatches to — the bound contract's taskQueue. Exposed for logging/observability so callers don't need to reach through contract.
Returns
TContract["taskQueue"]
Methods
executeActivity()
executeActivity<TActivityName>(activityName, options): AsyncResult<ClientInferOutput<ContractActivityOf<TContract, TActivityName>>,
| ActivityAlreadyStartedError
| ActivityResultErrorsOf<ContractActivityOf<TContract, TActivityName>>>;Defined in: packages/client/src/client.ts:786
Execute a standalone activity — startActivity then the handle's result(). Beside the start errors, surfaces the activity's declared contract errors and the first-class outcome errors.
Type Parameters
| Type Parameter |
|---|
TActivityName extends string |
Parameters
| Parameter | Type |
|---|---|
activityName | TActivityName |
options | TypedActivityStartOptions<ContractActivityOf<TContract, TActivityName>> |
Returns
AsyncResult<ClientInferOutput<ContractActivityOf<TContract, TActivityName>>, | ActivityAlreadyStartedError | ActivityResultErrorsOf<ContractActivityOf<TContract, TActivityName>>>
Example
import { ACTIVITY_EXECUTE_PATTERNS } from "@temporal-contract/client";
const result = await client.for(pdfContract).executeActivity("renderInvoice", {
activityId: `invoice-${invoiceId}`,
args: { invoiceId },
});
result.match({
ok: ({ url }) => console.log("rendered", url),
errCases: (matcher) =>
matcher.with(...ACTIVITY_EXECUTE_PATTERNS, (error) => console.error(error)),
defect: (cause) => console.error("unexpected failure", cause),
});executeUpdateWithStart()
executeUpdateWithStart<TWorkflowName, TUpdateName>(workflowName, options): AsyncResult<ClientInferOutput<UpdateOf<TContract["workflows"][TWorkflowName], TUpdateName>>,
| WorkflowValidationError
| WorkflowAlreadyStartedError
| UpdateValidationError
| UpdateRejectedError
| UpdateFailedError
| UpdateRpcTimeoutOrCancelledError>;Defined in: packages/client/src/client.ts:593
Start a workflow (or, under workflowIdConflictPolicy: "USE_EXISTING", reuse the running one) and send it an update in one request, waiting for the update's result — Temporal's executeUpdateWithStart.
Validates both the workflow input (args) and the update input (updateArgs, for the update named by updateName) before anything is sent, and parses the update's result against its output schema. To reach the workflow afterwards, getHandle it by ID (workflowIdFor for a derived ID).
Type Parameters
| Type Parameter |
|---|
TWorkflowName extends string |
TUpdateName extends string |
Parameters
| Parameter | Type |
|---|---|
workflowName | TWorkflowName |
options | TypedUpdateWithStartOptions<TContract, TWorkflowName, TUpdateName> |
Returns
AsyncResult<ClientInferOutput<UpdateOf<TContract["workflows"][TWorkflowName], TUpdateName>>, | WorkflowValidationError | WorkflowAlreadyStartedError | UpdateValidationError | UpdateRejectedError | UpdateFailedError | UpdateRpcTimeoutOrCancelledError>
executeWorkflow()
executeWorkflow<TWorkflowName>(workflowName, options): AsyncResult<ClientInferOutput<TContract["workflows"][TWorkflowName]>,
| WorkflowAlreadyStartedError
| WorkflowResultErrorsOf<TContract["workflows"][TWorkflowName]>>;Defined in: packages/client/src/client.ts:572
Execute a workflow (start and wait for result) with AsyncResult pattern — startWorkflow(...) then handle.result().
Beside the start-phase errors, the result phase surfaces the workflow's declared contract errors and the first-class outcome errors (WorkflowCancelledError / WorkflowTerminatedError / WorkflowTimeoutError) — see TypedWorkflowHandle.result for the cancellation-handling caveat.
Type Parameters
| Type Parameter |
|---|
TWorkflowName extends string |
Parameters
| Parameter | Type |
|---|---|
workflowName | TWorkflowName |
options | TypedWorkflowStartOptions<TContract, TWorkflowName> |
Returns
AsyncResult<ClientInferOutput<TContract["workflows"][TWorkflowName]>, | WorkflowAlreadyStartedError | WorkflowResultErrorsOf<TContract["workflows"][TWorkflowName]>>
Example
import { CONTRACT_ERROR_TAG, WORKFLOW_EXECUTE_PATTERNS } from "@temporal-contract/client";
import { P } from "unthrown";
const result = await contractClient.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),
errCases: (matcher) =>
matcher
.with(P.tag(CONTRACT_ERROR_TAG), (error) =>
console.error('Domain failure:', error.errorName),
)
.with(...WORKFLOW_EXECUTE_PATTERNS, (error) =>
console.error('Processing failed:', error),
),
defect: (cause) => console.error('Unexpected failure:', cause),
});getActivityHandle()
getActivityHandle<TActivityName>(
activityName,
activityId,
options?
): TypedActivityHandle<ContractActivityOf<TContract, TActivityName>>;Defined in: packages/client/src/client.ts:802
Get a typed handle to an existing standalone activity execution — synchronous and infallible, like Temporal's getHandle. Without a runId the handle targets the latest run under activityId.
Type Parameters
| Type Parameter |
|---|
TActivityName extends string |
Parameters
| Parameter | Type |
|---|---|
activityName | TActivityName |
activityId | string |
options? | { runId?: string; } |
options.runId? | string |
Returns
TypedActivityHandle<ContractActivityOf<TContract, TActivityName>>
getHandle()
getHandle<TWorkflowName>(
workflowName,
workflowId,
options?
): TypedWorkflowHandle<TContract["workflows"][TWorkflowName]>;Defined in: packages/client/src/client.ts:706
Get a typed handle to an existing workflow execution — synchronous and infallible, like Temporal's getHandle. Whether the execution exists is a server-side question answered lazily by the handle's methods (as WorkflowExecutionNotFoundError).
Accepts an optional runId (bind to a specific execution) and Temporal's firstExecutionRunId — the chain interlock ensuring mutating handle methods (terminate, cancel) don't affect executions from another chain reusing the workflow ID.
Type Parameters
| Type Parameter |
|---|
TWorkflowName extends string |
Parameters
| Parameter | Type |
|---|---|
workflowName | TWorkflowName |
workflowId | string |
options? | TypedGetHandleOptions |
Returns
TypedWorkflowHandle<TContract["workflows"][TWorkflowName]>
Example
const handle = contractClient.getHandle('processOrder', 'order-123');
const result = await handle.result();signalWithStart()
signalWithStart<TWorkflowName, TSignalName>(workflowName, options): AsyncResult<TypedWorkflowHandleWithSignaledRunId<TContract["workflows"][TWorkflowName]>,
| WorkflowValidationError
| WorkflowAlreadyStartedError
| SignalValidationError>;Defined in: packages/client/src/client.ts:481
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 input schema of the signal named by the options bag'ssignalNamefield
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 |
options | TypedSignalWithStartOptions<TContract, TWorkflowName, TSignalName> |
Returns
AsyncResult<TypedWorkflowHandleWithSignaledRunId<TContract["workflows"][TWorkflowName]>, | WorkflowValidationError | WorkflowAlreadyStartedError | SignalValidationError>
Example
import {
SIGNAL_VALIDATION_ERROR_TAG,
WORKFLOW_START_PATTERNS,
} from "@temporal-contract/client";
import { P } from "unthrown";
const result = await contractClient.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),
errCases: (matcher) =>
matcher
.with(P.tag(SIGNAL_VALIDATION_ERROR_TAG), (error) =>
console.error('signal payload rejected', error),
)
.with(...WORKFLOW_START_PATTERNS, (error) =>
console.error('signalWithStart failed', error),
),
defect: (cause) => console.error('unexpected failure', cause),
});startActivity()
startActivity<TActivityName>(activityName, options): AsyncResult<TypedActivityHandle<ContractActivityOf<TContract, TActivityName>>,
| ActivityValidationError
| ActivityAlreadyStartedError>;Defined in: packages/client/src/client.ts:745
Start a standalone activity — one of the contract's global activities, run directly on the contract's task queue with no workflow around it (Temporal's client.activity.start; needs Temporal Server ≥ 1.32). The worker side is the ordinary declareActivitiesHandler registration, so its input validation and failure mapping apply.
args is validated against the activity's input schema before anything is sent. The activity's contract-level activityOptions are the defaults for the call's options; the merged options need a per-attempt and a total bound, or the call is a defect.
Type Parameters
| Type Parameter |
|---|
TActivityName extends string |
Parameters
| Parameter | Type |
|---|---|
activityName | TActivityName |
options | TypedActivityStartOptions<ContractActivityOf<TContract, TActivityName>> |
Returns
AsyncResult<TypedActivityHandle<ContractActivityOf<TContract, TActivityName>>, | ActivityValidationError | ActivityAlreadyStartedError>
Example
const started = await client.for(pdfContract).startActivity("renderInvoice", {
activityId: `invoice-${invoiceId}`,
args: { invoiceId },
});startWorkflow()
startWorkflow<TWorkflowName>(workflowName, options): AsyncResult<TypedWorkflowHandle<TContract["workflows"][TWorkflowName]>,
| WorkflowValidationError
| WorkflowAlreadyStartedError>;Defined in: packages/client/src/client.ts:414
Start a workflow and return a typed handle with AsyncResult pattern
Type Parameters
| Type Parameter |
|---|
TWorkflowName extends string |
Parameters
| Parameter | Type |
|---|---|
workflowName | TWorkflowName |
options | TypedWorkflowStartOptions<TContract, TWorkflowName> |
Returns
AsyncResult<TypedWorkflowHandle<TContract["workflows"][TWorkflowName]>, | WorkflowValidationError | WorkflowAlreadyStartedError>
Example
import { WORKFLOW_START_PATTERNS } from "@temporal-contract/client";
const handleResult = await contractClient.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
},
errCases: (matcher) =>
matcher.with(...WORKFLOW_START_PATTERNS, (error) =>
console.error('Failed to start:', error),
),
defect: (cause) => console.error('Unexpected failure:', cause),
});workflowIdFor()
workflowIdFor<TWorkflowName>(workflowName, input): AsyncResult<string, WorkflowValidationError>;Defined in: packages/client/src/client.ts:673
The workflow ID the contract derives for input — the same validation and derivation a start runs, without starting anything. Use it to getHandle an execution of a workflow whose contract declares workflowId.
Only callable for such workflows (the name is constrained at the type level); invalid input is Err(WorkflowValidationError).
Type Parameters
| Type Parameter |
|---|
TWorkflowName extends string |
Parameters
| Parameter | Type |
|---|---|
workflowName | TWorkflowName |
input | ClientInferInput<TContract["workflows"][TWorkflowName]> |
Returns
AsyncResult<string, WorkflowValidationError>
Example
const handle = await orders
.workflowIdFor("processOrder", { orderId: "ORD-1" })
.map((workflowId) => orders.getHandle("processOrder", workflowId));ContractError
Defined in: packages/contract/dist/errors-impl-D7p9uupF.d.mts:45
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 result.match({ errCases: (m) => m.with(P.tag("@temporal-contract/ContractError"), …) })); 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-impl-D7p9uupF.d.mts:52
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@5.11.0/node_modules/unthrown/dist/index.d.mts:2332 |
cause? | public | unknown | - | ActivityValidationError.cause | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24 |
data | readonly | TData | Structured payload validated against the declared data schema. | ContractError_base.data | packages/contract/dist/errors-impl-D7p9uupF.d.mts:49 |
errorName | readonly | TName | Declared error name — the ApplicationFailure.type discriminator. | ContractError_base.errorName | packages/contract/dist/errors-impl-D7p9uupF.d.mts:47 |
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 |
QueryFailedError
Defined in: packages/client/src/errors.ts:310
Surfaced on the Err channel when the server could not serve a query:
- no handler is registered under the query name on the (possibly older) workflow execution, or the query handler itself threw — Temporal reports both as
QueryNotRegisteredError(anINVALID_ARGUMENTgRPC failure whose message carries the underlying reason); - the server rejected the query because of the execution's status, under the Temporal client's
queryRejectCondition— Temporal'sQueryRejectedError, whosestatusnames the execution status.
cause keeps Temporal's original error for inspection. A routine operational outcome — a stale execution predating the handler, a handler bug, a closed execution — not a technical fault, so it rides the Err channel instead of the defect channel.
Returned from the typed handle's queries.* proxies.
Extends
TaggedErrorInstance<"@temporal-contract/QueryFailedError", {cause?:unknown;queryName:string; }>
Constructors
Constructor
new QueryFailedError(queryName, cause?): QueryFailedError;Defined in: packages/client/src/errors.ts:316
Parameters
| Parameter | Type |
|---|---|
queryName | string |
cause? | unknown |
Returns
Overrides
TaggedError(QUERY_FAILED_ERROR_TAG, {
name: "QueryFailedError",
})<{
queryName: string;
cause?: unknown;
}>.constructorProperties
| Property | Modifier | Type | Inherited from | Defined in |
|---|---|---|---|---|
_tag | readonly | "@temporal-contract/QueryFailedError" | TaggedError(QUERY_FAILED_ERROR_TAG, { name: "QueryFailedError", })._tag | node_modules/.pnpm/unthrown@5.11.0/node_modules/unthrown/dist/index.d.mts:2332 |
cause? | public | unknown | ActivityValidationError.cause | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24 |
message | public | string | TaggedError(QUERY_FAILED_ERROR_TAG, { name: "QueryFailedError", }).message | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075 |
name | public | string | TaggedError(QUERY_FAILED_ERROR_TAG, { name: "QueryFailedError", }).name | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074 |
queryName | readonly | string | TaggedError(QUERY_FAILED_ERROR_TAG, { name: "QueryFailedError", }).queryName | packages/client/src/errors.ts:313 |
stack? | public | string | TaggedError(QUERY_FAILED_ERROR_TAG, { name: "QueryFailedError", }).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:275
Surfaced on the Err channel 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:282
Parameters
| Parameter | Type |
|---|---|
queryName | string |
direction | "input" | "output" |
issues | readonly Issue[] |
Returns
Overrides
TaggedError(QUERY_VALIDATION_ERROR_TAG, {
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(QUERY_VALIDATION_ERROR_TAG, { name: "QueryValidationError", })._tag | node_modules/.pnpm/unthrown@5.11.0/node_modules/unthrown/dist/index.d.mts:2332 |
cause? | public | unknown | TaggedError(QUERY_VALIDATION_ERROR_TAG, { 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(QUERY_VALIDATION_ERROR_TAG, { name: "QueryValidationError", }).direction | packages/client/src/errors.ts:279 |
issues | readonly | readonly Issue[] | TaggedError(QUERY_VALIDATION_ERROR_TAG, { name: "QueryValidationError", }).issues | packages/client/src/errors.ts:280 |
message | public | string | TaggedError(QUERY_VALIDATION_ERROR_TAG, { name: "QueryValidationError", }).message | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075 |
name | public | string | TaggedError(QUERY_VALIDATION_ERROR_TAG, { name: "QueryValidationError", }).name | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074 |
queryName | readonly | string | TaggedError(QUERY_VALIDATION_ERROR_TAG, { name: "QueryValidationError", }).queryName | packages/client/src/errors.ts:278 |
stack? | public | string | TaggedError(QUERY_VALIDATION_ERROR_TAG, { 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:73
Technical-failure wrapper for a Temporal call that failed in a way the typed client does not model. Never surfaced on the Err channel: it is the cause of the defect such a failure becomes, naming the operation that failed.
Extends
TaggedErrorInstance<"@temporal-contract/RuntimeClientError", {cause?:unknown;operation:string; }>
Constructors
Constructor
new RuntimeClientError(operation, cause?): RuntimeClientError;Defined in: packages/client/src/errors.ts:79
Parameters
| Parameter | Type |
|---|---|
operation | string |
cause? | unknown |
Returns
Overrides
TaggedError(RUNTIME_CLIENT_ERROR_TAG, {
name: "RuntimeClientError",
})<{
operation: string;
cause?: unknown;
}>.constructorProperties
| Property | Modifier | Type | Inherited from | Defined in |
|---|---|---|---|---|
_tag | readonly | "@temporal-contract/RuntimeClientError" | TaggedError(RUNTIME_CLIENT_ERROR_TAG, { name: "RuntimeClientError", })._tag | node_modules/.pnpm/unthrown@5.11.0/node_modules/unthrown/dist/index.d.mts:2332 |
cause? | public | unknown | ActivityValidationError.cause | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24 |
message | public | string | TaggedError(RUNTIME_CLIENT_ERROR_TAG, { name: "RuntimeClientError", }).message | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075 |
name | public | string | TaggedError(RUNTIME_CLIENT_ERROR_TAG, { name: "RuntimeClientError", }).name | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074 |
operation | readonly | string | TaggedError(RUNTIME_CLIENT_ERROR_TAG, { name: "RuntimeClientError", }).operation | packages/client/src/errors.ts:76 |
stack? | public | string | TaggedError(RUNTIME_CLIENT_ERROR_TAG, { name: "RuntimeClientError", }).stack | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076 |
ScheduleAlreadyExistsError
Defined in: packages/client/src/errors.ts:449
Surfaced on the Err channel when schedule.create collides with a running (not deleted) schedule bearing the same scheduleId — Temporal's ScheduleAlreadyRunning. Idempotent callers can branch on it explicitly (e.g. fetch the existing handle and continue).
Extends
TaggedErrorInstance<"@temporal-contract/ScheduleAlreadyExistsError", {cause?:unknown;scheduleId:string; }>
Constructors
Constructor
new ScheduleAlreadyExistsError(scheduleId, cause?): ScheduleAlreadyExistsError;Defined in: packages/client/src/errors.ts:455
Parameters
| Parameter | Type |
|---|---|
scheduleId | string |
cause? | unknown |
Returns
Overrides
TaggedError(SCHEDULE_ALREADY_EXISTS_ERROR_TAG, {
name: "ScheduleAlreadyExistsError",
})<{
scheduleId: string;
cause?: unknown;
}>.constructorProperties
| Property | Modifier | Type | Inherited from | Defined in |
|---|---|---|---|---|
_tag | readonly | "@temporal-contract/ScheduleAlreadyExistsError" | TaggedError(SCHEDULE_ALREADY_EXISTS_ERROR_TAG, { name: "ScheduleAlreadyExistsError", })._tag | node_modules/.pnpm/unthrown@5.11.0/node_modules/unthrown/dist/index.d.mts:2332 |
cause? | public | unknown | ActivityValidationError.cause | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24 |
message | public | string | TaggedError(SCHEDULE_ALREADY_EXISTS_ERROR_TAG, { name: "ScheduleAlreadyExistsError", }).message | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075 |
name | public | string | TaggedError(SCHEDULE_ALREADY_EXISTS_ERROR_TAG, { name: "ScheduleAlreadyExistsError", }).name | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074 |
scheduleId | readonly | string | TaggedError(SCHEDULE_ALREADY_EXISTS_ERROR_TAG, { name: "ScheduleAlreadyExistsError", }).scheduleId | packages/client/src/errors.ts:452 |
stack? | public | string | TaggedError(SCHEDULE_ALREADY_EXISTS_ERROR_TAG, { name: "ScheduleAlreadyExistsError", }).stack | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076 |
ScheduleNotFoundError
Defined in: packages/client/src/errors.ts:467
Surfaced on the Err channel when a schedule-handle operation targets a schedule ID unknown to the Temporal server — Temporal's ScheduleNotFoundError. Either the ID is wrong or the schedule was deleted.
Extends
TaggedErrorInstance<"@temporal-contract/ScheduleNotFoundError", {cause?:unknown;scheduleId:string; }>
Constructors
Constructor
new ScheduleNotFoundError(scheduleId, cause?): ScheduleNotFoundError;Defined in: packages/client/src/errors.ts:473
Parameters
| Parameter | Type |
|---|---|
scheduleId | string |
cause? | unknown |
Returns
Overrides
TaggedError(SCHEDULE_NOT_FOUND_ERROR_TAG, {
name: "ScheduleNotFoundError",
})<{
scheduleId: string;
cause?: unknown;
}>.constructorProperties
| Property | Modifier | Type | Inherited from | Defined in |
|---|---|---|---|---|
_tag | readonly | "@temporal-contract/ScheduleNotFoundError" | TaggedError(SCHEDULE_NOT_FOUND_ERROR_TAG, { name: "ScheduleNotFoundError", })._tag | node_modules/.pnpm/unthrown@5.11.0/node_modules/unthrown/dist/index.d.mts:2332 |
cause? | public | unknown | ActivityValidationError.cause | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24 |
message | public | string | TaggedError(SCHEDULE_NOT_FOUND_ERROR_TAG, { name: "ScheduleNotFoundError", }).message | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075 |
name | public | string | TaggedError(SCHEDULE_NOT_FOUND_ERROR_TAG, { name: "ScheduleNotFoundError", }).name | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074 |
scheduleId | readonly | string | TaggedError(SCHEDULE_NOT_FOUND_ERROR_TAG, { name: "ScheduleNotFoundError", }).scheduleId | packages/client/src/errors.ts:470 |
stack? | public | string | TaggedError(SCHEDULE_NOT_FOUND_ERROR_TAG, { name: "ScheduleNotFoundError", }).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:327
Surfaced on the Err channel 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:333
Parameters
| Parameter | Type |
|---|---|
signalName | string |
issues | readonly Issue[] |
Returns
Overrides
TaggedError(SIGNAL_VALIDATION_ERROR_TAG, {
name: "SignalValidationError",
})<{
signalName: string;
issues: ReadonlyArray<StandardSchemaV1.Issue>;
}>.constructorProperties
| Property | Modifier | Type | Inherited from | Defined in |
|---|---|---|---|---|
_tag | readonly | "@temporal-contract/SignalValidationError" | TaggedError(SIGNAL_VALIDATION_ERROR_TAG, { name: "SignalValidationError", })._tag | node_modules/.pnpm/unthrown@5.11.0/node_modules/unthrown/dist/index.d.mts:2332 |
cause? | public | unknown | TaggedError(SIGNAL_VALIDATION_ERROR_TAG, { 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(SIGNAL_VALIDATION_ERROR_TAG, { name: "SignalValidationError", }).issues | packages/client/src/errors.ts:331 |
message | public | string | TaggedError(SIGNAL_VALIDATION_ERROR_TAG, { name: "SignalValidationError", }).message | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075 |
name | public | string | TaggedError(SIGNAL_VALIDATION_ERROR_TAG, { name: "SignalValidationError", }).name | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074 |
signalName | readonly | string | TaggedError(SIGNAL_VALIDATION_ERROR_TAG, { name: "SignalValidationError", }).signalName | packages/client/src/errors.ts:330 |
stack? | public | string | TaggedError(SIGNAL_VALIDATION_ERROR_TAG, { 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-impl-D7p9uupF.d.mts:18
Error for technical/runtime failures that cannot be prevented by TypeScript — connection failures, missing runtime capabilities, worker bundling errors. These are unmodeled infrastructure faults, never anticipated domain failures, so they ride the Defect channel: the creation factories (TypedClient.create, TypedWorker.create) surface them as a Defect whose cause is a TechnicalError instance (inspect via match's defect handler, recoverDefect, or tapDefect) — this class never appears in a Result's modeled E channel.
The class is retained (and still exported) so the descriptive message and cause survive for logging; it is only ever used as a defect's cause.
Extends
TechnicalError_base<{cause?:unknown; }>
Constructors
Constructor
new TechnicalError(message, cause?): TechnicalError;Defined in: packages/contract/dist/errors-impl-D7p9uupF.d.mts:21
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@5.11.0/node_modules/unthrown/dist/index.d.mts:2332 |
cause? | public | unknown | ActivityValidationError.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:177
Connection-scoped root of the typed client surface.
A client is a connection; a contract is a schema. TypedClient owns the connection-lifetime concerns — the eager ensureConnected() and the raw escape hatch — and hands out contract-bound ContractClients via TypedClient.for. Create it once at process start; bind contracts freely (binding is synchronous, infallible, and memoized).
Properties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
raw | readonly | Client | The underlying @temporalio/client Client — the escape hatch for anything the typed surface doesn't cover yet (e.g. raw.workflow.list(...), raw.workflow.count(...)). Calls made through raw bypass contract validation. | packages/client/src/client.ts:184 |
Methods
for()
for<TContract>(contract): ContractClient<TContract>;Defined in: packages/client/src/client.ts:283
Bind a contract, returning a ContractClient typed against it.
Synchronous and infallible — binding a schema to an established connection is a free, compile-time-ish operation, so it's valid in a field initializer. Memoized per contract identity: the option-less for(c) === for(c) guarantee holds, so calling it per request is free.
Type Parameters
| Type Parameter |
|---|
TContract extends ContractDefinition |
Parameters
| Parameter | Type |
|---|---|
contract | TContract |
Returns
ContractClient<TContract>
Example
import { WORKFLOW_EXECUTE_PATTERNS } from "@temporal-contract/client";
import { orderContract } from "./contracts/order.contract.js";
const orders = client.for(orderContract);
const result = await orders.executeWorkflow("processOrder", {
workflowId: "order-123",
args: { orderId: "ORD-123" },
});
await result.match({
ok: (output) => console.log("processed", output),
errCases: (matcher) =>
matcher.with(...WORKFLOW_EXECUTE_PATTERNS, (error) =>
console.error("processing failed", error),
),
defect: (cause) => console.error("unexpected failure", cause),
});create()
static create(__namedParameters): AsyncResult<TypedClient, never>;Defined in: packages/client/src/client.ts:227
Create the connection-scoped typed client.
Returns AsyncResult<TypedClient, never> — a setup fault is a technical infrastructure failure, not an anticipated domain error, so it surfaces on the Defect channel (a TechnicalError instance as the defect's cause), never the modeled Err channel: when the client's connection exposes ensureConnected, it is awaited eagerly so a bad address/namespace surfaces here instead of on the first operation.
Parameters
| Parameter | Type |
|---|---|
__namedParameters | CreateClientOptions |
Returns
AsyncResult<TypedClient, never>
Example
import { TypedClient } from "@temporal-contract/client";
import { Client, Connection } from "@temporalio/client";
const connection = await Connection.connect();
const temporalClient = new Client({ connection });
// Once, at process start. The Err channel is empty (`never`), so
// `.get()` unwraps directly — a setup defect rethrows its cause.
const client = await TypedClient.create({ client: temporalClient }).get();TypedScheduleClient
Defined in: packages/client/src/schedule.ts:177
Typed wrapper around Temporal's ScheduleClient. Exposed as contractClient.schedule — keeps the typed-client surface organized the same way Temporal's own Client.schedule does. Not constructible directly: the class is exported for type annotations only.
Type Parameters
| Type Parameter |
|---|
TContract extends ContractDefinition |
Methods
create()
create<TWorkflowName>(workflowName, options): AsyncResult<TypedScheduleHandle,
| WorkflowValidationError
| ScheduleAlreadyExistsError>;Defined in: packages/client/src/schedule.ts:212
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 — but transmits the caller's ORIGINAL args (the worker parses them when each scheduled run starts, so a transforming schema applies exactly once, on the receiving side). 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.
A colliding running schedule (same scheduleId, not deleted) surfaces as ScheduleAlreadyExistsError on the Err channel.
Type Parameters
| Type Parameter |
|---|
TWorkflowName extends string |
Parameters
| Parameter | Type |
|---|---|
workflowName | TWorkflowName |
options | TypedScheduleCreateOptions<TContract, TWorkflowName> |
Returns
AsyncResult<TypedScheduleHandle, | WorkflowValidationError | ScheduleAlreadyExistsError>
getHandle()
getHandle(scheduleId): TypedScheduleHandle;Defined in: packages/client/src/schedule.ts:252
Get a typed handle to an existing schedule. Does not validate that the schedule exists — handle methods (describe, pause, etc.) surface a ScheduleNotFoundError if the underlying ID is unknown.
Parameters
| Parameter | Type |
|---|---|
scheduleId | string |
Returns
list()
list(options?): AsyncIterable<ScheduleSummary>;Defined in: packages/client/src/schedule.ts:268
List schedules in the namespace — a passthrough of Temporal's ScheduleClient.list. Not filtered to this contract: Temporal's visibility API lists every schedule the namespace knows about (use a query option to narrow server-side).
The one method outside the Result discipline: a lazy, paginated AsyncIterable has no single outcome to carry, so a page fetch that fails throws from the for await loop, exactly as Temporal's does. Wrap the loop in your own boundary (fromPromise) when you need it as an AsyncResult.
Parameters
| Parameter | Type |
|---|---|
options? | ListScheduleOptions |
Returns
AsyncIterable<ScheduleSummary>
UpdateFailedError
Defined in: packages/client/src/errors.ts:374
Surfaced on the Err channel when an admitted update's handler failed — Temporal's WorkflowUpdateFailedError, minus the admission rejections classified as UpdateRejectedError. A routine business failure of the update itself (the handler threw an ApplicationFailure), not a technical fault, so it rides the Err channel instead of the defect channel.
cause is the unwrapped underlying failure (typically an ApplicationFailure) lifted from Temporal's wrapper, mirroring WorkflowFailedError.cause.
Returned from the typed handle's updates.* proxies, the update handle's result(), and executeUpdateWithStart.
Extends
TaggedErrorInstance<"@temporal-contract/UpdateFailedError", {cause?:unknown;updateName:string; }>
Constructors
Constructor
new UpdateFailedError(updateName, cause?): UpdateFailedError;Defined in: packages/client/src/errors.ts:380
Parameters
| Parameter | Type |
|---|---|
updateName | string |
cause? | unknown |
Returns
Overrides
TaggedError(UPDATE_FAILED_ERROR_TAG, {
name: "UpdateFailedError",
})<{
updateName: string;
cause?: unknown;
}>.constructorProperties
| Property | Modifier | Type | Inherited from | Defined in |
|---|---|---|---|---|
_tag | readonly | "@temporal-contract/UpdateFailedError" | TaggedError(UPDATE_FAILED_ERROR_TAG, { name: "UpdateFailedError", })._tag | node_modules/.pnpm/unthrown@5.11.0/node_modules/unthrown/dist/index.d.mts:2332 |
cause? | public | unknown | ActivityValidationError.cause | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24 |
message | public | string | TaggedError(UPDATE_FAILED_ERROR_TAG, { name: "UpdateFailedError", }).message | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075 |
name | public | string | TaggedError(UPDATE_FAILED_ERROR_TAG, { name: "UpdateFailedError", }).name | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074 |
stack? | public | string | TaggedError(UPDATE_FAILED_ERROR_TAG, { name: "UpdateFailedError", }).stack | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076 |
updateName | readonly | string | TaggedError(UPDATE_FAILED_ERROR_TAG, { name: "UpdateFailedError", }).updateName | packages/client/src/errors.ts:377 |
UpdateRejectedError
Defined in: packages/client/src/errors.ts:405
Surfaced on the Err channel when an update was rejected at admission by the worker-side input validator — the update handler never ran. With a @temporal-contract/worker on the other side of the task queue, this is the update-input schema rejecting the payload (the worker's UpdateInputValidationError, whose message summarizes the failing fields); cause keeps that original ApplicationFailure.
Distinct from UpdateValidationError (the client-side schema check, which fails before anything is sent) and from UpdateFailedError (the handler was admitted and then failed).
Returned from the typed handle's updates.* proxies, the update handle's result(), and executeUpdateWithStart — never from startUpdate: Temporal hands back the update handle for a rejected update too, and the rejection surfaces when its result() is awaited.
Extends
TaggedErrorInstance<"@temporal-contract/UpdateRejectedError", {cause?:unknown;updateName:string; }>
Constructors
Constructor
new UpdateRejectedError(updateName, cause?): UpdateRejectedError;Defined in: packages/client/src/errors.ts:411
Parameters
| Parameter | Type |
|---|---|
updateName | string |
cause? | unknown |
Returns
Overrides
TaggedError(UPDATE_REJECTED_ERROR_TAG, {
name: "UpdateRejectedError",
})<{
updateName: string;
cause?: unknown;
}>.constructorProperties
| Property | Modifier | Type | Inherited from | Defined in |
|---|---|---|---|---|
_tag | readonly | "@temporal-contract/UpdateRejectedError" | TaggedError(UPDATE_REJECTED_ERROR_TAG, { name: "UpdateRejectedError", })._tag | node_modules/.pnpm/unthrown@5.11.0/node_modules/unthrown/dist/index.d.mts:2332 |
cause? | public | unknown | ActivityValidationError.cause | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24 |
message | public | string | TaggedError(UPDATE_REJECTED_ERROR_TAG, { name: "UpdateRejectedError", }).message | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075 |
name | public | string | TaggedError(UPDATE_REJECTED_ERROR_TAG, { name: "UpdateRejectedError", }).name | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074 |
stack? | public | string | TaggedError(UPDATE_REJECTED_ERROR_TAG, { name: "UpdateRejectedError", }).stack | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076 |
updateName | readonly | string | TaggedError(UPDATE_REJECTED_ERROR_TAG, { name: "UpdateRejectedError", }).updateName | packages/client/src/errors.ts:408 |
UpdateRpcTimeoutOrCancelledError
Defined in: packages/client/src/errors.ts:430
Surfaced on the Err channel when an update call timed out or was cancelled on the client side — Temporal's WorkflowUpdateRPCTimeoutOrCancelledError. It says nothing about the update itself, which may still be admitted and run: retry with the same updateId, or reattach with handle.getUpdateHandle(name, updateId). cause keeps Temporal's original error.
Returned from every update path: the updates.* proxies, startUpdate, the update handle's result(), and executeUpdateWithStart.
Extends
TaggedErrorInstance<"@temporal-contract/UpdateRpcTimeoutOrCancelledError", {cause?:unknown;updateName:string; }>
Constructors
Constructor
new UpdateRpcTimeoutOrCancelledError(updateName, cause?): UpdateRpcTimeoutOrCancelledError;Defined in: packages/client/src/errors.ts:437
Parameters
| Parameter | Type |
|---|---|
updateName | string |
cause? | unknown |
Returns
UpdateRpcTimeoutOrCancelledError
Overrides
TaggedError(
UPDATE_RPC_TIMEOUT_OR_CANCELLED_ERROR_TAG,
{ name: "UpdateRpcTimeoutOrCancelledError" },
)<{
updateName: string;
cause?: unknown;
}>.constructorProperties
| Property | Modifier | Type | Inherited from | Defined in |
|---|---|---|---|---|
_tag | readonly | "@temporal-contract/UpdateRpcTimeoutOrCancelledError" | TaggedError( UPDATE_RPC_TIMEOUT_OR_CANCELLED_ERROR_TAG, { name: "UpdateRpcTimeoutOrCancelledError" }, )._tag | node_modules/.pnpm/unthrown@5.11.0/node_modules/unthrown/dist/index.d.mts:2332 |
cause? | public | unknown | ActivityValidationError.cause | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24 |
message | public | string | TaggedError( UPDATE_RPC_TIMEOUT_OR_CANCELLED_ERROR_TAG, { name: "UpdateRpcTimeoutOrCancelledError" }, ).message | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075 |
name | public | string | TaggedError( UPDATE_RPC_TIMEOUT_OR_CANCELLED_ERROR_TAG, { name: "UpdateRpcTimeoutOrCancelledError" }, ).name | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074 |
stack? | public | string | TaggedError( UPDATE_RPC_TIMEOUT_OR_CANCELLED_ERROR_TAG, { name: "UpdateRpcTimeoutOrCancelledError" }, ).stack | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076 |
updateName | readonly | string | TaggedError( UPDATE_RPC_TIMEOUT_OR_CANCELLED_ERROR_TAG, { name: "UpdateRpcTimeoutOrCancelledError" }, ).updateName | packages/client/src/errors.ts:434 |
UpdateValidationError
Defined in: packages/client/src/errors.ts:342
Surfaced on the Err channel 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:349
Parameters
| Parameter | Type |
|---|---|
updateName | string |
direction | "input" | "output" |
issues | readonly Issue[] |
Returns
Overrides
TaggedError(UPDATE_VALIDATION_ERROR_TAG, {
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(UPDATE_VALIDATION_ERROR_TAG, { name: "UpdateValidationError", })._tag | node_modules/.pnpm/unthrown@5.11.0/node_modules/unthrown/dist/index.d.mts:2332 |
cause? | public | unknown | TaggedError(UPDATE_VALIDATION_ERROR_TAG, { 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(UPDATE_VALIDATION_ERROR_TAG, { name: "UpdateValidationError", }).direction | packages/client/src/errors.ts:346 |
issues | readonly | readonly Issue[] | TaggedError(UPDATE_VALIDATION_ERROR_TAG, { name: "UpdateValidationError", }).issues | packages/client/src/errors.ts:347 |
message | public | string | TaggedError(UPDATE_VALIDATION_ERROR_TAG, { name: "UpdateValidationError", }).message | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075 |
name | public | string | TaggedError(UPDATE_VALIDATION_ERROR_TAG, { name: "UpdateValidationError", }).name | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074 |
stack? | public | string | TaggedError(UPDATE_VALIDATION_ERROR_TAG, { name: "UpdateValidationError", }).stack | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076 |
updateName | readonly | string | TaggedError(UPDATE_VALIDATION_ERROR_TAG, { name: "UpdateValidationError", }).updateName | packages/client/src/errors.ts:345 |
WorkflowAlreadyStartedError
Defined in: packages/client/src/errors.ts:97
Surfaced on the Err channel when starting a workflow collides with an existing execution — Temporal's WorkflowExecutionAlreadyStartedError. The most common cause is a startPolicy that rejects duplicates while a previous run is still in retention.
Modeled (rather than left to the defect channel) so idempotent callers can branch on it explicitly — e.g. fetch the existing handle and continue — without inspecting 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:104
Parameters
| Parameter | Type |
|---|---|
workflowType | string |
workflowId | string |
cause? | unknown |
Returns
Overrides
TaggedError(WORKFLOW_ALREADY_STARTED_ERROR_TAG, {
name: "WorkflowAlreadyStartedError",
})<{
workflowType: string;
workflowId: string;
cause?: unknown;
}>.constructorProperties
| Property | Modifier | Type | Inherited from | Defined in |
|---|---|---|---|---|
_tag | readonly | "@temporal-contract/WorkflowAlreadyStartedError" | TaggedError(WORKFLOW_ALREADY_STARTED_ERROR_TAG, { name: "WorkflowAlreadyStartedError", })._tag | node_modules/.pnpm/unthrown@5.11.0/node_modules/unthrown/dist/index.d.mts:2332 |
cause? | public | unknown | ActivityValidationError.cause | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24 |
message | public | string | TaggedError(WORKFLOW_ALREADY_STARTED_ERROR_TAG, { name: "WorkflowAlreadyStartedError", }).message | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075 |
name | public | string | TaggedError(WORKFLOW_ALREADY_STARTED_ERROR_TAG, { name: "WorkflowAlreadyStartedError", }).name | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074 |
stack? | public | string | TaggedError(WORKFLOW_ALREADY_STARTED_ERROR_TAG, { name: "WorkflowAlreadyStartedError", }).stack | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076 |
workflowId | readonly | string | TaggedError(WORKFLOW_ALREADY_STARTED_ERROR_TAG, { name: "WorkflowAlreadyStartedError", }).workflowId | packages/client/src/errors.ts:101 |
workflowType | readonly | string | TaggedError(WORKFLOW_ALREADY_STARTED_ERROR_TAG, { name: "WorkflowAlreadyStartedError", }).workflowType | packages/client/src/errors.ts:100 |
WorkflowCancelledError
Defined in: packages/client/src/errors.ts:190
Surfaced on the Err channel when the awaited workflow execution ended Cancelled — Temporal's WorkflowFailedError wrapping a CancelledFailure. cause keeps the original CancelledFailure.
Swallowing this error hides the cancellation. Cancellation rides the modeled Err(...) channel here (mirroring the worker package's cancellation errors), so generic error handling that maps every Err to a blanket "failed" outcome silently conflates "the workflow was cancelled on purpose" with "the workflow broke". Give cancellation its own matcher arm when the two must diverge.
Returned from executeWorkflow and handle.result().
Extends
TaggedErrorInstance<"@temporal-contract/WorkflowCancelledError", {cause?:CancelledFailure;workflowId:string; }>
Constructors
Constructor
new WorkflowCancelledError(workflowId, cause?): WorkflowCancelledError;Defined in: packages/client/src/errors.ts:196
Parameters
| Parameter | Type |
|---|---|
workflowId | string |
cause? | CancelledFailure |
Returns
Overrides
TaggedError(WORKFLOW_CANCELLED_ERROR_TAG, {
name: "WorkflowCancelledError",
})<{
workflowId: string;
cause?: CancelledFailure | undefined;
}>.constructorProperties
| Property | Modifier | Type | Inherited from | Defined in |
|---|---|---|---|---|
_tag | readonly | "@temporal-contract/WorkflowCancelledError" | TaggedError(WORKFLOW_CANCELLED_ERROR_TAG, { name: "WorkflowCancelledError", })._tag | node_modules/.pnpm/unthrown@5.11.0/node_modules/unthrown/dist/index.d.mts:2332 |
cause? | public | CancelledFailure | ActivityValidationError.cause | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24 |
message | public | string | TaggedError(WORKFLOW_CANCELLED_ERROR_TAG, { name: "WorkflowCancelledError", }).message | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075 |
name | public | string | TaggedError(WORKFLOW_CANCELLED_ERROR_TAG, { name: "WorkflowCancelledError", }).name | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074 |
stack? | public | string | TaggedError(WORKFLOW_CANCELLED_ERROR_TAG, { name: "WorkflowCancelledError", }).stack | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076 |
workflowId | readonly | string | TaggedError(WORKFLOW_CANCELLED_ERROR_TAG, { name: "WorkflowCancelledError", }).workflowId | packages/client/src/errors.ts:193 |
WorkflowExecutionNotFoundError
Defined in: packages/client/src/errors.ts:120
Surfaced on the Err channel when an operation targets a workflow execution that doesn't exist in the namespace — Temporal's 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:128
Parameters
| Parameter | Type |
|---|---|
workflowId | string |
runId? | string |
cause? | unknown |
Returns
WorkflowExecutionNotFoundError
Overrides
TaggedError(
WORKFLOW_EXECUTION_NOT_FOUND_ERROR_TAG,
{ name: "WorkflowExecutionNotFoundError" },
)<{
workflowId: string;
runId?: string | undefined;
cause?: unknown;
}>.constructorProperties
| Property | Modifier | Type | Inherited from | Defined in |
|---|---|---|---|---|
_tag | readonly | "@temporal-contract/WorkflowExecutionNotFoundError" | TaggedError( WORKFLOW_EXECUTION_NOT_FOUND_ERROR_TAG, { name: "WorkflowExecutionNotFoundError" }, )._tag | node_modules/.pnpm/unthrown@5.11.0/node_modules/unthrown/dist/index.d.mts:2332 |
cause? | public | unknown | ActivityValidationError.cause | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24 |
message | public | string | TaggedError( WORKFLOW_EXECUTION_NOT_FOUND_ERROR_TAG, { name: "WorkflowExecutionNotFoundError" }, ).message | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075 |
name | public | string | TaggedError( WORKFLOW_EXECUTION_NOT_FOUND_ERROR_TAG, { name: "WorkflowExecutionNotFoundError" }, ).name | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074 |
runId? | readonly | string | TaggedError( WORKFLOW_EXECUTION_NOT_FOUND_ERROR_TAG, { name: "WorkflowExecutionNotFoundError" }, ).runId | packages/client/src/errors.ts:125 |
stack? | public | string | TaggedError( WORKFLOW_EXECUTION_NOT_FOUND_ERROR_TAG, { name: "WorkflowExecutionNotFoundError" }, ).stack | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076 |
workflowId | readonly | string | TaggedError( WORKFLOW_EXECUTION_NOT_FOUND_ERROR_TAG, { name: "WorkflowExecutionNotFoundError" }, ).workflowId | packages/client/src/errors.ts:124 |
WorkflowFailedError
Defined in: packages/client/src/errors.ts:161
Surfaced on the Err channel 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) 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.
Cancellation, termination, and timeout outcomes do NOT surface here: they are classified into the first-class WorkflowCancelledError, WorkflowTerminatedError, and WorkflowTimeoutError before this generic wrapper is considered, so instanceof digging through cause is never needed to tell them apart.
retryState is Temporal's account of why the execution stopped retrying (e.g. "RETRY_STATE_MAXIMUM_ATTEMPTS_REACHED"), carried over from its wrapper.
Returned from executeWorkflow and handle.result().
Extends
TaggedErrorInstance<"@temporal-contract/WorkflowFailedError", {cause?:TemporalFailure;retryState?:RetryState;workflowId:string; }>
Constructors
Constructor
new WorkflowFailedError(
workflowId,
cause?,
retryState?
): WorkflowFailedError;Defined in: packages/client/src/errors.ts:168
Parameters
| Parameter | Type |
|---|---|
workflowId | string |
cause? | TemporalFailure |
retryState? | RetryState |
Returns
Overrides
TaggedError(WORKFLOW_FAILED_ERROR_TAG, {
name: "WorkflowFailedError",
})<{
workflowId: string;
cause?: TemporalFailure | undefined;
retryState?: RetryState | undefined;
}>.constructorProperties
| Property | Modifier | Type | Inherited from | Defined in |
|---|---|---|---|---|
_tag | readonly | "@temporal-contract/WorkflowFailedError" | TaggedError(WORKFLOW_FAILED_ERROR_TAG, { name: "WorkflowFailedError", })._tag | node_modules/.pnpm/unthrown@5.11.0/node_modules/unthrown/dist/index.d.mts:2332 |
cause? | public | TemporalFailure | ActivityValidationError.cause | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24 |
message | public | string | TaggedError(WORKFLOW_FAILED_ERROR_TAG, { name: "WorkflowFailedError", }).message | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075 |
name | public | string | TaggedError(WORKFLOW_FAILED_ERROR_TAG, { name: "WorkflowFailedError", }).name | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074 |
retryState? | readonly | RetryState | TaggedError(WORKFLOW_FAILED_ERROR_TAG, { name: "WorkflowFailedError", }).retryState | packages/client/src/errors.ts:166 |
stack? | public | string | TaggedError(WORKFLOW_FAILED_ERROR_TAG, { name: "WorkflowFailedError", }).stack | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076 |
workflowId | readonly | string | TaggedError(WORKFLOW_FAILED_ERROR_TAG, { name: "WorkflowFailedError", }).workflowId | packages/client/src/errors.ts:164 |
WorkflowTerminatedError
Defined in: packages/client/src/errors.ts:210
Surfaced on the Err channel when the awaited workflow execution was terminated — Temporal's WorkflowFailedError wrapping a TerminatedFailure. cause keeps the original TerminatedFailure (whose message carries the terminate reason, when one was given).
Returned from executeWorkflow and handle.result().
Extends
TaggedErrorInstance<"@temporal-contract/WorkflowTerminatedError", {cause?:TerminatedFailure;workflowId:string; }>
Constructors
Constructor
new WorkflowTerminatedError(workflowId, cause?): WorkflowTerminatedError;Defined in: packages/client/src/errors.ts:216
Parameters
| Parameter | Type |
|---|---|
workflowId | string |
cause? | TerminatedFailure |
Returns
Overrides
TaggedError(WORKFLOW_TERMINATED_ERROR_TAG, {
name: "WorkflowTerminatedError",
})<{
workflowId: string;
cause?: TerminatedFailure | undefined;
}>.constructorProperties
| Property | Modifier | Type | Inherited from | Defined in |
|---|---|---|---|---|
_tag | readonly | "@temporal-contract/WorkflowTerminatedError" | TaggedError(WORKFLOW_TERMINATED_ERROR_TAG, { name: "WorkflowTerminatedError", })._tag | node_modules/.pnpm/unthrown@5.11.0/node_modules/unthrown/dist/index.d.mts:2332 |
cause? | public | TerminatedFailure | ActivityValidationError.cause | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24 |
message | public | string | TaggedError(WORKFLOW_TERMINATED_ERROR_TAG, { name: "WorkflowTerminatedError", }).message | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075 |
name | public | string | TaggedError(WORKFLOW_TERMINATED_ERROR_TAG, { name: "WorkflowTerminatedError", }).name | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074 |
stack? | public | string | TaggedError(WORKFLOW_TERMINATED_ERROR_TAG, { name: "WorkflowTerminatedError", }).stack | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076 |
workflowId | readonly | string | TaggedError(WORKFLOW_TERMINATED_ERROR_TAG, { name: "WorkflowTerminatedError", }).workflowId | packages/client/src/errors.ts:213 |
WorkflowTimeoutError
Defined in: packages/client/src/errors.ts:232
Surfaced on the Err channel when the awaited workflow execution timed out — Temporal's WorkflowFailedError wrapping a TimeoutFailure. cause keeps the original TimeoutFailure (whose timeoutType names which timeout fired).
Returned from executeWorkflow and handle.result().
Extends
TaggedErrorInstance<"@temporal-contract/WorkflowTimeoutError", {cause?:TimeoutFailure;workflowId:string; }>
Constructors
Constructor
new WorkflowTimeoutError(workflowId, cause?): WorkflowTimeoutError;Defined in: packages/client/src/errors.ts:238
Parameters
| Parameter | Type |
|---|---|
workflowId | string |
cause? | TimeoutFailure |
Returns
Overrides
TaggedError(WORKFLOW_TIMEOUT_ERROR_TAG, {
name: "WorkflowTimeoutError",
})<{
workflowId: string;
cause?: TimeoutFailure | undefined;
}>.constructorProperties
| Property | Modifier | Type | Inherited from | Defined in |
|---|---|---|---|---|
_tag | readonly | "@temporal-contract/WorkflowTimeoutError" | TaggedError(WORKFLOW_TIMEOUT_ERROR_TAG, { name: "WorkflowTimeoutError", })._tag | node_modules/.pnpm/unthrown@5.11.0/node_modules/unthrown/dist/index.d.mts:2332 |
cause? | public | TimeoutFailure | ActivityValidationError.cause | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24 |
message | public | string | TaggedError(WORKFLOW_TIMEOUT_ERROR_TAG, { name: "WorkflowTimeoutError", }).message | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075 |
name | public | string | TaggedError(WORKFLOW_TIMEOUT_ERROR_TAG, { name: "WorkflowTimeoutError", }).name | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074 |
stack? | public | string | TaggedError(WORKFLOW_TIMEOUT_ERROR_TAG, { name: "WorkflowTimeoutError", }).stack | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076 |
workflowId | readonly | string | TaggedError(WORKFLOW_TIMEOUT_ERROR_TAG, { name: "WorkflowTimeoutError", }).workflowId | packages/client/src/errors.ts:235 |
WorkflowValidationError
Defined in: packages/client/src/errors.ts:253
Surfaced on the Err channel when workflow input or output validation fails.
workflowId identifies the targeted execution when the failing call knows it (start/execute/signalWithStart options, a handle's bound execution); it is absent for call sites without one: schedule.create (runs are spawned later), workflowIdFor, and the input check of a workflow whose contract derives its ID (the ID is derived from the validated input).
Extends
TaggedErrorInstance<"@temporal-contract/WorkflowValidationError", {direction:"input"|"output";issues: readonlyIssue[];workflowId?:string;workflowName:string; }>
Constructors
Constructor
new WorkflowValidationError(
workflowName,
direction,
issues,
workflowId?
): WorkflowValidationError;Defined in: packages/client/src/errors.ts:261
Parameters
| Parameter | Type |
|---|---|
workflowName | string |
direction | "input" | "output" |
issues | readonly Issue[] |
workflowId? | string |
Returns
Overrides
TaggedError(WORKFLOW_VALIDATION_ERROR_TAG, {
name: "WorkflowValidationError",
})<{
workflowName: string;
direction: "input" | "output";
issues: ReadonlyArray<StandardSchemaV1.Issue>;
workflowId?: string | undefined;
}>.constructorProperties
| Property | Modifier | Type | Inherited from | Defined in |
|---|---|---|---|---|
_tag | readonly | "@temporal-contract/WorkflowValidationError" | TaggedError(WORKFLOW_VALIDATION_ERROR_TAG, { name: "WorkflowValidationError", })._tag | node_modules/.pnpm/unthrown@5.11.0/node_modules/unthrown/dist/index.d.mts:2332 |
cause? | public | unknown | TaggedError(WORKFLOW_VALIDATION_ERROR_TAG, { 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(WORKFLOW_VALIDATION_ERROR_TAG, { name: "WorkflowValidationError", }).direction | packages/client/src/errors.ts:257 |
issues | readonly | readonly Issue[] | TaggedError(WORKFLOW_VALIDATION_ERROR_TAG, { name: "WorkflowValidationError", }).issues | packages/client/src/errors.ts:258 |
message | public | string | TaggedError(WORKFLOW_VALIDATION_ERROR_TAG, { name: "WorkflowValidationError", }).message | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075 |
name | public | string | TaggedError(WORKFLOW_VALIDATION_ERROR_TAG, { name: "WorkflowValidationError", }).name | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074 |
stack? | public | string | TaggedError(WORKFLOW_VALIDATION_ERROR_TAG, { name: "WorkflowValidationError", }).stack | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076 |
workflowId? | readonly | string | TaggedError(WORKFLOW_VALIDATION_ERROR_TAG, { name: "WorkflowValidationError", }).workflowId | packages/client/src/errors.ts:259 |
workflowName | readonly | string | TaggedError(WORKFLOW_VALIDATION_ERROR_TAG, { name: "WorkflowValidationError", }).workflowName | packages/client/src/errors.ts:256 |
Type Aliases
ActivityContractErrorsOf
type ActivityContractErrorsOf<TActivity> = TActivity extends object ? ContractErrorUnion<TErrors> : never;Defined in: packages/client/src/types.ts:219
Typed contract-error union for an activity's declared errors map, or never when it declares none.
Type Parameters
| Type Parameter |
|---|
TActivity extends ActivityDefinition |
ActivityResultErrorsOf
type ActivityResultErrorsOf<TActivity> =
| ActivityContractErrorsOf<TActivity>
| ActivityValidationError
| ActivityFailedError
| ActivityCancelledError
| ActivityTerminatedError
| ActivityTimeoutError
| ActivityExecutionNotFoundError;Defined in: packages/client/src/types.ts:232
Union of the modeled errors awaiting a standalone activity's result can surface — the shared tail of executeActivity and the activity handle's result(): any contract error declared on the activity, output validation, the generic failure, the three first-class outcomes, and a missing execution.
Type Parameters
| Type Parameter |
|---|
TActivity extends ActivityDefinition |
AnyContractError
type AnyContractError = ContractError<string, unknown>;Defined in: packages/contract/dist/errors-impl-D7p9uupF.d.mts:63
Widest ContractError instantiation — useful as a constraint or for instanceof-style narrowing before discriminating on errorName.
ClientInferInput
type ClientInferInput<T> = StandardSchemaV1.InferInput<T["input"]>;Defined in: packages/contract/dist/types-DjpDZs60.d.mts:454
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-DjpDZs60.d.mts:461
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>,
| QueryValidationError
| QueryFailedError
| WorkflowExecutionNotFoundError>;Defined in: packages/client/src/types.ts:77
Infer query handler signature from client perspective. Client sends the query input type and receives the output type wrapped in an AsyncResult; the payload argument is omittable when the schema accepts undefined (e.g. argument-less defineQuery({ output })). The error union names exactly what the handle's query proxy produces: input/output-validation failure, a query the execution could not serve (unregistered handler or a throwing handler — QueryFailedError), or a missing execution.
Type Parameters
| Type Parameter |
|---|
TQuery extends QueryDefinition |
Parameters
| Parameter | Type |
|---|---|
...args | undefined extends ClientInferInput<TQuery> ? [ClientInferInput<TQuery>] : [ClientInferInput<TQuery>] |
Returns
AsyncResult<ClientInferOutput<TQuery>, | QueryValidationError | QueryFailedError | WorkflowExecutionNotFoundError>
ClientInferSignal
type ClientInferSignal<TSignal> = (...args) => AsyncResult<void,
| SignalValidationError
| WorkflowExecutionNotFoundError>;Defined in: packages/client/src/types.ts:61
Infer signal handler signature from client perspective. Client sends the signal input type; the payload argument is omittable when the schema accepts undefined (e.g. payload-less defineSignal()). The error union names exactly what the handle's signal proxy produces: input-validation failure or a missing execution.
Type Parameters
| Type Parameter |
|---|
TSignal extends SignalDefinition |
Parameters
| Parameter | Type |
|---|---|
...args | undefined extends ClientInferInput<TSignal> ? [ClientInferInput<TSignal>] : [ClientInferInput<TSignal>] |
Returns
AsyncResult<void, | SignalValidationError | WorkflowExecutionNotFoundError>
ClientInferUpdate
type ClientInferUpdate<TUpdate> = (...args) => AsyncResult<ClientInferOutput<TUpdate>,
| UpdateValidationError
| UpdateRejectedError
| UpdateFailedError
| UpdateRpcTimeoutOrCancelledError
| WorkflowExecutionNotFoundError>;Defined in: packages/client/src/types.ts:110
Infer update handler signature from client perspective. Client sends the update input type and receives the output type wrapped in an AsyncResult; the payload argument is omittable when the schema accepts undefined (e.g. argument-less defineUpdate({ output })), and an optional second argument carries the updateId. The error union names exactly what the handle's update proxy produces: input/output-validation failure, a worker-side admission rejection (UpdateRejectedError), a failed admitted handler (UpdateFailedError), a timed-out or cancelled update call, or a missing execution.
Type Parameters
| Type Parameter |
|---|
TUpdate extends UpdateDefinition |
Parameters
| Parameter | Type |
|---|---|
...args | undefined extends ClientInferInput<TUpdate> ? [ClientInferInput<TUpdate>, UpdateCallOptions] : [ClientInferInput<TUpdate>, UpdateCallOptions] |
Returns
AsyncResult<ClientInferOutput<TUpdate>, | UpdateValidationError | UpdateRejectedError | UpdateFailedError | UpdateRpcTimeoutOrCancelledError | WorkflowExecutionNotFoundError>
ClientInferWorkflowQueries
type ClientInferWorkflowQueries<T> = T["queries"] extends Record<string, QueryDefinition> ? { [K in keyof T["queries"]]: ClientInferQuery<T["queries"][K]> } : Record<never, never>;Defined in: packages/client/src/types.ts:136
Infer queries from a workflow definition (client perspective)
Type Parameters
| Type Parameter |
|---|
T extends AnyWorkflowDefinition |
ClientInferWorkflowSignals
type ClientInferWorkflowSignals<T> = T["signals"] extends Record<string, SignalDefinition> ? { [K in keyof T["signals"]]: ClientInferSignal<T["signals"][K]> } : Record<never, never>;Defined in: packages/client/src/types.ts:126
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]> } : Record<never, never>;Defined in: packages/client/src/types.ts:146
Infer updates from a workflow definition (client perspective)
Type Parameters
| Type Parameter |
|---|
T extends AnyWorkflowDefinition |
ContractActivityOf
type ContractActivityOf<TContract, TName> = TContract["activities"] extends Record<string, ActivityDefinition> ? TName extends keyof TContract["activities"] ? TContract["activities"][TName] : never : never;Defined in: packages/client/src/types.ts:208
The declared global activity named TName on TContract, or never — the activities a standalone call can target.
Type Parameters
| Type Parameter |
|---|
TContract extends ContractDefinition |
TName |
ContractErrorUnion
type ContractErrorUnion<TErrors> = { [K in keyof TErrors & string]: ContractError<K, InferErrorData<TErrors[K]>> }[keyof TErrors & string];Defined in: packages/contract/dist/errors-impl-D7p9uupF.d.mts:79
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> |
CreateClientOptions
type CreateClientOptions = object;Defined in: packages/client/src/options.ts:25
Options for TypedClient.create — the single options-object shape shared by the org's Typed*.create() factories.
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
client | Client | The underlying @temporalio/client Client. | packages/client/src/options.ts:27 |
onRehydrationMiss? | (miss) => void | Called when a failure whose type names a declared contract error does NOT rehydrate into it (its payload fails the declared schema, or a data-less error lacks the wire marker) and degrades to the generic WorkflowFailedError — a signal of schema drift between client and worker, or of a foreign failure reusing a declared name. A throwing hook is swallowed. Library packages don't log; wire your own here. | packages/client/src/options.ts:36 |
DerivedIdWorkflowName
type DerivedIdWorkflowName<TContract> = { [K in keyof TContract["workflows"] & string]: TContract["workflows"][K]["workflowId"] extends (input: never) => string ? K : never }[keyof TContract["workflows"] & string];Defined in: packages/client/src/options.ts:80
Names of the contract's workflows that derive their workflow ID.
Type Parameters
| Type Parameter |
|---|
TContract extends ContractDefinition |
RehydrationMiss
type RehydrationMiss = object;Defined in: packages/contract/dist/errors-impl-D7p9uupF.d.mts:131
Diagnostic payload describing a rehydration miss: a failure whose type matched a declared error name but that could not be rehydrated as the typed ContractError and degraded to the caller's generic failure classification.
Properties
TemporalFailure
type TemporalFailure =
| ApplicationFailure
| CancelledFailure
| TerminatedFailure
| TimeoutFailure
| ChildWorkflowFailure
| ServerFailure
| ActivityFailure;Defined in: packages/client/src/errors.ts:58
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.
Note that the cancellation/termination/timeout members are classified into their own first-class errors (WorkflowCancelledError, WorkflowTerminatedError, WorkflowTimeoutError) before a generic WorkflowFailedError is ever surfaced, so in practice a WorkflowFailedError.cause carries one of the remaining members.
Re-exported from the package entry point so consumers can import it directly: import type { TemporalFailure } from "@temporal-contract/client".
TypedActivityHandle
type TypedActivityHandle<TActivity> = object;Defined in: packages/client/src/activity.ts:55
Typed handle to a standalone activity execution, returned by ContractClient.startActivity and getActivityHandle.
Type Parameters
| Type Parameter |
|---|
TActivity extends ActivityDefinition |
Properties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
activityId | readonly | string | - | packages/client/src/activity.ts:56 |
cancel | public | (reason?) => AsyncResult<void, ActivityExecutionNotFoundError> | Request cancellation — cooperative: the activity must heartbeat to see it. | packages/client/src/activity.ts:81 |
describe | public | (options?) => AsyncResult<ActivityExecutionDescription, ActivityExecutionNotFoundError> | Describe the execution (status, attempts, timing, …). | packages/client/src/activity.ts:77 |
raw | readonly | ActivityHandle | The underlying @temporalio/client ActivityHandle — the escape hatch for what the typed surface doesn't cover (pause, updateOptions, …). | packages/client/src/activity.ts:67 |
result | public | () => AsyncResult<ClientInferOutput<TActivity>, ActivityResultErrorsOf<TActivity>> | Wait for the activity's result, parsed against its output schema. A failure matching one of the activity's declared errors surfaces as that typed ContractError; a cancelled / terminated / timed-out execution as the first-class ActivityCancelledError / ActivityTerminatedError / ActivityTimeoutError; anything else as ActivityFailedError. | packages/client/src/activity.ts:75 |
runId | readonly | string | undefined | Run ID of the execution this handle is pinned to: the started run for startActivity handles, the caller-provided runId (or undefined, meaning the latest run) for getActivityHandle handles. | packages/client/src/activity.ts:62 |
terminate | public | (reason?) => AsyncResult<void, ActivityExecutionNotFoundError> | Terminate the execution. The worker is not notified and may keep running it. | packages/client/src/activity.ts:83 |
TypedActivityStartOptions
type TypedActivityStartOptions<TActivity> = Omit<ActivityOptions, "id" | "taskQueue" | "args" | "typeInfo"> & object & undefined extends ClientInferInput<TActivity> ? object : object;Defined in: packages/client/src/options.ts:216
Options for ContractClient.startActivity / executeActivity: Temporal's standalone ActivityOptions, minus what the contract owns (the task queue) and with the payload typed against the activity's input schema.
The activity's contract-level activityOptions are the defaults; fields set here shallow-merge over them (a retry here replaces the contract's whole retry block). The merged options need a per-attempt bound (startToCloseTimeout or scheduleToCloseTimeout) and a total bound (scheduleToCloseTimeout, or a finite positive retry.maximumAttempts).
idConflictPolicy accepts only "FAIL" (the default) and "USE_EXISTING": Temporal has no TerminateExisting for activities.
Type Declaration
| Name | Type | Description | Defined in |
|---|---|---|---|
activityId | string | The activity ID — a meaningful business ID is recommended. | packages/client/src/options.ts:221 |
Type Parameters
| Type Parameter |
|---|
TActivity extends ActivityDefinition |
TypedGetHandleOptions
type TypedGetHandleOptions = Omit<GetWorkflowHandleOptions, "followRuns"> & object;Defined in: packages/client/src/options.ts:173
Options for ContractClient.getHandle. Temporal's GetWorkflowHandleOptions (firstExecutionRunId — the chain interlock ensuring mutating methods don't cross into another execution chain) with the optional runId of the specific execution to bind. followRuns is not offered: the handle always follows the run chain, so result() never meets Temporal's unmodeled WorkflowContinuedAsNewError.
Type Declaration
| Name | Type | Description | Defined in |
|---|---|---|---|
runId? | string | Run ID of the specific execution to bind the handle to. Omitted, the handle addresses the latest execution of the workflow ID. | packages/client/src/options.ts:178 |
TypedScheduleActionOverrides
type TypedScheduleActionOverrides = Pick<ScheduleOptionsStartWorkflowAction<never>,
| "workflowId"
| "workflowExecutionTimeout"
| "workflowRunTimeout"
| "workflowTaskTimeout"
| "retry"
| "memo"
| "staticDetails"
| "staticSummary">;Defined in: packages/client/src/schedule.ts:46
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> = ScheduleCreateFields & WorkflowArgsField<TContract["workflows"][TWorkflowName]> & object;Defined in: packages/client/src/schedule.ts:67
Options for TypedScheduleClient.create.
scheduleId, spec, policies, state, and memo are Temporal's own schedule-level ScheduleOptions. args is typed against the destination workflow's input schema (omittable when the schema accepts undefined). Workflow-action–level overrides nest under action so memo and other fields with the same name don't collide between the two scopes.
Type Declaration
| Name | Type | Description | Defined in |
|---|---|---|---|
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:80 |
Type Parameters
| Type Parameter |
|---|
TContract extends ContractDefinition |
TWorkflowName extends keyof TContract["workflows"] & string |
TypedScheduleHandle
type TypedScheduleHandle = object;Defined in: packages/client/src/schedule.ts:110
Typed handle to a schedule. Mirrors Temporal's ScheduleHandle lifecycle methods (pause, unpause, trigger, update, backfill, describe, delete) wrapped in the unthrown AsyncResult pattern so call sites match the rest of the typed client.
Every method surfaces a missing schedule (Temporal's ScheduleNotFoundError — wrong ID, or the schedule was deleted) as the modeled ScheduleNotFoundError on the Err channel; any other failure is a technical fault routed to the Defect channel with a RuntimeClientError cause.
Properties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
backfill | public | (options) => AsyncResult<void, ScheduleNotFoundError> | Run the schedule's action for historical time ranges, as if the schedule had been active over them. Passthrough of Temporal's ScheduleHandle.backfill. | packages/client/src/schedule.ts:164 |
delete | public | () => AsyncResult<void, ScheduleNotFoundError> | Delete the schedule. | packages/client/src/schedule.ts:166 |
describe | public | () => AsyncResult<ScheduleDescription, ScheduleNotFoundError> | Fetch the schedule's current description from the server. | packages/client/src/schedule.ts:168 |
pause | public | (note?) => AsyncResult<void, ScheduleNotFoundError> | Pause the schedule. Optional note becomes part of the audit trail. | packages/client/src/schedule.ts:120 |
raw | readonly | ScheduleHandle | The underlying @temporalio/client ScheduleHandle — the escape hatch for anything the typed surface doesn't cover. Calls made through raw bypass contract validation. | packages/client/src/schedule.ts:118 |
scheduleId | readonly | string | This schedule's identifier. | packages/client/src/schedule.ts:112 |
trigger | public | (overlap?) => AsyncResult<void, ScheduleNotFoundError> | Fire the schedule's action immediately. | packages/client/src/schedule.ts:124 |
unpause | public | (note?) => AsyncResult<void, ScheduleNotFoundError> | Resume a paused schedule. | packages/client/src/schedule.ts:122 |
update | public | (updateFn) => AsyncResult<void, | ScheduleNotFoundError | WorkflowValidationError> | Update the schedule definition: the handle fetches the current description, hands it to updateFn, and persists the returned options. When the returned action's workflowType names a workflow declared on the bound contract, the action is re-checked before anything is persisted, the same way create checks it: its args against the workflow's input schema (a mismatch is WorkflowValidationError on the Err channel), and its typedSearchAttributes against the declared attributes and kinds, and its taskQueue against the contract's (either mismatch is a misconfiguration, so a defect). The schedule is left untouched on any of them. An action whose workflowType is NOT declared on the contract is persisted as-is (passthrough — the contract has no schema to check it against); prefer delete + create for contract-level changes. Concurrency: last writer wins. Temporal's UpdateSchedule RPC is unconditional — the TypeScript SDK sends no conflict token and does not re-run updateFn on a conflict — so a concurrent modification landing between the read and the write is overwritten. That is true of the raw SDK too; this wrapper does not weaken it, but it does widen the window slightly: validation is asynchronous (schemas may be), so the wrapper fetches the description itself and hands the already-computed options to ScheduleHandle.update, which describes again internally. updateFn is invoked exactly once per call, and the options that are validated are exactly the options that are persisted. If two writers can race on one schedule, serialize them yourself. | packages/client/src/schedule.ts:154 |
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/types.ts:195
Typed searchAttributes map for a workflow, derived from the workflow's declared searchAttributes. Each key is constrained to a declared attribute name; each value's type is determined by the attribute's kind (e.g. KEYWORD → string, INT → number, DATETIME → Date, KEYWORD_LIST → string[]).
If the workflow declares no search attributes, this resolves to never, meaning the searchAttributes field is effectively absent from the start options for that workflow.
Type Parameters
| Type Parameter |
|---|
TWorkflow extends AnyWorkflowDefinition |
TypedSignalWithStartOptions
type TypedSignalWithStartOptions<TContract, TWorkflowName, TSignalName> = TypedWorkflowStartOptions<TContract, TWorkflowName> & SignalArgsField<TContract["workflows"][TWorkflowName]["signals"][TSignalName]> & object;Defined in: packages/client/src/options.ts:121
Options for ContractClient.signalWithStart — the start options of TypedWorkflowStartOptions plus the signal, typed against the named signal's input schema. The signal is addressed by the signalName field of this options bag (there is no positional signal parameter), keeping the method at two positional arguments like the rest of the surface.
Type Declaration
| Name | Type | Defined in |
|---|---|---|
signalName | TSignalName | packages/client/src/options.ts:127 |
Type Parameters
| Type Parameter |
|---|
TContract extends ContractDefinition |
TWorkflowName extends keyof TContract["workflows"] & string |
TSignalName extends InferSignalNames<TContract["workflows"][TWorkflowName]> |
TypedStartUpdateOptions
type TypedStartUpdateOptions<TUpdate> = object & undefined extends ClientInferInput<TUpdate> ? object : object;Defined in: packages/client/src/options.ts:186
Options for TypedWorkflowHandle.startUpdate — the update payload plus the passthrough subset of Temporal's WorkflowUpdateOptions. Passed as the second (positional) argument after the update name.
Type Declaration
| Name | Type | Description | Defined in |
|---|---|---|---|
updateId? | string | Unique ID for this update request (passthrough of Temporal's updateId). Meaningful business IDs enable deduplication. | packages/client/src/options.ts:191 |
waitForStage? | "ACCEPTED" | Update lifecycle stage to wait for before the handle is returned. Temporal currently only supports "ACCEPTED", which is also the default — the option exists as a forward-compatible passthrough. | packages/client/src/options.ts:197 |
Type Parameters
| Type Parameter |
|---|
TUpdate extends UpdateDefinition |
TypedUpdateWithStartOptions
type TypedUpdateWithStartOptions<TContract, TWorkflowName, TUpdateName> = TypedWorkflowStartOptions<TContract, TWorkflowName> & UpdateArgsField<TContract["workflows"][TWorkflowName]["updates"][TUpdateName]> & object;Defined in: packages/client/src/options.ts:147
Options for ContractClient.executeUpdateWithStart — the start options of TypedWorkflowStartOptions (with the workflowIdConflictPolicy Temporal requires for update-with-start) plus the update, addressed by updateName like signalWithStart's signal.
Type Declaration
| Name | Type | Description | Defined in |
|---|---|---|---|
updateId? | string | Unique ID for this update request (passthrough of Temporal's updateId). | packages/client/src/options.ts:162 |
updateName | TUpdateName | - | packages/client/src/options.ts:160 |
workflowIdConflictPolicy | WorkflowIdConflictPolicy | What to do when an execution with this workflow ID is already running: "USE_EXISTING" sends the update to it, "FAIL" surfaces WorkflowAlreadyStartedError. Required by Temporal for update-with-start. | packages/client/src/options.ts:159 |
Type Parameters
| Type Parameter |
|---|
TContract extends ContractDefinition |
TWorkflowName extends keyof TContract["workflows"] & string |
TUpdateName extends InferUpdateNames<TContract["workflows"][TWorkflowName]> |
TypedWorkflowHandle
type TypedWorkflowHandle<TWorkflow> = object;Defined in: packages/client/src/handle.ts:126
Typed workflow handle with validated results using unthrown Result/AsyncResult
Type Parameters
| Type Parameter |
|---|
TWorkflow extends AnyWorkflowDefinition |
Properties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
cancel | public | () => AsyncResult<void, WorkflowExecutionNotFoundError> | Cancel workflow with Result pattern | packages/client/src/handle.ts:238 |
describe | public | () => AsyncResult<Awaited<ReturnType<WorkflowHandle["describe"]>>, WorkflowExecutionNotFoundError> | Get workflow execution description including status and metadata | packages/client/src/handle.ts:243 |
fetchHistory | public | () => AsyncResult<Awaited<ReturnType<WorkflowHandle["fetchHistory"]>>, WorkflowExecutionNotFoundError> | Fetch the workflow execution history | packages/client/src/handle.ts:251 |
firstExecutionRunId | readonly | string | undefined | Run ID of the first execution in the workflow chain, when known (set on handles returned by startWorkflow, and on getHandle handles when the caller passed firstExecutionRunId). | packages/client/src/handle.ts:143 |
getUpdateHandle | public | <TUpdateName>(updateName, updateId) => TypedWorkflowUpdateHandle<UpdateOf<TWorkflow, TUpdateName>> | Reattach to an update already sent to this execution, by its updateId — Temporal's getUpdateHandle, typed against the named update so result() parses the outcome against its output schema. Synchronous, like Temporal's: nothing is sent until result(). | packages/client/src/handle.ts:211 |
queries | public | ClientInferWorkflowQueries<TWorkflow> | Type-safe queries based on workflow definition with Result pattern. Each query returns an AsyncResult — erring with QueryValidationError (payload/result schema mismatch), QueryFailedError (no handler registered on the execution, the handler threw, or the query was rejected), or WorkflowExecutionNotFoundError — instead of a throwing Promise; the error union is carried by ClientInferWorkflowQueries directly. | packages/client/src/handle.ts:162 |
raw | readonly | WorkflowHandle | The underlying @temporalio/client WorkflowHandle — the escape hatch for anything the typed surface doesn't cover yet (e.g. raw.cancel() with SDK-specific options). Calls made through raw bypass contract validation. Mirrors TypedClient.raw at the handle level. | packages/client/src/handle.ts:151 |
result | public | () => AsyncResult<ClientInferOutput<TWorkflow>, WorkflowResultErrorsOf<TWorkflow>> | 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. A cancelled / terminated / timed-out execution surfaces as the first-class WorkflowCancelledError / WorkflowTerminatedError / WorkflowTimeoutError — no instanceof digging through WorkflowFailedError.cause required. Cancellation is a modeled Err(...): give it its own matcher arm rather than folding it into a blanket "failed" branch, so a deliberate cancel isn't reported as a breakage. | packages/client/src/handle.ts:228 |
runId | readonly | string | undefined | Run ID of the execution this handle is pinned to: the caller-provided runId for getHandle handles, undefined otherwise — a started handle follows its run chain (a continue-as-new moves it to the next run), so it is not pinned to the run it started. See firstExecutionRunId for the run a start created. | packages/client/src/handle.ts:136 |
signals | public | ClientInferWorkflowSignals<TWorkflow> | Type-safe signals based on workflow definition with Result pattern. Each signal returns an AsyncResult — erring with SignalValidationError or WorkflowExecutionNotFoundError — instead of a throwing Promise; the error union is carried by ClientInferWorkflowSignals directly. | packages/client/src/handle.ts:171 |
startUpdate | public | <TUpdateName>(updateName, ...options) => AsyncResult<TypedWorkflowUpdateHandle<UpdateOf<TWorkflow, TUpdateName>>, StartUpdateError> | Start an update without waiting for its completion — Temporal's startUpdate beside the updates map's execute-and-wait shape. The update is addressed positionally (startUpdate(updateName, options)); everything else rides the TypedStartUpdateOptions bag. The options parameter is omittable when the update's input schema accepts undefined (e.g. an argument-less defineUpdate({ output })). Returns a TypedWorkflowUpdateHandle once the update is accepted or rejected: a worker-side admission rejection (and a failed handler) surfaces on the update handle's result(), not here. | packages/client/src/handle.ts:198 |
terminate | public | (reason?) => AsyncResult<void, WorkflowExecutionNotFoundError> | Terminate workflow with Result pattern | packages/client/src/handle.ts:233 |
updates | public | ClientInferWorkflowUpdates<TWorkflow> | Type-safe updates based on workflow definition with Result pattern. Each update starts the update AND waits for its result (Temporal's executeUpdate) — updates.name(input, { updateId }) — returning an AsyncResult that errs with UpdateValidationError, UpdateRejectedError (worker-side admission rejection), UpdateFailedError (the admitted handler failed), UpdateRpcTimeoutOrCancelledError, or WorkflowExecutionNotFoundError; use startUpdate to obtain an update handle without waiting for completion. | packages/client/src/handle.ts:184 |
workflowId | readonly | string | - | packages/client/src/handle.ts:127 |
TypedWorkflowHandleWithSignaledRunId
type TypedWorkflowHandleWithSignaledRunId<TWorkflow> = TypedWorkflowHandle<TWorkflow> & object;Defined in: packages/client/src/handle.ts:113
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/handle.ts:120 |
Type Parameters
| Type Parameter |
|---|
TWorkflow extends AnyWorkflowDefinition |
TypedWorkflowStartOptions
type TypedWorkflowStartOptions<TContract, TWorkflowName> = Omit<WorkflowStartOptions, ContractOwnedStartFields> & WorkflowIdField<TContract["workflows"][TWorkflowName]> & WorkflowArgsField<TContract["workflows"][TWorkflowName]> & object;Defined in: packages/client/src/options.ts:88
Type Declaration
| Name | Type | Description | Defined in |
|---|---|---|---|
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/options.ts:100 |
Type Parameters
| Type Parameter |
|---|
TContract extends ContractDefinition |
TWorkflowName extends keyof TContract["workflows"] & string |
TypedWorkflowUpdateHandle
type TypedWorkflowUpdateHandle<TUpdate> = object;Defined in: packages/client/src/handle.ts:92
Typed handle to an update, returned by TypedWorkflowHandle.startUpdate and TypedWorkflowHandle.getUpdateHandle. result() parses the update's outcome against the contract's output schema on receive (the worker transmits its original return value).
Type Parameters
| Type Parameter |
|---|
TUpdate extends UpdateDefinition |
Properties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
result | public | () => AsyncResult<ClientInferOutput<TUpdate>, UpdateResultError> | Wait for and return the update's result, parsed against the contract's output schema. A worker-side admission rejection surfaces here as UpdateRejectedError, a failed (admitted) handler as UpdateFailedError — both on the Err channel, never as defects. | packages/client/src/handle.ts:105 |
updateId | readonly | string | The ID of this update request. | packages/client/src/handle.ts:94 |
workflowId | readonly | string | The ID of the workflow execution targeted by this update. | packages/client/src/handle.ts:96 |
workflowRunId | readonly | string | undefined | The run ID of the targeted execution, when known. | packages/client/src/handle.ts:98 |
WorkflowContractErrorsOf
type WorkflowContractErrorsOf<TWorkflow> = TWorkflow extends object ? ContractErrorUnion<TErrors> : never;Defined in: packages/client/src/types.ts:162
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 |
WorkflowResultErrorsOf
type WorkflowResultErrorsOf<TWorkflow> =
| WorkflowContractErrorsOf<TWorkflow>
| WorkflowValidationError
| WorkflowFailedError
| WorkflowCancelledError
| WorkflowTerminatedError
| WorkflowTimeoutError
| WorkflowExecutionNotFoundError;Defined in: packages/client/src/types.ts:175
Union of the modeled errors a result-awaiting call can surface for a workflow — the shared tail of executeWorkflow and handle.result(): any contract error declared on the workflow, plus output validation, the generic completion failure, the three first-class workflow outcomes (cancelled / terminated / timed out), and a missing execution.
Type Parameters
| Type Parameter |
|---|
TWorkflow extends AnyWorkflowDefinition |
Variables
ACTIVITY_ALREADY_STARTED_ERROR_TAG
const ACTIVITY_ALREADY_STARTED_ERROR_TAG: "@temporal-contract/ActivityAlreadyStartedError" = "@temporal-contract/ActivityAlreadyStartedError";Defined in: packages/client/src/error-tags.ts:77
_tag of ActivityAlreadyStartedError — starting a standalone activity collided with a running one.
ACTIVITY_CANCELLED_ERROR_TAG
const ACTIVITY_CANCELLED_ERROR_TAG: "@temporal-contract/ActivityCancelledError" = "@temporal-contract/ActivityCancelledError";Defined in: packages/client/src/error-tags.ts:91
_tag of the client's ActivityCancelledError — the standalone activity ended Canceled. Deliberately the same literal as the worker package's in-workflow ActivityCancelledError tag, as for WorkflowCancelledError.
ACTIVITY_EXECUTE_PATTERNS
const ACTIVITY_EXECUTE_PATTERNS: readonly [{
_tag: "@temporal-contract/ActivityAlreadyStartedError";
}, {
_tag: "@temporal-contract/ActivityValidationError";
}, {
_tag: "@temporal-contract/ActivityFailedError";
}, {
_tag: "@temporal-contract/ActivityCancelledError";
}, {
_tag: "@temporal-contract/ActivityTerminatedError";
}, {
_tag: "@temporal-contract/ActivityTimeoutError";
}, {
_tag: "@temporal-contract/ActivityExecutionNotFoundError";
}];Defined in: packages/client/src/error-patterns.ts:175
ContractClient.executeActivity is start + result: both phases, minus the activity's own declared errors.
ACTIVITY_EXECUTION_NOT_FOUND_ERROR_TAG
const ACTIVITY_EXECUTION_NOT_FOUND_ERROR_TAG: "@temporal-contract/ActivityExecutionNotFoundError" = "@temporal-contract/ActivityExecutionNotFoundError";Defined in: packages/client/src/error-tags.ts:80
_tag of ActivityExecutionNotFoundError — the targeted standalone activity doesn't exist in the namespace.
ACTIVITY_FAILED_ERROR_TAG
const ACTIVITY_FAILED_ERROR_TAG: "@temporal-contract/ActivityFailedError" = "@temporal-contract/ActivityFailedError";Defined in: packages/client/src/error-tags.ts:84
_tag of ActivityFailedError — the standalone activity completed with a (non-outcome) failure.
ACTIVITY_RESULT_PATTERNS
const ACTIVITY_RESULT_PATTERNS: readonly [{
_tag: "@temporal-contract/ActivityValidationError";
}, {
_tag: "@temporal-contract/ActivityFailedError";
}, {
_tag: "@temporal-contract/ActivityCancelledError";
}, {
_tag: "@temporal-contract/ActivityTerminatedError";
}, {
_tag: "@temporal-contract/ActivityTimeoutError";
}, {
_tag: "@temporal-contract/ActivityExecutionNotFoundError";
}];Defined in: packages/client/src/error-patterns.ts:162
The non-contract-error tail of ActivityResultErrorsOf — everything a standalone activity handle's result() can produce besides the activity's own declared errors.
ACTIVITY_START_PATTERNS
const ACTIVITY_START_PATTERNS: readonly [{
_tag: "@temporal-contract/ActivityValidationError";
}, {
_tag: "@temporal-contract/ActivityAlreadyStartedError";
}];Defined in: packages/client/src/error-patterns.ts:152
Every error ContractClient.startActivity can produce: its input failed validation, or a running activity already holds this activity ID.
ACTIVITY_TERMINATED_ERROR_TAG
const ACTIVITY_TERMINATED_ERROR_TAG: "@temporal-contract/ActivityTerminatedError" = "@temporal-contract/ActivityTerminatedError";Defined in: packages/client/src/error-tags.ts:94
_tag of ActivityTerminatedError — the standalone activity was terminated.
ACTIVITY_TIMEOUT_ERROR_TAG
const ACTIVITY_TIMEOUT_ERROR_TAG: "@temporal-contract/ActivityTimeoutError" = "@temporal-contract/ActivityTimeoutError";Defined in: packages/client/src/error-tags.ts:97
_tag of ActivityTimeoutError — the standalone activity timed out.
ACTIVITY_VALIDATION_ERROR_TAG
const ACTIVITY_VALIDATION_ERROR_TAG: "@temporal-contract/ActivityValidationError" = "@temporal-contract/ActivityValidationError";Defined in: packages/client/src/error-tags.ts:100
_tag of ActivityValidationError — standalone activity input/output failed schema validation.
CONTRACT_ERROR_TAG
const CONTRACT_ERROR_TAG: "@temporal-contract/ContractError" = "@temporal-contract/ContractError";Defined in: packages/contract/dist/error-tags-B9RXZ7FP.d.mts:17
_tag of ContractError — a contract-declared typed domain error.
QUERY_FAILED_ERROR_TAG
const QUERY_FAILED_ERROR_TAG: "@temporal-contract/QueryFailedError" = "@temporal-contract/QueryFailedError";Defined in: packages/client/src/error-tags.ts:52
_tag of QueryFailedError — the query could not be served (unregistered handler or handler failure).
QUERY_PATTERNS
const QUERY_PATTERNS: readonly [{
_tag: "@temporal-contract/QueryValidationError";
}, {
_tag: "@temporal-contract/QueryFailedError";
}, {
_tag: "@temporal-contract/WorkflowExecutionNotFoundError";
}];Defined in: packages/client/src/error-patterns.ts:124
Every error a handle.queries.* call can produce.
QUERY_VALIDATION_ERROR_TAG
const QUERY_VALIDATION_ERROR_TAG: "@temporal-contract/QueryValidationError" = "@temporal-contract/QueryValidationError";Defined in: packages/client/src/error-tags.ts:49
_tag of QueryValidationError — query input/output failed schema validation.
RUNTIME_CLIENT_ERROR_TAG
const RUNTIME_CLIENT_ERROR_TAG: "@temporal-contract/RuntimeClientError" = "@temporal-contract/RuntimeClientError";Defined in: packages/client/src/error-tags.ts:18
_tag of RuntimeClientError — generic technical-failure wrapper (rides the defect channel).
SCHEDULE_ALREADY_EXISTS_ERROR_TAG
const SCHEDULE_ALREADY_EXISTS_ERROR_TAG: "@temporal-contract/ScheduleAlreadyExistsError" = "@temporal-contract/ScheduleAlreadyExistsError";Defined in: packages/client/src/error-tags.ts:71
_tag of ScheduleAlreadyExistsError — schedule.create collided with a running schedule.
SCHEDULE_CREATE_PATTERNS
const SCHEDULE_CREATE_PATTERNS: readonly [{
_tag: "@temporal-contract/ScheduleAlreadyExistsError";
}, {
_tag: "@temporal-contract/WorkflowValidationError";
}];Defined in: packages/client/src/error-patterns.ts:143
Every error schedule.create can produce.
SCHEDULE_NOT_FOUND_ERROR_TAG
const SCHEDULE_NOT_FOUND_ERROR_TAG: "@temporal-contract/ScheduleNotFoundError" = "@temporal-contract/ScheduleNotFoundError";Defined in: packages/client/src/error-tags.ts:74
_tag of ScheduleNotFoundError — the schedule ID is unknown to the Temporal server.
SIGNAL_PATTERNS
const SIGNAL_PATTERNS: readonly [{
_tag: "@temporal-contract/SignalValidationError";
}, {
_tag: "@temporal-contract/WorkflowExecutionNotFoundError";
}];Defined in: packages/client/src/error-patterns.ts:118
Every error a handle.signals.* call can produce.
SIGNAL_VALIDATION_ERROR_TAG
const SIGNAL_VALIDATION_ERROR_TAG: "@temporal-contract/SignalValidationError" = "@temporal-contract/SignalValidationError";Defined in: packages/client/src/error-tags.ts:55
_tag of SignalValidationError — signal input failed schema validation.
UPDATE_FAILED_ERROR_TAG
const UPDATE_FAILED_ERROR_TAG: "@temporal-contract/UpdateFailedError" = "@temporal-contract/UpdateFailedError";Defined in: packages/client/src/error-tags.ts:61
_tag of UpdateFailedError — the update handler failed after admission.
UPDATE_PATTERNS
const UPDATE_PATTERNS: readonly [{
_tag: "@temporal-contract/UpdateValidationError";
}, {
_tag: "@temporal-contract/UpdateRejectedError";
}, {
_tag: "@temporal-contract/UpdateFailedError";
}, {
_tag: "@temporal-contract/UpdateRpcTimeoutOrCancelledError";
}, {
_tag: "@temporal-contract/WorkflowExecutionNotFoundError";
}];Defined in: packages/client/src/error-patterns.ts:134
Every error a handle.updates.* call (or an update handle's result()) can produce.
UPDATE_REJECTED_ERROR_TAG
const UPDATE_REJECTED_ERROR_TAG: "@temporal-contract/UpdateRejectedError" = "@temporal-contract/UpdateRejectedError";Defined in: packages/client/src/error-tags.ts:64
_tag of UpdateRejectedError — the update was rejected at admission by the worker-side validator.
UPDATE_RPC_TIMEOUT_OR_CANCELLED_ERROR_TAG
const UPDATE_RPC_TIMEOUT_OR_CANCELLED_ERROR_TAG: "@temporal-contract/UpdateRpcTimeoutOrCancelledError" = "@temporal-contract/UpdateRpcTimeoutOrCancelledError";Defined in: packages/client/src/error-tags.ts:67
_tag of UpdateRpcTimeoutOrCancelledError — the update call timed out or was cancelled client-side.
UPDATE_VALIDATION_ERROR_TAG
const UPDATE_VALIDATION_ERROR_TAG: "@temporal-contract/UpdateValidationError" = "@temporal-contract/UpdateValidationError";Defined in: packages/client/src/error-tags.ts:58
_tag of UpdateValidationError — update input/output failed schema validation (client side).
WORKFLOW_ALREADY_STARTED_ERROR_TAG
const WORKFLOW_ALREADY_STARTED_ERROR_TAG: "@temporal-contract/WorkflowAlreadyStartedError" = "@temporal-contract/WorkflowAlreadyStartedError";Defined in: packages/client/src/error-tags.ts:21
_tag of WorkflowAlreadyStartedError — starting collided with an existing execution.
WORKFLOW_CANCELLED_ERROR_TAG
const WORKFLOW_CANCELLED_ERROR_TAG: "@temporal-contract/WorkflowCancelledError" = "@temporal-contract/WorkflowCancelledError";Defined in: packages/client/src/error-tags.ts:37
_tag of the client's WorkflowCancelledError — the execution ended Cancelled. Deliberately the same literal as the worker package's in-workflow WorkflowCancelledError tag: both mean "this workflow was cancelled", observed from different sides of the task queue, so grouped matchers treat them alike.
WORKFLOW_EXECUTE_PATTERNS
const WORKFLOW_EXECUTE_PATTERNS: readonly [{
_tag: "@temporal-contract/WorkflowAlreadyStartedError";
}, {
_tag: "@temporal-contract/WorkflowValidationError";
}, {
_tag: "@temporal-contract/WorkflowFailedError";
}, {
_tag: "@temporal-contract/WorkflowCancelledError";
}, {
_tag: "@temporal-contract/WorkflowTerminatedError";
}, {
_tag: "@temporal-contract/WorkflowTimeoutError";
}, {
_tag: "@temporal-contract/WorkflowExecutionNotFoundError";
}];Defined in: packages/client/src/error-patterns.ts:95
ContractClient.executeWorkflow is start + result, so its union is the widest: both phases, minus the workflow's own declared errors.
WORKFLOW_EXECUTION_NOT_FOUND_ERROR_TAG
const WORKFLOW_EXECUTION_NOT_FOUND_ERROR_TAG: "@temporal-contract/WorkflowExecutionNotFoundError" = "@temporal-contract/WorkflowExecutionNotFoundError";Defined in: packages/client/src/error-tags.ts:24
_tag of WorkflowExecutionNotFoundError — the targeted execution doesn't exist in the namespace.
WORKFLOW_FAILED_ERROR_TAG
const WORKFLOW_FAILED_ERROR_TAG: "@temporal-contract/WorkflowFailedError" = "@temporal-contract/WorkflowFailedError";Defined in: packages/client/src/error-tags.ts:28
_tag of WorkflowFailedError — the execution completed with a (non-outcome) failure.
WORKFLOW_RESULT_PATTERNS
const WORKFLOW_RESULT_PATTERNS: readonly [{
_tag: "@temporal-contract/WorkflowValidationError";
}, {
_tag: "@temporal-contract/WorkflowFailedError";
}, {
_tag: "@temporal-contract/WorkflowCancelledError";
}, {
_tag: "@temporal-contract/WorkflowTerminatedError";
}, {
_tag: "@temporal-contract/WorkflowTimeoutError";
}, {
_tag: "@temporal-contract/WorkflowExecutionNotFoundError";
}];Defined in: packages/client/src/error-patterns.ts:82
The non-contract-error tail of WorkflowResultErrorsOf — everything TypedWorkflowHandle.result() can produce besides the workflow's own declared errors: output validation, a generic completion failure, the three first-class stopped outcomes, and a missing execution.
WORKFLOW_START_PATTERNS
const WORKFLOW_START_PATTERNS: readonly [{
_tag: "@temporal-contract/WorkflowValidationError";
}, {
_tag: "@temporal-contract/WorkflowAlreadyStartedError";
}];Defined in: packages/client/src/error-patterns.ts:71
Every error ContractClient.startWorkflow can produce: its input failed validation, or an execution under this workflow ID already exists (signalWithStart adds SignalValidationError).
WORKFLOW_STOPPED_PATTERNS
const WORKFLOW_STOPPED_PATTERNS: readonly [{
_tag: "@temporal-contract/WorkflowCancelledError";
}, {
_tag: "@temporal-contract/WorkflowTerminatedError";
}, {
_tag: "@temporal-contract/WorkflowTimeoutError";
}];Defined in: packages/client/src/error-patterns.ts:111
The three outcomes that mean "the execution was stopped, and not by completing" — cancelled, terminated, timed out. A subset of WORKFLOW_RESULT_PATTERNS, for callers that treat those alike but want the remaining failures branched separately.
WORKFLOW_TERMINATED_ERROR_TAG
const WORKFLOW_TERMINATED_ERROR_TAG: "@temporal-contract/WorkflowTerminatedError" = "@temporal-contract/WorkflowTerminatedError";Defined in: packages/client/src/error-tags.ts:40
_tag of WorkflowTerminatedError — the execution was terminated.
WORKFLOW_TIMEOUT_ERROR_TAG
const WORKFLOW_TIMEOUT_ERROR_TAG: "@temporal-contract/WorkflowTimeoutError" = "@temporal-contract/WorkflowTimeoutError";Defined in: packages/client/src/error-tags.ts:43
_tag of WorkflowTimeoutError — the execution timed out.
WORKFLOW_VALIDATION_ERROR_TAG
const WORKFLOW_VALIDATION_ERROR_TAG: "@temporal-contract/WorkflowValidationError" = "@temporal-contract/WorkflowValidationError";Defined in: packages/client/src/error-tags.ts:46
_tag of WorkflowValidationError — workflow input/output failed schema validation.
Functions
readTypedSearchAttributes()
function readTypedSearchAttributes<TWorkflow>(workflowDef, instance): Partial<TypedSearchAttributeMap<TWorkflow>>;Defined in: packages/client/src/client.ts:101
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
}