@better-auth/core 1.3.26 → 1.3.28

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 (130) hide show
  1. package/.turbo/turbo-build.log +60 -9
  2. package/build.config.ts +7 -0
  3. package/dist/db/adapter/index.cjs +2 -0
  4. package/dist/db/adapter/index.d.cts +14 -0
  5. package/dist/db/adapter/index.d.mts +14 -0
  6. package/dist/db/adapter/index.d.ts +14 -0
  7. package/dist/db/adapter/index.mjs +1 -0
  8. package/dist/db/index.cjs +89 -0
  9. package/dist/db/index.d.cts +16 -107
  10. package/dist/db/index.d.mts +16 -107
  11. package/dist/db/index.d.ts +16 -107
  12. package/dist/db/index.mjs +69 -0
  13. package/dist/env/index.cjs +312 -0
  14. package/dist/env/index.d.cts +36 -0
  15. package/dist/env/index.d.mts +36 -0
  16. package/dist/env/index.d.ts +36 -0
  17. package/dist/env/index.mjs +297 -0
  18. package/dist/error/index.cjs +44 -0
  19. package/dist/error/index.d.cts +33 -0
  20. package/dist/error/index.d.mts +33 -0
  21. package/dist/error/index.d.ts +33 -0
  22. package/dist/error/index.mjs +41 -0
  23. package/dist/index.d.cts +179 -1
  24. package/dist/index.d.mts +179 -1
  25. package/dist/index.d.ts +179 -1
  26. package/dist/middleware/index.cjs +25 -0
  27. package/dist/middleware/index.d.cts +14 -0
  28. package/dist/middleware/index.d.mts +14 -0
  29. package/dist/middleware/index.d.ts +14 -0
  30. package/dist/middleware/index.mjs +21 -0
  31. package/dist/oauth2/index.cjs +368 -0
  32. package/dist/oauth2/index.d.cts +100 -0
  33. package/dist/oauth2/index.d.mts +100 -0
  34. package/dist/oauth2/index.d.ts +100 -0
  35. package/dist/oauth2/index.mjs +357 -0
  36. package/dist/shared/core.BJPBStdk.d.ts +1693 -0
  37. package/dist/shared/core.Bl6TpxyD.d.mts +181 -0
  38. package/dist/shared/core.Bqe5IGAi.d.ts +13 -0
  39. package/dist/shared/core.BwoNUcJQ.d.cts +53 -0
  40. package/dist/shared/core.BwoNUcJQ.d.mts +53 -0
  41. package/dist/shared/core.BwoNUcJQ.d.ts +53 -0
  42. package/dist/shared/core.CajxAutx.d.cts +143 -0
  43. package/dist/shared/core.CajxAutx.d.mts +143 -0
  44. package/dist/shared/core.CajxAutx.d.ts +143 -0
  45. package/dist/shared/core.CkkLHQWc.d.mts +1693 -0
  46. package/dist/shared/core.DkdZ1o38.d.ts +181 -0
  47. package/dist/shared/core.Dl-70uns.d.cts +84 -0
  48. package/dist/shared/core.Dl-70uns.d.mts +84 -0
  49. package/dist/shared/core.Dl-70uns.d.ts +84 -0
  50. package/dist/shared/core.DyEdx0m7.d.cts +181 -0
  51. package/dist/shared/core.E9DfzGLz.d.mts +13 -0
  52. package/dist/shared/core.HqYn20Fi.d.cts +13 -0
  53. package/dist/shared/core.gYIBmdi1.d.cts +1693 -0
  54. package/dist/social-providers/index.cjs +2793 -0
  55. package/dist/social-providers/index.d.cts +3903 -0
  56. package/dist/social-providers/index.d.mts +3903 -0
  57. package/dist/social-providers/index.d.ts +3903 -0
  58. package/dist/social-providers/index.mjs +2743 -0
  59. package/dist/utils/index.cjs +7 -0
  60. package/dist/utils/index.d.cts +10 -0
  61. package/dist/utils/index.d.mts +10 -0
  62. package/dist/utils/index.d.ts +10 -0
  63. package/dist/utils/index.mjs +5 -0
  64. package/package.json +109 -2
  65. package/src/db/adapter/index.ts +448 -0
  66. package/src/db/index.ts +13 -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 +50 -0
  75. package/src/env/color-depth.ts +172 -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 +130 -0
  93. package/src/social-providers/cognito.ts +269 -0
  94. package/src/social-providers/discord.ts +172 -0
  95. package/src/social-providers/dropbox.ts +112 -0
  96. package/src/social-providers/facebook.ts +204 -0
  97. package/src/social-providers/figma.ts +115 -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 +171 -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 +95 -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 +110 -0
  114. package/src/social-providers/salesforce.ts +157 -0
  115. package/src/social-providers/slack.ts +114 -0
  116. package/src/social-providers/spotify.ts +93 -0
  117. package/src/social-providers/tiktok.ts +211 -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 +128 -0
  121. package/src/social-providers/zoom.ts +218 -0
  122. package/src/types/context.ts +313 -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 +1161 -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
