@shivaedev/effect-trpc 0.8.0 → 0.8.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.8.1 - 2026-10-18
4
+
5
+ ### Changed
6
+
7
+ - Release with updated workspace dependencies.
8
+
3
9
  ## 0.8.0 - 2026-10-18
4
10
 
5
11
  ### Breaking
package/README.md CHANGED
@@ -272,7 +272,7 @@ The mapper receives the procedure path and an `origin` of `failure` or `defect`.
272
272
 
273
273
  `instrument(effect, procedure)` wraps resolver work and can read request services. `instrumentStream(stream, procedure)` wraps subscription streams. Both receive the procedure path and kind; an Effect-instrumentation defect is redacted.
274
274
 
275
- Each query, mutation and subscription creates one procedure span named after its full procedure path, such as `orders.read`. Its attributes are `rpc.method` set to that path, `rpc.system: "trpc"` and `trpc.type` set to `"query"`, `"mutation"` or `"subscription"`. A span opened by the resolver is a child of that procedure span. Subscriptions also provide the caller's exact `AbortSignal` through `RequestSignal`; the resolver can observe its aborted state. The [procedure evidence tests](src/server/procedureEvidence.spec.ts) record these spans and observe signal identity and abort through `router.createCaller` in process.
275
+ Each query, mutation and subscription creates one procedure span named after its full procedure path, such as `orders.read`. Its attributes are `rpc.method` set to that path, `rpc.system: "trpc"` and `trpc.type` set to `"query"`, `"mutation"` or `"subscription"`. A span opened by the resolver is a child of that procedure span. Subscriptions also provide the caller's exact `AbortSignal` through `RequestSignal`; the resolver can observe its aborted state.
276
276
 
277
277
  ### Once per test suite: the real router caller
278
278
 
@@ -345,11 +345,9 @@ Import each name from its defining `@shivaedev/effect-trpc/<module>.ts`; there i
345
345
  | `server/errors.ts` | `fail`, `badRequest`, `unauthorized`, `forbidden`, `notFound`, `conflict`, `preconditionFailed`, `internalServerError` |
346
346
  | `server/rejection.ts` | `rejectWith`, `rejectionCode`, `RejectionError`, `DeclaredRejection`, `RejectWithOptions` |
347
347
  | `server/rejectionFormatter.ts` | `rejectionFormatter`, `withRejection`, `RejectionData`, `RejectionErrorShape` |
348
- | `rejectionDecoding.ts`, `rejectionDecoding.ts` | `rejectionOf`, `decodeRejection`, `EncodedRejection` |
348
+ | `rejectionDecoding.ts` | `rejectionOf`, `decodeRejection`, `EncodedRejection` |
349
349
  | `server/testing/caller.ts` | `makeEffectCaller`, `makeEffectCallerFactory`, `EffectCaller`, `EffectCallerFactory` |
350
350
  | `server/testing/vitest.ts` | `makeTrpcIt`, `makeTrpcHarnessIt` |
351
- | `server/testing/types.ts` | `CallerOptions`, `CallerResult`, `MakeTrpcItOptions`, `MakeTrpcHarnessItOptions`, `TrpcIt`, `TrpcTest`, `TrpcTester`, `TrpcHarnessIt`, `TrpcHarnessTest`, `TrpcHarnessTester` |
352
- | `server/testing/AnyTestLayer.ts` | `AnyTestLayer` |
353
351
 
354
352
  `rejectWith` removes the declared schema types from the Effect's error channel and adds `RejectionError`.
355
353
 
@@ -372,6 +370,4 @@ The Vitest dependency is optional unless you import the testing modules. The app
372
370
  await runtime.dispose();
