@better-auth/core 1.4.6-beta.3 → 1.4.6

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.6-beta.3 build /home/runner/work/better-auth/better-auth/packages/core
2
+ > @better-auth/core@1.4.6 build /home/runner/work/better-auth/better-auth/packages/core
3
3
  > tsdown
4
4
 
5
5
  ℹ tsdown v0.17.0 powered by rolldown v1.0.0-beta.53
@@ -7,8 +7,8 @@
7
7
  ℹ entry: src/index.ts, src/db/index.ts, src/db/adapter/index.ts, src/async_hooks/index.ts, src/context/index.ts, src/env/index.ts, src/oauth2/index.ts, src/api/index.ts, src/social-providers/index.ts, src/utils/index.ts, src/error/index.ts
8
8
  ℹ tsconfig: tsconfig.json
9
9
  ℹ Build start
10
- ℹ dist/social-providers/index.mjs  79.87 kB │ gzip: 10.31 kB
11
- ℹ dist/db/adapter/index.mjs  37.94 kB │ gzip: 7.72 kB
10
+ ℹ dist/social-providers/index.mjs  80.70 kB │ gzip: 10.32 kB
11
+ ℹ dist/db/adapter/index.mjs  38.13 kB │ gzip: 7.79 kB
12
12
  ℹ dist/db/index.mjs  1.66 kB │ gzip: 0.54 kB
13
13
  ℹ dist/api/index.mjs  0.86 kB │ gzip: 0.42 kB
14
14
  ℹ dist/context/index.mjs  0.77 kB │ gzip: 0.28 kB
@@ -25,10 +25,10 @@
25
25
  ℹ dist/error-CMXuwPsa.mjs  1.77 kB │ gzip: 0.79 kB
26
26
  ℹ dist/async_hooks-CrTStdt6.mjs  1.70 kB │ gzip: 0.85 kB
27
27
  ℹ dist/utils-BqQC77zO.mjs  1.10 kB │ gzip: 0.55 kB
28
- ℹ dist/social-providers/index.d.mts  3.84 kB │ gzip: 1.18 kB
28
+ ℹ dist/social-providers/index.d.mts  3.88 kB │ gzip: 1.19 kB
29
29
  ℹ dist/context/index.d.mts  3.02 kB │ gzip: 0.95 kB
30
30
  ℹ dist/error/index.d.mts  1.84 kB │ gzip: 0.72 kB
31
- ℹ dist/db/adapter/index.d.mts  1.34 kB │ gzip: 0.42 kB
31
+ ℹ dist/db/adapter/index.d.mts  1.34 kB │ gzip: 0.43 kB
32
32
  ℹ dist/utils/index.d.mts  1.19 kB │ gzip: 0.55 kB
33
33
  ℹ dist/db/index.d.mts  1.04 kB │ gzip: 0.38 kB
34
34
  ℹ dist/index.d.mts  0.86 kB │ gzip: 0.33 kB
@@ -36,8 +36,8 @@
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.14 kB │ gzip: 0.10 kB
39
- ℹ dist/index-BfhTkcnW.d.mts 217.64 kB │ gzip: 34.32 kB
39
+ ℹ dist/index-D6KwwQy5.d.mts 218.31 kB │ gzip: 34.38 kB
40
40
  ℹ dist/index-D4vfN5ui.d.mts  3.31 kB │ gzip: 1.11 kB
41
41
  ℹ dist/index-Da4Ujjef.d.mts  0.24 kB │ gzip: 0.16 kB
42
- ℹ 32 files, total: 390.80 kB
43
- ✔ Build complete in 4643ms
42
+ ℹ 32 files, total: 392.54 kB
43
+ ✔ Build complete in 4673ms
@@ -1,2 +1,2 @@
1
- import { a as optionsMiddleware, i as createAuthMiddleware, n as AuthMiddleware, r as createAuthEndpoint, t as AuthEndpoint } from "../index-BfhTkcnW.mjs";
1
+ import { a as optionsMiddleware, i as createAuthMiddleware, n as AuthMiddleware, r as createAuthEndpoint, t as AuthEndpoint } from "../index-D6KwwQy5.mjs";
2
2
  export { AuthEndpoint, AuthMiddleware, createAuthEndpoint, createAuthMiddleware, optionsMiddleware };
@@ -1,4 +1,4 @@
1
- import { Gn as DBAdapter, Xn as DBTransactionAdapter, f as AuthContext } from "../index-BfhTkcnW.mjs";
1
+ import { Kn as DBAdapter, Zn as DBTransactionAdapter, f as AuthContext } from "../index-D6KwwQy5.mjs";
2
2
  import { t as AsyncLocalStorage } from "../index-Da4Ujjef.mjs";
3
3
  import { EndpointContext, InputContext } from "better-call";
4
4
 
@@ -1,2 +1,2 @@
1
- import { $n as Where, Gn as DBAdapter, Jn as DBAdapterInstance, Kn as DBAdapterDebugLogOption, Qn as JoinOption, Un as CleanedWhere, Wn as CustomAdapter, Xn as DBTransactionAdapter, Yn as DBAdapterSchemaCreation, Zn as JoinConfig, _r as initGetFieldName, ar as AdapterConfig, br as initGetDefaultFieldName, cr as AdapterFactoryOptions, dr as CreateCustomAdapter, er as deepmerge, gr as initGetIdField, hr as initGetModelName, ir as createAdapterFactory, lr as AdapterTestDebugLogs, nr as AdapterFactory, or as AdapterFactoryConfig, qn as DBAdapterFactoryConfig, rr as createAdapter, sr as AdapterFactoryCustomizeAdapterCreator, tr as withApplyDefault, ur as CreateAdapterOptions, vr as initGetFieldAttributes, yr as initGetDefaultModelName } from "../../index-BfhTkcnW.mjs";
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-D6KwwQy5.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,5 +1,5 @@
1
1
  import { t as getAuthTables } from "../../get-tables-BGfrxIVZ.mjs";
2
- import { i as logger, o as getColorDepth, t as TTY_COLORS } from "../../env-D6s-lvJz.mjs";
2
+ import { i as logger, n as createLogger, o as getColorDepth, t as TTY_COLORS } from "../../env-D6s-lvJz.mjs";
3
3
  import { n as safeJSONParse, r as generateId } from "../../utils-BqQC77zO.mjs";
4
4
  import { t as BetterAuthError } from "../../error-CMXuwPsa.mjs";
5
5
 
