Skip to content

Commit

Permalink
chore: Update next-auth to v4.23.0 (which supports Node v18)
Browse files Browse the repository at this point in the history
  • Loading branch information
bprusinowski committed Aug 15, 2023
1 parent 38d0d46 commit b76e07f
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 67 deletions.
2 changes: 1 addition & 1 deletion app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
"micro-cors": "^0.1.1",
"mitt": "^3.0.0",
"nanoid": "^3.1.12",
"next-auth": "^4.10.3",
"next-auth": "^4.23.0",
"nextkit": "^3.4.3",
"nprogress": "^0.2.0",
"pg": "^8.3.3",
Expand Down
2 changes: 1 addition & 1 deletion app/pages/api/auth/[...nextauth].ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import NextAuth, { NextAuthOptions } from "next-auth";
import KeycloakProvider from "next-auth/providers/keycloak";

import { ensureUserFromSub } from "@/db/user";
import { KEYCLOAK_ID, KEYCLOAK_SECRET, KEYCLOAK_ISSUER } from "@/domain/env";
import { KEYCLOAK_ID, KEYCLOAK_ISSUER, KEYCLOAK_SECRET } from "@/domain/env";
import { truthy } from "@/domain/types";

import type { NextApiRequest, NextApiResponse } from "next";
Expand Down
14 changes: 6 additions & 8 deletions app/pages/api/config.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
import { getServerSession } from "next-auth";
import { nextAuthOptions } from "pages/api/auth/[...nextauth]";

import { createConfig } from "@/db/config";

import { api } from "../../server/nextkit";

import { getServerSideSession } from "./session";

const route = api({
POST: async ({ req, res }) => {
const session = await getServerSideSession(req, res);
const session = await getServerSession(req, res, nextAuthOptions);
const userId = session?.user?.id;
const { data } = req.body;
const result = await createConfig({
data,
userId,
});
return result;

return await createConfig({ data, userId });
},
});

Expand Down
10 changes: 0 additions & 10 deletions app/pages/api/session.ts

This file was deleted.

23 changes: 12 additions & 11 deletions app/pages/profile.tsx
Original file line number Diff line number Diff line change
@@ -1,36 +1,37 @@
import {
Typography,
Box,
Table,
TableBody,
TableRow,
TableCell,
TableHead,
Box,
TableRow,
Typography,
} from "@mui/material";
import { User } from "@prisma/client";
import { GetServerSideProps } from "next";
import { getServerSession } from "next-auth";
import Link from "next/link";
import { nextAuthOptions } from "pages/api/auth/[...nextauth]";

import { AppLayout } from "@/components/layout";
import {
PanelLayout,
PanelMiddleWrapper,
} from "@/configurator/components/layout";
import { getUserConfigs, ParsedConfig } from "@/db/config";
import { deserializeProps, serializeProps, Serialized } from "@/db/serialize";
import { ParsedConfig, getUserConfigs } from "@/db/config";
import { Serialized, deserializeProps, serializeProps } from "@/db/serialize";
import { findBySub } from "@/db/user";

import { getServerSideSession } from "./api/session";

type PageProps = {
user: User;
userConfigs: ParsedConfig[];
};

