@better-auth/core 1.3.27 → 1.3.29

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 (121) hide show
  1. package/.turbo/turbo-build.log +54 -4
  2. package/build.config.ts +6 -0
  3. package/dist/db/adapter/index.d.cts +13 -23
  4. package/dist/db/adapter/index.d.mts +13 -23
  5. package/dist/db/adapter/index.d.ts +13 -23
  6. package/dist/db/index.cjs +16 -0
  7. package/dist/db/index.d.cts +6 -83
  8. package/dist/db/index.d.mts +6 -83
  9. package/dist/db/index.d.ts +6 -83
  10. package/dist/db/index.mjs +16 -1
  11. package/dist/env/index.cjs +312 -0
  12. package/dist/env/index.d.cts +36 -0
  13. package/dist/env/index.d.mts +36 -0
  14. package/dist/env/index.d.ts +36 -0
  15. package/dist/env/index.mjs +297 -0
  16. package/dist/error/index.cjs +44 -0
  17. package/dist/error/index.d.cts +33 -0
  18. package/dist/error/index.d.mts +33 -0
  19. package/dist/error/index.d.ts +33 -0
  20. package/dist/error/index.mjs +41 -0
  21. package/dist/index.d.cts +156 -101
  22. package/dist/index.d.mts +156 -101
  23. package/dist/index.d.ts +156 -101
  24. package/dist/middleware/index.cjs +25 -0
  25. package/dist/middleware/index.d.cts +13 -0
  26. package/dist/middleware/index.d.mts +13 -0
  27. package/dist/middleware/index.d.ts +13 -0
  28. package/dist/middleware/index.mjs +21 -0
  29. package/dist/oauth2/index.cjs +368 -0
  30. package/dist/oauth2/index.d.cts +100 -0
  31. package/dist/oauth2/index.d.mts +100 -0
  32. package/dist/oauth2/index.d.ts +100 -0
  33. package/dist/oauth2/index.mjs +357 -0
  34. package/dist/shared/core.Bl6TpxyD.d.mts +181 -0
  35. package/dist/shared/core.Bqe5IGAi.d.ts +13 -0
  36. package/dist/shared/core.Bshk2o_x.d.ts +1721 -0
  37. package/dist/shared/core.BwoNUcJQ.d.cts +53 -0
  38. package/dist/shared/core.BwoNUcJQ.d.mts +53 -0
  39. package/dist/shared/core.BwoNUcJQ.d.ts +53 -0
  40. package/dist/shared/core.C6_2xGyf.d.mts +1721 -0
  41. package/dist/shared/{core.CnvFgghY.d.cts → core.CajxAutx.d.cts} +27 -1
  42. package/dist/shared/{core.CnvFgghY.d.mts → core.CajxAutx.d.mts} +27 -1
  43. package/dist/shared/{core.CnvFgghY.d.ts → core.CajxAutx.d.ts} +27 -1
  44. package/dist/shared/core.CfqdiZTu.d.cts +1721 -0
  45. package/dist/shared/core.DkdZ1o38.d.ts +181 -0
  46. package/dist/shared/core.Dl-70uns.d.cts +84 -0
  47. package/dist/shared/core.Dl-70uns.d.mts +84 -0
  48. package/dist/shared/core.Dl-70uns.d.ts +84 -0
  49. package/dist/shared/core.DyEdx0m7.d.cts +181 -0
  50. package/dist/shared/core.E9DfzGLz.d.mts +13 -0
  51. package/dist/shared/core.HqYn20Fi.d.cts +13 -0
  52. package/dist/social-providers/index.cjs +2793 -0
  53. package/dist/social-providers/index.d.cts +3903 -0
  54. package/dist/social-providers/index.d.mts +3903 -0
  55. package/dist/social-providers/index.d.ts +3903 -0
  56. package/dist/social-providers/index.mjs +2743 -0
  57. package/dist/utils/index.cjs +7 -0
  58. package/dist/utils/index.d.cts +10 -0
  59. package/dist/utils/index.d.mts +10 -0
  60. package/dist/utils/index.d.ts +10 -0
  61. package/dist/utils/index.mjs +5 -0
  62. package/package.json +98 -2
  63. package/src/db/adapter/index.ts +424 -0
  64. package/src/db/index.ts +2 -0
  65. package/src/db/schema/rate-limit.ts +21 -0
  66. package/src/db/type.ts +28 -0
  67. package/src/env/color-depth.ts +172 -0
  68. package/src/env/env-impl.ts +124 -0
  69. package/src/env/index.ts +23 -0
  70. package/src/env/logger.test.ts +33 -0
  71. package/src/env/logger.ts +145 -0
  72. package/src/error/codes.ts +31 -0
  73. package/src/error/index.ts +11 -0
  74. package/src/index.ts +0 -2
  75. package/src/middleware/index.ts +33 -0
  76. package/src/oauth2/client-credentials-token.ts +102 -0
  77. package/src/oauth2/create-authorization-url.ts +85 -0
  78. package/src/oauth2/index.ts +22 -0
  79. package/src/oauth2/oauth-provider.ts +194 -0
  80. package/src/oauth2/refresh-access-token.ts +124 -0
  81. package/src/oauth2/utils.ts +36 -0
  82. package/src/oauth2/validate-authorization-code.ts +156 -0
  83. package/src/social-providers/apple.ts +213 -0
  84. package/src/social-providers/atlassian.ts +130 -0
  85. package/src/social-providers/cognito.ts +269 -0
  86. package/src/social-providers/discord.ts +172 -0
  87. package/src/social-providers/dropbox.ts +112 -0
  88. package/src/social-providers/facebook.ts +204 -0
  89. package/src/social-providers/figma.ts +115 -0
  90. package/src/social-providers/github.ts +154 -0
  91. package/src/social-providers/gitlab.ts +152 -0
  92. package/src/social-providers/google.ts +171 -0
  93. package/src/social-providers/huggingface.ts +116 -0
  94. package/src/social-providers/index.ts +118 -0
  95. package/src/social-providers/kakao.ts +178 -0
  96. package/src/social-providers/kick.ts +95 -0
  97. package/src/social-providers/line.ts +169 -0
  98. package/src/social-providers/linear.ts +120 -0
  99. package/src/social-providers/linkedin.ts +110 -0
  100. package/src/social-providers/microsoft-entra-id.ts +243 -0
  101. package/src/social-providers/naver.ts +112 -0
  102. package/src/social-providers/notion.ts +106 -0
  103. package/src/social-providers/paypal.ts +261 -0
  104. package/src/social-providers/reddit.ts +122 -0
  105. package/src/social-providers/roblox.ts +110 -0
  106. package/src/social-providers/salesforce.ts +157 -0
  107. package/src/social-providers/slack.ts +114 -0
  108. package/src/social-providers/spotify.ts +93 -0
  109. package/src/social-providers/tiktok.ts +211 -0
  110. package/src/social-providers/twitch.ts +111 -0
  111. package/src/social-providers/twitter.ts +194 -0
  112. package/src/social-providers/vk.ts +128 -0
  113. package/src/social-providers/zoom.ts +218 -0
  114. package/src/types/context.ts +334 -0
  115. package/src/types/cookie.ts +7 -0
  116. package/src/types/index.ts +19 -1
  117. package/src/types/init-options.ts +1048 -2
  118. package/src/types/plugin-client.ts +69 -0
  119. package/src/types/plugin.ts +134 -0
  120. package/src/utils/error-codes.ts +51 -0
  121. package/src/utils/index.ts +1 -0
