Upgrading nextjs and collect (#3252)

* Upgrading nextjs and collect

* Fixing suggestions + yarn.lock

* Updating submodules

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
Leo Giovanettiandkodiakhq[bot] authored and GitHub committed 2022-07-12 11:43:53 -06:00
1 parent c3c7f82841
commit b1d637d1a6
14 files changed
+51 -358

No files matched your search

Submodule apps/api updated: 74c227f5f1...a5976ec5c6.
+1 -1
View File
@@ -16,7 +16,7 @@
"license": "MIT",
"dependencies": {
"iframe-resizer-react": "^1.1.0",
"next": "^12.1.6",
"next": "^12.2.0",
"nextra": "^1.1.0",
"nextra-theme-docs": "^1.2.2",
"react": "^18.1.0",
+1 -1
View File
@@ -10,7 +10,7 @@
"dependencies": {
"highlight.js": "^11.5.1",
"isarray": "2.0.5",
"next": "12.1.6",
"next": "12.2.0",
"openapi-snippet": "^0.13.0",
"react": "18.1.0",
"react-dom": "18.1.0",
+2 -2
View File
@@ -91,6 +91,7 @@ export const extendEventData = (
? !!req.headers.get("x-vercel-id")
: !!(req.headers as any)?.["x-vercel-id"];
const pageUrl = original?.page_url || (req as any)?.page?.name || undefined;
const cookies = req.cookies as { [key: string]: any };
return {
title: "",
ipAddress: "",
@@ -104,8 +105,7 @@ export const extendEventData = (
: original?.isTeamBooking,
referrer: "",
onVercel,
isAuthorized:
!!req.cookies["next-auth.session-token"] || !!req.cookies["__Secure-next-auth.session-token"],
isAuthorized: !!cookies["next-auth.session-token"] || !!cookies["__Secure-next-auth.session-token"],
utc_time: new Date().toISOString(),
};
};
File renamed without changes.
+3 -3
View File
@@ -80,9 +80,9 @@
"memory-cache": "^0.2.0",
"micro": "^9.3.4",
"mime-types": "^2.1.35",
"next": "^12.1.6",
"next-auth": "^4.5.0",
"next-collect": "^0.1.0",
"next": "^12.2.0",
"next-auth": "^4.9.0",
"next-collect": "^0.2.0",
"next-i18next": "^11.0.0",
"next-mdx-remote": "^4.0.3",
"next-seo": "^4.26.0",
@@ -15,6 +15,14 @@ import path from "path";
*/
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
const [appName, fileName] = Array.isArray(req.query.static) ? req.query.static : [req.query.static];
if (!fileName) {
return res.status(400).json({ error: true, message: "No file name provided" });
}
if (!appName) {
return res.status(400).json({ error: true, message: "No app name provided" });
}
const fileNameParts = fileName.split(".");
const { [fileNameParts.length - 1]: fileExtension } = fileNameParts;
const STATIC_PATH = path.join(process.cwd(), "..", "..", "packages/app-store", appName, "static", fileName);
+7 -1
View File
@@ -1,4 +1,5 @@
import { NextApiRequest, NextApiResponse } from "next";
import z from "zod";
import jackson from "@lib/jackson";
@@ -12,6 +13,10 @@ const extractAuthToken = (req: NextApiRequest) => {
return null;
};
const requestQuery = z.object({
access_token: z.string(),
});
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
try {
if (req.method !== "GET") {
@@ -24,7 +29,8 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
// check for query param
if (!token) {
let arr: string[] = [];
arr = arr.concat(req.query.access_token);
const { access_token } = requestQuery.parse(req.query);
arr = arr.concat(access_token);
if (arr[0].length > 0) {
token = arr[0];
}
+11 -2
View File
@@ -1,5 +1,6 @@
import { pick } from "lodash";
import type { NextApiRequest, NextApiResponse } from "next";
import z from "zod";
import { getSession } from "@lib/auth";
import prisma from "@lib/prisma";
@@ -11,8 +12,16 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
return res.status(401).json({ message: "Not authenticated" });
}
const userIdQuery = req.query?.id ?? null;
const userId = Array.isArray(userIdQuery) ? parseInt(userIdQuery.pop() || "") : parseInt(userIdQuery);
const querySchema = z.object({
id: z.string().transform((val) => parseInt(val)),
});
const parsedQuery = querySchema.safeParse(req.query);
const userId = parsedQuery.success ? parsedQuery.data.id : null;
if (!userId) {
return res.status(400).json({ message: "No user id provided" });
}
const authenticatedUser = await prisma.user.findFirst({
rejectOnNotFound: true,