@better-auth/core 1.4.0-beta.5 → 1.4.0-beta.7

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.
@@ -1,21 +1,27 @@
1
1
 
2
- > @better-auth/core@1.4.0-beta.5 build /home/runner/work/better-auth/better-auth/packages/core
2
+ > @better-auth/core@1.4.0-beta.7 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/adapter/index".
8
9
  Generated an empty chunk: "index".
9
- Generated an empty chunk: "index".
10
- Generated an empty chunk: "index".
11
- Generated an empty chunk: "index".
10
+ Generated an empty chunk: "db/adapter/index".
12
11
  [success] Build succeeded for core
13
12
  [log] dist/index.cjs (total size: 15 B, chunk size: 15 B)
14
13
 
14
+ [log] dist/async_hooks/index.cjs (total size: 922 B, chunk size: 922 B, exports: getAsyncLocalStorage)
15
+
16
+ [log] dist/db/index.cjs (total size: 2.09 kB, chunk size: 2.09 kB, exports: accountSchema, coreSchema, sessionSchema, userSchema, verificationSchema)
17
+
18
+ [log] dist/db/adapter/index.cjs (total size: 15 B, chunk size: 15 B)
15
19
  [log] dist/index.mjs (total size: 1 B, chunk size: 1 B)
16
20
 
17
- Σ Total dist size (byte size): 55 B
18
- [log]
19
- [warn] Build is done with some warnings:
21
+ [log] dist/async_hooks/index.mjs (total size: 887 B, chunk size: 887 B, exports: getAsyncLocalStorage)
20
22
 
21
- - Potential missing package.json files: dist/index.d.cjs
23
+ [log] dist/db/index.mjs (total size: 1.4 kB, chunk size: 1.4 kB, exports: accountSchema, coreSchema, sessionSchema, userSchema, verificationSchema)
24
+
25
+ [log] dist/db/adapter/index.mjs (total size: 1 B, chunk size: 1 B)
26
+ Σ Total dist size (byte size): 41.9 kB
27
+ [log]
package/build.config.ts CHANGED
@@ -8,5 +8,10 @@ export default defineBuildConfig({
8
8
  outDir: "dist",
9
9
  clean: true,
10
10
  failOnWarn: false,
11
- entries: ["./src/index.ts"],
11
+ entries: [
12
+ "./src/index.ts",
13
+ "./src/db/index.ts",
14
+ "./src/db/adapter/index.ts",
15
+ "./src/async_hooks/index.ts",
16
+ ],
12
17
  });
