better-auth 0.4.3 → 0.4.4
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/drizzle.d.ts +1 -1
- package/dist/adapters/mongodb.d.ts +1 -1
- package/dist/adapters/prisma.d.ts +1 -1
- package/dist/api.d.ts +1 -1
- package/dist/api.js +6 -4
- package/dist/cli.js +1 -0
- package/dist/client/plugins.d.ts +3 -3
- package/dist/client.d.ts +1 -1
- package/dist/{index-DTlKO6LZ.d.ts → index-Bt0CUdx4.d.ts} +26 -40
- package/dist/{index-BJjwxSm5.d.ts → index-CJ44EC0j.d.ts} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +35 -21
- package/dist/next-js.d.ts +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/plugins.d.ts +3 -3
- package/dist/plugins.js +6 -4
- package/dist/react.d.ts +1 -1
- package/dist/solid-start.d.ts +1 -1
- package/dist/solid.d.ts +1 -1
- package/dist/svelte-kit.d.ts +1 -1
- package/dist/svelte.d.ts +1 -1
- package/dist/types.d.ts +2 -2
- package/dist/vue.d.ts +1 -1
- package/package.json +1 -1
package/dist/api.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { e as AuthEndpoint, f as AuthMiddleware, v as callbackOAuth, T as changePassword, d as createAuthEndpoint, c as createAuthMiddleware, M as createEmailVerificationToken, $ as csrfMiddleware, V as deleteUser, Y as error, J as forgetPassword, K as forgetPasswordCallback, X as getCSRFToken, r as getEndpoints, w as getSession, x as getSessionFromCtx, z as listSessions, Z as ok, o as optionsMiddleware, L as resetPassword, C as revokeSession, D as revokeSessions, s as router, N as sendVerificationEmail, y as sessionMiddleware, U as setPassword, u as signInEmail, t as signInOAuth, E as signOut, _ as signUpEmail, Q as updateUser, O as verifyEmail } from './index-
|
|
1
|
+
export { e as AuthEndpoint, f as AuthMiddleware, v as callbackOAuth, T as changePassword, d as createAuthEndpoint, c as createAuthMiddleware, M as createEmailVerificationToken, $ as csrfMiddleware, V as deleteUser, Y as error, J as forgetPassword, K as forgetPasswordCallback, X as getCSRFToken, r as getEndpoints, w as getSession, x as getSessionFromCtx, z as listSessions, Z as ok, o as optionsMiddleware, L as resetPassword, C as revokeSession, D as revokeSessions, s as router, N as sendVerificationEmail, y as sessionMiddleware, U as setPassword, u as signInEmail, t as signInOAuth, E as signOut, _ as signUpEmail, Q as updateUser, O as verifyEmail } from './index-Bt0CUdx4.js';
|
|
2
2
|
import './helper-DPDj8Nix.js';
|
|
3
3
|
import 'zod';
|
|
4
4
|
export { APIError } from 'better-call';
|
package/dist/api.js
CHANGED
|
@@ -820,20 +820,22 @@ import { APIError as APIError2 } from "better-call";
|
|
|
820
820
|
|
|
821
821
|
// src/utils/date.ts
|
|
822
822
|
var getDate = (span, unit = "ms") => {
|
|
823
|
-
|
|
824
|
-
return new Date(date.getTime() + (unit === "sec" ? span * 1e3 : span));
|
|
823
|
+
return new Date(Date.now() + (unit === "sec" ? span * 1e3 : span));
|
|
825
824
|
};
|
|
826
825
|
|
|
827
826
|
// src/cookies/index.ts
|
|
828
827
|
import { TimeSpan } from "oslo";
|
|
829
828
|
async function setSessionCookie(ctx, sessionToken, dontRememberMe, overrides) {
|
|
830
829
|
const options = ctx.context.authCookies.sessionToken.options;
|
|
831
|
-
options.maxAge = dontRememberMe ? void 0 :
|
|
830
|
+
options.maxAge = dontRememberMe ? void 0 : ctx.context.sessionConfig.expiresIn;
|
|
832
831
|
await ctx.setSignedCookie(
|
|
833
832
|
ctx.context.authCookies.sessionToken.name,
|
|
834
833
|
sessionToken,
|
|
835
834
|
ctx.context.secret,
|
|
836
|
-
|
|
835
|
+
{
|
|
836
|
+
...options,
|
|
837
|
+
...overrides
|
|
838
|
+
}
|
|
837
839
|
);
|
|
838
840
|
if (dontRememberMe) {
|
|
839
841
|
await ctx.setSignedCookie(
|
package/dist/cli.js
CHANGED
package/dist/client/plugins.d.ts
CHANGED
|
@@ -2,10 +2,10 @@ import * as nanostores from 'nanostores';
|
|
|
2
2
|
import { A as AccessControl, S as StatementsPrimitive, R as Role } from '../statement-CfnyN34h.js';
|
|
3
3
|
import * as _better_fetch_fetch from '@better-fetch/fetch';
|
|
4
4
|
import { BetterFetchOption } from '@better-fetch/fetch';
|
|
5
|
-
import { o as organization, j as Organization, M as Member, I as Invitation, u as username, m as magicLink, d as phoneNumber, e as anonymous, i as admin } from '../index-
|
|
6
|
-
export { g as getPasskeyActions, c as passkeyClient, a as twoFactorClient } from '../index-
|
|
5
|
+
import { o as organization, j as Organization, M as Member, I as Invitation, u as username, m as magicLink, d as phoneNumber, e as anonymous, i as admin } from '../index-CJ44EC0j.js';
|
|
6
|
+
export { g as getPasskeyActions, c as passkeyClient, a as twoFactorClient } from '../index-CJ44EC0j.js';
|
|
7
7
|
import { P as Prettify } from '../helper-DPDj8Nix.js';
|
|
8
|
-
import { F as FieldAttribute, B as BetterAuthOptions, b as BetterAuthPlugin } from '../index-
|
|
8
|
+
import { F as FieldAttribute, B as BetterAuthOptions, b as BetterAuthPlugin } from '../index-Bt0CUdx4.js';
|
|
9
9
|
import * as better_call from 'better-call';
|
|
10
10
|
import { z } from 'zod';
|
|
11
11
|
import { O as OAuth2Tokens, U as User } from '../types-IzAbV4nB.js';
|
package/dist/client.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { BetterFetch, BetterFetchError, BetterFetchOption } from '@better-fetch/
|
|
|
6
6
|
import { U as UnionToIntersection, P as Prettify, S as StripEmptyObjects } from './helper-DPDj8Nix.js';
|
|
7
7
|
import { ClientOptions, InferClientAPI, InferActions, InferAdditionalFromClient, InferSessionFromClient, InferUserFromClient, BetterAuthClientPlugin, IsSignal } from './types.js';
|
|
8
8
|
export { AtomListener, InferPluginsFromClient } from './types.js';
|
|
9
|
-
import './index-
|
|
9
|
+
import './index-Bt0CUdx4.js';
|
|
10
10
|
import 'kysely';
|
|
11
11
|
import './types-IzAbV4nB.js';
|
|
12
12
|
import 'better-call';
|
|
@@ -1012,22 +1012,8 @@ declare const createInternalAdapter: (adapter: Adapter, ctx: {
|
|
|
1012
1012
|
userAgent?: string | undefined;
|
|
1013
1013
|
} | null>;
|
|
1014
1014
|
findSession: (sessionId: string) => Promise<{
|
|
1015
|
-
session:
|
|
1016
|
-
|
|
1017
|
-
userId: string;
|
|
1018
|
-
expiresAt: Date;
|
|
1019
|
-
ipAddress?: string | undefined;
|
|
1020
|
-
userAgent?: string | undefined;
|
|
1021
|
-
};
|
|
1022
|
-
user: {
|
|
1023
|
-
id: string;
|
|
1024
|
-
email: string;
|
|
1025
|
-
emailVerified: boolean;
|
|
1026
|
-
name: string;
|
|
1027
|
-
createdAt: Date;
|
|
1028
|
-
updatedAt: Date;
|
|
1029
|
-
image?: string | undefined;
|
|
1030
|
-
};
|
|
1015
|
+
session: Session;
|
|
1016
|
+
user: User;
|
|
1031
1017
|
} | null>;
|
|
1032
1018
|
updateSession: (sessionId: string, session: Partial<Session>) => Promise<{
|
|
1033
1019
|
id: string;
|
|
@@ -1175,12 +1161,12 @@ declare const signInOAuth: {
|
|
|
1175
1161
|
/**
|
|
1176
1162
|
* OAuth2 provider to use`
|
|
1177
1163
|
*/
|
|
1178
|
-
provider: z.ZodEnum<["github", ...("
|
|
1164
|
+
provider: z.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter")[]]>;
|
|
1179
1165
|
}, "strip", z.ZodTypeAny, {
|
|
1180
|
-
provider: "
|
|
1166
|
+
provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
|
|
1181
1167
|
callbackURL?: string | undefined;
|
|
1182
1168
|
}, {
|
|
1183
|
-
provider: "
|
|
1169
|
+
provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
|
|
1184
1170
|
callbackURL?: string | undefined;
|
|
1185
1171
|
}>;
|
|
1186
1172
|
}>]>(...ctx: C): Promise<C extends [{
|
|
@@ -1214,12 +1200,12 @@ declare const signInOAuth: {
|
|
|
1214
1200
|
/**
|
|
1215
1201
|
* OAuth2 provider to use`
|
|
1216
1202
|
*/
|
|
1217
|
-
provider: z.ZodEnum<["github", ...("
|
|
1203
|
+
provider: z.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter")[]]>;
|
|
1218
1204
|
}, "strip", z.ZodTypeAny, {
|
|
1219
|
-
provider: "
|
|
1205
|
+
provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
|
|
1220
1206
|
callbackURL?: string | undefined;
|
|
1221
1207
|
}, {
|
|
1222
|
-
provider: "
|
|
1208
|
+
provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
|
|
1223
1209
|
callbackURL?: string | undefined;
|
|
1224
1210
|
}>;
|
|
1225
1211
|
};
|
|
@@ -2436,12 +2422,12 @@ declare function getEndpoints<C extends AuthContext, Option extends BetterAuthOp
|
|
|
2436
2422
|
}>>;
|
|
2437
2423
|
body: zod.ZodObject<{
|
|
2438
2424
|
callbackURL: zod.ZodOptional<zod.ZodString>;
|
|
2439
|
-
provider: zod.ZodEnum<["github", ...("
|
|
2425
|
+
provider: zod.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter")[]]>;
|
|
2440
2426
|
}, "strip", zod.ZodTypeAny, {
|
|
2441
|
-
provider: "
|
|
2427
|
+
provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
|
|
2442
2428
|
callbackURL?: string | undefined;
|
|
2443
2429
|
}, {
|
|
2444
|
-
provider: "
|
|
2430
|
+
provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
|
|
2445
2431
|
callbackURL?: string | undefined;
|
|
2446
2432
|
}>;
|
|
2447
2433
|
}>]>(...ctx: C_1): Promise<C_1 extends [{
|
|
@@ -2465,12 +2451,12 @@ declare function getEndpoints<C extends AuthContext, Option extends BetterAuthOp
|
|
|
2465
2451
|
}>>;
|
|
2466
2452
|
body: zod.ZodObject<{
|
|
2467
2453
|
callbackURL: zod.ZodOptional<zod.ZodString>;
|
|
2468
|
-
provider: zod.ZodEnum<["github", ...("
|
|
2454
|
+
provider: zod.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter")[]]>;
|
|
2469
2455
|
}, "strip", zod.ZodTypeAny, {
|
|
2470
|
-
provider: "
|
|
2456
|
+
provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
|
|
2471
2457
|
callbackURL?: string | undefined;
|
|
2472
2458
|
}, {
|
|
2473
|
-
provider: "
|
|
2459
|
+
provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
|
|
2474
2460
|
callbackURL?: string | undefined;
|
|
2475
2461
|
}>;
|
|
2476
2462
|
};
|
|
@@ -3545,12 +3531,12 @@ declare const router: <C extends AuthContext, Option extends BetterAuthOptions>(
|
|
|
3545
3531
|
}>>;
|
|
3546
3532
|
body: zod.ZodObject<{
|
|
3547
3533
|
callbackURL: zod.ZodOptional<zod.ZodString>;
|
|
3548
|
-
provider: zod.ZodEnum<["github", ...("
|
|
3534
|
+
provider: zod.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter")[]]>;
|
|
3549
3535
|
}, "strip", zod.ZodTypeAny, {
|
|
3550
|
-
provider: "
|
|
3536
|
+
provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
|
|
3551
3537
|
callbackURL?: string | undefined;
|
|
3552
3538
|
}, {
|
|
3553
|
-
provider: "
|
|
3539
|
+
provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
|
|
3554
3540
|
callbackURL?: string | undefined;
|
|
3555
3541
|
}>;
|
|
3556
3542
|
}>]>(...ctx: C_1): Promise<C_1 extends [{
|
|
@@ -3574,12 +3560,12 @@ declare const router: <C extends AuthContext, Option extends BetterAuthOptions>(
|
|
|
3574
3560
|
}>>;
|
|
3575
3561
|
body: zod.ZodObject<{
|
|
3576
3562
|
callbackURL: zod.ZodOptional<zod.ZodString>;
|
|
3577
|
-
provider: zod.ZodEnum<["github", ...("
|
|
3563
|
+
provider: zod.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter")[]]>;
|
|
3578
3564
|
}, "strip", zod.ZodTypeAny, {
|
|
3579
|
-
provider: "
|
|
3565
|
+
provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
|
|
3580
3566
|
callbackURL?: string | undefined;
|
|
3581
3567
|
}, {
|
|
3582
|
-
provider: "
|
|
3568
|
+
provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
|
|
3583
3569
|
callbackURL?: string | undefined;
|
|
3584
3570
|
}>;
|
|
3585
3571
|
};
|
|
@@ -4656,12 +4642,12 @@ declare const betterAuth: <O extends BetterAuthOptions>(options: O) => {
|
|
|
4656
4642
|
}>>;
|
|
4657
4643
|
body: zod.ZodObject<{
|
|
4658
4644
|
callbackURL: zod.ZodOptional<zod.ZodString>;
|
|
4659
|
-
provider: zod.ZodEnum<["github", ...("
|
|
4645
|
+
provider: zod.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter")[]]>;
|
|
4660
4646
|
}, "strip", zod.ZodTypeAny, {
|
|
4661
|
-
provider: "
|
|
4647
|
+
provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
|
|
4662
4648
|
callbackURL?: string | undefined;
|
|
4663
4649
|
}, {
|
|
4664
|
-
provider: "
|
|
4650
|
+
provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
|
|
4665
4651
|
callbackURL?: string | undefined;
|
|
4666
4652
|
}>;
|
|
4667
4653
|
}>]>(...ctx: C): Promise<C extends [{
|
|
@@ -4685,12 +4671,12 @@ declare const betterAuth: <O extends BetterAuthOptions>(options: O) => {
|
|
|
4685
4671
|
}>>;
|
|
4686
4672
|
body: zod.ZodObject<{
|
|
4687
4673
|
callbackURL: zod.ZodOptional<zod.ZodString>;
|
|
4688
|
-
provider: zod.ZodEnum<["github", ...("
|
|
4674
|
+
provider: zod.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter")[]]>;
|
|
4689
4675
|
}, "strip", zod.ZodTypeAny, {
|
|
4690
|
-
provider: "
|
|
4676
|
+
provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
|
|
4691
4677
|
callbackURL?: string | undefined;
|
|
4692
4678
|
}, {
|
|
4693
|
-
provider: "
|
|
4679
|
+
provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
|
|
4694
4680
|
callbackURL?: string | undefined;
|
|
4695
4681
|
}>;
|
|
4696
4682
|
};
|
|
@@ -5,7 +5,7 @@ import { P as Prettify } from './helper-DPDj8Nix.js';
|
|
|
5
5
|
import { A as AccessControl, R as Role, S as StatementsPrimitive, g as defaultRoles } from './statement-CfnyN34h.js';
|
|
6
6
|
import * as _better_fetch_fetch from '@better-fetch/fetch';
|
|
7
7
|
import { BetterFetch, BetterFetchOption } from '@better-fetch/fetch';
|
|
8
|
-
import { H as HookEndpointContext, g as AuthContext } from './index-
|
|
8
|
+
import { H as HookEndpointContext, g as AuthContext } from './index-Bt0CUdx4.js';
|
|
9
9
|
import * as nanostores from 'nanostores';
|
|
10
10
|
import { atom } from 'nanostores';
|
|
11
11
|
import * as _simplewebauthn_types from '@simplewebauthn/types';
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -820,8 +820,7 @@ import { APIError as APIError2 } from "better-call";
|
|
|
820
820
|
|
|
821
821
|
// src/utils/date.ts
|
|
822
822
|
var getDate = (span, unit = "ms") => {
|
|
823
|
-
|
|
824
|
-
return new Date(date.getTime() + (unit === "sec" ? span * 1e3 : span));
|
|
823
|
+
return new Date(Date.now() + (unit === "sec" ? span * 1e3 : span));
|
|
825
824
|
};
|
|
826
825
|
|
|
827
826
|
// src/cookies/index.ts
|
|
@@ -830,7 +829,7 @@ function getCookies(options) {
|
|
|
830
829
|
const secure = options.advanced?.useSecureCookies !== void 0 ? options.advanced?.useSecureCookies : options.baseURL?.startsWith("https://") || process.env.NODE_ENV === "production";
|
|
831
830
|
const secureCookiePrefix = secure ? "__Secure-" : "";
|
|
832
831
|
const cookiePrefix = "better-auth";
|
|
833
|
-
const sessionMaxAge = new TimeSpan(7, "d").seconds();
|
|
832
|
+
const sessionMaxAge = options.session?.expiresIn || new TimeSpan(7, "d").seconds();
|
|
834
833
|
const crossSubdomainEnabled = !!options.advanced?.crossSubDomainCookies?.enabled;
|
|
835
834
|
const domain = crossSubdomainEnabled ? options.advanced?.crossSubDomainCookies?.domain || (options.baseURL ? new URL(options.baseURL).hostname : void 0) : void 0;
|
|
836
835
|
if (crossSubdomainEnabled && !domain) {
|
|
@@ -934,12 +933,15 @@ function createCookieGetter(options) {
|
|
|
934
933
|
}
|
|
935
934
|
async function setSessionCookie(ctx, sessionToken, dontRememberMe, overrides) {
|
|
936
935
|
const options = ctx.context.authCookies.sessionToken.options;
|
|
937
|
-
options.maxAge = dontRememberMe ? void 0 :
|
|
936
|
+
options.maxAge = dontRememberMe ? void 0 : ctx.context.sessionConfig.expiresIn;
|
|
938
937
|
await ctx.setSignedCookie(
|
|
939
938
|
ctx.context.authCookies.sessionToken.name,
|
|
940
939
|
sessionToken,
|
|
941
940
|
ctx.context.secret,
|
|
942
|
-
|
|
941
|
+
{
|
|
942
|
+
...options,
|
|
943
|
+
...overrides
|
|
944
|
+
}
|
|
943
945
|
);
|
|
944
946
|
if (dontRememberMe) {
|
|
945
947
|
await ctx.setSignedCookie(
|
|
@@ -3756,42 +3758,54 @@ var createInternalAdapter = (adapter, ctx) => {
|
|
|
3756
3758
|
* set the session to expire in 1 day.
|
|
3757
3759
|
* The cookie will be set to expire at the end of the session
|
|
3758
3760
|
*/
|
|
3759
|
-
expiresAt: dontRememberMe ? getDate(
|
|
3761
|
+
expiresAt: dontRememberMe ? getDate(60 * 60 * 24, "sec") : getDate(sessionExpiration, "sec"),
|
|
3760
3762
|
ipAddress: headers?.get("x-forwarded-for") || "",
|
|
3761
3763
|
userAgent: headers?.get("user-agent") || ""
|
|
3762
3764
|
};
|
|
3763
3765
|
const session = await createWithHooks(data, "session");
|
|
3764
3766
|
if (secondaryStorage && session) {
|
|
3767
|
+
const user = await adapter.findOne({
|
|
3768
|
+
model: tables.user.tableName,
|
|
3769
|
+
where: [{ field: "id", value: userId }]
|
|
3770
|
+
});
|
|
3765
3771
|
secondaryStorage.set(
|
|
3766
3772
|
session.id,
|
|
3767
|
-
JSON.stringify(
|
|
3773
|
+
JSON.stringify({
|
|
3774
|
+
session,
|
|
3775
|
+
user
|
|
3776
|
+
}),
|
|
3768
3777
|
sessionExpiration
|
|
3769
3778
|
);
|
|
3770
3779
|
}
|
|
3771
3780
|
return session;
|
|
3772
3781
|
},
|
|
3773
3782
|
findSession: async (sessionId) => {
|
|
3774
|
-
let session = null;
|
|
3775
3783
|
if (secondaryStorage) {
|
|
3776
3784
|
const sessionStringified = await secondaryStorage.get(sessionId);
|
|
3777
3785
|
if (sessionStringified) {
|
|
3778
3786
|
const s = JSON.parse(sessionStringified);
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3787
|
+
return {
|
|
3788
|
+
session: {
|
|
3789
|
+
...s.session,
|
|
3790
|
+
expiresAt: new Date(s.session.expiresAt)
|
|
3791
|
+
},
|
|
3792
|
+
user: {
|
|
3793
|
+
...s.user,
|
|
3794
|
+
createdAt: new Date(s.user.createdAt),
|
|
3795
|
+
updatedAt: new Date(s.user.updatedAt)
|
|
3796
|
+
}
|
|
3782
3797
|
};
|
|
3783
3798
|
}
|
|
3784
|
-
} else {
|
|
3785
|
-
session = await adapter.findOne({
|
|
3786
|
-
model: tables.session.tableName,
|
|
3787
|
-
where: [
|
|
3788
|
-
{
|
|
3789
|
-
value: sessionId,
|
|
3790
|
-
field: "id"
|
|
3791
|
-
}
|
|
3792
|
-
]
|
|
3793
|
-
});
|
|
3794
3799
|
}
|
|
3800
|
+
const session = await adapter.findOne({
|
|
3801
|
+
model: tables.session.tableName,
|
|
3802
|
+
where: [
|
|
3803
|
+
{
|
|
3804
|
+
value: sessionId,
|
|
3805
|
+
field: "id"
|
|
3806
|
+
}
|
|
3807
|
+
]
|
|
3808
|
+
});
|
|
3795
3809
|
if (!session) {
|
|
3796
3810
|
return null;
|
|
3797
3811
|
}
|
package/dist/next-js.d.ts
CHANGED
package/dist/node.d.ts
CHANGED
package/dist/plugins.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { A as AnonymousOptions, O as OrganizationOptions, b as Passkey, P as PasskeyOptions, U as UserWithPhoneNumber, f as UserWithRole, i as admin, h as adminMiddleware, e as anonymous, g as getPasskeyActions, m as magicLink, o as organization, p as passkey, c as passkeyClient, d as phoneNumber, t as twoFactor, a as twoFactorClient, u as username } from './index-
|
|
1
|
+
export { A as AnonymousOptions, O as OrganizationOptions, b as Passkey, P as PasskeyOptions, U as UserWithPhoneNumber, f as UserWithRole, i as admin, h as adminMiddleware, e as anonymous, g as getPasskeyActions, m as magicLink, o as organization, p as passkey, c as passkeyClient, d as phoneNumber, t as twoFactor, a as twoFactorClient, u as username } from './index-CJ44EC0j.js';
|
|
2
2
|
export { i as ac } from './index-DfAHOgpj.js';
|
|
3
|
-
import { H as HookEndpointContext } from './index-
|
|
4
|
-
export { e as AuthEndpoint, f as AuthMiddleware, b as BetterAuthPlugin, P as PluginSchema, d as createAuthEndpoint, c as createAuthMiddleware, o as optionsMiddleware } from './index-
|
|
3
|
+
import { H as HookEndpointContext } from './index-Bt0CUdx4.js';
|
|
4
|
+
export { e as AuthEndpoint, f as AuthMiddleware, b as BetterAuthPlugin, P as PluginSchema, d as createAuthEndpoint, c as createAuthMiddleware, o as optionsMiddleware } from './index-Bt0CUdx4.js';
|
|
5
5
|
import './types-IzAbV4nB.js';
|
|
6
6
|
import 'zod';
|
|
7
7
|
import './helper-DPDj8Nix.js';
|
package/dist/plugins.js
CHANGED
|
@@ -760,20 +760,22 @@ import { APIError } from "better-call";
|
|
|
760
760
|
|
|
761
761
|
// src/utils/date.ts
|
|
762
762
|
var getDate = (span, unit = "ms") => {
|
|
763
|
-
|
|
764
|
-
return new Date(date.getTime() + (unit === "sec" ? span * 1e3 : span));
|
|
763
|
+
return new Date(Date.now() + (unit === "sec" ? span * 1e3 : span));
|
|
765
764
|
};
|
|
766
765
|
|
|
767
766
|
// src/cookies/index.ts
|
|
768
767
|
import { TimeSpan } from "oslo";
|
|
769
768
|
async function setSessionCookie(ctx, sessionToken, dontRememberMe, overrides) {
|
|
770
769
|
const options = ctx.context.authCookies.sessionToken.options;
|
|
771
|
-
options.maxAge = dontRememberMe ? void 0 :
|
|
770
|
+
options.maxAge = dontRememberMe ? void 0 : ctx.context.sessionConfig.expiresIn;
|
|
772
771
|
await ctx.setSignedCookie(
|
|
773
772
|
ctx.context.authCookies.sessionToken.name,
|
|
774
773
|
sessionToken,
|
|
775
774
|
ctx.context.secret,
|
|
776
|
-
|
|
775
|
+
{
|
|
776
|
+
...options,
|
|
777
|
+
...overrides
|
|
778
|
+
}
|
|
777
779
|
);
|
|
778
780
|
if (dontRememberMe) {
|
|
779
781
|
await ctx.setSignedCookie(
|
package/dist/react.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import * as _better_fetch_fetch from '@better-fetch/fetch';
|
|
|
3
3
|
import { U as UnionToIntersection, P as Prettify, S as StripEmptyObjects } from './helper-DPDj8Nix.js';
|
|
4
4
|
import { ClientOptions, InferClientAPI, InferActions, InferAdditionalFromClient, BetterAuthClientPlugin, IsSignal } from './types.js';
|
|
5
5
|
import { useStore } from '@nanostores/react';
|
|
6
|
-
import './index-
|
|
6
|
+
import './index-Bt0CUdx4.js';
|
|
7
7
|
import 'kysely';
|
|
8
8
|
import './types-IzAbV4nB.js';
|
|
9
9
|
import 'better-call';
|
package/dist/solid-start.d.ts
CHANGED
package/dist/solid.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import * as _better_fetch_fetch from '@better-fetch/fetch';
|
|
|
3
3
|
import { U as UnionToIntersection, P as Prettify, S as StripEmptyObjects } from './helper-DPDj8Nix.js';
|
|
4
4
|
import { ClientOptions, InferClientAPI, InferActions, InferAdditionalFromClient, BetterAuthClientPlugin, IsSignal } from './types.js';
|
|
5
5
|
import { Accessor } from 'solid-js';
|
|
6
|
-
import './index-
|
|
6
|
+
import './index-Bt0CUdx4.js';
|
|
7
7
|
import 'kysely';
|
|
8
8
|
import './types-IzAbV4nB.js';
|
|
9
9
|
import 'better-call';
|
package/dist/svelte-kit.d.ts
CHANGED
package/dist/svelte.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import * as nanostores from 'nanostores';
|
|
|
3
3
|
import * as _better_fetch_fetch from '@better-fetch/fetch';
|
|
4
4
|
import { U as UnionToIntersection, P as Prettify, S as StripEmptyObjects } from './helper-DPDj8Nix.js';
|
|
5
5
|
import { ClientOptions, InferClientAPI, InferActions, InferAdditionalFromClient, BetterAuthClientPlugin, IsSignal } from './types.js';
|
|
6
|
-
import './index-
|
|
6
|
+
import './index-Bt0CUdx4.js';
|
|
7
7
|
import 'kysely';
|
|
8
8
|
import './types-IzAbV4nB.js';
|
|
9
9
|
import 'better-call';
|
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { b as BetterAuthPlugin, a as Auth, I as InferFieldsInputClient, h as InferFieldsOutput } from './index-
|
|
2
|
-
export { A as Adapter, k as AdditionalSessionFieldsInput, l as AdditionalSessionFieldsOutput, i as AdditionalUserFieldsInput, j as AdditionalUserFieldsOutput, g as AuthContext, B as BetterAuthOptions, G as GenericEndpointContext, H as HookEndpointContext, p as InferPluginTypes, n as InferSession, m as InferUser, P as PluginSchema, R as RateLimit, S as SecondaryStorage, W as Where, q as init } from './index-
|
|
1
|
+
import { b as BetterAuthPlugin, a as Auth, I as InferFieldsInputClient, h as InferFieldsOutput } from './index-Bt0CUdx4.js';
|
|
2
|
+
export { A as Adapter, k as AdditionalSessionFieldsInput, l as AdditionalSessionFieldsOutput, i as AdditionalUserFieldsInput, j as AdditionalUserFieldsOutput, g as AuthContext, B as BetterAuthOptions, G as GenericEndpointContext, H as HookEndpointContext, p as InferPluginTypes, n as InferSession, m as InferUser, P as PluginSchema, R as RateLimit, S as SecondaryStorage, W as Where, q as init } from './index-Bt0CUdx4.js';
|
|
3
3
|
import { U as UnionToIntersection, H as HasRequiredKeys, P as Prettify, S as StripEmptyObjects, L as LiteralString } from './helper-DPDj8Nix.js';
|
|
4
4
|
export { D as DeepPartial, a as LiteralUnion, R as RequiredKeysOf, W as WithoutEmpty } from './helper-DPDj8Nix.js';
|
|
5
5
|
import { S as Session, U as User } from './types-IzAbV4nB.js';
|
package/dist/vue.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import * as _better_fetch_fetch from '@better-fetch/fetch';
|
|
|
3
3
|
import { U as UnionToIntersection, P as Prettify, S as StripEmptyObjects } from './helper-DPDj8Nix.js';
|
|
4
4
|
import { ClientOptions, InferClientAPI, InferActions, InferAdditionalFromClient, BetterAuthClientPlugin, IsSignal } from './types.js';
|
|
5
5
|
import { Ref, DeepReadonly } from 'vue';
|
|
6
|
-
import './index-
|
|
6
|
+
import './index-Bt0CUdx4.js';
|
|
7
7
|
import 'kysely';
|
|
8
8
|
import './types-IzAbV4nB.js';
|
|
9
9
|
import 'better-call';
|