2022-09-29 16:58:29 +00:00
|
|
|
import superjson from "superjson";
|
|
|
|
|
2023-05-09 19:27:05 +00:00
|
|
|
import { initTRPC } from "@trpc/server";
|
2022-12-13 21:34:21 +00:00
|
|
|
|
2023-05-09 19:27:05 +00:00
|
|
|
import type { createContextInner } from "./createContext";
|
|
|
|
import type { UserFromSession } from "./middlewares/sessionMiddleware";
|
2022-09-29 16:58:29 +00:00
|
|
|
|
2023-05-09 19:27:05 +00:00
|
|
|
export const tRPCContext = initTRPC.context<typeof createContextInner>().create({
|
2022-09-29 16:58:29 +00:00
|
|
|
transformer: superjson,
|
|
|
|
});
|
|
|
|
|
2023-05-09 19:27:05 +00:00
|
|
|
export const router = tRPCContext.router;
|
|
|
|
export const mergeRouters = tRPCContext.mergeRouters;
|
|
|
|
export const middleware = tRPCContext.middleware;
|
|
|
|
export const procedure = tRPCContext.procedure;
|
2023-03-23 22:10:01 +00:00
|
|
|
|
2023-05-09 19:27:05 +00:00
|
|
|
export type TrpcSessionUser = UserFromSession;
|