@better-auth/core 1.4.0-beta.13 → 1.4.0-beta.14

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.
Files changed (91) hide show
  1. package/.turbo/turbo-build.log +37 -45
  2. package/dist/api/index.cjs +1 -1
  3. package/dist/api/index.d.cts +2 -6
  4. package/dist/api/index.d.ts +2 -6
  5. package/dist/api/index.js +1 -1
  6. package/dist/async_hooks/index.d.cts +1 -1
  7. package/dist/async_hooks/index.d.ts +1 -1
  8. package/dist/context/index.cjs +1 -1
  9. package/dist/context/index.d.cts +14 -18
  10. package/dist/context/index.d.ts +14 -18
  11. package/dist/context/index.js +1 -1
  12. package/dist/{context-Bm0rm76r.js → context-BAOGRjRS.js} +30 -30
  13. package/dist/{context-7VgEbfs3.cjs → context-BRDf96na.cjs} +29 -29
  14. package/dist/db/adapter/index.d.cts +2 -6
  15. package/dist/db/adapter/index.d.ts +2 -6
  16. package/dist/db/index.cjs +17 -17
  17. package/dist/db/index.d.cts +2 -2
  18. package/dist/db/index.d.ts +2 -2
  19. package/dist/db/index.js +17 -17
  20. package/dist/env/index.d.cts +1 -1
  21. package/dist/env/index.d.ts +1 -1
  22. package/dist/{index-Cg7SVnu9.d.cts → index-6-zeCbRA.d.cts} +5005 -2553
  23. package/dist/{index-D5uj-vER.d.ts → index-C8vNYjIq.d.ts} +4 -4
  24. package/dist/{index-Dy_s5RNc.d.cts → index-DAzyP5GG.d.cts} +4 -4
  25. package/dist/{index-RfHoxHB4.d.ts → index-DTT2geV_.d.ts} +3662 -1211
  26. package/dist/index.d.cts +3 -65
  27. package/dist/index.d.ts +3 -65
  28. package/dist/oauth2/index.cjs +1 -1
  29. package/dist/oauth2/index.d.cts +2 -2
  30. package/dist/oauth2/index.d.ts +2 -2
  31. package/dist/oauth2/index.js +1 -1
  32. package/dist/{oauth2-C8-hfKTF.cjs → oauth2-C4Pt8KMZ.cjs} +87 -87
  33. package/dist/{oauth2-CjVUvPq7.js → oauth2-CP3eVHS_.js} +88 -88
  34. package/dist/social-providers/index.cjs +891 -891
  35. package/dist/social-providers/index.d.cts +2 -3
  36. package/dist/social-providers/index.d.ts +2 -3
  37. package/dist/social-providers/index.js +891 -891
  38. package/package.json +4 -3
  39. package/src/api/index.ts +1 -1
  40. package/src/context/endpoint-context.ts +1 -1
  41. package/src/context/index.ts +7 -7
  42. package/src/context/transaction.ts +2 -2
  43. package/src/db/adapter/index.ts +1 -1
  44. package/src/db/index.ts +11 -11
  45. package/src/db/plugin.ts +1 -1
  46. package/src/db/type.ts +3 -3
  47. package/src/env/index.ts +9 -9
  48. package/src/env/logger.test.ts +2 -2
  49. package/src/oauth2/client-credentials-token.ts +1 -1
  50. package/src/oauth2/index.ts +10 -11
  51. package/src/oauth2/refresh-access-token.ts +1 -1
  52. package/src/oauth2/validate-authorization-code.ts +1 -1
  53. package/src/social-providers/apple.ts +1 -1
  54. package/src/social-providers/atlassian.ts +6 -3
  55. package/src/social-providers/cognito.ts +7 -4
  56. package/src/social-providers/facebook.ts +6 -3
  57. package/src/social-providers/figma.ts +6 -3
  58. package/src/social-providers/gitlab.ts +1 -1
  59. package/src/social-providers/google.ts +6 -3
  60. package/src/social-providers/huggingface.ts +1 -1
  61. package/src/social-providers/index.ts +25 -25
  62. package/src/social-providers/kakao.ts +1 -1
  63. package/src/social-providers/kick.ts +1 -1
  64. package/src/social-providers/linkedin.ts +1 -1
  65. package/src/social-providers/microsoft-entra-id.ts +6 -6
  66. package/src/social-providers/naver.ts +1 -1
  67. package/src/social-providers/paypal.ts +3 -3
  68. package/src/social-providers/polar.ts +1 -1
  69. package/src/social-providers/reddit.ts +1 -1
  70. package/src/social-providers/roblox.ts +1 -1
  71. package/src/social-providers/salesforce.ts +6 -3
  72. package/src/social-providers/slack.ts +1 -1
  73. package/src/social-providers/spotify.ts +1 -1
  74. package/src/social-providers/twitch.ts +3 -3
  75. package/src/social-providers/vk.ts +3 -2
  76. package/src/social-providers/zoom.ts +1 -1
  77. package/src/types/context.ts +5 -4
  78. package/src/types/index.ts +11 -10
  79. package/src/types/init-options.ts +33 -7
  80. package/src/types/plugin-client.ts +2 -2
  81. package/src/types/plugin.ts +3 -3
  82. package/dist/helper-BH5srn6K.d.ts +0 -6
  83. package/dist/helper-ChPUVnMr.d.cts +0 -6
  84. package/dist/index-BCxkjvux.d.cts +0 -344
  85. package/dist/index-CZCOI9An.d.ts +0 -344
  86. package/dist/index-DQNPxXof.d.ts +0 -262
  87. package/dist/index-DXj1sY8B.d.cts +0 -1772
  88. package/dist/index-DgTKobWC.d.ts +0 -1772
  89. package/dist/index-daoIWR6L.d.cts +0 -262
  90. /package/dist/{index-CR-gJyzm.d.ts → index-BzepAavo.d.cts} +0 -0
  91. /package/dist/{index-CilaMiAm.d.cts → index-DT7CRnvv.d.ts} +0 -0
