@better-auth/core 1.3.27 → 1.4.0-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/.turbo/turbo-build.log +72 -25
  2. package/dist/async_hooks/index.cjs +12 -20
  3. package/dist/async_hooks/index.d.cts +4 -7
  4. package/dist/async_hooks/index.d.ts +4 -7
  5. package/dist/async_hooks/index.js +18 -0
  6. package/dist/chunk-CUT6urMc.cjs +30 -0
  7. package/dist/db/adapter/index.cjs +0 -2
  8. package/dist/db/adapter/index.d.cts +7 -23
  9. package/dist/db/adapter/index.d.ts +7 -23
  10. package/dist/db/adapter/index.js +1 -0
  11. package/dist/db/index.cjs +49 -56
  12. package/dist/db/index.d.cts +3 -116
  13. package/dist/db/index.d.ts +3 -116
  14. package/dist/db/index.js +61 -0
  15. package/dist/env/index.cjs +16 -0
  16. package/dist/env/index.d.cts +2 -0
  17. package/dist/env/index.d.ts +2 -0
  18. package/dist/env/index.js +3 -0
  19. package/dist/env-B05JceKx.cjs +330 -0
  20. package/dist/env-BZ5Nwx0e.js +246 -0
  21. package/dist/error/index.cjs +5 -0
  22. package/dist/error/index.d.cts +35 -0
  23. package/dist/error/index.d.ts +35 -0
  24. package/dist/error/index.js +4 -0
  25. package/dist/error-Hbg10Ynz.cjs +56 -0
  26. package/dist/error-ULaqTKlI.js +45 -0
  27. package/dist/helper-5oNxdxzu.d.ts +6 -0
  28. package/dist/helper-DVgWo5zB.d.cts +6 -0
  29. package/dist/index-B7m2jDWm.d.cts +344 -0
  30. package/dist/index-CESTxPyW.d.cts +82 -0
  31. package/dist/index-Cw9Gfaxd.d.cts +4410 -0
  32. package/dist/index-Cx8dCSTo.d.ts +82 -0
  33. package/dist/index-DJdmnKQr.d.ts +4410 -0
  34. package/dist/index-DNvIh1jX.d.cts +1870 -0
  35. package/dist/index-DoyF8K2U.d.ts +344 -0
  36. package/dist/index-ujq2DkG7.d.ts +1870 -0
  37. package/dist/index.cjs +0 -2
  38. package/dist/index.d.cts +7 -124
  39. package/dist/index.d.ts +7 -124
  40. package/dist/index.js +1 -0
  41. package/dist/middleware/index.cjs +22 -0
  42. package/dist/middleware/index.d.cts +7 -0
  43. package/dist/middleware/index.d.ts +7 -0
  44. package/dist/middleware/index.js +18 -0
  45. package/dist/oauth2/index.cjs +12 -0
  46. package/dist/oauth2/index.d.cts +3 -0
  47. package/dist/oauth2/index.d.ts +3 -0
  48. package/dist/oauth2/index.js +3 -0
  49. package/dist/oauth2-BokgssHJ.js +239 -0
  50. package/dist/oauth2-CLON8fY4.cjs +302 -0
  51. package/dist/social-providers/index.cjs +2410 -0
  52. package/dist/social-providers/index.d.cts +4 -0
  53. package/dist/social-providers/index.d.ts +4 -0
  54. package/dist/social-providers/index.js +2370 -0
  55. package/dist/type-BNCR-kIK.d.cts +262 -0
  56. package/dist/type-eT5TjHFp.d.ts +262 -0
  57. package/dist/utils/index.cjs +3 -0
  58. package/dist/utils/index.d.cts +9 -0
  59. package/dist/utils/index.d.ts +9 -0
  60. package/dist/utils/index.js +3 -0
  61. package/dist/utils-AcCtPmwG.cjs +13 -0
  62. package/dist/utils-BQjFFU97.js +7 -0
  63. package/package.json +107 -11
  64. package/src/async_hooks/index.ts +1 -9
  65. package/src/db/adapter/index.ts +424 -0
  66. package/src/db/index.ts +4 -0
  67. package/src/db/schema/rate-limit.ts +21 -0
  68. package/src/db/type.ts +29 -10
  69. package/src/env/color-depth.ts +171 -0
  70. package/src/env/env-impl.ts +123 -0
  71. package/src/env/index.ts +23 -0
  72. package/src/env/logger.test.ts +33 -0
  73. package/src/env/logger.ts +145 -0
  74. package/src/error/codes.ts +31 -0
  75. package/src/error/index.ts +11 -0
  76. package/src/index.ts +0 -2
  77. package/src/middleware/index.ts +33 -0
  78. package/src/oauth2/client-credentials-token.ts +102 -0
  79. package/src/oauth2/create-authorization-url.ts +85 -0
  80. package/src/oauth2/index.ts +22 -0
  81. package/src/oauth2/oauth-provider.ts +194 -0
  82. package/src/oauth2/refresh-access-token.ts +124 -0
  83. package/src/oauth2/utils.ts +36 -0
  84. package/src/oauth2/validate-authorization-code.ts +156 -0
  85. package/src/social-providers/apple.ts +213 -0
  86. package/src/social-providers/atlassian.ts +127 -0
  87. package/src/social-providers/cognito.ts +266 -0
  88. package/src/social-providers/discord.ts +169 -0
  89. package/src/social-providers/dropbox.ts +112 -0
  90. package/src/social-providers/facebook.ts +201 -0
  91. package/src/social-providers/figma.ts +112 -0
  92. package/src/social-providers/github.ts +154 -0
  93. package/src/social-providers/gitlab.ts +152 -0
  94. package/src/social-providers/google.ts +168 -0
  95. package/src/social-providers/huggingface.ts +116 -0
  96. package/src/social-providers/index.ts +118 -0
  97. package/src/social-providers/kakao.ts +178 -0
  98. package/src/social-providers/kick.ts +92 -0
  99. package/src/social-providers/line.ts +169 -0
  100. package/src/social-providers/linear.ts +120 -0
  101. package/src/social-providers/linkedin.ts +110 -0
  102. package/src/social-providers/microsoft-entra-id.ts +243 -0
  103. package/src/social-providers/naver.ts +112 -0
  104. package/src/social-providers/notion.ts +106 -0
  105. package/src/social-providers/paypal.ts +261 -0
  106. package/src/social-providers/reddit.ts +122 -0
  107. package/src/social-providers/roblox.ts +107 -0
  108. package/src/social-providers/salesforce.ts +154 -0
  109. package/src/social-providers/slack.ts +111 -0
  110. package/src/social-providers/spotify.ts +93 -0
  111. package/src/social-providers/tiktok.ts +208 -0
  112. package/src/social-providers/twitch.ts +111 -0
  113. package/src/social-providers/twitter.ts +194 -0
  114. package/src/social-providers/vk.ts +125 -0
  115. package/src/social-providers/zoom.ts +215 -0
  116. package/src/types/context.ts +270 -0
  117. package/src/types/cookie.ts +7 -0
  118. package/src/types/index.ts +19 -1
  119. package/src/types/init-options.ts +1035 -7
  120. package/src/types/plugin-client.ts +69 -0
  121. package/src/types/plugin.ts +134 -0
  122. package/src/utils/error-codes.ts +51 -0
  123. package/src/utils/index.ts +1 -0
  124. package/tsdown.config.ts +19 -0
  125. package/build.config.ts +0 -17
  126. package/dist/async_hooks/index.d.mts +0 -10
  127. package/dist/async_hooks/index.mjs +0 -25
  128. package/dist/db/adapter/index.d.mts +0 -23
  129. package/dist/db/adapter/index.mjs +0 -1
  130. package/dist/db/index.d.mts +0 -116
  131. package/dist/db/index.mjs +0 -55
  132. package/dist/index.d.mts +0 -124
  133. package/dist/index.mjs +0 -1
  134. package/dist/shared/core.CnvFgghY.d.cts +0 -117
  135. package/dist/shared/core.CnvFgghY.d.mts +0 -117
  136. package/dist/shared/core.CnvFgghY.d.ts +0 -117
