Skip to content
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
55 changes: 15 additions & 40 deletions dev/src/app/(app)/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,51 +4,26 @@ const Page = () => {
return (
<article className={["container"].filter(Boolean).join(" ")}>
<h1>
Payload 3.0 <span className="rainbow">BETA</span>!
<span className="rainbow">Payload Oauth2 Plugin</span>
</h1>
<p>
This BETA is rapidly evolving, you can report any bugs against{" "}
<a
href="https://github.com/payloadcms/payload-3.0-demo/issues"
target="_blank"
>
the repo
</a>{" "}
or in the{" "}
<a
href="https://discord.com/channels/967097582721572934/1215659716538273832"
target="_blank"
>
dedicated channel in Discord
</a>
.
</p>

<p>Features</p>
<ul>
<li>✅ Compatible with Payload v3</li>
<li>🔐 Configures OAuth2 with any providers</li>
<li>✨ Zero dependencies</li>
<li>⚙ Highly customizable</li>
</ul>
<p>
<strong>
Payload is running at <Link href="/admin">/admin</Link>
You can check some <Link href="/admin">SSO examples here</Link>. Make
sure to configure the OAuth2 plugin environment variables.
</strong>
</p>

<p>
<Link href="/my-route" target="_blank">
/my-route
</Link>{" "}
contains an example of a custom route running the Local API.
</p>

<p>You can use the Local API in your server components like this:</p>
<pre>
<code>
{`import { getPayload } from 'payload'
import configPromise from "@payload-config";
const payload = await getPayload({ config: configPromise })

const data = await payload.find({
collection: 'posts',
})`}
</code>
</pre>
<small>
<a href="https://github.com/payloadcms/payload" target="_blank">
https://github.com/payloadcms/payload
</a>{" "}
</small>
</article>
);
};
Expand Down
103 changes: 71 additions & 32 deletions dev/src/payload-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,21 +63,23 @@ export type SupportedTimezones =

export interface Config {
auth: {
'local-users': LocalUserAuthOperations;
users: UserAuthOperations;
'local-users': LocalUserAuthOperations;
};
blocks: {};
collections: {
'local-users': LocalUser;
users: User;
'local-users': LocalUser;
'payload-kv': PayloadKv;
'payload-locked-documents': PayloadLockedDocument;
'payload-preferences': PayloadPreference;
'payload-migrations': PayloadMigration;
};
collectionsJoins: {};
collectionsSelect: {
'local-users': LocalUsersSelect<false> | LocalUsersSelect<true>;
users: UsersSelect<false> | UsersSelect<true>;
'local-users': LocalUsersSelect<false> | LocalUsersSelect<true>;
'payload-kv': PayloadKvSelect<false> | PayloadKvSelect<true>;
'payload-locked-documents': PayloadLockedDocumentsSelect<false> | PayloadLockedDocumentsSelect<true>;
'payload-preferences': PayloadPreferencesSelect<false> | PayloadPreferencesSelect<true>;
'payload-migrations': PayloadMigrationsSelect<false> | PayloadMigrationsSelect<true>;
Expand All @@ -89,18 +91,18 @@ export interface Config {
globalsSelect: {};
locale: null;
user:
| (LocalUser & {
collection: 'local-users';
})
| (User & {
collection: 'users';
})
| (LocalUser & {
collection: 'local-users';
});
jobs: {
tasks: unknown;
workflows: unknown;
};
}
export interface LocalUserAuthOperations {
export interface UserAuthOperations {
forgotPassword: {
email: string;
password: string;
Expand All @@ -118,7 +120,7 @@ export interface LocalUserAuthOperations {
password: string;
};
}
export interface UserAuthOperations {
export interface LocalUserAuthOperations {
forgotPassword: {
email: string;
password: string;
Expand All @@ -136,6 +138,16 @@ export interface UserAuthOperations {
password: string;
};
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "users".
*/
export interface User {
id: number;
email: string;
updatedAt: string;
createdAt: string;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "local-users".
Expand All @@ -151,18 +163,31 @@ export interface LocalUser {
hash?: string | null;
loginAttempts?: number | null;
lockUntil?: string | null;
sessions?:
| {
id: string;
createdAt?: string | null;
expiresAt: string;
}[]
| null;
password?: string | null;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "users".
* via the `definition` "payload-kv".
*/
export interface User {
export interface PayloadKv {
id: number;
email: string;
sub?: string | null;
updatedAt: string;
createdAt: string;
key: string;
data:
| {
[k: string]: unknown;
}
| unknown[]
| string
| number
| boolean
| null;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
Expand All @@ -171,23 +196,23 @@ export interface User {
export interface PayloadLockedDocument {
id: number;
document?:
| ({
relationTo: 'local-users';
value: number | LocalUser;
} | null)
| ({
relationTo: 'users';
value: number | User;
} | null)
| ({
relationTo: 'local-users';
value: number | LocalUser;
} | null);
globalSlug?: string | null;
user:
| {
relationTo: 'local-users';
value: number | LocalUser;
}
| {
relationTo: 'users';
value: number | User;
}
| {
relationTo: 'local-users';
value: number | LocalUser;
};
updatedAt: string;
createdAt: string;
Expand All @@ -199,13 +224,13 @@ export interface PayloadLockedDocument {
export interface PayloadPreference {
id: number;
user:
| {
relationTo: 'local-users';
value: number | LocalUser;
}
| {
relationTo: 'users';
value: number | User;
}
| {
relationTo: 'local-users';
value: number | LocalUser;
};
key?: string | null;
value?:
Expand All @@ -231,6 +256,15 @@ 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;
updatedAt?: T;
createdAt?: T;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "local-users_select".
Expand All @@ -245,16 +279,21 @@ export interface LocalUsersSelect<T extends boolean = true> {
hash?: T;
loginAttempts?: T;
lockUntil?: T;
sessions?:
| T
| {
id?: T;
createdAt?: T;
expiresAt?: T;
};
}
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "users_select".
* via the `definition` "payload-kv_select".
*/
export interface UsersSelect<T extends boolean = true> {
email?: T;
sub?: T;
updatedAt?: T;
createdAt?: T;
export interface PayloadKvSelect<T extends boolean = true> {
key?: T;
data?: T;
}
/**
* This interface was referenced by `Config`'s JSON-Schema
Expand Down
Loading