better-auth 0.2.8-beta.8 → 0.2.8

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.
Files changed (44) hide show
  1. package/dist/.DS_Store +0 -0
  2. package/dist/access.js +13 -2
  3. package/dist/adapters/drizzle.d.ts +1 -1
  4. package/dist/adapters/drizzle.js +13 -23
  5. package/dist/adapters/mongodb.d.ts +1 -1
  6. package/dist/adapters/mongodb.js +3 -2
  7. package/dist/adapters/prisma.d.ts +1 -1
  8. package/dist/adapters/prisma.js +3 -280
  9. package/dist/api.d.ts +1 -1
  10. package/dist/api.js +407 -269
  11. package/dist/cli.js +213 -55
  12. package/dist/client/plugins.d.ts +5 -3
  13. package/dist/client/plugins.js +49 -34
  14. package/dist/client.d.ts +3 -1
  15. package/dist/client.js +34 -32
  16. package/dist/{index-CKn-Zrry.d.ts → index-C9S3KShG.d.ts} +50 -63
  17. package/dist/{index-DtRHPoYF.d.ts → index-UOcOxfoL.d.ts} +6 -5
  18. package/dist/index.d.ts +1 -1
  19. package/dist/index.js +501 -372
  20. package/dist/next-js.d.ts +1 -1
  21. package/dist/next-js.js +6 -5
  22. package/dist/node.d.ts +1 -1
  23. package/dist/node.js +5 -5
  24. package/dist/plugins.d.ts +8 -5
  25. package/dist/plugins.js +716 -498
  26. package/dist/react.d.ts +4 -2
  27. package/dist/react.js +37 -33
  28. package/dist/social.js +116 -68
  29. package/dist/solid-start.d.ts +1 -1
  30. package/dist/solid-start.js +3 -2
  31. package/dist/solid.d.ts +2 -1
  32. package/dist/solid.js +35 -32
  33. package/dist/svelte-kit.d.ts +1 -1
  34. package/dist/svelte-kit.js +6 -4
  35. package/dist/svelte.d.ts +2 -1
  36. package/dist/svelte.js +33 -32
  37. package/dist/types.d.ts +2 -2
  38. package/dist/types.js +0 -1
  39. package/dist/vue.d.ts +3 -1
  40. package/dist/vue.js +35 -32
  41. package/package.json +2 -3
  42. package/dist/hide-metadata-DEHJp1rk.d.ts +0 -5
  43. package/dist/utils.d.ts +0 -51
  44. package/dist/utils.js +0 -426
package/dist/client.js CHANGED
@@ -1,27 +1,5 @@
1
- import { createFetch, betterFetch } from '@better-fetch/fetch';
2
- import 'oslo';
3
- import 'nanoid';
4
- import { createConsola } from 'consola';
5
- import 'oslo/oauth2';
6
- import 'zod';
7
- import { atom, onMount } from 'nanostores';
8
-
9
1
  // src/client/config.ts
10
- createConsola({
11
- formatOptions: {
12
- date: false,
13
- colors: true,
14
- compact: true
15
- },
16
- defaults: {
17
- tag: "Better Auth"
18
- }
19
- });
20
-
21
- // src/utils/misc.ts
22
- function capitalizeFirstLetter(str) {
23
- return str.charAt(0).toUpperCase() + str.slice(1);
24
- }
2
+ import { createFetch } from "@better-fetch/fetch";
25
3
 
26
4
  // src/error/better-auth-error.ts
27
5
  var BetterAuthError = class extends Error {
@@ -67,6 +45,12 @@ function getBaseURL(url, path) {
67
45
  }
68
46
  return void 0;
69
47
  }
48
+
49
+ // src/client/config.ts
50
+ import "nanostores";
51
+
52
+ // src/client/fetch-plugins.ts
53
+ import { betterFetch } from "@better-fetch/fetch";
70
54
  var redirectPlugin = {
71
55
  id: "redirect",
72
56
  name: "Redirect",
@@ -201,6 +185,11 @@ var getClientConfig = (options) => {
201
185
  };
202
186
  };
203
187
 
188
+ // src/utils/misc.ts
189
+ function capitalizeFirstLetter(str) {
190
+ return str.charAt(0).toUpperCase() + str.slice(1);
191
+ }
192
+
204
193
  // src/client/proxy.ts
205
194
  function getMethod(path, knownPathMethods, args) {
206
195
  const method = knownPathMethods[path];
@@ -273,11 +262,19 @@ function createDynamicPathProxy(routes, client, knownPathMethods, atoms, atomLis
273
262
  }
274
263
  return createProxy();
275
264
  }
