@better-auth/core 1.4.0-beta.9 → 1.4.0
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 +41 -76
- package/dist/api/index.d.mts +3 -0
- package/dist/api/index.mjs +26 -0
- package/dist/async_hooks/index.d.mts +2 -10
- package/dist/async_hooks/index.mjs +2 -24
- package/dist/async_hooks-BfRfbd1J.mjs +18 -0
- package/dist/context/index.d.mts +54 -0
- package/dist/context/index.mjs +4 -0
- package/dist/context-DgQ9XGBl.mjs +114 -0
- package/dist/db/adapter/index.d.mts +3 -14
- package/dist/db/adapter/index.mjs +1 -1
- package/dist/db/index.d.mts +3 -39
- package/dist/db/index.mjs +46 -55
- package/dist/env/index.d.mts +2 -36
- package/dist/env/index.mjs +2 -299
- package/dist/env-DwlNAN_D.mjs +245 -0
- package/dist/error/index.d.mts +31 -29
- package/dist/error/index.mjs +3 -40
- package/dist/error-BhAKg8LX.mjs +45 -0
- package/dist/index-CdubV7uy.d.mts +82 -0
- package/dist/index-CkAWdKH8.d.mts +7352 -0
- package/dist/index-DgwIISs7.d.mts +7 -0
- package/dist/index.d.mts +3 -180
- package/dist/index.mjs +1 -1
- package/dist/oauth2/index.d.mts +3 -99
- package/dist/oauth2/index.mjs +2 -356
- package/dist/oauth2-DmgZmPEg.mjs +236 -0
- package/dist/social-providers/index.d.mts +3 -3903
- package/dist/social-providers/index.mjs +2434 -2654
- package/dist/utils/index.d.mts +5 -6
- package/dist/utils/index.mjs +2 -4
- package/dist/utils-C5EN75oV.mjs +7 -0
- package/package.json +70 -111
- package/src/api/index.ts +53 -0
- package/src/async_hooks/index.ts +1 -9
- package/src/context/endpoint-context.ts +49 -0
- package/src/context/index.ts +21 -0
- package/src/context/request-state.test.ts +94 -0
- package/src/context/request-state.ts +90 -0
- package/src/context/transaction.ts +73 -0
- package/src/db/adapter/index.ts +215 -129
- package/src/db/index.ts +12 -13
- package/src/db/plugin.ts +3 -3
- package/src/db/type.ts +54 -42
- package/src/env/color-depth.ts +5 -4
- package/src/env/env-impl.ts +2 -1
- package/src/env/index.ts +9 -9
- package/src/env/logger.test.ts +3 -2
- package/src/env/logger.ts +11 -9
- package/src/error/codes.ts +1 -1
- package/src/error/index.ts +1 -1
- package/src/oauth2/client-credentials-token.ts +9 -9
- package/src/oauth2/create-authorization-url.ts +12 -12
- package/src/oauth2/index.ts +10 -11
- package/src/oauth2/oauth-provider.ts +96 -74
- package/src/oauth2/refresh-access-token.ts +12 -12
- package/src/oauth2/utils.ts +2 -0
- package/src/oauth2/validate-authorization-code.ts +13 -15
- package/src/social-providers/apple.ts +8 -8
- package/src/social-providers/atlassian.ts +21 -19
- package/src/social-providers/cognito.ts +15 -15
- package/src/social-providers/discord.ts +8 -11
- package/src/social-providers/dropbox.ts +5 -5
- package/src/social-providers/facebook.ts +12 -10
- package/src/social-providers/figma.ts +6 -6
- package/src/social-providers/github.ts +4 -4
- package/src/social-providers/gitlab.ts +13 -10
- package/src/social-providers/google.ts +13 -13
- package/src/social-providers/huggingface.ts +27 -25
- package/src/social-providers/index.ts +30 -24
- package/src/social-providers/kakao.ts +41 -41
- package/src/social-providers/kick.ts +7 -9
- package/src/social-providers/line.ts +12 -12
- package/src/social-providers/linear.ts +9 -8
- package/src/social-providers/linkedin.ts +5 -5
- package/src/social-providers/microsoft-entra-id.ts +31 -15
- package/src/social-providers/naver.ts +5 -5
- package/src/social-providers/notion.ts +11 -9
- package/src/social-providers/paybin.ts +122 -0
- package/src/social-providers/paypal.ts +31 -29
- package/src/social-providers/polar.ts +110 -0
- package/src/social-providers/reddit.ts +6 -6
- package/src/social-providers/roblox.ts +15 -14
- package/src/social-providers/salesforce.ts +20 -18
- package/src/social-providers/slack.ts +4 -7
- package/src/social-providers/spotify.ts +5 -5
- package/src/social-providers/tiktok.ts +32 -33
- package/src/social-providers/twitch.ts +8 -8
- package/src/social-providers/twitter.ts +49 -45
- package/src/social-providers/vk.ts +14 -17
- package/src/social-providers/zoom.ts +29 -14
- package/src/types/context.ts +67 -67
- package/src/types/cookie.ts +1 -0
- package/src/types/index.ts +13 -11
- package/src/types/init-options.ts +1134 -911
- package/src/types/plugin-client.ts +61 -13
- package/src/types/plugin.ts +81 -57
- package/tsconfig.json +2 -5
- package/{build.config.ts → tsdown.config.ts} +8 -11
- package/vitest.config.ts +3 -0
- package/dist/async_hooks/index.cjs +0 -27
- package/dist/async_hooks/index.d.cts +0 -10
- package/dist/async_hooks/index.d.ts +0 -10
- package/dist/db/adapter/index.cjs +0 -2
- package/dist/db/adapter/index.d.cts +0 -14
- package/dist/db/adapter/index.d.ts +0 -14
- package/dist/db/index.cjs +0 -91
- package/dist/db/index.d.cts +0 -39
- package/dist/db/index.d.ts +0 -39
- package/dist/env/index.cjs +0 -315
- package/dist/env/index.d.cts +0 -36
- package/dist/env/index.d.ts +0 -36
- package/dist/error/index.cjs +0 -44
- package/dist/error/index.d.cts +0 -33
- package/dist/error/index.d.ts +0 -33
- package/dist/index.cjs +0 -2
- package/dist/index.d.cts +0 -180
- package/dist/index.d.ts +0 -180
- package/dist/middleware/index.cjs +0 -25
- package/dist/middleware/index.d.cts +0 -14
- package/dist/middleware/index.d.mts +0 -14
- package/dist/middleware/index.d.ts +0 -14
- package/dist/middleware/index.mjs +0 -21
- package/dist/oauth2/index.cjs +0 -368
- package/dist/oauth2/index.d.cts +0 -99
- package/dist/oauth2/index.d.ts +0 -99
- package/dist/shared/core.2rWMW9q9.d.ts +0 -13
- package/dist/shared/core.40VTWh-p.d.cts +0 -217
- package/dist/shared/core.BfcVdsSf.d.cts +0 -181
- package/dist/shared/core.Bisb2Bdk.d.mts +0 -181
- package/dist/shared/core.BwoNUcJQ.d.cts +0 -53
- package/dist/shared/core.BwoNUcJQ.d.mts +0 -53
- package/dist/shared/core.BwoNUcJQ.d.ts +0 -53
- package/dist/shared/core.CErFRCOZ.d.mts +0 -1684
- package/dist/shared/core.CGN6D-Mh.d.ts +0 -181
- package/dist/shared/core.CPuIItYE.d.ts +0 -217
- package/dist/shared/core.CftpHMDz.d.cts +0 -13
- package/dist/shared/core.Db7zJyxf.d.ts +0 -1684
- package/dist/shared/core.DqaxObkf.d.cts +0 -1684
- package/dist/shared/core.MjcDoj7R.d.cts +0 -5
- package/dist/shared/core.MjcDoj7R.d.mts +0 -5
- package/dist/shared/core.MjcDoj7R.d.ts +0 -5
- package/dist/shared/core.g2ZbxAEV.d.mts +0 -217
- package/dist/shared/core.g9ACQ8v2.d.mts +0 -13
- package/dist/social-providers/index.cjs +0 -2793
- package/dist/social-providers/index.d.cts +0 -3903
- package/dist/social-providers/index.d.ts +0 -3903
- package/dist/utils/index.cjs +0 -7
- package/dist/utils/index.d.cts +0 -10
- package/dist/utils/index.d.ts +0 -10
- package/src/middleware/index.ts +0 -33
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,77 +1,42 @@
|
|
|
1
1
|
|
|
2
|
-
> @better-auth/core@1.4.0
|
|
3
|
-
>
|
|
4
|
-
|
|
5
|
-
[
|
|
6
|
-
[
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
[
|
|
32
|
-
[
|
|
33
|
-
|
|
34
|
-
[
|
|
35
|
-
|
|
36
|
-
[
|
|
37
|
-
|
|
38
|
-
[
|
|
39
|
-
|
|
40
|
-
[
|
|
41
|
-
|
|
42
|
-
[
|
|
43
|
-
|
|
44
|
-
[log] dist/oauth2/index.cjs (total size: 10.3 kB, chunk size: 10.3 kB, exports: clientCredentialsToken, createAuthorizationCodeRequest, createAuthorizationURL, createClientCredentialsTokenRequest, createRefreshAccessTokenRequest, generateCodeChallenge, getOAuth2Tokens, refreshAccessToken, validateAuthorizationCode, validateToken)
|
|
45
|
-
|
|
46
|
-
[log] dist/db/index.cjs (total size: 2.43 kB, chunk size: 2.43 kB, exports: accountSchema, coreSchema, rateLimitSchema, sessionSchema, userSchema, verificationSchema)
|
|
47
|
-
|
|
48
|
-
[log] dist/social-providers/index.cjs (total size: 87.9 kB, chunk size: 86.1 kB, exports: SocialProviderListEnum, apple, atlassian, cognito, discord, dropbox, facebook, figma, getApplePublicKey, getCognitoPublicKey, github, gitlab, google, huggingface, kakao, kick, line, linear, linkedin, microsoft, naver, notion, paypal, reddit, roblox, salesforce, slack, socialProviderList, socialProviders, spotify, tiktok, twitch, twitter, vk, zoom)
|
|
49
|
-
└─ dist/error/index.cjs (1.75 kB)
|
|
50
|
-
|
|
51
|
-
[log] dist/db/adapter/index.cjs (total size: 15 B, chunk size: 15 B)
|
|
52
|
-
[log] dist/index.mjs (total size: 1 B, chunk size: 1 B)
|
|
53
|
-
|
|
54
|
-
[log] dist/async_hooks/index.mjs (total size: 887 B, chunk size: 887 B, exports: getAsyncLocalStorage)
|
|
55
|
-
|
|
56
|
-
[log] dist/middleware/index.mjs (total size: 495 B, chunk size: 495 B, exports: createAuthEndpoint, createAuthMiddleware, optionsMiddleware)
|
|
57
|
-
|
|
58
|
-
[log] dist/utils/index.mjs (total size: 83 B, chunk size: 83 B, exports: defineErrorCodes)
|
|
59
|
-
|
|
60
|
-
[log] dist/error/index.mjs (total size: 1.7 kB, chunk size: 1.7 kB, exports: BASE_ERROR_CODES, BetterAuthError)
|
|
61
|
-
|
|
62
|
-
[log] dist/env/index.mjs (total size: 8.42 kB, chunk size: 8.42 kB, exports: ENV, TTY_COLORS, createLogger, env, getBooleanEnvVar, getColorDepth, getEnvVar, isDevelopment, isProduction, isTest, levels, logger, nodeENV, shouldPublishLog)
|
|
63
|
-
|
|
64
|
-
[log] dist/oauth2/index.mjs (total size: 9.88 kB, chunk size: 9.88 kB, exports: clientCredentialsToken, createAuthorizationCodeRequest, createAuthorizationURL, createClientCredentialsTokenRequest, createRefreshAccessTokenRequest, generateCodeChallenge, getOAuth2Tokens, refreshAccessToken, validateAuthorizationCode, validateToken)
|
|
65
|
-
|
|
66
|
-
[log] dist/db/index.mjs (total size: 1.67 kB, chunk size: 1.67 kB, exports: accountSchema, coreSchema, rateLimitSchema, sessionSchema, userSchema, verificationSchema)
|
|
67
|
-
|
|
68
|
-
[log] dist/social-providers/index.mjs (total size: 85.8 kB, chunk size: 84.1 kB, exports: SocialProviderListEnum, apple, atlassian, cognito, discord, dropbox, facebook, figma, getApplePublicKey, getCognitoPublicKey, github, gitlab, google, huggingface, kakao, kick, line, linear, linkedin, microsoft, naver, notion, paypal, reddit, roblox, salesforce, slack, socialProviderList, socialProviders, spotify, tiktok, twitch, twitter, vk, zoom)
|
|
69
|
-
└─ dist/error/index.mjs (1.7 kB)
|
|
70
|
-
|
|
71
|
-
[log] dist/db/adapter/index.mjs (total size: 1 B, chunk size: 1 B)
|
|
72
|
-
Σ Total dist size (byte size): 859 kB
|
|
73
|
-
[log]
|
|
74
|
-
[warn] Build is done with some warnings:
|
|
75
|
-
|
|
76
|
-
- Implicitly bundling "bun:sqlite"
|
|
77
|
-
- Implicitly bundling "node:sqlite"
|
|
2
|
+
> @better-auth/core@1.4.0 build /home/runner/work/better-auth/better-auth/packages/core
|
|
3
|
+
> tsdown
|
|
4
|
+
|
|
5
|
+
[34mℹ[39m tsdown [2mv0.16.5[22m powered by rolldown [2mv1.0.0-beta.50[22m
|
|
6
|
+
[34mℹ[39m Using tsdown config: [4m/home/runner/work/better-auth/better-auth/packages/core/tsdown.config.ts[24m
|
|
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
|
+
[34mℹ[39m tsconfig: [34mtsconfig.json[39m
|
|
9
|
+
[34mℹ[39m Build start
|
|
10
|
+
[34mℹ[39m [2mdist/[22m[1msocial-providers/index.mjs[22m [2m 78.21 kB[22m [2m│ gzip: 10.17 kB[22m
|
|
11
|
+
[34mℹ[39m [2mdist/[22m[1mdb/index.mjs[22m [2m 1.58 kB[22m [2m│ gzip: 0.49 kB[22m
|
|
12
|
+
[34mℹ[39m [2mdist/[22m[1mapi/index.mjs[22m [2m 0.83 kB[22m [2m│ gzip: 0.40 kB[22m
|
|
13
|
+
[34mℹ[39m [2mdist/[22m[1mcontext/index.mjs[22m [2m 0.74 kB[22m [2m│ gzip: 0.27 kB[22m
|
|
14
|
+
[34mℹ[39m [2mdist/[22m[1moauth2/index.mjs[22m [2m 0.61 kB[22m [2m│ gzip: 0.24 kB[22m
|
|
15
|
+
[34mℹ[39m [2mdist/[22m[1menv/index.mjs[22m [2m 0.44 kB[22m [2m│ gzip: 0.25 kB[22m
|
|
16
|
+
[34mℹ[39m [2mdist/[22m[1merror/index.mjs[22m [2m 0.16 kB[22m [2m│ gzip: 0.13 kB[22m
|
|
17
|
+
[34mℹ[39m [2mdist/[22m[1masync_hooks/index.mjs[22m [2m 0.11 kB[22m [2m│ gzip: 0.10 kB[22m
|
|
18
|
+
[34mℹ[39m [2mdist/[22m[1mutils/index.mjs[22m [2m 0.09 kB[22m [2m│ gzip: 0.09 kB[22m
|
|
19
|
+
[34mℹ[39m [2mdist/[22m[1mdb/adapter/index.mjs[22m [2m 0.01 kB[22m [2m│ gzip: 0.03 kB[22m
|
|
20
|
+
[34mℹ[39m [2mdist/[22m[1mindex.mjs[22m [2m 0.01 kB[22m [2m│ gzip: 0.03 kB[22m
|
|
21
|
+
[34mℹ[39m [2mdist/[22moauth2-DmgZmPEg.mjs [2m 9.17 kB[22m [2m│ gzip: 2.13 kB[22m
|
|
22
|
+
[34mℹ[39m [2mdist/[22menv-DwlNAN_D.mjs [2m 7.67 kB[22m [2m│ gzip: 2.54 kB[22m
|
|
23
|
+
[34mℹ[39m [2mdist/[22mcontext-DgQ9XGBl.mjs [2m 3.89 kB[22m [2m│ gzip: 1.00 kB[22m
|
|
24
|
+
[34mℹ[39m [2mdist/[22merror-BhAKg8LX.mjs [2m 1.77 kB[22m [2m│ gzip: 0.79 kB[22m
|
|
25
|
+
[34mℹ[39m [2mdist/[22masync_hooks-BfRfbd1J.mjs [2m 0.87 kB[22m [2m│ gzip: 0.46 kB[22m
|
|
26
|
+
[34mℹ[39m [2mdist/[22mutils-C5EN75oV.mjs [2m 0.13 kB[22m [2m│ gzip: 0.12 kB[22m
|
|
27
|
+
[34mℹ[39m [2mdist/[22m[32m[1msocial-providers/index.d.mts[22m[39m [2m 3.78 kB[22m [2m│ gzip: 1.16 kB[22m
|
|
28
|
+
[34mℹ[39m [2mdist/[22m[32m[1mcontext/index.d.mts[22m[39m [2m 3.05 kB[22m [2m│ gzip: 0.96 kB[22m
|
|
29
|
+
[34mℹ[39m [2mdist/[22m[32m[1merror/index.d.mts[22m[39m [2m 1.84 kB[22m [2m│ gzip: 0.72 kB[22m
|
|
30
|
+
[34mℹ[39m [2mdist/[22m[32m[1mdb/index.d.mts[22m[39m [2m 1.01 kB[22m [2m│ gzip: 0.38 kB[22m
|
|
31
|
+
[34mℹ[39m [2mdist/[22m[32m[1mindex.d.mts[22m[39m [2m 0.87 kB[22m [2m│ gzip: 0.34 kB[22m
|
|
32
|
+
[34mℹ[39m [2mdist/[22m[32m[1mutils/index.d.mts[22m[39m [2m 0.84 kB[22m [2m│ gzip: 0.43 kB[22m
|
|
33
|
+
[34mℹ[39m [2mdist/[22m[32m[1moauth2/index.d.mts[22m[39m [2m 0.79 kB[22m [2m│ gzip: 0.30 kB[22m
|
|
34
|
+
[34mℹ[39m [2mdist/[22m[32m[1menv/index.d.mts[22m[39m [2m 0.59 kB[22m [2m│ gzip: 0.30 kB[22m
|
|
35
|
+
[34mℹ[39m [2mdist/[22m[32m[1mdb/adapter/index.d.mts[22m[39m [2m 0.53 kB[22m [2m│ gzip: 0.24 kB[22m
|
|
36
|
+
[34mℹ[39m [2mdist/[22m[32m[1mapi/index.d.mts[22m[39m [2m 0.29 kB[22m [2m│ gzip: 0.16 kB[22m
|
|
37
|
+
[34mℹ[39m [2mdist/[22m[32m[1masync_hooks/index.d.mts[22m[39m [2m 0.14 kB[22m [2m│ gzip: 0.10 kB[22m
|
|
38
|
+
[34mℹ[39m [2mdist/[22m[32mindex-CkAWdKH8.d.mts[39m [2m205.84 kB[22m [2m│ gzip: 32.50 kB[22m
|
|
39
|
+
[34mℹ[39m [2mdist/[22m[32mindex-CdubV7uy.d.mts[39m [2m 3.31 kB[22m [2m│ gzip: 1.11 kB[22m
|
|
40
|
+
[34mℹ[39m [2mdist/[22m[32mindex-DgwIISs7.d.mts[39m [2m 0.24 kB[22m [2m│ gzip: 0.16 kB[22m
|
|
41
|
+
[34mℹ[39m 31 files, total: 329.43 kB
|
|
42
|
+
[32m✔[39m Build complete in [32m4482ms[39m
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { a as optionsMiddleware, i as createAuthMiddleware, n as AuthMiddleware, r as createAuthEndpoint, t as AuthEndpoint } from "../index-CkAWdKH8.mjs";
|
|
2
|
+
import "../index-CdubV7uy.mjs";
|
|
3
|
+
export { AuthEndpoint, AuthMiddleware, createAuthEndpoint, createAuthMiddleware, optionsMiddleware };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import "../async_hooks-BfRfbd1J.mjs";
|
|
2
|
+
import { f as runWithEndpointContext } from "../context-DgQ9XGBl.mjs";
|
|
3
|
+
import { createEndpoint, createMiddleware } from "better-call";
|
|
4
|
+
|
|
5
|
+
//#region src/api/index.ts
|
|
6
|
+
const optionsMiddleware = createMiddleware(async () => {
|
|
7
|
+
/**
|
|
8
|
+
* This will be passed on the instance of
|
|
9
|
+
* the context. Used to infer the type
|
|
10
|
+
* here.
|
|
11
|
+
*/
|
|
12
|
+
return {};
|
|
13
|
+
});
|
|
14
|
+
const createAuthMiddleware = createMiddleware.create({ use: [optionsMiddleware, createMiddleware(async () => {
|
|
15
|
+
return {};
|
|
16
|
+
})] });
|
|
17
|
+
const use = [optionsMiddleware];
|
|
18
|
+
const createAuthEndpoint = (path, options, handler) => {
|
|
19
|
+
return createEndpoint(path, {
|
|
20
|
+
...options,
|
|
21
|
+
use: [...options?.use || [], ...use]
|
|
22
|
+
}, async (ctx) => runWithEndpointContext(ctx, () => handler(ctx)));
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
//#endregion
|
|
26
|
+
export { createAuthEndpoint, createAuthMiddleware, optionsMiddleware };
|
|
@@ -1,10 +1,2 @@
|
|
|
1
|
-
import { AsyncLocalStorage } from
|
|
2
|
-
export { AsyncLocalStorage }
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* AsyncLocalStorage will be import directly in 1.5.x
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
declare function getAsyncLocalStorage(): Promise<typeof AsyncLocalStorage>;
|
|
9
|
-
|
|
10
|
-
export { getAsyncLocalStorage };
|
|
1
|
+
import { n as getAsyncLocalStorage, t as AsyncLocalStorage } from "../index-DgwIISs7.mjs";
|
|
2
|
+
export { AsyncLocalStorage, getAsyncLocalStorage };
|
|
@@ -1,25 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
const AsyncLocalStoragePromise = import(
|
|
3
|
-
/* @vite-ignore */
|
|
4
|
-
/* webpackIgnore: true */
|
|
5
|
-
moduleName
|
|
6
|
-
).then((mod) => mod.AsyncLocalStorage).catch((err) => {
|
|
7
|
-
if ("AsyncLocalStorage" in globalThis) {
|
|
8
|
-
return globalThis.AsyncLocalStorage;
|
|
9
|
-
}
|
|
10
|
-
console.warn(
|
|
11
|
-
"[better-auth] Warning: AsyncLocalStorage is not available in this environment. Some features may not work as expected."
|
|
12
|
-
);
|
|
13
|
-
console.warn(
|
|
14
|
-
"[better-auth] Please read more about this warning at https://better-auth.com/docs/installation#mount-handler"
|
|
15
|
-
);
|
|
16
|
-
console.warn(
|
|
17
|
-
"[better-auth] If you are using Cloudflare Workers, please see: https://developers.cloudflare.com/workers/configuration/compatibility-flags/#nodejs-compatibility-flag"
|
|
18
|
-
);
|
|
19
|
-
throw err;
|
|
20
|
-
});
|
|
21
|
-
async function getAsyncLocalStorage() {
|
|
22
|
-
return AsyncLocalStoragePromise;
|
|
23
|
-
}
|
|
1
|
+
import { t as getAsyncLocalStorage } from "../async_hooks-BfRfbd1J.mjs";
|
|
24
2
|
|
|
25
|
-
export { getAsyncLocalStorage };
|
|
3
|
+
export { getAsyncLocalStorage };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
//#region src/async_hooks/index.ts
|
|
2
|
+
const AsyncLocalStoragePromise = import(
|
|
3
|
+
/* @vite-ignore */
|
|
4
|
+
/* webpackIgnore: true */
|
|
5
|
+
"node:async_hooks"
|
|
6
|
+
).then((mod) => mod.AsyncLocalStorage).catch((err) => {
|
|
7
|
+
if ("AsyncLocalStorage" in globalThis) return globalThis.AsyncLocalStorage;
|
|
8
|
+
console.warn("[better-auth] Warning: AsyncLocalStorage is not available in this environment. Some features may not work as expected.");
|
|
9
|
+
console.warn("[better-auth] Please read more about this warning at https://better-auth.com/docs/installation#mount-handler");
|
|
10
|
+
console.warn("[better-auth] If you are using Cloudflare Workers, please see: https://developers.cloudflare.com/workers/configuration/compatibility-flags/#nodejs-compatibility-flag");
|
|
11
|
+
throw err;
|
|
12
|
+
});
|
|
13
|
+
async function getAsyncLocalStorage() {
|
|
14
|
+
return AsyncLocalStoragePromise;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
//#endregion
|
|
18
|
+
export { getAsyncLocalStorage as t };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Wn as DBAdapter, Yn as DBTransactionAdapter, f as AuthContext } from "../index-CkAWdKH8.mjs";
|
|
2
|
+
import "../index-CdubV7uy.mjs";
|
|
3
|
+
import { t as AsyncLocalStorage } from "../index-DgwIISs7.mjs";
|
|
4
|
+
import { EndpointContext, InputContext } from "better-call";
|
|
5
|
+
|
|
6
|
+
//#region src/context/endpoint-context.d.ts
|
|
7
|
+
type AuthEndpointContext = Partial<InputContext<string, any> & EndpointContext<string, any>> & {
|
|
8
|
+
context: AuthContext;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* This is for internal use only. Most users should use `getCurrentAuthContext` instead.
|
|
12
|
+
*
|
|
13
|
+
* It is exposed for advanced use cases where you need direct access to the AsyncLocalStorage instance.
|
|
14
|
+
*/
|
|
15
|
+
declare function getCurrentAuthContextAsyncLocalStorage(): Promise<AsyncLocalStorage<AuthEndpointContext>>;
|
|
16
|
+
declare function getCurrentAuthContext(): Promise<AuthEndpointContext>;
|
|
17
|
+
declare function runWithEndpointContext<T>(context: AuthEndpointContext, fn: () => T): Promise<T>;
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/context/request-state.d.ts
|
|
20
|
+
type RequestStateWeakMap = WeakMap<object, any>;
|
|
21
|
+
declare function getRequestStateAsyncLocalStorage(): Promise<AsyncLocalStorage<RequestStateWeakMap>>;
|
|
22
|
+
declare function hasRequestState(): Promise<boolean>;
|
|
23
|
+
declare function getCurrentRequestState(): Promise<RequestStateWeakMap>;
|
|
24
|
+
declare function runWithRequestState<T>(store: RequestStateWeakMap, fn: () => T): Promise<T>;
|
|
25
|
+
interface RequestState<T> {
|
|
26
|
+
get(): Promise<T>;
|
|
27
|
+
set(value: T): Promise<void>;
|
|
28
|
+
readonly ref: Readonly<object>;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Defines a request-scoped state with lazy initialization.
|
|
32
|
+
*
|
|
33
|
+
* @param initFn - A function that initializes the state. It is called the first time `get()` is invoked within each request context, and only once per context.
|
|
34
|
+
* @returns A RequestState object with `get` and `set` methods, and a unique `ref` for debugging.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* const userState = defineRequestState(() => ({ id: '', name: '' }));
|
|
38
|
+
* // Later, within a request context:
|
|
39
|
+
* const user = await userState.get();
|
|
40
|
+
*/
|
|
41
|
+
declare function defineRequestState<T>(initFn: () => T | Promise<T>): RequestState<T>;
|
|
42
|
+
//#endregion
|
|
43
|
+
//#region src/context/transaction.d.ts
|
|
44
|
+
/**
|
|
45
|
+
* This is for internal use only. Most users should use `getCurrentAdapter` instead.
|
|
46
|
+
*
|
|
47
|
+
* It is exposed for advanced use cases where you need direct access to the AsyncLocalStorage instance.
|
|
48
|
+
*/
|
|
49
|
+
declare const getCurrentDBAdapterAsyncLocalStorage: () => Promise<AsyncLocalStorage<DBTransactionAdapter>>;
|
|
50
|
+
declare const getCurrentAdapter: (fallback: DBTransactionAdapter) => Promise<DBTransactionAdapter>;
|
|
51
|
+
declare const runWithAdapter: <R>(adapter: DBAdapter, fn: () => R) => Promise<R>;
|
|
52
|
+
declare const runWithTransaction: <R>(adapter: DBAdapter, fn: () => R) => Promise<R>;
|
|
53
|
+
//#endregion
|
|
54
|
+
export { type AuthEndpointContext, type RequestState, type RequestStateWeakMap, defineRequestState, getCurrentAdapter, getCurrentAuthContext, getCurrentAuthContextAsyncLocalStorage, getCurrentDBAdapterAsyncLocalStorage, getCurrentRequestState, getRequestStateAsyncLocalStorage, hasRequestState, runWithAdapter, runWithEndpointContext, runWithRequestState, runWithTransaction };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import "../async_hooks-BfRfbd1J.mjs";
|
|
2
|
+
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-DgQ9XGBl.mjs";
|
|
3
|
+
|
|
4
|
+
export { defineRequestState, getCurrentAdapter, getCurrentAuthContext, getCurrentAuthContextAsyncLocalStorage, getCurrentDBAdapterAsyncLocalStorage, getCurrentRequestState, getRequestStateAsyncLocalStorage, hasRequestState, runWithAdapter, runWithEndpointContext, runWithRequestState, runWithTransaction };
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { t as getAsyncLocalStorage } from "./async_hooks-BfRfbd1J.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/context/endpoint-context.ts
|
|
4
|
+
let currentContextAsyncStorage = null;
|
|
5
|
+
const ensureAsyncStorage$2 = async () => {
|
|
6
|
+
if (!currentContextAsyncStorage) currentContextAsyncStorage = new (await (getAsyncLocalStorage()))();
|
|
7
|
+
return currentContextAsyncStorage;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* This is for internal use only. Most users should use `getCurrentAuthContext` instead.
|
|
11
|
+
*
|
|
12
|
+
* It is exposed for advanced use cases where you need direct access to the AsyncLocalStorage instance.
|
|
13
|
+
*/
|
|
14
|
+
async function getCurrentAuthContextAsyncLocalStorage() {
|
|
15
|
+
return ensureAsyncStorage$2();
|
|
16
|
+
}
|
|
17
|
+
async function getCurrentAuthContext() {
|
|
18
|
+
const context = (await ensureAsyncStorage$2()).getStore();
|
|
19
|
+
if (!context) throw new Error("No auth context found. Please make sure you are calling this function within a `runWithEndpointContext` callback.");
|
|
20
|
+
return context;
|
|
21
|
+
}
|
|
22
|
+
async function runWithEndpointContext(context, fn) {
|
|
23
|
+
return (await ensureAsyncStorage$2()).run(context, fn);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region src/context/request-state.ts
|
|
28
|
+
let requestStateAsyncStorage = null;
|
|
29
|
+
const ensureAsyncStorage$1 = async () => {
|
|
30
|
+
if (!requestStateAsyncStorage) requestStateAsyncStorage = new (await (getAsyncLocalStorage()))();
|
|
31
|
+
return requestStateAsyncStorage;
|
|
32
|
+
};
|
|
33
|
+
async function getRequestStateAsyncLocalStorage() {
|
|
34
|
+
return ensureAsyncStorage$1();
|
|
35
|
+
}
|
|
36
|
+
async function hasRequestState() {
|
|
37
|
+
return (await ensureAsyncStorage$1()).getStore() !== void 0;
|
|
38
|
+
}
|
|
39
|
+
async function getCurrentRequestState() {
|
|
40
|
+
const store = (await ensureAsyncStorage$1()).getStore();
|
|
41
|
+
if (!store) throw new Error("No request state found. Please make sure you are calling this function within a `runWithRequestState` callback.");
|
|
42
|
+
return store;
|
|
43
|
+
}
|
|
44
|
+
async function runWithRequestState(store, fn) {
|
|
45
|
+
return (await ensureAsyncStorage$1()).run(store, fn);
|
|
46
|
+
}
|
|
47
|
+
function defineRequestState(initFn) {
|
|
48
|
+
const ref = Object.freeze({});
|
|
49
|
+
return {
|
|
50
|
+
get ref() {
|
|
51
|
+
return ref;
|
|
52
|
+
},
|
|
53
|
+
async get() {
|
|
54
|
+
const store = await getCurrentRequestState();
|
|
55
|
+
if (!store.has(ref)) {
|
|
56
|
+
const initialValue = await initFn();
|
|
57
|
+
store.set(ref, initialValue);
|
|
58
|
+
return initialValue;
|
|
59
|
+
}
|
|
60
|
+
return store.get(ref);
|
|
61
|
+
},
|
|
62
|
+
async set(value) {
|
|
63
|
+
(await getCurrentRequestState()).set(ref, value);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
//#endregion
|
|
69
|
+
//#region src/context/transaction.ts
|
|
70
|
+
let currentAdapterAsyncStorage = null;
|
|
71
|
+
const ensureAsyncStorage = async () => {
|
|
72
|
+
if (!currentAdapterAsyncStorage) currentAdapterAsyncStorage = new (await (getAsyncLocalStorage()))();
|
|
73
|
+
return currentAdapterAsyncStorage;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* This is for internal use only. Most users should use `getCurrentAdapter` instead.
|
|
77
|
+
*
|
|
78
|
+
* It is exposed for advanced use cases where you need direct access to the AsyncLocalStorage instance.
|
|
79
|
+
*/
|
|
80
|
+
const getCurrentDBAdapterAsyncLocalStorage = async () => {
|
|
81
|
+
return ensureAsyncStorage();
|
|
82
|
+
};
|
|
83
|
+
const getCurrentAdapter = async (fallback) => {
|
|
84
|
+
return ensureAsyncStorage().then((als) => {
|
|
85
|
+
return als.getStore() || fallback;
|
|
86
|
+
}).catch(() => {
|
|
87
|
+
return fallback;
|
|
88
|
+
});
|
|
89
|
+
};
|
|
90
|
+
const runWithAdapter = async (adapter, fn) => {
|
|
91
|
+
let called = true;
|
|
92
|
+
return ensureAsyncStorage().then((als) => {
|
|
93
|
+
called = true;
|
|
94
|
+
return als.run(adapter, fn);
|
|
95
|
+
}).catch((err) => {
|
|
96
|
+
if (!called) return fn();
|
|
97
|
+
throw err;
|
|
98
|
+
});
|
|
99
|
+
};
|
|
100
|
+
const runWithTransaction = async (adapter, fn) => {
|
|
101
|
+
let called = true;
|
|
102
|
+
return ensureAsyncStorage().then((als) => {
|
|
103
|
+
called = true;
|
|
104
|
+
return adapter.transaction(async (trx) => {
|
|
105
|
+
return als.run(trx, fn);
|
|
106
|
+
});
|
|
107
|
+
}).catch((err) => {
|
|
108
|
+
if (!called) return fn();
|
|
109
|
+
throw err;
|
|
110
|
+
});
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
//#endregion
|
|
114
|
+
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,14 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import '../../shared/core.MjcDoj7R.mjs';
|
|
5
|
-
import 'kysely';
|
|
6
|
-
import 'better-sqlite3';
|
|
7
|
-
import 'better-call';
|
|
8
|
-
import 'bun:sqlite';
|
|
9
|
-
import 'node:sqlite';
|
|
10
|
-
import '../../social-providers/index.mjs';
|
|
11
|
-
import '@better-auth/core/oauth2';
|
|
12
|
-
import '../../shared/core.Bisb2Bdk.mjs';
|
|
13
|
-
import '../../shared/core.BwoNUcJQ.mjs';
|
|
14
|
-
import '@better-auth/core';
|
|
1
|
+
import { Gn as DBAdapterDebugLogOption, Hn as CleanedWhere, Jn as DBAdapterSchemaCreation, Kn as DBAdapterFactoryConfig, Qn as Where, Un as CustomAdapter, Wn as DBAdapter, Xn as JoinConfig, Yn as DBTransactionAdapter, Zn as JoinOption, qn as DBAdapterInstance } from "../../index-CkAWdKH8.mjs";
|
|
2
|
+
import "../../index-CdubV7uy.mjs";
|
|
3
|
+
export { CleanedWhere, CustomAdapter, DBAdapter, DBAdapterDebugLogOption, DBAdapterFactoryConfig, DBAdapterInstance, DBAdapterSchemaCreation, DBTransactionAdapter, JoinConfig, JoinOption, Where };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export { };
|
package/dist/db/index.d.mts
CHANGED
|
@@ -1,39 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import * as z from 'zod';
|
|
5
|
-
import '../shared/core.MjcDoj7R.mjs';
|
|
6
|
-
|
|
7
|
-
declare const coreSchema: z.ZodObject<{
|
|
8
|
-
id: z.ZodString;
|
|
9
|
-
createdAt: z.ZodDefault<z.ZodDate>;
|
|
10
|
-
updatedAt: z.ZodDefault<z.ZodDate>;
|
|
11
|
-
}, z.core.$strip>;
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* @deprecated Backport for 1.3.x, we will remove this in 1.4.x
|
|
15
|
-
*/
|
|
16
|
-
type AuthPluginSchema = BetterAuthPluginDBSchema;
|
|
17
|
-
/**
|
|
18
|
-
* @deprecated Backport for 1.3.x, we will remove this in 1.4.x
|
|
19
|
-
*/
|
|
20
|
-
type FieldAttribute = DBFieldAttribute;
|
|
21
|
-
/**
|
|
22
|
-
* @deprecated Backport for 1.3.x, we will remove this in 1.4.x
|
|
23
|
-
*/
|
|
24
|
-
type FieldAttributeConfig = DBFieldAttributeConfig;
|
|
25
|
-
/**
|
|
26
|
-
* @deprecated Backport for 1.3.x, we will remove this in 1.4.x
|
|
27
|
-
*/
|
|
28
|
-
type FieldType = DBFieldType;
|
|
29
|
-
/**
|
|
30
|
-
* @deprecated Backport for 1.3.x, we will remove this in 1.4.x
|
|
31
|
-
*/
|
|
32
|
-
type Primitive = DBPrimitive;
|
|
33
|
-
/**
|
|
34
|
-
* @deprecated Backport for 1.3.x, we will remove this in 1.4.x
|
|
35
|
-
*/
|
|
36
|
-
type BetterAuthDbSchema = BetterAuthDBSchema;
|
|
37
|
-
|
|
38
|
-
export { BetterAuthDBSchema, BetterAuthPluginDBSchema, DBFieldAttribute, DBFieldAttributeConfig, DBFieldType, DBPrimitive, coreSchema };
|
|
39
|
-
export type { AuthPluginSchema, BetterAuthDbSchema, FieldAttribute, FieldAttributeConfig, FieldType, Primitive };
|
|
1
|
+
import { $n as AuthPluginSchema, Cr as SecondaryStorage, Sr as DBPrimitive, _r as BetterAuthDBSchema, ar as Verification, br as DBFieldType, cr as userSchema, dr as sessionSchema, er as BetterAuthDbSchema, fr as RateLimit, gr as BetterAuthPluginDBSchema, hr as accountSchema, ir as Primitive, lr as coreSchema, mr as Account, nr as FieldAttributeConfig, or as verificationSchema, pr as rateLimitSchema, rr as FieldType, sr as User, tr as FieldAttribute, ur as Session, vr as DBFieldAttribute, xr as DBPreservedModels, yr as DBFieldAttributeConfig } from "../index-CkAWdKH8.mjs";
|
|
2
|
+
import "../index-CdubV7uy.mjs";
|
|
3
|
+
export { Account, AuthPluginSchema, BetterAuthDBSchema, BetterAuthDbSchema, BetterAuthPluginDBSchema, DBFieldAttribute, DBFieldAttributeConfig, DBFieldType, DBPreservedModels, DBPrimitive, FieldAttribute, FieldAttributeConfig, FieldType, Primitive, RateLimit, SecondaryStorage, Session, User, Verification, accountSchema, coreSchema, rateLimitSchema, sessionSchema, userSchema, verificationSchema };
|
package/dist/db/index.mjs
CHANGED
|
@@ -1,70 +1,61 @@
|
|
|
1
|
-
import * as z from
|
|
1
|
+
import * as z from "zod";
|
|
2
2
|
|
|
3
|
+
//#region src/db/schema/shared.ts
|
|
3
4
|
const coreSchema = z.object({
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
id: z.string(),
|
|
6
|
+
createdAt: z.date().default(() => /* @__PURE__ */ new Date()),
|
|
7
|
+
updatedAt: z.date().default(() => /* @__PURE__ */ new Date())
|
|
7
8
|
});
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region src/db/schema/account.ts
|
|
12
|
+
const accountSchema = coreSchema.extend({
|
|
13
|
+
providerId: z.string(),
|
|
14
|
+
accountId: z.string(),
|
|
15
|
+
userId: z.coerce.string(),
|
|
16
|
+
accessToken: z.string().nullish(),
|
|
17
|
+
refreshToken: z.string().nullish(),
|
|
18
|
+
idToken: z.string().nullish(),
|
|
19
|
+
accessTokenExpiresAt: z.date().nullish(),
|
|
20
|
+
refreshTokenExpiresAt: z.date().nullish(),
|
|
21
|
+
scope: z.string().nullish(),
|
|
22
|
+
password: z.string().nullish()
|
|
14
23
|
});
|
|
15
24
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
idToken: z.string().nullish(),
|
|
23
|
-
/**
|
|
24
|
-
* Access token expires at
|
|
25
|
-
*/
|
|
26
|
-
accessTokenExpiresAt: z.date().nullish(),
|
|
27
|
-
/**
|
|
28
|
-
* Refresh token expires at
|
|
29
|
-
*/
|
|
30
|
-
refreshTokenExpiresAt: z.date().nullish(),
|
|
31
|
-
/**
|
|
32
|
-
* The scopes that the user has authorized
|
|
33
|
-
*/
|
|
34
|
-
scope: z.string().nullish(),
|
|
35
|
-
/**
|
|
36
|
-
* Password is only stored in the credential provider
|
|
37
|
-
*/
|
|
38
|
-
password: z.string().nullish()
|
|
25
|
+
//#endregion
|
|
26
|
+
//#region src/db/schema/rate-limit.ts
|
|
27
|
+
const rateLimitSchema = z.object({
|
|
28
|
+
key: z.string(),
|
|
29
|
+
count: z.number(),
|
|
30
|
+
lastRequest: z.number()
|
|
39
31
|
});
|
|
40
32
|
|
|
33
|
+
//#endregion
|
|
34
|
+
//#region src/db/schema/session.ts
|
|
41
35
|
const sessionSchema = coreSchema.extend({
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
36
|
+
userId: z.coerce.string(),
|
|
37
|
+
expiresAt: z.date(),
|
|
38
|
+
token: z.string(),
|
|
39
|
+
ipAddress: z.string().nullish(),
|
|
40
|
+
userAgent: z.string().nullish()
|
|
47
41
|
});
|
|
48
42
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
43
|
+
//#endregion
|
|
44
|
+
//#region src/db/schema/user.ts
|
|
45
|
+
const userSchema = coreSchema.extend({
|
|
46
|
+
email: z.string().transform((val) => val.toLowerCase()),
|
|
47
|
+
emailVerified: z.boolean().default(false),
|
|
48
|
+
name: z.string(),
|
|
49
|
+
image: z.string().nullish()
|
|
53
50
|
});
|
|
54
51
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
* The number of requests made
|
|
62
|
-
*/
|
|
63
|
-
count: z.number(),
|
|
64
|
-
/**
|
|
65
|
-
* The last request time in milliseconds
|
|
66
|
-
*/
|
|
67
|
-
lastRequest: z.number()
|
|
52
|
+
//#endregion
|
|
53
|
+
//#region src/db/schema/verification.ts
|
|
54
|
+
const verificationSchema = coreSchema.extend({
|
|
55
|
+
value: z.string(),
|
|
56
|
+
expiresAt: z.date(),
|
|
57
|
+
identifier: z.string()
|
|
68
58
|
});
|
|
69
59
|
|
|
70
|
-
|
|
60
|
+
//#endregion
|
|
61
|
+
export { accountSchema, coreSchema, rateLimitSchema, sessionSchema, userSchema, verificationSchema };
|
package/dist/env/index.d.mts
CHANGED
|
@@ -1,36 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
type EnvObject = Record<string, string | undefined>;
|
|
4
|
-
declare const env: EnvObject;
|
|
5
|
-
declare const nodeENV: string;
|
|
6
|
-
/** Detect if `NODE_ENV` environment variable is `production` */
|
|
7
|
-
declare const isProduction: boolean;
|
|
8
|
-
/** Detect if `NODE_ENV` environment variable is `dev` or `development` */
|
|
9
|
-
declare const isDevelopment: boolean;
|
|
10
|
-
/** Detect if `NODE_ENV` environment variable is `test` */
|
|
11
|
-
declare const isTest: () => boolean;
|
|
12
|
-
/**
|
|
13
|
-
* Get environment variable with fallback
|
|
14
|
-
*/
|
|
15
|
-
declare function getEnvVar<Fallback extends string>(key: string, fallback?: Fallback): Fallback extends string ? string : string | undefined;
|
|
16
|
-
/**
|
|
17
|
-
* Get boolean environment variable
|
|
18
|
-
*/
|
|
19
|
-
declare function getBooleanEnvVar(key: string, fallback?: boolean): boolean;
|
|
20
|
-
/**
|
|
21
|
-
* Common environment variables used in Better Auth
|
|
22
|
-
*/
|
|
23
|
-
declare const ENV: Readonly<{
|
|
24
|
-
readonly BETTER_AUTH_SECRET: string;
|
|
25
|
-
readonly AUTH_SECRET: string;
|
|
26
|
-
readonly BETTER_AUTH_TELEMETRY: string;
|
|
27
|
-
readonly BETTER_AUTH_TELEMETRY_ID: string;
|
|
28
|
-
readonly NODE_ENV: string;
|
|
29
|
-
readonly PACKAGE_VERSION: string;
|
|
30
|
-
readonly BETTER_AUTH_TELEMETRY_ENDPOINT: string;
|
|
31
|
-
}>;
|
|
32
|
-
|
|
33
|
-
declare function getColorDepth(): number;
|
|
34
|
-
|
|
35
|
-
export { ENV, env, getBooleanEnvVar, getColorDepth, getEnvVar, isDevelopment, isProduction, isTest, nodeENV };
|
|
36
|
-
export type { EnvObject };
|
|
1
|
+
import { _ as isTest, a as TTY_COLORS, c as logger, d as EnvObject, f as env, g as isProduction, h as isDevelopment, i as Logger, l as shouldPublishLog, m as getEnvVar, n as LogHandlerParams, o as createLogger, p as getBooleanEnvVar, r as LogLevel, s as levels, t as InternalLogger, u as ENV, v as nodeENV, y as getColorDepth } from "../index-CdubV7uy.mjs";
|
|
2
|
+
export { ENV, EnvObject, InternalLogger, LogHandlerParams, LogLevel, Logger, TTY_COLORS, createLogger, env, getBooleanEnvVar, getColorDepth, getEnvVar, isDevelopment, isProduction, isTest, levels, logger, nodeENV, shouldPublishLog };
|