@better-auth/core 1.4.0-beta.10 → 1.4.0-beta.12
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 +48 -38
- package/dist/{middleware → api}/index.cjs +10 -2
- package/dist/api/index.d.cts +7 -0
- package/dist/api/index.d.ts +7 -0
- package/dist/{middleware → api}/index.js +10 -2
- package/dist/async_hooks/index.cjs +2 -18
- package/dist/async_hooks/index.d.cts +2 -7
- package/dist/async_hooks/index.d.ts +2 -7
- package/dist/async_hooks/index.js +1 -16
- package/dist/async_hooks-CaXONcb9.cjs +24 -0
- package/dist/async_hooks-CkLtIFa6.js +18 -0
- package/dist/context/index.cjs +10 -0
- package/dist/context/index.d.cts +34 -0
- package/dist/context/index.d.ts +34 -0
- package/dist/context/index.js +4 -0
- package/dist/context-CWyHL_gc.js +72 -0
- package/dist/context-DFi3BBSr.cjs +113 -0
- package/dist/db/adapter/index.d.cts +5 -5
- package/dist/db/adapter/index.d.ts +6 -6
- package/dist/db/index.d.cts +1 -1
- package/dist/db/index.d.ts +2 -2
- package/dist/env/index.cjs +1 -1
- package/dist/env/index.d.cts +1 -1
- package/dist/env/index.d.ts +1 -1
- package/dist/env/index.js +1 -1
- package/dist/{env-B05JceKx.cjs → env-Blu2teFF.cjs} +0 -1
- package/dist/{env-BZ5Nwx0e.js → env-eIh_Jcvf.js} +0 -1
- package/dist/error/index.cjs +2 -2
- package/dist/error/index.js +2 -2
- package/dist/{error-ULaqTKlI.js → error-H6U5qGNP.js} +1 -1
- package/dist/{error-Hbg10Ynz.cjs → error-k9KM7GAb.cjs} +1 -1
- package/dist/{index-DJdmnKQr.d.ts → index-BPsqLi68.d.ts} +1 -1
- package/dist/{index-DNvIh1jX.d.cts → index-CJB1zxVC.d.cts} +1446 -1586
- package/dist/index-CfJcErGc.d.ts +7 -0
- package/dist/{type-BNCR-kIK.d.cts → index-CgIE2ECh.d.cts} +125 -125
- package/dist/{index-DoyF8K2U.d.ts → index-ChlC5Vy3.d.ts} +1 -1
- package/dist/{type-eT5TjHFp.d.ts → index-Cmh0x42V.d.ts} +126 -126
- package/dist/index-CoizSMoE.d.cts +7 -0
- package/dist/{index-Cw9Gfaxd.d.cts → index-ehsSkBxt.d.cts} +1 -1
- package/dist/{index-ujq2DkG7.d.ts → index-jMi85fzG.d.ts} +1446 -1586
- package/dist/index.d.cts +64 -6
- package/dist/index.d.ts +65 -7
- package/dist/oauth2/index.cjs +1 -1
- package/dist/oauth2/index.d.cts +1 -1
- package/dist/oauth2/index.d.ts +2 -2
- package/dist/oauth2/index.js +1 -1
- package/dist/social-providers/index.cjs +6 -6
- package/dist/social-providers/index.d.cts +2 -2
- package/dist/social-providers/index.d.ts +3 -3
- package/dist/social-providers/index.js +5 -5
- package/dist/utils/index.cjs +1 -1
- package/dist/utils/index.js +1 -1
- package/package.json +24 -13
- package/src/api/index.ts +57 -0
- package/src/context/endpoint-context.ts +48 -0
- package/src/context/index.ts +12 -0
- package/src/context/transaction.ts +72 -0
- package/src/db/index.ts +1 -2
- package/src/env/color-depth.ts +5 -4
- package/src/types/context.ts +9 -45
- package/src/types/index.ts +1 -1
- package/src/types/init-options.ts +30 -11
- package/src/types/plugin.ts +10 -8
- package/tsdown.config.ts +2 -1
- package/dist/middleware/index.d.cts +0 -7
- package/dist/middleware/index.d.ts +0 -7
- package/src/middleware/index.ts +0 -33
- /package/dist/{helper-5oNxdxzu.d.ts → helper-Dm5AtPVS.d.ts} +0 -0
- /package/dist/{index-CESTxPyW.d.cts → index-CsHMVqbX.d.ts} +0 -0
- /package/dist/{index-Cx8dCSTo.d.ts → index-DFwrZMma.d.cts} +0 -0
- /package/dist/{index-B7m2jDWm.d.cts → index-_Oiv-VVr.d.cts} +0 -0
- /package/dist/{oauth2-BokgssHJ.js → oauth2-D_FUKfC8.js} +0 -0
- /package/dist/{oauth2-CLON8fY4.cjs → oauth2-DqX_pPhp.cjs} +0 -0
- /package/dist/{utils-AcCtPmwG.cjs → utils-Bs-jKit4.cjs} +0 -0
- /package/dist/{utils-BQjFFU97.js → utils-Sn10glI8.js} +0 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,74 +1,84 @@
|
|
|
1
1
|
|
|
2
|
-
> @better-auth/core@1.4.0-beta.
|
|
2
|
+
> @better-auth/core@1.4.0-beta.12 build /home/runner/work/better-auth/better-auth/packages/core
|
|
3
3
|
> tsdown
|
|
4
4
|
|
|
5
5
|
[34mℹ[39m tsdown [2mv0.15.6[22m powered by rolldown [2mv1.0.0-beta.43[22m
|
|
6
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/
|
|
7
|
+
[34mℹ[39m entry: [34msrc/index.ts, src/api/index.ts, src/async_hooks/index.ts, src/context/index.ts, src/db/index.ts, src/env/index.ts, src/error/index.ts, src/oauth2/index.ts, src/social-providers/index.ts, src/utils/index.ts, src/db/adapter/index.ts[39m
|
|
8
8
|
[34mℹ[39m tsconfig: [34mtsconfig.json[39m
|
|
9
9
|
[34mℹ[39m Build start
|
|
10
10
|
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[1msocial-providers/index.cjs[22m [2m77.23 kB[22m [2m│ gzip: 10.22 kB[22m
|
|
11
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[
|
|
12
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[1mapi/index.cjs[22m [2m 1.07 kB[22m [2m│ gzip: 0.46 kB[22m
|
|
13
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
14
|
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[1menv/index.cjs[22m [2m 0.67 kB[22m [2m│ gzip: 0.24 kB[22m
|
|
15
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[1mcontext/index.cjs[22m [2m 0.64 kB[22m [2m│ gzip: 0.21 kB[22m
|
|
16
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[1masync_hooks/index.cjs[22m [2m 0.14 kB[22m [2m│ gzip: 0.11 kB[22m
|
|
17
18
|
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[1mutils/index.cjs[22m [2m 0.12 kB[22m [2m│ gzip: 0.10 kB[22m
|
|
18
19
|
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[1mdb/adapter/index.cjs[22m [2m 0.00 kB[22m [2m│ gzip: 0.02 kB[22m
|
|
19
20
|
[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-
|
|
21
|
-
[34mℹ[39m [33m[CJS][39m [2mdist/[22menv-
|
|
22
|
-
[34mℹ[39m [33m[CJS][39m [2mdist/[
|
|
21
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22moauth2-DqX_pPhp.cjs [2m10.87 kB[22m [2m│ gzip: 2.29 kB[22m
|
|
22
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22menv-Blu2teFF.cjs [2m 9.08 kB[22m [2m│ gzip: 2.62 kB[22m
|
|
23
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22mcontext-DFi3BBSr.cjs [2m 3.34 kB[22m [2m│ gzip: 0.79 kB[22m
|
|
24
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22merror-k9KM7GAb.cjs [2m 1.98 kB[22m [2m│ gzip: 0.86 kB[22m
|
|
23
25
|
[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/[
|
|
25
|
-
[34mℹ[39m [33m[CJS][39m
|
|
26
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22masync_hooks-CaXONcb9.cjs [2m 0.97 kB[22m [2m│ gzip: 0.51 kB[22m
|
|
27
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22mutils-Bs-jKit4.cjs [2m 0.23 kB[22m [2m│ gzip: 0.17 kB[22m
|
|
28
|
+
[34mℹ[39m [33m[CJS][39m 18 files, total: 110.27 kB
|
|
26
29
|
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[1msocial-providers/index.js[22m [2m 73.39 kB[22m [2m│ gzip: 9.98 kB[22m
|
|
27
30
|
[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[
|
|
29
|
-
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[
|
|
30
|
-
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[
|
|
31
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[1mapi/index.js[22m [2m 0.83 kB[22m [2m│ gzip: 0.40 kB[22m
|
|
32
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[1moauth2/index.js[22m [2m 0.56 kB[22m [2m│ gzip: 0.19 kB[22m
|
|
33
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[1mcontext/index.js[22m [2m 0.45 kB[22m [2m│ gzip: 0.18 kB[22m
|
|
31
34
|
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[1menv/index.js[22m [2m 0.37 kB[22m [2m│ gzip: 0.18 kB[22m
|
|
32
35
|
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[1merror/index.js[22m [2m 0.15 kB[22m [2m│ gzip: 0.12 kB[22m
|
|
36
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[1masync_hooks/index.js[22m [2m 0.10 kB[22m [2m│ gzip: 0.09 kB[22m
|
|
33
37
|
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[1mutils/index.js[22m [2m 0.09 kB[22m [2m│ gzip: 0.08 kB[22m
|
|
34
38
|
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[1mdb/adapter/index.js[22m [2m 0.01 kB[22m [2m│ gzip: 0.03 kB[22m
|
|
35
39
|
[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-
|
|
37
|
-
[34mℹ[39m [34m[ESM][39m [2mdist/[22menv-
|
|
38
|
-
[34mℹ[39m [34m[ESM][39m [2mdist/[
|
|
39
|
-
[34mℹ[39m [34m[ESM][39m [2mdist/[
|
|
40
|
-
[34mℹ[39m [34m[ESM][39m [2mdist/[
|
|
40
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22moauth2-D_FUKfC8.js [2m 9.18 kB[22m [2m│ gzip: 2.10 kB[22m
|
|
41
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22menv-eIh_Jcvf.js [2m 7.60 kB[22m [2m│ gzip: 2.50 kB[22m
|
|
42
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22mcontext-CWyHL_gc.js [2m 2.46 kB[22m [2m│ gzip: 0.69 kB[22m
|
|
43
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22merror-H6U5qGNP.js [2m 1.75 kB[22m [2m│ gzip: 0.78 kB[22m
|
|
44
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22masync_hooks-CkLtIFa6.js [2m 0.86 kB[22m [2m│ gzip: 0.46 kB[22m
|
|
45
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22mutils-Sn10glI8.js [2m 0.13 kB[22m [2m│ gzip: 0.11 kB[22m
|
|
46
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[32m[1msocial-providers/index.d.ts[22m[39m [2m 3.00 kB[22m [2m│ gzip: 0.63 kB[22m
|
|
47
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[32m[1mindex.d.ts[22m[39m [2m 2.44 kB[22m [2m│ gzip: 0.93 kB[22m
|
|
48
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[32m[1mcontext/index.d.ts[22m[39m [2m 1.87 kB[22m [2m│ gzip: 0.59 kB[22m
|
|
41
49
|
[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
50
|
[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
51
|
[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
52
|
[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.
|
|
53
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[32m[1mdb/adapter/index.d.ts[22m[39m [2m 0.55 kB[22m [2m│ gzip: 0.22 kB[22m
|
|
47
54
|
[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[
|
|
49
|
-
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[32m[1masync_hooks/index.d.ts[22m[39m [2m 0.
|
|
50
|
-
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[32mindex-
|
|
51
|
-
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[32mindex-
|
|
52
|
-
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[32mindex-
|
|
53
|
-
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[
|
|
54
|
-
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[32mindex-
|
|
55
|
-
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[32mhelper-
|
|
56
|
-
[34mℹ[39m [34m[ESM][39m
|
|
55
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[32m[1mapi/index.d.ts[22m[39m [2m 0.39 kB[22m [2m│ gzip: 0.17 kB[22m
|
|
56
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[32m[1masync_hooks/index.d.ts[22m[39m [2m 0.13 kB[22m [2m│ gzip: 0.09 kB[22m
|
|
57
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[32mindex-BPsqLi68.d.ts[39m [2m109.59 kB[22m [2m│ gzip: 13.64 kB[22m
|
|
58
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[32mindex-jMi85fzG.d.ts[39m [2m 50.86 kB[22m [2m│ gzip: 10.78 kB[22m
|
|
59
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[32mindex-ChlC5Vy3.d.ts[39m [2m 8.95 kB[22m [2m│ gzip: 2.13 kB[22m
|
|
60
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[32mindex-Cmh0x42V.d.ts[39m [2m 8.24 kB[22m [2m│ gzip: 2.05 kB[22m
|
|
61
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[32mindex-CsHMVqbX.d.ts[39m [2m 3.18 kB[22m [2m│ gzip: 1.06 kB[22m
|
|
62
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[32mhelper-Dm5AtPVS.d.ts[39m [2m 0.33 kB[22m [2m│ gzip: 0.21 kB[22m
|
|
63
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[32mindex-CfJcErGc.d.ts[39m [2m 0.24 kB[22m [2m│ gzip: 0.16 kB[22m
|
|
64
|
+
[34mℹ[39m [34m[ESM][39m 35 files, total: 294.00 kB
|
|
57
65
|
[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
|
|
66
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[32m[1mindex.d.cts[22m[39m [2m 2.44 kB[22m [2m│ gzip: 0.92 kB[22m
|
|
67
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[32m[1mcontext/index.d.cts[22m[39m [2m 1.88 kB[22m [2m│ gzip: 0.59 kB[22m
|
|
58
68
|
[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
69
|
[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
70
|
[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
71
|
[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
72
|
[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
73
|
[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[
|
|
66
|
-
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[32m[1masync_hooks/index.d.cts[22m[39m [2m 0.
|
|
67
|
-
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[32mindex-
|
|
68
|
-
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[32mindex-
|
|
69
|
-
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[32mindex-
|
|
70
|
-
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[
|
|
71
|
-
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[32mindex-
|
|
74
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[32m[1mapi/index.d.cts[22m[39m [2m 0.39 kB[22m [2m│ gzip: 0.18 kB[22m
|
|
75
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[32m[1masync_hooks/index.d.cts[22m[39m [2m 0.13 kB[22m [2m│ gzip: 0.09 kB[22m
|
|
76
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[32mindex-ehsSkBxt.d.cts[39m [2m109.59 kB[22m [2m│ gzip: 13.64 kB[22m
|
|
77
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[32mindex-CJB1zxVC.d.cts[39m [2m 50.86 kB[22m [2m│ gzip: 10.78 kB[22m
|
|
78
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[32mindex-_Oiv-VVr.d.cts[39m [2m 8.95 kB[22m [2m│ gzip: 2.13 kB[22m
|
|
79
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[32mindex-CgIE2ECh.d.cts[39m [2m 8.24 kB[22m [2m│ gzip: 2.06 kB[22m
|
|
80
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[32mindex-DFwrZMma.d.cts[39m [2m 3.18 kB[22m [2m│ gzip: 1.06 kB[22m
|
|
72
81
|
[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
|
|
74
|
-
[
|
|
82
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[32mindex-CoizSMoE.d.cts[39m [2m 0.24 kB[22m [2m│ gzip: 0.16 kB[22m
|
|
83
|
+
[34mℹ[39m [33m[CJS][39m 18 files, total: 194.53 kB
|
|
84
|
+
[32m✔[39m Build complete in [32m3787ms[39m
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
const require_chunk = require('../chunk-CUT6urMc.cjs');
|
|
2
|
+
require('../async_hooks-CaXONcb9.cjs');
|
|
3
|
+
const require_context = require('../context-DFi3BBSr.cjs');
|
|
2
4
|
let better_call = require("better-call");
|
|
3
5
|
better_call = require_chunk.__toESM(better_call);
|
|
4
6
|
|
|
5
|
-
//#region src/
|
|
7
|
+
//#region src/api/index.ts
|
|
6
8
|
const optionsMiddleware = (0, better_call.createMiddleware)(async () => {
|
|
7
9
|
/**
|
|
8
10
|
* This will be passed on the instance of
|
|
@@ -14,7 +16,13 @@ const optionsMiddleware = (0, better_call.createMiddleware)(async () => {
|
|
|
14
16
|
const createAuthMiddleware = better_call.createMiddleware.create({ use: [optionsMiddleware, (0, better_call.createMiddleware)(async () => {
|
|
15
17
|
return {};
|
|
16
18
|
})] });
|
|
17
|
-
const
|
|
19
|
+
const use = [optionsMiddleware];
|
|
20
|
+
const createAuthEndpoint = (path, options, handler) => {
|
|
21
|
+
return (0, better_call.createEndpoint)(path, {
|
|
22
|
+
...options,
|
|
23
|
+
use: [...options?.use || [], ...use]
|
|
24
|
+
}, async (ctx) => require_context.runWithEndpointContext(ctx, () => handler(ctx)));
|
|
25
|
+
};
|
|
18
26
|
|
|
19
27
|
//#endregion
|
|
20
28
|
exports.createAuthEndpoint = createAuthEndpoint;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import "../helper-DVgWo5zB.cjs";
|
|
2
|
+
import "../index-CgIE2ECh.cjs";
|
|
3
|
+
import { AuthEndpoint, AuthMiddleware, createAuthEndpoint, createAuthMiddleware, optionsMiddleware } from "../index-CJB1zxVC.cjs";
|
|
4
|
+
import "../index-_Oiv-VVr.cjs";
|
|
5
|
+
import "../index-ehsSkBxt.cjs";
|
|
6
|
+
import "../index-DFwrZMma.cjs";
|
|
7
|
+
export { AuthEndpoint, AuthMiddleware, createAuthEndpoint, createAuthMiddleware, optionsMiddleware };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import "../helper-Dm5AtPVS.js";
|
|
2
|
+
import "../index-Cmh0x42V.js";
|
|
3
|
+
import { AuthEndpoint, AuthMiddleware, createAuthEndpoint, createAuthMiddleware, optionsMiddleware } from "../index-jMi85fzG.js";
|
|
4
|
+
import "../index-ChlC5Vy3.js";
|
|
5
|
+
import "../index-BPsqLi68.js";
|
|
6
|
+
import "../index-CsHMVqbX.js";
|
|
7
|
+
export { AuthEndpoint, AuthMiddleware, createAuthEndpoint, createAuthMiddleware, optionsMiddleware };
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import "../async_hooks-CkLtIFa6.js";
|
|
2
|
+
import { runWithEndpointContext } from "../context-CWyHL_gc.js";
|
|
1
3
|
import { createEndpoint, createMiddleware } from "better-call";
|
|
2
4
|
|
|
3
|
-
//#region src/
|
|
5
|
+
//#region src/api/index.ts
|
|
4
6
|
const optionsMiddleware = createMiddleware(async () => {
|
|
5
7
|
/**
|
|
6
8
|
* This will be passed on the instance of
|
|
@@ -12,7 +14,13 @@ const optionsMiddleware = createMiddleware(async () => {
|
|
|
12
14
|
const createAuthMiddleware = createMiddleware.create({ use: [optionsMiddleware, createMiddleware(async () => {
|
|
13
15
|
return {};
|
|
14
16
|
})] });
|
|
15
|
-
const
|
|
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
|
+
};
|
|
16
24
|
|
|
17
25
|
//#endregion
|
|
18
26
|
export { createAuthEndpoint, createAuthMiddleware, optionsMiddleware };
|
|
@@ -1,19 +1,3 @@
|
|
|
1
|
+
const require_async_hooks = require('../async_hooks-CaXONcb9.cjs');
|
|
1
2
|
|
|
2
|
-
|
|
3
|
-
const AsyncLocalStoragePromise = import(
|
|
4
|
-
/* @vite-ignore */
|
|
5
|
-
/* webpackIgnore: true */
|
|
6
|
-
"node:async_hooks"
|
|
7
|
-
).then((mod) => mod.AsyncLocalStorage).catch((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;
|
|
13
|
-
});
|
|
14
|
-
async function getAsyncLocalStorage() {
|
|
15
|
-
return AsyncLocalStoragePromise;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
//#endregion
|
|
19
|
-
exports.getAsyncLocalStorage = getAsyncLocalStorage;
|
|
3
|
+
exports.getAsyncLocalStorage = require_async_hooks.getAsyncLocalStorage;
|
|
@@ -1,7 +1,2 @@
|
|
|
1
|
-
import { AsyncLocalStorage } from "
|
|
2
|
-
|
|
3
|
-
//#region src/async_hooks/index.d.ts
|
|
4
|
-
|
|
5
|
-
declare function getAsyncLocalStorage(): Promise<typeof AsyncLocalStorage>;
|
|
6
|
-
//#endregion
|
|
7
|
-
export { type AsyncLocalStorage, getAsyncLocalStorage };
|
|
1
|
+
import { AsyncLocalStorage, getAsyncLocalStorage } from "../index-CoizSMoE.cjs";
|
|
2
|
+
export { AsyncLocalStorage, getAsyncLocalStorage };
|
|
@@ -1,7 +1,2 @@
|
|
|
1
|
-
import { AsyncLocalStorage } from "
|
|
2
|
-
|
|
3
|
-
//#region src/async_hooks/index.d.ts
|
|
4
|
-
|
|
5
|
-
declare function getAsyncLocalStorage(): Promise<typeof AsyncLocalStorage>;
|
|
6
|
-
//#endregion
|
|
7
|
-
export { type AsyncLocalStorage, getAsyncLocalStorage };
|
|
1
|
+
import { AsyncLocalStorage, getAsyncLocalStorage } from "../index-CfJcErGc.js";
|
|
2
|
+
export { AsyncLocalStorage, getAsyncLocalStorage };
|
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
|
|
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
|
-
}
|
|
1
|
+
import { getAsyncLocalStorage } from "../async_hooks-CkLtIFa6.js";
|
|
16
2
|
|
|
17
|
-
//#endregion
|
|
18
3
|
export { getAsyncLocalStorage };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/async_hooks/index.ts
|
|
3
|
+
const AsyncLocalStoragePromise = import(
|
|
4
|
+
/* @vite-ignore */
|
|
5
|
+
/* webpackIgnore: true */
|
|
6
|
+
"node:async_hooks"
|
|
7
|
+
).then((mod) => mod.AsyncLocalStorage).catch((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;
|
|
13
|
+
});
|
|
14
|
+
async function getAsyncLocalStorage() {
|
|
15
|
+
return AsyncLocalStoragePromise;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
19
|
+
Object.defineProperty(exports, 'getAsyncLocalStorage', {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function () {
|
|
22
|
+
return getAsyncLocalStorage;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
@@ -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,10 @@
|
|
|
1
|
+
require('../async_hooks-CaXONcb9.cjs');
|
|
2
|
+
const require_context = require('../context-DFi3BBSr.cjs');
|
|
3
|
+
|
|
4
|
+
exports.getCurrentAdapter = require_context.getCurrentAdapter;
|
|
5
|
+
exports.getCurrentAuthContext = require_context.getCurrentAuthContext;
|
|
6
|
+
exports.getCurrentAuthContextAsyncLocalStorage = require_context.getCurrentAuthContextAsyncLocalStorage;
|
|
7
|
+
exports.getCurrentDBAdapterAsyncLocalStorage = require_context.getCurrentDBAdapterAsyncLocalStorage;
|
|
8
|
+
exports.runWithAdapter = require_context.runWithAdapter;
|
|
9
|
+
exports.runWithEndpointContext = require_context.runWithEndpointContext;
|
|
10
|
+
exports.runWithTransaction = require_context.runWithTransaction;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import "../helper-DVgWo5zB.cjs";
|
|
2
|
+
import "../index-CgIE2ECh.cjs";
|
|
3
|
+
import { AuthContext, DBAdapter, DBTransactionAdapter } from "../index-CJB1zxVC.cjs";
|
|
4
|
+
import "../index-_Oiv-VVr.cjs";
|
|
5
|
+
import "../index-ehsSkBxt.cjs";
|
|
6
|
+
import "../index-DFwrZMma.cjs";
|
|
7
|
+
import { AsyncLocalStorage } from "../index-CoizSMoE.cjs";
|
|
8
|
+
import { EndpointContext, InputContext } from "better-call";
|
|
9
|
+
|
|
10
|
+
//#region src/context/transaction.d.ts
|
|
11
|
+
/**
|
|
12
|
+
* This is for internal use only. Most users should use `getCurrentAdapter` instead.
|
|
13
|
+
*
|
|
14
|
+
* It is exposed for advanced use cases where you need direct access to the AsyncLocalStorage instance.
|
|
15
|
+
*/
|
|
16
|
+
declare const getCurrentDBAdapterAsyncLocalStorage: () => Promise<AsyncLocalStorage<DBTransactionAdapter>>;
|
|
17
|
+
declare const getCurrentAdapter: (fallback: DBTransactionAdapter) => Promise<DBTransactionAdapter>;
|
|
18
|
+
declare const runWithAdapter: <R>(adapter: DBAdapter, fn: () => R) => Promise<R>;
|
|
19
|
+
declare const runWithTransaction: <R>(adapter: DBAdapter, fn: () => R) => Promise<R>;
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/context/endpoint-context.d.ts
|
|
22
|
+
type AuthEndpointContext = Partial<InputContext<string, any> & EndpointContext<string, any>> & {
|
|
23
|
+
context: AuthContext;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* This is for internal use only. Most users should use `getCurrentAuthContext` instead.
|
|
27
|
+
*
|
|
28
|
+
* It is exposed for advanced use cases where you need direct access to the AsyncLocalStorage instance.
|
|
29
|
+
*/
|
|
30
|
+
declare function getCurrentAuthContextAsyncLocalStorage(): Promise<AsyncLocalStorage<AuthEndpointContext>>;
|
|
31
|
+
declare function getCurrentAuthContext(): Promise<AuthEndpointContext>;
|
|
32
|
+
declare function runWithEndpointContext<T>(context: AuthEndpointContext, fn: () => T): Promise<T>;
|
|
33
|
+
//#endregion
|
|
34
|
+
export { type AuthEndpointContext, getCurrentAdapter, getCurrentAuthContext, getCurrentAuthContextAsyncLocalStorage, getCurrentDBAdapterAsyncLocalStorage, runWithAdapter, runWithEndpointContext, runWithTransaction };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import "../helper-Dm5AtPVS.js";
|
|
2
|
+
import "../index-Cmh0x42V.js";
|
|
3
|
+
import { AuthContext, DBAdapter, DBTransactionAdapter } from "../index-jMi85fzG.js";
|
|
4
|
+
import "../index-ChlC5Vy3.js";
|
|
5
|
+
import "../index-BPsqLi68.js";
|
|
6
|
+
import "../index-CsHMVqbX.js";
|
|
7
|
+
import { AsyncLocalStorage } from "../index-CfJcErGc.js";
|
|
8
|
+
import { EndpointContext, InputContext } from "better-call";
|
|
9
|
+
|
|
10
|
+
//#region src/context/transaction.d.ts
|
|
11
|
+
/**
|
|
12
|
+
* This is for internal use only. Most users should use `getCurrentAdapter` instead.
|
|
13
|
+
*
|
|
14
|
+
* It is exposed for advanced use cases where you need direct access to the AsyncLocalStorage instance.
|
|
15
|
+
*/
|
|
16
|
+
declare const getCurrentDBAdapterAsyncLocalStorage: () => Promise<AsyncLocalStorage<DBTransactionAdapter>>;
|
|
17
|
+
declare const getCurrentAdapter: (fallback: DBTransactionAdapter) => Promise<DBTransactionAdapter>;
|
|
18
|
+
declare const runWithAdapter: <R>(adapter: DBAdapter, fn: () => R) => Promise<R>;
|
|
19
|
+
declare const runWithTransaction: <R>(adapter: DBAdapter, fn: () => R) => Promise<R>;
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/context/endpoint-context.d.ts
|
|
22
|
+
type AuthEndpointContext = Partial<InputContext<string, any> & EndpointContext<string, any>> & {
|
|
23
|
+
context: AuthContext;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* This is for internal use only. Most users should use `getCurrentAuthContext` instead.
|
|
27
|
+
*
|
|
28
|
+
* It is exposed for advanced use cases where you need direct access to the AsyncLocalStorage instance.
|
|
29
|
+
*/
|
|
30
|
+
declare function getCurrentAuthContextAsyncLocalStorage(): Promise<AsyncLocalStorage<AuthEndpointContext>>;
|
|
31
|
+
declare function getCurrentAuthContext(): Promise<AuthEndpointContext>;
|
|
32
|
+
declare function runWithEndpointContext<T>(context: AuthEndpointContext, fn: () => T): Promise<T>;
|
|
33
|
+
//#endregion
|
|
34
|
+
export { type AuthEndpointContext, getCurrentAdapter, getCurrentAuthContext, getCurrentAuthContextAsyncLocalStorage, getCurrentDBAdapterAsyncLocalStorage, runWithAdapter, runWithEndpointContext, runWithTransaction };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import "../async_hooks-CkLtIFa6.js";
|
|
2
|
+
import { getCurrentAdapter, getCurrentAuthContext, getCurrentAuthContextAsyncLocalStorage, getCurrentDBAdapterAsyncLocalStorage, runWithAdapter, runWithEndpointContext, runWithTransaction } from "../context-CWyHL_gc.js";
|
|
3
|
+
|
|
4
|
+
export { getCurrentAdapter, getCurrentAuthContext, getCurrentAuthContextAsyncLocalStorage, getCurrentDBAdapterAsyncLocalStorage, runWithAdapter, runWithEndpointContext, runWithTransaction };
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { getAsyncLocalStorage } from "./async_hooks-CkLtIFa6.js";
|
|
2
|
+
|
|
3
|
+
//#region src/context/transaction.ts
|
|
4
|
+
let currentAdapterAsyncStorage = null;
|
|
5
|
+
const ensureAsyncStorage$1 = async () => {
|
|
6
|
+
if (!currentAdapterAsyncStorage) currentAdapterAsyncStorage = new (await (getAsyncLocalStorage()))();
|
|
7
|
+
return currentAdapterAsyncStorage;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* This is for internal use only. Most users should use `getCurrentAdapter` instead.
|
|
11
|
+
*
|
|
12
|
+
* It is exposed for advanced use cases where you need direct access to the AsyncLocalStorage instance.
|
|
13
|
+
*/
|
|
14
|
+
const getCurrentDBAdapterAsyncLocalStorage = async () => {
|
|
15
|
+
return ensureAsyncStorage$1();
|
|
16
|
+
};
|
|
17
|
+
const getCurrentAdapter = async (fallback) => {
|
|
18
|
+
return ensureAsyncStorage$1().then((als) => {
|
|
19
|
+
return als.getStore() || fallback;
|
|
20
|
+
}).catch(() => {
|
|
21
|
+
return fallback;
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
const runWithAdapter = async (adapter, fn) => {
|
|
25
|
+
let called = true;
|
|
26
|
+
return ensureAsyncStorage$1().then((als) => {
|
|
27
|
+
called = true;
|
|
28
|
+
return als.run(adapter, fn);
|
|
29
|
+
}).catch((err) => {
|
|
30
|
+
if (!called) return fn();
|
|
31
|
+
throw err;
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
const runWithTransaction = async (adapter, fn) => {
|
|
35
|
+
let called = true;
|
|
36
|
+
return ensureAsyncStorage$1().then((als) => {
|
|
37
|
+
called = true;
|
|
38
|
+
return adapter.transaction(async (trx) => {
|
|
39
|
+
return als.run(trx, fn);
|
|
40
|
+
});
|
|
41
|
+
}).catch((err) => {
|
|
42
|
+
if (!called) return fn();
|
|
43
|
+
throw err;
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region src/context/endpoint-context.ts
|
|
49
|
+
let currentContextAsyncStorage = null;
|
|
50
|
+
const ensureAsyncStorage = async () => {
|
|
51
|
+
if (!currentContextAsyncStorage) currentContextAsyncStorage = new (await (getAsyncLocalStorage()))();
|
|
52
|
+
return currentContextAsyncStorage;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* This is for internal use only. Most users should use `getCurrentAuthContext` instead.
|
|
56
|
+
*
|
|
57
|
+
* It is exposed for advanced use cases where you need direct access to the AsyncLocalStorage instance.
|
|
58
|
+
*/
|
|
59
|
+
async function getCurrentAuthContextAsyncLocalStorage() {
|
|
60
|
+
return ensureAsyncStorage();
|
|
61
|
+
}
|
|
62
|
+
async function getCurrentAuthContext() {
|
|
63
|
+
const context = (await ensureAsyncStorage()).getStore();
|
|
64
|
+
if (!context) throw new Error("No auth context found. Please make sure you are calling this function within a `getCurrentAuthContext` callback.");
|
|
65
|
+
return context;
|
|
66
|
+
}
|
|
67
|
+
async function runWithEndpointContext(context, fn) {
|
|
68
|
+
return (await ensureAsyncStorage()).run(context, fn);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
//#endregion
|
|
72
|
+
export { getCurrentAdapter, getCurrentAuthContext, getCurrentAuthContextAsyncLocalStorage, getCurrentDBAdapterAsyncLocalStorage, runWithAdapter, runWithEndpointContext, runWithTransaction };
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
const require_async_hooks = require('./async_hooks-CaXONcb9.cjs');
|
|
2
|
+
|
|
3
|
+
//#region src/context/transaction.ts
|
|
4
|
+
let currentAdapterAsyncStorage = null;
|
|
5
|
+
const ensureAsyncStorage$1 = async () => {
|
|
6
|
+
if (!currentAdapterAsyncStorage) currentAdapterAsyncStorage = new (await (require_async_hooks.getAsyncLocalStorage()))();
|
|
7
|
+
return currentAdapterAsyncStorage;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* This is for internal use only. Most users should use `getCurrentAdapter` instead.
|
|
11
|
+
*
|
|
12
|
+
* It is exposed for advanced use cases where you need direct access to the AsyncLocalStorage instance.
|
|
13
|
+
*/
|
|
14
|
+
const getCurrentDBAdapterAsyncLocalStorage = async () => {
|
|
15
|
+
return ensureAsyncStorage$1();
|
|
16
|
+
};
|
|
17
|
+
const getCurrentAdapter = async (fallback) => {
|
|
18
|
+
return ensureAsyncStorage$1().then((als) => {
|
|
19
|
+
return als.getStore() || fallback;
|
|
20
|
+
}).catch(() => {
|
|
21
|
+
return fallback;
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
const runWithAdapter = async (adapter, fn) => {
|
|
25
|
+
let called = true;
|
|
26
|
+
return ensureAsyncStorage$1().then((als) => {
|
|
27
|
+
called = true;
|
|
28
|
+
return als.run(adapter, fn);
|
|
29
|
+
}).catch((err) => {
|
|
30
|
+
if (!called) return fn();
|
|
31
|
+
throw err;
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
const runWithTransaction = async (adapter, fn) => {
|
|
35
|
+
let called = true;
|
|
36
|
+
return ensureAsyncStorage$1().then((als) => {
|
|
37
|
+
called = true;
|
|
38
|
+
return adapter.transaction(async (trx) => {
|
|
39
|
+
return als.run(trx, fn);
|
|
40
|
+
});
|
|
41
|
+
}).catch((err) => {
|
|
42
|
+
if (!called) return fn();
|
|
43
|
+
throw err;
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region src/context/endpoint-context.ts
|
|
49
|
+
let currentContextAsyncStorage = null;
|
|
50
|
+
const ensureAsyncStorage = async () => {
|
|
51
|
+
if (!currentContextAsyncStorage) currentContextAsyncStorage = new (await (require_async_hooks.getAsyncLocalStorage()))();
|
|
52
|
+
return currentContextAsyncStorage;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* This is for internal use only. Most users should use `getCurrentAuthContext` instead.
|
|
56
|
+
*
|
|
57
|
+
* It is exposed for advanced use cases where you need direct access to the AsyncLocalStorage instance.
|
|
58
|
+
*/
|
|
59
|
+
async function getCurrentAuthContextAsyncLocalStorage() {
|
|
60
|
+
return ensureAsyncStorage();
|
|
61
|
+
}
|
|
62
|
+
async function getCurrentAuthContext() {
|
|
63
|
+
const context = (await ensureAsyncStorage()).getStore();
|
|
64
|
+
if (!context) throw new Error("No auth context found. Please make sure you are calling this function within a `getCurrentAuthContext` callback.");
|
|
65
|
+
return context;
|
|
66
|
+
}
|
|
67
|
+
async function runWithEndpointContext(context, fn) {
|
|
68
|
+
return (await ensureAsyncStorage()).run(context, fn);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
//#endregion
|
|
72
|
+
Object.defineProperty(exports, 'getCurrentAdapter', {
|
|
73
|
+
enumerable: true,
|
|
74
|
+
get: function () {
|
|
75
|
+
return getCurrentAdapter;
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
Object.defineProperty(exports, 'getCurrentAuthContext', {
|
|
79
|
+
enumerable: true,
|
|
80
|
+
get: function () {
|
|
81
|
+
return getCurrentAuthContext;
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
Object.defineProperty(exports, 'getCurrentAuthContextAsyncLocalStorage', {
|
|
85
|
+
enumerable: true,
|
|
86
|
+
get: function () {
|
|
87
|
+
return getCurrentAuthContextAsyncLocalStorage;
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
Object.defineProperty(exports, 'getCurrentDBAdapterAsyncLocalStorage', {
|
|
91
|
+
enumerable: true,
|
|
92
|
+
get: function () {
|
|
93
|
+
return getCurrentDBAdapterAsyncLocalStorage;
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
Object.defineProperty(exports, 'runWithAdapter', {
|
|
97
|
+
enumerable: true,
|
|
98
|
+
get: function () {
|
|
99
|
+
return runWithAdapter;
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
Object.defineProperty(exports, 'runWithEndpointContext', {
|
|
103
|
+
enumerable: true,
|
|
104
|
+
get: function () {
|
|
105
|
+
return runWithEndpointContext;
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
Object.defineProperty(exports, 'runWithTransaction', {
|
|
109
|
+
enumerable: true,
|
|
110
|
+
get: function () {
|
|
111
|
+
return runWithTransaction;
|
|
112
|
+
}
|
|
113
|
+
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "../../helper-DVgWo5zB.cjs";
|
|
2
|
-
import "../../
|
|
3
|
-
import "../../index-
|
|
4
|
-
import "../../index-
|
|
5
|
-
import "../../index-
|
|
6
|
-
import
|
|
2
|
+
import "../../index-CgIE2ECh.cjs";
|
|
3
|
+
import { CleanedWhere, CustomAdapter, DBAdapter, DBAdapterDebugLogOption, DBAdapterFactoryConfig, DBAdapterInstance, DBAdapterSchemaCreation, DBTransactionAdapter, Where } from "../../index-CJB1zxVC.cjs";
|
|
4
|
+
import "../../index-_Oiv-VVr.cjs";
|
|
5
|
+
import "../../index-ehsSkBxt.cjs";
|
|
6
|
+
import "../../index-DFwrZMma.cjs";
|
|
7
7
|
export { CleanedWhere, CustomAdapter, DBAdapter, DBAdapterDebugLogOption, DBAdapterFactoryConfig, DBAdapterInstance, DBAdapterSchemaCreation, DBTransactionAdapter, Where };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import "../../helper-
|
|
2
|
-
import "../../
|
|
3
|
-
import "../../index-
|
|
4
|
-
import "../../index-
|
|
5
|
-
import "../../index-
|
|
6
|
-
import
|
|
1
|
+
import "../../helper-Dm5AtPVS.js";
|
|
2
|
+
import "../../index-Cmh0x42V.js";
|
|
3
|
+
import { CleanedWhere, CustomAdapter, DBAdapter, DBAdapterDebugLogOption, DBAdapterFactoryConfig, DBAdapterInstance, DBAdapterSchemaCreation, DBTransactionAdapter, Where } from "../../index-jMi85fzG.js";
|
|
4
|
+
import "../../index-ChlC5Vy3.js";
|
|
5
|
+
import "../../index-BPsqLi68.js";
|
|
6
|
+
import "../../index-CsHMVqbX.js";
|
|
7
7
|
export { CleanedWhere, CustomAdapter, DBAdapter, DBAdapterDebugLogOption, DBAdapterFactoryConfig, DBAdapterInstance, DBAdapterSchemaCreation, DBTransactionAdapter, Where };
|
package/dist/db/index.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
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 "../
|
|
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 "../index-CgIE2ECh.cjs";
|
|
3
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 };
|