265
+
266
+ // src/client/session-atom.ts
267
+ import { atom as atom2 } from "nanostores";
268
+
269
+ // src/client/query.ts
270
+ import "@better-fetch/fetch";
271
+ import { atom, onMount } from "nanostores";
276
272
  var useAuthQuery = (initializedAtom, path, $fetch, options) => {
277
273
  const value = atom({
278
274
  data: null,
279
275
  error: null,
280
- isPending: false
276
+ isPending: false,
277
+ isRefetching: false
281
278
  });
282
279
  const fn = () => {
283
280
  const opts = typeof options === "function" ? options({
@@ -291,24 +288,27 @@ var useAuthQuery = (initializedAtom, path, $fetch, options) => {
291
288
  value.set({
292
289
  data: context.data,
293
290
  error: null,
294
- isPending: false
291
+ isPending: false,
292
+ isRefetching: false
295
293
  });
296
294
  await opts?.onSuccess?.(context);
297
295
  },
298
296
  async onError(context) {
299
297
  value.set({
300
298
  error: context.error,
301
- data: null,
302
- isPending: false
299
+ data: value.get().data,
300
+ isPending: false,
301
+ isRefetching: false
303
302
  });
304
303
  await opts?.onError?.(context);
305
304
  },
306
305
  async onRequest(context) {
307
306
  const currentValue = value.get();
308
307
  value.set({
309
- isPending: true,
308
+ isPending: currentValue.data === null,
310
309
  data: currentValue.data,
311
- error: currentValue.error
310
+ error: null,
311
+ isRefetching: true
312
312
  });
313
313
  await opts?.onRequest?.(context);
314
314
  }
@@ -337,7 +337,7 @@ var useAuthQuery = (initializedAtom, path, $fetch, options) => {
337
337
 
338
338
  // src/client/session-atom.ts
339
339
  function getSessionAtom($fetch) {
340
- const $signal = atom(false);
340
+ const $signal = atom2(false);
341
341
  const session = useAuthQuery($signal, "/session", $fetch, {
342
342
  method: "GET"
343
343
  });
@@ -380,5 +380,7 @@ function createAuthClient(options) {
380
380
  );
381
381
  return proxy;
382
382
  }
383
-
384
- export { createAuthClient, useAuthQuery };
383
+ export {
384
+ createAuthClient,
385
+ useAuthQuery
386
+ };
@@ -58,6 +58,7 @@ interface Adapter {
58
58
  append?: boolean;
59
59
  overwrite?: boolean;
60
60
  }>;
61
+ options?: Record<string, any>;
61
62
  }
62
63
  interface SessionAdapter {
63
64
  create: (data: {
@@ -73,7 +74,10 @@ interface SessionAdapter {
73
74
  }) => Promise<void>;
74
75
  }
75
76
 
76
- declare const createInternalAdapter: (adapter: Adapter, options: BetterAuthOptions) => {
77
+ declare const createInternalAdapter: (adapter: Adapter, ctx: {
78
+ options: BetterAuthOptions;
79
+ hooks: Exclude<BetterAuthOptions["databaseHooks"], undefined>[];
80
+ }) => {
77
81
  createOAuthUser: (user: User, account: Account) => Promise<{
78
82
  user: {
79
83
  id: string;
@@ -395,13 +399,6 @@ declare function createCookieGetter(options: BetterAuthOptions): (cookieName: st
395
399
  options: CookieOptions;
396
400
  };
397
401
  type BetterAuthCookies = ReturnType<typeof getCookies>;
398
- declare function setSessionCookie(ctx: GenericEndpointContext, sessionToken: string, dontRememberMe?: boolean, overrides?: Partial<CookieOptions>): Promise<void>;
399
- declare function deleteSessionCookie(ctx: GenericEndpointContext): void;
400
- type CookieAttributes = {
401
- value: string;
402
- [key: string]: string | boolean;
403
- };
404
- declare function parseSetCookieHeader(header: string): Map<string, CookieAttributes>;
405
402
 
406
403
  declare const createLogger: (options?: {
407
404
  disabled?: boolean;
@@ -415,16 +412,6 @@ declare const createLogger: (options?: {
415
412
  success: (...args: any[]) => void;
416
413
  break: (...args: any[]) => void;
417
414
  };
418
- declare const logger: {
419
- log: (...args: any[]) => void;
420
- error: (...args: any[]) => void;
421
- warn: (...args: any[]) => void;
422
- info: (...args: any[]) => void;
423
- debug: (...args: any[]) => void;
424
- box: (...args: any[]) => void;
425
- success: (...args: any[]) => void;
426
- break: (...args: any[]) => void;
427
- };
428
415
 
429
416
  declare const init: (opts: BetterAuthOptions) => Promise<{
430
417
  options: BetterAuthOptions;
@@ -757,10 +744,10 @@ type BetterAuthPlugin = {
757
744
  * The init function is called when the plugin is initialized.
758
745
  * You can return a new context or modify the existing context.
759
746
  */
760
- init?: (options: BetterAuthOptions) => DeepPartial<{
761
- context: Omit<AuthContext, "options">;
762
- options: BetterAuthOptions;
763
- }> | void;
747
+ init?: (options: BetterAuthOptions) => {
748
+ context?: DeepPartial<Omit<AuthContext, "options">>;
749
+ options?: BetterAuthOptions;
750
+ } | void;
764
751
  endpoints?: {
765
752
  [key: string]: AuthEndpoint;
766
753
  };
@@ -857,7 +844,7 @@ type InferAdditional<Options extends BetterAuthOptions, Key extends string> = Op
857
844
  type AdditionalSessionFields<Options extends BetterAuthOptions> = InferAdditional<Options, "session">;
858
845
  type AdditionalUserFields<Options extends BetterAuthOptions> = InferAdditional<Options, "user">;
859
846
  type InferUser<O extends BetterAuthOptions | Auth> = UnionToIntersection<StripEmptyObjects<User & (O extends BetterAuthOptions ? AdditionalUserFields<O> : O extends Auth ? AdditionalUserFields<O["options"]> : {})>>;
860
- type InferSession<O extends BetterAuthOptions | Auth> = UnionToIntersection<Session & (O extends BetterAuthOptions ? AdditionalSessionFields<O> : O extends Auth ? AdditionalSessionFields<O["options"]> : {})>;
847
+ type InferSession<O extends BetterAuthOptions | Auth> = UnionToIntersection<StripEmptyObjects<Session & (O extends BetterAuthOptions ? AdditionalSessionFields<O> : O extends Auth ? AdditionalSessionFields<O["options"]> : {})>>;
861
848
  type InferPluginTypes<O extends BetterAuthOptions> = O["plugins"] extends Array<infer P> ? UnionToIntersection<P extends BetterAuthPlugin ? P["$Infer"] extends Record<string, any> ? P["$Infer"] : {} : {}> : {};
862
849
  interface RateLimit {
863
850
  /**
@@ -1230,7 +1217,7 @@ interface BetterAuthOptions {
1230
1217
  after?: (verification: Verification) => Promise<void>;
1231
1218
  };
1232
1219
  };
1233
- }[];
1220
+ };
1234
1221
  }
1235
1222
 
1236
1223
  declare const signInOAuth: {
@@ -1256,17 +1243,17 @@ declare const signInOAuth: {
1256
1243
  /**
1257
1244
  * OAuth2 provider to use`
1258
1245
  */
1259
- provider: z.ZodEnum<["github", ...("github" | "apple" | "discord" | "facebook" | "google" | "spotify" | "twitch" | "twitter")[]]>;
1246
+ provider: z.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter")[]]>;
1260
1247
  /**
1261
1248
  * If this is true the session will only be valid for the current browser session
1262
1249
  */
1263
1250
  dontRememberMe: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
1264
1251
  }, "strip", z.ZodTypeAny, {
1265
- provider: "github" | "apple" | "discord" | "facebook" | "google" | "spotify" | "twitch" | "twitter";
1252
+ provider: "apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter";
1266
1253
  callbackURL?: string | undefined;
1267
1254
  dontRememberMe?: boolean | undefined;
1268
1255
  }, {
1269
- provider: "github" | "apple" | "discord" | "facebook" | "google" | "spotify" | "twitch" | "twitter";
1256
+ provider: "apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter";
1270
1257
  callbackURL?: string | undefined;
1271
1258
  dontRememberMe?: boolean | undefined;
1272
1259
  }>;
@@ -1299,17 +1286,17 @@ declare const signInOAuth: {
1299
1286
  /**
1300
1287
  * OAuth2 provider to use`
1301
1288
  */
1302
- provider: z.ZodEnum<["github", ...("github" | "apple" | "discord" | "facebook" | "google" | "spotify" | "twitch" | "twitter")[]]>;
1289
+ provider: z.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter")[]]>;
1303
1290
  /**
1304
1291
  * If this is true the session will only be valid for the current browser session
1305
1292
  */
1306
1293
  dontRememberMe: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
1307
1294
  }, "strip", z.ZodTypeAny, {
1308
- provider: "github" | "apple" | "discord" | "facebook" | "google" | "spotify" | "twitch" | "twitter";
1295
+ provider: "apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter";
1309
1296
  callbackURL?: string | undefined;
1310
1297
  dontRememberMe?: boolean | undefined;
1311
1298
  }, {
1312
- provider: "github" | "apple" | "discord" | "facebook" | "google" | "spotify" | "twitch" | "twitter";
1299
+ provider: "apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter";
1313
1300
  callbackURL?: string | undefined;
1314
1301
  dontRememberMe?: boolean | undefined;
1315
1302
  }>;
@@ -1513,7 +1500,7 @@ declare const listSessions: <Option extends BetterAuthOptions>() => {
1513
1500
  };
1514
1501
  }>, better_call.EndpointOptions>[];
1515
1502
  requireHeaders: true;
1516
- }>): Promise<Prettify<UnionToIntersection<{
1503
+ }>): Promise<Prettify<UnionToIntersection<StripEmptyObjects<{
1517
1504
  id: string;
1518
1505
  userId: string;
1519
1506
  expiresAt: Date;
@@ -1531,7 +1518,7 @@ declare const listSessions: <Option extends BetterAuthOptions>() => {
1531
1518
  fields: infer Field;
1532
1519
  };
1533
1520
  };
1534
- } ? Field extends Record<infer Key extends string | number | symbol, FieldAttribute> ? { [key in Key as Field[key]["required"] extends false ? never : Field[key]["defaultValue"] extends string | number | boolean | Function | Date ? key : never]: InferFieldOutput<Field[key]>; } & { [key_1 in Key as Field[key_1]["returned"] extends false ? never : key_1]?: InferFieldOutput<Field[key_1]> | undefined; } : {} : {} : {} : {})>>[]>;
1521
+ } ? Field extends Record<infer Key extends string | number | symbol, FieldAttribute> ? { [key in Key as Field[key]["required"] extends false ? never : Field[key]["defaultValue"] extends string | number | boolean | Function | Date ? key : never]: InferFieldOutput<Field[key]>; } & { [key_1 in Key as Field[key_1]["returned"] extends false ? never : key_1]?: InferFieldOutput<Field[key_1]> | undefined; } : {} : {} : {} : {})>>>[]>;
1535
1522
  path: "/user/list-sessions";
1536
1523
  options: {
1537
1524
  method: "GET";
@@ -2458,14 +2445,14 @@ declare function getEndpoints<C extends AuthContext, Option extends BetterAuthOp
2458
2445
  }>>;
2459
2446
  body: zod.ZodObject<{
2460
2447
  callbackURL: zod.ZodOptional<zod.ZodString>;
2461
- provider: zod.ZodEnum<["github", ...("github" | "apple" | "discord" | "facebook" | "google" | "spotify" | "twitch" | "twitter")[]]>;
2448
+ provider: zod.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter")[]]>;
2462
2449
  dontRememberMe: zod.ZodOptional<zod.ZodDefault<zod.ZodBoolean>>;
2463
2450
  }, "strip", zod.ZodTypeAny, {
2464
- provider: "github" | "apple" | "discord" | "facebook" | "google" | "spotify" | "twitch" | "twitter";
2451
+ provider: "apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter";
2465
2452
  callbackURL?: string | undefined;
2466
2453
  dontRememberMe?: boolean | undefined;
2467
2454
  }, {
2468
- provider: "github" | "apple" | "discord" | "facebook" | "google" | "spotify" | "twitch" | "twitter";
2455
+ provider: "apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter";
2469
2456
  callbackURL?: string | undefined;
2470
2457
  dontRememberMe?: boolean | undefined;
2471
2458
  }>;
@@ -2488,14 +2475,14 @@ declare function getEndpoints<C extends AuthContext, Option extends BetterAuthOp
2488
2475
  }>>;
2489
2476
  body: zod.ZodObject<{
2490
2477
  callbackURL: zod.ZodOptional<zod.ZodString>;
2491
- provider: zod.ZodEnum<["github", ...("github" | "apple" | "discord" | "facebook" | "google" | "spotify" | "twitch" | "twitter")[]]>;
2478
+ provider: zod.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter")[]]>;
2492
2479
  dontRememberMe: zod.ZodOptional<zod.ZodDefault<zod.ZodBoolean>>;
2493
2480
  }, "strip", zod.ZodTypeAny, {
2494
- provider: "github" | "apple" | "discord" | "facebook" | "google" | "spotify" | "twitch" | "twitter";
2481
+ provider: "apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter";
2495
2482
  callbackURL?: string | undefined;
2496
2483
  dontRememberMe?: boolean | undefined;
2497
2484
  }, {
2498
- provider: "github" | "apple" | "discord" | "facebook" | "google" | "spotify" | "twitch" | "twitter";
2485
+ provider: "apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter";
2499
2486
  callbackURL?: string | undefined;
2500
2487
  dontRememberMe?: boolean | undefined;
2501
2488
  }>;
@@ -2570,7 +2557,7 @@ declare function getEndpoints<C extends AuthContext, Option extends BetterAuthOp
2570
2557
  method: "GET";
2571
2558
  requireHeaders: true;
2572
2559
  }>): Promise<{
2573
- session: UnionToIntersection<{
2560
+ session: UnionToIntersection<StripEmptyObjects<{
2574
2561
  id: string;
2575
2562
  userId: string;
2576
2563
  expiresAt: Date;
@@ -2588,7 +2575,7 @@ declare function getEndpoints<C extends AuthContext, Option extends BetterAuthOp
2588
2575
  fields: infer Field;
2589
2576
  };
2590
2577
  };
2591
- } ? Field extends Record<infer Key extends string | number | symbol, FieldAttribute> ? { [key in Key as Field[key]["required"] extends false ? never : Field[key]["defaultValue"] extends string | number | boolean | Function | Date ? key : never]: InferFieldOutput<Field[key]>; } & { [key_1 in Key as Field[key_1]["returned"] extends false ? never : key_1]?: InferFieldOutput<Field[key_1]> | undefined; } : {} : {} : {} : {})>;
2578
+ } ? Field extends Record<infer Key extends string | number | symbol, FieldAttribute> ? { [key in Key as Field[key]["required"] extends false ? never : Field[key]["defaultValue"] extends string | number | boolean | Function | Date ? key : never]: InferFieldOutput<Field[key]>; } & { [key_1 in Key as Field[key_1]["returned"] extends false ? never : key_1]?: InferFieldOutput<Field[key_1]> | undefined; } : {} : {} : {} : {})>>;
2592
2579
  user: UnionToIntersection<StripEmptyObjects<{
2593
2580
  id: string;
2594
2581
  email: string;
@@ -3291,7 +3278,7 @@ declare function getEndpoints<C extends AuthContext, Option extends BetterAuthOp
3291
3278
  };
