@better-auth/core 1.4.7 → 1.4.8-beta.2

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,5 +1,5 @@
1
1
 
2
- > @better-auth/core@1.4.7 build /home/runner/work/better-auth/better-auth/packages/core
2
+ > @better-auth/core@1.4.8-beta.2 build /home/runner/work/better-auth/better-auth/packages/core
3
3
  > tsdown
4
4
 
5
5
  ℹ tsdown v0.17.2 powered by rolldown v1.0.0-beta.53
@@ -21,7 +21,7 @@
21
21
  ℹ dist/index.mjs  0.01 kB │ gzip: 0.03 kB
22
22
  ℹ dist/oauth2-D2y9ALiO.mjs  9.19 kB │ gzip: 2.13 kB
23
23
  ℹ dist/env-DbssmzoK.mjs  7.67 kB │ gzip: 2.54 kB
24
- ℹ dist/get-tables-DeuRhD_P.mjs  6.67 kB │ gzip: 1.29 kB
24
+ ℹ dist/get-tables-CMc_Emww.mjs  6.76 kB │ gzip: 1.30 kB
25
25
  ℹ dist/context-DblZrIwO.mjs  3.89 kB │ gzip: 1.00 kB
26
26
  ℹ dist/error-CzMAIrPb.mjs  1.77 kB │ gzip: 0.79 kB
27
27
  ℹ dist/utils-NloIXYE0.mjs  1.10 kB │ gzip: 0.55 kB
@@ -30,14 +30,14 @@
30
30
  ℹ dist/error/index.d.mts  1.84 kB │ gzip: 0.72 kB
31
31
  ℹ dist/db/adapter/index.d.mts  1.34 kB │ gzip: 0.42 kB
32
32
  ℹ dist/utils/index.d.mts  1.19 kB │ gzip: 0.55 kB
33
- ℹ dist/db/index.d.mts  1.04 kB │ gzip: 0.38 kB
34
- ℹ dist/index.d.mts  0.86 kB │ gzip: 0.33 kB
33
+ ℹ dist/index.d.mts  0.92 kB │ gzip: 0.35 kB
34
+ ℹ dist/db/index.d.mts  0.81 kB │ gzip: 0.34 kB
35
35
  ℹ dist/oauth2/index.d.mts  0.76 kB │ gzip: 0.28 kB
36
36
  ℹ dist/env/index.d.mts  0.59 kB │ gzip: 0.30 kB
37
37
  ℹ dist/api/index.d.mts  0.26 kB │ gzip: 0.14 kB
38
38
  ℹ dist/async_hooks/index.d.mts  0.24 kB │ gzip: 0.16 kB
39
39
  ℹ dist/async_hooks/pure.index.d.mts  0.22 kB │ gzip: 0.16 kB
40
- ℹ dist/index-NeeRjOR2.d.mts 218.68 kB │ gzip: 34.40 kB
40
+ ℹ dist/index-CTa0oOlQ.d.mts 217.82 kB │ gzip: 34.28 kB
41
41
  ℹ dist/index-BRBu0-5h.d.mts  3.31 kB │ gzip: 1.11 kB
42
- ℹ 32 files, total: 393.37 kB
43
- ✔ Build complete in 4944ms
42
+ ℹ 32 files, total: 392.43 kB
43
+ ✔ Build complete in 4594ms
@@ -1,2 +1,2 @@
1
- import { a as optionsMiddleware, i as createAuthMiddleware, n as AuthMiddleware, r as createAuthEndpoint, t as AuthEndpoint } from "../index-NeeRjOR2.mjs";
1
+ import { a as optionsMiddleware, i as createAuthMiddleware, n as AuthMiddleware, r as createAuthEndpoint, t as AuthEndpoint } from "../index-CTa0oOlQ.mjs";
2
2
  export { AuthEndpoint, AuthMiddleware, createAuthEndpoint, createAuthMiddleware, optionsMiddleware };
@@ -1,4 +1,4 @@
1
- import { Kn as DBAdapter, Zn as DBTransactionAdapter, f as AuthContext } from "../index-NeeRjOR2.mjs";
1
+ import { Kn as DBAdapter, Zn as DBTransactionAdapter, f as AuthContext } from "../index-CTa0oOlQ.mjs";
2
2
  import { AsyncLocalStorage } from "@better-auth/core/async_hooks";
3
3
  import { EndpointContext, InputContext } from "better-call";
4
4
 
@@ -1,2 +1,2 @@
1
- import { $n as JoinOption, Gn as CustomAdapter, Jn as DBAdapterFactoryConfig, Kn as DBAdapter, Qn as JoinConfig, Wn as CleanedWhere, Xn as DBAdapterSchemaCreation, Yn as DBAdapterInstance, Zn as DBTransactionAdapter, _r as initGetIdField, ar as createAdapterFactory, br as initGetDefaultModelName, cr as AdapterFactoryCustomizeAdapterCreator, dr as CreateAdapterOptions, er as Where, fr as CreateCustomAdapter, gr as initGetModelName, ir as createAdapter, lr as AdapterFactoryOptions, nr as withApplyDefault, or as AdapterConfig, qn as DBAdapterDebugLogOption, rr as AdapterFactory, sr as AdapterFactoryConfig, tr as deepmerge, ur as AdapterTestDebugLogs, vr as initGetFieldName, xr as initGetDefaultFieldName, yr as initGetFieldAttributes } from "../../index-NeeRjOR2.mjs";
1
+ import { $n as JoinOption, Cr as initGetDefaultFieldName, Gn as CustomAdapter, Jn as DBAdapterFactoryConfig, Kn as DBAdapter, Qn as JoinConfig, Sr as initGetDefaultModelName, Wn as CleanedWhere, Xn as DBAdapterSchemaCreation, Yn as DBAdapterInstance, Zn as DBTransactionAdapter, ar as createAdapterFactory, br as initGetFieldName, cr as AdapterFactoryCustomizeAdapterCreator, dr as CreateAdapterOptions, er as Where, fr as CreateCustomAdapter, ir as createAdapter, lr as AdapterFactoryOptions, nr as withApplyDefault, or as AdapterConfig, qn as DBAdapterDebugLogOption, rr as AdapterFactory, sr as AdapterFactoryConfig, tr as deepmerge, ur as AdapterTestDebugLogs, vr as initGetModelName, xr as initGetFieldAttributes, yr as initGetIdField } from "../../index-CTa0oOlQ.mjs";
2
2
  export { AdapterConfig, AdapterFactory, AdapterFactoryConfig, AdapterFactoryCustomizeAdapterCreator, AdapterFactoryOptions, AdapterTestDebugLogs, CleanedWhere, CreateAdapterOptions, CreateCustomAdapter, CustomAdapter, DBAdapter, DBAdapterDebugLogOption, DBAdapterFactoryConfig, DBAdapterInstance, DBAdapterSchemaCreation, DBTransactionAdapter, JoinConfig, JoinOption, Where, createAdapter, createAdapterFactory, deepmerge, initGetDefaultFieldName, initGetDefaultModelName, initGetFieldAttributes, initGetFieldName, initGetIdField, initGetModelName, withApplyDefault };
