Skip to content

Commit b2d5c39

Browse files
authored
Merge pull request #23 from WilsonLe/payload-3-stable
stable payload 3
2 parents 93d167a + e5806dc commit b2d5c39

File tree

14 files changed

+2332
-1796
lines changed

14 files changed

+2332
-1796
lines changed

.vscode/launch.json

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
{
22
"configurations": [
33
{
4-
"name": "Payload OAuth 2",
4+
"name": "Payload OAuth 2 Dev",
5+
"type": "node",
6+
"request": "launch",
7+
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/next",
8+
"cwd": "${workspaceFolder}/dev",
9+
"console": "integratedTerminal"
10+
},
11+
{
12+
"name": "Payload OAuth 2 Test",
513
"type": "node-terminal",
614
"request": "launch",
7-
"command": "pnpm dev"
15+
"command": "pnpm test"
816
}
917
]
1018
}

dev/next-env.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
/// <reference types="next/image-types/global" />
33

44
// NOTE: This file should not be edited
5-
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.
5+
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { OAuthLoginButton as OAuthLoginButton_0 } from "../../../components/OAuthLoginButton";
1+
import { OAuthLoginButton as OAuthLoginButton_cd47d145aed4cb23589a094917bd46e9 } from 'src/components/OAuthLoginButton'
22

33
export const importMap = {
4-
"app/components/OAuthLoginButton#OAuthLoginButton": OAuthLoginButton_0,
5-
};
4+
"src/components/OAuthLoginButton#OAuthLoginButton": OAuthLoginButton_cd47d145aed4cb23589a094917bd46e9
5+
}

dev/src/app/(payload)/layout.tsx

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,30 @@
1-
/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */
2-
/* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */
3-
import configPromise from "@payload-config";
4-
import { RootLayout } from "@payloadcms/next/layouts";
5-
import React from "react";
6-
71
import "@payloadcms/next/css";
2+
import { handleServerFunctions, RootLayout } from "@payloadcms/next/layouts";
3+
import { ServerFunctionClient } from "payload";
4+
import React from "react";
5+
import config from "../../payload.config";
86
import { importMap } from "./admin/importMap.js";
97
import "./custom.scss";
108

119
type Args = {
1210
children: React.ReactNode;
1311
};
1412

13+
const serverFunction: ServerFunctionClient = async function (args) {
14+
"use server";
15+
return handleServerFunctions({
16+
...args,
17+
config,
18+
importMap,
19+
});
20+
};
21+
1522
const Layout = ({ children }: Args) => (
16-
<RootLayout config={configPromise} importMap={importMap}>
23+
<RootLayout
24+
config={config}
25+
importMap={importMap}
26+
serverFunction={serverFunction}
27+
>
1728
{children}
1829
</RootLayout>
1930
);

dev/src/payload-types.ts

