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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) hide show
  1. package/.turbo/turbo-build.log +72 -24
  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 -0
  8. package/dist/db/adapter/index.d.cts +7 -0
  9. package/dist/db/adapter/index.d.ts +7 -0
  10. package/dist/db/adapter/index.js +1 -0
  11. package/dist/db/index.cjs +67 -1
  12. package/dist/db/index.d.cts +3 -130
  13. package/dist/db/index.d.ts +3 -130
  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 -2
  39. package/dist/index.d.ts +7 -2
  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 +116 -10
  64. package/src/async_hooks/index.ts +1 -9
  65. package/src/db/adapter/index.ts +448 -0
  66. package/src/db/index.ts +15 -0
  67. package/src/db/plugin.ts +11 -0
  68. package/src/db/schema/account.ts +34 -0
  69. package/src/db/schema/rate-limit.ts +21 -0
  70. package/src/db/schema/session.ts +17 -0
  71. package/src/db/schema/shared.ts +7 -0
  72. package/src/db/schema/user.ts +16 -0
  73. package/src/db/schema/verification.ts +15 -0
  74. package/src/db/type.ts +41 -0
  75. package/src/env/color-depth.ts +171 -0
  76. package/src/env/env-impl.ts +123 -0
  77. package/src/env/index.ts +23 -0
  78. package/src/env/logger.test.ts +33 -0
  79. package/src/env/logger.ts +145 -0
  80. package/src/error/codes.ts +31 -0
  81. package/src/error/index.ts +11 -0
  82. package/src/index.ts +1 -1
  83. package/src/middleware/index.ts +33 -0
  84. package/src/oauth2/client-credentials-token.ts +102 -0
  85. package/src/oauth2/create-authorization-url.ts +85 -0
  86. package/src/oauth2/index.ts +22 -0
  87. package/src/oauth2/oauth-provider.ts +194 -0
  88. package/src/oauth2/refresh-access-token.ts +124 -0
  89. package/src/oauth2/utils.ts +36 -0
  90. package/src/oauth2/validate-authorization-code.ts +156 -0
  91. package/src/social-providers/apple.ts +213 -0
  92. package/src/social-providers/atlassian.ts +127 -0
  93. package/src/social-providers/cognito.ts +266 -0
  94. package/src/social-providers/discord.ts +169 -0
  95. package/src/social-providers/dropbox.ts +112 -0
  96. package/src/social-providers/facebook.ts +201 -0
  97. package/src/social-providers/figma.ts +112 -0
  98. package/src/social-providers/github.ts +154 -0
  99. package/src/social-providers/gitlab.ts +152 -0
  100. package/src/social-providers/google.ts +168 -0
  101. package/src/social-providers/huggingface.ts +116 -0
  102. package/src/social-providers/index.ts +118 -0
  103. package/src/social-providers/kakao.ts +178 -0
  104. package/src/social-providers/kick.ts +92 -0
  105. package/src/social-providers/line.ts +169 -0
  106. package/src/social-providers/linear.ts +120 -0
  107. package/src/social-providers/linkedin.ts +110 -0
  108. package/src/social-providers/microsoft-entra-id.ts +243 -0
  109. package/src/social-providers/naver.ts +112 -0
  110. package/src/social-providers/notion.ts +106 -0
  111. package/src/social-providers/paypal.ts +261 -0
  112. package/src/social-providers/reddit.ts +122 -0
  113. package/src/social-providers/roblox.ts +107 -0
  114. package/src/social-providers/salesforce.ts +154 -0
  115. package/src/social-providers/slack.ts +111 -0
  116. package/src/social-providers/spotify.ts +93 -0
  117. package/src/social-providers/tiktok.ts +208 -0
  118. package/src/social-providers/twitch.ts +111 -0
  119. package/src/social-providers/twitter.ts +194 -0
  120. package/src/social-providers/vk.ts +125 -0
  121. package/src/social-providers/zoom.ts +215 -0
  122. package/src/types/context.ts +270 -0
  123. package/src/types/cookie.ts +7 -0
  124. package/src/types/helper.ts +5 -0
  125. package/src/types/index.ts +20 -1
  126. package/src/types/init-options.ts +1156 -0
  127. package/src/types/plugin-client.ts +69 -0
  128. package/src/types/plugin.ts +134 -0
  129. package/src/utils/error-codes.ts +51 -0
  130. package/src/utils/index.ts +1 -0
  131. package/tsdown.config.ts +19 -0
  132. package/build.config.ts +0 -16
  133. package/dist/async_hooks/index.d.mts +0 -10
  134. package/dist/async_hooks/index.mjs +0 -25
  135. package/dist/db/index.d.mts +0 -130
  136. package/dist/db/index.mjs +0 -1
  137. package/dist/index.d.mts +0 -2
  138. package/dist/index.mjs +0 -1