@@ -1,27 +1,74 @@
1
1
 
2
- > @better-auth/core@1.3.27 build /home/runner/work/better-auth/better-auth/packages/core
3
- > unbuild --clean
2
+ > @better-auth/core@1.4.0-beta.10 build /home/runner/work/better-auth/better-auth/packages/core
3
+ > tsdown
4
4
 
5
- [info] Building core
6
- [info] Cleaning dist directory: `./dist`
7
- Generated an empty chunk: "index".
8
- Generated an empty chunk: "db/adapter/index".
9
- Generated an empty chunk: "index".
10
- Generated an empty chunk: "db/adapter/index".
11
- [success] Build succeeded for core
12
- [log] dist/index.cjs (total size: 15 B, chunk size: 15 B)
13
-
14
- [log] dist/async_hooks/index.cjs (total size: 922 B, chunk size: 922 B, exports: getAsyncLocalStorage)
15
-
16
- [log] dist/db/index.cjs (total size: 2.09 kB, chunk size: 2.09 kB, exports: accountSchema, coreSchema, sessionSchema, userSchema, verificationSchema)
17
-
18
- [log] dist/db/adapter/index.cjs (total size: 15 B, chunk size: 15 B)
19
- [log] dist/index.mjs (total size: 1 B, chunk size: 1 B)
20
-
21
- [log] dist/async_hooks/index.mjs (total size: 887 B, chunk size: 887 B, exports: getAsyncLocalStorage)
22
-
23
- [log] dist/db/index.mjs (total size: 1.4 kB, chunk size: 1.4 kB, exports: accountSchema, coreSchema, sessionSchema, userSchema, verificationSchema)
24
-
25
- [log] dist/db/adapter/index.mjs (total size: 1 B, chunk size: 1 B)
26
- Σ Total dist size (byte size): 43 kB
27
- [log]
5
+ ℹ tsdown v0.15.6 powered by rolldown v1.0.0-beta.43
6
+ ℹ Using tsdown config: /home/runner/work/better-auth/better-auth/packages/core/tsdown.config.ts
7
+ ℹ entry: src/index.ts, src/async_hooks/index.ts, src/db/index.ts, src/env/index.ts, src/error/index.ts, src/middleware/index.ts, src/oauth2/index.ts, src/social-providers/index.ts, src/utils/index.ts, src/db/adapter/index.ts
8
+ ℹ tsconfig: tsconfig.json
9
+ ℹ Build start
10
+ ℹ [CJS] dist/social-providers/index.cjs 77.23 kB │ gzip: 10.22 kB
11
+ ℹ [CJS] dist/db/index.cjs  1.86 kB │ gzip: 0.56 kB
12
+ ℹ [CJS] dist/async_hooks/index.cjs  0.88 kB │ gzip: 0.46 kB
13
+ ℹ [CJS] dist/oauth2/index.cjs  0.80 kB │ gzip: 0.24 kB
14
+ ℹ [CJS] dist/middleware/index.cjs  0.79 kB │ gzip: 0.34 kB
15
+ ℹ [CJS] dist/env/index.cjs  0.67 kB │ gzip: 0.24 kB
16
+ ℹ [CJS] dist/error/index.cjs  0.21 kB │ gzip: 0.14 kB
17
+ ℹ [CJS] dist/utils/index.cjs  0.12 kB │ gzip: 0.10 kB
18
+ ℹ [CJS] dist/db/adapter/index.cjs  0.00 kB │ gzip: 0.02 kB
19
+ ℹ [CJS] dist/index.cjs  0.00 kB │ gzip: 0.02 kB
20
+ ℹ [CJS] dist/oauth2-CLON8fY4.cjs 10.87 kB │ gzip: 2.29 kB
21
+ ℹ [CJS] dist/env-B05JceKx.cjs  9.16 kB │ gzip: 2.64 kB
22
+ ℹ [CJS] dist/error-Hbg10Ynz.cjs  1.98 kB │ gzip: 0.85 kB
23
+ ℹ [CJS] dist/chunk-CUT6urMc.cjs  1.09 kB │ gzip: 0.54 kB
24
+ ℹ [CJS] dist/utils-AcCtPmwG.cjs  0.23 kB │ gzip: 0.17 kB
25
+ ℹ [CJS] 15 files, total: 105.88 kB
26
+ ℹ [ESM] dist/social-providers/index.js  73.39 kB │ gzip: 9.98 kB
27
+ ℹ [ESM] dist/db/index.js  1.58 kB │ gzip: 0.49 kB
28
+ ℹ [ESM] dist/async_hooks/index.js  0.86 kB │ gzip: 0.46 kB
29
+ ℹ [ESM] dist/middleware/index.js  0.57 kB │ gzip: 0.27 kB
30
+ ℹ [ESM] dist/oauth2/index.js  0.56 kB │ gzip: 0.18 kB
31
+ ℹ [ESM] dist/env/index.js  0.37 kB │ gzip: 0.18 kB
32
+ ℹ [ESM] dist/error/index.js  0.15 kB │ gzip: 0.12 kB
33
+ ℹ [ESM] dist/utils/index.js  0.09 kB │ gzip: 0.08 kB
34
+ ℹ [ESM] dist/db/adapter/index.js  0.01 kB │ gzip: 0.03 kB
35
+ ℹ [ESM] dist/index.js  0.01 kB │ gzip: 0.03 kB
36
+ ℹ [ESM] dist/oauth2-BokgssHJ.js  9.18 kB │ gzip: 2.10 kB
37
+ ℹ [ESM] dist/env-BZ5Nwx0e.js  7.68 kB │ gzip: 2.52 kB
38
+ ℹ [ESM] dist/error-ULaqTKlI.js  1.75 kB │ gzip: 0.78 kB
39
+ ℹ [ESM] dist/utils-BQjFFU97.js  0.13 kB │ gzip: 0.11 kB
40
+ ℹ [ESM] dist/social-providers/index.d.ts  3.00 kB │ gzip: 0.62 kB
41
+ ℹ [ESM] dist/error/index.d.ts  1.83 kB │ gzip: 0.71 kB
42
+ ℹ [ESM] dist/db/index.d.ts  0.86 kB │ gzip: 0.26 kB
43
+ ℹ [ESM] dist/utils/index.d.ts  0.84 kB │ gzip: 0.43 kB
44
+ ℹ [ESM] dist/index.d.ts  0.79 kB │ gzip: 0.28 kB
45
+ ℹ [ESM] dist/oauth2/index.d.ts  0.71 kB │ gzip: 0.23 kB
46
+ ℹ [ESM] dist/db/adapter/index.d.ts  0.55 kB │ gzip: 0.23 kB
47
+ ℹ [ESM] dist/env/index.d.ts  0.49 kB │ gzip: 0.22 kB
48
+ ℹ [ESM] dist/middleware/index.d.ts  0.39 kB │ gzip: 0.18 kB
49
+ ℹ [ESM] dist/async_hooks/index.d.ts  0.24 kB │ gzip: 0.16 kB
50
+ ℹ [ESM] dist/index-DJdmnKQr.d.ts 109.59 kB │ gzip: 13.64 kB
51
+ ℹ [ESM] dist/index-ujq2DkG7.d.ts  56.16 kB │ gzip: 11.73 kB
52
+ ℹ [ESM] dist/index-DoyF8K2U.d.ts  8.95 kB │ gzip: 2.13 kB
53
+ ℹ [ESM] dist/type-eT5TjHFp.d.ts  8.24 kB │ gzip: 2.08 kB
54
+ ℹ [ESM] dist/index-Cx8dCSTo.d.ts  3.18 kB │ gzip: 1.06 kB
55
+ ℹ [ESM] dist/helper-5oNxdxzu.d.ts  0.33 kB │ gzip: 0.21 kB
56
+ ℹ [ESM] 30 files, total: 292.45 kB
57
+ ℹ [CJS] dist/social-providers/index.d.cts  3.00 kB │ gzip: 0.63 kB
58
+ ℹ [CJS] dist/error/index.d.cts  1.83 kB │ gzip: 0.71 kB
59
+ ℹ [CJS] dist/db/index.d.cts  0.86 kB │ gzip: 0.26 kB
60
+ ℹ [CJS] dist/utils/index.d.cts  0.84 kB │ gzip: 0.43 kB
61
+ ℹ [CJS] dist/index.d.cts  0.79 kB │ gzip: 0.28 kB
62
+ ℹ [CJS] dist/oauth2/index.d.cts  0.71 kB │ gzip: 0.23 kB
63
+ ℹ [CJS] dist/db/adapter/index.d.cts  0.55 kB │ gzip: 0.23 kB
64
+ ℹ [CJS] dist/env/index.d.cts  0.50 kB │ gzip: 0.22 kB
65
+ ℹ [CJS] dist/middleware/index.d.cts  0.39 kB │ gzip: 0.18 kB
66
+ ℹ [CJS] dist/async_hooks/index.d.cts  0.24 kB │ gzip: 0.16 kB
67
+ ℹ [CJS] dist/index-Cw9Gfaxd.d.cts 109.59 kB │ gzip: 13.64 kB
68
+ ℹ [CJS] dist/index-DNvIh1jX.d.cts  56.16 kB │ gzip: 11.73 kB
69
+ ℹ [CJS] dist/index-B7m2jDWm.d.cts  8.95 kB │ gzip: 2.13 kB
70
+ ℹ [CJS] dist/type-BNCR-kIK.d.cts  8.24 kB │ gzip: 2.08 kB
71
+ ℹ [CJS] dist/index-CESTxPyW.d.cts  3.18 kB │ gzip: 1.06 kB
72
+ ℹ [CJS] dist/helper-DVgWo5zB.d.cts  0.33 kB │ gzip: 0.21 kB
73
+ ℹ [CJS] 16 files, total: 196.16 kB
74
+ ✔ Build complete in 4060ms
@@ -1,27 +1,19 @@
1
- 'use strict';
2
1
 