@@ -1,13 +1,13 @@
1
1
 
2
- > @better-auth/core@1.4.0-beta.13 build /home/runner/work/better-auth/better-auth/packages/core
2
+ > @better-auth/core@1.4.0-beta.14 build /home/runner/work/better-auth/better-auth/packages/core
3
3
  > tsdown
4
4
 
5
- ℹ tsdown v0.15.9 powered by rolldown v1.0.0-beta.44
5
+ ℹ tsdown v0.15.10 powered by rolldown v1.0.0-beta.44
6
6
  ℹ Using tsdown config: /home/runner/work/better-auth/better-auth/packages/core/tsdown.config.ts
7
- ℹ entry: src/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
7
+ ℹ entry: src/index.ts, src/api/index.ts, src/async_hooks/index.ts, src/db/index.ts, src/context/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
8
8
  ℹ tsconfig: tsconfig.json
9
9
  ℹ Build start
10
- ℹ [CJS] dist/social-providers/index.cjs 79.35 kB │ gzip: 10.37 kB
10
+ ℹ [CJS] dist/social-providers/index.cjs 79.35 kB │ gzip: 10.25 kB
11
11
  ℹ [CJS] dist/db/index.cjs  1.86 kB │ gzip: 0.56 kB
12
12
  ℹ [CJS] dist/api/index.cjs  1.07 kB │ gzip: 0.46 kB
13
13
  ℹ [CJS] dist/oauth2/index.cjs  0.80 kB │ gzip: 0.24 kB
@@ -18,23 +18,23 @@
18
18
  ℹ [CJS] dist/utils/index.cjs  0.12 kB │ gzip: 0.10 kB
19
19
  ℹ [CJS] dist/db/adapter/index.cjs  0.00 kB │ gzip: 0.02 kB
20
20
  ℹ [CJS] dist/index.cjs  0.00 kB │ gzip: 0.02 kB
21
- ℹ [CJS] dist/oauth2-C8-hfKTF.cjs 10.80 kB │ gzip: 2.27 kB
21
+ ℹ [CJS] dist/oauth2-C4Pt8KMZ.cjs 10.80 kB │ gzip: 2.29 kB
22
22
  ℹ [CJS] dist/env-CuEMo0ZI.cjs  9.08 kB │ gzip: 2.62 kB
23
- ℹ [CJS] dist/context-7VgEbfs3.cjs  3.34 kB │ gzip: 0.79 kB
23
+ ℹ [CJS] dist/context-BRDf96na.cjs  3.34 kB │ gzip: 0.79 kB
24
24
  ℹ [CJS] dist/error-k9KM7GAb.cjs  1.98 kB │ gzip: 0.86 kB
25
25
  ℹ [CJS] dist/chunk-CUT6urMc.cjs  1.09 kB │ gzip: 0.54 kB
26
26
  ℹ [CJS] dist/async_hooks-CaXONcb9.cjs  0.97 kB │ gzip: 0.51 kB
27
27
  ℹ [CJS] dist/utils-Bs-jKit4.cjs  0.23 kB │ gzip: 0.17 kB
28
- ℹ [CJS] 18 files, total: 112.33 kB
28
+ ℹ [CJS] 18 files, total: 112.32 kB
29
29
  [UNRESOLVED_IMPORT] Warning: Could not resolve '@better-auth/core/oauth2' in src/social-providers/polar.ts
30
- ╭─[ src/social-providers/polar.ts:7:8 ]
30
+ ╭─[ src/social-providers/polar.ts:6:8 ]
31
31
  │
32
- 7 │ } from "@better-auth/core/oauth2";
32
+ 6 │ } from "@better-auth/core/oauth2";
33
33
   │ ─────────────┬────────────
34
34
   │ ╰────────────── Module not found, treating it as an external dependency
35
35
  ───╯
36
36
 
37
- ℹ [ESM] dist/social-providers/index.js  75.54 kB │ gzip: 10.13 kB
37
+ ℹ [ESM] dist/social-providers/index.js  75.54 kB │ gzip: 9.98 kB
38
38
  ℹ [ESM] dist/db/index.js  1.58 kB │ gzip: 0.49 kB
39
39
  ℹ [ESM] dist/api/index.js  0.83 kB │ gzip: 0.40 kB
40
40
  ℹ [ESM] dist/oauth2/index.js  0.60 kB │ gzip: 0.24 kB
@@ -45,56 +45,48 @@
45
45
  ℹ [ESM] dist/utils/index.js  0.09 kB │ gzip: 0.09 kB
46
46
  ℹ [ESM] dist/db/adapter/index.js  0.01 kB │ gzip: 0.03 kB
47
47
  ℹ [ESM] dist/index.js  0.01 kB │ gzip: 0.03 kB
48
- ℹ [ESM] dist/oauth2-CjVUvPq7.js  9.16 kB │ gzip: 2.10 kB
48
+ ℹ [ESM] dist/oauth2-CP3eVHS_.js  9.16 kB │ gzip: 2.12 kB
49
49
  ℹ [ESM] dist/env-DZG_k5Hh.js  7.67 kB │ gzip: 2.54 kB