@@ -1,5 +1,5 @@
1
1
 
2
- > @better-auth/core@1.3.27 build /home/runner/work/better-auth/better-auth/packages/core
2
+ > @better-auth/core@1.3.29 build /home/runner/work/better-auth/better-auth/packages/core
3
3
  > unbuild --clean
4
4
 
5
5
  [info] Building core
@@ -8,20 +8,70 @@ Generated an empty chunk: "index".
8
8
  Generated an empty chunk: "db/adapter/index".
9
9
  Generated an empty chunk: "index".
10
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.
11
31
  [success] Build succeeded for core
12
32
  [log] dist/index.cjs (total size: 15 B, chunk size: 15 B)
13
33
 
14
34
  [log] dist/async_hooks/index.cjs (total size: 922 B, chunk size: 922 B, exports: getAsyncLocalStorage)
15
35
 
16
- [log] dist/db/index.cjs (total size: 2.09 kB, chunk size: 2.09 kB, exports: accountSchema, coreSchema, sessionSchema, userSchema, verificationSchema)
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.62 kB, chunk size: 8.62 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)
17
50
 
18
51
  [log] dist/db/adapter/index.cjs (total size: 15 B, chunk size: 15 B)
19
52
  [log] dist/index.mjs (total size: 1 B, chunk size: 1 B)