3292
3279
  }>, better_call.EndpointOptions>[];
3293
3280
  requireHeaders: true;
3294
- }>): Promise<Prettify<UnionToIntersection<{
3281
+ }>): Promise<Prettify<UnionToIntersection<StripEmptyObjects<{
3295
3282
  id: string;
3296
3283
  userId: string;
3297
3284
  expiresAt: Date;
@@ -3309,7 +3296,7 @@ declare function getEndpoints<C extends AuthContext, Option extends BetterAuthOp
3309
3296
  fields: infer Field;
3310
3297
  };
3311
3298
  };
3312
- } ? Field extends Record<infer Key extends string | number | symbol, FieldAttribute> ? { [key in Key as Field[key]["required"] extends false ? never : Field[key]["defaultValue"] extends string | number | boolean | Function | Date ? key : never]: InferFieldOutput<Field[key]>; } & { [key_1 in Key as Field[key_1]["returned"] extends false ? never : key_1]?: InferFieldOutput<Field[key_1]> | undefined; } : {} : {} : {} : {})>>[]>;
3299
+ } ? Field extends Record<infer Key extends string | number | symbol, FieldAttribute> ? { [key in Key as Field[key]["required"] extends false ? never : Field[key]["defaultValue"] extends string | number | boolean | Function | Date ? key : never]: InferFieldOutput<Field[key]>; } & { [key_1 in Key as Field[key_1]["returned"] extends false ? never : key_1]?: InferFieldOutput<Field[key_1]> | undefined; } : {} : {} : {} : {})>>>[]>;
3313
3300
  path: "/user/list-sessions";
