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
@@ -6,7 +6,7 @@ export * from '@better-fetch/fetch';
6
6
  import { ClientOptions, BetterAuthClientPlugin, IsSignal, InferClientAPI, InferActions, InferErrorCodes } from '../../types/index.mjs';
7
7
  import { U as UnionToIntersection, P as PrettifyDeep } from '../../shared/better-auth.Bi8FQwDD.mjs';
8
8
  import { DependencyList } from 'react';
9
- import { h as BASE_ERROR_CODES } from '../../shared/better-auth.imLEY-xr.mjs';
9
+ import { h as BASE_ERROR_CODES } from '../../shared/better-auth.Ck0xlDsK.mjs';
10
10
  import 'better-call';
11
11
  import 'zod';
12
12
  import 'kysely';
@@ -30,7 +30,30 @@ interface UseStoreOptions<SomeStore> {
30
30
  */
31
31
  keys?: StoreKeys<SomeStore>[];
32
32
  }
33
- declare function useStore<SomeStore extends Store>(store: SomeStore, { keys, deps }?: UseStoreOptions<SomeStore>): StoreValue<SomeStore>;
33
+ /**
34
+ * Subscribe to store changes and get store's value.
35
+ *
36
+ * Can be user with store builder too.
37
+ *
38
+ * ```js
39
+ * import { useStore } from 'nanostores/react'
40
+ *
41
+ * import { router } from '../store/router'
42
+ *
43
+ * export const Layout = () => {
44
+ * let page = useStore(router)
45
+ * if (page.route === 'home') {
46
+ * return <HomePage />
47
+ * } else {
48
+ * return <Error404 />
49
+ * }
50
+ * }
51
+ * ```
52
+ *
53
+ * @param store Store instance.
54
+ * @returns Store value.
55
+ */
56
+ declare function useStore<SomeStore extends Store>(store: SomeStore, options?: UseStoreOptions<SomeStore>): StoreValue<SomeStore>;
34
57
 
35
58
  declare function capitalizeFirstLetter(str: string): string;
