Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stable payload 3 #23

Merged
merged 1 commit into from
Dec 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
{
"configurations": [
{
"name": "Payload OAuth 2",
"name": "Payload OAuth 2 Dev",
"type": "node",
"request": "launch",
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/next",
"cwd": "${workspaceFolder}/dev",
"console": "integratedTerminal"
},
{
"name": "Payload OAuth 2 Test",
"type": "node-terminal",
"request": "launch",
"command": "pnpm dev"
"command": "pnpm test"
}
]
}
2 changes: 1 addition & 1 deletion dev/next-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
6 changes: 3 additions & 3 deletions dev/src/app/(payload)/admin/importMap.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { OAuthLoginButton as OAuthLoginButton_0 } from "../../../components/OAuthLoginButton";
import { OAuthLoginButton as OAuthLoginButton_cd47d145aed4cb23589a094917bd46e9 } from 'src/components/OAuthLoginButton'

export const importMap = {
"app/components/OAuthLoginButton#OAuthLoginButton": OAuthLoginButton_0,
};
"src/components/OAuthLoginButton#OAuthLoginButton": OAuthLoginButton_cd47d145aed4cb23589a094917bd46e9
}
25 changes: 18 additions & 7 deletions dev/src/app/(payload)/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,30 @@
/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */
/* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */
import configPromise from "@payload-config";
import { RootLayout } from "@payloadcms/next/layouts";
import React from "react";

import "@payloadcms/next/css";
import { handleServerFunctions, RootLayout } from "@payloadcms/next/layouts";
import { ServerFunctionClient } from "payload";
import React from "react";
import config from "../../payload.config";
import { importMap } from "./admin/importMap.js";
import "./custom.scss";

type Args = {
children: React.ReactNode;
};

const serverFunction: ServerFunctionClient = async function (args) {
"use server";
return handleServerFunctions({
...args,
config,
importMap,
});
};

