@delmaredigital/payload-better-auth 0.3.9 → 0.3.11

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.
Files changed (166) hide show
  1. package/README.md +136 -3
  2. package/dist/adapter/collections.d.ts +0 -1
  3. package/dist/adapter/collections.js +0 -2
  4. package/dist/adapter/index.d.ts +0 -1
  5. package/dist/adapter/index.js +13 -2
  6. package/dist/components/BeforeLogin.d.ts +0 -1
  7. package/dist/components/BeforeLogin.js +0 -2
  8. package/dist/components/LoginView.d.ts +0 -1
  9. package/dist/components/LoginView.js +0 -2
  10. package/dist/components/LoginViewWrapper.d.ts +0 -1
  11. package/dist/components/LoginViewWrapper.js +0 -2
  12. package/dist/components/LogoutButton.d.ts +0 -1
  13. package/dist/components/LogoutButton.js +0 -2
  14. package/dist/components/PasskeyRegisterButton.d.ts +0 -1
  15. package/dist/components/PasskeyRegisterButton.js +0 -2
  16. package/dist/components/PasskeySignInButton.d.ts +0 -1
  17. package/dist/components/PasskeySignInButton.js +0 -2
  18. package/dist/components/auth/ForgotPasswordView.d.ts +0 -1
  19. package/dist/components/auth/ForgotPasswordView.js +0 -2
  20. package/dist/components/auth/ResetPasswordView.d.ts +0 -1
  21. package/dist/components/auth/ResetPasswordView.js +0 -2
  22. package/dist/components/auth/index.d.ts +0 -1
  23. package/dist/components/auth/index.js +0 -2
  24. package/dist/components/management/ApiKeysManagementClient.d.ts +0 -1
  25. package/dist/components/management/ApiKeysManagementClient.js +0 -2
  26. package/dist/components/management/PasskeysManagementClient.d.ts +0 -1
  27. package/dist/components/management/PasskeysManagementClient.js +0 -2
  28. package/dist/components/management/SecurityNavLinks.d.ts +0 -1
  29. package/dist/components/management/SecurityNavLinks.js +0 -2
  30. package/dist/components/management/TwoFactorManagementClient.d.ts +0 -1
  31. package/dist/components/management/TwoFactorManagementClient.js +0 -2
  32. package/dist/components/management/index.d.ts +0 -1
  33. package/dist/components/management/index.js +0 -2
  34. package/dist/components/management/views/ApiKeysView.d.ts +0 -1
  35. package/dist/components/management/views/ApiKeysView.js +0 -2
  36. package/dist/components/management/views/PasskeysView.d.ts +0 -1
  37. package/dist/components/management/views/PasskeysView.js +0 -2
  38. package/dist/components/management/views/TwoFactorView.d.ts +0 -1
  39. package/dist/components/management/views/TwoFactorView.js +0 -2
  40. package/dist/components/management/views/index.d.ts +0 -1
  41. package/dist/components/management/views/index.js +0 -2
  42. package/dist/components/twoFactor/TwoFactorSetupView.d.ts +0 -1
  43. package/dist/components/twoFactor/TwoFactorSetupView.js +0 -2
  44. package/dist/components/twoFactor/TwoFactorVerifyView.d.ts +0 -1
  45. package/dist/components/twoFactor/TwoFactorVerifyView.js +0 -2
  46. package/dist/components/twoFactor/index.d.ts +0 -1
  47. package/dist/components/twoFactor/index.js +0 -2
  48. package/dist/exports/client.d.ts +0 -1
  49. package/dist/exports/client.js +0 -2
  50. package/dist/exports/components.d.ts +0 -1
  51. package/dist/exports/components.js +0 -2
  52. package/dist/exports/management.d.ts +0 -1
  53. package/dist/exports/management.js +0 -2
  54. package/dist/exports/rsc.d.ts +0 -1
  55. package/dist/exports/rsc.js +0 -2
  56. package/dist/generated-types.d.ts +0 -1
  57. package/dist/generated-types.js +0 -2
  58. package/dist/index.d.ts +0 -1
  59. package/dist/index.js +0 -2
  60. package/dist/plugin/index.d.ts +0 -1
  61. package/dist/plugin/index.js +0 -2
  62. package/dist/scripts/generate-types.d.ts +0 -1
  63. package/dist/scripts/generate-types.js +0 -2
  64. package/dist/types/apiKey.d.ts +0 -1
  65. package/dist/types/apiKey.js +0 -2
  66. package/dist/types/betterAuth.d.ts +0 -1
  67. package/dist/types/betterAuth.js +0 -2
  68. package/dist/utils/access.d.ts +0 -1
  69. package/dist/utils/access.js +0 -2
  70. package/dist/utils/apiKeyAccess.d.ts +0 -1
  71. package/dist/utils/apiKeyAccess.js +0 -2
  72. package/dist/utils/betterAuthDefaults.d.ts +0 -1
  73. package/dist/utils/betterAuthDefaults.js +0 -2
  74. package/dist/utils/detectAuthConfig.d.ts +0 -1
  75. package/dist/utils/detectAuthConfig.js +0 -2
  76. package/dist/utils/detectEnabledPlugins.d.ts +0 -1
  77. package/dist/utils/detectEnabledPlugins.js +0 -2
  78. package/dist/utils/firstUserAdmin.d.ts +0 -1
  79. package/dist/utils/firstUserAdmin.js +0 -2
  80. package/dist/utils/generateScopes.d.ts +0 -1
  81. package/dist/utils/generateScopes.js +0 -2
  82. package/dist/utils/session.d.ts +0 -1
  83. package/dist/utils/session.js +0 -2
  84. package/package.json +1 -1
  85. package/dist/adapter/collections.d.ts.map +0 -1
  86. package/dist/adapter/collections.js.map +0 -1
  87. package/dist/adapter/index.d.ts.map +0 -1
  88. package/dist/adapter/index.js.map +0 -1
  89. package/dist/components/BeforeLogin.d.ts.map +0 -1
  90. package/dist/components/BeforeLogin.js.map +0 -1
  91. package/dist/components/LoginView.d.ts.map +0 -1
  92. package/dist/components/LoginView.js.map +0 -1
  93. package/dist/components/LoginViewWrapper.d.ts.map +0 -1
  94. package/dist/components/LoginViewWrapper.js.map +0 -1
  95. package/dist/components/LogoutButton.d.ts.map +0 -1
  96. package/dist/components/LogoutButton.js.map +0 -1
  97. package/dist/components/PasskeyRegisterButton.d.ts.map +0 -1
  98. package/dist/components/PasskeyRegisterButton.js.map +0 -1
  99. package/dist/components/PasskeySignInButton.d.ts.map +0 -1
  100. package/dist/components/PasskeySignInButton.js.map +0 -1
  101. package/dist/components/auth/ForgotPasswordView.d.ts.map +0 -1
  102. package/dist/components/auth/ForgotPasswordView.js.map +0 -1
  103. package/dist/components/auth/ResetPasswordView.d.ts.map +0 -1
  104. package/dist/components/auth/ResetPasswordView.js.map +0 -1
  105. package/dist/components/auth/index.d.ts.map +0 -1
  106. package/dist/components/auth/index.js.map +0 -1
  107. package/dist/components/management/ApiKeysManagementClient.d.ts.map +0 -1
  108. package/dist/components/management/ApiKeysManagementClient.js.map +0 -1
  109. package/dist/components/management/PasskeysManagementClient.d.ts.map +0 -1
  110. package/dist/components/management/PasskeysManagementClient.js.map +0 -1
  111. package/dist/components/management/SecurityNavLinks.d.ts.map +0 -1
  112. package/dist/components/management/SecurityNavLinks.js.map +0 -1
  113. package/dist/components/management/TwoFactorManagementClient.d.ts.map +0 -1
  114. package/dist/components/management/TwoFactorManagementClient.js.map +0 -1
  115. package/dist/components/management/index.d.ts.map +0 -1
  116. package/dist/components/management/index.js.map +0 -1
  117. package/dist/components/management/views/ApiKeysView.d.ts.map +0 -1
  118. package/dist/components/management/views/ApiKeysView.js.map +0 -1
  119. package/dist/components/management/views/PasskeysView.d.ts.map +0 -1
  120. package/dist/components/management/views/PasskeysView.js.map +0 -1
  121. package/dist/components/management/views/TwoFactorView.d.ts.map +0 -1
  122. package/dist/components/management/views/TwoFactorView.js.map +0 -1
  123. package/dist/components/management/views/index.d.ts.map +0 -1
  124. package/dist/components/management/views/index.js.map +0 -1
  125. package/dist/components/twoFactor/TwoFactorSetupView.d.ts.map +0 -1
  126. package/dist/components/twoFactor/TwoFactorSetupView.js.map +0 -1
  127. package/dist/components/twoFactor/TwoFactorVerifyView.d.ts.map +0 -1
  128. package/dist/components/twoFactor/TwoFactorVerifyView.js.map +0 -1
  129. package/dist/components/twoFactor/index.d.ts.map +0 -1
  130. package/dist/components/twoFactor/index.js.map +0 -1
  131. package/dist/exports/client.d.ts.map +0 -1
  132. package/dist/exports/client.js.map +0 -1
  133. package/dist/exports/components.d.ts.map +0 -1
  134. package/dist/exports/components.js.map +0 -1
  135. package/dist/exports/management.d.ts.map +0 -1
  136. package/dist/exports/management.js.map +0 -1
  137. package/dist/exports/rsc.d.ts.map +0 -1
  138. package/dist/exports/rsc.js.map +0 -1
  139. package/dist/generated-types.d.ts.map +0 -1
  140. package/dist/generated-types.js.map +0 -1
  141. package/dist/index.d.ts.map +0 -1
  142. package/dist/index.js.map +0 -1
  143. package/dist/plugin/index.d.ts.map +0 -1
  144. package/dist/plugin/index.js.map +0 -1
  145. package/dist/scripts/generate-types.d.ts.map +0 -1
  146. package/dist/scripts/generate-types.js.map +0 -1
  147. package/dist/types/apiKey.d.ts.map +0 -1
  148. package/dist/types/apiKey.js.map +0 -1
  149. package/dist/types/betterAuth.d.ts.map +0 -1
  150. package/dist/types/betterAuth.js.map +0 -1
  151. package/dist/utils/access.d.ts.map +0 -1
  152. package/dist/utils/access.js.map +0 -1
  153. package/dist/utils/apiKeyAccess.d.ts.map +0 -1
  154. package/dist/utils/apiKeyAccess.js.map +0 -1
  155. package/dist/utils/betterAuthDefaults.d.ts.map +0 -1
  156. package/dist/utils/betterAuthDefaults.js.map +0 -1
  157. package/dist/utils/detectAuthConfig.d.ts.map +0 -1
  158. package/dist/utils/detectAuthConfig.js.map +0 -1
  159. package/dist/utils/detectEnabledPlugins.d.ts.map +0 -1
  160. package/dist/utils/detectEnabledPlugins.js.map +0 -1
  161. package/dist/utils/firstUserAdmin.d.ts.map +0 -1
  162. package/dist/utils/firstUserAdmin.js.map +0 -1
  163. package/dist/utils/generateScopes.d.ts.map +0 -1
  164. package/dist/utils/generateScopes.js.map +0 -1
  165. package/dist/utils/session.d.ts.map +0 -1
  166. package/dist/utils/session.js.map +0 -1
