0.1.17 #18

Merged
Thilawyn merged 37 commits from next into master 2024-09-07 20:56:30 +02:00
Showing only changes of commit 4e55a69937 - Show all commits

View File

@@ -17,7 +17,27 @@ export const ExpressOnly = importTRPCServer.pipe(Effect.map(({
Match.orElse(() => { Match.orElse(() => {
throw new TRPCError({ throw new TRPCError({
code: "BAD_REQUEST", 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",
}) })
}), }),
) )