@@ -1,26 +1,74 @@
1
1
 
2
- > @better-auth/core@1.3.26 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/index".
9
- Generated an empty chunk: "index".
10
- Generated an empty chunk: "db/index".
11
- Generated an empty chunk: "index".
12
- Generated an empty chunk: "index".
13
- Generated an empty chunk: "index".
14
- [success] Build succeeded for core
15
- [log] dist/index.cjs (total size: 15 B, chunk size: 15 B)
16
-
17
- [log] dist/async_hooks/index.cjs (total size: 922 B, chunk size: 922 B, exports: getAsyncLocalStorage)
18
-
19
- [log] dist/db/index.cjs (total size: 15 B, chunk size: 15 B)
20
- [log] dist/index.mjs (total size: 1 B, chunk size: 1 B)
21
-
22
- [log] dist/async_hooks/index.mjs (total size: 887 B, chunk size: 887 B, exports: getAsyncLocalStorage)
23
-
24
- [log] dist/db/index.mjs (total size: 1 B, chunk size: 1 B)
25
- Σ Total dist size (byte size): 13.8 kB
26
- [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
+ });
File without changes
@@ -0,0 +1,7 @@
1
+ import "../../helper-DVgWo5zB.cjs";
2
+ import "../../type-BNCR-kIK.cjs";
3
+ import "../../index-B7m2jDWm.cjs";
4
+ import "../../index-Cw9Gfaxd.cjs";
5
+ import "../../index-CESTxPyW.cjs";
6
+ import { CleanedWhere, CustomAdapter, DBAdapter, DBAdapterDebugLogOption, DBAdapterFactoryConfig, DBAdapterInstance, DBAdapterSchemaCreation, DBTransactionAdapter, Where } from "../../index-DNvIh1jX.cjs";
7
+ export { CleanedWhere, CustomAdapter, DBAdapter, DBAdapterDebugLogOption, DBAdapterFactoryConfig, DBAdapterInstance, DBAdapterSchemaCreation, DBTransactionAdapter, Where };
@@ -0,0 +1,7 @@
1
+ import "../../helper-5oNxdxzu.js";
2
+ import "../../type-eT5TjHFp.js";
3
+ import "../../index-DoyF8K2U.js";
4
+ import "../../index-DJdmnKQr.js";
5
+ import "../../index-Cx8dCSTo.js";
6
+ import { CleanedWhere, CustomAdapter, DBAdapter, DBAdapterDebugLogOption, DBAdapterFactoryConfig, DBAdapterInstance, DBAdapterSchemaCreation, DBTransactionAdapter, Where } from "../../index-ujq2DkG7.js";
7
+ export { CleanedWhere, CustomAdapter, DBAdapter, DBAdapterDebugLogOption, DBAdapterFactoryConfig, DBAdapterInstance, DBAdapterSchemaCreation, DBTransactionAdapter, Where };
@@ -0,0 +1 @@
1
+ export { };
package/dist/db/index.cjs CHANGED
@@ -1,2 +1,68 @@
1
- 'use strict';
1
+ const require_chunk = require('../chunk-CUT6urMc.cjs');
2
+ let zod = require("zod");
3
+ zod = require_chunk.__toESM(zod);
2
4
 
