@better-auth/core 1.4.6-beta.3 → 1.4.6-beta.4
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.
- package/.turbo/turbo-build.log +8 -8
- package/dist/api/index.d.mts +1 -1
- package/dist/context/index.d.mts +1 -1
- package/dist/db/adapter/index.d.mts +1 -1
- package/dist/db/adapter/index.mjs +13 -9
- package/dist/db/index.d.mts +1 -1
- package/dist/{index-BfhTkcnW.d.mts → index-Bp1Bfmzt.d.mts} +35 -25
- package/dist/index.d.mts +1 -1
- package/dist/oauth2/index.d.mts +1 -1
- package/dist/social-providers/index.d.mts +2 -2
- package/dist/social-providers/index.mjs +18 -4
- package/package.json +7 -5
- package/src/db/adapter/factory.ts +9 -3
- package/src/db/adapter/index.ts +8 -0
- package/src/env/logger.ts +4 -6
- package/src/social-providers/google.ts +46 -17
- package/src/types/init-options.ts +24 -24
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @better-auth/core@1.4.6-beta.
|
|
2
|
+
> @better-auth/core@1.4.6-beta.4 build /home/runner/work/better-auth/better-auth/packages/core
|
|
3
3
|
> tsdown
|
|
4
4
|
|
|
5
5
|
[34mℹ[39m tsdown [2mv0.17.0[22m powered by rolldown [2mv1.0.0-beta.53[22m
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
[34mℹ[39m entry: [34msrc/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[39m
|
|
8
8
|
[34mℹ[39m tsconfig: [34mtsconfig.json[39m
|
|
9
9
|
[34mℹ[39m Build start
|
|
10
|
-
[34mℹ[39m [2mdist/[22m[1msocial-providers/index.mjs[22m [2m
|
|
11
|
-
[34mℹ[39m [2mdist/[22m[1mdb/adapter/index.mjs[22m [2m
|
|
10
|
+
[34mℹ[39m [2mdist/[22m[1msocial-providers/index.mjs[22m [2m 80.39 kB[22m [2m│ gzip: 10.31 kB[22m
|
|
11
|
+
[34mℹ[39m [2mdist/[22m[1mdb/adapter/index.mjs[22m [2m 38.13 kB[22m [2m│ gzip: 7.79 kB[22m
|
|
12
12
|
[34mℹ[39m [2mdist/[22m[1mdb/index.mjs[22m [2m 1.66 kB[22m [2m│ gzip: 0.54 kB[22m
|
|
13
13
|
[34mℹ[39m [2mdist/[22m[1mapi/index.mjs[22m [2m 0.86 kB[22m [2m│ gzip: 0.42 kB[22m
|
|
14
14
|
[34mℹ[39m [2mdist/[22m[1mcontext/index.mjs[22m [2m 0.77 kB[22m [2m│ gzip: 0.28 kB[22m
|
|
@@ -25,19 +25,19 @@
|
|
|
25
25
|
[34mℹ[39m [2mdist/[22merror-CMXuwPsa.mjs [2m 1.77 kB[22m [2m│ gzip: 0.79 kB[22m
|
|
26
26
|
[34mℹ[39m [2mdist/[22masync_hooks-CrTStdt6.mjs [2m 1.70 kB[22m [2m│ gzip: 0.85 kB[22m
|
|
27
27
|
[34mℹ[39m [2mdist/[22mutils-BqQC77zO.mjs [2m 1.10 kB[22m [2m│ gzip: 0.55 kB[22m
|
|
28
|
-
[34mℹ[39m [2mdist/[22m[32m[1msocial-providers/index.d.mts[22m[39m [2m 3.
|
|
28
|
+
[34mℹ[39m [2mdist/[22m[32m[1msocial-providers/index.d.mts[22m[39m [2m 3.88 kB[22m [2m│ gzip: 1.19 kB[22m
|
|
29
29
|
[34mℹ[39m [2mdist/[22m[32m[1mcontext/index.d.mts[22m[39m [2m 3.02 kB[22m [2m│ gzip: 0.95 kB[22m
|
|
30
30
|
[34mℹ[39m [2mdist/[22m[32m[1merror/index.d.mts[22m[39m [2m 1.84 kB[22m [2m│ gzip: 0.72 kB[22m
|
|
31
31
|
[34mℹ[39m [2mdist/[22m[32m[1mdb/adapter/index.d.mts[22m[39m [2m 1.34 kB[22m [2m│ gzip: 0.42 kB[22m
|
|
32
32
|
[34mℹ[39m [2mdist/[22m[32m[1mutils/index.d.mts[22m[39m [2m 1.19 kB[22m [2m│ gzip: 0.55 kB[22m
|
|
33
33
|
[34mℹ[39m [2mdist/[22m[32m[1mdb/index.d.mts[22m[39m [2m 1.04 kB[22m [2m│ gzip: 0.38 kB[22m
|
|
34
34
|
[34mℹ[39m [2mdist/[22m[32m[1mindex.d.mts[22m[39m [2m 0.86 kB[22m [2m│ gzip: 0.33 kB[22m
|
|
35
|
-
[34mℹ[39m [2mdist/[22m[32m[1moauth2/index.d.mts[22m[39m [2m 0.76 kB[22m [2m│ gzip: 0.
|
|
35
|
+
[34mℹ[39m [2mdist/[22m[32m[1moauth2/index.d.mts[22m[39m [2m 0.76 kB[22m [2m│ gzip: 0.28 kB[22m
|
|
36
36
|
[34mℹ[39m [2mdist/[22m[32m[1menv/index.d.mts[22m[39m [2m 0.59 kB[22m [2m│ gzip: 0.30 kB[22m
|
|
37
37
|
[34mℹ[39m [2mdist/[22m[32m[1mapi/index.d.mts[22m[39m [2m 0.26 kB[22m [2m│ gzip: 0.14 kB[22m
|
|
38
38
|
[34mℹ[39m [2mdist/[22m[32m[1masync_hooks/index.d.mts[22m[39m [2m 0.14 kB[22m [2m│ gzip: 0.10 kB[22m
|
|
39
|
-
[34mℹ[39m [2mdist/[22m[32mindex-
|
|
39
|
+
[34mℹ[39m [2mdist/[22m[32mindex-Bp1Bfmzt.d.mts[39m [2m218.16 kB[22m [2m│ gzip: 34.38 kB[22m
|
|
40
40
|
[34mℹ[39m [2mdist/[22m[32mindex-D4vfN5ui.d.mts[39m [2m 3.31 kB[22m [2m│ gzip: 1.11 kB[22m
|
|
41
41
|
[34mℹ[39m [2mdist/[22m[32mindex-Da4Ujjef.d.mts[39m [2m 0.24 kB[22m [2m│ gzip: 0.16 kB[22m
|
|
42
|
-
[34mℹ[39m 32 files, total:
|
|
43
|
-
[32m✔[39m Build complete in [
|
|
42
|
+
[34mℹ[39m 32 files, total: 392.08 kB
|
|
43
|
+
[32m✔[39m Build complete in [32m4911ms[39m
|
package/dist/api/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as optionsMiddleware, i as createAuthMiddleware, n as AuthMiddleware, r as createAuthEndpoint, t as AuthEndpoint } from "../index-
|
|
1
|
+
import { a as optionsMiddleware, i as createAuthMiddleware, n as AuthMiddleware, r as createAuthEndpoint, t as AuthEndpoint } from "../index-Bp1Bfmzt.mjs";
|
|
2
2
|
export { AuthEndpoint, AuthMiddleware, createAuthEndpoint, createAuthMiddleware, optionsMiddleware };
|
package/dist/context/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Kn as DBAdapter, Zn as DBTransactionAdapter, f as AuthContext } from "../index-Bp1Bfmzt.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
|
|
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-Bp1Bfmzt.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.
|
|
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.
|
|
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
|
|
package/dist/db/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Ar as
|
|
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-Bp1Bfmzt.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 {
|
|
@@ -7157,13 +7167,13 @@ type BetterAuthOptions = {
|
|
|
7157
7167
|
* if the hook returns false, the user will not be created.
|
|
7158
7168
|
* If the hook returns an object, it'll be used instead of the original data
|
|
7159
7169
|
*/
|
|
7160
|
-
before?: (user: User & Record<string, unknown>, context
|
|
7170
|
+
before?: (user: User & Record<string, unknown>, context: GenericEndpointContext | null) => Promise<boolean | void | {
|
|
7161
7171
|
data: Optional<User> & Record<string, any>;
|
|
7162
7172
|
}>;
|
|
7163
7173
|
/**
|
|
7164
7174
|
* Hook that is called after a user is created.
|
|
7165
7175
|
*/
|
|
7166
|
-
after?: (user: User & Record<string, unknown>, context
|
|
7176
|
+
after?: (user: User & Record<string, unknown>, context: GenericEndpointContext | null) => Promise<void>;
|
|
7167
7177
|
};
|
|
7168
7178
|
update?: {
|
|
7169
7179
|
/**
|
|
@@ -7171,24 +7181,24 @@ type BetterAuthOptions = {
|
|
|
7171
7181
|
* if the hook returns false, the user will not be updated.
|
|
7172
7182
|
* If the hook returns an object, it'll be used instead of the original data
|
|
7173
7183
|
*/
|
|
7174
|
-
before?: (user: Partial<User> & Record<string, unknown>, context
|
|
7184
|
+
before?: (user: Partial<User> & Record<string, unknown>, context: GenericEndpointContext | null) => Promise<boolean | void | {
|
|
7175
7185
|
data: Optional<User & Record<string, any>>;
|
|
7176
7186
|
}>;
|
|
7177
7187
|
/**
|
|
7178
7188
|
* Hook that is called after a user is updated.
|
|
7179
7189
|
*/
|
|
7180
|
-
after?: (user: User & Record<string, unknown>, context
|
|
7190
|
+
after?: (user: User & Record<string, unknown>, context: GenericEndpointContext | null) => Promise<void>;
|
|
7181
7191
|
};
|
|
7182
7192
|
delete?: {
|
|
7183
7193
|
/**
|
|
7184
7194
|
* Hook that is called before a user is deleted.
|
|
7185
7195
|
* if the hook returns false, the user will not be deleted.
|
|
7186
7196
|
*/
|
|
7187
|
-
before?: (user: User & Record<string, unknown>, context
|
|
7197
|
+
before?: (user: User & Record<string, unknown>, context: GenericEndpointContext | null) => Promise<boolean | void>;
|
|
7188
7198
|
/**
|
|
7189
7199
|
* Hook that is called after a user is deleted.
|
|
7190
7200
|
*/
|
|
7191
|
-
after?: (user: User & Record<string, unknown>, context
|
|
7201
|
+
after?: (user: User & Record<string, unknown>, context: GenericEndpointContext | null) => Promise<void>;
|
|
7192
7202
|
};
|
|
7193
7203
|
};
|
|
7194
7204
|
/**
|
|
@@ -7201,13 +7211,13 @@ type BetterAuthOptions = {
|
|
|
7201
7211
|
* if the hook returns false, the session will not be created.
|
|
7202
7212
|
* If the hook returns an object, it'll be used instead of the original data
|
|
7203
7213
|
*/
|
|
7204
|
-
before?: (session: Session & Record<string, unknown>, context
|
|
7214
|
+
before?: (session: Session & Record<string, unknown>, context: GenericEndpointContext | null) => Promise<boolean | void | {
|
|
7205
7215
|
data: Optional<Session> & Record<string, any>;
|
|
7206
7216
|
}>;
|
|
7207
7217
|
/**
|
|
7208
7218
|
* Hook that is called after a session is created.
|
|
7209
7219
|
*/
|
|
7210
|
-
after?: (session: Session & Record<string, unknown>, context
|
|
7220
|
+
after?: (session: Session & Record<string, unknown>, context: GenericEndpointContext | null) => Promise<void>;
|
|
7211
7221
|
};
|
|
7212
7222
|
/**
|
|
7213
7223
|
* Update hook
|
|
@@ -7218,24 +7228,24 @@ type BetterAuthOptions = {
|
|
|
7218
7228
|
* if the hook returns false, the session will not be updated.
|
|
7219
7229
|
* If the hook returns an object, it'll be used instead of the original data
|
|
7220
7230
|
*/
|
|
7221
|
-
before?: (session: Partial<Session> & Record<string, unknown>, context
|
|
7231
|
+
before?: (session: Partial<Session> & Record<string, unknown>, context: GenericEndpointContext | null) => Promise<boolean | void | {
|
|
7222
7232
|
data: Optional<Session & Record<string, any>>;
|
|
7223
7233
|
}>;
|
|
7224
7234
|
/**
|
|
7225
7235
|
* Hook that is called after a session is updated.
|
|
7226
7236
|
*/
|
|
7227
|
-
after?: (session: Session & Record<string, unknown>, context
|
|
7237
|
+
after?: (session: Session & Record<string, unknown>, context: GenericEndpointContext | null) => Promise<void>;
|
|
7228
7238
|
};
|
|
7229
7239
|
delete?: {
|
|
7230
7240
|
/**
|
|
7231
7241
|
* Hook that is called before a session is deleted.
|
|
7232
7242
|
* if the hook returns false, the session will not be deleted.
|
|
7233
7243
|
*/
|
|
7234
|
-
before?: (session: Session & Record<string, unknown>, context
|
|
7244
|
+
before?: (session: Session & Record<string, unknown>, context: GenericEndpointContext | null) => Promise<boolean | void>;
|
|
7235
7245
|
/**
|
|
7236
7246
|
* Hook that is called after a session is deleted.
|
|
7237
7247
|
*/
|
|
7238
|
-
after?: (session: Session & Record<string, unknown>, context
|
|
7248
|
+
after?: (session: Session & Record<string, unknown>, context: GenericEndpointContext | null) => Promise<void>;
|
|
7239
7249
|
};
|
|
7240
7250
|
};
|
|
7241
7251
|
/**
|
|
@@ -7248,13 +7258,13 @@ type BetterAuthOptions = {
|
|
|
7248
7258
|
* If the hook returns false, the account will not be created.
|
|
7249
7259
|
* If the hook returns an object, it'll be used instead of the original data
|
|
7250
7260
|
*/
|
|
7251
|
-
before?: (account: Account, context
|
|
7261
|
+
before?: (account: Account, context: GenericEndpointContext | null) => Promise<boolean | void | {
|
|
7252
7262
|
data: Optional<Account> & Record<string, any>;
|
|
7253
7263
|
}>;
|
|
7254
7264
|
/**
|
|
7255
7265
|
* Hook that is called after a account is created.
|
|
7256
7266
|
*/
|
|
7257
|
-
after?: (account: Account, context
|
|
7267
|
+
after?: (account: Account, context: GenericEndpointContext | null) => Promise<void>;
|
|
7258
7268
|
};
|
|
7259
7269
|
/**
|
|
7260
7270
|
* Update hook
|
|
@@ -7265,24 +7275,24 @@ type BetterAuthOptions = {
|
|
|
7265
7275
|
* If the hook returns false, the user will not be updated.
|
|
7266
7276
|
* If the hook returns an object, it'll be used instead of the original data
|
|
7267
7277
|
*/
|
|
7268
|
-
before?: (account: Partial<Account> & Record<string, unknown>, context
|
|
7278
|
+
before?: (account: Partial<Account> & Record<string, unknown>, context: GenericEndpointContext | null) => Promise<boolean | void | {
|
|
7269
7279
|
data: Optional<Account & Record<string, any>>;
|
|
7270
7280
|
}>;
|
|
7271
7281
|
/**
|
|
7272
7282
|
* Hook that is called after a account is updated.
|
|
7273
7283
|
*/
|
|
7274
|
-
after?: (account: Account & Record<string, unknown>, context
|
|
7284
|
+
after?: (account: Account & Record<string, unknown>, context: GenericEndpointContext | null) => Promise<void>;
|
|
7275
7285
|
};
|
|
7276
7286
|
delete?: {
|
|
7277
7287
|
/**
|
|
7278
7288
|
* Hook that is called before an account is deleted.
|
|
7279
7289
|
* if the hook returns false, the account will not be deleted.
|
|
7280
7290
|
*/
|
|
7281
|
-
before?: (account: Account & Record<string, unknown>, context
|
|
7291
|
+
before?: (account: Account & Record<string, unknown>, context: GenericEndpointContext | null) => Promise<boolean | void>;
|
|
7282
7292
|
/**
|
|
7283
7293
|
* Hook that is called after an account is deleted.
|
|
7284
7294
|
*/
|
|
7285
|
-
after?: (account: Account & Record<string, unknown>, context
|
|
7295
|
+
after?: (account: Account & Record<string, unknown>, context: GenericEndpointContext | null) => Promise<void>;
|
|
7286
7296
|
};
|
|
7287
7297
|
};
|
|
7288
7298
|
/**
|
|
@@ -7295,13 +7305,13 @@ type BetterAuthOptions = {
|
|
|
7295
7305
|
* if the hook returns false, the verification will not be created.
|
|
7296
7306
|
* If the hook returns an object, it'll be used instead of the original data
|
|
7297
7307
|
*/
|
|
7298
|
-
before?: (verification: Verification & Record<string, unknown>, context
|
|
7308
|
+
before?: (verification: Verification & Record<string, unknown>, context: GenericEndpointContext | null) => Promise<boolean | void | {
|
|
7299
7309
|
data: Optional<Verification> & Record<string, any>;
|
|
7300
7310
|
}>;
|
|
7301
7311
|
/**
|
|
7302
7312
|
* Hook that is called after a verification is created.
|
|
7303
7313
|
*/
|
|
7304
|
-
after?: (verification: Verification & Record<string, unknown>, context
|
|
7314
|
+
after?: (verification: Verification & Record<string, unknown>, context: GenericEndpointContext | null) => Promise<void>;
|
|
7305
7315
|
};
|
|
7306
7316
|
update?: {
|
|
7307
7317
|
/**
|
|
@@ -7309,24 +7319,24 @@ type BetterAuthOptions = {
|
|
|
7309
7319
|
* if the hook returns false, the verification will not be updated.
|
|
7310
7320
|
* If the hook returns an object, it'll be used instead of the original data
|
|
7311
7321
|
*/
|
|
7312
|
-
before?: (verification: Partial<Verification> & Record<string, unknown>, context
|
|
7322
|
+
before?: (verification: Partial<Verification> & Record<string, unknown>, context: GenericEndpointContext | null) => Promise<boolean | void | {
|
|
7313
7323
|
data: Optional<Verification & Record<string, any>>;
|
|
7314
7324
|
}>;
|
|
7315
7325
|
/**
|
|
7316
7326
|
* Hook that is called after a verification is updated.
|
|
7317
7327
|
*/
|
|
7318
|
-
after?: (verification: Verification & Record<string, unknown>, context
|
|
7328
|
+
after?: (verification: Verification & Record<string, unknown>, context: GenericEndpointContext | null) => Promise<void>;
|
|
7319
7329
|
};
|
|
7320
7330
|
delete?: {
|
|
7321
7331
|
/**
|
|
7322
7332
|
* Hook that is called before a verification is deleted.
|
|
7323
7333
|
* if the hook returns false, the verification will not be deleted.
|
|
7324
7334
|
*/
|
|
7325
|
-
before?: (verification: Verification & Record<string, unknown>, context
|
|
7335
|
+
before?: (verification: Verification & Record<string, unknown>, context: GenericEndpointContext | null) => Promise<boolean | void>;
|
|
7326
7336
|
/**
|
|
7327
7337
|
* Hook that is called after a verification is deleted.
|
|
7328
7338
|
*/
|
|
7329
|
-
after?: (verification: Verification & Record<string, unknown>, context
|
|
7339
|
+
after?: (verification: Verification & Record<string, unknown>, context: GenericEndpointContext | null) => Promise<void>;
|
|
7330
7340
|
};
|
|
7331
7341
|
};
|
|
7332
7342
|
} | undefined;
|
|
@@ -7738,4 +7748,4 @@ declare const createAuthEndpoint: <Path extends string, Opts extends EndpointOpt
|
|
|
7738
7748
|
type AuthEndpoint = ReturnType<typeof createAuthEndpoint>;
|
|
7739
7749
|
type AuthMiddleware = ReturnType<typeof createAuthMiddleware>;
|
|
7740
7750
|
//#endregion
|
|
7741
|
-
export { AccountStatus as $,
|
|
7751
|
+
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 {
|
|
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-Bp1Bfmzt.mjs";
|
|
2
2
|
export { AuthContext, BetterAuthAdvancedOptions, BetterAuthClientOptions, BetterAuthClientPlugin, BetterAuthCookies, BetterAuthOptions, BetterAuthPlugin, BetterAuthRateLimitOptions, ClientAtomListener, ClientFetchOption, ClientStore, GenerateIdFn, GenericEndpointContext, HookEndpointContext, InternalAdapter, LiteralString, LiteralUnion, Prettify, StandardSchemaV1 };
|
package/dist/oauth2/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { An as
|
|
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-Bp1Bfmzt.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
|
|
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-Bp1Bfmzt.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 {
|
|
840
|
-
if (!
|
|
841
|
-
|
|
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
|
|
@@ -2577,4 +2591,4 @@ const socialProviderList = Object.keys(socialProviders);
|
|
|
2577
2591
|
const SocialProviderListEnum = z.enum(socialProviderList).or(z.string());
|
|
2578
2592
|
|
|
2579
2593
|
//#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 };
|
|
2594
|
+
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
|
+
"version": "1.4.6-beta.4",
|
|
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.
|
|
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.
|
|
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 {
|
|
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.
|
|
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.
|
|
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;
|
package/src/db/adapter/index.ts
CHANGED
|
@@ -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 =
|
|
59
|
-
LogLevel,
|
|
60
|
-
|
|
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 {
|
|
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
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
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
|
-
|
|
143
|
-
|
|
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
|
+
};
|
|
@@ -995,7 +995,7 @@ export type BetterAuthOptions = {
|
|
|
995
995
|
*/
|
|
996
996
|
before?: (
|
|
997
997
|
user: User & Record<string, unknown>,
|
|
998
|
-
context
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
1268
|
+
context: GenericEndpointContext | null,
|
|
1269
1269
|
) => Promise<void>;
|
|
1270
1270
|
};
|
|
1271
1271
|
};
|