50
- ℹ [ESM] dist/context-Bm0rm76r.js  2.50 kB │ gzip: 0.72 kB
50
+ ℹ [ESM] dist/context-BAOGRjRS.js  2.50 kB │ gzip: 0.72 kB
51
51
  ℹ [ESM] dist/error-CxOXAZsS.js  1.77 kB │ gzip: 0.79 kB
52
52
  ℹ [ESM] dist/async_hooks-qYTIyHB7.js  0.87 kB │ gzip: 0.46 kB
53
53
  ℹ [ESM] dist/utils-CK1IUN9R.js  0.13 kB │ gzip: 0.12 kB
54
- ℹ [ESM] dist/social-providers/index.d.ts  3.66 kB │ gzip: 1.15 kB
55
- ℹ [ESM] dist/index.d.ts  2.50 kB │ gzip: 0.97 kB
56
- ℹ [ESM] dist/context/index.d.ts  1.89 kB │ gzip: 0.61 kB
54
+ ℹ [ESM] dist/social-providers/index.d.ts  3.65 kB │ gzip: 1.14 kB
57
55
  ℹ [ESM] dist/error/index.d.ts  1.83 kB │ gzip: 0.71 kB
58
- ℹ [ESM] dist/db/index.d.ts  0.98 kB │ gzip: 0.38 kB
56
+ ℹ [ESM] dist/context/index.d.ts  1.77 kB │ gzip: 0.56 kB
57
+ ℹ [ESM] dist/db/index.d.ts  1.01 kB │ gzip: 0.38 kB
59
58
  ℹ [ESM] dist/utils/index.d.ts  0.84 kB │ gzip: 0.43 kB
60
- ℹ [ESM] dist/oauth2/index.d.ts  0.78 kB │ gzip: 0.30 kB
61
- ℹ [ESM] dist/db/adapter/index.d.ts  0.59 kB │ gzip: 0.27 kB
59
+ ℹ [ESM] dist/index.d.ts  0.82 kB │ gzip: 0.32 kB
60
+ ℹ [ESM] dist/oauth2/index.d.ts  0.79 kB │ gzip: 0.30 kB
62
61
  ℹ [ESM] dist/env/index.d.ts  0.59 kB │ gzip: 0.30 kB
63
- ℹ [ESM] dist/api/index.d.ts  0.41 kB │ gzip: 0.20 kB
62
+ ℹ [ESM] dist/db/adapter/index.d.ts  0.46 kB │ gzip: 0.23 kB
63
+ ℹ [ESM] dist/api/index.d.ts  0.29 kB │ gzip: 0.16 kB
64
64
  ℹ [ESM] dist/async_hooks/index.d.ts  0.14 kB │ gzip: 0.10 kB
65
- ℹ [ESM] dist/index-RfHoxHB4.d.ts 113.32 kB │ gzip: 14.16 kB
66
- ℹ [ESM] dist/index-DgTKobWC.d.ts  52.30 kB │ gzip: 11.14 kB
67
- ℹ [ESM] dist/index-CZCOI9An.d.ts  9.00 kB │ gzip: 2.16 kB
68
- ℹ [ESM] dist/index-DQNPxXof.d.ts  8.30 kB │ gzip: 2.11 kB
69
- ℹ [ESM] dist/index-D5uj-vER.d.ts  3.25 kB │ gzip: 1.10 kB
70
- ℹ [ESM] dist/helper-BH5srn6K.d.ts  0.34 kB │ gzip: 0.22 kB
71
- ℹ [ESM] dist/index-CR-gJyzm.d.ts  0.24 kB │ gzip: 0.16 kB
72
- ℹ [ESM] 35 files, total: 302.94 kB
65
+ ℹ [ESM] dist/index-DTT2geV_.d.ts 185.45 kB │ gzip: 29.86 kB
66
+ ℹ [ESM] dist/index-C8vNYjIq.d.ts  3.25 kB │ gzip: 1.10 kB
67
+ ℹ [ESM] dist/index-DT7CRnvv.d.ts  0.24 kB │ gzip: 0.16 kB
68
+ ℹ [ESM] 31 files, total: 303.10 kB
73
69
  [UNRESOLVED_IMPORT] Warning: Could not resolve '@better-auth/core/oauth2' in src/social-providers/polar.ts
74
- ╭─[ src/social-providers/polar.ts:7:8 ]
70
+ ╭─[ src/social-providers/polar.ts:6:8 ]
75
71
  │
76
- 7 │ } from "@better-auth/core/oauth2";
72
+ 6 │ } from "@better-auth/core/oauth2";
77
73
   │ ─────────────┬────────────
78
74
   │ ╰────────────── Module not found, treating it as an external dependency
79
75
  ───╯
80
76
 
81
- ℹ [CJS] dist/social-providers/index.d.cts  3.67 kB │ gzip: 1.15 kB
82
- ℹ [CJS] dist/index.d.cts  2.50 kB │ gzip: 0.97 kB
83
- ℹ [CJS] dist/context/index.d.cts  1.90 kB │ gzip: 0.61 kB
77
+ ℹ [CJS] dist/social-providers/index.d.cts  3.65 kB │ gzip: 1.14 kB
84
78
  ℹ [CJS] dist/error/index.d.cts  1.83 kB │ gzip: 0.71 kB
85
- ℹ [CJS] dist/db/index.d.cts  0.99 kB │ gzip: 0.38 kB
79
+ ℹ [CJS] dist/context/index.d.cts  1.77 kB │ gzip: 0.56 kB
80
+ ℹ [CJS] dist/db/index.d.cts  1.01 kB │ gzip: 0.38 kB
86
81
  ℹ [CJS] dist/utils/index.d.cts  0.84 kB │ gzip: 0.43 kB
