@better-auth/core 1.5.0-beta.1 → 1.5.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +12 -12
- package/LICENSE.md +15 -12
- package/dist/api/index.d.mts +1 -1
- package/dist/api/index.mjs +1 -1
- package/dist/context/index.d.mts +1 -1
- package/dist/context/index.mjs +1 -1
- package/dist/{context-DblZrIwO.mjs → context-BBNwughv.mjs} +19 -0
- package/dist/db/adapter/index.d.mts +1 -1
- package/dist/db/adapter/index.mjs +2 -2
- package/dist/db/index.d.mts +1 -1
- package/dist/error/index.d.mts +4 -0
- package/dist/error/index.mjs +2 -2
- package/dist/{error-Dj5gH2lv.mjs → error-GNtLPYaS.mjs} +2 -1
- package/dist/{index-oZTwg35a.d.mts → index-CGr4Qrv8.d.mts} +212 -6
- package/dist/index.d.mts +2 -2
- package/dist/oauth2/index.d.mts +1 -1
- package/dist/social-providers/index.d.mts +1 -1
- package/dist/social-providers/index.mjs +2 -2
- package/dist/utils/index.d.mts +10 -1
- package/dist/utils/index.mjs +2 -2
- package/dist/{utils-s65Fz0OM.mjs → utils-puAL36Bz.mjs} +17 -1
- package/package.json +3 -3
- package/src/context/index.ts +29 -0
- package/src/error/codes.ts +2 -0
- package/src/types/context.ts +50 -1
- package/src/types/index.ts +3 -0
- package/src/types/init-options.ts +28 -1
- package/src/types/plugin.ts +1 -1
- package/src/utils/deprecate.test.ts +72 -0
- package/src/utils/deprecate.ts +21 -0
- package/src/utils/index.ts +1 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @better-auth/core@1.5.0-beta.
|
|
2
|
+
> @better-auth/core@1.5.0-beta.3 build /home/runner/work/better-auth/better-auth/packages/core
|
|
3
3
|
> tsdown
|
|
4
4
|
|
|
5
5
|
[34mℹ[39m tsdown [2mv0.17.2[22m powered by rolldown [2mv1.0.0-beta.53[22m
|
|
@@ -16,28 +16,28 @@
|
|
|
16
16
|
[34mℹ[39m [2mdist/[22m[1moauth2/index.mjs[22m [2m 0.75 kB[22m [2m│ gzip: 0.28 kB[22m
|
|
17
17
|
[34mℹ[39m [2mdist/[22m[1mcontext/index.mjs[22m [2m 0.70 kB[22m [2m│ gzip: 0.24 kB[22m
|
|
18
18
|
[34mℹ[39m [2mdist/[22m[1menv/index.mjs[22m [2m 0.44 kB[22m [2m│ gzip: 0.25 kB[22m
|
|
19
|
-
[34mℹ[39m [2mdist/[22m[1mutils/index.mjs[22m [2m 0.
|
|
19
|
+
[34mℹ[39m [2mdist/[22m[1mutils/index.mjs[22m [2m 0.26 kB[22m [2m│ gzip: 0.18 kB[22m
|
|
20
20
|
[34mℹ[39m [2mdist/[22m[1merror/index.mjs[22m [2m 0.22 kB[22m [2m│ gzip: 0.16 kB[22m
|
|
21
21
|
[34mℹ[39m [2mdist/[22m[1mindex.mjs[22m [2m 0.01 kB[22m [2m│ gzip: 0.03 kB[22m
|
|
22
22
|
[34mℹ[39m [2mdist/[22moauth2-BjWM15hm.mjs [2m 12.82 kB[22m [2m│ gzip: 3.16 kB[22m
|
|
23
23
|
[34mℹ[39m [2mdist/[22menv-DbssmzoK.mjs [2m 7.67 kB[22m [2m│ gzip: 2.54 kB[22m
|
|
24
24
|
[34mℹ[39m [2mdist/[22mget-tables-CMc_Emww.mjs [2m 6.76 kB[22m [2m│ gzip: 1.30 kB[22m
|
|
25
|
-
[34mℹ[39m [2mdist/[22mcontext-
|
|
26
|
-
[34mℹ[39m [2mdist/[22merror-
|
|
27
|
-
[34mℹ[39m [2mdist/[22mutils-
|
|
28
|
-
[34mℹ[39m [2mdist/[22m[32m[1merror/index.d.mts[22m[39m [2m
|
|
29
|
-
[34mℹ[39m [2mdist/[22m[32m[1msocial-providers/index.d.mts[22m[39m [2m 3.
|
|
25
|
+
[34mℹ[39m [2mdist/[22mcontext-BBNwughv.mjs [2m 4.87 kB[22m [2m│ gzip: 1.40 kB[22m
|
|
26
|
+
[34mℹ[39m [2mdist/[22merror-GNtLPYaS.mjs [2m 3.19 kB[22m [2m│ gzip: 1.30 kB[22m
|
|
27
|
+
[34mℹ[39m [2mdist/[22mutils-puAL36Bz.mjs [2m 1.58 kB[22m [2m│ gzip: 0.76 kB[22m
|
|
28
|
+
[34mℹ[39m [2mdist/[22m[32m[1merror/index.d.mts[22m[39m [2m 6.11 kB[22m [2m│ gzip: 1.50 kB[22m
|
|
29
|
+
[34mℹ[39m [2mdist/[22m[32m[1msocial-providers/index.d.mts[22m[39m [2m 3.89 kB[22m [2m│ gzip: 1.20 kB[22m
|
|
30
30
|
[34mℹ[39m [2mdist/[22m[32m[1mcontext/index.d.mts[22m[39m [2m 3.02 kB[22m [2m│ gzip: 0.96 kB[22m
|
|
31
|
+
[34mℹ[39m [2mdist/[22m[32m[1mutils/index.d.mts[22m[39m [2m 1.55 kB[22m [2m│ gzip: 0.70 kB[22m
|
|
31
32
|
[34mℹ[39m [2mdist/[22m[32m[1mdb/adapter/index.d.mts[22m[39m [2m 1.34 kB[22m [2m│ gzip: 0.43 kB[22m
|
|
32
|
-
[34mℹ[39m [2mdist/[22m[32m[
|
|
33
|
-
[34mℹ[39m [2mdist/[22m[32m[1mindex.d.mts[22m[39m [2m 0.92 kB[22m [2m│ gzip: 0.36 kB[22m
|
|
33
|
+
[34mℹ[39m [2mdist/[22m[32m[1mindex.d.mts[22m[39m [2m 1.09 kB[22m [2m│ gzip: 0.39 kB[22m
|
|
34
34
|
[34mℹ[39m [2mdist/[22m[32m[1moauth2/index.d.mts[22m[39m [2m 0.88 kB[22m [2m│ gzip: 0.32 kB[22m
|
|
35
35
|
[34mℹ[39m [2mdist/[22m[32m[1mdb/index.d.mts[22m[39m [2m 0.81 kB[22m [2m│ gzip: 0.34 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.24 kB[22m [2m│ gzip: 0.16 kB[22m
|
|
39
39
|
[34mℹ[39m [2mdist/[22m[32m[1masync_hooks/pure.index.d.mts[22m[39m [2m 0.22 kB[22m [2m│ gzip: 0.16 kB[22m
|
|
40
|
-
[34mℹ[39m [2mdist/[22m[32mindex-
|
|
40
|
+
[34mℹ[39m [2mdist/[22m[32mindex-CGr4Qrv8.d.mts[39m [2m228.51 kB[22m [2m│ gzip: 36.16 kB[22m
|
|
41
41
|
[34mℹ[39m [2mdist/[22m[32mindex-BRBu0-5h.d.mts[39m [2m 3.31 kB[22m [2m│ gzip: 1.11 kB[22m
|
|
42
|
-
[34mℹ[39m 32 files, total:
|
|
43
|
-
[32m✔[39m Build complete in [
|
|
42
|
+
[34mℹ[39m 32 files, total: 415.51 kB
|
|
43
|
+
[32m✔[39m Build complete in [32m5246ms[39m
|
package/LICENSE.md
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
The MIT License (MIT)
|
|
2
2
|
Copyright (c) 2024 - present, Bereket Engida
|
|
3
3
|
|
|
4
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
5
|
-
and associated documentation files (the
|
|
6
|
-
including without limitation the rights to
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
5
|
+
this software and associated documentation files (the “Software”), to deal in
|
|
6
|
+
the Software without restriction, including without limitation the rights to
|
|
7
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
8
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
9
|
+
subject to the following conditions:
|
|
9
10
|
|
|
10
|
-
The above copyright notice and this permission notice shall be included in all
|
|
11
|
-
substantial portions of the Software.
|
|
11
|
+
The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
copies or substantial portions of the Software.
|
|
12
13
|
|
|
13
|
-
THE SOFTWARE IS PROVIDED
|
|
14
|
-
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
16
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
17
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
18
|
+
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
19
|
+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
20
|
+
DEALINGS IN THE SOFTWARE.
|
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-CGr4Qrv8.mjs";
|
|
2
2
|
export { AuthEndpoint, AuthMiddleware, createAuthEndpoint, createAuthMiddleware, optionsMiddleware };
|
package/dist/api/index.mjs
CHANGED
package/dist/context/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Qn as DBAdapter, f as AuthContext, rr as DBTransactionAdapter } from "../index-CGr4Qrv8.mjs";
|
|
2
2
|
import { AsyncLocalStorage } from "@better-auth/core/async_hooks";
|
|
3
3
|
import { EndpointContext, InputContext } from "better-call";
|
|
4
4
|
|
package/dist/context/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as defineRequestState, c as hasRequestState, d as getCurrentAuthContextAsyncLocalStorage, f as runWithEndpointContext, i as runWithTransaction, l as runWithRequestState, n as getCurrentDBAdapterAsyncLocalStorage, o as getCurrentRequestState, r as runWithAdapter, s as getRequestStateAsyncLocalStorage, t as getCurrentAdapter, u as getCurrentAuthContext } from "../context-
|
|
1
|
+
import { a as defineRequestState, c as hasRequestState, d as getCurrentAuthContextAsyncLocalStorage, f as runWithEndpointContext, i as runWithTransaction, l as runWithRequestState, n as getCurrentDBAdapterAsyncLocalStorage, o as getCurrentRequestState, r as runWithAdapter, s as getRequestStateAsyncLocalStorage, t as getCurrentAdapter, u as getCurrentAuthContext } from "../context-BBNwughv.mjs";
|
|
2
2
|
|
|
3
3
|
export { defineRequestState, getCurrentAdapter, getCurrentAuthContext, getCurrentAuthContextAsyncLocalStorage, getCurrentDBAdapterAsyncLocalStorage, getCurrentRequestState, getRequestStateAsyncLocalStorage, hasRequestState, runWithAdapter, runWithEndpointContext, runWithRequestState, runWithTransaction };
|
|
@@ -110,5 +110,24 @@ const runWithTransaction = async (adapter, fn) => {
|
|
|
110
110
|
});
|
|
111
111
|
};
|
|
112
112
|
|
|
113
|
+
//#endregion
|
|
114
|
+
//#region src/context/index.ts
|
|
115
|
+
const glo = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {};
|
|
116
|
+
const importIdentifier = "__ $BETTER_AUTH$ __";
|
|
117
|
+
if (glo[importIdentifier] === true)
|
|
118
|
+
/**
|
|
119
|
+
* Dear reader of this message. Please take this seriously.
|
|
120
|
+
*
|
|
121
|
+
* If you see this message, make sure that you only import one version of Better Auth. In many cases,
|
|
122
|
+
* your package manager installs two versions of Better Auth that are used by different packages within your project.
|
|
123
|
+
*
|
|
124
|
+
* This often leads to issues that are hard to debug. We often need to ensure async local storage instance,
|
|
125
|
+
* If you imported different versions of Better Auth, it is impossible for us to
|
|
126
|
+
* do status synchronization per request anymore - which might break the states.
|
|
127
|
+
*
|
|
128
|
+
*/
|
|
129
|
+
console.error("Better Auth was already imported. This breaks async local storage instance and will lead to issues!");
|
|
130
|
+
glo[importIdentifier] = true;
|
|
131
|
+
|
|
113
132
|
//#endregion
|
|
114
133
|
export { defineRequestState as a, hasRequestState as c, getCurrentAuthContextAsyncLocalStorage as d, runWithEndpointContext as f, runWithTransaction as i, runWithRequestState as l, getCurrentDBAdapterAsyncLocalStorage as n, getCurrentRequestState as o, runWithAdapter as r, getRequestStateAsyncLocalStorage as s, getCurrentAdapter as t, getCurrentAuthContext as u };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $n as
|
|
1
|
+
import { $n as DBAdapterDebugLogOption, Dr as initGetFieldAttributes, Er as initGetFieldName, Or as initGetDefaultModelName, Qn as DBAdapter, Tr as initGetIdField, Xn as CleanedWhere, Zn as CustomAdapter, _r as CreateAdapterOptions, ar as JoinOption, cr as withApplyDefault, dr as createAdapterFactory, er as DBAdapterFactoryConfig, fr as AdapterConfig, gr as AdapterTestDebugLogs, hr as AdapterFactoryOptions, ir as JoinConfig, kr as initGetDefaultFieldName, lr as AdapterFactory, mr as AdapterFactoryCustomizeAdapterCreator, nr as DBAdapterSchemaCreation, or as Where, pr as AdapterFactoryConfig, rr as DBTransactionAdapter, sr as deepmerge, tr as DBAdapterInstance, ur as createAdapter, vr as CreateCustomAdapter, wr as initGetModelName } from "../../index-CGr4Qrv8.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,7 +1,7 @@
|
|
|
1
1
|
import { t as getAuthTables } from "../../get-tables-CMc_Emww.mjs";
|
|
2
2
|
import { i as logger, n as createLogger, o as getColorDepth, t as TTY_COLORS } from "../../env-DbssmzoK.mjs";
|
|
3
|
-
import { n as safeJSONParse, r as generateId } from "../../utils-
|
|
4
|
-
import { n as BetterAuthError } from "../../error-
|
|
3
|
+
import { n as safeJSONParse, r as generateId } from "../../utils-puAL36Bz.mjs";
|
|
4
|
+
import { n as BetterAuthError } from "../../error-GNtLPYaS.mjs";
|
|
5
5
|
|
|
6
6
|
//#region src/db/adapter/get-default-model-name.ts
|
|
7
7
|
const initGetDefaultModelName = ({ usePlural, schema }) => {
|
package/dist/db/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Ar as
|
|
1
|
+
import { Ar as Verification, Br as accountSchema, Fr as Session, Gr as DBFieldAttribute, Hr as getAuthTables, Ir as sessionSchema, Jr as DBPrimitive, Kr as DBFieldAttributeConfig, Lr as RateLimit, Mr as User, Nr as userSchema, Pr as coreSchema, Rr as rateLimitSchema, Ur as BaseModelNames, Vr as BetterAuthPluginDBSchema, Wr as BetterAuthDBSchema, Xr as SecondaryStorage, Yr as ModelNames, jr as verificationSchema, qr as DBFieldType, zr as Account } from "../index-CGr4Qrv8.mjs";
|
|
2
2
|
export { Account, BaseModelNames, BetterAuthDBSchema, BetterAuthPluginDBSchema, DBFieldAttribute, DBFieldAttributeConfig, DBFieldType, DBPrimitive, ModelNames, RateLimit, SecondaryStorage, Session, User, Verification, accountSchema, coreSchema, getAuthTables, rateLimitSchema, sessionSchema, userSchema, verificationSchema };
|
package/dist/error/index.d.mts
CHANGED
|
@@ -110,6 +110,10 @@ declare const BASE_ERROR_CODES: {
|
|
|
110
110
|
code: "USER_ALREADY_HAS_PASSWORD";
|
|
111
111
|
message: "User already has a password. Provide that to delete the account.";
|
|
112
112
|
};
|
|
113
|
+
readonly CROSS_SITE_NAVIGATION_LOGIN_BLOCKED: {
|
|
114
|
+
code: "CROSS_SITE_NAVIGATION_LOGIN_BLOCKED";
|
|
115
|
+
message: "Cross-site navigation login blocked. This request appears to be a CSRF attack.";
|
|
116
|
+
};
|
|
113
117
|
readonly VERIFICATION_EMAIL_NOT_ENABLED: {
|
|
114
118
|
code: "VERIFICATION_EMAIL_NOT_ENABLED";
|
|
115
119
|
message: "Verification email isn't enabled";
|
package/dist/error/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "../env-DbssmzoK.mjs";
|
|
2
|
-
import "../utils-
|
|
3
|
-
import { n as BetterAuthError, r as BASE_ERROR_CODES, t as APIError } from "../error-
|
|
2
|
+
import "../utils-puAL36Bz.mjs";
|
|
3
|
+
import { n as BetterAuthError, r as BASE_ERROR_CODES, t as APIError } from "../error-GNtLPYaS.mjs";
|
|
4
4
|
|
|
5
5
|
export { APIError, BASE_ERROR_CODES, BetterAuthError };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as defineErrorCodes } from "./utils-
|
|
1
|
+
import { i as defineErrorCodes } from "./utils-puAL36Bz.mjs";
|
|
2
2
|
import { APIError } from "better-call/error";
|
|
3
3
|
|
|
4
4
|
//#region src/error/codes.ts
|
|
@@ -30,6 +30,7 @@ const BASE_ERROR_CODES = defineErrorCodes({
|
|
|
30
30
|
FAILED_TO_UNLINK_LAST_ACCOUNT: "You can't unlink your last account",
|
|
31
31
|
ACCOUNT_NOT_FOUND: "Account not found",
|
|
32
32
|
USER_ALREADY_HAS_PASSWORD: "User already has a password. Provide that to delete the account.",
|
|
33
|
+
CROSS_SITE_NAVIGATION_LOGIN_BLOCKED: "Cross-site navigation login blocked. This request appears to be a CSRF attack.",
|
|
33
34
|
VERIFICATION_EMAIL_NOT_ENABLED: "Verification email isn't enabled",
|
|
34
35
|
EMAIL_ALREADY_VERIFIED: "Email is already verified",
|
|
35
36
|
EMAIL_MISMATCH: "Email mismatch",
|
|
@@ -6191,7 +6191,7 @@ type SocialProviderList = typeof socialProviderList;
|
|
|
6191
6191
|
//#region src/types/plugin.d.ts
|
|
6192
6192
|
type DeepPartial<T> = T extends Function ? T : T extends object ? { [K in keyof T]?: DeepPartial<T[K]> } : T;
|
|
6193
6193
|
type HookEndpointContext = Partial<EndpointContext<string, any> & Omit<InputContext<string, any>, "method">> & {
|
|
6194
|
-
path
|
|
6194
|
+
path?: string;
|
|
6195
6195
|
context: AuthContext & {
|
|
6196
6196
|
returned?: unknown | undefined;
|
|
6197
6197
|
responseHeaders?: Headers | undefined;
|
|
@@ -6709,8 +6709,15 @@ type BetterAuthOptions = {
|
|
|
6709
6709
|
* A function that is called when a user verifies their email
|
|
6710
6710
|
* @param user the user that verified their email
|
|
6711
6711
|
* @param request the request object
|
|
6712
|
+
* @deprecated Use `beforeEmailVerification` or `afterEmailVerification` instead. This will be removed in 1.5
|
|
6712
6713
|
*/
|
|
6713
6714
|
onEmailVerification?: (user: User, request?: Request) => Promise<void>;
|
|
6715
|
+
/**
|
|
6716
|
+
* A function that is called before a user verifies their email
|
|
6717
|
+
* @param user the user that verified their email
|
|
6718
|
+
* @param request the request object
|
|
6719
|
+
*/
|
|
6720
|
+
beforeEmailVerification?: (user: User, request?: Request) => Promise<void>;
|
|
6714
6721
|
/**
|
|
6715
6722
|
* A function that is called when a user's email is updated to verified
|
|
6716
6723
|
* @param user the user that verified their email
|
|
@@ -7199,8 +7206,20 @@ type BetterAuthOptions = {
|
|
|
7199
7206
|
*
|
|
7200
7207
|
* Trusted origins will be dynamically
|
|
7201
7208
|
* calculated based on the request.
|
|
7209
|
+
*
|
|
7210
|
+
* @example
|
|
7211
|
+
* ```ts
|
|
7212
|
+
* trustedOrigins: async (request) => {
|
|
7213
|
+
* return [
|
|
7214
|
+
* "https://better-auth.com",
|
|
7215
|
+
* "https://*.better-auth.com",
|
|
7216
|
+
* request.headers.get("x-custom-origin")
|
|
7217
|
+
* ];
|
|
7218
|
+
* }
|
|
7219
|
+
* ```
|
|
7220
|
+
* @returns An array of trusted origins.
|
|
7202
7221
|
*/
|
|
7203
|
-
trustedOrigins?: (string[] | ((request?: Request | undefined) => Awaitable<string[]>)) | undefined;
|
|
7222
|
+
trustedOrigins?: (string[] | ((request?: Request | undefined) => Awaitable<(string | undefined | null)[]>)) | undefined;
|
|
7204
7223
|
/**
|
|
7205
7224
|
* Rate limiting configuration
|
|
7206
7225
|
*/
|
|
@@ -7515,6 +7534,22 @@ type BetterAuthOptions = {
|
|
|
7515
7534
|
};
|
|
7516
7535
|
//#endregion
|
|
7517
7536
|
//#region src/types/context.d.ts
|
|
7537
|
+
/**
|
|
7538
|
+
* Mutators are defined in each plugin
|
|
7539
|
+
*
|
|
7540
|
+
* @example
|
|
7541
|
+
* ```ts
|
|
7542
|
+
* declare module "@better-auth/core" {
|
|
7543
|
+
* interface BetterAuthPluginRegistry<Auth, Context> {
|
|
7544
|
+
* 'jwt': {
|
|
7545
|
+
* creator: typeof jwt
|
|
7546
|
+
* }
|
|
7547
|
+
* }
|
|
7548
|
+
* }
|
|
7549
|
+
* ```
|
|
7550
|
+
*/
|
|
7551
|
+
interface BetterAuthPluginRegistry<Auth, Context> {}
|
|
7552
|
+
type BetterAuthPluginRegistryIdentifier = keyof BetterAuthPluginRegistry<unknown, unknown>;
|
|
7518
7553
|
type GenericEndpointContext<Options extends BetterAuthOptions = BetterAuthOptions> = EndpointContext<string, any> & {
|
|
7519
7554
|
context: AuthContext<Options>;
|
|
7520
7555
|
};
|
|
@@ -7577,7 +7612,24 @@ type CreateCookieGetterFn = (cookieName: string, overrideAttributes?: Partial<Co
|
|
|
7577
7612
|
attributes: CookieOptions;
|
|
7578
7613
|
};
|
|
7579
7614
|
type CheckPasswordFn<Options extends BetterAuthOptions = BetterAuthOptions> = (userId: string, ctx: GenericEndpointContext<Options>) => Promise<boolean>;
|
|
7580
|
-
type
|
|
7615
|
+
type PluginContext = {
|
|
7616
|
+
getPlugin: <ID extends BetterAuthPluginRegistryIdentifier | LiteralString>(pluginId: ID) => (ID extends BetterAuthPluginRegistryIdentifier ? ReturnType<BetterAuthPluginRegistry<unknown, unknown>[ID]["creator"]> : BetterAuthPlugin) | null;
|
|
7617
|
+
/**
|
|
7618
|
+
* Checks if a plugin is enabled by its ID.
|
|
7619
|
+
*
|
|
7620
|
+
* @param pluginId - The ID of the plugin to check
|
|
7621
|
+
* @returns `true` if the plugin is enabled, `false` otherwise
|
|
7622
|
+
*
|
|
7623
|
+
* @example
|
|
7624
|
+
* ```ts
|
|
7625
|
+
* if (ctx.context.hasPlugin("organization")) {
|
|
7626
|
+
* // organization plugin is enabled
|
|
7627
|
+
* }
|
|
7628
|
+
* ```
|
|
7629
|
+
*/
|
|
7630
|
+
hasPlugin: <ID extends BetterAuthPluginRegistryIdentifier | LiteralString>(pluginId: ID) => boolean;
|
|
7631
|
+
};
|
|
7632
|
+
type AuthContext<Options extends BetterAuthOptions = BetterAuthOptions> = PluginContext & {
|
|
7581
7633
|
options: Options;
|
|
7582
7634
|
appName: string;
|
|
7583
7635
|
baseURL: string;
|
|
@@ -7815,13 +7867,167 @@ interface BetterAuthClientPlugin {
|
|
|
7815
7867
|
//#region src/api/index.d.ts
|
|
7816
7868
|
declare const optionsMiddleware: <InputCtx extends better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>>(inputContext: InputCtx) => Promise<AuthContext>;
|
|
7817
7869
|
declare const createAuthMiddleware: {
|
|
7818
|
-
<Options extends better_call0.MiddlewareOptions, R>(options: Options, handler: (ctx: better_call0.MiddlewareContext<Options,
|
|
7870
|
+
<Options extends better_call0.MiddlewareOptions, R>(options: Options, handler: (ctx: better_call0.MiddlewareContext<Options, {
|
|
7819
7871
|
returned?: unknown | undefined;
|
|
7820
7872
|
responseHeaders?: Headers | undefined;
|
|
7873
|
+
} & PluginContext & {
|
|
7874
|
+
options: BetterAuthOptions;
|
|
7875
|
+
appName: string;
|
|
7876
|
+
baseURL: string;
|
|
7877
|
+
trustedOrigins: string[];
|
|
7878
|
+
isTrustedOrigin: (url: string, settings?: {
|
|
7879
|
+
allowRelativePaths: boolean;
|
|
7880
|
+
}) => boolean;
|
|
7881
|
+
oauthConfig: {
|
|
7882
|
+
skipStateCookieCheck?: boolean | undefined;
|
|
7883
|
+
storeStateStrategy: "database" | "cookie";
|
|
7884
|
+
};
|
|
7885
|
+
newSession: {
|
|
7886
|
+
session: Session & Record<string, any>;
|
|
7887
|
+
user: User & Record<string, any>;
|
|
7888
|
+
} | null;
|
|
7889
|
+
session: {
|
|
7890
|
+
session: Session & Record<string, any>;
|
|
7891
|
+
user: User & Record<string, any>;
|
|
7892
|
+
} | null;
|
|
7893
|
+
setNewSession: (session: {
|
|
7894
|
+
session: Session & Record<string, any>;
|
|
7895
|
+
user: User & Record<string, any>;
|
|
7896
|
+
} | null) => void;
|
|
7897
|
+
socialProviders: OAuthProvider[];
|
|
7898
|
+
authCookies: BetterAuthCookies;
|
|
7899
|
+
logger: ReturnType<typeof createLogger>;
|
|
7900
|
+
rateLimit: {
|
|
7901
|
+
enabled: boolean;
|
|
7902
|
+
window: number;
|
|
7903
|
+
max: number;
|
|
7904
|
+
storage: "memory" | "database" | "secondary-storage";
|
|
7905
|
+
} & BetterAuthRateLimitOptions;
|
|
7906
|
+
adapter: DBAdapter<BetterAuthOptions>;
|
|
7907
|
+
internalAdapter: InternalAdapter<BetterAuthOptions>;
|
|
7908
|
+
createAuthCookie: (cookieName: string, overrideAttributes?: Partial<better_call0.CookieOptions> | undefined) => {
|
|
7909
|
+
name: string;
|
|
7910
|
+
attributes: better_call0.CookieOptions;
|
|
7911
|
+
};
|
|
7912
|
+
secret: string;
|
|
7913
|
+
sessionConfig: {
|
|
7914
|
+
updateAge: number;
|
|
7915
|
+
expiresIn: number;
|
|
7916
|
+
freshAge: number;
|
|
7917
|
+
cookieRefreshCache: false | {
|
|
7918
|
+
enabled: true;
|
|
7919
|
+
updateAge: number;
|
|
7920
|
+
};
|
|
7921
|
+
};
|
|
7922
|
+
generateId: (options: {
|
|
7923
|
+
model: ModelNames;
|
|
7924
|
+
size?: number | undefined;
|
|
7925
|
+
}) => string | false;
|
|
7926
|
+
secondaryStorage: SecondaryStorage | undefined;
|
|
7927
|
+
password: {
|
|
7928
|
+
hash: (password: string) => Promise<string>;
|
|
7929
|
+
verify: (data: {
|
|
7930
|
+
password: string;
|
|
7931
|
+
hash: string;
|
|
7932
|
+
}) => Promise<boolean>;
|
|
7933
|
+
config: {
|
|
7934
|
+
minPasswordLength: number;
|
|
7935
|
+
maxPasswordLength: number;
|
|
7936
|
+
};
|
|
7937
|
+
checkPassword: (userId: string, ctx: GenericEndpointContext<BetterAuthOptions>) => Promise<boolean>;
|
|
7938
|
+
};
|
|
7939
|
+
tables: BetterAuthDBSchema;
|
|
7940
|
+
runMigrations: () => Promise<void>;
|
|
7941
|
+
publishTelemetry: (event: {
|
|
7942
|
+
type: string;
|
|
7943
|
+
anonymousId?: string | undefined;
|
|
7944
|
+
payload: Record<string, any>;
|
|
7945
|
+
}) => Promise<void>;
|
|
7946
|
+
skipOriginCheck: boolean;
|
|
7947
|
+
skipCSRFCheck: boolean;
|
|
7948
|
+
runInBackground: (promise: Promise<void>) => void;
|
|
7949
|
+
runInBackgroundOrAwait: (promise: Promise<unknown> | Promise<void> | void | unknown) => Promise<unknown>;
|
|
7821
7950
|
}>) => Promise<R>): (inputContext: better_call0.MiddlewareInputContext<Options>) => Promise<R>;
|
|
7822
|
-
<Options extends better_call0.MiddlewareOptions, R_1>(handler: (ctx: better_call0.MiddlewareContext<Options,
|
|
7951
|
+
<Options extends better_call0.MiddlewareOptions, R_1>(handler: (ctx: better_call0.MiddlewareContext<Options, {
|
|
7823
7952
|
returned?: unknown | undefined;
|
|
7824
7953
|
responseHeaders?: Headers | undefined;
|
|
7954
|
+
} & PluginContext & {
|
|
7955
|
+
options: BetterAuthOptions;
|
|
7956
|
+
appName: string;
|
|
7957
|
+
baseURL: string;
|
|
7958
|
+
trustedOrigins: string[];
|
|
7959
|
+
isTrustedOrigin: (url: string, settings?: {
|
|
7960
|
+
allowRelativePaths: boolean;
|
|
7961
|
+
}) => boolean;
|
|
7962
|
+
oauthConfig: {
|
|
7963
|
+
skipStateCookieCheck?: boolean | undefined;
|
|
7964
|
+
storeStateStrategy: "database" | "cookie";
|
|
7965
|
+
};
|
|
7966
|
+
newSession: {
|
|
7967
|
+
session: Session & Record<string, any>;
|
|
7968
|
+
user: User & Record<string, any>;
|
|
7969
|
+
} | null;
|
|
7970
|
+
session: {
|
|
7971
|
+
session: Session & Record<string, any>;
|
|
7972
|
+
user: User & Record<string, any>;
|
|
7973
|
+
} | null;
|
|
7974
|
+
setNewSession: (session: {
|
|
7975
|
+
session: Session & Record<string, any>;
|
|
7976
|
+
user: User & Record<string, any>;
|
|
7977
|
+
} | null) => void;
|
|
7978
|
+
socialProviders: OAuthProvider[];
|
|
7979
|
+
authCookies: BetterAuthCookies;
|
|
7980
|
+
logger: ReturnType<typeof createLogger>;
|
|
7981
|
+
rateLimit: {
|
|
7982
|
+
enabled: boolean;
|
|
7983
|
+
window: number;
|
|
7984
|
+
max: number;
|
|
7985
|
+
storage: "memory" | "database" | "secondary-storage";
|
|
7986
|
+
} & BetterAuthRateLimitOptions;
|
|
7987
|
+
adapter: DBAdapter<BetterAuthOptions>;
|
|
7988
|
+
internalAdapter: InternalAdapter<BetterAuthOptions>;
|
|
7989
|
+
createAuthCookie: (cookieName: string, overrideAttributes?: Partial<better_call0.CookieOptions> | undefined) => {
|
|
7990
|
+
name: string;
|
|
7991
|
+
attributes: better_call0.CookieOptions;
|
|
7992
|
+
};
|
|
7993
|
+
secret: string;
|
|
7994
|
+
sessionConfig: {
|
|
7995
|
+
updateAge: number;
|
|
7996
|
+
expiresIn: number;
|
|
7997
|
+
freshAge: number;
|
|
7998
|
+
cookieRefreshCache: false | {
|
|
7999
|
+
enabled: true;
|
|
8000
|
+
updateAge: number;
|
|
8001
|
+
};
|
|
8002
|
+
};
|
|
8003
|
+
generateId: (options: {
|
|
8004
|
+
model: ModelNames;
|
|
8005
|
+
size?: number | undefined;
|
|
8006
|
+
}) => string | false;
|
|
8007
|
+
secondaryStorage: SecondaryStorage | undefined;
|
|
8008
|
+
password: {
|
|
8009
|
+
hash: (password: string) => Promise<string>;
|
|
8010
|
+
verify: (data: {
|
|
8011
|
+
password: string;
|
|
8012
|
+
hash: string;
|
|
8013
|
+
}) => Promise<boolean>;
|
|
8014
|
+
config: {
|
|
8015
|
+
minPasswordLength: number;
|
|
8016
|
+
maxPasswordLength: number;
|
|
8017
|
+
};
|
|
8018
|
+
checkPassword: (userId: string, ctx: GenericEndpointContext<BetterAuthOptions>) => Promise<boolean>;
|
|
8019
|
+
};
|
|
8020
|
+
tables: BetterAuthDBSchema;
|
|
8021
|
+
runMigrations: () => Promise<void>;
|
|
8022
|
+
publishTelemetry: (event: {
|
|
8023
|
+
type: string;
|
|
8024
|
+
anonymousId?: string | undefined;
|
|
8025
|
+
payload: Record<string, any>;
|
|
8026
|
+
}) => Promise<void>;
|
|
8027
|
+
skipOriginCheck: boolean;
|
|
8028
|
+
skipCSRFCheck: boolean;
|
|
8029
|
+
runInBackground: (promise: Promise<void>) => void;
|
|
8030
|
+
runInBackgroundOrAwait: (promise: Promise<unknown> | Promise<void> | void | unknown) => Promise<unknown>;
|
|
7825
8031
|
}>) => Promise<R_1>): (inputContext: better_call0.MiddlewareInputContext<Options>) => Promise<R_1>;
|
|
7826
8032
|
};
|
|
7827
8033
|
type EndpointHandler<Path extends string, Options extends EndpointOptions, R> = (context: EndpointContext<Path, Options, AuthContext>) => Promise<R>;
|
|
@@ -7830,4 +8036,4 @@ declare function createAuthEndpoint<Path extends string, Options extends Endpoin
|
|
|
7830
8036
|
type AuthEndpoint<Path extends string, Opts extends EndpointOptions, R> = ReturnType<typeof createAuthEndpoint<Path, Opts, R>>;
|
|
7831
8037
|
type AuthMiddleware = ReturnType<typeof createAuthMiddleware>;
|
|
7832
8038
|
//#endregion
|
|
7833
|
-
export {
|
|
8039
|
+
export { NotionOptions as $, DBAdapterDebugLogOption as $n, HuggingFaceProfile as $t, VercelOptions as A, apple as An, Verification as Ar, LinearOptions as At, PaybinOptions as B, getOAuth2Tokens as Bn, accountSchema as Br, TwitterOption as Bt, HookEndpointContext as C, getCognitoPublicKey as Cn, Primitive as Cr, tiktok as Ct, SocialProviders as D, AppleNonConformUser as Dn, initGetFieldAttributes as Dr, LinkedInOptions as Dt, SocialProviderListEnum as E, atlassian as En, initGetFieldName as Er, gitlab as Et, polar as F, verifyJwsAccessToken as Fn, Session as Fr, KickProfile as Ft, LineUserInfo as G, createClientCredentialsTokenRequest as Gn, DBFieldAttribute as Gr, twitch as Gt, paybin as H, refreshAccessToken as Hn, getAuthTables as Hr, twitter as Ht, PayPalOptions as I, createAuthorizationCodeRequest as In, sessionSchema as Ir, kick as It, NaverProfile as J, OAuthProvider as Jn, DBPrimitive as Jr, spotify as Jt, line as K, OAuth2Tokens as Kn, DBFieldAttributeConfig as Kr, SpotifyOptions as Kt, PayPalProfile as L, validateAuthorizationCode as Ln, RateLimit as Lr, DropboxOptions as Lt, vercel as M, BetterAuthCookies as Mn, User as Mr, LinearUser as Mt, PolarOptions as N, getJwks as Nn, userSchema as Nr, linear as Nt, socialProviderList as O, AppleOptions as On, initGetDefaultModelName as Or, LinkedInProfile as Ot, PolarProfile as P, verifyAccessToken as Pn, coreSchema as Pr, KickOptions as Pt, kakao as Q, DBAdapter as Qn, HuggingFaceOptions as Qt, PayPalTokenResponse as R, validateToken as Rn, rateLimitSchema as Rr, DropboxProfile as Rt, BetterAuthPlugin as S, cognito as Sn, Prettify as Sr, TiktokProfile as St, SocialProviderList as T, AtlassianProfile as Tn, initGetIdField as Tr, GitlabProfile as Tt, LineIdTokenPayload as U, createAuthorizationURL as Un, BaseModelNames as Ur, TwitchOptions as Ut, PaybinProfile as V, createRefreshAccessTokenRequest as Vn, BetterAuthPluginDBSchema as Vr, TwitterProfile as Vt, LineOptions as W, clientCredentialsToken as Wn, BetterAuthDBSchema as Wr, TwitchProfile as Wt, KakaoOptions as X, CleanedWhere as Xn, SecondaryStorage as Xr, SlackProfile as Xt, naver as Y, ProviderOptions as Yn, ModelNames as Yr, SlackOptions as Yt, KakaoProfile as Z, CustomAdapter as Zn, slack as Zt, PluginContext as _, DiscordOptions as _n, CreateAdapterOptions as _r, roblox as _t, optionsMiddleware as a, MicrosoftEntraIDProfile as an, JoinOption as ar, PronounOption as at, BetterAuthRateLimitOptions as b, CognitoOptions as bn, LiteralString as br, reddit as bt, BetterAuthClientPlugin as c, GithubOptions as cn, withApplyDefault as cr, zoom as ct, ClientStore as d, FigmaOptions as dn, createAdapterFactory as dr, vk as dt, huggingface as en, DBAdapterFactoryConfig as er, NotionProfile as et, AuthContext as f, FigmaProfile as fn, AdapterConfig as fr, SalesforceOptions as ft, InternalAdapter as g, facebook as gn, AdapterTestDebugLogs as gr, RobloxProfile as gt, GenericEndpointContext as h, FacebookProfile as hn, AdapterFactoryOptions as hr, RobloxOptions as ht, createAuthMiddleware as i, google as in, JoinConfig as ir, PhoneNumber as it, VercelProfile as j, getApplePublicKey as jn, verificationSchema as jr, LinearProfile as jt, socialProviders as k, AppleProfile as kn, initGetDefaultFieldName as kr, linkedin as kt, ClientAtomListener as l, GithubProfile as ln, AdapterFactory as lr, VkOption as lt, BetterAuthPluginRegistryIdentifier as m, FacebookOptions as mn, AdapterFactoryCustomizeAdapterCreator as mr, salesforce as mt, AuthMiddleware as n, GoogleProfile as nn, DBAdapterSchemaCreation as nr, AccountStatus as nt, StandardSchemaV1$1 as o, MicrosoftOptions as on, Where as or, ZoomOptions as ot, BetterAuthPluginRegistry as p, figma as pn, AdapterFactoryConfig as pr, SalesforceProfile as pt, NaverOptions as q, OAuth2UserInfo as qn, DBFieldType as qr, SpotifyProfile as qt, createAuthEndpoint as r, getGooglePublicKey as rn, DBTransactionAdapter as rr, LoginType as rt, BetterAuthClientOptions as s, microsoft as sn, deepmerge as sr, ZoomProfile as st, AuthEndpoint as t, GoogleOptions as tn, DBAdapterInstance as tr, notion as tt, ClientFetchOption as u, github as un, createAdapter as ur, VkProfile as ut, BetterAuthAdvancedOptions as v, DiscordProfile as vn, CreateCustomAdapter as vr, RedditOptions as vt, SocialProvider as w, AtlassianOptions as wn, initGetModelName as wr, GitlabOptions as wt, GenerateIdFn as x, CognitoProfile as xn, LiteralUnion as xr, TiktokOptions as xt, BetterAuthOptions as y, discord as yn, Awaitable as yr, RedditProfile as yt, paypal as z, generateCodeChallenge as zn, Account as zr, dropbox as zt };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { AuthContext, Awaitable, BetterAuthAdvancedOptions, BetterAuthClientOptions, BetterAuthClientPlugin, BetterAuthCookies, BetterAuthOptions, BetterAuthPlugin, BetterAuthRateLimitOptions, ClientAtomListener, ClientFetchOption, ClientStore, GenerateIdFn, GenericEndpointContext, HookEndpointContext, InternalAdapter, LiteralString, LiteralUnion, Prettify, Primitive, StandardSchemaV1 };
|
|
1
|
+
import { C as HookEndpointContext, Cr as Primitive, Mn as BetterAuthCookies, S as BetterAuthPlugin, Sr as Prettify, _ as PluginContext, b as BetterAuthRateLimitOptions, br as LiteralString, c as BetterAuthClientPlugin, d as ClientStore, f as AuthContext, g as InternalAdapter, h as GenericEndpointContext, l as ClientAtomListener, m as BetterAuthPluginRegistryIdentifier, o as StandardSchemaV1, p as BetterAuthPluginRegistry, s as BetterAuthClientOptions, u as ClientFetchOption, v as BetterAuthAdvancedOptions, x as GenerateIdFn, xr as LiteralUnion, y as BetterAuthOptions, yr as Awaitable } from "./index-CGr4Qrv8.mjs";
|
|
2
|
+
export { AuthContext, Awaitable, BetterAuthAdvancedOptions, BetterAuthClientOptions, BetterAuthClientPlugin, BetterAuthCookies, BetterAuthOptions, BetterAuthPlugin, BetterAuthPluginRegistry, BetterAuthPluginRegistryIdentifier, BetterAuthRateLimitOptions, ClientAtomListener, ClientFetchOption, ClientStore, GenerateIdFn, GenericEndpointContext, HookEndpointContext, InternalAdapter, LiteralString, LiteralUnion, PluginContext, Prettify, Primitive, StandardSchemaV1 };
|
package/dist/oauth2/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Bn as getOAuth2Tokens, Fn as verifyJwsAccessToken, Gn as createClientCredentialsTokenRequest, Hn as refreshAccessToken, In as createAuthorizationCodeRequest, Jn as OAuthProvider, Kn as OAuth2Tokens, Ln as validateAuthorizationCode, Nn as getJwks, Pn as verifyAccessToken, Rn as validateToken, Un as createAuthorizationURL, Vn as createRefreshAccessTokenRequest, Wn as clientCredentialsToken, Yn as ProviderOptions, qn as OAuth2UserInfo, zn as generateCodeChallenge } from "../index-CGr4Qrv8.mjs";
|
|
2
2
|
export { OAuth2Tokens, OAuth2UserInfo, OAuthProvider, ProviderOptions, clientCredentialsToken, createAuthorizationCodeRequest, createAuthorizationURL, createClientCredentialsTokenRequest, createRefreshAccessTokenRequest, generateCodeChallenge, getJwks, getOAuth2Tokens, refreshAccessToken, validateAuthorizationCode, validateToken, verifyAccessToken, verifyJwsAccessToken };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as NotionOptions, $t as HuggingFaceProfile, A as VercelOptions, An as apple, At as LinearOptions, B as PaybinOptions, Bt as TwitterOption, Cn as getCognitoPublicKey, Ct as tiktok, D as SocialProviders, Dn as AppleNonConformUser, Dt as LinkedInOptions, E as SocialProviderListEnum, En as atlassian, Et as gitlab, F as polar, Ft as KickProfile, G as LineUserInfo, Gt as twitch, H as paybin, Ht as twitter, I as PayPalOptions, It as kick, J as NaverProfile, Jt as spotify, K as line, Kt as SpotifyOptions, L as PayPalProfile, Lt as DropboxOptions, M as vercel, Mt as LinearUser, N as PolarOptions, Nt as linear, O as socialProviderList, On as AppleOptions, Ot as LinkedInProfile, P as PolarProfile, Pt as KickOptions, Q as kakao, Qt as HuggingFaceOptions, R as PayPalTokenResponse, Rt as DropboxProfile, Sn as cognito, St as TiktokProfile, T as SocialProviderList, Tn as AtlassianProfile, Tt as GitlabProfile, U as LineIdTokenPayload, Ut as TwitchOptions, V as PaybinProfile, Vt as TwitterProfile, W as LineOptions, Wt as TwitchProfile, X as KakaoOptions, Xt as SlackProfile, Y as naver, Yt as SlackOptions, Z as KakaoProfile, Zt as slack, _n as DiscordOptions, _t as roblox, an as MicrosoftEntraIDProfile, at as PronounOption, bn as CognitoOptions, bt as reddit, cn as GithubOptions, ct as zoom, dn as FigmaOptions, dt as vk, en as huggingface, et as NotionProfile, fn as FigmaProfile, ft as SalesforceOptions, gn as facebook, gt as RobloxProfile, hn as FacebookProfile, ht as RobloxOptions, in as google, it as PhoneNumber, j as VercelProfile, jn as getApplePublicKey, jt as LinearProfile, k as socialProviders, kn as AppleProfile, kt as linkedin, ln as GithubProfile, lt as VkOption, mn as FacebookOptions, mt as salesforce, nn as GoogleProfile, nt as AccountStatus, on as MicrosoftOptions, ot as ZoomOptions, pn as figma, pt as SalesforceProfile, q as NaverOptions, qt as SpotifyProfile, rn as getGooglePublicKey, rt as LoginType, sn as microsoft, st as ZoomProfile, tn as GoogleOptions, tt as notion, un as github, ut as VkProfile, vn as DiscordProfile, vt as RedditOptions, w as SocialProvider, wn as AtlassianOptions, wt as GitlabOptions, xn as CognitoProfile, xt as TiktokOptions, yn as discord, yt as RedditProfile, z as paypal, zt as dropbox } from "../index-CGr4Qrv8.mjs";
|
|
2
2
|
export { AccountStatus, AppleNonConformUser, AppleOptions, AppleProfile, AtlassianOptions, AtlassianProfile, CognitoOptions, CognitoProfile, DiscordOptions, DiscordProfile, DropboxOptions, DropboxProfile, FacebookOptions, FacebookProfile, FigmaOptions, FigmaProfile, GithubOptions, GithubProfile, GitlabOptions, GitlabProfile, GoogleOptions, GoogleProfile, HuggingFaceOptions, HuggingFaceProfile, KakaoOptions, KakaoProfile, KickOptions, KickProfile, LineIdTokenPayload, LineOptions, LineUserInfo, LinearOptions, LinearProfile, LinearUser, LinkedInOptions, LinkedInProfile, LoginType, MicrosoftEntraIDProfile, MicrosoftOptions, NaverOptions, NaverProfile, NotionOptions, NotionProfile, PayPalOptions, PayPalProfile, PayPalTokenResponse, PaybinOptions, PaybinProfile, PhoneNumber, PolarOptions, PolarProfile, PronounOption, RedditOptions, RedditProfile, RobloxOptions, RobloxProfile, SalesforceOptions, SalesforceProfile, SlackOptions, SlackProfile, SocialProvider, SocialProviderList, SocialProviderListEnum, SocialProviders, SpotifyOptions, SpotifyProfile, TiktokOptions, TiktokProfile, TwitchOptions, TwitchProfile, TwitterOption, TwitterProfile, VercelOptions, VercelProfile, VkOption, VkProfile, ZoomOptions, ZoomProfile, apple, atlassian, cognito, discord, dropbox, facebook, figma, getApplePublicKey, getCognitoPublicKey, getGooglePublicKey, github, gitlab, google, huggingface, kakao, kick, line, linear, linkedin, microsoft, naver, notion, paybin, paypal, polar, reddit, roblox, salesforce, slack, socialProviderList, socialProviders, spotify, tiktok, twitch, twitter, vercel, vk, zoom };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { i as logger } from "../env-DbssmzoK.mjs";
|
|
2
|
-
import "../utils-
|
|
3
|
-
import { n as BetterAuthError, t as APIError } from "../error-
|
|
2
|
+
import "../utils-puAL36Bz.mjs";
|
|
3
|
+
import { n as BetterAuthError, t as APIError } from "../error-GNtLPYaS.mjs";
|
|
4
4
|
import { a as validateAuthorizationCode, c as refreshAccessToken, d as getOAuth2Tokens, l as createAuthorizationURL, u as generateCodeChallenge } from "../oauth2-BjWM15hm.mjs";
|
|
5
5
|
import * as z from "zod";
|
|
6
6
|
import { base64 } from "@better-auth/utils/base64";
|
package/dist/utils/index.d.mts
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
import { t as InternalLogger } from "../index-BRBu0-5h.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/deprecate.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Wraps a function to log a deprecation warning at once.
|
|
7
|
+
*/
|
|
8
|
+
declare function deprecate<T extends (...args: any[]) => any>(fn: T, message: string, logger?: InternalLogger): T;
|
|
9
|
+
//#endregion
|
|
1
10
|
//#region src/utils/error-codes.d.ts
|
|
2
11
|
type UpperLetter = "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | "J" | "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" | "S" | "T" | "U" | "V" | "W" | "X" | "Y" | "Z";
|
|
3
12
|
type SpecialCharacter = "_";
|
|
@@ -18,4 +27,4 @@ declare function safeJSONParse<T>(data: unknown): T | null;
|
|
|
18
27
|
//#region src/utils/string.d.ts
|
|
19
28
|
declare function capitalizeFirstLetter(str: string): string;
|
|
20
29
|
//#endregion
|
|
21
|
-
export { capitalizeFirstLetter, defineErrorCodes, generateId, safeJSONParse };
|
|
30
|
+
export { capitalizeFirstLetter, defineErrorCodes, deprecate, generateId, safeJSONParse };
|
package/dist/utils/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import "../env-DbssmzoK.mjs";
|
|
2
|
-
import { i as defineErrorCodes, n as safeJSONParse, r as generateId, t as capitalizeFirstLetter } from "../utils-
|
|
2
|
+
import { a as deprecate, i as defineErrorCodes, n as safeJSONParse, r as generateId, t as capitalizeFirstLetter } from "../utils-puAL36Bz.mjs";
|
|
3
3
|
|
|
4
|
-
export { capitalizeFirstLetter, defineErrorCodes, generateId, safeJSONParse };
|
|
4
|
+
export { capitalizeFirstLetter, defineErrorCodes, deprecate, generateId, safeJSONParse };
|
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
import { i as logger } from "./env-DbssmzoK.mjs";
|
|
2
2
|
import { createRandomStringGenerator } from "@better-auth/utils/random";
|
|
3
3
|
|
|
4
|
+
//#region src/utils/deprecate.ts
|
|
5
|
+
/**
|
|
6
|
+
* Wraps a function to log a deprecation warning at once.
|
|
7
|
+
*/
|
|
8
|
+
function deprecate(fn, message, logger$1) {
|
|
9
|
+
let warned = false;
|
|
10
|
+
return function(...args) {
|
|
11
|
+
if (!warned) {
|
|
12
|
+
(logger$1?.warn ?? console.warn)(`[Deprecation] ${message}`);
|
|
13
|
+
warned = true;
|
|
14
|
+
}
|
|
15
|
+
return fn.apply(this, args);
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
//#endregion
|
|
4
20
|
//#region src/utils/error-codes.ts
|
|
5
21
|
function defineErrorCodes(codes) {
|
|
6
22
|
return Object.fromEntries(Object.entries(codes).map(([key, value]) => [key, {
|
|
@@ -44,4 +60,4 @@ function capitalizeFirstLetter(str) {
|
|
|
44
60
|
}
|
|
45
61
|
|
|
46
62
|
//#endregion
|
|
47
|
-
export { defineErrorCodes as i, safeJSONParse as n, generateId as r, capitalizeFirstLetter as t };
|
|
63
|
+
export { deprecate as a, defineErrorCodes as i, safeJSONParse as n, generateId as r, capitalizeFirstLetter as t };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@better-auth/core",
|
|
3
|
-
"version": "1.5.0-beta.
|
|
3
|
+
"version": "1.5.0-beta.3",
|
|
4
4
|
"description": "The most comprehensive authentication framework for TypeScript.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
"devDependencies": {
|
|
115
115
|
"@better-auth/utils": "0.3.0",
|
|
116
116
|
"@better-fetch/fetch": "1.1.21",
|
|
117
|
-
"better-call": "1.1.
|
|
117
|
+
"better-call": "1.1.8",
|
|
118
118
|
"jose": "^6.1.0",
|
|
119
119
|
"kysely": "^0.28.5",
|
|
120
120
|
"nanostores": "^1.0.1",
|
|
@@ -127,7 +127,7 @@
|
|
|
127
127
|
"peerDependencies": {
|
|
128
128
|
"@better-auth/utils": "0.3.0",
|
|
129
129
|
"@better-fetch/fetch": "1.1.21",
|
|
130
|
-
"better-call": "1.1.
|
|
130
|
+
"better-call": "1.1.8",
|
|
131
131
|
"jose": "^6.1.0",
|
|
132
132
|
"kysely": "^0.28.5",
|
|
133
133
|
"nanostores": "^1.0.1"
|
package/src/context/index.ts
CHANGED
|
@@ -19,3 +19,32 @@ export {
|
|
|
19
19
|
runWithAdapter,
|
|
20
20
|
runWithTransaction,
|
|
21
21
|
} from "./transaction";
|
|
22
|
+
|
|
23
|
+
const glo: any =
|
|
24
|
+
typeof globalThis !== "undefined"
|
|
25
|
+
? globalThis
|
|
26
|
+
: typeof window !== "undefined"
|
|
27
|
+
? window
|
|
28
|
+
: typeof global !== "undefined"
|
|
29
|
+
? global
|
|
30
|
+
: {};
|
|
31
|
+
|
|
32
|
+
const importIdentifier = "__ $BETTER_AUTH$ __";
|
|
33
|
+
|
|
34
|
+
if (glo[importIdentifier] === true) {
|
|
35
|
+
/**
|
|
36
|
+
* Dear reader of this message. Please take this seriously.
|
|
37
|
+
*
|
|
38
|
+
* If you see this message, make sure that you only import one version of Better Auth. In many cases,
|
|
39
|
+
* your package manager installs two versions of Better Auth that are used by different packages within your project.
|
|
40
|
+
*
|
|
41
|
+
* This often leads to issues that are hard to debug. We often need to ensure async local storage instance,
|
|
42
|
+
* If you imported different versions of Better Auth, it is impossible for us to
|
|
43
|
+
* do status synchronization per request anymore - which might break the states.
|
|
44
|
+
*
|
|
45
|
+
*/
|
|
46
|
+
console.error(
|
|
47
|
+
"Better Auth was already imported. This breaks async local storage instance and will lead to issues!",
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
glo[importIdentifier] = true;
|
package/src/error/codes.ts
CHANGED
|
@@ -30,6 +30,8 @@ export const BASE_ERROR_CODES = defineErrorCodes({
|
|
|
30
30
|
ACCOUNT_NOT_FOUND: "Account not found",
|
|
31
31
|
USER_ALREADY_HAS_PASSWORD:
|
|
32
32
|
"User already has a password. Provide that to delete the account.",
|
|
33
|
+
CROSS_SITE_NAVIGATION_LOGIN_BLOCKED:
|
|
34
|
+
"Cross-site navigation login blocked. This request appears to be a CSRF attack.",
|
|
33
35
|
VERIFICATION_EMAIL_NOT_ENABLED: "Verification email isn't enabled",
|
|
34
36
|
EMAIL_ALREADY_VERIFIED: "Email is already verified",
|
|
35
37
|
EMAIL_MISMATCH: "Email mismatch",
|
package/src/types/context.ts
CHANGED
|
@@ -12,10 +12,33 @@ import type { DBAdapter, Where } from "../db/adapter";
|
|
|
12
12
|
import type { createLogger } from "../env";
|
|
13
13
|
import type { OAuthProvider } from "../oauth2";
|
|
14
14
|
import type { BetterAuthCookies } from "./cookie";
|
|
15
|
+
import type { LiteralString } from "./helper";
|
|
15
16
|
import type {
|
|
16
17
|
BetterAuthOptions,
|
|
17
18
|
BetterAuthRateLimitOptions,
|
|
18
19
|
} from "./init-options";
|
|
20
|
+
import type { BetterAuthPlugin } from "./plugin";
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Mutators are defined in each plugin
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* declare module "@better-auth/core" {
|
|
28
|
+
* interface BetterAuthPluginRegistry<Auth, Context> {
|
|
29
|
+
* 'jwt': {
|
|
30
|
+
* creator: typeof jwt
|
|
31
|
+
* }
|
|
32
|
+
* }
|
|
33
|
+
* }
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
// biome-ignore lint/correctness/noUnusedVariables: Auth and Context is used in the declaration merging
|
|
37
|
+
export interface BetterAuthPluginRegistry<Auth, Context> {}
|
|
38
|
+
export type BetterAuthPluginRegistryIdentifier = keyof BetterAuthPluginRegistry<
|
|
39
|
+
unknown,
|
|
40
|
+
unknown
|
|
41
|
+
>;
|
|
19
42
|
|
|
20
43
|
export type GenericEndpointContext<
|
|
21
44
|
Options extends BetterAuthOptions = BetterAuthOptions,
|
|
@@ -159,8 +182,34 @@ type CheckPasswordFn<Options extends BetterAuthOptions = BetterAuthOptions> = (
|
|
|
159
182
|
ctx: GenericEndpointContext<Options>,
|
|
160
183
|
) => Promise<boolean>;
|
|
161
184
|
|
|
185
|
+
export type PluginContext = {
|
|
186
|
+
getPlugin: <ID extends BetterAuthPluginRegistryIdentifier | LiteralString>(
|
|
187
|
+
pluginId: ID,
|
|
188
|
+
) =>
|
|
189
|
+
| (ID extends BetterAuthPluginRegistryIdentifier
|
|
190
|
+
? ReturnType<BetterAuthPluginRegistry<unknown, unknown>[ID]["creator"]>
|
|
191
|
+
: BetterAuthPlugin)
|
|
192
|
+
| null;
|
|
193
|
+
/**
|
|
194
|
+
* Checks if a plugin is enabled by its ID.
|
|
195
|
+
*
|
|
196
|
+
* @param pluginId - The ID of the plugin to check
|
|
197
|
+
* @returns `true` if the plugin is enabled, `false` otherwise
|
|
198
|
+
*
|
|
199
|
+
* @example
|
|
200
|
+
* ```ts
|
|
201
|
+
* if (ctx.context.hasPlugin("organization")) {
|
|
202
|
+
* // organization plugin is enabled
|
|
203
|
+
* }
|
|
204
|
+
* ```
|
|
205
|
+
*/
|
|
206
|
+
hasPlugin: <ID extends BetterAuthPluginRegistryIdentifier | LiteralString>(
|
|
207
|
+
pluginId: ID,
|
|
208
|
+
) => boolean;
|
|
209
|
+
};
|
|
210
|
+
|
|
162
211
|
export type AuthContext<Options extends BetterAuthOptions = BetterAuthOptions> =
|
|
163
|
-
{
|
|
212
|
+
PluginContext & {
|
|
164
213
|
options: Options;
|
|
165
214
|
appName: string;
|
|
166
215
|
baseURL: string;
|
package/src/types/index.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
export type { StandardSchemaV1 } from "@standard-schema/spec";
|
|
2
2
|
export type {
|
|
3
3
|
AuthContext,
|
|
4
|
+
BetterAuthPluginRegistry,
|
|
5
|
+
BetterAuthPluginRegistryIdentifier,
|
|
4
6
|
GenericEndpointContext,
|
|
5
7
|
InternalAdapter,
|
|
8
|
+
PluginContext,
|
|
6
9
|
} from "./context";
|
|
7
10
|
export type { BetterAuthCookies } from "./cookie";
|
|
8
11
|
export type * from "./helper";
|
|
@@ -478,8 +478,18 @@ export type BetterAuthOptions = {
|
|
|
478
478
|
* A function that is called when a user verifies their email
|
|
479
479
|
* @param user the user that verified their email
|
|
480
480
|
* @param request the request object
|
|
481
|
+
* @deprecated Use `beforeEmailVerification` or `afterEmailVerification` instead. This will be removed in 1.5
|
|
481
482
|
*/
|
|
482
483
|
onEmailVerification?: (user: User, request?: Request) => Promise<void>;
|
|
484
|
+
/**
|
|
485
|
+
* A function that is called before a user verifies their email
|
|
486
|
+
* @param user the user that verified their email
|
|
487
|
+
* @param request the request object
|
|
488
|
+
*/
|
|
489
|
+
beforeEmailVerification?: (
|
|
490
|
+
user: User,
|
|
491
|
+
request?: Request,
|
|
492
|
+
) => Promise<void>;
|
|
483
493
|
/**
|
|
484
494
|
* A function that is called when a user's email is updated to verified
|
|
485
495
|
* @param user the user that verified their email
|
|
@@ -1002,9 +1012,26 @@ export type BetterAuthOptions = {
|
|
|
1002
1012
|
*
|
|
1003
1013
|
* Trusted origins will be dynamically
|
|
1004
1014
|
* calculated based on the request.
|
|
1015
|
+
*
|
|
1016
|
+
* @example
|
|
1017
|
+
* ```ts
|
|
1018
|
+
* trustedOrigins: async (request) => {
|
|
1019
|
+
* return [
|
|
1020
|
+
* "https://better-auth.com",
|
|
1021
|
+
* "https://*.better-auth.com",
|
|
1022
|
+
* request.headers.get("x-custom-origin")
|
|
1023
|
+
* ];
|
|
1024
|
+
* }
|
|
1025
|
+
* ```
|
|
1026
|
+
* @returns An array of trusted origins.
|
|
1005
1027
|
*/
|
|
1006
1028
|
trustedOrigins?:
|
|
1007
|
-
| (
|
|
1029
|
+
| (
|
|
1030
|
+
| string[]
|
|
1031
|
+
| ((
|
|
1032
|
+
request?: Request | undefined,
|
|
1033
|
+
) => Awaitable<(string | undefined | null)[]>)
|
|
1034
|
+
)
|
|
1008
1035
|
| undefined;
|
|
1009
1036
|
/**
|
|
1010
1037
|
* Rate limiting configuration
|
package/src/types/plugin.ts
CHANGED
|
@@ -20,7 +20,7 @@ type DeepPartial<T> = T extends Function
|
|
|
20
20
|
export type HookEndpointContext = Partial<
|
|
21
21
|
EndpointContext<string, any> & Omit<InputContext<string, any>, "method">
|
|
22
22
|
> & {
|
|
23
|
-
path
|
|
23
|
+
path?: string;
|
|
24
24
|
context: AuthContext & {
|
|
25
25
|
returned?: unknown | undefined;
|
|
26
26
|
responseHeaders?: Headers | undefined;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from "vitest";
|
|
2
|
+
import { deprecate } from "./deprecate";
|
|
3
|
+
|
|
4
|
+
describe("deprecate", () => {
|
|
5
|
+
it("should warn once when called multiple times", () => {
|
|
6
|
+
const warn = vi.fn();
|
|
7
|
+
const logger = { warn } as any;
|
|
8
|
+
const fn = vi.fn();
|
|
9
|
+
const deprecatedFn = deprecate(fn, "test message", logger);
|
|
10
|
+
|
|
11
|
+
deprecatedFn();
|
|
12
|
+
deprecatedFn();
|
|
13
|
+
deprecatedFn();
|
|
14
|
+
|
|
15
|
+
expect(warn).toHaveBeenCalledTimes(1);
|
|
16
|
+
expect(warn).toHaveBeenCalledWith("[Deprecation] test message");
|
|
17
|
+
expect(fn).toHaveBeenCalledTimes(3);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it("should use provided logger if available", () => {
|
|
21
|
+
const warn = vi.fn();
|
|
22
|
+
const logger = { warn } as any;
|
|
23
|
+
const fn = vi.fn();
|
|
24
|
+
const deprecatedFn = deprecate(fn, "test message", logger);
|
|
25
|
+
|
|
26
|
+
deprecatedFn();
|
|
27
|
+
|
|
28
|
+
expect(warn).toHaveBeenCalledWith("[Deprecation] test message");
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it("should fall back to console.warn if no logger provided", () => {
|
|
32
|
+
const consoleWarn = vi.spyOn(console, "warn").mockImplementation(() => {});
|
|
33
|
+
const fn = vi.fn();
|
|
34
|
+
const deprecatedFn = deprecate(fn, "test message");
|
|
35
|
+
|
|
36
|
+
deprecatedFn();
|
|
37
|
+
|
|
38
|
+
expect(consoleWarn).toHaveBeenCalledWith("[Deprecation] test message");
|
|
39
|
+
consoleWarn.mockRestore();
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it("should pass arguments and return value correctly", () => {
|
|
43
|
+
const fn = vi.fn((a: number, b: number) => a + b);
|
|
44
|
+
const deprecatedFn = deprecate(fn, "test message", {
|
|
45
|
+
warn: vi.fn(),
|
|
46
|
+
} as any);
|
|
47
|
+
|
|
48
|
+
const result = deprecatedFn(1, 2);
|
|
49
|
+
|
|
50
|
+
expect(result).toBe(3);
|
|
51
|
+
expect(fn).toHaveBeenCalledWith(1, 2);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it("should preserve this context", () => {
|
|
55
|
+
class TestClass {
|
|
56
|
+
value = 10;
|
|
57
|
+
method(a: number) {
|
|
58
|
+
return this.value + a;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const instance = new TestClass();
|
|
63
|
+
const originalMethod = instance.method;
|
|
64
|
+
instance.method = deprecate(originalMethod, "test message", {
|
|
65
|
+
warn: vi.fn(),
|
|
66
|
+
} as any);
|
|
67
|
+
|
|
68
|
+
const result = instance.method(5);
|
|
69
|
+
|
|
70
|
+
expect(result).toBe(15);
|
|
71
|
+
});
|
|
72
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { InternalLogger } from "../env";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Wraps a function to log a deprecation warning at once.
|
|
5
|
+
*/
|
|
6
|
+
export function deprecate<T extends (...args: any[]) => any>(
|
|
7
|
+
fn: T,
|
|
8
|
+
message: string,
|
|
9
|
+
logger?: InternalLogger,
|
|
10
|
+
): T {
|
|
11
|
+
let warned = false;
|
|
12
|
+
|
|
13
|
+
return function (this: any, ...args: Parameters<T>): ReturnType<T> {
|
|
14
|
+
if (!warned) {
|
|
15
|
+
const warn = logger?.warn ?? console.warn;
|
|
16
|
+
warn(`[Deprecation] ${message}`);
|
|
17
|
+
warned = true;
|
|
18
|
+
}
|
|
19
|
+
return fn.apply(this, args);
|
|
20
|
+
} as T;
|
|
21
|
+
}
|
package/src/utils/index.ts
CHANGED