better-auth 1.1.15 → 1.1.16-beta.2

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 (97) hide show
  1. package/dist/adapters/drizzle.d.cts +3 -3
  2. package/dist/adapters/drizzle.d.ts +3 -3
  3. package/dist/adapters/kysely.d.cts +3 -3
  4. package/dist/adapters/kysely.d.ts +3 -3
  5. package/dist/adapters/memory.d.cts +3 -3
  6. package/dist/adapters/memory.d.ts +3 -3
  7. package/dist/adapters/mongodb.d.cts +3 -3
  8. package/dist/adapters/mongodb.d.ts +3 -3
  9. package/dist/adapters/prisma.d.cts +3 -3
  10. package/dist/adapters/prisma.d.ts +3 -3
  11. package/dist/adapters/test.d.cts +3 -3
  12. package/dist/adapters/test.d.ts +3 -3
  13. package/dist/api.d.cts +3 -3
  14. package/dist/api.d.ts +3 -3
  15. package/dist/{auth-B1VtL9l_.d.cts → auth-BeJz3pJl.d.ts} +122 -11
  16. package/dist/{auth-o42_VXAs.d.ts → auth-BhxKOGFX.d.cts} +122 -11
  17. package/dist/{chunk-OC5UM5IR.js → chunk-ESO5YY5U.js} +4 -1
  18. package/dist/{chunk-5HQLYV4W.cjs → chunk-VLEDK7YA.cjs} +4 -1
  19. package/dist/client/plugins.d.cts +4 -4
  20. package/dist/client/plugins.d.ts +4 -4
  21. package/dist/client.d.cts +3 -3
  22. package/dist/client.d.ts +3 -3
  23. package/dist/cookies.d.cts +3 -3
  24. package/dist/cookies.d.ts +3 -3
  25. package/dist/db.d.cts +4 -4
  26. package/dist/db.d.ts +4 -4
  27. package/dist/{helper-Bi8FQwDD.d.cts → helper-DH9-LqKX.d.cts} +2 -2
  28. package/dist/{helper-Bi8FQwDD.d.ts → helper-DH9-LqKX.d.ts} +2 -2
  29. package/dist/{index-Y--3ocl8.d.ts → index-AHkEi8zV.d.ts} +1 -1
  30. package/dist/{index-CvhU_ZIM.d.cts → index-BaUkFaos.d.cts} +2 -2
  31. package/dist/{index-IbeXrsdr.d.cts → index-C_vn4Wrp.d.cts} +1 -1
  32. package/dist/{index-DuiTiM3G.d.ts → index-Cy7N_c9V.d.ts} +2 -2
  33. package/dist/index.d.cts +4 -4
  34. package/dist/index.d.ts +4 -4
  35. package/dist/next-js.d.cts +3 -3
  36. package/dist/next-js.d.ts +3 -3
  37. package/dist/node.d.cts +3 -3
  38. package/dist/node.d.ts +3 -3
  39. package/dist/oauth2.d.cts +5 -5
  40. package/dist/oauth2.d.ts +5 -5
  41. package/dist/plugin/custom-session.d.cts +3 -3
  42. package/dist/plugin/custom-session.d.ts +3 -3
  43. package/dist/plugins/access.d.cts +1 -1
  44. package/dist/plugins/access.d.ts +1 -1
  45. package/dist/plugins/admin.d.cts +3 -3
  46. package/dist/plugins/admin.d.ts +3 -3
  47. package/dist/plugins/anonymous.d.cts +3 -3
  48. package/dist/plugins/anonymous.d.ts +3 -3
  49. package/dist/plugins/bearer.cjs +2 -2
  50. package/dist/plugins/bearer.d.cts +3 -3
  51. package/dist/plugins/bearer.d.ts +3 -3
  52. package/dist/plugins/bearer.js +1 -1
  53. package/dist/plugins/email-otp.d.cts +3 -3
  54. package/dist/plugins/email-otp.d.ts +3 -3
  55. package/dist/plugins/generic-oauth.d.cts +3 -3
  56. package/dist/plugins/generic-oauth.d.ts +3 -3
  57. package/dist/plugins/jwt.d.cts +3 -3
  58. package/dist/plugins/jwt.d.ts +3 -3
  59. package/dist/plugins/multi-session.d.cts +3 -3
  60. package/dist/plugins/multi-session.d.ts +3 -3
  61. package/dist/plugins/oidc-provider.d.cts +3 -3
  62. package/dist/plugins/oidc-provider.d.ts +3 -3
  63. package/dist/plugins/open-api.d.cts +3 -3
  64. package/dist/plugins/open-api.d.ts +3 -3
  65. package/dist/plugins/organization.d.cts +4 -4
  66. package/dist/plugins/organization.d.ts +4 -4
  67. package/dist/plugins/passkey.d.cts +3 -3
  68. package/dist/plugins/passkey.d.ts +3 -3
  69. package/dist/plugins/phone-number.d.cts +3 -3
  70. package/dist/plugins/phone-number.d.ts +3 -3
  71. package/dist/plugins/sso.d.cts +3 -3
  72. package/dist/plugins/sso.d.ts +3 -3
  73. package/dist/plugins/two-factor.d.cts +3 -3
  74. package/dist/plugins/two-factor.d.ts +3 -3
  75. package/dist/plugins/username.d.cts +3 -3
  76. package/dist/plugins/username.d.ts +3 -3
  77. package/dist/plugins.cjs +2 -2
  78. package/dist/plugins.d.cts +5 -5
  79. package/dist/plugins.d.ts +5 -5
  80. package/dist/plugins.js +1 -1
  81. package/dist/react.d.cts +3 -3
  82. package/dist/react.d.ts +3 -3
  83. package/dist/social.d.cts +2 -2
  84. package/dist/social.d.ts +2 -2
  85. package/dist/solid.d.cts +3 -3
  86. package/dist/solid.d.ts +3 -3
  87. package/dist/{state-Dtin-sFo.d.ts → state-LRRP8rLX.d.ts} +1 -1
  88. package/dist/{state-6Eae7Wge.d.cts → state-lKhv648n.d.cts} +1 -1
  89. package/dist/svelte-kit.d.cts +3 -3
  90. package/dist/svelte-kit.d.ts +3 -3
  91. package/dist/svelte.d.cts +3 -3
  92. package/dist/svelte.d.ts +3 -3
  93. package/dist/types.d.cts +5 -5
  94. package/dist/types.d.ts +5 -5
  95. package/dist/vue.d.cts +3 -3
  96. package/dist/vue.d.ts +3 -3
  97. package/package.json +1 -1
