better-auth 1.6.11 → 1.6.13
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/api/index.d.mts +12 -48
- package/dist/api/routes/account.d.mts +2 -23
- package/dist/api/routes/account.mjs +94 -73
- package/dist/api/routes/callback.d.mts +1 -1
- package/dist/api/routes/callback.mjs +39 -42
- package/dist/api/routes/email-verification.d.mts +1 -0
- package/dist/api/routes/email-verification.mjs +4 -3
- package/dist/api/routes/password.mjs +1 -1
- package/dist/api/routes/session.mjs +15 -10
- package/dist/api/routes/sign-in.d.mts +1 -0
- package/dist/api/routes/sign-in.mjs +3 -2
- package/dist/api/routes/sign-up.d.mts +1 -0
- package/dist/api/routes/sign-up.mjs +9 -7
- package/dist/api/routes/update-user.mjs +7 -7
- package/dist/client/fetch-plugins.mjs +2 -1
- package/dist/client/parser.mjs +0 -1
- package/dist/client/plugins/index.d.mts +3 -3
- package/dist/client/proxy.mjs +2 -1
- package/dist/context/create-context.mjs +10 -14
- package/dist/context/helpers.mjs +3 -2
- package/dist/cookies/cookie-utils.d.mts +24 -1
- package/dist/cookies/cookie-utils.mjs +85 -22
- package/dist/cookies/index.d.mts +2 -3
- package/dist/cookies/index.mjs +39 -11
- package/dist/cookies/session-store.mjs +4 -23
- package/dist/db/get-migration.mjs +4 -4
- package/dist/db/index.d.mts +2 -2
- package/dist/db/index.mjs +3 -2
- package/dist/db/internal-adapter.mjs +56 -50
- package/dist/db/schema.d.mts +15 -2
- package/dist/db/schema.mjs +26 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +2 -2
- package/dist/oauth2/errors.mjs +16 -1
- package/dist/oauth2/index.d.mts +2 -2
- package/dist/oauth2/index.mjs +3 -3
- package/dist/oauth2/link-account.d.mts +27 -1
- package/dist/oauth2/link-account.mjs +27 -4
- package/dist/oauth2/state.mjs +8 -2
- package/dist/package.mjs +1 -1
- package/dist/plugins/access/access.mjs +11 -6
- package/dist/plugins/admin/admin.mjs +0 -4
- package/dist/plugins/admin/client.d.mts +1 -1
- package/dist/plugins/admin/routes.mjs +3 -3
- package/dist/plugins/anonymous/index.mjs +2 -2
- package/dist/plugins/bearer/index.mjs +4 -9
- package/dist/plugins/captcha/index.mjs +2 -2
- package/dist/plugins/email-otp/routes.mjs +1 -1
- package/dist/plugins/generic-oauth/index.d.mts +1 -1
- package/dist/plugins/generic-oauth/index.mjs +6 -6
- package/dist/plugins/generic-oauth/routes.mjs +37 -34
- package/dist/plugins/generic-oauth/types.d.mts +7 -0
- package/dist/plugins/last-login-method/client.mjs +2 -2
- package/dist/plugins/magic-link/index.mjs +0 -1
- package/dist/plugins/mcp/index.mjs +2 -5
- package/dist/plugins/multi-session/index.mjs +2 -2
- package/dist/plugins/oauth-proxy/index.mjs +45 -32
- package/dist/plugins/oauth-proxy/utils.mjs +3 -10
- package/dist/plugins/oidc-provider/index.mjs +2 -5
- package/dist/plugins/one-tap/client.mjs +9 -2
- package/dist/plugins/one-tap/index.mjs +16 -39
- package/dist/plugins/open-api/generator.mjs +16 -5
- package/dist/plugins/organization/adapter.mjs +61 -56
- package/dist/plugins/organization/client.d.mts +2 -1
- package/dist/plugins/organization/error-codes.d.mts +1 -0
- package/dist/plugins/organization/error-codes.mjs +2 -1
- package/dist/plugins/organization/routes/crud-invites.mjs +3 -0
- package/dist/plugins/organization/routes/crud-org.d.mts +4 -4
- package/dist/plugins/organization/routes/crud-org.mjs +2 -2
- package/dist/plugins/organization/types.d.mts +3 -3
- package/dist/plugins/phone-number/routes.mjs +1 -1
- package/dist/plugins/two-factor/backup-codes/index.d.mts +4 -3
- package/dist/plugins/two-factor/client.mjs +2 -1
- package/dist/plugins/two-factor/index.mjs +3 -2
- package/dist/plugins/username/index.d.mts +24 -2
- package/dist/plugins/username/index.mjs +49 -3
- package/dist/state.d.mts +2 -2
- package/dist/state.mjs +18 -4
- package/dist/test-utils/headers.mjs +2 -7
- package/dist/test-utils/test-instance.d.mts +36 -144
- package/dist/utils/index.d.mts +1 -1
- package/dist/utils/url.d.mts +2 -1
- package/dist/utils/url.mjs +9 -3
- package/package.json +15 -14
|
@@ -240,7 +240,7 @@ declare function getTestInstance<O extends Partial<BetterAuthOptions>, C extends
|
|
|
240
240
|
allowedMediaTypes: string[];
|
|
241
241
|
scope: "server";
|
|
242
242
|
};
|
|
243
|
-
},
|
|
243
|
+
}, never>;
|
|
244
244
|
readonly getSession: better_call0.StrictEndpoint<"/get-session", {
|
|
245
245
|
method: ("GET" | "POST")[];
|
|
246
246
|
operationId: string;
|
|
@@ -339,6 +339,7 @@ declare function getTestInstance<O extends Partial<BetterAuthOptions>, C extends
|
|
|
339
339
|
callbackURL: zod.ZodOptional<zod.ZodString>;
|
|
340
340
|
rememberMe: zod.ZodOptional<zod.ZodBoolean>;
|
|
341
341
|
}, zod_v4_core0.$strip>, zod.ZodRecord<zod.ZodString, zod.ZodAny>>;
|
|
342
|
+
cloneRequest: true;
|
|
342
343
|
metadata: {
|
|
343
344
|
allowedMediaTypes: string[];
|
|
344
345
|
$Infer: {
|
|
@@ -505,6 +506,7 @@ declare function getTestInstance<O extends Partial<BetterAuthOptions>, C extends
|
|
|
505
506
|
method: "POST";
|
|
506
507
|
operationId: string;
|
|
507
508
|
use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<void>)[];
|
|
509
|
+
cloneRequest: true;
|
|
508
510
|
body: zod.ZodObject<{
|
|
509
511
|
email: zod.ZodString;
|
|
510
512
|
password: zod.ZodString;
|
|
@@ -736,6 +738,7 @@ declare function getTestInstance<O extends Partial<BetterAuthOptions>, C extends
|
|
|
736
738
|
readonly sendVerificationEmail: better_call0.StrictEndpoint<"/send-verification-email", {
|
|
737
739
|
method: "POST";
|
|
738
740
|
operationId: string;
|
|
741
|
+
cloneRequest: true;
|
|
739
742
|
body: zod.ZodObject<{
|
|
740
743
|
email: zod.ZodEmail;
|
|
741
744
|
callbackURL: zod.ZodOptional<zod.ZodString>;
|
|
@@ -1940,29 +1943,6 @@ declare function getTestInstance<O extends Partial<BetterAuthOptions>, C extends
|
|
|
1940
1943
|
}>;
|
|
1941
1944
|
readonly accountInfo: better_call0.StrictEndpoint<"/account-info", {
|
|
1942
1945
|
method: "GET";
|
|
1943
|
-
use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
|
|
1944
|
-
session: {
|
|
1945
|
-
session: Record<string, any> & {
|
|
1946
|
-
id: string;
|
|
1947
|
-
createdAt: Date;
|
|
1948
|
-
updatedAt: Date;
|
|
1949
|
-
userId: string;
|
|
1950
|
-
expiresAt: Date;
|
|
1951
|
-
token: string;
|
|
1952
|
-
ipAddress?: string | null | undefined;
|
|
1953
|
-
userAgent?: string | null | undefined;
|
|
1954
|
-
};
|
|
1955
|
-
user: Record<string, any> & {
|
|
1956
|
-
id: string;
|
|
1957
|
-
createdAt: Date;
|
|
1958
|
-
updatedAt: Date;
|
|
1959
|
-
email: string;
|
|
1960
|
-
emailVerified: boolean;
|
|
1961
|
-
name: string;
|
|
1962
|
-
image?: string | null | undefined;
|
|
1963
|
-
};
|
|
1964
|
-
};
|
|
1965
|
-
}>)[];
|
|
1966
1946
|
metadata: {
|
|
1967
1947
|
openapi: {
|
|
1968
1948
|
description: string;
|
|
@@ -2012,6 +1992,8 @@ declare function getTestInstance<O extends Partial<BetterAuthOptions>, C extends
|
|
|
2012
1992
|
};
|
|
2013
1993
|
query: zod.ZodOptional<zod.ZodObject<{
|
|
2014
1994
|
accountId: zod.ZodOptional<zod.ZodString>;
|
|
1995
|
+
providerId: zod.ZodOptional<zod.ZodString>;
|
|
1996
|
+
userId: zod.ZodOptional<zod.ZodString>;
|
|
2015
1997
|
}, zod_v4_core0.$strip>>;
|
|
2016
1998
|
}, {
|
|
2017
1999
|
user: _better_auth_core_oauth20.OAuth2UserInfo;
|
|
@@ -2242,7 +2224,7 @@ declare function getTestInstance<O extends Partial<BetterAuthOptions>, C extends
|
|
|
2242
2224
|
allowedMediaTypes: string[];
|
|
2243
2225
|
scope: "server";
|
|
2244
2226
|
};
|
|
2245
|
-
},
|
|
2227
|
+
}, never>;
|
|
2246
2228
|
readonly getSession: better_call0.StrictEndpoint<"/get-session", {
|
|
2247
2229
|
method: ("GET" | "POST")[];
|
|
2248
2230
|
operationId: string;
|
|
@@ -2341,6 +2323,7 @@ declare function getTestInstance<O extends Partial<BetterAuthOptions>, C extends
|
|
|
2341
2323
|
callbackURL: zod.ZodOptional<zod.ZodString>;
|
|
2342
2324
|
rememberMe: zod.ZodOptional<zod.ZodBoolean>;
|
|
2343
2325
|
}, zod_v4_core0.$strip>, zod.ZodRecord<zod.ZodString, zod.ZodAny>>;
|
|
2326
|
+
cloneRequest: true;
|
|
2344
2327
|
metadata: {
|
|
2345
2328
|
allowedMediaTypes: string[];
|
|
2346
2329
|
$Infer: {
|
|
@@ -2507,6 +2490,7 @@ declare function getTestInstance<O extends Partial<BetterAuthOptions>, C extends
|
|
|
2507
2490
|
method: "POST";
|
|
2508
2491
|
operationId: string;
|
|
2509
2492
|
use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<void>)[];
|
|
2493
|
+
cloneRequest: true;
|
|
2510
2494
|
body: zod.ZodObject<{
|
|
2511
2495
|
email: zod.ZodString;
|
|
2512
2496
|
password: zod.ZodString;
|
|
@@ -2738,6 +2722,7 @@ declare function getTestInstance<O extends Partial<BetterAuthOptions>, C extends
|
|
|
2738
2722
|
readonly sendVerificationEmail: better_call0.StrictEndpoint<"/send-verification-email", {
|
|
2739
2723
|
method: "POST";
|
|
2740
2724
|
operationId: string;
|
|
2725
|
+
cloneRequest: true;
|
|
2741
2726
|
body: zod.ZodObject<{
|
|
2742
2727
|
email: zod.ZodEmail;
|
|
2743
2728
|
callbackURL: zod.ZodOptional<zod.ZodString>;
|
|
@@ -3942,29 +3927,6 @@ declare function getTestInstance<O extends Partial<BetterAuthOptions>, C extends
|
|
|
3942
3927
|
}>;
|
|
3943
3928
|
readonly accountInfo: better_call0.StrictEndpoint<"/account-info", {
|
|
3944
3929
|
method: "GET";
|
|
3945
|
-
use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
|
|
3946
|
-
session: {
|
|
3947
|
-
session: Record<string, any> & {
|
|
3948
|
-
id: string;
|
|
3949
|
-
createdAt: Date;
|
|
3950
|
-
updatedAt: Date;
|
|
3951
|
-
userId: string;
|
|
3952
|
-
expiresAt: Date;
|
|
3953
|
-
token: string;
|
|
3954
|
-
ipAddress?: string | null | undefined;
|
|
3955
|
-
userAgent?: string | null | undefined;
|
|
3956
|
-
};
|
|
3957
|
-
user: Record<string, any> & {
|
|
3958
|
-
id: string;
|
|
3959
|
-
createdAt: Date;
|
|
3960
|
-
updatedAt: Date;
|
|
3961
|
-
email: string;
|
|
3962
|
-
emailVerified: boolean;
|
|
3963
|
-
name: string;
|
|
3964
|
-
image?: string | null | undefined;
|
|
3965
|
-
};
|
|
3966
|
-
};
|
|
3967
|
-
}>)[];
|
|
3968
3930
|
metadata: {
|
|
3969
3931
|
openapi: {
|
|
3970
3932
|
description: string;
|
|
@@ -4014,6 +3976,8 @@ declare function getTestInstance<O extends Partial<BetterAuthOptions>, C extends
|
|
|
4014
3976
|
};
|
|
4015
3977
|
query: zod.ZodOptional<zod.ZodObject<{
|
|
4016
3978
|
accountId: zod.ZodOptional<zod.ZodString>;
|
|
3979
|
+
providerId: zod.ZodOptional<zod.ZodString>;
|
|
3980
|
+
userId: zod.ZodOptional<zod.ZodString>;
|
|
4017
3981
|
}, zod_v4_core0.$strip>>;
|
|
4018
3982
|
}, {
|
|
4019
3983
|
user: _better_auth_core_oauth20.OAuth2UserInfo;
|
|
@@ -4247,7 +4211,7 @@ declare function getTestInstance<O extends Partial<BetterAuthOptions>, C extends
|
|
|
4247
4211
|
allowedMediaTypes: string[];
|
|
4248
4212
|
scope: "server";
|
|
4249
4213
|
};
|
|
4250
|
-
},
|
|
4214
|
+
}, never>;
|
|
4251
4215
|
readonly getSession: better_call0.StrictEndpoint<"/get-session", {
|
|
4252
4216
|
method: ("GET" | "POST")[];
|
|
4253
4217
|
operationId: string;
|
|
@@ -4346,6 +4310,7 @@ declare function getTestInstance<O extends Partial<BetterAuthOptions>, C extends
|
|
|
4346
4310
|
callbackURL: zod.ZodOptional<zod.ZodString>;
|
|
4347
4311
|
rememberMe: zod.ZodOptional<zod.ZodBoolean>;
|
|
4348
4312
|
}, zod_v4_core0.$strip>, zod.ZodRecord<zod.ZodString, zod.ZodAny>>;
|
|
4313
|
+
cloneRequest: true;
|
|
4349
4314
|
metadata: {
|
|
4350
4315
|
allowedMediaTypes: string[];
|
|
4351
4316
|
$Infer: {
|
|
@@ -4512,6 +4477,7 @@ declare function getTestInstance<O extends Partial<BetterAuthOptions>, C extends
|
|
|
4512
4477
|
method: "POST";
|
|
4513
4478
|
operationId: string;
|
|
4514
4479
|
use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<void>)[];
|
|
4480
|
+
cloneRequest: true;
|
|
4515
4481
|
body: zod.ZodObject<{
|
|
4516
4482
|
email: zod.ZodString;
|
|
4517
4483
|
password: zod.ZodString;
|
|
@@ -4743,6 +4709,7 @@ declare function getTestInstance<O extends Partial<BetterAuthOptions>, C extends
|
|
|
4743
4709
|
readonly sendVerificationEmail: better_call0.StrictEndpoint<"/send-verification-email", {
|
|
4744
4710
|
method: "POST";
|
|
4745
4711
|
operationId: string;
|
|
4712
|
+
cloneRequest: true;
|
|
4746
4713
|
body: zod.ZodObject<{
|
|
4747
4714
|
email: zod.ZodEmail;
|
|
4748
4715
|
callbackURL: zod.ZodOptional<zod.ZodString>;
|
|
@@ -5947,29 +5914,6 @@ declare function getTestInstance<O extends Partial<BetterAuthOptions>, C extends
|
|
|
5947
5914
|
}>;
|
|
5948
5915
|
readonly accountInfo: better_call0.StrictEndpoint<"/account-info", {
|
|
5949
5916
|
method: "GET";
|
|
5950
|
-
use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
|
|
5951
|
-
session: {
|
|
5952
|
-
session: Record<string, any> & {
|
|
5953
|
-
id: string;
|
|
5954
|
-
createdAt: Date;
|
|
5955
|
-
updatedAt: Date;
|
|
5956
|
-
userId: string;
|
|
5957
|
-
expiresAt: Date;
|
|
5958
|
-
token: string;
|
|
5959
|
-
ipAddress?: string | null | undefined;
|
|
5960
|
-
userAgent?: string | null | undefined;
|
|
5961
|
-
};
|
|
5962
|
-
user: Record<string, any> & {
|
|
5963
|
-
id: string;
|
|
5964
|
-
createdAt: Date;
|
|
5965
|
-
updatedAt: Date;
|
|
5966
|
-
email: string;
|
|
5967
|
-
emailVerified: boolean;
|
|
5968
|
-
name: string;
|
|
5969
|
-
image?: string | null | undefined;
|
|
5970
|
-
};
|
|
5971
|
-
};
|
|
5972
|
-
}>)[];
|
|
5973
5917
|
metadata: {
|
|
5974
5918
|
openapi: {
|
|
5975
5919
|
description: string;
|
|
@@ -6019,6 +5963,8 @@ declare function getTestInstance<O extends Partial<BetterAuthOptions>, C extends
|
|
|
6019
5963
|
};
|
|
6020
5964
|
query: zod.ZodOptional<zod.ZodObject<{
|
|
6021
5965
|
accountId: zod.ZodOptional<zod.ZodString>;
|
|
5966
|
+
providerId: zod.ZodOptional<zod.ZodString>;
|
|
5967
|
+
userId: zod.ZodOptional<zod.ZodString>;
|
|
6022
5968
|
}, zod_v4_core0.$strip>>;
|
|
6023
5969
|
}, {
|
|
6024
5970
|
user: _better_auth_core_oauth20.OAuth2UserInfo;
|
|
@@ -6249,7 +6195,7 @@ declare function getTestInstance<O extends Partial<BetterAuthOptions>, C extends
|
|
|
6249
6195
|
allowedMediaTypes: string[];
|
|
6250
6196
|
scope: "server";
|
|
6251
6197
|
};
|
|
6252
|
-
},
|
|
6198
|
+
}, never>;
|
|
6253
6199
|
readonly getSession: better_call0.StrictEndpoint<"/get-session", {
|
|
6254
6200
|
method: ("GET" | "POST")[];
|
|
6255
6201
|
operationId: string;
|
|
@@ -6348,6 +6294,7 @@ declare function getTestInstance<O extends Partial<BetterAuthOptions>, C extends
|
|
|
6348
6294
|
callbackURL: zod.ZodOptional<zod.ZodString>;
|
|
6349
6295
|
rememberMe: zod.ZodOptional<zod.ZodBoolean>;
|
|
6350
6296
|
}, zod_v4_core0.$strip>, zod.ZodRecord<zod.ZodString, zod.ZodAny>>;
|
|
6297
|
+
cloneRequest: true;
|
|
6351
6298
|
metadata: {
|
|
6352
6299
|
allowedMediaTypes: string[];
|
|
6353
6300
|
$Infer: {
|
|
@@ -6514,6 +6461,7 @@ declare function getTestInstance<O extends Partial<BetterAuthOptions>, C extends
|
|
|
6514
6461
|
method: "POST";
|
|
6515
6462
|
operationId: string;
|
|
6516
6463
|
use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<void>)[];
|
|
6464
|
+
cloneRequest: true;
|
|
6517
6465
|
body: zod.ZodObject<{
|
|
6518
6466
|
email: zod.ZodString;
|
|
6519
6467
|
password: zod.ZodString;
|
|
@@ -6745,6 +6693,7 @@ declare function getTestInstance<O extends Partial<BetterAuthOptions>, C extends
|
|
|
6745
6693
|
readonly sendVerificationEmail: better_call0.StrictEndpoint<"/send-verification-email", {
|
|
6746
6694
|
method: "POST";
|
|
6747
6695
|
operationId: string;
|
|
6696
|
+
cloneRequest: true;
|
|
6748
6697
|
body: zod.ZodObject<{
|
|
6749
6698
|
email: zod.ZodEmail;
|
|
6750
6699
|
callbackURL: zod.ZodOptional<zod.ZodString>;
|
|
@@ -7949,29 +7898,6 @@ declare function getTestInstance<O extends Partial<BetterAuthOptions>, C extends
|
|
|
7949
7898
|
}>;
|
|
7950
7899
|
readonly accountInfo: better_call0.StrictEndpoint<"/account-info", {
|
|
7951
7900
|
method: "GET";
|
|
7952
|
-
use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
|
|
7953
|
-
session: {
|
|
7954
|
-
session: Record<string, any> & {
|
|
7955
|
-
id: string;
|
|
7956
|
-
createdAt: Date;
|
|
7957
|
-
updatedAt: Date;
|
|
7958
|
-
userId: string;
|
|
7959
|
-
expiresAt: Date;
|
|
7960
|
-
token: string;
|
|
7961
|
-
ipAddress?: string | null | undefined;
|
|
7962
|
-
userAgent?: string | null | undefined;
|
|
7963
|
-
};
|
|
7964
|
-
user: Record<string, any> & {
|
|
7965
|
-
id: string;
|
|
7966
|
-
createdAt: Date;
|
|
7967
|
-
updatedAt: Date;
|
|
7968
|
-
email: string;
|
|
7969
|
-
emailVerified: boolean;
|
|
7970
|
-
name: string;
|
|
7971
|
-
image?: string | null | undefined;
|
|
7972
|
-
};
|
|
7973
|
-
};
|
|
7974
|
-
}>)[];
|
|
7975
7901
|
metadata: {
|
|
7976
7902
|
openapi: {
|
|
7977
7903
|
description: string;
|
|
@@ -8021,6 +7947,8 @@ declare function getTestInstance<O extends Partial<BetterAuthOptions>, C extends
|
|
|
8021
7947
|
};
|
|
8022
7948
|
query: zod.ZodOptional<zod.ZodObject<{
|
|
8023
7949
|
accountId: zod.ZodOptional<zod.ZodString>;
|
|
7950
|
+
providerId: zod.ZodOptional<zod.ZodString>;
|
|
7951
|
+
userId: zod.ZodOptional<zod.ZodString>;
|
|
8024
7952
|
}, zod_v4_core0.$strip>>;
|
|
8025
7953
|
}, {
|
|
8026
7954
|
user: _better_auth_core_oauth20.OAuth2UserInfo;
|
|
@@ -8325,7 +8253,7 @@ declare function getTestInstance<O extends Partial<BetterAuthOptions>, C extends
|
|
|
8325
8253
|
allowedMediaTypes: string[];
|
|
8326
8254
|
scope: "server";
|
|
8327
8255
|
};
|
|
8328
|
-
},
|
|
8256
|
+
}, never>;
|
|
8329
8257
|
readonly getSession: better_call0.StrictEndpoint<"/get-session", {
|
|
8330
8258
|
method: ("GET" | "POST")[];
|
|
8331
8259
|
operationId: string;
|
|
@@ -8424,6 +8352,7 @@ declare function getTestInstance<O extends Partial<BetterAuthOptions>, C extends
|
|
|
8424
8352
|
callbackURL: zod.ZodOptional<zod.ZodString>;
|
|
8425
8353
|
rememberMe: zod.ZodOptional<zod.ZodBoolean>;
|
|
8426
8354
|
}, zod_v4_core0.$strip>, zod.ZodRecord<zod.ZodString, zod.ZodAny>>;
|
|
8355
|
+
cloneRequest: true;
|
|
8427
8356
|
metadata: {
|
|
8428
8357
|
allowedMediaTypes: string[];
|
|
8429
8358
|
$Infer: {
|
|
@@ -8590,6 +8519,7 @@ declare function getTestInstance<O extends Partial<BetterAuthOptions>, C extends
|
|
|
8590
8519
|
method: "POST";
|
|
8591
8520
|
operationId: string;
|
|
8592
8521
|
use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<void>)[];
|
|
8522
|
+
cloneRequest: true;
|
|
8593
8523
|
body: zod.ZodObject<{
|
|
8594
8524
|
email: zod.ZodString;
|
|
8595
8525
|
password: zod.ZodString;
|
|
@@ -8821,6 +8751,7 @@ declare function getTestInstance<O extends Partial<BetterAuthOptions>, C extends
|
|
|
8821
8751
|
readonly sendVerificationEmail: better_call0.StrictEndpoint<"/send-verification-email", {
|
|
8822
8752
|
method: "POST";
|
|
8823
8753
|
operationId: string;
|
|
8754
|
+
cloneRequest: true;
|
|
8824
8755
|
body: zod.ZodObject<{
|
|
8825
8756
|
email: zod.ZodEmail;
|
|
8826
8757
|
callbackURL: zod.ZodOptional<zod.ZodString>;
|
|
@@ -10025,29 +9956,6 @@ declare function getTestInstance<O extends Partial<BetterAuthOptions>, C extends
|
|
|
10025
9956
|
}>;
|
|
10026
9957
|
readonly accountInfo: better_call0.StrictEndpoint<"/account-info", {
|
|
10027
9958
|
method: "GET";
|
|
10028
|
-
use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
|
|
10029
|
-
session: {
|
|
10030
|
-
session: Record<string, any> & {
|
|
10031
|
-
id: string;
|
|
10032
|
-
createdAt: Date;
|
|
10033
|
-
updatedAt: Date;
|
|
10034
|
-
userId: string;
|
|
10035
|
-
expiresAt: Date;
|
|
10036
|
-
token: string;
|
|
10037
|
-
ipAddress?: string | null | undefined;
|
|
10038
|
-
userAgent?: string | null | undefined;
|
|
10039
|
-
};
|
|
10040
|
-
user: Record<string, any> & {
|
|
10041
|
-
id: string;
|
|
10042
|
-
createdAt: Date;
|
|
10043
|
-
updatedAt: Date;
|
|
10044
|
-
email: string;
|
|
10045
|
-
emailVerified: boolean;
|
|
10046
|
-
name: string;
|
|
10047
|
-
image?: string | null | undefined;
|
|
10048
|
-
};
|
|
10049
|
-
};
|
|
10050
|
-
}>)[];
|
|
10051
9959
|
metadata: {
|
|
10052
9960
|
openapi: {
|
|
10053
9961
|
description: string;
|
|
@@ -10097,6 +10005,8 @@ declare function getTestInstance<O extends Partial<BetterAuthOptions>, C extends
|
|
|
10097
10005
|
};
|
|
10098
10006
|
query: zod.ZodOptional<zod.ZodObject<{
|
|
10099
10007
|
accountId: zod.ZodOptional<zod.ZodString>;
|
|
10008
|
+
providerId: zod.ZodOptional<zod.ZodString>;
|
|
10009
|
+
userId: zod.ZodOptional<zod.ZodString>;
|
|
10100
10010
|
}, zod_v4_core0.$strip>>;
|
|
10101
10011
|
}, {
|
|
10102
10012
|
user: _better_auth_core_oauth20.OAuth2UserInfo;
|
|
@@ -10327,7 +10237,7 @@ declare function getTestInstance<O extends Partial<BetterAuthOptions>, C extends
|
|
|
10327
10237
|
allowedMediaTypes: string[];
|
|
10328
10238
|
scope: "server";
|
|
10329
10239
|
};
|
|
10330
|
-
},
|
|
10240
|
+
}, never>;
|
|
10331
10241
|
readonly getSession: better_call0.StrictEndpoint<"/get-session", {
|
|
10332
10242
|
method: ("GET" | "POST")[];
|
|
10333
10243
|
operationId: string;
|
|
@@ -10426,6 +10336,7 @@ declare function getTestInstance<O extends Partial<BetterAuthOptions>, C extends
|
|
|
10426
10336
|
callbackURL: zod.ZodOptional<zod.ZodString>;
|
|
10427
10337
|
rememberMe: zod.ZodOptional<zod.ZodBoolean>;
|
|
10428
10338
|
}, zod_v4_core0.$strip>, zod.ZodRecord<zod.ZodString, zod.ZodAny>>;
|
|
10339
|
+
cloneRequest: true;
|
|
10429
10340
|
metadata: {
|
|
10430
10341
|
allowedMediaTypes: string[];
|
|
10431
10342
|
$Infer: {
|
|
@@ -10592,6 +10503,7 @@ declare function getTestInstance<O extends Partial<BetterAuthOptions>, C extends
|
|
|
10592
10503
|
method: "POST";
|
|
10593
10504
|
operationId: string;
|
|
10594
10505
|
use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<void>)[];
|
|
10506
|
+
cloneRequest: true;
|
|
10595
10507
|
body: zod.ZodObject<{
|
|
10596
10508
|
email: zod.ZodString;
|
|
10597
10509
|
password: zod.ZodString;
|
|
@@ -10823,6 +10735,7 @@ declare function getTestInstance<O extends Partial<BetterAuthOptions>, C extends
|
|
|
10823
10735
|
readonly sendVerificationEmail: better_call0.StrictEndpoint<"/send-verification-email", {
|
|
10824
10736
|
method: "POST";
|
|
10825
10737
|
operationId: string;
|
|
10738
|
+
cloneRequest: true;
|
|
10826
10739
|
body: zod.ZodObject<{
|
|
10827
10740
|
email: zod.ZodEmail;
|
|
10828
10741
|
callbackURL: zod.ZodOptional<zod.ZodString>;
|
|
@@ -12027,29 +11940,6 @@ declare function getTestInstance<O extends Partial<BetterAuthOptions>, C extends
|
|
|
12027
11940
|
}>;
|
|
12028
11941
|
readonly accountInfo: better_call0.StrictEndpoint<"/account-info", {
|
|
12029
11942
|
method: "GET";
|
|
12030
|
-
use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
|
|
12031
|
-
session: {
|
|
12032
|
-
session: Record<string, any> & {
|
|
12033
|
-
id: string;
|
|
12034
|
-
createdAt: Date;
|
|
12035
|
-
updatedAt: Date;
|
|
12036
|
-
userId: string;
|
|
12037
|
-
expiresAt: Date;
|
|
12038
|
-
token: string;
|
|
12039
|
-
ipAddress?: string | null | undefined;
|
|
12040
|
-
userAgent?: string | null | undefined;
|
|
12041
|
-
};
|
|
12042
|
-
user: Record<string, any> & {
|
|
12043
|
-
id: string;
|
|
12044
|
-
createdAt: Date;
|
|
12045
|
-
updatedAt: Date;
|
|
12046
|
-
email: string;
|
|
12047
|
-
emailVerified: boolean;
|
|
12048
|
-
name: string;
|
|
12049
|
-
image?: string | null | undefined;
|
|
12050
|
-
};
|
|
12051
|
-
};
|
|
12052
|
-
}>)[];
|
|
12053
11943
|
metadata: {
|
|
12054
11944
|
openapi: {
|
|
12055
11945
|
description: string;
|
|
@@ -12099,6 +11989,8 @@ declare function getTestInstance<O extends Partial<BetterAuthOptions>, C extends
|
|
|
12099
11989
|
};
|
|
12100
11990
|
query: zod.ZodOptional<zod.ZodObject<{
|
|
12101
11991
|
accountId: zod.ZodOptional<zod.ZodString>;
|
|
11992
|
+
providerId: zod.ZodOptional<zod.ZodString>;
|
|
11993
|
+
userId: zod.ZodOptional<zod.ZodString>;
|
|
12102
11994
|
}, zod_v4_core0.$strip>>;
|
|
12103
11995
|
}, {
|
|
12104
11996
|
user: _better_auth_core_oauth20.OAuth2UserInfo;
|
package/dist/utils/index.d.mts
CHANGED
|
@@ -1,4 +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 } from "./url.mjs";
|
|
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,6 +1,7 @@
|
|
|
1
1
|
import { BaseURLConfig, DynamicBaseURLConfig } from "@better-auth/core";
|
|
2
2
|
|
|
3
3
|
//#region src/utils/url.d.ts
|
|
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;
|
|
5
6
|
declare function getOrigin(url: string): string | null;
|
|
6
7
|
declare function getProtocol(url: string): string | null;
|
|
@@ -74,4 +75,4 @@ declare function resolveDynamicBaseURL(config: DynamicBaseURLConfig, source: Req
|
|
|
74
75
|
*/
|
|
75
76
|
declare function resolveBaseURL(config: BaseURLConfig | undefined, basePath: string, source?: Request | Headers, loadEnv?: boolean, trustedProxyHeaders?: boolean): string | undefined;
|
|
76
77
|
//#endregion
|
|
77
|
-
export { getBaseURL, getHost, getHostFromSource, getOrigin, getProtocol, getProtocolFromSource, isDynamicBaseURLConfig, isRequestLike, matchesHostPattern, resolveBaseURL, resolveDynamicBaseURL };
|
|
78
|
+
export { getBaseURL, getHost, getHostFromSource, getOrigin, getProtocol, getProtocolFromSource, isDynamicBaseURLConfig, isRequestLike, matchesHostPattern, resolveBaseURL, resolveDynamicBaseURL, trimTrailingSlashes };
|
package/dist/utils/url.mjs
CHANGED
|
@@ -2,6 +2,7 @@ import { wildcardMatch } from "./wildcard.mjs";
|
|
|
2
2
|
import { env } from "@better-auth/core/env";
|
|
3
3
|
import { BetterAuthError } from "@better-auth/core/error";
|
|
4
4
|
//#region src/utils/url.ts
|
|
5
|
+
const SLASH_CHAR_CODE = "/".charCodeAt(0);
|
|
5
6
|
/**
|
|
6
7
|
* Minimal loopback check for dev scheme inference only. Reachable from
|
|
7
8
|
* `client/config.ts` via `getBaseURL`, so we MUST NOT import the full
|
|
@@ -17,9 +18,14 @@ function isLoopbackForDevScheme(host) {
|
|
|
17
18
|
const hostname = host.replace(/:\d+$/, "").replace(/^\[|\]$/g, "").toLowerCase();
|
|
18
19
|
return hostname === "localhost" || hostname.endsWith(".localhost") || hostname === "::1" || hostname.startsWith("127.");
|
|
19
20
|
}
|
|
21
|
+
function trimTrailingSlashes(value) {
|
|
22
|
+
let end = value.length;
|
|
23
|
+
while (end > 0 && value.charCodeAt(end - 1) === SLASH_CHAR_CODE) end--;
|
|
24
|
+
return end === value.length ? value : value.slice(0, end);
|
|
25
|
+
}
|
|
20
26
|
function checkHasPath(url) {
|
|
21
27
|
try {
|
|
22
|
-
return (new URL(url).pathname
|
|
28
|
+
return (trimTrailingSlashes(new URL(url).pathname) || "/") !== "/";
|
|
23
29
|
} catch {
|
|
24
30
|
throw new BetterAuthError(`Invalid base URL: ${url}. Please provide a valid base URL.`);
|
|
25
31
|
}
|
|
@@ -36,7 +42,7 @@ function assertHasProtocol(url) {
|
|
|
36
42
|
function withPath(url, path = "/api/auth") {
|
|
37
43
|
assertHasProtocol(url);
|
|
38
44
|
if (checkHasPath(url)) return url;
|
|
39
|
-
const trimmedUrl = url
|
|
45
|
+
const trimmedUrl = trimTrailingSlashes(url);
|
|
40
46
|
if (!path || path === "/") return trimmedUrl;
|
|
41
47
|
path = path.startsWith("/") ? path : `/${path}`;
|
|
42
48
|
return `${trimmedUrl}${path}`;
|
|
@@ -229,4 +235,4 @@ function resolveBaseURL(config, basePath, source, loadEnv, trustedProxyHeaders)
|
|
|
229
235
|
return getBaseURL(void 0, basePath, request, loadEnv, trustedProxyHeaders);
|
|
230
236
|
}
|
|
231
237
|
//#endregion
|
|
232
|
-
export { getBaseURL, getHost, getHostFromSource, getOrigin, getProtocol, getProtocolFromSource, isDynamicBaseURLConfig, isRequestLike, matchesHostPattern, resolveBaseURL, resolveDynamicBaseURL };
|
|
238
|
+
export { getBaseURL, getHost, getHostFromSource, getOrigin, getProtocol, getProtocolFromSource, isDynamicBaseURLConfig, isRequestLike, matchesHostPattern, resolveBaseURL, resolveDynamicBaseURL, trimTrailingSlashes };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "better-auth",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.13",
|
|
4
4
|
"description": "The most comprehensive authentication framework for TypeScript.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -479,29 +479,29 @@
|
|
|
479
479
|
}
|
|
480
480
|
},
|
|
481
481
|
"dependencies": {
|
|
482
|
-
"@better-auth/utils": "0.4.
|
|
482
|
+
"@better-auth/utils": "0.4.1",
|
|
483
483
|
"@better-fetch/fetch": "1.1.21",
|
|
484
484
|
"@noble/ciphers": "^2.1.1",
|
|
485
485
|
"@noble/hashes": "^2.0.1",
|
|
486
486
|
"better-call": "1.3.5",
|
|
487
487
|
"defu": "^6.1.4",
|
|
488
488
|
"jose": "^6.1.3",
|
|
489
|
-
"kysely": "^0.28.17",
|
|
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.13",
|
|
493
|
+
"@better-auth/drizzle-adapter": "1.6.13",
|
|
494
|
+
"@better-auth/kysely-adapter": "1.6.13",
|
|
495
|
+
"@better-auth/memory-adapter": "1.6.13",
|
|
496
|
+
"@better-auth/mongo-adapter": "1.6.13",
|
|
497
|
+
"@better-auth/prisma-adapter": "1.6.13",
|
|
498
|
+
"@better-auth/telemetry": "1.6.13"
|
|
499
499
|
},
|
|
500
500
|
"devDependencies": {
|
|
501
501
|
"@lynx-js/react": "^0.116.3",
|
|
502
|
-
"@sveltejs/kit": "^2.
|
|
503
|
-
"@tanstack/react-start": "^1.
|
|
504
|
-
"@tanstack/solid-start": "^1.
|
|
502
|
+
"@sveltejs/kit": "^2.60.1",
|
|
503
|
+
"@tanstack/react-start": "^1.168.4",
|
|
504
|
+
"@tanstack/solid-start": "^1.168.4",
|
|
505
505
|
"@types/bun": "^1.3.9",
|
|
506
506
|
"@types/google.accounts": "^0.0.18",
|
|
507
507
|
"@types/pg": "^8.16.0",
|
|
@@ -512,7 +512,7 @@
|
|
|
512
512
|
"happy-dom": "^20.8.9",
|
|
513
513
|
"listhen": "^1.9.0",
|
|
514
514
|
"msw": "^2.12.10",
|
|
515
|
-
"next": "^16.2.
|
|
515
|
+
"next": "^16.2.6",
|
|
516
516
|
"oauth2-mock-server": "^8.2.2",
|
|
517
517
|
"react": "^19.2.4",
|
|
518
518
|
"react-dom": "^19.2.4",
|
|
@@ -520,6 +520,7 @@
|
|
|
520
520
|
"tsdown": "0.21.1",
|
|
521
521
|
"type-fest": "^5.4.4",
|
|
522
522
|
"typescript": "^5.9.3",
|
|
523
|
+
"vite": "^7.3.2",
|
|
523
524
|
"vitest": "^4.1.5",
|
|
524
525
|
"vue": "^3.5.29"
|
|
525
526
|
},
|