package/README.md CHANGED
@@ -2,11 +2,19 @@
2
2
 
3
3
  Better Auth adapter and plugins for Payload CMS. Enables seamless integration between Better Auth and Payload.
4
4
 
5
- [![Demo](https://img.shields.io/badge/Demo-Live-blue)](https://demo.delmaredigital.com)
6
- [![Starter Template](https://img.shields.io/badge/Starter-Template-green)](https://github.com/delmaredigital/dd-starter)
7
- [![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fdelmaredigital%2Fdd-starter&project-name=my-payload-site&build-command=pnpm%20run%20ci&env=PAYLOAD_SECRET,BETTER_AUTH_SECRET&stores=%5B%7B%22type%22%3A%22integration%22%2C%22protocol%22%3A%22storage%22%2C%22productSlug%22%3A%22neon%22%2C%22integrationSlug%22%3A%22neon%22%7D%2C%7B%22type%22%3A%22blob%22%7D%5D)
5
+ <p align="center">
6
+ <a href="https://demo.delmaredigital.com"><img src="https://img.shields.io/badge/Live_Demo-Try_It_Now-2ea44f?style=for-the-badge&logo=vercel&logoColor=white" alt="Live Demo - Try It Now"></a>
7
+ &nbsp;&nbsp;
8
+ <a href="https://github.com/delmaredigital/dd-starter"><img src="https://img.shields.io/badge/Starter_Template-Use_This-blue?style=for-the-badge&logo=github&logoColor=white" alt="Starter Template - Use This"></a>
9
+ </p>
10
+
11
+ <p align="center">
12
+ <a href="https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fdelmaredigital%2Fdd-starter&project-name=my-payload-site&build-command=pnpm%20run%20ci&env=PAYLOAD_SECRET,BETTER_AUTH_SECRET&stores=%5B%7B%22type%22%3A%22integration%22%2C%22protocol%22%3A%22storage%22%2C%22productSlug%22%3A%22neon%22%2C%22integrationSlug%22%3A%22neon%22%7D%2C%7B%22type%22%3A%22blob%22%7D%5D"><img src="https://vercel.com/button" alt="Deploy with Vercel" height="32"></a>
13
+ </p>
8
14
 
9
15
  ---
16
+ ## Documentation
17
+ For additional documentation and references, visit: [https://deepwiki.com/delmaredigital/payload-better-auth](https://deepwiki.com/delmaredigital/payload-better-auth)
10
18
 
11
19
  ## Table of Contents
12
20
 
@@ -17,6 +25,7 @@ Better Auth adapter and plugins for Payload CMS. Enables seamless integration be
17
25
  - [Access Control Helpers](#access-control-helpers)
18
26
  - [API Key Scope Enforcement](#api-key-scope-enforcement)
19
27
  - [Plugin Compatibility](#plugin-compatibility)
28
+ - [Recipes](#recipes)
20
29
  - [Types](#types)
21
30
  - [License](#license)
22
31
 
@@ -1585,6 +1594,130 @@ createBetterAuthPlugin({
1585
1594
 
1586
1595
  ---
1587
1596
 
1597
+ ## Recipes
1598
+
1599
+ Common patterns and solutions for Better Auth integration.
1600
+
1601
+ ### Auto-Create Organization on User Signup
1602
+
1603
+ A common pattern is to automatically create a personal workspace/organization when a user signs up (and verifies their email). The key is to use Better Auth's organization API (`auth.api.createOrganization()`) rather than raw adapter calls, so that `organizationHooks` fire properly.
1604
+
1605
+ **The Challenge:** Database hooks are defined in `betterAuthOptions` before the `auth` instance exists, so you can't directly reference `auth.api` in your hooks.
1606
+
1607
+ **The Solution:** Use a lazy auth instance singleton:
1608
+
1609
+ **Step 1: Create an auth instance singleton**
1610
+
1611
+ ```typescript
1612
+ // src/lib/auth/instance.ts
1613
+ import type { betterAuth } from 'better-auth'
1614
+
1615
+ type AuthInstance = ReturnType<typeof betterAuth>
1616
+
1617
+ let authInstance: AuthInstance | null = null
1618
+
1619
+ export function setAuthInstance(auth: AuthInstance): void {
1620
+ authInstance = auth
1621
+ }
1622
+
1623
+ export function getAuthInstance(): AuthInstance {
1624
+ if (!authInstance) {
1625
+ throw new Error('Auth not initialized')
1626
+ }
1627
+ return authInstance
1628
+ }
1629
+ ```
1630
+
1631
+ **Step 2: Store the instance after creation**
1632
+
1633
+ ```typescript
1634
+ // src/payload.config.ts (or wherever you configure plugins)
1635
+ import { setAuthInstance } from '@/lib/auth/instance'
1636
+
1637
+ createBetterAuthPlugin({
1638
+ createAuth: (payload) => {
1639
+ const auth = betterAuth({
1640
+ ...betterAuthOptions,
1641
+ database: payloadAdapter({ payloadClient: payload }),
1642
+ // ... other options
1643
+ })
1644
+
1645
+ // Store for use in database hooks
1646
+ setAuthInstance(auth)
1647
+
1648
+ return auth
1649
+ },
1650
+ })
1651
+ ```
1652
+
1653
+ **Step 3: Use the organization API in database hooks**
1654
+
1655
+ ```typescript
1656
+ // src/lib/auth/config.ts
1657
+ import { getAuthInstance } from './instance'
1658
+
1659
+ export const betterAuthOptions: Partial<BetterAuthOptions> = {
1660
+ // ... other options
1661
+
1662
+ plugins: [
1663
+ organization({
1664
+ // organizationHooks fire when using auth.api.createOrganization()
1665
+ organizationHooks: {
1666
+ afterCreateOrganization: async ({ organization }) => {
1667
+ // This runs for ALL org creations - auto-created, manual, API
1668
+ console.log(`Organization ${organization.id} created`)
1669
+ // Create related records, send welcome email, etc.
1670
+ },
1671
+ },
1672
+ }),
1673
+ ],
1674
+
1675
+ databaseHooks: {
1676
+ user: {
1677
+ update: {
1678
+ after: async (user, ctx) => {
1679
+ // Only proceed if user just verified their email
1680
+ if (!user.emailVerified) return
1681
+
1682
+ // Check if user already has an organization (e.g., joined via invitation)
1683
+ const existingMembership = await ctx?.context?.adapter?.findOne({
1684
+ model: 'member',
1685
+ where: [{ field: 'userId', value: user.id }],
1686
+ })
1687
+ if (existingMembership) return
1688
+
1689
+ // Create organization using the proper API
1690
+ // This ensures organizationHooks.afterCreateOrganization fires
1691
+ const auth = getAuthInstance()
1692
+ await auth.api.createOrganization({
1693
+ body: {
1694
+ name: `${user.name}'s Workspace`,
1695
+ slug: generateUniqueSlug(user.name),
1696
+ userId: user.id,
1697
+ },
1698
+ })
1699
+ },
1700
+ },
1701
+ },
1702
+ },
1703
+ }
1704
+ ```
1705
+
1706
+ **Why This Matters:**
1707
+
1708
+ | Approach | organizationHooks fire? | Recommended? |
1709
+ |----------|------------------------|--------------|
1710
+ | `auth.api.createOrganization()` | ✅ Yes | ✅ Yes |
1711
+ | `ctx.context.adapter.create({ model: 'organization' })` | ❌ No | ❌ No |
1712
+
1713
+ Using the raw adapter bypasses Better Auth's organization plugin entirely. Any logic in `organizationHooks` (like creating related records, sending notifications, or syncing with external systems) won't run.
1714
+
1715
+ **Handling Invitations:**
1716
+
1717
+ Users who join via invitation already have a membership record (created when they accept the invitation), so the `existingMembership` check prevents creating a duplicate personal organization for them.
1718
+
1719
+ ---
1720
+
1588
1721
  ## Types
1589
1722
 
1590
1723
  The package exports comprehensive TypeScript types for Better Auth integration.
@@ -121,4 +121,3 @@ export type BetterAuthCollectionsOptions = {
121
121
  * ```
122
122
  */
123
123
  export declare function betterAuthCollections(options?: BetterAuthCollectionsOptions): Plugin;
124
- //# sourceMappingURL=collections.d.ts.map
@@ -445,5 +445,3 @@ function generateCollection(modelKey, table, usePlural, adminGroup, customAccess
445
445
  };
446
446
  };
447
447
  }
448
-
449
- //# sourceMappingURL=collections.js.map
@@ -79,4 +79,3 @@ export type PayloadAdapterConfig = {
79
79
  */
80
80
  export declare function payloadAdapter({ payloadClient, adapterConfig, }: PayloadAdapterConfig): (options: BetterAuthOptions) => Adapter;
81
81
  export type { Adapter, BetterAuthOptions };
82
- //# sourceMappingURL=index.d.ts.map
@@ -295,6 +295,19 @@
295
295
  }
296
296
  }
297
297
  }
298
+ // Convert date strings to Date objects
299
+ // Better Auth expects Date objects for date field comparisons
300
+ for (const [key, value] of Object.entries(transformed)){
301
+ if (typeof value !== 'string') continue;
302
+ // Check if schema defines this field as a date type
303
+ const fieldDef = modelSchema.fields[key];
304
+ if (fieldDef?.type === 'date') {
305
+ const dateValue = new Date(value);
306
+ if (!isNaN(dateValue.getTime())) {
307
+ transformed[key] = dateValue;
308
+ }
309
+ }
310
+ }
298
311
  // Convert semantic ID fields to numbers when using serial IDs
299
312
  // Heuristic: fields ending in 'Id' or '_id' containing numeric strings
300
313
  // Modified by allowlist (add) and blocklist (exclude)
@@ -599,5 +612,3 @@
599
612
  return adapterFactory(options);
600
613
  };
601
614
  }
