From 253c3ec00dbb37b6cb61a1c2c3d3f4274939cf34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Valverd=C3=A9?= Date: Sat, 7 Sep 2024 05:15:19 +0200 Subject: [PATCH] TRPCContextCreator refactoring --- src/TRPC/TRPCContextCreator.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/TRPC/TRPCContextCreator.ts b/src/TRPC/TRPCContextCreator.ts index 49425c2..9087b1e 100644 --- a/src/TRPC/TRPCContextCreator.ts +++ b/src/TRPC/TRPCContextCreator.ts @@ -5,21 +5,21 @@ import { createTRCPErrorMapper } from "./createTRCPErrorMapper" import { TRPCContextTransactionEnum, type TRPCContext, type TRPCContextTransaction } from "./TRPCContext" +export const Identifier = "@thilalib/TRPC/TRPCContextCreator" + +export interface TRPCContextCreator extends Context.Tag> {} + export interface TRPCContextCreatorService { readonly createContext: (transaction: TRPCContextTransaction) => TRPCContext readonly createExpressContext: (context: CreateExpressContextOptions) => TRPCContext readonly createWebSocketContext: (context: CreateWSSContextFnOptions) => TRPCContext } -export class TRPCUnknownContextCreator extends Context.Tag("@thilalib/TRPC/TRPCContextCreator") ->() {} +export const TRPCUnknownContextCreator = Context.GenericTag>(Identifier) export const make = () => { - class TRPCContextCreator extends Context.Tag("@thilalib/TRPC/TRPCContextCreator") - >() {} + const TRPCContextCreator = Context.GenericTag>(Identifier) const TRPCContextCreatorLive = Layer.effect(TRPCContextCreator, Effect.gen(function*() { const runtime = yield* Effect.runtime() @@ -53,5 +53,5 @@ export const make = () => { return { createContext, createExpressContext, createWebSocketContext } })) - return { TRPCContextCreator, TRPCContextCreatorLive } + return { TRPCContextCreator, TRPCContextCreatorLive } as const }