Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .agents/rules/dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
| `zod` | Direct dep of `contract` (used internally for the `defineContract` runtime validation pass); user-side schema lib for the others |
| `valibot` / `arktype` | User-side schema libraries (Standard Schema) |

`pino` and `ts-pattern` appear in the catalog and are used by `examples/` only — they're not imported from any published package's `src/`.
`pino` appears in the catalog and is used by `examples/` only — it's not imported from any published package's `src/`.

## Tooling

Expand Down
11 changes: 11 additions & 0 deletions .changeset/bump-unthrown-beta-6.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
"@temporal-contract/contract": patch
"@temporal-contract/client": patch
"@temporal-contract/worker": patch
---

Bump `unthrown` to `5.0.0-beta.6`, whose exhaustive matcher is now built-in
(same `.with(…)` / `tag` / `P` call-site shape — no code changes needed). The
`ts-pattern` peer/dev dependencies added for beta.5 are removed: `unthrown` has
zero runtime dependencies, so nothing needs installing alongside it. The
`unthrown` peer range is raised to `^5.0.0-beta.6`.
Comment thread
btravers marked this conversation as resolved.
30 changes: 15 additions & 15 deletions docs/guide/migrating-to-unthrown.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,21 @@ the same name but is now imported from `"unthrown"`.

## API mapping

| neverthrow | unthrown |
| -------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| `import { ResultAsync } from "neverthrow"` | `import { fromPromise } from "unthrown"` |
| type `ResultAsync<T, E>` | type `AsyncResult<T, E>` |
| type `Result<T, E>` | `Result<T, E>` (now from `"unthrown"`) |
| `ok(v)` / `err(e)` | `Ok(v)` / `Err(e)` (from `"unthrown"`) |
| `okAsync(v)` | `Ok(v).toAsync()` (no `okAsync`) |
| `errAsync(e)` | `Err(e).toAsync()` (no `errAsync`) |
| `ResultAsync.fromPromise(promise, errFn)` | `fromPromise(promise, errFn)` |
| `ResultAsync.fromSafePromise(promise)` | `fromSafePromise(promise)` |
| `.andThen(fn)` | `.flatMap(fn)` |
| `.map(fn)` / `.mapErr(fn)` / `.orElse(fn)` | `.map(fn)` / `.mapErrCases(m)` / `.flatMapErrCases(m)` (the error combinators take an exhaustive ts-pattern matcher `m`, not a plain callback) |
| `Result.combine([...])` | `all([...])` |
| `result.match(okFn, errFn)` (positional) | `result.match({ ok, errCases, defect })` (object, 3 channels; `errCases` is an exhaustive matcher) |
| `result.isOk()` / `result.isErr()` to narrow | `result.isOk()` / `result.isErr()` / `result.isDefect()` (methods narrow; `isOk(result)` free functions also exist) |
| neverthrow | unthrown |
| -------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| `import { ResultAsync } from "neverthrow"` | `import { fromPromise } from "unthrown"` |
| type `ResultAsync<T, E>` | type `AsyncResult<T, E>` |
| type `Result<T, E>` | `Result<T, E>` (now from `"unthrown"`) |
| `ok(v)` / `err(e)` | `Ok(v)` / `Err(e)` (from `"unthrown"`) |
| `okAsync(v)` | `Ok(v).toAsync()` (no `okAsync`) |
| `errAsync(e)` | `Err(e).toAsync()` (no `errAsync`) |
| `ResultAsync.fromPromise(promise, errFn)` | `fromPromise(promise, errFn)` |
| `ResultAsync.fromSafePromise(promise)` | `fromSafePromise(promise)` |
| `.andThen(fn)` | `.flatMap(fn)` |
| `.map(fn)` / `.mapErr(fn)` / `.orElse(fn)` | `.map(fn)` / `.mapErrCases(m)` / `.flatMapErrCases(m)` (the error combinators take an exhaustive matcher `m`, not a plain callback) |
| `Result.combine([...])` | `all([...])` |
| `result.match(okFn, errFn)` (positional) | `result.match({ ok, errCases, defect })` (object, 3 channels; `errCases` is an exhaustive matcher) |
| `result.isOk()` / `result.isErr()` to narrow | `result.isOk()` / `result.isErr()` / `result.isDefect()` (methods narrow; `isOk(result)` free functions also exist) |