3314
3301
  options: {
3315
3302
  method: "GET";
@@ -3520,14 +3507,14 @@ declare const router: <C extends AuthContext, Option extends BetterAuthOptions>(
3520
3507
  }>>;
3521
3508
  body: zod.ZodObject<{
3522
3509
  callbackURL: zod.ZodOptional<zod.ZodString>;
3523
- provider: zod.ZodEnum<["github", ...("github" | "apple" | "discord" | "facebook" | "google" | "spotify" | "twitch" | "twitter")[]]>;
3510
+ provider: zod.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter")[]]>;
3524
3511
  dontRememberMe: zod.ZodOptional<zod.ZodDefault<zod.ZodBoolean>>;
3525
3512
  }, "strip", zod.ZodTypeAny, {
3526
- provider: "github" | "apple" | "discord" | "facebook" | "google" | "spotify" | "twitch" | "twitter";
3513
+ provider: "apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter";
3527
3514
  callbackURL?: string | undefined;
3528
3515
  dontRememberMe?: boolean | undefined;
3529
3516
  }, {
3530
- provider: "github" | "apple" | "discord" | "facebook" | "google" | "spotify" | "twitch" | "twitter";
3517
+ provider: "apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter";
3531
3518
  callbackURL?: string | undefined;
3532
3519
  dontRememberMe?: boolean | undefined;
3533
3520
  }>;
@@ -3550,14 +3537,14 @@ declare const router: <C extends AuthContext, Option extends BetterAuthOptions>(
3550
3537
  }>>;
3551
3538
  body: zod.ZodObject<{
3552
3539
  callbackURL: zod.ZodOptional<zod.ZodString>;
3553
- provider: zod.ZodEnum<["github", ...("github" | "apple" | "discord" | "facebook" | "google" | "spotify" | "twitch" | "twitter")[]]>;
3540
+ provider: zod.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter")[]]>;
3554
3541
  dontRememberMe: zod.ZodOptional<zod.ZodDefault<zod.ZodBoolean>>;
3555
3542
  }, "strip", zod.ZodTypeAny, {
3556
- provider: "github" | "apple" | "discord" | "facebook" | "google" | "spotify" | "twitch" | "twitter";
3543
+ provider: "apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter";
3557
3544
  callbackURL?: string | undefined;
3558
3545
  dontRememberMe?: boolean | undefined;
3559
3546
  }, {
3560
- provider: "github" | "apple" | "discord" | "facebook" | "google" | "spotify" | "twitch" | "twitter";
3547
+ provider: "apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter";
3561
3548
  callbackURL?: string | undefined;
3562
3549
  dontRememberMe?: boolean | undefined;
3563
3550
  }>;
@@ -3632,7 +3619,7 @@ declare const router: <C extends AuthContext, Option extends BetterAuthOptions>(
3632
3619
  method: "GET";
3633
3620
  requireHeaders: true;
3634
3621
  }>): Promise<{
3635
- session: UnionToIntersection<{
3622
+ session: UnionToIntersection<StripEmptyObjects<{
3636
3623
  id: string;
3637
3624
  userId: string;
3638
3625
  expiresAt: Date;
@@ -3650,7 +3637,7 @@ declare const router: <C extends AuthContext, Option extends BetterAuthOptions>(
3650
3637
  fields: infer Field;
3651
3638
  };
3652
3639
  };
3653
- } ? Field extends Record<infer Key extends string | number | symbol, FieldAttribute> ? { [key in Key as Field[key]["required"] extends false ? never : Field[key]["defaultValue"] extends string | number | boolean | Function | Date ? key : never]: InferFieldOutput<Field[key]>; } & { [key_1 in Key as Field[key_1]["returned"] extends false ? never : key_1]?: InferFieldOutput<Field[key_1]> | undefined; } : {} : {} : {} : {})>;
3640
+ } ? Field extends Record<infer Key extends string | number | symbol, FieldAttribute> ? { [key in Key as Field[key]["required"] extends false ? never : Field[key]["defaultValue"] extends string | number | boolean | Function | Date ? key : never]: InferFieldOutput<Field[key]>; } & { [key_1 in Key as Field[key_1]["returned"] extends false ? never : key_1]?: InferFieldOutput<Field[key_1]> | undefined; } : {} : {} : {} : {})>>;
3654
3641
  user: UnionToIntersection<StripEmptyObjects<{
3655
3642
  id: string;
3656
3643
  email: string;
@@ -4353,7 +4340,7 @@ declare const router: <C extends AuthContext, Option extends BetterAuthOptions>(
4353
4340
  };
4354
4341
  }>, better_call.EndpointOptions>[];
