Skip to content

Commit f76341f

Browse files
AdamWAdamWozniewski
authored andcommitted
Update repos for async-auth
update package.json for ver5
1 parent fed27e6 commit f76341f

File tree

26 files changed

+1132
-1760
lines changed

26 files changed

+1132
-1760
lines changed

asynchronous-authorization/langchain-next-js/bun.lock

Lines changed: 357 additions & 279 deletions
Large diffs are not rendered by default.

asynchronous-authorization/langchain-next-js/package.json

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -22,68 +22,68 @@
2222
"fga:init": "tsx src/lib/fga/fga-init.ts"
2323
},
2424
"engines": {
25-
"node": ">=18"
25+
"node": ">=20 <23"
2626
},
2727
"dependencies": {
28-
"@auth0/ai-langchain": "3",
29-
"@auth0/nextjs-auth0": "4.4.2",
30-
"@langchain/community": "0.3.42",
31-
"@langchain/core": "0.3",
32-
"@langchain/langgraph": "0.3",
33-
"@langchain/openai": "0.6",
34-
"@radix-ui/react-avatar": "^1.1.7",
35-
"@radix-ui/react-checkbox": "^1.2.3",
36-
"@radix-ui/react-dialog": "^1.1.11",
37-
"@radix-ui/react-dropdown-menu": "^2.1.12",
38-
"@radix-ui/react-popover": "^1.1.11",
39-
"@radix-ui/react-slot": "^1.2.0",
40-
"@types/pg": "^8.15.4",
28+
"@auth0/ai-langchain": "^3.5.0",
29+
"@auth0/nextjs-auth0": "^4.10.0",
30+
"@langchain/community": "^0.3.55",
31+
"@langchain/core": "^0.3.75",
32+
"@langchain/langgraph": "^0.4.9",
33+
"@langchain/openai": "^0.6.11",
34+
"@radix-ui/react-avatar": "^1.1.10",
35+
"@radix-ui/react-checkbox": "^1.3.3",
36+
"@radix-ui/react-dialog": "^1.1.15",
37+
"@radix-ui/react-dropdown-menu": "^2.1.16",
38+
"@radix-ui/react-popover": "^1.1.15",
39+
"@radix-ui/react-slot": "^1.2.3",
40+
"@types/pg": "^8.15.5",
4141
"class-variance-authority": "^0.7.1",
4242
"clsx": "^2.1.1",
4343
"date-fns": "^4.1.0",
44-
"dotenv": "^17.0.1",
45-
"drizzle-orm": "^0.43.1",
46-
"drizzle-zod": "^0.7.1",
47-
"googleapis": "^148.0.0",
48-
"langchain": "0.3",
49-
"langgraph-nextjs-api-passthrough": "0.1",
50-
"lucide-react": "^0.475.0",
51-
"marked": "^15.0.7",
44+
"drizzle-orm": "^0.44.5",
45+
"drizzle-zod": "0.7.1",
46+
"googleapis": "^159.0.0",
47+
"langchain": "^0.3.33",
48+
"langgraph-nextjs-api-passthrough": "^0.1.4",
49+
"lucide-react": "^0.543.0",
50+
"marked": "^16.2.1",
5251
"nanoid": "^5.1.5",
53-
"next": "15.2.4",
54-
"next-themes": "^0.4.4",
55-
"nuqs": "^2.4.3",
52+
"next": "^15.5.2",
53+
"next-themes": "^0.4.6",
54+
"nuqs": "^2.6.0",
5655
"pdf-parse": "^1.1.1",
5756
"pg": "^8.16.3",
58-
"postgres": "^3.4.5",
59-
"react": "19.0.0",
57+
"postgres": "^3.4.7",
58+
"react": "^19.1.1",
6059
"react-device-detect": "^2.2.3",
61-
"react-dom": "19.0.0",
62-
"react-markdown": "^10.0.0",
63-
"react-toastify": "11.0.3",
64-
"sonner": "^1.7.2",
65-
"tailwind-merge": "^2.6.0",
60+
"react-dom": "^19.1.1",
61+
"react-markdown": "^10.1.0",
62+
"react-toastify": "^11.0.5",
63+
"sonner": "^2.0.7",
64+
"tailwind-merge": "^3.3.1",
6665
"tailwindcss-animate": "^1.0.7",
67-
"use-stick-to-bottom": "^1.0.44",
66+
"use-stick-to-bottom": "^1.1.1",
6867
"vaul": "^1.1.2",
69-
"zod": "^3.24.2",
68+
"zod": "3.25.76 || ^4",
7069
"zod-to-json-schema": "^3.23.2"
7170
},
7271
"devDependencies": {
73-
"@next/bundle-analyzer": "^15.1.7",
74-
"@types/node": "^22.13.4",
72+
"@next/bundle-analyzer": "^15.5.2",
73+
"@types/node": "^24.3.1",
7574
"@types/pdf-parse": "^1.1.5",
76-
"@types/react": "19.0.9",
77-
"@types/react-dom": "19.0.3",
78-
"autoprefixer": "^10.4.20",
79-
"drizzle-kit": "^0.31.1",
80-
"eslint": "^9.20.1",
81-
"eslint-config-next": "^15.1.7",
75+
"@types/react": "^19.1.12",
76+
"@types/react-dom": "^19.1.9",
77+
"autoprefixer": "^10.4.21",
78+
"dotenv": "^16.4.5",
79+
"drizzle-kit": "^0.31.4",
80+
"eslint": "^9.35.0",
81+
"eslint-config-next": "^15.5.2",
8282
"npm-run-all": "^4.1.5",
83-
"postcss": "8.5.2",
84-
"prettier": "^3.4.2",
85-
"tailwindcss": "3.4.17",
86-
"tsx": "^4.19.4",
87-
"typescript": "5.7.3"
83+
"postcss": "^8.5.6",
84+
"prettier": "^3.6.2",
85+
"@tailwindcss/postcss": "^4.1.13",
86+
"tsx": "^4.20.5",
87+
"typescript": "^5.9.2"
8888
}
8989
}