export const getServerSideProps: GetServerSideProps<PageProps> = async (
context
) => {
const session = await getServerSideSession(context.req, context.res);
export const getServerSideProps: GetServerSideProps<PageProps> = async ({
req,
res,
}) => {
const session = await getServerSession(req, res, nextAuthOptions);
const userSub = session?.user.sub;
if (userSub) {
const user = await findBySub(userSub);
Expand Down
82 changes: 46 additions & 36 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -778,13 +778,6 @@
dependencies:
regenerator-runtime "^0.13.4"

"@babel/runtime@^7.16.3":
version "7.19.0"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.19.0.tgz#22b11c037b094d27a8a2504ea4dcff00f50e2259"
integrity sha512-eR8Lo9hnDS7tqkO7NsV+mKvCmv5boaXFSZ70DnfhcgiEne8hv9oCEd36Klw74EtizEqLsy4YnW8UWwpBVolHZA==
dependencies:
regenerator-runtime "^0.13.4"

"@babel/runtime@^7.17.2", "@babel/runtime@^7.5.5", "@babel/runtime@^7.8.3", "@babel/runtime@^7.8.7":
version "7.17.2"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.17.2.tgz#66f68591605e59da47523c631416b18508779941"
Expand All @@ -799,6 +792,13 @@
dependencies:
regenerator-runtime "^0.13.11"

"@babel/runtime@^7.20.13":
version "7.22.10"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.22.10.tgz#ae3e9631fd947cb7e3610d3e9d8fef5f76696682"
integrity sha512-21t/fkKLMZI4pqP2wlmsQAWnYW1PDyKyyUV4vCi+B25ydmdaYTKXPwCj0BzSUnZf4seIiYvSA3jcZ3gdsMFkLQ==
dependencies:
regenerator-runtime "^0.14.0"

"@babel/runtime@^7.20.7":
version "7.22.5"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.22.5.tgz#8564dd588182ce0047d55d7a75e93921107b57ec"
Expand Down Expand Up @@ -3060,10 +3060,10 @@
"@nodelib/fs.scandir" "2.1.5"
fastq "^1.6.0"

"@panva/hkdf@^1.0.1":
version "1.0.2"
resolved "https://registry.yarnpkg.com/@panva/hkdf/-/hkdf-1.0.2.tgz#bab0f09d09de9fd83628220d496627681bc440d6"
integrity sha512-MSAs9t3Go7GUkMhpKC44T58DJ5KGk2vBo+h1cqQeqlMfdGkxaVB78ZWpv9gYi/g2fa4sopag9gJsNvS8XGgWJA==
"@panva/hkdf@^1.0.2":
version "1.1.1"
resolved "https://registry.yarnpkg.com/@panva/hkdf/-/hkdf-1.1.1.tgz#ab9cd8755d1976e72fc77a00f7655a64efe6cd5d"
integrity sha512-dhPeilub1NuIG0X5Kvhh9lH4iW3ZsHlnzwgwbOlgwQ2wG1IqFzsgHqmKPk3WzsdWAeaxKJxgM0+W433RmN45GA==

"@percy/cli-app@1.26.1":
version "1.26.1"
Expand Down Expand Up @@ -7182,6 +7182,11 @@ cookie@^0.4.1:
resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.4.2.tgz#0e41f24de5ecf317947c82fc789e06a884824432"
integrity sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA==

cookie@^0.5.0:
version "0.5.0"
resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.5.0.tgz#d1f5d71adec6558c58f389987c366aa47e994f8b"
integrity sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==

copy-anything@^3.0.2:
version "3.0.2"
resolved "https://registry.yarnpkg.com/copy-anything/-/copy-anything-3.0.2.tgz#7189171ff5e1893b2287e8bf574b8cd448ed50b1"
Expand Down Expand Up @@ -11387,10 +11392,10 @@ joi@^17.3.0:
"@sideway/formula" "^3.0.0"
"@sideway/pinpoint" "^2.0.0"

jose@^4.1.4, jose@^4.3.7:
version "4.9.2"
resolved "https://registry.yarnpkg.com/jose/-/jose-4.9.2.tgz#268994df4443b9c191de0b001c2e3796ac6cf368"
integrity sha512-EqKvu2PqJCD3Jrg3PvcYZVS7D21qMVLSYMDAFcOdGUEOpJSLNtJO7NjLANvu3SYHVl6pdP2ff7ve6EZW2nX7Nw==
jose@^4.11.4, jose@^4.14.4:
version "4.14.4"
resolved "https://registry.yarnpkg.com/jose/-/jose-4.14.4.tgz#59e09204e2670c3164ee24cbfe7115c6f8bff9ca"
integrity sha512-j8GhLiKmUAh+dsFXlX1aJCbt5KMibuKb+d7j1JaOJG6s2UjX1PQlW+OKB/sD4a/5ZYF4RcmYmLSndOoU3Lt/3g==

"js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0:
version "4.0.0"
Expand Down Expand Up @@ -12750,17 +12755,17 @@ natural-compare@^1.4.0:
resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7"
integrity sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==

next-auth@^4.10.3:
version "4.10.3"
resolved "https://registry.yarnpkg.com/next-auth/-/next-auth-4.10.3.tgz#0a952dd5004fd2ac2ba414c990922cf9b33951a3"
integrity sha512-7zc4aXYc/EEln7Pkcsn21V1IevaTZsMLJwapfbnKA4+JY0+jFzWbt5p/ljugesGIrN4VOZhpZIw50EaFZyghJQ==
next-auth@^4.23.0:
version "4.23.0"
resolved "https://registry.yarnpkg.com/next-auth/-/next-auth-4.23.0.tgz#1aeeb57f4fb2edf8e3ffb660e1016374e11b7237"
integrity sha512-RgukcJkBdvsJwEfA+B80Wcowvtgy6tk8KKWffb7CMCdzcLO4fCCA6aB6sp/DZ2I0ISvWGnbVcO5KXmlan71igw==
dependencies:
"@babel/runtime" "^7.16.3"
"@panva/hkdf" "^1.0.1"
cookie "^0.4.1"
jose "^4.3.7"
"@babel/runtime" "^7.20.13"
"@panva/hkdf" "^1.0.2"
cookie "^0.5.0"
jose "^4.11.4"
oauth "^0.9.15"
openid-client "^5.1.0"
openid-client "^5.4.0"
preact "^10.6.3"
preact-render-to-string "^5.1.19"
uuid "^8.3.2"
Expand Down Expand Up @@ -12985,7 +12990,7 @@ object-assign@^4, object-assign@^4.1.0, object-assign@^4.1.1:
resolved "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz"
integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=

object-hash@^2.0.1:
object-hash@^2.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/object-hash/-/object-hash-2.2.0.tgz#5ad518581eefc443bd763472b8ff2e9c2c0d54a5"
integrity sha512-gScRMn0bS5fH+IuwyIFgnh9zBdo4DV+6GhygmWM9HyNJSgS0hScp1f5vjtm7oIIOiT9trXrShAkLFSc2IqKNgw==
Expand Down Expand Up @@ -13102,10 +13107,10 @@ octal@^1.0.0:
resolved "https://registry.npmjs.org/octal/-/octal-1.0.0.tgz"
integrity sha1-Y+cWKmjvvrniE1iNWOmJ0eXEUws=

oidc-token-hash@^5.0.1:
version "5.0.1"
resolved "https://registry.yarnpkg.com/oidc-token-hash/-/oidc-token-hash-5.0.1.tgz#ae6beec3ec20f0fd885e5400d175191d6e2f10c6"
integrity sha512-EvoOtz6FIEBzE+9q253HsLCVRiK/0doEJ2HCvvqMQb3dHZrP3WlJKYtJ55CRTw4jmYomzH4wkPuCj/I3ZvpKxQ==
oidc-token-hash@^5.0.3:
version "5.0.3"
resolved "https://registry.yarnpkg.com/oidc-token-hash/-/oidc-token-hash-5.0.3.tgz#9a229f0a1ce9d4fc89bcaee5478c97a889e7b7b6"
integrity sha512-IF4PcGgzAr6XXSff26Sk/+P4KZFJVuHAJZj3wgO3vX2bMdNVp/QXTP3P7CEm9V1IdG8lDLY3HhiqpsE/nOwpPw==

once@^1.3.0, once@^1.3.1, once@^1.4.0:
version "1.4.0"
Expand Down Expand Up @@ -13133,15 +13138,15 @@ opener@^1.5.2:
resolved "https://registry.npmjs.org/opener/-/opener-1.5.2.tgz"
integrity sha512-ur5UIdyw5Y7yEj9wLzhqXiy6GZ3Mwx0yGI+5sMn2r0N0v3cKJvUmFH5yPP+WXh9e0xfyzyJX95D8l088DNFj7A==

openid-client@^5.1.0:
version "5.1.9"
resolved "https://registry.yarnpkg.com/openid-client/-/openid-client-5.1.9.tgz#6887e75ad3fa8d0c78d0ed693a5ea107d39b54de"
integrity sha512-o/11Xos2fRPpK1zQrPfSIhIusFrAkqGSPwkD0UlUB+CCuRzd7zrrBJwIjgnVv3VUSif9ZGXh2d3GSJNH2Koh5g==
openid-client@^5.4.0:
version "5.4.3"
resolved "https://registry.yarnpkg.com/openid-client/-/openid-client-5.4.3.tgz#c75d2f6d07a25d383a72c8ff34605a36b7e2cd73"
integrity sha512-sVQOvjsT/sbSfYsQI/9liWQGVZH/Pp3rrtlGEwgk/bbHfrUDZ24DN57lAagIwFtuEu+FM9Ev7r85s8S/yPjimQ==
dependencies:
jose "^4.1.4"
jose "^4.14.4"
lru-cache "^6.0.0"
object-hash "^2.0.1"
oidc-token-hash "^5.0.1"
object-hash "^2.2.0"
oidc-token-hash "^5.0.3"

optimism@^0.16.0:
version "0.16.1"
Expand Down Expand Up @@ -14481,6 +14486,11 @@ regenerator-runtime@^0.13.4:
resolved "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.7.tgz"
integrity sha512-a54FxoJDIr27pgf7IgeQGxmqUNYrcV338lf/6gH456HZ/PhX+5BcwHXG9ajESmwe6WRO0tAzRUrRmNONWgkrew==

regenerator-runtime@^0.14.0:
version "0.14.0"
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.14.0.tgz#5e19d68eb12d486f797e15a3c6a918f7cec5eb45"
integrity sha512-srw17NI0TUWHuGa5CFGGmhfNIeja30WMBfbslPNhf6JrqQlLN5gcrvig1oqPxiVaXb0oW0XRKtH6Nngs5lKCIA==

regexp.prototype.flags@^1.4.3:
version "1.5.0"
resolved "https://registry.yarnpkg.com/regexp.prototype.flags/-/regexp.prototype.flags-1.5.0.tgz#fe7ce25e7e4cca8db37b6634c8a2c7009199b9cb"
Expand Down

0 comments on commit b76e07f

Please sign in to comment.