@temporal-contract/contract
v8.0.0
Published
Contract builder for temporal-contract
Maintainers
Readme
@temporal-contract/contract
Contract builder and type definitions for Temporal workflows and activities
Installation
# 8.0 beta — `latest` still resolves 7.x
pnpm add @temporal-contract/contract@beta
# Plus one Standard Schema validator of your choice — zod, valibot, arktype, …
pnpm add zod
# Optional peer, needed only for the `@temporal-contract/contract/errors` entry
pnpm add unthrownQuick Example
import { defineContract, defineWorkflow } from "@temporal-contract/contract";
import { z } from "zod";
const processOrder = defineWorkflow({
input: z.object({ orderId: z.string() }),
output: z.object({ success: z.boolean() }),
// Required: the workflowIdReusePolicy for a start under an existing ID.
startPolicy: "once-per-id",
activities: {/* ... */},
});
export const myContract = defineContract({
taskQueue: "orders",
workflows: { processOrder },
});Documentation
📖 Read the full documentation →
License
MIT
