better-auth 0.4.9-beta.4 → 0.4.9-beta.6

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.
@@ -1,4 +1,4 @@
1
- import { A as Adapter } from '../index-DJvDzGCt.js';
1
+ import { A as Adapter } from '../index-DLbRYrL5.js';
2
2
  import 'zod';
3
3
  import 'kysely';
4
4
  import '../types-IzAbV4nB.js';
@@ -1,5 +1,5 @@
1
1
  import { Db } from 'mongodb';
2
- import { W as Where } from '../index-DJvDzGCt.js';
2
+ import { W as Where } from '../index-DLbRYrL5.js';
3
3
  import 'zod';
4
4
  import 'kysely';
5
5
  import '../types-IzAbV4nB.js';
@@ -1,4 +1,4 @@
1
- import { A as Adapter } from '../index-DJvDzGCt.js';
1
+ import { A as Adapter } from '../index-DLbRYrL5.js';
2
2
  import 'zod';
3
3
  import 'kysely';
4
4
  import '../types-IzAbV4nB.js';
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-DJvDzGCt.js';
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-DLbRYrL5.js';
2
2
  import './helper-DPDj8Nix.js';
3
3
  import 'zod';
4
4
  export { APIError } from 'better-call';
package/dist/api.js CHANGED
@@ -1570,30 +1570,14 @@ var callbackOAuth = createAuthEndpoint(
1570
1570
  );
1571
1571
 
1572
1572
  // src/api/routes/sign-out.ts
1573
- import { z as z7 } from "zod";
1573
+ import "zod";
1574
1574
  import { APIError as APIError7 } from "better-call";