4355
4342
  requireHeaders: true;
4356
- }>): Promise<Prettify<UnionToIntersection<{
4343
+ }>): Promise<Prettify<UnionToIntersection<StripEmptyObjects<{
4357
4344
  id: string;
4358
4345
  userId: string;
4359
4346
  expiresAt: Date;
@@ -4371,7 +4358,7 @@ declare const router: <C extends AuthContext, Option extends BetterAuthOptions>(
4371
4358
  fields: infer Field;
4372
4359
  };
4373
4360
  };
4374
- } ? Field extends Record<infer Key extends string | number | symbol, FieldAttribute> ? { [key in Key as Field[key]["required"] extends false ? never : Field[key]["defaultValue"] extends string | number | boolean | Function | Date ? key : never]: InferFieldOutput<Field[key]>; } & { [key_1 in Key as Field[key_1]["returned"] extends false ? never : key_1]?: InferFieldOutput<Field[key_1]> | undefined; } : {} : {} : {} : {})>>[]>;
4361
+ } ? Field extends Record<infer Key extends string | number | symbol, FieldAttribute> ? { [key in Key as Field[key]["required"] extends false ? never : Field[key]["defaultValue"] extends string | number | boolean | Function | Date ? key : never]: InferFieldOutput<Field[key]>; } & { [key_1 in Key as Field[key_1]["returned"] extends false ? never : key_1]?: InferFieldOutput<Field[key_1]> | undefined; } : {} : {} : {} : {})>>>[]>;
4375
4362
  path: "/user/list-sessions";