@@ -1,26 +1,77 @@
1
1
 
2
- > @better-auth/core@1.3.26 build /home/runner/work/better-auth/better-auth/packages/core
2
+ > @better-auth/core@1.3.28 build /home/runner/work/better-auth/better-auth/packages/core
3
3
  > unbuild --clean
4
4
 
5
5
  [info] Building core
6
6
  [info] Cleaning dist directory: `./dist`
7
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".
8
+ Generated an empty chunk: "db/adapter/index".
13
9
  Generated an empty chunk: "index".
10
+ Generated an empty chunk: "db/adapter/index".
11
+ "bun:sqlite" is imported by "src/types/init-options.ts", but could not be resolved – treating it as an external dependency.
12
+ "node:sqlite" is imported by "src/types/init-options.ts", but could not be resolved – treating it as an external dependency.
13
+ Export "ProviderOptions" of module "src/oauth2/oauth-provider.ts" was reexported through module "src/oauth2/index.ts" while both modules are dependencies of each other and will end up in different chunks by current Rollup settings. This scenario is not well supported at the moment as it will produce a circular dependency between chunks and will likely lead to broken execution order.
14
+ Either change the import in "src/oauth2/create-authorization-url.ts" to point directly to the exporting module or reconfigure "output.manualChunks" to ensure these modules end up in the same chunk.
15
+ Export "ProviderOptions" of module "src/oauth2/oauth-provider.ts" was reexported through module "src/oauth2/index.ts" while both modules are dependencies of each other and will end up in different chunks by current Rollup settings. This scenario is not well supported at the moment as it will produce a circular dependency between chunks and will likely lead to broken execution order.
16
+ Either change the import in "src/oauth2/validate-authorization-code.ts" to point directly to the exporting module or reconfigure "output.manualChunks" to ensure these modules end up in the same chunk.
17
+ Export "OAuthProvider" of module "src/oauth2/oauth-provider.ts" was reexported through module "src/oauth2/index.ts" while both modules are dependencies of each other and will end up in different chunks by current Rollup settings. This scenario is not well supported at the moment as it will produce a circular dependency between chunks and will likely lead to broken execution order.
18
+ Either change the import in "src/types/context.ts" to point directly to the exporting module or reconfigure "output.manualChunks" to ensure these modules end up in the same chunk.
19
+ Export "ProviderOptions" of module "src/oauth2/oauth-provider.ts" was reexported through module "src/oauth2/index.ts" while both modules are dependencies of each other and will end up in different chunks by current Rollup settings. This scenario is not well supported at the moment as it will produce a circular dependency between chunks and will likely lead to broken execution order.
20
+ Either change the import in "src/oauth2/create-authorization-url.ts" to point directly to the exporting module or reconfigure "output.manualChunks" to ensure these modules end up in the same chunk.
21
+ Export "ProviderOptions" of module "src/oauth2/oauth-provider.ts" was reexported through module "src/oauth2/index.ts" while both modules are dependencies of each other and will end up in different chunks by current Rollup settings. This scenario is not well supported at the moment as it will produce a circular dependency between chunks and will likely lead to broken execution order.
22
+ Either change the import in "src/oauth2/validate-authorization-code.ts" to point directly to the exporting module or reconfigure "output.manualChunks" to ensure these modules end up in the same chunk.
23
+ Export "OAuthProvider" of module "src/oauth2/oauth-provider.ts" was reexported through module "src/oauth2/index.ts" while both modules are dependencies of each other and will end up in different chunks by current Rollup settings. This scenario is not well supported at the moment as it will produce a circular dependency between chunks and will likely lead to broken execution order.
24
+ Either change the import in "src/types/context.ts" to point directly to the exporting module or reconfigure "output.manualChunks" to ensure these modules end up in the same chunk.
25
+ Export "ProviderOptions" of module "src/oauth2/oauth-provider.ts" was reexported through module "src/oauth2/index.ts" while both modules are dependencies of each other and will end up in different chunks by current Rollup settings. This scenario is not well supported at the moment as it will produce a circular dependency between chunks and will likely lead to broken execution order.
26
+ Either change the import in "src/oauth2/create-authorization-url.ts" to point directly to the exporting module or reconfigure "output.manualChunks" to ensure these modules end up in the same chunk.
27
+ Export "ProviderOptions" of module "src/oauth2/oauth-provider.ts" was reexported through module "src/oauth2/index.ts" while both modules are dependencies of each other and will end up in different chunks by current Rollup settings. This scenario is not well supported at the moment as it will produce a circular dependency between chunks and will likely lead to broken execution order.
28
+ Either change the import in "src/oauth2/validate-authorization-code.ts" to point directly to the exporting module or reconfigure "output.manualChunks" to ensure these modules end up in the same chunk.
29
+ Export "OAuthProvider" of module "src/oauth2/oauth-provider.ts" was reexported through module "src/oauth2/index.ts" while both modules are dependencies of each other and will end up in different chunks by current Rollup settings. This scenario is not well supported at the moment as it will produce a circular dependency between chunks and will likely lead to broken execution order.
30
+ Either change the import in "src/types/context.ts" to point directly to the exporting module or reconfigure "output.manualChunks" to ensure these modules end up in the same chunk.
14
31
  [success] Build succeeded for core