1575
1575
  var signOut = createAuthEndpoint(
1576
1576
  "/sign-out",
1577
1577
  {
1578
- method: "POST",
1579
- body: z7.optional(
1580
- z7.object({
1581
- callbackURL: z7.string().optional()
1582
- })
1583
- ),
1584
- use: [redirectURLMiddleware]
1578
+ method: "POST"
1585
1579
  },
1586
1580
  async (ctx) => {
1587
- const callbackOrigin = ctx.body?.callbackURL ? new URL(ctx.body.callbackURL).origin : null;
1588
- const trustedOrigins = [
1589
- ctx.context.baseURL,
1590
- ...ctx.context.options.trustedOrigins || []
1591
- ];
1592
- if (callbackOrigin && !trustedOrigins.includes(callbackOrigin)) {
1593
- throw new APIError7("UNAUTHORIZED", {
1594
- message: "Invalid callback URL"
1595
- });
1596
- }
1597
1581
  const sessionCookieToken = await ctx.getSignedCookie(
1598
1582
  ctx.context.authCookies.sessionToken.name,
1599
1583
  ctx.context.secret
@@ -1605,11 +1589,8 @@ var signOut = createAuthEndpoint(
1605
1589
  }
1606
1590
  await ctx.context.internalAdapter.deleteSession(sessionCookieToken);
1607
1591
  deleteSessionCookie(ctx);
1608
- return ctx.json(null, {
1609
- body: {
1610
- redirect: !!ctx.body?.callbackURL,
1611
- url: ctx.body?.callbackURL
1612
- }
1592
+ return ctx.json({
1593
+ success: true
1613
1594
  });
1614
1595
  }
1615
1596
  );
@@ -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, k as Organization, M as Member, I as Invitation, u as username, m as magicLink, d as phoneNumber, e as anonymous, i as admin, j as genericOAuth } from '../index-Do85clFc.js';
6
- export { g as getPasskeyActions, c as passkeyClient, a as twoFactorClient } from '../index-Do85clFc.js';
5
+ import { o as organization, k as Organization, M as Member, I as Invitation, u as username, m as magicLink, d as phoneNumber, e as anonymous, i as admin, j as genericOAuth } from '../index-e3_mbU9X.js';
6
+ export { g as getPasskeyActions, c as passkeyClient, a as twoFactorClient } from '../index-e3_mbU9X.js';
7
7
  import { P as Prettify } from '../helper-DPDj8Nix.js';
8
- import { F as FieldAttribute, B as BetterAuthOptions, b as BetterAuthPlugin } from '../index-DJvDzGCt.js';
8
+ import { F as FieldAttribute, B as BetterAuthOptions, b as BetterAuthPlugin } from '../index-DLbRYrL5.js';
9
9
  import '../types-IzAbV4nB.js';
10
10
  import 'zod';
11
11
  import 'better-call';
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-DJvDzGCt.js';
9
+ import './index-DLbRYrL5.js';
10
10
  import 'kysely';
11
11
  import './types-IzAbV4nB.js';
12
12
  import 'better-call';
@@ -1120,12 +1120,12 @@ declare const signInOAuth: {
1120
1120
  /**
1121
1121
  * OAuth2 provider to use`
1122
1122
  */
1123
- provider: z.ZodEnum<["github", ...("github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter")[]]>;
1123
+ provider: z.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter")[]]>;
1124
1124
  }, "strip", z.ZodTypeAny, {
1125
- provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
1125
+ provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
1126
1126
  callbackURL?: string | undefined;
1127
1127
  }, {
1128
- provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
1128
+ provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
1129
1129
  callbackURL?: string | undefined;
1130
1130
  }>;
1131
1131
  use: better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, void>, better_call.EndpointOptions>[];
@@ -1160,12 +1160,12 @@ declare const signInOAuth: {
1160
1160
  /**
1161
1161
  * OAuth2 provider to use`
1162
1162
  */
1163
- provider: z.ZodEnum<["github", ...("github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter")[]]>;
1163
+ provider: z.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter")[]]>;
1164
1164
  }, "strip", z.ZodTypeAny, {
1165
- provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
1165
+ provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
1166
1166
  callbackURL?: string | undefined;
1167
1167
  }, {
1168
- provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
1168
+ provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
1169
1169
  callbackURL?: string | undefined;
1170
1170
  }>;
1171
1171
  use: better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, void>, better_call.EndpointOptions>[];
@@ -1546,28 +1546,14 @@ declare const revokeSessions: {
1546
1546
  declare const signOut: {
1547
1547
  <C extends [(better_call.Context<"/sign-out", {
1548
1548
  method: "POST";
1549
- body: z.ZodOptional<z.ZodObject<{
1550
- callbackURL: z.ZodOptional<z.ZodString>;
1551
- }, "strip", z.ZodTypeAny, {
1552
- callbackURL?: string | undefined;
1553
- }, {
1554
- callbackURL?: string | undefined;
1555
- }>>;
1556
- use: better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, void>, better_call.EndpointOptions>[];
1557
1549
  }> | undefined)?]>(...ctx: C): Promise<C extends [{
1558
1550
  asResponse: true;
1559
- }] ? Response : null>;
1551
+ }] ? Response : {
1552
+ success: boolean;
1553
+ }>;
1560
1554
  path: "/sign-out";
1561
1555
  options: {
1562
1556
  method: "POST";
1563
- body: z.ZodOptional<z.ZodObject<{
1564
- callbackURL: z.ZodOptional<z.ZodString>;
1565
- }, "strip", z.ZodTypeAny, {
1566
- callbackURL?: string | undefined;
1567
- }, {
1568
- callbackURL?: string | undefined;
1569
- }>>;
1570
- use: better_call.Endpoint<better_call.Handler<string, better_call.EndpointOptions, void>, better_call.EndpointOptions>[];
1571
1557
  };
1572
1558
  method: better_call.Method | better_call.Method[];
1573
1559
  headers: Headers;
@@ -2375,12 +2361,12 @@ declare function getEndpoints<C extends AuthContext, Option extends BetterAuthOp
2375
2361
  }>>;
2376
2362
  body: zod.ZodObject<{
2377
2363
  callbackURL: zod.ZodOptional<zod.ZodString>;
2378
- provider: zod.ZodEnum<["github", ...("github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter")[]]>;
2364
+ provider: zod.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter")[]]>;
2379
2365
  }, "strip", zod.ZodTypeAny, {
2380
- provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
2366
+ provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
2381
2367
  callbackURL?: string | undefined;
2382
2368
  }, {
2383
- provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
2369
+ provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
2384
2370
  callbackURL?: string | undefined;
2385
2371
  }>;
2386
2372
  use: Endpoint<better_call.Handler<string, better_call.EndpointOptions, void>, better_call.EndpointOptions>[];
@@ -2405,12 +2391,12 @@ declare function getEndpoints<C extends AuthContext, Option extends BetterAuthOp
2405
2391
  }>>;
