@better-auth/core 1.3.26 → 1.4.0-beta.10
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 +72 -24
- package/dist/async_hooks/index.cjs +12 -20
- package/dist/async_hooks/index.d.cts +4 -7
- package/dist/async_hooks/index.d.ts +4 -7
- package/dist/async_hooks/index.js +18 -0
- package/dist/chunk-CUT6urMc.cjs +30 -0
- package/dist/db/adapter/index.cjs +0 -0
- package/dist/db/adapter/index.d.cts +7 -0
- package/dist/db/adapter/index.d.ts +7 -0
- package/dist/db/adapter/index.js +1 -0
- package/dist/db/index.cjs +67 -1
- package/dist/db/index.d.cts +3 -130
- package/dist/db/index.d.ts +3 -130
- package/dist/db/index.js +61 -0
- package/dist/env/index.cjs +16 -0
- package/dist/env/index.d.cts +2 -0
- package/dist/env/index.d.ts +2 -0
- package/dist/env/index.js +3 -0
- package/dist/env-B05JceKx.cjs +330 -0
- package/dist/env-BZ5Nwx0e.js +246 -0
- package/dist/error/index.cjs +5 -0
- package/dist/error/index.d.cts +35 -0
- package/dist/error/index.d.ts +35 -0
- package/dist/error/index.js +4 -0
- package/dist/error-Hbg10Ynz.cjs +56 -0
- package/dist/error-ULaqTKlI.js +45 -0
- package/dist/helper-5oNxdxzu.d.ts +6 -0
- package/dist/helper-DVgWo5zB.d.cts +6 -0
- package/dist/index-B7m2jDWm.d.cts +344 -0
- package/dist/index-CESTxPyW.d.cts +82 -0
- package/dist/index-Cw9Gfaxd.d.cts +4410 -0
- package/dist/index-Cx8dCSTo.d.ts +82 -0
- package/dist/index-DJdmnKQr.d.ts +4410 -0
- package/dist/index-DNvIh1jX.d.cts +1870 -0
- package/dist/index-DoyF8K2U.d.ts +344 -0
- package/dist/index-ujq2DkG7.d.ts +1870 -0
- package/dist/index.cjs +0 -2
- package/dist/index.d.cts +7 -2
- package/dist/index.d.ts +7 -2
- package/dist/index.js +1 -0
- package/dist/middleware/index.cjs +22 -0
- package/dist/middleware/index.d.cts +7 -0
- package/dist/middleware/index.d.ts +7 -0
- package/dist/middleware/index.js +18 -0
- package/dist/oauth2/index.cjs +12 -0
- package/dist/oauth2/index.d.cts +3 -0
- package/dist/oauth2/index.d.ts +3 -0
- package/dist/oauth2/index.js +3 -0
- package/dist/oauth2-BokgssHJ.js +239 -0
- package/dist/oauth2-CLON8fY4.cjs +302 -0
- package/dist/social-providers/index.cjs +2410 -0
- package/dist/social-providers/index.d.cts +4 -0
- package/dist/social-providers/index.d.ts +4 -0
- package/dist/social-providers/index.js +2370 -0
- package/dist/type-BNCR-kIK.d.cts +262 -0
- package/dist/type-eT5TjHFp.d.ts +262 -0
- package/dist/utils/index.cjs +3 -0
- package/dist/utils/index.d.cts +9 -0
- package/dist/utils/index.d.ts +9 -0
- package/dist/utils/index.js +3 -0
- package/dist/utils-AcCtPmwG.cjs +13 -0
- package/dist/utils-BQjFFU97.js +7 -0
- package/package.json +116 -10
- package/src/async_hooks/index.ts +1 -9
- package/src/db/adapter/index.ts +448 -0
- package/src/db/index.ts +15 -0
- package/src/db/plugin.ts +11 -0
- package/src/db/schema/account.ts +34 -0
- package/src/db/schema/rate-limit.ts +21 -0
- package/src/db/schema/session.ts +17 -0
- package/src/db/schema/shared.ts +7 -0
- package/src/db/schema/user.ts +16 -0
- package/src/db/schema/verification.ts +15 -0
- package/src/db/type.ts +41 -0
- package/src/env/color-depth.ts +171 -0
- package/src/env/env-impl.ts +123 -0
- package/src/env/index.ts +23 -0
- package/src/env/logger.test.ts +33 -0
- package/src/env/logger.ts +145 -0
- package/src/error/codes.ts +31 -0
- package/src/error/index.ts +11 -0
- package/src/index.ts +1 -1
- package/src/middleware/index.ts +33 -0
- package/src/oauth2/client-credentials-token.ts +102 -0
- package/src/oauth2/create-authorization-url.ts +85 -0
- package/src/oauth2/index.ts +22 -0
- package/src/oauth2/oauth-provider.ts +194 -0
- package/src/oauth2/refresh-access-token.ts +124 -0
- package/src/oauth2/utils.ts +36 -0
- package/src/oauth2/validate-authorization-code.ts +156 -0
- package/src/social-providers/apple.ts +213 -0
- package/src/social-providers/atlassian.ts +127 -0
- package/src/social-providers/cognito.ts +266 -0
- package/src/social-providers/discord.ts +169 -0
- package/src/social-providers/dropbox.ts +112 -0
- package/src/social-providers/facebook.ts +201 -0
- package/src/social-providers/figma.ts +112 -0
- package/src/social-providers/github.ts +154 -0
- package/src/social-providers/gitlab.ts +152 -0
- package/src/social-providers/google.ts +168 -0
- package/src/social-providers/huggingface.ts +116 -0
- package/src/social-providers/index.ts +118 -0
- package/src/social-providers/kakao.ts +178 -0
- package/src/social-providers/kick.ts +92 -0
- package/src/social-providers/line.ts +169 -0
- package/src/social-providers/linear.ts +120 -0
- package/src/social-providers/linkedin.ts +110 -0
- package/src/social-providers/microsoft-entra-id.ts +243 -0
- package/src/social-providers/naver.ts +112 -0
- package/src/social-providers/notion.ts +106 -0
- package/src/social-providers/paypal.ts +261 -0
- package/src/social-providers/reddit.ts +122 -0
- package/src/social-providers/roblox.ts +107 -0
- package/src/social-providers/salesforce.ts +154 -0
- package/src/social-providers/slack.ts +111 -0
- package/src/social-providers/spotify.ts +93 -0
- package/src/social-providers/tiktok.ts +208 -0
- package/src/social-providers/twitch.ts +111 -0
- package/src/social-providers/twitter.ts +194 -0
- package/src/social-providers/vk.ts +125 -0
- package/src/social-providers/zoom.ts +215 -0
- package/src/types/context.ts +270 -0
- package/src/types/cookie.ts +7 -0
- package/src/types/helper.ts +5 -0
- package/src/types/index.ts +20 -1
- package/src/types/init-options.ts +1156 -0
- package/src/types/plugin-client.ts +69 -0
- package/src/types/plugin.ts +134 -0
- package/src/utils/error-codes.ts +51 -0
- package/src/utils/index.ts +1 -0
- package/tsdown.config.ts +19 -0
- package/build.config.ts +0 -16
- package/dist/async_hooks/index.d.mts +0 -10
- package/dist/async_hooks/index.mjs +0 -25
- package/dist/db/index.d.mts +0 -130
- package/dist/db/index.mjs +0 -1
- package/dist/index.d.mts +0 -2
- package/dist/index.mjs +0 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,26 +1,74 @@
|
|
|
1
1
|
|
|
2
|
-
> @better-auth/core@1.
|
|
3
|
-
>
|
|
2
|
+
> @better-auth/core@1.4.0-beta.10 build /home/runner/work/better-auth/better-auth/packages/core
|
|
3
|
+
> tsdown
|
|
4
4
|
|
|
5
|
-
[
|
|
6
|
-
[
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
[
|
|
15
|
-
[
|
|
16
|
-
|
|
17
|
-
[
|
|
18
|
-
|
|
19
|
-
[
|
|
20
|
-
[
|
|
21
|
-
|
|
22
|
-
[
|
|
23
|
-
|
|
24
|
-
[
|
|
25
|
-
|
|
26
|
-
[
|
|
5
|
+
[34mℹ[39m tsdown [2mv0.15.6[22m powered by rolldown [2mv1.0.0-beta.43[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/async_hooks/index.ts, src/db/index.ts, src/env/index.ts, src/error/index.ts, src/middleware/index.ts, src/oauth2/index.ts, src/social-providers/index.ts, src/utils/index.ts, src/db/adapter/index.ts[39m
|
|
8
|
+
[34mℹ[39m tsconfig: [34mtsconfig.json[39m
|
|
9
|
+
[34mℹ[39m Build start
|
|
10
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[1msocial-providers/index.cjs[22m [2m77.23 kB[22m [2m│ gzip: 10.22 kB[22m
|
|
11
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[1mdb/index.cjs[22m [2m 1.86 kB[22m [2m│ gzip: 0.56 kB[22m
|
|
12
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[1masync_hooks/index.cjs[22m [2m 0.88 kB[22m [2m│ gzip: 0.46 kB[22m
|
|
13
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[1moauth2/index.cjs[22m [2m 0.80 kB[22m [2m│ gzip: 0.24 kB[22m
|
|
14
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[1mmiddleware/index.cjs[22m [2m 0.79 kB[22m [2m│ gzip: 0.34 kB[22m
|
|
15
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[1menv/index.cjs[22m [2m 0.67 kB[22m [2m│ gzip: 0.24 kB[22m
|
|
16
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[1merror/index.cjs[22m [2m 0.21 kB[22m [2m│ gzip: 0.14 kB[22m
|
|
17
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[1mutils/index.cjs[22m [2m 0.12 kB[22m [2m│ gzip: 0.10 kB[22m
|
|
18
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[1mdb/adapter/index.cjs[22m [2m 0.00 kB[22m [2m│ gzip: 0.02 kB[22m
|
|
19
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[1mindex.cjs[22m [2m 0.00 kB[22m [2m│ gzip: 0.02 kB[22m
|
|
20
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22moauth2-CLON8fY4.cjs [2m10.87 kB[22m [2m│ gzip: 2.29 kB[22m
|
|
21
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22menv-B05JceKx.cjs [2m 9.16 kB[22m [2m│ gzip: 2.64 kB[22m
|
|
22
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22merror-Hbg10Ynz.cjs [2m 1.98 kB[22m [2m│ gzip: 0.85 kB[22m
|
|
23
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22mchunk-CUT6urMc.cjs [2m 1.09 kB[22m [2m│ gzip: 0.54 kB[22m
|
|
24
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22mutils-AcCtPmwG.cjs [2m 0.23 kB[22m [2m│ gzip: 0.17 kB[22m
|
|
25
|
+
[34mℹ[39m [33m[CJS][39m 15 files, total: 105.88 kB
|
|
26
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[1msocial-providers/index.js[22m [2m 73.39 kB[22m [2m│ gzip: 9.98 kB[22m
|
|
27
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[1mdb/index.js[22m [2m 1.58 kB[22m [2m│ gzip: 0.49 kB[22m
|
|
28
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[1masync_hooks/index.js[22m [2m 0.86 kB[22m [2m│ gzip: 0.46 kB[22m
|
|
29
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[1mmiddleware/index.js[22m [2m 0.57 kB[22m [2m│ gzip: 0.27 kB[22m
|
|
30
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[1moauth2/index.js[22m [2m 0.56 kB[22m [2m│ gzip: 0.18 kB[22m
|
|
31
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[1menv/index.js[22m [2m 0.37 kB[22m [2m│ gzip: 0.18 kB[22m
|
|
32
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[1merror/index.js[22m [2m 0.15 kB[22m [2m│ gzip: 0.12 kB[22m
|
|
33
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[1mutils/index.js[22m [2m 0.09 kB[22m [2m│ gzip: 0.08 kB[22m
|
|
34
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[1mdb/adapter/index.js[22m [2m 0.01 kB[22m [2m│ gzip: 0.03 kB[22m
|
|
35
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[1mindex.js[22m [2m 0.01 kB[22m [2m│ gzip: 0.03 kB[22m
|
|
36
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22moauth2-BokgssHJ.js [2m 9.18 kB[22m [2m│ gzip: 2.10 kB[22m
|
|
37
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22menv-BZ5Nwx0e.js [2m 7.68 kB[22m [2m│ gzip: 2.52 kB[22m
|
|
38
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22merror-ULaqTKlI.js [2m 1.75 kB[22m [2m│ gzip: 0.78 kB[22m
|
|
39
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22mutils-BQjFFU97.js [2m 0.13 kB[22m [2m│ gzip: 0.11 kB[22m
|
|
40
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[32m[1msocial-providers/index.d.ts[22m[39m [2m 3.00 kB[22m [2m│ gzip: 0.62 kB[22m
|
|
41
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[32m[1merror/index.d.ts[22m[39m [2m 1.83 kB[22m [2m│ gzip: 0.71 kB[22m
|
|
42
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[32m[1mdb/index.d.ts[22m[39m [2m 0.86 kB[22m [2m│ gzip: 0.26 kB[22m
|
|
43
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[32m[1mutils/index.d.ts[22m[39m [2m 0.84 kB[22m [2m│ gzip: 0.43 kB[22m
|
|
44
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[32m[1mindex.d.ts[22m[39m [2m 0.79 kB[22m [2m│ gzip: 0.28 kB[22m
|
|
45
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[32m[1moauth2/index.d.ts[22m[39m [2m 0.71 kB[22m [2m│ gzip: 0.23 kB[22m
|
|
46
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[32m[1mdb/adapter/index.d.ts[22m[39m [2m 0.55 kB[22m [2m│ gzip: 0.23 kB[22m
|
|
47
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[32m[1menv/index.d.ts[22m[39m [2m 0.49 kB[22m [2m│ gzip: 0.22 kB[22m
|
|
48
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[32m[1mmiddleware/index.d.ts[22m[39m [2m 0.39 kB[22m [2m│ gzip: 0.18 kB[22m
|
|
49
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[32m[1masync_hooks/index.d.ts[22m[39m [2m 0.24 kB[22m [2m│ gzip: 0.16 kB[22m
|
|
50
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[32mindex-DJdmnKQr.d.ts[39m [2m109.59 kB[22m [2m│ gzip: 13.64 kB[22m
|
|
51
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[32mindex-ujq2DkG7.d.ts[39m [2m 56.16 kB[22m [2m│ gzip: 11.73 kB[22m
|
|
52
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[32mindex-DoyF8K2U.d.ts[39m [2m 8.95 kB[22m [2m│ gzip: 2.13 kB[22m
|
|
53
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[32mtype-eT5TjHFp.d.ts[39m [2m 8.24 kB[22m [2m│ gzip: 2.08 kB[22m
|
|
54
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[32mindex-Cx8dCSTo.d.ts[39m [2m 3.18 kB[22m [2m│ gzip: 1.06 kB[22m
|
|
55
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[32mhelper-5oNxdxzu.d.ts[39m [2m 0.33 kB[22m [2m│ gzip: 0.21 kB[22m
|
|
56
|
+
[34mℹ[39m [34m[ESM][39m 30 files, total: 292.45 kB
|
|
57
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[32m[1msocial-providers/index.d.cts[22m[39m [2m 3.00 kB[22m [2m│ gzip: 0.63 kB[22m
|
|
58
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[32m[1merror/index.d.cts[22m[39m [2m 1.83 kB[22m [2m│ gzip: 0.71 kB[22m
|
|
59
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[32m[1mdb/index.d.cts[22m[39m [2m 0.86 kB[22m [2m│ gzip: 0.26 kB[22m
|
|
60
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[32m[1mutils/index.d.cts[22m[39m [2m 0.84 kB[22m [2m│ gzip: 0.43 kB[22m
|
|
61
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[32m[1mindex.d.cts[22m[39m [2m 0.79 kB[22m [2m│ gzip: 0.28 kB[22m
|
|
62
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[32m[1moauth2/index.d.cts[22m[39m [2m 0.71 kB[22m [2m│ gzip: 0.23 kB[22m
|
|
63
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[32m[1mdb/adapter/index.d.cts[22m[39m [2m 0.55 kB[22m [2m│ gzip: 0.23 kB[22m
|
|
64
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[32m[1menv/index.d.cts[22m[39m [2m 0.50 kB[22m [2m│ gzip: 0.22 kB[22m
|
|
65
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[32m[1mmiddleware/index.d.cts[22m[39m [2m 0.39 kB[22m [2m│ gzip: 0.18 kB[22m
|
|
66
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[32m[1masync_hooks/index.d.cts[22m[39m [2m 0.24 kB[22m [2m│ gzip: 0.16 kB[22m
|
|
67
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[32mindex-Cw9Gfaxd.d.cts[39m [2m109.59 kB[22m [2m│ gzip: 13.64 kB[22m
|
|
68
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[32mindex-DNvIh1jX.d.cts[39m [2m 56.16 kB[22m [2m│ gzip: 11.73 kB[22m
|
|
69
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[32mindex-B7m2jDWm.d.cts[39m [2m 8.95 kB[22m [2m│ gzip: 2.13 kB[22m
|
|
70
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[32mtype-BNCR-kIK.d.cts[39m [2m 8.24 kB[22m [2m│ gzip: 2.08 kB[22m
|
|
71
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[32mindex-CESTxPyW.d.cts[39m [2m 3.18 kB[22m [2m│ gzip: 1.06 kB[22m
|
|
72
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[32mhelper-DVgWo5zB.d.cts[39m [2m 0.33 kB[22m [2m│ gzip: 0.21 kB[22m
|
|
73
|
+
[34mℹ[39m [33m[CJS][39m 16 files, total: 196.16 kB
|
|
74
|
+
[32m✔[39m Build complete in [32m4060ms[39m
|
|
@@ -1,27 +1,19 @@
|
|
|
1
|
-
'use strict';
|
|
2
1
|
|
|
3
|
-
|
|
2
|
+
//#region src/async_hooks/index.ts
|
|
4
3
|
const AsyncLocalStoragePromise = import(
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
/* @vite-ignore */
|
|
5
|
+
/* webpackIgnore: true */
|
|
6
|
+
"node:async_hooks"
|
|
8
7
|
).then((mod) => mod.AsyncLocalStorage).catch((err) => {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
);
|
|
15
|
-
console.warn(
|
|
16
|
-
"[better-auth] Please read more about this warning at https://better-auth.com/docs/installation#mount-handler"
|
|
17
|
-
);
|
|
18
|
-
console.warn(
|
|
19
|
-
"[better-auth] If you are using Cloudflare Workers, please see: https://developers.cloudflare.com/workers/configuration/compatibility-flags/#nodejs-compatibility-flag"
|
|
20
|
-
);
|
|
21
|
-
throw err;
|
|
8
|
+
if ("AsyncLocalStorage" in globalThis) return globalThis.AsyncLocalStorage;
|
|
9
|
+
console.warn("[better-auth] Warning: AsyncLocalStorage is not available in this environment. Some features may not work as expected.");
|
|
10
|
+
console.warn("[better-auth] Please read more about this warning at https://better-auth.com/docs/installation#mount-handler");
|
|
11
|
+
console.warn("[better-auth] If you are using Cloudflare Workers, please see: https://developers.cloudflare.com/workers/configuration/compatibility-flags/#nodejs-compatibility-flag");
|
|
12
|
+
throw err;
|
|
22
13
|
});
|
|
23
14
|
async function getAsyncLocalStorage() {
|
|
24
|
-
|
|
15
|
+
return AsyncLocalStoragePromise;
|
|
25
16
|
}
|
|
26
17
|
|
|
27
|
-
|
|
18
|
+
//#endregion
|
|
19
|
+
exports.getAsyncLocalStorage = getAsyncLocalStorage;
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import { AsyncLocalStorage } from
|
|
2
|
-
export { AsyncLocalStorage } from 'node:async_hooks';
|
|
1
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
* AsyncLocalStorage will be import directly in 1.5.x
|
|
6
|
-
*/
|
|
3
|
+
//#region src/async_hooks/index.d.ts
|
|
7
4
|
|
|
8
5
|
declare function getAsyncLocalStorage(): Promise<typeof AsyncLocalStorage>;
|
|
9
|
-
|
|
10
|
-
export { getAsyncLocalStorage };
|
|
6
|
+
//#endregion
|
|
7
|
+
export { type AsyncLocalStorage, getAsyncLocalStorage };
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import { AsyncLocalStorage } from
|
|
2
|
-
export { AsyncLocalStorage } from 'node:async_hooks';
|
|
1
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
* AsyncLocalStorage will be import directly in 1.5.x
|
|
6
|
-
*/
|
|
3
|
+
//#region src/async_hooks/index.d.ts
|
|
7
4
|
|
|
8
5
|
declare function getAsyncLocalStorage(): Promise<typeof AsyncLocalStorage>;
|
|
9
|
-
|
|
10
|
-
export { getAsyncLocalStorage };
|
|
6
|
+
//#endregion
|
|
7
|
+
export { type AsyncLocalStorage, 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 };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//#region rolldown:runtime
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
+
key = keys[i];
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
+
get: ((k) => from[k]).bind(null, key),
|
|
13
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
19
|
+
value: mod,
|
|
20
|
+
enumerable: true
|
|
21
|
+
}) : target, mod));
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
|
|
25
|
+
Object.defineProperty(exports, '__toESM', {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function () {
|
|
28
|
+
return __toESM;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
File without changes
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import "../../helper-DVgWo5zB.cjs";
|
|
2
|
+
import "../../type-BNCR-kIK.cjs";
|
|
3
|
+
import "../../index-B7m2jDWm.cjs";
|
|
4
|
+
import "../../index-Cw9Gfaxd.cjs";
|
|
5
|
+
import "../../index-CESTxPyW.cjs";
|
|
6
|
+
import { CleanedWhere, CustomAdapter, DBAdapter, DBAdapterDebugLogOption, DBAdapterFactoryConfig, DBAdapterInstance, DBAdapterSchemaCreation, DBTransactionAdapter, Where } from "../../index-DNvIh1jX.cjs";
|
|
7
|
+
export { CleanedWhere, CustomAdapter, DBAdapter, DBAdapterDebugLogOption, DBAdapterFactoryConfig, DBAdapterInstance, DBAdapterSchemaCreation, DBTransactionAdapter, Where };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import "../../helper-5oNxdxzu.js";
|
|
2
|
+
import "../../type-eT5TjHFp.js";
|
|
3
|
+
import "../../index-DoyF8K2U.js";
|
|
4
|
+
import "../../index-DJdmnKQr.js";
|
|
5
|
+
import "../../index-Cx8dCSTo.js";
|
|
6
|
+
import { CleanedWhere, CustomAdapter, DBAdapter, DBAdapterDebugLogOption, DBAdapterFactoryConfig, DBAdapterInstance, DBAdapterSchemaCreation, DBTransactionAdapter, Where } from "../../index-ujq2DkG7.js";
|
|
7
|
+
export { CleanedWhere, CustomAdapter, DBAdapter, DBAdapterDebugLogOption, DBAdapterFactoryConfig, DBAdapterInstance, DBAdapterSchemaCreation, DBTransactionAdapter, Where };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/dist/db/index.cjs
CHANGED
|
@@ -1,2 +1,68 @@
|
|
|
1
|
-
|
|
1
|
+
const require_chunk = require('../chunk-CUT6urMc.cjs');
|
|
2
|
+
let zod = require("zod");
|
|
3
|
+
zod = require_chunk.__toESM(zod);
|
|
2
4
|
|
|
5
|
+
//#region src/db/schema/shared.ts
|
|
6
|
+
const coreSchema = zod.object({
|
|
7
|
+
id: zod.string(),
|
|
8
|
+
createdAt: zod.date().default(() => /* @__PURE__ */ new Date()),
|
|
9
|
+
updatedAt: zod.date().default(() => /* @__PURE__ */ new Date())
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region src/db/schema/user.ts
|
|
14
|
+
const userSchema = coreSchema.extend({
|
|
15
|
+
email: zod.string().transform((val) => val.toLowerCase()),
|
|
16
|
+
emailVerified: zod.boolean().default(false),
|
|
17
|
+
name: zod.string(),
|
|
18
|
+
image: zod.string().nullish()
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region src/db/schema/account.ts
|
|
23
|
+
const accountSchema = coreSchema.extend({
|
|
24
|
+
providerId: zod.string(),
|
|
25
|
+
accountId: zod.string(),
|
|
26
|
+
userId: zod.coerce.string(),
|
|
27
|
+
accessToken: zod.string().nullish(),
|
|
28
|
+
refreshToken: zod.string().nullish(),
|
|
29
|
+
idToken: zod.string().nullish(),
|
|
30
|
+
accessTokenExpiresAt: zod.date().nullish(),
|
|
31
|
+
refreshTokenExpiresAt: zod.date().nullish(),
|
|
32
|
+
scope: zod.string().nullish(),
|
|
33
|
+
password: zod.string().nullish()
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
//#endregion
|
|
37
|
+
//#region src/db/schema/session.ts
|
|
38
|
+
const sessionSchema = coreSchema.extend({
|
|
39
|
+
userId: zod.coerce.string(),
|
|
40
|
+
expiresAt: zod.date(),
|
|
41
|
+
token: zod.string(),
|
|
42
|
+
ipAddress: zod.string().nullish(),
|
|
43
|
+
userAgent: zod.string().nullish()
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
//#endregion
|
|
47
|
+
//#region src/db/schema/verification.ts
|
|
48
|
+
const verificationSchema = coreSchema.extend({
|
|
49
|
+
value: zod.string(),
|
|
50
|
+
expiresAt: zod.date(),
|
|
51
|
+
identifier: zod.string()
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
//#endregion
|
|
55
|
+
//#region src/db/schema/rate-limit.ts
|
|
56
|
+
const rateLimitSchema = zod.object({
|
|
57
|
+
key: zod.string(),
|
|
58
|
+
count: zod.number(),
|
|
59
|
+
lastRequest: zod.number()
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
//#endregion
|
|
63
|
+
exports.accountSchema = accountSchema;
|
|
64
|
+
exports.coreSchema = coreSchema;
|
|
65
|
+
exports.rateLimitSchema = rateLimitSchema;
|
|
66
|
+
exports.sessionSchema = sessionSchema;
|
|
67
|
+
exports.userSchema = userSchema;
|
|
68
|
+
exports.verificationSchema = verificationSchema;
|
package/dist/db/index.d.cts
CHANGED
|
@@ -1,130 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
type DBFieldType = "string" | "number" | "boolean" | "date" | "json" | `${"string" | "number"}[]` | Array<LiteralString>;
|
|
6
|
-
type DBPrimitive = string | number | boolean | Date | null | undefined | string[] | number[];
|
|
7
|
-
type DBFieldAttributeConfig = {
|
|
8
|
-
/**
|
|
9
|
-
* If the field should be required on a new record.
|
|
10
|
-
* @default true
|
|
11
|
-
*/
|
|
12
|
-
required?: boolean;
|
|
13
|
-
/**
|
|
14
|
-
* If the value should be returned on a response body.
|
|
15
|
-
* @default true
|
|
16
|
-
*/
|
|
17
|
-
returned?: boolean;
|
|
18
|
-
/**
|
|
19
|
-
* If a value should be provided when creating a new record.
|
|
20
|
-
* @default true
|
|
21
|
-
*/
|
|
22
|
-
input?: boolean;
|
|
23
|
-
/**
|
|
24
|
-
* Default value for the field
|
|
25
|
-
*
|
|
26
|
-
* Note: This will not create a default value on the database level. It will only
|
|
27
|
-
* be used when creating a new record.
|
|
28
|
-
*/
|
|
29
|
-
defaultValue?: DBPrimitive | (() => DBPrimitive);
|
|
30
|
-
/**
|
|
31
|
-
* Update value for the field
|
|
32
|
-
*
|
|
33
|
-
* Note: This will create an onUpdate trigger on the database level for supported adapters.
|
|
34
|
-
* It will be called when updating a record.
|
|
35
|
-
*/
|
|
36
|
-
onUpdate?: () => DBPrimitive;
|
|
37
|
-
/**
|
|
38
|
-
* transform the value before storing it.
|
|
39
|
-
*/
|
|
40
|
-
transform?: {
|
|
41
|
-
input?: (value: DBPrimitive) => DBPrimitive | Promise<DBPrimitive>;
|
|
42
|
-
output?: (value: DBPrimitive) => DBPrimitive | Promise<DBPrimitive>;
|
|
43
|
-
};
|
|
44
|
-
/**
|
|
45
|
-
* Reference to another model.
|
|
46
|
-
*/
|
|
47
|
-
references?: {
|
|
48
|
-
/**
|
|
49
|
-
* The model to reference.
|
|
50
|
-
*/
|
|
51
|
-
model: string;
|
|
52
|
-
/**
|
|
53
|
-
* The field on the referenced model.
|
|
54
|
-
*/
|
|
55
|
-
field: string;
|
|
56
|
-
/**
|
|
57
|
-
* The action to perform when the reference is deleted.
|
|
58
|
-
* @default "cascade"
|
|
59
|
-
*/
|
|
60
|
-
onDelete?: "no action" | "restrict" | "cascade" | "set null" | "set default";
|
|
61
|
-
};
|
|
62
|
-
unique?: boolean;
|
|
63
|
-
/**
|
|
64
|
-
* If the field should be a bigint on the database instead of integer.
|
|
65
|
-
*/
|
|
66
|
-
bigint?: boolean;
|
|
67
|
-
/**
|
|
68
|
-
* A zod schema to validate the value.
|
|
69
|
-
*/
|
|
70
|
-
validator?: {
|
|
71
|
-
input?: ZodType;
|
|
72
|
-
output?: ZodType;
|
|
73
|
-
};
|
|
74
|
-
/**
|
|
75
|
-
* The name of the field on the database.
|
|
76
|
-
*/
|
|
77
|
-
fieldName?: string;
|
|
78
|
-
/**
|
|
79
|
-
* If the field should be sortable.
|
|
80
|
-
*
|
|
81
|
-
* applicable only for `text` type.
|
|
82
|
-
* It's useful to mark fields varchar instead of text.
|
|
83
|
-
*/
|
|
84
|
-
sortable?: boolean;
|
|
85
|
-
};
|
|
86
|
-
type DBFieldAttribute<T extends DBFieldType = DBFieldType> = {
|
|
87
|
-
type: T;
|
|
88
|
-
} & DBFieldAttributeConfig;
|
|
89
|
-
type BetterAuthDBSchema = Record<string, {
|
|
90
|
-
/**
|
|
91
|
-
* The name of the table in the database
|
|
92
|
-
*/
|
|
93
|
-
modelName: string;
|
|
94
|
-
/**
|
|
95
|
-
* The fields of the table
|
|
96
|
-
*/
|
|
97
|
-
fields: Record<string, DBFieldAttribute>;
|
|
98
|
-
/**
|
|
99
|
-
* Whether to disable migrations for this table
|
|
100
|
-
* @default false
|
|
101
|
-
*/
|
|
102
|
-
disableMigrations?: boolean;
|
|
103
|
-
/**
|
|
104
|
-
* The order of the table
|
|
105
|
-
*/
|
|
106
|
-
order?: number;
|
|
107
|
-
}>;
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* @deprecated Backport for 1.3.x, we will remove this in 1.4.x
|
|
111
|
-
*/
|
|
112
|
-
type FieldAttribute = DBFieldAttribute;
|
|
113
|
-
/**
|
|
114
|
-
* @deprecated Backport for 1.3.x, we will remove this in 1.4.x
|
|
115
|
-
*/
|
|
116
|
-
type FieldAttributeConfig = DBFieldAttributeConfig;
|
|
117
|
-
/**
|
|
118
|
-
* @deprecated Backport for 1.3.x, we will remove this in 1.4.x
|
|
119
|
-
*/
|
|
120
|
-
type FieldType = DBFieldType;
|
|
121
|
-
/**
|
|
122
|
-
* @deprecated Backport for 1.3.x, we will remove this in 1.4.x
|
|
123
|
-
*/
|
|
124
|
-
type Primitive = DBPrimitive;
|
|
125
|
-
/**
|
|
126
|
-
* @deprecated Backport for 1.3.x, we will remove this in 1.4.x
|
|
127
|
-
*/
|
|
128
|
-
type BetterAuthDbSchema = BetterAuthDBSchema;
|
|
129
|
-
|
|
130
|
-
export type { BetterAuthDBSchema, BetterAuthDbSchema, DBFieldAttribute, DBFieldAttributeConfig, DBFieldType, DBPrimitive, FieldAttribute, FieldAttributeConfig, FieldType, Primitive };
|
|
1
|
+
import "../helper-DVgWo5zB.cjs";
|
|
2
|
+
import { 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 } from "../type-BNCR-kIK.cjs";
|
|
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.d.ts
CHANGED
|
@@ -1,130 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
type DBFieldType = "string" | "number" | "boolean" | "date" | "json" | `${"string" | "number"}[]` | Array<LiteralString>;
|
|
6
|
-
type DBPrimitive = string | number | boolean | Date | null | undefined | string[] | number[];
|
|
7
|
-
type DBFieldAttributeConfig = {
|
|
8
|
-
/**
|
|
9
|
-
* If the field should be required on a new record.
|
|
10
|
-
* @default true
|
|
11
|
-
*/
|
|
12
|
-
required?: boolean;
|
|
13
|
-
/**
|
|
14
|
-
* If the value should be returned on a response body.
|
|
15
|
-
* @default true
|
|
16
|
-
*/
|
|
17
|
-
returned?: boolean;
|
|
18
|
-
/**
|
|
19
|
-
* If a value should be provided when creating a new record.
|
|
20
|
-
* @default true
|
|
21
|
-
*/
|
|
22
|
-
input?: boolean;
|
|
23
|
-
/**
|
|
24
|
-
* Default value for the field
|
|
25
|
-
*
|
|
26
|
-
* Note: This will not create a default value on the database level. It will only
|
|
27
|
-
* be used when creating a new record.
|
|
28
|
-
*/
|
|
29
|
-
defaultValue?: DBPrimitive | (() => DBPrimitive);
|
|
30
|
-
/**
|
|
31
|
-
* Update value for the field
|
|
32
|
-
*
|
|
33
|
-
* Note: This will create an onUpdate trigger on the database level for supported adapters.
|
|
34
|
-
* It will be called when updating a record.
|
|
35
|
-
*/
|
|
36
|
-
onUpdate?: () => DBPrimitive;
|
|
37
|
-
/**
|
|
38
|
-
* transform the value before storing it.
|
|
39
|
-
*/
|
|
40
|
-
transform?: {
|
|
41
|
-
input?: (value: DBPrimitive) => DBPrimitive | Promise<DBPrimitive>;
|
|
42
|
-
output?: (value: DBPrimitive) => DBPrimitive | Promise<DBPrimitive>;
|
|
43
|
-
};
|
|
44
|
-
/**
|
|
45
|
-
* Reference to another model.
|
|
46
|
-
*/
|
|
47
|
-
references?: {
|
|
48
|
-
/**
|
|
49
|
-
* The model to reference.
|
|
50
|
-
*/
|
|
51
|
-
model: string;
|
|
52
|
-
/**
|
|
53
|
-
* The field on the referenced model.
|
|
54
|
-
*/
|
|
55
|
-
field: string;
|
|
56
|
-
/**
|
|
57
|
-
* The action to perform when the reference is deleted.
|
|
58
|
-
* @default "cascade"
|
|
59
|
-
*/
|
|
60
|
-
onDelete?: "no action" | "restrict" | "cascade" | "set null" | "set default";
|
|
61
|
-
};
|
|
62
|
-
unique?: boolean;
|
|
63
|
-
/**
|
|
64
|
-
* If the field should be a bigint on the database instead of integer.
|
|
65
|
-
*/
|
|
66
|
-
bigint?: boolean;
|
|
67
|
-
/**
|
|
68
|
-
* A zod schema to validate the value.
|
|
69
|
-
*/
|
|
70
|
-
validator?: {
|
|
71
|
-
input?: ZodType;
|
|
72
|
-
output?: ZodType;
|
|
73
|
-
};
|
|
74
|
-
/**
|
|
75
|
-
* The name of the field on the database.
|
|
76
|
-
*/
|
|
77
|
-
fieldName?: string;
|
|
78
|
-
/**
|
|
79
|
-
* If the field should be sortable.
|
|
80
|
-
*
|
|
81
|
-
* applicable only for `text` type.
|
|
82
|
-
* It's useful to mark fields varchar instead of text.
|
|
83
|
-
*/
|
|
84
|
-
sortable?: boolean;
|
|
85
|
-
};
|
|
86
|
-
type DBFieldAttribute<T extends DBFieldType = DBFieldType> = {
|
|
87
|
-
type: T;
|
|
88
|
-
} & DBFieldAttributeConfig;
|
|
89
|
-
type BetterAuthDBSchema = Record<string, {
|
|
90
|
-
/**
|
|
91
|
-
* The name of the table in the database
|
|
92
|
-
*/
|
|
93
|
-
modelName: string;
|
|
94
|
-
/**
|
|
95
|
-
* The fields of the table
|
|
96
|
-
*/
|
|
97
|
-
fields: Record<string, DBFieldAttribute>;
|
|
98
|
-
/**
|
|
99
|
-
* Whether to disable migrations for this table
|
|
100
|
-
* @default false
|
|
101
|
-
*/
|
|
102
|
-
disableMigrations?: boolean;
|
|
103
|
-
/**
|
|
104
|
-
* The order of the table
|
|
105
|
-
*/
|
|
106
|
-
order?: number;
|
|
107
|
-
}>;
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* @deprecated Backport for 1.3.x, we will remove this in 1.4.x
|
|
111
|
-
*/
|
|
112
|
-
type FieldAttribute = DBFieldAttribute;
|
|
113
|
-
/**
|
|
114
|
-
* @deprecated Backport for 1.3.x, we will remove this in 1.4.x
|
|
115
|
-
*/
|
|
116
|
-
type FieldAttributeConfig = DBFieldAttributeConfig;
|
|
117
|
-
/**
|
|
118
|
-
* @deprecated Backport for 1.3.x, we will remove this in 1.4.x
|
|
119
|
-
*/
|
|
120
|
-
type FieldType = DBFieldType;
|
|
121
|
-
/**
|
|
122
|
-
* @deprecated Backport for 1.3.x, we will remove this in 1.4.x
|
|
123
|
-
*/
|
|
124
|
-
type Primitive = DBPrimitive;
|
|
125
|
-
/**
|
|
126
|
-
* @deprecated Backport for 1.3.x, we will remove this in 1.4.x
|
|
127
|
-
*/
|
|
128
|
-
type BetterAuthDbSchema = BetterAuthDBSchema;
|
|
129
|
-
|
|
130
|
-
export type { BetterAuthDBSchema, BetterAuthDbSchema, DBFieldAttribute, DBFieldAttributeConfig, DBFieldType, DBPrimitive, FieldAttribute, FieldAttributeConfig, FieldType, Primitive };
|
|
1
|
+
import "../helper-5oNxdxzu.js";
|
|
2
|
+
import { 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 } from "../type-eT5TjHFp.js";
|
|
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.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
|
|
3
|
+
//#region src/db/schema/shared.ts
|
|
4
|
+
const coreSchema = z.object({
|
|
5
|
+
id: z.string(),
|
|
6
|
+
createdAt: z.date().default(() => /* @__PURE__ */ new Date()),
|
|
7
|
+
updatedAt: z.date().default(() => /* @__PURE__ */ new Date())
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region src/db/schema/user.ts
|
|
12
|
+
const userSchema = coreSchema.extend({
|
|
13
|
+
email: z.string().transform((val) => val.toLowerCase()),
|
|
14
|
+
emailVerified: z.boolean().default(false),
|
|
15
|
+
name: z.string(),
|
|
16
|
+
image: z.string().nullish()
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
//#endregion
|
|
20
|
+
//#region src/db/schema/account.ts
|
|
21
|
+
const accountSchema = coreSchema.extend({
|
|
22
|
+
providerId: z.string(),
|
|
23
|
+
accountId: z.string(),
|
|
24
|
+
userId: z.coerce.string(),
|
|
25
|
+
accessToken: z.string().nullish(),
|
|
26
|
+
refreshToken: z.string().nullish(),
|
|
27
|
+
idToken: z.string().nullish(),
|
|
28
|
+
accessTokenExpiresAt: z.date().nullish(),
|
|
29
|
+
refreshTokenExpiresAt: z.date().nullish(),
|
|
30
|
+
scope: z.string().nullish(),
|
|
31
|
+
password: z.string().nullish()
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region src/db/schema/session.ts
|
|
36
|
+
const sessionSchema = coreSchema.extend({
|
|
37
|
+
userId: z.coerce.string(),
|
|
38
|
+
expiresAt: z.date(),
|
|
39
|
+
token: z.string(),
|
|
40
|
+
ipAddress: z.string().nullish(),
|
|
41
|
+
userAgent: z.string().nullish()
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
//#endregion
|
|
45
|
+
//#region src/db/schema/verification.ts
|
|
46
|
+
const verificationSchema = coreSchema.extend({
|
|
47
|
+
value: z.string(),
|
|
48
|
+
expiresAt: z.date(),
|
|
49
|
+
identifier: z.string()
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
//#endregion
|
|
53
|
+
//#region src/db/schema/rate-limit.ts
|
|
54
|
+
const rateLimitSchema = z.object({
|
|
55
|
+
key: z.string(),
|
|
56
|
+
count: z.number(),
|
|
57
|
+
lastRequest: z.number()
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
//#endregion
|
|
61
|
+
export { accountSchema, coreSchema, rateLimitSchema, sessionSchema, userSchema, verificationSchema };
|