better-auth 1.2.4-beta.1 → 1.2.4-beta.12

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 (216) hide show
  1. package/dist/adapters/drizzle-adapter/index.cjs +6 -0
  2. package/dist/adapters/drizzle-adapter/index.d.cts +1 -1
  3. package/dist/adapters/drizzle-adapter/index.d.mts +1 -1
  4. package/dist/adapters/drizzle-adapter/index.d.ts +1 -1
  5. package/dist/adapters/drizzle-adapter/index.mjs +7 -1
  6. package/dist/adapters/kysely-adapter/index.d.cts +1 -1
  7. package/dist/adapters/kysely-adapter/index.d.mts +1 -1
  8. package/dist/adapters/kysely-adapter/index.d.ts +1 -1
  9. package/dist/adapters/memory-adapter/index.d.cts +1 -1
  10. package/dist/adapters/memory-adapter/index.d.mts +1 -1
  11. package/dist/adapters/memory-adapter/index.d.ts +1 -1
  12. package/dist/adapters/mongodb-adapter/index.d.cts +1 -1
  13. package/dist/adapters/mongodb-adapter/index.d.mts +1 -1
  14. package/dist/adapters/mongodb-adapter/index.d.ts +1 -1
  15. package/dist/adapters/prisma-adapter/index.d.cts +1 -1
  16. package/dist/adapters/prisma-adapter/index.d.mts +1 -1
  17. package/dist/adapters/prisma-adapter/index.d.ts +1 -1
  18. package/dist/adapters/test.d.cts +1 -1
  19. package/dist/adapters/test.d.mts +1 -1
  20. package/dist/adapters/test.d.ts +1 -1
  21. package/dist/api/index.cjs +3 -3
  22. package/dist/api/index.d.cts +1 -1
  23. package/dist/api/index.d.mts +1 -1
  24. package/dist/api/index.d.ts +1 -1
  25. package/dist/api/index.mjs +4 -4
  26. package/dist/client/index.cjs +2 -2
  27. package/dist/client/index.d.cts +2 -2
  28. package/dist/client/index.d.mts +2 -2
  29. package/dist/client/index.d.ts +2 -2
  30. package/dist/client/index.mjs +2 -2
  31. package/dist/client/plugins/index.cjs +91 -101
  32. package/dist/client/plugins/index.d.cts +15 -236
  33. package/dist/client/plugins/index.d.mts +15 -236
  34. package/dist/client/plugins/index.d.ts +15 -236
  35. package/dist/client/plugins/index.mjs +92 -102
  36. package/dist/client/react/index.cjs +17 -13
  37. package/dist/client/react/index.d.cts +25 -2
  38. package/dist/client/react/index.d.mts +25 -2
  39. package/dist/client/react/index.d.ts +25 -2
  40. package/dist/client/react/index.mjs +17 -13
  41. package/dist/client/solid/index.cjs +2 -2
  42. package/dist/client/solid/index.d.cts +1 -1
  43. package/dist/client/solid/index.d.mts +1 -1
  44. package/dist/client/solid/index.d.ts +1 -1
  45. package/dist/client/solid/index.mjs +2 -2
  46. package/dist/client/svelte/index.cjs +2 -2
  47. package/dist/client/svelte/index.d.cts +1 -1
  48. package/dist/client/svelte/index.d.mts +1 -1
  49. package/dist/client/svelte/index.d.ts +1 -1
  50. package/dist/client/svelte/index.mjs +2 -2
  51. package/dist/client/vue/index.cjs +2 -2
  52. package/dist/client/vue/index.d.cts +1 -1
  53. package/dist/client/vue/index.d.mts +1 -1
  54. package/dist/client/vue/index.d.ts +1 -1
  55. package/dist/client/vue/index.mjs +2 -2
  56. package/dist/cookies/index.cjs +6 -2
  57. package/dist/cookies/index.d.cts +1 -1
  58. package/dist/cookies/index.d.mts +1 -1
  59. package/dist/cookies/index.d.ts +1 -1
  60. package/dist/cookies/index.mjs +6 -2
  61. package/dist/db/index.cjs +1 -1
  62. package/dist/db/index.d.cts +2 -2
  63. package/dist/db/index.d.mts +2 -2
  64. package/dist/db/index.d.ts +2 -2
  65. package/dist/db/index.mjs +1 -1
  66. package/dist/index.cjs +15 -11
  67. package/dist/index.d.cts +2 -2
  68. package/dist/index.d.mts +2 -2
  69. package/dist/index.d.ts +2 -2
  70. package/dist/index.mjs +16 -12
  71. package/dist/integrations/next-js.cjs +5 -5
  72. package/dist/integrations/next-js.d.cts +1 -1
  73. package/dist/integrations/next-js.d.mts +1 -1
  74. package/dist/integrations/next-js.d.ts +1 -1
  75. package/dist/integrations/next-js.mjs +5 -5
  76. package/dist/integrations/node.d.cts +1 -1
  77. package/dist/integrations/node.d.mts +1 -1
  78. package/dist/integrations/node.d.ts +1 -1
  79. package/dist/integrations/svelte-kit.d.cts +1 -1
  80. package/dist/integrations/svelte-kit.d.mts +1 -1
  81. package/dist/integrations/svelte-kit.d.ts +1 -1
  82. package/dist/oauth2/index.cjs +1 -1
  83. package/dist/oauth2/index.d.cts +2 -2
  84. package/dist/oauth2/index.d.mts +2 -2
  85. package/dist/oauth2/index.d.ts +2 -2
  86. package/dist/oauth2/index.mjs +1 -1
  87. package/dist/plugins/admin/index.cjs +4 -4
  88. package/dist/plugins/admin/index.d.cts +1 -1
  89. package/dist/plugins/admin/index.d.mts +1 -1
  90. package/dist/plugins/admin/index.d.ts +1 -1
  91. package/dist/plugins/admin/index.mjs +4 -4
  92. package/dist/plugins/anonymous/index.cjs +3 -3
  93. package/dist/plugins/anonymous/index.d.cts +1 -1
  94. package/dist/plugins/anonymous/index.d.mts +1 -1
  95. package/dist/plugins/anonymous/index.d.ts +1 -1
  96. package/dist/plugins/anonymous/index.mjs +3 -3
  97. package/dist/plugins/bearer/index.cjs +3 -3
  98. package/dist/plugins/bearer/index.d.cts +1 -1
  99. package/dist/plugins/bearer/index.d.mts +1 -1
  100. package/dist/plugins/bearer/index.d.ts +1 -1
  101. package/dist/plugins/bearer/index.mjs +3 -3
  102. package/dist/plugins/custom-session/index.cjs +3 -3
  103. package/dist/plugins/custom-session/index.d.cts +1 -1
  104. package/dist/plugins/custom-session/index.d.mts +1 -1
  105. package/dist/plugins/custom-session/index.d.ts +1 -1
  106. package/dist/plugins/custom-session/index.mjs +3 -3
  107. package/dist/plugins/email-otp/index.cjs +3 -3
  108. package/dist/plugins/email-otp/index.d.cts +1 -1
  109. package/dist/plugins/email-otp/index.d.mts +1 -1
  110. package/dist/plugins/email-otp/index.d.ts +1 -1
  111. package/dist/plugins/email-otp/index.mjs +3 -3
  112. package/dist/plugins/generic-oauth/index.cjs +3 -3
  113. package/dist/plugins/generic-oauth/index.d.cts +1 -1
  114. package/dist/plugins/generic-oauth/index.d.mts +1 -1
  115. package/dist/plugins/generic-oauth/index.d.ts +1 -1
  116. package/dist/plugins/generic-oauth/index.mjs +3 -3
  117. package/dist/plugins/index.cjs +15 -17
  118. package/dist/plugins/index.d.cts +3 -3
  119. package/dist/plugins/index.d.mts +3 -3
  120. package/dist/plugins/index.d.ts +3 -3
  121. package/dist/plugins/index.mjs +15 -17
  122. package/dist/plugins/jwt/index.cjs +8 -4
  123. package/dist/plugins/jwt/index.d.cts +1 -1
  124. package/dist/plugins/jwt/index.d.mts +1 -1
  125. package/dist/plugins/jwt/index.d.ts +1 -1
  126. package/dist/plugins/jwt/index.mjs +8 -4
  127. package/dist/plugins/magic-link/index.cjs +3 -3
  128. package/dist/plugins/magic-link/index.mjs +3 -3
  129. package/dist/plugins/multi-session/index.cjs +14 -5
  130. package/dist/plugins/multi-session/index.d.cts +1 -1
  131. package/dist/plugins/multi-session/index.d.mts +1 -1
  132. package/dist/plugins/multi-session/index.d.ts +1 -1
  133. package/dist/plugins/multi-session/index.mjs +14 -5
  134. package/dist/plugins/oauth-proxy/index.cjs +3 -3
  135. package/dist/plugins/oauth-proxy/index.d.cts +1 -1
  136. package/dist/plugins/oauth-proxy/index.d.mts +1 -1
  137. package/dist/plugins/oauth-proxy/index.d.ts +1 -1
  138. package/dist/plugins/oauth-proxy/index.mjs +3 -3
  139. package/dist/plugins/oidc-provider/index.cjs +89 -17
  140. package/dist/plugins/oidc-provider/index.d.cts +110 -14
  141. package/dist/plugins/oidc-provider/index.d.mts +110 -14
  142. package/dist/plugins/oidc-provider/index.d.ts +110 -14
  143. package/dist/plugins/oidc-provider/index.mjs +89 -17
  144. package/dist/plugins/one-tap/index.cjs +3 -3
  145. package/dist/plugins/one-tap/index.mjs +3 -3
  146. package/dist/plugins/open-api/index.cjs +3 -3
  147. package/dist/plugins/open-api/index.d.cts +1 -1
  148. package/dist/plugins/open-api/index.d.mts +1 -1
  149. package/dist/plugins/open-api/index.d.ts +1 -1
  150. package/dist/plugins/open-api/index.mjs +3 -3
  151. package/dist/plugins/organization/index.cjs +5 -5
  152. package/dist/plugins/organization/index.d.cts +2 -2
  153. package/dist/plugins/organization/index.d.mts +2 -2
  154. package/dist/plugins/organization/index.d.ts +2 -2
  155. package/dist/plugins/organization/index.mjs +5 -5
  156. package/dist/plugins/passkey/index.cjs +3 -3
  157. package/dist/plugins/passkey/index.d.cts +1 -1
  158. package/dist/plugins/passkey/index.d.mts +1 -1
  159. package/dist/plugins/passkey/index.d.ts +1 -1
  160. package/dist/plugins/passkey/index.mjs +3 -3
  161. package/dist/plugins/phone-number/index.cjs +19 -11
  162. package/dist/plugins/phone-number/index.d.cts +4 -3
  163. package/dist/plugins/phone-number/index.d.mts +4 -3
  164. package/dist/plugins/phone-number/index.d.ts +4 -3
  165. package/dist/plugins/phone-number/index.mjs +19 -11
  166. package/dist/plugins/sso/index.cjs +3 -3
  167. package/dist/plugins/sso/index.d.cts +1 -1
  168. package/dist/plugins/sso/index.d.mts +1 -1
  169. package/dist/plugins/sso/index.d.ts +1 -1
  170. package/dist/plugins/sso/index.mjs +3 -3
  171. package/dist/plugins/two-factor/index.cjs +7 -7
  172. package/dist/plugins/two-factor/index.d.cts +1 -1
  173. package/dist/plugins/two-factor/index.d.mts +1 -1
  174. package/dist/plugins/two-factor/index.d.ts +1 -1
  175. package/dist/plugins/two-factor/index.mjs +7 -7
  176. package/dist/plugins/username/index.cjs +3 -3
  177. package/dist/plugins/username/index.d.cts +1 -1
  178. package/dist/plugins/username/index.d.mts +1 -1
  179. package/dist/plugins/username/index.d.ts +1 -1
  180. package/dist/plugins/username/index.mjs +3 -3
  181. package/dist/shared/{better-auth.B5NYxGA3.mjs → better-auth.67eSHmUo.mjs} +3 -7
  182. package/dist/shared/{better-auth.CMz4USTt.cjs → better-auth.B6Xcg5N5.cjs} +1 -1
  183. package/dist/shared/{better-auth.K251u4eV.mjs → better-auth.BH6IWaNB.mjs} +3 -3
  184. package/dist/shared/{better-auth.DNb3Aogp.cjs → better-auth.BN2jUYPL.cjs} +1 -1
  185. package/dist/shared/{better-auth.F2VsZ04W.d.ts → better-auth.BVojg4kv.d.ts} +1 -1
  186. package/dist/shared/{better-auth.BA2kubRc.d.cts → better-auth.BdjFNTuQ.d.cts} +1 -1
  187. package/dist/shared/{better-auth.D4ignKqt.d.mts → better-auth.BfPbu6oh.d.mts} +1 -1
  188. package/dist/shared/{better-auth.DhfiEsxl.cjs → better-auth.C-R0J0n1.cjs} +15 -1
  189. package/dist/shared/{better-auth.Bd1H94Nk.mjs → better-auth.CABkkSP8.mjs} +1 -1
  190. package/dist/shared/{better-auth.npe3WWSD.mjs → better-auth.CFZLHBFT.mjs} +23 -24
  191. package/dist/shared/{better-auth.GgQnT00n.cjs → better-auth.CHHC_PJT.cjs} +1 -0
  192. package/dist/shared/{better-auth.BI_ldOv7.mjs → better-auth.CHsl8t-G.mjs} +2 -7
  193. package/dist/shared/{better-auth.BAR_8WbD.d.cts → better-auth.CPKTEzG-.d.cts} +3 -2
  194. package/dist/shared/{better-auth.DXbPkpEx.cjs → better-auth.CR_ASYNx.cjs} +3 -3
  195. package/dist/shared/{better-auth.YSKz0i4l.mjs → better-auth.CSVqSIae.mjs} +1 -1
  196. package/dist/shared/{better-auth.Cx-TsLBb.d.mts → better-auth.CVOWGLfd.d.mts} +1 -1
  197. package/dist/shared/{better-auth.CoMXyQ1y.mjs → better-auth.CbXAPXob.mjs} +1 -0
  198. package/dist/shared/{better-auth.imLEY-xr.d.mts → better-auth.Ck0xlDsK.d.mts} +3 -2
  199. package/dist/shared/{better-auth.BS4hQYkx.d.cts → better-auth.Ckf_tP8g.d.mts} +1 -1
  200. package/dist/shared/{better-auth.CqfKuHli.mjs → better-auth.CmplT_y7.mjs} +11 -18
  201. package/dist/shared/{better-auth.BvJDkY_b.cjs → better-auth.Cr6NZZDX.cjs} +11 -18
  202. package/dist/shared/{better-auth.BLtLzuLI.d.cts → better-auth.DIRcdXVm.d.cts} +1 -1
  203. package/dist/shared/{better-auth.DayxQ0AW.d.ts → better-auth.DaeQzncE.d.ts} +1 -1
  204. package/dist/shared/{better-auth.CKg1f8vU.cjs → better-auth.DcpLarbN.cjs} +3 -7
  205. package/dist/shared/{better-auth.purQujiV.d.ts → better-auth.DiHCWsNg.d.ts} +3 -2
  206. package/dist/shared/{better-auth.CwDUoRLB.cjs → better-auth.Dxrp37xO.cjs} +2 -7
  207. package/dist/shared/{better-auth.BzKRBwSF.cjs → better-auth.GVCiTzec.cjs} +23 -24
  208. package/dist/shared/{better-auth.NcLhHEks.mjs → better-auth.VTXNLFMT.mjs} +15 -1
  209. package/dist/shared/{better-auth.BxdddeEs.d.mts → better-auth.Vci2tT86.d.cts} +1 -1
  210. package/dist/shared/{better-auth.977UjO4P.d.ts → better-auth.jVBEmAqh.d.ts} +1 -1
  211. package/dist/social-providers/index.cjs +3 -1
  212. package/dist/social-providers/index.mjs +3 -1
  213. package/dist/types/index.d.cts +4 -3
  214. package/dist/types/index.d.mts +4 -3
  215. package/dist/types/index.d.ts +4 -3
  216. package/package.json +3 -3