3
- let moduleName = "node:async_hooks";
2
+ //#region src/async_hooks/index.ts
4
3
  const AsyncLocalStoragePromise = import(
5
- /* @vite-ignore */
6
- /* webpackIgnore: true */
7
- moduleName
4
+ /* @vite-ignore */
5
+ /* webpackIgnore: true */
6
+ "node:async_hooks"
8
7
  ).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;
8
+ if ("AsyncLocalStorage" in globalThis) return globalThis.AsyncLocalStorage;
9
+ console.warn("[better-auth] Warning: AsyncLocalStorage is not available in this environment. Some features may not work as expected.");
10
+ console.warn("[better-auth] Please read more about this warning at https://better-auth.com/docs/installation#mount-handler");
11
+ console.warn("[better-auth] If you are using Cloudflare Workers, please see: https://developers.cloudflare.com/workers/configuration/compatibility-flags/#nodejs-compatibility-flag");
12
+ throw err;
22
13
  });
23
14
  async function getAsyncLocalStorage() {
24
- return AsyncLocalStoragePromise;
15
+ return AsyncLocalStoragePromise;
25
16
  }
26
17
 
27
- exports.getAsyncLocalStorage = getAsyncLocalStorage;
18
+ //#endregion
19
+ exports.getAsyncLocalStorage = getAsyncLocalStorage;
@@ -1,10 +1,7 @@
1
- import { AsyncLocalStorage } from 'node:async_hooks';
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 'node:async_hooks';
2
- export { AsyncLocalStorage } from 'node:async_hooks';
1
+ import { AsyncLocalStorage } from "node:async_hooks";
3
2
 