2406
2392
  body: zod.ZodObject<{
2407
2393
  callbackURL: zod.ZodOptional<zod.ZodString>;
2408
- provider: zod.ZodEnum<["github", ...("github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter")[]]>;
2394
+ provider: zod.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter")[]]>;
2409
2395
  }, "strip", zod.ZodTypeAny, {
2410
- provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
2396
+ provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
2411
2397
  callbackURL?: string | undefined;
2412
2398
  }, {
2413
- provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
2399
+ provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
2414
2400
  callbackURL?: string | undefined;
2415
2401
  }>;
2416
2402
  use: Endpoint<better_call.Handler<string, better_call.EndpointOptions, void>, better_call.EndpointOptions>[];
@@ -2519,28 +2505,14 @@ declare function getEndpoints<C extends AuthContext, Option extends BetterAuthOp
2519
2505
  signOut: {
2520
2506
  <C_1 extends [(better_call.Context<"/sign-out", {
2521
2507
  method: "POST";
2522
- body: zod.ZodOptional<zod.ZodObject<{
2523
- callbackURL: zod.ZodOptional<zod.ZodString>;
2524
- }, "strip", zod.ZodTypeAny, {
2525
- callbackURL?: string | undefined;
2526
- }, {
2527
- callbackURL?: string | undefined;
2528
- }>>;
2529
- use: Endpoint<better_call.Handler<string, better_call.EndpointOptions, void>, better_call.EndpointOptions>[];
2530
2508
  }> | undefined)?]>(...ctx: C_1): Promise<C_1 extends [{
2531
2509
  asResponse: true;
2532
- }] ? Response : null>;
2510
+ }] ? Response : {
2511
+ success: boolean;
2512
+ }>;
2533
2513
  path: "/sign-out";
2534
2514
  options: {
2535
2515
  method: "POST";
2536
- body: zod.ZodOptional<zod.ZodObject<{
2537
- callbackURL: zod.ZodOptional<zod.ZodString>;
2538
- }, "strip", zod.ZodTypeAny, {
2539
- callbackURL?: string | undefined;
2540
- }, {
2541
- callbackURL?: string | undefined;
2542
- }>>;
2543
- use: Endpoint<better_call.Handler<string, better_call.EndpointOptions, void>, better_call.EndpointOptions>[];
2544
2516
  };
2545
2517
  method: better_call.Method | better_call.Method[];
2546
2518
  headers: Headers;
@@ -3478,12 +3450,12 @@ declare const router: <C extends AuthContext, Option extends BetterAuthOptions>(
3478
3450
  }>>;
3479
3451
  body: zod.ZodObject<{
3480
3452
  callbackURL: zod.ZodOptional<zod.ZodString>;
3481
- provider: zod.ZodEnum<["github", ...("github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter")[]]>;
3453
+ provider: zod.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter")[]]>;
3482
3454
  }, "strip", zod.ZodTypeAny, {
3483
- provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
3455
+ provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
3484
3456
  callbackURL?: string | undefined;
3485
3457
  }, {
3486
- provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
3458
+ provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
3487
3459
  callbackURL?: string | undefined;
3488
3460
  }>;
3489
3461
  use: Endpoint<better_call.Handler<string, better_call.EndpointOptions, void>, better_call.EndpointOptions>[];
@@ -3508,12 +3480,12 @@ declare const router: <C extends AuthContext, Option extends BetterAuthOptions>(
3508
3480
  }>>;
3509
3481
  body: zod.ZodObject<{
3510
3482
  callbackURL: zod.ZodOptional<zod.ZodString>;
3511
- provider: zod.ZodEnum<["github", ...("github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter")[]]>;
3483
+ provider: zod.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter")[]]>;
3512
3484
  }, "strip", zod.ZodTypeAny, {
3513
- provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
3485
+ provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
3514
3486
  callbackURL?: string | undefined;
3515
3487
  }, {
3516
- provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
3488
+ provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
3517
3489
  callbackURL?: string | undefined;
3518
3490
  }>;
3519
3491
  use: Endpoint<better_call.Handler<string, better_call.EndpointOptions, void>, better_call.EndpointOptions>[];