15
32
  [log] dist/index.cjs (total size: 15 B, chunk size: 15 B)
16
33
 
17
34
  [log] dist/async_hooks/index.cjs (total size: 922 B, chunk size: 922 B, exports: getAsyncLocalStorage)
18
35
 
19
- [log] dist/db/index.cjs (total size: 15 B, chunk size: 15 B)
36
+ [log] dist/middleware/index.cjs (total size: 610 B, chunk size: 610 B, exports: createAuthEndpoint, createAuthMiddleware, optionsMiddleware)
37
+
38
+ [log] dist/utils/index.cjs (total size: 114 B, chunk size: 114 B, exports: defineErrorCodes)
39
+
40
+ [log] dist/error/index.cjs (total size: 1.75 kB, chunk size: 1.75 kB, exports: BASE_ERROR_CODES, BetterAuthError)
41
+
42
+ [log] dist/env/index.cjs (total size: 8.61 kB, chunk size: 8.61 kB, exports: ENV, TTY_COLORS, createLogger, env, getBooleanEnvVar, getColorDepth, getEnvVar, isDevelopment, isProduction, isTest, levels, logger, nodeENV, shouldPublishLog)
43
+
44
+ [log] dist/oauth2/index.cjs (total size: 10.3 kB, chunk size: 10.3 kB, exports: clientCredentialsToken, createAuthorizationCodeRequest, createAuthorizationURL, createClientCredentialsTokenRequest, createRefreshAccessTokenRequest, generateCodeChallenge, getOAuth2Tokens, refreshAccessToken, validateAuthorizationCode, validateToken)
45
+
46
+ [log] dist/db/index.cjs (total size: 2.43 kB, chunk size: 2.43 kB, exports: accountSchema, coreSchema, rateLimitSchema, sessionSchema, userSchema, verificationSchema)
47
+
48
+ [log] dist/social-providers/index.cjs (total size: 87.9 kB, chunk size: 86.1 kB, exports: SocialProviderListEnum, apple, atlassian, cognito, discord, dropbox, facebook, figma, getApplePublicKey, getCognitoPublicKey, github, gitlab, google, huggingface, kakao, kick, line, linear, linkedin, microsoft, naver, notion, paypal, reddit, roblox, salesforce, slack, socialProviderList, socialProviders, spotify, tiktok, twitch, twitter, vk, zoom)
49
+ └─ dist/error/index.cjs (1.75 kB)
50
+
51
+ [log] dist/db/adapter/index.cjs (total size: 15 B, chunk size: 15 B)
20
52
  [log] dist/index.mjs (total size: 1 B, chunk size: 1 B)