87
- ℹ [CJS] dist/oauth2/index.d.cts  0.78 kB │ gzip: 0.29 kB
88
- ℹ [CJS] dist/db/adapter/index.d.cts  0.60 kB │ gzip: 0.27 kB
82
+ ℹ [CJS] dist/index.d.cts  0.83 kB │ gzip: 0.32 kB
83
+ ℹ [CJS] dist/oauth2/index.d.cts  0.79 kB │ gzip: 0.30 kB
89
84
  ℹ [CJS] dist/env/index.d.cts  0.59 kB │ gzip: 0.30 kB
90
- ℹ [CJS] dist/api/index.d.cts  0.42 kB │ gzip: 0.20 kB
85
+ ℹ [CJS] dist/db/adapter/index.d.cts  0.47 kB │ gzip: 0.22 kB
86
+ ℹ [CJS] dist/api/index.d.cts  0.29 kB │ gzip: 0.16 kB
91
87
  ℹ [CJS] dist/async_hooks/index.d.cts  0.14 kB │ gzip: 0.10 kB
92
- ℹ [CJS] dist/index-Cg7SVnu9.d.cts 116.60 kB │ gzip: 14.88 kB
93
- ℹ [CJS] dist/index-DXj1sY8B.d.cts  52.31 kB │ gzip: 11.14 kB
94
- ℹ [CJS] dist/index-BCxkjvux.d.cts  9.00 kB │ gzip: 2.16 kB
95
- ℹ [CJS] dist/index-daoIWR6L.d.cts  8.30 kB │ gzip: 2.11 kB
96
- ℹ [CJS] dist/index-Dy_s5RNc.d.cts  3.25 kB │ gzip: 1.10 kB
97
- ℹ [CJS] dist/helper-ChPUVnMr.d.cts  0.34 kB │ gzip: 0.22 kB
98
- ℹ [CJS] dist/index-CilaMiAm.d.cts  0.24 kB │ gzip: 0.16 kB
99
- ℹ [CJS] 18 files, total: 204.31 kB
100
- ✔ Build complete in 4730ms
88
+ ℹ [CJS] dist/index-6-zeCbRA.d.cts 188.69 kB │ gzip: 30.59 kB
89
+ ℹ [CJS] dist/index-DAzyP5GG.d.cts  3.25 kB │ gzip: 1.10 kB
90
+ ℹ [CJS] dist/index-BzepAavo.d.cts  0.24 kB │ gzip: 0.16 kB
91
+ ℹ [CJS] 14 files, total: 204.40 kB
92
+ ✔ Build complete in 4733ms
@@ -1,6 +1,6 @@
1
1
  const require_chunk = require('../chunk-CUT6urMc.cjs');
2
2
  require('../async_hooks-CaXONcb9.cjs');
3
- const require_context = require('../context-7VgEbfs3.cjs');
3
+ const require_context = require('../context-BRDf96na.cjs');
4
4
  let better_call = require("better-call");
5
5
  better_call = require_chunk.__toESM(better_call);
6
6
 
@@ -1,7 +1,3 @@
1
- import "../helper-ChPUVnMr.cjs";
2
- import "../index-daoIWR6L.cjs";
3
- import { a as optionsMiddleware, i as createAuthMiddleware, n as AuthMiddleware, r as createAuthEndpoint, t as AuthEndpoint } from "../index-DXj1sY8B.cjs";
4
- import "../index-BCxkjvux.cjs";
5
- import "../index-Cg7SVnu9.cjs";
6
- import "../index-Dy_s5RNc.cjs";
1
+ import { a as optionsMiddleware, i as createAuthMiddleware, n as AuthMiddleware, r as createAuthEndpoint, t as AuthEndpoint } from "../index-6-zeCbRA.cjs";
2
+ import "../index-DAzyP5GG.cjs";
7
3
  export { AuthEndpoint, AuthMiddleware, createAuthEndpoint, createAuthMiddleware, optionsMiddleware };
@@ -1,7 +1,3 @@
1
- import "../helper-BH5srn6K.js";
2
- import "../index-DQNPxXof.js";
3
- import { a as optionsMiddleware, i as createAuthMiddleware, n as AuthMiddleware, r as createAuthEndpoint, t as AuthEndpoint } from "../index-DgTKobWC.js";
4
- import "../index-CZCOI9An.js";
5
- import "../index-RfHoxHB4.js";
6
- import "../index-D5uj-vER.js";
1
+ import { a as optionsMiddleware, i as createAuthMiddleware, n as AuthMiddleware, r as createAuthEndpoint, t as AuthEndpoint } from "../index-DTT2geV_.js";
2
+ import "../index-C8vNYjIq.js";
7
3
  export { AuthEndpoint, AuthMiddleware, createAuthEndpoint, createAuthMiddleware, optionsMiddleware };
package/dist/api/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import "../async_hooks-qYTIyHB7.js";
2
- import { r as runWithEndpointContext } from "../context-Bm0rm76r.js";
2
+ import { s as runWithEndpointContext } from "../context-BAOGRjRS.js";
3
3
  import { createEndpoint, createMiddleware } from "better-call";
4
4
 
5
5
  //#region src/api/index.ts
@@ -1,2 +1,2 @@
1
- import { n as getAsyncLocalStorage, t as AsyncLocalStorage } from "../index-CilaMiAm.cjs";
1
+ import { n as getAsyncLocalStorage, t as AsyncLocalStorage } from "../index-BzepAavo.cjs";
2
2
  export { AsyncLocalStorage, getAsyncLocalStorage };
