@temporal-contract/client
@temporal-contract/client
Classes
ContractClient
Defined in: packages/client/src/client.ts:747
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.
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:753 |
schedule | readonly | TypedScheduleClient<TContract> | Typed wrapper around Temporal's client.schedule.create(...) and related lifecycle methods. Fires the underlying startWorkflow action with args validated against the contract's input schema. Requires @temporalio/client 1.16+. The Schedule API was added in 1.16; TypedClient.create fails fast (a defect with a clear message) when the underlying Client predates it. Example import { P } from "unthrown"; const result = await contractClient.schedule.create("processOrder", { scheduleId: "daily-sweep", spec: { cronExpressions: ["0 2 * * *"] }, args: { orderId: "sweep" }, }); await result.match({ ok: async (handle) => { await handle.pause("maintenance"); }, errCases: (matcher) => matcher.with( P.tag("@temporal-contract/WorkflowNotInContractError"), P.tag("@temporal-contract/WorkflowValidationError"), P.tag("@temporal-contract/ScheduleAlreadyExistsError"), (error) => console.error("schedule create failed", error), ), defect: (cause) => console.error("unexpected failure", cause), }); | packages/client/src/client.ts:787 |
Accessors
taskQueue
Get Signature
get taskQueue(): TContract["taskQueue"];Defined in: packages/client/src/client.ts:815
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
executeWorkflow()
executeWorkflow<TWorkflowName>(workflowName, options): AsyncResult<ClientInferOutput<TContract["workflows"][TWorkflowName]>,
| WorkflowNotInContractError
| WorkflowAlreadyStartedError
| WorkflowResultErrorsOf<TContract["workflows"][TWorkflowName]>>;Defined in: packages/client/src/client.ts:1104
Execute a workflow (start and wait for result) with AsyncResult pattern.
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]>, | WorkflowNotInContractError | WorkflowAlreadyStartedError | WorkflowResultErrorsOf<TContract["workflows"][TWorkflowName]>>
Example
import {
WORKFLOW_FAILED_ERROR_TAG,
WORKFLOW_VALIDATION_ERROR_TAG,
} 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('@temporal-contract/ContractError'), (error) =>
console.error('Domain failure:', error.errorName),
)
.with(
P.tag(WORKFLOW_VALIDATION_ERROR_TAG),
P.tag(WORKFLOW_FAILED_ERROR_TAG),
// ...one P.tag per remaining member of the union
(error) => console.error('Processing failed:', error),
),
defect: (cause) => console.error('Unexpected failure:', cause),
});getHandle()
getHandle<TWorkflowName>(
workflowName,
workflowId,
options?
): Result<TypedWorkflowHandle<TContract["workflows"][TWorkflowName]>, WorkflowNotInContractError>;Defined in: packages/client/src/client.ts:1227
Get a typed handle to an existing workflow execution.
Synchronous — the only failure mode is a workflow name missing from the contract, surfaced as a sync Result Err. 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 GetWorkflowHandleOptions passthrough — in particular 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
Result<TypedWorkflowHandle<TContract["workflows"][TWorkflowName]>, WorkflowNotInContractError>
Example
const handleResult = contractClient.getHandle('processOrder', 'order-123');
if (!handleResult.isOk()) {
console.error('Unknown workflow:', handleResult.isErr() ? handleResult.error : handleResult.cause);
return;
}
const result = await handleResult.value.result();signalWithStart()
signalWithStart<TWorkflowName, TSignalName>(workflowName, options): AsyncResult<TypedWorkflowHandleWithSignaledRunId<TContract["workflows"][TWorkflowName]>,
| WorkflowNotInContractError
| WorkflowValidationError
| WorkflowAlreadyStartedError
| SignalValidationError>;Defined in: packages/client/src/client.ts:959
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]>, | WorkflowNotInContractError | WorkflowValidationError | WorkflowAlreadyStartedError | SignalValidationError>
Example
import {
SIGNAL_VALIDATION_ERROR_TAG,
WORKFLOW_ALREADY_STARTED_ERROR_TAG,
WORKFLOW_NOT_IN_CONTRACT_ERROR_TAG,
WORKFLOW_VALIDATION_ERROR_TAG,
} 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(
P.tag(WORKFLOW_NOT_IN_CONTRACT_ERROR_TAG),
P.tag(WORKFLOW_VALIDATION_ERROR_TAG),
P.tag(WORKFLOW_ALREADY_STARTED_ERROR_TAG),
(error) => console.error('signalWithStart failed', error),
),
defect: (cause) => console.error('unexpected failure', cause),
});startWorkflow()
startWorkflow<TWorkflowName>(workflowName, options): AsyncResult<TypedWorkflowHandle<TContract["workflows"][TWorkflowName]>,
| WorkflowNotInContractError
| WorkflowValidationError
| WorkflowAlreadyStartedError>;Defined in: packages/client/src/client.ts:854
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]>, | WorkflowNotInContractError | WorkflowValidationError | WorkflowAlreadyStartedError>
Example
import {
WORKFLOW_ALREADY_STARTED_ERROR_TAG,
WORKFLOW_NOT_IN_CONTRACT_ERROR_TAG,
WORKFLOW_VALIDATION_ERROR_TAG,
} from "@temporal-contract/client";
import { P } from "unthrown";
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(
P.tag(WORKFLOW_NOT_IN_CONTRACT_ERROR_TAG),
P.tag(WORKFLOW_VALIDATION_ERROR_TAG),
P.tag(WORKFLOW_ALREADY_STARTED_ERROR_TAG),
(error) => console.error('Failed to start:', error),
),
defect: (cause) => console.error('Unexpected failure:', cause),
});ContractError
Defined in: packages/contract/dist/errors-impl-BxWuCbUU.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-BxWuCbUU.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.7.0/node_modules/unthrown/dist/index.d.mts:2011 |
cause? | public | unknown | - | QueryValidationError.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-BxWuCbUU.d.mts:49 |
errorName | readonly | TName | Declared error name — the ApplicationFailure.type discriminator. | ContractError_base.errorName | packages/contract/dist/errors-impl-BxWuCbUU.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:318
Surfaced on the Err channel when the server could not serve a query — either no handler is registered under the query name on the (possibly older) workflow execution, or the query handler itself threw. Temporal reports both through the same channel (QueryNotRegisteredError, an INVALID_ARGUMENT gRPC failure whose message carries the underlying reason), so they are classified into this single modeled error; cause keeps Temporal's original error for inspection.
A routine operational outcome — a stale execution predating the handler, a handler bug — 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:324
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.7.0/node_modules/unthrown/dist/index.d.mts:2011 |
cause? | public | unknown | QueryValidationError.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:321 |
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:286
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:293
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.7.0/node_modules/unthrown/dist/index.d.mts:2011 |
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:290 |
issues | readonly | readonly Issue[] | TaggedError(QUERY_VALIDATION_ERROR_TAG, { name: "QueryValidationError", }).issues | packages/client/src/errors.ts:291 |
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:289 |
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:62
Generic runtime failure wrapper when no specific error type applies
Extends
TaggedErrorInstance<"@temporal-contract/RuntimeClientError", {cause?:unknown;operation:string; }>
Constructors
Constructor
new RuntimeClientError(operation, cause?): RuntimeClientError;Defined in: packages/client/src/errors.ts:68
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.7.0/node_modules/unthrown/dist/index.d.mts:2011 |
cause? | public | unknown | QueryValidationError.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:65 |
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:431
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:437
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.7.0/node_modules/unthrown/dist/index.d.mts:2011 |
cause? | public | unknown | QueryValidationError.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:434 |
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:449
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:455
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.7.0/node_modules/unthrown/dist/index.d.mts:2011 |
cause? | public | unknown | QueryValidationError.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:452 |
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:335
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:341
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.7.0/node_modules/unthrown/dist/index.d.mts:2011 |
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:339 |
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:338 |
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-BxWuCbUU.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-BxWuCbUU.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.7.0/node_modules/unthrown/dist/index.d.mts:2011 |
cause? | public | unknown | QueryValidationError.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:597
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(), the @temporalio/client capability check 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:604 |
Methods
for()
for<TContract>(contract): ContractClient<TContract>;Defined in: packages/client/src/client.ts:726
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_NOT_IN_CONTRACT_ERROR_TAG,
WORKFLOW_VALIDATION_ERROR_TAG,
} from "@temporal-contract/client";
import { P } from "unthrown";
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(
P.tag(WORKFLOW_NOT_IN_CONTRACT_ERROR_TAG),
P.tag(WORKFLOW_VALIDATION_ERROR_TAG),
// ...one P.tag per remaining member of the union
(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:648
Create the connection-scoped typed client.
Returns AsyncResult<TypedClient, never> — setup faults are technical infrastructure failures, not anticipated domain errors, so they surface on the Defect channel (a TechnicalError instance as the defect's cause), never the modeled Err channel. Technical failures routed there:
- the underlying
Clientlacks the Schedule API (@temporalio/client< 1.16); - the connection cannot be established (when the client's connection exposes
ensureConnected, it is awaited eagerly so a bad address/namespace surfaces here instead of on the first operation).
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:171
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,
| WorkflowNotInContractError
| WorkflowValidationError
| ScheduleAlreadyExistsError>;Defined in: packages/client/src/schedule.ts:206
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, | WorkflowNotInContractError | WorkflowValidationError | ScheduleAlreadyExistsError>
getHandle()
getHandle(scheduleId): TypedScheduleHandle;Defined in: packages/client/src/schedule.ts:300
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:310
List schedules in the namespace — a typed async-iterable 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).
Parameters
| Parameter | Type |
|---|---|
options? | ListScheduleOptions |
Returns
AsyncIterable<ScheduleSummary>
UpdateFailedError
Defined in: packages/client/src/errors.ts:382
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, startUpdate, and the update handle's result().
Extends
TaggedErrorInstance<"@temporal-contract/UpdateFailedError", {cause?:unknown;updateName:string; }>
Constructors
Constructor
new UpdateFailedError(updateName, cause?): UpdateFailedError;Defined in: packages/client/src/errors.ts:388
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.7.0/node_modules/unthrown/dist/index.d.mts:2011 |
cause? | public | unknown | QueryValidationError.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:385 |
UpdateRejectedError
Defined in: packages/client/src/errors.ts:411
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, startUpdate, and the update handle's result().
Extends
TaggedErrorInstance<"@temporal-contract/UpdateRejectedError", {cause?:unknown;updateName:string; }>
Constructors
Constructor
new UpdateRejectedError(updateName, cause?): UpdateRejectedError;Defined in: packages/client/src/errors.ts:417
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.7.0/node_modules/unthrown/dist/index.d.mts:2011 |
cause? | public | unknown | QueryValidationError.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:414 |
UpdateValidationError
Defined in: packages/client/src/errors.ts:350
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:357
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.7.0/node_modules/unthrown/dist/index.d.mts:2011 |
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:354 |
issues | readonly | readonly Issue[] | TaggedError(UPDATE_VALIDATION_ERROR_TAG, { name: "UpdateValidationError", }).issues | packages/client/src/errors.ts:355 |
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:353 |
WorkflowAlreadyStartedError
Defined in: packages/client/src/errors.ts:106
Discriminated variant of RuntimeClientError surfaced when starting a workflow collides with an existing execution — Temporal's WorkflowExecutionAlreadyStartedError. The most common cause is a workflowId reuse policy that rejects duplicates while a previous run is still in retention.
Distinguishing this from RuntimeClientError lets idempotent callers branch on it explicitly (e.g. fetch the existing handle and continue) without inspecting error.cause against a Temporal SDK class.
Extends
TaggedErrorInstance<"@temporal-contract/WorkflowAlreadyStartedError", {cause?:unknown;workflowId:string;workflowType:string; }>
Constructors
Constructor
new WorkflowAlreadyStartedError(
workflowType,
workflowId,
cause?
): WorkflowAlreadyStartedError;Defined in: packages/client/src/errors.ts:113
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.7.0/node_modules/unthrown/dist/index.d.mts:2011 |
cause? | public | unknown | QueryValidationError.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:110 |
workflowType | readonly | string | TaggedError(WORKFLOW_ALREADY_STARTED_ERROR_TAG, { name: "WorkflowAlreadyStartedError", }).workflowType | packages/client/src/errors.ts:109 |
WorkflowCancelledError
Defined in: packages/client/src/errors.ts:197
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:203
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.7.0/node_modules/unthrown/dist/index.d.mts:2011 |
cause? | public | CancelledFailure | QueryValidationError.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:200 |
WorkflowExecutionNotFoundError
Defined in: packages/client/src/errors.ts:131
Discriminated variant of RuntimeClientError surfaced when an operation targets a workflow execution that doesn't exist in the namespace — Temporal's WorkflowNotFoundError (distinct from this package's contract-level WorkflowNotInContractError).
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:139
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.7.0/node_modules/unthrown/dist/index.d.mts:2011 |
cause? | public | unknown | QueryValidationError.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:136 |
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:135 |
WorkflowFailedError
Defined in: packages/client/src/errors.ts:169
Discriminated variant of RuntimeClientError surfaced when waiting on a workflow's result and the workflow completes with a failure — Temporal's WorkflowFailedError.
cause is the unwrapped underlying TemporalFailure (typically an ApplicationFailure) 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.
Returned from executeWorkflow and handle.result().
Extends
TaggedErrorInstance<"@temporal-contract/WorkflowFailedError", {cause?:TemporalFailure;workflowId:string; }>
Constructors
Constructor
new WorkflowFailedError(workflowId, cause?): WorkflowFailedError;Defined in: packages/client/src/errors.ts:175
Parameters
| Parameter | Type |
|---|---|
workflowId | string |
cause? | TemporalFailure |
Returns
Overrides
TaggedError(WORKFLOW_FAILED_ERROR_TAG, {
name: "WorkflowFailedError",
})<{
workflowId: string;
cause?: TemporalFailure | 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.7.0/node_modules/unthrown/dist/index.d.mts:2011 |
cause? | public | TemporalFailure | QueryValidationError.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 |
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:172 |
WorkflowNotInContractError
Defined in: packages/client/src/errors.ts:83
Surfaced on the Err channel when a workflow name is not declared in the bound contract. This is a contract-level lookup failure (a typo, a stale contract) — distinct from Temporal's own WorkflowNotFoundError, which is about a missing execution and surfaces here as WorkflowExecutionNotFoundError.
Extends
TaggedErrorInstance<"@temporal-contract/WorkflowNotInContractError", {availableWorkflows: readonlystring[];workflowName:string; }>
Constructors
Constructor
new WorkflowNotInContractError(workflowName, availableWorkflows): WorkflowNotInContractError;Defined in: packages/client/src/errors.ts:89
Parameters
| Parameter | Type |
|---|---|
workflowName | string |
availableWorkflows | readonly string[] |
Returns
Overrides
TaggedError(WORKFLOW_NOT_IN_CONTRACT_ERROR_TAG, {
name: "WorkflowNotInContractError",
})<{
workflowName: string;
availableWorkflows: readonly string[];
}>.constructorProperties
| Property | Modifier | Type | Inherited from | Defined in |
|---|---|---|---|---|
_tag | readonly | "@temporal-contract/WorkflowNotInContractError" | TaggedError(WORKFLOW_NOT_IN_CONTRACT_ERROR_TAG, { name: "WorkflowNotInContractError", })._tag | node_modules/.pnpm/unthrown@5.7.0/node_modules/unthrown/dist/index.d.mts:2011 |
availableWorkflows | readonly | readonly string[] | TaggedError(WORKFLOW_NOT_IN_CONTRACT_ERROR_TAG, { name: "WorkflowNotInContractError", }).availableWorkflows | packages/client/src/errors.ts:87 |
cause? | public | unknown | TaggedError(WORKFLOW_NOT_IN_CONTRACT_ERROR_TAG, { name: "WorkflowNotInContractError", }).cause | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es2022.error.d.ts:24 |
message | public | string | TaggedError(WORKFLOW_NOT_IN_CONTRACT_ERROR_TAG, { name: "WorkflowNotInContractError", }).message | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1075 |
name | public | string | TaggedError(WORKFLOW_NOT_IN_CONTRACT_ERROR_TAG, { name: "WorkflowNotInContractError", }).name | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1074 |
stack? | public | string | TaggedError(WORKFLOW_NOT_IN_CONTRACT_ERROR_TAG, { name: "WorkflowNotInContractError", }).stack | node_modules/.pnpm/typescript@6.0.3/node_modules/typescript/lib/lib.es5.d.ts:1076 |
workflowName | readonly | string | TaggedError(WORKFLOW_NOT_IN_CONTRACT_ERROR_TAG, { name: "WorkflowNotInContractError", }).workflowName | packages/client/src/errors.ts:86 |
WorkflowTerminatedError
Defined in: packages/client/src/errors.ts:217
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:223
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.7.0/node_modules/unthrown/dist/index.d.mts:2011 |
cause? | public | TerminatedFailure | QueryValidationError.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:220 |
WorkflowTimeoutError
Defined in: packages/client/src/errors.ts:239
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:245
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.7.0/node_modules/unthrown/dist/index.d.mts:2011 |
cause? | public | TimeoutFailure | QueryValidationError.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:242 |
WorkflowValidationError
Defined in: packages/client/src/errors.ts:264
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 (e.g. schedule.create, where runs are spawned later).
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:272
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.7.0/node_modules/unthrown/dist/index.d.mts:2011 |
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:268 |
issues | readonly | readonly Issue[] | TaggedError(WORKFLOW_VALIDATION_ERROR_TAG, { name: "WorkflowValidationError", }).issues | packages/client/src/errors.ts:269 |
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:270 |
workflowName | readonly | string | TaggedError(WORKFLOW_VALIDATION_ERROR_TAG, { name: "WorkflowValidationError", }).workflowName | packages/client/src/errors.ts:267 |
Type Aliases
AnyContractError
type AnyContractError = ContractError<string, unknown>;Defined in: packages/contract/dist/errors-impl-BxWuCbUU.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-Do36Wf1g.d.mts:466
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-Do36Wf1g.d.mts:473
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:59
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:43
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
| WorkflowExecutionNotFoundError>;Defined in: packages/client/src/types.ts:78
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 })). 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), or a missing execution.
Type Parameters
| Type Parameter |
|---|
TUpdate extends UpdateDefinition |
Parameters
| Parameter | Type |
|---|---|
...args | undefined extends ClientInferInput<TUpdate> ? [ClientInferInput<TUpdate>] : [ClientInferInput<TUpdate>] |
Returns
AsyncResult<ClientInferOutput<TUpdate>, | UpdateValidationError | UpdateRejectedError | UpdateFailedError | 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:100
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:90
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:110
Infer updates from a workflow definition (client perspective)
Type Parameters
| Type Parameter |
|---|
T extends AnyWorkflowDefinition |
ContractErrorUnion
type ContractErrorUnion<TErrors> = { [K in keyof TErrors & string]: ContractError<K, InferErrorData<TErrors[K]>> }[keyof TErrors & string];Defined in: packages/contract/dist/errors-impl-BxWuCbUU.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/client.ts:581
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/client.ts:583 |
TemporalFailure
type TemporalFailure =
| ApplicationFailure
| CancelledFailure
| TerminatedFailure
| TimeoutFailure
| ChildWorkflowFailure
| ServerFailure
| ActivityFailure;Defined in: packages/client/src/errors.ts:50
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".
TypedGetHandleOptions
type TypedGetHandleOptions = GetWorkflowHandleOptions & object;Defined in: packages/client/src/client.ts:265
Options for ContractClient.getHandle. Extends Temporal's GetWorkflowHandleOptions (followRuns, firstExecutionRunId — the chain interlock ensuring mutating methods don't cross into another execution chain) with the optional runId of the specific execution to bind.
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/client.ts:270 |
TypedScheduleActionOverrides
type TypedScheduleActionOverrides = Pick<ScheduleOptionsStartWorkflowAction<never>,
| "workflowId"
| "workflowExecutionTimeout"
| "workflowRunTimeout"
| "workflowTaskTimeout"
| "retry"
| "memo"
| "staticDetails"
| "staticSummary">;Defined in: packages/client/src/schedule.ts:45
Workflow-action–level overrides forwarded to Temporal's ScheduleOptionsStartWorkflowAction. These live under a nested action field so the workflow-level memo (per-action workflow metadata) can be set independently from the schedule-level memo (metadata on the schedule itself) — Temporal honours both, and they have separate lifecycles.
workflowType and taskQueue are owned by the contract and not exposed.
TypedScheduleCreateOptions
type TypedScheduleCreateOptions<TContract, TWorkflowName> = object;Defined in: packages/client/src/schedule.ts:66
Options for TypedScheduleClient.create.
scheduleId and spec come from Temporal's ScheduleOptions. args is typed against the destination workflow's input schema. policies, state, and memo mirror Temporal's own schedule-level options. Workflow-action–level overrides nest under action so memo and other fields with the same name don't collide between the two scopes.
Type Parameters
| Type Parameter |
|---|
TContract extends ContractDefinition |
TWorkflowName extends keyof TContract["workflows"] & string |
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
action? | TypedScheduleActionOverrides | Workflow-action–level overrides. workflowType and taskQueue are derived from the contract, so they don't appear here. Note that action.memo is a workflow-level memo applied to each spawned run, distinct from the top-level memo (which is metadata on the schedule itself). | packages/client/src/schedule.ts:98 |
args | ClientInferInput<TContract["workflows"][TWorkflowName]> | Workflow input — validated against the contract's input schema. | packages/client/src/schedule.ts:75 |
memo? | ScheduleOptions["memo"] | Schedule-level memo (non-indexed metadata on the schedule itself). | packages/client/src/schedule.ts:90 |
policies? | ScheduleOptions["policies"] | Temporal schedule policies (overlap, catchupWindow, pauseOnFailure, etc.). | packages/client/src/schedule.ts:86 |
scheduleId | string | Schedule ID. Recommended to use a meaningful business identifier. | packages/client/src/schedule.ts:71 |
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:84 |
spec | ScheduleSpec | When the schedule should fire (cron, interval, calendar). | packages/client/src/schedule.ts:73 |
state? | ScheduleOptions["state"] | Temporal schedule state (paused, note, limited, etc.). | packages/client/src/schedule.ts:88 |
TypedScheduleHandle
type TypedScheduleHandle = object;Defined in: packages/client/src/schedule.ts:113
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:158 |
delete | public | () => AsyncResult<void, ScheduleNotFoundError> | Delete the schedule. | packages/client/src/schedule.ts:160 |
describe | public | () => AsyncResult<ScheduleDescription, ScheduleNotFoundError> | Fetch the schedule's current description from the server. | packages/client/src/schedule.ts:162 |
pause | public | (note?) => AsyncResult<void, ScheduleNotFoundError> | Pause the schedule. Optional note becomes part of the audit trail. | packages/client/src/schedule.ts:117 |
scheduleId | readonly | string | This schedule's identifier. | packages/client/src/schedule.ts:115 |
trigger | public | (overlap?) => AsyncResult<void, ScheduleNotFoundError> | Fire the schedule's action immediately. | packages/client/src/schedule.ts:121 |
unpause | public | (note?) => AsyncResult<void, ScheduleNotFoundError> | Resume a paused schedule. | packages/client/src/schedule.ts:119 |
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's args are validated against that workflow's input schema before anything is persisted — a mismatch surfaces as WorkflowValidationError on the Err channel and the schedule is left untouched. 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:148 |
TypedSearchAttributeMap
type TypedSearchAttributeMap<TWorkflow> = TWorkflow["searchAttributes"] extends Record<string, SearchAttributeDefinition> ? { [K in keyof TWorkflow["searchAttributes"]]?: SearchAttributeKindToType<TWorkflow["searchAttributes"][K]["kind"]> } : never;Defined in: packages/client/src/client.ts:121
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> = Omit<WorkflowSignalWithStartOptions,
| "taskQueue"
| "args"
| "signal"
| "signalArgs"
| "searchAttributes"
| "typedSearchAttributes"> & WorkflowArgsField<TContract["workflows"][TWorkflowName]> & SignalArgsField<TContract["workflows"][TWorkflowName]["signals"][TSignalName]> & object;Defined in: packages/client/src/client.ts:238
Options for ContractClient.signalWithStart — typed against both the workflow's input schema and 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 | 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 signalWithStart request is dispatched. | packages/client/src/client.ts:255 |
signalName | TSignalName | - | packages/client/src/client.ts:248 |
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/client.ts:278
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/client.ts:283 |
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/client.ts:289 |
Type Parameters
| Type Parameter |
|---|
TUpdate extends UpdateDefinition |
TypedWorkflowHandle
type TypedWorkflowHandle<TWorkflow> = object;Defined in: packages/client/src/client.ts:345
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/client.ts:449 |
describe | public | () => AsyncResult<Awaited<ReturnType<WorkflowHandle["describe"]>>, WorkflowExecutionNotFoundError> | Get workflow execution description including status and metadata | packages/client/src/client.ts:454 |
fetchHistory | public | () => AsyncResult<Awaited<ReturnType<WorkflowHandle["fetchHistory"]>>, WorkflowExecutionNotFoundError> | Fetch the workflow execution history | packages/client/src/client.ts:462 |
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/client.ts:361 |
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, or the handler threw), or WorkflowExecutionNotFoundError — instead of a throwing Promise; the error union is carried by ClientInferWorkflowQueries directly. | packages/client/src/client.ts:379 |
raw | readonly | WorkflowHandle | The underlying @temporalio/client WorkflowHandle — the escape hatch for anything the typed surface doesn't cover yet (e.g. raw.getUpdateHandle(...), raw.cancel() with SDK-specific options). Calls made through raw bypass contract validation. Mirrors TypedClient.raw at the handle level. | packages/client/src/client.ts:369 |
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/client.ts:439 |
runId | readonly | string | undefined | Run ID of the execution this handle is bound to, when known: the started run's ID for startWorkflow handles, the caller-provided runId for getHandle handles, undefined otherwise (the handle then addresses the latest execution). | packages/client/src/client.ts:354 |
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/client.ts:388 |
startUpdate | public | <TUpdateName>(updateName, ...options) => AsyncResult<TypedWorkflowUpdateHandle<TWorkflow["updates"][TUpdateName] extends UpdateDefinition ? TWorkflow["updates"][TUpdateName] : never>, UpdateCallError> | 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. Returns a TypedWorkflowUpdateHandle whose result() parses the outcome against the contract's output schema on receive. The options parameter is omittable when the update's input schema accepts undefined (e.g. an argument-less defineUpdate({ output })). | packages/client/src/client.ts:411 |
terminate | public | (reason?) => AsyncResult<void, WorkflowExecutionNotFoundError> | Terminate workflow with Result pattern | packages/client/src/client.ts:444 |
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), returning an AsyncResult that errs with UpdateValidationError, UpdateRejectedError (worker-side admission rejection), UpdateFailedError (the admitted handler failed), or WorkflowExecutionNotFoundError; use startUpdate to obtain an update handle without waiting for completion. | packages/client/src/client.ts:399 |
workflowId | readonly | string | - | packages/client/src/client.ts:346 |
TypedWorkflowHandleWithSignaledRunId
type TypedWorkflowHandleWithSignaledRunId<TWorkflow> = TypedWorkflowHandle<TWorkflow> & object;Defined in: packages/client/src/client.ts:332
Typed workflow handle returned by signalWithStart. Adds signaledRunId to the standard handle so callers can correlate the signal with the (possibly pre-existing) workflow execution chain.
Type Declaration
| Name | Type | Description | Defined in |
|---|---|---|---|
signaledRunId | string | The Run Id of the bound Workflow at the time of signalWithStart. Since signalWithStart may have signaled an existing Workflow Chain, this is not necessarily the firstExecutionRunId. | packages/client/src/client.ts:339 |
Type Parameters
| Type Parameter |
|---|
TWorkflow extends AnyWorkflowDefinition |
TypedWorkflowStartOptions
type TypedWorkflowStartOptions<TContract, TWorkflowName> = Omit<WorkflowStartOptions,
| "taskQueue"
| "args"
| "searchAttributes"
| "typedSearchAttributes"
| "workflowId"> & WorkflowIdField<TContract["workflows"][TWorkflowName]> & WorkflowArgsField<TContract["workflows"][TWorkflowName]> & object;Defined in: packages/client/src/client.ts:202
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/client.ts:217 |
Type Parameters
| Type Parameter |
|---|
TContract extends ContractDefinition |
TWorkflowName extends keyof TContract["workflows"] & string |
TypedWorkflowUpdateHandle
type TypedWorkflowUpdateHandle<TUpdate> = object;Defined in: packages/client/src/client.ts:311
Typed handle to an in-flight update, returned by TypedWorkflowHandle.startUpdate. result() parses the update's outcome against the contract's output schema on receive (the worker transmits its original return value — D1).
Type Parameters
| Type Parameter |
|---|
TUpdate extends UpdateDefinition |
Properties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
result | public | () => AsyncResult<ClientInferOutput<TUpdate>, UpdateCallError> | Wait for and return the update's result, parsed against the contract's output schema. A worker-side admission rejection surfaces as UpdateRejectedError; a failed (admitted) handler as UpdateFailedError — both on the Err channel, never as defects. | packages/client/src/client.ts:324 |
updateId | readonly | string | The ID of this update request. | packages/client/src/client.ts:313 |
workflowId | readonly | string | The ID of the workflow execution targeted by this update. | packages/client/src/client.ts:315 |
workflowRunId | readonly | string | undefined | The run ID of the targeted execution, when known. | packages/client/src/client.ts:317 |
WorkflowContractErrorsOf
type WorkflowContractErrorsOf<TWorkflow> = TWorkflow extends object ? ContractErrorUnion<TErrors> : never;Defined in: packages/client/src/client.ts:87
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/client.ts:101
Union of the modeled errors a result-awaiting call can surface for a workflow — the shared tail of ContractClient.executeWorkflow and TypedWorkflowHandle.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
QUERY_FAILED_ERROR_TAG
const QUERY_FAILED_ERROR_TAG: "@temporal-contract/QueryFailedError" = "@temporal-contract/QueryFailedError";Defined in: packages/client/src/error-tags.ts:55
_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:119
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:52
_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:70
_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/WorkflowNotInContractError";
}, {
_tag: "@temporal-contract/WorkflowValidationError";
}];Defined in: packages/client/src/error-patterns.ts:134
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:73
_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:113
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:58
_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:64
_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/WorkflowExecutionNotFoundError";
}];Defined in: packages/client/src/error-patterns.ts:126
Every error a handle.updates.* call 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:67
_tag of UpdateRejectedError — the update was rejected at admission by the worker-side validator.
UPDATE_VALIDATION_ERROR_TAG
const UPDATE_VALIDATION_ERROR_TAG: "@temporal-contract/UpdateValidationError" = "@temporal-contract/UpdateValidationError";Defined in: packages/client/src/error-tags.ts:61
_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:24
_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:40
_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/WorkflowNotInContractError";
}, {
_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:89
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:27
_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:31
_tag of WorkflowFailedError — the execution completed with a (non-outcome) failure.
WORKFLOW_NOT_IN_CONTRACT_ERROR_TAG
const WORKFLOW_NOT_IN_CONTRACT_ERROR_TAG: "@temporal-contract/WorkflowNotInContractError" = "@temporal-contract/WorkflowNotInContractError";Defined in: packages/client/src/error-tags.ts:21
_tag of WorkflowNotInContractError — the workflow name isn't declared on the bound contract.
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:76
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/WorkflowNotInContractError";
}, {
_tag: "@temporal-contract/WorkflowValidationError";
}, {
_tag: "@temporal-contract/WorkflowAlreadyStartedError";
}];Defined in: packages/client/src/error-patterns.ts:64
Every error ContractClient.startWorkflow / signalWithStart can produce: the workflow name is not on the contract, its input failed validation, or an execution under this workflow ID already exists.
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:106
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:43
_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:46
_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:49
_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:159
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
}