602
-
603
- //# sourceMappingURL=index.js.map
@@ -8,4 +8,3 @@ export type BeforeLoginProps = {
8
8
  */
9
9
  export declare function BeforeLogin({ loginUrl }: BeforeLoginProps): import("react").JSX.Element;
10
10
  export default BeforeLogin;
11
- //# sourceMappingURL=BeforeLogin.d.ts.map
@@ -29,5 +29,3 @@ import { useRouter } from 'next/navigation.js';
29
29
  });
30
30
  }
31
31
  export default BeforeLogin;
32
-
33
- //# sourceMappingURL=BeforeLogin.js.map
@@ -56,4 +56,3 @@ export type LoginViewProps = {
56
56
  };
57
57
  export declare function LoginView({ authClient: providedClient, logo, title, afterLoginPath, requiredRole, requireAllRoles, enablePasskey, enableSignUp, defaultSignUpRole, enableForgotPassword, resetPasswordUrl, }: LoginViewProps): import("react").JSX.Element;
58
58
  export default LoginView;
59
- //# sourceMappingURL=LoginView.d.ts.map
@@ -1337,5 +1337,3 @@ export function LoginView({ authClient: providedClient, logo, title = 'Login', a
1337
1337
  });
1338
1338
  }
1339
1339
  export default LoginView;