@@ -1,2 +1,2 @@
1
- import { n as getAsyncLocalStorage, t as AsyncLocalStorage } from "../index-CR-gJyzm.js";
1
+ import { n as getAsyncLocalStorage, t as AsyncLocalStorage } from "../index-DT7CRnvv.js";
2
2
  export { AsyncLocalStorage, getAsyncLocalStorage };
@@ -1,5 +1,5 @@
1
1
  require('../async_hooks-CaXONcb9.cjs');
2
- const require_context = require('../context-7VgEbfs3.cjs');
2
+ const require_context = require('../context-BRDf96na.cjs');
3
3
 
4
4
  exports.getCurrentAdapter = require_context.getCurrentAdapter;
5
5
  exports.getCurrentAuthContext = require_context.getCurrentAuthContext;
@@ -1,23 +1,8 @@
1
- import "../helper-ChPUVnMr.cjs";
2
- import "../index-daoIWR6L.cjs";
3
- import { C as DBTransactionAdapter, f as AuthContext, v as DBAdapter } from "../index-DXj1sY8B.cjs";
4
- import "../index-BCxkjvux.cjs";
5
- import "../index-Cg7SVnu9.cjs";
6
- import "../index-Dy_s5RNc.cjs";
7
- import { t as AsyncLocalStorage } from "../index-CilaMiAm.cjs";
1
+ import { Wn as DBTransactionAdapter, d as AuthContext, zn as DBAdapter } from "../index-6-zeCbRA.cjs";
2
+ import "../index-DAzyP5GG.cjs";
3
+ import { t as AsyncLocalStorage } from "../index-BzepAavo.cjs";
8
4
  import { EndpointContext, InputContext } from "better-call";
9
5
 
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
6
  //#region src/context/endpoint-context.d.ts