36
59
  type InferResolvedHooks<O extends ClientOptions> = O["plugins"] extends Array<infer Plugin> ? Plugin extends BetterAuthClientPlugin ? Plugin["getAtoms"] extends (fetch: any) => infer Atoms ? Atoms extends Record<string, any> ? {
@@ -6,7 +6,7 @@ export * from '@better-fetch/fetch';
6
6
  import { ClientOptions, BetterAuthClientPlugin, IsSignal, InferClientAPI, InferActions, InferErrorCodes } from '../../types/index.js';
7
7
  import { U as UnionToIntersection, P as PrettifyDeep } from '../../shared/better-auth.Bi8FQwDD.js';
8
8
  import { DependencyList } from 'react';
9
- import { h as BASE_ERROR_CODES } from '../../shared/better-auth.purQujiV.js';
9
+ import { h as BASE_ERROR_CODES } from '../../shared/better-auth.DiHCWsNg.js';
10
10
  import 'better-call';
11
11
  import 'zod';
12
12
  import 'kysely';
@@ -30,7 +30,30 @@ interface UseStoreOptions<SomeStore> {
30
30
  */
31
31
  keys?: StoreKeys<SomeStore>[];
32
32
  }
33
- declare function useStore<SomeStore extends Store>(store: SomeStore, { keys, deps }?: UseStoreOptions<SomeStore>): StoreValue<SomeStore>;
33
+ /**
34
+ * Subscribe to store changes and get store's value.
35
+ *
36
+ * Can be user with store builder too.
37
+ *
38
+ * ```js
39
+ * import { useStore } from 'nanostores/react'
40
+ *
41
+ * import { router } from '../store/router'
42
+ *
43
+ * export const Layout = () => {
44
+ * let page = useStore(router)
45
+ * if (page.route === 'home') {
46
+ * return <HomePage />
47
+ * } else {
48
+ * return <Error404 />
49
+ * }
50
+ * }
51
+ * ```
52
+ *
53
+ * @param store Store instance.
54
+ * @returns Store value.
55
+ */
56
+ declare function useStore<SomeStore extends Store>(store: SomeStore, options?: UseStoreOptions<SomeStore>): StoreValue<SomeStore>;
34
57
 
35
58
  declare function capitalizeFirstLetter(str: string): string;
36
59
  type InferResolvedHooks<O extends ClientOptions> = O["plugins"] extends Array<infer Plugin> ? Plugin extends BetterAuthClientPlugin ? Plugin["getAtoms"] extends (fetch: any) => infer Atoms ? Atoms extends Record<string, any> ? {
@@ -1,24 +1,28 @@
1
- import { g as getClientConfig, c as createDynamicPathProxy } from '../../shared/better-auth.YSKz0i4l.mjs';
1
+ import { g as getClientConfig, c as createDynamicPathProxy } from '../../shared/better-auth.CSVqSIae.mjs';
2
2
  import { listenKeys } from 'nanostores';
3
3
  import { useRef, useCallback, useSyncExternalStore } from 'react';
4
4
  import '@better-fetch/fetch';
5
- import '../../shared/better-auth.NcLhHEks.mjs';
5
+ import '../../shared/better-auth.VTXNLFMT.mjs';
6
6
  import '../../shared/better-auth.8zoxzg-F.mjs';
7
7
  import '../../shared/better-auth.DdzSJf-n.mjs';
8
8
  import '../../shared/better-auth.CQvoVIBD.mjs';
9
9
  import '../../shared/better-auth.ffWeg50w.mjs';
10
10
 
11
- let emit = (snapshotRef, onChange) => (value) => {
12
- snapshotRef.current = value;
13
- onChange();
14
- };
15
- function useStore(store, { keys, deps = [store, keys] } = {}) {
16
- let snapshotRef = useRef();
17
- snapshotRef.current = store.get();
18
- let subscribe = useCallback(
19
- (onChange) => (keys?.length || 0) > 0 ? listenKeys(store, keys, emit(snapshotRef, onChange)) : store.listen(emit(snapshotRef, onChange)),
20
- deps
21
- );
11
+ function useStore(store, options = {}) {
12
+ let snapshotRef = useRef(store.get());
13
+ const { keys, deps = [store, keys] } = options;
14
+ let subscribe = useCallback((onChange) => {
15
+ const emitChange = (value) => {
16
+ if (snapshotRef.current === value) return;
17
+ snapshotRef.current = value;
18
+ onChange();
19
+ };
20
+ emitChange(store.value);
21
+ if (keys?.length) {
22
+ return listenKeys(store, keys, emitChange);
23
+ }
24
+ return store.listen(emitChange);
25
+ }, deps);
22
26
  let get = () => snapshotRef.current;
23
27
  return useSyncExternalStore(subscribe, get, get);
24
28
  }
@@ -1,11 +1,11 @@
1
1
  'use strict';
2
2
 
3
- const proxy = require('../../shared/better-auth.DNb3Aogp.cjs');
3
+ const proxy = require('../../shared/better-auth.BN2jUYPL.cjs');
4
4
  const misc = require('../../shared/better-auth.BLDOwz3i.cjs');
5
5
  const store = require('solid-js/store');
6
6
  const solidJs = require('solid-js');
7
7
  require('@better-fetch/fetch');
8
- require('../../shared/better-auth.DhfiEsxl.cjs');
8
+ require('../../shared/better-auth.C-R0J0n1.cjs');
9
9
  require('../../shared/better-auth.DiSjtgs9.cjs');
10
10
  require('../../shared/better-auth.ANpbi45u.cjs');
11
11
  require('nanostores');
@@ -3,7 +3,7 @@ import { BetterFetchError } from '@better-fetch/fetch';
3
3
  import { ClientOptions, BetterAuthClientPlugin, IsSignal, InferClientAPI, InferActions, InferErrorCodes } from '../../types/index.cjs';
4
4
  import { Accessor } from 'solid-js';
5
5
  import { U as UnionToIntersection, P as PrettifyDeep } from '../../shared/better-auth.Bi8FQwDD.cjs';
6
- import { h as BASE_ERROR_CODES } from '../../shared/better-auth.BAR_8WbD.cjs';
6
+ import { h as BASE_ERROR_CODES } from '../../shared/better-auth.CPKTEzG-.cjs';
7
7
  import 'nanostores';
8
8
  import 'better-call';
9
9
  import 'zod';
@@ -3,7 +3,7 @@ import { BetterFetchError } from '@better-fetch/fetch';
3
3
  import { ClientOptions, BetterAuthClientPlugin, IsSignal, InferClientAPI, InferActions, InferErrorCodes } from '../../types/index.mjs';
4
4
  import { Accessor } from 'solid-js';
5
5
  import { U as UnionToIntersection, P as PrettifyDeep } from '../../shared/better-auth.Bi8FQwDD.mjs';
6
- import { h as BASE_ERROR_CODES } from '../../shared/better-auth.imLEY-xr.mjs';
6
+ import { h as BASE_ERROR_CODES } from '../../shared/better-auth.Ck0xlDsK.mjs';
7
7
  import 'nanostores';
8
8
  import 'better-call';
9
9
  import 'zod';
@@ -3,7 +3,7 @@ import { BetterFetchError } from '@better-fetch/fetch';
3
3
  import { ClientOptions, BetterAuthClientPlugin, IsSignal, InferClientAPI, InferActions, InferErrorCodes } from '../../types/index.js';
4
4
  import { Accessor } from 'solid-js';
5
5
  import { U as UnionToIntersection, P as PrettifyDeep } from '../../shared/better-auth.Bi8FQwDD.js';
6
- import { h as BASE_ERROR_CODES } from '../../shared/better-auth.purQujiV.js';
6
+ import { h as BASE_ERROR_CODES } from '../../shared/better-auth.DiHCWsNg.js';
7
7
  import 'nanostores';
8
8
  import 'better-call';
9
9
  import 'zod';
@@ -1,9 +1,9 @@
1
- import { g as getClientConfig, c as createDynamicPathProxy } from '../../shared/better-auth.YSKz0i4l.mjs';
1
+ import { g as getClientConfig, c as createDynamicPathProxy } from '../../shared/better-auth.CSVqSIae.mjs';
2
2
  import { c as capitalizeFirstLetter } from '../../shared/better-auth.D-2CmEwz.mjs';
3
3
  import { createStore, reconcile } from 'solid-js/store';
4
4
  import { onCleanup } from 'solid-js';
5
5
  import '@better-fetch/fetch';
6
- import '../../shared/better-auth.NcLhHEks.mjs';
6
+ import '../../shared/better-auth.VTXNLFMT.mjs';
7
7
  import '../../shared/better-auth.8zoxzg-F.mjs';
8
8
  import '../../shared/better-auth.DdzSJf-n.mjs';
9
9
  import 'nanostores';
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
- const proxy = require('../../shared/better-auth.DNb3Aogp.cjs');
3
+ const proxy = require('../../shared/better-auth.BN2jUYPL.cjs');
4
4
  const misc = require('../../shared/better-auth.BLDOwz3i.cjs');
5
5
  require('@better-fetch/fetch');
6
- require('../../shared/better-auth.DhfiEsxl.cjs');
6
+ require('../../shared/better-auth.C-R0J0n1.cjs');
7
7
  require('../../shared/better-auth.DiSjtgs9.cjs');
8
8
  require('../../shared/better-auth.ANpbi45u.cjs');
9
9
  require('nanostores');
@@ -4,7 +4,7 @@ import * as _better_fetch_fetch from '@better-fetch/fetch';
4
4
  import { BetterFetchError } from '@better-fetch/fetch';
5
5
  import { ClientOptions, BetterAuthClientPlugin, IsSignal, InferClientAPI, InferActions, InferErrorCodes } from '../../types/index.cjs';
6
6
  import { U as UnionToIntersection, P as PrettifyDeep } from '../../shared/better-auth.Bi8FQwDD.cjs';
7
- import { h as BASE_ERROR_CODES } from '../../shared/better-auth.BAR_8WbD.cjs';
7
+ import { h as BASE_ERROR_CODES } from '../../shared/better-auth.CPKTEzG-.cjs';
8
8
  import 'better-call';
9
9
  import 'zod';
10
10
  import 'kysely';
@@ -4,7 +4,7 @@ import * as _better_fetch_fetch from '@better-fetch/fetch';
4
4
  import { BetterFetchError } from '@better-fetch/fetch';
5
5
  import { ClientOptions, BetterAuthClientPlugin, IsSignal, InferClientAPI, InferActions, InferErrorCodes } from '../../types/index.mjs';
6
6
  import { U as UnionToIntersection, P as PrettifyDeep } from '../../shared/better-auth.Bi8FQwDD.mjs';
7
- import { h as BASE_ERROR_CODES } from '../../shared/better-auth.imLEY-xr.mjs';
7
+ import { h as BASE_ERROR_CODES } from '../../shared/better-auth.Ck0xlDsK.mjs';
8
8
  import 'better-call';
9
9
  import 'zod';
10
10
  import 'kysely';
@@ -4,7 +4,7 @@ import * as _better_fetch_fetch from '@better-fetch/fetch';
4
4
  import { BetterFetchError } from '@better-fetch/fetch';
5
5
  import { ClientOptions, BetterAuthClientPlugin, IsSignal, InferClientAPI, InferActions, InferErrorCodes } from '../../types/index.js';
6
6
  import { U as UnionToIntersection, P as PrettifyDeep } from '../../shared/better-auth.Bi8FQwDD.js';
7
- import { h as BASE_ERROR_CODES } from '../../shared/better-auth.purQujiV.js';
7
+ import { h as BASE_ERROR_CODES } from '../../shared/better-auth.DiHCWsNg.js';
8
8
  import 'better-call';
9
9
  import 'zod';
10
10
  import 'kysely';
@@ -1,7 +1,7 @@
1
- import { g as getClientConfig, c as createDynamicPathProxy } from '../../shared/better-auth.YSKz0i4l.mjs';
1
+ import { g as getClientConfig, c as createDynamicPathProxy } from '../../shared/better-auth.CSVqSIae.mjs';
2
2
  import { c as capitalizeFirstLetter } from '../../shared/better-auth.D-2CmEwz.mjs';
3
3
  import '@better-fetch/fetch';
4
- import '../../shared/better-auth.NcLhHEks.mjs';
4
+ import '../../shared/better-auth.VTXNLFMT.mjs';
5
5
  import '../../shared/better-auth.8zoxzg-F.mjs';
6
6
  import '../../shared/better-auth.DdzSJf-n.mjs';
7
7
  import 'nanostores';
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
3
  const vue = require('vue');
4
- const proxy = require('../../shared/better-auth.DNb3Aogp.cjs');
4
+ const proxy = require('../../shared/better-auth.BN2jUYPL.cjs');
5
5
  const misc = require('../../shared/better-auth.BLDOwz3i.cjs');
6
6
  require('@better-fetch/fetch');
7
- require('../../shared/better-auth.DhfiEsxl.cjs');
7
+ require('../../shared/better-auth.C-R0J0n1.cjs');
8
8
  require('../../shared/better-auth.DiSjtgs9.cjs');
9
9
  require('../../shared/better-auth.ANpbi45u.cjs');
10
10
  require('nanostores');
@@ -4,7 +4,7 @@ import { BetterFetchError } from '@better-fetch/fetch';
4
4
  import { DeepReadonly, Ref } from 'vue';
5
5
  import { ClientOptions, BetterAuthClientPlugin, IsSignal, InferClientAPI, InferActions, InferErrorCodes } from '../../types/index.cjs';
6
6
  import { U as UnionToIntersection, P as PrettifyDeep } from '../../shared/better-auth.Bi8FQwDD.cjs';
7
- import { h as BASE_ERROR_CODES } from '../../shared/better-auth.BAR_8WbD.cjs';
7
+ import { h as BASE_ERROR_CODES } from '../../shared/better-auth.CPKTEzG-.cjs';
8
8
  import 'better-call';
9
9
  import 'zod';
10
10
  import 'kysely';
@@ -4,7 +4,7 @@ import { BetterFetchError } from '@better-fetch/fetch';
4
4
  import { DeepReadonly, Ref } from 'vue';
5
5
  import { ClientOptions, BetterAuthClientPlugin, IsSignal, InferClientAPI, InferActions, InferErrorCodes } from '../../types/index.mjs';
6
6
  import { U as UnionToIntersection, P as PrettifyDeep } from '../../shared/better-auth.Bi8FQwDD.mjs';
7
- import { h as BASE_ERROR_CODES } from '../../shared/better-auth.imLEY-xr.mjs';
7
+ import { h as BASE_ERROR_CODES } from '../../shared/better-auth.Ck0xlDsK.mjs';
8
8
  import 'better-call';
9
9
  import 'zod';
10
10
  import 'kysely';
@@ -4,7 +4,7 @@ import { BetterFetchError } from '@better-fetch/fetch';
4
4
  import { DeepReadonly, Ref } from 'vue';
5
5
  import { ClientOptions, BetterAuthClientPlugin, IsSignal, InferClientAPI, InferActions, InferErrorCodes } from '../../types/index.js';
6
6
  import { U as UnionToIntersection, P as PrettifyDeep } from '../../shared/better-auth.Bi8FQwDD.js';
7
- import { h as BASE_ERROR_CODES } from '../../shared/better-auth.purQujiV.js';
7
+ import { h as BASE_ERROR_CODES } from '../../shared/better-auth.DiHCWsNg.js';
8
8
  import 'better-call';
9
9
  import 'zod';
10
10
  import 'kysely';
@@ -1,8 +1,8 @@
1
1
  import { shallowRef, getCurrentScope, onScopeDispose, readonly, getCurrentInstance } from 'vue';
2
- import { g as getClientConfig, c as createDynamicPathProxy } from '../../shared/better-auth.YSKz0i4l.mjs';
2
+ import { g as getClientConfig, c as createDynamicPathProxy } from '../../shared/better-auth.CSVqSIae.mjs';
3
3
  import { c as capitalizeFirstLetter } from '../../shared/better-auth.D-2CmEwz.mjs';
4
4
  import '@better-fetch/fetch';
5
- import '../../shared/better-auth.NcLhHEks.mjs';
5
+ import '../../shared/better-auth.VTXNLFMT.mjs';
6
6
  import '../../shared/better-auth.8zoxzg-F.mjs';
7
7
  import '../../shared/better-auth.DdzSJf-n.mjs';
8
8
  import 'nanostores';
@@ -355,8 +355,12 @@ const getSessionCookie = (request, config) => {
355
355
  if (!cookies) {
356
356
  return null;
357
357
  }
358
- const { cookieName = "session_token", cookiePrefix = "better-auth" } = config || {};
359
- const name = env.isProduction ? `__Secure-${cookiePrefix}.${cookieName}` : `${cookiePrefix}.${cookieName}`;
358
+ const {
359
+ cookieName = "session_token",
360
+ cookiePrefix = "better-auth",
361
+ useSecureCookies = request instanceof Request && env.isProduction && request.url.startsWith("https://") || (request instanceof Request && request.url.startsWith("https://") ? true : false)
362
+ } = config || {};
363
+ const name = useSecureCookies ? `__Secure-${cookiePrefix}.${cookieName}` : `${cookiePrefix}.${cookieName}`;
360
364
  const parsedCookie = parseCookies(cookies);
361
365
  const sessionToken = parsedCookie.get(name);
362
366
  if (sessionToken) {
@@ -1,5 +1,5 @@
1
1
  import 'better-call';
2
- export { aq as BetterAuthCookies, av as EligibleCookies, ao as createCookieGetter, at as deleteSessionCookie, ax as getCookieCache, ap as getCookies, aw as getSessionCookie, au as parseCookies, ay as parseSetCookieHeader, ar as setCookieCache, az as setCookieToHeader, as as setSessionCookie } from '../shared/better-auth.BAR_8WbD.cjs';
2
+ export { aq as BetterAuthCookies, av as EligibleCookies, ao as createCookieGetter, at as deleteSessionCookie, ax as getCookieCache, ap as getCookies, aw as getSessionCookie, au as parseCookies, ay as parseSetCookieHeader, ar as setCookieCache, az as setCookieToHeader, as as setSessionCookie } from '../shared/better-auth.CPKTEzG-.cjs';
3
3
  import '../shared/better-auth.Bi8FQwDD.cjs';
4
4
  import 'zod';
5
5
  import 'kysely';
@@ -1,5 +1,5 @@
1
1
  import 'better-call';
2
- export { aq as BetterAuthCookies, av as EligibleCookies, ao as createCookieGetter, at as deleteSessionCookie, ax as getCookieCache, ap as getCookies, aw as getSessionCookie, au as parseCookies, ay as parseSetCookieHeader, ar as setCookieCache, az as setCookieToHeader, as as setSessionCookie } from '../shared/better-auth.imLEY-xr.mjs';
2
+ export { aq as BetterAuthCookies, av as EligibleCookies, ao as createCookieGetter, at as deleteSessionCookie, ax as getCookieCache, ap as getCookies, aw as getSessionCookie, au as parseCookies, ay as parseSetCookieHeader, ar as setCookieCache, az as setCookieToHeader, as as setSessionCookie } from '../shared/better-auth.Ck0xlDsK.mjs';
3
3
  import '../shared/better-auth.Bi8FQwDD.mjs';
4
4
  import 'zod';
5
5
  import 'kysely';
@@ -1,5 +1,5 @@
1
1
  import 'better-call';
2
- export { aq as BetterAuthCookies, av as EligibleCookies, ao as createCookieGetter, at as deleteSessionCookie, ax as getCookieCache, ap as getCookies, aw as getSessionCookie, au as parseCookies, ay as parseSetCookieHeader, ar as setCookieCache, az as setCookieToHeader, as as setSessionCookie } from '../shared/better-auth.purQujiV.js';
2
+ export { aq as BetterAuthCookies, av as EligibleCookies, ao as createCookieGetter, at as deleteSessionCookie, ax as getCookieCache, ap as getCookies, aw as getSessionCookie, au as parseCookies, ay as parseSetCookieHeader, ar as setCookieCache, az as setCookieToHeader, as as setSessionCookie } from '../shared/better-auth.DiHCWsNg.js';
3
3
  import '../shared/better-auth.Bi8FQwDD.js';
4
4
  import 'zod';
5
5
  import 'kysely';
@@ -353,8 +353,12 @@ const getSessionCookie = (request, config) => {
353
353
  if (!cookies) {
354
354
  return null;
355
355
  }
356
- const { cookieName = "session_token", cookiePrefix = "better-auth" } = config || {};
357
- const name = isProduction ? `__Secure-${cookiePrefix}.${cookieName}` : `${cookiePrefix}.${cookieName}`;
356
+ const {
357
+ cookieName = "session_token",
358
+ cookiePrefix = "better-auth",
359
+ useSecureCookies = request instanceof Request && isProduction && request.url.startsWith("https://") || (request instanceof Request && request.url.startsWith("https://") ? true : false)
360
+ } = config || {};
361
+ const name = useSecureCookies ? `__Secure-${cookiePrefix}.${cookieName}` : `${cookiePrefix}.${cookieName}`;
358
362
  const parsedCookie = parseCookies(cookies);
359
363
  const sessionToken = parsedCookie.get(name);
360
364
  if (sessionToken) {
package/dist/db/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const getMigration = require('../shared/better-auth.CKg1f8vU.cjs');
3
+ const getMigration = require('../shared/better-auth.DcpLarbN.cjs');
4
4
  const getTables = require('../shared/better-auth.BEphVDyL.cjs');
5
5
  const zod = require('zod');
6
6
  const schema = require('../shared/better-auth.CHyZMcYK.cjs');
@@ -1,5 +1,5 @@
1
- import { g as Adapter, f as BetterAuthOptions, G as GenericEndpointContext, W as Where, T as FieldAttribute, X as FieldType, K as KyselyDatabaseType } from '../shared/better-auth.BAR_8WbD.cjs';
2
- export { a7 as BetterAuthDbSchema, _ as FieldAttributeConfig, a6 as InferFieldsFromOptions, a5 as InferFieldsFromPlugins, a2 as InferFieldsInput, a3 as InferFieldsInputClient, a1 as InferFieldsOutput, a0 as InferValueType, Z as InternalAdapter, a4 as PluginFieldAttribute, a9 as accountSchema, $ as createFieldAttribute, Y as createInternalAdapter, ae as getAllFields, a8 as getAuthTables, an as mergeSchema, al as parseAccountInput, ag as parseAccountOutput, ak as parseAdditionalUserInput, ai as parseInputData, ad as parseOutputData, am as parseSessionInput, ah as parseSessionOutput, aj as parseUserInput, af as parseUserOutput, ab as sessionSchema, aa as userSchema, ac as verificationSchema } from '../shared/better-auth.BAR_8WbD.cjs';
1
+ import { g as Adapter, f as BetterAuthOptions, G as GenericEndpointContext, W as Where, T as FieldAttribute, X as FieldType, K as KyselyDatabaseType } from '../shared/better-auth.CPKTEzG-.cjs';
2
+ export { a7 as BetterAuthDbSchema, _ as FieldAttributeConfig, a6 as InferFieldsFromOptions, a5 as InferFieldsFromPlugins, a2 as InferFieldsInput, a3 as InferFieldsInputClient, a1 as InferFieldsOutput, a0 as InferValueType, Z as InternalAdapter, a4 as PluginFieldAttribute, a9 as accountSchema, $ as createFieldAttribute, Y as createInternalAdapter, ae as getAllFields, a8 as getAuthTables, an as mergeSchema, al as parseAccountInput, ag as parseAccountOutput, ak as parseAdditionalUserInput, ai as parseInputData, ad as parseOutputData, am as parseSessionInput, ah as parseSessionOutput, aj as parseUserInput, af as parseUserOutput, ab as sessionSchema, aa as userSchema, ac as verificationSchema } from '../shared/better-auth.CPKTEzG-.cjs';
3
3
  import { z } from 'zod';
4
4
  import '../shared/better-auth.Bi8FQwDD.cjs';
5
5
  import 'kysely';
@@ -1,5 +1,5 @@
1
- import { g as Adapter, f as BetterAuthOptions, G as GenericEndpointContext, W as Where, T as FieldAttribute, X as FieldType, K as KyselyDatabaseType } from '../shared/better-auth.imLEY-xr.mjs';
2
- export { a7 as BetterAuthDbSchema, _ as FieldAttributeConfig, a6 as InferFieldsFromOptions, a5 as InferFieldsFromPlugins, a2 as InferFieldsInput, a3 as InferFieldsInputClient, a1 as InferFieldsOutput, a0 as InferValueType, Z as InternalAdapter, a4 as PluginFieldAttribute, a9 as accountSchema, $ as createFieldAttribute, Y as createInternalAdapter, ae as getAllFields, a8 as getAuthTables, an as mergeSchema, al as parseAccountInput, ag as parseAccountOutput, ak as parseAdditionalUserInput, ai as parseInputData, ad as parseOutputData, am as parseSessionInput, ah as parseSessionOutput, aj as parseUserInput, af as parseUserOutput, ab as sessionSchema, aa as userSchema, ac as verificationSchema } from '../shared/better-auth.imLEY-xr.mjs';
1
+ import { g as Adapter, f as BetterAuthOptions, G as GenericEndpointContext, W as Where, T as FieldAttribute, X as FieldType, K as KyselyDatabaseType } from '../shared/better-auth.Ck0xlDsK.mjs';
2
+ export { a7 as BetterAuthDbSchema, _ as FieldAttributeConfig, a6 as InferFieldsFromOptions, a5 as InferFieldsFromPlugins, a2 as InferFieldsInput, a3 as InferFieldsInputClient, a1 as InferFieldsOutput, a0 as InferValueType, Z as InternalAdapter, a4 as PluginFieldAttribute, a9 as accountSchema, $ as createFieldAttribute, Y as createInternalAdapter, ae as getAllFields, a8 as getAuthTables, an as mergeSchema, al as parseAccountInput, ag as parseAccountOutput, ak as parseAdditionalUserInput, ai as parseInputData, ad as parseOutputData, am as parseSessionInput, ah as parseSessionOutput, aj as parseUserInput, af as parseUserOutput, ab as sessionSchema, aa as userSchema, ac as verificationSchema } from '../shared/better-auth.Ck0xlDsK.mjs';
3
3
  import { z } from 'zod';
4
4
  import '../shared/better-auth.Bi8FQwDD.mjs';
5
5
  import 'kysely';
@@ -1,5 +1,5 @@
1
- import { g as Adapter, f as BetterAuthOptions, G as GenericEndpointContext, W as Where, T as FieldAttribute, X as FieldType, K as KyselyDatabaseType } from '../shared/better-auth.purQujiV.js';
2
- export { a7 as BetterAuthDbSchema, _ as FieldAttributeConfig, a6 as InferFieldsFromOptions, a5 as InferFieldsFromPlugins, a2 as InferFieldsInput, a3 as InferFieldsInputClient, a1 as InferFieldsOutput, a0 as InferValueType, Z as InternalAdapter, a4 as PluginFieldAttribute, a9 as accountSchema, $ as createFieldAttribute, Y as createInternalAdapter, ae as getAllFields, a8 as getAuthTables, an as mergeSchema, al as parseAccountInput, ag as parseAccountOutput, ak as parseAdditionalUserInput, ai as parseInputData, ad as parseOutputData, am as parseSessionInput, ah as parseSessionOutput, aj as parseUserInput, af as parseUserOutput, ab as sessionSchema, aa as userSchema, ac as verificationSchema } from '../shared/better-auth.purQujiV.js';
1
+ import { g as Adapter, f as BetterAuthOptions, G as GenericEndpointContext, W as Where, T as FieldAttribute, X as FieldType, K as KyselyDatabaseType } from '../shared/better-auth.DiHCWsNg.js';
2
+ export { a7 as BetterAuthDbSchema, _ as FieldAttributeConfig, a6 as InferFieldsFromOptions, a5 as InferFieldsFromPlugins, a2 as InferFieldsInput, a3 as InferFieldsInputClient, a1 as InferFieldsOutput, a0 as InferValueType, Z as InternalAdapter, a4 as PluginFieldAttribute, a9 as accountSchema, $ as createFieldAttribute, Y as createInternalAdapter, ae as getAllFields, a8 as getAuthTables, an as mergeSchema, al as parseAccountInput, ag as parseAccountOutput, ak as parseAdditionalUserInput, ai as parseInputData, ad as parseOutputData, am as parseSessionInput, ah as parseSessionOutput, aj as parseUserInput, af as parseUserOutput, ab as sessionSchema, aa as userSchema, ac as verificationSchema } from '../shared/better-auth.DiHCWsNg.js';
3
3
  import { z } from 'zod';
4
4
  import '../shared/better-auth.Bi8FQwDD.js';
5
5
  import 'kysely';
package/dist/db/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { d as convertFromDB, b as convertToDB, c as createInternalAdapter, a as getAdapter, e as getMigrations, f as getSchema, g as getWithHooks, m as matchType } from '../shared/better-auth.B5NYxGA3.mjs';
1
+ export { d as convertFromDB, b as convertToDB, c as createInternalAdapter, a as getAdapter, e as getMigrations, f as getSchema, g as getWithHooks, m as matchType } from '../shared/better-auth.67eSHmUo.mjs';
2
2
  export { g as getAuthTables } from '../shared/better-auth.DORkW_Ge.mjs';
3
3
  import { z } from 'zod';
4
4
  export { a as accountSchema, g as getAllFields, m as mergeSchema, i as parseAccountInput, c as parseAccountOutput, h as parseAdditionalUserInput, e as parseInputData, p as parseOutputData, j as parseSessionInput, d as parseSessionOutput, f as parseUserInput, b as parseUserOutput, s as sessionSchema, u as userSchema, v as verificationSchema } from '../shared/better-auth.C24Bzw4w.mjs';
package/dist/index.cjs CHANGED
@@ -3,7 +3,7 @@
3
3
  const api_index = require('./api/index.cjs');
4
4
  const defu = require('defu');
5
5
  const password = require('./shared/better-auth.YUF6P-PB.cjs');
6
- const getMigration = require('./shared/better-auth.CKg1f8vU.cjs');
6
+ const getMigration = require('./shared/better-auth.DcpLarbN.cjs');
7
7
  const getTables = require('./shared/better-auth.BEphVDyL.cjs');
8
8
  require('zod');
9
9
  require('./shared/better-auth.CHyZMcYK.cjs');
@@ -21,11 +21,11 @@ require('jose');
21
21
  require('./shared/better-auth.CYeOI8C-.cjs');
22
22
  const env = require('./shared/better-auth.DiSjtgs9.cjs');
23
23
  const password$1 = require('./shared/better-auth.CDXNofOe.cjs');
24
- const url = require('./shared/better-auth.DhfiEsxl.cjs');
24
+ const url = require('./shared/better-auth.C-R0J0n1.cjs');
25
25
  const index = require('./shared/better-auth.ANpbi45u.cjs');
26
- const account = require('./shared/better-auth.BzKRBwSF.cjs');
26
+ const account = require('./shared/better-auth.GVCiTzec.cjs');
27
27
  const misc = require('./shared/better-auth.BLDOwz3i.cjs');
28
- const state = require('./shared/better-auth.GgQnT00n.cjs');
28
+ const state = require('./shared/better-auth.CHHC_PJT.cjs');
29
29
  require('./shared/better-auth.BgkOX1Ei.cjs');
30
30
  require('@noble/hashes/scrypt');
31
31
  require('@better-auth/utils');
@@ -222,16 +222,20 @@ const betterAuth = (options) => {
222
222
  handler: async (request) => {
223
223
  const ctx = await authContext;
224
224
  const basePath = ctx.options.basePath || "/api/auth";
225
- const url$1 = new URL(request.url);
226
225
  if (!ctx.options.baseURL) {
227
- const baseURL = url.getBaseURL(void 0, basePath) || `${url$1.origin}${basePath}`;
228
- ctx.options.baseURL = baseURL;
229
- ctx.baseURL = baseURL;
226
+ const baseURL = url.getBaseURL(void 0, basePath, request);
227
+ if (baseURL) {
228
+ ctx.baseURL = baseURL;
229
+ ctx.options.baseURL = url.getOrigin(ctx.baseURL) || void 0;
230
+ } else {
231
+ throw new index.BetterAuthError(
232
+ "Could not get base URL from request. Please provide a valid base URL."
233
+ );
234
+ }
230
235
  }
231
236
  ctx.trustedOrigins = [
232
- ...options.trustedOrigins ? Array.isArray(options.trustedOrigins) ? options.trustedOrigins : options.trustedOrigins(request) : [],
233
- ctx.options.baseURL,
234
- url$1.origin
237
+ ...options.trustedOrigins ? Array.isArray(options.trustedOrigins) ? options.trustedOrigins : await options.trustedOrigins(request) : [],
238
+ ctx.options.baseURL
235
239
  ];
236
240
  const { handler } = api_index.router(ctx, options);
237
241
  return handler(request);
package/dist/index.d.cts CHANGED
@@ -1,7 +1,7 @@
1
- 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, i as Auth, l as AuthContext, A as AuthPluginSchema, f as BetterAuthOptions, B as BetterAuthPlugin, 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, O as LogHandlerParams, L as LogLevel, N as Logger, M as Models, R as RateLimit, y as SecondaryStorage, S as Session, U as User, V as Verification, W as Where, m as WithJsDoc, n as betterAuth, P as createLogger, v as init, E as levels, Q as logger, J as shouldPublishLog } from './shared/better-auth.BAR_8WbD.cjs';
1
+ 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, i as Auth, l as AuthContext, A as AuthPluginSchema, f as BetterAuthOptions, B as BetterAuthPlugin, 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, O as LogHandlerParams, L as LogLevel, N as Logger, M as Models, R as RateLimit, y as SecondaryStorage, S as Session, U as User, V as Verification, W as Where, m as WithJsDoc, n as betterAuth, P as createLogger, v as init, E as levels, Q as logger, J as shouldPublishLog } from './shared/better-auth.CPKTEzG-.cjs';
2
2
  export { AtomListener, BetterAuthClientPlugin, ClientOptions, InferActions, InferAdditionalFromClient, InferClientAPI, InferErrorCodes, InferPluginsFromClient, InferSessionFromClient, InferUserFromClient, IsSignal, Store } from './types/index.cjs';
3
3
  export { H as HIDE_METADATA } from './shared/better-auth.DEHJp1rk.cjs';
4
- export { g as generateState, p as parseState } from './shared/better-auth.BS4hQYkx.cjs';
4
+ export { g as generateState, p as parseState } from './shared/better-auth.Vci2tT86.cjs';
5
5
  export * from 'better-call';
6
6
  export * from 'zod';
7
7
  export { D as DeepPartial, E as Expand, H as HasRequiredKeys, a as LiteralNumber, L as LiteralString, d as LiteralUnion, O as OmitId, c as PreserveJSDoc, b as Prettify, P as PrettifyDeep, R as RequiredKeysOf, S as StripEmptyObjects, U as UnionToIntersection, W as WithoutEmpty } from './shared/better-auth.Bi8FQwDD.cjs';
package/dist/index.d.mts CHANGED
@@ -1,7 +1,7 @@
1
- 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, i as Auth, l as AuthContext, A as AuthPluginSchema, f as BetterAuthOptions, B as BetterAuthPlugin, 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, O as LogHandlerParams, L as LogLevel, N as Logger, M as Models, R as RateLimit, y as SecondaryStorage, S as Session, U as User, V as Verification, W as Where, m as WithJsDoc, n as betterAuth, P as createLogger, v as init, E as levels, Q as logger, J as shouldPublishLog } from './shared/better-auth.imLEY-xr.mjs';
1
+ 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, i as Auth, l as AuthContext, A as AuthPluginSchema, f as BetterAuthOptions, B as BetterAuthPlugin, 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, O as LogHandlerParams, L as LogLevel, N as Logger, M as Models, R as RateLimit, y as SecondaryStorage, S as Session, U as User, V as Verification, W as Where, m as WithJsDoc, n as betterAuth, P as createLogger, v as init, E as levels, Q as logger, J as shouldPublishLog } from './shared/better-auth.Ck0xlDsK.mjs';
2
2
  export { AtomListener, BetterAuthClientPlugin, ClientOptions, InferActions, InferAdditionalFromClient, InferClientAPI, InferErrorCodes, InferPluginsFromClient, InferSessionFromClient, InferUserFromClient, IsSignal, Store } from './types/index.mjs';
3
3
  export { H as HIDE_METADATA } from './shared/better-auth.DEHJp1rk.mjs';
4
- export { g as generateState, p as parseState } from './shared/better-auth.BxdddeEs.mjs';
4
+ export { g as generateState, p as parseState } from './shared/better-auth.Ckf_tP8g.mjs';
5
5
  export * from 'better-call';
6
6
  export * from 'zod';
7
7
  export { D as DeepPartial, E as Expand, H as HasRequiredKeys, a as LiteralNumber, L as LiteralString, d as LiteralUnion, O as OmitId, c as PreserveJSDoc, b as Prettify, P as PrettifyDeep, R as RequiredKeysOf, S as StripEmptyObjects, U as UnionToIntersection, W as WithoutEmpty } from './shared/better-auth.Bi8FQwDD.mjs';
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- 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, i as Auth, l as AuthContext, A as AuthPluginSchema, f as BetterAuthOptions, B as BetterAuthPlugin, 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, O as LogHandlerParams, L as LogLevel, N as Logger, M as Models, R as RateLimit, y as SecondaryStorage, S as Session, U as User, V as Verification, W as Where, m as WithJsDoc, n as betterAuth, P as createLogger, v as init, E as levels, Q as logger, J as shouldPublishLog } from './shared/better-auth.purQujiV.js';
1
+ 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, i as Auth, l as AuthContext, A as AuthPluginSchema, f as BetterAuthOptions, B as BetterAuthPlugin, 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, O as LogHandlerParams, L as LogLevel, N as Logger, M as Models, R as RateLimit, y as SecondaryStorage, S as Session, U as User, V as Verification, W as Where, m as WithJsDoc, n as betterAuth, P as createLogger, v as init, E as levels, Q as logger, J as shouldPublishLog } from './shared/better-auth.DiHCWsNg.js';
2
2
  export { AtomListener, BetterAuthClientPlugin, ClientOptions, InferActions, InferAdditionalFromClient, InferClientAPI, InferErrorCodes, InferPluginsFromClient, InferSessionFromClient, InferUserFromClient, IsSignal, Store } from './types/index.js';
3
3
  export { H as HIDE_METADATA } from './shared/better-auth.DEHJp1rk.js';
4
- export { g as generateState, p as parseState } from './shared/better-auth.F2VsZ04W.js';
4
+ export { g as generateState, p as parseState } from './shared/better-auth.BVojg4kv.js';
5
5
  export * from 'better-call';
6
6
  export * from 'zod';
7
7
  export { D as DeepPartial, E as Expand, H as HasRequiredKeys, a as LiteralNumber, L as LiteralString, d as LiteralUnion, O as OmitId, c as PreserveJSDoc, b as Prettify, P as PrettifyDeep, R as RequiredKeysOf, S as StripEmptyObjects, U as UnionToIntersection, W as WithoutEmpty } from './shared/better-auth.Bi8FQwDD.js';
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { getEndpoints, router } from './api/index.mjs';
2
2
  import { defu } from 'defu';
3
3
  import { v as verifyPassword, h as hashPassword } from './shared/better-auth.OT3XFeFk.mjs';
4
- import { a as getAdapter, c as createInternalAdapter, e as getMigrations } from './shared/better-auth.B5NYxGA3.mjs';
4
+ import { a as getAdapter, c as createInternalAdapter, e as getMigrations } from './shared/better-auth.67eSHmUo.mjs';
5
5
  import { g as getAuthTables } from './shared/better-auth.DORkW_Ge.mjs';
6
6
  import 'zod';
7
7
  import './shared/better-auth.C24Bzw4w.mjs';
@@ -20,13 +20,13 @@ import 'jose';
20
20
  import './shared/better-auth.B4Qoxdgc.mjs';
21
21
  import { e as env, a as isProduction } from './shared/better-auth.8zoxzg-F.mjs';
22
22
  import { c as checkPassword } from './shared/better-auth.YwDQhoPc.mjs';
23
- import { a as getBaseURL } from './shared/better-auth.NcLhHEks.mjs';
23
+ import { a as getBaseURL, g as getOrigin } from './shared/better-auth.VTXNLFMT.mjs';
24
24
  import { B as BetterAuthError } from './shared/better-auth.DdzSJf-n.mjs';
25
25
  export { M as MissingDependencyError } from './shared/better-auth.DdzSJf-n.mjs';
26
- import { B as BASE_ERROR_CODES } from './shared/better-auth.npe3WWSD.mjs';
27
- export { H as HIDE_METADATA } from './shared/better-auth.npe3WWSD.mjs';
26
+ import { B as BASE_ERROR_CODES } from './shared/better-auth.CFZLHBFT.mjs';
27
+ export { H as HIDE_METADATA } from './shared/better-auth.CFZLHBFT.mjs';
28
28
  export { c as capitalizeFirstLetter } from './shared/better-auth.D-2CmEwz.mjs';
29
- export { g as generateState, p as parseState } from './shared/better-auth.CoMXyQ1y.mjs';
29
+ export { g as generateState, p as parseState } from './shared/better-auth.CbXAPXob.mjs';
30
30
  import './shared/better-auth.Duk7IG0N.mjs';
31
31
  import '@noble/hashes/scrypt';
32
32
  import '@better-auth/utils';
@@ -223,16 +223,20 @@ const betterAuth = (options) => {
223
223
  handler: async (request) => {
224
224
  const ctx = await authContext;
225
225
  const basePath = ctx.options.basePath || "/api/auth";
226
- const url = new URL(request.url);
227
226
  if (!ctx.options.baseURL) {
228
- const baseURL = getBaseURL(void 0, basePath) || `${url.origin}${basePath}`;
229
- ctx.options.baseURL = baseURL;
230
- ctx.baseURL = baseURL;
227
+ const baseURL = getBaseURL(void 0, basePath, request);
228
+ if (baseURL) {
229
+ ctx.baseURL = baseURL;
230
+ ctx.options.baseURL = getOrigin(ctx.baseURL) || void 0;
231
+ } else {
232
+ throw new BetterAuthError(
233
+ "Could not get base URL from request. Please provide a valid base URL."
234
+ );
235
+ }
231
236
  }
232
237
  ctx.trustedOrigins = [
233
- ...options.trustedOrigins ? Array.isArray(options.trustedOrigins) ? options.trustedOrigins : options.trustedOrigins(request) : [],
234
- ctx.options.baseURL,
235
- url.origin
238
+ ...options.trustedOrigins ? Array.isArray(options.trustedOrigins) ? options.trustedOrigins : await options.trustedOrigins(request) : [],
239
+ ctx.options.baseURL
236
240
  ];
237
241
  const { handler } = router(ctx, options);
238
242
  return handler(request);
@@ -6,9 +6,9 @@ require('@better-auth/utils/hmac');
6
6
  const cookies_index = require('../cookies/index.cjs');
7
7
  require('better-call');
8
8
  require('zod');
9
- const account = require('../shared/better-auth.BzKRBwSF.cjs');
9
+ const account = require('../shared/better-auth.GVCiTzec.cjs');
10
10
  require('../shared/better-auth.CHyZMcYK.cjs');
11
- require('../shared/better-auth.BvJDkY_b.cjs');
11
+ require('../shared/better-auth.Cr6NZZDX.cjs');
12
12
  require('../plugins/organization/access/index.cjs');
13
13
  require('../shared/better-auth.CYeOI8C-.cjs');
14
14
  require('../shared/better-auth.GpOOav9x.cjs');
@@ -22,7 +22,7 @@ require('@noble/hashes/scrypt');
22
22
  require('@better-auth/utils');
23
23
  require('@better-auth/utils/hex');
24
24
  require('@noble/hashes/utils');
25
- require('../shared/better-auth.CMz4USTt.cjs');
25
+ require('../shared/better-auth.B6Xcg5N5.cjs');
26
26
  require('@better-auth/utils/otp');
27
27
  require('../plugins/admin/access/index.cjs');
28
28
  require('@better-fetch/fetch');
@@ -34,10 +34,10 @@ require('../shared/better-auth.C1hdVENX.cjs');
34
34
  require('../shared/better-auth.D3mtHEZg.cjs');
35
35
  require('../social-providers/index.cjs');
36
36
  require('../shared/better-auth.DdjqxOIu.cjs');
37
- require('../shared/better-auth.GgQnT00n.cjs');
37
+ require('../shared/better-auth.CHHC_PJT.cjs');
38
38
  require('../shared/better-auth.Bg6iw3ig.cjs');
39
39
  require('../shared/better-auth.BMYo0QR-.cjs');
40
- require('../shared/better-auth.DhfiEsxl.cjs');
40
+ require('../shared/better-auth.C-R0J0n1.cjs');
41
41
  require('jose/errors');
42
42
  require('@better-auth/utils/binary');
43
43
  require('../shared/better-auth.DhsGZ30Q.cjs');
@@ -1,5 +1,5 @@
1
1
  import * as better_call from 'better-call';
2
- import { H as HookEndpointContext } from '../shared/better-auth.BAR_8WbD.cjs';
2
+ import { H as HookEndpointContext } from '../shared/better-auth.CPKTEzG-.cjs';
3
3
  import '../shared/better-auth.Bi8FQwDD.cjs';
4
4
  import 'zod';
5
5
  import 'kysely';