@better-auth-ui/react 1.6.3 → 1.6.5

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 (355) hide show
  1. package/dist/components/auth/auth-provider.d.ts +23 -8
  2. package/dist/components/auth/auth-provider.js +35 -19
  3. package/dist/components/{email → auth/email}/email-changed.js +2 -2
  4. package/dist/components/{email → auth/email}/email-localization.js +1 -1
  5. package/dist/components/{email → auth/email}/email-styles.js +1 -1
  6. package/dist/components/{email → auth/email}/email-verification.js +2 -2
  7. package/dist/components/{email → auth/email}/magic-link.js +2 -2
  8. package/dist/components/{email → auth/email}/new-device.js +2 -2
  9. package/dist/components/{email → auth/email}/otp-email.js +2 -2
  10. package/dist/components/{email → auth/email}/password-changed.js +2 -2
  11. package/dist/components/{email → auth/email}/reset-password.js +2 -2
  12. package/dist/components/auth/fetch-options-provider.d.ts +19 -0
  13. package/dist/components/auth/fetch-options-provider.js +30 -0
  14. package/dist/email.d.ts +1 -0
  15. package/dist/email.js +11 -0
  16. package/dist/hooks/auth/use-authenticate.d.ts +5 -28
  17. package/dist/hooks/auth/use-authenticate.js +12 -12
  18. package/dist/hooks/auth/use-user.d.ts +19 -314
  19. package/dist/hooks/auth/use-user.js +5 -5
  20. package/dist/hooks/use-auth-mutation.d.ts +12 -7
  21. package/dist/hooks/use-auth-plugin.d.ts +31 -0
  22. package/dist/hooks/use-auth-plugin.js +10 -0
  23. package/dist/hooks/use-auth-query.d.ts +3 -3
  24. package/dist/index.d.ts +34 -32
  25. package/dist/index.js +75 -83
  26. package/dist/lib/auth-client.d.ts +23 -3687
  27. package/dist/lib/auth-plugin.d.ts +61 -0
  28. package/dist/lib/auth-server.d.ts +16 -0
  29. package/dist/mutations/auth/request-password-reset-mutation.d.ts +26 -0
  30. package/dist/mutations/auth/request-password-reset-mutation.js +24 -0
  31. package/dist/mutations/auth/reset-password-mutation.d.ts +25 -0
  32. package/dist/mutations/auth/reset-password-mutation.js +24 -0
  33. package/dist/mutations/auth/send-verification-email-mutation.d.ts +24 -0
  34. package/dist/mutations/auth/send-verification-email-mutation.js +24 -0
  35. package/dist/mutations/auth/sign-in-email-mutation.d.ts +71 -0
  36. package/dist/mutations/auth/sign-in-email-mutation.js +29 -0
  37. package/dist/mutations/auth/sign-in-social-mutation.d.ts +77 -0
  38. package/dist/mutations/auth/sign-in-social-mutation.js +24 -0
  39. package/dist/mutations/auth/sign-out-mutation.d.ts +25 -0
  40. package/dist/mutations/auth/sign-out-mutation.js +28 -0
  41. package/dist/mutations/auth/sign-up-email-mutation.d.ts +105 -0
  42. package/dist/mutations/auth/sign-up-email-mutation.js +29 -0
  43. package/dist/mutations/auth-mutation-options.d.ts +37 -20
  44. package/dist/mutations/auth-mutation-options.js +2 -2
  45. package/dist/mutations/magic-link/sign-in-magic-link-mutation.d.ts +24 -0
  46. package/dist/mutations/magic-link/sign-in-magic-link-mutation.js +24 -0
  47. package/dist/mutations/multi-session/revoke-multi-session-mutation.d.ts +25 -0
  48. package/dist/mutations/multi-session/revoke-multi-session-mutation.js +29 -0
  49. package/dist/mutations/multi-session/set-active-session-mutation.d.ts +62 -0
  50. package/dist/mutations/multi-session/set-active-session-mutation.js +31 -0
  51. package/dist/mutations/passkey/add-passkey-mutation.d.ts +71 -0
  52. package/dist/mutations/passkey/add-passkey-mutation.js +29 -0
  53. package/dist/mutations/passkey/delete-passkey-mutation.d.ts +25 -0
  54. package/dist/mutations/passkey/delete-passkey-mutation.js +29 -0
  55. package/dist/mutations/passkey/sign-in-passkey-mutation.d.ts +105 -0
  56. package/dist/mutations/passkey/sign-in-passkey-mutation.js +29 -0
  57. package/dist/mutations/settings/change-email-mutation.d.ts +25 -0
  58. package/dist/mutations/settings/change-email-mutation.js +29 -0
  59. package/dist/mutations/settings/change-password-mutation.d.ts +78 -0
  60. package/dist/mutations/settings/change-password-mutation.js +24 -0
  61. package/dist/mutations/settings/delete-user-mutation.d.ts +26 -0
  62. package/dist/mutations/settings/delete-user-mutation.js +24 -0
  63. package/dist/mutations/settings/link-social-mutation.d.ts +26 -0
  64. package/dist/mutations/settings/link-social-mutation.js +24 -0
  65. package/dist/mutations/settings/revoke-session-mutation.d.ts +25 -0
  66. package/dist/mutations/settings/revoke-session-mutation.js +29 -0
  67. package/dist/mutations/settings/unlink-account-mutation.d.ts +25 -0
  68. package/dist/mutations/settings/unlink-account-mutation.js +29 -0
  69. package/dist/mutations/settings/update-user-mutation.d.ts +25 -0
  70. package/dist/mutations/settings/update-user-mutation.js +35 -0
  71. package/dist/mutations/username/is-username-available-mutation.d.ts +27 -0
  72. package/dist/mutations/username/is-username-available-mutation.js +24 -0
  73. package/dist/mutations/username/sign-in-username-mutation.d.ts +75 -0
  74. package/dist/mutations/username/sign-in-username-mutation.js +29 -0
  75. package/dist/plugins/captcha-plugin.d.ts +29 -0
  76. package/dist/plugins/captcha-plugin.js +29 -0
  77. package/dist/plugins.d.ts +1 -0
  78. package/dist/plugins.js +3 -0
  79. package/dist/queries/auth/session-query.d.ts +71 -0
  80. package/dist/queries/auth/session-query.js +30 -0
  81. package/dist/queries/auth-query-options.d.ts +26 -15
  82. package/dist/queries/multi-session/list-device-sessions-query.d.ts +76 -0
  83. package/dist/queries/multi-session/list-device-sessions-query.js +31 -0
  84. package/dist/queries/passkey/list-passkeys-query.d.ts +74 -0
  85. package/dist/queries/passkey/list-passkeys-query.js +31 -0
  86. package/dist/queries/settings/account-info-query.d.ts +85 -0
  87. package/dist/queries/settings/account-info-query.js +31 -0
  88. package/dist/queries/settings/list-accounts-query.d.ts +76 -0
  89. package/dist/queries/settings/list-accounts-query.js +31 -0
  90. package/dist/queries/settings/list-sessions-query.d.ts +74 -0
  91. package/dist/queries/settings/list-sessions-query.js +31 -0
  92. package/dist/server/queries/auth/session-query.d.ts +57 -0
  93. package/dist/server/queries/auth/session-query.js +13 -0
  94. package/dist/server/queries/multi-session/list-device-sessions-query.d.ts +60 -0
  95. package/dist/server/queries/multi-session/list-device-sessions-query.js +12 -0
  96. package/dist/server/queries/passkey/list-passkeys-query.d.ts +60 -0
  97. package/dist/server/queries/passkey/list-passkeys-query.js +12 -0
  98. package/dist/server/queries/settings/account-info-query.d.ts +68 -0
  99. package/dist/server/queries/settings/account-info-query.js +12 -0
  100. package/dist/server/queries/settings/list-accounts-query.d.ts +60 -0
  101. package/dist/server/queries/settings/list-accounts-query.js +12 -0
  102. package/dist/server/queries/settings/list-sessions-query.d.ts +60 -0
  103. package/dist/server/queries/settings/list-sessions-query.js +12 -0
  104. package/dist/server.d.ts +7 -0
  105. package/dist/server.js +7 -0
  106. package/package.json +28 -22
  107. package/src/components/auth/auth-provider.tsx +88 -25
  108. package/src/components/{email → auth/email}/email-changed.tsx +1 -1
  109. package/src/components/{email → auth/email}/email-verification.tsx +1 -1
  110. package/src/components/{email → auth/email}/magic-link.tsx +1 -1
  111. package/src/components/{email → auth/email}/new-device.tsx +1 -1
  112. package/src/components/{email → auth/email}/otp-email.tsx +1 -1
  113. package/src/components/{email → auth/email}/password-changed.tsx +1 -1
  114. package/src/components/{email → auth/email}/reset-password.tsx +1 -1
  115. package/src/components/auth/fetch-options-provider.tsx +77 -0
  116. package/src/email.ts +1 -0
  117. package/src/hooks/auth/use-authenticate.ts +12 -6
  118. package/src/hooks/auth/use-user.ts +14 -9
  119. package/src/hooks/use-auth-mutation.ts +30 -12
  120. package/src/hooks/use-auth-plugin.ts +50 -0
  121. package/src/hooks/use-auth-query.ts +11 -7
  122. package/src/index.ts +34 -32
  123. package/src/lib/auth-client.ts +33 -31
  124. package/src/lib/auth-plugin.ts +77 -0
  125. package/src/lib/auth-server.ts +30 -0
  126. package/src/mutations/auth/request-password-reset-mutation.ts +58 -0
  127. package/src/mutations/auth/reset-password-mutation.ts +60 -0
  128. package/src/mutations/auth/send-verification-email-mutation.ts +58 -0
  129. package/src/mutations/auth/sign-in-email-mutation.ts +78 -0
  130. package/src/mutations/auth/sign-in-social-mutation.ts +64 -0
  131. package/src/mutations/auth/sign-out-mutation.ts +71 -0
  132. package/src/mutations/auth/sign-up-email-mutation.ts +74 -0
  133. package/src/mutations/auth-mutation-options.ts +83 -38
  134. package/src/mutations/magic-link/sign-in-magic-link-mutation.ts +59 -0
  135. package/src/mutations/multi-session/revoke-multi-session-mutation.ts +70 -0
  136. package/src/mutations/multi-session/set-active-session-mutation.ts +98 -0
  137. package/src/mutations/passkey/add-passkey-mutation.ts +66 -0
  138. package/src/mutations/passkey/delete-passkey-mutation.ts +66 -0
  139. package/src/mutations/passkey/sign-in-passkey-mutation.ts +74 -0
  140. package/src/mutations/settings/change-email-mutation.ts +67 -0
  141. package/src/mutations/settings/change-password-mutation.ts +59 -0
  142. package/src/mutations/settings/delete-user-mutation.ts +59 -0
  143. package/src/mutations/settings/link-social-mutation.ts +59 -0
  144. package/src/mutations/settings/revoke-session-mutation.ts +69 -0
  145. package/src/mutations/settings/unlink-account-mutation.ts +67 -0
  146. package/src/mutations/settings/update-user-mutation.ts +82 -0
  147. package/src/mutations/username/is-username-available-mutation.ts +62 -0
  148. package/src/mutations/username/sign-in-username-mutation.ts +74 -0
  149. package/src/plugins/captcha-plugin.tsx +75 -0
  150. package/src/plugins.ts +3 -0
  151. package/src/queries/auth/session-query.ts +135 -0
  152. package/src/queries/auth-query-options.ts +61 -12
  153. package/src/queries/multi-session/list-device-sessions-query.ts +177 -0
  154. package/src/queries/passkey/list-passkeys-query.ts +154 -0
  155. package/src/queries/settings/account-info-query.ts +158 -0
  156. package/src/queries/settings/list-accounts-query.ts +156 -0
  157. package/src/queries/settings/list-sessions-query.ts +154 -0
  158. package/src/server/queries/auth/session-query.ts +94 -0
  159. package/src/server/queries/multi-session/list-device-sessions-query.ts +102 -0
  160. package/src/server/queries/passkey/list-passkeys-query.ts +100 -0
  161. package/src/server/queries/settings/account-info-query.ts +101 -0
  162. package/src/server/queries/settings/list-accounts-query.ts +101 -0
  163. package/src/server/queries/settings/list-sessions-query.ts +101 -0
  164. package/src/server.ts +7 -0
  165. package/dist/core.d.ts +0 -1
  166. package/dist/core.js +0 -1
  167. package/dist/hooks/auth/use-is-username-available.d.ts +0 -20
  168. package/dist/hooks/auth/use-is-username-available.js +0 -13
  169. package/dist/hooks/auth/use-request-password-reset.d.ts +0 -21
  170. package/dist/hooks/auth/use-request-password-reset.js +0 -13
  171. package/dist/hooks/auth/use-reset-password.d.ts +0 -23
  172. package/dist/hooks/auth/use-reset-password.js +0 -13
  173. package/dist/hooks/auth/use-send-verification-email.d.ts +0 -19
  174. package/dist/hooks/auth/use-send-verification-email.js +0 -13
  175. package/dist/hooks/auth/use-session.d.ts +0 -35
  176. package/dist/hooks/auth/use-session.js +0 -16
  177. package/dist/hooks/auth/use-sign-in-email.d.ts +0 -26
  178. package/dist/hooks/auth/use-sign-in-email.js +0 -17
  179. package/dist/hooks/auth/use-sign-in-magic-link.d.ts +0 -27
  180. package/dist/hooks/auth/use-sign-in-magic-link.js +0 -13
  181. package/dist/hooks/auth/use-sign-in-passkey.d.ts +0 -21
  182. package/dist/hooks/auth/use-sign-in-passkey.js +0 -17
  183. package/dist/hooks/auth/use-sign-in-social.d.ts +0 -63
  184. package/dist/hooks/auth/use-sign-in-social.js +0 -13
  185. package/dist/hooks/auth/use-sign-in-username.d.ts +0 -25
  186. package/dist/hooks/auth/use-sign-in-username.js +0 -17
  187. package/dist/hooks/auth/use-sign-out.d.ts +0 -18
  188. package/dist/hooks/auth/use-sign-out.js +0 -16
  189. package/dist/hooks/auth/use-sign-up-email.d.ts +0 -1186
  190. package/dist/hooks/auth/use-sign-up-email.js +0 -17
  191. package/dist/hooks/settings/use-account-info.d.ts +0 -17
  192. package/dist/hooks/settings/use-account-info.js +0 -18
  193. package/dist/hooks/settings/use-add-passkey.d.ts +0 -21
  194. package/dist/hooks/settings/use-add-passkey.js +0 -17
  195. package/dist/hooks/settings/use-change-email.d.ts +0 -21
  196. package/dist/hooks/settings/use-change-email.js +0 -17
  197. package/dist/hooks/settings/use-change-password.d.ts +0 -21
  198. package/dist/hooks/settings/use-change-password.js +0 -13
  199. package/dist/hooks/settings/use-delete-passkey.d.ts +0 -19
  200. package/dist/hooks/settings/use-delete-passkey.js +0 -17
  201. package/dist/hooks/settings/use-delete-user.d.ts +0 -24
  202. package/dist/hooks/settings/use-delete-user.js +0 -13
  203. package/dist/hooks/settings/use-link-social.d.ts +0 -43
  204. package/dist/hooks/settings/use-link-social.js +0 -13
  205. package/dist/hooks/settings/use-list-accounts.d.ts +0 -22
  206. package/dist/hooks/settings/use-list-accounts.js +0 -15
  207. package/dist/hooks/settings/use-list-device-sessions.d.ts +0 -34
  208. package/dist/hooks/settings/use-list-device-sessions.js +0 -15
  209. package/dist/hooks/settings/use-list-sessions.d.ts +0 -23
  210. package/dist/hooks/settings/use-list-sessions.js +0 -15
  211. package/dist/hooks/settings/use-list-user-passkeys.d.ts +0 -14
  212. package/dist/hooks/settings/use-list-user-passkeys.js +0 -15
  213. package/dist/hooks/settings/use-revoke-multi-session.d.ts +0 -19
  214. package/dist/hooks/settings/use-revoke-multi-session.js +0 -17
  215. package/dist/hooks/settings/use-revoke-session.d.ts +0 -19
  216. package/dist/hooks/settings/use-revoke-session.js +0 -17
  217. package/dist/hooks/settings/use-set-active-session.d.ts +0 -20
  218. package/dist/hooks/settings/use-set-active-session.js +0 -20
  219. package/dist/hooks/settings/use-unlink-account.d.ts +0 -21
  220. package/dist/hooks/settings/use-unlink-account.js +0 -17
  221. package/dist/hooks/settings/use-update-user.d.ts +0 -1185
  222. package/dist/hooks/settings/use-update-user.js +0 -24
  223. package/dist/lib/auth-client.js +0 -11
  224. package/dist/lib/auth-config.d.ts +0 -43
  225. package/dist/lib/auth-context.d.ts +0 -2
  226. package/dist/lib/auth-context.js +0 -6
  227. package/dist/mutations/auth/is-username-available-options.d.ts +0 -19
  228. package/dist/mutations/auth/is-username-available-options.js +0 -7
  229. package/dist/mutations/auth/request-password-reset-options.d.ts +0 -15
  230. package/dist/mutations/auth/request-password-reset-options.js +0 -7
  231. package/dist/mutations/auth/reset-password-options.d.ts +0 -17
  232. package/dist/mutations/auth/reset-password-options.js +0 -7
  233. package/dist/mutations/auth/send-verification-email-options.d.ts +0 -15
  234. package/dist/mutations/auth/send-verification-email-options.js +0 -7
  235. package/dist/mutations/auth/sign-in-email-options.d.ts +0 -23
  236. package/dist/mutations/auth/sign-in-email-options.js +0 -11
  237. package/dist/mutations/auth/sign-in-magic-link-options.d.ts +0 -23
  238. package/dist/mutations/auth/sign-in-magic-link-options.js +0 -11
  239. package/dist/mutations/auth/sign-in-passkey-options.d.ts +0 -15
  240. package/dist/mutations/auth/sign-in-passkey-options.js +0 -11
  241. package/dist/mutations/auth/sign-in-social-options.d.ts +0 -61
  242. package/dist/mutations/auth/sign-in-social-options.js +0 -11
  243. package/dist/mutations/auth/sign-in-username-options.d.ts +0 -19
  244. package/dist/mutations/auth/sign-in-username-options.js +0 -11
  245. package/dist/mutations/auth/sign-out-options.d.ts +0 -12
  246. package/dist/mutations/auth/sign-out-options.js +0 -7
  247. package/dist/mutations/auth/sign-up-email-options.d.ts +0 -1180
  248. package/dist/mutations/auth/sign-up-email-options.js +0 -11
  249. package/dist/mutations/settings/add-passkey-options.d.ts +0 -15
  250. package/dist/mutations/settings/add-passkey-options.js +0 -11
  251. package/dist/mutations/settings/change-email-options.d.ts +0 -15
  252. package/dist/mutations/settings/change-email-options.js +0 -7
  253. package/dist/mutations/settings/change-password-options.d.ts +0 -17
  254. package/dist/mutations/settings/change-password-options.js +0 -7
  255. package/dist/mutations/settings/delete-passkey-options.d.ts +0 -13
  256. package/dist/mutations/settings/delete-passkey-options.js +0 -11
  257. package/dist/mutations/settings/delete-user-options.d.ts +0 -20
  258. package/dist/mutations/settings/delete-user-options.js +0 -7
  259. package/dist/mutations/settings/link-social-options.d.ts +0 -39
  260. package/dist/mutations/settings/link-social-options.js +0 -7
  261. package/dist/mutations/settings/revoke-multi-session-options.d.ts +0 -13
  262. package/dist/mutations/settings/revoke-multi-session-options.js +0 -11
  263. package/dist/mutations/settings/revoke-session-options.d.ts +0 -13
  264. package/dist/mutations/settings/revoke-session-options.js +0 -7
  265. package/dist/mutations/settings/set-active-session-options.d.ts +0 -13
  266. package/dist/mutations/settings/set-active-session-options.js +0 -11
  267. package/dist/mutations/settings/unlink-account-options.d.ts +0 -15
  268. package/dist/mutations/settings/unlink-account-options.js +0 -7
  269. package/dist/mutations/settings/update-user-options.d.ts +0 -1182
  270. package/dist/mutations/settings/update-user-options.js +0 -7
  271. package/dist/queries/auth/session-options.d.ts +0 -110
  272. package/dist/queries/auth/session-options.js +0 -7
  273. package/dist/queries/settings/account-info-options.d.ts +0 -32
  274. package/dist/queries/settings/account-info-options.js +0 -12
  275. package/dist/queries/settings/list-accounts-options.d.ts +0 -53
  276. package/dist/queries/settings/list-accounts-options.js +0 -12
  277. package/dist/queries/settings/list-device-sessions-options.d.ts +0 -99
  278. package/dist/queries/settings/list-device-sessions-options.js +0 -12
  279. package/dist/queries/settings/list-sessions-options.d.ts +0 -54
  280. package/dist/queries/settings/list-sessions-options.js +0 -12
  281. package/dist/queries/settings/list-user-passkeys-options.d.ts +0 -18
  282. package/dist/queries/settings/list-user-passkeys-options.js +0 -12
  283. package/src/core.ts +0 -1
  284. package/src/hooks/auth/use-is-username-available.ts +0 -31
  285. package/src/hooks/auth/use-request-password-reset.ts +0 -33
  286. package/src/hooks/auth/use-reset-password.ts +0 -31
  287. package/src/hooks/auth/use-send-verification-email.ts +0 -31
  288. package/src/hooks/auth/use-session.ts +0 -31
  289. package/src/hooks/auth/use-sign-in-email.ts +0 -41
  290. package/src/hooks/auth/use-sign-in-magic-link.ts +0 -29
  291. package/src/hooks/auth/use-sign-in-passkey.ts +0 -40
  292. package/src/hooks/auth/use-sign-in-social.ts +0 -31
  293. package/src/hooks/auth/use-sign-in-username.ts +0 -40
  294. package/src/hooks/auth/use-sign-out.ts +0 -34
  295. package/src/hooks/auth/use-sign-up-email.ts +0 -40
  296. package/src/hooks/settings/use-account-info.ts +0 -40
  297. package/src/hooks/settings/use-add-passkey.ts +0 -37
  298. package/src/hooks/settings/use-change-email.ts +0 -37
  299. package/src/hooks/settings/use-change-password.ts +0 -29
  300. package/src/hooks/settings/use-delete-passkey.ts +0 -37
  301. package/src/hooks/settings/use-delete-user.ts +0 -29
  302. package/src/hooks/settings/use-link-social.ts +0 -29
  303. package/src/hooks/settings/use-list-accounts.ts +0 -39
  304. package/src/hooks/settings/use-list-device-sessions.ts +0 -39
  305. package/src/hooks/settings/use-list-sessions.ts +0 -39
  306. package/src/hooks/settings/use-list-user-passkeys.ts +0 -39
  307. package/src/hooks/settings/use-revoke-multi-session.ts +0 -39
  308. package/src/hooks/settings/use-revoke-session.ts +0 -39
  309. package/src/hooks/settings/use-set-active-session.ts +0 -58
  310. package/src/hooks/settings/use-unlink-account.ts +0 -37
  311. package/src/hooks/settings/use-update-user.ts +0 -50
  312. package/src/lib/auth-config.ts +0 -48
  313. package/src/lib/auth-context.ts +0 -6
  314. package/src/mutations/auth/is-username-available-options.ts +0 -18
  315. package/src/mutations/auth/request-password-reset-options.ts +0 -14
  316. package/src/mutations/auth/reset-password-options.ts +0 -14
  317. package/src/mutations/auth/send-verification-email-options.ts +0 -14
  318. package/src/mutations/auth/sign-in-email-options.ts +0 -19
  319. package/src/mutations/auth/sign-in-magic-link-options.ts +0 -15
  320. package/src/mutations/auth/sign-in-passkey-options.ts +0 -15
  321. package/src/mutations/auth/sign-in-social-options.ts +0 -19
  322. package/src/mutations/auth/sign-in-username-options.ts +0 -15
  323. package/src/mutations/auth/sign-out-options.ts +0 -11
  324. package/src/mutations/auth/sign-up-email-options.ts +0 -15
  325. package/src/mutations/settings/add-passkey-options.ts +0 -15
  326. package/src/mutations/settings/change-email-options.ts +0 -11
  327. package/src/mutations/settings/change-password-options.ts +0 -14
  328. package/src/mutations/settings/delete-passkey-options.ts +0 -15
  329. package/src/mutations/settings/delete-user-options.ts +0 -11
  330. package/src/mutations/settings/link-social-options.ts +0 -11
  331. package/src/mutations/settings/revoke-multi-session-options.ts +0 -15
  332. package/src/mutations/settings/revoke-session-options.ts +0 -14
  333. package/src/mutations/settings/set-active-session-options.ts +0 -15
  334. package/src/mutations/settings/unlink-account-options.ts +0 -14
  335. package/src/mutations/settings/update-user-options.ts +0 -15
  336. package/src/queries/auth/session-options.ts +0 -18
  337. package/src/queries/settings/account-info-options.ts +0 -25
  338. package/src/queries/settings/list-accounts-options.ts +0 -26
  339. package/src/queries/settings/list-device-sessions-options.ts +0 -24
  340. package/src/queries/settings/list-sessions-options.ts +0 -23
  341. package/src/queries/settings/list-user-passkeys-options.ts +0 -23
  342. /package/dist/components/{email → auth/email}/email-changed.d.ts +0 -0
  343. /package/dist/components/{email → auth/email}/email-localization.d.ts +0 -0
  344. /package/dist/components/{email → auth/email}/email-styles.d.ts +0 -0
  345. /package/dist/components/{email → auth/email}/email-verification.d.ts +0 -0
  346. /package/dist/components/{email → auth/email}/index.d.ts +0 -0
  347. /package/dist/components/{email → auth/email}/index.js +0 -0
  348. /package/dist/components/{email → auth/email}/magic-link.d.ts +0 -0
  349. /package/dist/components/{email → auth/email}/new-device.d.ts +0 -0
  350. /package/dist/components/{email → auth/email}/otp-email.d.ts +0 -0
  351. /package/dist/components/{email → auth/email}/password-changed.d.ts +0 -0
  352. /package/dist/components/{email → auth/email}/reset-password.d.ts +0 -0
  353. /package/src/components/{email → auth/email}/email-localization.tsx +0 -0
  354. /package/src/components/{email → auth/email}/email-styles.tsx +0 -0
  355. /package/src/components/{email → auth/email}/index.ts +0 -0
