better-auth 1.7.20 → 1.7.22
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/_virtual/_rolldown/runtime.mjs +1 -2
- package/dist/adapters/index.d.mts +0 -2
- package/dist/adapters/index.mjs +1 -2
- package/dist/api/dispatch.d.mts +1 -3
- package/dist/api/dispatch.mjs +1 -2
- package/dist/api/index.d.mts +5 -4
- package/dist/api/index.mjs +9 -9
- package/dist/api/middlewares/authorization.d.mts +1 -3
- package/dist/api/middlewares/authorization.mjs +1 -2
- package/dist/api/middlewares/origin-check.d.mts +1 -3
- package/dist/api/middlewares/origin-check.mjs +2 -3
- package/dist/api/rate-limiter/index.mjs +1 -2
- package/dist/api/routes/account.d.mts +1 -3
- package/dist/api/routes/account.mjs +10 -10
- package/dist/api/routes/callback.d.mts +1 -3
- package/dist/api/routes/callback.mjs +5 -6
- package/dist/api/routes/email-verification.d.mts +1 -3
- package/dist/api/routes/email-verification.mjs +4 -5
- package/dist/api/routes/error.d.mts +1 -3
- package/dist/api/routes/error.mjs +1 -2
- package/dist/api/routes/ok.d.mts +1 -3
- package/dist/api/routes/ok.mjs +1 -2
- package/dist/api/routes/password.d.mts +1 -3
- package/dist/api/routes/password.mjs +3 -4
- package/dist/api/routes/session.d.mts +2 -3
- package/dist/api/routes/session.mjs +10 -6
- package/dist/api/routes/sign-in.d.mts +0 -2
- package/dist/api/routes/sign-in.mjs +6 -7
- package/dist/api/routes/sign-out.d.mts +1 -3
- package/dist/api/routes/sign-out.mjs +1 -2
- package/dist/api/routes/sign-up.d.mts +1 -3
- package/dist/api/routes/sign-up.mjs +26 -16
- package/dist/api/routes/update-session.d.mts +1 -3
- package/dist/api/routes/update-session.mjs +2 -3
- package/dist/api/routes/update-user.d.mts +1 -3
- package/dist/api/routes/update-user.mjs +31 -28
- package/dist/api/state/oauth.d.mts +0 -2
- package/dist/api/state/oauth.mjs +1 -2
- package/dist/api/state/session-source.d.mts +1 -3
- package/dist/api/state/session-source.mjs +1 -2
- package/dist/api/state/should-session-refresh.d.mts +0 -2
- package/dist/api/state/should-session-refresh.mjs +1 -2
- package/dist/api/to-auth-endpoints.mjs +2 -3
- package/dist/auth/base.mjs +3 -9
- package/dist/auth/full.d.mts +1 -3
- package/dist/auth/full.mjs +1 -2
- package/dist/auth/minimal.d.mts +0 -2
- package/dist/auth/minimal.mjs +2 -3
- package/dist/auth/trusted-origins.mjs +2 -3
- package/dist/client/broadcast-channel.d.mts +1 -3
- package/dist/client/broadcast-channel.mjs +4 -4
- package/dist/client/config.d.mts +1 -3
- package/dist/client/config.mjs +2 -3
- package/dist/client/equality.d.mts +1 -3
- package/dist/client/equality.mjs +1 -2
- package/dist/client/fetch-plugins.mjs +1 -2
- package/dist/client/focus-manager.d.mts +1 -3
- package/dist/client/focus-manager.mjs +4 -4
- package/dist/client/index.d.mts +5 -7
- package/dist/client/index.mjs +1 -2
- package/dist/client/lynx/index.d.mts +1 -3
- package/dist/client/lynx/index.mjs +1 -2
- package/dist/client/lynx/lynx-store.d.mts +0 -2
- package/dist/client/lynx/lynx-store.mjs +1 -2
- package/dist/client/online-manager.d.mts +1 -3
- package/dist/client/online-manager.mjs +7 -7
- package/dist/client/parser.d.mts +0 -2
- package/dist/client/parser.mjs +1 -2
- package/dist/client/path-to-object.d.mts +0 -2
- package/dist/client/plugins/index.d.mts +6 -6
- package/dist/client/plugins/infer-plugin.d.mts +1 -3
- package/dist/client/plugins/infer-plugin.mjs +1 -2
- package/dist/client/proxy.mjs +1 -2
- package/dist/client/query-atom.mjs +1 -2
- package/dist/client/query.d.mts +1 -3
- package/dist/client/query.mjs +1 -2
- package/dist/client/react/index.d.mts +1 -3
- package/dist/client/react/index.mjs +1 -2
- package/dist/client/react/react-store.d.mts +0 -2
- package/dist/client/react/react-store.mjs +1 -2
- package/dist/client/session-atom.d.mts +1 -3
- package/dist/client/session-atom.mjs +2 -2
- package/dist/client/session-refresh.d.mts +1 -3
- package/dist/client/session-refresh.mjs +3 -3
- package/dist/client/solid/index.d.mts +1 -3
- package/dist/client/solid/index.mjs +1 -2
- package/dist/client/solid/solid-store.mjs +1 -2
- package/dist/client/svelte/index.d.mts +1 -3
- package/dist/client/svelte/index.mjs +1 -2
- package/dist/client/types.d.mts +2 -4
- package/dist/client/vanilla.d.mts +1 -3
- package/dist/client/vanilla.mjs +1 -2
- package/dist/client/vue/index.d.mts +1 -3
- package/dist/client/vue/index.mjs +1 -2
- package/dist/client/vue/vue-store.mjs +1 -2
- package/dist/context/create-context.mjs +8 -9
- package/dist/context/helpers.mjs +3 -4
- package/dist/context/init-minimal.mjs +1 -2
- package/dist/context/init.mjs +1 -2
- package/dist/context/secret-utils.mjs +1 -2
- package/dist/context/store-capabilities.mjs +1 -2
- package/dist/cookies/cache.mjs +1 -2
- package/dist/cookies/cookie-utils.d.mts +0 -2
- package/dist/cookies/cookie-utils.mjs +1 -2
- package/dist/cookies/index.d.mts +0 -2
- package/dist/cookies/index.mjs +2 -3
- package/dist/cookies/jwt.mjs +1 -2
- package/dist/cookies/session-store.d.mts +0 -2
- package/dist/cookies/session-store.mjs +1 -2
- package/dist/crypto/buffer.d.mts +1 -3
- package/dist/crypto/buffer.mjs +1 -2
- package/dist/crypto/index.d.mts +0 -2
- package/dist/crypto/index.mjs +2 -3
- package/dist/crypto/jwt.d.mts +1 -3
- package/dist/crypto/jwt.mjs +1 -2
- package/dist/crypto/password.d.mts +0 -2
- package/dist/crypto/password.mjs +1 -2
- package/dist/crypto/purpose.mjs +1 -2
- package/dist/crypto/random.d.mts +1 -3
- package/dist/crypto/random.mjs +1 -2
- package/dist/db/adapter-base.d.mts +1 -3
- package/dist/db/adapter-base.mjs +1 -2
- package/dist/db/adapter-kysely.d.mts +1 -3
- package/dist/db/adapter-kysely.mjs +1 -2
- package/dist/db/field-converter.d.mts +1 -3
- package/dist/db/field-converter.mjs +1 -2
- package/dist/db/field.d.mts +0 -2
- package/dist/db/get-migration.d.mts +1 -3
- package/dist/db/get-migration.mjs +10 -13
- package/dist/db/get-schema.d.mts +1 -3
- package/dist/db/get-schema.mjs +1 -2
- package/dist/db/index.d.mts +1 -1
- package/dist/db/index.mjs +4 -5
- package/dist/db/internal-adapter.d.mts +1 -3
- package/dist/db/internal-adapter.mjs +25 -11
- package/dist/db/revoke-unproven-account-access.d.mts +1 -3
- package/dist/db/revoke-unproven-account-access.mjs +1 -2
- package/dist/db/schema.d.mts +1 -3
- package/dist/db/schema.mjs +1 -2
- package/dist/db/to-zod.d.mts +0 -2
- package/dist/db/to-zod.mjs +1 -2
- package/dist/db/verification-token-storage.mjs +1 -2
- package/dist/db/with-hooks.d.mts +1 -3
- package/dist/db/with-hooks.mjs +1 -2
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/integrations/cookie-plugin-guard.mjs +1 -2
- package/dist/integrations/next-js.d.mts +1 -3
- package/dist/integrations/next-js.mjs +2 -3
- package/dist/integrations/node.d.mts +1 -3
- package/dist/integrations/node.mjs +1 -2
- package/dist/integrations/solid-start.d.mts +1 -3
- package/dist/integrations/solid-start.mjs +1 -2
- package/dist/integrations/svelte-kit.d.mts +1 -3
- package/dist/integrations/svelte-kit.mjs +1 -2
- package/dist/integrations/tanstack-start-solid.d.mts +1 -3
- package/dist/integrations/tanstack-start-solid.mjs +1 -2
- package/dist/integrations/tanstack-start.d.mts +1 -3
- package/dist/integrations/tanstack-start.mjs +1 -2
- package/dist/oauth2/account-key.mjs +1 -2
- package/dist/oauth2/callback.mjs +1 -2
- package/dist/oauth2/errors.mjs +1 -2
- package/dist/oauth2/index.d.mts +1 -1
- package/dist/oauth2/index.mjs +1 -1
- package/dist/oauth2/link-account.d.mts +1 -3
- package/dist/oauth2/link-account.mjs +18 -13
- package/dist/oauth2/state.d.mts +1 -3
- package/dist/oauth2/state.mjs +3 -4
- package/dist/oauth2/utils.d.mts +1 -3
- package/dist/oauth2/utils.mjs +1 -2
- package/dist/package.mjs +2 -3
- package/dist/plugins/access/access.d.mts +1 -3
- package/dist/plugins/access/access.mjs +1 -2
- package/dist/plugins/access/index.d.mts +1 -1
- package/dist/plugins/access/types.d.mts +1 -3
- package/dist/plugins/additional-fields/client.d.mts +1 -3
- package/dist/plugins/additional-fields/client.mjs +1 -2
- package/dist/plugins/admin/access/statement.d.mts +1 -3
- package/dist/plugins/admin/access/statement.mjs +1 -2
- package/dist/plugins/admin/admin.d.mts +1 -3
- package/dist/plugins/admin/admin.mjs +2 -3
- package/dist/plugins/admin/client.d.mts +2 -4
- package/dist/plugins/admin/client.mjs +1 -2
- package/dist/plugins/admin/error-codes.d.mts +1 -3
- package/dist/plugins/admin/error-codes.mjs +1 -2
- package/dist/plugins/admin/has-permission.mjs +1 -2
- package/dist/plugins/admin/index.d.mts +1 -1
- package/dist/plugins/admin/routes.mjs +3 -4
- package/dist/plugins/admin/schema.d.mts +1 -3
- package/dist/plugins/admin/schema.mjs +1 -2
- package/dist/plugins/admin/types.d.mts +1 -3
- package/dist/plugins/anonymous/client.d.mts +1 -3
- package/dist/plugins/anonymous/client.mjs +1 -2
- package/dist/plugins/anonymous/error-codes.d.mts +1 -3
- package/dist/plugins/anonymous/error-codes.mjs +1 -2
- package/dist/plugins/anonymous/index.d.mts +0 -2
- package/dist/plugins/anonymous/index.mjs +3 -4
- package/dist/plugins/anonymous/schema.d.mts +1 -3
- package/dist/plugins/anonymous/schema.mjs +1 -2
- package/dist/plugins/anonymous/types.d.mts +1 -3
- package/dist/plugins/bearer/index.d.mts +1 -3
- package/dist/plugins/bearer/index.mjs +1 -2
- package/dist/plugins/captcha/constants.d.mts +1 -3
- package/dist/plugins/captcha/constants.mjs +1 -2
- package/dist/plugins/captcha/error-codes.mjs +1 -2
- package/dist/plugins/captcha/index.d.mts +0 -2
- package/dist/plugins/captcha/index.mjs +2 -3
- package/dist/plugins/captcha/types.d.mts +1 -3
- package/dist/plugins/captcha/utils.mjs +1 -2
- package/dist/plugins/captcha/verify-handlers/captchafox.mjs +1 -2
- package/dist/plugins/captcha/verify-handlers/cloudflare-turnstile.mjs +1 -2
- package/dist/plugins/captcha/verify-handlers/google-recaptcha.mjs +1 -2
- package/dist/plugins/captcha/verify-handlers/h-captcha.mjs +1 -2
- package/dist/plugins/captcha/verify-handlers/vercel-botid.mjs +1 -2
- package/dist/plugins/custom-session/client.d.mts +1 -3
- package/dist/plugins/custom-session/client.mjs +1 -2
- package/dist/plugins/custom-session/index.d.mts +1 -3
- package/dist/plugins/custom-session/index.mjs +3 -4
- package/dist/plugins/device-authorization/client.d.mts +1 -3
- package/dist/plugins/device-authorization/client.mjs +1 -2
- package/dist/plugins/device-authorization/error-codes.mjs +1 -2
- package/dist/plugins/device-authorization/index.d.mts +1 -3
- package/dist/plugins/device-authorization/index.mjs +2 -3
- package/dist/plugins/device-authorization/routes.d.mts +4 -6
- package/dist/plugins/device-authorization/routes.mjs +18 -4
- package/dist/plugins/device-authorization/schema.d.mts +0 -2
- package/dist/plugins/device-authorization/schema.mjs +1 -2
- package/dist/plugins/email-otp/client.d.mts +0 -2
- package/dist/plugins/email-otp/client.mjs +1 -2
- package/dist/plugins/email-otp/error-codes.d.mts +1 -3
- package/dist/plugins/email-otp/error-codes.mjs +1 -2
- package/dist/plugins/email-otp/index.d.mts +0 -2
- package/dist/plugins/email-otp/index.mjs +4 -5
- package/dist/plugins/email-otp/otp-token.mjs +3 -4
- package/dist/plugins/email-otp/routes.mjs +6 -7
- package/dist/plugins/email-otp/types.d.mts +1 -3
- package/dist/plugins/email-otp/utils.mjs +1 -2
- package/dist/plugins/generic-oauth/error-codes.mjs +1 -2
- package/dist/plugins/generic-oauth/index.d.mts +1 -6
- package/dist/plugins/generic-oauth/index.mjs +43 -30
- package/dist/plugins/generic-oauth/providers/auth0.d.mts +1 -3
- package/dist/plugins/generic-oauth/providers/auth0.mjs +1 -2
- package/dist/plugins/generic-oauth/providers/gumroad.d.mts +1 -3
- package/dist/plugins/generic-oauth/providers/gumroad.mjs +1 -2
- package/dist/plugins/generic-oauth/providers/hubspot.d.mts +1 -3
- package/dist/plugins/generic-oauth/providers/hubspot.mjs +1 -2
- package/dist/plugins/generic-oauth/providers/keycloak.d.mts +1 -3
- package/dist/plugins/generic-oauth/providers/keycloak.mjs +1 -2
- package/dist/plugins/generic-oauth/providers/line.d.mts +1 -3
- package/dist/plugins/generic-oauth/providers/line.mjs +1 -2
- package/dist/plugins/generic-oauth/providers/microsoft-entra-id.d.mts +1 -3
- package/dist/plugins/generic-oauth/providers/microsoft-entra-id.mjs +1 -2
- package/dist/plugins/generic-oauth/providers/okta.d.mts +1 -3
- package/dist/plugins/generic-oauth/providers/okta.mjs +1 -2
- package/dist/plugins/generic-oauth/providers/patreon.d.mts +1 -3
- package/dist/plugins/generic-oauth/providers/patreon.mjs +1 -2
- package/dist/plugins/generic-oauth/providers/slack.d.mts +1 -3
- package/dist/plugins/generic-oauth/providers/slack.mjs +1 -2
- package/dist/plugins/generic-oauth/providers/yandex.d.mts +1 -3
- package/dist/plugins/generic-oauth/providers/yandex.mjs +1 -2
- package/dist/plugins/generic-oauth/types.d.mts +6 -5
- package/dist/plugins/haveibeenpwned/index.d.mts +1 -3
- package/dist/plugins/haveibeenpwned/index.mjs +2 -3
- package/dist/plugins/index.d.mts +5 -5
- package/dist/plugins/jwt/adapter.mjs +1 -2
- package/dist/plugins/jwt/client.d.mts +1 -3
- package/dist/plugins/jwt/client.mjs +1 -2
- package/dist/plugins/jwt/cookie-cache.mjs +1 -2
- package/dist/plugins/jwt/index.d.mts +1 -3
- package/dist/plugins/jwt/index.mjs +5 -6
- package/dist/plugins/jwt/schema.d.mts +1 -3
- package/dist/plugins/jwt/schema.mjs +1 -2
- package/dist/plugins/jwt/sign.d.mts +0 -2
- package/dist/plugins/jwt/sign.mjs +1 -2
- package/dist/plugins/jwt/types.d.mts +1 -3
- package/dist/plugins/jwt/utils.d.mts +1 -3
- package/dist/plugins/jwt/utils.mjs +2 -3
- package/dist/plugins/jwt/verify.d.mts +1 -3
- package/dist/plugins/jwt/verify.mjs +1 -2
- package/dist/plugins/last-login-method/client.d.mts +1 -3
- package/dist/plugins/last-login-method/client.mjs +1 -2
- package/dist/plugins/last-login-method/index.d.mts +1 -3
- package/dist/plugins/last-login-method/index.mjs +1 -2
- package/dist/plugins/magic-link/client.d.mts +1 -3
- package/dist/plugins/magic-link/client.mjs +1 -2
- package/dist/plugins/magic-link/index.d.mts +1 -3
- package/dist/plugins/magic-link/index.mjs +4 -5
- package/dist/plugins/magic-link/utils.mjs +1 -2
- package/dist/plugins/multi-session/client.d.mts +0 -2
- package/dist/plugins/multi-session/client.mjs +1 -2
- package/dist/plugins/multi-session/error-codes.d.mts +1 -3
- package/dist/plugins/multi-session/error-codes.mjs +1 -2
- package/dist/plugins/multi-session/index.d.mts +0 -2
- package/dist/plugins/multi-session/index.mjs +3 -4
- package/dist/plugins/oauth-popup/client.d.mts +0 -2
- package/dist/plugins/oauth-popup/client.mjs +1 -2
- package/dist/plugins/oauth-popup/constants.d.mts +1 -3
- package/dist/plugins/oauth-popup/constants.mjs +1 -2
- package/dist/plugins/oauth-popup/error-codes.d.mts +1 -3
- package/dist/plugins/oauth-popup/error-codes.mjs +1 -2
- package/dist/plugins/oauth-popup/index.d.mts +0 -2
- package/dist/plugins/oauth-popup/index.mjs +5 -6
- package/dist/plugins/oauth-popup/types.d.mts +1 -3
- package/dist/plugins/oauth-proxy/index.d.mts +1 -3
- package/dist/plugins/oauth-proxy/index.mjs +7 -8
- package/dist/plugins/oauth-proxy/utils.mjs +1 -2
- package/dist/plugins/one-tap/client.d.mts +1 -3
- package/dist/plugins/one-tap/client.mjs +1 -2
- package/dist/plugins/one-tap/index.d.mts +1 -3
- package/dist/plugins/one-tap/index.mjs +7 -8
- package/dist/plugins/one-time-token/client.d.mts +0 -2
- package/dist/plugins/one-time-token/client.mjs +1 -2
- package/dist/plugins/one-time-token/index.d.mts +1 -3
- package/dist/plugins/one-time-token/index.mjs +3 -4
- package/dist/plugins/one-time-token/utils.mjs +1 -2
- package/dist/plugins/open-api/generator.d.mts +0 -2
- package/dist/plugins/open-api/generator.mjs +2 -3
- package/dist/plugins/open-api/index.d.mts +0 -2
- package/dist/plugins/open-api/index.mjs +2 -3
- package/dist/plugins/open-api/logo.mjs +1 -2
- package/dist/plugins/organization/access/statement.d.mts +1 -3
- package/dist/plugins/organization/access/statement.mjs +1 -2
- package/dist/plugins/organization/adapter.d.mts +3 -5
- package/dist/plugins/organization/adapter.mjs +2 -3
- package/dist/plugins/organization/call.mjs +1 -2
- package/dist/plugins/organization/client.d.mts +9 -11
- package/dist/plugins/organization/client.mjs +2 -3
- package/dist/plugins/organization/error-codes.d.mts +1 -3
- package/dist/plugins/organization/error-codes.mjs +1 -2
- package/dist/plugins/organization/has-permission.d.mts +1 -3
- package/dist/plugins/organization/has-permission.mjs +2 -3
- package/dist/plugins/organization/index.d.mts +3 -3
- package/dist/plugins/organization/organization.d.mts +3 -5
- package/dist/plugins/organization/organization.mjs +3 -4
- package/dist/plugins/organization/permission.d.mts +1 -3
- package/dist/plugins/organization/permission.mjs +1 -2
- package/dist/plugins/organization/roles.d.mts +1 -3
- package/dist/plugins/organization/roles.mjs +1 -2
- package/dist/plugins/organization/routes/crud-access-control.d.mts +2 -4
- package/dist/plugins/organization/routes/crud-access-control.mjs +3 -4
- package/dist/plugins/organization/routes/crud-invites.d.mts +4 -6
- package/dist/plugins/organization/routes/crud-invites.mjs +5 -6
- package/dist/plugins/organization/routes/crud-members.d.mts +4 -6
- package/dist/plugins/organization/routes/crud-members.mjs +4 -5
- package/dist/plugins/organization/routes/crud-org.d.mts +4 -6
- package/dist/plugins/organization/routes/crud-org.mjs +8 -9
- package/dist/plugins/organization/routes/crud-team.d.mts +4 -6
- package/dist/plugins/organization/routes/crud-team.mjs +3 -4
- package/dist/plugins/organization/schema.d.mts +0 -2
- package/dist/plugins/organization/schema.mjs +1 -2
- package/dist/plugins/organization/types.d.mts +1 -3
- package/dist/plugins/phone-number/client.d.mts +1 -3
- package/dist/plugins/phone-number/client.mjs +1 -2
- package/dist/plugins/phone-number/error-codes.d.mts +1 -3
- package/dist/plugins/phone-number/error-codes.mjs +1 -2
- package/dist/plugins/phone-number/index.d.mts +0 -2
- package/dist/plugins/phone-number/index.mjs +1 -2
- package/dist/plugins/phone-number/routes.mjs +6 -7
- package/dist/plugins/phone-number/schema.d.mts +1 -3
- package/dist/plugins/phone-number/schema.mjs +1 -2
- package/dist/plugins/phone-number/types.d.mts +2 -4
- package/dist/plugins/siwe/client.d.mts +1 -3
- package/dist/plugins/siwe/client.mjs +1 -2
- package/dist/plugins/siwe/index.d.mts +1 -3
- package/dist/plugins/siwe/index.mjs +6 -7
- package/dist/plugins/siwe/parse-message.mjs +1 -2
- package/dist/plugins/siwe/schema.d.mts +1 -3
- package/dist/plugins/siwe/schema.mjs +1 -2
- package/dist/plugins/siwe/types.d.mts +0 -2
- package/dist/plugins/test-utils/auth-helpers.mjs +1 -2
- package/dist/plugins/test-utils/cookie-builder.mjs +1 -2
- package/dist/plugins/test-utils/db-helpers.mjs +1 -2
- package/dist/plugins/test-utils/factories.mjs +1 -2
- package/dist/plugins/test-utils/index.d.mts +0 -2
- package/dist/plugins/test-utils/index.mjs +2 -3
- package/dist/plugins/test-utils/otp-sink.mjs +1 -2
- package/dist/plugins/test-utils/types.d.mts +1 -3
- package/dist/plugins/two-factor/backup-codes/index.d.mts +1 -3
- package/dist/plugins/two-factor/backup-codes/index.mjs +4 -5
- package/dist/plugins/two-factor/client.d.mts +2 -4
- package/dist/plugins/two-factor/client.mjs +1 -2
- package/dist/plugins/two-factor/constant.mjs +1 -2
- package/dist/plugins/two-factor/error-code.d.mts +1 -3
- package/dist/plugins/two-factor/error-code.mjs +1 -2
- package/dist/plugins/two-factor/index.d.mts +0 -2
- package/dist/plugins/two-factor/index.mjs +9 -10
- package/dist/plugins/two-factor/otp/index.d.mts +1 -3
- package/dist/plugins/two-factor/otp/index.mjs +4 -5
- package/dist/plugins/two-factor/schema.d.mts +1 -3
- package/dist/plugins/two-factor/schema.mjs +1 -2
- package/dist/plugins/two-factor/totp/index.d.mts +1 -3
- package/dist/plugins/two-factor/totp/index.mjs +3 -4
- package/dist/plugins/two-factor/types.d.mts +1 -3
- package/dist/plugins/two-factor/utils.mjs +1 -2
- package/dist/plugins/two-factor/verify-two-factor.mjs +5 -6
- package/dist/plugins/username/client.d.mts +0 -2
- package/dist/plugins/username/client.mjs +1 -2
- package/dist/plugins/username/error-codes.d.mts +1 -3
- package/dist/plugins/username/error-codes.mjs +1 -2
- package/dist/plugins/username/index.d.mts +0 -2
- package/dist/plugins/username/index.mjs +4 -5
- package/dist/plugins/username/schema.d.mts +1 -3
- package/dist/plugins/username/schema.mjs +1 -2
- package/dist/state.d.mts +2 -7
- package/dist/state.mjs +3 -7
- package/dist/test-utils/headers.d.mts +1 -3
- package/dist/test-utils/headers.mjs +1 -2
- package/dist/test-utils/http-test-instance.d.mts +0 -2
- package/dist/test-utils/http-test-instance.mjs +1 -2
- package/dist/test-utils/index.d.mts +1 -1
- package/dist/test-utils/index.mjs +1 -1
- package/dist/test-utils/test-instance.d.mts +4 -6
- package/dist/test-utils/test-instance.mjs +5 -6
- package/dist/types/api.d.mts +1 -3
- package/dist/types/auth.d.mts +2 -4
- package/dist/types/helper.d.mts +1 -3
- package/dist/types/index.d.mts +2 -2
- package/dist/types/models.d.mts +0 -2
- package/dist/types/plugins.d.mts +0 -2
- package/dist/utils/constants.mjs +1 -2
- package/dist/utils/date.mjs +1 -2
- package/dist/utils/hashing.mjs +1 -2
- package/dist/utils/hide-metadata.d.mts +2 -5
- package/dist/utils/hide-metadata.mjs +1 -4
- package/dist/utils/index.d.mts +1 -1
- package/dist/utils/is-atom.mjs +1 -2
- package/dist/utils/is-promise.mjs +1 -2
- package/dist/utils/middleware-response.mjs +1 -2
- package/dist/utils/password.mjs +1 -2
- package/dist/utils/plugin-helper.mjs +1 -2
- package/dist/utils/request.mjs +1 -2
- package/dist/utils/shim.mjs +1 -2
- package/dist/utils/time.d.mts +0 -2
- package/dist/utils/time.mjs +1 -2
- package/dist/utils/url.d.mts +1 -3
- package/dist/utils/url.mjs +1 -2
- package/dist/utils/validate-user-info.mjs +1 -2
- package/dist/utils/wildcard.mjs +1 -2
- package/dist/version.mjs +1 -2
- package/package.json +10 -10
- package/dist/utils/boolean.mjs +0 -6
package/dist/client/index.d.mts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import { ExtractPluginField, HasRequiredKeys, InferPluginFieldFromTuple, IsAny, OverrideMerge, Prettify, PrettifyDeep, RequiredKeysOf, StripEmptyObjects, UnionToIntersection } from "../types/helper.mjs";
|
|
2
|
-
import { CamelCase, InferCtx, InferRoute, InferRoutes, InferSessionUpdateCtx, InferSignUpEmailCtx, InferUserUpdateCtx, MergeRoutes, PathToObject, ProxyRequest } from "./path-to-object.mjs";
|
|
3
|
-
import { BetterAuthClientOptions, BetterAuthClientPlugin, ClientAtomListener, ClientStore, InferActions, InferAdditionalFromClient, InferClientAPI, InferErrorCodes, InferSessionFromClient, InferUserFromClient, IsSignal, SessionQueryParams } from "./types.mjs";
|
|
4
1
|
import { BroadcastChannel, BroadcastListener, BroadcastMessage, getGlobalBroadcastChannel, kBroadcastChannel } from "./broadcast-channel.mjs";
|
|
5
2
|
import { isJsonEqual, withEquality } from "./equality.mjs";
|
|
6
3
|
import { FocusListener, FocusManager, kFocusManager } from "./focus-manager.mjs";
|
|
@@ -8,23 +5,25 @@ import { OnlineListener, OnlineManager, kOnlineManager } from "./online-manager.
|
|
|
8
5
|
import { parseJSON } from "./parser.mjs";
|
|
9
6
|
import { AuthQueryAtom, AuthQueryState, useAuthQuery } from "./query.mjs";
|
|
10
7
|
import { SessionRefreshOptions, createSessionRefreshManager } from "./session-refresh.mjs";
|
|
8
|
+
import { BetterAuthClientOptions, BetterAuthClientPlugin, ClientAtomListener, ClientStore, InferActions, InferAdditionalFromClient, InferClientAPI, InferErrorCodes, InferSessionFromClient, InferUserFromClient, IsSignal, SessionQueryParams } from "./types.mjs";
|
|
11
9
|
import { AuthClient, createAuthClient } from "./vanilla.mjs";
|
|
10
|
+
import "../plugins/access/index.mjs";
|
|
11
|
+
import "../plugins/organization/index.mjs";
|
|
12
12
|
import { AccessControl, ArrayElement, ExactRoleStatements, Role, RoleAuthorizeRequest, RoleInput, RoleStatements, Statements, SubArray, Subset } from "../plugins/access/types.mjs";
|
|
13
13
|
import { AuthorizeResponse, createAccessControl, role } from "../plugins/access/access.mjs";
|
|
14
|
-
import "../
|
|
14
|
+
import { ExtractPluginField, HasRequiredKeys, InferPluginFieldFromTuple, IsAny, OverrideMerge, Prettify, PrettifyDeep, RequiredKeysOf, StripEmptyObjects, UnionToIntersection } from "../types/helper.mjs";
|
|
15
15
|
import { OrganizationOptions } from "../plugins/organization/types.mjs";
|
|
16
16
|
import { InferInvitation, InferMember, InferOrganization, InferOrganizationRolesFromOption, InferOrganizationZodRolesFromOption, InferTeam, Invitation, InvitationInput, InvitationStatus, Member, MemberInput, Organization, OrganizationInput, OrganizationRole, OrganizationSchema, Team, TeamInput, TeamMember, TeamMemberInput, defaultRolesSchema, invitationSchema, invitationStatus, memberSchema, organizationRoleSchema, organizationSchema, roleSchema, teamMemberSchema, teamSchema } from "../plugins/organization/schema.mjs";
|
|
17
17
|
import { getOrgAdapter } from "../plugins/organization/adapter.mjs";
|
|
18
18
|
import { hasPermission } from "../plugins/organization/has-permission.mjs";
|
|
19
19
|
import { parseRoles } from "../plugins/organization/roles.mjs";
|
|
20
20
|
import { DefaultOrganizationPlugin, DynamicAccessControlEndpoints, OrganizationCreator, OrganizationEndpoints, OrganizationPlugin, TeamEndpoints, organization } from "../plugins/organization/organization.mjs";
|
|
21
|
-
import "
|
|
21
|
+
import { CamelCase, InferCtx, InferRoute, InferRoutes, InferSessionUpdateCtx, InferSignUpEmailCtx, InferUserUpdateCtx, MergeRoutes, PathToObject, ProxyRequest } from "./path-to-object.mjs";
|
|
22
22
|
import { BetterAuthOptions, BetterAuthPlugin } from "@better-auth/core";
|
|
23
23
|
import { DBPrimitive } from "@better-auth/core/db";
|
|
24
24
|
export type * from "@better-auth/core/db";
|
|
25
25
|
export type * from "nanostores";
|
|
26
26
|
export type * from "@better-fetch/fetch";
|
|
27
|
-
//#region src/client/index.d.ts
|
|
28
27
|
export declare const InferPlugin: <T extends BetterAuthPlugin>() => {
|
|
29
28
|
id: "infer-server-plugin";
|
|
30
29
|
version: string;
|
|
@@ -33,5 +32,4 @@ export declare const InferPlugin: <T extends BetterAuthPlugin>() => {
|
|
|
33
32
|
export declare function InferAuth<O extends {
|
|
34
33
|
options: BetterAuthOptions;
|
|
35
34
|
}>(): O["options"];
|
|
36
|
-
//#endregion
|
|
37
35
|
export { type AccessControl, type ArrayElement, AuthClient, AuthQueryAtom, AuthQueryState, type AuthorizeResponse, type BetterAuthClientOptions, type BetterAuthClientPlugin, BroadcastChannel, BroadcastListener, BroadcastMessage, type CamelCase, type ClientAtomListener, type ClientStore, type DBPrimitive, type DefaultOrganizationPlugin, type DynamicAccessControlEndpoints, type ExactRoleStatements, type ExtractPluginField, type FocusListener, type FocusManager, type HasRequiredKeys, InferActions, InferAdditionalFromClient, InferClientAPI, type InferCtx, InferErrorCodes, type InferInvitation, type InferMember, type InferOrganization, type InferOrganizationRolesFromOption, type InferOrganizationZodRolesFromOption, type InferPluginFieldFromTuple, type InferRoute, type InferRoutes, InferSessionFromClient, type InferSessionUpdateCtx, type InferSignUpEmailCtx, type InferTeam, InferUserFromClient, type InferUserUpdateCtx, type Invitation, type InvitationInput, type InvitationStatus, type IsAny, IsSignal, type Member, type MemberInput, type MergeRoutes, type OnlineListener, type OnlineManager, type Organization, type OrganizationCreator, type OrganizationEndpoints, type OrganizationInput, type OrganizationOptions, type OrganizationPlugin, type OrganizationRole, type OrganizationSchema, type OverrideMerge, type PathToObject, type Prettify, type PrettifyDeep, type ProxyRequest, type RequiredKeysOf, type Role, type RoleAuthorizeRequest, type RoleInput, type RoleStatements, SessionQueryParams, SessionRefreshOptions, type Statements, type StripEmptyObjects, type SubArray, type Subset, type Team, type TeamEndpoints, type TeamInput, type TeamMember, type TeamMemberInput, type UnionToIntersection, type createAccessControl, createAuthClient, createSessionRefreshManager, type defaultRolesSchema, getGlobalBroadcastChannel, type getOrgAdapter, type hasPermission, type invitationSchema, type invitationStatus, isJsonEqual, kBroadcastChannel, kFocusManager, kOnlineManager, type memberSchema, type organization, type organizationRoleSchema, type organizationSchema, parseJSON, type parseRoles, type role, type roleSchema, type teamMemberSchema, type teamSchema, useAuthQuery, withEquality };
|
package/dist/client/index.mjs
CHANGED
|
@@ -7,7 +7,7 @@ import { parseJSON } from "./parser.mjs";
|
|
|
7
7
|
import { useAuthQuery } from "./query.mjs";
|
|
8
8
|
import { createSessionRefreshManager } from "./session-refresh.mjs";
|
|
9
9
|
import { createAuthClient } from "./vanilla.mjs";
|
|
10
|
-
|
|
10
|
+
// src/client/index.ts
|
|
11
11
|
const InferPlugin = () => {
|
|
12
12
|
return {
|
|
13
13
|
id: "infer-server-plugin",
|
|
@@ -18,5 +18,4 @@ const InferPlugin = () => {
|
|
|
18
18
|
function InferAuth() {
|
|
19
19
|
return {};
|
|
20
20
|
}
|
|
21
|
-
//#endregion
|
|
22
21
|
export { InferAuth, InferPlugin, createAuthClient, createSessionRefreshManager, getGlobalBroadcastChannel, isJsonEqual, kBroadcastChannel, kFocusManager, kOnlineManager, parseJSON, useAuthQuery, withEquality };
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { ExtractPluginField, HasRequiredKeys, InferPluginFieldFromTuple, IsAny, OverrideMerge, Prettify, PrettifyDeep, RequiredKeysOf, StripEmptyObjects, UnionToIntersection } from "../../types/helper.mjs";
|
|
2
|
-
import { InferActions, InferClientAPI, InferErrorCodes, IsSignal, SessionQueryParams } from "../types.mjs";
|
|
3
2
|
import { getClientConfig } from "../config.mjs";
|
|
3
|
+
import { InferActions, InferClientAPI, InferErrorCodes, IsSignal, SessionQueryParams } from "../types.mjs";
|
|
4
4
|
import { useStore } from "./lynx-store.mjs";
|
|
5
5
|
import { BetterAuthClientOptions } from "@better-auth/core";
|
|
6
6
|
import { BASE_ERROR_CODES } from "@better-auth/core/error";
|
|
7
7
|
import { BetterFetchError, BetterFetchResponse } from "@better-fetch/fetch";
|
|
8
8
|
export type * from "nanostores";
|
|
9
9
|
export type * from "@better-fetch/fetch";
|
|
10
|
-
//#region src/client/lynx/index.d.ts
|
|
11
10
|
type InferResolvedHooks<O extends BetterAuthClientOptions> = O extends {
|
|
12
11
|
plugins: Array<infer Plugin>;
|
|
13
12
|
} ? UnionToIntersection<Plugin extends {
|
|
@@ -38,5 +37,4 @@ export type LynxAuthClient<Option extends BetterAuthClientOptions> = UnionToInte
|
|
|
38
37
|
$ERROR_CODES: PrettifyDeep<InferErrorCodes<Option> & typeof BASE_ERROR_CODES>;
|
|
39
38
|
};
|
|
40
39
|
export declare function createAuthClient<Option extends BetterAuthClientOptions>(options?: Option | undefined): LynxAuthClient<Option>;
|
|
41
|
-
//#endregion
|
|
42
40
|
export { type ExtractPluginField, type HasRequiredKeys, type InferPluginFieldFromTuple, type IsAny, type OverrideMerge, type Prettify, type PrettifyDeep, type RequiredKeysOf, type StripEmptyObjects, type UnionToIntersection, useStore };
|
|
@@ -2,7 +2,7 @@ import { getClientConfig } from "../config.mjs";
|
|
|
2
2
|
import { createDynamicPathProxy } from "../proxy.mjs";
|
|
3
3
|
import { useStore } from "./lynx-store.mjs";
|
|
4
4
|
import { capitalizeFirstLetter } from "@better-auth/core/utils/string";
|
|
5
|
-
|
|
5
|
+
// src/client/lynx/index.ts
|
|
6
6
|
function getAtomKey(str) {
|
|
7
7
|
return `use${capitalizeFirstLetter(str)}`;
|
|
8
8
|
}
|
|
@@ -19,5 +19,4 @@ function createAuthClient(options) {
|
|
|
19
19
|
};
|
|
20
20
|
return createDynamicPathProxy(routes, $fetch, pluginPathMethods, pluginsAtoms, atomListeners);
|
|
21
21
|
}
|
|
22
|
-
//#endregion
|
|
23
22
|
export { createAuthClient, useStore };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Store, StoreValue } from "nanostores";
|
|
2
2
|
import { DependencyList } from "@lynx-js/react";
|
|
3
|
-
//#region src/client/lynx/lynx-store.d.ts
|
|
4
3
|
type StoreKeys<T> = T extends {
|
|
5
4
|
setKey: (k: infer K, v: any) => unknown;
|
|
6
5
|
} ? K : never;
|
|
@@ -41,5 +40,4 @@ export interface UseStoreOptions<SomeStore> {
|
|
|
41
40
|
* @returns Store value.
|
|
42
41
|
*/
|
|
43
42
|
export declare function useStore<SomeStore extends Store>(store: SomeStore, options?: UseStoreOptions<SomeStore>): StoreValue<SomeStore>;
|
|
44
|
-
//#endregion
|
|
45
43
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { listenKeys } from "nanostores";
|
|
2
2
|
import { useCallback, useRef, useSyncExternalStore } from "@lynx-js/react";
|
|
3
|
-
|
|
3
|
+
// src/client/lynx/lynx-store.ts
|
|
4
4
|
/**
|
|
5
5
|
* Subscribe to store changes and get store's value.
|
|
6
6
|
*
|
|
@@ -40,5 +40,4 @@ function useStore(store, options = {}) {
|
|
|
40
40
|
const get = () => snapshotRef.current;
|
|
41
41
|
return useSyncExternalStore(subscribe, get, get);
|
|
42
42
|
}
|
|
43
|
-
//#endregion
|
|
44
43
|
export { useStore };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/client/online-manager.d.ts
|
|
2
1
|
export type OnlineListener = (online: boolean) => void;
|
|
3
2
|
export declare const kOnlineManager: unique symbol;
|
|
4
3
|
export interface OnlineManager {
|
|
@@ -6,5 +5,4 @@ export interface OnlineManager {
|
|
|
6
5
|
isOnline: boolean;
|
|
7
6
|
subscribe(listener: OnlineListener): () => void;
|
|
8
7
|
setup(): () => void;
|
|
9
|
-
}
|
|
10
|
-
//#endregion
|
|
8
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
// src/client/online-manager.ts
|
|
2
2
|
const kOnlineManager = Symbol.for("better-auth:online-manager");
|
|
3
3
|
var WindowOnlineManager = class {
|
|
4
4
|
listeners = /* @__PURE__ */ new Set();
|
|
5
|
-
isOnline =
|
|
5
|
+
isOnline = globalThis.navigator?.onLine ?? true;
|
|
6
6
|
subscribe(listener) {
|
|
7
7
|
this.listeners.add(listener);
|
|
8
8
|
return () => {
|
|
@@ -15,13 +15,14 @@ var WindowOnlineManager = class {
|
|
|
15
15
|
}
|
|
16
16
|
setup() {
|
|
17
17
|
if (typeof window === "undefined" || typeof window.addEventListener === "undefined") return () => {};
|
|
18
|
+
const target = window;
|
|
18
19
|
const onOnline = () => this.setOnline(true);
|
|
19
20
|
const onOffline = () => this.setOnline(false);
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
target.addEventListener("online", onOnline, false);
|
|
22
|
+
target.addEventListener("offline", onOffline, false);
|
|
22
23
|
return () => {
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
target.removeEventListener("online", onOnline, false);
|
|
25
|
+
target.removeEventListener("offline", onOffline, false);
|
|
25
26
|
};
|
|
26
27
|
}
|
|
27
28
|
};
|
|
@@ -29,5 +30,4 @@ function getGlobalOnlineManager() {
|
|
|
29
30
|
if (!globalThis[kOnlineManager]) globalThis[kOnlineManager] = new WindowOnlineManager();
|
|
30
31
|
return globalThis[kOnlineManager];
|
|
31
32
|
}
|
|
32
|
-
//#endregion
|
|
33
33
|
export { getGlobalOnlineManager, kOnlineManager };
|
package/dist/client/parser.d.mts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/client/parser.d.ts
|
|
2
1
|
type ParseOptions = {
|
|
3
2
|
/** Throw errors instead of returning the original value */
|
|
4
3
|
strict?: boolean | undefined;
|
|
@@ -10,5 +9,4 @@ type ParseOptions = {
|
|
|
10
9
|
parseDates?: boolean | undefined;
|
|
11
10
|
};
|
|
12
11
|
export declare function parseJSON<T = unknown>(value: unknown, options?: ParseOptions): T;
|
|
13
|
-
//#endregion
|
|
14
12
|
export {};
|
package/dist/client/parser.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/client/parser.ts
|
|
2
2
|
const JSON_SIGNATURE = /^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;
|
|
3
3
|
const SPECIAL_VALUES = {
|
|
4
4
|
true: true,
|
|
@@ -56,5 +56,4 @@ function betterJSONParse(value, options = {}) {
|
|
|
56
56
|
function parseJSON(value, options = { strict: true }) {
|
|
57
57
|
return betterJSONParse(value, options);
|
|
58
58
|
}
|
|
59
|
-
//#endregion
|
|
60
59
|
export { parseJSON };
|
|
@@ -4,7 +4,6 @@ import { BetterAuthClientOptions, ClientFetchOption } from "@better-auth/core";
|
|
|
4
4
|
import { SocialProviderList } from "@better-auth/core/social-providers";
|
|
5
5
|
import { Endpoint, InputContext, StandardSchemaV1 as StandardSchemaV1$1 } from "better-call";
|
|
6
6
|
import { BetterFetchResponse } from "@better-fetch/fetch";
|
|
7
|
-
//#region src/client/path-to-object.d.ts
|
|
8
7
|
/**
|
|
9
8
|
* Extract generic OAuth provider IDs from the client options.
|
|
10
9
|
* Supports both `$InferAuth` (server type bridge) and client plugins
|
|
@@ -108,5 +107,4 @@ export type ProxyRequest = {
|
|
|
108
107
|
query?: any | undefined;
|
|
109
108
|
[key: string]: any;
|
|
110
109
|
};
|
|
111
|
-
//#endregion
|
|
112
110
|
export {};
|
|
@@ -16,18 +16,17 @@ import { OTPOptions, otp2fa } from "../../plugins/two-factor/otp/index.mjs";
|
|
|
16
16
|
import { TOTPOptions, totp2fa } from "../../plugins/two-factor/totp/index.mjs";
|
|
17
17
|
import { TwoFactorOptions, TwoFactorProvider, TwoFactorTable, UserWithTwoFactor } from "../../plugins/two-factor/types.mjs";
|
|
18
18
|
import { TWO_FACTOR_ERROR_CODES } from "../../plugins/two-factor/error-code.mjs";
|
|
19
|
-
import {
|
|
19
|
+
import { inferAdditionalFields } from "../../plugins/additional-fields/client.mjs";
|
|
20
20
|
import { USERNAME_ERROR_CODES } from "../../plugins/username/error-codes.mjs";
|
|
21
21
|
import { ORGANIZATION_ERROR_CODES } from "../../plugins/organization/error-codes.mjs";
|
|
22
|
-
import { inferAdditionalFields } from "../../plugins/additional-fields/client.mjs";
|
|
23
|
-
import { ADMIN_ERROR_CODES } from "../../plugins/admin/error-codes.mjs";
|
|
24
22
|
import { AdminClientOptions, adminClient } from "../../plugins/admin/client.mjs";
|
|
25
|
-
import {
|
|
23
|
+
import { ADMIN_ERROR_CODES } from "../../plugins/admin/error-codes.mjs";
|
|
26
24
|
import { anonymousClient } from "../../plugins/anonymous/client.mjs";
|
|
25
|
+
import { ANONYMOUS_ERROR_CODES } from "../../plugins/anonymous/error-codes.mjs";
|
|
27
26
|
import { customSessionClient } from "../../plugins/custom-session/client.mjs";
|
|
28
27
|
import { deviceAuthorizationClient } from "../../plugins/device-authorization/client.mjs";
|
|
29
|
-
import { EMAIL_OTP_ERROR_CODES } from "../../plugins/email-otp/error-codes.mjs";
|
|
30
28
|
import { emailOTPClient } from "../../plugins/email-otp/client.mjs";
|
|
29
|
+
import { EMAIL_OTP_ERROR_CODES } from "../../plugins/email-otp/error-codes.mjs";
|
|
31
30
|
import { jwtClient } from "../../plugins/jwt/client.mjs";
|
|
32
31
|
import { LastLoginMethodClientConfig, lastLoginMethodClient } from "../../plugins/last-login-method/client.mjs";
|
|
33
32
|
import { magicLinkClient } from "../../plugins/magic-link/client.mjs";
|
|
@@ -36,9 +35,10 @@ import { SignInPopupOptions, SignInPopupResult, createSignInPopup, getStoredPopu
|
|
|
36
35
|
import { GoogleOneTapActionOptions, GoogleOneTapOptions, GsiButtonConfiguration, oneTapClient } from "../../plugins/one-tap/client.mjs";
|
|
37
36
|
import { oneTimeTokenClient } from "../../plugins/one-time-token/client.mjs";
|
|
38
37
|
import { OrganizationClientOptions, clientSideHasPermission, inferOrgAdditionalFields, organizationClient } from "../../plugins/organization/client.mjs";
|
|
39
|
-
import { PHONE_NUMBER_ERROR_CODES } from "../../plugins/phone-number/error-codes.mjs";
|
|
40
38
|
import { phoneNumberClient } from "../../plugins/phone-number/client.mjs";
|
|
39
|
+
import { PHONE_NUMBER_ERROR_CODES } from "../../plugins/phone-number/error-codes.mjs";
|
|
41
40
|
import { siweClient } from "../../plugins/siwe/client.mjs";
|
|
41
|
+
import { twoFactorClient } from "../../plugins/two-factor/client.mjs";
|
|
42
42
|
import { UsernameClientOptions, usernameClient } from "../../plugins/username/client.mjs";
|
|
43
43
|
import { InferServerPlugin } from "./infer-plugin.mjs";
|
|
44
44
|
export { ADMIN_ERROR_CODES, ANONYMOUS_ERROR_CODES, AdminClientOptions, type AdminOptions, type AnonymousOptions, type AnonymousSession, type BackupCodeOptions, EMAIL_OTP_ERROR_CODES, type ExtractPluginField, type FieldAttributeToObject, GoogleOneTapActionOptions, GoogleOneTapOptions, GsiButtonConfiguration, type HasRequiredKeys, type InferAdminRolesFromOption, type InferInvitation, type InferMember, type InferOrganization, type InferOrganizationRolesFromOption, type InferOrganizationZodRolesFromOption, type InferPluginFieldFromTuple, InferServerPlugin, type InferTeam, type Invitation, type InvitationInput, type InvitationStatus, type IsAny, type JWKOptions, type JWSAlgorithms, type Jwk, type JwtOptions, LastLoginMethodClientConfig, MULTI_SESSION_ERROR_CODES, type Member, type MemberInput, type MultiSessionConfig, OAUTH_POPUP_ERROR_CODES, ORGANIZATION_ERROR_CODES, type OTPOptions, type OneTimeTokenOptions, type Organization, OrganizationClientOptions, type OrganizationInput, type OrganizationRole, type OrganizationSchema, type OverrideMerge, PHONE_NUMBER_ERROR_CODES, POPUP_TOKEN_STORAGE_KEY, type PhoneNumberOptions, type Prettify, type PrettifyDeep, type RemoveFieldsWithReturnedFalse, type RequiredKeysOf, type ResolvedSigningKey, type SessionWithImpersonatedBy, SignInPopupOptions, SignInPopupResult, type StripEmptyObjects, type TOTPOptions, TWO_FACTOR_ERROR_CODES, type Team, type TeamInput, type TeamMember, type TeamMemberInput, type TwoFactorOptions, type TwoFactorProvider, type TwoFactorTable, USERNAME_ERROR_CODES, type UnionToIntersection, type UserWithAnonymous, type UserWithPhoneNumber, type UserWithRole, type UserWithTwoFactor, UsernameClientOptions, adminClient, anonymousClient, type backupCode2fa, clientSideHasPermission, createSignInPopup, customSessionClient, type defaultRolesSchema, deviceAuthorizationClient, emailOTPClient, type encodeBackupCodes, type generateBackupCodes, type getBackupCodes, getStoredPopupToken, inferAdditionalFields, inferOrgAdditionalFields, type invitationSchema, type invitationStatus, jwtClient, lastLoginMethodClient, magicLinkClient, type memberSchema, multiSessionClient, oauthPopupClient, oneTapClient, oneTimeTokenClient, organizationClient, type organizationRoleSchema, type organizationSchema, type otp2fa, phoneNumberClient, popupBearerFetchPlugin, type roleSchema, type schema, siweClient, type teamMemberSchema, type teamSchema, type totp2fa, twoFactorClient, usernameClient, type verifyBackupCode };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { BetterAuthOptions } from "@better-auth/core";
|
|
2
|
-
//#region src/client/plugins/infer-plugin.d.ts
|
|
3
2
|
export declare const InferServerPlugin: <AuthOrOption extends BetterAuthOptions | {
|
|
4
3
|
options: BetterAuthOptions;
|
|
5
4
|
}, ID extends string>() => {
|
|
@@ -10,5 +9,4 @@ export declare const InferServerPlugin: <AuthOrOption extends BetterAuthOptions
|
|
|
10
9
|
} ? O : AuthOrOption)["plugins"] extends (infer P)[] ? P extends {
|
|
11
10
|
id: ID;
|
|
12
11
|
} ? P : never : never;
|
|
13
|
-
};
|
|
14
|
-
//#endregion
|
|
12
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PACKAGE_VERSION } from "../../version.mjs";
|
|
2
|
-
|
|
2
|
+
// src/client/plugins/infer-plugin.ts
|
|
3
3
|
const InferServerPlugin = () => {
|
|
4
4
|
return {
|
|
5
5
|
id: "infer-server-plugin",
|
|
@@ -7,5 +7,4 @@ const InferServerPlugin = () => {
|
|
|
7
7
|
$InferServerPlugin: {}
|
|
8
8
|
};
|
|
9
9
|
};
|
|
10
|
-
//#endregion
|
|
11
10
|
export { InferServerPlugin };
|
package/dist/client/proxy.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isAtom } from "../utils/is-atom.mjs";
|
|
2
2
|
import { toKebabCase } from "@better-auth/core/utils/string";
|
|
3
3
|
import { isPayloadMethod } from "@better-fetch/fetch";
|
|
4
|
-
|
|
4
|
+
// src/client/proxy.ts
|
|
5
5
|
function createDynamicPathProxy(routes, client, knownPathMethods, atoms, atomListeners) {
|
|
6
6
|
function createProxy(path = []) {
|
|
7
7
|
return new Proxy(function() {}, {
|
|
@@ -67,5 +67,4 @@ function createDynamicPathProxy(routes, client, knownPathMethods, atoms, atomLis
|
|
|
67
67
|
}
|
|
68
68
|
return createProxy();
|
|
69
69
|
}
|
|
70
|
-
//#endregion
|
|
71
70
|
export { createDynamicPathProxy };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { atom } from "nanostores";
|
|
2
|
-
|
|
2
|
+
// src/client/query-atom.ts
|
|
3
3
|
const kAuthQuery = Symbol.for("better-auth:auth-query");
|
|
4
4
|
function isAuthQueryStore(store) {
|
|
5
5
|
return kAuthQuery in store && store[kAuthQuery] === true;
|
|
@@ -9,5 +9,4 @@ function createAuthQueryAtom(initialValue) {
|
|
|
9
9
|
Object.defineProperty(queryAtom, kAuthQuery, { value: true });
|
|
10
10
|
return queryAtom;
|
|
11
11
|
}
|
|
12
|
-
//#endregion
|
|
13
12
|
export { createAuthQueryAtom, isAuthQueryStore };
|
package/dist/client/query.d.mts
CHANGED
|
@@ -2,7 +2,6 @@ import { SessionQueryParams } from "./types.mjs";
|
|
|
2
2
|
import { ClientFetchOption } from "@better-auth/core";
|
|
3
3
|
import { PreinitializedWritableAtom } from "nanostores";
|
|
4
4
|
import { BetterFetch, BetterFetchError } from "@better-fetch/fetch";
|
|
5
|
-
//#region src/client/query.d.ts
|
|
6
5
|
export type AuthQueryState<T> = {
|
|
7
6
|
data: null | T;
|
|
8
7
|
error: null | BetterFetchError;
|
|
@@ -17,5 +16,4 @@ export declare const useAuthQuery: <T>(initializedAtom: PreinitializedWritableAt
|
|
|
17
16
|
data: null | T;
|
|
18
17
|
error: null | BetterFetchError;
|
|
19
18
|
isPending: boolean;
|
|
20
|
-
}) => ClientFetchOption) | ClientFetchOption) | undefined) => AuthQueryAtom<T>;
|
|
21
|
-
//#endregion
|
|
19
|
+
}) => ClientFetchOption) | ClientFetchOption) | undefined) => AuthQueryAtom<T>;
|
package/dist/client/query.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isJsonEqual, withEquality } from "./equality.mjs";
|
|
2
2
|
import { createAuthQueryAtom } from "./query-atom.mjs";
|
|
3
3
|
import { onMount } from "nanostores";
|
|
4
|
-
|
|
4
|
+
// src/client/query.ts
|
|
5
5
|
const isServer = () => typeof window === "undefined";
|
|
6
6
|
function isAuthQueryStateEqual(a, b) {
|
|
7
7
|
return isJsonEqual(a.data, b.data) && a.error === b.error && a.isPending === b.isPending && a.isRefetching === b.isRefetching && a.refetch === b.refetch;
|
|
@@ -130,5 +130,4 @@ const useAuthQuery = (initializedAtom, path, $fetch, options) => {
|
|
|
130
130
|
});
|
|
131
131
|
return value;
|
|
132
132
|
};
|
|
133
|
-
//#endregion
|
|
134
133
|
export { useAuthQuery };
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { ExtractPluginField, HasRequiredKeys, InferPluginFieldFromTuple, IsAny, OverrideMerge, Prettify, PrettifyDeep, RequiredKeysOf, StripEmptyObjects, UnionToIntersection } from "../../types/helper.mjs";
|
|
2
|
-
import { InferActions, InferClientAPI, InferErrorCodes, IsSignal, SessionQueryParams } from "../types.mjs";
|
|
3
2
|
import { getClientConfig } from "../config.mjs";
|
|
3
|
+
import { InferActions, InferClientAPI, InferErrorCodes, IsSignal, SessionQueryParams } from "../types.mjs";
|
|
4
4
|
import { useStore } from "./react-store.mjs";
|
|
5
5
|
import { BetterAuthClientOptions } from "@better-auth/core";
|
|
6
6
|
import { BASE_ERROR_CODES } from "@better-auth/core/error";
|
|
7
7
|
import { BetterFetchError, BetterFetchResponse } from "@better-fetch/fetch";
|
|
8
8
|
export type * from "nanostores";
|
|
9
9
|
export type * from "@better-fetch/fetch";
|
|
10
|
-
//#region src/client/react/index.d.ts
|
|
11
10
|
type InferResolvedHooks<O extends BetterAuthClientOptions> = O extends {
|
|
12
11
|
plugins: Array<infer Plugin>;
|
|
13
12
|
} ? UnionToIntersection<Plugin extends {
|
|
@@ -39,5 +38,4 @@ export type ReactAuthClient<Option extends BetterAuthClientOptions> = UnionToInt
|
|
|
39
38
|
$ERROR_CODES: InferErrorCodes<Option> & typeof BASE_ERROR_CODES;
|
|
40
39
|
};
|
|
41
40
|
export declare function createAuthClient<Option extends BetterAuthClientOptions>(options?: Option | undefined): ReactAuthClient<Option>;
|
|
42
|
-
//#endregion
|
|
43
41
|
export { type ExtractPluginField, type HasRequiredKeys, type InferPluginFieldFromTuple, type IsAny, type OverrideMerge, type Prettify, type PrettifyDeep, type RequiredKeysOf, type StripEmptyObjects, type UnionToIntersection, useStore };
|
|
@@ -2,7 +2,7 @@ import { getClientConfig } from "../config.mjs";
|
|
|
2
2
|
import { createDynamicPathProxy } from "../proxy.mjs";
|
|
3
3
|
import { useStore } from "./react-store.mjs";
|
|
4
4
|
import { capitalizeFirstLetter } from "@better-auth/core/utils/string";
|
|
5
|
-
|
|
5
|
+
// src/client/react/index.ts
|
|
6
6
|
function getAtomKey(str) {
|
|
7
7
|
return `use${capitalizeFirstLetter(str)}`;
|
|
8
8
|
}
|
|
@@ -19,5 +19,4 @@ function createAuthClient(options) {
|
|
|
19
19
|
};
|
|
20
20
|
return createDynamicPathProxy(routes, $fetch, pluginPathMethods, pluginsAtoms, atomListeners);
|
|
21
21
|
}
|
|
22
|
-
//#endregion
|
|
23
22
|
export { createAuthClient, useStore };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Store, StoreValue } from "nanostores";
|
|
2
2
|
import { DependencyList } from "react";
|
|
3
|
-
//#region src/client/react/react-store.d.ts
|
|
4
3
|
type StoreKeys<T> = T extends {
|
|
5
4
|
setKey: (k: infer K, v: any) => unknown;
|
|
6
5
|
} ? K : never;
|
|
@@ -41,5 +40,4 @@ export interface UseStoreOptions<SomeStore> {
|
|
|
41
40
|
* @returns Store value.
|
|
42
41
|
*/
|
|
43
42
|
export declare function useStore<SomeStore extends Store>(store: SomeStore, options?: UseStoreOptions<SomeStore>): StoreValue<SomeStore>;
|
|
44
|
-
//#endregion
|
|
45
43
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isAuthQueryStore } from "../query-atom.mjs";
|
|
2
2
|
import { listenKeys } from "nanostores";
|
|
3
3
|
import { useCallback, useRef, useSyncExternalStore } from "react";
|
|
4
|
-
|
|
4
|
+
// src/client/react/react-store.ts
|
|
5
5
|
/**
|
|
6
6
|
* Subscribe to store changes and get store's value.
|
|
7
7
|
*
|
|
@@ -41,5 +41,4 @@ function useStore(store, options = {}) {
|
|
|
41
41
|
const get = () => snapshotRef.current;
|
|
42
42
|
return useSyncExternalStore(subscribe, get, isAuthQueryStore(store) ? () => store.init : get);
|
|
43
43
|
}
|
|
44
|
-
//#endregion
|
|
45
44
|
export { useStore };
|
|
@@ -3,9 +3,7 @@ import "../types/index.mjs";
|
|
|
3
3
|
import "./query.mjs";
|
|
4
4
|
import { BetterAuthClientOptions } from "@better-auth/core";
|
|
5
5
|
import { BetterFetch } from "@better-fetch/fetch";
|
|
6
|
-
//#region src/client/session-atom.d.ts
|
|
7
6
|
export type SessionData = {
|
|
8
7
|
user: User;
|
|
9
8
|
session: Session;
|
|
10
|
-
} & Record<string, any>;
|
|
11
|
-
//#endregion
|
|
9
|
+
} & Record<string, any>;
|
|
@@ -2,7 +2,7 @@ import { isJsonEqual, withEquality } from "./equality.mjs";
|
|
|
2
2
|
import { createAuthQueryAtom } from "./query-atom.mjs";
|
|
3
3
|
import { createSessionRefreshManager } from "./session-refresh.mjs";
|
|
4
4
|
import { STORE_UNMOUNT_DELAY, atom, onMount } from "nanostores";
|
|
5
|
-
|
|
5
|
+
// src/client/session-atom.ts
|
|
6
6
|
const isServer = () => typeof window === "undefined";
|
|
7
7
|
const SESSION_MOUNT_DEDUPE_INTERVAL = STORE_UNMOUNT_DELAY;
|
|
8
8
|
function hydrateSessionAtom(sessionAtom, session) {
|
|
@@ -75,6 +75,7 @@ function getSessionAtom($fetch, options) {
|
|
|
75
75
|
if (data?.needsRefresh) try {
|
|
76
76
|
const refreshRes = await $fetch("/get-session", {
|
|
77
77
|
method: "POST",
|
|
78
|
+
body: {},
|
|
78
79
|
signal
|
|
79
80
|
});
|
|
80
81
|
if (signal.aborted) return "aborted";
|
|
@@ -175,5 +176,4 @@ function getSessionAtom($fetch, options) {
|
|
|
175
176
|
broadcastSessionUpdate: (trigger) => broadcastSessionUpdate(trigger)
|
|
176
177
|
};
|
|
177
178
|
}
|
|
178
|
-
//#endregion
|
|
179
179
|
export { getSessionAtom, hydrateSessionAtom };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { BetterAuthClientOptions } from "@better-auth/core";
|
|
2
2
|
import { WritableAtom } from "nanostores";
|
|
3
|
-
//#region src/client/session-refresh.d.ts
|
|
4
3
|
export interface SessionRefreshOptions {
|
|
5
4
|
fetchSession: () => Promise<void>;
|
|
6
5
|
shouldPollSession?: () => boolean;
|
|
@@ -14,5 +13,4 @@ export declare function createSessionRefreshManager(opts: SessionRefreshOptions)
|
|
|
14
13
|
event?: "poll" | "visibilitychange" | "storage";
|
|
15
14
|
} | undefined) => void;
|
|
16
15
|
broadcastSessionUpdate: (trigger: "signout" | "getSession" | "updateUser") => void;
|
|
17
|
-
};
|
|
18
|
-
//#endregion
|
|
16
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getGlobalBroadcastChannel } from "./broadcast-channel.mjs";
|
|
2
2
|
import { getGlobalFocusManager } from "./focus-manager.mjs";
|
|
3
3
|
import { getGlobalOnlineManager } from "./online-manager.mjs";
|
|
4
|
-
|
|
4
|
+
// src/client/session-refresh.ts
|
|
5
5
|
const now = () => Math.floor(Date.now() / 1e3);
|
|
6
6
|
/**
|
|
7
7
|
* Rate limit: don't refetch on focus if a session request was made within this many seconds
|
|
@@ -74,11 +74,12 @@ function createSessionRefreshManager(opts) {
|
|
|
74
74
|
const init = () => {
|
|
75
75
|
if (state.isInitialized) return;
|
|
76
76
|
state.isInitialized = true;
|
|
77
|
+
setupSignalSubscription();
|
|
78
|
+
if (typeof window === "undefined") return;
|
|
77
79
|
setupPolling();
|
|
78
80
|
setupBroadcast();
|
|
79
81
|
setupFocusRefetch();
|
|
80
82
|
setupOnlineRefetch();
|
|
81
|
-
setupSignalSubscription();
|
|
82
83
|
state.cleanupBroadcastSetup = getGlobalBroadcastChannel().setup();
|
|
83
84
|
state.cleanupFocusSetup = getGlobalFocusManager().setup();
|
|
84
85
|
state.cleanupOnlineSetup = getGlobalOnlineManager().setup();
|
|
@@ -127,5 +128,4 @@ function createSessionRefreshManager(opts) {
|
|
|
127
128
|
broadcastSessionUpdate
|
|
128
129
|
};
|
|
129
130
|
}
|
|
130
|
-
//#endregion
|
|
131
131
|
export { createSessionRefreshManager };
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { ExtractPluginField, HasRequiredKeys, InferPluginFieldFromTuple, IsAny, OverrideMerge, Prettify, PrettifyDeep, RequiredKeysOf, StripEmptyObjects, UnionToIntersection } from "../../types/helper.mjs";
|
|
2
|
-
import { InferActions, InferClientAPI, InferErrorCodes, IsSignal, SessionQueryParams } from "../types.mjs";
|
|
3
2
|
import { getClientConfig } from "../config.mjs";
|
|
3
|
+
import { InferActions, InferClientAPI, InferErrorCodes, IsSignal, SessionQueryParams } from "../types.mjs";
|
|
4
4
|
import { BetterAuthClientOptions } from "@better-auth/core";
|
|
5
5
|
import { BASE_ERROR_CODES } from "@better-auth/core/error";
|
|
6
6
|
import { BetterFetchError, BetterFetchResponse } from "@better-fetch/fetch";
|
|
7
7
|
import { Accessor } from "solid-js";
|
|
8
8
|
export type * from "nanostores";
|
|
9
9
|
export type * from "@better-fetch/fetch";
|
|
10
|
-
//#region src/client/solid/index.d.ts
|
|
11
10
|
type InferResolvedHooks<O extends BetterAuthClientOptions> = O extends {
|
|
12
11
|
plugins: Array<infer Plugin>;
|
|
13
12
|
} ? UnionToIntersection<Plugin extends {
|
|
@@ -39,5 +38,4 @@ export type SolidAuthClient<Option extends BetterAuthClientOptions> = UnionToInt
|
|
|
39
38
|
$ERROR_CODES: PrettifyDeep<InferErrorCodes<Option> & typeof BASE_ERROR_CODES>;
|
|
40
39
|
};
|
|
41
40
|
export declare function createAuthClient<Option extends BetterAuthClientOptions>(options?: Option | undefined): SolidAuthClient<Option>;
|
|
42
|
-
//#endregion
|
|
43
41
|
export type { ExtractPluginField, HasRequiredKeys, InferPluginFieldFromTuple, IsAny, OverrideMerge, Prettify, PrettifyDeep, RequiredKeysOf, StripEmptyObjects, UnionToIntersection };
|
|
@@ -2,7 +2,7 @@ import { getClientConfig } from "../config.mjs";
|
|
|
2
2
|
import { createDynamicPathProxy } from "../proxy.mjs";
|
|
3
3
|
import { useStore } from "./solid-store.mjs";
|
|
4
4
|
import { capitalizeFirstLetter } from "@better-auth/core/utils/string";
|
|
5
|
-
|
|
5
|
+
// src/client/solid/index.ts
|
|
6
6
|
function getAtomKey(str) {
|
|
7
7
|
return `use${capitalizeFirstLetter(str)}`;
|
|
8
8
|
}
|
|
@@ -19,5 +19,4 @@ function createAuthClient(options) {
|
|
|
19
19
|
};
|
|
20
20
|
return createDynamicPathProxy(routes, $fetch, pluginPathMethods, pluginsAtoms, atomListeners);
|
|
21
21
|
}
|
|
22
|
-
//#endregion
|
|
23
22
|
export { createAuthClient };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { onCleanup } from "solid-js";
|
|
2
2
|
import { createStore, reconcile } from "solid-js/store";
|
|
3
|
-
|
|
3
|
+
// src/client/solid/solid-store.ts
|
|
4
4
|
/**
|
|
5
5
|
* Subscribes to store changes and gets store’s value.
|
|
6
6
|
*
|
|
@@ -17,5 +17,4 @@ function useStore(store) {
|
|
|
17
17
|
unbindActivation();
|
|
18
18
|
return () => state.value;
|
|
19
19
|
}
|
|
20
|
-
//#endregion
|
|
21
20
|
export { useStore };
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { ExtractPluginField, HasRequiredKeys, InferPluginFieldFromTuple, IsAny, OverrideMerge, Prettify, PrettifyDeep, RequiredKeysOf, StripEmptyObjects, UnionToIntersection } from "../../types/helper.mjs";
|
|
2
|
-
import { InferActions, InferClientAPI, InferErrorCodes, IsSignal, SessionQueryParams } from "../types.mjs";
|
|
3
2
|
import { getClientConfig } from "../config.mjs";
|
|
3
|
+
import { InferActions, InferClientAPI, InferErrorCodes, IsSignal, SessionQueryParams } from "../types.mjs";
|
|
4
4
|
import { BetterAuthClientOptions } from "@better-auth/core";
|
|
5
5
|
import { BASE_ERROR_CODES } from "@better-auth/core/error";
|
|
6
6
|
import { Atom } from "nanostores";
|
|
7
7
|
import { BetterFetchError, BetterFetchResponse } from "@better-fetch/fetch";
|
|
8
8
|
export type * from "nanostores";
|
|
9
9
|
export type * from "@better-fetch/fetch";
|
|
10
|
-
//#region src/client/svelte/index.d.ts
|
|
11
10
|
type InferResolvedHooks<O extends BetterAuthClientOptions> = O extends {
|
|
12
11
|
plugins: Array<infer Plugin>;
|
|
13
12
|
} ? UnionToIntersection<Plugin extends {
|
|
@@ -39,5 +38,4 @@ export type SvelteAuthClient<Option extends BetterAuthClientOptions> = UnionToIn
|
|
|
39
38
|
$ERROR_CODES: PrettifyDeep<InferErrorCodes<Option> & typeof BASE_ERROR_CODES>;
|
|
40
39
|
};
|
|
41
40
|
export declare function createAuthClient<Option extends BetterAuthClientOptions>(options?: Option | undefined): SvelteAuthClient<Option>;
|
|
42
|
-
//#endregion
|
|
43
41
|
export type { ExtractPluginField, HasRequiredKeys, InferPluginFieldFromTuple, IsAny, OverrideMerge, Prettify, PrettifyDeep, RequiredKeysOf, StripEmptyObjects, UnionToIntersection };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getClientConfig } from "../config.mjs";
|
|
2
2
|
import { createDynamicPathProxy } from "../proxy.mjs";
|
|
3
3
|
import { capitalizeFirstLetter } from "@better-auth/core/utils/string";
|
|
4
|
-
|
|
4
|
+
// src/client/svelte/index.ts
|
|
5
5
|
function createAuthClient(options) {
|
|
6
6
|
const { pluginPathMethods, pluginsActions, pluginsAtoms, hydrateSession, $fetch, atomListeners, $store } = getClientConfig(options);
|
|
7
7
|
const resolvedHooks = {};
|
|
@@ -15,5 +15,4 @@ function createAuthClient(options) {
|
|
|
15
15
|
};
|
|
16
16
|
return createDynamicPathProxy(routes, $fetch, pluginPathMethods, pluginsAtoms, atomListeners);
|
|
17
17
|
}
|
|
18
|
-
//#endregion
|
|
19
18
|
export { createAuthClient };
|
package/dist/client/types.d.mts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { InferFieldsInputClient } from "../db/field.mjs";
|
|
2
|
+
import "../types/index.mjs";
|
|
2
3
|
import { StripEmptyObjects, UnionToIntersection } from "../types/helper.mjs";
|
|
3
|
-
import { InferRoutes } from "./path-to-object.mjs";
|
|
4
4
|
import { Session as Session$1, User as User$1 } from "../types/models.mjs";
|
|
5
5
|
import { Auth } from "../types/auth.mjs";
|
|
6
|
-
import "
|
|
6
|
+
import { InferRoutes } from "./path-to-object.mjs";
|
|
7
7
|
import { BetterAuthClientOptions as BetterAuthClientOptions$1, BetterAuthClientPlugin, ClientAtomListener as ClientAtomListener$1, ClientStore as ClientStore$1 } from "@better-auth/core";
|
|
8
8
|
import { DBFieldAttribute, InferDBFieldsOutput } from "@better-auth/core/db";
|
|
9
|
-
//#region src/client/types.d.ts
|
|
10
9
|
type ClientPluginError<K extends string = string> = {
|
|
11
10
|
readonly code: K;
|
|
12
11
|
message: string;
|
|
@@ -47,5 +46,4 @@ export type SessionQueryParams = {
|
|
|
47
46
|
disableCookieCache?: boolean | undefined;
|
|
48
47
|
disableRefresh?: boolean | undefined;
|
|
49
48
|
};
|
|
50
|
-
//#endregion
|
|
51
49
|
export type { BetterAuthClientOptions$1 as BetterAuthClientOptions, BetterAuthClientPlugin, ClientAtomListener$1 as ClientAtomListener, ClientStore$1 as ClientStore };
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { PrettifyDeep, UnionToIntersection } from "../types/helper.mjs";
|
|
2
|
-
import { InferActions, InferClientAPI, InferErrorCodes, IsSignal, SessionQueryParams } from "./types.mjs";
|
|
3
2
|
import { getClientConfig } from "./config.mjs";
|
|
3
|
+
import { InferActions, InferClientAPI, InferErrorCodes, IsSignal, SessionQueryParams } from "./types.mjs";
|
|
4
4
|
import { BetterAuthClientOptions } from "@better-auth/core";
|
|
5
5
|
import { BASE_ERROR_CODES } from "@better-auth/core/error";
|
|
6
6
|
import { Atom } from "nanostores";
|
|
7
7
|
import { BetterFetchError, BetterFetchResponse } from "@better-fetch/fetch";
|
|
8
|
-
//#region src/client/vanilla.d.ts
|
|
9
8
|
type InferResolvedHooks<O extends BetterAuthClientOptions> = O extends {
|
|
10
9
|
plugins: Array<infer Plugin>;
|
|
11
10
|
} ? UnionToIntersection<Plugin extends {
|
|
@@ -37,5 +36,4 @@ export type AuthClient<Option extends BetterAuthClientOptions> = UnionToIntersec
|
|
|
37
36
|
$ERROR_CODES: PrettifyDeep<InferErrorCodes<Option> & typeof BASE_ERROR_CODES>;
|
|
38
37
|
};
|
|
39
38
|
export declare function createAuthClient<Option extends BetterAuthClientOptions>(options?: Option | undefined): AuthClient<Option>;
|
|
40
|
-
//#endregion
|
|
41
39
|
export {};
|