@@ -1,4 +1,4 @@
1
- import { t as getAuthTables } from "../../get-tables-DeuRhD_P.mjs";
1
+ import { t as getAuthTables } from "../../get-tables-CMc_Emww.mjs";
2
2
  import { i as logger, n as createLogger, o as getColorDepth, t as TTY_COLORS } from "../../env-DbssmzoK.mjs";
3
3
  import { n as safeJSONParse, r as generateId } from "../../utils-NloIXYE0.mjs";
4
4
  import { t as BetterAuthError } from "../../error-CzMAIrPb.mjs";
@@ -1,2 +1,2 @@
1
- import { Ar as verificationSchema, Br as BetterAuthPluginDBSchema, Cr as BetterAuthDbSchema, Dr as Primitive, Er as FieldType, Fr as sessionSchema, Gr as DBFieldType, Hr as BetterAuthDBSchema, Ir as RateLimit, Jr as SecondaryStorage, Kr as DBPrimitive, Lr as rateLimitSchema, Mr as userSchema, Nr as coreSchema, Or as getAuthTables, Pr as Session, Rr as Account, Sr as AuthPluginSchema, Tr as FieldAttributeConfig, Ur as DBFieldAttribute, Vr as BaseModelNames, Wr as DBFieldAttributeConfig, jr as User, kr as Verification, qr as ModelNames, wr as FieldAttribute, zr as accountSchema } from "../index-NeeRjOR2.mjs";
2
- export { Account, AuthPluginSchema, BaseModelNames, BetterAuthDBSchema, BetterAuthDbSchema, BetterAuthPluginDBSchema, DBFieldAttribute, DBFieldAttributeConfig, DBFieldType, DBPrimitive, FieldAttribute, FieldAttributeConfig, FieldType, ModelNames, Primitive, RateLimit, SecondaryStorage, Session, User, Verification, accountSchema, coreSchema, getAuthTables, rateLimitSchema, sessionSchema, userSchema, verificationSchema };
1
+ import { Ar as sessionSchema, Br as DBFieldAttributeConfig, Dr as userSchema, Er as User, Fr as BetterAuthPluginDBSchema, Hr as DBPrimitive, Ir as getAuthTables, Lr as BaseModelNames, Mr as rateLimitSchema, Nr as Account, Or as coreSchema, Pr as accountSchema, Rr as BetterAuthDBSchema, Tr as verificationSchema, Ur as ModelNames, Vr as DBFieldType, Wr as SecondaryStorage, jr as RateLimit, kr as Session, wr as Verification, zr as DBFieldAttribute } from "../index-CTa0oOlQ.mjs";
2
+ export { Account, BaseModelNames, BetterAuthDBSchema, BetterAuthPluginDBSchema, DBFieldAttribute, DBFieldAttributeConfig, DBFieldType, DBPrimitive, ModelNames, RateLimit, SecondaryStorage, Session, User, Verification, accountSchema, coreSchema, getAuthTables, rateLimitSchema, sessionSchema, userSchema, verificationSchema };
package/dist/db/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as getAuthTables } from "../get-tables-DeuRhD_P.mjs";
1
+ import { t as getAuthTables } from "../get-tables-CMc_Emww.mjs";
2
2
  import * as z from "zod";
3
3
 
4
4
  //#region src/db/schema/shared.ts
@@ -31,7 +31,7 @@ const getAuthTables = (options) => {
31
31
  }
32
32
  }
33
33
  } };
34
- const { user, session, account, ...pluginTables } = pluginSchema;
34
+ const { user, session, account, verification, ...pluginTables } = pluginSchema;
35
35
  const sessionTable = { session: {
36
36
  modelName: options.session?.modelName || "session",
37
37
  fields: {
@@ -239,7 +239,9 @@ const getAuthTables = (options) => {
239
239
  defaultValue: () => /* @__PURE__ */ new Date(),
240
240
  onUpdate: () => /* @__PURE__ */ new Date(),
241
241
  fieldName: options.verification?.fields?.updatedAt || "updatedAt"
242
- }
242
+ },
243
+ ...verification?.fields,
244
+ ...options.verification?.additionalFields
243
245
  },
244
246
  order: 4
245
247
  },
@@ -49,8 +49,8 @@ type DBFieldAttributeConfig = {
49
49
  * transform the value before storing it.
50
50
  */
51
51
  transform?: {
52
- input?: (value: DBPrimitive) => DBPrimitive | Promise<DBPrimitive>;
53
- output?: (value: DBPrimitive) => DBPrimitive | Promise<DBPrimitive>;
52
+ input?: (value: DBPrimitive) => Awaitable<DBPrimitive>;
53
+ output?: (value: DBPrimitive) => Awaitable<DBPrimitive>;
54
54
  } | undefined;
55
55
  /**
56
56
  * Reference to another model.
@@ -127,7 +127,7 @@ interface SecondaryStorage {
127
127
  * @param key - Key to get
128
128
  * @returns - Value of the key
129
129
  */
130
- get: (key: string) => Promise<unknown> | unknown;
130
+ get: (key: string) => Awaitable<unknown>;
131
131
  set: (
132
132
  /**
133
133
  * Key to store
@@ -140,14 +140,17 @@ interface SecondaryStorage {
140
140
  /**
141
141
  * Time to live in seconds
142
142
  */
143
- ttl?: number | undefined) => Promise<void | null | unknown> | void;
143
+ ttl?: number | undefined) => Awaitable<void | null | unknown>;
144
144
  /**
145
145
  *
146
146
  * @param key - Key to delete
147
147
  */
148
- delete: (key: string) => Promise<void | null | string> | void;
148
+ delete: (key: string) => Awaitable<void | null | string>;
149
149
  }
150
150
  //#endregion
151
+ //#region src/db/get-tables.d.ts
152
+ declare const getAuthTables: (options: BetterAuthOptions) => BetterAuthDBSchema;
153
+ //#endregion
151
154
  //#region src/db/plugin.d.ts