@@ -3622,28 +3594,14 @@ declare const router: <C extends AuthContext, Option extends BetterAuthOptions>(
3622
3594
  signOut: {
3623
3595
  <C_1 extends [(better_call.Context<"/sign-out", {
3624
3596
  method: "POST";
3625
- body: zod.ZodOptional<zod.ZodObject<{
3626
- callbackURL: zod.ZodOptional<zod.ZodString>;
3627
- }, "strip", zod.ZodTypeAny, {
3628
- callbackURL?: string | undefined;
3629
- }, {
3630
- callbackURL?: string | undefined;
3631
- }>>;
3632
- use: Endpoint<better_call.Handler<string, better_call.EndpointOptions, void>, better_call.EndpointOptions>[];
3633
3597
  }> | undefined)?]>(...ctx: C_1): Promise<C_1 extends [{
3634
3598
  asResponse: true;
3635
- }] ? Response : null>;
3599
+ }] ? Response : {
3600
+ success: boolean;
3601
+ }>;
3636
3602
  path: "/sign-out";
3637
3603
  options: {
3638
3604
  method: "POST";
3639
- body: zod.ZodOptional<zod.ZodObject<{
3640
- callbackURL: zod.ZodOptional<zod.ZodString>;
3641
- }, "strip", zod.ZodTypeAny, {
3642
- callbackURL?: string | undefined;
3643
- }, {
3644
- callbackURL?: string | undefined;
3645
- }>>;
3646
- use: Endpoint<better_call.Handler<string, better_call.EndpointOptions, void>, better_call.EndpointOptions>[];
3647
3605
  };
3648
3606
  method: better_call.Method | better_call.Method[];
3649
3607
  headers: Headers;
@@ -4583,12 +4541,12 @@ declare const betterAuth: <O extends BetterAuthOptions>(options: O) => {
4583
4541
  }>>;
4584
4542
  body: zod.ZodObject<{
4585
4543
  callbackURL: zod.ZodOptional<zod.ZodString>;
4586
- provider: zod.ZodEnum<["github", ...("github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter")[]]>;
4544
+ provider: zod.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter")[]]>;
4587
4545
  }, "strip", zod.ZodTypeAny, {
4588
- provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
4546
+ provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
4589
4547
  callbackURL?: string | undefined;
4590
4548
  }, {
4591
- provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
4549
+ provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
4592
4550
  callbackURL?: string | undefined;
4593
4551
  }>;
4594
4552
  use: Endpoint<better_call.Handler<string, better_call.EndpointOptions, void>, better_call.EndpointOptions>[];
@@ -4613,12 +4571,12 @@ declare const betterAuth: <O extends BetterAuthOptions>(options: O) => {
4613
4571
  }>>;
4614
4572
  body: zod.ZodObject<{
4615
4573
  callbackURL: zod.ZodOptional<zod.ZodString>;
4616
- provider: zod.ZodEnum<["github", ...("github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter")[]]>;
4574
+ provider: zod.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter")[]]>;
4617
4575
  }, "strip", zod.ZodTypeAny, {
4618
- provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
4576
+ provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
4619
4577
  callbackURL?: string | undefined;
4620
4578
  }, {
4621
- provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
4579
+ provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
4622
4580
  callbackURL?: string | undefined;
4623
4581
  }>;
4624
4582
  use: Endpoint<better_call.Handler<string, better_call.EndpointOptions, void>, better_call.EndpointOptions>[];
@@ -4727,28 +4685,14 @@ declare const betterAuth: <O extends BetterAuthOptions>(options: O) => {
4727
4685
  signOut: {
4728
4686
  <C extends [(better_call.Context<"/sign-out", {
4729
4687
  method: "POST";
4730
- body: zod.ZodOptional<zod.ZodObject<{
4731
- callbackURL: zod.ZodOptional<zod.ZodString>;
4732
- }, "strip", zod.ZodTypeAny, {
4733
- callbackURL?: string | undefined;
4734
- }, {
4735
- callbackURL?: string | undefined;
4736
- }>>;
4737
- use: Endpoint<better_call.Handler<string, better_call.EndpointOptions, void>, better_call.EndpointOptions>[];
4738
4688
  }> | undefined)?]>(...ctx: C): Promise<C extends [{
4739
4689
  asResponse: true;
4740
- }] ? Response : null>;
4690
+ }] ? Response : {
4691
+ success: boolean;
4692
+ }>;
4741
4693
  path: "/sign-out";
4742
4694
  options: {
4743
4695
  method: "POST";
4744
- body: zod.ZodOptional<zod.ZodObject<{
4745
- callbackURL: zod.ZodOptional<zod.ZodString>;
4746
- }, "strip", zod.ZodTypeAny, {
4747
- callbackURL?: string | undefined;
4748
- }, {
4749
- callbackURL?: string | undefined;
4750
- }>>;
4751
- use: Endpoint<better_call.Handler<string, better_call.EndpointOptions, void>, better_call.EndpointOptions>[];
4752
4696
  };
