chore: bump @trpc/* and @tanstack/react-query (#13335)

Co-authored-by: Peer Richelsen <[email protected]>
Co-authored-by: Omar López <[email protected]>
Co-authored-by: CarinaWolli <[email protected]>
Co-authored-by: Alex van Andel <[email protected]>
Co-authored-by: zomars <[email protected]>
Co-authored-by: Udit Takkar <[email protected]>
Co-authored-by: Benny Joo <[email protected]>
Co-authored-by: Carina Wollendorfer <[email protected]>
Co-authored-by: Gergő Móricz <[email protected]>
Co-authored-by: Keith Williams <[email protected]>
This commit is contained in:
183 files changed
+1203 -1013

No files matched your search

+6 -2
View File
@@ -10,7 +10,11 @@ import type { SelectedCalendar, User as PrismaUser } from "@calcom/prisma/client
import type { CreateNextContextOptions } from "@trpc/server/adapters/next";
type CreateContextOptions = CreateNextContextOptions | GetServerSidePropsContext;
type CreateContextOptions =
| (Omit<CreateNextContextOptions, "info"> & {
info?: CreateNextContextOptions["info"];
})
| GetServerSidePropsContext;
export type CreateInnerContextOptions = {
sourceIp?: string;
@@ -48,7 +52,7 @@ export type GetSessionFn =
*
* Also useful for:
* - testing, so you don't have to mock Next.js' `req`/`res`
* - tRPC's `createSSGHelpers` where we don't have `req`/`res`
* - tRPC's `createServerSideHelpers` where we don't have `req`/`res`
*
* @see https://trpc.io/docs/context#inner-and-outer-context
*/
+2 -2
View File
@@ -14,8 +14,8 @@ export function createNextApiHandler(router: AnyRouter, isPublic = false, namesp
/**
* @link https://trpc.io/docs/context
*/
createContext: ({ req, res }) => {
return createTrpcContext({ req, res });
createContext: (opts) => {
return createTrpcContext(opts);
},
/**
* @link https://trpc.io/docs/error-handling
@@ -5,12 +5,13 @@ import logger from "@calcom/lib/logger";
import { MembershipRole } from "@calcom/prisma/enums";
import { teamMetadataSchema, userMetadata } from "@calcom/prisma/zod-utils";
import type { Maybe } from "@trpc/server";
import { TRPCError } from "@trpc/server";
import type { TRPCContextInner } from "../createContext";
import { middleware } from "../trpc";
type Maybe<T> = T | null | undefined;
export async function getUserFromSession(ctx: TRPCContextInner, session: Maybe<Session>) {
const { prisma } = ctx;
if (!session?.user?.id) {
@@ -161,7 +162,7 @@ export const isAuthed = middleware(async ({ ctx, next }) => {
}
return next({
ctx: { ...ctx, user, session },
ctx: { user, session },
});
});
@@ -170,7 +171,7 @@ export const isAdminMiddleware = isAuthed.unstable_pipe(({ ctx, next }) => {
if (user?.role !== "ADMIN") {
throw new TRPCError({ code: "UNAUTHORIZED" });
}
return next({ ctx: { ...ctx, user: user } });
return next({ ctx: { user: user } });
});
// Org admins can be admins or owners
@@ -179,7 +180,7 @@ export const isOrgAdminMiddleware = isAuthed.unstable_pipe(({ ctx, next }) => {
if (!user?.organization?.isOrgAdmin) {
throw new TRPCError({ code: "UNAUTHORIZED" });
}
return next({ ctx: { ...ctx, user: user } });
return next({ ctx: { user: user } });
});
export default sessionMiddleware;