1340
-
1341
- //# sourceMappingURL=LoginView.js.map
@@ -7,4 +7,3 @@ type LoginViewWrapperProps = AdminViewProps;
7
7
  */
8
8
  export declare function LoginViewWrapper({ initPageResult }: LoginViewWrapperProps): Promise<import("react").JSX.Element>;
9
9
  export default LoginViewWrapper;
10
- //# sourceMappingURL=LoginViewWrapper.d.ts.map
@@ -22,5 +22,3 @@ import { LoginView } from './LoginView.js';
22
22
  });
23
23
  }
24
24
  export default LoginViewWrapper;
25
-
26
- //# sourceMappingURL=LoginViewWrapper.js.map
@@ -4,4 +4,3 @@
4
4
  */
5
5
  export declare function LogoutButton(): import("react").JSX.Element;
6
6
  export default LogoutButton;
7
- //# sourceMappingURL=LogoutButton.d.ts.map
@@ -47,5 +47,3 @@ import { useRouter } from 'next/navigation.js';
47
47
  });
48
48
  }
49
49
  export default LogoutButton;
50
-
51
- //# sourceMappingURL=LogoutButton.js.map
@@ -43,4 +43,3 @@ export type PasskeyRegisterButtonProps = Omit<ButtonHTMLAttributes<HTMLButtonEle
43
43
  */
