better-auth 0.2.9-beta.5 → 0.2.9-beta.7

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-PjYlcsPD.js';
1
+ import { A as Adapter } from '../index-C9S3KShG.js';
2
2
  import 'kysely';
3
3
  import '../index-JM-i6hLs.js';
4
4
  import 'arctic';
@@ -1,5 +1,5 @@
1
1
  import { Db } from 'mongodb';
2
- import { W as Where } from '../index-PjYlcsPD.js';
2
+ import { W as Where } from '../index-C9S3KShG.js';
3
3
  import 'kysely';
4
4
  import '../index-JM-i6hLs.js';
5
5
  import 'arctic';
@@ -1,4 +1,4 @@
1
- import { A as Adapter } from '../index-PjYlcsPD.js';
1
+ import { A as Adapter } from '../index-C9S3KShG.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 { e as AuthEndpoint, f as AuthMiddleware, n as callbackOAuth, L as changePassword, d as createAuthEndpoint, c as createAuthMiddleware, D as createEmailVerificationToken, V as csrfMiddleware, N as deleteUser, Q as error, y as forgetPassword, z as forgetPasswordCallback, O as getCSRFToken, l as getEndpoints, p as getSession, q as getSessionFromCtx, u as listSessions, T as ok, o as optionsMiddleware, C as resetPassword, v as revokeSession, w as revokeSessions, r as router, E as sendVerificationEmail, t as sessionMiddleware, M as setPassword, m as signInEmail, s as signInOAuth, x as signOut, U as signUpEmail, K as updateUser, J as verifyEmail } from './index-PjYlcsPD.js';
1
+ export { e as AuthEndpoint, f as AuthMiddleware, n as callbackOAuth, L as changePassword, d as createAuthEndpoint, c as createAuthMiddleware, D as createEmailVerificationToken, V as csrfMiddleware, N as deleteUser, Q as error, y as forgetPassword, z as forgetPasswordCallback, O as getCSRFToken, l as getEndpoints, p as getSession, q as getSessionFromCtx, u as listSessions, T as ok, o as optionsMiddleware, C as resetPassword, v as revokeSession, w as revokeSessions, r as router, E as sendVerificationEmail, t as sessionMiddleware, M as setPassword, m as signInEmail, s as signInOAuth, x as signOut, U as signUpEmail, K as updateUser, J as verifyEmail } from './index-C9S3KShG.js';
2
2
  import 'zod';
3
3
  import './helper-DPDj8Nix.js';
4
4
  import 'better-call';
