better-auth 0.2.8-beta.12 → 0.2.8-beta.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { A as Adapter } from '../index-BwEFpoZw.js';
1
+ import { A as Adapter } from '../index-DjYTypwW.js';
2
2
  import 'kysely';
3
3
  import '../index-JM-i6hLs.js';
4
4
  import 'arctic';
@@ -1,4 +1,4 @@
1
- import { W as Where } from '../index-BwEFpoZw.js';
1
+ import { W as Where } from '../index-DjYTypwW.js';
2
2
  import 'kysely';
3
3
  import '../index-JM-i6hLs.js';
4
4
  import 'arctic';
@@ -1,4 +1,4 @@
1
- import { A as Adapter } from '../index-BwEFpoZw.js';
1
+ import { A as Adapter } from '../index-DjYTypwW.js';
2
2
  import 'kysely';
3
3
  import '../index-JM-i6hLs.js';
4
4
  import 'arctic';
package/dist/api.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { b as AuthEndpoint, d as AuthMiddleware, y as callbackOAuth, X as changePassword, a as createAuthEndpoint, c as createAuthMiddleware, Q as createEmailVerificationToken, a2 as csrfMiddleware, Z as deleteUser, $ as error, M as forgetPassword, N as forgetPasswordCallback, _ as getCSRFToken, u as getEndpoints, z as getSession, C as getSessionFromCtx, E as listSessions, a0 as ok, o as optionsMiddleware, O as resetPassword, J as revokeSession, K as revokeSessions, v as router, T as sendVerificationEmail, D as sessionMiddleware, Y as setPassword, x as signInEmail, w as signInOAuth, L as signOut, a1 as signUpEmail, V as updateUser, U as verifyEmail } from './index-BwEFpoZw.js';
1
+ export { b as AuthEndpoint, d as AuthMiddleware, y as callbackOAuth, X as changePassword, a as createAuthEndpoint, c as createAuthMiddleware, Q as createEmailVerificationToken, a2 as csrfMiddleware, Z as deleteUser, $ as error, M as forgetPassword, N as forgetPasswordCallback, _ as getCSRFToken, u as getEndpoints, z as getSession, C as getSessionFromCtx, E as listSessions, a0 as ok, o as optionsMiddleware, O as resetPassword, J as revokeSession, K as revokeSessions, v as router, T as sendVerificationEmail, D as sessionMiddleware, Y as setPassword, x as signInEmail, w as signInOAuth, L as signOut, a1 as signUpEmail, V as updateUser, U as verifyEmail } from './index-DjYTypwW.js';
2
2
  import 'zod';
3
3
  import './helper-DPDj8Nix.js';
4
4
  import 'better-call';
@@ -2,14 +2,14 @@ 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, e as Organization, M as Member, I as Invitation, u as username, m as magicLink, d as phoneNumber } from '../index-CGc97fG-.js';
6
- export { g as getPasskeyActions, c as passkeyClient, a as twoFactorClient } from '../index-CGc97fG-.js';
5
+ import { o as organization, e as Organization, M as Member, I as Invitation, u as username, m as magicLink, d as phoneNumber } from '../index-BHqaQq-x.js';
6
+ export { g as getPasskeyActions, c as passkeyClient, a as twoFactorClient } from '../index-BHqaQq-x.js';
7
7
  import { P as Prettify } from '../helper-DPDj8Nix.js';
8
8
  import '../index-JM-i6hLs.js';
9
9
  import 'arctic';
10
10
  import 'zod';
11
11
  import 'better-call';
12
- import '../index-BwEFpoZw.js';
12
+ import '../index-DjYTypwW.js';
13
13
  import 'kysely';
14
14
  import 'better-sqlite3';
15
15
  import 'mysql2';
@@ -109,6 +109,7 @@ declare const organizationClient: <O extends OrganizationClientOptions>(options?
109
109
  }> | null;
110
110
  error: null | _better_fetch_fetch.BetterFetchError;
111
111
  isPending: boolean;
112
+ isRefetching: boolean;
112
113
  }>;
113
114
  listOrganizations: nanostores.PreinitializedWritableAtom<{
114
115
  data: {
@@ -121,6 +122,7 @@ declare const organizationClient: <O extends OrganizationClientOptions>(options?
121
122
  }[] | null;
122
123
  error: null | _better_fetch_fetch.BetterFetchError;
123
124
  isPending: boolean;
125
+ isRefetching: boolean;
124
126
  }>;
125
127
  };