20
53
 
21
54
  [log] dist/async_hooks/index.mjs (total size: 887 B, chunk size: 887 B, exports: getAsyncLocalStorage)
22
55
 
23
- [log] dist/db/index.mjs (total size: 1.4 kB, chunk size: 1.4 kB, exports: accountSchema, coreSchema, sessionSchema, userSchema, verificationSchema)
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.33 kB, chunk size: 8.33 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)
24
70
 
25
71
  [log] dist/db/adapter/index.mjs (total size: 1 B, chunk size: 1 B)
26
- Σ Total dist size (byte size): 43 kB
72
+ Σ Total dist size (byte size): 865 kB
27
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
@@ -13,5 +13,11 @@ export default defineBuildConfig({
13
13
  "./src/db/index.ts",
14
14
  "./src/db/adapter/index.ts",
15
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",
16
22
  ],
17
23
  });
@@ -1,23 +1,13 @@
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 '../../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.CfqdiZTu.cjs';
3
+ import 'zod';
4
+ import 'kysely';
5
+ import 'better-call';
6
+ import '../../shared/core.Dl-70uns.cjs';
7
+ import 'bun:sqlite';
8
+ import 'node:sqlite';
9
+ import '../../social-providers/index.cjs';
10
+ import '@better-auth/core/oauth2';
11
+ import '../../shared/core.DyEdx0m7.cjs';
12
+ import '../../shared/core.BwoNUcJQ.cjs';
13
+ import '@better-auth/core';
@@ -1,23 +1,13 @@
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 '../../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.C6_2xGyf.mjs';
3
+ import 'zod';
4
+ import 'kysely';
5
+ import 'better-call';
6
+ import '../../shared/core.Dl-70uns.mjs';
7
+ import 'bun:sqlite';
8
+ import 'node:sqlite';
9
+ import '../../social-providers/index.mjs';
10
+ import '@better-auth/core/oauth2';
11
+ import '../../shared/core.Bl6TpxyD.mjs';
12
+ import '../../shared/core.BwoNUcJQ.mjs';
13
+ import '@better-auth/core';
@@ -1,23 +1,13 @@
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 '../../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.Bshk2o_x.js';
3
+ import 'zod';
4
+ import 'kysely';
5
+ import 'better-call';
6
+ import '../../shared/core.Dl-70uns.js';
7
+ import 'bun:sqlite';
8
+ import 'node:sqlite';
9
+ import '../../social-providers/index.js';
10
+ import '@better-auth/core/oauth2';
11
+ import '../../shared/core.DkdZ1o38.js';
12
+ import '../../shared/core.BwoNUcJQ.js';
13
+ import '@better-auth/core';
package/dist/db/index.cjs CHANGED
@@ -68,8 +68,24 @@ const verificationSchema = coreSchema.extend({
68
68
  identifier: z__namespace.string()
69
69
  });
70
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
+
71
86
  exports.accountSchema = accountSchema;
72
87
  exports.coreSchema = coreSchema;
88
+ exports.rateLimitSchema = rateLimitSchema;
73
89
  exports.sessionSchema = sessionSchema;
74
90
  exports.userSchema = userSchema;
75
91
  exports.verificationSchema = verificationSchema;
@@ -1,15 +1,8 @@
1
- import { D as DBFieldAttribute, b as DBFieldAttributeConfig, c as DBFieldType, d as DBPrimitive, B as BetterAuthDBSchema } from '../shared/core.CnvFgghY.cjs';
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';
2
4
  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
- };
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';
13
6
 