4376
4363
  options: {
4377
4364
  method: "GET";
@@ -4584,14 +4571,14 @@ declare const betterAuth: <O extends BetterAuthOptions>(options: O) => {
4584
4571
  }>>;
4585
4572
  body: zod.ZodObject<{
4586
4573
  callbackURL: zod.ZodOptional<zod.ZodString>;
4587
- provider: zod.ZodEnum<["github", ...("github" | "apple" | "discord" | "facebook" | "google" | "spotify" | "twitch" | "twitter")[]]>;
4574
+ provider: zod.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter")[]]>;
4588
4575
  dontRememberMe: zod.ZodOptional<zod.ZodDefault<zod.ZodBoolean>>;
4589
4576
  }, "strip", zod.ZodTypeAny, {
4590
- provider: "github" | "apple" | "discord" | "facebook" | "google" | "spotify" | "twitch" | "twitter";
4577
+ provider: "apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter";
4591
4578
  callbackURL?: string | undefined;
4592
4579
  dontRememberMe?: boolean | undefined;
4593
4580
  }, {
4594
- provider: "github" | "apple" | "discord" | "facebook" | "google" | "spotify" | "twitch" | "twitter";
4581
+ provider: "apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter";
4595
4582
  callbackURL?: string | undefined;
4596
4583
  dontRememberMe?: boolean | undefined;
4597
4584
  }>;
@@ -4614,14 +4601,14 @@ declare const betterAuth: <O extends BetterAuthOptions>(options: O) => {
4614
4601
  }>>;
4615
4602
  body: zod.ZodObject<{
4616
4603
  callbackURL: zod.ZodOptional<zod.ZodString>;
4617
- provider: zod.ZodEnum<["github", ...("github" | "apple" | "discord" | "facebook" | "google" | "spotify" | "twitch" | "twitter")[]]>;
4604
+ provider: zod.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter")[]]>;
4618
4605
  dontRememberMe: zod.ZodOptional<zod.ZodDefault<zod.ZodBoolean>>;
4619
4606
  }, "strip", zod.ZodTypeAny, {
4620
- provider: "github" | "apple" | "discord" | "facebook" | "google" | "spotify" | "twitch" | "twitter";
4607
+ provider: "apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter";
4621
4608
  callbackURL?: string | undefined;
4622
4609
  dontRememberMe?: boolean | undefined;
4623
4610
  }, {
4624
- provider: "github" | "apple" | "discord" | "facebook" | "google" | "spotify" | "twitch" | "twitter";
4611
+ provider: "apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter";
4625
4612
  callbackURL?: string | undefined;
4626
4613
  dontRememberMe?: boolean | undefined;
4627
4614
  }>;
@@ -4696,7 +4683,7 @@ declare const betterAuth: <O extends BetterAuthOptions>(options: O) => {
4696
4683
  method: "GET";
4697
4684
  requireHeaders: true;
4698
4685
  }>): Promise<{
4699
- session: UnionToIntersection<{
4686
+ session: UnionToIntersection<StripEmptyObjects<{
4700
4687
  id: string;
4701
4688
  userId: string;
4702
4689
  expiresAt: Date;
@@ -4714,7 +4701,7 @@ declare const betterAuth: <O extends BetterAuthOptions>(options: O) => {
4714
4701
  fields: infer Field;
4715
4702
  };
4716
4703
  };
4717
- } ? Field extends Record<infer Key extends string | number | symbol, FieldAttribute> ? { [key in Key as Field[key]["required"] extends false ? never : Field[key]["defaultValue"] extends string | number | boolean | Function | Date ? key : never]: InferFieldOutput<Field[key]>; } & { [key_1 in Key as Field[key_1]["returned"] extends false ? never : key_1]?: InferFieldOutput<Field[key_1]> | undefined; } : {} : {} : {} : {})>;
4704
+ } ? Field extends Record<infer Key extends string | number | symbol, FieldAttribute> ? { [key in Key as Field[key]["required"] extends false ? never : Field[key]["defaultValue"] extends string | number | boolean | Function | Date ? key : never]: InferFieldOutput<Field[key]>; } & { [key_1 in Key as Field[key_1]["returned"] extends false ? never : key_1]?: InferFieldOutput<Field[key_1]> | undefined; } : {} : {} : {} : {})>>;
4718
4705
  user: UnionToIntersection<StripEmptyObjects<{
4719
4706
  id: string;
4720
4707
  email: string;
@@ -5417,7 +5404,7 @@ declare const betterAuth: <O extends BetterAuthOptions>(options: O) => {
5417
5404
  };
5418
5405
  }>, better_call.EndpointOptions>[];
