better-auth 0.4.4 → 0.4.5

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.
@@ -657,14 +657,12 @@ interface BetterAuthOptions {
657
657
  */
658
658
  sendResetPassword?: (url: string, user: User) => Promise<void>;
659
659
  /**
660
- * @param email the email to send the verification email to
661
- * @param url the url to send the verification
662
- * email to
663
- * @param token the actual token. You can use this
664
- * if you want to custom endpoint to verify the
665
- * email.
660
+ * @param user the user to send the verification email to
661
+ * @param url the url to send the verification email to
662
+ * it contains the token as well
663
+ * @param token the token to send the verification email to
666
664
  */
667
- sendVerificationEmail?: (email: string, url: string, token: string) => Promise<void>;
665
+ sendVerificationEmail?: (url: string, user: User, token: string) => Promise<void>;
668
666
  /**
669
667
  * Send a verification email automatically
670
668
  * after sign up
@@ -1004,7 +1002,7 @@ declare const createInternalAdapter: (adapter: Adapter, ctx: {
1004
1002
  image?: string | undefined;
1005
1003
  }[]>;
1006
1004
  deleteUser: (userId: string) => Promise<void>;
1007
- createSession: (userId: string, request?: Request | Headers, dontRememberMe?: boolean, inputData?: Partial<Session> & Record<string, any>) => Promise<{
1005
+ createSession: (userId: string, request?: Request | Headers, dontRememberMe?: boolean, override?: Partial<Session> & Record<string, any>) => Promise<{
1008
1006
  id: string;
1009
1007
  userId: string;
1010
1008
  expiresAt: Date;
@@ -1024,7 +1022,9 @@ declare const createInternalAdapter: (adapter: Adapter, ctx: {
1024
1022
  } | null>;
1025
1023
  deleteSession: (id: string) => Promise<void>;
1026
1024
  deleteSessions: (userId: string) => Promise<void>;
1027
- findUserByEmail: (email: string) => Promise<{
1025
+ findUserByEmail: (email: string, options?: {
1026
+ includeAccounts: boolean;
1027
+ }) => Promise<{
1028
1028
  user: {
1029
1029
  id: string;
1030
1030
  email: string;
@@ -1064,7 +1064,7 @@ declare const createInternalAdapter: (adapter: Adapter, ctx: {
1064
1064
  idToken?: string | null | undefined;
1065
1065
  expiresAt?: Date | null | undefined;
1066
1066
  password?: string | null | undefined;
1067
- id?: string | undefined;
1067
+ id: string;
1068
1068
  } | null>;
1069
1069
  updateUser: (userId: string, data: Partial<User> & Record<string, any>) => Promise<{
1070
1070
  id: string;
@@ -1161,12 +1161,12 @@ declare const signInOAuth: {
1161
1161
  /**
1162
1162
  * OAuth2 provider to use`
1163
1163
  */
1164
- provider: z.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter")[]]>;
1164
+ provider: z.ZodEnum<["github", ...("github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter")[]]>;
1165
1165
  }, "strip", z.ZodTypeAny, {
1166
- provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
1166
+ provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
1167
1167
  callbackURL?: string | undefined;
1168
1168
  }, {
1169
- provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
1169
+ provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
1170
1170
  callbackURL?: string | undefined;
1171
1171
  }>;
1172
1172
  }>]>(...ctx: C): Promise<C extends [{
@@ -1200,12 +1200,12 @@ declare const signInOAuth: {
1200
1200
  /**
1201
1201
  * OAuth2 provider to use`
1202
1202
  */
1203
- provider: z.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter")[]]>;
1203
+ provider: z.ZodEnum<["github", ...("github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter")[]]>;
1204
1204
  }, "strip", z.ZodTypeAny, {
1205
- provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
1205
+ provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
1206
1206
  callbackURL?: string | undefined;
1207
1207
  }, {
1208
- provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
1208
+ provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
1209
1209
  callbackURL?: string | undefined;
1210
1210
  }>;
1211
1211
  };
@@ -1805,7 +1805,7 @@ declare const verifyEmail: {
1805
1805
  asResponse: true;
1806
1806
  }] ? Response : {
1807
1807
  status: boolean;
1808
- } | null>;
1808
+ }>;
1809
1809
  path: "/verify-email";
1810
1810
  options: {
1811
1811
  method: "GET";
@@ -2422,12 +2422,12 @@ declare function getEndpoints<C extends AuthContext, Option extends BetterAuthOp
2422
2422
  }>>;
2423
2423
  body: zod.ZodObject<{
2424
2424
  callbackURL: zod.ZodOptional<zod.ZodString>;
2425
- provider: zod.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter")[]]>;
2425
+ provider: zod.ZodEnum<["github", ...("github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter")[]]>;
2426
2426
  }, "strip", zod.ZodTypeAny, {
2427
- provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
2427
+ provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
2428
2428
  callbackURL?: string | undefined;
2429
2429
  }, {
2430
- provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
2430
+ provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
2431
2431
  callbackURL?: string | undefined;
2432
2432
  }>;