@@ -0,0 +1,74 @@
1
+ import { DataTag, QueryClient } from '@tanstack/react-query';
2
+ import { BetterFetchError } from 'better-auth/react';
3
+ import { AuthClient, InferData } from '../../lib/auth-client';
4
+ export type ListSessionsData<TAuthClient extends AuthClient> = InferData<TAuthClient["listSessions"]>;
5
+ export type ListSessionsParams<TAuthClient extends AuthClient> = Parameters<TAuthClient["listSessions"]>[0];
6
+ export type ListSession<TAuthClient extends AuthClient = AuthClient> = NonNullable<ListSessionsData<TAuthClient>>[number];
7
+ export type ListSessionsOptions<TAuthClient extends AuthClient> = Omit<ReturnType<typeof listSessionsOptions<TAuthClient>>, "queryKey" | "queryFn">;
8
+ /**
9
+ * Query options factory for the current user's active sessions.
10
+ *
11
+ * @param authClient - The Better Auth client.
12
+ * @param userId - The current signed-in user's ID. Used for cache partitioning.
13
+ * @param params - Parameters forwarded to `authClient.listSessions`.
14
+ */
15
+ export declare function listSessionsOptions<TAuthClient extends AuthClient>(authClient: TAuthClient, userId: string | undefined, params?: ListSessionsParams<TAuthClient>): (import('@tanstack/react-query').OmitKeyof<import('@tanstack/react-query').UseQueryOptions<InferData<TAuthClient["listSessions"]>, BetterFetchError, InferData<TAuthClient["listSessions"]>, readonly ["auth", "user", string | undefined, "listSessions", Record<string, any> | null]>, "queryFn"> & {
16
+ queryFn?: import('@tanstack/react-query').QueryFunction<InferData<TAuthClient["listSessions"]>, readonly ["auth", "user", string | undefined, "listSessions", Record<string, any> | null], never> | undefined;
17
+ } & {
18
+ queryKey: readonly ["auth", "user", string | undefined, "listSessions", Record<string, any> | null] & {
19
+ [dataTagSymbol]: InferData<TAuthClient["listSessions"]>;
20
+ [dataTagErrorSymbol]: BetterFetchError;
21
+ };
22
+ }) & {
23
+ queryKey: DataTag<readonly ["auth", "user", string | undefined, "listSessions", Record<string, any> | null], InferData<TAuthClient["listSessions"]>, BetterFetchError>;
24
+ };
25
+ /**
26
+ * Get the current user's active sessions from the query cache, calling
27
+ * `fetchListSessions` under the hood if no cached entry exists. Resolves
28
+ * with the session list, making it ideal for loaders or `beforeLoad` guards.
29
+ *
30
+ * @param queryClient - The React Query client.
31
+ * @param authClient - The Better Auth client.
32
+ * @param userId - The signed-in user's ID, used for cache partitioning.
33
+ * @param params - Parameters forwarded to `authClient.listSessions`.
34
+ */
35
+ export declare const ensureListSessions: <TAuthClient extends AuthClient>(queryClient: QueryClient, authClient: TAuthClient, userId: string, params?: ListSessionsParams<TAuthClient>) => Promise<InferData<TAuthClient["listSessions"]>>;
36
+ /**
37
+ * Prefetch the current user's active sessions into the query cache. Behaves
38
+ * like `fetchListSessions`, but does not throw on error and does not return
39
+ * the data — use this to warm the cache without blocking navigation.
40
+ *
41
+ * @param queryClient - The React Query client.
42
+ * @param authClient - The Better Auth client.
43
+ * @param userId - The signed-in user's ID, used for cache partitioning.
44
+ * @param params - Parameters forwarded to `authClient.listSessions`.
45
+ */
46
+ export declare const prefetchListSessions: <TAuthClient extends AuthClient>(queryClient: QueryClient, authClient: TAuthClient, userId: string, params?: ListSessionsParams<TAuthClient>) => Promise<void>;
47
+ /**
48
+ * Fetch and cache the current user's active sessions, resolving with the
49
+ * data or throwing on error. If a cached entry exists and is neither
50
+ * invalidated nor older than `staleTime`, the cached value is returned
51
+ * without a network call; otherwise the latest data is fetched.
52
+ *
53
+ * @param queryClient - The React Query client.
54
+ * @param authClient - The Better Auth client.
55
+ * @param userId - The signed-in user's ID, used for cache partitioning.
56
+ * @param params - Parameters forwarded to `authClient.listSessions`.
57
+ */
58
+ export declare const fetchListSessions: <TAuthClient extends AuthClient>(queryClient: QueryClient, authClient: TAuthClient, userId: string, params?: ListSessionsParams<TAuthClient>) => Promise<InferData<TAuthClient["listSessions"]>>;
59
+ export type UseListSessionsOptions<TAuthClient extends AuthClient> = ListSessionsOptions<TAuthClient> & ListSessionsParams<TAuthClient>;
60
+ /**
61
+ * Subscribe to the current user's active sessions via TanStack Query.
62
+ *
63
+ * Shares a query key with the server-side `listSessionsOptions`, so
64
+ * SSR-hydrated data is reused from the cache without an immediate refetch.
65
+ * The query is gated on a signed-in user; while the session is loading or
66
+ * absent, the underlying `queryFn` is replaced with `skipToken`.
67
+ *
68
+ * @param authClient - The Better Auth client.
69
+ * @param options - `listSessions` params (`query`, `fetchOptions`) merged
70
+ * with `useQuery` options (e.g. `enabled`, `staleTime`, `select`).
71
+ * @param queryClient - Optional custom `QueryClient`. Defaults to the client
72
+ * from the nearest `QueryClientProvider`.
73
+ */
74
+ export declare function useListSessions<TAuthClient extends AuthClient>(authClient: TAuthClient, options?: UseListSessionsOptions<TAuthClient>, queryClient?: QueryClient): import('@tanstack/react-query').UseQueryResult<import('@tanstack/react-query').NoInfer<InferData<TAuthClient["listSessions"]>>, BetterFetchError>;
@@ -0,0 +1,31 @@
1
+ import { useSession as e } from "../auth/session-query.js";
2
+ import { authQueryKeys as t } from "@better-auth-ui/core";
3
+ import { queryOptions as n, skipToken as r, useQuery as i } from "@tanstack/react-query";
4
+ //#region src/queries/settings/list-sessions-query.ts
5
+ function a(e, r, i) {
6
+ return n({
7
+ queryKey: t.listSessions(r, i?.query),
8
+ queryFn: ({ signal: t }) => e.listSessions({
9
+ ...i,
10
+ fetchOptions: {
11
+ ...i?.fetchOptions,
12
+ signal: t,
13
+ throw: !0
14
+ }
15
+ })
16
+ });
17
+ }
18
+ var o = (e, t, n, r) => e.ensureQueryData(a(t, n, r)), s = (e, t, n, r) => e.prefetchQuery(a(t, n, r)), c = (e, t, n, r) => e.fetchQuery(a(t, n, r));
19
+ function l(t, n = {}, o) {
20
+ let { data: s } = e(t, void 0, o), c = s?.user.id, { query: l, fetchOptions: u, ...d } = n, f = a(t, c, {
21
+ query: l,
22
+ fetchOptions: u
23
+ });
24
+ return i({
25
+ ...d,
26
+ ...f,
27
+ queryFn: c ? f.queryFn : r
28
+ }, o);
29
+ }
30
+ //#endregion
31
+ export { o as ensureListSessions, c as fetchListSessions, a as listSessionsOptions, s as prefetchListSessions, l as useListSessions };
@@ -0,0 +1,57 @@
1
+ import { DataTag, QueryClient } from '@tanstack/react-query';
2
+ import { APIError } from 'better-auth';
3
+ import { AuthServer } from '../../../lib/auth-server';
4
+ export type SessionData<TAuth extends AuthServer = AuthServer> = Awaited<ReturnType<TAuth["api"]["getSession"]>>;
5
+ export type Session<TAuth extends AuthServer = AuthServer> = NonNullable<SessionData<TAuth>>;
6
+ export type SessionParams<TAuth extends AuthServer> = Parameters<TAuth["api"]["getSession"]>[0];
7
+ /**
8
+ * Query options factory for the current session on the server.
9
+ *
10
+ * Uses the same query key as the client-side `sessionOptions` so that data
11
+ * fetched during SSR hydrates seamlessly into the client's React Query cache.
12
+ *
13
+ * @param auth - The Better Auth server instance.
14
+ * @param params - Parameters forwarded to `auth.api.getSession` (typically
15
+ * includes request `headers` for cookie-based session resolution).
16
+ */
17
+ export declare function sessionOptions<TAuth extends AuthServer>(auth: TAuth, params: SessionParams<TAuth>): (import('@tanstack/react-query').OmitKeyof<import('@tanstack/react-query').UseQueryOptions<Awaited<ReturnType<TAuth["api"]["getSession"]>>, APIError, Awaited<ReturnType<TAuth["api"]["getSession"]>>, readonly ["auth", "getSession"]>, "queryFn"> & {
18
+ queryFn?: import('@tanstack/react-query').QueryFunction<Awaited<ReturnType<TAuth["api"]["getSession"]>>, readonly ["auth", "getSession"], never> | undefined;
19
+ } & {
20
+ queryKey: readonly ["auth", "getSession"] & {
21
+ [dataTagSymbol]: Awaited<ReturnType<TAuth["api"]["getSession"]>>;
22
+ [dataTagErrorSymbol]: APIError;
23
+ };
24
+ }) & {
25
+ queryKey: DataTag<readonly ["auth", "getSession"], Awaited<ReturnType<TAuth["api"]["getSession"]>>, APIError>;
26
+ };
27
+ /**
28
+ * Get the current session from the query cache, calling `fetchSession` under
29
+ * the hood if no cached entry exists. Resolves with the session data, making
30
+ * it suitable for reading the value directly in a server component.
31
+ *
32
+ * @param queryClient - The React Query client used for SSR hydration.
33
+ * @param auth - The Better Auth server instance.
34
+ * @param params - Parameters forwarded to `auth.api.getSession`.
35
+ */
36
+ export declare const ensureSession: <TAuth extends AuthServer>(queryClient: QueryClient, auth: TAuth, params: SessionParams<TAuth>) => Promise<Awaited<ReturnType<TAuth["api"]["getSession"]>>>;
37
+ /**
38
+ * Prefetch the current session into the query cache. Behaves like
39
+ * `fetchSession`, but does not throw on error and does not return the data —
40
+ * use this when you only need the value to be available after hydration.
41
+ *
42
+ * @param queryClient - The React Query client used for SSR hydration.
43
+ * @param auth - The Better Auth server instance.
44
+ * @param params - Parameters forwarded to `auth.api.getSession`.
45
+ */
46
+ export declare const prefetchSession: <TAuth extends AuthServer>(queryClient: QueryClient, auth: TAuth, params: SessionParams<TAuth>) => Promise<void>;
47
+ /**
48
+ * Fetch and cache the current session, resolving with the data or throwing
49
+ * on error. If a cached entry exists and is neither invalidated nor older
50
+ * than `staleTime`, the cached value is returned without a network call;
51
+ * otherwise the latest data is fetched.
52
+ *
53
+ * @param queryClient - The React Query client used for SSR hydration.
54
+ * @param auth - The Better Auth server instance.
55
+ * @param params - Parameters forwarded to `auth.api.getSession`.
56
+ */
57
+ export declare const fetchSession: <TAuth extends AuthServer>(queryClient: QueryClient, auth: TAuth, params: SessionParams<TAuth>) => Promise<Awaited<ReturnType<TAuth["api"]["getSession"]>>>;
@@ -0,0 +1,13 @@
1
+ import { authQueryKeys as e } from "@better-auth-ui/core";
2
+ import { queryOptions as t } from "@tanstack/react-query";
3
+ //#region src/server/queries/auth/session-query.ts
4
+ function n(n, r) {
5
+ let i = e.session;
6
+ return t({
7
+ queryKey: i,
8
+ queryFn: () => n.api.getSession(r)
9
+ });
10
+ }
11
+ var r = (e, t, r) => e.ensureQueryData(n(t, r)), i = (e, t, r) => e.prefetchQuery(n(t, r)), a = (e, t, r) => e.fetchQuery(n(t, r));
12
+ //#endregion
13
+ export { r as ensureSession, a as fetchSession, i as prefetchSession, n as sessionOptions };
@@ -0,0 +1,60 @@
1
+ import { DataTag, QueryClient } from '@tanstack/react-query';
2
+ import { APIError } from 'better-auth';
3
+ import { MultiSessionAuthServer } from '../../../lib/auth-server';
4
+ export type ListDeviceSessionsData<TAuth extends MultiSessionAuthServer> = Awaited<ReturnType<TAuth["api"]["listDeviceSessions"]>>;
5
+ export type ListDeviceSession<TAuth extends MultiSessionAuthServer = MultiSessionAuthServer> = NonNullable<ListDeviceSessionsData<TAuth>>[number];
6
+ export type ListDeviceSessionsParams<TAuth extends MultiSessionAuthServer> = Parameters<TAuth["api"]["listDeviceSessions"]>[0];
7
+ /**
8
+ * Query options factory for the current user's device sessions.
9
+ *
10
+ * @param auth - The Better Auth server instance with the multi-session plugin.
11
+ * @param userId - The signed-in user's ID. Used for cache partitioning so
12
+ * the key matches the client-side `listDeviceSessionsOptions` for SSR hydration.
13
+ * @param params - Parameters forwarded to `auth.api.listDeviceSessions`.
14
+ */
15
+ export declare function listDeviceSessionsOptions<TAuth extends MultiSessionAuthServer>(auth: TAuth, userId: string, params: ListDeviceSessionsParams<TAuth>): (import('@tanstack/react-query').OmitKeyof<import('@tanstack/react-query').UseQueryOptions<Awaited<ReturnType<TAuth["api"]["listDeviceSessions"]>>, APIError, Awaited<ReturnType<TAuth["api"]["listDeviceSessions"]>>, readonly ["auth", "user", string | undefined, "listDeviceSessions", Record<string, any> | null]>, "queryFn"> & {
16
+ queryFn?: import('@tanstack/react-query').QueryFunction<Awaited<ReturnType<TAuth["api"]["listDeviceSessions"]>>, readonly ["auth", "user", string | undefined, "listDeviceSessions", Record<string, any> | null], never> | undefined;
17
+ } & {
18
+ queryKey: readonly ["auth", "user", string | undefined, "listDeviceSessions", Record<string, any> | null] & {
19
+ [dataTagSymbol]: Awaited<ReturnType<TAuth["api"]["listDeviceSessions"]>>;
20
+ [dataTagErrorSymbol]: APIError;
21
+ };
22
+ }) & {
23
+ queryKey: DataTag<readonly ["auth", "user", string | undefined, "listDeviceSessions", Record<string, any> | null], Awaited<ReturnType<TAuth["api"]["listDeviceSessions"]>>, APIError>;
24
+ };
25
+ /**
26
+ * Get the current user's device sessions from the query cache, calling
27
+ * `fetchListDeviceSessions` under the hood if no cached entry exists.
28
+ * Resolves with the device session list, making it suitable for reading
29
+ * directly in a server component.
30
+ *
31
+ * @param queryClient - The React Query client used for SSR hydration.
32
+ * @param auth - The Better Auth server instance with the multi-session plugin.
33
+ * @param userId - The signed-in user's ID, used for cache partitioning.
34
+ * @param params - Parameters forwarded to `auth.api.listDeviceSessions`.
35
+ */
36
+ export declare const ensureListDeviceSessions: <TAuth extends MultiSessionAuthServer>(queryClient: QueryClient, auth: TAuth, userId: string, params: ListDeviceSessionsParams<TAuth>) => Promise<Awaited<ReturnType<TAuth["api"]["listDeviceSessions"]>>>;
37
+ /**
38
+ * Prefetch the current user's device sessions into the query cache. Behaves
39
+ * like `fetchListDeviceSessions`, but does not throw on error and does not
40
+ * return the data — use this when you only need the value to be available
41
+ * after hydration.
42
+ *
43
+ * @param queryClient - The React Query client used for SSR hydration.
44
+ * @param auth - The Better Auth server instance with the multi-session plugin.
45
+ * @param userId - The signed-in user's ID, used for cache partitioning.
46
+ * @param params - Parameters forwarded to `auth.api.listDeviceSessions`.
47
+ */
48
+ export declare const prefetchListDeviceSessions: <TAuth extends MultiSessionAuthServer>(queryClient: QueryClient, auth: TAuth, userId: string, params: ListDeviceSessionsParams<TAuth>) => Promise<void>;
49
+ /**
50
+ * Fetch and cache the current user's device sessions, resolving with the
51
+ * data or throwing on error. If a cached entry exists and is neither
52
+ * invalidated nor older than `staleTime`, the cached value is returned
53
+ * without a network call; otherwise the latest data is fetched.
54
+ *
55
+ * @param queryClient - The React Query client used for SSR hydration.
56
+ * @param auth - The Better Auth server instance with the multi-session plugin.
57
+ * @param userId - The signed-in user's ID, used for cache partitioning.
58
+ * @param params - Parameters forwarded to `auth.api.listDeviceSessions`.
59
+ */
60
+ export declare const fetchListDeviceSessions: <TAuth extends MultiSessionAuthServer>(queryClient: QueryClient, auth: TAuth, userId: string, params: ListDeviceSessionsParams<TAuth>) => Promise<Awaited<ReturnType<TAuth["api"]["listDeviceSessions"]>>>;
@@ -0,0 +1,12 @@
1
+ import { authQueryKeys as e } from "@better-auth-ui/core";
2
+ import { queryOptions as t } from "@tanstack/react-query";
3
+ //#region src/server/queries/multi-session/list-device-sessions-query.ts
4
+ function n(n, r, i) {
5
+ return t({
6
+ queryKey: e.listDeviceSessions(r, i?.query),
7
+ queryFn: () => n.api.listDeviceSessions(i)
8
+ });
9
+ }
10
+ var r = (e, t, r, i) => e.ensureQueryData(n(t, r, i)), i = (e, t, r, i) => e.prefetchQuery(n(t, r, i)), a = (e, t, r, i) => e.fetchQuery(n(t, r, i));
11
+ //#endregion
12
+ export { r as ensureListDeviceSessions, a as fetchListDeviceSessions, n as listDeviceSessionsOptions, i as prefetchListDeviceSessions };
@@ -0,0 +1,60 @@
1
+ import { DataTag, QueryClient } from '@tanstack/react-query';
2
+ import { APIError } from 'better-auth';
3
+ import { PasskeyAuthServer } from '../../../lib/auth-server';
4
+ export type ListPasskeysData<TAuth extends PasskeyAuthServer> = Awaited<ReturnType<TAuth["api"]["listPasskeys"]>>;
5
+ export type ListPasskeysParams<TAuth extends PasskeyAuthServer> = Parameters<TAuth["api"]["listPasskeys"]>[0];
6
+ export type ListPasskey<TAuth extends PasskeyAuthServer = PasskeyAuthServer> = NonNullable<ListPasskeysData<TAuth>>[number];
7
+ /**
8
+ * Query options factory for the current user's passkeys.
9
+ *
10
+ * @param auth - The Better Auth server instance with the passkey plugin.
11
+ * @param userId - The signed-in user's ID. Used for cache partitioning so
12
+ * the key matches the client-side `listPasskeysOptions` for SSR hydration.
13
+ * @param params - Parameters forwarded to `auth.api.listPasskeys`.
14
+ */
15
+ export declare function listPasskeysOptions<TAuth extends PasskeyAuthServer>(auth: TAuth, userId: string, params: ListPasskeysParams<TAuth>): (import('@tanstack/react-query').OmitKeyof<import('@tanstack/react-query').UseQueryOptions<Awaited<ReturnType<TAuth["api"]["listPasskeys"]>>, APIError, Awaited<ReturnType<TAuth["api"]["listPasskeys"]>>, readonly ["auth", "user", string | undefined, "listPasskeys", Record<string, any> | null]>, "queryFn"> & {
16
+ queryFn?: import('@tanstack/react-query').QueryFunction<Awaited<ReturnType<TAuth["api"]["listPasskeys"]>>, readonly ["auth", "user", string | undefined, "listPasskeys", Record<string, any> | null], never> | undefined;
17
+ } & {
18
+ queryKey: readonly ["auth", "user", string | undefined, "listPasskeys", Record<string, any> | null] & {
19
+ [dataTagSymbol]: Awaited<ReturnType<TAuth["api"]["listPasskeys"]>>;
20
+ [dataTagErrorSymbol]: APIError;
21
+ };
22
+ }) & {
23
+ queryKey: DataTag<readonly ["auth", "user", string | undefined, "listPasskeys", Record<string, any> | null], Awaited<ReturnType<TAuth["api"]["listPasskeys"]>>, APIError>;
24
+ };
25
+ /**
26
+ * Get the current user's passkeys from the query cache, calling
27
+ * `fetchListPasskeys` under the hood if no cached entry exists. Resolves
28
+ * with the passkey list, making it suitable for reading directly in a server
29
+ * component.
30
+ *
31
+ * @param queryClient - The React Query client used for SSR hydration.
32
+ * @param auth - The Better Auth server instance with the passkey plugin.
33
+ * @param userId - The signed-in user's ID, used for cache partitioning.
34
+ * @param params - Parameters forwarded to `auth.api.listPasskeys`.
35
+ */
36
+ export declare const ensureListPasskeys: <TAuth extends PasskeyAuthServer>(queryClient: QueryClient, auth: TAuth, userId: string, params: ListPasskeysParams<TAuth>) => Promise<Awaited<ReturnType<TAuth["api"]["listPasskeys"]>>>;
37
+ /**
38
+ * Prefetch the current user's passkeys into the query cache. Behaves like
39
+ * `fetchListPasskeys`, but does not throw on error and does not return
40
+ * the data — use this when you only need the value to be available after
41
+ * hydration.
42
+ *
43
+ * @param queryClient - The React Query client used for SSR hydration.
44
+ * @param auth - The Better Auth server instance with the passkey plugin.
45
+ * @param userId - The signed-in user's ID, used for cache partitioning.
46
+ * @param params - Parameters forwarded to `auth.api.listPasskeys`.
47
+ */
48
+ export declare const prefetchListPasskeys: <TAuth extends PasskeyAuthServer>(queryClient: QueryClient, auth: TAuth, userId: string, params: ListPasskeysParams<TAuth>) => Promise<void>;
49
+ /**
50
+ * Fetch and cache the current user's passkeys, resolving with the data or
51
+ * throwing on error. If a cached entry exists and is neither invalidated
52
+ * nor older than `staleTime`, the cached value is returned without a
53
+ * network call; otherwise the latest data is fetched.
54
+ *
55
+ * @param queryClient - The React Query client used for SSR hydration.
56
+ * @param auth - The Better Auth server instance with the passkey plugin.
57
+ * @param userId - The signed-in user's ID, used for cache partitioning.
58
+ * @param params - Parameters forwarded to `auth.api.listPasskeys`.
59
+ */
60
+ export declare const fetchListPasskeys: <TAuth extends PasskeyAuthServer>(queryClient: QueryClient, auth: TAuth, userId: string, params: ListPasskeysParams<TAuth>) => Promise<Awaited<ReturnType<TAuth["api"]["listPasskeys"]>>>;
@@ -0,0 +1,12 @@
1
+ import { authQueryKeys as e } from "@better-auth-ui/core";
2
+ import { queryOptions as t } from "@tanstack/react-query";
3
+ //#region src/server/queries/passkey/list-passkeys-query.ts
4
+ function n(n, r, i) {
5
+ return t({
6
+ queryKey: e.listPasskeys(r, i?.query),
7
+ queryFn: () => n.api.listPasskeys(i)
8
+ });
9
+ }
10
+ var r = (e, t, r, i) => e.ensureQueryData(n(t, r, i)), i = (e, t, r, i) => e.prefetchQuery(n(t, r, i)), a = (e, t, r, i) => e.fetchQuery(n(t, r, i));
11
+ //#endregion
12
+ export { r as ensureListPasskeys, a as fetchListPasskeys, n as listPasskeysOptions, i as prefetchListPasskeys };
@@ -0,0 +1,68 @@
1
+ import { DataTag, QueryClient } from '@tanstack/react-query';
2
+ import { APIError } from 'better-auth';
3
+ import { AuthServer } from '../../../lib/auth-server';
4
+ export type AccountInfoData<TAuth extends AuthServer = AuthServer> = Awaited<ReturnType<TAuth["api"]["accountInfo"]>>;
5
+ export type AccountInfoParams<TAuth extends AuthServer> = Parameters<TAuth["api"]["accountInfo"]>[0];
6
+ export type AccountInfo<TAuth extends AuthServer = AuthServer> = NonNullable<AccountInfoData<TAuth>>;
7
+ /**
8
+ * Query options factory for provider-specific account info.
9
+ *
10
+ * @param auth - The Better Auth server instance.
11
+ * @param userId - The signed-in user's ID. Used for cache partitioning so
12
+ * the key matches the client-side `accountInfoOptions` for SSR hydration.
13
+ * @param params - Parameters forwarded to `auth.api.accountInfo`.
14
+ */
15
+ export declare function accountInfoOptions<TAuth extends AuthServer>(auth: TAuth, userId: string, params: AccountInfoParams<TAuth>): (import('@tanstack/react-query').OmitKeyof<import('@tanstack/react-query').UseQueryOptions<Awaited<ReturnType<TAuth["api"]["accountInfo"]>>, APIError, Awaited<ReturnType<TAuth["api"]["accountInfo"]>>, readonly ["auth", "user", string | undefined, "accountInfo", {
16
+ accountId?: string | undefined;
17
+ } | null]>, "queryFn"> & {
18
+ queryFn?: import('@tanstack/react-query').QueryFunction<Awaited<ReturnType<TAuth["api"]["accountInfo"]>>, readonly ["auth", "user", string | undefined, "accountInfo", {
19
+ accountId?: string | undefined;
20
+ } | null], never> | undefined;
21
+ } & {
22
+ queryKey: readonly ["auth", "user", string | undefined, "accountInfo", {
23
+ accountId?: string | undefined;
24
+ } | null] & {
25
+ [dataTagSymbol]: Awaited<ReturnType<TAuth["api"]["accountInfo"]>>;
26
+ [dataTagErrorSymbol]: APIError;
27
+ };
28
+ }) & {
29
+ queryKey: DataTag<readonly ["auth", "user", string | undefined, "accountInfo", {
30
+ accountId?: string | undefined;
31
+ } | null], Awaited<ReturnType<TAuth["api"]["accountInfo"]>>, APIError>;
32
+ };
33
+ /**
34
+ * Get the current user's provider-specific account info from the query
35
+ * cache, calling `fetchAccountInfo` under the hood if no cached entry
36
+ * exists. Resolves with the data, making it suitable for reading directly
37
+ * in a server component.
38
+ *
39
+ * @param queryClient - The React Query client used for SSR hydration.
40
+ * @param auth - The Better Auth server instance.
41
+ * @param userId - The signed-in user's ID, used for cache partitioning.
42
+ * @param params - Parameters forwarded to `auth.api.accountInfo`.
43
+ */
44
+ export declare const ensureAccountInfo: <TAuth extends AuthServer>(queryClient: QueryClient, auth: TAuth, userId: string, params: AccountInfoParams<TAuth>) => Promise<Awaited<ReturnType<TAuth["api"]["accountInfo"]>>>;
45
+ /**
46
+ * Prefetch the current user's provider-specific account info into the query
47
+ * cache. Behaves like `fetchAccountInfo`, but does not throw on error and
48
+ * does not return the data — use this when you only need the value to be
49
+ * available after hydration.
50
+ *
51
+ * @param queryClient - The React Query client used for SSR hydration.
52
+ * @param auth - The Better Auth server instance.
53
+ * @param userId - The signed-in user's ID, used for cache partitioning.
54
+ * @param params - Parameters forwarded to `auth.api.accountInfo`.
55
+ */
56
+ export declare const prefetchAccountInfo: <TAuth extends AuthServer>(queryClient: QueryClient, auth: TAuth, userId: string, params: AccountInfoParams<TAuth>) => Promise<void>;
57
+ /**
58
+ * Fetch and cache the current user's provider-specific account info,
59
+ * resolving with the data or throwing on error. If a cached entry exists
60
+ * and is neither invalidated nor older than `staleTime`, the cached value
61
+ * is returned without a network call; otherwise the latest data is fetched.
62
+ *
63
+ * @param queryClient - The React Query client used for SSR hydration.
64
+ * @param auth - The Better Auth server instance.
65
+ * @param userId - The signed-in user's ID, used for cache partitioning.
66
+ * @param params - Parameters forwarded to `auth.api.accountInfo`.
67
+ */
68
+ export declare const fetchAccountInfo: <TAuth extends AuthServer>(queryClient: QueryClient, auth: TAuth, userId: string, params: AccountInfoParams<TAuth>) => Promise<Awaited<ReturnType<TAuth["api"]["accountInfo"]>>>;
@@ -0,0 +1,12 @@
1
+ import { authQueryKeys as e } from "@better-auth-ui/core";
2
+ import { queryOptions as t } from "@tanstack/react-query";
3
+ //#region src/server/queries/settings/account-info-query.ts
4
+ function n(n, r, i) {
5
+ return t({
6
+ queryKey: e.accountInfo(r, i?.query),
7
+ queryFn: () => n.api.accountInfo(i)
8
+ });
9
+ }
10
+ var r = (e, t, r, i) => e.ensureQueryData(n(t, r, i)), i = (e, t, r, i) => e.prefetchQuery(n(t, r, i)), a = (e, t, r, i) => e.fetchQuery(n(t, r, i));
11
+ //#endregion
12
+ export { n as accountInfoOptions, r as ensureAccountInfo, a as fetchAccountInfo, i as prefetchAccountInfo };
@@ -0,0 +1,60 @@
1
+ import { DataTag, QueryClient } from '@tanstack/react-query';
2
+ import { APIError } from 'better-auth';
3
+ import { AuthServer } from '../../../lib/auth-server';
4
+ export type ListAccountsData<TAuth extends AuthServer = AuthServer> = Awaited<ReturnType<TAuth["api"]["listUserAccounts"]>>;
5
+ export type ListAccountsParams<TAuth extends AuthServer> = Parameters<TAuth["api"]["listUserAccounts"]>[0];
6
+ export type ListAccount<TAuth extends AuthServer = AuthServer> = NonNullable<ListAccountsData<TAuth>>[number];
7
+ /**
8
+ * Query options factory for the current user's linked social accounts.
9
+ *
10
+ * @param auth - The Better Auth server instance.
11
+ * @param userId - The signed-in user's ID. Used for cache partitioning so
12
+ * the key matches the client-side `listAccountsOptions` for SSR hydration.
13
+ * @param params - Parameters forwarded to `auth.api.listUserAccounts`.
14
+ */
15
+ export declare function listAccountsOptions<TAuth extends AuthServer>(auth: TAuth, userId: string, params: ListAccountsParams<TAuth>): (import('@tanstack/react-query').OmitKeyof<import('@tanstack/react-query').UseQueryOptions<Awaited<ReturnType<TAuth["api"]["listUserAccounts"]>>, APIError, Awaited<ReturnType<TAuth["api"]["listUserAccounts"]>>, readonly ["auth", "user", string | undefined, "listAccounts", Record<string, any> | null]>, "queryFn"> & {
16
+ queryFn?: import('@tanstack/react-query').QueryFunction<Awaited<ReturnType<TAuth["api"]["listUserAccounts"]>>, readonly ["auth", "user", string | undefined, "listAccounts", Record<string, any> | null], never> | undefined;
17
+ } & {
18
+ queryKey: readonly ["auth", "user", string | undefined, "listAccounts", Record<string, any> | null] & {
19
+ [dataTagSymbol]: Awaited<ReturnType<TAuth["api"]["listUserAccounts"]>>;
20
+ [dataTagErrorSymbol]: APIError;
21
+ };
22
+ }) & {
23
+ queryKey: DataTag<readonly ["auth", "user", string | undefined, "listAccounts", Record<string, any> | null], Awaited<ReturnType<TAuth["api"]["listUserAccounts"]>>, APIError>;
24
+ };
25
+ /**
26
+ * Get the current user's linked social accounts from the query cache,
27
+ * calling `fetchListAccounts` under the hood if no cached entry exists.
28
+ * Resolves with the account list, making it suitable for reading directly
29
+ * in a server component.
30
+ *
31
+ * @param queryClient - The React Query client used for SSR hydration.
32
+ * @param auth - The Better Auth server instance.
33
+ * @param userId - The signed-in user's ID, used for cache partitioning.
34
+ * @param params - Parameters forwarded to `auth.api.listUserAccounts`.
35
+ */
36
+ export declare const ensureListAccounts: <TAuth extends AuthServer>(queryClient: QueryClient, auth: TAuth, userId: string, params: ListAccountsParams<TAuth>) => Promise<Awaited<ReturnType<TAuth["api"]["listUserAccounts"]>>>;
37
+ /**
38
+ * Prefetch the current user's linked social accounts into the query cache.
39
+ * Behaves like `fetchListAccounts`, but does not throw on error and does
40
+ * not return the data — use this when you only need the value to be
41
+ * available after hydration.
42
+ *
43
+ * @param queryClient - The React Query client used for SSR hydration.
44
+ * @param auth - The Better Auth server instance.
45
+ * @param userId - The signed-in user's ID, used for cache partitioning.
46
+ * @param params - Parameters forwarded to `auth.api.listUserAccounts`.
47
+ */
48
+ export declare const prefetchListAccounts: <TAuth extends AuthServer>(queryClient: QueryClient, auth: TAuth, userId: string, params: ListAccountsParams<TAuth>) => Promise<void>;
49
+ /**
50
+ * Fetch and cache the current user's linked social accounts, resolving
51
+ * with the data or throwing on error. If a cached entry exists and is
52
+ * neither invalidated nor older than `staleTime`, the cached value is
53
+ * returned without a network call; otherwise the latest data is fetched.
54
+ *
55
+ * @param queryClient - The React Query client used for SSR hydration.
56
+ * @param auth - The Better Auth server instance.
57
+ * @param userId - The signed-in user's ID, used for cache partitioning.
58
+ * @param params - Parameters forwarded to `auth.api.listUserAccounts`.
59
+ */
60
+ export declare const fetchListAccounts: <TAuth extends AuthServer>(queryClient: QueryClient, auth: TAuth, userId: string, params: ListAccountsParams<TAuth>) => Promise<Awaited<ReturnType<TAuth["api"]["listUserAccounts"]>>>;
@@ -0,0 +1,12 @@
1
+ import { authQueryKeys as e } from "@better-auth-ui/core";
2
+ import { queryOptions as t } from "@tanstack/react-query";
3
+ //#region src/server/queries/settings/list-accounts-query.ts
4
+ function n(n, r, i) {
5
+ return t({
6
+ queryKey: e.listAccounts(r, i?.query),
7
+ queryFn: () => n.api.listUserAccounts(i)
8
+ });
9
+ }
10
+ var r = (e, t, r, i) => e.ensureQueryData(n(t, r, i)), i = (e, t, r, i) => e.prefetchQuery(n(t, r, i)), a = (e, t, r, i) => e.fetchQuery(n(t, r, i));
11
+ //#endregion
12
+ export { r as ensureListAccounts, a as fetchListAccounts, n as listAccountsOptions, i as prefetchListAccounts };
@@ -0,0 +1,60 @@
1
+ import { DataTag, QueryClient } from '@tanstack/react-query';
2
+ import { APIError } from 'better-auth';
3
+ import { AuthServer } from '../../../lib/auth-server';
4
+ export type ListSessionsData<TAuth extends AuthServer = AuthServer> = Awaited<ReturnType<TAuth["api"]["listSessions"]>>;
5
+ export type ListSessionsParams<TAuth extends AuthServer> = Parameters<TAuth["api"]["listSessions"]>[0];
6
+ export type ListSession<TAuth extends AuthServer = AuthServer> = NonNullable<ListSessionsData<TAuth>>[number];
7
+ /**
8
+ * Query options factory for the current user's active sessions.
9
+ *
10
+ * @param auth - The Better Auth server instance.
11
+ * @param userId - The signed-in user's ID. Used for cache partitioning so
12
+ * the key matches the client-side `listSessionsOptions` for SSR hydration.
13
+ * @param params - Parameters forwarded to `auth.api.listSessions`.
14
+ */
15
+ export declare function listSessionsOptions<TAuth extends AuthServer>(auth: TAuth, userId: string, params: ListSessionsParams<TAuth>): (import('@tanstack/react-query').OmitKeyof<import('@tanstack/react-query').UseQueryOptions<Awaited<ReturnType<TAuth["api"]["listSessions"]>>, APIError, Awaited<ReturnType<TAuth["api"]["listSessions"]>>, readonly ["auth", "user", string | undefined, "listSessions", Record<string, any> | null]>, "queryFn"> & {
16
+ queryFn?: import('@tanstack/react-query').QueryFunction<Awaited<ReturnType<TAuth["api"]["listSessions"]>>, readonly ["auth", "user", string | undefined, "listSessions", Record<string, any> | null], never> | undefined;
17
+ } & {
18
+ queryKey: readonly ["auth", "user", string | undefined, "listSessions", Record<string, any> | null] & {
19
+ [dataTagSymbol]: Awaited<ReturnType<TAuth["api"]["listSessions"]>>;
20
+ [dataTagErrorSymbol]: APIError;
21
+ };
22
+ }) & {
23
+ queryKey: DataTag<readonly ["auth", "user", string | undefined, "listSessions", Record<string, any> | null], Awaited<ReturnType<TAuth["api"]["listSessions"]>>, APIError>;
24
+ };
25
+ /**
26
+ * Get the current user's active sessions from the query cache, calling
27
+ * `fetchListSessions` under the hood if no cached entry exists. Resolves
28
+ * with the session list, making it suitable for reading directly in a server
29
+ * component.
30
+ *
31
+ * @param queryClient - The React Query client used for SSR hydration.
32
+ * @param auth - The Better Auth server instance.
33
+ * @param userId - The signed-in user's ID, used for cache partitioning.
34
+ * @param params - Parameters forwarded to `auth.api.listSessions`.
35
+ */
36
+ export declare const ensureListSessions: <TAuth extends AuthServer>(queryClient: QueryClient, auth: TAuth, userId: string, params: ListSessionsParams<TAuth>) => Promise<Awaited<ReturnType<TAuth["api"]["listSessions"]>>>;
37
+ /**
38
+ * Prefetch the current user's active sessions into the query cache. Behaves
39
+ * like `fetchListSessions`, but does not throw on error and does not return
40
+ * the data — use this when you only need the value to be available after
41
+ * hydration.
42
+ *
43
+ * @param queryClient - The React Query client used for SSR hydration.
44
+ * @param auth - The Better Auth server instance.
45
+ * @param userId - The signed-in user's ID, used for cache partitioning.
46
+ * @param params - Parameters forwarded to `auth.api.listSessions`.
47
+ */
48
+ export declare const prefetchListSessions: <TAuth extends AuthServer>(queryClient: QueryClient, auth: TAuth, userId: string, params: ListSessionsParams<TAuth>) => Promise<void>;
49
+ /**
50
+ * Fetch and cache the current user's active sessions, resolving with the
51
+ * data or throwing on error. If a cached entry exists and is neither
52
+ * invalidated nor older than `staleTime`, the cached value is returned
53
+ * without a network call; otherwise the latest data is fetched.
54
+ *
55
+ * @param queryClient - The React Query client used for SSR hydration.
56
+ * @param auth - The Better Auth server instance.
57
+ * @param userId - The signed-in user's ID, used for cache partitioning.
58
+ * @param params - Parameters forwarded to `auth.api.listSessions`.
59
+ */
60
+ export declare const fetchListSessions: <TAuth extends AuthServer>(queryClient: QueryClient, auth: TAuth, userId: string, params: ListSessionsParams<TAuth>) => Promise<Awaited<ReturnType<TAuth["api"]["listSessions"]>>>;
@@ -0,0 +1,12 @@
1
+ import { authQueryKeys as e } from "@better-auth-ui/core";
2
+ import { queryOptions as t } from "@tanstack/react-query";
3
+ //#region src/server/queries/settings/list-sessions-query.ts
4
+ function n(n, r, i) {
5
+ return t({
6
+ queryKey: e.listSessions(r, i?.query),
7
+ queryFn: () => n.api.listSessions(i)
8
+ });
9
+ }
10
+ var r = (e, t, r, i) => e.ensureQueryData(n(t, r, i)), i = (e, t, r, i) => e.prefetchQuery(n(t, r, i)), a = (e, t, r, i) => e.fetchQuery(n(t, r, i));
11
+ //#endregion
12
+ export { r as ensureListSessions, a as fetchListSessions, n as listSessionsOptions, i as prefetchListSessions };
@@ -0,0 +1,7 @@
1
+ export type * from './lib/auth-server';
2
+ export * from './server/queries/auth/session-query';
3
+ export * from './server/queries/multi-session/list-device-sessions-query';
4
+ export * from './server/queries/passkey/list-passkeys-query';
5
+ export * from './server/queries/settings/account-info-query';
6
+ export * from './server/queries/settings/list-accounts-query';
7
+ export * from './server/queries/settings/list-sessions-query';
package/dist/server.js ADDED
@@ -0,0 +1,7 @@
1
+ import { ensureSession as e, fetchSession as t, prefetchSession as n, sessionOptions as r } from "./server/queries/auth/session-query.js";
2
+ import { ensureListDeviceSessions as i, fetchListDeviceSessions as a, listDeviceSessionsOptions as o, prefetchListDeviceSessions as s } from "./server/queries/multi-session/list-device-sessions-query.js";
3
+ import { ensureListPasskeys as c, fetchListPasskeys as l, listPasskeysOptions as u, prefetchListPasskeys as d } from "./server/queries/passkey/list-passkeys-query.js";
4
+ import { accountInfoOptions as f, ensureAccountInfo as p, fetchAccountInfo as m, prefetchAccountInfo as h } from "./server/queries/settings/account-info-query.js";
5
+ import { ensureListAccounts as g, fetchListAccounts as _, listAccountsOptions as v, prefetchListAccounts as y } from "./server/queries/settings/list-accounts-query.js";
6
+ import { ensureListSessions as b, fetchListSessions as x, listSessionsOptions as S, prefetchListSessions as C } from "./server/queries/settings/list-sessions-query.js";
7
+ export { f as accountInfoOptions, p as ensureAccountInfo, g as ensureListAccounts, i as ensureListDeviceSessions, c as ensureListPasskeys, b as ensureListSessions, e as ensureSession, m as fetchAccountInfo, _ as fetchListAccounts, a as fetchListDeviceSessions, l as fetchListPasskeys, x as fetchListSessions, t as fetchSession, v as listAccountsOptions, o as listDeviceSessionsOptions, u as listPasskeysOptions, S as listSessionsOptions, h as prefetchAccountInfo, y as prefetchListAccounts, s as prefetchListDeviceSessions, d as prefetchListPasskeys, C as prefetchListSessions, n as prefetchSession, r as sessionOptions };