@@ -1,9 +1,9 @@
1
- import { B as BetterAuthOptions, W as Where } from '../auth-B1VtL9l_.cjs';
1
+ import { B as BetterAuthOptions, W as Where } from '../auth-BhxKOGFX.cjs';
2
2
  import 'kysely';
3
3
  import 'better-call';
4
4
  import 'zod';
5
- import '../helper-Bi8FQwDD.cjs';
6
- import '../index-IbeXrsdr.cjs';
5
+ import '../helper-DH9-LqKX.cjs';
6
+ import '../index-C_vn4Wrp.cjs';
7
7
  import 'jose';
8
8
  import 'better-sqlite3';
9
9
 
@@ -1,9 +1,9 @@
1
- import { B as BetterAuthOptions, W as Where } from '../auth-o42_VXAs.js';
1
+ import { B as BetterAuthOptions, W as Where } from '../auth-BeJz3pJl.js';
2
2
  import 'kysely';
3
3
  import 'better-call';
4
4
  import 'zod';
5
- import '../helper-Bi8FQwDD.js';
6
- import '../index-Y--3ocl8.js';
5
+ import '../helper-DH9-LqKX.js';
6
+ import '../index-AHkEi8zV.js';
7
7
  import 'jose';
8
8
  import 'better-sqlite3';
9
9
 
@@ -1,9 +1,9 @@
1
1
  import { Kysely } from 'kysely';
2
- import { B as BetterAuthOptions, K as KyselyDatabaseType, W as Where } from '../auth-B1VtL9l_.cjs';
2
+ import { B as BetterAuthOptions, K as KyselyDatabaseType, W as Where } from '../auth-BhxKOGFX.cjs';
3
3
  import 'better-call';
4
4
  import 'zod';
5
- import '../helper-Bi8FQwDD.cjs';
6
- import '../index-IbeXrsdr.cjs';
5
+ import '../helper-DH9-LqKX.cjs';
6
+ import '../index-C_vn4Wrp.cjs';
7
7
  import 'jose';
8
8
  import 'better-sqlite3';
9
9
 
@@ -1,9 +1,9 @@
1
1
  import { Kysely } from 'kysely';
2
- import { B as BetterAuthOptions, K as KyselyDatabaseType, W as Where } from '../auth-o42_VXAs.js';
2
+ import { B as BetterAuthOptions, K as KyselyDatabaseType, W as Where } from '../auth-BeJz3pJl.js';
3
3
  import 'better-call';
4
4
  import 'zod';