const Layout = ({ children }: Args) => (
<RootLayout config={configPromise} importMap={importMap}>
<RootLayout
config={config}
importMap={importMap}
serverFunction={serverFunction}
>
{children}
</RootLayout>
);
Expand Down
73 changes: 64 additions & 9 deletions dev/src/payload-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,29 @@ export interface Config {
};
collections: {
users: User;
"payload-locked-documents": PayloadLockedDocument;
"payload-preferences": PayloadPreference;
"payload-migrations": PayloadMigration;
'payload-locked-documents': PayloadLockedDocument;
'payload-preferences': PayloadPreference;
'payload-migrations': PayloadMigration;
};
collectionsJoins: {};
collectionsSelect: {
users: UsersSelect<false> | UsersSelect<true>;
'payload-locked-documents': PayloadLockedDocumentsSelect<false> | PayloadLockedDocumentsSelect<true>;
'payload-preferences': PayloadPreferencesSelect<false> | PayloadPreferencesSelect<true>;
'payload-migrations': PayloadMigrationsSelect<false> | PayloadMigrationsSelect<true>;
};
db: {
defaultIDType: number;
};
globals: {};
globalsSelect: {};
locale: null;
user: User & {
collection: "users";
collection: 'users';
};
jobs: {
tasks: unknown;
workflows: unknown;
};
}
export interface UserAuthOperations {
Expand Down Expand Up @@ -61,12 +73,12 @@ export interface User {
export interface PayloadLockedDocument {
id: number;
document?: {
relationTo: "users";
relationTo: 'users';
value: number | User;
} | null;
globalSlug?: string | null;
user: {
relationTo: "users";
relationTo: 'users';
value: number | User;
};
updatedAt: string;
Expand All @@ -79,7 +91,7 @@ export interface PayloadLockedDocument {
export interface PayloadPreference {
id: number;
user: {
relationTo: "users";
relationTo: 'users';
value: number | User;
};
key?: string | null;
Expand All @@ -106,6 +118,48 @@ export interface PayloadMigration {
updatedAt: string;
createdAt: string;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "users_select".
*/
export interface UsersSelect<T extends boolean = true> {
email?: T;
sub?: T;
updatedAt?: T;
createdAt?: T;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "payload-locked-documents_select".
*/
export interface PayloadLockedDocumentsSelect<T extends boolean = true> {
document?: T;
globalSlug?: T;
user?: T;
updatedAt?: T;
createdAt?: T;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "payload-preferences_select".
*/
export interface PayloadPreferencesSelect<T extends boolean = true> {
user?: T;
key?: T;
value?: T;
updatedAt?: T;
createdAt?: T;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "payload-migrations_select".
*/
export interface PayloadMigrationsSelect<T extends boolean = true> {
name?: T;
batch?: T;
updatedAt?: T;
createdAt?: T;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "auth".
Expand All @@ -114,6 +168,7 @@ export interface Auth {
[k: string]: unknown;
}

declare module "payload" {

declare module 'payload' {
export interface GeneratedTypes extends Config {}
}
}
3 changes: 2 additions & 1 deletion dev/src/payload.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default buildConfig({
baseDir: path.resolve(dirname),
},
components: {
afterLogin: ["app/components/OAuthLoginButton#OAuthLoginButton"],
afterLogin: ["src/components/OAuthLoginButton#OAuthLoginButton"],
},
user: Users.slug,
},
Expand Down Expand Up @@ -64,6 +64,7 @@ export default buildConfig({
return "/admin";
},
failureRedirect: (req, err) => {
req.payload.logger.error(err);
return "/admin/login";
},
}),
Expand Down
26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "payload-oauth2",
"version": "1.0.6",
"version": "1.0.7",
"type": "module",
"homepage:": "https://payloadcms.com",
"repository": "https://github.com/WilsonLe/payload-oauth2",
Expand Down Expand Up @@ -38,7 +38,7 @@
"author": "wilsonle2907@gmail.com",
"license": "MIT",
"peerDependencies": {
"payload": "3.0.0-beta.116"
"payload": "^3"
},
"devDependencies": {
"@libsql/darwin-arm64": "0.4.6",
Expand All @@ -47,29 +47,29 @@
"@libsql/linux-arm64-musl": "0.4.6",
"@libsql/linux-x64-gnu": "0.4.6",
"@libsql/linux-x64-musl": "0.4.6",
"@payloadcms/db-sqlite": "3.0.0-beta.116",
"@payloadcms/drizzle": "3.0.0-beta.116",
"@payloadcms/next": "3.0.0-beta.116",
"@payloadcms/richtext-lexical": "3.0.0-beta.116",
"@payloadcms/ui": "3.0.0-beta.116",
"@payloadcms/db-sqlite": "^3",
"@payloadcms/drizzle": "^3",
"@payloadcms/next": "^3",
"@payloadcms/richtext-lexical": "^3",
"@payloadcms/ui": "^3",
"@swc/jest": "0.2.36",
"@types/jest": "29.5.12",
"@types/jsonwebtoken": "9.0.6",
"@types/node": "^22.10.2",
"@types/react": "18.3.3",
"cross-env": "7.0.3",
"dotenv": "16.4.5",
"eslint": "8.56.0",
"eslint-config-next": "14.2.3",
"jest": "29.7.0",
"jsonwebtoken": "9.0.2",
"jose": "5.9.6",
"libsql": "0.4.6",
"next": "15.0.0-canary.160",
"payload": "3.0.0-beta.116",
"next": "^15",
"payload": "^3",
"prettier": "3.3.2",
"prettier-plugin-organize-imports": "3.2.4",
"puppeteer": "^23.6.0",
"react": "19.0.0-rc-e740d4b1-20240919",
"react-dom": "19.0.0-rc-e740d4b1-20240919",
"react": "^19",
"react-dom": "^19",
"rimraf": "5.0.7",
"sharp": "0.33.4",
"tree-kill": "^1.2.2",
Expand Down
Loading
Loading