2433
2433
  }>]>(...ctx: C_1): Promise<C_1 extends [{
@@ -2451,12 +2451,12 @@ declare function getEndpoints<C extends AuthContext, Option extends BetterAuthOp
2451
2451
  }>>;
2452
2452
  body: zod.ZodObject<{
2453
2453
  callbackURL: zod.ZodOptional<zod.ZodString>;
2454
- provider: zod.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter")[]]>;
2454
+ provider: zod.ZodEnum<["github", ...("github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter")[]]>;
2455
2455
  }, "strip", zod.ZodTypeAny, {
2456
- provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
2456
+ provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
2457
2457
  callbackURL?: string | undefined;
2458
2458
  }, {
2459
- provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
2459
+ provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
2460
2460
  callbackURL?: string | undefined;
2461
2461
  }>;
2462
2462
  };
@@ -2888,7 +2888,7 @@ declare function getEndpoints<C extends AuthContext, Option extends BetterAuthOp
2888
2888
  asResponse: true;
2889
2889
  }] ? Response : {
2890
2890
  status: boolean;
2891
- } | null>;
2891
+ }>;
2892
2892
  path: "/verify-email";
2893
2893
  options: {
2894
2894
  method: "GET";
@@ -3531,12 +3531,12 @@ declare const router: <C extends AuthContext, Option extends BetterAuthOptions>(
3531
3531
  }>>;
3532
3532
  body: zod.ZodObject<{
3533
3533
  callbackURL: zod.ZodOptional<zod.ZodString>;
3534
- provider: zod.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter")[]]>;
3534
+ provider: zod.ZodEnum<["github", ...("github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter")[]]>;
3535
3535
  }, "strip", zod.ZodTypeAny, {
3536
- provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
3536
+ provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
3537
3537
  callbackURL?: string | undefined;
3538
3538
  }, {
3539
- provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
3539
+ provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
3540
3540
  callbackURL?: string | undefined;
3541
3541
  }>;
3542
3542
  }>]>(...ctx: C_1): Promise<C_1 extends [{
@@ -3560,12 +3560,12 @@ declare const router: <C extends AuthContext, Option extends BetterAuthOptions>(
3560
3560
  }>>;
3561
3561
  body: zod.ZodObject<{
3562
3562
  callbackURL: zod.ZodOptional<zod.ZodString>;
3563
- provider: zod.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter")[]]>;
3563
+ provider: zod.ZodEnum<["github", ...("github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter")[]]>;
3564
3564
  }, "strip", zod.ZodTypeAny, {
3565
- provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
3565
+ provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
3566
3566
  callbackURL?: string | undefined;
3567
3567
  }, {
3568
- provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
3568
+ provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
3569
3569
  callbackURL?: string | undefined;
3570
3570
  }>;
3571
3571
  };
@@ -3997,7 +3997,7 @@ declare const router: <C extends AuthContext, Option extends BetterAuthOptions>(
3997
3997
  asResponse: true;
3998
3998
  }] ? Response : {
3999
3999
  status: boolean;
4000
- } | null>;
4000
+ }>;
4001
4001
  path: "/verify-email";
4002
4002
  options: {
4003
4003
  method: "GET";
@@ -4642,12 +4642,12 @@ declare const betterAuth: <O extends BetterAuthOptions>(options: O) => {
4642
4642
  }>>;
4643
4643
  body: zod.ZodObject<{
4644
4644
  callbackURL: zod.ZodOptional<zod.ZodString>;
4645
- provider: zod.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter")[]]>;
4645
+ provider: zod.ZodEnum<["github", ...("github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter")[]]>;
4646
4646
  }, "strip", zod.ZodTypeAny, {
4647
- provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
4647
+ provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
4648
4648
  callbackURL?: string | undefined;
4649
4649
  }, {
4650
- provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
4650
+ provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
4651
4651
  callbackURL?: string | undefined;
4652
4652
  }>;
4653
4653
  }>]>(...ctx: C): Promise<C extends [{
@@ -4671,12 +4671,12 @@ declare const betterAuth: <O extends BetterAuthOptions>(options: O) => {
4671
4671
  }>>;
4672
4672
  body: zod.ZodObject<{
4673
4673
  callbackURL: zod.ZodOptional<zod.ZodString>;
4674
- provider: zod.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter")[]]>;
4674
+ provider: zod.ZodEnum<["github", ...("github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter")[]]>;
4675
4675
  }, "strip", zod.ZodTypeAny, {
4676
- provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
4676
+ provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
4677
4677
  callbackURL?: string | undefined;
4678
4678
  }, {
4679
- provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
4679
+ provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
4680
4680
  callbackURL?: string | undefined;
4681
4681
  }>;
4682
4682
  };
@@ -5108,7 +5108,7 @@ declare const betterAuth: <O extends BetterAuthOptions>(options: O) => {
5108
5108
  asResponse: true;
5109
5109
  }] ? Response : {
5110
5110
  status: boolean;
5111
- } | null>;
5111
+ }>;
5112
5112
  path: "/verify-email";
5113
5113
  options: {
5114
5114
  method: "GET";
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { a as Auth, a0 as betterAuth } from './index-Bt0CUdx4.js';
1
+ export { a as Auth, a0 as betterAuth } from './index-B5SM-JCa.js';
2
2
  import 'zod';
3
3
  import 'kysely';
4
4
  import './types-IzAbV4nB.js';