5
- import '../helper-Bi8FQwDD.js';
6
- import '../index-Y--3ocl8.js';
5
+ import '../helper-DH9-LqKX.js';
6
+ import '../index-AHkEi8zV.js';
7
7
  import 'jose';
8
8
  import 'better-sqlite3';
9
9
 
@@ -1,9 +1,9 @@
1
- import { B as BetterAuthOptions, W as Where } from '../auth-B1VtL9l_.cjs';
1
+ import { B as BetterAuthOptions, W as Where } from '../auth-BhxKOGFX.cjs';
2
2
  import 'kysely';
3
3
  import 'better-call';
4
4
  import 'zod';
5
- import '../helper-Bi8FQwDD.cjs';
6
- import '../index-IbeXrsdr.cjs';
5
+ import '../helper-DH9-LqKX.cjs';
6
+ import '../index-C_vn4Wrp.cjs';
7
7
  import 'jose';
8
8
  import 'better-sqlite3';
9
9
 
@@ -1,9 +1,9 @@
1
- import { B as BetterAuthOptions, W as Where } from '../auth-o42_VXAs.js';
1
+ import { B as BetterAuthOptions, W as Where } from '../auth-BeJz3pJl.js';
2
2
  import 'kysely';
3
3
  import 'better-call';
4
4
  import 'zod';
5
- import '../helper-Bi8FQwDD.js';
6
- import '../index-Y--3ocl8.js';
5
+ import '../helper-DH9-LqKX.js';
6
+ import '../index-AHkEi8zV.js';
7
7
  import 'jose';
8
8
  import 'better-sqlite3';
9
9
 
@@ -1,10 +1,10 @@
1
1
  import { Db } from 'mongodb';
2
- import { B as BetterAuthOptions, W as Where } from '../auth-B1VtL9l_.cjs';
2
+ import { B as BetterAuthOptions, W as Where } from '../auth-BhxKOGFX.cjs';
3
3
  import 'kysely';
4
4
  import 'better-call';
5
5
  import 'zod';
6
- import '../helper-Bi8FQwDD.cjs';
7
- import '../index-IbeXrsdr.cjs';
6
+ import '../helper-DH9-LqKX.cjs';
7
+ import '../index-C_vn4Wrp.cjs';
8
8
  import 'jose';
9
9
  import 'better-sqlite3';
10
10
 
@@ -1,10 +1,10 @@
1
1
  import { Db } from 'mongodb';
2
- import { B as BetterAuthOptions, W as Where } from '../auth-o42_VXAs.js';
2
+ import { B as BetterAuthOptions, W as Where } from '../auth-BeJz3pJl.js';
3
3
  import 'kysely';
4
4
  import 'better-call';
5
5
  import 'zod';
6
- import '../helper-Bi8FQwDD.js';
7
- import '../index-Y--3ocl8.js';
6
+ import '../helper-DH9-LqKX.js';
7
+ import '../index-AHkEi8zV.js';
8
8
  import 'jose';
9
9
  import 'better-sqlite3';
10
10
 
@@ -1,9 +1,9 @@
1
- import { B as BetterAuthOptions, W as Where } from '../auth-B1VtL9l_.cjs';
1
+ import { B as BetterAuthOptions, W as Where } from '../auth-BhxKOGFX.cjs';
2
2
  import 'kysely';
3
3
  import 'better-call';
4
4
  import 'zod';
5
- import '../helper-Bi8FQwDD.cjs';
6
- import '../index-IbeXrsdr.cjs';
5
+ import '../helper-DH9-LqKX.cjs';
6
+ import '../index-C_vn4Wrp.cjs';
7
7
  import 'jose';
8
8
  import 'better-sqlite3';
9
9
 
@@ -1,9 +1,9 @@
1
- import { B as BetterAuthOptions, W as Where } from '../auth-o42_VXAs.js';
1
+ import { B as BetterAuthOptions, W as Where } from '../auth-BeJz3pJl.js';
2
2
  import 'kysely';
3
3
  import 'better-call';
4
4
  import 'zod';
5
- import '../helper-Bi8FQwDD.js';
6
- import '../index-Y--3ocl8.js';
5
+ import '../helper-DH9-LqKX.js';
6
+ import '../index-AHkEi8zV.js';
7
7
  import 'jose';
8
8
  import 'better-sqlite3';
9
9
 
@@ -1,9 +1,9 @@
1
- import { B as BetterAuthOptions, A as Adapter } from '../auth-B1VtL9l_.cjs';
1
+ import { B as BetterAuthOptions, A as Adapter } from '../auth-BhxKOGFX.cjs';
2
2
  import 'kysely';
3
3
  import 'better-call';
4
4
  import 'zod';
