@temporal-contract/client
v8.0.1
Published
Client utilities with unthrown Result/AsyncResult for consuming temporal-contract workflows
Maintainers
Readme
@temporal-contract/client
Type-safe client for consuming Temporal workflows
Installation
# Core packages
pnpm add @temporal-contract/client @temporal-contract/contract
# Peer dependencies
pnpm add unthrown @temporalio/client @temporalio/common
# Plus one Standard Schema validator of your choice — zod, valibot, arktype, …
pnpm add zodQuick Example
import { TypedClient } from "@temporal-contract/client";
import { Connection, Client } from "@temporalio/client";
import { myContract } from "./contract.js";
const connection = await Connection.connect({ address: "localhost:7233" });
const temporalClient = new Client({ connection });
// One connection-scoped root per process. `create` returns
// `AsyncResult<TypedClient, never>` — setup faults are defects, so `.get()`
// unwraps directly.
const client = await TypedClient.create({ client: temporalClient }).get();
// Bind a contract — synchronous, infallible, memoized.
const orders = client.for(myContract);
// Execute workflow (fully typed!)
const result = await orders.executeWorkflow("processOrder", {
workflowId: "order-123",
args: { orderId: "ORD-123" },
});Documentation
📖 Read the full documentation →
License
MIT