Lines changed: 64 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,29 @@ export interface Config {
1212
};
1313
collections: {
1414
users: User;
15-
"payload-locked-documents": PayloadLockedDocument;
16-
"payload-preferences": PayloadPreference;
17-
"payload-migrations": PayloadMigration;
15+
'payload-locked-documents': PayloadLockedDocument;
16+
'payload-preferences': PayloadPreference;
17+
'payload-migrations': PayloadMigration;
18+
};
19+
collectionsJoins: {};
20+
collectionsSelect: {
21+
users: UsersSelect<false> | UsersSelect<true>;
22+
'payload-locked-documents': PayloadLockedDocumentsSelect<false> | PayloadLockedDocumentsSelect<true>;
23+
'payload-preferences': PayloadPreferencesSelect<false> | PayloadPreferencesSelect<true>;
24+
'payload-migrations': PayloadMigrationsSelect<false> | PayloadMigrationsSelect<true>;
1825
};
1926
db: {
2027
defaultIDType: number;
2128
};
2229
globals: {};
30+
globalsSelect: {};
2331
locale: null;
2432
user: User & {
25-
collection: "users";
33+
collection: 'users';
34+
};
35+
jobs: {
36+
tasks: unknown;
37+
workflows: unknown;
2638
};
2739
}
2840
export interface UserAuthOperations {
@@ -61,12 +73,12 @@ export interface User {
6173
export interface PayloadLockedDocument {
6274
id: number;
6375
document?: {
64-
relationTo: "users";
76+
relationTo: 'users';
6577
value: number | User;
6678
} | null;
6779
globalSlug?: string | null;
6880
user: {
69-
relationTo: "users";
81+
relationTo: 'users';
7082
value: number | User;
7183
};
7284
updatedAt: string;
@@ -79,7 +91,7 @@ export interface PayloadLockedDocument {
7991
export interface PayloadPreference {
8092
id: number;
8193
user: {
82-
relationTo: "users";
94+
relationTo: 'users';
8395
value: number | User;
8496
};
8597
key?: string | null;
@@ -106,6 +118,48 @@ export interface PayloadMigration {
106118
updatedAt: string;
107119
createdAt: string;
108120
}
121+
/**
122+
* This interface was referenced by `Config`'s JSON-Schema
123+
* via the `definition` "users_select".
124+
*/
125+
export interface UsersSelect<T extends boolean = true> {
126+
email?: T;
127+
sub?: T;
128+
updatedAt?: T;
129+
createdAt?: T;
130+
}
131+
/**
132+
* This interface was referenced by `Config`'s JSON-Schema
133+
* via the `definition` "payload-locked-documents_select".
134+
*/
135+
export interface PayloadLockedDocumentsSelect<T extends boolean = true> {
136+
document?: T;
137+
globalSlug?: T;
138+
user?: T;
139+
updatedAt?: T;
140+
createdAt?: T;
141+
}
142+
/**
143+
* This interface was referenced by `Config`'s JSON-Schema
144+
* via the `definition` "payload-preferences_select".
145+
*/
146+
export interface PayloadPreferencesSelect<T extends boolean = true> {
147+
user?: T;
148+
key?: T;
149+
value?: T;
150+
updatedAt?: T;
151+
createdAt?: T;
152+
}
153+
/**
154+
* This interface was referenced by `Config`'s JSON-Schema
155+
* via the `definition` "payload-migrations_select".
156+
*/
157+
export interface PayloadMigrationsSelect<T extends boolean = true> {
158+
name?: T;
159+
batch?: T;
160+
updatedAt?: T;
161+
createdAt?: T;
162+
}
109163
/**
110164
* This interface was referenced by `Config`'s JSON-Schema
111165
* via the `definition` "auth".
@@ -114,6 +168,7 @@ export interface Auth {
114168
[k: string]: unknown;
115169
}
116170

117-
declare module "payload" {
171+
172+
declare module 'payload' {
118173
export interface GeneratedTypes extends Config {}
119-
}
174+
}

dev/src/payload.config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export default buildConfig({
1818
baseDir: path.resolve(dirname),
1919
},
2020
components: {
21-
afterLogin: ["app/components/OAuthLoginButton#OAuthLoginButton"],
21+
afterLogin: ["src/components/OAuthLoginButton#OAuthLoginButton"],
2222
},
2323
user: Users.slug,
2424
},
@@ -64,6 +64,7 @@ export default buildConfig({
6464
return "/admin";
6565
},
6666
failureRedirect: (req, err) => {
67+
req.payload.logger.error(err);
6768
return "/admin/login";
6869
},
6970
}),

package.json

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "payload-oauth2",
3-
"version": "1.0.6",
3+
"version": "1.0.7",
44
"type": "module",
55
"homepage:": "https://payloadcms.com",
66
"repository": "https://github.com/WilsonLe/payload-oauth2",
@@ -38,7 +38,7 @@
3838
"author": "wilsonle2907@gmail.com",
3939
"license": "MIT",
4040
"peerDependencies": {
41-
"payload": "3.0.0-beta.116"
41+
"payload": "^3"
4242
},
4343
"devDependencies": {
4444
"@libsql/darwin-arm64": "0.4.6",
@@ -47,29 +47,29 @@
4747
"@libsql/linux-arm64-musl": "0.4.6",
4848
"@libsql/linux-x64-gnu": "0.4.6",
4949
"@libsql/linux-x64-musl": "0.4.6",
50-
"@payloadcms/db-sqlite": "3.0.0-beta.116",
51-
"@payloadcms/drizzle": "3.0.0-beta.116",
52-
"@payloadcms/next": "3.0.0-beta.116",
53-
"@payloadcms/richtext-lexical": "3.0.0-beta.116",
54-
"@payloadcms/ui": "3.0.0-beta.116",
50+
"@payloadcms/db-sqlite": "^3",
51+
"@payloadcms/drizzle": "^3",
52+
"@payloadcms/next": "^3",
53+
"@payloadcms/richtext-lexical": "^3",
54+
"@payloadcms/ui": "^3",
5555
"@swc/jest": "0.2.36",
5656
"@types/jest": "29.5.12",
57-
"@types/jsonwebtoken": "9.0.6",
57+
"@types/node": "^22.10.2",
5858
"@types/react": "18.3.3",
5959
"cross-env": "7.0.3",
6060
"dotenv": "16.4.5",
6161
"eslint": "8.56.0",
6262
"eslint-config-next": "14.2.3",
6363
"jest": "29.7.0",
64-
"jsonwebtoken": "9.0.2",
64+
"jose": "5.9.6",
6565
"libsql": "0.4.6",
66-
"next": "15.0.0-canary.160",
67-
"payload": "3.0.0-beta.116",
66+
"next": "^15",
67+
"payload": "^3",
6868
"prettier": "3.3.2",
6969
"prettier-plugin-organize-imports": "3.2.4",
7070
"puppeteer": "^23.6.0",
71-
"react": "19.0.0-rc-e740d4b1-20240919",
72-
"react-dom": "19.0.0-rc-e740d4b1-20240919",
71+
"react": "^19",
72+
"react-dom": "^19",
7373
"rimraf": "5.0.7",
7474
"sharp": "0.33.4",
7575
"tree-kill": "^1.2.2",

0 commit comments

Comments
 (0)