21
53
 
22
54
  [log] dist/async_hooks/index.mjs (total size: 887 B, chunk size: 887 B, exports: getAsyncLocalStorage)
23
55
 
24
- [log] dist/db/index.mjs (total size: 1 B, chunk size: 1 B)
25
- Σ Total dist size (byte size): 13.8 kB
56
+ [log] dist/middleware/index.mjs (total size: 495 B, chunk size: 495 B, exports: createAuthEndpoint, createAuthMiddleware, optionsMiddleware)
57
+
58
+ [log] dist/utils/index.mjs (total size: 83 B, chunk size: 83 B, exports: defineErrorCodes)
59
+
60
+ [log] dist/error/index.mjs (total size: 1.7 kB, chunk size: 1.7 kB, exports: BASE_ERROR_CODES, BetterAuthError)
61
+
62
+ [log] dist/env/index.mjs (total size: 8.32 kB, chunk size: 8.32 kB, exports: ENV, TTY_COLORS, createLogger, env, getBooleanEnvVar, getColorDepth, getEnvVar, isDevelopment, isProduction, isTest, levels, logger, nodeENV, shouldPublishLog)
63
+
64
+ [log] dist/oauth2/index.mjs (total size: 9.88 kB, chunk size: 9.88 kB, exports: clientCredentialsToken, createAuthorizationCodeRequest, createAuthorizationURL, createClientCredentialsTokenRequest, createRefreshAccessTokenRequest, generateCodeChallenge, getOAuth2Tokens, refreshAccessToken, validateAuthorizationCode, validateToken)
65
+
66
+ [log] dist/db/index.mjs (total size: 1.67 kB, chunk size: 1.67 kB, exports: accountSchema, coreSchema, rateLimitSchema, sessionSchema, userSchema, verificationSchema)
67
+
68
+ [log] dist/social-providers/index.mjs (total size: 85.8 kB, chunk size: 84.1 kB, exports: SocialProviderListEnum, apple, atlassian, cognito, discord, dropbox, facebook, figma, getApplePublicKey, getCognitoPublicKey, github, gitlab, google, huggingface, kakao, kick, line, linear, linkedin, microsoft, naver, notion, paypal, reddit, roblox, salesforce, slack, socialProviderList, socialProviders, spotify, tiktok, twitch, twitter, vk, zoom)
69
+ └─ dist/error/index.mjs (1.7 kB)
70
+
71
+ [log] dist/db/adapter/index.mjs (total size: 1 B, chunk size: 1 B)
72
+ Σ Total dist size (byte size): 863 kB
26
73
  [log]