@@ -0,0 +1,27 @@
1
+ 'use strict';
2
+
3
+ let moduleName = "node:async_hooks";
4
+ const AsyncLocalStoragePromise = import(
5
+ /* @vite-ignore */
6
+ /* webpackIgnore: true */
7
+ moduleName
8
+ ).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;
22
+ });
23
+ async function getAsyncLocalStorage() {
24
+ return AsyncLocalStoragePromise;
25
+ }
26
+
27
+ exports.getAsyncLocalStorage = getAsyncLocalStorage;
@@ -0,0 +1,10 @@
1
+ import { AsyncLocalStorage } from 'node:async_hooks';
2
+ export { AsyncLocalStorage } from 'node:async_hooks';
3
+
4
+ /**
5
+ * AsyncLocalStorage will be import directly in 1.5.x
6
+ */
7
+
8
+ declare function getAsyncLocalStorage(): Promise<typeof AsyncLocalStorage>;
9
+
10
+ export { getAsyncLocalStorage };
@@ -0,0 +1,10 @@
1
+ import { AsyncLocalStorage } from 'node:async_hooks';
2
+ export { AsyncLocalStorage } from 'node:async_hooks';
3
+
4
+ /**
5
+ * AsyncLocalStorage will be import directly in 1.5.x
6
+ */
7
+
8
+ declare function getAsyncLocalStorage(): Promise<typeof AsyncLocalStorage>;
9
+
10
+ export { getAsyncLocalStorage };
@@ -0,0 +1,10 @@
1
+ import { AsyncLocalStorage } from 'node:async_hooks';
2
+ export { AsyncLocalStorage } from 'node:async_hooks';
3
+
4
+ /**
5
+ * AsyncLocalStorage will be import directly in 1.5.x
6
+ */
7
+
8
+ declare function getAsyncLocalStorage(): Promise<typeof AsyncLocalStorage>;
9
+
10
+ export { getAsyncLocalStorage };
@@ -0,0 +1,25 @@
1
+ let moduleName = "node:async_hooks";
2
+ const AsyncLocalStoragePromise = import(
3
+ /* @vite-ignore */
4
+ /* webpackIgnore: true */
5
+ moduleName
6
+ ).then((mod) => mod.AsyncLocalStorage).catch((err) => {
7
+ if ("AsyncLocalStorage" in globalThis) {
8
+ return globalThis.AsyncLocalStorage;
9
+ }
10
+ console.warn(
11
+ "[better-auth] Warning: AsyncLocalStorage is not available in this environment. Some features may not work as expected."
12
+ );
13
+ console.warn(
14
+ "[better-auth] Please read more about this warning at https://better-auth.com/docs/installation#mount-handler"
15
+ );
16
+ console.warn(
17
+ "[better-auth] If you are using Cloudflare Workers, please see: https://developers.cloudflare.com/workers/configuration/compatibility-flags/#nodejs-compatibility-flag"
18
+ );
19
+ throw err;
20
+ });
21
+ async function getAsyncLocalStorage() {
22
+ return AsyncLocalStoragePromise;
23
+ }
24
+
25
+ export { getAsyncLocalStorage };
@@ -0,0 +1,2 @@
1
+ 'use strict';
2
+
@@ -0,0 +1,23 @@
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 };
@@ -0,0 +1,23 @@
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 };
@@ -0,0 +1,23 @@
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 };
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,75 @@
1
+ 'use strict';
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
+ exports.accountSchema = accountSchema;
72
+ exports.coreSchema = coreSchema;
73
+ exports.sessionSchema = sessionSchema;
74
+ exports.userSchema = userSchema;
75
+ exports.verificationSchema = verificationSchema;
@@ -0,0 +1,116 @@
1
+ import { D as DBFieldAttribute, b as DBFieldAttributeConfig, c as DBFieldType, d as DBPrimitive, B as BetterAuthDBSchema } from '../shared/core.CnvFgghY.cjs';
2
+ import * as z from 'zod';
3
+
4
+ type BetterAuthPluginDBSchema = {
5
+ [table in string]: {
6
+ fields: {
7
+ [field in string]: DBFieldAttribute;
8
+ };
9
+ disableMigration?: boolean;
10
+ modelName?: string;
11
+ };
12
+ };
13
+
14
+ declare const coreSchema: z.ZodObject<{
15
+ id: z.ZodString;
16
+ createdAt: z.ZodDefault<z.ZodDate>;
17
+ updatedAt: z.ZodDefault<z.ZodDate>;
18
+ }, z.core.$strip>;
19
+
20
+ declare const userSchema: z.ZodObject<{
21
+ id: z.ZodString;
22
+ createdAt: z.ZodDefault<z.ZodDate>;
23
+ updatedAt: z.ZodDefault<z.ZodDate>;
24
+ email: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
25
+ emailVerified: z.ZodDefault<z.ZodBoolean>;
26
+ name: z.ZodString;
27
+ image: z.ZodOptional<z.ZodNullable<z.ZodString>>;
28
+ }, z.core.$strip>;
29
+ /**
30
+ * User schema type used by better-auth, note that it's possible that user could have additional fields
31
+ *
32
+ * todo: we should use generics to extend this type with additional fields from plugins and options in the future
33
+ */
34
+ type User = z.infer<typeof userSchema>;
35
+
36
+ declare const accountSchema: z.ZodObject<{
37
+ id: z.ZodString;
38
+ createdAt: z.ZodDefault<z.ZodDate>;
39
+ updatedAt: z.ZodDefault<z.ZodDate>;
40
+ providerId: z.ZodString;
41
+ accountId: z.ZodString;
42
+ userId: z.ZodCoercedString<unknown>;
43
+ accessToken: z.ZodOptional<z.ZodNullable<z.ZodString>>;
44
+ refreshToken: z.ZodOptional<z.ZodNullable<z.ZodString>>;
45
+ idToken: z.ZodOptional<z.ZodNullable<z.ZodString>>;
46
+ accessTokenExpiresAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
47
+ refreshTokenExpiresAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
48
+ scope: z.ZodOptional<z.ZodNullable<z.ZodString>>;
49
+ password: z.ZodOptional<z.ZodNullable<z.ZodString>>;
50
+ }, z.core.$strip>;
51
+ /**
52
+ * Account schema type used by better-auth, note that it's possible that account could have additional fields
53
+ *
54
+ * todo: we should use generics to extend this type with additional fields from plugins and options in the future
55
+ */
56
+ type Account = z.infer<typeof accountSchema>;
57
+
58
+ declare const sessionSchema: z.ZodObject<{
59
+ id: z.ZodString;
60
+ createdAt: z.ZodDefault<z.ZodDate>;
61
+ updatedAt: z.ZodDefault<z.ZodDate>;
62
+ userId: z.ZodCoercedString<unknown>;
63
+ expiresAt: z.ZodDate;
64
+ token: z.ZodString;
65
+ ipAddress: z.ZodOptional<z.ZodNullable<z.ZodString>>;
66
+ userAgent: z.ZodOptional<z.ZodNullable<z.ZodString>>;
67
+ }, z.core.$strip>;
68
+ /**
69
+ * Session schema type used by better-auth, note that it's possible that session could have additional fields
70
+ *
71
+ * todo: we should use generics to extend this type with additional fields from plugins and options in the future
72
+ */
73
+ type Session = z.infer<typeof sessionSchema>;
74
+
75
+ declare const verificationSchema: z.ZodObject<{
76
+ id: z.ZodString;
77
+ createdAt: z.ZodDefault<z.ZodDate>;
78
+ updatedAt: z.ZodDefault<z.ZodDate>;
79
+ value: z.ZodString;
80
+ expiresAt: z.ZodDate;
81
+ identifier: z.ZodString;
82
+ }, z.core.$strip>;
83
+ /**
84
+ * Verification schema type used by better-auth, note that it's possible that verification could have additional fields
85
+ *
86
+ * todo: we should use generics to extend this type with additional fields from plugins and options in the future
87
+ */
88
+ type Verification = z.infer<typeof verificationSchema>;
89
+
90
+ /**
91
+ * @deprecated Backport for 1.3.x, we will remove this in 1.4.x
92
+ */
93
+ type AuthPluginSchema = BetterAuthPluginDBSchema;
94
+ /**
95
+ * @deprecated Backport for 1.3.x, we will remove this in 1.4.x
96
+ */
97
+ type FieldAttribute = DBFieldAttribute;
98
+ /**
99
+ * @deprecated Backport for 1.3.x, we will remove this in 1.4.x
100
+ */
101
+ type FieldAttributeConfig = DBFieldAttributeConfig;
102
+ /**
103
+ * @deprecated Backport for 1.3.x, we will remove this in 1.4.x
104
+ */
105
+ type FieldType = DBFieldType;
106
+ /**
107
+ * @deprecated Backport for 1.3.x, we will remove this in 1.4.x
108
+ */
109
+ type Primitive = DBPrimitive;
110
+ /**
111
+ * @deprecated Backport for 1.3.x, we will remove this in 1.4.x
112
+ */
113
+ type BetterAuthDbSchema = BetterAuthDBSchema;
114
+
115
+ export { BetterAuthDBSchema, DBFieldAttribute, DBFieldAttributeConfig, DBFieldType, DBPrimitive, accountSchema, coreSchema, sessionSchema, userSchema, verificationSchema };
116
+ export type { Account, AuthPluginSchema, BetterAuthDbSchema, BetterAuthPluginDBSchema, FieldAttribute, FieldAttributeConfig, FieldType, Primitive, Session, User, Verification };
@@ -0,0 +1,116 @@
1
+ import { D as DBFieldAttribute, b as DBFieldAttributeConfig, c as DBFieldType, d as DBPrimitive, B as BetterAuthDBSchema } from '../shared/core.CnvFgghY.mjs';
2
+ import * as z from 'zod';
3
+
4
+ type BetterAuthPluginDBSchema = {
5
+ [table in string]: {
6
+ fields: {
7
+ [field in string]: DBFieldAttribute;
8
+ };
9
+ disableMigration?: boolean;
10
+ modelName?: string;
11
+ };
12
+ };
13
+
14
+ declare const coreSchema: z.ZodObject<{
15
+ id: z.ZodString;
16
+ createdAt: z.ZodDefault<z.ZodDate>;
17
+ updatedAt: z.ZodDefault<z.ZodDate>;
18
+ }, z.core.$strip>;
19
+
20
+ declare const userSchema: z.ZodObject<{
21
+ id: z.ZodString;
22
+ createdAt: z.ZodDefault<z.ZodDate>;
23
+ updatedAt: z.ZodDefault<z.ZodDate>;
24
+ email: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
25
+ emailVerified: z.ZodDefault<z.ZodBoolean>;
26
+ name: z.ZodString;
27
+ image: z.ZodOptional<z.ZodNullable<z.ZodString>>;
28
+ }, z.core.$strip>;
29
+ /**
30
+ * User schema type used by better-auth, note that it's possible that user could have additional fields
31
+ *
32
+ * todo: we should use generics to extend this type with additional fields from plugins and options in the future
33
+ */
34
+ type User = z.infer<typeof userSchema>;
35
+
36
+ declare const accountSchema: z.ZodObject<{
37
+ id: z.ZodString;
38
+ createdAt: z.ZodDefault<z.ZodDate>;
39
+ updatedAt: z.ZodDefault<z.ZodDate>;
40
+ providerId: z.ZodString;
41
+ accountId: z.ZodString;
42
+ userId: z.ZodCoercedString<unknown>;
43
+ accessToken: z.ZodOptional<z.ZodNullable<z.ZodString>>;
44
+ refreshToken: z.ZodOptional<z.ZodNullable<z.ZodString>>;
45
+ idToken: z.ZodOptional<z.ZodNullable<z.ZodString>>;
46
+ accessTokenExpiresAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
47
+ refreshTokenExpiresAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
48
+ scope: z.ZodOptional<z.ZodNullable<z.ZodString>>;
49
+ password: z.ZodOptional<z.ZodNullable<z.ZodString>>;
50
+ }, z.core.$strip>;
51
+ /**
52
+ * Account schema type used by better-auth, note that it's possible that account could have additional fields
53
+ *
54
+ * todo: we should use generics to extend this type with additional fields from plugins and options in the future
55
+ */
56
+ type Account = z.infer<typeof accountSchema>;
57
+
58
+ declare const sessionSchema: z.ZodObject<{
59
+ id: z.ZodString;
60
+ createdAt: z.ZodDefault<z.ZodDate>;
61
+ updatedAt: z.ZodDefault<z.ZodDate>;
62
+ userId: z.ZodCoercedString<unknown>;
63
+ expiresAt: z.ZodDate;
64
+ token: z.ZodString;
65
+ ipAddress: z.ZodOptional<z.ZodNullable<z.ZodString>>;
66
+ userAgent: z.ZodOptional<z.ZodNullable<z.ZodString>>;
67
+ }, z.core.$strip>;
68
+ /**
69
+ * Session schema type used by better-auth, note that it's possible that session could have additional fields
70
+ *
71
+ * todo: we should use generics to extend this type with additional fields from plugins and options in the future
72
+ */
73
+ type Session = z.infer<typeof sessionSchema>;
74
+
75
+ declare const verificationSchema: z.ZodObject<{
76
+ id: z.ZodString;
77
+ createdAt: z.ZodDefault<z.ZodDate>;
78
+ updatedAt: z.ZodDefault<z.ZodDate>;
79
+ value: z.ZodString;
80
+ expiresAt: z.ZodDate;
81
+ identifier: z.ZodString;
82
+ }, z.core.$strip>;
83
+ /**
84
+ * Verification schema type used by better-auth, note that it's possible that verification could have additional fields
85
+ *
86
+ * todo: we should use generics to extend this type with additional fields from plugins and options in the future
87
+ */
88
+ type Verification = z.infer<typeof verificationSchema>;
89
+
90
+ /**
91
+ * @deprecated Backport for 1.3.x, we will remove this in 1.4.x
92
+ */
93
+ type AuthPluginSchema = BetterAuthPluginDBSchema;
94
+ /**
95
+ * @deprecated Backport for 1.3.x, we will remove this in 1.4.x
96
+ */
97
+ type FieldAttribute = DBFieldAttribute;
98
+ /**
99
+ * @deprecated Backport for 1.3.x, we will remove this in 1.4.x
100
+ */
101
+ type FieldAttributeConfig = DBFieldAttributeConfig;
102
+ /**
103
+ * @deprecated Backport for 1.3.x, we will remove this in 1.4.x
104
+ */
105
+ type FieldType = DBFieldType;
106
+ /**
107
+ * @deprecated Backport for 1.3.x, we will remove this in 1.4.x
108
+ */
109
+ type Primitive = DBPrimitive;
110
+ /**
111
+ * @deprecated Backport for 1.3.x, we will remove this in 1.4.x
112
+ */
113
+ type BetterAuthDbSchema = BetterAuthDBSchema;
114
+
115
+ export { BetterAuthDBSchema, DBFieldAttribute, DBFieldAttributeConfig, DBFieldType, DBPrimitive, accountSchema, coreSchema, sessionSchema, userSchema, verificationSchema };
116
+ export type { Account, AuthPluginSchema, BetterAuthDbSchema, BetterAuthPluginDBSchema, FieldAttribute, FieldAttributeConfig, FieldType, Primitive, Session, User, Verification };
@@ -0,0 +1,116 @@
1
+ import { D as DBFieldAttribute, b as DBFieldAttributeConfig, c as DBFieldType, d as DBPrimitive, B as BetterAuthDBSchema } from '../shared/core.CnvFgghY.js';
2
+ import * as z from 'zod';
3
+
4
+ type BetterAuthPluginDBSchema = {
5
+ [table in string]: {
6
+ fields: {
7
+ [field in string]: DBFieldAttribute;
8
+ };
9
+ disableMigration?: boolean;
10
+ modelName?: string;
11
+ };
12
+ };
13
+
14
+ declare const coreSchema: z.ZodObject<{
15
+ id: z.ZodString;
16
+ createdAt: z.ZodDefault<z.ZodDate>;
17
+ updatedAt: z.ZodDefault<z.ZodDate>;
18
+ }, z.core.$strip>;
19
+
20
+ declare const userSchema: z.ZodObject<{
21
+ id: z.ZodString;
22
+ createdAt: z.ZodDefault<z.ZodDate>;
23
+ updatedAt: z.ZodDefault<z.ZodDate>;
24
+ email: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
25
+ emailVerified: z.ZodDefault<z.ZodBoolean>;
26
+ name: z.ZodString;
27
+ image: z.ZodOptional<z.ZodNullable<z.ZodString>>;
28
+ }, z.core.$strip>;
29
+ /**
30
+ * User schema type used by better-auth, note that it's possible that user could have additional fields
31
+ *
32
+ * todo: we should use generics to extend this type with additional fields from plugins and options in the future
33
+ */
34
+ type User = z.infer<typeof userSchema>;
35
+
36
+ declare const accountSchema: z.ZodObject<{
37
+ id: z.ZodString;
38
+ createdAt: z.ZodDefault<z.ZodDate>;
39
+ updatedAt: z.ZodDefault<z.ZodDate>;
40
+ providerId: z.ZodString;
41
+ accountId: z.ZodString;
42
+ userId: z.ZodCoercedString<unknown>;
43
+ accessToken: z.ZodOptional<z.ZodNullable<z.ZodString>>;
44
+ refreshToken: z.ZodOptional<z.ZodNullable<z.ZodString>>;
45
+ idToken: z.ZodOptional<z.ZodNullable<z.ZodString>>;
46
+ accessTokenExpiresAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
47
+ refreshTokenExpiresAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
48
+ scope: z.ZodOptional<z.ZodNullable<z.ZodString>>;
49
+ password: z.ZodOptional<z.ZodNullable<z.ZodString>>;
50
+ }, z.core.$strip>;
51
+ /**
52
+ * Account schema type used by better-auth, note that it's possible that account could have additional fields
53
+ *
54
+ * todo: we should use generics to extend this type with additional fields from plugins and options in the future
55
+ */
56
+ type Account = z.infer<typeof accountSchema>;
57
+
58
+ declare const sessionSchema: z.ZodObject<{
59
+ id: z.ZodString;
60
+ createdAt: z.ZodDefault<z.ZodDate>;
61
+ updatedAt: z.ZodDefault<z.ZodDate>;
62
+ userId: z.ZodCoercedString<unknown>;
63
+ expiresAt: z.ZodDate;
64
+ token: z.ZodString;
65
+ ipAddress: z.ZodOptional<z.ZodNullable<z.ZodString>>;
66
+ userAgent: z.ZodOptional<z.ZodNullable<z.ZodString>>;
67
+ }, z.core.$strip>;
68
+ /**
69
+ * Session schema type used by better-auth, note that it's possible that session could have additional fields
70
+ *
71
+ * todo: we should use generics to extend this type with additional fields from plugins and options in the future
72
+ */
73
+ type Session = z.infer<typeof sessionSchema>;
74
+
75
+ declare const verificationSchema: z.ZodObject<{
76
+ id: z.ZodString;
77
+ createdAt: z.ZodDefault<z.ZodDate>;
78
+ updatedAt: z.ZodDefault<z.ZodDate>;
79
+ value: z.ZodString;
80
+ expiresAt: z.ZodDate;
81
+ identifier: z.ZodString;
82
+ }, z.core.$strip>;
83
+ /**
84
+ * Verification schema type used by better-auth, note that it's possible that verification could have additional fields
85
+ *
86
+ * todo: we should use generics to extend this type with additional fields from plugins and options in the future
87
+ */
88
+ type Verification = z.infer<typeof verificationSchema>;
89
+
90
+ /**
91
+ * @deprecated Backport for 1.3.x, we will remove this in 1.4.x
92
+ */
93
+ type AuthPluginSchema = BetterAuthPluginDBSchema;
94
+ /**
95
+ * @deprecated Backport for 1.3.x, we will remove this in 1.4.x
96
+ */
97
+ type FieldAttribute = DBFieldAttribute;
98
+ /**
99
+ * @deprecated Backport for 1.3.x, we will remove this in 1.4.x
100
+ */
101
+ type FieldAttributeConfig = DBFieldAttributeConfig;
102
+ /**
103
+ * @deprecated Backport for 1.3.x, we will remove this in 1.4.x
104
+ */
105
+ type FieldType = DBFieldType;
106
+ /**
107
+ * @deprecated Backport for 1.3.x, we will remove this in 1.4.x
108
+ */
109
+ type Primitive = DBPrimitive;
110
+ /**
111
+ * @deprecated Backport for 1.3.x, we will remove this in 1.4.x
112
+ */
113
+ type BetterAuthDbSchema = BetterAuthDBSchema;
114
+
115
+ export { BetterAuthDBSchema, DBFieldAttribute, DBFieldAttributeConfig, DBFieldType, DBPrimitive, accountSchema, coreSchema, sessionSchema, userSchema, verificationSchema };
116
+ export type { Account, AuthPluginSchema, BetterAuthDbSchema, BetterAuthPluginDBSchema, FieldAttribute, FieldAttributeConfig, FieldType, Primitive, Session, User, Verification };