44
44
  export declare function PasskeyRegisterButton({ authClient: providedClient, passkeyName, onSuccess, onError, label, loadingLabel, disabled, children, ...buttonProps }: PasskeyRegisterButtonProps): import("react").JSX.Element;
45
45
  export default PasskeyRegisterButton;
46
- //# sourceMappingURL=PasskeyRegisterButton.d.ts.map
@@ -63,5 +63,3 @@ import { createPayloadAuthClient } from '../exports/client.js';
63
63
  });
64
64
  }
65
65
  export default PasskeyRegisterButton;
66
-
67
- //# sourceMappingURL=PasskeyRegisterButton.js.map
@@ -40,4 +40,3 @@ export type PasskeySignInButtonProps = Omit<ButtonHTMLAttributes<HTMLButtonEleme
40
40
  */
41
41
  export declare function PasskeySignInButton({ authClient: providedClient, onSuccess, onError, label, loadingLabel, disabled, children, ...buttonProps }: PasskeySignInButtonProps): import("react").JSX.Element;
42
42
  export default PasskeySignInButton;
43
- //# sourceMappingURL=PasskeySignInButton.d.ts.map
@@ -54,5 +54,3 @@ import { createPayloadAuthClient } from '../exports/client.js';
54
54
  });
55
55
  }
56
56
  export default PasskeySignInButton;
57
-
58
- //# sourceMappingURL=PasskeySignInButton.js.map
@@ -14,4 +14,3 @@ export type ForgotPasswordViewProps = {
14
14
  */
15
15
  export declare function ForgotPasswordView({ logo, title, loginPath, successMessage, }: ForgotPasswordViewProps): import("react").JSX.Element;
16
16
  export default ForgotPasswordView;
17
- //# sourceMappingURL=ForgotPasswordView.d.ts.map
@@ -235,5 +235,3 @@ import { useState } from 'react';
235
235
  });
236
236
  }
237
237
  export default ForgotPasswordView;
