|
1 | 1 | # @temporal-contract/client |
2 | 2 |
|
| 3 | +## 8.0.0-beta.4 |
| 4 | + |
| 5 | +### Major Changes |
| 6 | + |
| 7 | +- e7a9ef4: v8 review remediation — the full-surface overhaul from the six-track 8.0 review. Headline breaks, per package: |
| 8 | + |
| 9 | + **All boundaries (client + worker):** payloads are now parsed exactly once, on the receiving side. The sender still validates (surfacing a typed `Err`/`ValidationError` early) but transmits the caller's original value, so transforming schemas (`z.coerce.*`, `.transform(...)`) apply once end-to-end instead of twice. |
| 10 | + |
| 11 | + **`@temporal-contract/contract`:** |
| 12 | + |
| 13 | + - `defineContract`'s structural validation is hand-rolled and strict (unknown keys rejected); the zod runtime dependency is gone. |
| 14 | + - `input` is optional on signal/query/update definitions — `defineSignal()` / `defineQuery({ output })` with no input means the handler receives `undefined`, no `z.void()` ceremony. |
| 15 | + - ESM-only build (the CJS artifacts and `main`/`module`/`require` conditions are removed). |
| 16 | + - `InferContractWorkflows` is deleted (trivial alias). |
| 17 | + |
| 18 | + **`@temporal-contract/client`:** |
| 19 | + |
| 20 | + - `TypedClient` is split from the contract: `TypedClient.create({ client })` is connection-scoped, and `typedClient.for(contract)` returns the contract-bound `ContractClient` with the workflow/schedule methods. A `readonly raw` escape hatch exposes the underlying `Client`. |
| 21 | + - `getHandle` is synchronous, returns `Result<TypedWorkflowHandle, WorkflowNotInContractError>`, and accepts `runId`/`firstExecutionRunId` options; handles carry `runId`/`firstExecutionRunId`; typed `startUpdate` joins `executeUpdate`. |
| 22 | + - `WorkflowNotFoundError` is renamed `WorkflowNotInContractError`. |
| 23 | + - `CreateTypedClientOptions` is renamed `CreateClientOptions` — the family-shared name for the `Typed*.create()` options shape (matching amqp-contract). |
| 24 | + - Schedule surface parity: typed `ScheduleAlreadyExistsError`/`ScheduleNotFoundError` on the error channel (instead of defects), plus `update`, `backfill`, and `list`. |
| 25 | + - The six unused `ClientInfer*` type exports are deleted. |
| 26 | + |
| 27 | + **`@temporal-contract/worker`:** |
| 28 | + |
| 29 | + - Invalid signal payloads are dropped and logged (`log.warn`), never thrown — `SignalInputValidationError` is deleted; a stale client can no longer terminally kill a workflow execution. |
| 30 | + - Contract misuse inside workflow code (unknown signal/query/update or workflow name, async schema, uncovered activity options) now fails fast as a non-retryable `ContractMisuseError` `ApplicationFailure` instead of hanging executions in Workflow Task retries. |
| 31 | + - Exported `qualify` is renamed `qualifyFailure` (no alias), and the deprecated `createWorkerOrThrow` is removed — use `createWorker(...).get()`. |
| 32 | + - `defineActivityMiddleware` is renamed `declareActivityMiddleware` — the family convention is `define*` for contract authoring and `declare*` for implementation-side APIs, and middleware was the one implementation-side holdout. |
| 33 | + - `activities` is optional on `createWorker`, and activity-less workflows no longer need `{}` entries in the implementations map. |
| 34 | + - `TypedChildWorkflowHandle` gains a typed `signals` map and `firstExecutionRunId`. |
| 35 | + |
| 36 | + **`@temporal-contract/testing`:** |
| 37 | + |
| 38 | + - New contract-aware fixtures: `createContractTest(contract, { workflowsPath, activities?, workerOptions? })` yields `{ client, typedClient, worker }` against the testcontainers server, and `runActivity(definition, implementation, input, { env? })` runs one implementation inside `MockActivityEnvironment` (vitest-free). |
| 39 | + - Configurable environments: `createTimeSkippingTest(options?)` / `createTimeSkippingEnvironment(options?)` forward `TimeSkippingTestWorkflowEnvironmentOptions`; `createGlobalSetup({ postgresImage?, temporalImage?, temporalEnv?, quiet? })` pins container images and env. |
| 40 | + - The package now peer-depends on `@temporal-contract/contract`, `@temporal-contract/client`, `@temporal-contract/worker`, and `unthrown`. |
| 41 | + - The time-skipping `testEnv` fixture is correctly typed (the fixture record previously declared a phantom `$worker` key, leaving `testEnv` untyped in consuming suites). |
| 42 | + |
| 43 | +### Patch Changes |
| 44 | + |
| 45 | +- 5638ae4: The exported `ClientInferSignal` / `ClientInferQuery` / `ClientInferUpdate` aliases now carry the concrete error unions the handle proxies actually produce (`{Signal,Query,Update}ValidationError | WorkflowExecutionNotFoundError`) instead of a bare, unmatchable `Error` channel — surfaced by adopting `@unthrown/oxlint`'s `no-ambiguous-error-type` rule. `TypedWorkflowHandle` behavior is unchanged (it already substituted the concrete unions); only direct consumers of the aliases see the more precise types. The rest of the adoption (all six rules at `error`, reasoned `no-throw` disables at the sanctioned throw sites) is comment-and-config only. |
| 46 | +- Updated dependencies [e7a9ef4] |
| 47 | + - @temporal-contract/contract@8.0.0-beta.4 |
| 48 | + |
3 | 49 | ## 8.0.0-beta.3 |
4 | 50 |
|
5 | 51 | ### Patch Changes |
|
0 commit comments