better-auth 0.3.3-beta.2 → 0.3.3-beta.3

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,6 +1,6 @@
1
- import { A as Adapter } from '../index-B8Y4Ky8v.js';
1
+ import { A as Adapter } from '../index-Cj2o9gfR.js';
2
2
  import 'kysely';
3
- import '../index-DwNtr-kK.js';
3
+ import '../index-CT4RHCuS.js';
4
4
  import 'arctic';
5
5
  import 'zod';
6
6
  import '../helper-DPDj8Nix.js';
@@ -1,7 +1,7 @@
1
1
  import { Db } from 'mongodb';
2
- import { W as Where } from '../index-B8Y4Ky8v.js';
2
+ import { W as Where } from '../index-Cj2o9gfR.js';
3
3
  import 'kysely';
4
- import '../index-DwNtr-kK.js';
4
+ import '../index-CT4RHCuS.js';
5
5
  import 'arctic';
6
6
  import 'zod';
7
7
  import '../helper-DPDj8Nix.js';
@@ -1,6 +1,6 @@
1
- import { A as Adapter } from '../index-B8Y4Ky8v.js';
1
+ import { A as Adapter } from '../index-Cj2o9gfR.js';
2
2
  import 'kysely';
3
- import '../index-DwNtr-kK.js';
3
+ import '../index-CT4RHCuS.js';
4
4
  import 'arctic';
5
5
  import 'zod';
6
6
  import '../helper-DPDj8Nix.js';