5419
5406
  requireHeaders: true;
5420
- }>): Promise<Prettify<UnionToIntersection<{
5407
+ }>): Promise<Prettify<UnionToIntersection<StripEmptyObjects<{
5421
5408
  id: string;
5422
5409
  userId: string;
5423
5410
  expiresAt: Date;
@@ -5435,7 +5422,7 @@ declare const betterAuth: <O extends BetterAuthOptions>(options: O) => {
5435
5422
  fields: infer Field;
5436
5423
  };
5437
5424
  };
5438
- } ? Field extends Record<infer Key extends string | number | symbol, FieldAttribute> ? { [key in Key as Field[key]["required"] extends false ? never : Field[key]["defaultValue"] extends string | number | boolean | Function | Date ? key : never]: InferFieldOutput<Field[key]>; } & { [key_1 in Key as Field[key_1]["returned"] extends false ? never : key_1]?: InferFieldOutput<Field[key_1]> | undefined; } : {} : {} : {} : {})>>[]>;
5425
+ } ? Field extends Record<infer Key extends string | number | symbol, FieldAttribute> ? { [key in Key as Field[key]["required"] extends false ? never : Field[key]["defaultValue"] extends string | number | boolean | Function | Date ? key : never]: InferFieldOutput<Field[key]>; } & { [key_1 in Key as Field[key_1]["returned"] extends false ? never : key_1]?: InferFieldOutput<Field[key_1]> | undefined; } : {} : {} : {} : {})>>>[]>;
5439
5426
  path: "/user/list-sessions";