22
7
  type AuthEndpointContext = Partial<InputContext<string, any> & EndpointContext<string, any>> & {
23
8
  context: AuthContext;
@@ -31,4 +16,15 @@ declare function getCurrentAuthContextAsyncLocalStorage(): Promise<AsyncLocalSto
31
16
  declare function getCurrentAuthContext(): Promise<AuthEndpointContext>;
32
17
  declare function runWithEndpointContext<T>(context: AuthEndpointContext, fn: () => T): Promise<T>;
33
18
  //#endregion
19
+ //#region src/context/transaction.d.ts
20
+ /**
21
+ * This is for internal use only. Most users should use `getCurrentAdapter` instead.
22
+ *
23
+ * It is exposed for advanced use cases where you need direct access to the AsyncLocalStorage instance.
24
+ */
25
+ declare const getCurrentDBAdapterAsyncLocalStorage: () => Promise<AsyncLocalStorage<DBTransactionAdapter>>;
26
+ declare const getCurrentAdapter: (fallback: DBTransactionAdapter) => Promise<DBTransactionAdapter>;
27
+ declare const runWithAdapter: <R>(adapter: DBAdapter, fn: () => R) => Promise<R>;
28
+ declare const runWithTransaction: <R>(adapter: DBAdapter, fn: () => R) => Promise<R>;
29
+ //#endregion
34
30
  export { type AuthEndpointContext, getCurrentAdapter, getCurrentAuthContext, getCurrentAuthContextAsyncLocalStorage, getCurrentDBAdapterAsyncLocalStorage, runWithAdapter, runWithEndpointContext, runWithTransaction };
@@ -1,23 +1,8 @@
1
- import "../helper-BH5srn6K.js";
2
- import "../index-DQNPxXof.js";
3
- import { C as DBTransactionAdapter, f as AuthContext, v as DBAdapter } from "../index-DgTKobWC.js";
4
- import "../index-CZCOI9An.js";
5
- import "../index-RfHoxHB4.js";
6
- import "../index-D5uj-vER.js";
7
- import { t as AsyncLocalStorage } from "../index-CR-gJyzm.js";
1
+ import { Wn as DBTransactionAdapter, d as AuthContext, zn as DBAdapter } from "../index-DTT2geV_.js";
2
+ import "../index-C8vNYjIq.js";
3
+ import { t as AsyncLocalStorage } from "../index-DT7CRnvv.js";
8
4
  import { EndpointContext, InputContext } from "better-call";
9
5
 
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
6
  //#region src/context/endpoint-context.d.ts
22
7
  type AuthEndpointContext = Partial<InputContext<string, any> & EndpointContext<string, any>> & {
23
8
  context: AuthContext;
@@ -31,4 +16,15 @@ declare function getCurrentAuthContextAsyncLocalStorage(): Promise<AsyncLocalSto
31
16
  declare function getCurrentAuthContext(): Promise<AuthEndpointContext>;
32
17
  declare function runWithEndpointContext<T>(context: AuthEndpointContext, fn: () => T): Promise<T>;
33
18
  //#endregion
19
+ //#region src/context/transaction.d.ts
20
+ /**
21
+ * This is for internal use only. Most users should use `getCurrentAdapter` instead.
22
+ *
23
+ * It is exposed for advanced use cases where you need direct access to the AsyncLocalStorage instance.
24
+ */
25
+ declare const getCurrentDBAdapterAsyncLocalStorage: () => Promise<AsyncLocalStorage<DBTransactionAdapter>>;
26
+ declare const getCurrentAdapter: (fallback: DBTransactionAdapter) => Promise<DBTransactionAdapter>;
27
+ declare const runWithAdapter: <R>(adapter: DBAdapter, fn: () => R) => Promise<R>;
28
+ declare const runWithTransaction: <R>(adapter: DBAdapter, fn: () => R) => Promise<R>;
29
+ //#endregion
34
30
  export { type AuthEndpointContext, getCurrentAdapter, getCurrentAuthContext, getCurrentAuthContextAsyncLocalStorage, getCurrentDBAdapterAsyncLocalStorage, runWithAdapter, runWithEndpointContext, runWithTransaction };
@@ -1,4 +1,4 @@
1
1
  import "../async_hooks-qYTIyHB7.js";
2
- import { a as getCurrentDBAdapterAsyncLocalStorage, i as getCurrentAdapter, n as getCurrentAuthContextAsyncLocalStorage, o as runWithAdapter, r as runWithEndpointContext, s as runWithTransaction, t as getCurrentAuthContext } from "../context-Bm0rm76r.js";
2
+ import { a as getCurrentAuthContext, i as runWithTransaction, n as getCurrentDBAdapterAsyncLocalStorage, o as getCurrentAuthContextAsyncLocalStorage, r as runWithAdapter, s as runWithEndpointContext, t as getCurrentAdapter } from "../context-BAOGRjRS.js";
3
3
 
4
4
  export { getCurrentAdapter, getCurrentAuthContext, getCurrentAuthContextAsyncLocalStorage, getCurrentDBAdapterAsyncLocalStorage, runWithAdapter, runWithEndpointContext, runWithTransaction };
@@ -1,8 +1,32 @@
1
1
  import { t as getAsyncLocalStorage } from "./async_hooks-qYTIyHB7.js";
2
2
 
3
+ //#region src/context/endpoint-context.ts
4
+ let currentContextAsyncStorage = null;
5
+ const ensureAsyncStorage$1 = async () => {
6
+ if (!currentContextAsyncStorage) currentContextAsyncStorage = new (await (getAsyncLocalStorage()))();
7
+ return currentContextAsyncStorage;
8
+ };
9
+ /**
10
+ * This is for internal use only. Most users should use `getCurrentAuthContext` instead.
11
+ *
12
+ * It is exposed for advanced use cases where you need direct access to the AsyncLocalStorage instance.
13
+ */
14
+ async function getCurrentAuthContextAsyncLocalStorage() {
15
+ return ensureAsyncStorage$1();
16
+ }
17
+ async function getCurrentAuthContext() {
18
+ const context = (await ensureAsyncStorage$1()).getStore();
19
+ if (!context) throw new Error("No auth context found. Please make sure you are calling this function within a `runWithEndpointContext` callback.");
20
+ return context;
21
+ }
22
+ async function runWithEndpointContext(context, fn) {
23
+ return (await ensureAsyncStorage$1()).run(context, fn);
24
+ }
25
+
26
+ //#endregion
3
27
  //#region src/context/transaction.ts
4
28
  let currentAdapterAsyncStorage = null;
5
- const ensureAsyncStorage$1 = async () => {
29
+ const ensureAsyncStorage = async () => {
6
30
  if (!currentAdapterAsyncStorage) currentAdapterAsyncStorage = new (await (getAsyncLocalStorage()))();
7
31
  return currentAdapterAsyncStorage;
8
32
  };
@@ -12,10 +36,10 @@ const ensureAsyncStorage$1 = async () => {
12
36
  * It is exposed for advanced use cases where you need direct access to the AsyncLocalStorage instance.
13
37
  */
14
38
  const getCurrentDBAdapterAsyncLocalStorage = async () => {
15
- return ensureAsyncStorage$1();
39
+ return ensureAsyncStorage();
16
40
  };
17
41
  const getCurrentAdapter = async (fallback) => {
18
- return ensureAsyncStorage$1().then((als) => {
42
+ return ensureAsyncStorage().then((als) => {
19
43
  return als.getStore() || fallback;
20
44
  }).catch(() => {
21
45
  return fallback;
@@ -23,7 +47,7 @@ const getCurrentAdapter = async (fallback) => {
23
47
  };
24
48
  const runWithAdapter = async (adapter, fn) => {
25
49
  let called = true;
26
- return ensureAsyncStorage$1().then((als) => {
50
+ return ensureAsyncStorage().then((als) => {
27
51
  called = true;
28
52
  return als.run(adapter, fn);
29
53
  }).catch((err) => {
@@ -33,7 +57,7 @@ const runWithAdapter = async (adapter, fn) => {
33
57
  };
34
58
  const runWithTransaction = async (adapter, fn) => {
35
59
  let called = true;
36
- return ensureAsyncStorage$1().then((als) => {
60
+ return ensureAsyncStorage().then((als) => {
37
61
  called = true;
38
62
  return adapter.transaction(async (trx) => {
39
63
  return als.run(trx, fn);
@@ -45,28 +69,4 @@ const runWithTransaction = async (adapter, fn) => {
45
69
  };
46
70
 
47
71
  //#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 `runWithEndpointContext` callback.");
65
- return context;
66
- }
67
- async function runWithEndpointContext(context, fn) {
68
- return (await ensureAsyncStorage()).run(context, fn);
69
- }
70
-
71
- //#endregion
72
- export { getCurrentDBAdapterAsyncLocalStorage as a, getCurrentAdapter as i, getCurrentAuthContextAsyncLocalStorage as n, runWithAdapter as o, runWithEndpointContext as r, runWithTransaction as s, getCurrentAuthContext as t };
72
+ export { getCurrentAuthContext as a, runWithTransaction as i, getCurrentDBAdapterAsyncLocalStorage as n, getCurrentAuthContextAsyncLocalStorage as o, runWithAdapter as r, runWithEndpointContext as s, getCurrentAdapter as t };
@@ -1,8 +1,32 @@
1
1
  const require_async_hooks = require('./async_hooks-CaXONcb9.cjs');
2
2
 
3
+ //#region src/context/endpoint-context.ts
4
+ let currentContextAsyncStorage = null;
5
+ const ensureAsyncStorage$1 = async () => {
6
+ if (!currentContextAsyncStorage) currentContextAsyncStorage = new (await (require_async_hooks.getAsyncLocalStorage()))();
7
+ return currentContextAsyncStorage;
8
+ };
9
+ /**
10
+ * This is for internal use only. Most users should use `getCurrentAuthContext` instead.
11
+ *
12
+ * It is exposed for advanced use cases where you need direct access to the AsyncLocalStorage instance.
13
+ */
14
+ async function getCurrentAuthContextAsyncLocalStorage() {
15
+ return ensureAsyncStorage$1();
16
+ }
17
+ async function getCurrentAuthContext() {
18
+ const context = (await ensureAsyncStorage$1()).getStore();
19
+ if (!context) throw new Error("No auth context found. Please make sure you are calling this function within a `runWithEndpointContext` callback.");
20
+ return context;
21
+ }
22
+ async function runWithEndpointContext(context, fn) {
23
+ return (await ensureAsyncStorage$1()).run(context, fn);
24
+ }
25
+
26
+ //#endregion
3
27
  //#region src/context/transaction.ts
4
28
  let currentAdapterAsyncStorage = null;
5
- const ensureAsyncStorage$1 = async () => {
29
+ const ensureAsyncStorage = async () => {
6
30
  if (!currentAdapterAsyncStorage) currentAdapterAsyncStorage = new (await (require_async_hooks.getAsyncLocalStorage()))();
7
31
  return currentAdapterAsyncStorage;
8
32
  };
@@ -12,10 +36,10 @@ const ensureAsyncStorage$1 = async () => {
12
36
  * It is exposed for advanced use cases where you need direct access to the AsyncLocalStorage instance.
13
37
  */
14
38
  const getCurrentDBAdapterAsyncLocalStorage = async () => {
15
- return ensureAsyncStorage$1();
39
+ return ensureAsyncStorage();
16
40
  };
17
41
  const getCurrentAdapter = async (fallback) => {
18
- return ensureAsyncStorage$1().then((als) => {
42
+ return ensureAsyncStorage().then((als) => {
19
43
  return als.getStore() || fallback;
20
44
  }).catch(() => {
21
45
  return fallback;
@@ -23,7 +47,7 @@ const getCurrentAdapter = async (fallback) => {
23
47
  };
24
48
  const runWithAdapter = async (adapter, fn) => {
25
49
  let called = true;
26
- return ensureAsyncStorage$1().then((als) => {
50
+ return ensureAsyncStorage().then((als) => {
27
51
  called = true;
28
52
  return als.run(adapter, fn);
29
53
  }).catch((err) => {
@@ -33,7 +57,7 @@ const runWithAdapter = async (adapter, fn) => {
33
57
  };
34
58
  const runWithTransaction = async (adapter, fn) => {
35
59
  let called = true;
36
- return ensureAsyncStorage$1().then((als) => {
60
+ return ensureAsyncStorage().then((als) => {
37
61
  called = true;
38
62
  return adapter.transaction(async (trx) => {
39
63
  return als.run(trx, fn);
@@ -44,30 +68,6 @@ const runWithTransaction = async (adapter, fn) => {
44
68
  });
45
69
  };
46
70
 
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 `runWithEndpointContext` callback.");
65
- return context;
66
- }
67
- async function runWithEndpointContext(context, fn) {
68
- return (await ensureAsyncStorage()).run(context, fn);
69
- }
70
-
71
71
  //#endregion
72
72
  Object.defineProperty(exports, 'getCurrentAdapter', {
73
73
  enumerable: true,
@@ -1,7 +1,3 @@
1
- import "../../helper-ChPUVnMr.cjs";
2
- import "../../index-daoIWR6L.cjs";
3
- import { C as DBTransactionAdapter, S as DBAdapterSchemaCreation, _ as CustomAdapter, b as DBAdapterFactoryConfig, g as CleanedWhere, v as DBAdapter, w as Where, x as DBAdapterInstance, y as DBAdapterDebugLogOption } from "../../index-DXj1sY8B.cjs";
4
- import "../../index-BCxkjvux.cjs";
5
- import "../../index-Cg7SVnu9.cjs";
6
- import "../../index-Dy_s5RNc.cjs";
1
+ import { Bn as DBAdapterDebugLogOption, Gn as Where, Hn as DBAdapterInstance, Ln as CleanedWhere, Rn as CustomAdapter, Un as DBAdapterSchemaCreation, Vn as DBAdapterFactoryConfig, Wn as DBTransactionAdapter, zn as DBAdapter } from "../../index-6-zeCbRA.cjs";
2
+ import "../../index-DAzyP5GG.cjs";
7
3
  export { CleanedWhere, CustomAdapter, DBAdapter, DBAdapterDebugLogOption, DBAdapterFactoryConfig, DBAdapterInstance, DBAdapterSchemaCreation, DBTransactionAdapter, Where };
@@ -1,7 +1,3 @@
1
- import "../../helper-BH5srn6K.js";
2
- import "../../index-DQNPxXof.js";
3
- import { C as DBTransactionAdapter, S as DBAdapterSchemaCreation, _ as CustomAdapter, b as DBAdapterFactoryConfig, g as CleanedWhere, v as DBAdapter, w as Where, x as DBAdapterInstance, y as DBAdapterDebugLogOption } from "../../index-DgTKobWC.js";
4
- import "../../index-CZCOI9An.js";
5
- import "../../index-RfHoxHB4.js";
6
- import "../../index-D5uj-vER.js";
1
+ import { Bn as DBAdapterDebugLogOption, Gn as Where, Hn as DBAdapterInstance, Ln as CleanedWhere, Rn as CustomAdapter, Un as DBAdapterSchemaCreation, Vn as DBAdapterFactoryConfig, Wn as DBTransactionAdapter, zn as DBAdapter } from "../../index-DTT2geV_.js";
2
+ import "../../index-C8vNYjIq.js";
7
3
  export { CleanedWhere, CustomAdapter, DBAdapter, DBAdapterDebugLogOption, DBAdapterFactoryConfig, DBAdapterInstance, DBAdapterSchemaCreation, DBTransactionAdapter, Where };
package/dist/db/index.cjs CHANGED
@@ -9,15 +9,6 @@ const coreSchema = zod.object({
9
9
  updatedAt: zod.date().default(() => /* @__PURE__ */ new Date())
10
10
  });
11
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
12
  //#endregion
22
13
  //#region src/db/schema/account.ts
23
14
  const accountSchema = coreSchema.extend({
@@ -33,6 +24,14 @@ const accountSchema = coreSchema.extend({
33
24
  password: zod.string().nullish()
34
25
  });
35
26
 
27
+ //#endregion
28
+ //#region src/db/schema/rate-limit.ts
29
+ const rateLimitSchema = zod.object({
30
+ key: zod.string(),
31
+ count: zod.number(),
32
+ lastRequest: zod.number()
33
+ });
34
+
36
35
  //#endregion
37
36
  //#region src/db/schema/session.ts
38
37
  const sessionSchema = coreSchema.extend({
@@ -43,6 +42,15 @@ const sessionSchema = coreSchema.extend({
43
42
  userAgent: zod.string().nullish()
44
43
  });
45
44
 
45
+ //#endregion
46
+ //#region src/db/schema/user.ts
47
+ const userSchema = coreSchema.extend({
48
+ email: zod.string().transform((val) => val.toLowerCase()),
49
+ emailVerified: zod.boolean().default(false),
50
+ name: zod.string(),
51
+ image: zod.string().nullish()
52
+ });
53
+
46
54
  //#endregion
47
55
  //#region src/db/schema/verification.ts
48
56
  const verificationSchema = coreSchema.extend({
@@ -51,14 +59,6 @@ const verificationSchema = coreSchema.extend({
51
59
  identifier: zod.string()
52
60
  });
53
61
 
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
62
  //#endregion
63
63
  exports.accountSchema = accountSchema;
64
64
  exports.coreSchema = coreSchema;
@@ -1,3 +1,3 @@
1
- import "../helper-ChPUVnMr.cjs";
2
- import { C as DBPreservedModels, S as DBFieldType, T as SecondaryStorage, _ as coreSchema, a as FieldType, b as DBFieldAttribute, c as rateLimitSchema, d as Session, f as sessionSchema, g as userSchema, h as User, i as FieldAttributeConfig, l as Verification, m as accountSchema, n as BetterAuthDbSchema, o as Primitive, p as Account, r as FieldAttribute, s as RateLimit, t as AuthPluginSchema, u as verificationSchema, v as BetterAuthPluginDBSchema, w as DBPrimitive, x as DBFieldAttributeConfig, y as BetterAuthDBSchema } from "../index-daoIWR6L.cjs";
1
+ import { $n as verificationSchema, Jn as FieldAttribute, Kn as AuthPluginSchema, Qn as Verification, Xn as FieldType, Yn as FieldAttributeConfig, Zn as Primitive, ar as RateLimit, cr as accountSchema, dr as DBFieldAttribute, er as User, fr as DBFieldAttributeConfig, gr as SecondaryStorage, hr as DBPrimitive, ir as sessionSchema, lr as BetterAuthPluginDBSchema, mr as DBPreservedModels, nr as coreSchema, or as rateLimitSchema, pr as DBFieldType, qn as BetterAuthDbSchema, rr as Session, sr as Account, tr as userSchema, ur as BetterAuthDBSchema } from "../index-6-zeCbRA.cjs";
2
+ import "../index-DAzyP5GG.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 };
@@ -1,3 +1,3 @@
1
- import "../helper-BH5srn6K.js";
2
- import { C as DBPreservedModels, S as DBFieldType, T as SecondaryStorage, _ as coreSchema, a as FieldType, b as DBFieldAttribute, c as rateLimitSchema, d as Session, f as sessionSchema, g as userSchema, h as User, i as FieldAttributeConfig, l as Verification, m as accountSchema, n as BetterAuthDbSchema, o as Primitive, p as Account, r as FieldAttribute, s as RateLimit, t as AuthPluginSchema, u as verificationSchema, v as BetterAuthPluginDBSchema, w as DBPrimitive, x as DBFieldAttributeConfig, y as BetterAuthDBSchema } from "../index-DQNPxXof.js";
1
+ import { $n as verificationSchema, Jn as FieldAttribute, Kn as AuthPluginSchema, Qn as Verification, Xn as FieldType, Yn as FieldAttributeConfig, Zn as Primitive, ar as RateLimit, cr as accountSchema, dr as DBFieldAttribute, er as User, fr as DBFieldAttributeConfig, gr as SecondaryStorage, hr as DBPrimitive, ir as sessionSchema, lr as BetterAuthPluginDBSchema, mr as DBPreservedModels, nr as coreSchema, or as rateLimitSchema, pr as DBFieldType, qn as BetterAuthDbSchema, rr as Session, sr as Account, tr as userSchema, ur as BetterAuthDBSchema } from "../index-DTT2geV_.js";
2
+ import "../index-C8vNYjIq.js";
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 };