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

View File

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