152
155
  type BetterAuthPluginDBSchema = { [table in string]: {
153
156
  fields: {
@@ -249,35 +252,6 @@ declare const verificationSchema: z.ZodObject<{
249
252
  */
250
253
  type Verification = z.infer<typeof verificationSchema>;
251
254
  //#endregion
252
- //#region src/db/get-tables.d.ts
253
- declare const getAuthTables: (options: BetterAuthOptions) => BetterAuthDBSchema;
254
- //#endregion
255
- //#region src/db/index.d.ts
256
- /**
257
- * @deprecated Backport for 1.3.x, we will remove this in 1.4.x
258
- */
259
- type AuthPluginSchema = BetterAuthPluginDBSchema;
260
- /**
261
- * @deprecated Backport for 1.3.x, we will remove this in 1.4.x
262
- */
263
- type FieldAttribute = DBFieldAttribute;
264
- /**
265
- * @deprecated Backport for 1.3.x, we will remove this in 1.4.x
266
- */
267
- type FieldAttributeConfig = DBFieldAttributeConfig;
268
- /**
269
- * @deprecated Backport for 1.3.x, we will remove this in 1.4.x
270
- */
271
- type FieldType = DBFieldType;
272
- /**
273
- * @deprecated Backport for 1.3.x, we will remove this in 1.4.x
274
- */
275
- type Primitive$1 = DBPrimitive;
276
- /**
277
- * @deprecated Backport for 1.3.x, we will remove this in 1.4.x
278
- */
279
- type BetterAuthDbSchema = BetterAuthDBSchema;
280
- //#endregion
281
255
  //#region src/db/adapter/get-default-field-name.d.ts
282
256
  declare const initGetDefaultFieldName: ({
283
257
  schema,
@@ -384,6 +358,7 @@ declare const initGetModelName: ({
384
358
  //#endregion
385
359
  //#region src/types/helper.d.ts
386
360
  type Primitive = string | number | symbol | bigint | boolean | null | undefined;
361
+ type Awaitable<T> = T | Promise<T>;
387
362
  type LiteralString = "" | (string & Record<never, never>);
388
363
  type LiteralUnion<LiteralType, BaseType extends Primitive> = LiteralType | (BaseType & Record<never, never>);
389
364
  type Prettify<T> = { [K in keyof T]: T[K] } & {};
@@ -414,7 +389,7 @@ type AdapterFactoryCustomizeAdapterCreator = (config: {
414
389
  *
415
390
  * If the config has defined `debugLogs` as `false`, no logs will be shown.
416
391
  */
417
- debugLog: (...args: any[]) => void;
392
+ debugLog: (...args: unknown[]) => void;
418
393
  /**
419
394
  * Get the model name which is expected to be saved in the database based on the user's schema.
420
395
  */
@@ -472,8 +447,8 @@ type AdapterFactoryCustomizeAdapterCreator = (config: {
472
447
  model: string;
473
448
  field: string;
474
449
  }) => DBFieldAttribute;
475
- transformInput: (data: Record<string, any>, defaultModelName: string, action: "create" | "update", forceAllowId?: boolean | undefined) => Promise<Record<string, any>>;
476
- transformOutput: (data: Record<string, any>, defaultModelName: string, select?: string[] | undefined, joinConfig?: JoinConfig | undefined) => Promise<Record<string, any>>;
450
+ transformInput: (data: Record<string, unknown>, defaultModelName: string, action: "create" | "update", forceAllowId?: boolean | undefined) => Promise<Record<string, unknown>>;
451
+ transformOutput: (data: Record<string, unknown>, defaultModelName: string, select?: string[] | undefined, joinConfig?: JoinConfig | undefined) => Promise<Record<string, unknown>>;
477
452
  transformWhereClause: <W extends Where[] | undefined>({
478
453
  model,
479
454
  where
@@ -1068,7 +1043,7 @@ interface OAuthProvider<T extends Record<string, any> = Record<string, any>, O e
1068
1043
  redirectURI: string;
1069
1044
  display?: string | undefined;
1070
1045
  loginHint?: string | undefined;
1071
- }) => Promise<URL> | URL;
1046
+ }) => Awaitable<URL>;
1072
1047
  name: string;
1073
1048
  validateAuthorizationCode: (data: {
1074
1049
  code: string;
@@ -3706,7 +3681,8 @@ declare const zoom: (userOptions: ZoomOptions) => {
3706
3681
  refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
3707
3682
  getUserInfo(token: OAuth2Tokens & {
3708
3683
  user?: {
3709
- name?: {
3684
+ name
3685
+ /** The user's cluster (Example: "us04") */? /** The user's cluster (Example: "us04") */: {
3710
3686
  firstName?: string;
3711
3687
  lastName?: string;
3712
3688
  };
@@ -4305,16 +4281,7 @@ declare const paypal: (options: PayPalOptions) => {
4305
4281
  getUserInfo(token: OAuth2Tokens & {
4306
4282
  user?: {
4307
4283
  name?: {
4308
- firstName
4309
- /**
4310
- * Whether to request shipping address information
4311
- * @default false
4312
- */?
4313
- /**
4314
- * Whether to request shipping address information
4315
- * @default false
4316
- */
4317
- : string;
4284
+ firstName?: string;
4318
4285
  lastName?: string;
4319
4286
  };
4320
4287
  email?: string;
@@ -6173,7 +6140,6 @@ type SocialProviders = { [K in SocialProviderList[number]]?: Parameters<(typeof
6173
6140
  type SocialProviderList = typeof socialProviderList;
6174
6141
  //#endregion
6175
6142
  //#region src/types/plugin.d.ts
6176
- type Awaitable<T> = T | Promise<T>;
6177
6143
  type DeepPartial<T> = T extends Function ? T : T extends object ? { [K in keyof T]?: DeepPartial<T[K]> } : T;
6178
6144
  type HookEndpointContext = Partial<EndpointContext<string, any> & Omit<InputContext<string, any>, "method">> & {
6179
6145
  path: string;
@@ -6280,7 +6246,7 @@ type BetterAuthPlugin = {
6280
6246
  * This will override the default database operations
6281
6247
  */
6282
6248
  adapter?: {
6283
- [key: string]: (...args: any[]) => Promise<any> | any;
6249
+ [key: string]: (...args: any[]) => Awaitable<any>;
6284
6250
  };
6285
6251
  };
6286
6252
  //#endregion
@@ -7134,6 +7100,12 @@ type BetterAuthOptions = {
7134
7100
  * Map verification fields
7135
7101
  */
7136
7102
  fields?: Partial<Record<keyof OmitId<Verification>, string>>;
7103
+ /**
7104
+ * Additional fields for the verification
7105
+ */
7106
+ additionalFields?: {
7107
+ [key: string]: DBFieldAttribute;
7108
+ };
7137
7109
  /**
7138
7110
  * disable cleaning up expired values when a verification value is
7139
7111
  * fetched
@@ -7143,7 +7115,7 @@ type BetterAuthOptions = {
7143
7115
  /**
7144
7116
  * List of trusted origins.
7145
7117
  */
7146
- trustedOrigins?: (string[] | ((request: Request) => string[] | Promise<string[]>)) | undefined;
7118
+ trustedOrigins?: (string[] | ((request: Request) => Awaitable<string[]>)) | undefined;
7147
7119
  /**
7148
7120
  * Rate limiting configuration
7149
7121
  */
@@ -7750,4 +7722,4 @@ declare function createAuthEndpoint<Path extends string, Options extends Endpoin
7750
7722
  type AuthEndpoint<Path extends string, Opts extends EndpointOptions, R> = ReturnType<typeof createAuthEndpoint<Path, Opts, R>>;
7751
7723
  type AuthMiddleware = ReturnType<typeof createAuthMiddleware>;
7752
7724
  //#endregion
7753
- export { AccountStatus as $, JoinOption as $n, GoogleProfile as $t, PolarOptions as A, createAuthorizationCodeRequest as An, verificationSchema as Ar, linear as At, LineIdTokenPayload as B, OAuth2Tokens as Bn, BetterAuthPluginDBSchema as Br, TwitchOptions as Bt, SocialProviderListEnum as C, atlassian as Cn, BetterAuthDbSchema as Cr, gitlab as Ct, VercelOptions as D, apple as Dn, Primitive$1 as Dr, LinearOptions as Dt, socialProviders as E, AppleProfile as En, FieldType as Er, linkedin as Et, PayPalTokenResponse as F, createRefreshAccessTokenRequest as Fn, sessionSchema as Fr, DropboxProfile as Ft, NaverProfile as G, CustomAdapter as Gn, DBFieldType as Gr, spotify as Gt, LineUserInfo as H, OAuthProvider as Hn, BetterAuthDBSchema as Hr, twitch as Ht, paypal as I, refreshAccessToken as In, RateLimit as Ir, dropbox as It, KakaoProfile as J, DBAdapterFactoryConfig as Jn, SecondaryStorage as Jr, slack as Jt, naver as K, DBAdapter as Kn, DBPrimitive as Kr, SlackOptions as Kt, PaybinOptions as L, createAuthorizationURL as Ln, rateLimitSchema as Lr, TwitterOption as Lt, polar as M, validateToken as Mn, userSchema as Mr, KickProfile as Mt, PayPalOptions as N, generateCodeChallenge as Nn, coreSchema as Nr, kick as Nt, VercelProfile as O, getApplePublicKey as On, getAuthTables as Or, LinearProfile as Ot, PayPalProfile as P, getOAuth2Tokens as Pn, Session as Pr, DropboxOptions as Pt, notion as Q, JoinConfig as Qn, GoogleOptions as Qt, PaybinProfile as R, clientCredentialsToken as Rn, Account as Rr, TwitterProfile as Rt, SocialProviderList as S, AtlassianProfile as Sn, AuthPluginSchema as Sr, GitlabProfile as St, socialProviderList as T, AppleOptions as Tn, FieldAttributeConfig as Tr, LinkedInProfile as Tt, line as U, ProviderOptions as Un, DBFieldAttribute as Ur, SpotifyOptions as Ut, LineOptions as V, OAuth2UserInfo as Vn, BaseModelNames as Vr, TwitchProfile as Vt, NaverOptions as W, CleanedWhere as Wn, DBFieldAttributeConfig as Wr, SpotifyProfile as Wt, NotionOptions as X, DBAdapterSchemaCreation as Xn, HuggingFaceProfile as Xt, kakao as Y, DBAdapterInstance as Yn, HuggingFaceOptions as Yt, NotionProfile as Z, DBTransactionAdapter as Zn, huggingface as Zt, BetterAuthRateLimitOptions as _, CognitoOptions as _n, initGetIdField as _r, reddit as _t, optionsMiddleware as a, GithubOptions as an, createAdapterFactory as ar, zoom as at, HookEndpointContext as b, getCognitoPublicKey as bn, initGetDefaultModelName as br, tiktok as bt, BetterAuthClientPlugin as c, FigmaOptions as cn, AdapterFactoryCustomizeAdapterCreator as cr, vk as ct, ClientStore as d, FacebookOptions as dn, CreateAdapterOptions as dr, salesforce as dt, getGooglePublicKey as en, Where as er, LoginType as et, AuthContext as f, FacebookProfile as fn, CreateCustomAdapter as fr, RobloxOptions as ft, BetterAuthOptions as g, discord as gn, initGetModelName as gr, RedditProfile as gt, BetterAuthAdvancedOptions as h, DiscordProfile as hn, Prettify as hr, RedditOptions as ht, createAuthMiddleware as i, microsoft as in, createAdapter as ir, ZoomProfile as it, PolarProfile as j, validateAuthorizationCode as jn, User as jr, KickOptions as jt, vercel as k, BetterAuthCookies as kn, Verification as kr, LinearUser as kt, ClientAtomListener as l, FigmaProfile as ln, AdapterFactoryOptions as lr, SalesforceOptions as lt, InternalAdapter as m, DiscordOptions as mn, LiteralUnion as mr, roblox as mt, AuthMiddleware as n, MicrosoftEntraIDProfile as nn, withApplyDefault as nr, PronounOption as nt, StandardSchemaV1$1 as o, GithubProfile as on, AdapterConfig as or, VkOption as ot, GenericEndpointContext as p, facebook as pn, LiteralString as pr, RobloxProfile as pt, KakaoOptions as q, DBAdapterDebugLogOption as qn, ModelNames as qr, SlackProfile as qt, createAuthEndpoint as r, MicrosoftOptions as rn, AdapterFactory as rr, ZoomOptions as rt, BetterAuthClientOptions as s, github as sn, AdapterFactoryConfig as sr, VkProfile as st, AuthEndpoint as t, google as tn, deepmerge as tr, PhoneNumber as tt, ClientFetchOption as u, figma as un, AdapterTestDebugLogs as ur, SalesforceProfile as ut, GenerateIdFn as v, CognitoProfile as vn, initGetFieldName as vr, TiktokOptions as vt, SocialProviders as w, AppleNonConformUser as wn, FieldAttribute as wr, LinkedInOptions as wt, SocialProvider as x, AtlassianOptions as xn, initGetDefaultFieldName as xr, GitlabOptions as xt, BetterAuthPlugin as y, cognito as yn, initGetFieldAttributes as yr, TiktokProfile as yt, paybin as z, createClientCredentialsTokenRequest as zn, accountSchema as zr, twitter as zt };
7725
+ export { AccountStatus as $, JoinOption as $n, GoogleProfile as $t, PolarOptions as A, createAuthorizationCodeRequest as An, sessionSchema as Ar, linear as At, LineIdTokenPayload as B, OAuth2Tokens as Bn, DBFieldAttributeConfig as Br, TwitchOptions as Bt, SocialProviderListEnum as C, atlassian as Cn, initGetDefaultFieldName as Cr, gitlab as Ct, VercelOptions as D, apple as Dn, userSchema as Dr, LinearOptions as Dt, socialProviders as E, AppleProfile as En, User as Er, linkedin as Et, PayPalTokenResponse as F, createRefreshAccessTokenRequest as Fn, BetterAuthPluginDBSchema as Fr, DropboxProfile as Ft, NaverProfile as G, CustomAdapter as Gn, spotify as Gt, LineUserInfo as H, OAuthProvider as Hn, DBPrimitive as Hr, twitch as Ht, paypal as I, refreshAccessToken as In, getAuthTables as Ir, dropbox as It, KakaoProfile as J, DBAdapterFactoryConfig as Jn, slack as Jt, naver as K, DBAdapter as Kn, SlackOptions as Kt, PaybinOptions as L, createAuthorizationURL as Ln, BaseModelNames as Lr, TwitterOption as Lt, polar as M, validateToken as Mn, rateLimitSchema as Mr, KickProfile as Mt, PayPalOptions as N, generateCodeChallenge as Nn, Account as Nr, kick as Nt, VercelProfile as O, getApplePublicKey as On, coreSchema as Or, LinearProfile as Ot, PayPalProfile as P, getOAuth2Tokens as Pn, accountSchema as Pr, DropboxOptions as Pt, notion as Q, JoinConfig as Qn, GoogleOptions as Qt, PaybinProfile as R, clientCredentialsToken as Rn, BetterAuthDBSchema as Rr, TwitterProfile as Rt, SocialProviderList as S, AtlassianProfile as Sn, initGetDefaultModelName as Sr, GitlabProfile as St, socialProviderList as T, AppleOptions as Tn, verificationSchema as Tr, LinkedInProfile as Tt, line as U, ProviderOptions as Un, ModelNames as Ur, SpotifyOptions as Ut, LineOptions as V, OAuth2UserInfo as Vn, DBFieldType as Vr, TwitchProfile as Vt, NaverOptions as W, CleanedWhere as Wn, SecondaryStorage as Wr, SpotifyProfile as Wt, NotionOptions as X, DBAdapterSchemaCreation as Xn, HuggingFaceProfile as Xt, kakao as Y, DBAdapterInstance as Yn, HuggingFaceOptions as Yt, NotionProfile as Z, DBTransactionAdapter as Zn, huggingface as Zt, BetterAuthRateLimitOptions as _, CognitoOptions as _n, Primitive as _r, reddit as _t, optionsMiddleware as a, GithubOptions as an, createAdapterFactory as ar, zoom as at, HookEndpointContext as b, getCognitoPublicKey as bn, initGetFieldName as br, tiktok as bt, BetterAuthClientPlugin as c, FigmaOptions as cn, AdapterFactoryCustomizeAdapterCreator as cr, vk as ct, ClientStore as d, FacebookOptions as dn, CreateAdapterOptions as dr, salesforce as dt, getGooglePublicKey as en, Where as er, LoginType as et, AuthContext as f, FacebookProfile as fn, CreateCustomAdapter as fr, RobloxOptions as ft, BetterAuthOptions as g, discord as gn, Prettify as gr, RedditProfile as gt, BetterAuthAdvancedOptions as h, DiscordProfile as hn, LiteralUnion as hr, RedditOptions as ht, createAuthMiddleware as i, microsoft as in, createAdapter as ir, ZoomProfile as it, PolarProfile as j, validateAuthorizationCode as jn, RateLimit as jr, KickOptions as jt, vercel as k, BetterAuthCookies as kn, Session as kr, LinearUser as kt, ClientAtomListener as l, FigmaProfile as ln, AdapterFactoryOptions as lr, SalesforceOptions as lt, InternalAdapter as m, DiscordOptions as mn, LiteralString as mr, roblox as mt, AuthMiddleware as n, MicrosoftEntraIDProfile as nn, withApplyDefault as nr, PronounOption as nt, StandardSchemaV1$1 as o, GithubProfile as on, AdapterConfig as or, VkOption as ot, GenericEndpointContext as p, facebook as pn, Awaitable as pr, RobloxProfile as pt, KakaoOptions as q, DBAdapterDebugLogOption as qn, SlackProfile as qt, createAuthEndpoint as r, MicrosoftOptions as rn, AdapterFactory as rr, ZoomOptions as rt, BetterAuthClientOptions as s, github as sn, AdapterFactoryConfig as sr, VkProfile as st, AuthEndpoint as t, google as tn, deepmerge as tr, PhoneNumber as tt, ClientFetchOption as u, figma as un, AdapterTestDebugLogs as ur, SalesforceProfile as ut, GenerateIdFn as v, CognitoProfile as vn, initGetModelName as vr, TiktokOptions as vt, SocialProviders as w, AppleNonConformUser as wn, Verification as wr, LinkedInOptions as wt, SocialProvider as x, AtlassianOptions as xn, initGetFieldAttributes as xr, GitlabOptions as xt, BetterAuthPlugin as y, cognito as yn, initGetIdField as yr, TiktokProfile as yt, paybin as z, createClientCredentialsTokenRequest as zn, DBFieldAttribute as zr, twitter as zt };
package/dist/index.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { _ as BetterAuthRateLimitOptions, b as HookEndpointContext, c as BetterAuthClientPlugin, d as ClientStore, f as AuthContext, g as BetterAuthOptions, h as BetterAuthAdvancedOptions, hr as Prettify, kn as BetterAuthCookies, l as ClientAtomListener, m as InternalAdapter, mr as LiteralUnion, o as StandardSchemaV1, p as GenericEndpointContext, pr as LiteralString, s as BetterAuthClientOptions, u as ClientFetchOption, v as GenerateIdFn, y as BetterAuthPlugin } from "./index-NeeRjOR2.mjs";
2
- export { AuthContext, BetterAuthAdvancedOptions, BetterAuthClientOptions, BetterAuthClientPlugin, BetterAuthCookies, BetterAuthOptions, BetterAuthPlugin, BetterAuthRateLimitOptions, ClientAtomListener, ClientFetchOption, ClientStore, GenerateIdFn, GenericEndpointContext, HookEndpointContext, InternalAdapter, LiteralString, LiteralUnion, Prettify, StandardSchemaV1 };
1
+ import { _ as BetterAuthRateLimitOptions, _r as Primitive, b as HookEndpointContext, c as BetterAuthClientPlugin, d as ClientStore, f as AuthContext, g as BetterAuthOptions, gr as Prettify, h as BetterAuthAdvancedOptions, hr as LiteralUnion, kn as BetterAuthCookies, l as ClientAtomListener, m as InternalAdapter, mr as LiteralString, o as StandardSchemaV1, p as GenericEndpointContext, pr as Awaitable, s as BetterAuthClientOptions, u as ClientFetchOption, v as GenerateIdFn, y as BetterAuthPlugin } from "./index-CTa0oOlQ.mjs";
2
+ export { AuthContext, Awaitable, BetterAuthAdvancedOptions, BetterAuthClientOptions, BetterAuthClientPlugin, BetterAuthCookies, BetterAuthOptions, BetterAuthPlugin, BetterAuthRateLimitOptions, ClientAtomListener, ClientFetchOption, ClientStore, GenerateIdFn, GenericEndpointContext, HookEndpointContext, InternalAdapter, LiteralString, LiteralUnion, Prettify, Primitive, StandardSchemaV1 };
@@ -1,2 +1,2 @@
1
- import { An as createAuthorizationCodeRequest, Bn as OAuth2Tokens, Fn as createRefreshAccessTokenRequest, Hn as OAuthProvider, In as refreshAccessToken, Ln as createAuthorizationURL, Mn as validateToken, Nn as generateCodeChallenge, Pn as getOAuth2Tokens, Rn as clientCredentialsToken, Un as ProviderOptions, Vn as OAuth2UserInfo, jn as validateAuthorizationCode, zn as createClientCredentialsTokenRequest } from "../index-NeeRjOR2.mjs";
1
+ import { An as createAuthorizationCodeRequest, Bn as OAuth2Tokens, Fn as createRefreshAccessTokenRequest, Hn as OAuthProvider, In as refreshAccessToken, Ln as createAuthorizationURL, Mn as validateToken, Nn as generateCodeChallenge, Pn as getOAuth2Tokens, Rn as clientCredentialsToken, Un as ProviderOptions, Vn as OAuth2UserInfo, jn as validateAuthorizationCode, zn as createClientCredentialsTokenRequest } from "../index-CTa0oOlQ.mjs";
2
2
  export { OAuth2Tokens, OAuth2UserInfo, OAuthProvider, ProviderOptions, clientCredentialsToken, createAuthorizationCodeRequest, createAuthorizationURL, createClientCredentialsTokenRequest, createRefreshAccessTokenRequest, generateCodeChallenge, getOAuth2Tokens, refreshAccessToken, validateAuthorizationCode, validateToken };
@@ -1,2 +1,2 @@
1
- import { $ as AccountStatus, $t as GoogleProfile, A as PolarOptions, At as linear, B as LineIdTokenPayload, Bt as TwitchOptions, C as SocialProviderListEnum, Cn as atlassian, Ct as gitlab, D as VercelOptions, Dn as apple, Dt as LinearOptions, E as socialProviders, En as AppleProfile, Et as linkedin, F as PayPalTokenResponse, Ft as DropboxProfile, G as NaverProfile, Gt as spotify, H as LineUserInfo, Ht as twitch, I as paypal, It as dropbox, J as KakaoProfile, Jt as slack, K as naver, Kt as SlackOptions, L as PaybinOptions, Lt as TwitterOption, M as polar, Mt as KickProfile, N as PayPalOptions, Nt as kick, O as VercelProfile, On as getApplePublicKey, Ot as LinearProfile, P as PayPalProfile, Pt as DropboxOptions, Q as notion, Qt as GoogleOptions, R as PaybinProfile, Rt as TwitterProfile, S as SocialProviderList, Sn as AtlassianProfile, St as GitlabProfile, T as socialProviderList, Tn as AppleOptions, Tt as LinkedInProfile, U as line, Ut as SpotifyOptions, V as LineOptions, Vt as TwitchProfile, W as NaverOptions, Wt as SpotifyProfile, X as NotionOptions, Xt as HuggingFaceProfile, Y as kakao, Yt as HuggingFaceOptions, Z as NotionProfile, Zt as huggingface, _n as CognitoOptions, _t as reddit, an as GithubOptions, at as zoom, bn as getCognitoPublicKey, bt as tiktok, cn as FigmaOptions, ct as vk, dn as FacebookOptions, dt as salesforce, en as getGooglePublicKey, et as LoginType, fn as FacebookProfile, ft as RobloxOptions, gn as discord, gt as RedditProfile, hn as DiscordProfile, ht as RedditOptions, in as microsoft, it as ZoomProfile, j as PolarProfile, jt as KickOptions, k as vercel, kt as LinearUser, ln as FigmaProfile, lt as SalesforceOptions, mn as DiscordOptions, mt as roblox, nn as MicrosoftEntraIDProfile, nt as PronounOption, on as GithubProfile, ot as VkOption, pn as facebook, pt as RobloxProfile, q as KakaoOptions, qt as SlackProfile, rn as MicrosoftOptions, rt as ZoomOptions, sn as github, st as VkProfile, tn as google, tt as PhoneNumber, un as figma, ut as SalesforceProfile, vn as CognitoProfile, vt as TiktokOptions, w as SocialProviders, wn as AppleNonConformUser, wt as LinkedInOptions, x as SocialProvider, xn as AtlassianOptions, xt as GitlabOptions, yn as cognito, yt as TiktokProfile, z as paybin, zt as twitter } from "../index-NeeRjOR2.mjs";
1
+ import { $ as AccountStatus, $t as GoogleProfile, A as PolarOptions, At as linear, B as LineIdTokenPayload, Bt as TwitchOptions, C as SocialProviderListEnum, Cn as atlassian, Ct as gitlab, D as VercelOptions, Dn as apple, Dt as LinearOptions, E as socialProviders, En as AppleProfile, Et as linkedin, F as PayPalTokenResponse, Ft as DropboxProfile, G as NaverProfile, Gt as spotify, H as LineUserInfo, Ht as twitch, I as paypal, It as dropbox, J as KakaoProfile, Jt as slack, K as naver, Kt as SlackOptions, L as PaybinOptions, Lt as TwitterOption, M as polar, Mt as KickProfile, N as PayPalOptions, Nt as kick, O as VercelProfile, On as getApplePublicKey, Ot as LinearProfile, P as PayPalProfile, Pt as DropboxOptions, Q as notion, Qt as GoogleOptions, R as PaybinProfile, Rt as TwitterProfile, S as SocialProviderList, Sn as AtlassianProfile, St as GitlabProfile, T as socialProviderList, Tn as AppleOptions, Tt as LinkedInProfile, U as line, Ut as SpotifyOptions, V as LineOptions, Vt as TwitchProfile, W as NaverOptions, Wt as SpotifyProfile, X as NotionOptions, Xt as HuggingFaceProfile, Y as kakao, Yt as HuggingFaceOptions, Z as NotionProfile, Zt as huggingface, _n as CognitoOptions, _t as reddit, an as GithubOptions, at as zoom, bn as getCognitoPublicKey, bt as tiktok, cn as FigmaOptions, ct as vk, dn as FacebookOptions, dt as salesforce, en as getGooglePublicKey, et as LoginType, fn as FacebookProfile, ft as RobloxOptions, gn as discord, gt as RedditProfile, hn as DiscordProfile, ht as RedditOptions, in as microsoft, it as ZoomProfile, j as PolarProfile, jt as KickOptions, k as vercel, kt as LinearUser, ln as FigmaProfile, lt as SalesforceOptions, mn as DiscordOptions, mt as roblox, nn as MicrosoftEntraIDProfile, nt as PronounOption, on as GithubProfile, ot as VkOption, pn as facebook, pt as RobloxProfile, q as KakaoOptions, qt as SlackProfile, rn as MicrosoftOptions, rt as ZoomOptions, sn as github, st as VkProfile, tn as google, tt as PhoneNumber, un as figma, ut as SalesforceProfile, vn as CognitoProfile, vt as TiktokOptions, w as SocialProviders, wn as AppleNonConformUser, wt as LinkedInOptions, x as SocialProvider, xn as AtlassianOptions, xt as GitlabOptions, yn as cognito, yt as TiktokProfile, z as paybin, zt as twitter } from "../index-CTa0oOlQ.mjs";
2
2
  export { AccountStatus, AppleNonConformUser, AppleOptions, AppleProfile, AtlassianOptions, AtlassianProfile, CognitoOptions, CognitoProfile, DiscordOptions, DiscordProfile, DropboxOptions, DropboxProfile, FacebookOptions, FacebookProfile, FigmaOptions, FigmaProfile, GithubOptions, GithubProfile, GitlabOptions, GitlabProfile, GoogleOptions, GoogleProfile, HuggingFaceOptions, HuggingFaceProfile, KakaoOptions, KakaoProfile, KickOptions, KickProfile, LineIdTokenPayload, LineOptions, LineUserInfo, LinearOptions, LinearProfile, LinearUser, LinkedInOptions, LinkedInProfile, LoginType, MicrosoftEntraIDProfile, MicrosoftOptions, NaverOptions, NaverProfile, NotionOptions, NotionProfile, PayPalOptions, PayPalProfile, PayPalTokenResponse, PaybinOptions, PaybinProfile, PhoneNumber, PolarOptions, PolarProfile, PronounOption, RedditOptions, RedditProfile, RobloxOptions, RobloxProfile, SalesforceOptions, SalesforceProfile, SlackOptions, SlackProfile, SocialProvider, SocialProviderList, SocialProviderListEnum, SocialProviders, SpotifyOptions, SpotifyProfile, TiktokOptions, TiktokProfile, TwitchOptions, TwitchProfile, TwitterOption, TwitterProfile, VercelOptions, VercelProfile, VkOption, VkProfile, ZoomOptions, ZoomProfile, apple, atlassian, cognito, discord, dropbox, facebook, figma, getApplePublicKey, getCognitoPublicKey, getGooglePublicKey, github, gitlab, google, huggingface, kakao, kick, line, linear, linkedin, microsoft, naver, notion, paybin, paypal, polar, reddit, roblox, salesforce, slack, socialProviderList, socialProviders, spotify, tiktok, twitch, twitter, vercel, vk, zoom };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@better-auth/core",
3
- "version": "1.4.7",
3
+ "version": "1.4.8-beta.2",
4
4
  "description": "The most comprehensive authentication framework for TypeScript.",
5
5
  "type": "module",
6
6
  "repository": {
@@ -43,7 +43,7 @@ export type AdapterFactoryCustomizeAdapterCreator = (config: {
43
43
  *
44
44
  * If the config has defined `debugLogs` as `false`, no logs will be shown.
45
45
  */
46
- debugLog: (...args: any[]) => void;
46
+ debugLog: (...args: unknown[]) => void;
47
47
  /**
48
48
  * Get the model name which is expected to be saved in the database based on the user's schema.
49
49
  */
@@ -97,17 +97,17 @@ export type AdapterFactoryCustomizeAdapterCreator = (config: {
97
97
  }) => DBFieldAttribute;
98
98
  // The following functions are exposed primarily for the purpose of having wrapper adapters.
99
99
  transformInput: (
100
- data: Record<string, any>,
100
+ data: Record<string, unknown>,
101
101
  defaultModelName: string,
102
102
  action: "create" | "update",
103
103
  forceAllowId?: boolean | undefined,
104
- ) => Promise<Record<string, any>>;
104
+ ) => Promise<Record<string, unknown>>;
105
105
  transformOutput: (
106
- data: Record<string, any>,
106
+ data: Record<string, unknown>,
107
107
  defaultModelName: string,
108
108
  select?: string[] | undefined,
109
109
  joinConfig?: JoinConfig | undefined,
110
- ) => Promise<Record<string, any>>;
110
+ ) => Promise<Record<string, unknown>>;
111
111
  transformWhereClause: <W extends Where[] | undefined>({
112
112
  model,
113
113
  where,
@@ -47,7 +47,8 @@ export const getAuthTables = (
47
47
  },
48
48
  } satisfies BetterAuthDBSchema;
49
49
 
50
- const { user, session, account, ...pluginTables } = pluginSchema;
50
+ const { user, session, account, verification, ...pluginTables } =
51
+ pluginSchema;
51
52
 
52
53
  const sessionTable = {
53
54
  session: {
@@ -267,6 +268,8 @@ export const getAuthTables = (
267
268
  onUpdate: () => new Date(),
268
269
  fieldName: options.verification?.fields?.updatedAt || "updatedAt",
269
270
  },
271
+ ...verification?.fields,
272
+ ...options.verification?.additionalFields,
270
273
  },
271
274
  order: 4,
272
275
  },
package/src/db/index.ts CHANGED
@@ -1,12 +1,4 @@
1
- import type { BetterAuthPluginDBSchema } from "./plugin";
2
- import type {
3
- BetterAuthDBSchema,
4
- DBFieldAttribute,
5
- DBFieldAttributeConfig,
6
- DBFieldType,
7
- DBPrimitive,
8
- } from "./type";
9
-
1
+ export { getAuthTables } from "./get-tables";
10
2
  export type { BetterAuthPluginDBSchema } from "./plugin";
11
3
  export { type Account, accountSchema } from "./schema/account";
12
4
  export { type RateLimit, rateLimitSchema } from "./schema/rate-limit";
@@ -24,30 +16,3 @@ export type {
24
16
  ModelNames,
25
17
  SecondaryStorage,
26
18
  } from "./type";
27
-
28
- /**
29
- * @deprecated Backport for 1.3.x, we will remove this in 1.4.x
30
- */
31
- export type AuthPluginSchema = BetterAuthPluginDBSchema;
32
- /**
33
- * @deprecated Backport for 1.3.x, we will remove this in 1.4.x
34
- */
35
- export type FieldAttribute = DBFieldAttribute;
36
- /**
37
- * @deprecated Backport for 1.3.x, we will remove this in 1.4.x
38
- */
39
- export type FieldAttributeConfig = DBFieldAttributeConfig;
40
- /**
41
- * @deprecated Backport for 1.3.x, we will remove this in 1.4.x
42
- */
43
- export type FieldType = DBFieldType;
44
- /**
45
- * @deprecated Backport for 1.3.x, we will remove this in 1.4.x
46
- */
47
- export type Primitive = DBPrimitive;
48
- /**
49
- * @deprecated Backport for 1.3.x, we will remove this in 1.4.x
50
- */
51
- export type BetterAuthDbSchema = BetterAuthDBSchema;
52
-
53
- export { getAuthTables } from "./get-tables";
@@ -59,4 +59,25 @@ describe("getAuthTables", () => {
59
59
  expect(refreshTokenExpiresAtField.fieldName).toBe("refreshTokenExpiresAt");
60
60
  expect(accessTokenExpiresAtField.fieldName).toBe("accessTokenExpiresAt");
61
61
  });
62
+
63
+ it("should merge additionalFields into verification table metadata", () => {
64
+ const tables = getAuthTables({
65
+ verification: {
66
+ additionalFields: {
67
+ newField: {
68
+ fieldName: "new_field",
69
+ type: "string",
70
+ },
71
+ },
72
+ },
73
+ });
74
+
75
+ const verificationTable = tables.verification;
76
+ const newField = verificationTable!.fields.newField!;
77
+
78
+ console.log(newField);
79
+ expect(newField).not.toBeUndefined();
80
+ expect(newField.fieldName).toBe("new_field");
81
+ expect(newField.type).toBe("string");
82
+ });
62
83
  });
package/src/db/type.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { StandardSchemaV1 } from "@standard-schema/spec";
2
- import type { LiteralString } from "../types";
2
+ import type { Awaitable, LiteralString } from "../types";
3
3
 
4
4
  export type BaseModelNames = "user" | "account" | "session" | "verification";
5
5
 
@@ -63,8 +63,8 @@ export type DBFieldAttributeConfig = {
63
63
  */
64
64
  transform?:
65
65
  | {
66
- input?: (value: DBPrimitive) => DBPrimitive | Promise<DBPrimitive>;
67
- output?: (value: DBPrimitive) => DBPrimitive | Promise<DBPrimitive>;
66
+ input?: (value: DBPrimitive) => Awaitable<DBPrimitive>;
67
+ output?: (value: DBPrimitive) => Awaitable<DBPrimitive>;
68
68
  }
69
69
  | undefined;
70
70
  /**
@@ -157,7 +157,7 @@ export interface SecondaryStorage {
157
157
  * @param key - Key to get
158
158
  * @returns - Value of the key
159
159
  */
160
- get: (key: string) => Promise<unknown> | unknown;
160
+ get: (key: string) => Awaitable<unknown>;
161
161
  set: (
162
162
  /**
163
163
  * Key to store
@@ -171,10 +171,10 @@ export interface SecondaryStorage {
171
171
  * Time to live in seconds
172
172
  */
173
173
  ttl?: number | undefined,
174
- ) => Promise<void | null | unknown> | void;
174
+ ) => Awaitable<void | null | unknown>;
175
175
  /**
176
176
  *
177
177
  * @param key - Key to delete
178
178
  */
179
- delete: (key: string) => Promise<void | null | string> | void;
179
+ delete: (key: string) => Awaitable<void | null | string>;
180
180
  }
@@ -1,4 +1,4 @@
1
- import type { LiteralString } from "../types";
1
+ import type { Awaitable, LiteralString } from "../types";
2
2
 
3
3
  export interface OAuth2Tokens {
4
4
  tokenType?: string | undefined;
@@ -35,7 +35,7 @@ export interface OAuthProvider<
35
35
  redirectURI: string;
36
36
  display?: string | undefined;
37
37
  loginHint?: string | undefined;
38
- }) => Promise<URL> | URL;
38
+ }) => Awaitable<URL>;
39
39
  name: string;
40
40
  validateAuthorizationCode: (data: {
41
41
  code: string;
@@ -1,5 +1,13 @@
1
- type Primitive = string | number | symbol | bigint | boolean | null | undefined;
1
+ export type Primitive =
2
+ | string
3
+ | number
4
+ | symbol
5
+ | bigint
6
+ | boolean
7
+ | null
8
+ | undefined;
2
9
 
10
+ export type Awaitable<T> = T | Promise<T>;
3
11
  export type LiteralString = "" | (string & Record<never, never>);
4
12
  export type LiteralUnion<LiteralType, BaseType extends Primitive> =
5
13
  | LiteralType
@@ -23,7 +23,7 @@ import type { DBAdapterDebugLogOption, DBAdapterInstance } from "../db/adapter";
23
23
  import type { Logger } from "../env";
24
24
  import type { SocialProviderList, SocialProviders } from "../social-providers";
25
25
  import type { AuthContext, GenericEndpointContext } from "./context";
26
- import type { LiteralUnion } from "./helper";
26
+ import type { Awaitable, LiteralUnion } from "./helper";
27
27
  import type { BetterAuthPlugin } from "./plugin";
28
28
 
29
29
  type KyselyDatabaseType = "postgres" | "mysql" | "sqlite" | "mssql";
@@ -954,6 +954,12 @@ export type BetterAuthOptions = {
954
954
  * Map verification fields
955
955
  */
956
956
  fields?: Partial<Record<keyof OmitId<Verification>, string>>;
957
+ /**
958
+ * Additional fields for the verification
959
+ */
960
+ additionalFields?: {
961
+ [key: string]: DBFieldAttribute;
962
+ };
957
963
  /**
958
964
  * disable cleaning up expired values when a verification value is
959
965
  * fetched
@@ -965,7 +971,7 @@ export type BetterAuthOptions = {
965
971
  * List of trusted origins.
966
972
  */
967
973
  trustedOrigins?:
968
- | (string[] | ((request: Request) => string[] | Promise<string[]>))
974
+ | (string[] | ((request: Request) => Awaitable<string[]>))
969
975
  | undefined;
970
976
  /**
971
977
  * Rate limiting configuration
@@ -8,10 +8,9 @@ import type { Migration } from "kysely";
8
8
  import type { AuthMiddleware } from "../api";
9
9
  import type { BetterAuthPluginDBSchema } from "../db";
10
10
  import type { AuthContext } from "./context";
11
- import type { LiteralString } from "./helper";
11
+ import type { Awaitable, LiteralString } from "./helper";
12
12
  import type { BetterAuthOptions } from "./init-options";
13
13
 
14
- type Awaitable<T> = T | Promise<T>;
15
14
  type DeepPartial<T> = T extends Function
16
15
  ? T
17
16
  : T extends object
@@ -153,6 +152,6 @@ export type BetterAuthPlugin = {
153
152
  * This will override the default database operations
154
153
  */
155
154
  adapter?: {
156
- [key: string]: (...args: any[]) => Promise<any> | any;
155
+ [key: string]: (...args: any[]) => Awaitable<any>;
157
156
  };
158
157
  };