@delmaredigital/payload-better-auth 0.5.4 → 0.5.6
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.
- package/dist/adapter/index.js +5 -5
- package/dist/components/LoginView.js +1 -1
- package/dist/components/PasskeyRegisterButton.js +1 -1
- package/dist/components/PasskeySignInButton.js +1 -1
- package/dist/components/management/ApiKeysManagementClient.js +1 -1
- package/dist/components/management/PasskeysManagementClient.js +1 -1
- package/dist/exports/client.d.ts +32 -4
- package/package.json +9 -9
package/dist/adapter/index.js
CHANGED
|
@@ -147,11 +147,11 @@
|
|
|
147
147
|
const effectiveDbType = adapterConfig.dbType ?? (typeof payloadClient !== 'function' ? detectDbType(payloadClient) : 'postgres');
|
|
148
148
|
const idType = resolveIdType(effectiveDbType, options, adapterConfig.idType);
|
|
149
149
|
const generateId = options.advanced?.database?.generateId;
|
|
150
|
-
// Warn if using number IDs but
|
|
151
|
-
//
|
|
152
|
-
//
|
|
153
|
-
if (idType === 'number' && generateId !==
|
|
154
|
-
console.warn(
|
|
150
|
+
// Warn if using number IDs but generateId is not set to 'serial'.
|
|
151
|
+
// Without this, Better Auth's factory won't coerce relationship field values to numbers,
|
|
152
|
+
// causing Payload ValidationErrors on create/update (e.g. user: '1' instead of user: 1).
|
|
153
|
+
if (idType === 'number' && generateId !== 'serial') {
|
|
154
|
+
console.warn(`[payload-adapter] Warning: Using SERIAL (number) IDs but \`generateId\` is ${generateId === undefined ? 'not set' : `set to "${generateId}"`}. ` + 'You must set `advanced: { database: { generateId: "serial" } }` in your Better Auth config ' + 'so that relationship field values are correctly coerced to numbers. ' + 'Without this, create/update operations will fail with ValidationErrors.');
|
|
155
155
|
}
|
|
156
156
|
// Warn if modelName appears to be already plural (ends with 's')
|
|
157
157
|
// With usePlural: true, providing 'users' would become 'userss'
|
|
@@ -48,7 +48,7 @@ export function LoginView({ authClient: providedClient, logo, title = 'Login', a
|
|
|
48
48
|
const getClient = async ()=>{
|
|
49
49
|
if (providedClient) return providedClient;
|
|
50
50
|
if (clientRef.current) return clientRef.current;
|
|
51
|
-
const { passkeyClient } = await import(
|
|
51
|
+
const { passkeyClient } = await import('@better-auth/passkey/client');
|
|
52
52
|
clientRef.current = createAuthClient({
|
|
53
53
|
plugins: [
|
|
54
54
|
twoFactorClient(),
|
|
@@ -33,7 +33,7 @@ import { twoFactorClient } from 'better-auth/client/plugins';
|
|
|
33
33
|
async function getClient() {
|
|
34
34
|
if (providedClient) return providedClient;
|
|
35
35
|
if (clientRef.current) return clientRef.current;
|
|
36
|
-
const { passkeyClient } = await import(
|
|
36
|
+
const { passkeyClient } = await import('@better-auth/passkey/client');
|
|
37
37
|
clientRef.current = createAuthClient({
|
|
38
38
|
plugins: [
|
|
39
39
|
twoFactorClient(),
|
|
@@ -31,7 +31,7 @@ import { twoFactorClient } from 'better-auth/client/plugins';
|
|
|
31
31
|
async function getClient() {
|
|
32
32
|
if (providedClient) return providedClient;
|
|
33
33
|
if (clientRef.current) return clientRef.current;
|
|
34
|
-
const { passkeyClient } = await import(
|
|
34
|
+
const { passkeyClient } = await import('@better-auth/passkey/client');
|
|
35
35
|
clientRef.current = createAuthClient({
|
|
36
36
|
plugins: [
|
|
37
37
|
twoFactorClient(),
|
|
@@ -94,7 +94,7 @@ import { createAuthClient } from 'better-auth/react';
|
|
|
94
94
|
const getClient = async ()=>{
|
|
95
95
|
if (providedClient) return providedClient;
|
|
96
96
|
if (clientRef.current) return clientRef.current;
|
|
97
|
-
const { apiKeyClient } = await import(
|
|
97
|
+
const { apiKeyClient } = await import('@better-auth/api-key/client');
|
|
98
98
|
clientRef.current = createAuthClient({
|
|
99
99
|
plugins: [
|
|
100
100
|
apiKeyClient()
|
|
@@ -23,7 +23,7 @@ import { twoFactorClient } from 'better-auth/client/plugins';
|
|
|
23
23
|
const getClient = async ()=>{
|
|
24
24
|
if (providedClient) return providedClient;
|
|
25
25
|
if (clientRef.current) return clientRef.current;
|
|
26
|
-
const { passkeyClient } = await import(
|
|
26
|
+
const { passkeyClient } = await import('@better-auth/passkey/client');
|
|
27
27
|
clientRef.current = createAuthClient({
|
|
28
28
|
plugins: [
|
|
29
29
|
twoFactorClient(),
|
package/dist/exports/client.d.ts
CHANGED
|
@@ -703,10 +703,6 @@ export interface PayloadAuthClientOptions {
|
|
|
703
703
|
* ```
|
|
704
704
|
*/
|
|
705
705
|
export declare function createPayloadAuthClient(options?: PayloadAuthClientOptions): {
|
|
706
|
-
updateSession: any;
|
|
707
|
-
} & {
|
|
708
|
-
updateUser: any;
|
|
709
|
-
} & {
|
|
710
706
|
signOut: <FetchOptions extends import("better-auth").ClientFetchOption<never, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth").Prettify<{
|
|
711
707
|
query?: Record<string, any> | undefined;
|
|
712
708
|
fetchOptions?: FetchOptions | undefined;
|
|
@@ -1239,6 +1235,38 @@ export declare function createPayloadAuthClient(options?: PayloadAuthClientOptio
|
|
|
1239
1235
|
message?: string | undefined;
|
|
1240
1236
|
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
1241
1237
|
};
|
|
1238
|
+
} & {
|
|
1239
|
+
updateSession: <FetchOptions extends import("better-auth").ClientFetchOption<Partial<Partial<{}>> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth").Prettify<Partial<{}> & {
|
|
1240
|
+
fetchOptions?: FetchOptions | undefined;
|
|
1241
|
+
}> | undefined, data_1?: FetchOptions | undefined) => Promise<import("better-auth/react").BetterFetchResponse<{
|
|
1242
|
+
session: {
|
|
1243
|
+
id: string;
|
|
1244
|
+
createdAt: Date;
|
|
1245
|
+
updatedAt: Date;
|
|
1246
|
+
userId: string;
|
|
1247
|
+
expiresAt: Date;
|
|
1248
|
+
token: string;
|
|
1249
|
+
ipAddress?: string | null | undefined;
|
|
1250
|
+
userAgent?: string | null | undefined;
|
|
1251
|
+
};
|
|
1252
|
+
}, {
|
|
1253
|
+
code?: string | undefined;
|
|
1254
|
+
message?: string | undefined;
|
|
1255
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
1256
|
+
} & {
|
|
1257
|
+
updateUser: <FetchOptions extends import("better-auth").ClientFetchOption<Partial<Partial<{}> & {
|
|
1258
|
+
name?: string | undefined;
|
|
1259
|
+
image?: string | undefined | null;
|
|
1260
|
+
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth").Prettify<{
|
|
1261
|
+
image?: (string | null) | undefined;
|
|
1262
|
+
name?: string | undefined;
|
|
1263
|
+
fetchOptions?: FetchOptions | undefined;
|
|
1264
|
+
} & Partial<{} & {}>> | undefined, data_1?: FetchOptions | undefined) => Promise<import("better-auth/react").BetterFetchResponse<{
|
|
1265
|
+
status: boolean;
|
|
1266
|
+
}, {
|
|
1267
|
+
code?: string | undefined;
|
|
1268
|
+
message?: string | undefined;
|
|
1269
|
+
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
1242
1270
|
} & {
|
|
1243
1271
|
listSessions: <FetchOptions extends import("better-auth").ClientFetchOption<never, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth").Prettify<{
|
|
1244
1272
|
query?: Record<string, any> | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@delmaredigital/payload-better-auth",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.6",
|
|
4
4
|
"description": "Better Auth adapter and plugins for Payload CMS",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -113,18 +113,18 @@
|
|
|
113
113
|
}
|
|
114
114
|
},
|
|
115
115
|
"devDependencies": {
|
|
116
|
-
"@better-auth/api-key": "^1.5.
|
|
117
|
-
"@better-auth/passkey": "^1.5.
|
|
118
|
-
"@payloadcms/next": "^3.
|
|
119
|
-
"@payloadcms/ui": "^3.
|
|
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",
|
|
120
120
|
"@swc/cli": "^0.6.0",
|
|
121
|
-
"@swc/core": "^1.15.
|
|
122
|
-
"@types/node": "^
|
|
121
|
+
"@swc/core": "^1.15.18",
|
|
122
|
+
"@types/node": "^24.11.0",
|
|
123
123
|
"@types/react": "^19.2.14",
|
|
124
124
|
"@vitest/coverage-v8": "^2.1.9",
|
|
125
|
-
"better-auth": "^1.5.
|
|
125
|
+
"better-auth": "^1.5.1",
|
|
126
126
|
"next": "^16.1.6",
|
|
127
|
-
"payload": "^3.
|
|
127
|
+
"payload": "^3.78.0",
|
|
128
128
|
"react": "^19.2.4",
|
|
129
129
|
"tsx": "^4.21.0",
|
|
130
130
|
"typescript": "^5.9.3",
|