TRPC context creator
This commit is contained in:
@@ -10,5 +10,5 @@ export interface TRPCContext {
|
||||
options?: { readonly signal?: AbortSignal }
|
||||
) => Promise<A>
|
||||
|
||||
req: Request
|
||||
// req: Request
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { TRPCError } from "@trpc/server"
|
||||
import type { CreateExpressContextOptions } from "@trpc/server/adapters/express"
|
||||
import type { CreateWSSContextFnOptions } from "@trpc/server/adapters/ws"
|
||||
import { Context, Effect, Layer, Runtime } from "effect"
|
||||
import type { Services } from "../Services"
|
||||
import type { TRPCContext } from "./TRPCContext"
|
||||
@@ -9,7 +10,10 @@ import type { TRPCContext } from "./TRPCContext"
|
||||
* Provides a function that instantiates a fresh context for each tRPC procedure call
|
||||
*/
|
||||
export class TRPCContextCreator extends Context.Tag("TRPCContextCreator")<TRPCContextCreator,
|
||||
(opts: CreateExpressContextOptions) => TRPCContext
|
||||
(opts:
|
||||
| CreateExpressContextOptions
|
||||
| CreateWSSContextFnOptions
|
||||
) => TRPCContext
|
||||
>() {}
|
||||
|
||||
export module TRPCContextCreator {
|
||||
@@ -20,7 +24,7 @@ export module TRPCContextCreator {
|
||||
return ({ req }) => ({
|
||||
runtime,
|
||||
run,
|
||||
req,
|
||||
// req,
|
||||
})
|
||||
}))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user