5440
5427
  options: {
5441
5428
  method: "GET";
@@ -5603,4 +5590,4 @@ type Auth = {
5603
5590
  options: BetterAuthOptions;
5604
5591
  };
5605
5592
 
5606
- export { error as $, type Adapter as A, type BetterAuthPlugin as B, getSessionFromCtx as C, sessionMiddleware as D, listSessions as E, type FieldAttribute as F, type GenericEndpointContext as G, type HookEndpointContext as H, type InferFieldOutput as I, revokeSession as J, revokeSessions as K, signOut as L, forgetPassword as M, forgetPasswordCallback as N, resetPassword as O, type PluginSchema as P, createEmailVerificationToken as Q, type RateLimit as R, type SessionAdapter as S, sendVerificationEmail as T, verifyEmail as U, updateUser as V, type Where as W, changePassword as X, setPassword as Y, deleteUser as Z, getCSRFToken as _, createAuthEndpoint as a, ok as a0, signUpEmail as a1, csrfMiddleware as a2, betterAuth as a3, type AuthEndpoint as b, createAuthMiddleware as c, type AuthMiddleware as d, type Auth as e, type BetterAuthOptions as f, type AuthContext as g, getCookies as h, createCookieGetter as i, type BetterAuthCookies as j, deleteSessionCookie as k, createLogger as l, logger as m, type InferUser as n, optionsMiddleware as o, parseSetCookieHeader as p, type InferSession as q, type InferPluginTypes as r, setSessionCookie as s, init as t, getEndpoints as u, router as v, signInOAuth as w, signInEmail as x, callbackOAuth as y, getSession as z };
5593
+ export { type Adapter as A, type BetterAuthOptions as B, resetPassword as C, createEmailVerificationToken as D, sendVerificationEmail as E, type FieldAttribute as F, type GenericEndpointContext as G, type HookEndpointContext as H, type InferFieldOutput as I, verifyEmail as J, updateUser as K, changePassword as L, setPassword as M, deleteUser as N, getCSRFToken as O, type PluginSchema as P, error as Q, type RateLimit as R, type SessionAdapter as S, ok as T, signUpEmail as U, csrfMiddleware as V, type Where as W, betterAuth as X, type Auth as a, type BetterAuthPlugin as b, createAuthMiddleware as c, createAuthEndpoint as d, type AuthEndpoint as e, type AuthMiddleware as f, type InferUser as g, type InferSession as h, type InferPluginTypes as i, init as j, type AuthContext as k, getEndpoints as l, signInEmail as m, callbackOAuth as n, optionsMiddleware as o, getSession as p, getSessionFromCtx as q, router as r, signInOAuth as s, sessionMiddleware as t, listSessions as u, revokeSession as v, revokeSessions as w, signOut as x, forgetPassword as y, forgetPasswordCallback as z };
@@ -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 } from './index-CKn-Zrry.js';
8
+ import { H as HookEndpointContext } from './index-C9S3KShG.js';
9
9
  import * as nanostores from 'nanostores';
10
10
  import { atom } from 'nanostores';
11
11
  import * as _simplewebauthn_types from '@simplewebauthn/types';
@@ -3636,6 +3636,7 @@ declare const passkeyClient: () => {
3636
3636
  data: Passkey[] | null;
3637
3637
  error: null | _better_fetch_fetch.BetterFetchError;
3638
3638
  isPending: boolean;
3639
+ isRefetching: boolean;
3639
3640
  }>;
3640
3641
  _listPasskeys: nanostores.PreinitializedWritableAtom<any>;
3641
3642
  };
@@ -4239,12 +4240,12 @@ declare const magicLink: (options: MagicLinkOptions) => {
4239
4240
  currentURL: z.ZodOptional<z.ZodString>;
4240
4241
  }, "strip", z.ZodTypeAny, {
4241
4242
  email: string;
4242
- callbackURL?: string | undefined;
4243
4243
  currentURL?: string | undefined;
4244
+ callbackURL?: string | undefined;
4244
4245
  }, {
4245
4246
  email: string;
4246
- callbackURL?: string | undefined;
4247
4247
  currentURL?: string | undefined;
4248
+ callbackURL?: string | undefined;
4248
4249
  }>;
4249
4250
  }>): Promise<{
4250
4251
  status: boolean;
@@ -4259,12 +4260,12 @@ declare const magicLink: (options: MagicLinkOptions) => {
4259
4260
  currentURL: z.ZodOptional<z.ZodString>;
4260
4261
  }, "strip", z.ZodTypeAny, {
4261
4262
  email: string;
4262
- callbackURL?: string | undefined;
4263
4263
  currentURL?: string | undefined;
4264
+ callbackURL?: string | undefined;
4264
4265
  }, {
4265
4266
  email: string;
4266
- callbackURL?: string | undefined;
4267
4267
  currentURL?: string | undefined;
4268
+ callbackURL?: string | undefined;
4268
4269
  }>;
4269
4270
  };
4270
4271
  method: better_call.Method | better_call.Method[];
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { e as Auth, a3 as betterAuth } from './index-CKn-Zrry.js';
1
+ export { a as Auth, X as betterAuth } from './index-C9S3KShG.js';
2
2
  import 'kysely';
3
3
  import './index-JM-i6hLs.js';
4
4
  import 'arctic';