asynchronous-authorization/langchain-next-js/postcss.config.js

Lines changed: 0 additions & 6 deletions
This file was deleted.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
const config = {
2+
plugins: {
3+
"@tailwindcss/postcss": {},
4+
},
5+
};
6+
export default config;

asynchronous-authorization/langchain-next-js/src/app/globals.css

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
@tailwind base;
2-
@tailwind components;
3-
@tailwind utilities;
1+
@import "tailwindcss";
42

53
@layer base {
64
:root {

asynchronous-authorization/langchain-next-js/src/lib/db/schema/documents.ts

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { sql } from 'drizzle-orm';
2-
import { text, varchar, timestamp, pgTable, customType } from 'drizzle-orm/pg-core';
2+
import { varchar, timestamp, pgTable, customType } from 'drizzle-orm/pg-core';
33
import { createSelectSchema } from 'drizzle-zod';
44
import { z } from 'zod';
55

@@ -18,20 +18,17 @@ export const documents = pgTable('documents', {
1818
content: bytea('content').notNull(),
1919
fileName: varchar('file_name', { length: 300 }).notNull(),
2020
fileType: varchar('file_type', { length: 100 }).notNull(),
21-
createdAt: timestamp('created_at')
22-
.notNull()
23-
.default(sql`now()`),
24-
updatedAt: timestamp('updated_at')
25-
.notNull()
26-
.default(sql`now()`),
21+
createdAt: timestamp('created_at').notNull().default(sql`now()`),
22+
updatedAt: timestamp('updated_at').notNull().default(sql`now()`),
2723
userId: varchar('user_id', { length: 191 }).notNull(),
2824
userEmail: varchar('user_email', { length: 191 }).notNull(),
2925
sharedWith: varchar('shared_with', { length: 300 }).array(),
3026
});
3127

32-
export const documentSchema = createSelectSchema(documents).extend({});
28+
export const documentSchema = createSelectSchema(documents, {
29+
content: z.instanceof(Buffer),
30+
}).extend({});
3331

34-
// Schema for documents - used to validate API requests
3532
export const insertDocumentSchema = documentSchema.omit({
3633
id: true,
3734
createdAt: true,
@@ -40,6 +37,5 @@ export const insertDocumentSchema = documentSchema.omit({
4037
userEmail: true,
4138
});
4239

43-
// Type for documents - used to type API request params and within Components
4440
export type DocumentParams = z.infer<typeof documentSchema>;
4541
export type NewDocumentParams = z.infer<typeof insertDocumentSchema>;
Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,34 @@
1-
import { NextResponse, type NextRequest } from 'next/server';
1+
import { NextRequest, NextResponse } from "next/server";
2+
import { auth0 } from "./lib/auth0";
23

3-
import { auth0 } from '@/lib/auth0';
4+
const APP_SESSION_COOKIE = "appSession";
45

5-
/**
6-
* Middleware to handle authentication using Auth0
7-
*/
86
export async function middleware(request: NextRequest) {
9-
const authRes = await auth0.middleware(request);
7+
const { pathname } = request.nextUrl;
108

11-
// authentication routes — let the middleware handle it
12-
if (request.nextUrl.pathname.startsWith('/auth')) {
13-
return authRes;
9+
if (pathname.startsWith("/auth")) {
10+
return auth0.middleware(request);
1411
}
1512

16-
const { origin } = new URL(request.url);
17-
const session = await auth0.getSession(request);
18-
19-
// user does not have a session — redirect to login
20-
if (!session) {
21-
return NextResponse.redirect(`${origin}/auth/login`);
13+
try {
14+
const session = await auth0.getSession(request);
15+
if (!session) {
16+
return NextResponse.redirect(new URL("/auth/login", request.url));
17+
}
18+
return NextResponse.next();
19+
} catch {
20+
const redirect = NextResponse.redirect(new URL("/auth/login", request.url));
21+
redirect.cookies.set(APP_SESSION_COOKIE, "", {
22+
path: "/",
23+
httpOnly: true,
24+
maxAge: 0,
25+
});
26+
return redirect;
2227
}
23-
24-
return authRes;
2528
}
2629

2730
export const config = {
2831
matcher: [
29-
/*
30-
* Match all request paths except for the ones starting with:
31-
* - _next/static (static files)
32-
* - _next/image (image optimization files)
33-
* - favicon.ico, sitemap.xml, robots.txt (metadata files)
34-
*/
35-
'/((?!_next/static|_next/image|images|favicon.[ico|png]|sitemap.xml|robots.txt|$).*)',
32+
"/((?!_next/static|_next/image|images|favicon\\.(?:ico|png)|sitemap\\.xml|robots\\.txt|$).*)",
3633
],
3734
};
File renamed without changes.

asynchronous-authorization/vercel-ai-next-js/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
22

33
# dependencies
4+
./package-lock.json
45
/node_modules
56
/.pnp
67
.pnp.js

0 commit comments

Comments
 (0)