238
-
239
- //# sourceMappingURL=ForgotPasswordView.js.map
@@ -15,4 +15,3 @@ export type ResetPasswordViewProps = {
15
15
  */
16
16
  export declare function ResetPasswordView({ logo, title, afterResetPath, minPasswordLength, }: ResetPasswordViewProps): import("react").JSX.Element;
17
17
  export default ResetPasswordView;
18
- //# sourceMappingURL=ResetPasswordView.d.ts.map
@@ -291,5 +291,3 @@ import { useRouter, useSearchParams } from 'next/navigation.js';
291
291
  });
292
292
  }
293
293
  export default ResetPasswordView;
294
-
295
- //# sourceMappingURL=ResetPasswordView.js.map
@@ -5,4 +5,3 @@
5
5
  */
6
6
  export { ForgotPasswordView, type ForgotPasswordViewProps } from './ForgotPasswordView.js';
7
7
  export { ResetPasswordView, type ResetPasswordViewProps } from './ResetPasswordView.js';
8
- //# sourceMappingURL=index.d.ts.map
@@ -4,5 +4,3 @@
4
4
  * @packageDocumentation
5
5
  */ export { ForgotPasswordView } from './ForgotPasswordView.js';
6
6
  export { ResetPasswordView } from './ResetPasswordView.js';
7
-
8
- //# sourceMappingURL=index.js.map
@@ -16,4 +16,3 @@ export type ApiKeysManagementClientProps = {
16
16
  */
17
17
  export declare function ApiKeysManagementClient({ authClient: providedClient, title, availableScopes, defaultScopes, }?: ApiKeysManagementClientProps): import("react").JSX.Element;
18
18
  export default ApiKeysManagementClient;
19
- //# sourceMappingURL=ApiKeysManagementClient.d.ts.map
@@ -864,5 +864,3 @@ import { createPayloadAuthClient } from '../../exports/client.js';
864
864
  });
865
865
  }
866
866
  export default ApiKeysManagementClient;
867
-
868
- //# sourceMappingURL=ApiKeysManagementClient.js.map
@@ -11,4 +11,3 @@ export type PasskeysManagementClientProps = {
11
11
  */
12
12
  export declare function PasskeysManagementClient({ authClient: providedClient, title, }?: PasskeysManagementClientProps): import("react").JSX.Element;
13
13
  export default PasskeysManagementClient;
14
- //# sourceMappingURL=PasskeysManagementClient.d.ts.map
@@ -359,5 +359,3 @@ import { createPayloadAuthClient } from '../../exports/client.js';
359
359
  });
360
360
  }
361
361
  export default PasskeysManagementClient;
362
-
363
- //# sourceMappingURL=PasskeysManagementClient.js.map
@@ -17,4 +17,3 @@ export type SecurityNavLinksProps = {
17
17
  */
18
18
  export declare function SecurityNavLinks({ basePath, showTwoFactor, showApiKeys, showPasskeys, }?: SecurityNavLinksProps): import("react").JSX.Element | null;
19
19
  export default SecurityNavLinks;
20
- //# sourceMappingURL=SecurityNavLinks.d.ts.map
@@ -90,5 +90,3 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
90
90
  });
91
91
  }
92
92
  export default SecurityNavLinks;
93
-
94
- //# sourceMappingURL=SecurityNavLinks.js.map
@@ -11,4 +11,3 @@ export type TwoFactorManagementClientProps = {
11
11
  */
12
12
  export declare function TwoFactorManagementClient({ authClient: providedClient, title, }?: TwoFactorManagementClientProps): import("react").JSX.Element;
13
13
  export default TwoFactorManagementClient;
14
- //# sourceMappingURL=TwoFactorManagementClient.d.ts.map
@@ -490,5 +490,3 @@ import { createPayloadAuthClient } from '../../exports/client.js';
490
490
  });
491
491
  }
492
492
  export default TwoFactorManagementClient;
493
-
494
- //# sourceMappingURL=TwoFactorManagementClient.js.map
@@ -12,4 +12,3 @@ export { PasskeysManagementClient } from './PasskeysManagementClient.js';
12
12
  export type { PasskeysManagementClientProps } from './PasskeysManagementClient.js';
13
13
  export { SecurityNavLinks } from './SecurityNavLinks.js';
14
14
  export type { SecurityNavLinksProps } from './SecurityNavLinks.js';
15
- //# sourceMappingURL=index.d.ts.map
@@ -9,5 +9,3 @@ export { ApiKeysManagementClient } from './ApiKeysManagementClient.js';
9
9
  export { PasskeysManagementClient } from './PasskeysManagementClient.js';
10
10
  // Nav links (client component)
11
11
  export { SecurityNavLinks } from './SecurityNavLinks.js';
12
-
13
- //# sourceMappingURL=index.js.map
@@ -6,4 +6,3 @@ type ApiKeysViewProps = AdminViewProps;
6
6
  */
7
7
  export declare function ApiKeysView({ initPageResult, params, searchParams, }: ApiKeysViewProps): Promise<import("react").JSX.Element>;
8
8
  export default ApiKeysView;
9
- //# sourceMappingURL=ApiKeysView.d.ts.map
@@ -37,5 +37,3 @@ import { buildAvailableScopes } from '../../../utils/generateScopes.js';
37
37
  });
38
38
  }
39
39
  export default ApiKeysView;
40
-
41
- //# sourceMappingURL=ApiKeysView.js.map
@@ -6,4 +6,3 @@ type PasskeysViewProps = AdminViewProps;
6
6
  */