package/dist/api.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- export { f as AuthEndpoint, g as AuthMiddleware, n as callbackOAuth, L as changePassword, e as createAuthEndpoint, d 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-B8Y4Ky8v.js';
1
+ export { f as AuthEndpoint, g as AuthMiddleware, n as callbackOAuth, L as changePassword, e as createAuthEndpoint, d 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-Cj2o9gfR.js';
2
2
  import 'zod';
3
3
  import './helper-DPDj8Nix.js';
4
4
  import 'better-call';
5
5
  import 'kysely';
6
- import './index-DwNtr-kK.js';
6
+ import './index-CT4RHCuS.js';
7
7
  import 'arctic';
8
8
  import 'better-sqlite3';
9
9
  import 'mysql2';
package/dist/api.js CHANGED
@@ -416,9 +416,7 @@ var github = (options) => {
416
416
  name: profile.name,
417
417
  email: profile.email,
418
418
  image: profile.avatar_url,
419
- emailVerified,
420
- createdAt: /* @__PURE__ */ new Date(),
421
- updatedAt: /* @__PURE__ */ new Date()
419
+ emailVerified
422
420
  },
423
421
  data: profile
424
422
  };
@@ -1398,6 +1396,7 @@ var callbackOAuth = createAuthEndpoint(
1398
1396
  }
1399
1397
  const { callbackURL, currentURL, dontRememberMe } = parsedState.data;
1400
1398
  if (!user || data.success === false) {
1399
+ logger.error("Unable to get user info", data.error);
1401
1400
  throw c.redirect(
1402
1401
  `${c.context.baseURL}/error?error=oauth_validation_failed`
1403
1402
  );
@@ -2240,48 +2239,92 @@ var signUpEmail = createAuthEndpoint(
2240
2239
  },
2241
2240
  async (ctx) => {
2242
2241
  if (!ctx.context.options.emailAndPassword?.enabled) {
2243
- return ctx.json(null, {
2244
- status: 400,
2245
- body: {
2246
- message: "Email and password is not enabled"
2242
+ return ctx.json(
2243
+ {
2244
+ user: null,
2245
+ session: null,
2246
+ error: {
2247
+ message: "Email and password is not enabled"
2248
+ }
2249
+ },
2250
+ {
2251
+ status: 400,
2252
+ body: {
2253
+ message: "Email and password is not enabled"
2254
+ }
2247
2255
  }
2248
- });
2256
+ );
2249
2257
  }
2250
2258
  const { name, email, password, image } = ctx.body;
2251
2259
  const isValidEmail = z11.string().email().safeParse(email);
2252
2260
  if (!isValidEmail.success) {
2253
- return ctx.json(null, {
2254
- status: 400,
2255
- body: {
2256
- message: "Invalid email address"
2261
+ return ctx.json(
2262
+ {
2263
+ user: null,
2264
+ session: null,
2265
+ error: {
2266
+ message: "Invalid email address"
2267
+ }
2268
+ },
2269
+ {
2270
+ status: 400,
2271
+ body: {
2272
+ message: "Invalid email address"
2273
+ }
2257
2274
  }
2258
- });
2275
+ );
2259
2276
  }
2260
2277
  const minPasswordLength = ctx.context.password.config.minPasswordLength;
2261
2278
  if (password.length < minPasswordLength) {
2262
2279
  ctx.context.logger.error("Password is too short");
2263
- return ctx.json(null, {
2264
- status: 400,
2265
- body: { message: "Password is too short" }
2266
- });
2280
+ return ctx.json(
2281
+ {
2282
+ user: null,
2283
+ session: null,
2284
+ error: {
2285
+ message: "Password is too short"
2286
+ }
2287
+ },
2288
+ {
2289
+ status: 400,
2290
+ body: { message: "Password is too short" }
2291
+ }
2292
+ );
2267
2293
  }
2268
2294
  const maxPasswordLength = ctx.context.password.config.maxPasswordLength;
2269
2295
  if (password.length > maxPasswordLength) {
2270
2296
  ctx.context.logger.error("Password is too long");
2271
- return ctx.json(null, {
2272
- status: 400,
2273
- body: { message: "Password is too long" }
2274
- });
2297
+ return ctx.json(
2298
+ {
2299
+ user: null,
2300
+ session: null,
2301
+ error: {
2302
+ message: "Password is too long"
2303
+ }
2304
+ },
2305
+ {
2306
+ status: 400,
2307
+ body: { message: "Password is too long" }
2308
+ }
2309
+ );
2275
2310
  }
2276
2311
  const dbUser = await ctx.context.internalAdapter.findUserByEmail(email);
2277
- const hash = await ctx.context.password.hash(password);
2278
2312
  if (dbUser?.user) {
2279
- return ctx.json(null, {
2280
- status: 400,
2281
- body: {
2282
- message: "User already exists"
2313
+ return ctx.json(
2314
+ {
2315
+ user: null,
2316
+ session: null,
2317
+ error: {
2318
+ message: "User already exists"
2319
+ }
2320
+ },
2321
+ {
2322
+ status: 400,
2323
+ body: {
2324
+ message: "User already exists"
2325
+ }
2283
2326
  }
2284
- });
2327
+ );
2285
2328
  }
2286
2329
  const createdUser = await ctx.context.internalAdapter.createUser({
2287
2330
  id: generateRandomString(32, alphabet("a-z", "0-9", "A-Z")),
@@ -2293,13 +2336,23 @@ var signUpEmail = createAuthEndpoint(
2293
2336
  updatedAt: /* @__PURE__ */ new Date()
2294
2337
  });
2295
2338
  if (!createdUser) {
2296
- return ctx.json(null, {
2297
- status: 400,
2298
- body: {
2299
- message: "Could not create user"
2339
+ return ctx.json(
2340
+ {
2341
+ user: null,
2342
+ session: null,
2343
+ error: {
2344
+ message: "Could not create user"
2345
+ }
2346
+ },
2347
+ {
2348
+ status: 400,
2349
+ body: {
2350
+ message: "Could not create user"
2351
+ }
2300
2352
  }
2301
- });
2353
+ );
2302
2354
  }
2355
+ const hash = await ctx.context.password.hash(password);
2303
2356
  await ctx.context.internalAdapter.linkAccount({
2304
2357
  id: generateRandomString(32, alphabet("a-z", "0-9", "A-Z")),
2305
2358
  userId: createdUser.id,
@@ -2312,12 +2365,21 @@ var signUpEmail = createAuthEndpoint(
2312
2365
  ctx.request
2313
2366
  );
2314
2367
  if (!session) {
2315
- return ctx.json(null, {
2316
- status: 400,
2317
- body: {
2318
- message: "Could not create session"
2368
+ return ctx.json(
2369
+ {
2370
+ user: null,
2371
+ session: null,
2372
+ error: {
2373
+ message: "Could not create session"
2374
+ }
2375
+ },
2376
+ {
2377
+ status: 400,
2378
+ body: {
2379
+ message: "Could not create session"
2380
+ }
2319
2381
  }
2320
- });
2382
+ );
2321
2383
  }
2322
2384
  await setSessionCookie(ctx, session.id);
2323
2385
  if (ctx.context.options.emailAndPassword.sendEmailVerificationOnSignUp) {
@@ -2335,7 +2397,8 @@ var signUpEmail = createAuthEndpoint(
2335
2397
  return ctx.json(
2336
2398
  {
2337
2399
  user: createdUser,
2338
- session
2400
+ session,
2401
+ error: null
2339
2402
  },
2340
2403
  {
2341
2404
  body: ctx.body.callbackURL ? {
@@ -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, f as Organization, M as Member, I as Invitation, u as username, m as magicLink, d as phoneNumber, e as anonymous } from '../index-CdP51xBK.js';
6
- export { g as getPasskeyActions, c as passkeyClient, a as twoFactorClient } from '../index-CdP51xBK.js';
5
+ import { o as organization, f as Organization, M as Member, I as Invitation, u as username, m as magicLink, d as phoneNumber, e as anonymous } from '../index-CMf5Aw2R.js';
6
+ export { g as getPasskeyActions, c as passkeyClient, a as twoFactorClient } from '../index-CMf5Aw2R.js';
7
7
  import { P as Prettify } from '../helper-DPDj8Nix.js';
8
- import '../index-DwNtr-kK.js';
8
+ import '../index-CT4RHCuS.js';
9
9
  import 'arctic';
10
10
  import 'zod';
11
11
  import 'better-call';
12
- import '../index-B8Y4Ky8v.js';
12
+ import '../index-Cj2o9gfR.js';
13
13
  import 'kysely';
14
14
  import 'better-sqlite3';
15
15
  import 'mysql2';
package/dist/client.d.ts CHANGED
@@ -6,9 +6,9 @@ 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-B8Y4Ky8v.js';
9
+ import './index-Cj2o9gfR.js';
10
10
  import 'kysely';
11
- import './index-DwNtr-kK.js';
11
+ import './index-CT4RHCuS.js';
12
12
  import 'arctic';
13
13
  import 'better-call';
14
14
  import 'better-sqlite3';
@@ -1,11 +1,11 @@
1
- import { U as User, S as Session } from './index-DwNtr-kK.js';
1
+ import { U as User, S as Session } from './index-CT4RHCuS.js';
2
2
  import * as better_call from 'better-call';
3
3
  import { z, ZodObject, ZodOptional, ZodArray, ZodLiteral } from 'zod';
4
4
  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-B8Y4Ky8v.js';
8
+ import { H as HookEndpointContext } from './index-Cj2o9gfR.js';
9
9
  import * as nanostores from 'nanostores';
10
10
  import { atom } from 'nanostores';
11
11
  import * as _simplewebauthn_types from '@simplewebauthn/types';
@@ -4302,6 +4302,10 @@ declare const magicLink: (options: MagicLinkOptions) => {
4302
4302
  };
4303
4303
  };
4304
4304
 
4305
+ interface UserWithPhoneNumber extends User {
4306
+ phoneNumber: string;
4307
+ phoneNumberVerified: boolean;
4308
+ }
4305
4309
  declare const phoneNumber: (options?: {
4306
4310
  otp?: {
4307
4311
  /**
@@ -4320,6 +4324,12 @@ declare const phoneNumber: (options?: {
4320
4324
  expiresIn?: number;
4321
4325
  };
4322
4326
  enableAutoSignIn?: boolean;
4327
+ /**
4328
+ * Function to validate phone number
4329
+ *
4330
+ * by default any string is accepted
4331
+ */
4332
+ phoneNumberValidator?: (phoneNumber: string) => boolean;
4323
4333
  }) => {
4324
4334
  id: "phone-number";
4325
4335
  endpoints: {
@@ -4411,6 +4421,9 @@ declare const phoneNumber: (options?: {
4411
4421
  callbackURL?: string | undefined;
4412
4422
  }>;
4413
4423
  }>): Promise<{
4424
+ user: null;
4425
+ session: null;
4426
+ } | {
4414
4427
  user: {
4415
4428
  id: string;
4416
4429
  email: string;
@@ -4427,7 +4440,7 @@ declare const phoneNumber: (options?: {
4427
4440
  ipAddress?: string | undefined;
4428
4441
  userAgent?: string | undefined;
4429
4442
  };
4430
- } | null>;
4443
+ }>;
4431
4444
  path: "/sign-up/phone-number";
4432
4445
  options: {
4433
4446
  method: "POST";
@@ -4762,4 +4775,4 @@ declare const anonymous: () => {
4762
4775
  };
4763
4776
  };
4764
4777
 
4765
- export { type Invitation as I, type Member as M, type OrganizationOptions as O, type PasskeyOptions as P, twoFactorClient as a, type Passkey as b, passkeyClient as c, phoneNumber as d, anonymous as e, type Organization as f, getPasskeyActions as g, magicLink as m, organization as o, passkey as p, twoFactor as t, username as u };
4778
+ export { type Invitation as I, type Member as M, type OrganizationOptions as O, type PasskeyOptions as P, type UserWithPhoneNumber as U, twoFactorClient as a, type Passkey as b, passkeyClient as c, phoneNumber as d, anonymous as e, type Organization as f, getPasskeyActions as g, magicLink as m, organization as o, passkey as p, twoFactor as t, username as u };
@@ -448,8 +448,6 @@ declare const github: (options: GithubOptions) => {
448
448
  email: string;
449
449
  image: string;
450
450
  emailVerified: boolean;
451
- createdAt: Date;
452
- updatedAt: Date;
453
451
  };
454
452
  data: GithubProfile;
455
453
  } | null>;
@@ -768,8 +766,6 @@ declare const oAuthProviders: {
768
766
  email: string;
769
767
  image: string;
770
768
  emailVerified: boolean;
771
- createdAt: Date;
772
- updatedAt: Date;
773
769
  };
774
770
  data: GithubProfile;
775
771
  } | null>;
@@ -1,5 +1,5 @@
1
1
  import { Kysely, Migration, PostgresPool, Dialect } from 'kysely';
2
- import { S as Session, U as User, A as Account, V as Verification, O as OAuthProvider, a as AppleProfile, D as DiscordProfile, F as FacebookProfile, G as GithubProfile, b as GoogleProfile, M as MicrosoftEntraIDProfile, c as SpotifyProfile, T as TwitchProfile, d as TwitterProfile, e as SocialProviders, f as OAuthProviderList } from './index-DwNtr-kK.js';
2
+ import { S as Session, U as User, A as Account, V as Verification, O as OAuthProvider, a as AppleProfile, D as DiscordProfile, F as FacebookProfile, G as GithubProfile, b as GoogleProfile, M as MicrosoftEntraIDProfile, c as SpotifyProfile, T as TwitchProfile, d as TwitterProfile, e as SocialProviders, f as OAuthProviderList } from './index-CT4RHCuS.js';
3
3
  import * as better_call from 'better-call';
4
4
  import { ContextTools, CookieOptions, Endpoint, EndpointResponse, Context, Prettify as Prettify$1 } from 'better-call';
5
5
  import * as arctic from 'arctic';
@@ -492,8 +492,6 @@ declare const init: (opts: BetterAuthOptions) => Promise<{
492
492
  email: string;
493
493
  image: string;
494
494
  emailVerified: boolean;
495
- createdAt: Date;
496
- updatedAt: Date;
497
495
  };
498
496
  data: GithubProfile;
499
497
  } | null>;
@@ -1263,17 +1261,17 @@ declare const signInOAuth: {
1263
1261
  /**
1264
1262
  * OAuth2 provider to use`
1265
1263
  */
1266
- provider: z.ZodEnum<["github", ...("github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter")[]]>;
1264
+ provider: z.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter")[]]>;
1267
1265
  /**
1268
1266
  * If this is true the session will only be valid for the current browser session
1269
1267
  */
1270
1268
  dontRememberMe: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
1271
1269
  }, "strip", z.ZodTypeAny, {
1272
- provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
1270
+ provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
1273
1271
  callbackURL?: string | undefined;
1274
1272
  dontRememberMe?: boolean | undefined;
1275
1273
  }, {
1276
- provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
1274
+ provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
1277
1275
  callbackURL?: string | undefined;
1278
1276
  dontRememberMe?: boolean | undefined;
1279
1277
  }>;
@@ -1306,17 +1304,17 @@ declare const signInOAuth: {
1306
1304
  /**
1307
1305
  * OAuth2 provider to use`
1308
1306
  */
1309
- provider: z.ZodEnum<["github", ...("github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter")[]]>;
1307
+ provider: z.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter")[]]>;
1310
1308
  /**
1311
1309
  * If this is true the session will only be valid for the current browser session
1312
1310
  */
1313
1311
  dontRememberMe: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
1314
1312
  }, "strip", z.ZodTypeAny, {
1315
- provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
1313
+ provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
1316
1314
  callbackURL?: string | undefined;
1317
1315
  dontRememberMe?: boolean | undefined;
1318
1316
  }, {
1319
- provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
1317
+ provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
1320
1318
  callbackURL?: string | undefined;
1321
1319
  dontRememberMe?: boolean | undefined;
1322
1320
  }>;
@@ -2341,6 +2339,12 @@ declare const signUpEmail: {
2341
2339
  callbackURL?: string | undefined;
2342
2340
  }>;
2343
2341
  }>): Promise<{
2342
+ user: null;
2343
+ session: null;
2344
+ error: {
2345
+ message: string;
2346
+ };
2347
+ } | {
2344
2348
  user: {
2345
2349
  id: string;
2346
2350
  email: string;
@@ -2357,7 +2361,8 @@ declare const signUpEmail: {
2357
2361
  ipAddress?: string | undefined;
2358
2362
  userAgent?: string | undefined;
2359
2363
  };
2360
- } | null>;
2364
+ error: null;
2365
+ }>;
2361
2366
  path: "/sign-up/email";
2362
2367
  options: {
2363
2368
  method: "POST";
@@ -2465,14 +2470,14 @@ declare function getEndpoints<C extends AuthContext, Option extends BetterAuthOp
2465
2470
  }>>;
2466
2471
  body: zod.ZodObject<{
2467
2472
  callbackURL: zod.ZodOptional<zod.ZodString>;
2468
- provider: zod.ZodEnum<["github", ...("github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter")[]]>;
2473
+ provider: zod.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter")[]]>;
2469
2474
  dontRememberMe: zod.ZodOptional<zod.ZodDefault<zod.ZodBoolean>>;
2470
2475
  }, "strip", zod.ZodTypeAny, {
2471
- provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
2476
+ provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
2472
2477
  callbackURL?: string | undefined;
2473
2478
  dontRememberMe?: boolean | undefined;
2474
2479
  }, {
2475
- provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
2480
+ provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
2476
2481
  callbackURL?: string | undefined;
2477
2482
  dontRememberMe?: boolean | undefined;
2478
2483
  }>;
@@ -2495,14 +2500,14 @@ declare function getEndpoints<C extends AuthContext, Option extends BetterAuthOp
2495
2500
  }>>;
2496
2501
  body: zod.ZodObject<{
2497
2502
  callbackURL: zod.ZodOptional<zod.ZodString>;
2498
- provider: zod.ZodEnum<["github", ...("github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter")[]]>;
2503
+ provider: zod.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter")[]]>;
2499
2504
  dontRememberMe: zod.ZodOptional<zod.ZodDefault<zod.ZodBoolean>>;
2500
2505
  }, "strip", zod.ZodTypeAny, {
2501
- provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
2506
+ provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
2502
2507
  callbackURL?: string | undefined;
2503
2508
  dontRememberMe?: boolean | undefined;
2504
2509
  }, {
2505
- provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
2510
+ provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
2506
2511
  callbackURL?: string | undefined;
2507
2512
  dontRememberMe?: boolean | undefined;
2508
2513
  }>;
@@ -2681,6 +2686,12 @@ declare function getEndpoints<C extends AuthContext, Option extends BetterAuthOp
2681
2686
  callbackURL?: string | undefined;
2682
2687
  }>;
2683
2688
  }>): Promise<{
2689
+ user: null;
2690
+ session: null;
2691
+ error: {
2692
+ message: string;
2693
+ };
2694
+ } | {
2684
2695
  user: {
2685
2696
  id: string;
2686
2697
  email: string;
@@ -2697,7 +2708,8 @@ declare function getEndpoints<C extends AuthContext, Option extends BetterAuthOp
2697
2708
  ipAddress?: string | undefined;
2698
2709
  userAgent?: string | undefined;
2699
2710
  };
2700
- } | null>;
2711
+ error: null;
2712
+ }>;
2701
2713
  path: "/sign-up/email";
2702
2714
  options: {
2703
2715
  method: "POST";
@@ -3527,14 +3539,14 @@ declare const router: <C extends AuthContext, Option extends BetterAuthOptions>(
3527
3539
  }>>;
3528
3540
  body: zod.ZodObject<{
3529
3541
  callbackURL: zod.ZodOptional<zod.ZodString>;
3530
- provider: zod.ZodEnum<["github", ...("github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter")[]]>;
3542
+ provider: zod.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter")[]]>;
3531
3543
  dontRememberMe: zod.ZodOptional<zod.ZodDefault<zod.ZodBoolean>>;
3532
3544
  }, "strip", zod.ZodTypeAny, {
3533
- provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
3545
+ provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
3534
3546
  callbackURL?: string | undefined;
3535
3547
  dontRememberMe?: boolean | undefined;
3536
3548
  }, {
3537
- provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
3549
+ provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
3538
3550
  callbackURL?: string | undefined;
3539
3551
  dontRememberMe?: boolean | undefined;
3540
3552
  }>;
@@ -3557,14 +3569,14 @@ declare const router: <C extends AuthContext, Option extends BetterAuthOptions>(
3557
3569
  }>>;
3558
3570
  body: zod.ZodObject<{
3559
3571
  callbackURL: zod.ZodOptional<zod.ZodString>;
3560
- provider: zod.ZodEnum<["github", ...("github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter")[]]>;
3572
+ provider: zod.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter")[]]>;
3561
3573
  dontRememberMe: zod.ZodOptional<zod.ZodDefault<zod.ZodBoolean>>;
3562
3574
  }, "strip", zod.ZodTypeAny, {
3563
- provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
3575
+ provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
3564
3576
  callbackURL?: string | undefined;
3565
3577
  dontRememberMe?: boolean | undefined;
3566
3578
  }, {
3567
- provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
3579
+ provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
3568
3580
  callbackURL?: string | undefined;
3569
3581
  dontRememberMe?: boolean | undefined;
3570
3582
  }>;
@@ -3743,6 +3755,12 @@ declare const router: <C extends AuthContext, Option extends BetterAuthOptions>(
3743
3755
  callbackURL?: string | undefined;
3744
3756
  }>;
3745
3757
  }>): Promise<{
3758
+ user: null;
3759
+ session: null;
3760
+ error: {
3761
+ message: string;
3762
+ };
3763
+ } | {
3746
3764
  user: {
3747
3765
  id: string;
3748
3766
  email: string;
@@ -3759,7 +3777,8 @@ declare const router: <C extends AuthContext, Option extends BetterAuthOptions>(
3759
3777
  ipAddress?: string | undefined;
3760
3778
  userAgent?: string | undefined;
3761
3779
  };
3762
- } | null>;
3780
+ error: null;
3781
+ }>;
3763
3782
  path: "/sign-up/email";
3764
3783
  options: {
3765
3784
  method: "POST";
@@ -4591,14 +4610,14 @@ declare const betterAuth: <O extends BetterAuthOptions>(options: O) => {
4591
4610
  }>>;
4592
4611
  body: zod.ZodObject<{
4593
4612
  callbackURL: zod.ZodOptional<zod.ZodString>;
4594
- provider: zod.ZodEnum<["github", ...("github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter")[]]>;
4613
+ provider: zod.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter")[]]>;
4595
4614
  dontRememberMe: zod.ZodOptional<zod.ZodDefault<zod.ZodBoolean>>;
4596
4615
  }, "strip", zod.ZodTypeAny, {
4597
- provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
4616
+ provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
4598
4617
  callbackURL?: string | undefined;
4599
4618
  dontRememberMe?: boolean | undefined;
4600
4619
  }, {
4601
- provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
4620
+ provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
4602
4621
  callbackURL?: string | undefined;
4603
4622
  dontRememberMe?: boolean | undefined;
4604
4623
  }>;
@@ -4621,14 +4640,14 @@ declare const betterAuth: <O extends BetterAuthOptions>(options: O) => {
4621
4640
  }>>;
4622
4641
  body: zod.ZodObject<{
4623
4642
  callbackURL: zod.ZodOptional<zod.ZodString>;
4624
- provider: zod.ZodEnum<["github", ...("github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter")[]]>;
4643
+ provider: zod.ZodEnum<["github", ...("apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter")[]]>;
4625
4644
  dontRememberMe: zod.ZodOptional<zod.ZodDefault<zod.ZodBoolean>>;
4626
4645
  }, "strip", zod.ZodTypeAny, {
4627
- provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
4646
+ provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
4628
4647
  callbackURL?: string | undefined;
4629
4648
  dontRememberMe?: boolean | undefined;
4630
4649
  }, {
4631
- provider: "github" | "apple" | "discord" | "facebook" | "microsoft" | "google" | "spotify" | "twitch" | "twitter";
4650
+ provider: "apple" | "discord" | "facebook" | "github" | "google" | "microsoft" | "spotify" | "twitch" | "twitter";
4632
4651
  callbackURL?: string | undefined;
4633
4652
  dontRememberMe?: boolean | undefined;
4634
4653
  }>;
@@ -4807,6 +4826,12 @@ declare const betterAuth: <O extends BetterAuthOptions>(options: O) => {
4807
4826
  callbackURL?: string | undefined;
4808
4827
  }>;
4809
4828
  }>): Promise<{
4829
+ user: null;
4830
+ session: null;
4831
+ error: {
4832
+ message: string;
4833
+ };
4834
+ } | {
4810
4835
  user: {
4811
4836
  id: string;
4812
4837
  email: string;
@@ -4823,7 +4848,8 @@ declare const betterAuth: <O extends BetterAuthOptions>(options: O) => {
4823
4848
  ipAddress?: string | undefined;
4824
4849
  userAgent?: string | undefined;
4825
4850
  };
4826
- } | null>;
4851
+ error: null;
4852
+ }>;
4827
4853
  path: "/sign-up/email";
4828
4854
  options: {
4829
4855
  method: "POST";
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- export { a as Auth, X as betterAuth } from './index-B8Y4Ky8v.js';
1
+ export { a as Auth, X as betterAuth } from './index-Cj2o9gfR.js';
2
2
  import 'kysely';
3
- import './index-DwNtr-kK.js';
3
+ import './index-CT4RHCuS.js';
4
4
  import 'arctic';
5
5
  import 'zod';
6
6
  import './helper-DPDj8Nix.js';