0.1.17 #18
@@ -17,7 +17,27 @@ export const ExpressOnly = importTRPCServer.pipe(Effect.map(({
|
||||
Match.orElse(() => {
|
||||
throw new TRPCError({
|
||||
code: "BAD_REQUEST",
|
||||
message: "Only Express backend is supported by this procedure",
|
||||
message: "Only Express transport is supported by this procedure",
|
||||
})
|
||||
}),
|
||||
)
|
||||
)))
|
||||
|
||||
export const WebSocketOnly = importTRPCServer.pipe(Effect.map(({
|
||||
experimental_standaloneMiddleware,
|
||||
TRPCError,
|
||||
}) => experimental_standaloneMiddleware<{
|
||||
ctx: { readonly transaction: TRPCContextTransaction }
|
||||
}>().create(opts =>
|
||||
Match.value(opts.ctx.transaction).pipe(
|
||||
Match.tag("WebSocket", transaction =>
|
||||
opts.next({ ctx: { transaction } })
|
||||
),
|
||||
|
||||
Match.orElse(() => {
|
||||
throw new TRPCError({
|
||||
code: "BAD_REQUEST",
|
||||
message: "Only WebSocket transport is supported by this procedure",
|
||||
})
|
||||
}),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user