7
7
  export declare function PasskeysView({ initPageResult, params, searchParams, }: PasskeysViewProps): Promise<import("react").JSX.Element>;
8
8
  export default PasskeysView;
9
- //# sourceMappingURL=PasskeysView.d.ts.map
@@ -27,5 +27,3 @@ import { PasskeysManagementClient } from '../PasskeysManagementClient.js';
27
27
  });
28
28
  }
29
29
  export default PasskeysView;
30
-
31
- //# sourceMappingURL=PasskeysView.js.map
@@ -6,4 +6,3 @@ type TwoFactorViewProps = AdminViewProps;
6
6
  */
7
7
  export declare function TwoFactorView({ initPageResult, params, searchParams, }: TwoFactorViewProps): Promise<import("react").JSX.Element>;
8
8
  export default TwoFactorView;
9
- //# sourceMappingURL=TwoFactorView.d.ts.map
@@ -27,5 +27,3 @@ import { TwoFactorManagementClient } from '../TwoFactorManagementClient.js';
27
27
  });
28
28
  }
29
29
  export default TwoFactorView;
30
-
31
- //# sourceMappingURL=TwoFactorView.js.map
@@ -7,4 +7,3 @@
7
7
  export { TwoFactorView } from './TwoFactorView.js';
8
8
  export { ApiKeysView } from './ApiKeysView.js';
9
9
  export { PasskeysView } from './PasskeysView.js';
10
- //# sourceMappingURL=index.d.ts.map
@@ -6,5 +6,3 @@
6
6
  */ export { TwoFactorView } from './TwoFactorView.js';
7
7
  export { ApiKeysView } from './ApiKeysView.js';
8
8
  export { PasskeysView } from './PasskeysView.js';
9
-
10
- //# sourceMappingURL=index.js.map
@@ -15,4 +15,3 @@ export type TwoFactorSetupViewProps = {
15
15
  */
16
16
  export declare function TwoFactorSetupView({ logo, title, afterSetupPath, onSetupComplete, }: TwoFactorSetupViewProps): import("react").JSX.Element;
17
17
  export default TwoFactorSetupView;
18
- //# sourceMappingURL=TwoFactorSetupView.d.ts.map
@@ -446,5 +446,3 @@ import { useState, useEffect } from 'react';
446
446
  });
447
447
  }
448
448
  export default TwoFactorSetupView;
449
-
450
- //# sourceMappingURL=TwoFactorSetupView.js.map
@@ -15,4 +15,3 @@ export type TwoFactorVerifyViewProps = {
15
15
  */
16
16
  export declare function TwoFactorVerifyView({ logo, title, afterVerifyPath, onVerifyComplete, }: TwoFactorVerifyViewProps): import("react").JSX.Element;
17
17
  export default TwoFactorVerifyView;
18
- //# sourceMappingURL=TwoFactorVerifyView.d.ts.map
@@ -202,5 +202,3 @@ import { useRouter } from 'next/navigation.js';
202
202
  });
203
203
  }
204
204
  export default TwoFactorVerifyView;
205
-
206
- //# sourceMappingURL=TwoFactorVerifyView.js.map
@@ -5,4 +5,3 @@
5
5
  */
6
6
  export { TwoFactorSetupView, type TwoFactorSetupViewProps } from './TwoFactorSetupView.js';
7
7
  export { TwoFactorVerifyView, type TwoFactorVerifyViewProps } from './TwoFactorVerifyView.js';
8
- //# sourceMappingURL=index.d.ts.map
@@ -4,5 +4,3 @@
4
4
  * @packageDocumentation
5
5
  */ export { TwoFactorSetupView } from './TwoFactorSetupView.js';
6
6
  export { TwoFactorVerifyView } from './TwoFactorVerifyView.js';
7
-
8
- //# sourceMappingURL=index.js.map
@@ -3654,4 +3654,3 @@ export declare function createPayloadAuthClient(options?: PayloadAuthClientOptio
3654
3654
  };
3655
3655
  };
3656
3656
  export type PayloadAuthClient = ReturnType<typeof createPayloadAuthClient>;
3657
- //# sourceMappingURL=client.d.ts.map
@@ -61,5 +61,3 @@ export { passkeyClient } from '@better-auth/passkey/client';
61
61
  ]
62
62
  });
63
63
  }
64
-
65
- //# sourceMappingURL=client.js.map
@@ -21,4 +21,3 @@ export type { PasskeySignInButtonProps } from '../components/PasskeySignInButton
21
21
  export { PasskeySignInButton } from '../components/PasskeySignInButton.js';
22
22
  export type { PasskeyRegisterButtonProps } from '../components/PasskeyRegisterButton.js';
23
23
  export { PasskeyRegisterButton } from '../components/PasskeyRegisterButton.js';
24
- //# sourceMappingURL=components.d.ts.map
@@ -12,5 +12,3 @@ export { TwoFactorSetupView } from '../components/twoFactor/TwoFactorSetupView.j
12
12
  export { TwoFactorVerifyView } from '../components/twoFactor/TwoFactorVerifyView.js';
13
13
  export { PasskeySignInButton } from '../components/PasskeySignInButton.js';
14
14
  export { PasskeyRegisterButton } from '../components/PasskeyRegisterButton.js';
