better-auth 1.7.12 → 1.7.14
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/adapters/index.d.mts +5 -10
- package/dist/api/dispatch.d.mts +3 -5
- package/dist/api/dispatch.mjs +6 -4
- package/dist/api/index.d.mts +506 -508
- package/dist/api/index.mjs +35 -34
- package/dist/api/middlewares/authorization.d.mts +15 -12
- package/dist/api/middlewares/authorization.mjs +2 -1
- package/dist/api/middlewares/index.d.mts +2 -1
- package/dist/api/middlewares/origin-check.d.mts +4 -7
- package/dist/api/routes/account.d.mts +11 -15
- package/dist/api/routes/account.mjs +7 -4
- package/dist/api/routes/callback.d.mts +2 -5
- package/dist/api/routes/callback.mjs +4 -2
- package/dist/api/routes/email-verification.d.mts +7 -12
- package/dist/api/routes/error.d.mts +2 -5
- package/dist/api/routes/index.d.mts +2 -1
- package/dist/api/routes/ok.d.mts +2 -5
- package/dist/api/routes/password.d.mts +8 -11
- package/dist/api/routes/password.mjs +3 -2
- package/dist/api/routes/session.d.mts +26 -29
- package/dist/api/routes/sign-in.d.mts +4 -6
- package/dist/api/routes/sign-out.d.mts +2 -5
- package/dist/api/routes/sign-up.d.mts +4 -6
- package/dist/api/routes/update-session.d.mts +4 -6
- package/dist/api/routes/update-user.d.mts +14 -16
- package/dist/api/routes/update-user.mjs +1 -1
- package/dist/api/state/oauth.d.mts +0 -3
- package/dist/api/state/oauth.mjs +2 -1
- package/dist/auth/full.d.mts +3 -4
- package/dist/auth/minimal.d.mts +3 -3
- package/dist/client/broadcast-channel.d.mts +6 -7
- package/dist/client/config.d.mts +15 -19
- package/dist/client/config.mjs +2 -2
- package/dist/client/equality.d.mts +3 -5
- package/dist/client/focus-manager.d.mts +4 -5
- package/dist/client/index.d.mts +8 -7
- package/dist/client/lynx/index.d.mts +6 -7
- package/dist/client/lynx/index.mjs +3 -2
- package/dist/client/lynx/lynx-store.d.mts +3 -4
- package/dist/client/online-manager.d.mts +4 -5
- package/dist/client/parser.d.mts +9 -5
- package/dist/client/path-to-object.d.mts +13 -14
- package/dist/client/plugins/index.d.mts +1 -1
- package/dist/client/plugins/infer-plugin.d.mts +2 -4
- package/dist/client/query.d.mts +4 -6
- package/dist/client/react/index.d.mts +6 -7
- package/dist/client/react/index.mjs +3 -2
- package/dist/client/react/react-store.d.mts +3 -4
- package/dist/client/session-atom.d.mts +4 -4
- package/dist/client/session-refresh.d.mts +3 -5
- package/dist/client/solid/index.d.mts +6 -7
- package/dist/client/solid/index.mjs +3 -2
- package/dist/client/svelte/index.d.mts +6 -7
- package/dist/client/svelte/index.mjs +3 -2
- package/dist/client/types.d.mts +11 -11
- package/dist/client/vanilla.d.mts +4 -5
- package/dist/client/vanilla.mjs +3 -2
- package/dist/client/vue/index.d.mts +6 -7
- package/dist/client/vue/index.mjs +3 -2
- package/dist/context/create-context.mjs +7 -7
- package/dist/context/helpers.mjs +9 -7
- package/dist/cookies/cookie-utils.d.mts +13 -13
- package/dist/cookies/cookie-utils.mjs +1 -3
- package/dist/cookies/index.d.mts +17 -18
- package/dist/cookies/index.mjs +11 -7
- package/dist/cookies/jwt.mjs +2 -1
- package/dist/cookies/session-store.d.mts +6 -5
- package/dist/cookies/session-store.mjs +3 -2
- package/dist/crypto/buffer.d.mts +2 -3
- package/dist/crypto/index.d.mts +9 -16
- package/dist/crypto/index.mjs +2 -1
- package/dist/crypto/jwt.d.mts +5 -7
- package/dist/crypto/jwt.mjs +2 -1
- package/dist/crypto/password.d.mts +1 -5
- package/dist/crypto/random.d.mts +2 -3
- package/dist/db/adapter-base.d.mts +2 -4
- package/dist/db/adapter-kysely.d.mts +2 -4
- package/dist/db/field-converter.d.mts +3 -5
- package/dist/db/field.d.mts +11 -12
- package/dist/db/get-migration.d.mts +4 -8
- package/dist/db/get-migration.mjs +22 -22
- package/dist/db/get-schema.d.mts +2 -4
- package/dist/db/internal-adapter.d.mts +2 -4
- package/dist/db/internal-adapter.mjs +6 -4
- package/dist/db/revoke-unproven-account-access.d.mts +3 -4
- package/dist/db/schema.d.mts +15 -16
- package/dist/db/schema.mjs +6 -3
- package/dist/db/to-zod.d.mts +5 -9
- package/dist/db/with-hooks.d.mts +3 -5
- package/dist/index.d.mts +4 -3
- package/dist/integrations/next-js.d.mts +7 -11
- package/dist/integrations/node.d.mts +5 -7
- package/dist/integrations/node.mjs +4 -2
- package/dist/integrations/solid-start.d.mts +2 -3
- package/dist/integrations/svelte-kit.d.mts +6 -14
- package/dist/integrations/tanstack-start-solid.d.mts +4 -8
- package/dist/integrations/tanstack-start.d.mts +4 -8
- package/dist/oauth2/link-account.d.mts +5 -11
- package/dist/oauth2/link-account.mjs +12 -6
- package/dist/oauth2/state.d.mts +5 -7
- package/dist/oauth2/state.mjs +1 -1
- package/dist/oauth2/utils.d.mts +4 -6
- package/dist/package.mjs +1 -1
- package/dist/plugins/access/access.d.mts +4 -6
- package/dist/plugins/access/index.mjs +1 -2
- package/dist/plugins/access/types.d.mts +12 -14
- package/dist/plugins/additional-fields/client.d.mts +2 -4
- package/dist/plugins/admin/access/index.mjs +1 -2
- package/dist/plugins/admin/access/statement.d.mts +7 -7
- package/dist/plugins/admin/admin.d.mts +122 -128
- package/dist/plugins/admin/client.d.mts +32 -32
- package/dist/plugins/admin/client.mjs +1 -1
- package/dist/plugins/admin/error-codes.d.mts +25 -28
- package/dist/plugins/admin/index.d.mts +1 -1
- package/dist/plugins/admin/index.mjs +1 -2
- package/dist/plugins/admin/schema.d.mts +3 -4
- package/dist/plugins/admin/types.d.mts +8 -8
- package/dist/plugins/anonymous/client.d.mts +10 -12
- package/dist/plugins/anonymous/client.mjs +1 -1
- package/dist/plugins/anonymous/error-codes.d.mts +10 -13
- package/dist/plugins/anonymous/index.d.mts +17 -21
- package/dist/plugins/anonymous/schema.d.mts +2 -3
- package/dist/plugins/anonymous/types.d.mts +5 -6
- package/dist/plugins/bearer/index.d.mts +7 -11
- package/dist/plugins/captcha/constants.d.mts +2 -3
- package/dist/plugins/captcha/index.d.mts +6 -9
- package/dist/plugins/captcha/types.d.mts +11 -13
- package/dist/plugins/custom-session/client.d.mts +2 -4
- package/dist/plugins/custom-session/index.d.mts +10 -16
- package/dist/plugins/device-authorization/client.d.mts +2 -4
- package/dist/plugins/device-authorization/index.d.mts +39 -44
- package/dist/plugins/device-authorization/index.mjs +10 -9
- package/dist/plugins/device-authorization/routes.d.mts +7 -5
- package/dist/plugins/device-authorization/routes.mjs +6 -5
- package/dist/plugins/device-authorization/schema.d.mts +2 -3
- package/dist/plugins/email-otp/client.d.mts +5 -7
- package/dist/plugins/email-otp/client.mjs +1 -1
- package/dist/plugins/email-otp/error-codes.d.mts +5 -8
- package/dist/plugins/email-otp/index.d.mts +69 -76
- package/dist/plugins/email-otp/otp-token.mjs +19 -7
- package/dist/plugins/email-otp/types.d.mts +2 -4
- package/dist/plugins/generic-oauth/index.d.mts +9 -13
- package/dist/plugins/generic-oauth/index.mjs +6 -4
- package/dist/plugins/generic-oauth/providers/auth0.d.mts +3 -5
- package/dist/plugins/generic-oauth/providers/gumroad.d.mts +3 -5
- package/dist/plugins/generic-oauth/providers/hubspot.d.mts +3 -5
- package/dist/plugins/generic-oauth/providers/hubspot.mjs +2 -1
- package/dist/plugins/generic-oauth/providers/index.d.mts +2 -1
- package/dist/plugins/generic-oauth/providers/keycloak.d.mts +3 -5
- package/dist/plugins/generic-oauth/providers/line.d.mts +3 -5
- package/dist/plugins/generic-oauth/providers/microsoft-entra-id.d.mts +3 -5
- package/dist/plugins/generic-oauth/providers/okta.d.mts +3 -5
- package/dist/plugins/generic-oauth/providers/patreon.d.mts +3 -5
- package/dist/plugins/generic-oauth/providers/slack.d.mts +3 -5
- package/dist/plugins/generic-oauth/providers/yandex.d.mts +3 -5
- package/dist/plugins/generic-oauth/types.d.mts +6 -7
- package/dist/plugins/haveibeenpwned/index.d.mts +7 -11
- package/dist/plugins/index.d.mts +4 -1
- package/dist/plugins/jwt/client.d.mts +2 -3
- package/dist/plugins/jwt/index.d.mts +11 -14
- package/dist/plugins/jwt/index.mjs +1 -1
- package/dist/plugins/jwt/schema.d.mts +2 -3
- package/dist/plugins/jwt/sign.d.mts +9 -8
- package/dist/plugins/jwt/types.d.mts +7 -8
- package/dist/plugins/jwt/utils.d.mts +6 -9
- package/dist/plugins/jwt/verify.d.mts +2 -4
- package/dist/plugins/last-login-method/client.d.mts +3 -4
- package/dist/plugins/last-login-method/index.d.mts +5 -9
- package/dist/plugins/last-login-method/index.mjs +1 -1
- package/dist/plugins/magic-link/client.d.mts +2 -4
- package/dist/plugins/magic-link/index.d.mts +7 -10
- package/dist/plugins/magic-link/index.mjs +20 -17
- package/dist/plugins/multi-session/client.d.mts +3 -5
- package/dist/plugins/multi-session/client.mjs +1 -1
- package/dist/plugins/multi-session/error-codes.d.mts +3 -6
- package/dist/plugins/multi-session/index.d.mts +10 -14
- package/dist/plugins/oauth-popup/client.d.mts +11 -17
- package/dist/plugins/oauth-popup/client.mjs +6 -4
- package/dist/plugins/oauth-popup/constants.d.mts +5 -6
- package/dist/plugins/oauth-popup/error-codes.d.mts +6 -9
- package/dist/plugins/oauth-popup/index.d.mts +11 -15
- package/dist/plugins/oauth-popup/index.mjs +8 -7
- package/dist/plugins/oauth-popup/types.d.mts +4 -6
- package/dist/plugins/oauth-proxy/index.d.mts +11 -15
- package/dist/plugins/oauth-proxy/index.mjs +10 -7
- package/dist/plugins/one-tap/client.d.mts +6 -9
- package/dist/plugins/one-tap/index.d.mts +4 -7
- package/dist/plugins/one-time-token/client.d.mts +2 -3
- package/dist/plugins/one-time-token/index.d.mts +8 -10
- package/dist/plugins/open-api/generator.d.mts +8 -8
- package/dist/plugins/open-api/generator.mjs +5 -5
- package/dist/plugins/open-api/index.d.mts +5 -7
- package/dist/plugins/organization/access/index.mjs +1 -2
- package/dist/plugins/organization/access/statement.d.mts +8 -8
- package/dist/plugins/organization/adapter.d.mts +60 -87
- package/dist/plugins/organization/adapter.mjs +14 -10
- package/dist/plugins/organization/client.d.mts +108 -107
- package/dist/plugins/organization/client.mjs +9 -5
- package/dist/plugins/organization/error-codes.d.mts +61 -64
- package/dist/plugins/organization/has-permission.d.mts +2 -4
- package/dist/plugins/organization/has-permission.mjs +1 -1
- package/dist/plugins/organization/index.d.mts +1 -1
- package/dist/plugins/organization/organization.d.mts +20 -20
- package/dist/plugins/organization/organization.mjs +13 -8
- package/dist/plugins/organization/permission.d.mts +4 -5
- package/dist/plugins/organization/routes/crud-access-control.d.mts +28 -28
- package/dist/plugins/organization/routes/crud-invites.d.mts +64 -65
- package/dist/plugins/organization/routes/crud-invites.mjs +21 -18
- package/dist/plugins/organization/routes/crud-members.d.mts +53 -56
- package/dist/plugins/organization/routes/crud-members.mjs +23 -21
- package/dist/plugins/organization/routes/crud-org.d.mts +63 -65
- package/dist/plugins/organization/routes/crud-org.mjs +4 -2
- package/dist/plugins/organization/routes/crud-team.d.mts +65 -66
- package/dist/plugins/organization/routes/crud-team.mjs +4 -2
- package/dist/plugins/organization/schema.d.mts +33 -33
- package/dist/plugins/organization/schema.mjs +1 -1
- package/dist/plugins/organization/types.d.mts +16 -17
- package/dist/plugins/phone-number/client.d.mts +14 -16
- package/dist/plugins/phone-number/client.mjs +1 -1
- package/dist/plugins/phone-number/error-codes.d.mts +14 -17
- package/dist/plugins/phone-number/index.d.mts +48 -54
- package/dist/plugins/phone-number/schema.d.mts +2 -3
- package/dist/plugins/phone-number/types.d.mts +4 -5
- package/dist/plugins/siwe/client.d.mts +2 -4
- package/dist/plugins/siwe/index.d.mts +7 -9
- package/dist/plugins/siwe/index.mjs +1 -1
- package/dist/plugins/siwe/parse-message.mjs +1 -3
- package/dist/plugins/siwe/schema.d.mts +3 -4
- package/dist/plugins/siwe/types.d.mts +4 -4
- package/dist/plugins/test-utils/auth-helpers.mjs +4 -2
- package/dist/plugins/test-utils/index.d.mts +3 -5
- package/dist/plugins/test-utils/types.d.mts +7 -7
- package/dist/plugins/two-factor/backup-codes/index.d.mts +11 -14
- package/dist/plugins/two-factor/backup-codes/index.mjs +12 -6
- package/dist/plugins/two-factor/client.d.mts +16 -19
- package/dist/plugins/two-factor/client.mjs +1 -1
- package/dist/plugins/two-factor/constant.mjs +1 -1
- package/dist/plugins/two-factor/error-code.d.mts +15 -18
- package/dist/plugins/two-factor/index.d.mts +31 -35
- package/dist/plugins/two-factor/index.mjs +6 -3
- package/dist/plugins/two-factor/otp/index.d.mts +5 -8
- package/dist/plugins/two-factor/otp/index.mjs +159 -154
- package/dist/plugins/two-factor/schema.d.mts +2 -3
- package/dist/plugins/two-factor/totp/index.d.mts +7 -10
- package/dist/plugins/two-factor/totp/index.mjs +164 -148
- package/dist/plugins/two-factor/types.d.mts +6 -7
- package/dist/plugins/username/client.d.mts +12 -14
- package/dist/plugins/username/client.mjs +1 -1
- package/dist/plugins/username/error-codes.d.mts +11 -14
- package/dist/plugins/username/index.d.mts +26 -31
- package/dist/plugins/username/schema.d.mts +7 -10
- package/dist/state.d.mts +4 -5
- package/dist/test-utils/headers.d.mts +2 -3
- package/dist/test-utils/http-test-instance.d.mts +26 -29
- package/dist/test-utils/test-instance.d.mts +7 -6
- package/dist/test-utils/test-instance.mjs +4 -2
- package/dist/types/adapter.d.mts +1 -1
- package/dist/types/api.d.mts +4 -6
- package/dist/types/auth.d.mts +2 -4
- package/dist/types/helper.d.mts +11 -12
- package/dist/types/index.d.mts +2 -2
- package/dist/types/models.d.mts +4 -5
- package/dist/types/plugins.d.mts +7 -8
- package/dist/utils/hide-metadata.d.mts +2 -3
- package/dist/utils/index.d.mts +2 -1
- package/dist/utils/is-api-error.mjs +1 -2
- package/dist/utils/time.d.mts +4 -4
- package/dist/utils/url.d.mts +13 -15
- package/dist/utils/wildcard.mjs +5 -3
- package/package.json +12 -12
|
@@ -1,30 +1,27 @@
|
|
|
1
|
-
import * as _$_better_auth_core_utils_error_codes0 from "@better-auth/core/utils/error-codes";
|
|
2
|
-
|
|
3
1
|
//#region src/plugins/admin/error-codes.d.ts
|
|
4
|
-
declare const ADMIN_ERROR_CODES: {
|
|
5
|
-
USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL:
|
|
6
|
-
FAILED_TO_CREATE_USER:
|
|
7
|
-
USER_ALREADY_EXISTS:
|
|
8
|
-
YOU_CANNOT_BAN_YOURSELF:
|
|
9
|
-
YOU_ARE_NOT_ALLOWED_TO_CHANGE_USERS_ROLE:
|
|
10
|
-
YOU_ARE_NOT_ALLOWED_TO_CREATE_USERS:
|
|
11
|
-
YOU_ARE_NOT_ALLOWED_TO_LIST_USERS:
|
|
12
|
-
YOU_ARE_NOT_ALLOWED_TO_LIST_USERS_SESSIONS:
|
|
13
|
-
YOU_ARE_NOT_ALLOWED_TO_BAN_USERS:
|
|
14
|
-
YOU_ARE_NOT_ALLOWED_TO_IMPERSONATE_USERS:
|
|
15
|
-
YOU_ARE_NOT_ALLOWED_TO_REVOKE_USERS_SESSIONS:
|
|
16
|
-
YOU_ARE_NOT_ALLOWED_TO_DELETE_USERS:
|
|
17
|
-
YOU_ARE_NOT_ALLOWED_TO_SET_USERS_PASSWORD:
|
|
18
|
-
BANNED_USER:
|
|
19
|
-
YOU_ARE_NOT_ALLOWED_TO_GET_USER:
|
|
20
|
-
NO_DATA_TO_UPDATE:
|
|
21
|
-
YOU_ARE_NOT_ALLOWED_TO_UPDATE_USERS:
|
|
22
|
-
YOU_CANNOT_REMOVE_YOURSELF:
|
|
23
|
-
YOU_ARE_NOT_ALLOWED_TO_SET_NON_EXISTENT_VALUE:
|
|
24
|
-
YOU_CANNOT_IMPERSONATE_ADMINS:
|
|
25
|
-
INVALID_ROLE_TYPE:
|
|
26
|
-
YOU_ARE_NOT_ALLOWED_TO_SET_USERS_EMAIL:
|
|
27
|
-
PASSWORD_CANNOT_BE_UPDATED_VIA_UPDATE_USER:
|
|
2
|
+
export declare const ADMIN_ERROR_CODES: {
|
|
3
|
+
USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL: import("@better-auth/core/utils/error-codes").RawError<"USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL">;
|
|
4
|
+
FAILED_TO_CREATE_USER: import("@better-auth/core/utils/error-codes").RawError<"FAILED_TO_CREATE_USER">;
|
|
5
|
+
USER_ALREADY_EXISTS: import("@better-auth/core/utils/error-codes").RawError<"USER_ALREADY_EXISTS">;
|
|
6
|
+
YOU_CANNOT_BAN_YOURSELF: import("@better-auth/core/utils/error-codes").RawError<"YOU_CANNOT_BAN_YOURSELF">;
|
|
7
|
+
YOU_ARE_NOT_ALLOWED_TO_CHANGE_USERS_ROLE: import("@better-auth/core/utils/error-codes").RawError<"YOU_ARE_NOT_ALLOWED_TO_CHANGE_USERS_ROLE">;
|
|
8
|
+
YOU_ARE_NOT_ALLOWED_TO_CREATE_USERS: import("@better-auth/core/utils/error-codes").RawError<"YOU_ARE_NOT_ALLOWED_TO_CREATE_USERS">;
|
|
9
|
+
YOU_ARE_NOT_ALLOWED_TO_LIST_USERS: import("@better-auth/core/utils/error-codes").RawError<"YOU_ARE_NOT_ALLOWED_TO_LIST_USERS">;
|
|
10
|
+
YOU_ARE_NOT_ALLOWED_TO_LIST_USERS_SESSIONS: import("@better-auth/core/utils/error-codes").RawError<"YOU_ARE_NOT_ALLOWED_TO_LIST_USERS_SESSIONS">;
|
|
11
|
+
YOU_ARE_NOT_ALLOWED_TO_BAN_USERS: import("@better-auth/core/utils/error-codes").RawError<"YOU_ARE_NOT_ALLOWED_TO_BAN_USERS">;
|
|
12
|
+
YOU_ARE_NOT_ALLOWED_TO_IMPERSONATE_USERS: import("@better-auth/core/utils/error-codes").RawError<"YOU_ARE_NOT_ALLOWED_TO_IMPERSONATE_USERS">;
|
|
13
|
+
YOU_ARE_NOT_ALLOWED_TO_REVOKE_USERS_SESSIONS: import("@better-auth/core/utils/error-codes").RawError<"YOU_ARE_NOT_ALLOWED_TO_REVOKE_USERS_SESSIONS">;
|
|
14
|
+
YOU_ARE_NOT_ALLOWED_TO_DELETE_USERS: import("@better-auth/core/utils/error-codes").RawError<"YOU_ARE_NOT_ALLOWED_TO_DELETE_USERS">;
|
|
15
|
+
YOU_ARE_NOT_ALLOWED_TO_SET_USERS_PASSWORD: import("@better-auth/core/utils/error-codes").RawError<"YOU_ARE_NOT_ALLOWED_TO_SET_USERS_PASSWORD">;
|
|
16
|
+
BANNED_USER: import("@better-auth/core/utils/error-codes").RawError<"BANNED_USER">;
|
|
17
|
+
YOU_ARE_NOT_ALLOWED_TO_GET_USER: import("@better-auth/core/utils/error-codes").RawError<"YOU_ARE_NOT_ALLOWED_TO_GET_USER">;
|
|
18
|
+
NO_DATA_TO_UPDATE: import("@better-auth/core/utils/error-codes").RawError<"NO_DATA_TO_UPDATE">;
|
|
19
|
+
YOU_ARE_NOT_ALLOWED_TO_UPDATE_USERS: import("@better-auth/core/utils/error-codes").RawError<"YOU_ARE_NOT_ALLOWED_TO_UPDATE_USERS">;
|
|
20
|
+
YOU_CANNOT_REMOVE_YOURSELF: import("@better-auth/core/utils/error-codes").RawError<"YOU_CANNOT_REMOVE_YOURSELF">;
|
|
21
|
+
YOU_ARE_NOT_ALLOWED_TO_SET_NON_EXISTENT_VALUE: import("@better-auth/core/utils/error-codes").RawError<"YOU_ARE_NOT_ALLOWED_TO_SET_NON_EXISTENT_VALUE">;
|
|
22
|
+
YOU_CANNOT_IMPERSONATE_ADMINS: import("@better-auth/core/utils/error-codes").RawError<"YOU_CANNOT_IMPERSONATE_ADMINS">;
|
|
23
|
+
INVALID_ROLE_TYPE: import("@better-auth/core/utils/error-codes").RawError<"INVALID_ROLE_TYPE">;
|
|
24
|
+
YOU_ARE_NOT_ALLOWED_TO_SET_USERS_EMAIL: import("@better-auth/core/utils/error-codes").RawError<"YOU_ARE_NOT_ALLOWED_TO_SET_USERS_EMAIL">;
|
|
25
|
+
PASSWORD_CANNOT_BE_UPDATED_VIA_UPDATE_USER: import("@better-auth/core/utils/error-codes").RawError<"PASSWORD_CANNOT_BE_UPDATED_VIA_UPDATE_USER">;
|
|
28
26
|
};
|
|
29
|
-
//#endregion
|
|
30
|
-
export { ADMIN_ERROR_CODES };
|
|
27
|
+
//#endregion
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { AdminOptions, InferAdminRolesFromOption, SessionWithImpersonatedBy, UserWithRole } from "./types.mjs";
|
|
2
2
|
import { admin } from "./admin.mjs";
|
|
3
|
-
export { AdminOptions, InferAdminRolesFromOption, SessionWithImpersonatedBy, UserWithRole, admin };
|
|
3
|
+
export { type AdminOptions, type InferAdminRolesFromOption, type SessionWithImpersonatedBy, type UserWithRole, admin };
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { admin };
|
|
1
|
+
export { admin } from "./admin.mjs";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/plugins/admin/schema.d.ts
|
|
2
|
-
declare const schema: {
|
|
2
|
+
export declare const schema: {
|
|
3
3
|
user: {
|
|
4
4
|
fields: {
|
|
5
5
|
role: {
|
|
@@ -35,6 +35,5 @@ declare const schema: {
|
|
|
35
35
|
};
|
|
36
36
|
};
|
|
37
37
|
};
|
|
38
|
-
type AdminSchema = typeof schema;
|
|
39
|
-
//#endregion
|
|
40
|
-
export { AdminSchema };
|
|
38
|
+
export type AdminSchema = typeof schema;
|
|
39
|
+
//#endregion
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import { Session, User } from "../../types/models.mjs";
|
|
2
2
|
import { InferOptionSchema } from "../../types/plugins.mjs";
|
|
3
|
+
import "../../types/index.mjs";
|
|
3
4
|
import { AccessControl, Role } from "../access/types.mjs";
|
|
5
|
+
import "../access/index.mjs";
|
|
4
6
|
import { AdminSchema } from "./schema.mjs";
|
|
5
7
|
import { Awaitable } from "@better-auth/core";
|
|
6
|
-
|
|
7
8
|
//#region src/plugins/admin/types.d.ts
|
|
8
|
-
interface UserWithRole extends User {
|
|
9
|
+
export interface UserWithRole extends User {
|
|
9
10
|
role?: string | undefined;
|
|
10
11
|
banned: boolean | null;
|
|
11
12
|
banReason?: (string | null) | undefined;
|
|
12
13
|
banExpires?: (Date | null) | undefined;
|
|
13
14
|
}
|
|
14
|
-
interface SessionWithImpersonatedBy extends Session {
|
|
15
|
+
export interface SessionWithImpersonatedBy extends Session {
|
|
15
16
|
impersonatedBy?: string | undefined;
|
|
16
17
|
}
|
|
17
|
-
interface AdminOptions {
|
|
18
|
+
export interface AdminOptions {
|
|
18
19
|
/**
|
|
19
20
|
* The default role for a user
|
|
20
21
|
*
|
|
@@ -60,7 +61,7 @@ interface AdminOptions {
|
|
|
60
61
|
/**
|
|
61
62
|
* Custom permissions for roles.
|
|
62
63
|
*/
|
|
63
|
-
roles?: { [key in string]?: Role } | undefined;
|
|
64
|
+
roles?: { [key in string]?: Role; } | undefined;
|
|
64
65
|
/**
|
|
65
66
|
* List of user ids that should have admin access
|
|
66
67
|
*
|
|
@@ -84,8 +85,7 @@ interface AdminOptions {
|
|
|
84
85
|
*/
|
|
85
86
|
allowImpersonatingAdmins?: boolean | undefined;
|
|
86
87
|
}
|
|
87
|
-
type InferAdminRolesFromOption<O extends AdminOptions | undefined> = O extends {
|
|
88
|
+
export type InferAdminRolesFromOption<O extends AdminOptions | undefined> = O extends {
|
|
88
89
|
roles: Record<string, unknown>;
|
|
89
90
|
} ? keyof O["roles"] : "user" | "admin";
|
|
90
|
-
//#endregion
|
|
91
|
-
export { AdminOptions, InferAdminRolesFromOption, SessionWithImpersonatedBy, UserWithRole };
|
|
91
|
+
//#endregion
|
|
@@ -2,10 +2,8 @@ import { schema } from "./schema.mjs";
|
|
|
2
2
|
import { AnonymousOptions, AnonymousSession, UserWithAnonymous } from "./types.mjs";
|
|
3
3
|
import { anonymous } from "./index.mjs";
|
|
4
4
|
import { ANONYMOUS_ERROR_CODES } from "./error-codes.mjs";
|
|
5
|
-
import * as _$_better_auth_core_utils_error_codes0 from "@better-auth/core/utils/error-codes";
|
|
6
|
-
|
|
7
5
|
//#region src/plugins/anonymous/client.d.ts
|
|
8
|
-
declare const anonymousClient: () => {
|
|
6
|
+
export declare const anonymousClient: () => {
|
|
9
7
|
id: "anonymous";
|
|
10
8
|
version: string;
|
|
11
9
|
$InferServerPlugin: ReturnType<typeof anonymous>;
|
|
@@ -18,15 +16,15 @@ declare const anonymousClient: () => {
|
|
|
18
16
|
signal: "$sessionSignal";
|
|
19
17
|
}[];
|
|
20
18
|
$ERROR_CODES: {
|
|
21
|
-
FAILED_TO_CREATE_USER:
|
|
22
|
-
INVALID_EMAIL_FORMAT:
|
|
23
|
-
COULD_NOT_CREATE_SESSION:
|
|
24
|
-
ANONYMOUS_USERS_CANNOT_SIGN_IN_AGAIN_ANONYMOUSLY:
|
|
25
|
-
FAILED_TO_DELETE_ANONYMOUS_USER:
|
|
26
|
-
FAILED_TO_DELETE_ANONYMOUS_USER_SESSIONS:
|
|
27
|
-
USER_IS_NOT_ANONYMOUS:
|
|
28
|
-
DELETE_ANONYMOUS_USER_DISABLED:
|
|
19
|
+
FAILED_TO_CREATE_USER: import("@better-auth/core/utils/error-codes").RawError<"FAILED_TO_CREATE_USER">;
|
|
20
|
+
INVALID_EMAIL_FORMAT: import("@better-auth/core/utils/error-codes").RawError<"INVALID_EMAIL_FORMAT">;
|
|
21
|
+
COULD_NOT_CREATE_SESSION: import("@better-auth/core/utils/error-codes").RawError<"COULD_NOT_CREATE_SESSION">;
|
|
22
|
+
ANONYMOUS_USERS_CANNOT_SIGN_IN_AGAIN_ANONYMOUSLY: import("@better-auth/core/utils/error-codes").RawError<"ANONYMOUS_USERS_CANNOT_SIGN_IN_AGAIN_ANONYMOUSLY">;
|
|
23
|
+
FAILED_TO_DELETE_ANONYMOUS_USER: import("@better-auth/core/utils/error-codes").RawError<"FAILED_TO_DELETE_ANONYMOUS_USER">;
|
|
24
|
+
FAILED_TO_DELETE_ANONYMOUS_USER_SESSIONS: import("@better-auth/core/utils/error-codes").RawError<"FAILED_TO_DELETE_ANONYMOUS_USER_SESSIONS">;
|
|
25
|
+
USER_IS_NOT_ANONYMOUS: import("@better-auth/core/utils/error-codes").RawError<"USER_IS_NOT_ANONYMOUS">;
|
|
26
|
+
DELETE_ANONYMOUS_USER_DISABLED: import("@better-auth/core/utils/error-codes").RawError<"DELETE_ANONYMOUS_USER_DISABLED">;
|
|
29
27
|
};
|
|
30
28
|
};
|
|
31
29
|
//#endregion
|
|
32
|
-
export {
|
|
30
|
+
export { ANONYMOUS_ERROR_CODES, type AnonymousOptions, type AnonymousSession, type UserWithAnonymous, type schema };
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
import * as _$_better_auth_core_utils_error_codes0 from "@better-auth/core/utils/error-codes";
|
|
2
|
-
|
|
3
1
|
//#region src/plugins/anonymous/error-codes.d.ts
|
|
4
|
-
declare const ANONYMOUS_ERROR_CODES: {
|
|
5
|
-
FAILED_TO_CREATE_USER:
|
|
6
|
-
INVALID_EMAIL_FORMAT:
|
|
7
|
-
COULD_NOT_CREATE_SESSION:
|
|
8
|
-
ANONYMOUS_USERS_CANNOT_SIGN_IN_AGAIN_ANONYMOUSLY:
|
|
9
|
-
FAILED_TO_DELETE_ANONYMOUS_USER:
|
|
10
|
-
FAILED_TO_DELETE_ANONYMOUS_USER_SESSIONS:
|
|
11
|
-
USER_IS_NOT_ANONYMOUS:
|
|
12
|
-
DELETE_ANONYMOUS_USER_DISABLED:
|
|
2
|
+
export declare const ANONYMOUS_ERROR_CODES: {
|
|
3
|
+
FAILED_TO_CREATE_USER: import("@better-auth/core/utils/error-codes").RawError<"FAILED_TO_CREATE_USER">;
|
|
4
|
+
INVALID_EMAIL_FORMAT: import("@better-auth/core/utils/error-codes").RawError<"INVALID_EMAIL_FORMAT">;
|
|
5
|
+
COULD_NOT_CREATE_SESSION: import("@better-auth/core/utils/error-codes").RawError<"COULD_NOT_CREATE_SESSION">;
|
|
6
|
+
ANONYMOUS_USERS_CANNOT_SIGN_IN_AGAIN_ANONYMOUSLY: import("@better-auth/core/utils/error-codes").RawError<"ANONYMOUS_USERS_CANNOT_SIGN_IN_AGAIN_ANONYMOUSLY">;
|
|
7
|
+
FAILED_TO_DELETE_ANONYMOUS_USER: import("@better-auth/core/utils/error-codes").RawError<"FAILED_TO_DELETE_ANONYMOUS_USER">;
|
|
8
|
+
FAILED_TO_DELETE_ANONYMOUS_USER_SESSIONS: import("@better-auth/core/utils/error-codes").RawError<"FAILED_TO_DELETE_ANONYMOUS_USER_SESSIONS">;
|
|
9
|
+
USER_IS_NOT_ANONYMOUS: import("@better-auth/core/utils/error-codes").RawError<"USER_IS_NOT_ANONYMOUS">;
|
|
10
|
+
DELETE_ANONYMOUS_USER_DISABLED: import("@better-auth/core/utils/error-codes").RawError<"DELETE_ANONYMOUS_USER_DISABLED">;
|
|
13
11
|
};
|
|
14
|
-
//#endregion
|
|
15
|
-
export { ANONYMOUS_ERROR_CODES };
|
|
12
|
+
//#endregion
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
import { AnonymousOptions, AnonymousSession, UserWithAnonymous } from "./types.mjs";
|
|
2
|
-
import * as _$_better_auth_core0 from "@better-auth/core";
|
|
3
|
-
import * as _$_better_auth_core_utils_error_codes0 from "@better-auth/core/utils/error-codes";
|
|
4
|
-
import * as _$better_call0 from "better-call";
|
|
5
|
-
|
|
6
2
|
//#region src/plugins/anonymous/index.d.ts
|
|
7
3
|
declare module "@better-auth/core" {
|
|
8
4
|
interface BetterAuthPluginRegistry<AuthOptions, Options> {
|
|
@@ -11,11 +7,11 @@ declare module "@better-auth/core" {
|
|
|
11
7
|
};
|
|
12
8
|
}
|
|
13
9
|
}
|
|
14
|
-
declare const anonymous: (options?: AnonymousOptions | undefined) => {
|
|
10
|
+
export declare const anonymous: (options?: AnonymousOptions | undefined) => {
|
|
15
11
|
id: "anonymous";
|
|
16
12
|
version: string;
|
|
17
13
|
endpoints: {
|
|
18
|
-
signInAnonymous:
|
|
14
|
+
signInAnonymous: import("better-call").StrictEndpoint<"/sign-in/anonymous", {
|
|
19
15
|
method: "POST";
|
|
20
16
|
metadata: {
|
|
21
17
|
openapi: {
|
|
@@ -54,9 +50,9 @@ declare const anonymous: (options?: AnonymousOptions | undefined) => {
|
|
|
54
50
|
image?: string | null | undefined;
|
|
55
51
|
};
|
|
56
52
|
}>;
|
|
57
|
-
deleteAnonymousUser:
|
|
53
|
+
deleteAnonymousUser: import("better-call").StrictEndpoint<"/delete-anonymous-user", {
|
|
58
54
|
method: "POST";
|
|
59
|
-
use:
|
|
55
|
+
use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
60
56
|
session: {
|
|
61
57
|
session: Record<string, any> & {
|
|
62
58
|
id: string;
|
|
@@ -139,12 +135,12 @@ declare const anonymous: (options?: AnonymousOptions | undefined) => {
|
|
|
139
135
|
};
|
|
140
136
|
hooks: {
|
|
141
137
|
before: {
|
|
142
|
-
matcher(ctx:
|
|
143
|
-
handler:
|
|
138
|
+
matcher(ctx: import("@better-auth/core").HookEndpointContext): boolean;
|
|
139
|
+
handler: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<void>>;
|
|
144
140
|
}[];
|
|
145
141
|
after: {
|
|
146
|
-
matcher(ctx:
|
|
147
|
-
handler:
|
|
142
|
+
matcher(ctx: import("@better-auth/core").HookEndpointContext): boolean;
|
|
143
|
+
handler: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<void>>;
|
|
148
144
|
}[];
|
|
149
145
|
};
|
|
150
146
|
options: AnonymousOptions | undefined;
|
|
@@ -161,15 +157,15 @@ declare const anonymous: (options?: AnonymousOptions | undefined) => {
|
|
|
161
157
|
};
|
|
162
158
|
};
|
|
163
159
|
$ERROR_CODES: {
|
|
164
|
-
FAILED_TO_CREATE_USER:
|
|
165
|
-
INVALID_EMAIL_FORMAT:
|
|
166
|
-
COULD_NOT_CREATE_SESSION:
|
|
167
|
-
ANONYMOUS_USERS_CANNOT_SIGN_IN_AGAIN_ANONYMOUSLY:
|
|
168
|
-
FAILED_TO_DELETE_ANONYMOUS_USER:
|
|
169
|
-
FAILED_TO_DELETE_ANONYMOUS_USER_SESSIONS:
|
|
170
|
-
USER_IS_NOT_ANONYMOUS:
|
|
171
|
-
DELETE_ANONYMOUS_USER_DISABLED:
|
|
160
|
+
FAILED_TO_CREATE_USER: import("@better-auth/core/utils/error-codes").RawError<"FAILED_TO_CREATE_USER">;
|
|
161
|
+
INVALID_EMAIL_FORMAT: import("@better-auth/core/utils/error-codes").RawError<"INVALID_EMAIL_FORMAT">;
|
|
162
|
+
COULD_NOT_CREATE_SESSION: import("@better-auth/core/utils/error-codes").RawError<"COULD_NOT_CREATE_SESSION">;
|
|
163
|
+
ANONYMOUS_USERS_CANNOT_SIGN_IN_AGAIN_ANONYMOUSLY: import("@better-auth/core/utils/error-codes").RawError<"ANONYMOUS_USERS_CANNOT_SIGN_IN_AGAIN_ANONYMOUSLY">;
|
|
164
|
+
FAILED_TO_DELETE_ANONYMOUS_USER: import("@better-auth/core/utils/error-codes").RawError<"FAILED_TO_DELETE_ANONYMOUS_USER">;
|
|
165
|
+
FAILED_TO_DELETE_ANONYMOUS_USER_SESSIONS: import("@better-auth/core/utils/error-codes").RawError<"FAILED_TO_DELETE_ANONYMOUS_USER_SESSIONS">;
|
|
166
|
+
USER_IS_NOT_ANONYMOUS: import("@better-auth/core/utils/error-codes").RawError<"USER_IS_NOT_ANONYMOUS">;
|
|
167
|
+
DELETE_ANONYMOUS_USER_DISABLED: import("@better-auth/core/utils/error-codes").RawError<"DELETE_ANONYMOUS_USER_DISABLED">;
|
|
172
168
|
};
|
|
173
169
|
};
|
|
174
170
|
//#endregion
|
|
175
|
-
export { AnonymousOptions, AnonymousSession, UserWithAnonymous
|
|
171
|
+
export type { AnonymousOptions, AnonymousSession, UserWithAnonymous };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/plugins/anonymous/schema.d.ts
|
|
2
|
-
declare const schema: {
|
|
2
|
+
export declare const schema: {
|
|
3
3
|
user: {
|
|
4
4
|
fields: {
|
|
5
5
|
isAnonymous: {
|
|
@@ -11,5 +11,4 @@ declare const schema: {
|
|
|
11
11
|
};
|
|
12
12
|
};
|
|
13
13
|
};
|
|
14
|
-
//#endregion
|
|
15
|
-
export { schema };
|
|
14
|
+
//#endregion
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Session, User } from "../../types/models.mjs";
|
|
2
2
|
import { InferOptionSchema } from "../../types/plugins.mjs";
|
|
3
|
+
import "../../types/index.mjs";
|
|
3
4
|
import { schema } from "./schema.mjs";
|
|
4
5
|
import { AuthContext, Awaitable, GenericEndpointContext } from "@better-auth/core";
|
|
5
6
|
import { EndpointContext } from "better-call";
|
|
6
|
-
|
|
7
7
|
//#region src/plugins/anonymous/types.d.ts
|
|
8
|
-
type AnonymousSession = {
|
|
8
|
+
export type AnonymousSession = {
|
|
9
9
|
session: Session;
|
|
10
10
|
user: User;
|
|
11
11
|
} & {
|
|
@@ -13,10 +13,10 @@ type AnonymousSession = {
|
|
|
13
13
|
isAnonymous: boolean | null;
|
|
14
14
|
};
|
|
15
15
|
} & Record<string, any>;
|
|
16
|
-
interface UserWithAnonymous extends User {
|
|
16
|
+
export interface UserWithAnonymous extends User {
|
|
17
17
|
isAnonymous: boolean;
|
|
18
18
|
}
|
|
19
|
-
interface AnonymousOptions {
|
|
19
|
+
export interface AnonymousOptions {
|
|
20
20
|
/**
|
|
21
21
|
* Configure a custom domain for anonymous user email addresses.
|
|
22
22
|
* @default "anonymous.placeholder.invalid"
|
|
@@ -61,5 +61,4 @@ interface AnonymousOptions {
|
|
|
61
61
|
*/
|
|
62
62
|
schema?: InferOptionSchema<typeof schema> | undefined;
|
|
63
63
|
}
|
|
64
|
-
//#endregion
|
|
65
|
-
export { AnonymousOptions, AnonymousSession, UserWithAnonymous };
|
|
64
|
+
//#endregion
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import * as _$_better_auth_core0 from "@better-auth/core";
|
|
2
|
-
import * as _$better_call0 from "better-call";
|
|
3
|
-
|
|
4
1
|
//#region src/plugins/bearer/index.d.ts
|
|
5
2
|
declare module "@better-auth/core" {
|
|
6
3
|
interface BetterAuthPluginRegistry<AuthOptions, Options> {
|
|
@@ -9,7 +6,7 @@ declare module "@better-auth/core" {
|
|
|
9
6
|
};
|
|
10
7
|
}
|
|
11
8
|
}
|
|
12
|
-
interface BearerOptions {
|
|
9
|
+
export interface BearerOptions {
|
|
13
10
|
/**
|
|
14
11
|
* If true, only signed tokens
|
|
15
12
|
* will be converted to session
|
|
@@ -22,24 +19,23 @@ interface BearerOptions {
|
|
|
22
19
|
/**
|
|
23
20
|
* Converts bearer token to session cookie
|
|
24
21
|
*/
|
|
25
|
-
declare const bearer: (options?: BearerOptions | undefined) => {
|
|
22
|
+
export declare const bearer: (options?: BearerOptions | undefined) => {
|
|
26
23
|
id: "bearer";
|
|
27
24
|
version: string;
|
|
28
25
|
hooks: {
|
|
29
26
|
before: {
|
|
30
|
-
matcher(context:
|
|
31
|
-
handler:
|
|
27
|
+
matcher(context: import("@better-auth/core").HookEndpointContext): boolean;
|
|
28
|
+
handler: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
32
29
|
context: {
|
|
33
30
|
headers: Headers;
|
|
34
31
|
};
|
|
35
32
|
} | undefined>>;
|
|
36
33
|
}[];
|
|
37
34
|
after: {
|
|
38
|
-
matcher(context:
|
|
39
|
-
handler:
|
|
35
|
+
matcher(context: import("@better-auth/core").HookEndpointContext): true;
|
|
36
|
+
handler: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<void>>;
|
|
40
37
|
}[];
|
|
41
38
|
};
|
|
42
39
|
options: BearerOptions | undefined;
|
|
43
40
|
};
|
|
44
|
-
//#endregion
|
|
45
|
-
export { BearerOptions, bearer };
|
|
41
|
+
//#endregion
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
//#region src/plugins/captcha/constants.d.ts
|
|
2
|
-
declare const Providers: {
|
|
2
|
+
export declare const Providers: {
|
|
3
3
|
readonly CLOUDFLARE_TURNSTILE: "cloudflare-turnstile";
|
|
4
4
|
readonly GOOGLE_RECAPTCHA: "google-recaptcha";
|
|
5
5
|
readonly HCAPTCHA: "hcaptcha";
|
|
6
6
|
readonly CAPTCHAFOX: "captchafox";
|
|
7
7
|
readonly VERCEL_BOTID: "vercel-botid";
|
|
8
8
|
};
|
|
9
|
-
//#endregion
|
|
10
|
-
export { Providers };
|
|
9
|
+
//#endregion
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import { BaseCaptchaOptions, BotIdVerification, CaptchaFoxOptions, CaptchaOptions, CloudflareTurnstileOptions, GoogleRecaptchaOptions, HCaptchaOptions, Provider, ValidateRequestContext, VercelBotIdOptions } from "./types.mjs";
|
|
2
|
-
import * as _$_better_auth_core0 from "@better-auth/core";
|
|
3
|
-
import * as _$_better_auth_core_utils_error_codes0 from "@better-auth/core/utils/error-codes";
|
|
4
|
-
|
|
5
2
|
//#region src/plugins/captcha/index.d.ts
|
|
6
3
|
declare module "@better-auth/core" {
|
|
7
4
|
interface BetterAuthPluginRegistry<AuthOptions, Options> {
|
|
@@ -10,18 +7,18 @@ declare module "@better-auth/core" {
|
|
|
10
7
|
};
|
|
11
8
|
}
|
|
12
9
|
}
|
|
13
|
-
declare const captcha: (options: CaptchaOptions) => {
|
|
10
|
+
export declare const captcha: (options: CaptchaOptions) => {
|
|
14
11
|
id: "captcha";
|
|
15
12
|
version: string;
|
|
16
13
|
$ERROR_CODES: {
|
|
17
|
-
VERIFICATION_FAILED:
|
|
18
|
-
MISSING_RESPONSE:
|
|
19
|
-
UNKNOWN_ERROR:
|
|
14
|
+
VERIFICATION_FAILED: import("@better-auth/core/utils/error-codes").RawError<"VERIFICATION_FAILED">;
|
|
15
|
+
MISSING_RESPONSE: import("@better-auth/core/utils/error-codes").RawError<"MISSING_RESPONSE">;
|
|
16
|
+
UNKNOWN_ERROR: import("@better-auth/core/utils/error-codes").RawError<"UNKNOWN_ERROR">;
|
|
20
17
|
};
|
|
21
|
-
onRequest: (request: Request, ctx:
|
|
18
|
+
onRequest: (request: Request, ctx: import("@better-auth/core").AuthContext) => Promise<{
|
|
22
19
|
response: Response;
|
|
23
20
|
} | undefined>;
|
|
24
21
|
options: CaptchaOptions;
|
|
25
22
|
};
|
|
26
23
|
//#endregion
|
|
27
|
-
export { BaseCaptchaOptions, BotIdVerification, CaptchaFoxOptions, CaptchaOptions, CloudflareTurnstileOptions, GoogleRecaptchaOptions, HCaptchaOptions, Provider, ValidateRequestContext, VercelBotIdOptions
|
|
24
|
+
export type { BaseCaptchaOptions, BotIdVerification, CaptchaFoxOptions, CaptchaOptions, CloudflareTurnstileOptions, GoogleRecaptchaOptions, HCaptchaOptions, Provider, ValidateRequestContext, VercelBotIdOptions };
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { Providers } from "./constants.mjs";
|
|
2
|
-
|
|
3
2
|
//#region src/plugins/captcha/types.d.ts
|
|
4
|
-
type Provider = (typeof Providers)[keyof typeof Providers];
|
|
5
|
-
interface BaseCaptchaOptions {
|
|
3
|
+
export type Provider = (typeof Providers)[keyof typeof Providers];
|
|
4
|
+
export interface BaseCaptchaOptions {
|
|
6
5
|
secretKey: string;
|
|
7
6
|
/**
|
|
8
7
|
* Paths where captcha verification is enforced. Paths match exactly unless
|
|
@@ -11,7 +10,7 @@ interface BaseCaptchaOptions {
|
|
|
11
10
|
endpoints?: string[] | undefined;
|
|
12
11
|
siteVerifyURLOverride?: string | undefined;
|
|
13
12
|
}
|
|
14
|
-
interface GoogleRecaptchaOptions extends BaseCaptchaOptions {
|
|
13
|
+
export interface GoogleRecaptchaOptions extends BaseCaptchaOptions {
|
|
15
14
|
provider: typeof Providers.GOOGLE_RECAPTCHA;
|
|
16
15
|
minScore?: number | undefined;
|
|
17
16
|
/**
|
|
@@ -26,7 +25,7 @@ interface GoogleRecaptchaOptions extends BaseCaptchaOptions {
|
|
|
26
25
|
*/
|
|
27
26
|
allowedHostnames?: string[] | undefined;
|
|
28
27
|
}
|
|
29
|
-
interface CloudflareTurnstileOptions extends BaseCaptchaOptions {
|
|
28
|
+
export interface CloudflareTurnstileOptions extends BaseCaptchaOptions {
|
|
30
29
|
provider: typeof Providers.CLOUDFLARE_TURNSTILE;
|
|
31
30
|
/**
|
|
32
31
|
* Expected Turnstile `action`. When set, a verification whose action does
|
|
@@ -39,11 +38,11 @@ interface CloudflareTurnstileOptions extends BaseCaptchaOptions {
|
|
|
39
38
|
*/
|
|
40
39
|
allowedHostnames?: string[] | undefined;
|
|
41
40
|
}
|
|
42
|
-
interface HCaptchaOptions extends BaseCaptchaOptions {
|
|
41
|
+
export interface HCaptchaOptions extends BaseCaptchaOptions {
|
|
43
42
|
provider: typeof Providers.HCAPTCHA;
|
|
44
43
|
siteKey?: string | undefined;
|
|
45
44
|
}
|
|
46
|
-
interface CaptchaFoxOptions extends BaseCaptchaOptions {
|
|
45
|
+
export interface CaptchaFoxOptions extends BaseCaptchaOptions {
|
|
47
46
|
provider: typeof Providers.CAPTCHAFOX;
|
|
48
47
|
siteKey?: string | undefined;
|
|
49
48
|
}
|
|
@@ -52,13 +51,13 @@ interface CaptchaFoxOptions extends BaseCaptchaOptions {
|
|
|
52
51
|
*
|
|
53
52
|
* @see https://vercel.com/docs/botid/verified-bots
|
|
54
53
|
*/
|
|
55
|
-
type BotIdVerification = {
|
|
54
|
+
export type BotIdVerification = {
|
|
56
55
|
isBot: boolean;
|
|
57
56
|
isVerifiedBot?: boolean | undefined;
|
|
58
57
|
verifiedBotName?: string | undefined;
|
|
59
58
|
verifiedBotCategory?: string | undefined;
|
|
60
59
|
};
|
|
61
|
-
type ValidateRequestContext = {
|
|
60
|
+
export type ValidateRequestContext = {
|
|
62
61
|
request: Request;
|
|
63
62
|
verification: BotIdVerification;
|
|
64
63
|
};
|
|
@@ -68,7 +67,7 @@ type ValidateRequestContext = {
|
|
|
68
67
|
*
|
|
69
68
|
* @see https://vercel.com/docs/botid/get-started
|
|
70
69
|
*/
|
|
71
|
-
interface VercelBotIdOptions {
|
|
70
|
+
export interface VercelBotIdOptions {
|
|
72
71
|
provider: typeof Providers.VERCEL_BOTID;
|
|
73
72
|
/**
|
|
74
73
|
* Auth paths to verify, without the Better Auth base path.
|
|
@@ -89,6 +88,5 @@ interface VercelBotIdOptions {
|
|
|
89
88
|
*/
|
|
90
89
|
validateRequest?: (ctx: ValidateRequestContext) => boolean | Promise<boolean>;
|
|
91
90
|
}
|
|
92
|
-
type CaptchaOptions = GoogleRecaptchaOptions | CloudflareTurnstileOptions | HCaptchaOptions | CaptchaFoxOptions | VercelBotIdOptions;
|
|
93
|
-
//#endregion
|
|
94
|
-
export { BaseCaptchaOptions, BotIdVerification, CaptchaFoxOptions, CaptchaOptions, CloudflareTurnstileOptions, GoogleRecaptchaOptions, HCaptchaOptions, Provider, ValidateRequestContext, VercelBotIdOptions };
|
|
91
|
+
export type CaptchaOptions = GoogleRecaptchaOptions | CloudflareTurnstileOptions | HCaptchaOptions | CaptchaFoxOptions | VercelBotIdOptions;
|
|
92
|
+
//#endregion
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { BetterAuthOptions } from "../../types/index.mjs";
|
|
2
2
|
import { Auth } from "better-auth";
|
|
3
|
-
|
|
4
3
|
//#region src/plugins/custom-session/client.d.ts
|
|
5
|
-
declare const customSessionClient: <A extends Auth | {
|
|
4
|
+
export declare const customSessionClient: <A extends Auth | {
|
|
6
5
|
options: BetterAuthOptions;
|
|
7
6
|
}>() => {
|
|
8
7
|
id: "infer-server-plugin";
|
|
@@ -13,5 +12,4 @@ declare const customSessionClient: <A extends Auth | {
|
|
|
13
12
|
id: "custom-session";
|
|
14
13
|
} ? P : never : never;
|
|
15
14
|
};
|
|
16
|
-
//#endregion
|
|
17
|
-
export { customSessionClient };
|
|
15
|
+
//#endregion
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
import * as _$_better_auth_core0 from "@better-auth/core";
|
|
2
1
|
import { BetterAuthOptions, GenericEndpointContext } from "@better-auth/core";
|
|
3
2
|
import { Session, User } from "@better-auth/core/db";
|
|
4
|
-
import * as _$better_call0 from "better-call";
|
|
5
|
-
import * as _$zod from "zod";
|
|
6
|
-
import * as _$zod_v4_core0 from "zod/v4/core";
|
|
7
|
-
|
|
8
3
|
//#region src/plugins/custom-session/index.d.ts
|
|
9
4
|
declare module "@better-auth/core" {
|
|
10
5
|
interface BetterAuthPluginRegistry<AuthOptions, Options> {
|
|
@@ -13,14 +8,14 @@ declare module "@better-auth/core" {
|
|
|
13
8
|
};
|
|
14
9
|
}
|
|
15
10
|
}
|
|
16
|
-
type CustomSessionPluginOptions = {
|
|
11
|
+
export type CustomSessionPluginOptions = {
|
|
17
12
|
/**
|
|
18
13
|
* This option is used to determine if the list-device-sessions endpoint should be mutated to the custom session data.
|
|
19
14
|
* @default false
|
|
20
15
|
*/
|
|
21
16
|
shouldMutateListDeviceSessionsEndpoint?: boolean | undefined;
|
|
22
17
|
};
|
|
23
|
-
declare const customSession: <Returns extends Record<string, any>, O extends BetterAuthOptions = BetterAuthOptions>(fn: (session: {
|
|
18
|
+
export declare const customSession: <Returns extends Record<string, any>, O extends BetterAuthOptions = BetterAuthOptions>(fn: (session: {
|
|
24
19
|
user: User<O["user"], O["plugins"]>;
|
|
25
20
|
session: Session<O["session"], O["plugins"]>;
|
|
26
21
|
}, ctx: GenericEndpointContext) => Promise<Returns>, options?: O | undefined, pluginOptions?: CustomSessionPluginOptions | undefined) => {
|
|
@@ -28,17 +23,17 @@ declare const customSession: <Returns extends Record<string, any>, O extends Bet
|
|
|
28
23
|
version: string;
|
|
29
24
|
hooks: {
|
|
30
25
|
after: {
|
|
31
|
-
matcher: (ctx:
|
|
32
|
-
handler:
|
|
26
|
+
matcher: (ctx: import("@better-auth/core").HookEndpointContext) => boolean;
|
|
27
|
+
handler: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<Awaited<Returns>[] | undefined>>;
|
|
33
28
|
}[];
|
|
34
29
|
};
|
|
35
30
|
endpoints: {
|
|
36
|
-
getSession:
|
|
31
|
+
getSession: import("better-call").StrictEndpoint<"/get-session", {
|
|
37
32
|
method: "GET";
|
|
38
|
-
query:
|
|
39
|
-
disableCookieCache:
|
|
40
|
-
disableRefresh:
|
|
41
|
-
},
|
|
33
|
+
query: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
34
|
+
disableCookieCache: import("zod").ZodOptional<import("zod").ZodCoercedBoolean<unknown>>;
|
|
35
|
+
disableRefresh: import("zod").ZodOptional<import("zod").ZodCoercedBoolean<unknown>>;
|
|
36
|
+
}, import("zod/v4/core").$strip>>;
|
|
42
37
|
metadata: {
|
|
43
38
|
CUSTOM_SESSION: boolean;
|
|
44
39
|
openapi: {
|
|
@@ -69,5 +64,4 @@ declare const customSession: <Returns extends Record<string, any>, O extends Bet
|
|
|
69
64
|
};
|
|
70
65
|
options: CustomSessionPluginOptions | undefined;
|
|
71
66
|
};
|
|
72
|
-
//#endregion
|
|
73
|
-
export { CustomSessionPluginOptions, customSession };
|
|
67
|
+
//#endregion
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { DeviceAuthorizationGrant, deviceAuthorization } from "./index.mjs";
|
|
2
|
-
|
|
3
2
|
//#region src/plugins/device-authorization/client.d.ts
|
|
4
|
-
declare const deviceAuthorizationClient: <Grant extends DeviceAuthorizationGrant | undefined = undefined>() => {
|
|
3
|
+
export declare const deviceAuthorizationClient: <Grant extends DeviceAuthorizationGrant | undefined = undefined>() => {
|
|
5
4
|
id: "device-authorization";
|
|
6
5
|
version: string;
|
|
7
6
|
$InferServerPlugin: ReturnType<typeof deviceAuthorization<Grant>>;
|
|
@@ -13,5 +12,4 @@ declare const deviceAuthorizationClient: <Grant extends DeviceAuthorizationGrant
|
|
|
13
12
|
"/device/deny": "POST";
|
|
14
13
|
};
|
|
15
14
|
};
|
|
16
|
-
//#endregion
|
|
17
|
-
export { deviceAuthorizationClient };
|
|
15
|
+
//#endregion
|