effect-orpc 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# effect-orpc
|
|
2
2
|
|
|
3
|
-
A type-safe integration between [oRPC](https://orpc.dev/) and [Effect](https://effect.website/), enabling Effect-native procedures with full service injection support.
|
|
3
|
+
A type-safe integration between [oRPC](https://orpc.dev/) and [Effect](https://effect.website/), enabling Effect-native procedures with full service injection support, OpenTelemetry tracing support and typesafe Effect errors support.
|
|
4
4
|
|
|
5
5
|
Inspired by [effect-trpc](https://github.com/mikearnaldi/effect-trpc).
|
|
6
6
|
|
|
@@ -23,7 +23,7 @@ pnpm add effect-orpc
|
|
|
23
23
|
bun add effect-orpc
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
-
## Demo
|
|
26
|
+
## Demo
|
|
27
27
|
|
|
28
28
|
```ts
|
|
29
29
|
import { os } from "@orpc/server";
|
|
@@ -51,7 +51,7 @@ const authedOs = os
|
|
|
51
51
|
});
|
|
52
52
|
|
|
53
53
|
// Define your services
|
|
54
|
-
class UsersRepo extends Effect.Service<UsersRepo>()("
|
|
54
|
+
class UsersRepo extends Effect.Service<UsersRepo>()("UsersRepo", {
|
|
55
55
|
accessors: true,
|
|
56
56
|
sync: () => ({
|
|
57
57
|
get: (id: number) => users.find((u) => u.id === id),
|
|
@@ -65,7 +65,7 @@ class UserNotFoundError extends ORPCTaggedError()("UserNotFoundError", {
|
|
|
65
65
|
|
|
66
66
|
// Create runtime with your services
|
|
67
67
|
const runtime = ManagedRuntime.make(UsersRepo.Default);
|
|
68
|
-
// Create Effect-aware oRPC builder from an other (optional) base oRPC builder
|
|
68
|
+
// Create Effect-aware oRPC builder from an other (optional) base oRPC builder and provide tagged errors
|
|
69
69
|
const effectOs = makeEffectORPC(runtime, authedOs).errors({
|
|
70
70
|
UserNotFoundError,
|
|
71
71
|
});
|