better-auth 1.6.27 → 1.6.28
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 +6 -1
- package/dist/api/dispatch.d.mts +1 -0
- package/dist/api/index.d.mts +474 -472
- package/dist/api/middlewares/authorization.d.mts +8 -12
- package/dist/api/middlewares/authorization.mjs +1 -2
- package/dist/api/middlewares/index.d.mts +1 -2
- package/dist/api/middlewares/origin-check.d.mts +5 -3
- package/dist/api/routes/account.d.mts +13 -10
- package/dist/api/routes/callback.d.mts +3 -1
- package/dist/api/routes/email-verification.d.mts +8 -4
- package/dist/api/routes/error.d.mts +3 -1
- package/dist/api/routes/index.d.mts +1 -2
- package/dist/api/routes/ok.d.mts +3 -1
- package/dist/api/routes/password.d.mts +9 -7
- package/dist/api/routes/session.d.mts +24 -22
- package/dist/api/routes/sign-in.d.mts +5 -3
- package/dist/api/routes/sign-out.d.mts +3 -1
- package/dist/api/routes/sign-up.d.mts +4 -3
- package/dist/api/routes/update-session.d.mts +4 -3
- package/dist/api/routes/update-user.d.mts +14 -13
- package/dist/auth/full.d.mts +1 -1
- package/dist/auth/minimal.d.mts +1 -1
- package/dist/client/config.d.mts +14 -12
- package/dist/client/config.mjs +2 -2
- package/dist/client/equality.d.mts +1 -0
- package/dist/client/index.d.mts +5 -6
- package/dist/client/lynx/index.d.mts +5 -4
- package/dist/client/lynx/lynx-store.d.mts +2 -1
- package/dist/client/parser.d.mts +3 -7
- package/dist/client/path-to-object.d.mts +4 -3
- package/dist/client/plugins/index.d.mts +1 -1
- package/dist/client/plugins/infer-plugin.d.mts +1 -0
- package/dist/client/query.d.mts +1 -0
- package/dist/client/react/index.d.mts +5 -4
- package/dist/client/react/react-store.d.mts +2 -1
- package/dist/client/session-atom.mjs +41 -17
- package/dist/client/session-refresh.d.mts +1 -0
- package/dist/client/solid/index.d.mts +5 -4
- package/dist/client/svelte/index.d.mts +5 -4
- package/dist/client/types.d.mts +2 -2
- package/dist/client/vanilla.d.mts +2 -1
- package/dist/client/vue/index.d.mts +5 -4
- package/dist/context/create-context.mjs +3 -3
- package/dist/context/helpers.mjs +2 -2
- package/dist/cookies/index.d.mts +7 -6
- package/dist/cookies/session-store.d.mts +0 -1
- package/dist/cookies/session-store.mjs +1 -2
- package/dist/crypto/index.d.mts +9 -2
- package/dist/crypto/jwt.d.mts +1 -0
- package/dist/crypto/password.d.mts +5 -1
- package/dist/db/adapter-base.d.mts +1 -0
- package/dist/db/adapter-kysely.d.mts +1 -0
- package/dist/db/field-converter.d.mts +1 -0
- package/dist/db/field.d.mts +10 -9
- package/dist/db/get-migration.d.mts +1 -0
- package/dist/db/get-schema.d.mts +1 -0
- package/dist/db/internal-adapter.d.mts +1 -0
- package/dist/db/internal-adapter.mjs +1 -2
- package/dist/db/revoke-unproven-account-access.d.mts +1 -0
- package/dist/db/schema.d.mts +2 -2
- package/dist/db/to-zod.d.mts +7 -3
- package/dist/db/with-hooks.d.mts +1 -0
- package/dist/index.d.mts +3 -4
- package/dist/integrations/next-js.d.mts +7 -4
- package/dist/integrations/node.d.mts +3 -2
- package/dist/integrations/svelte-kit.d.mts +9 -2
- package/dist/integrations/tanstack-start-solid.d.mts +5 -2
- package/dist/integrations/tanstack-start.d.mts +5 -2
- package/dist/oauth2/link-account.d.mts +1 -1
- package/dist/oauth2/state.d.mts +1 -0
- package/dist/oauth2/utils.d.mts +1 -0
- package/dist/package.mjs +1 -1
- package/dist/plugins/access/access.d.mts +1 -0
- package/dist/plugins/access/types.d.mts +5 -4
- package/dist/plugins/additional-fields/client.d.mts +1 -0
- package/dist/plugins/admin/access/statement.d.mts +0 -1
- package/dist/plugins/admin/admin.d.mts +125 -120
- package/dist/plugins/admin/client.d.mts +30 -30
- package/dist/plugins/admin/client.mjs +1 -1
- package/dist/plugins/admin/error-codes.d.mts +25 -23
- package/dist/plugins/admin/index.d.mts +1 -1
- package/dist/plugins/admin/schema.d.mts +1 -1
- package/dist/plugins/admin/types.d.mts +2 -3
- package/dist/plugins/anonymous/client.d.mts +11 -9
- package/dist/plugins/anonymous/client.mjs +1 -1
- package/dist/plugins/anonymous/error-codes.d.mts +10 -8
- package/dist/plugins/anonymous/index.d.mts +18 -14
- package/dist/plugins/anonymous/types.d.mts +1 -1
- package/dist/plugins/bearer/index.d.mts +7 -4
- package/dist/plugins/captcha/index.d.mts +8 -5
- package/dist/plugins/captcha/types.d.mts +1 -0
- package/dist/plugins/custom-session/client.d.mts +1 -0
- package/dist/plugins/custom-session/index.d.mts +12 -7
- package/dist/plugins/device-authorization/client.d.mts +1 -0
- package/dist/plugins/device-authorization/index.d.mts +22 -19
- package/dist/plugins/email-otp/client.d.mts +6 -4
- package/dist/plugins/email-otp/client.mjs +1 -1
- package/dist/plugins/email-otp/error-codes.d.mts +5 -3
- package/dist/plugins/email-otp/index.d.mts +74 -67
- package/dist/plugins/email-otp/types.d.mts +1 -0
- package/dist/plugins/generic-oauth/client.d.mts +11 -10
- package/dist/plugins/generic-oauth/client.mjs +1 -1
- package/dist/plugins/generic-oauth/error-codes.d.mts +10 -8
- package/dist/plugins/generic-oauth/index.d.mts +44 -40
- package/dist/plugins/generic-oauth/providers/auth0.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/gumroad.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/hubspot.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/index.d.mts +1 -2
- package/dist/plugins/generic-oauth/providers/keycloak.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/line.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/microsoft-entra-id.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/okta.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/patreon.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/slack.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/yandex.d.mts +1 -0
- package/dist/plugins/generic-oauth/types.d.mts +2 -1
- package/dist/plugins/haveibeenpwned/index.d.mts +6 -3
- package/dist/plugins/index.d.mts +1 -4
- package/dist/plugins/jwt/client.d.mts +2 -1
- package/dist/plugins/jwt/index.d.mts +11 -8
- package/dist/plugins/jwt/sign.d.mts +2 -2
- package/dist/plugins/jwt/types.d.mts +1 -1
- package/dist/plugins/jwt/utils.d.mts +4 -2
- package/dist/plugins/jwt/verify.d.mts +1 -0
- package/dist/plugins/last-login-method/index.d.mts +5 -2
- package/dist/plugins/magic-link/client.d.mts +1 -0
- package/dist/plugins/magic-link/index.d.mts +6 -4
- package/dist/plugins/mcp/client/adapters.d.mts +1 -0
- package/dist/plugins/mcp/client/index.mjs +2 -4
- package/dist/plugins/mcp/index.d.mts +11 -10
- package/dist/plugins/multi-session/client.d.mts +4 -2
- package/dist/plugins/multi-session/client.mjs +1 -1
- package/dist/plugins/multi-session/error-codes.d.mts +3 -1
- package/dist/plugins/multi-session/index.d.mts +11 -7
- package/dist/plugins/oauth-popup/client.d.mts +12 -6
- package/dist/plugins/oauth-popup/client.mjs +3 -5
- package/dist/plugins/oauth-popup/error-codes.d.mts +6 -4
- package/dist/plugins/oauth-popup/index.d.mts +12 -8
- package/dist/plugins/oauth-popup/index.mjs +1 -1
- package/dist/plugins/oauth-popup/types.d.mts +2 -1
- package/dist/plugins/oauth-proxy/index.d.mts +9 -6
- package/dist/plugins/oauth-proxy/index.mjs +2 -2
- package/dist/plugins/oidc-provider/client.d.mts +2 -1
- package/dist/plugins/oidc-provider/index.d.mts +17 -15
- package/dist/plugins/oidc-provider/schema.d.mts +1 -0
- package/dist/plugins/oidc-provider/types.d.mts +1 -1
- package/dist/plugins/one-tap/client.d.mts +3 -1
- package/dist/plugins/one-tap/index.d.mts +3 -1
- package/dist/plugins/one-time-token/client.d.mts +2 -1
- package/dist/plugins/one-time-token/index.d.mts +6 -5
- package/dist/plugins/open-api/generator.d.mts +1 -0
- package/dist/plugins/open-api/generator.mjs +5 -5
- package/dist/plugins/open-api/index.d.mts +5 -3
- package/dist/plugins/organization/access/statement.d.mts +0 -1
- package/dist/plugins/organization/adapter.d.mts +82 -56
- package/dist/plugins/organization/client.d.mts +103 -104
- package/dist/plugins/organization/client.mjs +4 -7
- package/dist/plugins/organization/error-codes.d.mts +61 -59
- package/dist/plugins/organization/has-permission.d.mts +1 -0
- 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 +9 -9
- package/dist/plugins/organization/organization.mjs +1 -1
- package/dist/plugins/organization/permission.d.mts +2 -2
- package/dist/plugins/organization/routes/crud-access-control.d.mts +27 -27
- package/dist/plugins/organization/routes/crud-invites.d.mts +64 -63
- package/dist/plugins/organization/routes/crud-invites.mjs +1 -1
- package/dist/plugins/organization/routes/crud-members.d.mts +56 -54
- package/dist/plugins/organization/routes/crud-members.mjs +1 -1
- package/dist/plugins/organization/routes/crud-org.d.mts +54 -53
- package/dist/plugins/organization/routes/crud-team.d.mts +65 -64
- package/dist/plugins/organization/schema.d.mts +4 -4
- package/dist/plugins/organization/schema.mjs +1 -1
- package/dist/plugins/organization/types.d.mts +14 -14
- package/dist/plugins/phone-number/client.d.mts +15 -13
- package/dist/plugins/phone-number/client.mjs +1 -1
- package/dist/plugins/phone-number/error-codes.d.mts +14 -12
- package/dist/plugins/phone-number/index.d.mts +47 -41
- package/dist/plugins/phone-number/types.d.mts +1 -1
- package/dist/plugins/siwe/client.d.mts +1 -0
- package/dist/plugins/siwe/index.d.mts +5 -4
- package/dist/plugins/test-utils/index.d.mts +4 -2
- package/dist/plugins/test-utils/types.d.mts +0 -1
- package/dist/plugins/two-factor/backup-codes/index.d.mts +6 -4
- package/dist/plugins/two-factor/backup-codes/index.mjs +1 -1
- package/dist/plugins/two-factor/client.d.mts +15 -12
- package/dist/plugins/two-factor/client.mjs +1 -1
- package/dist/plugins/two-factor/error-code.d.mts +12 -10
- package/dist/plugins/two-factor/index.d.mts +31 -27
- package/dist/plugins/two-factor/otp/index.d.mts +4 -2
- package/dist/plugins/two-factor/totp/index.d.mts +6 -4
- package/dist/plugins/two-factor/types.d.mts +1 -1
- package/dist/plugins/username/client.d.mts +11 -9
- package/dist/plugins/username/client.mjs +1 -1
- package/dist/plugins/username/error-codes.d.mts +10 -8
- package/dist/plugins/username/index.d.mts +22 -17
- package/dist/plugins/username/schema.d.mts +5 -3
- package/dist/state.d.mts +1 -0
- package/dist/test-utils/test-instance.d.mts +3 -5
- package/dist/types/adapter.d.mts +1 -1
- package/dist/types/api.d.mts +2 -1
- package/dist/types/auth.d.mts +1 -0
- package/dist/types/helper.d.mts +5 -5
- package/dist/types/index.d.mts +2 -2
- package/dist/types/models.d.mts +1 -0
- package/dist/types/plugins.d.mts +3 -2
- package/dist/utils/index.d.mts +1 -2
- package/dist/utils/url.d.mts +1 -0
- package/package.json +10 -10
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { USERNAME_ERROR_CODES } from "./error-codes.mjs";
|
|
2
2
|
import { username } from "./index.mjs";
|
|
3
|
+
import * as _$_better_auth_core_utils_error_codes0 from "@better-auth/core/utils/error-codes";
|
|
4
|
+
|
|
3
5
|
//#region src/plugins/username/client.d.ts
|
|
4
6
|
declare const usernameClient: () => {
|
|
5
7
|
id: "username";
|
|
@@ -10,15 +12,15 @@ declare const usernameClient: () => {
|
|
|
10
12
|
signal: "$sessionSignal";
|
|
11
13
|
}[];
|
|
12
14
|
$ERROR_CODES: {
|
|
13
|
-
EMAIL_NOT_VERIFIED:
|
|
14
|
-
UNEXPECTED_ERROR:
|
|
15
|
-
INVALID_USERNAME_OR_PASSWORD:
|
|
16
|
-
USERNAME_IS_ALREADY_TAKEN:
|
|
17
|
-
USERNAME_TOO_SHORT:
|
|
18
|
-
USERNAME_TOO_LONG:
|
|
19
|
-
INVALID_USERNAME:
|
|
20
|
-
INVALID_DISPLAY_USERNAME:
|
|
15
|
+
EMAIL_NOT_VERIFIED: _$_better_auth_core_utils_error_codes0.RawError<"EMAIL_NOT_VERIFIED">;
|
|
16
|
+
UNEXPECTED_ERROR: _$_better_auth_core_utils_error_codes0.RawError<"UNEXPECTED_ERROR">;
|
|
17
|
+
INVALID_USERNAME_OR_PASSWORD: _$_better_auth_core_utils_error_codes0.RawError<"INVALID_USERNAME_OR_PASSWORD">;
|
|
18
|
+
USERNAME_IS_ALREADY_TAKEN: _$_better_auth_core_utils_error_codes0.RawError<"USERNAME_IS_ALREADY_TAKEN">;
|
|
19
|
+
USERNAME_TOO_SHORT: _$_better_auth_core_utils_error_codes0.RawError<"USERNAME_TOO_SHORT">;
|
|
20
|
+
USERNAME_TOO_LONG: _$_better_auth_core_utils_error_codes0.RawError<"USERNAME_TOO_LONG">;
|
|
21
|
+
INVALID_USERNAME: _$_better_auth_core_utils_error_codes0.RawError<"INVALID_USERNAME">;
|
|
22
|
+
INVALID_DISPLAY_USERNAME: _$_better_auth_core_utils_error_codes0.RawError<"INVALID_DISPLAY_USERNAME">;
|
|
21
23
|
};
|
|
22
24
|
};
|
|
23
25
|
//#endregion
|
|
24
|
-
export {
|
|
26
|
+
export { usernameClient };
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
+
import * as _$_better_auth_core_utils_error_codes0 from "@better-auth/core/utils/error-codes";
|
|
2
|
+
|
|
1
3
|
//#region src/plugins/username/error-codes.d.ts
|
|
2
4
|
declare const USERNAME_ERROR_CODES: {
|
|
3
|
-
EMAIL_NOT_VERIFIED:
|
|
4
|
-
UNEXPECTED_ERROR:
|
|
5
|
-
INVALID_USERNAME_OR_PASSWORD:
|
|
6
|
-
USERNAME_IS_ALREADY_TAKEN:
|
|
7
|
-
USERNAME_TOO_SHORT:
|
|
8
|
-
USERNAME_TOO_LONG:
|
|
9
|
-
INVALID_USERNAME:
|
|
10
|
-
INVALID_DISPLAY_USERNAME:
|
|
5
|
+
EMAIL_NOT_VERIFIED: _$_better_auth_core_utils_error_codes0.RawError<"EMAIL_NOT_VERIFIED">;
|
|
6
|
+
UNEXPECTED_ERROR: _$_better_auth_core_utils_error_codes0.RawError<"UNEXPECTED_ERROR">;
|
|
7
|
+
INVALID_USERNAME_OR_PASSWORD: _$_better_auth_core_utils_error_codes0.RawError<"INVALID_USERNAME_OR_PASSWORD">;
|
|
8
|
+
USERNAME_IS_ALREADY_TAKEN: _$_better_auth_core_utils_error_codes0.RawError<"USERNAME_IS_ALREADY_TAKEN">;
|
|
9
|
+
USERNAME_TOO_SHORT: _$_better_auth_core_utils_error_codes0.RawError<"USERNAME_TOO_SHORT">;
|
|
10
|
+
USERNAME_TOO_LONG: _$_better_auth_core_utils_error_codes0.RawError<"USERNAME_TOO_LONG">;
|
|
11
|
+
INVALID_USERNAME: _$_better_auth_core_utils_error_codes0.RawError<"INVALID_USERNAME">;
|
|
12
|
+
INVALID_DISPLAY_USERNAME: _$_better_auth_core_utils_error_codes0.RawError<"INVALID_DISPLAY_USERNAME">;
|
|
11
13
|
};
|
|
12
14
|
//#endregion
|
|
13
15
|
export { USERNAME_ERROR_CODES };
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { InferOptionSchema } from "../../types/plugins.mjs";
|
|
2
2
|
import { UsernameSchema } from "./schema.mjs";
|
|
3
3
|
import { USERNAME_ERROR_CODES } from "./error-codes.mjs";
|
|
4
|
+
import * as _$_better_auth_core0 from "@better-auth/core";
|
|
5
|
+
import * as _$_better_auth_core_db0 from "@better-auth/core/db";
|
|
6
|
+
import * as _$_better_auth_core_utils_error_codes0 from "@better-auth/core/utils/error-codes";
|
|
7
|
+
import * as _$better_call0 from "better-call";
|
|
4
8
|
import * as z from "zod";
|
|
9
|
+
|
|
5
10
|
//#region src/plugins/username/index.d.ts
|
|
6
11
|
declare module "@better-auth/core" {
|
|
7
12
|
interface BetterAuthPluginRegistry<AuthOptions, Options> {
|
|
@@ -71,7 +76,7 @@ type UsernameOptions = {
|
|
|
71
76
|
declare const username: (options?: UsernameOptions | undefined) => {
|
|
72
77
|
id: "username";
|
|
73
78
|
version: string;
|
|
74
|
-
init(ctx:
|
|
79
|
+
init(ctx: _$_better_auth_core0.AuthContext): {
|
|
75
80
|
options: {
|
|
76
81
|
databaseHooks: {
|
|
77
82
|
user: {
|
|
@@ -84,7 +89,7 @@ declare const username: (options?: UsernameOptions | undefined) => {
|
|
|
84
89
|
emailVerified: boolean;
|
|
85
90
|
name: string;
|
|
86
91
|
image?: string | null | undefined;
|
|
87
|
-
} & Record<string, unknown>, context:
|
|
92
|
+
} & Record<string, unknown>, context: _$_better_auth_core0.GenericEndpointContext | null): Promise<{
|
|
88
93
|
data: {
|
|
89
94
|
username: string;
|
|
90
95
|
displayUsername: string;
|
|
@@ -118,7 +123,7 @@ declare const username: (options?: UsernameOptions | undefined) => {
|
|
|
118
123
|
emailVerified: boolean;
|
|
119
124
|
name: string;
|
|
120
125
|
image?: string | null | undefined;
|
|
121
|
-
}> & Record<string, unknown>, context:
|
|
126
|
+
}> & Record<string, unknown>, context: _$_better_auth_core0.GenericEndpointContext | null): Promise<{
|
|
122
127
|
data: {
|
|
123
128
|
displayUsername?: string | undefined;
|
|
124
129
|
username: string;
|
|
@@ -148,7 +153,7 @@ declare const username: (options?: UsernameOptions | undefined) => {
|
|
|
148
153
|
};
|
|
149
154
|
};
|
|
150
155
|
endpoints: {
|
|
151
|
-
signInUsername:
|
|
156
|
+
signInUsername: _$better_call0.StrictEndpoint<"/sign-in/username", {
|
|
152
157
|
method: "POST";
|
|
153
158
|
body: z.ZodObject<{
|
|
154
159
|
username: z.ZodString;
|
|
@@ -225,7 +230,7 @@ declare const username: (options?: UsernameOptions | undefined) => {
|
|
|
225
230
|
displayUsername: string;
|
|
226
231
|
};
|
|
227
232
|
}>;
|
|
228
|
-
isUsernameAvailable:
|
|
233
|
+
isUsernameAvailable: _$better_call0.StrictEndpoint<"/is-username-available", {
|
|
229
234
|
method: "POST";
|
|
230
235
|
body: z.ZodObject<{
|
|
231
236
|
username: z.ZodString;
|
|
@@ -244,14 +249,14 @@ declare const username: (options?: UsernameOptions | undefined) => {
|
|
|
244
249
|
unique: true;
|
|
245
250
|
returned: true;
|
|
246
251
|
transform: {
|
|
247
|
-
input(value:
|
|
252
|
+
input(value: _$_better_auth_core_db0.DBPrimitive): string | number | boolean | Date | Record<string, unknown> | unknown[] | null | undefined;
|
|
248
253
|
};
|
|
249
254
|
};
|
|
250
255
|
displayUsername: {
|
|
251
256
|
type: "string";
|
|
252
257
|
required: false;
|
|
253
258
|
transform: {
|
|
254
|
-
input(value:
|
|
259
|
+
input(value: _$_better_auth_core_db0.DBPrimitive): string | number | boolean | Date | Record<string, unknown> | unknown[] | null | undefined;
|
|
255
260
|
};
|
|
256
261
|
};
|
|
257
262
|
};
|
|
@@ -259,20 +264,20 @@ declare const username: (options?: UsernameOptions | undefined) => {
|
|
|
259
264
|
};
|
|
260
265
|
hooks: {
|
|
261
266
|
before: {
|
|
262
|
-
matcher(context:
|
|
263
|
-
handler:
|
|
267
|
+
matcher(context: _$_better_auth_core0.HookEndpointContext): boolean;
|
|
268
|
+
handler: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<void>>;
|
|
264
269
|
}[];
|
|
265
270
|
};
|
|
266
271
|
options: UsernameOptions | undefined;
|
|
267
272
|
$ERROR_CODES: {
|
|
268
|
-
EMAIL_NOT_VERIFIED:
|
|
269
|
-
UNEXPECTED_ERROR:
|
|
270
|
-
INVALID_USERNAME_OR_PASSWORD:
|
|
271
|
-
USERNAME_IS_ALREADY_TAKEN:
|
|
272
|
-
USERNAME_TOO_SHORT:
|
|
273
|
-
USERNAME_TOO_LONG:
|
|
274
|
-
INVALID_USERNAME:
|
|
275
|
-
INVALID_DISPLAY_USERNAME:
|
|
273
|
+
EMAIL_NOT_VERIFIED: _$_better_auth_core_utils_error_codes0.RawError<"EMAIL_NOT_VERIFIED">;
|
|
274
|
+
UNEXPECTED_ERROR: _$_better_auth_core_utils_error_codes0.RawError<"UNEXPECTED_ERROR">;
|
|
275
|
+
INVALID_USERNAME_OR_PASSWORD: _$_better_auth_core_utils_error_codes0.RawError<"INVALID_USERNAME_OR_PASSWORD">;
|
|
276
|
+
USERNAME_IS_ALREADY_TAKEN: _$_better_auth_core_utils_error_codes0.RawError<"USERNAME_IS_ALREADY_TAKEN">;
|
|
277
|
+
USERNAME_TOO_SHORT: _$_better_auth_core_utils_error_codes0.RawError<"USERNAME_TOO_SHORT">;
|
|
278
|
+
USERNAME_TOO_LONG: _$_better_auth_core_utils_error_codes0.RawError<"USERNAME_TOO_LONG">;
|
|
279
|
+
INVALID_USERNAME: _$_better_auth_core_utils_error_codes0.RawError<"INVALID_USERNAME">;
|
|
280
|
+
INVALID_DISPLAY_USERNAME: _$_better_auth_core_utils_error_codes0.RawError<"INVALID_DISPLAY_USERNAME">;
|
|
276
281
|
};
|
|
277
282
|
};
|
|
278
283
|
//#endregion
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import * as _$_better_auth_core_db0 from "@better-auth/core/db";
|
|
2
|
+
|
|
1
3
|
//#region src/plugins/username/schema.d.ts
|
|
2
4
|
declare const getSchema: (normalizer: {
|
|
3
5
|
username: (username: string) => string;
|
|
@@ -12,14 +14,14 @@ declare const getSchema: (normalizer: {
|
|
|
12
14
|
unique: true;
|
|
13
15
|
returned: true;
|
|
14
16
|
transform: {
|
|
15
|
-
input(value:
|
|
17
|
+
input(value: _$_better_auth_core_db0.DBPrimitive): string | number | boolean | Date | Record<string, unknown> | unknown[] | null | undefined;
|
|
16
18
|
};
|
|
17
19
|
};
|
|
18
20
|
displayUsername: {
|
|
19
21
|
type: "string";
|
|
20
22
|
required: false;
|
|
21
23
|
transform: {
|
|
22
|
-
input(value:
|
|
24
|
+
input(value: _$_better_auth_core_db0.DBPrimitive): string | number | boolean | Date | Record<string, unknown> | unknown[] | null | undefined;
|
|
23
25
|
};
|
|
24
26
|
};
|
|
25
27
|
};
|
|
@@ -27,4 +29,4 @@ declare const getSchema: (normalizer: {
|
|
|
27
29
|
};
|
|
28
30
|
type UsernameSchema = ReturnType<typeof getSchema>;
|
|
29
31
|
//#endregion
|
|
30
|
-
export { UsernameSchema
|
|
32
|
+
export { UsernameSchema };
|
package/dist/state.d.mts
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { Session, User } from "../types/models.mjs";
|
|
2
2
|
import { Auth } from "../types/auth.mjs";
|
|
3
|
-
import "../types/index.mjs";
|
|
4
|
-
import "../index.mjs";
|
|
5
3
|
import { AuthClient } from "../client/vanilla.mjs";
|
|
6
|
-
import "../client/index.mjs";
|
|
7
4
|
import { setCookieToHeader } from "../cookies/cookie-utils.mjs";
|
|
8
|
-
import "../cookies/index.mjs";
|
|
9
5
|
import { Awaitable, BetterAuthClientOptions, BetterAuthOptions } from "@better-auth/core";
|
|
6
|
+
import * as _$_better_auth_core_db_adapter0 from "@better-auth/core/db/adapter";
|
|
10
7
|
import { SuccessContext } from "@better-fetch/fetch";
|
|
8
|
+
|
|
11
9
|
//#region src/test-utils/test-instance.d.ts
|
|
12
10
|
declare function getTestInstance<O extends Partial<BetterAuthOptions>, C extends BetterAuthClientOptions>(options?: O | undefined, config?: {
|
|
13
11
|
clientOptions?: C;
|
|
@@ -50,7 +48,7 @@ declare function getTestInstance<O extends Partial<BetterAuthOptions>, C extends
|
|
|
50
48
|
cookieSetter: typeof setCookieToHeader;
|
|
51
49
|
customFetchImpl: (url: string | URL | Request, init?: RequestInit | undefined) => Promise<Response>;
|
|
52
50
|
sessionSetter: (headers: Headers) => (context: SuccessContext) => void;
|
|
53
|
-
db:
|
|
51
|
+
db: _$_better_auth_core_db_adapter0.DBAdapter<BetterAuthOptions>;
|
|
54
52
|
runWithUser: (email: string, password: string, fn: (headers: Headers) => Awaitable<void>) => Promise<void>;
|
|
55
53
|
}>;
|
|
56
54
|
//#endregion
|
package/dist/types/adapter.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { DBAdapter as DBAdapter$1, DBAdapterInstance, DBAdapterSchemaCreation, DBTransactionAdapter, JoinConfig, JoinOption, Where as Where$1 } from "@better-auth/core/db/adapter";
|
|
2
|
-
export type
|
|
2
|
+
export { type DBAdapter$1 as DBAdapter, type DBAdapterInstance, type DBAdapterSchemaCreation, type DBTransactionAdapter, type JoinConfig, type JoinOption, type Where$1 as Where };
|
package/dist/types/api.d.mts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { PrettifyDeep, UnionToIntersection } from "./helper.mjs";
|
|
2
2
|
import { Endpoint } from "better-call";
|
|
3
|
+
|
|
3
4
|
//#region src/types/api.d.ts
|
|
4
|
-
type FilteredAPI<API> = Omit<API, API extends { [key in infer K]: Endpoint
|
|
5
|
+
type FilteredAPI<API> = Omit<API, API extends { [key in infer K]: Endpoint } ? K extends string ? K extends "getSession" ? never : API[K]["options"]["metadata"] extends {
|
|
5
6
|
isAction: false;
|
|
6
7
|
} | {
|
|
7
8
|
scope: "http";
|
package/dist/types/auth.d.mts
CHANGED
|
@@ -4,6 +4,7 @@ import { InferPluginContext, InferPluginErrorCodes } from "./plugins.mjs";
|
|
|
4
4
|
import { router } from "../api/index.mjs";
|
|
5
5
|
import { AuthContext, BetterAuthOptions } from "@better-auth/core";
|
|
6
6
|
import { BASE_ERROR_CODES } from "@better-auth/core/error";
|
|
7
|
+
|
|
7
8
|
//#region src/types/auth.d.ts
|
|
8
9
|
type Auth<Options extends BetterAuthOptions = BetterAuthOptions> = {
|
|
9
10
|
handler: (request: Request) => Promise<Response>;
|
package/dist/types/helper.d.mts
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
//#region src/types/helper.d.ts
|
|
2
2
|
type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
3
3
|
type Prettify<T> = Omit<T, never>;
|
|
4
|
-
type PrettifyDeep<T> = { [K in keyof T]: T[K] extends ((...args: any[]) => any) ? T[K] : T[K] extends object ? T[K] extends Array<any> ? T[K] : T[K] extends Date ? T[K] : PrettifyDeep<T[K]> : T[K]
|
|
4
|
+
type PrettifyDeep<T> = { [K in keyof T]: T[K] extends ((...args: any[]) => any) ? T[K] : T[K] extends object ? T[K] extends Array<any> ? T[K] : T[K] extends Date ? T[K] : PrettifyDeep<T[K]> : T[K] } & {};
|
|
5
5
|
type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;
|
|
6
|
-
type RequiredKeysOf<BaseType extends object> = Exclude<{ [Key in keyof BaseType]: BaseType extends Record<Key, BaseType[Key]> ? Key : never
|
|
6
|
+
type RequiredKeysOf<BaseType extends object> = Exclude<{ [Key in keyof BaseType]: BaseType extends Record<Key, BaseType[Key]> ? Key : never }[keyof BaseType], undefined>;
|
|
7
7
|
type HasRequiredKeys<BaseType> = IsAny<BaseType> extends true ? false : [BaseType] extends [object] ? RequiredKeysOf<BaseType & object> extends never ? false : true : false;
|
|
8
|
-
type StripEmptyObjects<T extends object> = { [K in keyof T]: T[K]
|
|
8
|
+
type StripEmptyObjects<T extends object> = { [K in keyof T]: T[K] };
|
|
9
9
|
/**
|
|
10
10
|
* Object merge replacing `Base`'s keys with `Override`'s.
|
|
11
11
|
* The naive `Omit<Base, keyof Override> & Override` form breaks under generics.
|
|
12
12
|
*
|
|
13
13
|
* @see https://github.com/microsoft/TypeScript/issues/57466#issuecomment-1957988380
|
|
14
14
|
*/
|
|
15
|
-
type OverrideMerge<Base, Override> = Base extends unknown ? Override extends unknown ? Prettify<{ [K in keyof Base as K extends keyof Override ? never : K]: Base[K]
|
|
15
|
+
type OverrideMerge<Base, Override> = Base extends unknown ? Override extends unknown ? Prettify<{ [K in keyof Base as K extends keyof Override ? never : K]: Base[K] } & Override> : never : never;
|
|
16
16
|
/**
|
|
17
17
|
* Extracts a Record-typed field from a plugin, guarding against `any`.
|
|
18
18
|
*/
|
|
19
|
-
type ExtractPluginField<T, Field extends string> = IsAny<T> extends true ? {} : T extends { [K in Field]?: Record<string, any
|
|
19
|
+
type ExtractPluginField<T, Field extends string> = IsAny<T> extends true ? {} : T extends { [K in Field]?: Record<string, any> } ? T[Field] extends Record<string, any> ? T[Field] : {} : {};
|
|
20
20
|
/**
|
|
21
21
|
* Walks a plugin tuple with tail-recursive accumulator (TS 4.5+),
|
|
22
22
|
* extracting and intersecting the given field from each element.
|
package/dist/types/index.d.mts
CHANGED
|
@@ -6,5 +6,5 @@ import { Account, AdditionalSessionFieldsInput, AdditionalUserFieldsInput, Infer
|
|
|
6
6
|
import { InferOptionSchema, InferPluginContext, InferPluginErrorCodes, InferPluginIDs } from "./plugins.mjs";
|
|
7
7
|
import { Auth } from "./auth.mjs";
|
|
8
8
|
import { BetterAuthAdvancedOptions, BetterAuthCookies, BetterAuthOptions, BetterAuthPlugin, BetterAuthRateLimitOptions, StoreIdentifierOption } from "@better-auth/core";
|
|
9
|
-
export
|
|
10
|
-
export {
|
|
9
|
+
export * from "@better-auth/core/social-providers";
|
|
10
|
+
export { Account, AdditionalSessionFieldsInput, AdditionalUserFieldsInput, Auth, type BetterAuthAdvancedOptions, BetterAuthClientOptions, BetterAuthClientPlugin, type BetterAuthCookies, type BetterAuthOptions, type BetterAuthPlugin, type BetterAuthRateLimitOptions, ClientAtomListener, ClientStore, DBAdapter, DBAdapterInstance, DBAdapterSchemaCreation, DBTransactionAdapter, ExtractPluginField, FilteredAPI, HasRequiredKeys, InferAPI, InferActions, InferAdditionalFromClient, InferClientAPI, InferErrorCodes, InferOptionSchema, InferPluginContext, InferPluginErrorCodes, InferPluginFieldFromTuple, InferPluginIDs, InferPluginTypes, InferSessionAPI, InferSessionFromClient, InferUserFromClient, IsAny, IsSignal, JoinConfig, JoinOption, OverrideMerge, Prettify, PrettifyDeep, RateLimit, RequiredKeysOf, Session, SessionQueryParams, type StoreIdentifierOption, StripEmptyObjects, UnionToIntersection, User, Verification, Where };
|
package/dist/types/models.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ExtractPluginField, InferPluginFieldFromTuple, UnionToIntersection } from "./helper.mjs";
|
|
2
2
|
import { BetterAuthOptions } from "@better-auth/core";
|
|
3
3
|
import { Account, InferDBFieldsFromOptionsInput, InferDBFieldsFromPluginsInput, RateLimit, Session as Session$1, User as User$1, Verification } from "@better-auth/core/db";
|
|
4
|
+
|
|
4
5
|
//#region src/types/models.d.ts
|
|
5
6
|
type AdditionalUserFieldsInput<Options extends BetterAuthOptions> = InferDBFieldsFromPluginsInput<"user", Options["plugins"]> & InferDBFieldsFromOptionsInput<Options["user"]>;
|
|
6
7
|
type AdditionalSessionFieldsInput<Options extends BetterAuthOptions> = InferDBFieldsFromPluginsInput<"session", Options["plugins"]> & InferDBFieldsFromOptionsInput<Options["session"]>;
|
package/dist/types/plugins.d.mts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { ExtractPluginField, InferPluginFieldFromTuple, UnionToIntersection } from "./helper.mjs";
|
|
2
2
|
import { AuthContext, BetterAuthOptions, BetterAuthPlugin } from "@better-auth/core";
|
|
3
3
|
import { BetterAuthPluginDBSchema } from "@better-auth/core/db";
|
|
4
|
+
|
|
4
5
|
//#region src/types/plugins.d.ts
|
|
5
6
|
type InferOptionSchema<S extends BetterAuthPluginDBSchema> = S extends Record<string, {
|
|
6
7
|
fields: infer Fields;
|
|
7
8
|
}> ? { [K in keyof S]?: {
|
|
8
9
|
modelName?: string | undefined;
|
|
9
|
-
fields?: { [P in keyof Fields]?: string
|
|
10
|
-
}
|
|
10
|
+
fields?: { [P in keyof Fields]?: string } | undefined;
|
|
11
|
+
} } : never;
|
|
11
12
|
type InferPluginErrorCodes<O extends BetterAuthOptions> = O["plugins"] extends readonly [unknown, ...unknown[]] ? InferPluginFieldFromTuple<O["plugins"], "$ERROR_CODES"> : O["plugins"] extends Array<infer P> ? UnionToIntersection<ExtractPluginField<P, "$ERROR_CODES">> : {};
|
|
12
13
|
type InferPluginIDs<O extends BetterAuthOptions> = O["plugins"] extends Array<infer P> ? UnionToIntersection<P extends BetterAuthPlugin ? P["id"] : never> : never;
|
|
13
14
|
type ExtractInitContext<P extends BetterAuthPlugin> = P["init"] extends ((...args: any[]) => infer R) ? Awaited<R> extends {
|
package/dist/utils/index.d.mts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { generateState, parseState } from "../oauth2/state.mjs";
|
|
2
2
|
import { StateData, generateGenericState, parseGenericState } from "../state.mjs";
|
|
3
3
|
import { HIDE_METADATA } from "./hide-metadata.mjs";
|
|
4
|
-
import { getBaseURL, getHost, getHostFromSource, getOrigin, getProtocol, getProtocolFromSource, isDynamicBaseURLConfig, isRequestLike, matchesHostPattern, resolveBaseURL, resolveDynamicBaseURL, trimTrailingSlashes } from "./url.mjs";
|
|
5
|
-
export { HIDE_METADATA, type StateData, generateGenericState, generateState, getBaseURL, getHost, getHostFromSource, getOrigin, getProtocol, getProtocolFromSource, isDynamicBaseURLConfig, isRequestLike, matchesHostPattern, parseGenericState, parseState, resolveBaseURL, resolveDynamicBaseURL, trimTrailingSlashes };
|
|
4
|
+
import { getBaseURL, getHost, getHostFromSource, getOrigin, getProtocol, getProtocolFromSource, isDynamicBaseURLConfig, isRequestLike, matchesHostPattern, resolveBaseURL, resolveDynamicBaseURL, trimTrailingSlashes } from "./url.mjs";
|
package/dist/utils/url.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BaseURLConfig, DynamicBaseURLConfig } from "@better-auth/core";
|
|
2
|
+
|
|
2
3
|
//#region src/utils/url.d.ts
|
|
3
4
|
declare function trimTrailingSlashes(value: string): string;
|
|
4
5
|
declare function getBaseURL(url?: string, path?: string, request?: Request, loadEnv?: boolean, trustedProxyHeaders?: boolean | undefined): string | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "better-auth",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.28",
|
|
4
4
|
"description": "The most comprehensive authentication framework for TypeScript.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -489,13 +489,13 @@
|
|
|
489
489
|
"kysely": "^0.28.17 || ^0.29.0",
|
|
490
490
|
"nanostores": "^1.1.1",
|
|
491
491
|
"zod": "^4.3.6",
|
|
492
|
-
"@better-auth/core": "1.6.
|
|
493
|
-
"@better-auth/drizzle-adapter": "1.6.
|
|
494
|
-
"@better-auth/kysely-adapter": "1.6.
|
|
495
|
-
"@better-auth/memory-adapter": "1.6.
|
|
496
|
-
"@better-auth/mongo-adapter": "1.6.
|
|
497
|
-
"@better-auth/prisma-adapter": "1.6.
|
|
498
|
-
"@better-auth/telemetry": "1.6.
|
|
492
|
+
"@better-auth/core": "1.6.28",
|
|
493
|
+
"@better-auth/drizzle-adapter": "1.6.28",
|
|
494
|
+
"@better-auth/kysely-adapter": "1.6.28",
|
|
495
|
+
"@better-auth/memory-adapter": "1.6.28",
|
|
496
|
+
"@better-auth/mongo-adapter": "1.6.28",
|
|
497
|
+
"@better-auth/prisma-adapter": "1.6.28",
|
|
498
|
+
"@better-auth/telemetry": "1.6.28"
|
|
499
499
|
},
|
|
500
500
|
"devDependencies": {
|
|
501
501
|
"@lynx-js/react": "^0.116.3",
|
|
@@ -513,12 +513,12 @@
|
|
|
513
513
|
"happy-dom": "^20.8.9",
|
|
514
514
|
"listhen": "^1.9.0",
|
|
515
515
|
"msw": "^2.12.10",
|
|
516
|
-
"next": "^16.
|
|
516
|
+
"next": "^16.3.0",
|
|
517
517
|
"oauth2-mock-server": "^8.2.2",
|
|
518
518
|
"react": "^19.2.4",
|
|
519
519
|
"react-dom": "^19.2.4",
|
|
520
520
|
"solid-js": "^1.9.11",
|
|
521
|
-
"tsdown": "0.
|
|
521
|
+
"tsdown": "0.21.10",
|
|
522
522
|
"type-fest": "^5.4.4",
|
|
523
523
|
"typescript": "^6.0.3",
|
|
524
524
|
"vite": "^8.1.5",
|