This commit is contained in:
Julien Valverdé
2024-07-05 18:49:00 +02:00
parent 0f1d9c5ba6
commit a49843ec89
3 changed files with 5 additions and 6 deletions

BIN
bun.lockb

Binary file not shown.

View File

@@ -1,5 +1,4 @@
import type { Effect, Runtime } from "effect"
import type { RuntimeFiber } from "effect/Fiber"
import type { Effect } from "effect"
import type { Request } from "express"
import type { Services } from "../Services"
@@ -7,7 +6,7 @@ import type { Services } from "../Services"
export interface TRPCContext {
req: Request
run: <A, E>(
self: Effect.Effect<A, E, Services>,
options?: Runtime.RunForkOptions,
) => RuntimeFiber<A, E>
effect: Effect.Effect<A, E, Services>,
options?: { readonly signal?: AbortSignal }
) => Promise<A>
}

View File

@@ -14,7 +14,7 @@ export class TRPCContextCreator extends Context.Tag("TRPCContextCreator")<TRPCCo
export module TRPCContextCreator {
export const Live = Layer.effect(TRPCContextCreator, Effect.gen(function*() {
const run = yield* Effect.runtime<Services>().pipe(
Effect.map(Runtime.runFork)
Effect.map(Runtime.runPromise)
)
return ({ req }) => ({