5
- import '../helper-Bi8FQwDD.cjs';
6
- import '../index-IbeXrsdr.cjs';
5
+ import '../helper-DH9-LqKX.cjs';
6
+ import '../index-C_vn4Wrp.cjs';
7
7
  import 'jose';
8
8
  import 'better-sqlite3';
9
9
 
@@ -1,9 +1,9 @@
1
- import { B as BetterAuthOptions, A as Adapter } from '../auth-o42_VXAs.js';
1
+ import { B as BetterAuthOptions, A as Adapter } from '../auth-BeJz3pJl.js';
2
2
  import 'kysely';
3
3
  import 'better-call';
4
4
  import 'zod';
5
- import '../helper-Bi8FQwDD.js';
6
- import '../index-Y--3ocl8.js';
5
+ import '../helper-DH9-LqKX.js';
6
+ import '../index-AHkEi8zV.js';
7
7
  import 'jose';
8
8
  import 'better-sqlite3';
9
9
 
package/dist/api.d.cts CHANGED
@@ -1,8 +1,8 @@
1
- export { i as AuthEndpoint, j as AuthMiddleware, aD as callbackOAuth, aZ as changeEmail, aV as changePassword, h as createAuthEndpoint, g as createAuthMiddleware, aQ as createEmailVerificationToken, aX as deleteUser, aY as deleteUserCallback, a_ as error, aN as forgetPassword, aO as forgetPasswordCallback, aH as freshSessionMiddleware, az as getEndpoints, aE as getSession, aF as getSessionFromCtx, b2 as linkSocialAccount, aI as listSessions, b1 as listUserAccounts, a$ as ok, o as optionsMiddleware, b5 as originCheck, b4 as originCheckMiddleware, aP as resetPassword, aL as revokeOtherSessions, aJ as revokeSession, aK as revokeSessions, aA as router, aS as sendVerificationEmail, aR as sendVerificationEmailFn, aG as sessionMiddleware, aW as setPassword, aC as signInEmail, aB as signInSocial, aM as signOut, b0 as signUpEmail, b3 as unlinkAccount, aU as updateUser, aT as verifyEmail } from './auth-B1VtL9l_.cjs';
2
- import './helper-Bi8FQwDD.cjs';
1
+ export { i as AuthEndpoint, j as AuthMiddleware, aC as callbackOAuth, aY as changeEmail, aU as changePassword, h as createAuthEndpoint, g as createAuthMiddleware, aP as createEmailVerificationToken, aW as deleteUser, aX as deleteUserCallback, aZ as error, aM as forgetPassword, aN as forgetPasswordCallback, aG as freshSessionMiddleware, ay as getEndpoints, aD as getSession, aE as getSessionFromCtx, b1 as linkSocialAccount, aH as listSessions, b0 as listUserAccounts, a_ as ok, o as optionsMiddleware, b4 as originCheck, b3 as originCheckMiddleware, aO as resetPassword, aK as revokeOtherSessions, aI as revokeSession, aJ as revokeSessions, az as router, aR as sendVerificationEmail, aQ as sendVerificationEmailFn, aF as sessionMiddleware, aV as setPassword, aB as signInEmail, aA as signInSocial, aL as signOut, a$ as signUpEmail, b2 as unlinkAccount, aT as updateUser, aS as verifyEmail } from './auth-BhxKOGFX.cjs';
2
+ import './helper-DH9-LqKX.cjs';
3
3
  export { APIError } from 'better-call';
4
4
  import 'zod';
5
5
  import 'kysely';
6
- import './index-IbeXrsdr.cjs';
6
+ import './index-C_vn4Wrp.cjs';
7
7
  import 'jose';
8
8
  import 'better-sqlite3';