74
+ [warn] Build is done with some warnings:
75
+
76
+ - Implicitly bundling "bun:sqlite"
77
+ - Implicitly bundling "node:sqlite"
package/build.config.ts CHANGED
@@ -11,6 +11,13 @@ export default defineBuildConfig({
11
11
  entries: [
12
12
  "./src/index.ts",
13
13
  "./src/db/index.ts",
14
+ "./src/db/adapter/index.ts",
14
15
  "./src/async_hooks/index.ts",
16
+ "./src/env/index.ts",
17
+ "./src/oauth2/index.ts",
18
+ "./src/middleware/index.ts",
19
+ "./src/social-providers/index.ts",
20
+ "./src/utils/index.ts",
21
+ "./src/error/index.ts",
15
22
  ],
16
23
  });
@@ -0,0 +1,2 @@
1
+ 'use strict';
2
+
@@ -0,0 +1,14 @@
1
+ import '../../shared/core.CajxAutx.cjs';
2
+ export { C as CleanedWhere, j as CustomAdapter, i as DBAdapter, D as DBAdapterDebugLogOption, g as DBAdapterFactoryConfig, k as DBAdapterInstance, f as DBAdapterSchemaCreation, h as DBTransactionAdapter, W as Where } from '../../shared/core.gYIBmdi1.cjs';
3
+ import 'zod';
4
+ import 'kysely';
5
+ import 'better-sqlite3';
6
+ import 'better-call';
7
+ import '../../shared/core.Dl-70uns.cjs';
8
+ import 'bun:sqlite';
9
+ import 'node:sqlite';
10
+ import '../../social-providers/index.cjs';
11
+ import '@better-auth/core/oauth2';
12
+ import '../../shared/core.DyEdx0m7.cjs';
13
+ import '../../shared/core.BwoNUcJQ.cjs';
14
+ import '@better-auth/core';
@@ -0,0 +1,14 @@
1
+ import '../../shared/core.CajxAutx.mjs';
2
+ export { C as CleanedWhere, j as CustomAdapter, i as DBAdapter, D as DBAdapterDebugLogOption, g as DBAdapterFactoryConfig, k as DBAdapterInstance, f as DBAdapterSchemaCreation, h as DBTransactionAdapter, W as Where } from '../../shared/core.CkkLHQWc.mjs';
3
+ import 'zod';
4
+ import 'kysely';
5
+ import 'better-sqlite3';
6
+ import 'better-call';
7
+ import '../../shared/core.Dl-70uns.mjs';
8
+ import 'bun:sqlite';
9
+ import 'node:sqlite';
10
+ import '../../social-providers/index.mjs';
11
+ import '@better-auth/core/oauth2';
12
+ import '../../shared/core.Bl6TpxyD.mjs';
13
+ import '../../shared/core.BwoNUcJQ.mjs';
14
+ import '@better-auth/core';
@@ -0,0 +1,14 @@
1
+ import '../../shared/core.CajxAutx.js';
2
+ export { C as CleanedWhere, j as CustomAdapter, i as DBAdapter, D as DBAdapterDebugLogOption, g as DBAdapterFactoryConfig, k as DBAdapterInstance, f as DBAdapterSchemaCreation, h as DBTransactionAdapter, W as Where } from '../../shared/core.BJPBStdk.js';
3
+ import 'zod';
4
+ import 'kysely';
5
+ import 'better-sqlite3';
6
+ import 'better-call';
7
+ import '../../shared/core.Dl-70uns.js';
8
+ import 'bun:sqlite';
9
+ import 'node:sqlite';
10
+ import '../../social-providers/index.js';
11
+ import '@better-auth/core/oauth2';
12
+ import '../../shared/core.DkdZ1o38.js';
13
+ import '../../shared/core.BwoNUcJQ.js';
14
+ import '@better-auth/core';
@@ -0,0 +1 @@
1
+
package/dist/db/index.cjs CHANGED
@@ -1,2 +1,91 @@
1
1
  'use strict';
