better-auth 1.6.26 → 1.6.28

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 (210) hide show
  1. package/dist/adapters/index.d.mts +6 -1
  2. package/dist/api/dispatch.d.mts +1 -0
  3. package/dist/api/index.d.mts +508 -505
  4. package/dist/api/middlewares/authorization.d.mts +10 -14
  5. package/dist/api/middlewares/authorization.mjs +1 -2
  6. package/dist/api/middlewares/index.d.mts +1 -2
  7. package/dist/api/middlewares/origin-check.d.mts +5 -3
  8. package/dist/api/routes/account.d.mts +16 -13
  9. package/dist/api/routes/callback.d.mts +3 -1
  10. package/dist/api/routes/email-verification.d.mts +8 -4
  11. package/dist/api/routes/error.d.mts +3 -1
  12. package/dist/api/routes/index.d.mts +1 -2
  13. package/dist/api/routes/ok.d.mts +3 -1
  14. package/dist/api/routes/password.d.mts +10 -8
  15. package/dist/api/routes/session.d.mts +32 -30
  16. package/dist/api/routes/session.mjs +2 -3
  17. package/dist/api/routes/sign-in.d.mts +5 -3
  18. package/dist/api/routes/sign-out.d.mts +3 -1
  19. package/dist/api/routes/sign-up.d.mts +4 -3
  20. package/dist/api/routes/update-session.d.mts +5 -4
  21. package/dist/api/routes/update-user.d.mts +19 -18
  22. package/dist/auth/full.d.mts +1 -1
  23. package/dist/auth/minimal.d.mts +1 -1
  24. package/dist/client/config.d.mts +14 -12
  25. package/dist/client/config.mjs +2 -2
  26. package/dist/client/equality.d.mts +1 -0
  27. package/dist/client/index.d.mts +5 -6
  28. package/dist/client/lynx/index.d.mts +5 -4
  29. package/dist/client/lynx/lynx-store.d.mts +2 -1
  30. package/dist/client/parser.d.mts +3 -7
  31. package/dist/client/path-to-object.d.mts +4 -3
  32. package/dist/client/plugins/index.d.mts +1 -1
  33. package/dist/client/plugins/infer-plugin.d.mts +1 -0
  34. package/dist/client/query.d.mts +1 -0
  35. package/dist/client/react/index.d.mts +5 -4
  36. package/dist/client/react/react-store.d.mts +2 -1
  37. package/dist/client/session-atom.mjs +59 -46
  38. package/dist/client/session-refresh.d.mts +1 -0
  39. package/dist/client/solid/index.d.mts +5 -4
  40. package/dist/client/svelte/index.d.mts +5 -4
  41. package/dist/client/types.d.mts +2 -2
  42. package/dist/client/vanilla.d.mts +2 -1
  43. package/dist/client/vue/index.d.mts +5 -4
  44. package/dist/context/create-context.mjs +3 -3
  45. package/dist/context/helpers.mjs +2 -2
  46. package/dist/cookies/index.d.mts +7 -6
  47. package/dist/cookies/session-store.d.mts +0 -1
  48. package/dist/cookies/session-store.mjs +1 -2
  49. package/dist/crypto/index.d.mts +9 -2
  50. package/dist/crypto/jwt.d.mts +1 -0
  51. package/dist/crypto/password.d.mts +5 -1
  52. package/dist/db/adapter-base.d.mts +1 -0
  53. package/dist/db/adapter-kysely.d.mts +1 -0
  54. package/dist/db/field-converter.d.mts +1 -0
  55. package/dist/db/field.d.mts +10 -9
  56. package/dist/db/get-migration.d.mts +1 -0
  57. package/dist/db/get-schema.d.mts +1 -0
  58. package/dist/db/internal-adapter.d.mts +1 -0
  59. package/dist/db/internal-adapter.mjs +1 -2
  60. package/dist/db/revoke-unproven-account-access.d.mts +1 -0
  61. package/dist/db/schema.d.mts +2 -2
  62. package/dist/db/to-zod.d.mts +7 -3
  63. package/dist/db/with-hooks.d.mts +1 -0
  64. package/dist/index.d.mts +3 -4
  65. package/dist/integrations/next-js.d.mts +7 -4
  66. package/dist/integrations/node.d.mts +3 -2
  67. package/dist/integrations/svelte-kit.d.mts +9 -2
  68. package/dist/integrations/tanstack-start-solid.d.mts +5 -2
  69. package/dist/integrations/tanstack-start.d.mts +5 -2
  70. package/dist/oauth2/link-account.d.mts +1 -1
  71. package/dist/oauth2/state.d.mts +1 -0
  72. package/dist/oauth2/utils.d.mts +1 -0
  73. package/dist/package.mjs +1 -1
  74. package/dist/plugins/access/access.d.mts +1 -0
  75. package/dist/plugins/access/types.d.mts +5 -4
  76. package/dist/plugins/additional-fields/client.d.mts +1 -0
  77. package/dist/plugins/admin/access/statement.d.mts +0 -1
  78. package/dist/plugins/admin/admin.d.mts +137 -132
  79. package/dist/plugins/admin/client.d.mts +30 -30
  80. package/dist/plugins/admin/client.mjs +1 -1
  81. package/dist/plugins/admin/error-codes.d.mts +25 -23
  82. package/dist/plugins/admin/index.d.mts +1 -1
  83. package/dist/plugins/admin/schema.d.mts +1 -1
  84. package/dist/plugins/admin/types.d.mts +2 -3
  85. package/dist/plugins/anonymous/client.d.mts +11 -9
  86. package/dist/plugins/anonymous/client.mjs +1 -1
  87. package/dist/plugins/anonymous/error-codes.d.mts +10 -8
  88. package/dist/plugins/anonymous/index.d.mts +19 -15
  89. package/dist/plugins/anonymous/types.d.mts +1 -1
  90. package/dist/plugins/bearer/index.d.mts +8 -5
  91. package/dist/plugins/captcha/index.d.mts +8 -5
  92. package/dist/plugins/captcha/types.d.mts +1 -0
  93. package/dist/plugins/custom-session/client.d.mts +1 -0
  94. package/dist/plugins/custom-session/index.d.mts +12 -7
  95. package/dist/plugins/device-authorization/client.d.mts +1 -0
  96. package/dist/plugins/device-authorization/index.d.mts +22 -19
  97. package/dist/plugins/email-otp/client.d.mts +6 -4
  98. package/dist/plugins/email-otp/client.mjs +1 -1
  99. package/dist/plugins/email-otp/error-codes.d.mts +5 -3
  100. package/dist/plugins/email-otp/index.d.mts +76 -69
  101. package/dist/plugins/email-otp/types.d.mts +1 -0
  102. package/dist/plugins/generic-oauth/client.d.mts +11 -10
  103. package/dist/plugins/generic-oauth/client.mjs +1 -1
  104. package/dist/plugins/generic-oauth/error-codes.d.mts +10 -8
  105. package/dist/plugins/generic-oauth/index.d.mts +45 -41
  106. package/dist/plugins/generic-oauth/providers/auth0.d.mts +1 -0
  107. package/dist/plugins/generic-oauth/providers/gumroad.d.mts +1 -0
  108. package/dist/plugins/generic-oauth/providers/hubspot.d.mts +1 -0
  109. package/dist/plugins/generic-oauth/providers/index.d.mts +1 -2
  110. package/dist/plugins/generic-oauth/providers/keycloak.d.mts +1 -0
  111. package/dist/plugins/generic-oauth/providers/line.d.mts +1 -0
  112. package/dist/plugins/generic-oauth/providers/microsoft-entra-id.d.mts +1 -0
  113. package/dist/plugins/generic-oauth/providers/okta.d.mts +1 -0
  114. package/dist/plugins/generic-oauth/providers/patreon.d.mts +1 -0
  115. package/dist/plugins/generic-oauth/providers/slack.d.mts +1 -0
  116. package/dist/plugins/generic-oauth/providers/yandex.d.mts +1 -0
  117. package/dist/plugins/generic-oauth/types.d.mts +2 -1
  118. package/dist/plugins/haveibeenpwned/index.d.mts +6 -3
  119. package/dist/plugins/index.d.mts +1 -4
  120. package/dist/plugins/jwt/client.d.mts +2 -1
  121. package/dist/plugins/jwt/index.d.mts +12 -9
  122. package/dist/plugins/jwt/sign.d.mts +2 -2
  123. package/dist/plugins/jwt/types.d.mts +1 -1
  124. package/dist/plugins/jwt/utils.d.mts +4 -2
  125. package/dist/plugins/jwt/verify.d.mts +1 -0
  126. package/dist/plugins/last-login-method/index.d.mts +6 -3
  127. package/dist/plugins/magic-link/client.d.mts +1 -0
  128. package/dist/plugins/magic-link/index.d.mts +6 -4
  129. package/dist/plugins/mcp/client/adapters.d.mts +1 -0
  130. package/dist/plugins/mcp/client/index.mjs +2 -4
  131. package/dist/plugins/mcp/index.d.mts +12 -11
  132. package/dist/plugins/multi-session/client.d.mts +4 -2
  133. package/dist/plugins/multi-session/client.mjs +1 -1
  134. package/dist/plugins/multi-session/error-codes.d.mts +3 -1
  135. package/dist/plugins/multi-session/index.d.mts +12 -8
  136. package/dist/plugins/oauth-popup/client.d.mts +12 -6
  137. package/dist/plugins/oauth-popup/client.mjs +3 -5
  138. package/dist/plugins/oauth-popup/error-codes.d.mts +6 -4
  139. package/dist/plugins/oauth-popup/index.d.mts +12 -8
  140. package/dist/plugins/oauth-popup/index.mjs +1 -1
  141. package/dist/plugins/oauth-popup/types.d.mts +2 -1
  142. package/dist/plugins/oauth-proxy/index.d.mts +9 -6
  143. package/dist/plugins/oauth-proxy/index.mjs +2 -2
  144. package/dist/plugins/oidc-provider/client.d.mts +2 -1
  145. package/dist/plugins/oidc-provider/index.d.mts +20 -18
  146. package/dist/plugins/oidc-provider/schema.d.mts +1 -0
  147. package/dist/plugins/oidc-provider/types.d.mts +1 -1
  148. package/dist/plugins/one-tap/client.d.mts +3 -1
  149. package/dist/plugins/one-tap/index.d.mts +3 -1
  150. package/dist/plugins/one-time-token/client.d.mts +2 -1
  151. package/dist/plugins/one-time-token/index.d.mts +7 -6
  152. package/dist/plugins/open-api/generator.d.mts +1 -0
  153. package/dist/plugins/open-api/generator.mjs +5 -5
  154. package/dist/plugins/open-api/index.d.mts +5 -3
  155. package/dist/plugins/organization/access/statement.d.mts +0 -1
  156. package/dist/plugins/organization/adapter.d.mts +82 -56
  157. package/dist/plugins/organization/client.d.mts +103 -104
  158. package/dist/plugins/organization/client.mjs +4 -7
  159. package/dist/plugins/organization/error-codes.d.mts +61 -59
  160. package/dist/plugins/organization/has-permission.d.mts +1 -0
  161. package/dist/plugins/organization/has-permission.mjs +1 -1
  162. package/dist/plugins/organization/index.d.mts +1 -1
  163. package/dist/plugins/organization/organization.d.mts +33 -9
  164. package/dist/plugins/organization/organization.mjs +1 -1
  165. package/dist/plugins/organization/permission.d.mts +2 -2
  166. package/dist/plugins/organization/routes/crud-access-control.d.mts +147 -27
  167. package/dist/plugins/organization/routes/crud-invites.d.mts +186 -65
  168. package/dist/plugins/organization/routes/crud-invites.mjs +1 -1
  169. package/dist/plugins/organization/routes/crud-members.d.mts +178 -56
  170. package/dist/plugins/organization/routes/crud-members.mjs +1 -1
  171. package/dist/plugins/organization/routes/crud-org.d.mts +130 -57
  172. package/dist/plugins/organization/routes/crud-team.d.mts +235 -66
  173. package/dist/plugins/organization/schema.d.mts +4 -4
  174. package/dist/plugins/organization/schema.mjs +1 -1
  175. package/dist/plugins/organization/types.d.mts +14 -14
  176. package/dist/plugins/phone-number/client.d.mts +15 -13
  177. package/dist/plugins/phone-number/client.mjs +1 -1
  178. package/dist/plugins/phone-number/error-codes.d.mts +14 -12
  179. package/dist/plugins/phone-number/index.d.mts +47 -41
  180. package/dist/plugins/phone-number/types.d.mts +1 -1
  181. package/dist/plugins/siwe/client.d.mts +1 -0
  182. package/dist/plugins/siwe/index.d.mts +5 -4
  183. package/dist/plugins/test-utils/index.d.mts +4 -2
  184. package/dist/plugins/test-utils/types.d.mts +0 -1
  185. package/dist/plugins/two-factor/backup-codes/index.d.mts +7 -5
  186. package/dist/plugins/two-factor/backup-codes/index.mjs +1 -1
  187. package/dist/plugins/two-factor/client.d.mts +15 -12
  188. package/dist/plugins/two-factor/client.mjs +1 -1
  189. package/dist/plugins/two-factor/error-code.d.mts +12 -10
  190. package/dist/plugins/two-factor/index.d.mts +36 -32
  191. package/dist/plugins/two-factor/otp/index.d.mts +4 -2
  192. package/dist/plugins/two-factor/totp/index.d.mts +7 -5
  193. package/dist/plugins/two-factor/types.d.mts +1 -1
  194. package/dist/plugins/username/client.d.mts +11 -9
  195. package/dist/plugins/username/client.mjs +1 -1
  196. package/dist/plugins/username/error-codes.d.mts +10 -8
  197. package/dist/plugins/username/index.d.mts +22 -17
  198. package/dist/plugins/username/schema.d.mts +5 -3
  199. package/dist/state.d.mts +1 -0
  200. package/dist/test-utils/test-instance.d.mts +3 -5
  201. package/dist/types/adapter.d.mts +1 -1
  202. package/dist/types/api.d.mts +2 -1
  203. package/dist/types/auth.d.mts +1 -0
  204. package/dist/types/helper.d.mts +5 -5
  205. package/dist/types/index.d.mts +2 -2
  206. package/dist/types/models.d.mts +1 -0
  207. package/dist/types/plugins.d.mts +3 -2
  208. package/dist/utils/index.d.mts +1 -2
  209. package/dist/utils/url.d.mts +1 -0
  210. package/package.json +12 -11