## `okAsync` / `errAsync` are gone

Expand Down
1 change: 0 additions & 1 deletion examples/order-processing-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"@temporalio/client": "catalog:",
"pino": "catalog:",
"pino-pretty": "catalog:",
"ts-pattern": "catalog:",
"unthrown": "catalog:",
"zod": "catalog:"
},
Expand Down
1 change: 0 additions & 1 deletion examples/order-processing-worker/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"@temporalio/workflow": "catalog:",
"pino": "catalog:",
"pino-pretty": "catalog:",
"ts-pattern": "catalog:",
"unthrown": "catalog:",
"zod": "catalog:"
},
Expand Down
4 changes: 1 addition & 3 deletions packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
"@types/node": "catalog:",
"@unthrown/vitest": "catalog:",
"@vitest/coverage-v8": "catalog:",
"ts-pattern": "catalog:",
"tsdown": "catalog:",
"typedoc": "catalog:",
"typedoc-plugin-markdown": "catalog:",
Expand All @@ -78,8 +77,7 @@
"peerDependencies": {
"@temporalio/client": "^1",
"@temporalio/common": "^1",
"ts-pattern": "^5",
"unthrown": "^5.0.0-beta.5"
"unthrown": "^5.0.0-beta.6"
},
"engines": {
"node": ">=22.19.0"
Expand Down
7 changes: 1 addition & 6 deletions packages/contract/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@
"@unthrown/vitest": "catalog:",
"@vitest/coverage-v8": "catalog:",
"arktype": "catalog:",
"ts-pattern": "catalog:",
"tsdown": "catalog:",
"typedoc": "catalog:",
"typedoc-plugin-markdown": "catalog:",
Expand All @@ -88,13 +87,9 @@
"vitest": "catalog:"
},
"peerDependencies": {
"ts-pattern": "^5",
"unthrown": "^5.0.0-beta.5"
"unthrown": "^5.0.0-beta.6"
},
"peerDependenciesMeta": {
"ts-pattern": {
"optional": true
},
"unthrown": {
"optional": true
}
Expand Down
4 changes: 1 addition & 3 deletions packages/worker/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@
"@types/node": "catalog:",
"@unthrown/vitest": "catalog:",
"@vitest/coverage-v8": "catalog:",
"ts-pattern": "catalog:",
"tsdown": "catalog:",
"typedoc": "catalog:",
"typedoc-plugin-markdown": "catalog:",
Expand All @@ -97,8 +96,7 @@
"@temporalio/common": "^1",
"@temporalio/worker": "^1",
"@temporalio/workflow": "^1",
"ts-pattern": "^5",
"unthrown": "^5.0.0-beta.5"
"unthrown": "^5.0.0-beta.6"
},
"engines": {
"node": ">=22.19.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/worker/src/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ export class ChildWorkflowError extends TaggedError("@temporal-contract/ChildWor
* distinct {@link TaggedError}s, so call sites discriminate on the `_tag`
* (or `instanceof ChildWorkflowCancelledError`) instead of relying on an
* `instanceof ChildWorkflowError` that also matches cancellation. A
* `result.match` with the ts-pattern `errCases` matcher folds the
* `result.match` with the exhaustive `errCases` matcher folds the
* `ChildWorkflowError | ChildWorkflowCancelledError` union exhaustively.
*/
export class ChildWorkflowCancelledError extends TaggedError(
Expand Down
69 changes: 21 additions & 48 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ catalog:
"@temporalio/worker": 1.20.3
"@temporalio/workflow": 1.20.3
"@types/node": 26.1.1
"@unthrown/vitest": 5.0.0-beta.5
"@unthrown/vitest": 5.0.0-beta.6
"@vitest/coverage-v8": 4.1.10
arktype: 2.2.3
knip: 6.27.0
Expand All @@ -35,14 +35,13 @@ catalog:
pino: 10.3.1
pino-pretty: 13.1.3
testcontainers: 12.0.4
ts-pattern: 5.9.0
tsdown: 0.22.12
tsx: 4.23.1
turbo: 2.10.5
typedoc: 0.28.20
typedoc-plugin-markdown: 4.12.0
typescript: 6.0.3
unthrown: 5.0.0-beta.5
unthrown: 5.0.0-beta.6
valibot: 1.4.2
vitest: 4.1.10
zod: 4.4.3
Expand Down
Loading