@delmaredigital/payload-better-auth 0.6.10 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15,6 +15,10 @@ export { twoFactorClient } from 'better-auth/client/plugins';
15
15
  * Default plugins included with Payload Better Auth (core only).
16
16
  * Add optional plugins (passkeyClient, apiKeyClient) from their own packages.
17
17
  *
18
+ * Typed as `BetterAuthClientPlugin[]` so consumers' `.d.ts` files don't need
19
+ * to name Better Auth's zod-backed inferred plugin types (not portable across
20
+ * installs).
21
+ *
18
22
  * @example
19
23
  * ```typescript
20
24
  * import { createAuthClient, payloadAuthPlugins } from '@delmaredigital/payload-better-auth/client'
@@ -115,39 +115,70 @@ export type PasskeyFields = {
115
115
  aaguid?: string;
116
116
  };
117
117
  export type Passkey = PasskeyFields;
118
- export type OauthApplicationFields = {
119
- name?: string;
120
- icon?: string;
121
- metadata?: string;
122
- clientId?: string;
118
+ export type OauthClientFields = {
119
+ clientId: string;
123
120
  clientSecret?: string;
124
- redirectUrls?: string;
125
- type?: string;
126
121
  disabled?: boolean;
122
+ skipConsent?: boolean;
123
+ enableEndSession?: boolean;
124
+ subjectType?: string;
125
+ scopes?: string[];
127
126
  userId?: string;
128
127
  createdAt?: Date;
129
128
  updatedAt?: Date;
129
+ name?: string;
130
+ uri?: string;
131
+ icon?: string;
132
+ contacts?: string[];
133
+ tos?: string;
134
+ policy?: string;
135
+ softwareId?: string;
136
+ softwareVersion?: string;
137
+ softwareStatement?: string;
138
+ redirectUris: string[];
139
+ postLogoutRedirectUris?: string[];
140
+ tokenEndpointAuthMethod?: string;
141
+ grantTypes?: string[];
142
+ responseTypes?: string[];
143
+ public?: boolean;
144
+ type?: string;
145
+ requirePKCE?: boolean;
146
+ referenceId?: string;
147
+ metadata?: unknown;
148
+ };
149
+ export type OauthClient = OauthClientFields;
150
+ export type OauthRefreshTokenFields = {
151
+ token: string;
152
+ clientId: string;
153
+ sessionId?: string;
154
+ userId: string;
155
+ referenceId?: string;
156
+ expiresAt?: Date;
157
+ createdAt?: Date;
158
+ revoked?: Date;
159
+ authTime?: Date;
160
+ scopes: string[];
130
161
  };
131
- export type OauthApplication = OauthApplicationFields;
162
+ export type OauthRefreshToken = OauthRefreshTokenFields;
132
163
  export type OauthAccessTokenFields = {
133
- accessToken?: string;
134
- refreshToken?: string;
135
- accessTokenExpiresAt?: Date;
136
- refreshTokenExpiresAt?: Date;
137
- clientId?: string;
164
+ token?: string;
165
+ clientId: string;
166
+ sessionId?: string;
138
167
  userId?: string;
139
- scopes?: string;
168
+ referenceId?: string;
169
+ refreshId?: string;
170
+ expiresAt?: Date;
140
171
  createdAt?: Date;
141
- updatedAt?: Date;
172
+ scopes: string[];
142
173
  };
143
174
  export type OauthAccessToken = OauthAccessTokenFields;
144
175
  export type OauthConsentFields = {
145
- clientId?: string;
176
+ clientId: string;
146
177
  userId?: string;
147
- scopes?: string;
178
+ referenceId?: string;
179
+ scopes: string[];
148
180
  createdAt?: Date;
149
181
  updatedAt?: Date;
150
- consentGiven?: boolean;
151
182
  };
152
183
  export type OauthConsent = OauthConsentFields;
153
184
  export type OrganizationFields = {
@@ -200,12 +231,13 @@ export type TwoFactorFields = {
200
231
  secret: string;
201
232
  backupCodes: string;
202
233
  userId: string;
234
+ verified?: boolean;
203
235
  };
204
236
  export type TwoFactor = TwoFactorFields;
205
237
  /**
206
238
  * Union of all supported plugin identifiers.
207
239
  */
208
- export type PluginId = "username" | "admin" | "api-key" | "passkey" | "bearer" | "email-otp" | "magic-link" | "phone-number" | "one-tap" | "anonymous" | "multi-session" | "one-time-token" | "oidc-provider" | "generic-oauth" | "open-api" | "organization" | "jwt" | "two-factor";
240
+ export type PluginId = "username" | "admin" | "api-key" | "passkey" | "bearer" | "email-otp" | "magic-link" | "phone-number" | "one-tap" | "anonymous" | "multi-session" | "one-time-token" | "oauth-provider" | "generic-oauth" | "open-api" | "organization" | "jwt" | "two-factor";
209
241
  /**
210
242
  * Complete schema mapping of all models to their types.
211
243
  */
@@ -216,7 +248,8 @@ export type BetterAuthFullSchema = {
216
248
  "verification": Verification;
217
249
  "apikey": Apikey;
218
250
  "passkey": Passkey;
219
- "oauthApplication": OauthApplication;
251
+ "oauthClient": OauthClient;
252
+ "oauthRefreshToken": OauthRefreshToken;
220
253
  "oauthAccessToken": OauthAccessToken;
221
254
  "oauthConsent": OauthConsent;
222
255
  "organization": Organization;
@@ -6,9 +6,10 @@
6
6
  *
7
7
  * Run with: pnpm generate:types
8
8
  */ import { apiKey } from '@better-auth/api-key';
9
+ import { oauthProvider } from '@better-auth/oauth-provider';
9
10
  import { passkey } from '@better-auth/passkey';
10
11
  import { getSchema } from 'better-auth/db';
11
- import { admin, anonymous, bearer, emailOTP, genericOAuth, jwt, magicLink, multiSession, oidcProvider, oneTap, oneTimeToken, openAPI, organization, phoneNumber, twoFactor, username } from 'better-auth/plugins';
12
+ import { admin, anonymous, bearer, emailOTP, genericOAuth, jwt, magicLink, multiSession, oneTap, oneTimeToken, openAPI, organization, phoneNumber, twoFactor, username } from 'better-auth/plugins';
12
13
  import fs from 'node:fs/promises';
13
14
  import path from 'node:path';
14
15
  import { fileURLToPath } from 'node:url';
@@ -33,8 +34,9 @@ const plugins = [
33
34
  anonymous(),
34
35
  multiSession(),
35
36
  oneTimeToken(),
36
- oidcProvider({
37
- loginPage: ''
37
+ oauthProvider({
38
+ loginPage: '',
39
+ consentPage: ''
38
40
  }),
39
41
  genericOAuth({
40
42
  config: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@delmaredigital/payload-better-auth",
3
- "version": "0.6.10",
3
+ "version": "0.7.0",
4
4
  "description": "Better Auth adapter and plugins for Payload CMS",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -95,11 +95,11 @@
95
95
  "prepublishOnly": "pnpm build"
96
96
  },
97
97
  "peerDependencies": {
98
- "@better-auth/api-key": ">=1.5.0",
99
- "@better-auth/passkey": ">=1.5.0",
98
+ "@better-auth/api-key": ">=1.6.0",
99
+ "@better-auth/passkey": ">=1.6.0",
100
100
  "@payloadcms/next": ">=3.69.0",
101
101
  "@payloadcms/ui": ">=3.69.0",
102
- "better-auth": ">=1.5.0",
102
+ "better-auth": ">=1.6.0",
103
103
  "next": ">=15.4.8",
104
104
  "payload": ">=3.69.0",
105
105
  "react": ">=19.2.1"
@@ -113,19 +113,20 @@
113
113
  }
114
114
  },
115
115
  "devDependencies": {
116
- "@better-auth/api-key": "^1.5.1",
117
- "@better-auth/passkey": "^1.5.1",
118
- "@payloadcms/next": "^3.78.0",
119
- "@payloadcms/ui": "^3.78.0",
116
+ "@better-auth/api-key": "^1.6.6",
117
+ "@better-auth/oauth-provider": "^1.6.6",
118
+ "@better-auth/passkey": "^1.6.6",
119
+ "@payloadcms/next": "^3.83.0",
120
+ "@payloadcms/ui": "^3.83.0",
120
121
  "@swc/cli": "^0.6.0",
121
- "@swc/core": "^1.15.18",
122
- "@types/node": "^24.11.0",
122
+ "@swc/core": "^1.15.30",
123
+ "@types/node": "^24.12.2",
123
124
  "@types/react": "^19.2.14",
124
125
  "@vitest/coverage-v8": "^2.1.9",
125
- "better-auth": "^1.5.1",
126
- "next": "^16.1.6",
127
- "payload": "^3.78.0",
128
- "react": "^19.2.4",
126
+ "better-auth": "^1.6.6",
127
+ "next": "^16.2.4",
128
+ "payload": "^3.83.0",
129
+ "react": "^19.2.5",
129
130
  "tsx": "^4.21.0",
130
131
  "typescript": "^5.9.3",
131
132
  "vitest": "^2.1.9"