2
2
 
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())
23
+ });
24
+
25
+ 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()
30
+ });
31
+
32
+ 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()
55
+ });
56
+
57
+ 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()
63
+ });
64
+
65
+ const verificationSchema = coreSchema.extend({
66
+ value: z__namespace.string(),
67
+ expiresAt: z__namespace.date(),
68
+ identifier: z__namespace.string()
69
+ });
70
+
71
+ const rateLimitSchema = z__namespace.object({
72
+ /**
73
+ * The key to use for rate limiting
74
+ */
75
+ key: z__namespace.string(),
76
+ /**
77
+ * The number of requests made
78
+ */
79
+ count: z__namespace.number(),
80
+ /**
81
+ * The last request time in milliseconds
82
+ */
83
+ lastRequest: z__namespace.number()
84
+ });
85
+
86
+ exports.accountSchema = accountSchema;
87
+ exports.coreSchema = coreSchema;
88
+ exports.rateLimitSchema = rateLimitSchema;
89
+ exports.sessionSchema = sessionSchema;
90
+ exports.userSchema = userSchema;
91
+ exports.verificationSchema = verificationSchema;
@@ -1,111 +1,19 @@
1
- import { ZodType } from 'zod';
1
+ import { D as DBFieldAttribute, b as DBFieldAttributeConfig, c as DBFieldType, d as DBPrimitive, B as BetterAuthDBSchema } from '../shared/core.CajxAutx.cjs';
2
+ export { S as SecondaryStorage } from '../shared/core.CajxAutx.cjs';
3
+ import { B as BetterAuthPluginDBSchema } from '../shared/core.HqYn20Fi.cjs';
4
+ import * as z from 'zod';
5
+ export { A as Account, R as RateLimit, S as Session, U as User, V as Verification, a as accountSchema, r as rateLimitSchema, s as sessionSchema, u as userSchema, v as verificationSchema } from '../shared/core.Dl-70uns.cjs';
2
6
 
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
- }>;
7
+ declare const coreSchema: z.ZodObject<{
8
+ id: z.ZodString;
9
+ createdAt: z.ZodDefault<z.ZodDate>;
10
+ updatedAt: z.ZodDefault<z.ZodDate>;
11
+ }, z.core.$strip>;
108
12
 
13
+ /**
14
+ * @deprecated Backport for 1.3.x, we will remove this in 1.4.x
15
+ */
16
+ type AuthPluginSchema = BetterAuthPluginDBSchema;
109
17
  /**
110
18
  * @deprecated Backport for 1.3.x, we will remove this in 1.4.x
111
19
  */
@@ -127,4 +35,5 @@ type Primitive = DBPrimitive;
127
35
  */
128
36
  type BetterAuthDbSchema = BetterAuthDBSchema;
129
37
 
130
- export type { BetterAuthDBSchema, BetterAuthDbSchema, DBFieldAttribute, DBFieldAttributeConfig, DBFieldType, DBPrimitive, FieldAttribute, FieldAttributeConfig, FieldType, Primitive };
38
+ export { BetterAuthDBSchema, BetterAuthPluginDBSchema, DBFieldAttribute, DBFieldAttributeConfig, DBFieldType, DBPrimitive, coreSchema };
39
+ export type { AuthPluginSchema, BetterAuthDbSchema, FieldAttribute, FieldAttributeConfig, FieldType, Primitive };
@@ -1,111 +1,19 @@
1
- import { ZodType } from 'zod';
1
+ import { D as DBFieldAttribute, b as DBFieldAttributeConfig, c as DBFieldType, d as DBPrimitive, B as BetterAuthDBSchema } from '../shared/core.CajxAutx.mjs';
2
+ export { S as SecondaryStorage } from '../shared/core.CajxAutx.mjs';
3
+ import { B as BetterAuthPluginDBSchema } from '../shared/core.E9DfzGLz.mjs';
4
+ import * as z from 'zod';
5
+ export { A as Account, R as RateLimit, S as Session, U as User, V as Verification, a as accountSchema, r as rateLimitSchema, s as sessionSchema, u as userSchema, v as verificationSchema } from '../shared/core.Dl-70uns.mjs';
2
6
 
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
- }>;
7
+ declare const coreSchema: z.ZodObject<{
8
+ id: z.ZodString;
9
+ createdAt: z.ZodDefault<z.ZodDate>;
10
+ updatedAt: z.ZodDefault<z.ZodDate>;
11
+ }, z.core.$strip>;
108
12
 