14
7
  declare const coreSchema: z.ZodObject<{
15
8
  id: z.ZodString;
@@ -17,76 +10,6 @@ declare const coreSchema: z.ZodObject<{
17
10
  updatedAt: z.ZodDefault<z.ZodDate>;
18
11
  }, z.core.$strip>;
19
12
 
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
13
  /**
91
14
  * @deprecated Backport for 1.3.x, we will remove this in 1.4.x
92
15
  */
@@ -112,5 +35,5 @@ type Primitive = DBPrimitive;
112
35
  */
113
36
  type BetterAuthDbSchema = BetterAuthDBSchema;
114
37
 
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 };
38
+ export { BetterAuthDBSchema, BetterAuthPluginDBSchema, DBFieldAttribute, DBFieldAttributeConfig, DBFieldType, DBPrimitive, coreSchema };
39
+ export type { AuthPluginSchema, BetterAuthDbSchema, FieldAttribute, FieldAttributeConfig, FieldType, Primitive };
@@ -1,15 +1,8 @@
1
- import { D as DBFieldAttribute, b as DBFieldAttributeConfig, c as DBFieldType, d as DBPrimitive, B as BetterAuthDBSchema } from '../shared/core.CnvFgghY.mjs';
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';
2
4
  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
- };
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';
13
6
 
14
7
  declare const coreSchema: z.ZodObject<{
15
8
  id: z.ZodString;
@@ -17,76 +10,6 @@ declare const coreSchema: z.ZodObject<{
17
10
  updatedAt: z.ZodDefault<z.ZodDate>;
18
11
  }, z.core.$strip>;
19
12
 
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
13
  /**
91
14
  * @deprecated Backport for 1.3.x, we will remove this in 1.4.x
92
15
  */
@@ -112,5 +35,5 @@ type Primitive = DBPrimitive;
112
35
  */
113
36
  type BetterAuthDbSchema = BetterAuthDBSchema;
114
37
 
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 };
38
+ export { BetterAuthDBSchema, BetterAuthPluginDBSchema, DBFieldAttribute, DBFieldAttributeConfig, DBFieldType, DBPrimitive, coreSchema };
39
+ export type { AuthPluginSchema, BetterAuthDbSchema, FieldAttribute, FieldAttributeConfig, FieldType, Primitive };
@@ -1,15 +1,8 @@
1
- import { D as DBFieldAttribute, b as DBFieldAttributeConfig, c as DBFieldType, d as DBPrimitive, B as BetterAuthDBSchema } from '../shared/core.CnvFgghY.js';
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';
2
4
  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
- };
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';
13
6
 
14
7
  declare const coreSchema: z.ZodObject<{
15
8
  id: z.ZodString;
@@ -17,76 +10,6 @@ declare const coreSchema: z.ZodObject<{
17
10
  updatedAt: z.ZodDefault<z.ZodDate>;
18
11
  }, z.core.$strip>;
19
12
 
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
13
  /**
91
14
  * @deprecated Backport for 1.3.x, we will remove this in 1.4.x
92
15
  */
@@ -112,5 +35,5 @@ type Primitive = DBPrimitive;
112
35
  */
113
36
  type BetterAuthDbSchema = BetterAuthDBSchema;
114
37
 
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 };
38
+ export { BetterAuthDBSchema, BetterAuthPluginDBSchema, DBFieldAttribute, DBFieldAttributeConfig, DBFieldType, DBPrimitive, coreSchema };
39
+ export type { AuthPluginSchema, BetterAuthDbSchema, FieldAttribute, FieldAttributeConfig, FieldType, Primitive };
package/dist/db/index.mjs CHANGED
@@ -52,4 +52,19 @@ const verificationSchema = coreSchema.extend({
52
52
  identifier: z.string()
53
53
  });
54
54
 
55
- export { accountSchema, coreSchema, sessionSchema, userSchema, verificationSchema };
55
+ const rateLimitSchema = z.object({
56
+ /**
57
+ * The key to use for rate limiting
58
+ */
59
+ key: z.string(),
60
+ /**
61
+ * The number of requests made
62
+ */
63
+ count: z.number(),
64
+ /**
65
+ * The last request time in milliseconds
66
+ */
67
+ lastRequest: z.number()
68
+ });
69
+
70
+ export { accountSchema, coreSchema, rateLimitSchema, sessionSchema, userSchema, verificationSchema };