15
-
16
- //# sourceMappingURL=components.js.map
@@ -8,4 +8,3 @@ export { SecurityNavLinks, TwoFactorManagementClient, ApiKeysManagementClient, P
8
8
  export type { SecurityNavLinksProps, TwoFactorManagementClientProps, ApiKeysManagementClientProps, PasskeysManagementClientProps, } from '../components/management/index.js';
9
9
  export { detectEnabledPlugins } from '../utils/detectEnabledPlugins.js';
10
10
  export type { EnabledPluginsResult } from '../utils/detectEnabledPlugins.js';
11
- //# sourceMappingURL=management.d.ts.map
@@ -7,5 +7,3 @@
7
7
  export { SecurityNavLinks, TwoFactorManagementClient, ApiKeysManagementClient, PasskeysManagementClient } from '../components/management/index.js';
8
8
  // Re-export plugin detection utility
9
9
  export { detectEnabledPlugins } from '../utils/detectEnabledPlugins.js';
10
-
11
- //# sourceMappingURL=management.js.map
@@ -8,4 +8,3 @@ export { LoginViewWrapper } from '../components/LoginViewWrapper.js';
8
8
  export { TwoFactorView } from '../components/management/views/TwoFactorView.js';
9
9
  export { ApiKeysView } from '../components/management/views/ApiKeysView.js';
10
10
  export { PasskeysView } from '../components/management/views/PasskeysView.js';
11
- //# sourceMappingURL=rsc.d.ts.map
@@ -7,5 +7,3 @@
7
7
  export { TwoFactorView } from '../components/management/views/TwoFactorView.js';
8
8
  export { ApiKeysView } from '../components/management/views/ApiKeysView.js';
9
9
  export { PasskeysView } from '../components/management/views/PasskeysView.js';
10
-
11
- //# sourceMappingURL=rsc.js.map
@@ -230,4 +230,3 @@ export type BetterAuthFullSchema = {
230
230
  * Union of all model names in the schema.
231
231
  */
232
232
  export type ModelKey = keyof BetterAuthFullSchema;
233
- //# sourceMappingURL=generated-types.d.ts.map
@@ -7,5 +7,3 @@
7
7
  */ /**
8
8
  * Union of all model names in the schema.
9
9
  */ export { };
10
-
11
- //# sourceMappingURL=generated-types.js.map
package/dist/index.d.ts CHANGED
@@ -27,4 +27,3 @@ export type { Session } from './utils/session.js';
27
27
  export { firstUserAdminHooks } from './utils/firstUserAdmin.js';
28
28
  export type { FirstUserAdminOptions } from './utils/firstUserAdmin.js';
29
29
  export { withBetterAuthDefaults, apiKeyWithDefaults } from './utils/betterAuthDefaults.js';
30
- //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -25,5 +25,3 @@ export { getServerSession, getServerUser } from './utils/session.js';
25
25
  export { firstUserAdminHooks } from './utils/firstUserAdmin.js';
26
26
  // Better Auth defaults utility
27
27
  export { withBetterAuthDefaults, apiKeyWithDefaults } from './utils/betterAuthDefaults.js';
28
-
29
- //# sourceMappingURL=index.js.map
@@ -220,4 +220,3 @@ export declare function betterAuthStrategy(options?: BetterAuthStrategyOptions):
220
220
  * Reset the auth instance (useful for testing)
221
221
  */
222
222
  export declare function resetAuthInstance(): void;
223
- //# sourceMappingURL=index.d.ts.map
@@ -553,5 +553,3 @@ let apiKeyScopesConfig = undefined;
553
553
  */ export function resetAuthInstance() {
554
554
  authInstance = null;
555
555
  }
556
-
557
- //# sourceMappingURL=index.js.map
@@ -7,4 +7,3 @@
7
7
  * Run with: pnpm generate:types
8
8
  */
9
9
  export {};
10
- //# sourceMappingURL=generate-types.d.ts.map
@@ -226,5 +226,3 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url));
226
226
  const outputFile = path.resolve(__dirname, '../generated-types.ts');
227
227
  await fs.writeFile(outputFile, generated, 'utf8');
228
228
  console.log(`Generated types written to ${outputFile}`);
229
-
230
- //# sourceMappingURL=generate-types.js.map
@@ -58,4 +58,3 @@ export type AvailableScope = ScopeDefinition & {
58
58
  /** The scope ID (e.g., 'content:read') */
59
59
  id: string;
60
60
  };
61
- //# sourceMappingURL=apiKey.d.ts.map
@@ -8,5 +8,3 @@
8
8
  */ /**
9
9
  * Scope data passed to the API keys management client component.
10
10
  */ export { };
11
-
12
- //# sourceMappingURL=apiKey.js.map
@@ -189,4 +189,3 @@ export type EndpointWithBetterAuth<O extends BetterAuthOptions> = Omit<Endpoint,
189
189
  handler: (req: PayloadRequestWithBetterAuth<O>) => Promise<Response> | Response;
190
190
  };
191
191
  export {};
192
- //# sourceMappingURL=betterAuth.d.ts.map
@@ -25,5 +25,3 @@
25
25
  * }
26
26
  * ```
27
27
  */ export { };
28
-
29
- //# sourceMappingURL=betterAuth.js.map