13
+ /**
14
+ * @deprecated Backport for 1.3.x, we will remove this in 1.4.x
15
+ */
16
+ type AuthPluginSchema = BetterAuthPluginDBSchema;
109
17
  /**
110
18
  * @deprecated Backport for 1.3.x, we will remove this in 1.4.x
111
19
  */
@@ -127,4 +35,5 @@ type Primitive = DBPrimitive;
127
35
  */
128
36
  type BetterAuthDbSchema = BetterAuthDBSchema;
129
37
 
130
- export type { BetterAuthDBSchema, BetterAuthDbSchema, DBFieldAttribute, DBFieldAttributeConfig, DBFieldType, DBPrimitive, FieldAttribute, FieldAttributeConfig, FieldType, Primitive };
38
+ export { BetterAuthDBSchema, BetterAuthPluginDBSchema, DBFieldAttribute, DBFieldAttributeConfig, DBFieldType, DBPrimitive, coreSchema };
39
+ export type { AuthPluginSchema, BetterAuthDbSchema, FieldAttribute, FieldAttributeConfig, FieldType, Primitive };
@@ -1,111 +1,19 @@
1
- import { ZodType } from 'zod';
1
+ import { D as DBFieldAttribute, b as DBFieldAttributeConfig, c as DBFieldType, d as DBPrimitive, B as BetterAuthDBSchema } from '../shared/core.CajxAutx.js';
2
+ export { S as SecondaryStorage } from '../shared/core.CajxAutx.js';
3
+ import { B as BetterAuthPluginDBSchema } from '../shared/core.Bqe5IGAi.js';
4
+ import * as z from 'zod';
5
+ export { A as Account, R as RateLimit, S as Session, U as User, V as Verification, a as accountSchema, r as rateLimitSchema, s as sessionSchema, u as userSchema, v as verificationSchema } from '../shared/core.Dl-70uns.js';
2
6
 
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
- }>;
7
+ declare const coreSchema: z.ZodObject<{
8
+ id: z.ZodString;
9
+ createdAt: z.ZodDefault<z.ZodDate>;
10
+ updatedAt: z.ZodDefault<z.ZodDate>;
11
+ }, z.core.$strip>;
108
12
 
13
+ /**
14
+ * @deprecated Backport for 1.3.x, we will remove this in 1.4.x
15
+ */
16
+ type AuthPluginSchema = BetterAuthPluginDBSchema;
109
17
  /**
110
18
  * @deprecated Backport for 1.3.x, we will remove this in 1.4.x
111
19
  */
@@ -127,4 +35,5 @@ type Primitive = DBPrimitive;
127
35
  */
128
36
  type BetterAuthDbSchema = BetterAuthDBSchema;
129
37
 
130
- export type { BetterAuthDBSchema, BetterAuthDbSchema, DBFieldAttribute, DBFieldAttributeConfig, DBFieldType, DBPrimitive, FieldAttribute, FieldAttributeConfig, FieldType, Primitive };
38
+ export { BetterAuthDBSchema, BetterAuthPluginDBSchema, DBFieldAttribute, DBFieldAttributeConfig, DBFieldType, DBPrimitive, coreSchema };
39
+ export type { AuthPluginSchema, BetterAuthDbSchema, FieldAttribute, FieldAttributeConfig, FieldType, Primitive };