126
128
  atomListeners: ({
@@ -125,7 +125,8 @@ var useAuthQuery = (initializedAtom, path, $fetch, options) => {
125
125
  const value = atom({
126
126
  data: null,
127
127
  error: null,
128
- isPending: false
128
+ isPending: false,
129
+ isRefetching: false
129
130
  });
130
131
  const fn = () => {
131
132
  const opts = typeof options === "function" ? options({
@@ -139,24 +140,27 @@ var useAuthQuery = (initializedAtom, path, $fetch, options) => {
139
140
  value.set({
140
141
  data: context.data,
141
142
  error: null,
142
- isPending: false
143
+ isPending: false,
144
+ isRefetching: false
143
145
  });
144
146
  await opts?.onSuccess?.(context);
145
147
  },
146
148
  async onError(context) {
147
149
  value.set({
148
150
  error: context.error,
149
- data: null,
150
- isPending: false
151
+ data: value.get().data,
152
+ isPending: false,
153
+ isRefetching: false
151
154
  });
152
155
  await opts?.onError?.(context);
153
156
  },
154
157
  async onRequest(context) {
155
158
  const currentValue = value.get();
156
159
  value.set({
157
- isPending: true,
160
+ isPending: currentValue.data === null,
158
161
  data: currentValue.data,
159
- error: currentValue.error
162
+ error: null,
163
+ isRefetching: true
160
164
  });
161
165
  await opts?.onRequest?.(context);
162
166
  }
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-BwEFpoZw.js';
9
+ import './index-DjYTypwW.js';
10
10
  import 'kysely';
11
11
  import './index-JM-i6hLs.js';
12
12
  import 'arctic';
@@ -39,6 +39,7 @@ declare function createAuthClient<Option extends ClientOptions>(options?: Option
39
39
  } | null;
40
40
  error: null | _better_fetch_fetch.BetterFetchError;
41
41
  isPending: boolean;
42
+ isRefetching: boolean;
42
43
  }>;
43
44
  $fetch: _better_fetch_fetch.BetterFetch<{
44
45
  plugins: (_better_fetch_fetch.BetterFetchPlugin | {
@@ -268,6 +269,7 @@ declare const useAuthQuery: <T>(initializedAtom: PreinitializedWritableAtom<any>
268
269
  data: null | T;
269
270
  error: null | BetterFetchError;
270
271
  isPending: boolean;
272
+ isRefetching: boolean;
271
273
  }>;
272
274
 
273
275
  export { BetterAuthClientPlugin, ClientOptions, InferActions, InferAdditionalFromClient, InferClientAPI, InferSessionFromClient, InferUserFromClient, IsSignal, createAuthClient, useAuthQuery };
package/dist/client.js CHANGED
@@ -277,7 +277,8 @@ var useAuthQuery = (initializedAtom, path, $fetch, options) => {
277
277
  const value = atom({
278
278
  data: null,
279
279
  error: null,
280
- isPending: false
280
+ isPending: false,
281
+ isRefetching: false
281
282
  });
282
283
  const fn = () => {
283
284
  const opts = typeof options === "function" ? options({
@@ -291,24 +292,27 @@ var useAuthQuery = (initializedAtom, path, $fetch, options) => {
291
292
  value.set({
292
293
  data: context.data,
293
294
  error: null,
294
- isPending: false
295
+ isPending: false,
296
+ isRefetching: false
295
297
  });
296
298
  await opts?.onSuccess?.(context);
297
299
  },
298
300
  async onError(context) {
299
301
  value.set({
300
302
  error: context.error,
301
- data: null,
302
- isPending: false
303
+ data: value.get().data,
304
+ isPending: false,
305
+ isRefetching: false
303
306
  });
304
307
  await opts?.onError?.(context);
305
308
  },
306
309
  async onRequest(context) {
307
310
  const currentValue = value.get();
308
311
  value.set({
309
- isPending: true,
312
+ isPending: currentValue.data === null,
310
313
  data: currentValue.data,
311
- error: currentValue.error
314
+ error: null,
315
+ isRefetching: true
312
316
  });
313
317
  await opts?.onRequest?.(context);
314
318
  }
@@ -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-BwEFpoZw.js';
8
+ import { H as HookEndpointContext } from './index-DjYTypwW.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
  };
@@ -861,7 +861,7 @@ type InferAdditional<Options extends BetterAuthOptions, Key extends string> = Op
861
861
  type AdditionalSessionFields<Options extends BetterAuthOptions> = InferAdditional<Options, "session">;
862
862
  type AdditionalUserFields<Options extends BetterAuthOptions> = InferAdditional<Options, "user">;
863
863
  type InferUser<O extends BetterAuthOptions | Auth> = UnionToIntersection<StripEmptyObjects<User & (O extends BetterAuthOptions ? AdditionalUserFields<O> : O extends Auth ? AdditionalUserFields<O["options"]> : {})>>;
864
- type InferSession<O extends BetterAuthOptions | Auth> = UnionToIntersection<Session & (O extends BetterAuthOptions ? AdditionalSessionFields<O> : O extends Auth ? AdditionalSessionFields<O["options"]> : {})>;
864
+ type InferSession<O extends BetterAuthOptions | Auth> = StripEmptyObjects<Session & (O extends BetterAuthOptions ? AdditionalSessionFields<O> : O extends Auth ? AdditionalSessionFields<O["options"]> : {})>;
865
865
  type InferPluginTypes<O extends BetterAuthOptions> = O["plugins"] extends Array<infer P> ? UnionToIntersection<P extends BetterAuthPlugin ? P["$Infer"] extends Record<string, any> ? P["$Infer"] : {} : {}> : {};
866
866
  interface RateLimit {
867
867
  /**
@@ -1517,7 +1517,7 @@ declare const listSessions: <Option extends BetterAuthOptions>() => {
1517
1517
  };
1518
1518
  }>, better_call.EndpointOptions>[];
1519
1519
  requireHeaders: true;
1520
- }>): Promise<Prettify<UnionToIntersection<{
1520
+ }>): Promise<Prettify<StripEmptyObjects<{
1521
1521
  id: string;
1522
1522
  userId: string;
1523
1523
  expiresAt: Date;
@@ -2574,7 +2574,7 @@ declare function getEndpoints<C extends AuthContext, Option extends BetterAuthOp
2574
2574
  method: "GET";
2575
2575
  requireHeaders: true;
2576
2576
  }>): Promise<{
2577
- session: UnionToIntersection<{
2577
+ session: StripEmptyObjects<{
2578
2578
  id: string;
2579
2579
  userId: string;
2580
2580
  expiresAt: Date;
@@ -3295,7 +3295,7 @@ declare function getEndpoints<C extends AuthContext, Option extends BetterAuthOp
3295
3295
  };
3296
3296
  }>, better_call.EndpointOptions>[];
3297
3297
  requireHeaders: true;
3298
- }>): Promise<Prettify<UnionToIntersection<{
3298
+ }>): Promise<Prettify<StripEmptyObjects<{
3299
3299
  id: string;
3300
3300
  userId: string;
3301
3301
  expiresAt: Date;
@@ -3636,7 +3636,7 @@ declare const router: <C extends AuthContext, Option extends BetterAuthOptions>(
3636
3636
  method: "GET";
3637
3637
  requireHeaders: true;
3638
3638
  }>): Promise<{
3639
- session: UnionToIntersection<{
3639
+ session: StripEmptyObjects<{
3640
3640
  id: string;
3641
3641
  userId: string;
3642
3642
  expiresAt: Date;
@@ -4357,7 +4357,7 @@ declare const router: <C extends AuthContext, Option extends BetterAuthOptions>(
4357
4357
  };
4358
4358
  }>, better_call.EndpointOptions>[];
4359
4359
  requireHeaders: true;
4360
- }>): Promise<Prettify<UnionToIntersection<{
4360
+ }>): Promise<Prettify<StripEmptyObjects<{
4361
4361
  id: string;
4362
4362
  userId: string;
4363
4363
  expiresAt: Date;
@@ -4700,7 +4700,7 @@ declare const betterAuth: <O extends BetterAuthOptions>(options: O) => {
4700
4700
  method: "GET";
4701
4701
  requireHeaders: true;
4702
4702
  }>): Promise<{
4703
- session: UnionToIntersection<{
4703
+ session: StripEmptyObjects<{
4704
4704
  id: string;
4705
4705
  userId: string;
4706
4706
  expiresAt: Date;
@@ -5421,7 +5421,7 @@ declare const betterAuth: <O extends BetterAuthOptions>(options: O) => {
5421
5421
  };
5422
5422
  }>, better_call.EndpointOptions>[];
5423
5423
  requireHeaders: true;
5424
- }>): Promise<Prettify<UnionToIntersection<{
5424
+ }>): Promise<Prettify<StripEmptyObjects<{
5425
5425
  id: string;
5426
5426
  userId: string;
5427
5427
  expiresAt: Date;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { e as Auth, a3 as betterAuth } from './index-BwEFpoZw.js';
1
+ export { e as Auth, a3 as betterAuth } from './index-DjYTypwW.js';
2
2
  import 'kysely';
3
3
  import './index-JM-i6hLs.js';
4
4
  import 'arctic';
package/dist/next-js.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { e as Auth } from './index-BwEFpoZw.js';
1
+ import { e as Auth } from './index-DjYTypwW.js';
2
2
  import { U as User, S as Session } from './index-JM-i6hLs.js';
3
3
  import { NextRequest } from 'next/server';
4
4
  import 'kysely';
package/dist/node.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as http from 'http';
2
- import { e as Auth } from './index-BwEFpoZw.js';
2
+ import { e as Auth } from './index-DjYTypwW.js';
3
3
  import 'kysely';
4
4
  import './index-JM-i6hLs.js';
5
5
  import 'arctic';
package/dist/plugins.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- export { O as OrganizationOptions, b as Passkey, P as PasskeyOptions, W as WebAuthnCookieType, 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-CGc97fG-.js';
1
+ export { O as OrganizationOptions, b as Passkey, P as PasskeyOptions, W as WebAuthnCookieType, 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-BHqaQq-x.js';
2
2
  export { i as ac } from './index-DfAHOgpj.js';
3
- import { H as HookEndpointContext } from './index-BwEFpoZw.js';
4
- export { b as AuthEndpoint, d as AuthMiddleware, B as BetterAuthPlugin, P as PluginSchema, a as createAuthEndpoint, c as createAuthMiddleware, o as optionsMiddleware } from './index-BwEFpoZw.js';
3
+ import { H as HookEndpointContext } from './index-DjYTypwW.js';
4
+ export { b as AuthEndpoint, d as AuthMiddleware, B as BetterAuthPlugin, P as PluginSchema, a as createAuthEndpoint, c as createAuthMiddleware, o as optionsMiddleware } from './index-DjYTypwW.js';
5
5
  export { H as HIDE_METADATA } from './hide-metadata-DEHJp1rk.js';
6
6
  import './index-JM-i6hLs.js';
7
7
  import 'arctic';
package/dist/plugins.js CHANGED
@@ -4561,7 +4561,8 @@ var useAuthQuery = (initializedAtom, path, $fetch, options) => {
4561
4561
  const value = atom({
4562
4562
  data: null,
4563
4563
  error: null,
4564
- isPending: false
4564
+ isPending: false,
4565
+ isRefetching: false
4565
4566
  });
4566
4567
  const fn = () => {
4567
4568
  const opts = typeof options === "function" ? options({
@@ -4575,24 +4576,27 @@ var useAuthQuery = (initializedAtom, path, $fetch, options) => {
4575
4576
  value.set({
4576
4577
  data: context.data,
4577
4578
  error: null,
4578
- isPending: false
4579
+ isPending: false,
4580
+ isRefetching: false
4579
4581
  });
4580
4582
  await opts?.onSuccess?.(context);
4581
4583
  },
4582
4584
  async onError(context) {
4583
4585
  value.set({
4584
4586
  error: context.error,
4585
- data: null,
4586
- isPending: false
4587
+ data: value.get().data,
4588
+ isPending: false,
4589
+ isRefetching: false
4587
4590
  });
4588
4591
  await opts?.onError?.(context);
4589
4592
  },
4590
4593
  async onRequest(context) {
4591
4594
  const currentValue = value.get();
4592
4595
  value.set({
4593
- isPending: true,
4596
+ isPending: currentValue.data === null,
4594
4597
  data: currentValue.data,
4595
- error: currentValue.error
4598
+ error: null,
4599
+ isRefetching: true
4596
4600
  });
4597
4601
  await opts?.onRequest?.(context);
4598
4602
  }
package/dist/react.d.ts CHANGED
@@ -3,7 +3,7 @@ import { U as UnionToIntersection, P as Prettify, S as StripEmptyObjects } from
3
3
  import { ClientOptions, InferClientAPI, InferActions, InferAdditionalFromClient, BetterAuthClientPlugin, IsSignal } from './types.js';
4
4
  import { useStore } from '@nanostores/react';
5
5
  import 'zod';
6
- import './index-BwEFpoZw.js';
6
+ import './index-DjYTypwW.js';
7
7
  import 'kysely';
8
8
  import './index-JM-i6hLs.js';
9
9
  import 'arctic';
@@ -54,6 +54,7 @@ declare function createAuthClient<Option extends ClientOptions>(options?: Option
54
54
  } | null;
55
55
  error: null | _better_fetch_fetch.BetterFetchError;
56
56
  isPending: boolean;
57
+ isRefetching: boolean;
57
58
  };
58
59
  $Infer: {
59
60
  Session: {
package/dist/react.js CHANGED
@@ -279,7 +279,8 @@ var useAuthQuery = (initializedAtom, path, $fetch, options) => {
279
279
  const value = atom({
280
280
  data: null,
281
281
  error: null,
282
- isPending: false
282
+ isPending: false,
283
+ isRefetching: false
283
284
  });
284
285
  const fn = () => {
285
286
  const opts = typeof options === "function" ? options({
@@ -293,24 +294,27 @@ var useAuthQuery = (initializedAtom, path, $fetch, options) => {
293
294
  value.set({
294
295
  data: context.data,
295
296
  error: null,
296
- isPending: false
297
+ isPending: false,
298
+ isRefetching: false
297
299
  });
298
300
  await opts?.onSuccess?.(context);
299
301
  },
300
302
  async onError(context) {
301
303
  value.set({
302
304
  error: context.error,
303
- data: null,
304
- isPending: false
305
+ data: value.get().data,
306
+ isPending: false,
307
+ isRefetching: false
305
308
  });
306
309
  await opts?.onError?.(context);
307
310
  },
308
311
  async onRequest(context) {
309
312
  const currentValue = value.get();
310
313
  value.set({
311
- isPending: true,
314
+ isPending: currentValue.data === null,
312
315
  data: currentValue.data,
313
- error: currentValue.error
316
+ error: null,
317
+ isRefetching: true
314
318
  });
315
319
  await opts?.onRequest?.(context);
316
320
  }
@@ -1,4 +1,4 @@
1
- import { e as Auth } from './index-BwEFpoZw.js';
1
+ import { e as Auth } from './index-DjYTypwW.js';
2
2
  import 'kysely';
3
3
  import './index-JM-i6hLs.js';
4
4
  import 'arctic';
package/dist/solid.d.ts CHANGED
@@ -3,7 +3,7 @@ import { U as UnionToIntersection, P as Prettify, S as StripEmptyObjects } from
3
3
  import { ClientOptions, InferClientAPI, InferActions, InferAdditionalFromClient, BetterAuthClientPlugin, IsSignal } from './types.js';
4
4
  import { Accessor } from 'solid-js';
5
5
  import 'zod';
6
- import './index-BwEFpoZw.js';
6
+ import './index-DjYTypwW.js';
7
7
  import 'kysely';
8
8
  import './index-JM-i6hLs.js';
9
9
  import 'arctic';
@@ -37,6 +37,7 @@ declare function createAuthClient<Option extends ClientOptions>(options?: Option
37
37
  } | null;
38
38
  error: null | _better_fetch_fetch.BetterFetchError;
39
39
  isPending: boolean;
40
+ isRefetching: boolean;
40
41
  }>;
41
42
  $Infer: {
42
43
  Session: {
package/dist/solid.js CHANGED
@@ -278,7 +278,8 @@ var useAuthQuery = (initializedAtom, path, $fetch, options) => {
278
278
  const value = atom({
279
279
  data: null,
280
280
  error: null,
281
- isPending: false
281
+ isPending: false,
282
+ isRefetching: false
282
283
  });
283
284
  const fn = () => {
284
285
  const opts = typeof options === "function" ? options({
@@ -292,24 +293,27 @@ var useAuthQuery = (initializedAtom, path, $fetch, options) => {
292
293
  value.set({
293
294
  data: context.data,
294
295
  error: null,
295
- isPending: false
296
+ isPending: false,
297
+ isRefetching: false
296
298
  });
297
299
  await opts?.onSuccess?.(context);
298
300
  },
299
301
  async onError(context) {
300
302
  value.set({
301
303
  error: context.error,
302
- data: null,
303
- isPending: false
304
+ data: value.get().data,
305
+ isPending: false,
306
+ isRefetching: false
304
307
  });
305
308
  await opts?.onError?.(context);
306
309
  },
307
310
  async onRequest(context) {
308
311
  const currentValue = value.get();
309
312
  value.set({
310
- isPending: true,
313
+ isPending: currentValue.data === null,
311
314
  data: currentValue.data,
312
- error: currentValue.error
315
+ error: null,
316
+ isRefetching: true
313
317
  });
314
318
  await opts?.onRequest?.(context);
315
319
  }
@@ -1,4 +1,4 @@
1
- import { e as Auth, f as BetterAuthOptions } from './index-BwEFpoZw.js';
1
+ import { e as Auth, f as BetterAuthOptions } from './index-DjYTypwW.js';
2
2
  import 'kysely';
3
3
  import './index-JM-i6hLs.js';
4
4
  import 'arctic';
package/dist/svelte.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 'zod';
6
- import './index-BwEFpoZw.js';
6
+ import './index-DjYTypwW.js';
7
7
  import 'kysely';
8
8
  import './index-JM-i6hLs.js';
9
9
  import 'arctic';
@@ -36,6 +36,7 @@ declare function createAuthClient<Option extends ClientOptions>(options?: Option
36
36
  } | null;
37
37
  error: null | _better_fetch_fetch.BetterFetchError;
38
38
  isPending: boolean;
39
+ isRefetching: boolean;
39
40
  }>;
40
41
  $Infer: {
41
42
  Session: {
package/dist/svelte.js CHANGED
@@ -277,7 +277,8 @@ var useAuthQuery = (initializedAtom, path, $fetch, options) => {
277
277
  const value = atom({
278
278
  data: null,
279
279
  error: null,
280
- isPending: false
280
+ isPending: false,
281
+ isRefetching: false
281
282
  });
282
283
  const fn = () => {
283
284
  const opts = typeof options === "function" ? options({
@@ -291,24 +292,27 @@ var useAuthQuery = (initializedAtom, path, $fetch, options) => {
291
292
  value.set({
292
293
  data: context.data,
293
294
  error: null,
294
- isPending: false
295
+ isPending: false,
296
+ isRefetching: false
295
297
  });
296
298
  await opts?.onSuccess?.(context);
297
299
  },
298
300
  async onError(context) {
299
301
  value.set({
300
302
  error: context.error,
301
- data: null,
302
- isPending: false
303
+ data: value.get().data,
304
+ isPending: false,
305
+ isRefetching: false
303
306
  });
304
307
  await opts?.onError?.(context);
305
308
  },
306
309
  async onRequest(context) {
307
310
  const currentValue = value.get();
308
311
  value.set({
309
- isPending: true,
312
+ isPending: currentValue.data === null,
310
313
  data: currentValue.data,
311
- error: currentValue.error
314
+ error: null,
315
+ isRefetching: true
312
316
  });
313
317
  await opts?.onRequest?.(context);
314
318
  }
package/dist/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { B as BetterAuthPlugin, e as Auth, F as FieldAttribute, I as InferFieldOutput } from './index-BwEFpoZw.js';
2
- export { A as Adapter, g as AuthContext, f as BetterAuthOptions, G as GenericEndpointContext, H as HookEndpointContext, r as InferPluginTypes, q as InferSession, n as InferUser, P as PluginSchema, R as RateLimit, S as SessionAdapter, W as Where, t as init } from './index-BwEFpoZw.js';
1
+ import { B as BetterAuthPlugin, e as Auth, F as FieldAttribute, I as InferFieldOutput } from './index-DjYTypwW.js';
2
+ export { A as Adapter, g as AuthContext, f as BetterAuthOptions, G as GenericEndpointContext, H as HookEndpointContext, r as InferPluginTypes, q as InferSession, n as InferUser, P as PluginSchema, R as RateLimit, S as SessionAdapter, W as Where, t as init } from './index-DjYTypwW.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 './index-JM-i6hLs.js';
package/dist/utils.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { g as AuthContext, G as GenericEndpointContext } from './index-BwEFpoZw.js';
2
- export { j as BetterAuthCookies, i as createCookieGetter, l as createLogger, k as deleteSessionCookie, h as getCookies, m as logger, p as parseSetCookieHeader, s as setSessionCookie } from './index-BwEFpoZw.js';
1
+ import { g as AuthContext, G as GenericEndpointContext } from './index-DjYTypwW.js';
2
+ export { j as BetterAuthCookies, i as createCookieGetter, l as createLogger, k as deleteSessionCookie, h as getCookies, m as logger, p as parseSetCookieHeader, s as setSessionCookie } from './index-DjYTypwW.js';
3
3
  export { H as HIDE_METADATA } from './hide-metadata-DEHJp1rk.js';
4
4
  import { z } from 'zod';
5
5
  import 'kysely';
package/dist/vue.d.ts CHANGED
@@ -3,7 +3,7 @@ import { U as UnionToIntersection, P as Prettify, S as StripEmptyObjects } from
3
3
  import { ClientOptions, InferClientAPI, InferActions, InferAdditionalFromClient, BetterAuthClientPlugin, IsSignal } from './types.js';
4
4
  import { Ref, DeepReadonly } from 'vue';
5
5
  import 'zod';
6
- import './index-BwEFpoZw.js';
6
+ import './index-DjYTypwW.js';
7
7
  import 'kysely';
8
8
  import './index-JM-i6hLs.js';
9
9
  import 'arctic';
@@ -37,6 +37,7 @@ declare function createAuthClient<Option extends ClientOptions>(options?: Option
37
37
  } | null;
38
38
  readonly error: null | _better_fetch_fetch.BetterFetchError;
39
39
  readonly isPending: boolean;
40
+ readonly isRefetching: boolean;
40
41
  }, {
41
42
  readonly data: {
42
43
  readonly user: DeepReadonly<Prettify<StripEmptyObjects<{
@@ -58,6 +59,7 @@ declare function createAuthClient<Option extends ClientOptions>(options?: Option
58
59
  } | null;
59
60
  readonly error: null | _better_fetch_fetch.BetterFetchError;
60
61
  readonly isPending: boolean;
62
+ readonly isRefetching: boolean;
61
63
  }>>;
62
64
  $Infer: {
63
65
  Session: {
package/dist/vue.js CHANGED
@@ -278,7 +278,8 @@ var useAuthQuery = (initializedAtom, path, $fetch, options) => {
278
278
  const value = atom({
279
279
  data: null,
280
280
  error: null,
281
- isPending: false
281
+ isPending: false,
282
+ isRefetching: false
282
283
  });
283
284
  const fn = () => {
284
285
  const opts = typeof options === "function" ? options({
@@ -292,24 +293,27 @@ var useAuthQuery = (initializedAtom, path, $fetch, options) => {
292
293
  value.set({
293
294
  data: context.data,
294
295
  error: null,
295
- isPending: false
296
+ isPending: false,
297
+ isRefetching: false
296
298
  });
297
299
  await opts?.onSuccess?.(context);
298
300
  },
299
301
  async onError(context) {
300
302
  value.set({
301
303
  error: context.error,
302
- data: null,
303
- isPending: false
304
+ data: value.get().data,
305
+ isPending: false,
306
+ isRefetching: false
304
307
  });
305
308
  await opts?.onError?.(context);
306
309
  },
307
310
  async onRequest(context) {
308
311
  const currentValue = value.get();
309
312
  value.set({
310
- isPending: true,
313
+ isPending: currentValue.data === null,
311
314
  data: currentValue.data,
312
- error: currentValue.error
315
+ error: null,
316
+ isRefetching: true
313
317
  });
314
318
  await opts?.onRequest?.(context);
315
319
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "better-auth",
3
- "version": "0.2.8-beta.12",
3
+ "version": "0.2.8-beta.13",
4
4
  "description": "The most comprehensive authentication library for TypeScript.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",