@@ -4,7 +4,11 @@ import { TOTPOptions, totp2fa } from "./totp/index.mjs";
4
4
  import { TwoFactorOptions, TwoFactorProvider, TwoFactorTable, UserWithTwoFactor } from "./types.mjs";
5
5
  import { TWO_FACTOR_ERROR_CODES } from "./error-code.mjs";
6
6
  import { twoFactorClient } from "./client.mjs";
7
+ import * as _$_better_auth_core0 from "@better-auth/core";
8
+ import * as _$_better_auth_core_utils_error_codes0 from "@better-auth/core/utils/error-codes";
9
+ import * as _$better_call0 from "better-call";
7
10
  import * as z from "zod";
11
+
8
12
  //#region src/plugins/two-factor/index.d.ts
9
13
  declare module "@better-auth/core" {
10
14
  interface BetterAuthPluginRegistry<AuthOptions, Options> {
@@ -32,7 +36,7 @@ declare const twoFactor: <O extends TwoFactorOptions>(options?: O) => {
32
36
  *
33
37
  * @see [Read our docs to learn more.](https://better-auth.com/docs/plugins/2fa#api-method-two-factor-enable)
34
38
  */
35
- enableTwoFactor: import("better-call").StrictEndpoint<"/two-factor/enable", {
39
+ enableTwoFactor: _$better_call0.StrictEndpoint<"/two-factor/enable", {
36
40
  method: "POST";
37
41
  body: z.ZodObject<{
38
42
  password: z.ZodOptional<z.ZodString>;
@@ -41,7 +45,7 @@ declare const twoFactor: <O extends TwoFactorOptions>(options?: O) => {
41
45
  password: z.ZodString;
42
46
  issuer: z.ZodOptional<z.ZodString>;
43
47
  }, z.core.$strip>;
44
- use: ((inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
48
+ use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
45
49
  session: {
46
50
  session: Record<string, any> & {
47
51
  id: string;
@@ -63,7 +67,7 @@ declare const twoFactor: <O extends TwoFactorOptions>(options?: O) => {
63
67
  image?: string | null | undefined;
64
68
  };
65
69
  };
66
- }>)[];
70
+ }>>[];
67
71
  metadata: {
68
72
  openapi: {
69
73
  summary: string;
@@ -114,14 +118,14 @@ declare const twoFactor: <O extends TwoFactorOptions>(options?: O) => {
114
118
  *
115
119
  * @see [Read our docs to learn more.](https://better-auth.com/docs/plugins/2fa#api-method-two-factor-disable)
116
120
  */
117
- disableTwoFactor: import("better-call").StrictEndpoint<"/two-factor/disable", {
121
+ disableTwoFactor: _$better_call0.StrictEndpoint<"/two-factor/disable", {
118
122
  method: "POST";
119
123
  body: z.ZodObject<{
120
124
  password: z.ZodOptional<z.ZodString>;
121
125
  }, z.core.$strip> | z.ZodObject<{
122
126
  password: z.ZodString;
123
127
  }, z.core.$strip>;
124
- use: ((inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
128
+ use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
125
129
  session: {
126
130
  session: Record<string, any> & {
127
131
  id: string;
@@ -143,7 +147,7 @@ declare const twoFactor: <O extends TwoFactorOptions>(options?: O) => {
143
147
  image?: string | null | undefined;
144
148
  };
145
149
  };
146
- }>)[];
150
+ }>>[];
147
151
  metadata: {
148
152
  openapi: {
149
153
  summary: string;
@@ -170,7 +174,7 @@ declare const twoFactor: <O extends TwoFactorOptions>(options?: O) => {
170
174
  }, {
171
175
  status: boolean;
172
176
  }>;
173
- verifyBackupCode: import("better-call").StrictEndpoint<"/two-factor/verify-backup-code", {
177
+ verifyBackupCode: _$better_call0.StrictEndpoint<"/two-factor/verify-backup-code", {
174
178
  method: "POST";
175
179
  body: z.ZodObject<{
176
180
  code: z.ZodString;
@@ -281,14 +285,14 @@ declare const twoFactor: <O extends TwoFactorOptions>(options?: O) => {
281
285
  image?: string | null | undefined;
282
286
  }) | UserWithTwoFactor;
283
287
  }>;
284
- generateBackupCodes: import("better-call").StrictEndpoint<"/two-factor/generate-backup-codes", {
288
+ generateBackupCodes: _$better_call0.StrictEndpoint<"/two-factor/generate-backup-codes", {
285
289
  method: "POST";
286
290
  body: z.ZodObject<{
287
291
  password: z.ZodOptional<z.ZodString>;
288
292
  }, z.core.$strip> | z.ZodObject<{
289
293
  password: z.ZodString;
290
294
  }, z.core.$strip>;
291
- use: ((inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
295
+ use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
292
296
  session: {
293
297
  session: Record<string, any> & {
294
298
  id: string;
@@ -310,7 +314,7 @@ declare const twoFactor: <O extends TwoFactorOptions>(options?: O) => {
310
314
  image?: string | null | undefined;
311
315
  };
312
316
  };
313
- }>)[];
317
+ }>>[];
314
318
  metadata: {
315
319
  openapi: {
316
320
  description: string;
@@ -347,7 +351,7 @@ declare const twoFactor: <O extends TwoFactorOptions>(options?: O) => {
347
351
  status: boolean;
348
352
  backupCodes: string[];
349
353
  }>;
350
- viewBackupCodes: import("better-call").StrictEndpoint<string, {
354
+ viewBackupCodes: _$better_call0.StrictEndpoint<string, {
351
355
  method: "POST";
352
356
  body: z.ZodObject<{
353
357
  userId: z.ZodCoercedString<unknown>;
@@ -356,7 +360,7 @@ declare const twoFactor: <O extends TwoFactorOptions>(options?: O) => {
356
360
  status: boolean;
357
361
  backupCodes: string[];
358
362
  }>;
359
- sendTwoFactorOTP: import("better-call").StrictEndpoint<"/two-factor/send-otp", {
363
+ sendTwoFactorOTP: _$better_call0.StrictEndpoint<"/two-factor/send-otp", {
360
364
  method: "POST";
361
365
  body: z.ZodOptional<z.ZodObject<{
362
366
  trustDevice: z.ZodOptional<z.ZodBoolean>;
@@ -387,7 +391,7 @@ declare const twoFactor: <O extends TwoFactorOptions>(options?: O) => {
387
391
  }, {
388
392
  status: boolean;
389
393
  }>;
390
- verifyTwoFactorOTP: import("better-call").StrictEndpoint<"/two-factor/verify-otp", {
394
+ verifyTwoFactorOTP: _$better_call0.StrictEndpoint<"/two-factor/verify-otp", {
391
395
  method: "POST";
392
396
  body: z.ZodObject<{
393
397
  code: z.ZodString;
@@ -476,7 +480,7 @@ declare const twoFactor: <O extends TwoFactorOptions>(options?: O) => {
476
480
  image?: string | null | undefined;
477
481
  };
478
482
  }>;
479
- generateTOTP: import("better-call").StrictEndpoint<string, {
483
+ generateTOTP: _$better_call0.StrictEndpoint<string, {
480
484
  method: "POST";
481
485
  body: z.ZodObject<{
482
486
  secret: z.ZodString;
@@ -507,9 +511,9 @@ declare const twoFactor: <O extends TwoFactorOptions>(options?: O) => {
507
511
  }, {
508
512
  code: string;
509
513
  }>;
510
- getTOTPURI: import("better-call").StrictEndpoint<"/two-factor/get-totp-uri", {
514
+ getTOTPURI: _$better_call0.StrictEndpoint<"/two-factor/get-totp-uri", {
511
515
  method: "POST";
512
- use: ((inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
516
+ use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
513
517
  session: {
514
518
  session: Record<string, any> & {
515
519
  id: string;
@@ -531,7 +535,7 @@ declare const twoFactor: <O extends TwoFactorOptions>(options?: O) => {
531
535
  image?: string | null | undefined;
532
536
  };
533
537
  };
534
- }>)[];
538
+ }>>[];
535
539
  body: z.ZodObject<{
536
540
  password: z.ZodOptional<z.ZodString>;
537
541
  }, z.core.$strip> | z.ZodObject<{
@@ -563,7 +567,7 @@ declare const twoFactor: <O extends TwoFactorOptions>(options?: O) => {
563
567
  }, {
564
568
  totpURI: string;
565
569
  }>;
566
- verifyTOTP: import("better-call").StrictEndpoint<"/two-factor/verify-totp", {
570
+ verifyTOTP: _$better_call0.StrictEndpoint<"/two-factor/verify-totp", {
567
571
  method: "POST";
568
572
  body: z.ZodObject<{
569
573
  code: z.ZodString;
@@ -611,11 +615,11 @@ declare const twoFactor: <O extends TwoFactorOptions>(options?: O) => {
611
615
  options: NoInfer<O>;
612
616
  hooks: {
613
617
  after: {
614
- matcher(context: import("@better-auth/core").HookEndpointContext): boolean;
615
- handler: (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
618
+ matcher(context: _$_better_auth_core0.HookEndpointContext): boolean;
619
+ handler: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
616
620
  twoFactorRedirect: boolean;
617
621
  twoFactorMethods: string[];
618
- } | undefined>;
622
+ } | undefined>>;
619
623
  }[];
620
624
  };
621
625
  schema: {
@@ -680,17 +684,17 @@ declare const twoFactor: <O extends TwoFactorOptions>(options?: O) => {
680
684
  max: number;
681
685
  }[];
682
686
  $ERROR_CODES: {
683
- OTP_NOT_ENABLED: import("@better-auth/core/utils/error-codes").RawError<"OTP_NOT_ENABLED">;
684
- OTP_HAS_EXPIRED: import("@better-auth/core/utils/error-codes").RawError<"OTP_HAS_EXPIRED">;
685
- TOTP_NOT_ENABLED: import("@better-auth/core/utils/error-codes").RawError<"TOTP_NOT_ENABLED">;
686
- TWO_FACTOR_NOT_ENABLED: import("@better-auth/core/utils/error-codes").RawError<"TWO_FACTOR_NOT_ENABLED">;
687
- BACKUP_CODES_NOT_ENABLED: import("@better-auth/core/utils/error-codes").RawError<"BACKUP_CODES_NOT_ENABLED">;
688
- INVALID_BACKUP_CODE: import("@better-auth/core/utils/error-codes").RawError<"INVALID_BACKUP_CODE">;
689
- INVALID_CODE: import("@better-auth/core/utils/error-codes").RawError<"INVALID_CODE">;
690
- TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE: import("@better-auth/core/utils/error-codes").RawError<"TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE">;
691
- ACCOUNT_TEMPORARILY_LOCKED: import("@better-auth/core/utils/error-codes").RawError<"ACCOUNT_TEMPORARILY_LOCKED">;
692
- INVALID_TWO_FACTOR_COOKIE: import("@better-auth/core/utils/error-codes").RawError<"INVALID_TWO_FACTOR_COOKIE">;
687
+ OTP_NOT_ENABLED: _$_better_auth_core_utils_error_codes0.RawError<"OTP_NOT_ENABLED">;
688
+ OTP_HAS_EXPIRED: _$_better_auth_core_utils_error_codes0.RawError<"OTP_HAS_EXPIRED">;
689
+ TOTP_NOT_ENABLED: _$_better_auth_core_utils_error_codes0.RawError<"TOTP_NOT_ENABLED">;
690
+ TWO_FACTOR_NOT_ENABLED: _$_better_auth_core_utils_error_codes0.RawError<"TWO_FACTOR_NOT_ENABLED">;
691
+ BACKUP_CODES_NOT_ENABLED: _$_better_auth_core_utils_error_codes0.RawError<"BACKUP_CODES_NOT_ENABLED">;
692
+ INVALID_BACKUP_CODE: _$_better_auth_core_utils_error_codes0.RawError<"INVALID_BACKUP_CODE">;
693
+ INVALID_CODE: _$_better_auth_core_utils_error_codes0.RawError<"INVALID_CODE">;
694
+ TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE: _$_better_auth_core_utils_error_codes0.RawError<"TOO_MANY_ATTEMPTS_REQUEST_NEW_CODE">;
695
+ ACCOUNT_TEMPORARILY_LOCKED: _$_better_auth_core_utils_error_codes0.RawError<"ACCOUNT_TEMPORARILY_LOCKED">;
696
+ INVALID_TWO_FACTOR_COOKIE: _$_better_auth_core_utils_error_codes0.RawError<"INVALID_TWO_FACTOR_COOKIE">;
693
697
  };
694
698
  };
695
699
  //#endregion
696
- export { type BackupCodeOptions, type OTPOptions, type TOTPOptions, TWO_FACTOR_ERROR_CODES, TwoFactorOptions, TwoFactorProvider, TwoFactorTable, UserWithTwoFactor, type backupCode2fa, type encodeBackupCodes, type generateBackupCodes, type getBackupCodes, type otp2fa, type totp2fa, twoFactor, twoFactorClient, type verifyBackupCode };
700
+ export { BackupCodeOptions, OTPOptions, TOTPOptions, TWO_FACTOR_ERROR_CODES, TwoFactorOptions, TwoFactorProvider, TwoFactorTable, UserWithTwoFactor, backupCode2fa, encodeBackupCodes, generateBackupCodes, getBackupCodes, otp2fa, totp2fa, twoFactor, twoFactorClient, verifyBackupCode };
@@ -1,6 +1,8 @@
1
1
  import { UserWithTwoFactor } from "../types.mjs";
2
2
  import { Awaitable, GenericEndpointContext } from "@better-auth/core";
3
+ import * as _$better_call0 from "better-call";
3
4
  import * as z from "zod";
5
+
4
6
  //#region src/plugins/two-factor/otp/index.d.ts
5
7
  interface OTPOptions {
6
8
  /**
@@ -73,7 +75,7 @@ declare const otp2fa: (options?: OTPOptions | undefined) => {
73
75
  *
74
76
  * @see [Read our docs to learn more.](https://better-auth.com/docs/plugins/2fa#api-method-two-factor-send-otp)
75
77
  */
76
- sendTwoFactorOTP: import("better-call").StrictEndpoint<"/two-factor/send-otp", {
78
+ sendTwoFactorOTP: _$better_call0.StrictEndpoint<"/two-factor/send-otp", {
77
79
  method: "POST";
78
80
  body: z.ZodOptional<z.ZodObject<{
79
81
  trustDevice: z.ZodOptional<z.ZodBoolean>;
@@ -119,7 +121,7 @@ declare const otp2fa: (options?: OTPOptions | undefined) => {
119
121
  *
120
122
  * @see [Read our docs to learn more.](https://better-auth.com/docs/plugins/2fa#api-method-two-factor-verify-otp)
121
123
  */
122
- verifyTwoFactorOTP: import("better-call").StrictEndpoint<"/two-factor/verify-otp", {
124
+ verifyTwoFactorOTP: _$better_call0.StrictEndpoint<"/two-factor/verify-otp", {
123
125
  method: "POST";
124
126
  body: z.ZodObject<{
125
127
  code: z.ZodString;
@@ -1,6 +1,8 @@
1
1
  import { BackupCodeOptions } from "../backup-codes/index.mjs";
2
2
  import { UserWithTwoFactor } from "../types.mjs";
3
+ import * as _$better_call0 from "better-call";
3
4
  import * as z from "zod";
5
+
4
6
  //#region src/plugins/two-factor/totp/index.d.ts
5
7
  type TOTPOptions = {
6
8
  /**
@@ -50,7 +52,7 @@ declare const totp2fa: (options?: TOTPOptions | undefined) => {
50
52
  *
51
53
  * @see [Read our docs to learn more.](https://better-auth.com/docs/plugins/2fa#totp)
52
54
  */
53
- generateTOTP: import("better-call").StrictEndpoint<string, {
55
+ generateTOTP: _$better_call0.StrictEndpoint<string, {
54
56
  method: "POST";
55
57
  body: z.ZodObject<{
56
58
  secret: z.ZodString;
@@ -96,9 +98,9 @@ declare const totp2fa: (options?: TOTPOptions | undefined) => {
96
98
  *
97
99
  * @see [Read our docs to learn more.](https://better-auth.com/docs/plugins/2fa#getting-totp-uri)
98
100
  */
99
- getTOTPURI: import("better-call").StrictEndpoint<"/two-factor/get-totp-uri", {
101
+ getTOTPURI: _$better_call0.StrictEndpoint<"/two-factor/get-totp-uri", {
100
102
  method: "POST";
101
- use: ((inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
103
+ use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
102
104
  session: {
103
105
  session: Record<string, any> & {
104
106
  id: string;
@@ -120,7 +122,7 @@ declare const totp2fa: (options?: TOTPOptions | undefined) => {
120
122
  image?: string | null | undefined;
121
123
  };
122
124
  };
123
- }>)[];
125
+ }>>[];
124
126
  body: z.ZodObject<{
125
127
  password: z.ZodOptional<z.ZodString>;
126
128
  }, z.core.$strip> | z.ZodObject<{
@@ -167,7 +169,7 @@ declare const totp2fa: (options?: TOTPOptions | undefined) => {
167
169
  *
168
170
  * @see [Read our docs to learn more.](https://better-auth.com/docs/plugins/2fa#verifying-totp)
169
171
  */
170
- verifyTOTP: import("better-call").StrictEndpoint<"/two-factor/verify-totp", {
172
+ verifyTOTP: _$better_call0.StrictEndpoint<"/two-factor/verify-totp", {
171
173
  method: "POST";
172
174
  body: z.ZodObject<{
173
175
  code: z.ZodString;
@@ -1,11 +1,11 @@
1
1
  import { User } from "../../types/models.mjs";
2
2
  import { InferOptionSchema } from "../../types/plugins.mjs";
3
- import "../../types/index.mjs";
4
3
  import { BackupCodeOptions } from "./backup-codes/index.mjs";
5
4
  import { OTPOptions } from "./otp/index.mjs";
6
5
  import { schema } from "./schema.mjs";
7
6
  import { TOTPOptions } from "./totp/index.mjs";
8
7
  import { BetterAuthPlugin, LiteralString } from "@better-auth/core";
8
+
9
9
  //#region src/plugins/two-factor/types.d.ts
10
10
  interface TwoFactorOptions {
11
11
  /**
@@ -1,5 +1,7 @@
1
1
  import { USERNAME_ERROR_CODES } from "./error-codes.mjs";
2
2
  import { username } from "./index.mjs";
3
+ import * as _$_better_auth_core_utils_error_codes0 from "@better-auth/core/utils/error-codes";
4
+
3
5
  //#region src/plugins/username/client.d.ts
4
6
  declare const usernameClient: () => {
5
7
  id: "username";
@@ -10,15 +12,15 @@ declare const usernameClient: () => {
10
12
  signal: "$sessionSignal";
11
13
  }[];
12
14
  $ERROR_CODES: {
13
- EMAIL_NOT_VERIFIED: import("@better-auth/core/utils/error-codes").RawError<"EMAIL_NOT_VERIFIED">;
14
- UNEXPECTED_ERROR: import("@better-auth/core/utils/error-codes").RawError<"UNEXPECTED_ERROR">;
15
- INVALID_USERNAME_OR_PASSWORD: import("@better-auth/core/utils/error-codes").RawError<"INVALID_USERNAME_OR_PASSWORD">;
16
- USERNAME_IS_ALREADY_TAKEN: import("@better-auth/core/utils/error-codes").RawError<"USERNAME_IS_ALREADY_TAKEN">;
17
- USERNAME_TOO_SHORT: import("@better-auth/core/utils/error-codes").RawError<"USERNAME_TOO_SHORT">;
18
- USERNAME_TOO_LONG: import("@better-auth/core/utils/error-codes").RawError<"USERNAME_TOO_LONG">;
19
- INVALID_USERNAME: import("@better-auth/core/utils/error-codes").RawError<"INVALID_USERNAME">;
20
- INVALID_DISPLAY_USERNAME: import("@better-auth/core/utils/error-codes").RawError<"INVALID_DISPLAY_USERNAME">;
15
+ EMAIL_NOT_VERIFIED: _$_better_auth_core_utils_error_codes0.RawError<"EMAIL_NOT_VERIFIED">;
16
+ UNEXPECTED_ERROR: _$_better_auth_core_utils_error_codes0.RawError<"UNEXPECTED_ERROR">;
17
+ INVALID_USERNAME_OR_PASSWORD: _$_better_auth_core_utils_error_codes0.RawError<"INVALID_USERNAME_OR_PASSWORD">;
18
+ USERNAME_IS_ALREADY_TAKEN: _$_better_auth_core_utils_error_codes0.RawError<"USERNAME_IS_ALREADY_TAKEN">;
19
+ USERNAME_TOO_SHORT: _$_better_auth_core_utils_error_codes0.RawError<"USERNAME_TOO_SHORT">;
20
+ USERNAME_TOO_LONG: _$_better_auth_core_utils_error_codes0.RawError<"USERNAME_TOO_LONG">;
21
+ INVALID_USERNAME: _$_better_auth_core_utils_error_codes0.RawError<"INVALID_USERNAME">;
22
+ INVALID_DISPLAY_USERNAME: _$_better_auth_core_utils_error_codes0.RawError<"INVALID_DISPLAY_USERNAME">;
21
23
  };
22
24
  };
23
25
  //#endregion
24
- export { USERNAME_ERROR_CODES, usernameClient };
26
+ export { usernameClient };
@@ -14,4 +14,4 @@ const usernameClient = () => {
14
14
  };
15
15
  };
16
16
  //#endregion
17
- export { USERNAME_ERROR_CODES, usernameClient };
17
+ export { usernameClient };
@@ -1,13 +1,15 @@
1
+ import * as _$_better_auth_core_utils_error_codes0 from "@better-auth/core/utils/error-codes";
2
+
1
3
  //#region src/plugins/username/error-codes.d.ts
2
4
  declare const USERNAME_ERROR_CODES: {
3
- EMAIL_NOT_VERIFIED: import("@better-auth/core/utils/error-codes").RawError<"EMAIL_NOT_VERIFIED">;
4
- UNEXPECTED_ERROR: import("@better-auth/core/utils/error-codes").RawError<"UNEXPECTED_ERROR">;
5
- INVALID_USERNAME_OR_PASSWORD: import("@better-auth/core/utils/error-codes").RawError<"INVALID_USERNAME_OR_PASSWORD">;
6
- USERNAME_IS_ALREADY_TAKEN: import("@better-auth/core/utils/error-codes").RawError<"USERNAME_IS_ALREADY_TAKEN">;
7
- USERNAME_TOO_SHORT: import("@better-auth/core/utils/error-codes").RawError<"USERNAME_TOO_SHORT">;
8
- USERNAME_TOO_LONG: import("@better-auth/core/utils/error-codes").RawError<"USERNAME_TOO_LONG">;
9
- INVALID_USERNAME: import("@better-auth/core/utils/error-codes").RawError<"INVALID_USERNAME">;
10
- INVALID_DISPLAY_USERNAME: import("@better-auth/core/utils/error-codes").RawError<"INVALID_DISPLAY_USERNAME">;
5
+ EMAIL_NOT_VERIFIED: _$_better_auth_core_utils_error_codes0.RawError<"EMAIL_NOT_VERIFIED">;
6
+ UNEXPECTED_ERROR: _$_better_auth_core_utils_error_codes0.RawError<"UNEXPECTED_ERROR">;
7
+ INVALID_USERNAME_OR_PASSWORD: _$_better_auth_core_utils_error_codes0.RawError<"INVALID_USERNAME_OR_PASSWORD">;
8
+ USERNAME_IS_ALREADY_TAKEN: _$_better_auth_core_utils_error_codes0.RawError<"USERNAME_IS_ALREADY_TAKEN">;
9
+ USERNAME_TOO_SHORT: _$_better_auth_core_utils_error_codes0.RawError<"USERNAME_TOO_SHORT">;
10
+ USERNAME_TOO_LONG: _$_better_auth_core_utils_error_codes0.RawError<"USERNAME_TOO_LONG">;
11
+ INVALID_USERNAME: _$_better_auth_core_utils_error_codes0.RawError<"INVALID_USERNAME">;
12
+ INVALID_DISPLAY_USERNAME: _$_better_auth_core_utils_error_codes0.RawError<"INVALID_DISPLAY_USERNAME">;
11
13
  };
12
14
  //#endregion
13
15
  export { USERNAME_ERROR_CODES };
@@ -1,7 +1,12 @@
1
1
  import { InferOptionSchema } from "../../types/plugins.mjs";
2
2
  import { UsernameSchema } from "./schema.mjs";
3
3
  import { USERNAME_ERROR_CODES } from "./error-codes.mjs";
4
+ import * as _$_better_auth_core0 from "@better-auth/core";
5
+ import * as _$_better_auth_core_db0 from "@better-auth/core/db";
6
+ import * as _$_better_auth_core_utils_error_codes0 from "@better-auth/core/utils/error-codes";
7
+ import * as _$better_call0 from "better-call";
4
8
  import * as z from "zod";
9
+
5
10
  //#region src/plugins/username/index.d.ts
6
11
  declare module "@better-auth/core" {
7
12
  interface BetterAuthPluginRegistry<AuthOptions, Options> {
@@ -71,7 +76,7 @@ type UsernameOptions = {
71
76
  declare const username: (options?: UsernameOptions | undefined) => {
72
77
  id: "username";
73
78
  version: string;
74
- init(ctx: import("@better-auth/core").AuthContext): {
79
+ init(ctx: _$_better_auth_core0.AuthContext): {
75
80
  options: {
76
81
  databaseHooks: {
77
82
  user: {
@@ -84,7 +89,7 @@ declare const username: (options?: UsernameOptions | undefined) => {
84
89
  emailVerified: boolean;
85
90
  name: string;
86
91
  image?: string | null | undefined;
87
- } & Record<string, unknown>, context: import("@better-auth/core").GenericEndpointContext | null): Promise<{
92
+ } & Record<string, unknown>, context: _$_better_auth_core0.GenericEndpointContext | null): Promise<{
88
93
  data: {
89
94
  username: string;
90
95
  displayUsername: string;
@@ -118,7 +123,7 @@ declare const username: (options?: UsernameOptions | undefined) => {
118
123
  emailVerified: boolean;
119
124
  name: string;
120
125
  image?: string | null | undefined;
121
- }> & Record<string, unknown>, context: import("@better-auth/core").GenericEndpointContext | null): Promise<{
126
+ }> & Record<string, unknown>, context: _$_better_auth_core0.GenericEndpointContext | null): Promise<{
122
127
  data: {
123
128
  displayUsername?: string | undefined;
124
129
  username: string;
@@ -148,7 +153,7 @@ declare const username: (options?: UsernameOptions | undefined) => {
148
153
  };
149
154
  };
150
155
  endpoints: {
151
- signInUsername: import("better-call").StrictEndpoint<"/sign-in/username", {
156
+ signInUsername: _$better_call0.StrictEndpoint<"/sign-in/username", {
152
157
  method: "POST";
153
158
  body: z.ZodObject<{
154
159
  username: z.ZodString;
@@ -225,7 +230,7 @@ declare const username: (options?: UsernameOptions | undefined) => {
225
230
  displayUsername: string;
226
231
  };
227
232
  }>;
228
- isUsernameAvailable: import("better-call").StrictEndpoint<"/is-username-available", {
233
+ isUsernameAvailable: _$better_call0.StrictEndpoint<"/is-username-available", {
229
234
  method: "POST";
230
235
  body: z.ZodObject<{
231
236
  username: z.ZodString;
@@ -244,14 +249,14 @@ declare const username: (options?: UsernameOptions | undefined) => {
244
249
  unique: true;
245
250
  returned: true;
246
251
  transform: {
247
- input(value: import("@better-auth/core/db").DBPrimitive): string | number | boolean | Date | Record<string, unknown> | unknown[] | null | undefined;
252
+ input(value: _$_better_auth_core_db0.DBPrimitive): string | number | boolean | Date | Record<string, unknown> | unknown[] | null | undefined;
248
253
  };
249
254
  };
250
255
  displayUsername: {
251
256
  type: "string";
252
257
  required: false;
253
258
  transform: {
254
- input(value: import("@better-auth/core/db").DBPrimitive): string | number | boolean | Date | Record<string, unknown> | unknown[] | null | undefined;
259
+ input(value: _$_better_auth_core_db0.DBPrimitive): string | number | boolean | Date | Record<string, unknown> | unknown[] | null | undefined;
255
260
  };
256
261
  };
257
262
  };
@@ -259,20 +264,20 @@ declare const username: (options?: UsernameOptions | undefined) => {
259
264
  };
260
265
  hooks: {
261
266
  before: {
262
- matcher(context: import("@better-auth/core").HookEndpointContext): boolean;
263
- handler: (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<void>;
267
+ matcher(context: _$_better_auth_core0.HookEndpointContext): boolean;
268
+ handler: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<void>>;
264
269
  }[];
265
270
  };
266
271
  options: UsernameOptions | undefined;
267
272
  $ERROR_CODES: {
268
- EMAIL_NOT_VERIFIED: import("@better-auth/core/utils/error-codes").RawError<"EMAIL_NOT_VERIFIED">;
269
- UNEXPECTED_ERROR: import("@better-auth/core/utils/error-codes").RawError<"UNEXPECTED_ERROR">;
270
- INVALID_USERNAME_OR_PASSWORD: import("@better-auth/core/utils/error-codes").RawError<"INVALID_USERNAME_OR_PASSWORD">;
271
- USERNAME_IS_ALREADY_TAKEN: import("@better-auth/core/utils/error-codes").RawError<"USERNAME_IS_ALREADY_TAKEN">;
272
- USERNAME_TOO_SHORT: import("@better-auth/core/utils/error-codes").RawError<"USERNAME_TOO_SHORT">;
273
- USERNAME_TOO_LONG: import("@better-auth/core/utils/error-codes").RawError<"USERNAME_TOO_LONG">;
274
- INVALID_USERNAME: import("@better-auth/core/utils/error-codes").RawError<"INVALID_USERNAME">;
275
- INVALID_DISPLAY_USERNAME: import("@better-auth/core/utils/error-codes").RawError<"INVALID_DISPLAY_USERNAME">;
273
+ EMAIL_NOT_VERIFIED: _$_better_auth_core_utils_error_codes0.RawError<"EMAIL_NOT_VERIFIED">;
274
+ UNEXPECTED_ERROR: _$_better_auth_core_utils_error_codes0.RawError<"UNEXPECTED_ERROR">;
275
+ INVALID_USERNAME_OR_PASSWORD: _$_better_auth_core_utils_error_codes0.RawError<"INVALID_USERNAME_OR_PASSWORD">;
276
+ USERNAME_IS_ALREADY_TAKEN: _$_better_auth_core_utils_error_codes0.RawError<"USERNAME_IS_ALREADY_TAKEN">;
277
+ USERNAME_TOO_SHORT: _$_better_auth_core_utils_error_codes0.RawError<"USERNAME_TOO_SHORT">;
278
+ USERNAME_TOO_LONG: _$_better_auth_core_utils_error_codes0.RawError<"USERNAME_TOO_LONG">;
279
+ INVALID_USERNAME: _$_better_auth_core_utils_error_codes0.RawError<"INVALID_USERNAME">;
280
+ INVALID_DISPLAY_USERNAME: _$_better_auth_core_utils_error_codes0.RawError<"INVALID_DISPLAY_USERNAME">;
276
281
  };
277
282
  };
278
283
  //#endregion
@@ -1,3 +1,5 @@
1
+ import * as _$_better_auth_core_db0 from "@better-auth/core/db";
2
+
1
3
  //#region src/plugins/username/schema.d.ts
2
4
  declare const getSchema: (normalizer: {
3
5
  username: (username: string) => string;
@@ -12,14 +14,14 @@ declare const getSchema: (normalizer: {
12
14
  unique: true;
13
15
  returned: true;
14
16
  transform: {
15
- input(value: import("@better-auth/core/db").DBPrimitive): string | number | boolean | Date | Record<string, unknown> | unknown[] | null | undefined;
17
+ input(value: _$_better_auth_core_db0.DBPrimitive): string | number | boolean | Date | Record<string, unknown> | unknown[] | null | undefined;
16
18
  };
17
19
  };
18
20
  displayUsername: {
19
21
  type: "string";
20
22
  required: false;
21
23
  transform: {
22
- input(value: import("@better-auth/core/db").DBPrimitive): string | number | boolean | Date | Record<string, unknown> | unknown[] | null | undefined;
24
+ input(value: _$_better_auth_core_db0.DBPrimitive): string | number | boolean | Date | Record<string, unknown> | unknown[] | null | undefined;
23
25
  };
24
26
  };
25
27
  };
@@ -27,4 +29,4 @@ declare const getSchema: (normalizer: {
27
29
  };
28
30
  type UsernameSchema = ReturnType<typeof getSchema>;
29
31
  //#endregion
30
- export { UsernameSchema, getSchema };
32
+ export { UsernameSchema };
package/dist/state.d.mts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { GenericEndpointContext } from "@better-auth/core";
2
2
  import { BetterAuthError } from "@better-auth/core/error";
3
3
  import * as z from "zod";
4
+
4
5
  //#region src/state.d.ts
5
6
  declare const stateDataSchema: z.ZodObject<{
6
7
  callbackURL: z.ZodString;
@@ -1,13 +1,11 @@
1
1
  import { Session, User } from "../types/models.mjs";
2
2
  import { Auth } from "../types/auth.mjs";
3
- import "../types/index.mjs";
4
- import "../index.mjs";
5
3
  import { AuthClient } from "../client/vanilla.mjs";
6
- import "../client/index.mjs";
7
4
  import { setCookieToHeader } from "../cookies/cookie-utils.mjs";
8
- import "../cookies/index.mjs";
9
5
  import { Awaitable, BetterAuthClientOptions, BetterAuthOptions } from "@better-auth/core";
6
+ import * as _$_better_auth_core_db_adapter0 from "@better-auth/core/db/adapter";
10
7
  import { SuccessContext } from "@better-fetch/fetch";
8
+
11
9
  //#region src/test-utils/test-instance.d.ts
12
10
  declare function getTestInstance<O extends Partial<BetterAuthOptions>, C extends BetterAuthClientOptions>(options?: O | undefined, config?: {
13
11
  clientOptions?: C;
@@ -50,7 +48,7 @@ declare function getTestInstance<O extends Partial<BetterAuthOptions>, C extends
50
48
  cookieSetter: typeof setCookieToHeader;
51
49
  customFetchImpl: (url: string | URL | Request, init?: RequestInit | undefined) => Promise<Response>;
52
50
  sessionSetter: (headers: Headers) => (context: SuccessContext) => void;
53
- db: import("@better-auth/core/db/adapter").DBAdapter<BetterAuthOptions>;
51
+ db: _$_better_auth_core_db_adapter0.DBAdapter<BetterAuthOptions>;
54
52
  runWithUser: (email: string, password: string, fn: (headers: Headers) => Awaitable<void>) => Promise<void>;
55
53
  }>;
56
54
  //#endregion
@@ -1,2 +1,2 @@
1
1
  import { DBAdapter as DBAdapter$1, DBAdapterInstance, DBAdapterSchemaCreation, DBTransactionAdapter, JoinConfig, JoinOption, Where as Where$1 } from "@better-auth/core/db/adapter";
2
- export type { DBAdapter$1 as DBAdapter, DBAdapterInstance, DBAdapterSchemaCreation, DBTransactionAdapter, JoinConfig, JoinOption, Where$1 as Where };
2
+ export { type DBAdapter$1 as DBAdapter, type DBAdapterInstance, type DBAdapterSchemaCreation, type DBTransactionAdapter, type JoinConfig, type JoinOption, type Where$1 as Where };
@@ -1,7 +1,8 @@
1
1
  import { PrettifyDeep, UnionToIntersection } from "./helper.mjs";
2
2
  import { Endpoint } from "better-call";
3
+
3
4
  //#region src/types/api.d.ts
4
- type FilteredAPI<API> = Omit<API, API extends { [key in infer K]: Endpoint; } ? K extends string ? K extends "getSession" ? never : API[K]["options"]["metadata"] extends {
5
+ type FilteredAPI<API> = Omit<API, API extends { [key in infer K]: Endpoint } ? K extends string ? K extends "getSession" ? never : API[K]["options"]["metadata"] extends {
5
6
  isAction: false;
6
7
  } | {
7
8
  scope: "http";
@@ -4,6 +4,7 @@ import { InferPluginContext, InferPluginErrorCodes } from "./plugins.mjs";
4
4
  import { router } from "../api/index.mjs";
5
5
  import { AuthContext, BetterAuthOptions } from "@better-auth/core";
6
6
  import { BASE_ERROR_CODES } from "@better-auth/core/error";
7
+
7
8
  //#region src/types/auth.d.ts
8
9
  type Auth<Options extends BetterAuthOptions = BetterAuthOptions> = {
9
10
  handler: (request: Request) => Promise<Response>;
@@ -1,22 +1,22 @@
1
1
  //#region src/types/helper.d.ts
2
2
  type IsAny<T> = 0 extends 1 & T ? true : false;
3
3
  type Prettify<T> = Omit<T, never>;
4
- type PrettifyDeep<T> = { [K in keyof T]: T[K] extends ((...args: any[]) => any) ? T[K] : T[K] extends object ? T[K] extends Array<any> ? T[K] : T[K] extends Date ? T[K] : PrettifyDeep<T[K]> : T[K]; } & {};
4
+ type PrettifyDeep<T> = { [K in keyof T]: T[K] extends ((...args: any[]) => any) ? T[K] : T[K] extends object ? T[K] extends Array<any> ? T[K] : T[K] extends Date ? T[K] : PrettifyDeep<T[K]> : T[K] } & {};
5
5
  type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;
6
- type RequiredKeysOf<BaseType extends object> = Exclude<{ [Key in keyof BaseType]: BaseType extends Record<Key, BaseType[Key]> ? Key : never; }[keyof BaseType], undefined>;
6
+ type RequiredKeysOf<BaseType extends object> = Exclude<{ [Key in keyof BaseType]: BaseType extends Record<Key, BaseType[Key]> ? Key : never }[keyof BaseType], undefined>;
7
7
  type HasRequiredKeys<BaseType> = IsAny<BaseType> extends true ? false : [BaseType] extends [object] ? RequiredKeysOf<BaseType & object> extends never ? false : true : false;
8
- type StripEmptyObjects<T extends object> = { [K in keyof T]: T[K]; };
8
+ type StripEmptyObjects<T extends object> = { [K in keyof T]: T[K] };
9
9
  /**
10
10
  * Object merge replacing `Base`'s keys with `Override`'s.
11
11
  * The naive `Omit<Base, keyof Override> & Override` form breaks under generics.
12
12
  *
13
13
  * @see https://github.com/microsoft/TypeScript/issues/57466#issuecomment-1957988380
14
14
  */
15
- type OverrideMerge<Base, Override> = Base extends unknown ? Override extends unknown ? Prettify<{ [K in keyof Base as K extends keyof Override ? never : K]: Base[K]; } & Override> : never : never;
15
+ type OverrideMerge<Base, Override> = Base extends unknown ? Override extends unknown ? Prettify<{ [K in keyof Base as K extends keyof Override ? never : K]: Base[K] } & Override> : never : never;
16
16
  /**
17
17
  * Extracts a Record-typed field from a plugin, guarding against `any`.
18
18
  */
19
- type ExtractPluginField<T, Field extends string> = IsAny<T> extends true ? {} : T extends { [K in Field]?: Record<string, any>; } ? T[Field] extends Record<string, any> ? T[Field] : {} : {};
19
+ type ExtractPluginField<T, Field extends string> = IsAny<T> extends true ? {} : T extends { [K in Field]?: Record<string, any> } ? T[Field] extends Record<string, any> ? T[Field] : {} : {};
20
20
  /**
21
21
  * Walks a plugin tuple with tail-recursive accumulator (TS 4.5+),
22
22
  * extracting and intersecting the given field from each element.
@@ -6,5 +6,5 @@ import { Account, AdditionalSessionFieldsInput, AdditionalUserFieldsInput, Infer
6
6
  import { InferOptionSchema, InferPluginContext, InferPluginErrorCodes, InferPluginIDs } from "./plugins.mjs";
7
7
  import { Auth } from "./auth.mjs";
8
8
  import { BetterAuthAdvancedOptions, BetterAuthCookies, BetterAuthOptions, BetterAuthPlugin, BetterAuthRateLimitOptions, StoreIdentifierOption } from "@better-auth/core";
9
- export type * from "@better-auth/core/social-providers";
10
- export { type Account, type AdditionalSessionFieldsInput, type AdditionalUserFieldsInput, type Auth, type BetterAuthAdvancedOptions, type BetterAuthClientOptions, type BetterAuthClientPlugin, type BetterAuthCookies, type BetterAuthOptions, type BetterAuthPlugin, type BetterAuthRateLimitOptions, type ClientAtomListener, type ClientStore, type DBAdapter, type DBAdapterInstance, type DBAdapterSchemaCreation, type DBTransactionAdapter, type ExtractPluginField, FilteredAPI, type HasRequiredKeys, InferAPI, InferActions, InferAdditionalFromClient, InferClientAPI, InferErrorCodes, type InferOptionSchema, type InferPluginContext, type InferPluginErrorCodes, type InferPluginFieldFromTuple, type InferPluginIDs, type InferPluginTypes, InferSessionAPI, InferSessionFromClient, InferUserFromClient, type IsAny, IsSignal, type JoinConfig, type JoinOption, type OverrideMerge, type Prettify, type PrettifyDeep, type RateLimit, type RequiredKeysOf, type Session, SessionQueryParams, type StoreIdentifierOption, type StripEmptyObjects, type UnionToIntersection, type User, type Verification, type Where };
9
+ export * from "@better-auth/core/social-providers";
10
+ export { Account, AdditionalSessionFieldsInput, AdditionalUserFieldsInput, Auth, type BetterAuthAdvancedOptions, BetterAuthClientOptions, BetterAuthClientPlugin, type BetterAuthCookies, type BetterAuthOptions, type BetterAuthPlugin, type BetterAuthRateLimitOptions, ClientAtomListener, ClientStore, DBAdapter, DBAdapterInstance, DBAdapterSchemaCreation, DBTransactionAdapter, ExtractPluginField, FilteredAPI, HasRequiredKeys, InferAPI, InferActions, InferAdditionalFromClient, InferClientAPI, InferErrorCodes, InferOptionSchema, InferPluginContext, InferPluginErrorCodes, InferPluginFieldFromTuple, InferPluginIDs, InferPluginTypes, InferSessionAPI, InferSessionFromClient, InferUserFromClient, IsAny, IsSignal, JoinConfig, JoinOption, OverrideMerge, Prettify, PrettifyDeep, RateLimit, RequiredKeysOf, Session, SessionQueryParams, type StoreIdentifierOption, StripEmptyObjects, UnionToIntersection, User, Verification, Where };
@@ -1,6 +1,7 @@
1
1
  import { ExtractPluginField, InferPluginFieldFromTuple, UnionToIntersection } from "./helper.mjs";
2
2
  import { BetterAuthOptions } from "@better-auth/core";
3
3
  import { Account, InferDBFieldsFromOptionsInput, InferDBFieldsFromPluginsInput, RateLimit, Session as Session$1, User as User$1, Verification } from "@better-auth/core/db";
4
+
4
5
  //#region src/types/models.d.ts
5
6
  type AdditionalUserFieldsInput<Options extends BetterAuthOptions> = InferDBFieldsFromPluginsInput<"user", Options["plugins"]> & InferDBFieldsFromOptionsInput<Options["user"]>;
6
7
  type AdditionalSessionFieldsInput<Options extends BetterAuthOptions> = InferDBFieldsFromPluginsInput<"session", Options["plugins"]> & InferDBFieldsFromOptionsInput<Options["session"]>;
@@ -1,13 +1,14 @@
1
1
  import { ExtractPluginField, InferPluginFieldFromTuple, UnionToIntersection } from "./helper.mjs";
2
2
  import { AuthContext, BetterAuthOptions, BetterAuthPlugin } from "@better-auth/core";
3
3
  import { BetterAuthPluginDBSchema } from "@better-auth/core/db";
4
+
4
5
  //#region src/types/plugins.d.ts
5
6
  type InferOptionSchema<S extends BetterAuthPluginDBSchema> = S extends Record<string, {
6
7
  fields: infer Fields;
7
8
  }> ? { [K in keyof S]?: {
8
9
  modelName?: string | undefined;
9
- fields?: { [P in keyof Fields]?: string; } | undefined;
10
- }; } : never;
10
+ fields?: { [P in keyof Fields]?: string } | undefined;
11
+ } } : never;
11
12
  type InferPluginErrorCodes<O extends BetterAuthOptions> = O["plugins"] extends readonly [unknown, ...unknown[]] ? InferPluginFieldFromTuple<O["plugins"], "$ERROR_CODES"> : O["plugins"] extends Array<infer P> ? UnionToIntersection<ExtractPluginField<P, "$ERROR_CODES">> : {};
12
13
  type InferPluginIDs<O extends BetterAuthOptions> = O["plugins"] extends Array<infer P> ? UnionToIntersection<P extends BetterAuthPlugin ? P["id"] : never> : never;
13
14
  type ExtractInitContext<P extends BetterAuthPlugin> = P["init"] extends ((...args: any[]) => infer R) ? Awaited<R> extends {