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
@@ -1 +0,0 @@
|
||||
export * from "@trpc/client/links/httpBatchLink";
|
||||
@@ -1 +0,0 @@
|
||||
export * from "@trpc/client/links/httpLink";
|
||||
@@ -1 +0,0 @@
|
||||
export * from "@trpc/client/links/loggerLink";
|
||||
@@ -1 +0,0 @@
|
||||
export * from "@trpc/client/links/splitLink";
|
||||
@@ -11,11 +11,11 @@
|
||||
"lint:fix": "eslint . --ext .ts,.tsx --fix"
|
||||
},
|
||||
"dependencies": {
|
||||
"@tanstack/react-query": "^4.3.9",
|
||||
"@trpc/client": "^10.13.0",
|
||||
"@trpc/next": "^10.13.0",
|
||||
"@trpc/react-query": "^10.13.0",
|
||||
"@trpc/server": "^10.13.0",
|
||||
"@tanstack/react-query": "^5.17.15",
|
||||
"@trpc/client": "11.0.0-next-beta.222",
|
||||
"@trpc/next": "11.0.0-next-beta.222",
|
||||
"@trpc/react-query": "11.0.0-next-beta.222",
|
||||
"@trpc/server": "11.0.0-next-beta.222",
|
||||
"superjson": "1.9.1",
|
||||
"zod": "^3.22.2"
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
export * from "@trpc/react-query/server";
|
||||
@@ -1 +0,0 @@
|
||||
export * from "@trpc/react-query/ssg";
|
||||
@@ -1,18 +1,20 @@
|
||||
import type { NextPageContext } from "next/types";
|
||||
import superjson from "superjson";
|
||||
|
||||
import { httpBatchLink } from "../client/links/httpBatchLink";
|
||||
import { httpLink } from "../client/links/httpLink";
|
||||
import { loggerLink } from "../client/links/loggerLink";
|
||||
import { splitLink } from "../client/links/splitLink";
|
||||
import { httpBatchLink } from "../client";
|
||||
import { httpLink } from "../client";
|
||||
import { loggerLink } from "../client";
|
||||
import { splitLink } from "../client";
|
||||
import { createTRPCNext } from "../next";
|
||||
// ℹ️ Type-only import:
|
||||
// https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export
|
||||
import type { TRPCClientErrorLike } from "../react";
|
||||
import type { inferRouterInputs, inferRouterOutputs, Maybe } from "../server";
|
||||
import type { inferRouterInputs, inferRouterOutputs } from "../server";
|
||||
import type { AppRouter } from "../server/routers/_app";
|
||||
import { ENDPOINTS } from "./shared";
|
||||
|
||||
type Maybe<T> = T | null | undefined;
|
||||
|
||||
/**
|
||||
* We deploy our tRPC router on multiple lambdas to keep number of imports as small as possible
|
||||
* TODO: Make this dynamic based on folders in trpc server?
|
||||
@@ -47,7 +49,7 @@ const resolveEndpoint = (links: any) => {
|
||||
* A set of strongly-typed React hooks from your `AppRouter` type signature with `createTRPCReact`.
|
||||
* @link https://trpc.io/docs/v10/react#2-create-trpc-hooks
|
||||
*/
|
||||
export const trpc = createTRPCNext<AppRouter, NextPageContext, "ExperimentalSuspense">({
|
||||
export const trpc = createTRPCNext<AppRouter, NextPageContext>({
|
||||
config() {
|
||||
const url =
|
||||
typeof window !== "undefined"
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
@@ -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;
|
||||
Reference in new issue
Block a user