@delmaredigital/payload-better-auth 0.5.2 → 0.5.4
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/README.md +2 -0
- package/dist/components/LoginView.d.ts +1 -2
- package/dist/components/LoginView.js +24 -10
- package/dist/components/PasskeyRegisterButton.d.ts +1 -2
- package/dist/components/PasskeyRegisterButton.js +18 -3
- package/dist/components/PasskeySignInButton.d.ts +1 -2
- package/dist/components/PasskeySignInButton.js +18 -3
- package/dist/components/api-key/index.d.ts +9 -0
- package/dist/components/api-key/index.js +7 -0
- package/dist/components/management/ApiKeysManagementClient.js +12 -5
- package/dist/components/management/PasskeysManagementClient.d.ts +1 -2
- package/dist/components/management/PasskeysManagementClient.js +20 -6
- package/dist/components/management/TwoFactorManagementClient.d.ts +1 -2
- package/dist/components/management/index.d.ts +2 -6
- package/dist/components/management/index.js +3 -5
- package/dist/components/passkey/index.d.ts +14 -0
- package/dist/components/passkey/index.js +10 -0
- package/dist/exports/client.d.ts +125 -961
- package/dist/exports/client.js +20 -24
- package/dist/exports/components.d.ts +0 -5
- package/dist/exports/components.js +2 -4
- package/dist/exports/management.d.ts +5 -2
- package/dist/exports/management.js +5 -2
- package/dist/exports/rsc-api-key.d.ts +6 -0
- package/dist/exports/rsc-api-key.js +5 -0
- package/dist/exports/rsc-passkey.d.ts +6 -0
- package/dist/exports/rsc-passkey.js +5 -0
- package/dist/exports/rsc.d.ts +3 -2
- package/dist/exports/rsc.js +3 -2
- package/dist/plugin/index.js +2 -2
- package/package.json +21 -1
package/dist/exports/client.js
CHANGED
|
@@ -1,55 +1,51 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Client-side auth utilities
|
|
3
|
-
* Re-exports createAuthClient from better-auth/react and
|
|
3
|
+
* Re-exports createAuthClient from better-auth/react and core plugins
|
|
4
|
+
*
|
|
5
|
+
* NOTE: Only plugins from the core `better-auth` package are statically imported here.
|
|
6
|
+
* Optional peer dep plugins (passkey, apiKey, etc.) must NOT be statically imported
|
|
7
|
+
* because webpack resolves all static imports at build time, breaking consumers
|
|
8
|
+
* who don't have those packages installed.
|
|
4
9
|
*/ import { createAuthClient } from 'better-auth/react';
|
|
5
10
|
import { twoFactorClient } from 'better-auth/client/plugins';
|
|
6
|
-
|
|
7
|
-
// Re-export createAuthClient and common plugins
|
|
11
|
+
// Re-export createAuthClient and core plugins
|
|
8
12
|
export { createAuthClient } from 'better-auth/react';
|
|
9
13
|
export { twoFactorClient } from 'better-auth/client/plugins';
|
|
10
|
-
export { passkeyClient } from '@better-auth/passkey/client';
|
|
11
14
|
/**
|
|
12
|
-
* Default plugins included with Payload Better Auth.
|
|
13
|
-
*
|
|
15
|
+
* Default plugins included with Payload Better Auth (core only).
|
|
16
|
+
* Add optional plugins (passkeyClient, apiKeyClient) from their own packages.
|
|
14
17
|
*
|
|
15
|
-
* @example
|
|
18
|
+
* @example
|
|
16
19
|
* ```typescript
|
|
17
20
|
* import { createAuthClient, payloadAuthPlugins } from '@delmaredigital/payload-better-auth/client'
|
|
18
|
-
* import {
|
|
21
|
+
* import { passkeyClient } from '@better-auth/passkey/client'
|
|
22
|
+
* import { apiKeyClient } from '@better-auth/api-key/client'
|
|
19
23
|
*
|
|
20
24
|
* export const authClient = createAuthClient({
|
|
21
|
-
* plugins: [...payloadAuthPlugins,
|
|
25
|
+
* plugins: [...payloadAuthPlugins, passkeyClient(), apiKeyClient()],
|
|
22
26
|
* })
|
|
23
|
-
*
|
|
24
|
-
* // authClient.subscription is fully typed!
|
|
25
27
|
* ```
|
|
26
28
|
*/ export const payloadAuthPlugins = [
|
|
27
|
-
twoFactorClient()
|
|
28
|
-
passkeyClient()
|
|
29
|
+
twoFactorClient()
|
|
29
30
|
];
|
|
30
31
|
/**
|
|
31
|
-
* Create a pre-configured auth client with default plugins (twoFactor
|
|
32
|
+
* Create a pre-configured auth client with default core plugins (twoFactor).
|
|
32
33
|
*
|
|
33
|
-
*
|
|
34
|
-
* safety, use `createAuthClient` with `payloadAuthPlugins` instead.
|
|
34
|
+
* For passkeys, API keys, or other optional plugins, use `createAuthClient` directly:
|
|
35
35
|
*
|
|
36
|
-
* @
|
|
37
|
-
* @param options.baseURL - Base URL for auth endpoints (defaults to window.location.origin)
|
|
38
|
-
*
|
|
39
|
-
* @example Basic usage (no custom plugins)
|
|
36
|
+
* @example Basic usage
|
|
40
37
|
* ```typescript
|
|
41
38
|
* import { createPayloadAuthClient } from '@delmaredigital/payload-better-auth/client'
|
|
42
|
-
*
|
|
43
39
|
* export const authClient = createPayloadAuthClient()
|
|
44
40
|
* ```
|
|
45
41
|
*
|
|
46
|
-
* @example With
|
|
42
|
+
* @example With optional plugins
|
|
47
43
|
* ```typescript
|
|
48
44
|
* import { createAuthClient, payloadAuthPlugins } from '@delmaredigital/payload-better-auth/client'
|
|
49
|
-
* import {
|
|
45
|
+
* import { passkeyClient } from '@better-auth/passkey/client'
|
|
50
46
|
*
|
|
51
47
|
* export const authClient = createAuthClient({
|
|
52
|
-
* plugins: [...payloadAuthPlugins,
|
|
48
|
+
* plugins: [...payloadAuthPlugins, passkeyClient()],
|
|
53
49
|
* })
|
|
54
50
|
* ```
|
|
55
51
|
*/ export function createPayloadAuthClient(options) {
|
|
@@ -17,9 +17,4 @@ export type { TwoFactorSetupViewProps } from '../components/twoFactor/TwoFactorS
|
|
|
17
17
|
export { TwoFactorSetupView } from '../components/twoFactor/TwoFactorSetupView.js';
|
|
18
18
|
export type { TwoFactorVerifyViewProps } from '../components/twoFactor/TwoFactorVerifyView.js';
|
|
19
19
|
export { TwoFactorVerifyView } from '../components/twoFactor/TwoFactorVerifyView.js';
|
|
20
|
-
export type { PasskeySignInButtonProps } from '../components/PasskeySignInButton.js';
|
|
21
|
-
export { PasskeySignInButton } from '../components/PasskeySignInButton.js';
|
|
22
|
-
export type { PasskeyRegisterButtonProps } from '../components/PasskeyRegisterButton.js';
|
|
23
|
-
export { PasskeyRegisterButton } from '../components/PasskeyRegisterButton.js';
|
|
24
20
|
export { TwoFactorField } from '../components/management/fields/TwoFactorField.js';
|
|
25
|
-
export { PasskeysField } from '../components/management/fields/PasskeysField.js';
|
|
@@ -10,8 +10,6 @@ export { ForgotPasswordView } from '../components/auth/ForgotPasswordView.js';
|
|
|
10
10
|
export { ResetPasswordView } from '../components/auth/ResetPasswordView.js';
|
|
11
11
|
export { TwoFactorSetupView } from '../components/twoFactor/TwoFactorSetupView.js';
|
|
12
12
|
export { TwoFactorVerifyView } from '../components/twoFactor/TwoFactorVerifyView.js';
|
|
13
|
-
export { PasskeySignInButton } from '../components/PasskeySignInButton.js';
|
|
14
|
-
export { PasskeyRegisterButton } from '../components/PasskeyRegisterButton.js';
|
|
15
13
|
// Management UI field wrappers (for Payload ui fields)
|
|
16
|
-
export { TwoFactorField } from '../components/management/fields/TwoFactorField.js';
|
|
17
|
-
|
|
14
|
+
export { TwoFactorField } from '../components/management/fields/TwoFactorField.js'; // Passkey components moved to '@delmaredigital/payload-better-auth/components/passkey'
|
|
15
|
+
// API key components moved to '@delmaredigital/payload-better-auth/components/api-key'
|
|
@@ -3,8 +3,11 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Client components for managing security features in the Payload admin panel.
|
|
5
5
|
* For server component views, use the './rsc' export.
|
|
6
|
+
*
|
|
7
|
+
* Passkey management: '@delmaredigital/payload-better-auth/components/passkey'
|
|
8
|
+
* API key management: '@delmaredigital/payload-better-auth/components/api-key'
|
|
6
9
|
*/
|
|
7
|
-
export { SecurityNavLinks, TwoFactorManagementClient,
|
|
8
|
-
export type { SecurityNavLinksProps, TwoFactorManagementClientProps,
|
|
10
|
+
export { SecurityNavLinks, TwoFactorManagementClient, } from '../components/management/index.js';
|
|
11
|
+
export type { SecurityNavLinksProps, TwoFactorManagementClientProps, } from '../components/management/index.js';
|
|
9
12
|
export { detectEnabledPlugins } from '../utils/detectEnabledPlugins.js';
|
|
10
13
|
export type { EnabledPluginsResult } from '../utils/detectEnabledPlugins.js';
|
|
@@ -3,7 +3,10 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Client components for managing security features in the Payload admin panel.
|
|
5
5
|
* For server component views, use the './rsc' export.
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
*
|
|
7
|
+
* Passkey management: '@delmaredigital/payload-better-auth/components/passkey'
|
|
8
|
+
* API key management: '@delmaredigital/payload-better-auth/components/api-key'
|
|
9
|
+
*/ // Client components (core only — no optional peer deps)
|
|
10
|
+
export { SecurityNavLinks, TwoFactorManagementClient } from '../components/management/index.js';
|
|
8
11
|
// Re-export plugin detection utility
|
|
9
12
|
export { detectEnabledPlugins } from '../utils/detectEnabledPlugins.js';
|
package/dist/exports/rsc.d.ts
CHANGED
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
*
|
|
4
4
|
* These async server components use DefaultTemplate for proper
|
|
5
5
|
* integration with Payload's admin panel layout.
|
|
6
|
+
*
|
|
7
|
+
* Passkey views: '@delmaredigital/payload-better-auth/rsc/passkey'
|
|
8
|
+
* API key views: '@delmaredigital/payload-better-auth/rsc/api-key'
|
|
6
9
|
*/
|
|
7
10
|
export { LoginViewWrapper } from '../components/LoginViewWrapper.js';
|
|
8
11
|
export { TwoFactorView } from '../components/management/views/TwoFactorView.js';
|
|
9
|
-
export { ApiKeysView } from '../components/management/views/ApiKeysView.js';
|
|
10
|
-
export { PasskeysView } from '../components/management/views/PasskeysView.js';
|
package/dist/exports/rsc.js
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* These async server components use DefaultTemplate for proper
|
|
5
5
|
* integration with Payload's admin panel layout.
|
|
6
|
+
*
|
|
7
|
+
* Passkey views: '@delmaredigital/payload-better-auth/rsc/passkey'
|
|
8
|
+
* API key views: '@delmaredigital/payload-better-auth/rsc/api-key'
|
|
6
9
|
*/ export { LoginViewWrapper } from '../components/LoginViewWrapper.js';
|
|
7
10
|
export { TwoFactorView } from '../components/management/views/TwoFactorView.js';
|
|
8
|
-
export { ApiKeysView } from '../components/management/views/ApiKeysView.js';
|
|
9
|
-
export { PasskeysView } from '../components/management/views/PasskeysView.js';
|
package/dist/plugin/index.js
CHANGED
|
@@ -336,7 +336,7 @@ let apiKeyScopesConfig = undefined;
|
|
|
336
336
|
const managementViews = {};
|
|
337
337
|
if (enabledPlugins.hasApiKey) {
|
|
338
338
|
managementViews.securityApiKeys = {
|
|
339
|
-
Component: '@delmaredigital/payload-better-auth/rsc#ApiKeysView',
|
|
339
|
+
Component: '@delmaredigital/payload-better-auth/rsc/api-key#ApiKeysView',
|
|
340
340
|
path: paths.apiKeys
|
|
341
341
|
};
|
|
342
342
|
}
|
|
@@ -373,7 +373,7 @@ let apiKeyScopesConfig = undefined;
|
|
|
373
373
|
label: 'Passkeys',
|
|
374
374
|
admin: {
|
|
375
375
|
components: {
|
|
376
|
-
Field: '@delmaredigital/payload-better-auth/components#PasskeysField'
|
|
376
|
+
Field: '@delmaredigital/payload-better-auth/components/passkey#PasskeysField'
|
|
377
377
|
}
|
|
378
378
|
}
|
|
379
379
|
});
|
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.4",
|
|
4
4
|
"description": "Better Auth adapter and plugins for Payload CMS",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -56,6 +56,26 @@
|
|
|
56
56
|
"import": "./dist/exports/rsc.js",
|
|
57
57
|
"types": "./dist/exports/rsc.d.ts",
|
|
58
58
|
"default": "./dist/exports/rsc.js"
|
|
59
|
+
},
|
|
60
|
+
"./rsc/passkey": {
|
|
61
|
+
"import": "./dist/exports/rsc-passkey.js",
|
|
62
|
+
"types": "./dist/exports/rsc-passkey.d.ts",
|
|
63
|
+
"default": "./dist/exports/rsc-passkey.js"
|
|
64
|
+
},
|
|
65
|
+
"./rsc/api-key": {
|
|
66
|
+
"import": "./dist/exports/rsc-api-key.js",
|
|
67
|
+
"types": "./dist/exports/rsc-api-key.d.ts",
|
|
68
|
+
"default": "./dist/exports/rsc-api-key.js"
|
|
69
|
+
},
|
|
70
|
+
"./components/passkey": {
|
|
71
|
+
"import": "./dist/components/passkey/index.js",
|
|
72
|
+
"types": "./dist/components/passkey/index.d.ts",
|
|
73
|
+
"default": "./dist/components/passkey/index.js"
|
|
74
|
+
},
|
|
75
|
+
"./components/api-key": {
|
|
76
|
+
"import": "./dist/components/api-key/index.js",
|
|
77
|
+
"types": "./dist/components/api-key/index.d.ts",
|
|
78
|
+
"default": "./dist/components/api-key/index.js"
|
|
59
79
|
}
|
|
60
80
|
},
|
|
61
81
|
"files": [
|