@@ -260,6 +260,7 @@ const createAdapterFactory = ({ adapter: customAdapter, config: cfg }) => (optio
260
260
  adapterName: cfg.adapterName ?? cfg.adapterId,
261
261
  supportsNumericIds: cfg.supportsNumericIds ?? true,
262
262
  supportsUUIDs: cfg.supportsUUIDs ?? false,
263
+ supportsArrays: cfg.supportsArrays ?? false,
263
264
  transaction: cfg.transaction ?? false,
264
265
  disableTransformInput: cfg.disableTransformInput ?? false,
265
266
  disableTransformOutput: cfg.disableTransformOutput ?? false,
@@ -269,6 +270,7 @@ const createAdapterFactory = ({ adapter: customAdapter, config: cfg }) => (optio
269
270
  const schema = getAuthTables(options);
270
271
  const debugLog = (...args) => {
271
272
  if (config.debugLogs === true || typeof config.debugLogs === "object") {
273
+ const logger$2 = createLogger({ level: "info" });
272
274
  if (typeof config.debugLogs === "object" && "isRunningAdapterTests" in config.debugLogs) {
273
275
  if (config.debugLogs.isRunningAdapterTests) {
274
276
  args.shift();
@@ -292,10 +294,11 @@ const createAdapterFactory = ({ adapter: customAdapter, config: cfg }) => (optio
292
294
  else if (method === "deleteMany" && !config.debugLogs.deleteMany) return;
293
295
  else if (method === "count" && !config.debugLogs.count) return;
294
296
  }
295
- logger.info(`[${config.adapterName}]`, ...args);
296
- } else logger.info(`[${config.adapterName}]`, ...args);
297
+ logger$2.info(`[${config.adapterName}]`, ...args);
298
+ } else logger$2.info(`[${config.adapterName}]`, ...args);
297
299
  }
298
300
  };
301
+ const logger$1 = createLogger(options.logger);
299
302
  const getDefaultModelName = initGetDefaultModelName({
300
303
  usePlural: config.usePlural,
301
304
  schema
@@ -344,7 +347,7 @@ const createAdapterFactory = ({ adapter: customAdapter, config: cfg }) => (optio
344
347
  if (fieldAttributes && fieldAttributes.type === "date" && !(value instanceof Date) && typeof value === "string") try {
345
348
  value = new Date(value);
346
349
  } catch {
347
- logger.error("[Adapter Factory] Failed to convert string to date", {
350
+ logger$1.error("[Adapter Factory] Failed to convert string to date", {
348
351
  value,
349
352
  field
350
353
  });
@@ -354,7 +357,7 @@ const createAdapterFactory = ({ adapter: customAdapter, config: cfg }) => (optio
354
357
  if (fieldAttributes.references?.field === "id" && useNumberId) if (Array.isArray(newValue)) newValue = newValue.map((x) => x !== null ? Number(x) : null);
355
358
  else newValue = newValue !== null ? Number(newValue) : null;
356
359
  else if (config.supportsJSON === false && typeof newValue === "object" && fieldAttributes.type === "json") newValue = JSON.stringify(newValue);
357
- else if (config.supportsJSON === false && Array.isArray(newValue) && (fieldAttributes.type === "string[]" || fieldAttributes.type === "number[]")) newValue = JSON.stringify(newValue);
360
+ else if (config.supportsArrays === false && Array.isArray(newValue) && (fieldAttributes.type === "string[]" || fieldAttributes.type === "number[]")) newValue = JSON.stringify(newValue);
358
361
  else if (config.supportsDates === false && newValue instanceof Date && fieldAttributes.type === "date") newValue = newValue.toISOString();
359
362
  else if (config.supportsBooleans === false && typeof newValue === "boolean") newValue = newValue ? 1 : 0;
360
363
  if (config.customTransformInput) newValue = config.customTransformInput({
@@ -389,7 +392,7 @@ const createAdapterFactory = ({ adapter: customAdapter, config: cfg }) => (optio
389
392
  if (originalKey === "id" || field.references?.field === "id") {
390
393
  if (typeof newValue !== "undefined" && newValue !== null) newValue = String(newValue);
391
394
  } else if (config.supportsJSON === false && typeof newValue === "string" && field.type === "json") newValue = safeJSONParse(newValue);
392
- else if (config.supportsJSON === false && typeof newValue === "string" && (field.type === "string[]" || field.type === "number[]")) newValue = safeJSONParse(newValue);
395
+ else if (config.supportsArrays === false && typeof newValue === "string" && (field.type === "string[]" || field.type === "number[]")) newValue = safeJSONParse(newValue);
393
396
  else if (config.supportsDates === false && typeof newValue === "string" && field.type === "date") newValue = new Date(newValue);
394
397
  else if (config.supportsBooleans === false && typeof newValue === "number" && field.type === "boolean") newValue = newValue === 1;
395
398
  if (config.customTransformOutput) newValue = config.customTransformOutput({
@@ -579,7 +582,7 @@ const createAdapterFactory = ({ adapter: customAdapter, config: cfg }) => (optio
579
582
  });
580
583
  }
581
584
  } catch (error) {
582
- logger.error(`Failed to query fallback join for model ${modelName}:`, {
585
+ logger$1.error(`Failed to query fallback join for model ${modelName}:`, {
583
586
  where,
584
587
  limit: joinConfig.limit
585
588
  });
@@ -606,7 +609,7 @@ const createAdapterFactory = ({ adapter: customAdapter, config: cfg }) => (optio
606
609
  transaction: async (cb) => {
607
610
  if (!lazyLoadTransaction) if (!config.transaction) lazyLoadTransaction = createAsIsTransaction(adapter);
608
611
  else {
609
- logger.debug(`[${config.adapterName}] - Using provided transaction implementation.`);
612
+ logger$1.debug(`[${config.adapterName}] - Using provided transaction implementation.`);
610
613
  lazyLoadTransaction = config.transaction;
611
614
  }
612
615
  return lazyLoadTransaction(cb);
@@ -617,7 +620,7 @@ const createAdapterFactory = ({ adapter: customAdapter, config: cfg }) => (optio
617
620
  const model = getModelName(unsafeModel);
618
621
  unsafeModel = getDefaultModelName(unsafeModel);
619
622
  if ("id" in unsafeData && typeof unsafeData.id !== "undefined" && !forceAllowId) {
620
- logger.warn(`[${config.adapterName}] - You are trying to create a record with an id. This is not allowed as we handle id generation for you, unless you pass in the \`forceAllowId\` parameter. The id will be ignored.`);
623
+ logger$1.warn(`[${config.adapterName}] - You are trying to create a record with an id. This is not allowed as we handle id generation for you, unless you pass in the \`forceAllowId\` parameter. The id will be ignored.`);
621
624
  const stack = (/* @__PURE__ */ new Error()).stack?.split("\n").filter((_, i) => i !== 1).join("\n").replace("Error:", "Create method with `id` being called at:");
622
625
  console.log(stack);
623
626
  unsafeData.id = void 0;
@@ -944,6 +947,7 @@ function formatAction(action) {
944
947
  }
945
948
  /**
946
949
  * @deprecated Use `createAdapterFactory` instead. This export will be removed in a future version.
950
+ * @alias
947
951
  */
948
952
  const createAdapter = createAdapterFactory;
949
953
 
@@ -1,2 +1,2 @@
1
- import { Ar as User, Br as BaseModelNames, Cr as FieldAttribute, Dr as getAuthTables, Er as Primitive, Fr as RateLimit, Gr as DBPrimitive, Hr as DBFieldAttribute, Ir as rateLimitSchema, Kr as ModelNames, Lr as Account, Mr as coreSchema, Nr as Session, Or as Verification, Pr as sessionSchema, Rr as accountSchema, Sr as BetterAuthDbSchema, Tr as FieldType, Ur as DBFieldAttributeConfig, Vr as BetterAuthDBSchema, Wr as DBFieldType, jr as userSchema, kr as verificationSchema, qr as SecondaryStorage, wr as FieldAttributeConfig, xr as AuthPluginSchema, zr as BetterAuthPluginDBSchema } from "../index-BfhTkcnW.mjs";
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-D6KwwQy5.mjs";
2
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 };
@@ -526,6 +526,7 @@ declare const createAdapterFactory: ({
526
526
  }: AdapterFactoryOptions) => AdapterFactory;
527
527
  /**
528
528
  * @deprecated Use `createAdapterFactory` instead. This export will be removed in a future version.
529
+ * @alias
529
530
  */
530
531
  declare const createAdapter: ({
531
532
  adapter: customAdapter,
@@ -641,6 +642,14 @@ interface DBAdapterFactoryConfig<Options extends BetterAuthOptions = BetterAuthO
641
642
  * @default true
642
643
  */
643
644
  supportsBooleans?: boolean | undefined;
645
+ /**
646
+ * If the database doesn't support arrays, set this to `false`.
647
+ *
648
+ * We will handle the translation between using `array`s, and saving `string`s to the database.
649
+ *
650
+ * @default false
651
+ */
652
+ supportsArrays?: boolean | undefined;
644
653
  /**
645
654
  * Execute multiple operations in a transaction.
646
655
  *
@@ -2280,6 +2289,7 @@ declare const google: (options: GoogleOptions) => {
2280
2289
  } | null>;
2281
2290
  options: GoogleOptions;
2282
2291
  };
2292
+ declare const getGooglePublicKey: (kid: string) => Promise<Uint8Array<ArrayBufferLike> | CryptoKey>;
2283
2293
  //#endregion
2284
2294
  //#region src/social-providers/huggingface.d.ts
2285
2295
  interface HuggingFaceProfile {
@@ -2832,6 +2842,7 @@ declare const kick: (options: KickOptions) => {
2832
2842
  codeVerifier?: string | undefined;
2833
2843
  deviceId?: string | undefined;
2834
2844
  }): Promise<OAuth2Tokens>;
2845
+ refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
2835
2846
  getUserInfo(token: OAuth2Tokens & {
2836
2847
  user?: {
2837
2848
  name?: {
@@ -5212,6 +5223,7 @@ declare const socialProviders: {
5212
5223
  codeVerifier?: string | undefined;
5213
5224
  deviceId?: string | undefined;
5214
5225
  }): Promise<OAuth2Tokens>;
5226
+ refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
5215
5227
  getUserInfo(token: OAuth2Tokens & {
5216
5228
  user?: {
5217
5229
  name?: {
@@ -7157,13 +7169,13 @@ type BetterAuthOptions = {
7157
7169
  * if the hook returns false, the user will not be created.
7158
7170
  * If the hook returns an object, it'll be used instead of the original data
7159
7171
  */
7160
- before?: (user: User & Record<string, unknown>, context?: GenericEndpointContext) => Promise<boolean | void | {
7172
+ before?: (user: User & Record<string, unknown>, context: GenericEndpointContext | null) => Promise<boolean | void | {
7161
7173
  data: Optional<User> & Record<string, any>;
7162
7174
  }>;
7163
7175
  /**
7164
7176
  * Hook that is called after a user is created.
7165
7177
  */
7166
- after?: (user: User & Record<string, unknown>, context?: GenericEndpointContext) => Promise<void>;
7178
+ after?: (user: User & Record<string, unknown>, context: GenericEndpointContext | null) => Promise<void>;
7167
7179
  };
7168
7180
  update?: {
7169
7181
  /**
@@ -7171,24 +7183,24 @@ type BetterAuthOptions = {
7171
7183
  * if the hook returns false, the user will not be updated.
7172
7184
  * If the hook returns an object, it'll be used instead of the original data
7173
7185
  */
7174
- before?: (user: Partial<User> & Record<string, unknown>, context?: GenericEndpointContext) => Promise<boolean | void | {
7186
+ before?: (user: Partial<User> & Record<string, unknown>, context: GenericEndpointContext | null) => Promise<boolean | void | {
7175
7187
  data: Optional<User & Record<string, any>>;
7176
7188
  }>;
7177
7189
  /**
7178
7190
  * Hook that is called after a user is updated.
7179
7191
  */
7180
- after?: (user: User & Record<string, unknown>, context?: GenericEndpointContext) => Promise<void>;
7192
+ after?: (user: User & Record<string, unknown>, context: GenericEndpointContext | null) => Promise<void>;
7181
7193
  };
7182
7194
  delete?: {
7183
7195
  /**
7184
7196
  * Hook that is called before a user is deleted.
7185
7197
  * if the hook returns false, the user will not be deleted.
7186
7198
  */
7187
- before?: (user: User & Record<string, unknown>, context?: GenericEndpointContext) => Promise<boolean | void>;
7199
+ before?: (user: User & Record<string, unknown>, context: GenericEndpointContext | null) => Promise<boolean | void>;
7188
7200
  /**
7189
7201
  * Hook that is called after a user is deleted.
7190
7202
  */
7191
- after?: (user: User & Record<string, unknown>, context?: GenericEndpointContext) => Promise<void>;
7203
+ after?: (user: User & Record<string, unknown>, context: GenericEndpointContext | null) => Promise<void>;
7192
7204
  };
7193
7205
  };
7194
7206
  /**
@@ -7201,13 +7213,13 @@ type BetterAuthOptions = {
7201
7213
  * if the hook returns false, the session will not be created.
7202
7214
  * If the hook returns an object, it'll be used instead of the original data
7203
7215
  */
7204
- before?: (session: Session & Record<string, unknown>, context?: GenericEndpointContext) => Promise<boolean | void | {
7216
+ before?: (session: Session & Record<string, unknown>, context: GenericEndpointContext | null) => Promise<boolean | void | {
7205
7217
  data: Optional<Session> & Record<string, any>;
7206
7218
  }>;
7207
7219
  /**
7208
7220
  * Hook that is called after a session is created.
7209
7221
  */
7210
- after?: (session: Session & Record<string, unknown>, context?: GenericEndpointContext) => Promise<void>;
7222
+ after?: (session: Session & Record<string, unknown>, context: GenericEndpointContext | null) => Promise<void>;
7211
7223
  };
7212
7224
  /**
7213
7225
  * Update hook
@@ -7218,24 +7230,24 @@ type BetterAuthOptions = {
7218
7230
  * if the hook returns false, the session will not be updated.
7219
7231
  * If the hook returns an object, it'll be used instead of the original data
7220
7232
  */
7221
- before?: (session: Partial<Session> & Record<string, unknown>, context?: GenericEndpointContext) => Promise<boolean | void | {
7233
+ before?: (session: Partial<Session> & Record<string, unknown>, context: GenericEndpointContext | null) => Promise<boolean | void | {
7222
7234
  data: Optional<Session & Record<string, any>>;
7223
7235
  }>;
7224
7236
  /**
7225
7237
  * Hook that is called after a session is updated.
7226
7238
  */
7227
- after?: (session: Session & Record<string, unknown>, context?: GenericEndpointContext) => Promise<void>;
7239
+ after?: (session: Session & Record<string, unknown>, context: GenericEndpointContext | null) => Promise<void>;
7228
7240
  };
7229
7241
  delete?: {
7230
7242
  /**
7231
7243
  * Hook that is called before a session is deleted.
7232
7244
  * if the hook returns false, the session will not be deleted.
7233
7245
  */
7234
- before?: (session: Session & Record<string, unknown>, context?: GenericEndpointContext) => Promise<boolean | void>;
7246
+ before?: (session: Session & Record<string, unknown>, context: GenericEndpointContext | null) => Promise<boolean | void>;
7235
7247
  /**
7236
7248
  * Hook that is called after a session is deleted.
7237
7249
  */
7238
- after?: (session: Session & Record<string, unknown>, context?: GenericEndpointContext) => Promise<void>;
7250
+ after?: (session: Session & Record<string, unknown>, context: GenericEndpointContext | null) => Promise<void>;
7239
7251
  };
7240
7252
  };
7241
7253
  /**
@@ -7248,13 +7260,13 @@ type BetterAuthOptions = {
7248
7260
  * If the hook returns false, the account will not be created.
7249
7261
  * If the hook returns an object, it'll be used instead of the original data
7250
7262
  */
7251
- before?: (account: Account, context?: GenericEndpointContext) => Promise<boolean | void | {
7263
+ before?: (account: Account, context: GenericEndpointContext | null) => Promise<boolean | void | {
7252
7264
  data: Optional<Account> & Record<string, any>;
7253
7265
  }>;
7254
7266
  /**
7255
7267
  * Hook that is called after a account is created.
7256
7268
  */
7257
- after?: (account: Account, context?: GenericEndpointContext) => Promise<void>;
7269
+ after?: (account: Account, context: GenericEndpointContext | null) => Promise<void>;
7258
7270
  };
7259
7271
  /**
7260
7272
  * Update hook
@@ -7265,24 +7277,24 @@ type BetterAuthOptions = {
7265
7277
  * If the hook returns false, the user will not be updated.
7266
7278
  * If the hook returns an object, it'll be used instead of the original data
7267
7279
  */
7268
- before?: (account: Partial<Account> & Record<string, unknown>, context?: GenericEndpointContext) => Promise<boolean | void | {
7280
+ before?: (account: Partial<Account> & Record<string, unknown>, context: GenericEndpointContext | null) => Promise<boolean | void | {
7269
7281
  data: Optional<Account & Record<string, any>>;
7270
7282
  }>;
7271
7283
  /**
7272
7284
  * Hook that is called after a account is updated.
7273
7285
  */
7274
- after?: (account: Account & Record<string, unknown>, context?: GenericEndpointContext) => Promise<void>;
7286
+ after?: (account: Account & Record<string, unknown>, context: GenericEndpointContext | null) => Promise<void>;
7275
7287
  };
7276
7288
  delete?: {
7277
7289
  /**
7278
7290
  * Hook that is called before an account is deleted.
7279
7291
  * if the hook returns false, the account will not be deleted.
7280
7292
  */
7281
- before?: (account: Account & Record<string, unknown>, context?: GenericEndpointContext) => Promise<boolean | void>;
7293
+ before?: (account: Account & Record<string, unknown>, context: GenericEndpointContext | null) => Promise<boolean | void>;
7282
7294
  /**
7283
7295
  * Hook that is called after an account is deleted.
7284
7296
  */
7285
- after?: (account: Account & Record<string, unknown>, context?: GenericEndpointContext) => Promise<void>;
7297
+ after?: (account: Account & Record<string, unknown>, context: GenericEndpointContext | null) => Promise<void>;
7286
7298
  };
7287
7299
  };
7288
7300
  /**
@@ -7295,13 +7307,13 @@ type BetterAuthOptions = {
7295
7307
  * if the hook returns false, the verification will not be created.
7296
7308
  * If the hook returns an object, it'll be used instead of the original data
7297
7309
  */
7298
- before?: (verification: Verification & Record<string, unknown>, context?: GenericEndpointContext) => Promise<boolean | void | {
7310
+ before?: (verification: Verification & Record<string, unknown>, context: GenericEndpointContext | null) => Promise<boolean | void | {
7299
7311
  data: Optional<Verification> & Record<string, any>;
7300
7312
  }>;
7301
7313
  /**
7302
7314
  * Hook that is called after a verification is created.
7303
7315
  */
7304
- after?: (verification: Verification & Record<string, unknown>, context?: GenericEndpointContext) => Promise<void>;
7316
+ after?: (verification: Verification & Record<string, unknown>, context: GenericEndpointContext | null) => Promise<void>;
7305
7317
  };
7306
7318
  update?: {
7307
7319
  /**
@@ -7309,24 +7321,24 @@ type BetterAuthOptions = {
7309
7321
  * if the hook returns false, the verification will not be updated.
7310
7322
  * If the hook returns an object, it'll be used instead of the original data
7311
7323
  */
7312
- before?: (verification: Partial<Verification> & Record<string, unknown>, context?: GenericEndpointContext) => Promise<boolean | void | {
7324
+ before?: (verification: Partial<Verification> & Record<string, unknown>, context: GenericEndpointContext | null) => Promise<boolean | void | {
7313
7325
  data: Optional<Verification & Record<string, any>>;
7314
7326
  }>;
7315
7327
  /**
7316
7328
  * Hook that is called after a verification is updated.
7317
7329
  */
7318
- after?: (verification: Verification & Record<string, unknown>, context?: GenericEndpointContext) => Promise<void>;
7330
+ after?: (verification: Verification & Record<string, unknown>, context: GenericEndpointContext | null) => Promise<void>;
7319
7331
  };
7320
7332
  delete?: {
7321
7333
  /**
7322
7334
  * Hook that is called before a verification is deleted.
7323
7335
  * if the hook returns false, the verification will not be deleted.
7324
7336
  */
7325
- before?: (verification: Verification & Record<string, unknown>, context?: GenericEndpointContext) => Promise<boolean | void>;
7337
+ before?: (verification: Verification & Record<string, unknown>, context: GenericEndpointContext | null) => Promise<boolean | void>;
7326
7338
  /**
7327
7339
  * Hook that is called after a verification is deleted.
7328
7340
  */
7329
- after?: (verification: Verification & Record<string, unknown>, context?: GenericEndpointContext) => Promise<void>;
7341
+ after?: (verification: Verification & Record<string, unknown>, context: GenericEndpointContext | null) => Promise<void>;
7330
7342
  };
7331
7343
  };
7332
7344
  } | undefined;
@@ -7738,4 +7750,4 @@ declare const createAuthEndpoint: <Path extends string, Opts extends EndpointOpt
7738
7750
  type AuthEndpoint = ReturnType<typeof createAuthEndpoint>;
7739
7751
  type AuthMiddleware = ReturnType<typeof createAuthMiddleware>;
7740
7752
  //#endregion
7741
- export { AccountStatus as $, Where as $n, GoogleProfile as $t, PolarOptions as A, validateAuthorizationCode as An, User as Ar, linear as At, LineIdTokenPayload as B, OAuth2UserInfo as Bn, BaseModelNames as Br, TwitchOptions as Bt, SocialProviderListEnum as C, AppleNonConformUser as Cn, FieldAttribute as Cr, gitlab as Ct, VercelOptions as D, getApplePublicKey as Dn, getAuthTables as Dr, LinearOptions as Dt, socialProviders as E, apple as En, Primitive$1 as Er, linkedin as Et, PayPalTokenResponse as F, refreshAccessToken as Fn, RateLimit as Fr, DropboxProfile as Ft, NaverProfile as G, DBAdapter as Gn, DBPrimitive as Gr, spotify as Gt, LineUserInfo as H, ProviderOptions as Hn, DBFieldAttribute as Hr, twitch as Ht, paypal as I, createAuthorizationURL as In, rateLimitSchema as Ir, dropbox as It, KakaoProfile as J, DBAdapterInstance as Jn, slack as Jt, naver as K, DBAdapterDebugLogOption as Kn, ModelNames as Kr, SlackOptions as Kt, PaybinOptions as L, clientCredentialsToken as Ln, Account as Lr, TwitterOption as Lt, polar as M, generateCodeChallenge as Mn, coreSchema as Mr, KickProfile as Mt, PayPalOptions as N, getOAuth2Tokens as Nn, Session as Nr, kick as Nt, VercelProfile as O, BetterAuthCookies as On, Verification as Or, LinearProfile as Ot, PayPalProfile as P, createRefreshAccessTokenRequest as Pn, sessionSchema as Pr, DropboxOptions as Pt, notion as Q, JoinOption as Qn, GoogleOptions as Qt, PaybinProfile as R, createClientCredentialsTokenRequest as Rn, accountSchema as Rr, TwitterProfile as Rt, SocialProviderList as S, atlassian as Sn, BetterAuthDbSchema as Sr, GitlabProfile as St, socialProviderList as T, AppleProfile as Tn, FieldType as Tr, LinkedInProfile as Tt, line as U, CleanedWhere as Un, DBFieldAttributeConfig as Ur, SpotifyOptions as Ut, LineOptions as V, OAuthProvider as Vn, BetterAuthDBSchema as Vr, TwitchProfile as Vt, NaverOptions as W, CustomAdapter as Wn, DBFieldType as Wr, SpotifyProfile as Wt, NotionOptions as X, DBTransactionAdapter as Xn, HuggingFaceProfile as Xt, kakao as Y, DBAdapterSchemaCreation as Yn, HuggingFaceOptions as Yt, NotionProfile as Z, JoinConfig as Zn, huggingface as Zt, BetterAuthRateLimitOptions as _, CognitoProfile as _n, initGetFieldName as _r, reddit as _t, optionsMiddleware as a, GithubProfile as an, AdapterConfig as ar, zoom as at, HookEndpointContext as b, AtlassianOptions as bn, initGetDefaultFieldName as br, tiktok as bt, BetterAuthClientPlugin as c, FigmaProfile as cn, AdapterFactoryOptions as cr, vk as ct, ClientStore as d, FacebookProfile as dn, CreateCustomAdapter as dr, salesforce as dt, google as en, deepmerge as er, LoginType as et, AuthContext as f, facebook as fn, LiteralString as fr, RobloxOptions as ft, BetterAuthOptions as g, CognitoOptions as gn, initGetIdField as gr, RedditProfile as gt, BetterAuthAdvancedOptions as h, discord as hn, initGetModelName as hr, RedditOptions as ht, createAuthMiddleware as i, GithubOptions as in, createAdapterFactory as ir, ZoomProfile as it, PolarProfile as j, validateToken as jn, userSchema as jr, KickOptions as jt, vercel as k, createAuthorizationCodeRequest as kn, verificationSchema as kr, LinearUser as kt, ClientAtomListener as l, figma as ln, AdapterTestDebugLogs as lr, SalesforceOptions as lt, InternalAdapter as m, DiscordProfile as mn, Prettify as mr, roblox as mt, AuthMiddleware as n, MicrosoftOptions as nn, AdapterFactory as nr, PronounOption as nt, StandardSchemaV1$1 as o, github as on, AdapterFactoryConfig as or, VkOption as ot, GenericEndpointContext as p, DiscordOptions as pn, LiteralUnion as pr, RobloxProfile as pt, KakaoOptions as q, DBAdapterFactoryConfig as qn, SecondaryStorage as qr, SlackProfile as qt, createAuthEndpoint as r, microsoft as rn, createAdapter as rr, ZoomOptions as rt, BetterAuthClientOptions as s, FigmaOptions as sn, AdapterFactoryCustomizeAdapterCreator as sr, VkProfile as st, AuthEndpoint as t, MicrosoftEntraIDProfile as tn, withApplyDefault as tr, PhoneNumber as tt, ClientFetchOption as u, FacebookOptions as un, CreateAdapterOptions as ur, SalesforceProfile as ut, GenerateIdFn as v, cognito as vn, initGetFieldAttributes as vr, TiktokOptions as vt, SocialProviders as w, AppleOptions as wn, FieldAttributeConfig as wr, LinkedInOptions as wt, SocialProvider as x, AtlassianProfile as xn, AuthPluginSchema as xr, GitlabOptions as xt, BetterAuthPlugin as y, getCognitoPublicKey as yn, initGetDefaultModelName as yr, TiktokProfile as yt, paybin as z, OAuth2Tokens as zn, BetterAuthPluginDBSchema as zr, twitter as zt };
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 };
package/dist/index.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { On as BetterAuthCookies, _ as BetterAuthRateLimitOptions, b as HookEndpointContext, c as BetterAuthClientPlugin, d as ClientStore, f as AuthContext, fr as LiteralString, g as BetterAuthOptions, h as BetterAuthAdvancedOptions, l as ClientAtomListener, m as InternalAdapter, mr as Prettify, o as StandardSchemaV1, p as GenericEndpointContext, pr as LiteralUnion, s as BetterAuthClientOptions, u as ClientFetchOption, v as GenerateIdFn, y as BetterAuthPlugin } from "./index-BfhTkcnW.mjs";
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-D6KwwQy5.mjs";
2
2
  export { AuthContext, BetterAuthAdvancedOptions, BetterAuthClientOptions, BetterAuthClientPlugin, BetterAuthCookies, BetterAuthOptions, BetterAuthPlugin, BetterAuthRateLimitOptions, ClientAtomListener, ClientFetchOption, ClientStore, GenerateIdFn, GenericEndpointContext, HookEndpointContext, InternalAdapter, LiteralString, LiteralUnion, Prettify, StandardSchemaV1 };
@@ -1,2 +1,2 @@
1
- import { An as validateAuthorizationCode, Bn as OAuth2UserInfo, Fn as refreshAccessToken, Hn as ProviderOptions, In as createAuthorizationURL, Ln as clientCredentialsToken, Mn as generateCodeChallenge, Nn as getOAuth2Tokens, Pn as createRefreshAccessTokenRequest, Rn as createClientCredentialsTokenRequest, Vn as OAuthProvider, jn as validateToken, kn as createAuthorizationCodeRequest, zn as OAuth2Tokens } from "../index-BfhTkcnW.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-D6KwwQy5.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 AppleNonConformUser, Ct as gitlab, D as VercelOptions, Dn as getApplePublicKey, Dt as LinearOptions, E as socialProviders, En as apple, 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, 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 atlassian, St as GitlabProfile, T as socialProviderList, Tn as AppleProfile, 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 CognitoProfile, _t as reddit, an as GithubProfile, at as zoom, bn as AtlassianOptions, bt as tiktok, cn as FigmaProfile, ct as vk, dn as FacebookProfile, dt as salesforce, en as google, et as LoginType, fn as facebook, ft as RobloxOptions, gn as CognitoOptions, gt as RedditProfile, hn as discord, ht as RedditOptions, in as GithubOptions, it as ZoomProfile, j as PolarProfile, jt as KickOptions, k as vercel, kt as LinearUser, ln as figma, lt as SalesforceOptions, mn as DiscordProfile, mt as roblox, nn as MicrosoftOptions, nt as PronounOption, on as github, ot as VkOption, pn as DiscordOptions, pt as RobloxProfile, q as KakaoOptions, qt as SlackProfile, rn as microsoft, rt as ZoomOptions, sn as FigmaOptions, st as VkProfile, tn as MicrosoftEntraIDProfile, tt as PhoneNumber, un as FacebookOptions, ut as SalesforceProfile, vn as cognito, vt as TiktokOptions, w as SocialProviders, wn as AppleOptions, wt as LinkedInOptions, x as SocialProvider, xn as AtlassianProfile, xt as GitlabOptions, yn as getCognitoPublicKey, yt as TiktokProfile, z as paybin, zt as twitter } from "../index-BfhTkcnW.mjs";
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, 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 };
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-D6KwwQy5.mjs";
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 };
@@ -836,9 +836,16 @@ const google = (options) => {
836
836
  async verifyIdToken(token, nonce) {
837
837
  if (options.disableIdTokenSignIn) return false;
838
838
  if (options.verifyIdToken) return options.verifyIdToken(token, nonce);
839
- const { data: tokenInfo } = await betterFetch(`https://www.googleapis.com/oauth2/v3/tokeninfo?id_token=${token}`);
840
- if (!tokenInfo) return false;
841
- return tokenInfo.aud === options.clientId && (tokenInfo.iss === "https://accounts.google.com" || tokenInfo.iss === "accounts.google.com");
839
+ const { kid, alg: jwtAlg } = decodeProtectedHeader(token);
840
+ if (!kid || !jwtAlg) return false;
841
+ const { payload: jwtClaims } = await jwtVerify(token, await getGooglePublicKey(kid), {
842
+ algorithms: [jwtAlg],
843
+ issuer: ["https://accounts.google.com", "accounts.google.com"],
844
+ audience: options.clientId,
845
+ maxTokenAge: "1h"
846
+ });
847
+ if (nonce && jwtClaims.nonce !== nonce) return false;
848
+ return true;
842
849
  },
843
850
  async getUserInfo(token) {
844
851
  if (options.getUserInfo) return options.getUserInfo(token);
@@ -860,6 +867,13 @@ const google = (options) => {
860
867
  options
861
868
  };
862
869
  };
870
+ const getGooglePublicKey = async (kid) => {
871
+ const { data } = await betterFetch("https://www.googleapis.com/oauth2/v3/certs");
872
+ if (!data?.keys) throw new APIError("BAD_REQUEST", { message: "Keys not found" });
873
+ const jwk = data.keys.find((key) => key.kid === kid);
874
+ if (!jwk) throw new Error(`JWK with kid ${kid} not found`);
875
+ return await importJWK(jwk, jwk.alg);
876
+ };
863
877
 
864
878
  //#endregion
865
879
  //#region src/social-providers/huggingface.ts
@@ -1023,6 +1037,16 @@ const kick = (options) => {
1023
1037
  codeVerifier
1024
1038
  });
1025
1039
  },
1040
+ refreshAccessToken: options.refreshAccessToken ? options.refreshAccessToken : async (refreshToken) => {
1041
+ return refreshAccessToken({
1042
+ refreshToken,
1043
+ options: {
1044
+ clientId: options.clientId,
1045
+ clientSecret: options.clientSecret
1046
+ },
1047
+ tokenEndpoint: "https://id.kick.com/oauth/token"
1048
+ });
1049
+ },
1026
1050
  async getUserInfo(token) {
1027
1051
  if (options.getUserInfo) return options.getUserInfo(token);
1028
1052
  const { data, error } = await betterFetch("https://api.kick.com/public/v1/users", {
@@ -2577,4 +2601,4 @@ const socialProviderList = Object.keys(socialProviders);
2577
2601
  const SocialProviderListEnum = z.enum(socialProviderList).or(z.string());
2578
2602
 
2579
2603
  //#endregion
2580
- export { SocialProviderListEnum, apple, atlassian, cognito, discord, dropbox, facebook, figma, getApplePublicKey, getCognitoPublicKey, 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 };
2604
+ export { SocialProviderListEnum, 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,15 +1,16 @@
1
1
  {
2
2
  "name": "@better-auth/core",
3
- "version": "1.4.6-beta.3",
3
+ "version": "1.4.6",
4
4
  "description": "The most comprehensive authentication framework for TypeScript.",
5
5
  "type": "module",
6
6
  "repository": {
7
7
  "type": "git",
8
- "url": "https://github.com/better-auth/better-auth",
8
+ "url": "git+https://github.com/better-auth/better-auth.git",
9
9
  "directory": "packages/core"
10
10
  },
11
11
  "main": "./dist/index.mjs",
12
12
  "module": "./dist/index.mjs",
13
+ "types": "./dist/index.d.mts",
13
14
  "exports": {
14
15
  ".": {
15
16
  "dev-source": "./src/index.ts",
@@ -107,7 +108,7 @@
107
108
  "devDependencies": {
108
109
  "@better-auth/utils": "0.3.0",
109
110
  "@better-fetch/fetch": "1.1.18",
110
- "better-call": "1.1.4",
111
+ "better-call": "1.1.5",
111
112
  "jose": "^6.1.0",
112
113
  "kysely": "^0.28.5",
113
114
  "nanostores": "^1.0.1",
@@ -120,7 +121,7 @@
120
121
  "peerDependencies": {
121
122
  "@better-auth/utils": "0.3.0",
122
123
  "@better-fetch/fetch": "1.1.18",
123
- "better-call": "1.1.4",
124
+ "better-call": "1.1.5",
124
125
  "jose": "^6.1.0",
125
126
  "kysely": "^0.28.5",
126
127
  "nanostores": "^1.0.1"
@@ -130,6 +131,7 @@
130
131
  "dev": "tsdown --watch",
131
132
  "lint:package": "publint run --strict",
132
133
  "typecheck": "tsc --project tsconfig.json",
133
- "test": "vitest"
134
+ "test": "vitest",
135
+ "coverage": "vitest run --coverage"
134
136
  }
135
137
  }
@@ -1,4 +1,4 @@
1
- import { getColorDepth, logger, TTY_COLORS } from "../../env";
1
+ import { createLogger, getColorDepth, TTY_COLORS } from "../../env";
2
2
  import { BetterAuthError } from "../../error";
3
3
  import type { BetterAuthOptions } from "../../types";
4
4
  import { safeJSONParse } from "../../utils/json";
@@ -64,11 +64,13 @@ export const createAdapterFactory =
64
64
  adapterName: cfg.adapterName ?? cfg.adapterId,
65
65
  supportsNumericIds: cfg.supportsNumericIds ?? true,
66
66
  supportsUUIDs: cfg.supportsUUIDs ?? false,
67
+ supportsArrays: cfg.supportsArrays ?? false,
67
68
  transaction: cfg.transaction ?? false,
68
69
  disableTransformInput: cfg.disableTransformInput ?? false,
69
70
  disableTransformOutput: cfg.disableTransformOutput ?? false,
70
71
  disableTransformJoin: cfg.disableTransformJoin ?? false,
71
72
  } satisfies AdapterFactoryConfig;
73
+
72
74
  const useNumberId =
73
75
  options.advanced?.database?.useNumberId === true ||
74
76
  options.advanced?.database?.generateId === "serial";
@@ -83,6 +85,7 @@ export const createAdapterFactory =
83
85
 
84
86
  const debugLog = (...args: any[]) => {
85
87
  if (config.debugLogs === true || typeof config.debugLogs === "object") {
88
+ const logger = createLogger({ level: "info" });
86
89
  // If we're running adapter tests, we'll keep debug logs in memory, then print them out if a test fails.
87
90
  if (
88
91
  typeof config.debugLogs === "object" &&
@@ -138,6 +141,8 @@ export const createAdapterFactory =
138
141
  }
139
142
  };
140
143
 
144
+ const logger = createLogger(options.logger);
145
+
141
146
  const getDefaultModelName = initGetDefaultModelName({
142
147
  usePlural: config.usePlural,
143
148
  schema,
@@ -248,7 +253,7 @@ export const createAdapterFactory =
248
253
  ) {
249
254
  newValue = JSON.stringify(newValue);
250
255
  } else if (
251
- config.supportsJSON === false &&
256
+ config.supportsArrays === false &&
252
257
  Array.isArray(newValue) &&
253
258
  (fieldAttributes!.type === "string[]" ||
254
259
  fieldAttributes!.type === "number[]")
@@ -343,7 +348,7 @@ export const createAdapterFactory =
343
348
  ) {
344
349
  newValue = safeJSONParse(newValue);
345
350
  } else if (
346
- config.supportsJSON === false &&
351
+ config.supportsArrays === false &&
347
352
  typeof newValue === "string" &&
348
353
  (field.type === "string[]" || field.type === "number[]")
349
354
  ) {
@@ -1358,5 +1363,6 @@ function formatAction(action: string) {
1358
1363
 
1359
1364
  /**
1360
1365
  * @deprecated Use `createAdapterFactory` instead. This export will be removed in a future version.
1366
+ * @alias
1361
1367
  */
1362
1368
  export const createAdapter = createAdapterFactory;
@@ -112,6 +112,14 @@ export interface DBAdapterFactoryConfig<
112
112
  * @default true
113
113
  */
114
114
  supportsBooleans?: boolean | undefined;
115
+ /**
116
+ * If the database doesn't support arrays, set this to `false`.
117
+ *
118
+ * We will handle the translation between using `array`s, and saving `string`s to the database.
119
+ *
120
+ * @default false
121
+ */
122
+ supportsArrays?: boolean | undefined;
115
123
  /**
116
124
  * Execute multiple operations in a transaction.
117
125
  *
package/src/env/logger.ts CHANGED
@@ -55,12 +55,10 @@ export interface Logger {
55
55
  | undefined;
56
56
  }
57
57
 
58
- export type LogHandlerParams = Parameters<NonNullable<Logger["log"]>> extends [
59
- LogLevel,
60
- ...infer Rest,
61
- ]
62
- ? Rest
63
- : never;
58
+ export type LogHandlerParams =
59
+ Parameters<NonNullable<Logger["log"]>> extends [LogLevel, ...infer Rest]
60
+ ? Rest
61
+ : never;
64
62
 
65
63
  const levelColors: Record<LogLevel, string> = {
66
64
  info: TTY_COLORS.fg.blue,
@@ -1,5 +1,6 @@
1
1
  import { betterFetch } from "@better-fetch/fetch";
2
- import { decodeJwt } from "jose";
2
+ import { APIError } from "better-call";
3
+ import { decodeJwt, decodeProtectedHeader, importJWK, jwtVerify } from "jose";
3
4
  import { logger } from "../env";
4
5
  import { BetterAuthError } from "../error";
5
6
  import type { OAuthProvider, ProviderOptions } from "../oauth2";
@@ -126,24 +127,26 @@ export const google = (options: GoogleOptions) => {
126
127
  if (options.verifyIdToken) {
127
128
  return options.verifyIdToken(token, nonce);
128
129
  }
129
- const googlePublicKeyUrl = `https://www.googleapis.com/oauth2/v3/tokeninfo?id_token=${token}`;
130
- const { data: tokenInfo } = await betterFetch<{
131
- aud: string;
132
- iss: string;
133
- email: string;
134
- email_verified: boolean;
135
- name: string;
136
- picture: string;
137
- sub: string;
138
- }>(googlePublicKeyUrl);
139
- if (!tokenInfo) {
130
+
131
+ // Verify JWT integrity
132
+ // See https://developers.google.com/identity/sign-in/web/backend-auth#verify-the-integrity-of-the-id-token
133
+
134
+ const { kid, alg: jwtAlg } = decodeProtectedHeader(token);
135
+ if (!kid || !jwtAlg) return false;
136
+
137
+ const publicKey = await getGooglePublicKey(kid);
138
+ const { payload: jwtClaims } = await jwtVerify(token, publicKey, {
139
+ algorithms: [jwtAlg],
140
+ issuer: ["https://accounts.google.com", "accounts.google.com"],
141
+ audience: options.clientId,
142
+ maxTokenAge: "1h",
143
+ });
144
+
145
+ if (nonce && jwtClaims.nonce !== nonce) {
140
146
  return false;
141
147
  }
142
- const isValid =
143
- tokenInfo.aud === options.clientId &&
144
- (tokenInfo.iss === "https://accounts.google.com" ||
145
- tokenInfo.iss === "accounts.google.com");
146
- return isValid;
148
+
149
+ return true;
147
150
  },
148
151
  async getUserInfo(token) {
149
152
  if (options.getUserInfo) {
@@ -169,3 +172,29 @@ export const google = (options: GoogleOptions) => {
169
172
  options,
170
173
  } satisfies OAuthProvider<GoogleProfile>;
171
174
  };
175
+
176
+ export const getGooglePublicKey = async (kid: string) => {
177
+ const { data } = await betterFetch<{
178
+ keys: Array<{
179
+ kid: string;
180
+ alg: string;
181
+ kty: string;
182
+ use: string;
183
+ n: string;
184
+ e: string;
185
+ }>;
186
+ }>("https://www.googleapis.com/oauth2/v3/certs");
187
+
188
+ if (!data?.keys) {
189
+ throw new APIError("BAD_REQUEST", {
190
+ message: "Keys not found",
191
+ });
192
+ }
193
+
194
+ const jwk = data.keys.find((key) => key.kid === kid);
195
+ if (!jwk) {
196
+ throw new Error(`JWK with kid ${kid} not found`);
197
+ }
198
+
199
+ return await importJWK(jwk, jwk.alg);
200
+ };
@@ -1,6 +1,10 @@
1
1
  import { betterFetch } from "@better-fetch/fetch";
2
2
  import type { OAuthProvider, ProviderOptions } from "../oauth2";
3
- import { createAuthorizationURL, validateAuthorizationCode } from "../oauth2";
3
+ import {
4
+ createAuthorizationURL,
5
+ refreshAccessToken,
6
+ validateAuthorizationCode,
7
+ } from "../oauth2";
4
8
 
5
9
  export interface KickProfile {
6
10
  /**
@@ -53,6 +57,18 @@ export const kick = (options: KickOptions) => {
53
57
  codeVerifier,
54
58
  });
55
59
  },
60
+ refreshAccessToken: options.refreshAccessToken
61
+ ? options.refreshAccessToken
62
+ : async (refreshToken) => {
63
+ return refreshAccessToken({
64
+ refreshToken,
65
+ options: {
66
+ clientId: options.clientId,
67
+ clientSecret: options.clientSecret,
68
+ },
69
+ tokenEndpoint: "https://id.kick.com/oauth/token",
70
+ });
71
+ },
56
72
  async getUserInfo(token) {
57
73
  if (options.getUserInfo) {
58
74
  return options.getUserInfo(token);
@@ -995,7 +995,7 @@ export type BetterAuthOptions = {
995
995
  */
996
996
  before?: (
997
997
  user: User & Record<string, unknown>,
998
- context?: GenericEndpointContext,
998
+ context: GenericEndpointContext | null,
999
999
  ) => Promise<
1000
1000
  | boolean
1001
1001
  | void
@@ -1008,7 +1008,7 @@ export type BetterAuthOptions = {
1008
1008
  */
1009
1009
  after?: (
1010
1010
  user: User & Record<string, unknown>,
1011
- context?: GenericEndpointContext,
1011
+ context: GenericEndpointContext | null,
1012
1012
  ) => Promise<void>;
1013
1013
  };
1014
1014
  update?: {
@@ -1019,7 +1019,7 @@ export type BetterAuthOptions = {
1019
1019
  */
1020
1020
  before?: (
1021
1021
  user: Partial<User> & Record<string, unknown>,
1022
- context?: GenericEndpointContext,
1022
+ context: GenericEndpointContext | null,
1023
1023
  ) => Promise<
1024
1024
  | boolean
1025
1025
  | void
@@ -1032,7 +1032,7 @@ export type BetterAuthOptions = {
1032
1032
  */
1033
1033
  after?: (
1034
1034
  user: User & Record<string, unknown>,
1035
- context?: GenericEndpointContext,
1035
+ context: GenericEndpointContext | null,
1036
1036
  ) => Promise<void>;
1037
1037
  };
1038
1038
  delete?: {
@@ -1042,14 +1042,14 @@ export type BetterAuthOptions = {
1042
1042
  */
1043
1043
  before?: (
1044
1044
  user: User & Record<string, unknown>,
1045
- context?: GenericEndpointContext,
1045
+ context: GenericEndpointContext | null,
1046
1046
  ) => Promise<boolean | void>;
1047
1047
  /**
1048
1048
  * Hook that is called after a user is deleted.
1049
1049
  */
1050
1050
  after?: (
1051
1051
  user: User & Record<string, unknown>,
1052
- context?: GenericEndpointContext,
1052
+ context: GenericEndpointContext | null,
1053
1053
  ) => Promise<void>;
1054
1054
  };
1055
1055
  };
@@ -1065,7 +1065,7 @@ export type BetterAuthOptions = {
1065
1065
  */
1066
1066
  before?: (
1067
1067
  session: Session & Record<string, unknown>,
1068
- context?: GenericEndpointContext,
1068
+ context: GenericEndpointContext | null,
1069
1069
  ) => Promise<
1070
1070
  | boolean
1071
1071
  | void
@@ -1078,7 +1078,7 @@ export type BetterAuthOptions = {
1078
1078
  */
1079
1079
  after?: (
1080
1080
  session: Session & Record<string, unknown>,
1081
- context?: GenericEndpointContext,
1081
+ context: GenericEndpointContext | null,
1082
1082
  ) => Promise<void>;
1083
1083
  };
1084
1084
  /**
@@ -1092,7 +1092,7 @@ export type BetterAuthOptions = {
1092
1092
  */
1093
1093
  before?: (
1094
1094
  session: Partial<Session> & Record<string, unknown>,
1095
- context?: GenericEndpointContext,
1095
+ context: GenericEndpointContext | null,
1096
1096
  ) => Promise<
1097
1097
  | boolean
1098
1098
  | void
@@ -1105,7 +1105,7 @@ export type BetterAuthOptions = {
1105
1105
  */
1106
1106
  after?: (
1107
1107
  session: Session & Record<string, unknown>,
1108
- context?: GenericEndpointContext,
1108
+ context: GenericEndpointContext | null,
1109
1109
  ) => Promise<void>;
1110
1110
  };
1111
1111
  delete?: {
@@ -1115,14 +1115,14 @@ export type BetterAuthOptions = {
1115
1115
  */
1116
1116
  before?: (
1117
1117
  session: Session & Record<string, unknown>,
1118
- context?: GenericEndpointContext,
1118
+ context: GenericEndpointContext | null,
1119
1119
  ) => Promise<boolean | void>;
1120
1120
  /**
1121
1121
  * Hook that is called after a session is deleted.
1122
1122
  */
1123
1123
  after?: (
1124
1124
  session: Session & Record<string, unknown>,
1125
- context?: GenericEndpointContext,
1125
+ context: GenericEndpointContext | null,
1126
1126
  ) => Promise<void>;
1127
1127
  };
1128
1128
  };
@@ -1138,7 +1138,7 @@ export type BetterAuthOptions = {
1138
1138
  */
1139
1139
  before?: (
1140
1140
  account: Account,
1141
- context?: GenericEndpointContext,
1141
+ context: GenericEndpointContext | null,
1142
1142
  ) => Promise<
1143
1143
  | boolean
1144
1144
  | void
@@ -1151,7 +1151,7 @@ export type BetterAuthOptions = {
1151
1151
  */
1152
1152
  after?: (
1153
1153
  account: Account,
1154
- context?: GenericEndpointContext,
1154
+ context: GenericEndpointContext | null,
1155
1155
  ) => Promise<void>;
1156
1156
  };
1157
1157
  /**
@@ -1165,7 +1165,7 @@ export type BetterAuthOptions = {
1165
1165
  */
1166
1166
  before?: (
1167
1167
  account: Partial<Account> & Record<string, unknown>,
1168
- context?: GenericEndpointContext,
1168
+ context: GenericEndpointContext | null,
1169
1169
  ) => Promise<
1170
1170
  | boolean
1171
1171
  | void
@@ -1178,7 +1178,7 @@ export type BetterAuthOptions = {
1178
1178
  */
1179
1179
  after?: (
1180
1180
  account: Account & Record<string, unknown>,
1181
- context?: GenericEndpointContext,
1181
+ context: GenericEndpointContext | null,
1182
1182
  ) => Promise<void>;
1183
1183
  };
1184
1184
  delete?: {
@@ -1188,14 +1188,14 @@ export type BetterAuthOptions = {
1188
1188
  */
1189
1189
  before?: (
1190
1190
  account: Account & Record<string, unknown>,
1191
- context?: GenericEndpointContext,
1191
+ context: GenericEndpointContext | null,
1192
1192
  ) => Promise<boolean | void>;
1193
1193
  /**
1194
1194
  * Hook that is called after an account is deleted.
1195
1195
  */
1196
1196
  after?: (
1197
1197
  account: Account & Record<string, unknown>,
1198
- context?: GenericEndpointContext,
1198
+ context: GenericEndpointContext | null,
1199
1199
  ) => Promise<void>;
1200
1200
  };
1201
1201
  };
@@ -1211,7 +1211,7 @@ export type BetterAuthOptions = {
1211
1211
  */
1212
1212
  before?: (
1213
1213
  verification: Verification & Record<string, unknown>,
1214
- context?: GenericEndpointContext,
1214
+ context: GenericEndpointContext | null,
1215
1215
  ) => Promise<
1216
1216
  | boolean
1217
1217
  | void
@@ -1224,7 +1224,7 @@ export type BetterAuthOptions = {
1224
1224
  */
1225
1225
  after?: (
1226
1226
  verification: Verification & Record<string, unknown>,
1227
- context?: GenericEndpointContext,
1227
+ context: GenericEndpointContext | null,
1228
1228
  ) => Promise<void>;
1229
1229
  };
1230
1230
  update?: {
@@ -1235,7 +1235,7 @@ export type BetterAuthOptions = {
1235
1235
  */
1236
1236
  before?: (
1237
1237
  verification: Partial<Verification> & Record<string, unknown>,
1238
- context?: GenericEndpointContext,
1238
+ context: GenericEndpointContext | null,
1239
1239
  ) => Promise<
1240
1240
  | boolean
1241
1241
  | void
@@ -1248,7 +1248,7 @@ export type BetterAuthOptions = {
1248
1248
  */
1249
1249
  after?: (
1250
1250
  verification: Verification & Record<string, unknown>,
1251
- context?: GenericEndpointContext,
1251
+ context: GenericEndpointContext | null,
1252
1252
  ) => Promise<void>;
1253
1253
  };
1254
1254
  delete?: {
@@ -1258,14 +1258,14 @@ export type BetterAuthOptions = {
1258
1258
  */
1259
1259
  before?: (
1260
1260
  verification: Verification & Record<string, unknown>,
1261
- context?: GenericEndpointContext,
1261
+ context: GenericEndpointContext | null,
1262
1262
  ) => Promise<boolean | void>;
1263
1263
  /**
1264
1264
  * Hook that is called after a verification is deleted.
1265
1265
  */
1266
1266
  after?: (
1267
1267
  verification: Verification & Record<string, unknown>,
1268
- context?: GenericEndpointContext,
1268
+ context: GenericEndpointContext | null,
1269
1269
  ) => Promise<void>;
1270
1270
  };
1271
1271
  };