4
- /**
5
- * AsyncLocalStorage will be import directly in 1.5.x
6
- */
3
+ //#region src/async_hooks/index.d.ts
7
4
 
8
5
  declare function getAsyncLocalStorage(): Promise<typeof AsyncLocalStorage>;
9
-
10
- export { getAsyncLocalStorage };
6
+ //#endregion
7
+ export { type AsyncLocalStorage, getAsyncLocalStorage };
@@ -0,0 +1,18 @@
1
+ //#region src/async_hooks/index.ts
2
+ const AsyncLocalStoragePromise = import(
3
+ /* @vite-ignore */
4
+ /* webpackIgnore: true */
5
+ "node:async_hooks"
6
+ ).then((mod) => mod.AsyncLocalStorage).catch((err) => {
7
+ if ("AsyncLocalStorage" in globalThis) return globalThis.AsyncLocalStorage;
8
+ console.warn("[better-auth] Warning: AsyncLocalStorage is not available in this environment. Some features may not work as expected.");
9
+ console.warn("[better-auth] Please read more about this warning at https://better-auth.com/docs/installation#mount-handler");
10
+ console.warn("[better-auth] If you are using Cloudflare Workers, please see: https://developers.cloudflare.com/workers/configuration/compatibility-flags/#nodejs-compatibility-flag");
11
+ throw err;
12
+ });
13
+ async function getAsyncLocalStorage() {
14
+ return AsyncLocalStoragePromise;
15
+ }
16
+
17
+ //#endregion
18
+ export { getAsyncLocalStorage };
@@ -0,0 +1,30 @@
1
+ //#region rolldown:runtime
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
+ key = keys[i];
11
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
+ get: ((k) => from[k]).bind(null, key),
13
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
+ });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
19
+ value: mod,
20
+ enumerable: true
21
+ }) : target, mod));
22
+
23
+ //#endregion
24
+
25
+ Object.defineProperty(exports, '__toESM', {
26
+ enumerable: true,
27
+ get: function () {
28
+ return __toESM;
29
+ }
30
+ });
@@ -1,2 +0,0 @@
1
- 'use strict';
2
-
@@ -1,23 +1,7 @@
1
- type DBAdapterDebugLogOption = boolean | {
2
- /**
3
- * Useful when you want to log only certain conditions.
4
- */
5
- logCondition?: (() => boolean) | undefined;
6
- create?: boolean;
7
- update?: boolean;
8
- updateMany?: boolean;
9
- findOne?: boolean;
10
- findMany?: boolean;
11
- delete?: boolean;
12
- deleteMany?: boolean;
13
- count?: boolean;
14
- } | {
15
- /**
16
- * Only used for adapter tests to show debug logs if a test fails.
17
- *
18
- * @deprecated Not actually deprecated. Doing this for IDEs to show this option at the very bottom and stop end-users from using this.
19
- */
20
- isRunningAdapterTests: boolean;
21
- };
22
-
23
- export type { DBAdapterDebugLogOption };
1
+ import "../../helper-DVgWo5zB.cjs";
2
+ import "../../type-BNCR-kIK.cjs";
3
+ import "../../index-B7m2jDWm.cjs";
4
+ import "../../index-Cw9Gfaxd.cjs";
5
+ import "../../index-CESTxPyW.cjs";
6
+ import { CleanedWhere, CustomAdapter, DBAdapter, DBAdapterDebugLogOption, DBAdapterFactoryConfig, DBAdapterInstance, DBAdapterSchemaCreation, DBTransactionAdapter, Where } from "../../index-DNvIh1jX.cjs";
7
+ export { CleanedWhere, CustomAdapter, DBAdapter, DBAdapterDebugLogOption, DBAdapterFactoryConfig, DBAdapterInstance, DBAdapterSchemaCreation, DBTransactionAdapter, Where };
@@ -1,23 +1,7 @@
1
- type DBAdapterDebugLogOption = boolean | {
2
- /**
3
- * Useful when you want to log only certain conditions.
4
- */
5
- logCondition?: (() => boolean) | undefined;
6
- create?: boolean;
7
- update?: boolean;
8
- updateMany?: boolean;
9
- findOne?: boolean;
10
- findMany?: boolean;
11
- delete?: boolean;
12
- deleteMany?: boolean;
13
- count?: boolean;
14
- } | {
15
- /**
16
- * Only used for adapter tests to show debug logs if a test fails.
17
- *
18
- * @deprecated Not actually deprecated. Doing this for IDEs to show this option at the very bottom and stop end-users from using this.
19
- */
20
- isRunningAdapterTests: boolean;
21
- };
22
-
23
- export type { DBAdapterDebugLogOption };
1
+ import "../../helper-5oNxdxzu.js";
2
+ import "../../type-eT5TjHFp.js";
3
+ import "../../index-DoyF8K2U.js";
4
+ import "../../index-DJdmnKQr.js";
5
+ import "../../index-Cx8dCSTo.js";
6
+ import { CleanedWhere, CustomAdapter, DBAdapter, DBAdapterDebugLogOption, DBAdapterFactoryConfig, DBAdapterInstance, DBAdapterSchemaCreation, DBTransactionAdapter, Where } from "../../index-ujq2DkG7.js";
7
+ export { CleanedWhere, CustomAdapter, DBAdapter, DBAdapterDebugLogOption, DBAdapterFactoryConfig, DBAdapterInstance, DBAdapterSchemaCreation, DBTransactionAdapter, Where };
@@ -0,0 +1 @@
1
+ export { };
package/dist/db/index.cjs CHANGED
@@ -1,75 +1,68 @@
1
- 'use strict';
1
+ const require_chunk = require('../chunk-CUT6urMc.cjs');
2
+ let zod = require("zod");
3
+ zod = require_chunk.__toESM(zod);
2
4
 