373
371
  ```
374
372
 
375
- Choose an application server and tRPC transport separately. The rejection tests exercise tRPC's fetch handler and client in process; the cancellation test exercises a caller signal and Stream iterator. Those checks do not establish deployed HTTP or WebSocket disconnect behavior through a host or proxy. Test that boundary in the consuming application.
376
-
377
- For the package's design priorities, read [north star](https://github.com/ShivaeDev/platform/blob/main/packages/effect-trpc/docs/north-star.md). Implementation status, next work and maintainer questions live in the [roadmap](https://github.com/ShivaeDev/platform/blob/main/packages/effect-trpc/docs/roadmap.md).
373
+ Choose an application server and tRPC transport separately. The adapter's cancellation path starts from the caller's abort signal; test deployed HTTP or WebSocket disconnect behavior through your host or proxy in the consuming application.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shivaedev/effect-trpc",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "description": "Effect-native procedures and testing for tRPC",
5
5
  "homepage": "https://github.com/ShivaeDev/platform/tree/main/packages/effect-trpc#readme",
6
6
  "bugs": {
@@ -38,24 +38,22 @@
38
38
  "!src/**/*.spec.ts",
39
39
  "!src/**/test-support",
40
40
  "CHANGELOG.md",
41
- "docs",
42
41
  "README.md"
43
42
  ],
44
43
  "dependencies": {
45
- "@shivaedev/effect-test": "0.6.0"
44
+ "@shivaedev/effect-test": "0.7.0"
46
45
  },
47
46
  "devDependencies": {
48
47
  "@effect/vitest": "4.0.4",
49
48
  "@shivaedev/effect-contract": "0.5.1",
50
- "@shivaedev/quality": "0.25.0",
51
- "@shivaedev/test-story": "0.7.1",
49
+ "@shivaedev/quality": "0.27.1",
50
+ "@shivaedev/test-story": "0.11.0",
52
51
  "@trpc/client": "11.19.0",
53
52
  "@trpc/server": "11.19.0",
54
53
  "@types/node": "24.19.2",
55
- "@typescript/native": "npm:typescript@7.0.2",
56
54
  "effect": "4.0.4",
57
55
  "superjson": "2.2.6",
58
- "typescript": "npm:@typescript/typescript6@6.0.2",
56
+ "typescript": "7.0.2",
59
57
  "vitest": "5.0.3"
60
58
  },
61
59
  "peerDependencies": {
@@ -1,48 +0,0 @@
1
- # The north star
2
-
3
- ## The problem
4
-
5
- A tRPC application has a Promise boundary at every procedure. An Effect application has a different set of obligations inside that boundary: a service must be provided, a typed failure must remain distinguishable from a defect, a request must carry its own identity, and a scoped resource must live until its work ends. Handwritten adapters repeat this work at every feature and make it easy to weaken one obligation while fixing another.
6
-
7
- The package gives tRPC applications one small bridge. An application supplies its runtime once. A request Layer turns the context tRPC middleware produced into Effect services. A procedure yields those services and returns a value or a Stream. Schema describes the data boundary; an explicitly declared rejection describes the failure data a client can understand.
8
-
9
- This is the integration path for applications that use tRPC. Native Effect queries and commands belong to `effect-contract`; native request identity and server middleware belong to the `platform` RPC modules. Sharing a rejection schema across transports is useful. Making tRPC a requirement of the native framework is not.
10
-
11
- ## What good looks like
12
-
13
- ### Effects keep their meaning
14
-
15
- A procedure's generator is ordinary Effect work. Its service requirements must be supplied by the application runtime or request Layer; unavailable requirements must not disappear into a cast. Schema's encoded and decoded sides stay visible to both the caller and resolver. Input and output are decoders, so the resolver sees decoded input and produces encoded output.
16
-
17
- Resources keep the lifetime their work needs. A query or mutation has request work; a subscription has a Stream whose consumption owns its resources. Interruption belongs to that work too. Tests observe both the interruption and the finalizer, not just a returned cancellation error.
18
-
19
- ### Requests and failures cross deliberately
20
-
21
- A tRPC context value becomes a service in a request Layer. Middleware remains the place to establish or refine that context. The adapter does not invent an authentication policy, a global current user or a second request-context vocabulary.
22
-
23
- Failure data crosses only by an explicit choice. A declared Schema rejection is data a client may decode and act on. A `TRPCError` is an explicit transport response. An application mapper may expose another known error. An unlisted failure or defect is an internal error, not an accidental serialization of database or infrastructure details.
24
-
25
- An invalid input and an application rejection are different events. The formatter's reserved `invalidInput` mark allows a client to distinguish them while keeping field-error data in one location. Declared failures must not be able to forge that mark.
26
-
27
- ### tRPC and Effect remain recognizable
28
-
29
- tRPC owns routers, middleware, metadata and host transports. Effect owns services, Layers, Streams and the error channel. The adapter removes repetitive conversion at their boundary; it does not replace either side with its own framework.
30
-
31
- Tests use the router's real caller and an Effect-shaped view of it. Application fixtures can surround that caller, and test services can replace matching runtime services. The shared `effect-test` runner owns clocks and test lifecycle so this package does not maintain another implementation of them.
32
-
33
- ## Trade-offs
34
-
35
- The order is Effect types, scope and interruption; deliberate request and error boundaries; tRPC interoperability; then convenience. A helper that saves a few lines but makes unavailable services compile or lets a Stream outlive its resource scope loses. A richer public error that has not been declared loses to a redacted error. A feature needing tRPC middleware should use that middleware before adding another hook to this package.
36
-
37
- Test coverage limits the wording of guarantees. In-process HTTP serialization is valuable evidence for rejection encoding, but it cannot establish a production proxy's disconnect behavior. A caller signal and finalizer test establishes that path, not all hosts and transports. Application adoption and deployment validation stay with the framework and consuming application.
38
-
39
- ## What stays outside
40
-
41
- - A replacement for native `effect-contract` queries and commands.
42
- - A router, HTTP server, WebSocket server or transport selection policy.
43
- - Authentication, authorization, user-facing error wording and transaction policy.
44
- - A client cache, form state engine or automatic invalidation protocol.
45
- - A second Effect runtime owner or test runner.
46
- - An implied guarantee about deployed cancellation based only on local fixtures.
47
-
48
- Local implementation status, next work and maintainer decisions are in [the roadmap](./roadmap.md).
package/docs/roadmap.md DELETED
@@ -1,33 +0,0 @@
1
- # Roadmap
2
-
3
- This file owns `effect-trpc` implementation status and local next work. The [framework roadmap](https://github.com/ShivaeDev/platform/blob/main/docs/framework/roadmap.md) owns composed application fixtures, adoption and deployment validation. A library test is not application adoption evidence.
4
-
5
- ## Built
6
-
7
- - Generator queries and mutations over an application runtime and request services, including context supplied by tRPC middleware and request-Layer extensions that consume base services. `src/server/adapter.test.ts` covers runtime execution; `src/server/EffectProcedureBuilder.typecheck.test.ts` rejects missing services.
8
- - Effect Schema input and output decoding with encoded/decoded caller and resolver types. Adapter runtime tests and procedure type tests cover the distinction, including subscription output decoding.
9
- - Stream subscriptions with request services, scoped finalizers and interruption when a caller signal aborts. `src/server/adapter.test.ts` observes values, stream instrumentation and finalization; `src/server/internal/runtime.test.ts` covers pure interruption's transport error.
10
- - Procedure spans named after the full path with `rpc.method`, `rpc.system: "trpc"` and `trpc.type`, including resolver-child parenting for queries, mutations and subscriptions. The [procedure evidence tests](../src/server/procedureEvidence.spec.ts) use a recording Tracer and also observe the exact caller signal through `RequestSignal`, its aborted state and subscription finalization. The [adapter tests](../src/server/adapter.test.ts) observe Effect instrumentation with request services and stream instrumentation with procedure path and kind.
11
- - Explicit tRPC errors, application error mapping and redaction of unmapped failures and defects. Adapter/runtime tests cover resolver, request-Layer, mapper and Effect-instrumentation defects; `src/server/httpRejections.spec.ts` checks opaque serialized failures.
12
- - Tagged declared rejection encoding, taxonomy code mapping, custom code selection and formatter composition. `src/server/rejection.test.ts` and `src/server/httpRejections.spec.ts` cover fields, messages, encodings, HTTP statuses and mixed batches.
13
- - Input-validation field paths and the reserved `invalidInput` mark. `src/server/inputRejections.spec.ts` covers dotted paths, array indexes, whole-input issues and stripping forged marks; `src/server/rejection.typecheck.test.ts` rejects reserved fields.
14
- - Client rejection reading and schema decoding, including malformed carriers and unknown tags. HTTP rejection tests and rejection type tests cover values, class instances and synchronous decoder requirements.
15
- - Reuse of `effect-contract` operation error schemas with generated and reused rejection classes. `src/server/contractRejections.spec.ts` also checks opaque failures for an operation without declared rejections.
16
- - An Effect-shaped caller and application-defined test harness built on `effect-test`. `src/server/testing/vitest.test.ts` covers runtime service overrides, alternate contexts, table cases and harness services; its type tests preserve caller and harness types.
17
-
18
- ## Next
19
-
20
- 1. Add a representative real-host transport cancellation fixture when a consumer selects that transport. Observe query and subscription interruption and resource release; keep proxy/deployment acceptance with the consuming application.
21
- 2. Exercise test-harness setup inside the `around` wrapper and Layer acquisition lifetime through this adapter if consumers rely on that composition. The shared runner owns the implementation; adapter tests should observe the composition they promise.
22
-
23
- These are draft priorities, subject to the maintainer's investment decision below.
24
-
25
- ## Questions the maintainer owns
26
-
27
- - Should the package receive new adapter features, or focus on compatibility and stronger boundary evidence for tRPC consumers? The draft next work favors evidence for existing behavior. The root package paths establish its purpose but do not set its investment order.
28
- - Which real host and tRPC transport should be the first cancellation fixture? Caller-signal tests and in-process fetch serialization do not decide a deployment transport.
29
- - Should `RequestSignal` become a uniform service for queries and mutations as well as subscriptions? It is currently supplied by the subscription handler; expanding that boundary is an API/behavior decision, not documentation work.
30
-
31
- ## Evidence boundaries
32
-
33
- The HTTP rejection tests call tRPC's fetch handler in process with its actual client and transformer. Subscription cancellation uses `router.createCaller` with an abort signal and observes its iterator and finalizer. Neither is proof of a network server, WebSocket disconnect, reverse proxy, SSR or mobile lifecycle. Broader composed fixtures and deployment acceptance belong to the framework roadmap and the adopting application.