@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.
- package/dist/components/auth/auth-provider.d.ts +23 -8
- package/dist/components/auth/auth-provider.js +35 -19
- package/dist/components/{email → auth/email}/email-changed.js +2 -2
- package/dist/components/{email → auth/email}/email-localization.js +1 -1
- package/dist/components/{email → auth/email}/email-styles.js +1 -1
- package/dist/components/{email → auth/email}/email-verification.js +2 -2
- package/dist/components/{email → auth/email}/magic-link.js +2 -2
- package/dist/components/{email → auth/email}/new-device.js +2 -2
- package/dist/components/{email → auth/email}/otp-email.js +2 -2
- package/dist/components/{email → auth/email}/password-changed.js +2 -2
- package/dist/components/{email → auth/email}/reset-password.js +2 -2
- package/dist/components/auth/fetch-options-provider.d.ts +19 -0
- package/dist/components/auth/fetch-options-provider.js +30 -0
- package/dist/email.d.ts +1 -0
- package/dist/email.js +11 -0
- package/dist/hooks/auth/use-authenticate.d.ts +5 -28
- package/dist/hooks/auth/use-authenticate.js +12 -12
- package/dist/hooks/auth/use-user.d.ts +19 -314
- package/dist/hooks/auth/use-user.js +5 -5
- package/dist/hooks/use-auth-mutation.d.ts +12 -7
- package/dist/hooks/use-auth-plugin.d.ts +31 -0
- package/dist/hooks/use-auth-plugin.js +10 -0
- package/dist/hooks/use-auth-query.d.ts +3 -3
- package/dist/index.d.ts +34 -32
- package/dist/index.js +75 -83
- package/dist/lib/auth-client.d.ts +23 -3687
- package/dist/lib/auth-plugin.d.ts +61 -0
- package/dist/lib/auth-server.d.ts +16 -0
- package/dist/mutations/auth/request-password-reset-mutation.d.ts +26 -0
- package/dist/mutations/auth/request-password-reset-mutation.js +24 -0
- package/dist/mutations/auth/reset-password-mutation.d.ts +25 -0
- package/dist/mutations/auth/reset-password-mutation.js +24 -0
- package/dist/mutations/auth/send-verification-email-mutation.d.ts +24 -0
- package/dist/mutations/auth/send-verification-email-mutation.js +24 -0
- package/dist/mutations/auth/sign-in-email-mutation.d.ts +71 -0
- package/dist/mutations/auth/sign-in-email-mutation.js +29 -0
- package/dist/mutations/auth/sign-in-social-mutation.d.ts +77 -0
- package/dist/mutations/auth/sign-in-social-mutation.js +24 -0
- package/dist/mutations/auth/sign-out-mutation.d.ts +25 -0
- package/dist/mutations/auth/sign-out-mutation.js +28 -0
- package/dist/mutations/auth/sign-up-email-mutation.d.ts +105 -0
- package/dist/mutations/auth/sign-up-email-mutation.js +29 -0
- package/dist/mutations/auth-mutation-options.d.ts +37 -20
- package/dist/mutations/auth-mutation-options.js +2 -2
- package/dist/mutations/magic-link/sign-in-magic-link-mutation.d.ts +24 -0
- package/dist/mutations/magic-link/sign-in-magic-link-mutation.js +24 -0
- package/dist/mutations/multi-session/revoke-multi-session-mutation.d.ts +25 -0
- package/dist/mutations/multi-session/revoke-multi-session-mutation.js +29 -0
- package/dist/mutations/multi-session/set-active-session-mutation.d.ts +62 -0
- package/dist/mutations/multi-session/set-active-session-mutation.js +31 -0
- package/dist/mutations/passkey/add-passkey-mutation.d.ts +71 -0
- package/dist/mutations/passkey/add-passkey-mutation.js +29 -0
- package/dist/mutations/passkey/delete-passkey-mutation.d.ts +25 -0
- package/dist/mutations/passkey/delete-passkey-mutation.js +29 -0
- package/dist/mutations/passkey/sign-in-passkey-mutation.d.ts +105 -0
- package/dist/mutations/passkey/sign-in-passkey-mutation.js +29 -0
- package/dist/mutations/settings/change-email-mutation.d.ts +25 -0
- package/dist/mutations/settings/change-email-mutation.js +29 -0
- package/dist/mutations/settings/change-password-mutation.d.ts +78 -0
- package/dist/mutations/settings/change-password-mutation.js +24 -0
- package/dist/mutations/settings/delete-user-mutation.d.ts +26 -0
- package/dist/mutations/settings/delete-user-mutation.js +24 -0
- package/dist/mutations/settings/link-social-mutation.d.ts +26 -0
- package/dist/mutations/settings/link-social-mutation.js +24 -0
- package/dist/mutations/settings/revoke-session-mutation.d.ts +25 -0
- package/dist/mutations/settings/revoke-session-mutation.js +29 -0
- package/dist/mutations/settings/unlink-account-mutation.d.ts +25 -0
- package/dist/mutations/settings/unlink-account-mutation.js +29 -0
- package/dist/mutations/settings/update-user-mutation.d.ts +25 -0
- package/dist/mutations/settings/update-user-mutation.js +35 -0
- package/dist/mutations/username/is-username-available-mutation.d.ts +27 -0
- package/dist/mutations/username/is-username-available-mutation.js +24 -0
- package/dist/mutations/username/sign-in-username-mutation.d.ts +75 -0
- package/dist/mutations/username/sign-in-username-mutation.js +29 -0
- package/dist/plugins/captcha-plugin.d.ts +29 -0
- package/dist/plugins/captcha-plugin.js +29 -0
- package/dist/plugins.d.ts +1 -0
- package/dist/plugins.js +3 -0
- package/dist/queries/auth/session-query.d.ts +71 -0
- package/dist/queries/auth/session-query.js +30 -0
- package/dist/queries/auth-query-options.d.ts +26 -15
- package/dist/queries/multi-session/list-device-sessions-query.d.ts +76 -0
- package/dist/queries/multi-session/list-device-sessions-query.js +31 -0
- package/dist/queries/passkey/list-passkeys-query.d.ts +74 -0
- package/dist/queries/passkey/list-passkeys-query.js +31 -0
- package/dist/queries/settings/account-info-query.d.ts +85 -0
- package/dist/queries/settings/account-info-query.js +31 -0
- package/dist/queries/settings/list-accounts-query.d.ts +76 -0
- package/dist/queries/settings/list-accounts-query.js +31 -0
- package/dist/queries/settings/list-sessions-query.d.ts +74 -0
- package/dist/queries/settings/list-sessions-query.js +31 -0
- package/dist/server/queries/auth/session-query.d.ts +57 -0
- package/dist/server/queries/auth/session-query.js +13 -0
- package/dist/server/queries/multi-session/list-device-sessions-query.d.ts +60 -0
- package/dist/server/queries/multi-session/list-device-sessions-query.js +12 -0
- package/dist/server/queries/passkey/list-passkeys-query.d.ts +60 -0
- package/dist/server/queries/passkey/list-passkeys-query.js +12 -0
- package/dist/server/queries/settings/account-info-query.d.ts +68 -0
- package/dist/server/queries/settings/account-info-query.js +12 -0
- package/dist/server/queries/settings/list-accounts-query.d.ts +60 -0
- package/dist/server/queries/settings/list-accounts-query.js +12 -0
- package/dist/server/queries/settings/list-sessions-query.d.ts +60 -0
- package/dist/server/queries/settings/list-sessions-query.js +12 -0
- package/dist/server.d.ts +7 -0
- package/dist/server.js +7 -0
- package/package.json +28 -22
- package/src/components/auth/auth-provider.tsx +88 -25
- package/src/components/{email → auth/email}/email-changed.tsx +1 -1
- package/src/components/{email → auth/email}/email-verification.tsx +1 -1
- package/src/components/{email → auth/email}/magic-link.tsx +1 -1
- package/src/components/{email → auth/email}/new-device.tsx +1 -1
- package/src/components/{email → auth/email}/otp-email.tsx +1 -1
- package/src/components/{email → auth/email}/password-changed.tsx +1 -1
- package/src/components/{email → auth/email}/reset-password.tsx +1 -1
- package/src/components/auth/fetch-options-provider.tsx +77 -0
- package/src/email.ts +1 -0
- package/src/hooks/auth/use-authenticate.ts +12 -6
- package/src/hooks/auth/use-user.ts +14 -9
- package/src/hooks/use-auth-mutation.ts +30 -12
- package/src/hooks/use-auth-plugin.ts +50 -0
- package/src/hooks/use-auth-query.ts +11 -7
- package/src/index.ts +34 -32
- package/src/lib/auth-client.ts +33 -31
- package/src/lib/auth-plugin.ts +77 -0
- package/src/lib/auth-server.ts +30 -0
- package/src/mutations/auth/request-password-reset-mutation.ts +58 -0
- package/src/mutations/auth/reset-password-mutation.ts +60 -0
- package/src/mutations/auth/send-verification-email-mutation.ts +58 -0
- package/src/mutations/auth/sign-in-email-mutation.ts +78 -0
- package/src/mutations/auth/sign-in-social-mutation.ts +64 -0
- package/src/mutations/auth/sign-out-mutation.ts +71 -0
- package/src/mutations/auth/sign-up-email-mutation.ts +74 -0
- package/src/mutations/auth-mutation-options.ts +83 -38
- package/src/mutations/magic-link/sign-in-magic-link-mutation.ts +59 -0
- package/src/mutations/multi-session/revoke-multi-session-mutation.ts +70 -0
- package/src/mutations/multi-session/set-active-session-mutation.ts +98 -0
- package/src/mutations/passkey/add-passkey-mutation.ts +66 -0
- package/src/mutations/passkey/delete-passkey-mutation.ts +66 -0
- package/src/mutations/passkey/sign-in-passkey-mutation.ts +74 -0
- package/src/mutations/settings/change-email-mutation.ts +67 -0
- package/src/mutations/settings/change-password-mutation.ts +59 -0
- package/src/mutations/settings/delete-user-mutation.ts +59 -0
- package/src/mutations/settings/link-social-mutation.ts +59 -0
- package/src/mutations/settings/revoke-session-mutation.ts +69 -0
- package/src/mutations/settings/unlink-account-mutation.ts +67 -0
- package/src/mutations/settings/update-user-mutation.ts +82 -0
- package/src/mutations/username/is-username-available-mutation.ts +62 -0
- package/src/mutations/username/sign-in-username-mutation.ts +74 -0
- package/src/plugins/captcha-plugin.tsx +75 -0
- package/src/plugins.ts +3 -0
- package/src/queries/auth/session-query.ts +135 -0
- package/src/queries/auth-query-options.ts +61 -12
- package/src/queries/multi-session/list-device-sessions-query.ts +177 -0
- package/src/queries/passkey/list-passkeys-query.ts +154 -0
- package/src/queries/settings/account-info-query.ts +158 -0
- package/src/queries/settings/list-accounts-query.ts +156 -0
- package/src/queries/settings/list-sessions-query.ts +154 -0
- package/src/server/queries/auth/session-query.ts +94 -0
- package/src/server/queries/multi-session/list-device-sessions-query.ts +102 -0
- package/src/server/queries/passkey/list-passkeys-query.ts +100 -0
- package/src/server/queries/settings/account-info-query.ts +101 -0
- package/src/server/queries/settings/list-accounts-query.ts +101 -0
- package/src/server/queries/settings/list-sessions-query.ts +101 -0
- package/src/server.ts +7 -0
- package/dist/core.d.ts +0 -1
- package/dist/core.js +0 -1
- package/dist/hooks/auth/use-is-username-available.d.ts +0 -20
- package/dist/hooks/auth/use-is-username-available.js +0 -13
- package/dist/hooks/auth/use-request-password-reset.d.ts +0 -21
- package/dist/hooks/auth/use-request-password-reset.js +0 -13
- package/dist/hooks/auth/use-reset-password.d.ts +0 -23
- package/dist/hooks/auth/use-reset-password.js +0 -13
- package/dist/hooks/auth/use-send-verification-email.d.ts +0 -19
- package/dist/hooks/auth/use-send-verification-email.js +0 -13
- package/dist/hooks/auth/use-session.d.ts +0 -35
- package/dist/hooks/auth/use-session.js +0 -16
- package/dist/hooks/auth/use-sign-in-email.d.ts +0 -26
- package/dist/hooks/auth/use-sign-in-email.js +0 -17
- package/dist/hooks/auth/use-sign-in-magic-link.d.ts +0 -27
- package/dist/hooks/auth/use-sign-in-magic-link.js +0 -13
- package/dist/hooks/auth/use-sign-in-passkey.d.ts +0 -21
- package/dist/hooks/auth/use-sign-in-passkey.js +0 -17
- package/dist/hooks/auth/use-sign-in-social.d.ts +0 -63
- package/dist/hooks/auth/use-sign-in-social.js +0 -13
- package/dist/hooks/auth/use-sign-in-username.d.ts +0 -25
- package/dist/hooks/auth/use-sign-in-username.js +0 -17
- package/dist/hooks/auth/use-sign-out.d.ts +0 -18
- package/dist/hooks/auth/use-sign-out.js +0 -16
- package/dist/hooks/auth/use-sign-up-email.d.ts +0 -1186
- package/dist/hooks/auth/use-sign-up-email.js +0 -17
- package/dist/hooks/settings/use-account-info.d.ts +0 -17
- package/dist/hooks/settings/use-account-info.js +0 -18
- package/dist/hooks/settings/use-add-passkey.d.ts +0 -21
- package/dist/hooks/settings/use-add-passkey.js +0 -17
- package/dist/hooks/settings/use-change-email.d.ts +0 -21
- package/dist/hooks/settings/use-change-email.js +0 -17
- package/dist/hooks/settings/use-change-password.d.ts +0 -21
- package/dist/hooks/settings/use-change-password.js +0 -13
- package/dist/hooks/settings/use-delete-passkey.d.ts +0 -19
- package/dist/hooks/settings/use-delete-passkey.js +0 -17
- package/dist/hooks/settings/use-delete-user.d.ts +0 -24
- package/dist/hooks/settings/use-delete-user.js +0 -13
- package/dist/hooks/settings/use-link-social.d.ts +0 -43
- package/dist/hooks/settings/use-link-social.js +0 -13
- package/dist/hooks/settings/use-list-accounts.d.ts +0 -22
- package/dist/hooks/settings/use-list-accounts.js +0 -15
- package/dist/hooks/settings/use-list-device-sessions.d.ts +0 -34
- package/dist/hooks/settings/use-list-device-sessions.js +0 -15
- package/dist/hooks/settings/use-list-sessions.d.ts +0 -23
- package/dist/hooks/settings/use-list-sessions.js +0 -15
- package/dist/hooks/settings/use-list-user-passkeys.d.ts +0 -14
- package/dist/hooks/settings/use-list-user-passkeys.js +0 -15
- package/dist/hooks/settings/use-revoke-multi-session.d.ts +0 -19
- package/dist/hooks/settings/use-revoke-multi-session.js +0 -17
- package/dist/hooks/settings/use-revoke-session.d.ts +0 -19
- package/dist/hooks/settings/use-revoke-session.js +0 -17
- package/dist/hooks/settings/use-set-active-session.d.ts +0 -20
- package/dist/hooks/settings/use-set-active-session.js +0 -20
- package/dist/hooks/settings/use-unlink-account.d.ts +0 -21
- package/dist/hooks/settings/use-unlink-account.js +0 -17
- package/dist/hooks/settings/use-update-user.d.ts +0 -1185
- package/dist/hooks/settings/use-update-user.js +0 -24
- package/dist/lib/auth-client.js +0 -11
- package/dist/lib/auth-config.d.ts +0 -43
- package/dist/lib/auth-context.d.ts +0 -2
- package/dist/lib/auth-context.js +0 -6
- package/dist/mutations/auth/is-username-available-options.d.ts +0 -19
- package/dist/mutations/auth/is-username-available-options.js +0 -7
- package/dist/mutations/auth/request-password-reset-options.d.ts +0 -15
- package/dist/mutations/auth/request-password-reset-options.js +0 -7
- package/dist/mutations/auth/reset-password-options.d.ts +0 -17
- package/dist/mutations/auth/reset-password-options.js +0 -7
- package/dist/mutations/auth/send-verification-email-options.d.ts +0 -15
- package/dist/mutations/auth/send-verification-email-options.js +0 -7
- package/dist/mutations/auth/sign-in-email-options.d.ts +0 -23
- package/dist/mutations/auth/sign-in-email-options.js +0 -11
- package/dist/mutations/auth/sign-in-magic-link-options.d.ts +0 -23
- package/dist/mutations/auth/sign-in-magic-link-options.js +0 -11
- package/dist/mutations/auth/sign-in-passkey-options.d.ts +0 -15
- package/dist/mutations/auth/sign-in-passkey-options.js +0 -11
- package/dist/mutations/auth/sign-in-social-options.d.ts +0 -61
- package/dist/mutations/auth/sign-in-social-options.js +0 -11
- package/dist/mutations/auth/sign-in-username-options.d.ts +0 -19
- package/dist/mutations/auth/sign-in-username-options.js +0 -11
- package/dist/mutations/auth/sign-out-options.d.ts +0 -12
- package/dist/mutations/auth/sign-out-options.js +0 -7
- package/dist/mutations/auth/sign-up-email-options.d.ts +0 -1180
- package/dist/mutations/auth/sign-up-email-options.js +0 -11
- package/dist/mutations/settings/add-passkey-options.d.ts +0 -15
- package/dist/mutations/settings/add-passkey-options.js +0 -11
- package/dist/mutations/settings/change-email-options.d.ts +0 -15
- package/dist/mutations/settings/change-email-options.js +0 -7
- package/dist/mutations/settings/change-password-options.d.ts +0 -17
- package/dist/mutations/settings/change-password-options.js +0 -7
- package/dist/mutations/settings/delete-passkey-options.d.ts +0 -13
- package/dist/mutations/settings/delete-passkey-options.js +0 -11
- package/dist/mutations/settings/delete-user-options.d.ts +0 -20
- package/dist/mutations/settings/delete-user-options.js +0 -7
- package/dist/mutations/settings/link-social-options.d.ts +0 -39
- package/dist/mutations/settings/link-social-options.js +0 -7
- package/dist/mutations/settings/revoke-multi-session-options.d.ts +0 -13
- package/dist/mutations/settings/revoke-multi-session-options.js +0 -11
- package/dist/mutations/settings/revoke-session-options.d.ts +0 -13
- package/dist/mutations/settings/revoke-session-options.js +0 -7
- package/dist/mutations/settings/set-active-session-options.d.ts +0 -13
- package/dist/mutations/settings/set-active-session-options.js +0 -11
- package/dist/mutations/settings/unlink-account-options.d.ts +0 -15
- package/dist/mutations/settings/unlink-account-options.js +0 -7
- package/dist/mutations/settings/update-user-options.d.ts +0 -1182
- package/dist/mutations/settings/update-user-options.js +0 -7
- package/dist/queries/auth/session-options.d.ts +0 -110
- package/dist/queries/auth/session-options.js +0 -7
- package/dist/queries/settings/account-info-options.d.ts +0 -32
- package/dist/queries/settings/account-info-options.js +0 -12
- package/dist/queries/settings/list-accounts-options.d.ts +0 -53
- package/dist/queries/settings/list-accounts-options.js +0 -12
- package/dist/queries/settings/list-device-sessions-options.d.ts +0 -99
- package/dist/queries/settings/list-device-sessions-options.js +0 -12
- package/dist/queries/settings/list-sessions-options.d.ts +0 -54
- package/dist/queries/settings/list-sessions-options.js +0 -12
- package/dist/queries/settings/list-user-passkeys-options.d.ts +0 -18
- package/dist/queries/settings/list-user-passkeys-options.js +0 -12
- package/src/core.ts +0 -1
- package/src/hooks/auth/use-is-username-available.ts +0 -31
- package/src/hooks/auth/use-request-password-reset.ts +0 -33
- package/src/hooks/auth/use-reset-password.ts +0 -31
- package/src/hooks/auth/use-send-verification-email.ts +0 -31
- package/src/hooks/auth/use-session.ts +0 -31
- package/src/hooks/auth/use-sign-in-email.ts +0 -41
- package/src/hooks/auth/use-sign-in-magic-link.ts +0 -29
- package/src/hooks/auth/use-sign-in-passkey.ts +0 -40
- package/src/hooks/auth/use-sign-in-social.ts +0 -31
- package/src/hooks/auth/use-sign-in-username.ts +0 -40
- package/src/hooks/auth/use-sign-out.ts +0 -34
- package/src/hooks/auth/use-sign-up-email.ts +0 -40
- package/src/hooks/settings/use-account-info.ts +0 -40
- package/src/hooks/settings/use-add-passkey.ts +0 -37
- package/src/hooks/settings/use-change-email.ts +0 -37
- package/src/hooks/settings/use-change-password.ts +0 -29
- package/src/hooks/settings/use-delete-passkey.ts +0 -37
- package/src/hooks/settings/use-delete-user.ts +0 -29
- package/src/hooks/settings/use-link-social.ts +0 -29
- package/src/hooks/settings/use-list-accounts.ts +0 -39
- package/src/hooks/settings/use-list-device-sessions.ts +0 -39
- package/src/hooks/settings/use-list-sessions.ts +0 -39
- package/src/hooks/settings/use-list-user-passkeys.ts +0 -39
- package/src/hooks/settings/use-revoke-multi-session.ts +0 -39
- package/src/hooks/settings/use-revoke-session.ts +0 -39
- package/src/hooks/settings/use-set-active-session.ts +0 -58
- package/src/hooks/settings/use-unlink-account.ts +0 -37
- package/src/hooks/settings/use-update-user.ts +0 -50
- package/src/lib/auth-config.ts +0 -48
- package/src/lib/auth-context.ts +0 -6
- package/src/mutations/auth/is-username-available-options.ts +0 -18
- package/src/mutations/auth/request-password-reset-options.ts +0 -14
- package/src/mutations/auth/reset-password-options.ts +0 -14
- package/src/mutations/auth/send-verification-email-options.ts +0 -14
- package/src/mutations/auth/sign-in-email-options.ts +0 -19
- package/src/mutations/auth/sign-in-magic-link-options.ts +0 -15
- package/src/mutations/auth/sign-in-passkey-options.ts +0 -15
- package/src/mutations/auth/sign-in-social-options.ts +0 -19
- package/src/mutations/auth/sign-in-username-options.ts +0 -15
- package/src/mutations/auth/sign-out-options.ts +0 -11
- package/src/mutations/auth/sign-up-email-options.ts +0 -15
- package/src/mutations/settings/add-passkey-options.ts +0 -15
- package/src/mutations/settings/change-email-options.ts +0 -11
- package/src/mutations/settings/change-password-options.ts +0 -14
- package/src/mutations/settings/delete-passkey-options.ts +0 -15
- package/src/mutations/settings/delete-user-options.ts +0 -11
- package/src/mutations/settings/link-social-options.ts +0 -11
- package/src/mutations/settings/revoke-multi-session-options.ts +0 -15
- package/src/mutations/settings/revoke-session-options.ts +0 -14
- package/src/mutations/settings/set-active-session-options.ts +0 -15
- package/src/mutations/settings/unlink-account-options.ts +0 -14
- package/src/mutations/settings/update-user-options.ts +0 -15
- package/src/queries/auth/session-options.ts +0 -18
- package/src/queries/settings/account-info-options.ts +0 -25
- package/src/queries/settings/list-accounts-options.ts +0 -26
- package/src/queries/settings/list-device-sessions-options.ts +0 -24
- package/src/queries/settings/list-sessions-options.ts +0 -23
- package/src/queries/settings/list-user-passkeys-options.ts +0 -23
- /package/dist/components/{email → auth/email}/email-changed.d.ts +0 -0
- /package/dist/components/{email → auth/email}/email-localization.d.ts +0 -0
- /package/dist/components/{email → auth/email}/email-styles.d.ts +0 -0
- /package/dist/components/{email → auth/email}/email-verification.d.ts +0 -0
- /package/dist/components/{email → auth/email}/index.d.ts +0 -0
- /package/dist/components/{email → auth/email}/index.js +0 -0
- /package/dist/components/{email → auth/email}/magic-link.d.ts +0 -0
- /package/dist/components/{email → auth/email}/new-device.d.ts +0 -0
- /package/dist/components/{email → auth/email}/otp-email.d.ts +0 -0
- /package/dist/components/{email → auth/email}/password-changed.d.ts +0 -0
- /package/dist/components/{email → auth/email}/reset-password.d.ts +0 -0
- /package/src/components/{email → auth/email}/email-localization.tsx +0 -0
- /package/src/components/{email → auth/email}/email-styles.tsx +0 -0
- /package/src/components/{email → auth/email}/index.ts +0 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { authQueryKeys } from "@better-auth-ui/core"
|
|
2
|
+
import {
|
|
3
|
+
type DataTag,
|
|
4
|
+
type QueryClient,
|
|
5
|
+
queryOptions
|
|
6
|
+
} from "@tanstack/react-query"
|
|
7
|
+
import type { APIError } from "better-auth"
|
|
8
|
+
|
|
9
|
+
import type { PasskeyAuthServer } from "../../../lib/auth-server"
|
|
10
|
+
|
|
11
|
+
export type ListPasskeysData<TAuth extends PasskeyAuthServer> = Awaited<
|
|
12
|
+
ReturnType<TAuth["api"]["listPasskeys"]>
|
|
13
|
+
>
|
|
14
|
+
|
|
15
|
+
export type ListPasskeysParams<TAuth extends PasskeyAuthServer> = Parameters<
|
|
16
|
+
TAuth["api"]["listPasskeys"]
|
|
17
|
+
>[0]
|
|
18
|
+
|
|
19
|
+
export type ListPasskey<TAuth extends PasskeyAuthServer = PasskeyAuthServer> =
|
|
20
|
+
NonNullable<ListPasskeysData<TAuth>>[number]
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Query options factory for the current user's passkeys.
|
|
24
|
+
*
|
|
25
|
+
* @param auth - The Better Auth server instance with the passkey plugin.
|
|
26
|
+
* @param userId - The signed-in user's ID. Used for cache partitioning so
|
|
27
|
+
* the key matches the client-side `listPasskeysOptions` for SSR hydration.
|
|
28
|
+
* @param params - Parameters forwarded to `auth.api.listPasskeys`.
|
|
29
|
+
*/
|
|
30
|
+
export function listPasskeysOptions<TAuth extends PasskeyAuthServer>(
|
|
31
|
+
auth: TAuth,
|
|
32
|
+
userId: string,
|
|
33
|
+
params: ListPasskeysParams<TAuth>
|
|
34
|
+
) {
|
|
35
|
+
type TData = ListPasskeysData<TAuth>
|
|
36
|
+
const queryKey = authQueryKeys.listPasskeys(userId, params?.query)
|
|
37
|
+
|
|
38
|
+
const options = queryOptions<TData, APIError, TData, typeof queryKey>({
|
|
39
|
+
queryKey,
|
|
40
|
+
queryFn: () => auth.api.listPasskeys(params) as Promise<TData>
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
return options as typeof options & {
|
|
44
|
+
queryKey: DataTag<typeof queryKey, TData, APIError>
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Get the current user's passkeys from the query cache, calling
|
|
50
|
+
* `fetchListPasskeys` under the hood if no cached entry exists. Resolves
|
|
51
|
+
* with the passkey list, making it suitable for reading directly in a server
|
|
52
|
+
* component.
|
|
53
|
+
*
|
|
54
|
+
* @param queryClient - The React Query client used for SSR hydration.
|
|
55
|
+
* @param auth - The Better Auth server instance with the passkey plugin.
|
|
56
|
+
* @param userId - The signed-in user's ID, used for cache partitioning.
|
|
57
|
+
* @param params - Parameters forwarded to `auth.api.listPasskeys`.
|
|
58
|
+
*/
|
|
59
|
+
export const ensureListPasskeys = <TAuth extends PasskeyAuthServer>(
|
|
60
|
+
queryClient: QueryClient,
|
|
61
|
+
auth: TAuth,
|
|
62
|
+
userId: string,
|
|
63
|
+
params: ListPasskeysParams<TAuth>
|
|
64
|
+
) => queryClient.ensureQueryData(listPasskeysOptions(auth, userId, params))
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Prefetch the current user's passkeys into the query cache. Behaves like
|
|
68
|
+
* `fetchListPasskeys`, but does not throw on error and does not return
|
|
69
|
+
* the data — use this when you only need the value to be available after
|
|
70
|
+
* hydration.
|
|
71
|
+
*
|
|
72
|
+
* @param queryClient - The React Query client used for SSR hydration.
|
|
73
|
+
* @param auth - The Better Auth server instance with the passkey plugin.
|
|
74
|
+
* @param userId - The signed-in user's ID, used for cache partitioning.
|
|
75
|
+
* @param params - Parameters forwarded to `auth.api.listPasskeys`.
|
|
76
|
+
*/
|
|
77
|
+
export const prefetchListPasskeys = <TAuth extends PasskeyAuthServer>(
|
|
78
|
+
queryClient: QueryClient,
|
|
79
|
+
auth: TAuth,
|
|
80
|
+
userId: string,
|
|
81
|
+
params: ListPasskeysParams<TAuth>
|
|
82
|
+
) => queryClient.prefetchQuery(listPasskeysOptions(auth, userId, params))
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Fetch and cache the current user's passkeys, resolving with the data or
|
|
86
|
+
* throwing on error. If a cached entry exists and is neither invalidated
|
|
87
|
+
* nor older than `staleTime`, the cached value is returned without a
|
|
88
|
+
* network call; otherwise the latest data is fetched.
|
|
89
|
+
*
|
|
90
|
+
* @param queryClient - The React Query client used for SSR hydration.
|
|
91
|
+
* @param auth - The Better Auth server instance with the passkey plugin.
|
|
92
|
+
* @param userId - The signed-in user's ID, used for cache partitioning.
|
|
93
|
+
* @param params - Parameters forwarded to `auth.api.listPasskeys`.
|
|
94
|
+
*/
|
|
95
|
+
export const fetchListPasskeys = <TAuth extends PasskeyAuthServer>(
|
|
96
|
+
queryClient: QueryClient,
|
|
97
|
+
auth: TAuth,
|
|
98
|
+
userId: string,
|
|
99
|
+
params: ListPasskeysParams<TAuth>
|
|
100
|
+
) => queryClient.fetchQuery(listPasskeysOptions(auth, userId, params))
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { authQueryKeys } from "@better-auth-ui/core"
|
|
2
|
+
import {
|
|
3
|
+
type DataTag,
|
|
4
|
+
type QueryClient,
|
|
5
|
+
queryOptions
|
|
6
|
+
} from "@tanstack/react-query"
|
|
7
|
+
import type { APIError } from "better-auth"
|
|
8
|
+
|
|
9
|
+
import type { AuthServer } from "../../../lib/auth-server"
|
|
10
|
+
|
|
11
|
+
export type AccountInfoData<TAuth extends AuthServer = AuthServer> = Awaited<
|
|
12
|
+
ReturnType<TAuth["api"]["accountInfo"]>
|
|
13
|
+
>
|
|
14
|
+
|
|
15
|
+
export type AccountInfoParams<TAuth extends AuthServer> = Parameters<
|
|
16
|
+
TAuth["api"]["accountInfo"]
|
|
17
|
+
>[0]
|
|
18
|
+
|
|
19
|
+
export type AccountInfo<TAuth extends AuthServer = AuthServer> = NonNullable<
|
|
20
|
+
AccountInfoData<TAuth>
|
|
21
|
+
>
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Query options factory for provider-specific account info.
|
|
25
|
+
*
|
|
26
|
+
* @param auth - The Better Auth server instance.
|
|
27
|
+
* @param userId - The signed-in user's ID. Used for cache partitioning so
|
|
28
|
+
* the key matches the client-side `accountInfoOptions` for SSR hydration.
|
|
29
|
+
* @param params - Parameters forwarded to `auth.api.accountInfo`.
|
|
30
|
+
*/
|
|
31
|
+
export function accountInfoOptions<TAuth extends AuthServer>(
|
|
32
|
+
auth: TAuth,
|
|
33
|
+
userId: string,
|
|
34
|
+
params: AccountInfoParams<TAuth>
|
|
35
|
+
) {
|
|
36
|
+
type TData = AccountInfoData<TAuth>
|
|
37
|
+
const queryKey = authQueryKeys.accountInfo(userId, params?.query)
|
|
38
|
+
|
|
39
|
+
const options = queryOptions<TData, APIError, TData, typeof queryKey>({
|
|
40
|
+
queryKey,
|
|
41
|
+
queryFn: () => auth.api.accountInfo(params) as Promise<TData>
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
return options as typeof options & {
|
|
45
|
+
queryKey: DataTag<typeof queryKey, TData, APIError>
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Get the current user's provider-specific account info from the query
|
|
51
|
+
* cache, calling `fetchAccountInfo` under the hood if no cached entry
|
|
52
|
+
* exists. Resolves with the data, making it suitable for reading directly
|
|
53
|
+
* in a server component.
|
|
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.accountInfo`.
|
|
59
|
+
*/
|
|
60
|
+
export const ensureAccountInfo = <TAuth extends AuthServer>(
|
|
61
|
+
queryClient: QueryClient,
|
|
62
|
+
auth: TAuth,
|
|
63
|
+
userId: string,
|
|
64
|
+
params: AccountInfoParams<TAuth>
|
|
65
|
+
) => queryClient.ensureQueryData(accountInfoOptions(auth, userId, params))
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Prefetch the current user's provider-specific account info into the query
|
|
69
|
+
* cache. Behaves like `fetchAccountInfo`, but does not throw on error and
|
|
70
|
+
* does not return the data — use this when you only need the value to be
|
|
71
|
+
* available after hydration.
|
|
72
|
+
*
|
|
73
|
+
* @param queryClient - The React Query client used for SSR hydration.
|
|
74
|
+
* @param auth - The Better Auth server instance.
|
|
75
|
+
* @param userId - The signed-in user's ID, used for cache partitioning.
|
|
76
|
+
* @param params - Parameters forwarded to `auth.api.accountInfo`.
|
|
77
|
+
*/
|
|
78
|
+
export const prefetchAccountInfo = <TAuth extends AuthServer>(
|
|
79
|
+
queryClient: QueryClient,
|
|
80
|
+
auth: TAuth,
|
|
81
|
+
userId: string,
|
|
82
|
+
params: AccountInfoParams<TAuth>
|
|
83
|
+
) => queryClient.prefetchQuery(accountInfoOptions(auth, userId, params))
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Fetch and cache the current user's provider-specific account info,
|
|
87
|
+
* resolving with the data or throwing on error. If a cached entry exists
|
|
88
|
+
* and is neither invalidated nor older than `staleTime`, the cached value
|
|
89
|
+
* is returned without a network call; otherwise the latest data is fetched.
|
|
90
|
+
*
|
|
91
|
+
* @param queryClient - The React Query client used for SSR hydration.
|
|
92
|
+
* @param auth - The Better Auth server instance.
|
|
93
|
+
* @param userId - The signed-in user's ID, used for cache partitioning.
|
|
94
|
+
* @param params - Parameters forwarded to `auth.api.accountInfo`.
|
|
95
|
+
*/
|
|
96
|
+
export const fetchAccountInfo = <TAuth extends AuthServer>(
|
|
97
|
+
queryClient: QueryClient,
|
|
98
|
+
auth: TAuth,
|
|
99
|
+
userId: string,
|
|
100
|
+
params: AccountInfoParams<TAuth>
|
|
101
|
+
) => queryClient.fetchQuery(accountInfoOptions(auth, userId, params))
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { authQueryKeys } from "@better-auth-ui/core"
|
|
2
|
+
import {
|
|
3
|
+
type DataTag,
|
|
4
|
+
type QueryClient,
|
|
5
|
+
queryOptions
|
|
6
|
+
} from "@tanstack/react-query"
|
|
7
|
+
import type { APIError } from "better-auth"
|
|
8
|
+
|
|
9
|
+
import type { AuthServer } from "../../../lib/auth-server"
|
|
10
|
+
|
|
11
|
+
export type ListAccountsData<TAuth extends AuthServer = AuthServer> = Awaited<
|
|
12
|
+
ReturnType<TAuth["api"]["listUserAccounts"]>
|
|
13
|
+
>
|
|
14
|
+
|
|
15
|
+
export type ListAccountsParams<TAuth extends AuthServer> = Parameters<
|
|
16
|
+
TAuth["api"]["listUserAccounts"]
|
|
17
|
+
>[0]
|
|
18
|
+
|
|
19
|
+
export type ListAccount<TAuth extends AuthServer = AuthServer> = NonNullable<
|
|
20
|
+
ListAccountsData<TAuth>
|
|
21
|
+
>[number]
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Query options factory for the current user's linked social accounts.
|
|
25
|
+
*
|
|
26
|
+
* @param auth - The Better Auth server instance.
|
|
27
|
+
* @param userId - The signed-in user's ID. Used for cache partitioning so
|
|
28
|
+
* the key matches the client-side `listAccountsOptions` for SSR hydration.
|
|
29
|
+
* @param params - Parameters forwarded to `auth.api.listUserAccounts`.
|
|
30
|
+
*/
|
|
31
|
+
export function listAccountsOptions<TAuth extends AuthServer>(
|
|
32
|
+
auth: TAuth,
|
|
33
|
+
userId: string,
|
|
34
|
+
params: ListAccountsParams<TAuth>
|
|
35
|
+
) {
|
|
36
|
+
type TData = ListAccountsData<TAuth>
|
|
37
|
+
const queryKey = authQueryKeys.listAccounts(userId, params?.query)
|
|
38
|
+
|
|
39
|
+
const options = queryOptions<TData, APIError, TData, typeof queryKey>({
|
|
40
|
+
queryKey,
|
|
41
|
+
queryFn: () => auth.api.listUserAccounts(params) as Promise<TData>
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
return options as typeof options & {
|
|
45
|
+
queryKey: DataTag<typeof queryKey, TData, APIError>
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Get the current user's linked social accounts from the query cache,
|
|
51
|
+
* calling `fetchListAccounts` under the hood if no cached entry exists.
|
|
52
|
+
* Resolves with the account list, making it suitable for reading directly
|
|
53
|
+
* in a server component.
|
|
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 const ensureListAccounts = <TAuth extends AuthServer>(
|
|
61
|
+
queryClient: QueryClient,
|
|
62
|
+
auth: TAuth,
|
|
63
|
+
userId: string,
|
|
64
|
+
params: ListAccountsParams<TAuth>
|
|
65
|
+
) => queryClient.ensureQueryData(listAccountsOptions(auth, userId, params))
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Prefetch the current user's linked social accounts into the query cache.
|
|
69
|
+
* Behaves like `fetchListAccounts`, but does not throw on error and does
|
|
70
|
+
* not return the data — use this when you only need the value to be
|
|
71
|
+
* available after hydration.
|
|
72
|
+
*
|
|
73
|
+
* @param queryClient - The React Query client used for SSR hydration.
|
|
74
|
+
* @param auth - The Better Auth server instance.
|
|
75
|
+
* @param userId - The signed-in user's ID, used for cache partitioning.
|
|
76
|
+
* @param params - Parameters forwarded to `auth.api.listUserAccounts`.
|
|
77
|
+
*/
|
|
78
|
+
export const prefetchListAccounts = <TAuth extends AuthServer>(
|
|
79
|
+
queryClient: QueryClient,
|
|
80
|
+
auth: TAuth,
|
|
81
|
+
userId: string,
|
|
82
|
+
params: ListAccountsParams<TAuth>
|
|
83
|
+
) => queryClient.prefetchQuery(listAccountsOptions(auth, userId, params))
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Fetch and cache the current user's linked social accounts, resolving
|
|
87
|
+
* with the data or throwing on error. If a cached entry exists and is
|
|
88
|
+
* neither invalidated nor older than `staleTime`, the cached value is
|
|
89
|
+
* returned without a network call; otherwise the latest data is fetched.
|
|
90
|
+
*
|
|
91
|
+
* @param queryClient - The React Query client used for SSR hydration.
|
|
92
|
+
* @param auth - The Better Auth server instance.
|
|
93
|
+
* @param userId - The signed-in user's ID, used for cache partitioning.
|
|
94
|
+
* @param params - Parameters forwarded to `auth.api.listUserAccounts`.
|
|
95
|
+
*/
|
|
96
|
+
export const fetchListAccounts = <TAuth extends AuthServer>(
|
|
97
|
+
queryClient: QueryClient,
|
|
98
|
+
auth: TAuth,
|
|
99
|
+
userId: string,
|
|
100
|
+
params: ListAccountsParams<TAuth>
|
|
101
|
+
) => queryClient.fetchQuery(listAccountsOptions(auth, userId, params))
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { authQueryKeys } from "@better-auth-ui/core"
|
|
2
|
+
import {
|
|
3
|
+
type DataTag,
|
|
4
|
+
type QueryClient,
|
|
5
|
+
queryOptions
|
|
6
|
+
} from "@tanstack/react-query"
|
|
7
|
+
import type { APIError } from "better-auth"
|
|
8
|
+
|
|
9
|
+
import type { AuthServer } from "../../../lib/auth-server"
|
|
10
|
+
|
|
11
|
+
export type ListSessionsData<TAuth extends AuthServer = AuthServer> = Awaited<
|
|
12
|
+
ReturnType<TAuth["api"]["listSessions"]>
|
|
13
|
+
>
|
|
14
|
+
|
|
15
|
+
export type ListSessionsParams<TAuth extends AuthServer> = Parameters<
|
|
16
|
+
TAuth["api"]["listSessions"]
|
|
17
|
+
>[0]
|
|
18
|
+
|
|
19
|
+
export type ListSession<TAuth extends AuthServer = AuthServer> = NonNullable<
|
|
20
|
+
ListSessionsData<TAuth>
|
|
21
|
+
>[number]
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Query options factory for the current user's active sessions.
|
|
25
|
+
*
|
|
26
|
+
* @param auth - The Better Auth server instance.
|
|
27
|
+
* @param userId - The signed-in user's ID. Used for cache partitioning so
|
|
28
|
+
* the key matches the client-side `listSessionsOptions` for SSR hydration.
|
|
29
|
+
* @param params - Parameters forwarded to `auth.api.listSessions`.
|
|
30
|
+
*/
|
|
31
|
+
export function listSessionsOptions<TAuth extends AuthServer>(
|
|
32
|
+
auth: TAuth,
|
|
33
|
+
userId: string,
|
|
34
|
+
params: ListSessionsParams<TAuth>
|
|
35
|
+
) {
|
|
36
|
+
type TData = ListSessionsData<TAuth>
|
|
37
|
+
const queryKey = authQueryKeys.listSessions(userId, params?.query)
|
|
38
|
+
|
|
39
|
+
const options = queryOptions<TData, APIError, TData, typeof queryKey>({
|
|
40
|
+
queryKey,
|
|
41
|
+
queryFn: () => auth.api.listSessions(params) as Promise<TData>
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
return options as typeof options & {
|
|
45
|
+
queryKey: DataTag<typeof queryKey, TData, APIError>
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Get the current user's active sessions from the query cache, calling
|
|
51
|
+
* `fetchListSessions` under the hood if no cached entry exists. Resolves
|
|
52
|
+
* with the session list, making it suitable for reading directly in a server
|
|
53
|
+
* component.
|
|
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 const ensureListSessions = <TAuth extends AuthServer>(
|
|
61
|
+
queryClient: QueryClient,
|
|
62
|
+
auth: TAuth,
|
|
63
|
+
userId: string,
|
|
64
|
+
params: ListSessionsParams<TAuth>
|
|
65
|
+
) => queryClient.ensureQueryData(listSessionsOptions(auth, userId, params))
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Prefetch the current user's active sessions into the query cache. Behaves
|
|
69
|
+
* like `fetchListSessions`, but does not throw on error and does not return
|
|
70
|
+
* the data — use this when you only need the value to be available after
|
|
71
|
+
* hydration.
|
|
72
|
+
*
|
|
73
|
+
* @param queryClient - The React Query client used for SSR hydration.
|
|
74
|
+
* @param auth - The Better Auth server instance.
|
|
75
|
+
* @param userId - The signed-in user's ID, used for cache partitioning.
|
|
76
|
+
* @param params - Parameters forwarded to `auth.api.listSessions`.
|
|
77
|
+
*/
|
|
78
|
+
export const prefetchListSessions = <TAuth extends AuthServer>(
|
|
79
|
+
queryClient: QueryClient,
|
|
80
|
+
auth: TAuth,
|
|
81
|
+
userId: string,
|
|
82
|
+
params: ListSessionsParams<TAuth>
|
|
83
|
+
) => queryClient.prefetchQuery(listSessionsOptions(auth, userId, params))
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Fetch and cache the current user's active sessions, resolving with the
|
|
87
|
+
* data or throwing on error. If a cached entry exists and is neither
|
|
88
|
+
* invalidated nor older than `staleTime`, the cached value is returned
|
|
89
|
+
* without a network call; otherwise the latest data is fetched.
|
|
90
|
+
*
|
|
91
|
+
* @param queryClient - The React Query client used for SSR hydration.
|
|
92
|
+
* @param auth - The Better Auth server instance.
|
|
93
|
+
* @param userId - The signed-in user's ID, used for cache partitioning.
|
|
94
|
+
* @param params - Parameters forwarded to `auth.api.listSessions`.
|
|
95
|
+
*/
|
|
96
|
+
export const fetchListSessions = <TAuth extends AuthServer>(
|
|
97
|
+
queryClient: QueryClient,
|
|
98
|
+
auth: TAuth,
|
|
99
|
+
userId: string,
|
|
100
|
+
params: ListSessionsParams<TAuth>
|
|
101
|
+
) => queryClient.fetchQuery(listSessionsOptions(auth, userId, params))
|
package/src/server.ts
ADDED
|
@@ -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/core.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '@better-auth-ui/core';
|
package/dist/core.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "@better-auth-ui/core";
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { AuthClient } from '../../lib/auth-client';
|
|
2
|
-
import { isUsernameAvailableOptions } from '../../mutations/auth/is-username-available-options';
|
|
3
|
-
export type UseIsUsernameAvailableParams = NonNullable<Parameters<AuthClient["isUsernameAvailable"]>[0]>;
|
|
4
|
-
export type UseIsUsernameAvailableOptions = Omit<ReturnType<typeof isUsernameAvailableOptions>, "mutationKey" | "mutationFn">;
|
|
5
|
-
/**
|
|
6
|
-
* Hook that creates a mutation to check if a username is available.
|
|
7
|
-
*
|
|
8
|
-
* @param options - React Query options forwarded to `useMutation`.
|
|
9
|
-
* @returns The `useMutation` result where data contains `{ available: boolean }`.
|
|
10
|
-
*/
|
|
11
|
-
export declare function useIsUsernameAvailable(options?: UseIsUsernameAvailableOptions): import('@tanstack/react-query').UseMutationResult<{
|
|
12
|
-
available: boolean;
|
|
13
|
-
message: string | null;
|
|
14
|
-
}, import('better-auth/client').BetterFetchError, import('better-auth').Prettify<{
|
|
15
|
-
username: string;
|
|
16
|
-
} & {
|
|
17
|
-
fetchOptions?: import('better-auth').ClientFetchOption<Partial<{
|
|
18
|
-
username: string;
|
|
19
|
-
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined> | undefined;
|
|
20
|
-
}>, unknown>;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { useAuth as e } from "../../components/auth/auth-provider.js";
|
|
2
|
-
import { isUsernameAvailableOptions as t } from "../../mutations/auth/is-username-available-options.js";
|
|
3
|
-
import { useMutation as n } from "@tanstack/react-query";
|
|
4
|
-
//#region src/hooks/auth/use-is-username-available.ts
|
|
5
|
-
function r(r) {
|
|
6
|
-
let { authClient: i } = e();
|
|
7
|
-
return n({
|
|
8
|
-
...t(i),
|
|
9
|
-
...r
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
//#endregion
|
|
13
|
-
export { r as useIsUsernameAvailable };
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { AuthClient } from '../../lib/auth-client';
|
|
2
|
-
import { requestPasswordResetOptions } from '../../mutations/auth/request-password-reset-options';
|
|
3
|
-
export type UseRequestPasswordResetParams = NonNullable<Parameters<AuthClient["requestPasswordReset"]>[0]>;
|
|
4
|
-
export type UseRequestPasswordResetOptions = Omit<ReturnType<typeof requestPasswordResetOptions>, "mutationKey" | "mutationFn">;
|
|
5
|
-
/**
|
|
6
|
-
* Hook that creates a mutation for the forgot-password flow.
|
|
7
|
-
*
|
|
8
|
-
* Sends a password reset email for the provided address.
|
|
9
|
-
*
|
|
10
|
-
* @param options - React Query options forwarded to `useMutation`.
|
|
11
|
-
* @returns The `useMutation` result.
|
|
12
|
-
*/
|
|
13
|
-
export declare function useRequestPasswordReset(options?: UseRequestPasswordResetOptions): import('@tanstack/react-query').UseMutationResult<never, import('better-auth/client').BetterFetchError, import('better-auth').Prettify<{
|
|
14
|
-
email: string;
|
|
15
|
-
redirectTo?: string | undefined;
|
|
16
|
-
} & {
|
|
17
|
-
fetchOptions?: import('better-auth').ClientFetchOption<Partial<{
|
|
18
|
-
email: string;
|
|
19
|
-
redirectTo?: string | undefined;
|
|
20
|
-
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined> | undefined;
|
|
21
|
-
}>, unknown>;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { useAuth as e } from "../../components/auth/auth-provider.js";
|
|
2
|
-
import { requestPasswordResetOptions as t } from "../../mutations/auth/request-password-reset-options.js";
|
|
3
|
-
import { useMutation as n } from "@tanstack/react-query";
|
|
4
|
-
//#region src/hooks/auth/use-request-password-reset.ts
|
|
5
|
-
function r(r) {
|
|
6
|
-
let { authClient: i } = e();
|
|
7
|
-
return n({
|
|
8
|
-
...t(i),
|
|
9
|
-
...r
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
//#endregion
|
|
13
|
-
export { r as useRequestPasswordReset };
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { AuthClient } from '../../lib/auth-client';
|
|
2
|
-
import { resetPasswordOptions } from '../../mutations/auth/reset-password-options';
|
|
3
|
-
export type UseResetPasswordParams = NonNullable<Parameters<AuthClient["resetPassword"]>[0]>;
|
|
4
|
-
export type UseResetPasswordOptions = Omit<ReturnType<typeof resetPasswordOptions>, "mutationKey" | "mutationFn">;
|
|
5
|
-
/**
|
|
6
|
-
* Hook that creates a mutation for the reset-password flow.
|
|
7
|
-
*
|
|
8
|
-
* Resets the user's password using the provided token and new password.
|
|
9
|
-
*
|
|
10
|
-
* @param options - React Query options forwarded to `useMutation`.
|
|
11
|
-
* @returns The `useMutation` result.
|
|
12
|
-
*/
|
|
13
|
-
export declare function useResetPassword(options?: UseResetPasswordOptions): import('@tanstack/react-query').UseMutationResult<never, import('better-auth/client').BetterFetchError, import('better-auth').Prettify<{
|
|
14
|
-
newPassword: string;
|
|
15
|
-
token?: string | undefined;
|
|
16
|
-
} & {
|
|
17
|
-
fetchOptions?: import('better-auth').ClientFetchOption<Partial<{
|
|
18
|
-
newPassword: string;
|
|
19
|
-
token?: string | undefined;
|
|
20
|
-
}> & Record<string, any>, Partial<{
|
|
21
|
-
token?: string | undefined;
|
|
22
|
-
}> & Record<string, any>, Record<string, any> | undefined> | undefined;
|
|
23
|
-
}>, unknown>;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { useAuth as e } from "../../components/auth/auth-provider.js";
|
|
2
|
-
import { resetPasswordOptions as t } from "../../mutations/auth/reset-password-options.js";
|
|
3
|
-
import { useMutation as n } from "@tanstack/react-query";
|
|
4
|
-
//#region src/hooks/auth/use-reset-password.ts
|
|
5
|
-
function r(r) {
|
|
6
|
-
let { authClient: i } = e();
|
|
7
|
-
return n({
|
|
8
|
-
...t(i),
|
|
9
|
-
...r
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
//#endregion
|
|
13
|
-
export { r as useResetPassword };
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { AuthClient } from '../../lib/auth-client';
|
|
2
|
-
import { sendVerificationEmailOptions } from '../../mutations/auth/send-verification-email-options';
|
|
3
|
-
export type UseSendVerificationEmailParams = NonNullable<Parameters<AuthClient["sendVerificationEmail"]>[0]>;
|
|
4
|
-
export type UseSendVerificationEmailOptions = Omit<ReturnType<typeof sendVerificationEmailOptions>, "mutationKey" | "mutationFn">;
|
|
5
|
-
/**
|
|
6
|
-
* Hook that creates a mutation to send a verification email.
|
|
7
|
-
*
|
|
8
|
-
* @param options - React Query options forwarded to `useMutation`.
|
|
9
|
-
* @returns The `useMutation` result.
|
|
10
|
-
*/
|
|
11
|
-
export declare function useSendVerificationEmail(options?: UseSendVerificationEmailOptions): import('@tanstack/react-query').UseMutationResult<never, import('better-auth/client').BetterFetchError, import('better-auth').Prettify<{
|
|
12
|
-
email: string;
|
|
13
|
-
callbackURL?: string | undefined;
|
|
14
|
-
} & {
|
|
15
|
-
fetchOptions?: import('better-auth').ClientFetchOption<Partial<{
|
|
16
|
-
email: string;
|
|
17
|
-
callbackURL?: string | undefined;
|
|
18
|
-
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined> | undefined;
|
|
19
|
-
}>, unknown>;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { useAuth as e } from "../../components/auth/auth-provider.js";
|
|
2
|
-
import { sendVerificationEmailOptions as t } from "../../mutations/auth/send-verification-email-options.js";
|
|
3
|
-
import { useMutation as n } from "@tanstack/react-query";
|
|
4
|
-
//#region src/hooks/auth/use-send-verification-email.ts
|
|
5
|
-
function r(r) {
|
|
6
|
-
let { authClient: i } = e();
|
|
7
|
-
return n({
|
|
8
|
-
...t(i),
|
|
9
|
-
...r
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
//#endregion
|
|
13
|
-
export { r as useSendVerificationEmail };
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { AuthClient } from '../../lib/auth-client';
|
|
2
|
-
import { sessionOptions } from '../../queries/auth/session-options';
|
|
3
|
-
export type UseSessionParams = NonNullable<Parameters<AuthClient["getSession"]>[0]>;
|
|
4
|
-
export type UseSessionOptions = Omit<ReturnType<typeof sessionOptions>, "queryKey" | "queryFn"> & UseSessionParams;
|
|
5
|
-
/**
|
|
6
|
-
* Retrieve the current authentication session.
|
|
7
|
-
*
|
|
8
|
-
* @param options - Better Auth params (`query`, `fetchOptions`) and React
|
|
9
|
-
* Query options forwarded to `useQuery`.
|
|
10
|
-
* @returns React Query result for the session.
|
|
11
|
-
*/
|
|
12
|
-
export declare function useSession(options?: UseSessionOptions): import('@tanstack/react-query').UseQueryResult<{
|
|
13
|
-
user: import('better-auth').StripEmptyObjects<{
|
|
14
|
-
id: string;
|
|
15
|
-
createdAt: Date;
|
|
16
|
-
updatedAt: Date;
|
|
17
|
-
email: string;
|
|
18
|
-
emailVerified: boolean;
|
|
19
|
-
name: string;
|
|
20
|
-
image?: string | null | undefined;
|
|
21
|
-
} & {} & {
|
|
22
|
-
username?: string | null | undefined;
|
|
23
|
-
displayUsername?: string | null | undefined;
|
|
24
|
-
}>;
|
|
25
|
-
session: import('better-auth').StripEmptyObjects<{
|
|
26
|
-
id: string;
|
|
27
|
-
createdAt: Date;
|
|
28
|
-
updatedAt: Date;
|
|
29
|
-
userId: string;
|
|
30
|
-
expiresAt: Date;
|
|
31
|
-
token: string;
|
|
32
|
-
ipAddress?: string | null | undefined;
|
|
33
|
-
userAgent?: string | null | undefined;
|
|
34
|
-
}>;
|
|
35
|
-
} | null, import('better-auth/client').BetterFetchError>;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { useAuth as e } from "../../components/auth/auth-provider.js";
|
|
2
|
-
import { sessionOptions as t } from "../../queries/auth/session-options.js";
|
|
3
|
-
import { useQuery as n } from "@tanstack/react-query";
|
|
4
|
-
//#region src/hooks/auth/use-session.ts
|
|
5
|
-
function r(r) {
|
|
6
|
-
let { authClient: i } = e(), { query: a, fetchOptions: o, ...s } = r ?? {};
|
|
7
|
-
return n({
|
|
8
|
-
...t(i, {
|
|
9
|
-
query: a,
|
|
10
|
-
fetchOptions: o
|
|
11
|
-
}),
|
|
12
|
-
...s
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
//#endregion
|
|
16
|
-
export { r as useSession };
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { AuthClient } from '../../lib/auth-client';
|
|
2
|
-
import { signInEmailOptions } from '../../mutations/auth/sign-in-email-options';
|
|
3
|
-
export type UseSignInEmailParams = NonNullable<Parameters<AuthClient["signIn"]["email"]>[0]>;
|
|
4
|
-
export type UseSignInEmailOptions = Omit<ReturnType<typeof signInEmailOptions>, "mutationKey" | "mutationFn">;
|
|
5
|
-
/**
|
|
6
|
-
* Hook that creates a mutation for email/password sign-in.
|
|
7
|
-
*
|
|
8
|
-
* The mutation sends an email/password sign-in request and
|
|
9
|
-
* refetches the session on completion.
|
|
10
|
-
*
|
|
11
|
-
* @param options - React Query options forwarded to `useMutation`.
|
|
12
|
-
* @returns The `useMutation` result.
|
|
13
|
-
*/
|
|
14
|
-
export declare function useSignInEmail(options?: UseSignInEmailOptions): import('@tanstack/react-query').UseMutationResult<never, import('better-auth/client').BetterFetchError, import('better-auth').Prettify<{
|
|
15
|
-
email: string;
|
|
16
|
-
password: string;
|
|
17
|
-
callbackURL?: string | undefined;
|
|
18
|
-
rememberMe?: boolean | undefined;
|
|
19
|
-
} & {
|
|
20
|
-
fetchOptions?: import('better-auth').ClientFetchOption<Partial<{
|
|
21
|
-
email: string;
|
|
22
|
-
password: string;
|
|
23
|
-
callbackURL?: string | undefined;
|
|
24
|
-
rememberMe?: boolean | undefined;
|
|
25
|
-
}> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined> | undefined;
|
|
26
|
-
}>, unknown>;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { useAuth as e } from "../../components/auth/auth-provider.js";
|
|
2
|
-
import { sessionOptions as t } from "../../queries/auth/session-options.js";
|
|
3
|
-
import { signInEmailOptions as n } from "../../mutations/auth/sign-in-email-options.js";
|
|
4
|
-
import { useMutation as r, useQueryClient as i } from "@tanstack/react-query";
|
|
5
|
-
//#region src/hooks/auth/use-sign-in-email.ts
|
|
6
|
-
function a(a) {
|
|
7
|
-
let { authClient: o } = e(), s = i();
|
|
8
|
-
return r({
|
|
9
|
-
...n(o),
|
|
10
|
-
...a,
|
|
11
|
-
onSuccess: async (...e) => {
|
|
12
|
-
s.resetQueries({ queryKey: t(o).queryKey }), await a?.onSuccess?.(...e);
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
//#endregion
|
|
17
|
-
export { a as useSignInEmail };
|