package/dist/api.js CHANGED
@@ -143,7 +143,7 @@ function getBaseURL(url, path) {
143
143
  if (url) {
144
144
  return withPath(url, path);
145
145
  }
146
- const env = process?.env || {};
146
+ const env = typeof process !== "undefined" ? process.env : {};
147
147
  const fromEnv = env.BETTER_AUTH_URL || env.NEXT_PUBLIC_BETTER_AUTH_URL || env.PUBLIC_BETTER_AUTH_URL || env.NUXT_PUBLIC_BETTER_AUTH_URL || env.NUXT_PUBLIC_AUTH_URL || (env.BASE_URL !== "/" ? env.BASE_URL : void 0);
148
148
  if (fromEnv) {
149
149
  return withPath(fromEnv, path);
package/dist/cli.js CHANGED
@@ -483,7 +483,9 @@ async function getMigrations(config) {
483
483
  const betterAuthSchema = getSchema(config);
484
484
  const { kysely: db, databaseType: dbType } = await createKyselyAdapter(config);
485
485
  if (!db || !dbType) {
486
- logger.error("Invalid database configuration.");
486
+ logger.error(
487
+ "Only kysely adapter is supported for migrations. You can use `generate` command to generate the schema, if you're using a different adapter."
488
+ );
487
489
  process.exit(1);
488
490
  }
489
491
  const tableMetadata = await db.introspection.getTables();
@@ -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-CzTRLQrX.js';
6
- export { g as getPasskeyActions, c as passkeyClient, a as twoFactorClient } from '../index-CzTRLQrX.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-UOcOxfoL.js';
6
+ export { g as getPasskeyActions, c as passkeyClient, a as twoFactorClient } from '../index-UOcOxfoL.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-PjYlcsPD.js';
12
+ import '../index-C9S3KShG.js';
13
13
  import 'kysely';
14
14
  import 'better-sqlite3';
15
15
  import 'mysql2';
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-PjYlcsPD.js';
9
+ import './index-C9S3KShG.js';
10
10
  import 'kysely';
11
11
  import './index-JM-i6hLs.js';
12
12
  import 'arctic';
package/dist/client.js CHANGED
@@ -35,7 +35,7 @@ function getBaseURL(url, path) {
35
35
  if (url) {
36
36
  return withPath(url, path);
37
37
  }
38
- const env = process?.env || {};
38
+ const env = typeof process !== "undefined" ? process.env : {};
39
39
  const fromEnv = env.BETTER_AUTH_URL || env.NEXT_PUBLIC_BETTER_AUTH_URL || env.PUBLIC_BETTER_AUTH_URL || env.NUXT_PUBLIC_BETTER_AUTH_URL || env.NUXT_PUBLIC_AUTH_URL || (env.BASE_URL !== "/" ? env.BASE_URL : void 0);
40
40
  if (fromEnv) {
41
41
  return withPath(fromEnv, path);
@@ -1243,17 +1243,17 @@ declare const signInOAuth: {
1243
1243
  /**
1244
1244
  * OAuth2 provider to use`
1245
1245
  */
1246
- 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")[]]>;
1247
1247
  /**
1248
1248
  * If this is true the session will only be valid for the current browser session
1249
1249
  */
1250
1250
  dontRememberMe: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
1251
1251
  }, "strip", z.ZodTypeAny, {
1252
- provider: "github" | "apple" | "discord" | "facebook" | "google" | "spotify" | "twitch" | "twitter";
1252
+ provider: "apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter";
1253
1253
  callbackURL?: string | undefined;
1254
1254
  dontRememberMe?: boolean | undefined;
1255
1255
  }, {
1256
- provider: "github" | "apple" | "discord" | "facebook" | "google" | "spotify" | "twitch" | "twitter";
1256
+ provider: "apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter";
1257
1257
  callbackURL?: string | undefined;
1258
1258
  dontRememberMe?: boolean | undefined;
1259
1259
  }>;
@@ -1286,17 +1286,17 @@ declare const signInOAuth: {
1286
1286
  /**
1287
1287
  * OAuth2 provider to use`
1288
1288
  */
1289
- 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")[]]>;
1290
1290
  /**
1291
1291
  * If this is true the session will only be valid for the current browser session
1292
1292
  */
1293
1293
  dontRememberMe: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
1294
1294
  }, "strip", z.ZodTypeAny, {
1295
- provider: "github" | "apple" | "discord" | "facebook" | "google" | "spotify" | "twitch" | "twitter";
1295
+ provider: "apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter";
1296
1296
  callbackURL?: string | undefined;
1297
1297
  dontRememberMe?: boolean | undefined;
1298
1298
  }, {
1299
- provider: "github" | "apple" | "discord" | "facebook" | "google" | "spotify" | "twitch" | "twitter";
1299
+ provider: "apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter";
1300
1300
  callbackURL?: string | undefined;
1301
1301
  dontRememberMe?: boolean | undefined;
1302
1302
  }>;
@@ -2445,14 +2445,14 @@ declare function getEndpoints<C extends AuthContext, Option extends BetterAuthOp
2445
2445
  }>>;
2446
2446
  body: zod.ZodObject<{
2447
2447
  callbackURL: zod.ZodOptional<zod.ZodString>;
2448
- 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")[]]>;
2449
2449
  dontRememberMe: zod.ZodOptional<zod.ZodDefault<zod.ZodBoolean>>;
2450
2450
  }, "strip", zod.ZodTypeAny, {
2451
- provider: "github" | "apple" | "discord" | "facebook" | "google" | "spotify" | "twitch" | "twitter";
2451
+ provider: "apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter";
2452
2452
  callbackURL?: string | undefined;
2453
2453
  dontRememberMe?: boolean | undefined;
2454
2454
  }, {
2455
- provider: "github" | "apple" | "discord" | "facebook" | "google" | "spotify" | "twitch" | "twitter";
2455
+ provider: "apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter";
2456
2456
  callbackURL?: string | undefined;
2457
2457
  dontRememberMe?: boolean | undefined;
2458
2458
  }>;
@@ -2475,14 +2475,14 @@ declare function getEndpoints<C extends AuthContext, Option extends BetterAuthOp
2475
2475
  }>>;
2476
2476
  body: zod.ZodObject<{
2477
2477
  callbackURL: zod.ZodOptional<zod.ZodString>;
2478
- 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")[]]>;
2479
2479
  dontRememberMe: zod.ZodOptional<zod.ZodDefault<zod.ZodBoolean>>;
2480
2480
  }, "strip", zod.ZodTypeAny, {
2481
- provider: "github" | "apple" | "discord" | "facebook" | "google" | "spotify" | "twitch" | "twitter";
2481
+ provider: "apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter";
2482
2482
  callbackURL?: string | undefined;
2483
2483
  dontRememberMe?: boolean | undefined;
2484
2484
  }, {
2485
- provider: "github" | "apple" | "discord" | "facebook" | "google" | "spotify" | "twitch" | "twitter";
2485
+ provider: "apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter";
2486
2486
  callbackURL?: string | undefined;
2487
2487
  dontRememberMe?: boolean | undefined;
2488
2488
  }>;
@@ -3507,14 +3507,14 @@ declare const router: <C extends AuthContext, Option extends BetterAuthOptions>(
3507
3507
  }>>;
3508
3508
  body: zod.ZodObject<{
3509
3509
  callbackURL: zod.ZodOptional<zod.ZodString>;
3510
- 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")[]]>;
3511
3511
  dontRememberMe: zod.ZodOptional<zod.ZodDefault<zod.ZodBoolean>>;
3512
3512
  }, "strip", zod.ZodTypeAny, {
3513
- provider: "github" | "apple" | "discord" | "facebook" | "google" | "spotify" | "twitch" | "twitter";
3513
+ provider: "apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter";
3514
3514
  callbackURL?: string | undefined;
3515
3515
  dontRememberMe?: boolean | undefined;
3516
3516
  }, {
3517
- provider: "github" | "apple" | "discord" | "facebook" | "google" | "spotify" | "twitch" | "twitter";
3517
+ provider: "apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter";
3518
3518
  callbackURL?: string | undefined;
3519
3519
  dontRememberMe?: boolean | undefined;
3520
3520
  }>;
@@ -3537,14 +3537,14 @@ declare const router: <C extends AuthContext, Option extends BetterAuthOptions>(
3537
3537
  }>>;
3538
3538
  body: zod.ZodObject<{
3539
3539
  callbackURL: zod.ZodOptional<zod.ZodString>;
3540
- 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")[]]>;
3541
3541
  dontRememberMe: zod.ZodOptional<zod.ZodDefault<zod.ZodBoolean>>;
3542
3542
  }, "strip", zod.ZodTypeAny, {
3543
- provider: "github" | "apple" | "discord" | "facebook" | "google" | "spotify" | "twitch" | "twitter";
3543
+ provider: "apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter";
3544
3544
  callbackURL?: string | undefined;
3545
3545
  dontRememberMe?: boolean | undefined;
3546
3546
  }, {
3547
- provider: "github" | "apple" | "discord" | "facebook" | "google" | "spotify" | "twitch" | "twitter";
3547
+ provider: "apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter";
3548
3548
  callbackURL?: string | undefined;
3549
3549
  dontRememberMe?: boolean | undefined;
3550
3550
  }>;
@@ -4571,14 +4571,14 @@ declare const betterAuth: <O extends BetterAuthOptions>(options: O) => {
4571
4571
  }>>;
4572
4572
  body: zod.ZodObject<{
4573
4573
  callbackURL: zod.ZodOptional<zod.ZodString>;
4574
- 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")[]]>;
4575
4575
  dontRememberMe: zod.ZodOptional<zod.ZodDefault<zod.ZodBoolean>>;
4576
4576
  }, "strip", zod.ZodTypeAny, {
4577
- provider: "github" | "apple" | "discord" | "facebook" | "google" | "spotify" | "twitch" | "twitter";
4577
+ provider: "apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter";
4578
4578
  callbackURL?: string | undefined;
4579
4579
  dontRememberMe?: boolean | undefined;
4580
4580
  }, {
4581
- provider: "github" | "apple" | "discord" | "facebook" | "google" | "spotify" | "twitch" | "twitter";
4581
+ provider: "apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter";
4582
4582
  callbackURL?: string | undefined;
4583
4583
  dontRememberMe?: boolean | undefined;
4584
4584
  }>;
@@ -4601,14 +4601,14 @@ declare const betterAuth: <O extends BetterAuthOptions>(options: O) => {
4601
4601
  }>>;
4602
4602
  body: zod.ZodObject<{
4603
4603
  callbackURL: zod.ZodOptional<zod.ZodString>;
4604
- 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")[]]>;
4605
4605
  dontRememberMe: zod.ZodOptional<zod.ZodDefault<zod.ZodBoolean>>;
4606
4606
  }, "strip", zod.ZodTypeAny, {
4607
- provider: "github" | "apple" | "discord" | "facebook" | "google" | "spotify" | "twitch" | "twitter";
4607
+ provider: "apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter";
4608
4608
  callbackURL?: string | undefined;
4609
4609
  dontRememberMe?: boolean | undefined;
4610
4610
  }, {
4611
- provider: "github" | "apple" | "discord" | "facebook" | "google" | "spotify" | "twitch" | "twitter";
4611
+ provider: "apple" | "discord" | "facebook" | "github" | "google" | "spotify" | "twitch" | "twitter";
4612
4612
  callbackURL?: string | undefined;
4613
4613
  dontRememberMe?: boolean | undefined;
4614
4614
  }>;
@@ -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-PjYlcsPD.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';
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { a as Auth, X as betterAuth } from './index-PjYlcsPD.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';
package/dist/index.js CHANGED
@@ -143,7 +143,7 @@ function getBaseURL(url, path) {
143
143
  if (url) {
144
144
  return withPath(url, path);
145
145
  }
146
- const env = process?.env || {};
146
+ const env = typeof process !== "undefined" ? process.env : {};
147
147
  const fromEnv = env.BETTER_AUTH_URL || env.NEXT_PUBLIC_BETTER_AUTH_URL || env.PUBLIC_BETTER_AUTH_URL || env.NUXT_PUBLIC_BETTER_AUTH_URL || env.NUXT_PUBLIC_AUTH_URL || (env.BASE_URL !== "/" ? env.BASE_URL : void 0);
148
148
  if (fromEnv) {
149
149
  return withPath(fromEnv, path);
@@ -2995,7 +2995,9 @@ async function getMigrations(config2) {
2995
2995
  const betterAuthSchema = getSchema(config2);
2996
2996
  const { kysely: db, databaseType: dbType } = await createKyselyAdapter(config2);
2997
2997
  if (!db || !dbType) {
2998
- logger.error("Invalid database configuration.");
2998
+ logger.error(
2999
+ "Only kysely adapter is supported for migrations. You can use `generate` command to generate the schema, if you're using a different adapter."
3000
+ );
2999
3001
  process.exit(1);
3000
3002
  }
3001
3003
  const tableMetadata = await db.introspection.getTables();
package/dist/next-js.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as Auth } from './index-PjYlcsPD.js';
1
+ import { a as Auth } from './index-C9S3KShG.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 { a as Auth } from './index-PjYlcsPD.js';
2
+ import { a as Auth } from './index-C9S3KShG.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-CzTRLQrX.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-UOcOxfoL.js';
2
2
  export { i as ac } from './index-DfAHOgpj.js';
3
- import { H as HookEndpointContext } from './index-PjYlcsPD.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-PjYlcsPD.js';
3
+ import { H as HookEndpointContext } from './index-C9S3KShG.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-C9S3KShG.js';
5
5
  import './index-JM-i6hLs.js';
6
6
  import 'arctic';
7
7
  import 'zod';
package/dist/plugins.js CHANGED
@@ -81,7 +81,7 @@ function getBaseURL(url, path) {
81
81
  if (url) {
82
82
  return withPath(url, path);
83
83
  }
84
- const env = process?.env || {};
84
+ const env = typeof process !== "undefined" ? process.env : {};
85
85
  const fromEnv = env.BETTER_AUTH_URL || env.NEXT_PUBLIC_BETTER_AUTH_URL || env.PUBLIC_BETTER_AUTH_URL || env.NUXT_PUBLIC_BETTER_AUTH_URL || env.NUXT_PUBLIC_AUTH_URL || (env.BASE_URL !== "/" ? env.BASE_URL : void 0);
86
86
  if (fromEnv) {
87
87
  return withPath(fromEnv, path);
@@ -5970,6 +5970,9 @@ var phoneNumber = (options) => {
5970
5970
  ctx.body.phoneNumber
5971
5971
  );
5972
5972
  if (!otp || otp.expiresAt < /* @__PURE__ */ new Date()) {
5973
+ if (otp && otp.expiresAt < /* @__PURE__ */ new Date()) {
5974
+ await ctx.context.internalAdapter.deleteVerificationValue(otp.id);
5975
+ }
5973
5976
  return ctx.json(
5974
5977
  {
5975
5978
  status: false
@@ -5995,6 +5998,7 @@ var phoneNumber = (options) => {
5995
5998
  }
5996
5999
  );
5997
6000
  }
6001
+ await ctx.context.internalAdapter.deleteVerificationValue(otp.id);
5998
6002
  const user = await ctx.context.adapter.findOne({
5999
6003
  model: ctx.context.tables.user.tableName,
6000
6004
  where: [
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-PjYlcsPD.js';
6
+ import './index-C9S3KShG.js';
7
7
  import 'kysely';
8
8
  import './index-JM-i6hLs.js';
9
9
  import 'arctic';
package/dist/react.js CHANGED
@@ -38,7 +38,7 @@ function getBaseURL(url, path) {
38
38
  if (url) {
39
39
  return withPath(url, path);
40
40
  }
41
- const env = process?.env || {};
41
+ const env = typeof process !== "undefined" ? process.env : {};
42
42
  const fromEnv = env.BETTER_AUTH_URL || env.NEXT_PUBLIC_BETTER_AUTH_URL || env.PUBLIC_BETTER_AUTH_URL || env.NUXT_PUBLIC_BETTER_AUTH_URL || env.NUXT_PUBLIC_AUTH_URL || (env.BASE_URL !== "/" ? env.BASE_URL : void 0);
43
43
  if (fromEnv) {
44
44
  return withPath(fromEnv, path);
package/dist/social.js CHANGED
@@ -40,7 +40,7 @@ function getBaseURL(url, path) {
40
40
  if (url) {
41
41
  return withPath(url, path);
42
42
  }
43
- const env = process?.env || {};
43
+ const env = typeof process !== "undefined" ? process.env : {};
44
44
  const fromEnv = env.BETTER_AUTH_URL || env.NEXT_PUBLIC_BETTER_AUTH_URL || env.PUBLIC_BETTER_AUTH_URL || env.NUXT_PUBLIC_BETTER_AUTH_URL || env.NUXT_PUBLIC_AUTH_URL || (env.BASE_URL !== "/" ? env.BASE_URL : void 0);
45
45
  if (fromEnv) {
46
46
  return withPath(fromEnv, path);
@@ -1,4 +1,4 @@
1
- import { a as Auth } from './index-PjYlcsPD.js';
1
+ import { a as Auth } from './index-C9S3KShG.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-PjYlcsPD.js';
6
+ import './index-C9S3KShG.js';
7
7
  import 'kysely';
8
8
  import './index-JM-i6hLs.js';
9
9
  import 'arctic';
package/dist/solid.js CHANGED
@@ -38,7 +38,7 @@ function getBaseURL(url, path) {
38
38
  if (url) {
39
39
  return withPath(url, path);
40
40
  }
41
- const env = process?.env || {};
41
+ const env = typeof process !== "undefined" ? process.env : {};
42
42
  const fromEnv = env.BETTER_AUTH_URL || env.NEXT_PUBLIC_BETTER_AUTH_URL || env.PUBLIC_BETTER_AUTH_URL || env.NUXT_PUBLIC_BETTER_AUTH_URL || env.NUXT_PUBLIC_AUTH_URL || (env.BASE_URL !== "/" ? env.BASE_URL : void 0);
43
43
  if (fromEnv) {
44
44
  return withPath(fromEnv, path);
@@ -1,4 +1,4 @@
1
- import { a as Auth, B as BetterAuthOptions } from './index-PjYlcsPD.js';
1
+ import { a as Auth, B as BetterAuthOptions } from './index-C9S3KShG.js';
2
2
  import 'kysely';
3
3
  import './index-JM-i6hLs.js';
4
4
  import 'arctic';
@@ -18,7 +18,7 @@ declare const svelteKitHandler: ({ auth, event, resolve, }: {
18
18
  url: URL;
19
19
  };
20
20
  resolve: (event: any) => any;
21
- }) => any;
21
+ }) => Promise<any>;
22
22
  declare function isAuthPath(url: string, options: BetterAuthOptions): boolean;
23
23
 
24
24
  export { isAuthPath, svelteKitHandler, toSvelteKitHandler };
@@ -1,13 +1,14 @@
1
1
  // src/integrations/svelte-kit.ts
2
- import { building } from "$app/environment";
3
2
  var toSvelteKitHandler = (auth) => {
4
3
  return (event) => auth.handler(event.request);
5
4
  };
6
- var svelteKitHandler = ({
5
+ var svelteKitHandler = async ({
7
6
  auth,
8
7
  event,
9
8
  resolve
10
9
  }) => {
10
+ const { building } = await import("$app/environment").catch((e) => {
11
+ });
11
12
  if (building) {
12
13
  return resolve(event);
13
14
  }
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-PjYlcsPD.js';
6
+ import './index-C9S3KShG.js';
7
7
  import 'kysely';
8
8
  import './index-JM-i6hLs.js';
9
9
  import 'arctic';
package/dist/svelte.js CHANGED
@@ -35,7 +35,7 @@ function getBaseURL(url, path) {
35
35
  if (url) {
36
36
  return withPath(url, path);
37
37
  }
38
- const env = process?.env || {};
38
+ const env = typeof process !== "undefined" ? process.env : {};
39
39
  const fromEnv = env.BETTER_AUTH_URL || env.NEXT_PUBLIC_BETTER_AUTH_URL || env.PUBLIC_BETTER_AUTH_URL || env.NUXT_PUBLIC_BETTER_AUTH_URL || env.NUXT_PUBLIC_AUTH_URL || (env.BASE_URL !== "/" ? env.BASE_URL : void 0);
40
40
  if (fromEnv) {
41
41
  return withPath(fromEnv, path);
package/dist/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { b as BetterAuthPlugin, a as Auth, F as FieldAttribute, I as InferFieldOutput } from './index-PjYlcsPD.js';
2
- export { A as Adapter, k as AuthContext, B as BetterAuthOptions, G as GenericEndpointContext, H as HookEndpointContext, i as InferPluginTypes, h as InferSession, g as InferUser, P as PluginSchema, R as RateLimit, S as SessionAdapter, W as Where, j as init } from './index-PjYlcsPD.js';
1
+ import { b as BetterAuthPlugin, a as Auth, F as FieldAttribute, I as InferFieldOutput } from './index-C9S3KShG.js';
2
+ export { A as Adapter, k as AuthContext, B as BetterAuthOptions, G as GenericEndpointContext, H as HookEndpointContext, i as InferPluginTypes, h as InferSession, g as InferUser, P as PluginSchema, R as RateLimit, S as SessionAdapter, W as Where, j as init } from './index-C9S3KShG.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/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-PjYlcsPD.js';
6
+ import './index-C9S3KShG.js';
7
7
  import 'kysely';
8
8
  import './index-JM-i6hLs.js';
9
9
  import 'arctic';
package/dist/vue.js CHANGED
@@ -38,7 +38,7 @@ function getBaseURL(url, path) {
38
38
  if (url) {
39
39
  return withPath(url, path);
40
40
  }
41
- const env = process?.env || {};
41
+ const env = typeof process !== "undefined" ? process.env : {};
42
42
  const fromEnv = env.BETTER_AUTH_URL || env.NEXT_PUBLIC_BETTER_AUTH_URL || env.PUBLIC_BETTER_AUTH_URL || env.NUXT_PUBLIC_BETTER_AUTH_URL || env.NUXT_PUBLIC_AUTH_URL || (env.BASE_URL !== "/" ? env.BASE_URL : void 0);
43
43
  if (fromEnv) {
44
44
  return withPath(fromEnv, path);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "better-auth",
3
- "version": "0.2.9-beta.5",
3
+ "version": "0.2.9-beta.7",
4
4
  "description": "The most comprehensive authentication library for TypeScript.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
package/dist/.DS_Store DELETED
Binary file