@shivaedev/effect-trpc 0.7.1 → 0.7.2
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 +6 -0
- package/README.md +4 -2
- package/dist/server/internal/runtime.d.ts +2 -2
- package/dist/server/internal/runtime.d.ts.map +1 -1
- package/dist/server/testing/AnyTestLayer.d.ts +1 -1
- package/dist/server/testing/AnyTestLayer.d.ts.map +1 -1
- package/dist/server/testing/types.d.ts +1 -1
- package/dist/server/testing/types.d.ts.map +1 -1
- package/dist/server/testing/vitest.d.ts +1 -1
- package/dist/server/testing/vitest.d.ts.map +1 -1
- package/dist/server/testing/vitest.js.map +1 -1
- package/docs/roadmap.md +3 -3
- package/package.json +4 -3
- package/src/server/internal/runtime.ts +2 -2
- package/src/server/testing/AnyTestLayer.ts +1 -1
- package/src/server/testing/types.ts +1 -1
- package/src/server/testing/vitest.ts +1 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -272,6 +272,8 @@ 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.
|
|
276
|
+
|
|
275
277
|
### Once per test suite: the real router caller
|
|
276
278
|
|
|
277
279
|
Create the test helper in the application's test support. These definitions continue the first complete example:
|
|
@@ -354,13 +356,13 @@ Import each name from its defining `@shivaedev/effect-trpc/<module>.ts`; there i
|
|
|
354
356
|
### Install, runtime ownership and limits
|
|
355
357
|
|
|
356
358
|
```sh
|
|
357
|
-
pnpm add @shivaedev/effect-trpc @trpc/server@11.
|
|
359
|
+
pnpm add @shivaedev/effect-trpc @trpc/server@11.19.0 effect@4.0.4
|
|
358
360
|
```
|
|
359
361
|
|
|
360
362
|
Use the exact peer versions in this package's `package.json`. Node.js 24 or later is required. The rejection example also uses `superjson`; configure the same transformer on the tRPC client.
|
|
361
363
|
|
|
362
364
|
```sh
|
|
363
|
-
pnpm add @trpc/client@11.
|
|
365
|
+
pnpm add @trpc/client@11.19.0 superjson@2.2.6
|
|
364
366
|
pnpm add --save-dev @effect/vitest@4.0.4 vitest@5.0.3
|
|
365
367
|
```
|
|
366
368
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Effect, Stream } from "effect";
|
|
2
2
|
import type { EffectTRPCRuntime } from "#adapter.ts";
|
|
3
|
-
import type { EffectTRPCErrorMapper, EffectTRPCInstrument, ProcedureInfo } from "#types.ts";
|
|
3
|
+
import type { EffectTRPCErrorMapper, EffectTRPCInstrument, EffectTRPCStreamInstrument, ProcedureInfo } from "#types.ts";
|
|
4
4
|
import type { ContextBridge } from "./contextBridge.ts";
|
|
5
5
|
interface RunEffectOptions {
|
|
6
6
|
readonly procedure: ProcedureInfo;
|
|
@@ -13,7 +13,7 @@ export interface RuntimeBridge<TRequirements> {
|
|
|
13
13
|
}
|
|
14
14
|
export declare function makeRuntimeBridge<TRequirements, TRuntimeError>(runtime: EffectTRPCRuntime<TRequirements, TRuntimeError>, contextBridge: ContextBridge, options: {
|
|
15
15
|
readonly instrument?: EffectTRPCInstrument;
|
|
16
|
-
readonly instrumentStream?:
|
|
16
|
+
readonly instrumentStream?: EffectTRPCStreamInstrument;
|
|
17
17
|
readonly mapError?: EffectTRPCErrorMapper;
|
|
18
18
|
}): RuntimeBridge<TRequirements>;
|
|
19
19
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../src/server/internal/runtime.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,MAAM,EAAwB,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,KAAK,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../src/server/internal/runtime.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,MAAM,EAAwB,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,KAAK,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AACxH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD,UAAU,gBAAgB;IACzB,QAAQ,CAAC,SAAS,EAAE,aAAa,CAAC;IAClC,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;CAC9B;AACD,MAAM,WAAW,aAAa,CAAC,aAAa;IAC3C,QAAQ,CAAC,UAAU,EAAE,oBAAoB,CAAC;IAC1C,QAAQ,CAAC,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,aAAa,CAAC,EAAE,OAAO,EAAE,gBAAgB,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAClI,QAAQ,CAAC,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,aAAa,CAAC,EAAE,OAAO,EAAE,gBAAgB,KAAK,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;CACjJ;AAwDD,wBAAgB,iBAAiB,CAAC,aAAa,EAAE,aAAa,EAC7D,OAAO,EAAE,iBAAiB,CAAC,aAAa,EAAE,aAAa,CAAC,EACxD,aAAa,EAAE,aAAa,EAC5B,OAAO,EAAE;IACR,QAAQ,CAAC,UAAU,CAAC,EAAE,oBAAoB,CAAC;IAC3C,QAAQ,CAAC,gBAAgB,CAAC,EAAE,0BAA0B,CAAC;IACvD,QAAQ,CAAC,QAAQ,CAAC,EAAE,qBAAqB,CAAC;CAC1C,GACC,aAAa,CAAC,aAAa,CAAC,CAoD9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnyTestLayer.d.ts","sourceRoot":"","sources":["../../../src/server/testing/AnyTestLayer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AACpC,MAAM,MAAM,YAAY,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"AnyTestLayer.d.ts","sourceRoot":"","sources":["../../../src/server/testing/AnyTestLayer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AACpC,MAAM,MAAM,YAAY,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { TestContext, Vitest } from "@effect/vitest";
|
|
2
2
|
import type { Effect, Layer, Scope } from "effect";
|
|
3
|
+
import type { AnyTestLayer } from "@shivaedev/effect-test/any-test-layer.ts";
|
|
3
4
|
import type { EffectClock, EffectTestOptions } from "@shivaedev/effect-test/types.ts";
|
|
4
5
|
import type { EffectTRPCAdapter } from "#adapter.ts";
|
|
5
|
-
import type { AnyTestLayer } from "./AnyTestLayer.ts";
|
|
6
6
|
import type { EffectCallerFactory } from "./caller.ts";
|
|
7
7
|
export type TrpcHarnessTest<THarness, TProvided> = <A, TEff extends Effect.Effect<unknown, unknown, TProvided>>(name: string, body: (harness: THarness, context: TestContext) => Generator<TEff, A, never>, options?: number | EffectTestOptions) => void;
|
|
8
8
|
export interface TrpcHarnessTester<THarness, TProvided> extends TrpcHarnessTest<THarness, TProvided> {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/server/testing/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AACnD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/server/testing/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AACnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AAC7E,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACtF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACvD,MAAM,MAAM,eAAe,CAAC,QAAQ,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,IAAI,SAAS,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,CAAC,EAC7G,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,CAAC,OAAO,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AAa,SAAS,CAAC,GAAG,UAAU,EAAE,KAAK,EAAE,KAAK,MAAM,EAAE,UAAU,SAAS,YAAY,EAAE,QAAQ,CAC5I,SAAQ,iBAAiB,CAAC,aAAa,EAAE,UAAU,CAAC;IACpD,QAAQ,CAAC,WAAW,EAAE,CACrB,IAAI,EAAE,mBAAmB,CAAC,aAAa,CAAC,aAAa,CAAC,EAAE,YAAY,CAAC,aAAa,CAAC,CAAC,EACpF,OAAO,EAAE,WAAW,KAChB,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC;CACjE;AACD,MAAM,MAAM,aAAa,CAAC,aAAa,IAAI,aAAa,SAAS,CAAC,GAAG,UAAU,EAAE,MAAM,UAAU,KAAK,MAAM,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;AACrI,MAAM,MAAM,YAAY,CAAC,aAAa,IAAI,aAAa,SAAS,CAAC,GAAG,UAAU,EAAE,MAAM,WAAW,KAAK,MAAM,OAAO,GAChH,OAAO,SAAS,MAAM,GACrB,OAAO,GACP,KAAK,GACN,KAAK,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Layer } from "effect";
|
|
2
|
-
import type { AnyTestLayer } from "
|
|
2
|
+
import type { AnyTestLayer } from "@shivaedev/effect-test/any-test-layer.ts";
|
|
3
3
|
import type { CallerOptions, CallerResult, MakeTrpcHarnessItOptions, MakeTrpcItOptions, TrpcHarnessIt, TrpcIt } from "./types.ts";
|
|
4
4
|
export declare function makeTrpcHarnessIt<TCreateCaller extends (...arguments_: never[]) => object, TTestLayer extends AnyTestLayer, THarness>(options: MakeTrpcHarnessItOptions<TCreateCaller, TTestLayer, THarness>): TrpcHarnessIt<THarness, Layer.Success<TTestLayer>>;
|
|
5
5
|
export declare function makeTrpcIt<TCreateCaller extends (...arguments_: never[]) => object, TTestLayer extends AnyTestLayer>(options: MakeTrpcItOptions<TCreateCaller, TTestLayer>): TrpcIt<CallerOptions<TCreateCaller>, CallerResult<TCreateCaller>, Layer.Success<TTestLayer>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vitest.d.ts","sourceRoot":"","sources":["../../../src/server/testing/vitest.ts"],"names":[],"mappings":"AACA,OAAO,EAAU,KAAK,KAAK,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"vitest.d.ts","sourceRoot":"","sources":["../../../src/server/testing/vitest.ts"],"names":[],"mappings":"AACA,OAAO,EAAU,KAAK,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AAG7E,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAelI,wBAAgB,iBAAiB,CAAC,aAAa,SAAS,CAAC,GAAG,UAAU,EAAE,KAAK,EAAE,KAAK,MAAM,EAAE,UAAU,SAAS,YAAY,EAAE,QAAQ,EACpI,OAAO,EAAE,wBAAwB,CAAC,aAAa,EAAE,UAAU,EAAE,QAAQ,CAAC,GACpE,aAAa,CAAC,QAAQ,EAAE,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC;AAiBtD,wBAAgB,UAAU,CAAC,aAAa,SAAS,CAAC,GAAG,UAAU,EAAE,KAAK,EAAE,KAAK,MAAM,EAAE,UAAU,SAAS,YAAY,EACnH,OAAO,EAAE,iBAAiB,CAAC,aAAa,EAAE,UAAU,CAAC,GACnD,MAAM,CAAC,aAAa,CAAC,aAAa,CAAC,EAAE,YAAY,CAAC,aAAa,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAK9F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vitest.js","sourceRoot":"","sources":["../../../src/server/testing/vitest.ts"],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AK,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAClD,CAAC,CAAC;KACH,CAAC,CAAC;IACH,OAAO,cAAc,CAAC,SAAS,CAAC,CAAC;AAClC,CAAC;AACD,MAAM,UAAU,UAAU,CACzB,OAAqD;IAErD,OAAO,iBAAiB,CAAC;QACxB,GAAG,OAAO;QACV,WAAW,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC;KAC3C,CAAC,CAAC;AACJ,CAAC"}
|
package/docs/roadmap.md
CHANGED
|
@@ -7,6 +7,7 @@ This file owns `effect-trpc` implementation status and local next work. The [fra
|
|
|
7
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
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
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.
|
|
10
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.
|
|
11
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.
|
|
12
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.
|
|
@@ -16,9 +17,8 @@ This file owns `effect-trpc` implementation status and local next work. The [fra
|
|
|
16
17
|
|
|
17
18
|
## Next
|
|
18
19
|
|
|
19
|
-
1. Add
|
|
20
|
-
2.
|
|
21
|
-
3. 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.
|
|
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
22
|
|
|
23
23
|
These are draft priorities, subject to the maintainer's investment decision below.
|
|
24
24
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shivaedev/effect-trpc",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
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": {
|
|
@@ -220,10 +220,11 @@
|
|
|
220
220
|
"devDependencies": {
|
|
221
221
|
"@effect/vitest": "4.0.4",
|
|
222
222
|
"@shivaedev/effect-contract": "0.5.1",
|
|
223
|
-
"@shivaedev/quality": "0.
|
|
223
|
+
"@shivaedev/quality": "0.24.0",
|
|
224
|
+
"@shivaedev/test-story": "0.7.0",
|
|
224
225
|
"@trpc/client": "11.19.0",
|
|
225
226
|
"@trpc/server": "11.19.0",
|
|
226
|
-
"@types/node": "24.19.
|
|
227
|
+
"@types/node": "24.19.2",
|
|
227
228
|
"@typescript/native": "npm:typescript@7.0.2",
|
|
228
229
|
"effect": "4.0.4",
|
|
229
230
|
"superjson": "2.2.6",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TRPCError } from "@trpc/server";
|
|
2
2
|
import { Cause, Context, Effect, Exit, Option, Result, Stream } from "effect";
|
|
3
3
|
import type { EffectTRPCRuntime } from "#adapter.ts";
|
|
4
|
-
import type { EffectTRPCErrorMapper, EffectTRPCInstrument, ProcedureInfo } from "#types.ts";
|
|
4
|
+
import type { EffectTRPCErrorMapper, EffectTRPCInstrument, EffectTRPCStreamInstrument, ProcedureInfo } from "#types.ts";
|
|
5
5
|
import type { ContextBridge } from "./contextBridge.ts";
|
|
6
6
|
|
|
7
7
|
interface RunEffectOptions {
|
|
@@ -73,7 +73,7 @@ export function makeRuntimeBridge<TRequirements, TRuntimeError>(
|
|
|
73
73
|
contextBridge: ContextBridge,
|
|
74
74
|
options: {
|
|
75
75
|
readonly instrument?: EffectTRPCInstrument;
|
|
76
|
-
readonly instrumentStream?:
|
|
76
|
+
readonly instrumentStream?: EffectTRPCStreamInstrument;
|
|
77
77
|
readonly mapError?: EffectTRPCErrorMapper;
|
|
78
78
|
},
|
|
79
79
|
): RuntimeBridge<TRequirements> {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { Layer } from "effect";
|
|
2
|
-
export type AnyTestLayer = Layer.Layer<any, any, never>;
|
|
2
|
+
export type AnyTestLayer = Layer.Layer<any, any, never> | Layer.Layer<never, any, never>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { TestContext, Vitest } from "@effect/vitest";
|
|
2
2
|
import type { Effect, Layer, Scope } from "effect";
|
|
3
|
+
import type { AnyTestLayer } from "@shivaedev/effect-test/any-test-layer.ts";
|
|
3
4
|
import type { EffectClock, EffectTestOptions } from "@shivaedev/effect-test/types.ts";
|
|
4
5
|
import type { EffectTRPCAdapter } from "#adapter.ts";
|
|
5
|
-
import type { AnyTestLayer } from "./AnyTestLayer.ts";
|
|
6
6
|
import type { EffectCallerFactory } from "./caller.ts";
|
|
7
7
|
export type TrpcHarnessTest<THarness, TProvided> = <A, TEff extends Effect.Effect<unknown, unknown, TProvided>>(
|
|
8
8
|
name: string,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { it as effectIt, type Vitest } from "@effect/vitest";
|
|
2
2
|
import { Effect, type Layer } from "effect";
|
|
3
|
+
import type { AnyTestLayer } from "@shivaedev/effect-test/any-test-layer.ts";
|
|
3
4
|
import { makeEffectIt } from "@shivaedev/effect-test/vitest.ts";
|
|
4
|
-
import type { AnyTestLayer } from "./AnyTestLayer.ts";
|
|
5
5
|
import { makeEffectCallerFactory } from "./caller.ts";
|
|
6
6
|
import type { CallerOptions, CallerResult, MakeTrpcHarnessItOptions, MakeTrpcItOptions, TrpcHarnessIt, TrpcIt } from "./types.ts";
|
|
7
7
|
|