@better-auth/core 1.3.28 → 1.4.0-beta.11
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 +81 -76
- package/dist/api/index.cjs +30 -0
- package/dist/api/index.d.cts +7 -0
- package/dist/api/index.d.ts +7 -0
- package/dist/api/index.js +26 -0
- package/dist/async_hooks/index.cjs +2 -26
- package/dist/async_hooks/index.d.cts +4 -7
- package/dist/async_hooks/index.d.ts +4 -7
- package/dist/async_hooks/index.js +3 -0
- package/dist/async_hooks-CaXONcb9.cjs +24 -0
- package/dist/async_hooks-CkLtIFa6.js +18 -0
- package/dist/chunk-CUT6urMc.cjs +30 -0
- package/dist/context/index.cjs +8 -0
- package/dist/context/index.d.cts +17 -0
- package/dist/context/index.d.ts +17 -0
- package/dist/context/index.js +4 -0
- package/dist/context-DAu9ytQl.cjs +85 -0
- package/dist/context-rhoB1CVr.js +56 -0
- package/dist/db/adapter/index.cjs +0 -2
- package/dist/db/adapter/index.d.cts +7 -14
- package/dist/db/adapter/index.d.ts +7 -14
- package/dist/db/adapter/index.js +1 -0
- package/dist/db/index.cjs +46 -69
- package/dist/db/index.d.cts +3 -39
- package/dist/db/index.d.ts +3 -39
- package/dist/db/index.js +61 -0
- package/dist/env/index.cjs +15 -311
- package/dist/env/index.d.cts +2 -36
- package/dist/env/index.d.ts +2 -36
- package/dist/env/index.js +3 -0
- package/dist/env-D1OdwBk9.cjs +330 -0
- package/dist/env-DzHiLVFb.js +246 -0
- package/dist/error/index.cjs +4 -43
- package/dist/error/index.d.cts +31 -29
- package/dist/error/index.d.ts +31 -29
- package/dist/error/index.js +4 -0
- package/dist/error-H6U5qGNP.js +45 -0
- package/dist/error-k9KM7GAb.cjs +56 -0
- package/dist/helper-DVgWo5zB.d.cts +6 -0
- package/dist/helper-Dm5AtPVS.d.ts +6 -0
- package/dist/index-BPsqLi68.d.ts +4410 -0
- package/dist/index-CgIE2ECh.d.cts +262 -0
- package/dist/index-ChlC5Vy3.d.ts +344 -0
- package/dist/index-Cmh0x42V.d.ts +262 -0
- package/dist/index-CsHMVqbX.d.ts +82 -0
- package/dist/index-DFwrZMma.d.cts +82 -0
- package/dist/index-OrTFOyAG.d.ts +1871 -0
- package/dist/index-_Oiv-VVr.d.cts +344 -0
- package/dist/index-ehsSkBxt.d.cts +4410 -0
- package/dist/index-yBChAjSS.d.cts +1871 -0
- package/dist/index.cjs +0 -2
- package/dist/index.d.cts +7 -180
- package/dist/index.d.ts +7 -180
- package/dist/index.js +1 -0
- package/dist/oauth2/index.cjs +12 -368
- package/dist/oauth2/index.d.cts +3 -100
- package/dist/oauth2/index.d.ts +3 -100
- package/dist/oauth2/index.js +3 -0
- package/dist/oauth2-D_FUKfC8.js +239 -0
- package/dist/oauth2-DqX_pPhp.cjs +302 -0
- package/dist/social-providers/index.cjs +2262 -2645
- package/dist/social-providers/index.d.cts +4 -3903
- package/dist/social-providers/index.d.ts +4 -3903
- package/dist/social-providers/index.js +2370 -0
- package/dist/utils/index.cjs +2 -6
- package/dist/utils/index.d.cts +4 -5
- package/dist/utils/index.d.ts +4 -5
- package/dist/utils/index.js +3 -0
- package/dist/utils-Bs-jKit4.cjs +13 -0
- package/dist/utils-Sn10glI8.js +7 -0
- package/package.json +35 -25
- package/src/api/index.ts +57 -0
- package/src/async_hooks/index.ts +1 -9
- package/src/context/endpoint-context.ts +32 -0
- package/src/context/index.ts +6 -0
- package/src/context/transaction.ts +63 -0
- package/src/db/index.ts +2 -0
- package/src/db/type.ts +1 -10
- package/src/env/color-depth.ts +4 -5
- package/src/error/codes.ts +1 -1
- package/src/social-providers/apple.ts +2 -2
- package/src/social-providers/atlassian.ts +4 -7
- package/src/social-providers/cognito.ts +4 -7
- package/src/social-providers/discord.ts +2 -5
- package/src/social-providers/dropbox.ts +2 -2
- package/src/social-providers/facebook.ts +3 -6
- package/src/social-providers/figma.ts +4 -7
- package/src/social-providers/github.ts +2 -2
- package/src/social-providers/gitlab.ts +2 -2
- package/src/social-providers/google.ts +4 -7
- package/src/social-providers/huggingface.ts +2 -2
- package/src/social-providers/kakao.ts +2 -2
- package/src/social-providers/kick.ts +2 -5
- package/src/social-providers/line.ts +2 -2
- package/src/social-providers/linear.ts +2 -2
- package/src/social-providers/linkedin.ts +2 -2
- package/src/social-providers/microsoft-entra-id.ts +3 -3
- package/src/social-providers/naver.ts +2 -2
- package/src/social-providers/notion.ts +2 -2
- package/src/social-providers/paypal.ts +3 -3
- package/src/social-providers/reddit.ts +2 -2
- package/src/social-providers/roblox.ts +2 -5
- package/src/social-providers/salesforce.ts +4 -7
- package/src/social-providers/slack.ts +2 -5
- package/src/social-providers/spotify.ts +2 -2
- package/src/social-providers/tiktok.ts +2 -5
- package/src/social-providers/twitch.ts +3 -3
- package/src/social-providers/twitter.ts +2 -2
- package/src/social-providers/vk.ts +2 -5
- package/src/social-providers/zoom.ts +2 -5
- package/src/types/context.ts +20 -99
- package/src/types/index.ts +1 -1
- package/src/types/init-options.ts +20 -22
- package/src/types/plugin.ts +3 -3
- package/{build.config.ts → tsdown.config.ts} +8 -11
- package/dist/async_hooks/index.d.mts +0 -10
- package/dist/async_hooks/index.mjs +0 -25
- package/dist/db/adapter/index.d.mts +0 -14
- package/dist/db/adapter/index.mjs +0 -1
- package/dist/db/index.d.mts +0 -39
- package/dist/db/index.mjs +0 -70
- package/dist/env/index.d.mts +0 -36
- package/dist/env/index.mjs +0 -297
- package/dist/error/index.d.mts +0 -33
- package/dist/error/index.mjs +0 -41
- package/dist/index.d.mts +0 -180
- package/dist/index.mjs +0 -1
- 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.d.mts +0 -100
- package/dist/oauth2/index.mjs +0 -357
- package/dist/shared/core.BJPBStdk.d.ts +0 -1693
- package/dist/shared/core.Bl6TpxyD.d.mts +0 -181
- package/dist/shared/core.Bqe5IGAi.d.ts +0 -13
- 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.CajxAutx.d.cts +0 -143
- package/dist/shared/core.CajxAutx.d.mts +0 -143
- package/dist/shared/core.CajxAutx.d.ts +0 -143
- package/dist/shared/core.CkkLHQWc.d.mts +0 -1693
- package/dist/shared/core.DkdZ1o38.d.ts +0 -181
- package/dist/shared/core.Dl-70uns.d.cts +0 -84
- package/dist/shared/core.Dl-70uns.d.mts +0 -84
- package/dist/shared/core.Dl-70uns.d.ts +0 -84
- package/dist/shared/core.DyEdx0m7.d.cts +0 -181
- package/dist/shared/core.E9DfzGLz.d.mts +0 -13
- package/dist/shared/core.HqYn20Fi.d.cts +0 -13
- package/dist/shared/core.gYIBmdi1.d.cts +0 -1693
- package/dist/social-providers/index.d.mts +0 -3903
- package/dist/social-providers/index.mjs +0 -2743
- package/dist/utils/index.d.mts +0 -10
- package/dist/utils/index.mjs +0 -5
- package/src/middleware/index.ts +0 -33
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,77 +1,82 @@
|
|
|
1
1
|
|
|
2
|
-
> @better-auth/core@1.
|
|
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
|
-
[
|
|
45
|
-
|
|
46
|
-
[
|
|
47
|
-
|
|
48
|
-
[
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
[
|
|
52
|
-
[
|
|
53
|
-
|
|
54
|
-
[
|
|
55
|
-
|
|
56
|
-
[
|
|
57
|
-
|
|
58
|
-
[
|
|
59
|
-
|
|
60
|
-
[
|
|
61
|
-
|
|
62
|
-
[
|
|
63
|
-
|
|
64
|
-
[
|
|
65
|
-
|
|
66
|
-
[
|
|
67
|
-
|
|
68
|
-
[
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
[
|
|
72
|
-
|
|
73
|
-
[
|
|
74
|
-
[
|
|
75
|
-
|
|
76
|
-
-
|
|
77
|
-
-
|
|
2
|
+
> @better-auth/core@1.4.0-beta.11 build /home/runner/work/better-auth/better-auth/packages/core
|
|
3
|
+
> tsdown
|
|
4
|
+
|
|
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/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
|
+
[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[1mapi/index.cjs[22m [2m 1.07 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[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.42 kB[22m [2m│ gzip: 0.18 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[1masync_hooks/index.cjs[22m [2m 0.14 kB[22m [2m│ gzip: 0.11 kB[22m
|
|
18
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[1mutils/index.cjs[22m [2m 0.12 kB[22m [2m│ gzip: 0.10 kB[22m
|
|
19
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[1mdb/adapter/index.cjs[22m [2m 0.00 kB[22m [2m│ gzip: 0.02 kB[22m
|
|
20
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[1mindex.cjs[22m [2m 0.00 kB[22m [2m│ gzip: 0.02 kB[22m
|
|
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-D1OdwBk9.cjs [2m 9.16 kB[22m [2m│ gzip: 2.64 kB[22m
|
|
23
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22mcontext-DAu9ytQl.cjs [2m 2.40 kB[22m [2m│ gzip: 0.64 kB[22m
|
|
24
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22merror-k9KM7GAb.cjs [2m 1.98 kB[22m [2m│ gzip: 0.86 kB[22m
|
|
25
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22mchunk-CUT6urMc.cjs [2m 1.09 kB[22m [2m│ gzip: 0.54 kB[22m
|
|
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: 109.21 kB
|
|
29
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[1msocial-providers/index.js[22m [2m 73.39 kB[22m [2m│ gzip: 9.98 kB[22m
|
|
30
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[1mdb/index.js[22m [2m 1.58 kB[22m [2m│ gzip: 0.49 kB[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[1menv/index.js[22m [2m 0.37 kB[22m [2m│ gzip: 0.18 kB[22m
|
|
34
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[1mcontext/index.js[22m [2m 0.29 kB[22m [2m│ gzip: 0.15 kB[22m
|
|
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
|
|
37
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[1mutils/index.js[22m [2m 0.09 kB[22m [2m│ gzip: 0.08 kB[22m
|
|
38
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[1mdb/adapter/index.js[22m [2m 0.01 kB[22m [2m│ gzip: 0.03 kB[22m
|
|
39
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[1mindex.js[22m [2m 0.01 kB[22m [2m│ gzip: 0.03 kB[22m
|
|
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-DzHiLVFb.js [2m 7.68 kB[22m [2m│ gzip: 2.52 kB[22m
|
|
42
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22mcontext-rhoB1CVr.js [2m 1.79 kB[22m [2m│ gzip: 0.56 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[1merror/index.d.ts[22m[39m [2m 1.83 kB[22m [2m│ gzip: 0.71 kB[22m
|
|
48
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[32m[1mcontext/index.d.ts[22m[39m [2m 0.91 kB[22m [2m│ gzip: 0.35 kB[22m
|
|
49
|
+
[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
|
|
50
|
+
[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
|
|
51
|
+
[34mℹ[39m [34m[ESM][39m [2mdist/[22m[32m[1mindex.d.ts[22m[39m [2m 0.83 kB[22m [2m│ gzip: 0.28 kB[22m
|
|
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
|
|
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
|
|
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
|
|
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.24 kB[22m [2m│ gzip: 0.16 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-OrTFOyAG.d.ts[39m [2m 55.46 kB[22m [2m│ gzip: 11.63 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 34 files, total: 295.16 kB
|
|
64
|
+
[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
|
|
65
|
+
[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
|
|
66
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[32m[1mcontext/index.d.cts[22m[39m [2m 0.92 kB[22m [2m│ gzip: 0.35 kB[22m
|
|
67
|
+
[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
|
|
68
|
+
[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
|
|
69
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[32m[1mindex.d.cts[22m[39m [2m 0.83 kB[22m [2m│ gzip: 0.28 kB[22m
|
|
70
|
+
[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
|
|
71
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[32m[1mdb/adapter/index.d.cts[22m[39m [2m 0.55 kB[22m [2m│ gzip: 0.22 kB[22m
|
|
72
|
+
[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
|
|
73
|
+
[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
|
|
74
|
+
[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
|
|
75
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[32mindex-ehsSkBxt.d.cts[39m [2m109.59 kB[22m [2m│ gzip: 13.64 kB[22m
|
|
76
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[32mindex-yBChAjSS.d.cts[39m [2m 55.47 kB[22m [2m│ gzip: 11.63 kB[22m
|
|
77
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[32mindex-_Oiv-VVr.d.cts[39m [2m 8.95 kB[22m [2m│ gzip: 2.13 kB[22m
|
|
78
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[32mindex-CgIE2ECh.d.cts[39m [2m 8.24 kB[22m [2m│ gzip: 2.06 kB[22m
|
|
79
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[32mindex-DFwrZMma.d.cts[39m [2m 3.18 kB[22m [2m│ gzip: 1.06 kB[22m
|
|
80
|
+
[34mℹ[39m [33m[CJS][39m [2mdist/[22m[32mhelper-DVgWo5zB.d.cts[39m [2m 0.33 kB[22m [2m│ gzip: 0.21 kB[22m
|
|
81
|
+
[34mℹ[39m [33m[CJS][39m 17 files, total: 196.44 kB
|
|
82
|
+
[32m✔[39m Build complete in [32m3927ms[39m
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const require_chunk = require('../chunk-CUT6urMc.cjs');
|
|
2
|
+
require('../async_hooks-CaXONcb9.cjs');
|
|
3
|
+
const require_context = require('../context-DAu9ytQl.cjs');
|
|
4
|
+
let better_call = require("better-call");
|
|
5
|
+
better_call = require_chunk.__toESM(better_call);
|
|
6
|
+
|
|
7
|
+
//#region src/api/index.ts
|
|
8
|
+
const optionsMiddleware = (0, better_call.createMiddleware)(async () => {
|
|
9
|
+
/**
|
|
10
|
+
* This will be passed on the instance of
|
|
11
|
+
* the context. Used to infer the type
|
|
12
|
+
* here.
|
|
13
|
+
*/
|
|
14
|
+
return {};
|
|
15
|
+
});
|
|
16
|
+
const createAuthMiddleware = better_call.createMiddleware.create({ use: [optionsMiddleware, (0, better_call.createMiddleware)(async () => {
|
|
17
|
+
return {};
|
|
18
|
+
})] });
|
|
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
|
+
};
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
exports.createAuthEndpoint = createAuthEndpoint;
|
|
29
|
+
exports.createAuthMiddleware = createAuthMiddleware;
|
|
30
|
+
exports.optionsMiddleware = optionsMiddleware;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import "../helper-DVgWo5zB.cjs";
|
|
2
|
+
import "../index-CgIE2ECh.cjs";
|
|
3
|
+
import { AuthEndpoint, AuthMiddleware, createAuthEndpoint, createAuthMiddleware, optionsMiddleware } from "../index-yBChAjSS.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-OrTFOyAG.js";
|
|
4
|
+
import "../index-ChlC5Vy3.js";
|
|
5
|
+
import "../index-BPsqLi68.js";
|
|
6
|
+
import "../index-CsHMVqbX.js";
|
|
7
|
+
export { AuthEndpoint, AuthMiddleware, createAuthEndpoint, createAuthMiddleware, optionsMiddleware };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import "../async_hooks-CkLtIFa6.js";
|
|
2
|
+
import { runWithEndpointContext } from "../context-rhoB1CVr.js";
|
|
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,27 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
const require_async_hooks = require('../async_hooks-CaXONcb9.cjs');
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
const AsyncLocalStoragePromise = import(
|
|
5
|
-
/* @vite-ignore */
|
|
6
|
-
/* webpackIgnore: true */
|
|
7
|
-
moduleName
|
|
8
|
-
).then((mod) => mod.AsyncLocalStorage).catch((err) => {
|
|
9
|
-
if ("AsyncLocalStorage" in globalThis) {
|
|
10
|
-
return globalThis.AsyncLocalStorage;
|
|
11
|
-
}
|
|
12
|
-
console.warn(
|
|
13
|
-
"[better-auth] Warning: AsyncLocalStorage is not available in this environment. Some features may not work as expected."
|
|
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;
|
|
22
|
-
});
|
|
23
|
-
async function getAsyncLocalStorage() {
|
|
24
|
-
return AsyncLocalStoragePromise;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
exports.getAsyncLocalStorage = getAsyncLocalStorage;
|
|
3
|
+
exports.getAsyncLocalStorage = require_async_hooks.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,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,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
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
require('../async_hooks-CaXONcb9.cjs');
|
|
2
|
+
const require_context = require('../context-DAu9ytQl.cjs');
|
|
3
|
+
|
|
4
|
+
exports.getCurrentAdapter = require_context.getCurrentAdapter;
|
|
5
|
+
exports.getEndpointContext = require_context.getEndpointContext;
|
|
6
|
+
exports.runWithAdapter = require_context.runWithAdapter;
|
|
7
|
+
exports.runWithEndpointContext = require_context.runWithEndpointContext;
|
|
8
|
+
exports.runWithTransaction = require_context.runWithTransaction;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import "../helper-DVgWo5zB.cjs";
|
|
2
|
+
import "../index-CgIE2ECh.cjs";
|
|
3
|
+
import { DBAdapter, DBTransactionAdapter, GenericEndpointContext } from "../index-yBChAjSS.cjs";
|
|
4
|
+
import "../index-_Oiv-VVr.cjs";
|
|
5
|
+
import "../index-ehsSkBxt.cjs";
|
|
6
|
+
import "../index-DFwrZMma.cjs";
|
|
7
|
+
|
|
8
|
+
//#region src/context/transaction.d.ts
|
|
9
|
+
declare const getCurrentAdapter: (fallback: DBTransactionAdapter) => Promise<DBTransactionAdapter>;
|
|
10
|
+
declare const runWithAdapter: <R>(adapter: DBAdapter, fn: () => R) => Promise<R>;
|
|
11
|
+
declare const runWithTransaction: <R>(adapter: DBAdapter, fn: () => R) => Promise<R>;
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region src/context/endpoint-context.d.ts
|
|
14
|
+
declare function getEndpointContext(): Promise<GenericEndpointContext>;
|
|
15
|
+
declare function runWithEndpointContext<T>(context: GenericEndpointContext, fn: () => T): Promise<T>;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { getCurrentAdapter, getEndpointContext, runWithAdapter, runWithEndpointContext, runWithTransaction };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import "../helper-Dm5AtPVS.js";
|
|
2
|
+
import "../index-Cmh0x42V.js";
|
|
3
|
+
import { DBAdapter, DBTransactionAdapter, GenericEndpointContext } from "../index-OrTFOyAG.js";
|
|
4
|
+
import "../index-ChlC5Vy3.js";
|
|
5
|
+
import "../index-BPsqLi68.js";
|
|
6
|
+
import "../index-CsHMVqbX.js";
|
|
7
|
+
|
|
8
|
+
//#region src/context/transaction.d.ts
|
|
9
|
+
declare const getCurrentAdapter: (fallback: DBTransactionAdapter) => Promise<DBTransactionAdapter>;
|
|
10
|
+
declare const runWithAdapter: <R>(adapter: DBAdapter, fn: () => R) => Promise<R>;
|
|
11
|
+
declare const runWithTransaction: <R>(adapter: DBAdapter, fn: () => R) => Promise<R>;
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region src/context/endpoint-context.d.ts
|
|
14
|
+
declare function getEndpointContext(): Promise<GenericEndpointContext>;
|
|
15
|
+
declare function runWithEndpointContext<T>(context: GenericEndpointContext, fn: () => T): Promise<T>;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { getCurrentAdapter, getEndpointContext, runWithAdapter, runWithEndpointContext, runWithTransaction };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import "../async_hooks-CkLtIFa6.js";
|
|
2
|
+
import { getCurrentAdapter, getEndpointContext, runWithAdapter, runWithEndpointContext, runWithTransaction } from "../context-rhoB1CVr.js";
|
|
3
|
+
|
|
4
|
+
export { getCurrentAdapter, getEndpointContext, runWithAdapter, runWithEndpointContext, runWithTransaction };
|
|
@@ -0,0 +1,85 @@
|
|
|
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
|
+
const getCurrentAdapter = async (fallback) => {
|
|
10
|
+
return ensureAsyncStorage$1().then((als) => {
|
|
11
|
+
return als.getStore() || fallback;
|
|
12
|
+
}).catch(() => {
|
|
13
|
+
return fallback;
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
const runWithAdapter = async (adapter, fn) => {
|
|
17
|
+
let called = true;
|
|
18
|
+
return ensureAsyncStorage$1().then((als) => {
|
|
19
|
+
called = true;
|
|
20
|
+
return als.run(adapter, fn);
|
|
21
|
+
}).catch((err) => {
|
|
22
|
+
if (!called) return fn();
|
|
23
|
+
throw err;
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
const runWithTransaction = async (adapter, fn) => {
|
|
27
|
+
let called = true;
|
|
28
|
+
return ensureAsyncStorage$1().then((als) => {
|
|
29
|
+
called = true;
|
|
30
|
+
return adapter.transaction(async (trx) => {
|
|
31
|
+
return als.run(trx, fn);
|
|
32
|
+
});
|
|
33
|
+
}).catch((err) => {
|
|
34
|
+
if (!called) return fn();
|
|
35
|
+
throw err;
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region src/context/endpoint-context.ts
|
|
41
|
+
let currentContextAsyncStorage = null;
|
|
42
|
+
const ensureAsyncStorage = async () => {
|
|
43
|
+
if (!currentContextAsyncStorage) currentContextAsyncStorage = new (await (require_async_hooks.getAsyncLocalStorage()))();
|
|
44
|
+
return currentContextAsyncStorage;
|
|
45
|
+
};
|
|
46
|
+
async function getEndpointContext() {
|
|
47
|
+
const context = (await ensureAsyncStorage()).getStore();
|
|
48
|
+
if (!context) throw new Error("No auth context found. Please make sure you are calling this function within a `getEndpointContext` callback.");
|
|
49
|
+
return context;
|
|
50
|
+
}
|
|
51
|
+
async function runWithEndpointContext(context, fn) {
|
|
52
|
+
return (await ensureAsyncStorage()).run(context, fn);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
//#endregion
|
|
56
|
+
Object.defineProperty(exports, 'getCurrentAdapter', {
|
|
57
|
+
enumerable: true,
|
|
58
|
+
get: function () {
|
|
59
|
+
return getCurrentAdapter;
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
Object.defineProperty(exports, 'getEndpointContext', {
|
|
63
|
+
enumerable: true,
|
|
64
|
+
get: function () {
|
|
65
|
+
return getEndpointContext;
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
Object.defineProperty(exports, 'runWithAdapter', {
|
|
69
|
+
enumerable: true,
|
|
70
|
+
get: function () {
|
|
71
|
+
return runWithAdapter;
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
Object.defineProperty(exports, 'runWithEndpointContext', {
|
|
75
|
+
enumerable: true,
|
|
76
|
+
get: function () {
|
|
77
|
+
return runWithEndpointContext;
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
Object.defineProperty(exports, 'runWithTransaction', {
|
|
81
|
+
enumerable: true,
|
|
82
|
+
get: function () {
|
|
83
|
+
return runWithTransaction;
|
|
84
|
+
}
|
|
85
|
+
});
|
|
@@ -0,0 +1,56 @@
|
|
|
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
|
+
const getCurrentAdapter = async (fallback) => {
|
|
10
|
+
return ensureAsyncStorage$1().then((als) => {
|
|
11
|
+
return als.getStore() || fallback;
|
|
12
|
+
}).catch(() => {
|
|
13
|
+
return fallback;
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
const runWithAdapter = async (adapter, fn) => {
|
|
17
|
+
let called = true;
|
|
18
|
+
return ensureAsyncStorage$1().then((als) => {
|
|
19
|
+
called = true;
|
|
20
|
+
return als.run(adapter, fn);
|
|
21
|
+
}).catch((err) => {
|
|
22
|
+
if (!called) return fn();
|
|
23
|
+
throw err;
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
const runWithTransaction = async (adapter, fn) => {
|
|
27
|
+
let called = true;
|
|
28
|
+
return ensureAsyncStorage$1().then((als) => {
|
|
29
|
+
called = true;
|
|
30
|
+
return adapter.transaction(async (trx) => {
|
|
31
|
+
return als.run(trx, fn);
|
|
32
|
+
});
|
|
33
|
+
}).catch((err) => {
|
|
34
|
+
if (!called) return fn();
|
|
35
|
+
throw err;
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region src/context/endpoint-context.ts
|
|
41
|
+
let currentContextAsyncStorage = null;
|
|
42
|
+
const ensureAsyncStorage = async () => {
|
|
43
|
+
if (!currentContextAsyncStorage) currentContextAsyncStorage = new (await (getAsyncLocalStorage()))();
|
|
44
|
+
return currentContextAsyncStorage;
|
|
45
|
+
};
|
|
46
|
+
async function getEndpointContext() {
|
|
47
|
+
const context = (await ensureAsyncStorage()).getStore();
|
|
48
|
+
if (!context) throw new Error("No auth context found. Please make sure you are calling this function within a `getEndpointContext` callback.");
|
|
49
|
+
return context;
|
|
50
|
+
}
|
|
51
|
+
async function runWithEndpointContext(context, fn) {
|
|
52
|
+
return (await ensureAsyncStorage()).run(context, fn);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
//#endregion
|
|
56
|
+
export { getCurrentAdapter, getEndpointContext, runWithAdapter, runWithEndpointContext, runWithTransaction };
|