@@ -82,6 +82,7 @@ async function parseState(c) {
82
82
  parsedData.errorURL = `${c.context.baseURL}/error`;
83
83
  }
84
84
  if (parsedData.expiresAt < Date.now()) {
85
+ await c.context.internalAdapter.deleteVerificationValue(data.id);
85
86
  throw c.redirect(
86
87
  `${c.context.baseURL}/error?error=please_restart_the_process`
87
88
  );
@@ -1,11 +1,11 @@
1
1
  import { APIError } from 'better-call';
2
2
  import { z } from 'zod';
3
- import { a as createAuthEndpoint, g as getSessionFromCtx } from './better-auth.npe3WWSD.mjs';
3
+ import { a as createAuthEndpoint, g as getSessionFromCtx } from './better-auth.CFZLHBFT.mjs';
4
4
  import './better-auth.8zoxzg-F.mjs';
5
5
  import '@better-auth/utils/base64';
6
6
  import '@better-auth/utils/hmac';
7
7
  import './better-auth.C24Bzw4w.mjs';
8
- import { u as updateMemberRole, a as addMember, c as createInvitation, g as getFullOrganization, s as setActiveOrganization, b as createTeam, d as updateTeam, r as removeTeam, l as listOrganizationTeams, e as leaveOrganization, f as getActiveMember, h as removeMember, i as checkOrganizationSlug, j as rejectInvitation, k as getInvitation, m as acceptInvitation, n as cancelInvitation, o as listOrganizations, p as deleteOrganization, q as updateOrganization, t as createOrganization, O as ORGANIZATION_ERROR_CODES, v as orgSessionMiddleware, w as getOrgAdapter, x as hasPermission } from './better-auth.CqfKuHli.mjs';
8
+ import { u as updateMemberRole, a as addMember, c as createInvitation, g as getFullOrganization, s as setActiveOrganization, b as createTeam, d as updateTeam, r as removeTeam, l as listOrganizationTeams, e as leaveOrganization, f as getActiveMember, h as removeMember, i as checkOrganizationSlug, j as rejectInvitation, k as getInvitation, m as acceptInvitation, n as cancelInvitation, o as listOrganizations, p as deleteOrganization, q as updateOrganization, t as createOrganization, O as ORGANIZATION_ERROR_CODES, v as orgSessionMiddleware, w as getOrgAdapter, x as hasPermission } from './better-auth.CmplT_y7.mjs';
9
9
  import { defaultRoles } from '../plugins/organization/access/index.mjs';
10
10
 
11
11
  const shimContext = (originalObject, newContext) => {
@@ -164,11 +164,6 @@ const organization = (options) => {
164
164
  }
165
165
  },
166
166
  async (ctx) => {
167
- if (!ctx.body.permission || Object.keys(ctx.body.permission).length > 1) {
168
- throw new APIError("BAD_REQUEST", {
169
- message: "invalid permission check. you can only check one resource permission at a time."
170
- });
171
- }
172
167
  const activeOrganizationId = ctx.body.organizationId || ctx.context.session.session.activeOrganizationId;
173
168
  if (!activeOrganizationId) {
174
169
  throw new APIError("BAD_REQUEST", {
@@ -85,7 +85,7 @@ declare const createInternalAdapter: (adapter: Adapter, ctx: {
85
85
  updateSession: (sessionToken: string, session: Partial<Session> & Record<string, any>, context?: GenericEndpointContext) => Promise<any>;
86
86
  deleteSession: (token: string) => Promise<void>;
87
87
  deleteAccounts: (userId: string) => Promise<void>;
88
- deleteAccount: (providerId: string, userId: string) => Promise<void>;
88
+ deleteAccount: (accountId: string) => Promise<void>;
89
89
  deleteSessions: (userIdOrSessionTokens: string | string[]) => Promise<void>;
90
90
  findOAuthUser: (email: string, accountId: string, providerId: string) => Promise<{
91
91
  user: {
@@ -666,6 +666,7 @@ type EligibleCookies = (string & {}) | (keyof BetterAuthCookies & {});
666
666
  declare const getSessionCookie: (request: Request | Headers, config?: {
667
667
  cookiePrefix?: string;
668
668
  cookieName?: string;
669
+ useSecureCookies?: boolean;
669
670
  }) => string | null;
670
671
  declare const getCookieCache: <Session extends {
671
672
  session: Session & Record<string, any>;
@@ -2588,7 +2589,7 @@ type BetterAuthOptions = {
2588
2589
  /**
2589
2590
  * List of trusted origins.
2590
2591
  */
2591
- trustedOrigins?: string[] | ((request: Request) => string[]);
2592
+ trustedOrigins?: string[] | ((request: Request) => string[] | Promise<string[]>);
2592
2593
  /**
2593
2594
  * Rate limiting configuration
2594
2595
  */
@@ -2,7 +2,7 @@
2
2
 
3
3
  const zod = require('zod');
4
4
  const betterCall = require('better-call');
5
- const account = require('./better-auth.BzKRBwSF.cjs');
5
+ const account = require('./better-auth.GVCiTzec.cjs');
6
6
  const cookies_index = require('../cookies/index.cjs');
7
7
  const schema$1 = require('./better-auth.CHyZMcYK.cjs');
8
8
  require('./better-auth.DiSjtgs9.cjs');
@@ -51,7 +51,7 @@ const admin = (options) => {
51
51
  };
52
52
  const adminMiddleware = account.createAuthMiddleware(async (ctx) => {
53
53
  const session = await account.getSessionFromCtx(ctx);
54
- if ((!session?.session || !opts.adminRoles.includes(session.user.role)) && !opts.adminUserIds?.includes(session?.user.id || "")) {
54
+ if (!session) {
55
55
  throw new betterCall.APIError("UNAUTHORIZED");
56
56
  }
57
57
  return {
@@ -1058,7 +1058,7 @@ const admin = (options) => {
1058
1058
  message: "invalid permission check. you can only check one resource permission at a time."
1059
1059
  });
1060
1060
  }
1061
- const session = ctx.context.session;
1061
+ const session = await account.getSessionFromCtx(ctx);
1062
1062
  if (!session && (ctx.request || ctx.headers) && !ctx.body.userId && !ctx.body.role) {
1063
1063
  throw new betterCall.APIError("UNAUTHORIZED");
1064
1064
  }
@@ -1,5 +1,5 @@
1
1
  import { createFetch } from '@better-fetch/fetch';
2
- import { a as getBaseURL } from './better-auth.NcLhHEks.mjs';
2
+ import { a as getBaseURL } from './better-auth.VTXNLFMT.mjs';
3
3
  import { atom } from 'nanostores';
4
4
  import { u as useAuthQuery } from './better-auth.CQvoVIBD.mjs';
5
5
  import { p as parseJSON } from './better-auth.ffWeg50w.mjs';
@@ -1,6 +1,6 @@
1
1
  import * as zod from 'zod';
2
2
  import * as better_call from 'better-call';
3
- import { G as GenericEndpointContext, I as InferOptionSchema, H as HookEndpointContext, l as AuthContext } from './better-auth.imLEY-xr.mjs';
3
+ import { G as GenericEndpointContext, I as InferOptionSchema, H as HookEndpointContext, l as AuthContext } from './better-auth.Ck0xlDsK.mjs';
4
4
  import { Statements } from '../plugins/access/index.mjs';
5
5
 
6
6
  declare const apiKeySchema: ({ timeWindow, rateLimitMax, }: {
@@ -80,6 +80,7 @@ async function parseState(c) {
80
80
  parsedData.errorURL = `${c.context.baseURL}/error`;
81
81
  }
82
82
  if (parsedData.expiresAt < Date.now()) {
83
+ await c.context.internalAdapter.deleteVerificationValue(data.id);
83
84
  throw c.redirect(
84
85
  `${c.context.baseURL}/error?error=please_restart_the_process`
85
86
  );
@@ -85,7 +85,7 @@ declare const createInternalAdapter: (adapter: Adapter, ctx: {
85
85
  updateSession: (sessionToken: string, session: Partial<Session> & Record<string, any>, context?: GenericEndpointContext) => Promise<any>;
86
86
  deleteSession: (token: string) => Promise<void>;
87
87
  deleteAccounts: (userId: string) => Promise<void>;
88
- deleteAccount: (providerId: string, userId: string) => Promise<void>;
88
+ deleteAccount: (accountId: string) => Promise<void>;
89
89
  deleteSessions: (userIdOrSessionTokens: string | string[]) => Promise<void>;
90
90
  findOAuthUser: (email: string, accountId: string, providerId: string) => Promise<{
91
91
  user: {
@@ -666,6 +666,7 @@ type EligibleCookies = (string & {}) | (keyof BetterAuthCookies & {});
666
666
  declare const getSessionCookie: (request: Request | Headers, config?: {
667
667
  cookiePrefix?: string;
668
668
  cookieName?: string;
669
+ useSecureCookies?: boolean;
669
670
  }) => string | null;
670
671
  declare const getCookieCache: <Session extends {
671
672
  session: Session & Record<string, any>;
@@ -2588,7 +2589,7 @@ type BetterAuthOptions = {
2588
2589
  /**
2589
2590
  * List of trusted origins.
2590
2591
  */
2591
- trustedOrigins?: string[] | ((request: Request) => string[]);
2592
+ trustedOrigins?: string[] | ((request: Request) => string[] | Promise<string[]>);
2592
2593
  /**
2593
2594
  * Rate limiting configuration
2594
2595
  */
@@ -1,4 +1,4 @@
1
- import { G as GenericEndpointContext } from './better-auth.BAR_8WbD.cjs';
1
+ import { G as GenericEndpointContext } from './better-auth.Ck0xlDsK.mjs';
2
2
 
3
3
  declare function generateState(c: GenericEndpointContext, link?: {
4
4
  email: string;
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { c as createAuthMiddleware, s as sessionMiddleware, a as createAuthEndpoint, g as getSessionFromCtx, B as BASE_ERROR_CODES, M as requestOnlySessionMiddleware } from './better-auth.npe3WWSD.mjs';
2
+ import { c as createAuthMiddleware, s as sessionMiddleware, a as createAuthEndpoint, g as getSessionFromCtx, B as BASE_ERROR_CODES, M as requestOnlySessionMiddleware } from './better-auth.CFZLHBFT.mjs';
3
3
  import './better-auth.8zoxzg-F.mjs';
4
4
  import '@better-auth/utils/base64';
5
5
  import '@better-auth/utils/hmac';
@@ -321,7 +321,8 @@ const getOrgAdapter = (context, options) => {
321
321
  const userIds = members.map((member) => member.userId);
322
322
  const users = await adapter.findMany({
323
323
  model: "user",
324
- where: [{ field: "id", value: userIds, operator: "in" }]
324
+ where: [{ field: "id", value: userIds, operator: "in" }],
325
+ limit: options?.membershipLimit || 100
325
326
  });
326
327
  const userMap = new Map(users.map((user) => [user.id, user]));
327
328
  const membersWithUsers = members.map((member) => {
@@ -399,7 +400,8 @@ const getOrgAdapter = (context, options) => {
399
400
  field: "teamId",
400
401
  value: teamId
401
402
  }
402
- ]
403
+ ],
404
+ limit: options?.membershipLimit || 100
403
405
  });
404
406
  if (!team) {
405
407
  return null;
@@ -1792,11 +1794,8 @@ const updateOrganization = createAuthEndpoint(
1792
1794
  }
1793
1795
  const organizationId = ctx.body.organizationId || session.session.activeOrganizationId;
1794
1796
  if (!organizationId) {
1795
- return ctx.json(null, {
1796
- status: 400,
1797
- body: {
1798
- message: ORGANIZATION_ERROR_CODES.ORGANIZATION_NOT_FOUND
1799
- }
1797
+ throw new APIError("BAD_REQUEST", {
1798
+ message: ORGANIZATION_ERROR_CODES.ORGANIZATION_NOT_FOUND
1800
1799
  });
1801
1800
  }
1802
1801
  const adapter = getOrgAdapter(ctx.context, ctx.context.orgOptions);
@@ -1805,11 +1804,8 @@ const updateOrganization = createAuthEndpoint(
1805
1804
  organizationId
1806
1805
  });
1807
1806
  if (!member) {
1808
- return ctx.json(null, {
1809
- status: 400,
1810
- body: {
1811
- message: ORGANIZATION_ERROR_CODES.USER_IS_NOT_A_MEMBER_OF_THE_ORGANIZATION
1812
- }
1807
+ throw new APIError("BAD_REQUEST", {
1808
+ message: ORGANIZATION_ERROR_CODES.USER_IS_NOT_A_MEMBER_OF_THE_ORGANIZATION
1813
1809
  });
1814
1810
  }
1815
1811
  const canUpdateOrg = hasPermission({
@@ -1820,11 +1816,8 @@ const updateOrganization = createAuthEndpoint(
1820
1816
  options: ctx.context.orgOptions
1821
1817
  });
1822
1818
  if (!canUpdateOrg) {
1823
- return ctx.json(null, {
1824
- body: {
1825
- message: ORGANIZATION_ERROR_CODES.YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_ORGANIZATION
1826
- },
1827
- status: 403
1819
+ throw new APIError("FORBIDDEN", {
1820
+ message: ORGANIZATION_ERROR_CODES.YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_ORGANIZATION
1828
1821
  });
1829
1822
  }
1830
1823
  const updatedOrg = await adapter.updateOrganization(
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  const zod = require('zod');
4
- const account = require('./better-auth.BzKRBwSF.cjs');
4
+ const account = require('./better-auth.GVCiTzec.cjs');
5
5
  require('./better-auth.DiSjtgs9.cjs');
6
6
  require('@better-auth/utils/base64');
7
7
  require('@better-auth/utils/hmac');
@@ -323,7 +323,8 @@ const getOrgAdapter = (context, options) => {
323
323
  const userIds = members.map((member) => member.userId);
324
324
  const users = await adapter.findMany({
325
325
  model: "user",
326
- where: [{ field: "id", value: userIds, operator: "in" }]
326
+ where: [{ field: "id", value: userIds, operator: "in" }],
327
+ limit: options?.membershipLimit || 100
327
328
  });
328
329
  const userMap = new Map(users.map((user) => [user.id, user]));
329
330
  const membersWithUsers = members.map((member) => {
@@ -401,7 +402,8 @@ const getOrgAdapter = (context, options) => {
401
402
  field: "teamId",
402
403
  value: teamId
403
404
  }
404
- ]
405
+ ],
406
+ limit: options?.membershipLimit || 100
405
407
  });
406
408
  if (!team) {
407
409
  return null;
@@ -1794,11 +1796,8 @@ const updateOrganization = account.createAuthEndpoint(
1794
1796
  }
1795
1797
  const organizationId = ctx.body.organizationId || session.session.activeOrganizationId;
1796
1798
  if (!organizationId) {
1797
- return ctx.json(null, {
1798
- status: 400,
1799
- body: {
1800
- message: ORGANIZATION_ERROR_CODES.ORGANIZATION_NOT_FOUND
1801
- }
1799
+ throw new betterCall.APIError("BAD_REQUEST", {
1800
+ message: ORGANIZATION_ERROR_CODES.ORGANIZATION_NOT_FOUND
1802
1801
  });
1803
1802
  }
1804
1803
  const adapter = getOrgAdapter(ctx.context, ctx.context.orgOptions);
@@ -1807,11 +1806,8 @@ const updateOrganization = account.createAuthEndpoint(
1807
1806
  organizationId
1808
1807
  });
1809
1808
  if (!member) {
1810
- return ctx.json(null, {
1811
- status: 400,
1812
- body: {
1813
- message: ORGANIZATION_ERROR_CODES.USER_IS_NOT_A_MEMBER_OF_THE_ORGANIZATION
1814
- }
1809
+ throw new betterCall.APIError("BAD_REQUEST", {
1810
+ message: ORGANIZATION_ERROR_CODES.USER_IS_NOT_A_MEMBER_OF_THE_ORGANIZATION
1815
1811
  });
1816
1812
  }
1817
1813
  const canUpdateOrg = hasPermission({
@@ -1822,11 +1818,8 @@ const updateOrganization = account.createAuthEndpoint(
1822
1818
  options: ctx.context.orgOptions
1823
1819
  });
1824
1820
  if (!canUpdateOrg) {
1825
- return ctx.json(null, {
1826
- body: {
1827
- message: ORGANIZATION_ERROR_CODES.YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_ORGANIZATION
1828
- },
1829
- status: 403
1821
+ throw new betterCall.APIError("FORBIDDEN", {
1822
+ message: ORGANIZATION_ERROR_CODES.YOU_ARE_NOT_ALLOWED_TO_UPDATE_THIS_ORGANIZATION
1830
1823
  });
1831
1824
  }
1832
1825
  const updatedOrg = await adapter.updateOrganization(
@@ -2,7 +2,7 @@ import { AccessControl, Role, Statements } from '../plugins/access/index.cjs';
2
2
  import { z } from 'zod';
3
3
  import * as better_call from 'better-call';
4
4
  import { b as Prettify } from './better-auth.Bi8FQwDD.cjs';
5
- import { U as User, S as Session, G as GenericEndpointContext } from './better-auth.BAR_8WbD.cjs';
5
+ import { U as User, S as Session, G as GenericEndpointContext } from './better-auth.CPKTEzG-.cjs';
6
6
  import { defaultRoles } from '../plugins/organization/access/index.cjs';
7
7
 
8
8
  declare const organizationSchema: z.ZodObject<{
@@ -1,6 +1,6 @@
1
1
  import * as zod from 'zod';
2
2
  import * as better_call from 'better-call';
3
- import { G as GenericEndpointContext, I as InferOptionSchema, H as HookEndpointContext, l as AuthContext } from './better-auth.purQujiV.js';
3
+ import { G as GenericEndpointContext, I as InferOptionSchema, H as HookEndpointContext, l as AuthContext } from './better-auth.DiHCWsNg.js';
4
4
  import { Statements } from '../plugins/access/index.js';
5
5
 
6
6
  declare const apiKeySchema: ({ timeWindow, rateLimitMax, }: {
@@ -480,17 +480,13 @@ const createInternalAdapter = (adapter, ctx) => {
480
480
  ]
481
481
  });
482
482
  },
483
- deleteAccount: async (providerId, userId) => {
483
+ deleteAccount: async (accountId) => {
484
484
  await adapter.delete({
485
485
  model: "account",
486
486
  where: [
487
487
  {
488
- field: "providerId",
489
- value: providerId
490
- },
491
- {
492
- field: "userId",
493
- value: userId
488
+ field: "id",
489
+ value: accountId
494
490
  }
495
491
  ]
496
492
  });
@@ -85,7 +85,7 @@ declare const createInternalAdapter: (adapter: Adapter, ctx: {
85
85
  updateSession: (sessionToken: string, session: Partial<Session> & Record<string, any>, context?: GenericEndpointContext) => Promise<any>;
86
86
  deleteSession: (token: string) => Promise<void>;
87
87
  deleteAccounts: (userId: string) => Promise<void>;
88
- deleteAccount: (providerId: string, userId: string) => Promise<void>;
88
+ deleteAccount: (accountId: string) => Promise<void>;
89
89
  deleteSessions: (userIdOrSessionTokens: string | string[]) => Promise<void>;
90
90
  findOAuthUser: (email: string, accountId: string, providerId: string) => Promise<{
91
91
  user: {
@@ -666,6 +666,7 @@ type EligibleCookies = (string & {}) | (keyof BetterAuthCookies & {});
666
666
  declare const getSessionCookie: (request: Request | Headers, config?: {
667
667
  cookiePrefix?: string;
668
668
  cookieName?: string;
669
+ useSecureCookies?: boolean;
669
670
  }) => string | null;
670
671
  declare const getCookieCache: <Session extends {
671
672
  session: Session & Record<string, any>;
@@ -2588,7 +2589,7 @@ type BetterAuthOptions = {
2588
2589
  /**
2589
2590
  * List of trusted origins.
2590
2591
  */
2591
- trustedOrigins?: string[] | ((request: Request) => string[]);
2592
+ trustedOrigins?: string[] | ((request: Request) => string[] | Promise<string[]>);
2592
2593
  /**
2593
2594
  * Rate limiting configuration
2594
2595
  */
@@ -2,12 +2,12 @@
2
2
 
3
3
  const betterCall = require('better-call');
4
4
  const zod = require('zod');
5
- const account = require('./better-auth.BzKRBwSF.cjs');
5
+ const account = require('./better-auth.GVCiTzec.cjs');
6
6
  require('./better-auth.DiSjtgs9.cjs');
7
7
  require('@better-auth/utils/base64');
8
8
  require('@better-auth/utils/hmac');
9
9
  require('./better-auth.CHyZMcYK.cjs');
10
- const crudTeam = require('./better-auth.BvJDkY_b.cjs');
10
+ const crudTeam = require('./better-auth.Cr6NZZDX.cjs');
11
11
  const plugins_organization_access_index = require('../plugins/organization/access/index.cjs');
12
12
 
13
13
  const shimContext = (originalObject, newContext) => {
@@ -166,11 +166,6 @@ const organization = (options) => {
166
166
  }
167
167
  },
168
168
  async (ctx) => {
169
- if (!ctx.body.permission || Object.keys(ctx.body.permission).length > 1) {
170
- throw new betterCall.APIError("BAD_REQUEST", {
171
- message: "invalid permission check. you can only check one resource permission at a time."
172
- });
173
- }
174
169
  const activeOrganizationId = ctx.body.organizationId || ctx.context.session.session.activeOrganizationId;
175
170
  if (!activeOrganizationId) {
176
171
  throw new betterCall.APIError("BAD_REQUEST", {
@@ -5,7 +5,7 @@ const cookies_index = require('../cookies/index.cjs');
5
5
  const betterCall = require('better-call');
6
6
  const socialProviders_index = require('../social-providers/index.cjs');
7
7
  require('@better-auth/utils/random');
8
- const state = require('./better-auth.GgQnT00n.cjs');
8
+ const state = require('./better-auth.CHHC_PJT.cjs');
9
9
  const logger = require('./better-auth.GpOOav9x.cjs');
10
10
  const date = require('./better-auth.C1hdVENX.cjs');
11
11
  const id = require('./better-auth.Bg6iw3ig.cjs');
@@ -26,7 +26,7 @@ const hmac = require('@better-auth/utils/hmac');
26
26
  require('@better-fetch/fetch');
27
27
  require('defu');
28
28
  const jwt = require('./better-auth.BMYo0QR-.cjs');
29
- const url = require('./better-auth.DhfiEsxl.cjs');
29
+ const url = require('./better-auth.C-R0J0n1.cjs');
30
30
  const errors = require('jose/errors');
31
31
  const json = require('./better-auth.D3mtHEZg.cjs');
32
32
  const binary = require('@better-auth/utils/binary');
@@ -178,7 +178,7 @@ const originCheckMiddleware = createAuthMiddleware(async (ctx) => {
178
178
  const newUserCallbackURL = body?.newUserCallbackURL;
179
179
  const trustedOrigins = Array.isArray(context.options.trustedOrigins) ? context.trustedOrigins : [
180
180
  ...context.trustedOrigins,
181
- ...context.options.trustedOrigins?.(ctx.request) || []
181
+ ...await context.options.trustedOrigins?.(ctx.request) || []
182
182
  ];
183
183
  const usesCookies = ctx.headers?.has("cookie");
184
184
  const matchesPattern = (url$1, pattern) => {
@@ -226,7 +226,7 @@ const originCheck = (getValue) => createAuthMiddleware(async (ctx) => {
226
226
  context.options.trustedOrigins
227
227
  ) ? context.trustedOrigins : [
228
228
  ...context.trustedOrigins,
229
- ...context.options.trustedOrigins?.(ctx.request) || []
229
+ ...await context.options.trustedOrigins?.(ctx.request) || []
230
230
  ];
231
231
  const matchesPattern = (url$1, pattern) => {
232
232
  if (url$1.startsWith("/")) {
@@ -1634,9 +1634,7 @@ const callbackOAuth = createAuthEndpoint(
1634
1634
  }
1635
1635
  } catch (e) {
1636
1636
  c.context.logger.error("INVALID_CALLBACK_REQUEST", e);
1637
- throw c.redirect(
1638
- `${c.context.baseURL}/error?error=invalid_callback_request`
1639
- );
1637
+ throw c.redirect(`${defaultErrorURL}?error=invalid_callback_request`);
1640
1638
  }
1641
1639
  const { code, error, state: state$1, error_description, device_id } = queryOrBody;
1642
1640
  if (error) {
@@ -1657,7 +1655,7 @@ const callbackOAuth = createAuthEndpoint(
1657
1655
  requestSignUp
1658
1656
  } = await state.parseState(c);
1659
1657
  function redirectOnError(error2) {
1660
- let url = errorURL || callbackURL || `${c.context.baseURL}/error`;
1658
+ let url = errorURL || callbackURL || defaultErrorURL;
1661
1659
  if (url.includes("?")) {
1662
1660
  url = `${url}&error=${error2}`;
1663
1661
  } else {
@@ -2577,15 +2575,14 @@ const changeEmail = createAuthEndpoint(
2577
2575
  message: "Change email is disabled"
2578
2576
  });
2579
2577
  }
2580
- if (ctx.body.newEmail === ctx.context.session.user.email) {
2578
+ const newEmail = ctx.body.newEmail.toLowerCase();
2579
+ if (newEmail === ctx.context.session.user.email) {
2581
2580
  ctx.context.logger.error("Email is the same");
2582
2581
  throw new betterCall.APIError("BAD_REQUEST", {
2583
2582
  message: "Email is the same"
2584
2583
  });
2585
2584
  }
2586
- const existingUser = await ctx.context.internalAdapter.findUserByEmail(
2587
- ctx.body.newEmail
2588
- );
2585
+ const existingUser = await ctx.context.internalAdapter.findUserByEmail(newEmail);
2589
2586
  if (existingUser) {
2590
2587
  ctx.context.logger.error("Email already exists");
2591
2588
  throw new betterCall.APIError("BAD_REQUEST", {
@@ -2593,9 +2590,7 @@ const changeEmail = createAuthEndpoint(
2593
2590
  });
2594
2591
  }
2595
2592
  if (ctx.context.session.user.emailVerified !== true) {
2596
- const existing = await ctx.context.internalAdapter.findUserByEmail(
2597
- ctx.body.newEmail
2598
- );
2593
+ const existing = await ctx.context.internalAdapter.findUserByEmail(newEmail);
2599
2594
  if (existing) {
2600
2595
  throw new betterCall.APIError("UNPROCESSABLE_ENTITY", {
2601
2596
  message: BASE_ERROR_CODES.USER_ALREADY_EXISTS
@@ -2604,15 +2599,22 @@ const changeEmail = createAuthEndpoint(
2604
2599
  await ctx.context.internalAdapter.updateUserByEmail(
2605
2600
  ctx.context.session.user.email,
2606
2601
  {
2607
- email: ctx.body.newEmail
2602
+ email: newEmail
2608
2603
  },
2609
2604
  ctx
2610
2605
  );
2606
+ await cookies_index.setSessionCookie(ctx, {
2607
+ session: ctx.context.session.session,
2608
+ user: {
2609
+ ...ctx.context.session.user,
2610
+ email: newEmail
2611
+ }
2612
+ });
2611
2613
  if (ctx.context.options.emailVerification?.sendVerificationEmail) {
2612
2614
  const token2 = await createEmailVerificationToken(
2613
2615
  ctx.context.secret,
2614
2616
  ctx.context.session.user.email,
2615
- ctx.body.newEmail,
2617
+ newEmail,
2616
2618
  ctx.context.options.emailVerification?.expiresIn
2617
2619
  );
2618
2620
  const url2 = `${ctx.context.baseURL}/verify-email?token=${token2}&callbackURL=${ctx.body.callbackURL || "/"}`;
@@ -2620,7 +2622,7 @@ const changeEmail = createAuthEndpoint(
2620
2622
  {
2621
2623
  user: {
2622
2624
  ...ctx.context.session.user,
2623
- email: ctx.body.newEmail
2625
+ email: newEmail
2624
2626
  },
2625
2627
  url: url2,
2626
2628
  token: token2
@@ -2641,14 +2643,14 @@ const changeEmail = createAuthEndpoint(
2641
2643
  const token = await createEmailVerificationToken(
2642
2644
  ctx.context.secret,
2643
2645
  ctx.context.session.user.email,
2644
- ctx.body.newEmail,
2646
+ newEmail,
2645
2647
  ctx.context.options.emailVerification?.expiresIn
2646
2648
  );
2647
2649
  const url = `${ctx.context.baseURL}/verify-email?token=${token}&callbackURL=${ctx.body.callbackURL || "/"}`;
2648
2650
  await ctx.context.options.user.changeEmail.sendChangeEmailVerification(
2649
2651
  {
2650
2652
  user: ctx.context.session.user,
2651
- newEmail: ctx.body.newEmail,
2653
+ newEmail,
2652
2654
  url,
2653
2655
  token
2654
2656
  },
@@ -2982,10 +2984,7 @@ const unlinkAccount = createAuthEndpoint(
2982
2984
  message: BASE_ERROR_CODES.ACCOUNT_NOT_FOUND
2983
2985
  });
2984
2986
  }
2985
- await ctx.context.internalAdapter.deleteAccount(
2986
- ctx.body.providerId,
2987
- ctx.context.session.user.id
2988
- );
2987
+ await ctx.context.internalAdapter.deleteAccount(accountExist.id);
2989
2988
  return ctx.json({
2990
2989
  status: true
2991
2990
  });
@@ -19,7 +19,7 @@ function withPath(url, path = "/api/auth") {
19
19
  path = path.startsWith("/") ? path : `/${path}`;
20
20
  return `${url.replace(/\/+$/, "")}${path}`;
21
21
  }
22
- function getBaseURL(url, path) {
22
+ function getBaseURL(url, path, request) {
23
23
  if (url) {
24
24
  return withPath(url, path);
25
25
  }
@@ -27,6 +27,20 @@ function getBaseURL(url, path) {
27
27
  if (fromEnv) {
28
28
  return withPath(fromEnv, path);
29
29
  }
30
+ const fromRequest = request?.headers.get("x-forwarded-host");
31
+ const fromRequestProto = request?.headers.get("x-forwarded-proto");
32
+ if (fromRequest && fromRequestProto) {
33
+ return withPath(`${fromRequestProto}://${fromRequest}`, path);
34
+ }
35
+ if (request) {
36
+ const url2 = getOrigin(request.url);
37
+ if (!url2) {
38
+ throw new BetterAuthError(
39
+ "Could not get origin from request. Please provide a valid base URL."
40
+ );
41
+ }
42
+ return withPath(url2, path);
43
+ }
30
44
  if (typeof window !== "undefined" && window.location) {
31
45
  return withPath(window.location.origin, path);
32
46
  }
@@ -1,4 +1,4 @@
1
- import { G as GenericEndpointContext } from './better-auth.imLEY-xr.mjs';
1
+ import { G as GenericEndpointContext } from './better-auth.CPKTEzG-.cjs';
2
2
 
3
3
  declare function generateState(c: GenericEndpointContext, link?: {
4
4
  email: string;
@@ -2,7 +2,7 @@ import { AccessControl, Role, Statements } from '../plugins/access/index.js';
2
2
  import { z } from 'zod';
3
3
  import * as better_call from 'better-call';
4
4
  import { b as Prettify } from './better-auth.Bi8FQwDD.js';
5
- import { U as User, S as Session, G as GenericEndpointContext } from './better-auth.purQujiV.js';
5
+ import { U as User, S as Session, G as GenericEndpointContext } from './better-auth.DiHCWsNg.js';
6
6
  import { defaultRoles } from '../plugins/organization/access/index.js';
7
7
 
8
8
  declare const organizationSchema: z.ZodObject<{
@@ -1070,6 +1070,7 @@ const roblox = (options) => {
1070
1070
  if (error) {
1071
1071
  return null;
1072
1072
  }
1073
+ const userMap = await options.mapProfileToUser?.(profile);
1073
1074
  return {
1074
1075
  user: {
1075
1076
  id: profile.sub,
@@ -1077,7 +1078,8 @@ const roblox = (options) => {
1077
1078
  image: profile.picture,
1078
1079
  email: profile.preferred_username || null,
1079
1080
  // Roblox does not provide email
1080
- emailVerified: true
1081
+ emailVerified: true,
1082
+ ...userMap
1081
1083
  },
1082
1084
  data: {
1083
1085
  ...profile
@@ -1068,6 +1068,7 @@ const roblox = (options) => {
1068
1068
  if (error) {
1069
1069
  return null;
1070
1070
  }
1071
+ const userMap = await options.mapProfileToUser?.(profile);
1071
1072
  return {
1072
1073
  user: {
1073
1074
  id: profile.sub,
@@ -1075,7 +1076,8 @@ const roblox = (options) => {
1075
1076
  image: profile.picture,
1076
1077
  email: profile.preferred_username || null,
1077
1078
  // Roblox does not provide email
1078
- emailVerified: true
1079
+ emailVerified: true,
1080
+ ...userMap
1079
1081
  },
1080
1082
  data: {
1081
1083
  ...profile
@@ -1,5 +1,5 @@
1
- import { B as BetterAuthPlugin, a3 as InferFieldsInputClient, a1 as InferFieldsOutput, U as User, S as Session, i as Auth } from '../shared/better-auth.BAR_8WbD.cjs';
2
- export { u as Account, g as Adapter, x as AdapterInstance, w as AdapterSchemaCreation, r as AdditionalSessionFieldsInput, s as AdditionalSessionFieldsOutput, p as AdditionalUserFieldsInput, q as AdditionalUserFieldsOutput, l as AuthContext, A as AuthPluginSchema, f as BetterAuthOptions, z as FilterActions, F as FilteredAPI, G as GenericEndpointContext, H as HookEndpointContext, D as InferAPI, I as InferOptionSchema, a as InferPluginErrorCodes, t as InferPluginTypes, k as InferSession, C as InferSessionAPI, j as InferUser, M as Models, R as RateLimit, y as SecondaryStorage, V as Verification, W as Where, v as init } from '../shared/better-auth.BAR_8WbD.cjs';
1
+ import { B as BetterAuthPlugin, a3 as InferFieldsInputClient, a1 as InferFieldsOutput, U as User, S as Session, i as Auth } from '../shared/better-auth.CPKTEzG-.cjs';
2
+ export { u as Account, g as Adapter, x as AdapterInstance, w as AdapterSchemaCreation, r as AdditionalSessionFieldsInput, s as AdditionalSessionFieldsOutput, p as AdditionalUserFieldsInput, q as AdditionalUserFieldsOutput, l as AuthContext, A as AuthPluginSchema, f as BetterAuthOptions, z as FilterActions, F as FilteredAPI, G as GenericEndpointContext, H as HookEndpointContext, D as InferAPI, I as InferOptionSchema, a as InferPluginErrorCodes, t as InferPluginTypes, k as InferSession, C as InferSessionAPI, j as InferUser, M as Models, R as RateLimit, y as SecondaryStorage, V as Verification, W as Where, v as init } from '../shared/better-auth.CPKTEzG-.cjs';
3
3
  import { BetterFetchOption, BetterFetchResponse, BetterFetch, BetterFetchPlugin } from '@better-fetch/fetch';
4
4
  import { WritableAtom, Atom } from 'nanostores';
5
5
  import { U as UnionToIntersection, H as HasRequiredKeys, b as Prettify, L as LiteralString, S as StripEmptyObjects } from '../shared/better-auth.Bi8FQwDD.cjs';
@@ -30,7 +30,7 @@ type InferUserUpdateCtx<ClientOpts extends ClientOptions, FetchOptions extends B
30
30
  fetchOptions?: FetchOptions;
31
31
  } & Partial<UnionToIntersection<InferAdditionalFromClient<ClientOpts, "user", "input">>>;
32
32
  type InferCtx<C extends InputContext<any, any>, FetchOptions extends BetterFetchOption> = C["body"] extends Record<string, any> ? C["body"] & {
33
- fetchOptions?: BetterFetchOption<undefined, C["query"], C["params"]>;
33
+ fetchOptions?: FetchOptions;
34
34
  } : C["query"] extends Record<string, any> ? {
35
35
  query: C["query"];
36
36
  fetchOptions?: FetchOptions;
@@ -59,6 +59,7 @@ type InferRoute<API, COpts extends ClientOptions> = API extends Record<string, i
59
59
  } : NonNullable<Awaited<R>>, {
60
60
  code?: string;
61
61
  message?: string;
62
+ t?: FetchOptions["throw"];
62
63
  }, FetchOptions["throw"] extends true ? true : COpts["fetchOptions"] extends {
63
64
  throw: true;
64
65
  } ? true : false>> : never : never> : {} : never;