package/dist/api.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- export { i as AuthEndpoint, j as AuthMiddleware, aD as callbackOAuth, aZ as changeEmail, aV as changePassword, h as createAuthEndpoint, g as createAuthMiddleware, aQ as createEmailVerificationToken, aX as deleteUser, aY as deleteUserCallback, a_ as error, aN as forgetPassword, aO as forgetPasswordCallback, aH as freshSessionMiddleware, az as getEndpoints, aE as getSession, aF as getSessionFromCtx, b2 as linkSocialAccount, aI as listSessions, b1 as listUserAccounts, a$ as ok, o as optionsMiddleware, b5 as originCheck, b4 as originCheckMiddleware, aP as resetPassword, aL as revokeOtherSessions, aJ as revokeSession, aK as revokeSessions, aA as router, aS as sendVerificationEmail, aR as sendVerificationEmailFn, aG as sessionMiddleware, aW as setPassword, aC as signInEmail, aB as signInSocial, aM as signOut, b0 as signUpEmail, b3 as unlinkAccount, aU as updateUser, aT as verifyEmail } from './auth-o42_VXAs.js';
2
- import './helper-Bi8FQwDD.js';
1
+ export { i as AuthEndpoint, j as AuthMiddleware, aC as callbackOAuth, aY as changeEmail, aU as changePassword, h as createAuthEndpoint, g as createAuthMiddleware, aP as createEmailVerificationToken, aW as deleteUser, aX as deleteUserCallback, aZ as error, aM as forgetPassword, aN as forgetPasswordCallback, aG as freshSessionMiddleware, ay as getEndpoints, aD as getSession, aE as getSessionFromCtx, b1 as linkSocialAccount, aH as listSessions, b0 as listUserAccounts, a_ as ok, o as optionsMiddleware, b4 as originCheck, b3 as originCheckMiddleware, aO as resetPassword, aK as revokeOtherSessions, aI as revokeSession, aJ as revokeSessions, az as router, aR as sendVerificationEmail, aQ as sendVerificationEmailFn, aF as sessionMiddleware, aV as setPassword, aB as signInEmail, aA as signInSocial, aL as signOut, a$ as signUpEmail, b2 as unlinkAccount, aT as updateUser, aS as verifyEmail } from './auth-BeJz3pJl.js';
2
+ import './helper-DH9-LqKX.js';
3
3
  export { APIError } from 'better-call';
4
4
  import 'zod';
5
5
  import 'kysely';
6
- import './index-Y--3ocl8.js';
6
+ import './index-AHkEi8zV.js';
7
7
  import 'jose';
8
8
  import 'better-sqlite3';
@@ -3,8 +3,8 @@ import * as better_call from 'better-call';
3
3
  import { Endpoint, EndpointResponse, APIError, CookieOptions, ContextTools, EndpointOptions } from 'better-call';
4
4
  import * as zod from 'zod';
5
5
  import { ZodSchema, z } from 'zod';
6
- import { L as LiteralString, D as DeepPartial, U as UnionToIntersection, S as StripEmptyObjects, O as OmitId, d as LiteralUnion, P as PrettifyDeep, b as Prettify, E as Expand } from './helper-Bi8FQwDD.cjs';
7
- import { S as SocialProviders, b as SocialProviderList, O as OAuthProvider } from './index-IbeXrsdr.cjs';
6
+ import { L as LiteralString, D as DeepPartial, U as UnionToIntersection, S as StripEmptyObjects, O as OmitId, d as LiteralUnion, P as PrettifyDeep, b as Prettify, E as Expand } from './helper-DH9-LqKX.js';
7
+ import { S as SocialProviders, b as SocialProviderList, O as OAuthProvider } from './index-AHkEi8zV.js';
8
8
  import { Database } from 'better-sqlite3';
9
9
 
10
10
  declare const optionsMiddleware: Endpoint<better_call.Handler<string, better_call.EndpointOptions, AuthContext>, better_call.EndpointOptions>;
