From ab78c0b9ec6216d36ff9f92c559ee705d0c98e8e Mon Sep 17 00:00:00 2001 From: Leo Giovanetti Date: Wed, 6 Jul 2022 17:21:12 -0300 Subject: [PATCH 1/3] Upgrading nextjs --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c806055f00..a02580eb97 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "bcryptjs": "^2.4.3", "memory-cache": "^0.2.0", "modify-response-middleware": "^1.1.0", - "next": "^12.1.6", + "next": "^12.2.0", "next-api-middleware": "^1.0.1", "next-swagger-doc": "^0.3.4", "next-transpile-modules": "^9.0.0", From f93cb48d4d354e458f2810b8d49a5ce64d771183 Mon Sep 17 00:00:00 2001 From: Agusti Fernandez Pardo Date: Thu, 7 Jul 2022 18:56:27 +0200 Subject: [PATCH 2/3] fix: query partial type --- lib/helpers/extendRequest.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/helpers/extendRequest.ts b/lib/helpers/extendRequest.ts index 8ed3ee0571..5ae84596d1 100644 --- a/lib/helpers/extendRequest.ts +++ b/lib/helpers/extendRequest.ts @@ -13,7 +13,7 @@ declare module "next" { method: string; prisma: PrismaClient; session: { user: { id: number } }; - query: { [key: string]: string | string[] }; + query: Partial<{ [key: string]: string | string[] }>; isAdmin: boolean; } } From 599dccdcce8e6e578fdc9cca38766f5bab334d23 Mon Sep 17 00:00:00 2001 From: Agusti Fernandez Pardo Date: Fri, 8 Jul 2022 02:00:00 +0200 Subject: [PATCH 3/3] feat: add axiom --- next.config.js | 55 ++++++++++++++++++++++++++------------------------ 1 file changed, 29 insertions(+), 26 deletions(-) diff --git a/next.config.js b/next.config.js index f8491c9904..8c5749db55 100644 --- a/next.config.js +++ b/next.config.js @@ -13,30 +13,33 @@ const withTM = require("next-transpile-modules")([ "@calcom/embed-core", "@calcom/embed-snippet", ]); +const { withAxiom } = require("next-axiom"); -module.exports = withTM({ - async rewrites() { - return { - afterFiles: [ - // This redirects requests recieved at / the root to the /api/ folder. - { - source: "/v:version/:rest*", - destination: "/api/v:version/:rest*", - }, - // This redirects requests to api/v*/ to /api/ passing version as a query parameter. - { - source: "/api/v:version/:rest*", - destination: "/api/:rest*?version=:version", - }, - ], - fallback: [ - // These rewrites are checked after both pages/public files - // and dynamic routes are checked - { - source: "/:path*", - destination: `/api/:path*`, - }, - ], - }; - }, -}); +module.exports = withAxiom( + withTM({ + async rewrites() { + return { + afterFiles: [ + // This redirects requests recieved at / the root to the /api/ folder. + { + source: "/v:version/:rest*", + destination: "/api/v:version/:rest*", + }, + // This redirects requests to api/v*/ to /api/ passing version as a query parameter. + { + source: "/api/v:version/:rest*", + destination: "/api/:rest*?version=:version", + }, + ], + fallback: [ + // These rewrites are checked after both pages/public files + // and dynamic routes are checked + { + source: "/:path*", + destination: `/api/:path*`, + }, + ], + }; + }, + }) +);