4753
4697
  method: better_call.Method | better_call.Method[];
4754
4698
  headers: Headers;
@@ -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-DJvDzGCt.js';
8
+ import { H as HookEndpointContext, g as AuthContext } from './index-DLbRYrL5.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
@@ -1,4 +1,4 @@
1
- export { a as Auth, a0 as betterAuth } from './index-DJvDzGCt.js';
1
+ export { a as Auth, a0 as betterAuth } from './index-DLbRYrL5.js';
2
2
  import 'zod';
3
3
  import 'kysely';
4
4
  import './types-IzAbV4nB.js';
package/dist/index.js CHANGED
@@ -1676,30 +1676,14 @@ var callbackOAuth = createAuthEndpoint(
1676
1676
  );
1677
1677
 
1678
1678
  // src/api/routes/sign-out.ts
1679
- import { z as z7 } from "zod";
1679
+ import "zod";
1680
1680
  import { APIError as APIError7 } from "better-call";
1681
1681
  var signOut = createAuthEndpoint(
1682
1682
  "/sign-out",
1683
1683
  {
1684
- method: "POST",
1685
- body: z7.optional(
1686
- z7.object({
1687
- callbackURL: z7.string().optional()
1688
- })
1689
- ),
1690
- use: [redirectURLMiddleware]
1684
+ method: "POST"
1691
1685
  },
1692
1686
  async (ctx) => {
1693
- const callbackOrigin = ctx.body?.callbackURL ? new URL(ctx.body.callbackURL).origin : null;
1694
- const trustedOrigins = [
1695
- ctx.context.baseURL,
1696
- ...ctx.context.options.trustedOrigins || []
1697
- ];
1698
- if (callbackOrigin && !trustedOrigins.includes(callbackOrigin)) {
1699
- throw new APIError7("UNAUTHORIZED", {
1700
- message: "Invalid callback URL"
1701
- });
1702
- }
1703
1687
  const sessionCookieToken = await ctx.getSignedCookie(
1704
1688
  ctx.context.authCookies.sessionToken.name,
1705
1689
  ctx.context.secret
@@ -1711,11 +1695,8 @@ var signOut = createAuthEndpoint(
1711
1695
  }
1712
1696
  await ctx.context.internalAdapter.deleteSession(sessionCookieToken);
1713
1697
  deleteSessionCookie(ctx);
1714
- return ctx.json(null, {
1715
- body: {
1716
- redirect: !!ctx.body?.callbackURL,
1717
- url: ctx.body?.callbackURL
1718
- }
1698
+ return ctx.json({
1699
+ success: true
1719
1700
  });
1720
1701
  }
1721
1702
  );
package/dist/next-js.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as Auth } from './index-DJvDzGCt.js';
1
+ import { a as Auth } from './index-DLbRYrL5.js';
2
2
  import { U as User, S as Session } from './types-IzAbV4nB.js';
3
3
  import { NextRequest } from 'next/server';
4
4
  import 'zod';
package/dist/node.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as http from 'http';
2
- import { a as Auth } from './index-DJvDzGCt.js';
2
+ import { a as Auth } from './index-DLbRYrL5.js';
3
3
  import 'zod';
4
4
  import 'kysely';
5
5
  import './types-IzAbV4nB.js';
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, j as genericOAuth, 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-Do85clFc.js';
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, j as genericOAuth, 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-e3_mbU9X.js';
2
2
  export { i as ac } from './index-DfAHOgpj.js';
3
- import { H as HookEndpointContext } from './index-DJvDzGCt.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-DJvDzGCt.js';
3
+ import { H as HookEndpointContext } from './index-DLbRYrL5.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-DLbRYrL5.js';
5
5
  import './types-IzAbV4nB.js';
6
6
  import 'zod';
7
7
  import './helper-DPDj8Nix.js';
package/dist/plugins.js CHANGED
@@ -1491,30 +1491,14 @@ var callbackOAuth = createAuthEndpoint(
1491
1491
  );
1492
1492
 
1493
1493
  // src/api/routes/sign-out.ts
1494
- import { z as z6 } from "zod";
1494
+ import "zod";
1495
1495
  import { APIError as APIError6 } from "better-call";
1496
1496
  var signOut = createAuthEndpoint(
1497
1497
  "/sign-out",
1498
1498
  {
1499
- method: "POST",
1500
- body: z6.optional(
1501
- z6.object({
1502
- callbackURL: z6.string().optional()
1503
- })
1504
- ),
1505
- use: [redirectURLMiddleware]
1499
+ method: "POST"
1506
1500
  },
1507
1501
  async (ctx) => {
1508
- const callbackOrigin = ctx.body?.callbackURL ? new URL(ctx.body.callbackURL).origin : null;
1509
- const trustedOrigins = [
1510
- ctx.context.baseURL,
1511
- ...ctx.context.options.trustedOrigins || []
1512
- ];
1513
- if (callbackOrigin && !trustedOrigins.includes(callbackOrigin)) {
1514
- throw new APIError6("UNAUTHORIZED", {
1515
- message: "Invalid callback URL"
1516
- });
1517
- }
1518
1502
  const sessionCookieToken = await ctx.getSignedCookie(
1519
1503
  ctx.context.authCookies.sessionToken.name,
1520
1504
  ctx.context.secret
@@ -1526,11 +1510,8 @@ var signOut = createAuthEndpoint(
1526
1510
  }
1527
1511
  await ctx.context.internalAdapter.deleteSession(sessionCookieToken);
1528
1512
  deleteSessionCookie(ctx);
1529
- return ctx.json(null, {
1530
- body: {
1531
- redirect: !!ctx.body?.callbackURL,
1532
- url: ctx.body?.callbackURL
1533
- }
1513
+ return ctx.json({
1514
+ success: true
1534
1515
  });
1535
1516
  }
1536
1517
  );
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-DJvDzGCt.js';
6
+ import './index-DLbRYrL5.js';
7
7
  import 'kysely';
8
8
  import './types-IzAbV4nB.js';
9
9
  import 'better-call';
@@ -1,4 +1,4 @@
1
- import { a as Auth } from './index-DJvDzGCt.js';
1
+ import { a as Auth } from './index-DLbRYrL5.js';
2
2
  import 'zod';
3
3
  import 'kysely';
4
4
  import './types-IzAbV4nB.js';
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-DJvDzGCt.js';
6
+ import './index-DLbRYrL5.js';
7
7
  import 'kysely';
8
8
  import './types-IzAbV4nB.js';
9
9
  import 'better-call';
@@ -1,4 +1,4 @@
1
- import { a as Auth, B as BetterAuthOptions } from './index-DJvDzGCt.js';
1
+ import { a as Auth, B as BetterAuthOptions } from './index-DLbRYrL5.js';
2
2
  import 'zod';
3
3
  import 'kysely';
4
4
  import './types-IzAbV4nB.js';
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-DJvDzGCt.js';
6
+ import './index-DLbRYrL5.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-DJvDzGCt.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-DJvDzGCt.js';
1
+ import { b as BetterAuthPlugin, a as Auth, I as InferFieldsInputClient, h as InferFieldsOutput } from './index-DLbRYrL5.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-DLbRYrL5.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';
@@ -108,7 +108,9 @@ interface ClientOptions {
108
108
  }
109
109
  type InferClientAPI<O extends ClientOptions> = InferRoutes<O["plugins"] extends Array<any> ? (O["plugins"] extends Array<infer Pl> ? UnionToIntersection<Pl extends {
110
110
  $InferServerPlugin: infer Plug;
111
- } ? Plug extends BetterAuthPlugin ? Plug["endpoints"] : {} : {}> : {}) & Auth["api"] : Auth["api"], O>;
111
+ } ? Plug extends {
112
+ endpoints: infer Endpoints;
113
+ } ? Endpoints : {} : {}> : {}) & Auth["api"] : Auth["api"], O>;
112
114
  type InferActions<O extends ClientOptions> = O["plugins"] extends Array<infer Plugin> ? UnionToIntersection<Plugin extends BetterAuthClientPlugin ? Plugin["getActions"] extends ($fetch: BetterFetch) => infer Actions ? Actions : {} : {}> : {};
113
115
  /**
114
116
  * signals are just used to recall a computed value.
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-DJvDzGCt.js';
6
+ import './index-DLbRYrL5.js';
7
7
  import 'kysely';
8
8
  import './types-IzAbV4nB.js';
9
9
  import 'better-call';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "better-auth",
3
- "version": "0.4.9-beta.4",
3
+ "version": "0.4.9-beta.6",
4
4
  "description": "The most comprehensive authentication library for TypeScript.",
5
5
  "type": "module",
6
6
  "repository": {