5
+ //#region src/db/schema/shared.ts
6
+ const coreSchema = zod.object({
7
+ id: zod.string(),
8
+ createdAt: zod.date().default(() => /* @__PURE__ */ new Date()),
9
+ updatedAt: zod.date().default(() => /* @__PURE__ */ new Date())
10
+ });
11
+
12
+ //#endregion
13
+ //#region src/db/schema/user.ts
14
+ const userSchema = coreSchema.extend({
15
+ email: zod.string().transform((val) => val.toLowerCase()),
16
+ emailVerified: zod.boolean().default(false),
17
+ name: zod.string(),
18
+ image: zod.string().nullish()
19
+ });
20
+
21
+ //#endregion
22
+ //#region src/db/schema/account.ts
23
+ const accountSchema = coreSchema.extend({
24
+ providerId: zod.string(),
25
+ accountId: zod.string(),
26
+ userId: zod.coerce.string(),
27
+ accessToken: zod.string().nullish(),
28
+ refreshToken: zod.string().nullish(),
29
+ idToken: zod.string().nullish(),
30
+ accessTokenExpiresAt: zod.date().nullish(),
31
+ refreshTokenExpiresAt: zod.date().nullish(),
32
+ scope: zod.string().nullish(),
33
+ password: zod.string().nullish()
34
+ });
35
+
36
+ //#endregion
37
+ //#region src/db/schema/session.ts
38
+ const sessionSchema = coreSchema.extend({
39
+ userId: zod.coerce.string(),
40
+ expiresAt: zod.date(),
41
+ token: zod.string(),
42
+ ipAddress: zod.string().nullish(),
43
+ userAgent: zod.string().nullish()
44
+ });
45
+
46
+ //#endregion
47
+ //#region src/db/schema/verification.ts
48
+ const verificationSchema = coreSchema.extend({
49
+ value: zod.string(),
50
+ expiresAt: zod.date(),
51
+ identifier: zod.string()
52
+ });
53
+
54
+ //#endregion
55
+ //#region src/db/schema/rate-limit.ts
56
+ const rateLimitSchema = zod.object({
57
+ key: zod.string(),
58
+ count: zod.number(),
59
+ lastRequest: zod.number()
60
+ });
61
+
62
+ //#endregion
63
+ exports.accountSchema = accountSchema;
64
+ exports.coreSchema = coreSchema;
65
+ exports.rateLimitSchema = rateLimitSchema;
66
+ exports.sessionSchema = sessionSchema;
67
+ exports.userSchema = userSchema;
68
+ exports.verificationSchema = verificationSchema;
@@ -1,130 +1,3 @@
1
- import { ZodType } from 'zod';
2
-
3
- type LiteralString = "" | (string & Record<never, never>);
4
-
5
- type DBFieldType = "string" | "number" | "boolean" | "date" | "json" | `${"string" | "number"}[]` | Array<LiteralString>;
6
- type DBPrimitive = string | number | boolean | Date | null | undefined | string[] | number[];
7
- type DBFieldAttributeConfig = {
8
- /**
9
- * If the field should be required on a new record.
10
- * @default true
11
- */
12
- required?: boolean;
13
- /**
14
- * If the value should be returned on a response body.
15
- * @default true
16
- */
17
- returned?: boolean;
18
- /**
19
- * If a value should be provided when creating a new record.
20
- * @default true
21
- */
22
- input?: boolean;
23
- /**
24
- * Default value for the field
25
- *
26
- * Note: This will not create a default value on the database level. It will only
27
- * be used when creating a new record.
28
- */
29
- defaultValue?: DBPrimitive | (() => DBPrimitive);
30
- /**
31
- * Update value for the field
32
- *
33
- * Note: This will create an onUpdate trigger on the database level for supported adapters.
34
- * It will be called when updating a record.
35
- */
36
- onUpdate?: () => DBPrimitive;
37
- /**
38
- * transform the value before storing it.
39
- */
40
- transform?: {
41
- input?: (value: DBPrimitive) => DBPrimitive | Promise<DBPrimitive>;
42
- output?: (value: DBPrimitive) => DBPrimitive | Promise<DBPrimitive>;
43
- };
44
- /**
45
- * Reference to another model.
46
- */
47
- references?: {
48
- /**
49
- * The model to reference.
50
- */
51
- model: string;
52
- /**
53
- * The field on the referenced model.
54
- */
55
- field: string;
56
- /**
57
- * The action to perform when the reference is deleted.
58
- * @default "cascade"
59
- */
60
- onDelete?: "no action" | "restrict" | "cascade" | "set null" | "set default";
61
- };
62
- unique?: boolean;
63
- /**
64
- * If the field should be a bigint on the database instead of integer.
65
- */
66
- bigint?: boolean;
67
- /**
68
- * A zod schema to validate the value.
69
- */
70
- validator?: {
71
- input?: ZodType;
72
- output?: ZodType;
73
- };
74
- /**
75
- * The name of the field on the database.
76
- */
77
- fieldName?: string;
78
- /**
79
- * If the field should be sortable.
80
- *
81
- * applicable only for `text` type.
82
- * It's useful to mark fields varchar instead of text.
83
- */
84
- sortable?: boolean;
85
- };
86
- type DBFieldAttribute<T extends DBFieldType = DBFieldType> = {
87
- type: T;
88
- } & DBFieldAttributeConfig;
89
- type BetterAuthDBSchema = Record<string, {
90
- /**
91
- * The name of the table in the database
92
- */
93
- modelName: string;
94
- /**
95
- * The fields of the table
96
- */
97
- fields: Record<string, DBFieldAttribute>;
98
- /**
99
- * Whether to disable migrations for this table
100
- * @default false
101
- */
102
- disableMigrations?: boolean;
103
- /**
104
- * The order of the table
105
- */
106
- order?: number;
107
- }>;
108
-
109
- /**
110
- * @deprecated Backport for 1.3.x, we will remove this in 1.4.x
111
- */
112
- type FieldAttribute = DBFieldAttribute;
113
- /**
114
- * @deprecated Backport for 1.3.x, we will remove this in 1.4.x
115
- */
116
- type FieldAttributeConfig = DBFieldAttributeConfig;
117
- /**
118
- * @deprecated Backport for 1.3.x, we will remove this in 1.4.x
119
- */
120
- type FieldType = DBFieldType;
121
- /**
122
- * @deprecated Backport for 1.3.x, we will remove this in 1.4.x
123
- */
124
- type Primitive = DBPrimitive;
125
- /**
126
- * @deprecated Backport for 1.3.x, we will remove this in 1.4.x
127
- */
128
- type BetterAuthDbSchema = BetterAuthDBSchema;
129
-
130
- export type { BetterAuthDBSchema, BetterAuthDbSchema, DBFieldAttribute, DBFieldAttributeConfig, DBFieldType, DBPrimitive, FieldAttribute, FieldAttributeConfig, FieldType, Primitive };
1
+ import "../helper-DVgWo5zB.cjs";
2
+ import { Account, AuthPluginSchema, BetterAuthDBSchema, BetterAuthDbSchema, BetterAuthPluginDBSchema, DBFieldAttribute, DBFieldAttributeConfig, DBFieldType, DBPreservedModels, DBPrimitive, FieldAttribute, FieldAttributeConfig, FieldType, Primitive, RateLimit, SecondaryStorage, Session, User, Verification, accountSchema, coreSchema, rateLimitSchema, sessionSchema, userSchema, verificationSchema } from "../type-BNCR-kIK.cjs";
3
+ export { Account, AuthPluginSchema, BetterAuthDBSchema, BetterAuthDbSchema, BetterAuthPluginDBSchema, DBFieldAttribute, DBFieldAttributeConfig, DBFieldType, DBPreservedModels, DBPrimitive, FieldAttribute, FieldAttributeConfig, FieldType, Primitive, RateLimit, SecondaryStorage, Session, User, Verification, accountSchema, coreSchema, rateLimitSchema, sessionSchema, userSchema, verificationSchema };
@@ -1,130 +1,3 @@
1
- import { ZodType } from 'zod';
2
-
3
- type LiteralString = "" | (string & Record<never, never>);
4
-
5
- type DBFieldType = "string" | "number" | "boolean" | "date" | "json" | `${"string" | "number"}[]` | Array<LiteralString>;
6
- type DBPrimitive = string | number | boolean | Date | null | undefined | string[] | number[];
7
- type DBFieldAttributeConfig = {
8
- /**
9
- * If the field should be required on a new record.
10
- * @default true
11
- */
12
- required?: boolean;
13
- /**
14
- * If the value should be returned on a response body.
15
- * @default true
16
- */
17
- returned?: boolean;
18
- /**
19
- * If a value should be provided when creating a new record.
20
- * @default true
21
- */
22
- input?: boolean;
23
- /**
24
- * Default value for the field
25
- *
26
- * Note: This will not create a default value on the database level. It will only
27
- * be used when creating a new record.
28
- */
29
- defaultValue?: DBPrimitive | (() => DBPrimitive);
30
- /**
31
- * Update value for the field
32
- *
33
- * Note: This will create an onUpdate trigger on the database level for supported adapters.
34
- * It will be called when updating a record.
35
- */
36
- onUpdate?: () => DBPrimitive;
37
- /**
38
- * transform the value before storing it.
39
- */
40
- transform?: {
41
- input?: (value: DBPrimitive) => DBPrimitive | Promise<DBPrimitive>;
42
- output?: (value: DBPrimitive) => DBPrimitive | Promise<DBPrimitive>;
43
- };
44
- /**
45
- * Reference to another model.
46
- */
47
- references?: {
48
- /**
49
- * The model to reference.
50
- */
51
- model: string;
52
- /**
53
- * The field on the referenced model.
54
- */
55
- field: string;
56
- /**
57
- * The action to perform when the reference is deleted.
58
- * @default "cascade"
59
- */
60
- onDelete?: "no action" | "restrict" | "cascade" | "set null" | "set default";
61
- };
62
- unique?: boolean;
63
- /**
64
- * If the field should be a bigint on the database instead of integer.
65
- */
66
- bigint?: boolean;
67
- /**
68
- * A zod schema to validate the value.
69
- */
70
- validator?: {
71
- input?: ZodType;
72
- output?: ZodType;
73
- };
74
- /**
75
- * The name of the field on the database.
76
- */
77
- fieldName?: string;
78
- /**
79
- * If the field should be sortable.
80
- *
81
- * applicable only for `text` type.
82
- * It's useful to mark fields varchar instead of text.
83
- */
84
- sortable?: boolean;
85
- };
86
- type DBFieldAttribute<T extends DBFieldType = DBFieldType> = {
87
- type: T;
88
- } & DBFieldAttributeConfig;
89
- type BetterAuthDBSchema = Record<string, {
90
- /**
91
- * The name of the table in the database
92
- */
93
- modelName: string;
94
- /**
95
- * The fields of the table
96
- */
97
- fields: Record<string, DBFieldAttribute>;
98
- /**
99
- * Whether to disable migrations for this table
100
- * @default false
101
- */
102
- disableMigrations?: boolean;
103
- /**
104
- * The order of the table
105
- */
106
- order?: number;
107
- }>;
108
-
109
- /**
110
- * @deprecated Backport for 1.3.x, we will remove this in 1.4.x
111
- */
112
- type FieldAttribute = DBFieldAttribute;
113
- /**
114
- * @deprecated Backport for 1.3.x, we will remove this in 1.4.x
115
- */
116
- type FieldAttributeConfig = DBFieldAttributeConfig;
117
- /**
118
- * @deprecated Backport for 1.3.x, we will remove this in 1.4.x
119
- */
120
- type FieldType = DBFieldType;
121
- /**
122
- * @deprecated Backport for 1.3.x, we will remove this in 1.4.x
123
- */
124
- type Primitive = DBPrimitive;
125
- /**
126
- * @deprecated Backport for 1.3.x, we will remove this in 1.4.x
127
- */
128
- type BetterAuthDbSchema = BetterAuthDBSchema;
129
-
130
- export type { BetterAuthDBSchema, BetterAuthDbSchema, DBFieldAttribute, DBFieldAttributeConfig, DBFieldType, DBPrimitive, FieldAttribute, FieldAttributeConfig, FieldType, Primitive };
1
+ import "../helper-5oNxdxzu.js";
2
+ import { Account, AuthPluginSchema, BetterAuthDBSchema, BetterAuthDbSchema, BetterAuthPluginDBSchema, DBFieldAttribute, DBFieldAttributeConfig, DBFieldType, DBPreservedModels, DBPrimitive, FieldAttribute, FieldAttributeConfig, FieldType, Primitive, RateLimit, SecondaryStorage, Session, User, Verification, accountSchema, coreSchema, rateLimitSchema, sessionSchema, userSchema, verificationSchema } from "../type-eT5TjHFp.js";
3
+ export { Account, AuthPluginSchema, BetterAuthDBSchema, BetterAuthDbSchema, BetterAuthPluginDBSchema, DBFieldAttribute, DBFieldAttributeConfig, DBFieldType, DBPreservedModels, DBPrimitive, FieldAttribute, FieldAttributeConfig, FieldType, Primitive, RateLimit, SecondaryStorage, Session, User, Verification, accountSchema, coreSchema, rateLimitSchema, sessionSchema, userSchema, verificationSchema };
@@ -0,0 +1,61 @@
1
+ import * as z from "zod";
2
+
3
+ //#region src/db/schema/shared.ts
4
+ const coreSchema = z.object({
5
+ id: z.string(),
6
+ createdAt: z.date().default(() => /* @__PURE__ */ new Date()),
7
+ updatedAt: z.date().default(() => /* @__PURE__ */ new Date())
8
+ });
9
+
10
+ //#endregion
11
+ //#region src/db/schema/user.ts
12
+ const userSchema = coreSchema.extend({
13
+ email: z.string().transform((val) => val.toLowerCase()),
14
+ emailVerified: z.boolean().default(false),
15
+ name: z.string(),
16
+ image: z.string().nullish()
17
+ });
18
+
19
+ //#endregion
20
+ //#region src/db/schema/account.ts
21
+ const accountSchema = coreSchema.extend({
22
+ providerId: z.string(),
23
+ accountId: z.string(),
24
+ userId: z.coerce.string(),
25
+ accessToken: z.string().nullish(),
26
+ refreshToken: z.string().nullish(),
27
+ idToken: z.string().nullish(),
28
+ accessTokenExpiresAt: z.date().nullish(),
29
+ refreshTokenExpiresAt: z.date().nullish(),
30
+ scope: z.string().nullish(),
31
+ password: z.string().nullish()
32
+ });
33
+
34
+ //#endregion
35
+ //#region src/db/schema/session.ts
36
+ const sessionSchema = coreSchema.extend({
37
+ userId: z.coerce.string(),
38
+ expiresAt: z.date(),
39
+ token: z.string(),
40
+ ipAddress: z.string().nullish(),
41
+ userAgent: z.string().nullish()
42
+ });
43
+
44
+ //#endregion
45
+ //#region src/db/schema/verification.ts
46
+ const verificationSchema = coreSchema.extend({
47
+ value: z.string(),
48
+ expiresAt: z.date(),
49
+ identifier: z.string()
50
+ });
51
+
52
+ //#endregion
53
+ //#region src/db/schema/rate-limit.ts
54
+ const rateLimitSchema = z.object({
55
+ key: z.string(),
56
+ count: z.number(),
57
+ lastRequest: z.number()
58
+ });
59
+
60
+ //#endregion
61
+ export { accountSchema, coreSchema, rateLimitSchema, sessionSchema, userSchema, verificationSchema };