3
- const z = require('zod');
4
-
5
- function _interopNamespaceCompat(e) {
6
- if (e && typeof e === 'object' && 'default' in e) return e;
7
- const n = Object.create(null);
8
- if (e) {
9
- for (const k in e) {
10
- n[k] = e[k];
11
- }
12
- }
13
- n.default = e;
14
- return n;
15
- }
16
-
17
- const z__namespace = /*#__PURE__*/_interopNamespaceCompat(z);
18
-
19
- const coreSchema = z__namespace.object({
20
- id: z__namespace.string(),
21
- createdAt: z__namespace.date().default(() => /* @__PURE__ */ new Date()),
22
- updatedAt: z__namespace.date().default(() => /* @__PURE__ */ new Date())
5
+ //#region src/db/schema/shared.ts
6
+ const coreSchema = zod.object({
7
+ id: zod.string(),
8
+ createdAt: zod.date().default(() => /* @__PURE__ */ new Date()),
9
+ updatedAt: zod.date().default(() => /* @__PURE__ */ new Date())
23
10
  });
24
11
 
12
+ //#endregion
13
+ //#region src/db/schema/user.ts
25
14
  const userSchema = coreSchema.extend({
26
- email: z__namespace.string().transform((val) => val.toLowerCase()),
27
- emailVerified: z__namespace.boolean().default(false),
28
- name: z__namespace.string(),
29
- image: z__namespace.string().nullish()
15
+ email: zod.string().transform((val) => val.toLowerCase()),
16
+ emailVerified: zod.boolean().default(false),
17
+ name: zod.string(),
18
+ image: zod.string().nullish()
30
19
  });
31
20
 
21
+ //#endregion
22
+ //#region src/db/schema/account.ts
32
23
  const accountSchema = coreSchema.extend({
33
- providerId: z__namespace.string(),
34
- accountId: z__namespace.string(),
35
- userId: z__namespace.coerce.string(),
36
- accessToken: z__namespace.string().nullish(),
37
- refreshToken: z__namespace.string().nullish(),
38
- idToken: z__namespace.string().nullish(),
39
- /**
40
- * Access token expires at
41
- */
42
- accessTokenExpiresAt: z__namespace.date().nullish(),
43
- /**
44
- * Refresh token expires at
45
- */
46
- refreshTokenExpiresAt: z__namespace.date().nullish(),
47
- /**
48
- * The scopes that the user has authorized
49
- */
50
- scope: z__namespace.string().nullish(),
51
- /**
52
- * Password is only stored in the credential provider
53
- */
54
- password: z__namespace.string().nullish()
24
+ providerId: zod.string(),
25
+ accountId: zod.string(),
26
+ userId: zod.coerce.string(),
27
+ accessToken: zod.string().nullish(),
28
+ refreshToken: zod.string().nullish(),
29
+ idToken: zod.string().nullish(),
30
+ accessTokenExpiresAt: zod.date().nullish(),
31
+ refreshTokenExpiresAt: zod.date().nullish(),
32
+ scope: zod.string().nullish(),
33
+ password: zod.string().nullish()
55
34
  });
56
35
 
36
+ //#endregion
37
+ //#region src/db/schema/session.ts
57
38
  const sessionSchema = coreSchema.extend({
58
- userId: z__namespace.coerce.string(),
59
- expiresAt: z__namespace.date(),
60
- token: z__namespace.string(),
61
- ipAddress: z__namespace.string().nullish(),
62
- userAgent: z__namespace.string().nullish()
39
+ userId: zod.coerce.string(),
40
+ expiresAt: zod.date(),
41
+ token: zod.string(),
42
+ ipAddress: zod.string().nullish(),
43
+ userAgent: zod.string().nullish()
63
44
  });
64
45
 
46
+ //#endregion
47
+ //#region src/db/schema/verification.ts
65
48
  const verificationSchema = coreSchema.extend({
66
- value: z__namespace.string(),
67
- expiresAt: z__namespace.date(),
68
- identifier: z__namespace.string()
49
+ value: zod.string(),
50
+ expiresAt: zod.date(),
51
+ identifier: zod.string()
52
+ });
53
+
54
+ //#endregion
55
+ //#region src/db/schema/rate-limit.ts
56
+ const rateLimitSchema = zod.object({
57
+ key: zod.string(),
58
+ count: zod.number(),
59
+ lastRequest: zod.number()
69
60
  });
70
61
 
62
+ //#endregion
71
63
  exports.accountSchema = accountSchema;
72
64
  exports.coreSchema = coreSchema;
65
+ exports.rateLimitSchema = rateLimitSchema;
73
66
  exports.sessionSchema = sessionSchema;
74
67
  exports.userSchema = userSchema;
75
- exports.verificationSchema = verificationSchema;
68
+ exports.verificationSchema = verificationSchema;
@@ -1,116 +1,3 @@
1
- import { D as DBFieldAttribute, b as DBFieldAttributeConfig, c as DBFieldType, d as DBPrimitive, B as BetterAuthDBSchema } from '../shared/core.CnvFgghY.cjs';
2
- import * as z from 'zod';
3
-
4
- type BetterAuthPluginDBSchema = {
5
- [table in string]: {
6
- fields: {
7
- [field in string]: DBFieldAttribute;
8
- };
9
- disableMigration?: boolean;
10
- modelName?: string;
11
- };
12
- };
13
-
14
- declare const coreSchema: z.ZodObject<{
15
- id: z.ZodString;
16
- createdAt: z.ZodDefault<z.ZodDate>;
17
- updatedAt: z.ZodDefault<z.ZodDate>;
18
- }, z.core.$strip>;
19
-
20
- declare const userSchema: z.ZodObject<{
21
- id: z.ZodString;
22
- createdAt: z.ZodDefault<z.ZodDate>;
23
- updatedAt: z.ZodDefault<z.ZodDate>;
24
- email: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
25
- emailVerified: z.ZodDefault<z.ZodBoolean>;
26
- name: z.ZodString;
27
- image: z.ZodOptional<z.ZodNullable<z.ZodString>>;
28
- }, z.core.$strip>;
29
- /**
30
- * User schema type used by better-auth, note that it's possible that user could have additional fields
31
- *
32
- * todo: we should use generics to extend this type with additional fields from plugins and options in the future
33
- */
34
- type User = z.infer<typeof userSchema>;
35
-
36
- declare const accountSchema: z.ZodObject<{
37
- id: z.ZodString;
38
- createdAt: z.ZodDefault<z.ZodDate>;
39
- updatedAt: z.ZodDefault<z.ZodDate>;
40
- providerId: z.ZodString;
41
- accountId: z.ZodString;
42
- userId: z.ZodCoercedString<unknown>;
43
- accessToken: z.ZodOptional<z.ZodNullable<z.ZodString>>;
44
- refreshToken: z.ZodOptional<z.ZodNullable<z.ZodString>>;
45
- idToken: z.ZodOptional<z.ZodNullable<z.ZodString>>;
46
- accessTokenExpiresAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
47
- refreshTokenExpiresAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
48
- scope: z.ZodOptional<z.ZodNullable<z.ZodString>>;
49
- password: z.ZodOptional<z.ZodNullable<z.ZodString>>;
50
- }, z.core.$strip>;
51
- /**
52
- * Account schema type used by better-auth, note that it's possible that account could have additional fields
53
- *
54
- * todo: we should use generics to extend this type with additional fields from plugins and options in the future
55
- */
56
- type Account = z.infer<typeof accountSchema>;
57
-
58
- declare const sessionSchema: z.ZodObject<{
59
- id: z.ZodString;
60
- createdAt: z.ZodDefault<z.ZodDate>;
61
- updatedAt: z.ZodDefault<z.ZodDate>;
62
- userId: z.ZodCoercedString<unknown>;
63
- expiresAt: z.ZodDate;
64
- token: z.ZodString;
65
- ipAddress: z.ZodOptional<z.ZodNullable<z.ZodString>>;
66
- userAgent: z.ZodOptional<z.ZodNullable<z.ZodString>>;
67
- }, z.core.$strip>;
68
- /**
69
- * Session schema type used by better-auth, note that it's possible that session could have additional fields
70
- *
71
- * todo: we should use generics to extend this type with additional fields from plugins and options in the future
72
- */
73
- type Session = z.infer<typeof sessionSchema>;
74
-
75
- declare const verificationSchema: z.ZodObject<{
76
- id: z.ZodString;
77
- createdAt: z.ZodDefault<z.ZodDate>;
78
- updatedAt: z.ZodDefault<z.ZodDate>;
79
- value: z.ZodString;
80
- expiresAt: z.ZodDate;
81
- identifier: z.ZodString;
82
- }, z.core.$strip>;
83
- /**
84
- * Verification schema type used by better-auth, note that it's possible that verification could have additional fields
85
- *
86
- * todo: we should use generics to extend this type with additional fields from plugins and options in the future
87
- */
88
- type Verification = z.infer<typeof verificationSchema>;
89
-
90
- /**
91
- * @deprecated Backport for 1.3.x, we will remove this in 1.4.x
92
- */
93
- type AuthPluginSchema = BetterAuthPluginDBSchema;
94
- /**
95
- * @deprecated Backport for 1.3.x, we will remove this in 1.4.x
96
- */
97
- type FieldAttribute = DBFieldAttribute;
98
- /**
99
- * @deprecated Backport for 1.3.x, we will remove this in 1.4.x
100
- */
101
- type FieldAttributeConfig = DBFieldAttributeConfig;
102
- /**
103
- * @deprecated Backport for 1.3.x, we will remove this in 1.4.x
104
- */
105
- type FieldType = DBFieldType;
106
- /**
107
- * @deprecated Backport for 1.3.x, we will remove this in 1.4.x
108
- */
109
- type Primitive = DBPrimitive;
110
- /**
111
- * @deprecated Backport for 1.3.x, we will remove this in 1.4.x
112
- */
113
- type BetterAuthDbSchema = BetterAuthDBSchema;
114
-
115
- export { BetterAuthDBSchema, DBFieldAttribute, DBFieldAttributeConfig, DBFieldType, DBPrimitive, accountSchema, coreSchema, sessionSchema, userSchema, verificationSchema };
116
- export type { Account, AuthPluginSchema, BetterAuthDbSchema, BetterAuthPluginDBSchema, FieldAttribute, FieldAttributeConfig, FieldType, Primitive, Session, User, Verification };
1
+ import "../helper-DVgWo5zB.cjs";
2
+ import { Account, AuthPluginSchema, BetterAuthDBSchema, BetterAuthDbSchema, BetterAuthPluginDBSchema, DBFieldAttribute, DBFieldAttributeConfig, DBFieldType, DBPreservedModels, DBPrimitive, FieldAttribute, FieldAttributeConfig, FieldType, Primitive, RateLimit, SecondaryStorage, Session, User, Verification, accountSchema, coreSchema, rateLimitSchema, sessionSchema, userSchema, verificationSchema } from "../type-BNCR-kIK.cjs";
3
+ export { Account, AuthPluginSchema, BetterAuthDBSchema, BetterAuthDbSchema, BetterAuthPluginDBSchema, DBFieldAttribute, DBFieldAttributeConfig, DBFieldType, DBPreservedModels, DBPrimitive, FieldAttribute, FieldAttributeConfig, FieldType, Primitive, RateLimit, SecondaryStorage, Session, User, Verification, accountSchema, coreSchema, rateLimitSchema, sessionSchema, userSchema, verificationSchema };