@@ -893,17 +893,17 @@ type BetterAuthOptions = {
893
893
  */
894
894
  enabled: boolean;
895
895
  /**
896
- * Require email verification before a session
897
- * can be created for the user.
896
+ * Require email verification before creating a session.
898
897
  *
899
- * if the user is not verified, the user will not be able to sign in
900
- * and on sign in attempts, the user will be prompted to verify their email.
898
+ * if enabled, the user must verify their email before they can signin.
899
+ * And on sign in attempts, `sendVerificationEmail` will be called, to
900
+ * send the user email verification token.
901
901
  */
902
902
  requireEmailVerification?: boolean;
903
903
  /**
904
904
  * The maximum length of the password.
905
905
  *
906
- * @default 128
906
+ * @default 32
907
907
  */
908
908
  maxPasswordLength?: number;
909
909
  /**
@@ -935,6 +935,7 @@ type BetterAuthOptions = {
935
935
  /**
936
936
  * Number of seconds the reset password token is
937
937
  * valid for.
938
+ *
938
939
  * @default 1 hour (60 * 60)
939
940
  */
940
941
  resetPasswordTokenExpiresIn?: number;
@@ -974,19 +975,56 @@ type BetterAuthOptions = {
974
975
  * The model name for the user. Defaults to "user".
975
976
  */
976
977
  modelName?: string;
978
+ /**
979
+ * Map core fields to different fields in your database.
980
+ * It does not affect the actual type, it just changes the mapping
981
+ * to your database.
982
+ *
983
+ * @example
984
+ *
985
+ * ```ts
986
+ * fields: {
987
+ * name: "display_name",
988
+ * email: "email_address"
989
+ * }
990
+ * ```
991
+ *
992
+ * NB: If you're using adapter, you may want to provide they `key`
993
+ * of the field in your orm rather than the actual field in your database.
994
+ */
977
995
  fields?: Partial<Record<keyof OmitId<User>, string>>;
978
996
  /**
979
997
  * Additional fields for the session
998
+ *
999
+ * @example
1000
+ * ```ts
1001
+ * additionalFields: {
1002
+ * plan: {
1003
+ * type: "string",
1004
+ * defaultValue: "free"
1005
+ * },
1006
+ * role: {
1007
+ * type: ["super-admin", "user"],
1008
+ * required: false,
1009
+ * input: false
1010
+ * }
1011
+ * }
1012
+ * ```
1013
+ *
1014
+ * @see https://www.better-auth.com/docs/concepts/database#extending-core-schema
980
1015
  */
981
1016
  additionalFields?: {
982
1017
  [key: string]: FieldAttribute;
983
1018
  };
984
1019
  /**
985
1020
  * Changing email configuration
1021
+ *
1022
+ * @see https://www.better-auth.com/docs/concepts/users-accounts#change-email
986
1023
  */
987
1024
  changeEmail?: {
988
1025
  /**
989
1026
  * Enable changing email
1027
+ *
990
1028
  * @default false
991
1029
  */
992
1030
  enabled: boolean;
@@ -1044,7 +1082,9 @@ type BetterAuthOptions = {
1044
1082
  */
1045
1083
  modelName?: string;
1046
1084
  /**
1047
- * Map fields
1085
+ * Map core fields to different fields in your database.
1086
+ * It does not affect the actual type, it just changes the mapping
1087
+ * to your database.
1048
1088
  *
1049
1089
  * @example
1050
1090
  * ```ts
@@ -1124,9 +1164,33 @@ type BetterAuthOptions = {
1124
1164
  */
1125
1165
  freshAge?: number;
1126
1166
  };
1167
+ /**
1168
+ * Account configuration
1169
+ */
1127
1170
  account?: {
1171
+ /**
1172
+ * Model name for account table
1173
+ *
1174
+ * @default "account"
1175
+ */
1128
1176
  modelName?: string;
1177
+ /**
1178
+ * Map core fields to different fields in your database.
1179
+ * It does not affect the actual type, it just changes the mapping
1180
+ * to your database.
1181
+ *
1182
+ * @example
1183
+ * ```ts
1184
+ * {
1185
+ * userId: "user_id"
1186
+ * }
1187
+ */
1129
1188
  fields?: Partial<Record<keyof OmitId<Account>, string>>;
1189
+ /**
1190
+ * Account Linking Configuration
1191
+ *
1192
+ * @see https://www.better-auth.com/docs/concepts/users-accounts#account-linking
1193
+ */
1130
1194
  accountLinking?: {
1131
1195
  /**
1132
1196
  * Enable account linking
@@ -1136,6 +1200,14 @@ type BetterAuthOptions = {
1136
1200
  enabled?: boolean;
1137
1201
  /**
1138
1202
  * List of trusted providers
1203
+ *
1204
+ * When a user logs in using a trusted provider, their account will be automatically
1205
+ * linked even if the provider doesn’t confirm the email verification status.
1206
+ *
1207
+ * @example
1208
+ * ```ts
1209
+ * trustedProviders: ["github", "google"]
1210
+ * ```
1139
1211
  */
1140
1212
  trustedProviders?: Array<LiteralUnion<SocialProviderList[number] | "email-password", string>>;
1141
1213
  /**
@@ -1152,15 +1224,42 @@ type BetterAuthOptions = {
1152
1224
  * Verification configuration
1153
1225
  */
1154
1226
  verification?: {
1227
+ /**
1228
+ * Model name for verification table
1229
+ *
1230
+ * @default "verification"
1231
+ */
1155
1232
  modelName?: string;
1233
+ /**
1234
+ * Map core fields to different fields in your database.
1235
+ * It does not affect the actual type, it just changes the mapping
1236
+ * to your database.
1237
+ *
1238
+ * @example
1239
+ * ```ts
1240
+ * {
1241
+ * expiresAt: "expires"
1242
+ * }
1243
+ */
1156
1244
  fields?: Partial<Record<keyof OmitId<Verification>, string>>;
1157
1245
  };
1158
1246
  /**
1159
1247
  * List of trusted origins.
1248
+ *
1249
+ * Trusted origins prevent CSRF attacks and block open redirects. The server url is trusted
1250
+ * by default but any other request from a different origin, if it contains cookie or if it's
1251
+ * provided as a callback url the request will be blocked.
1252
+ *
1253
+ * @example
1254
+ * ```ts
1255
+ * trustedOrigins: ["http://localhost:3000", process.env.FRONTEND_URL]
1256
+ * ```
1160
1257
  */
1161
1258
  trustedOrigins?: string[];
1162
1259
  /**
1163
1260
  * Rate limiting configuration
1261
+ *
1262
+ * @see https://www.better-auth.com/docs/concepts/rate-limit
1164
1263
  */
1165
1264
  rateLimit?: {
1166
1265
  /**
@@ -1299,6 +1398,9 @@ type BetterAuthOptions = {
1299
1398
  attributes?: CookieOptions;
1300
1399
  };
1301
1400
  };
1401
+ /**
1402
+ * Default cookie that's applied to all cookies assigned by Better Auth
1403
+ */
1302
1404
  defaultCookieAttributes?: CookieOptions;
1303
1405
  /**
1304
1406
  * Prefix for cookies. If a cookie name is provided
@@ -1321,6 +1423,9 @@ type BetterAuthOptions = {
1321
1423
  size?: number;
1322
1424
  }) => string) | false;
1323
1425
  };
1426
+ /**
1427
+ * Customize Logger
1428
+ */
1324
1429
  logger?: Logger;
1325
1430
  /**
1326
1431
  * allows you to define custom hooks that can be
@@ -10677,8 +10782,14 @@ declare const BASE_ERROR_CODES: {
10677
10782
  ACCOUNT_NOT_FOUND: string;
10678
10783
  };
10679
10784
 
10680
- type WithJsDoc<T, D> = Expand<T & D>;
10681
- declare const betterAuth: <O extends BetterAuthOptions>(options: O) => {
10785
+ /**
10786
+ * Creates a better auth instance
10787
+ *
10788
+ * @template O - The type extending `BetterAuthOptions`
10789
+ * @param {O} options - Configuration options for authentication.
10790
+ * @returns The authentication instance.
10791
+ */
10792
+ declare const betterAuth: <O extends BetterAuthOptions>(options: Expand<O>) => {
10682
10793
  handler: (request: Request) => Promise<Response>;
10683
10794
  api: InferAPI<{
10684
10795
  ok: {
@@ -13514,4 +13625,4 @@ type Auth = {
13514
13625
  $ERROR_CODES: typeof BASE_ERROR_CODES;
13515
13626
  };
13516
13627
 
13517
- export { levels as $, type Adapter as A, type BetterAuthOptions as B, type SecondaryStorage as C, type FilterActions as D, type InferSessionAPI as E, type FilteredAPI as F, type GenericEndpointContext as G, type HookEndpointContext as H, type InferOptionSchema as I, type InferAPI as J, type KyselyDatabaseType as K, createCookieGetter as L, type Models as M, getCookies as N, type BetterAuthCookies as O, setCookieCache as P, setSessionCookie as Q, type RateLimit as R, type Session as S, deleteSessionCookie as T, type User as U, type Verification as V, type Where as W, parseCookies as X, type EligibleCookies as Y, parseSetCookieHeader as Z, type LogLevel as _, BASE_ERROR_CODES as a, ok as a$, shouldPublishLog as a0, type Logger as a1, type LogHandlerParams as a2, createLogger as a3, logger as a4, type FieldAttribute as a5, type FieldType as a6, createInternalAdapter as a7, type InternalAdapter as a8, type FieldAttributeConfig as a9, router as aA, signInSocial as aB, signInEmail as aC, callbackOAuth as aD, getSession as aE, getSessionFromCtx as aF, sessionMiddleware as aG, freshSessionMiddleware as aH, listSessions as aI, revokeSession as aJ, revokeSessions as aK, revokeOtherSessions as aL, signOut as aM, forgetPassword as aN, forgetPasswordCallback as aO, resetPassword as aP, createEmailVerificationToken as aQ, sendVerificationEmailFn as aR, sendVerificationEmail as aS, verifyEmail as aT, updateUser as aU, changePassword as aV, setPassword as aW, deleteUser as aX, deleteUserCallback as aY, changeEmail as aZ, error as a_, createFieldAttribute as aa, type InferValueType as ab, type InferFieldsOutput as ac, type InferFieldsInput as ad, type InferFieldsInputClient as ae, type PluginFieldAttribute as af, type InferFieldsFromPlugins as ag, type InferFieldsFromOptions as ah, type BetterAuthDbSchema as ai, getAuthTables as aj, accountSchema as ak, userSchema as al, sessionSchema as am, verificationSchema as an, parseOutputData as ao, getAllFields as ap, parseUserOutput as aq, parseAccountOutput as ar, parseSessionOutput as as, parseInputData as at, parseUserInput as au, parseAdditionalUserInput as av, parseAccountInput as aw, parseSessionInput as ax, mergeSchema as ay, getEndpoints as az, type AuthPluginSchema as b, signUpEmail as b0, listUserAccounts as b1, linkSocialAccount as b2, unlinkAccount as b3, originCheckMiddleware as b4, originCheck as b5, type HookBeforeHandler as c, type HookAfterHandler as d, type BetterAuthPlugin as e, type InferPluginErrorCodes as f, createAuthMiddleware as g, createAuthEndpoint as h, type AuthEndpoint as i, type AuthMiddleware as j, type Auth as k, type AuthContext as l, type InferUser as m, type InferSession as n, optionsMiddleware as o, type WithJsDoc as p, betterAuth as q, type AdditionalUserFieldsInput as r, type AdditionalUserFieldsOutput as s, type AdditionalSessionFieldsInput as t, type AdditionalSessionFieldsOutput as u, type InferPluginTypes as v, type Account as w, init as x, type AdapterSchemaCreation as y, type AdapterInstance as z };
13628
+ export { shouldPublishLog as $, type Adapter as A, type BetterAuthOptions as B, type FilterActions as C, type InferSessionAPI as D, type InferAPI as E, type FilteredAPI as F, type GenericEndpointContext as G, type HookEndpointContext as H, type InferOptionSchema as I, createCookieGetter as J, type KyselyDatabaseType as K, getCookies as L, type Models as M, type BetterAuthCookies as N, setCookieCache as O, setSessionCookie as P, deleteSessionCookie as Q, type RateLimit as R, type Session as S, parseCookies as T, type User as U, type Verification as V, type Where as W, type EligibleCookies as X, parseSetCookieHeader as Y, type LogLevel as Z, levels as _, BASE_ERROR_CODES as a, signUpEmail as a$, type Logger as a0, type LogHandlerParams as a1, createLogger as a2, logger as a3, type FieldAttribute as a4, type FieldType as a5, createInternalAdapter as a6, type InternalAdapter as a7, type FieldAttributeConfig as a8, createFieldAttribute as a9, signInSocial as aA, signInEmail as aB, callbackOAuth as aC, getSession as aD, getSessionFromCtx as aE, sessionMiddleware as aF, freshSessionMiddleware as aG, listSessions as aH, revokeSession as aI, revokeSessions as aJ, revokeOtherSessions as aK, signOut as aL, forgetPassword as aM, forgetPasswordCallback as aN, resetPassword as aO, createEmailVerificationToken as aP, sendVerificationEmailFn as aQ, sendVerificationEmail as aR, verifyEmail as aS, updateUser as aT, changePassword as aU, setPassword as aV, deleteUser as aW, deleteUserCallback as aX, changeEmail as aY, error as aZ, ok as a_, type InferValueType as aa, type InferFieldsOutput as ab, type InferFieldsInput as ac, type InferFieldsInputClient as ad, type PluginFieldAttribute as ae, type InferFieldsFromPlugins as af, type InferFieldsFromOptions as ag, type BetterAuthDbSchema as ah, getAuthTables as ai, accountSchema as aj, userSchema as ak, sessionSchema as al, verificationSchema as am, parseOutputData as an, getAllFields as ao, parseUserOutput as ap, parseAccountOutput as aq, parseSessionOutput as ar, parseInputData as as, parseUserInput as at, parseAdditionalUserInput as au, parseAccountInput as av, parseSessionInput as aw, mergeSchema as ax, getEndpoints as ay, router as az, type AuthPluginSchema as b, listUserAccounts as b0, linkSocialAccount as b1, unlinkAccount as b2, originCheckMiddleware as b3, originCheck as b4, type HookBeforeHandler as c, type HookAfterHandler as d, type BetterAuthPlugin as e, type InferPluginErrorCodes as f, createAuthMiddleware as g, createAuthEndpoint as h, type AuthEndpoint as i, type AuthMiddleware as j, type Auth as k, type AuthContext as l, type InferUser as m, type InferSession as n, optionsMiddleware as o, betterAuth as p, type AdditionalUserFieldsInput as q, type AdditionalUserFieldsOutput as r, type AdditionalSessionFieldsInput as s, type AdditionalSessionFieldsOutput as t, type InferPluginTypes as u, type Account as v, init as w, type AdapterSchemaCreation as x, type AdapterInstance as y, type SecondaryStorage as z };