@delmaredigital/payload-better-auth 0.5.5 → 0.6.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.
@@ -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 Better Auth is explicitly configured to generate its own IDs
151
- // This would cause Better Auth to generate UUIDs which won't work with SERIAL columns
152
- // Don't warn if generateId is undefined - that's the expected default case
153
- if (idType === 'number' && generateId !== undefined && generateId !== 'serial') {
154
- console.warn('[payload-adapter] Warning: Using SERIAL (number) IDs but `generateId` is set to a non-serial value. ' + 'Either set `advanced: { database: { generateId: "serial" } }` to let Payload generate IDs, ' + 'or set `adapterConfig: { idType: "text" }` if using UUIDs.');
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(/* webpackIgnore: true */ '@better-auth/passkey/client');
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(/* webpackIgnore: true */ '@better-auth/passkey/client');
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(/* webpackIgnore: true */ '@better-auth/passkey/client');
34
+ const { passkeyClient } = await import('@better-auth/passkey/client');
35
35
  clientRef.current = createAuthClient({
36
36
  plugins: [
37
37
  twoFactorClient(),
@@ -1,17 +1,15 @@
1
- import type { AvailableScope } from '../../types/apiKey.js';
1
+ import type { PermissionDefinition } from '../../types/apiKey.js';
2
2
  export type ApiKeysManagementClientProps = {
3
3
  /** Optional pre-configured auth client with apiKey plugin */
4
4
  authClient?: any;
5
5
  /** Page title. Default: 'API Keys' */
6
6
  title?: string;
7
- /** Available scopes for key creation. Auto-generated if not provided. */
8
- availableScopes?: AvailableScope[];
9
- /** Default scopes to pre-select when creating a key */
10
- defaultScopes?: string[];
7
+ /** Available permission definitions (collections + actions). Auto-generated if not provided. */
8
+ permissions?: PermissionDefinition[];
11
9
  };
12
10
  /**
13
11
  * Client component for API keys management.
14
- * Lists, creates, and deletes API keys with scope selection.
12
+ * Lists, creates, and deletes API keys with permission selection (read/write per collection).
15
13
  */
16
- export declare function ApiKeysManagementClient({ authClient: providedClient, title, availableScopes, defaultScopes, }?: ApiKeysManagementClientProps): import("react").JSX.Element;
14
+ export declare function ApiKeysManagementClient({ authClient: providedClient, title, permissions, }?: ApiKeysManagementClientProps): import("react").JSX.Element;
17
15
  export default ApiKeysManagementClient;