@better-auth/core 1.4.0-beta.18 → 1.4.0-beta.19

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,14 +1,14 @@
1
1
 
2
- > @better-auth/core@1.4.0-beta.18 build /home/runner/work/better-auth/better-auth/packages/core
2
+ > @better-auth/core@1.4.0-beta.19 build /home/runner/work/better-auth/better-auth/packages/core
3
3
  > tsdown
4
4
 
5
5
  ℹ tsdown v0.16.0 powered by rolldown v1.0.0-beta.46
6
6
  ℹ Using tsdown config: /home/runner/work/better-auth/better-auth/packages/core/tsdown.config.ts
7
- ℹ entry: src/index.ts, src/api/index.ts, src/async_hooks/index.ts, src/context/index.ts, src/db/index.ts, src/env/index.ts, src/error/index.ts, src/oauth2/index.ts, src/social-providers/index.ts, src/utils/index.ts, src/db/adapter/index.ts
7
+ ℹ entry: src/index.ts, src/api/index.ts, src/context/index.ts, src/db/index.ts, src/env/index.ts, src/async_hooks/index.ts, src/error/index.ts, src/oauth2/index.ts, src/social-providers/index.ts, src/utils/index.ts, src/db/adapter/index.ts
8
8
  ℹ tsconfig: tsconfig.json
9
9
  ℹ Build start
10
- ℹ dist/social-providers/index.mjs  77.62 kB │ gzip: 10.12 kB
11
- ℹ dist/db/index.mjs  1.64 kB │ gzip: 0.50 kB
10
+ ℹ dist/social-providers/index.mjs  77.61 kB │ gzip: 10.11 kB
11
+ ℹ dist/db/index.mjs  1.57 kB │ gzip: 0.49 kB
12
12
  ℹ dist/api/index.mjs  0.83 kB │ gzip: 0.40 kB
13
13
  ℹ dist/context/index.mjs  0.74 kB │ gzip: 0.27 kB
14
14
  ℹ dist/oauth2/index.mjs  0.61 kB │ gzip: 0.24 kB
@@ -20,23 +20,23 @@
20
20
  ℹ dist/index.mjs  0.01 kB │ gzip: 0.03 kB
21
21
  ℹ dist/oauth2-D4PPavcA.mjs  9.16 kB │ gzip: 2.12 kB
22
22
  ℹ dist/env-YhoEXwYv.mjs  7.67 kB │ gzip: 2.54 kB
23
- ℹ dist/context-DS_VYja7.mjs  3.91 kB │ gzip: 1.03 kB
23
+ ℹ dist/context-CioNtOxg.mjs  3.91 kB │ gzip: 1.03 kB
24
24
  ℹ dist/error-D6EqgOXr.mjs  1.77 kB │ gzip: 0.79 kB
25
25
  ℹ dist/async_hooks-BQqSywfV.mjs  0.87 kB │ gzip: 0.46 kB
26
26
  ℹ dist/utils-BFQCAfNW.mjs  0.13 kB │ gzip: 0.12 kB
27
27
  ℹ dist/social-providers/index.d.mts  3.78 kB │ gzip: 1.17 kB
28
- ℹ dist/context/index.d.mts  2.74 kB │ gzip: 0.79 kB
28
+ ℹ dist/context/index.d.mts  2.74 kB │ gzip: 0.78 kB
29
29
  ℹ dist/error/index.d.mts  1.84 kB │ gzip: 0.72 kB
30
30
  ℹ dist/db/index.d.mts  1.01 kB │ gzip: 0.38 kB
31
31
  ℹ dist/utils/index.d.mts  0.84 kB │ gzip: 0.43 kB
32
32
  ℹ dist/index.d.mts  0.83 kB │ gzip: 0.32 kB
33
- ℹ dist/oauth2/index.d.mts  0.79 kB │ gzip: 0.30 kB
33
+ ℹ dist/oauth2/index.d.mts  0.79 kB │ gzip: 0.29 kB
34
34
  ℹ dist/env/index.d.mts  0.59 kB │ gzip: 0.30 kB
35
- ℹ dist/db/adapter/index.d.mts  0.47 kB │ gzip: 0.22 kB
35
+ ℹ dist/db/adapter/index.d.mts  0.47 kB │ gzip: 0.23 kB
36
36
  ℹ dist/api/index.d.mts  0.29 kB │ gzip: 0.16 kB
37
37
  ℹ dist/async_hooks/index.d.mts  0.14 kB │ gzip: 0.10 kB
38
- ℹ dist/index-_O87hA7T.d.mts 201.05 kB │ gzip: 31.42 kB
38
+ ℹ dist/index-DfNcDLXx.d.mts 201.29 kB │ gzip: 31.53 kB
39
39
  ℹ dist/index-JSfspfWW.d.mts  3.31 kB │ gzip: 1.11 kB
40
40
  ℹ dist/index-CRg-E-VF.d.mts  0.24 kB │ gzip: 0.16 kB
41
- ℹ 31 files, total: 323.70 kB
42
- ✔ Build complete in 4598ms
41
+ ℹ 31 files, total: 323.88 kB
42
+ ✔ Build complete in 4555ms
@@ -1,3 +1,3 @@
1
- import { a as optionsMiddleware, i as createAuthMiddleware, n as AuthMiddleware, r as createAuthEndpoint, t as AuthEndpoint } from "../index-_O87hA7T.mjs";
1
+ import { a as optionsMiddleware, i as createAuthMiddleware, n as AuthMiddleware, r as createAuthEndpoint, t as AuthEndpoint } from "../index-DfNcDLXx.mjs";
2
2
  import "../index-JSfspfWW.mjs";
3
3
  export { AuthEndpoint, AuthMiddleware, createAuthEndpoint, createAuthMiddleware, optionsMiddleware };
@@ -1,5 +1,5 @@
1
1
  import "../async_hooks-BQqSywfV.mjs";
2
- import { f as runWithEndpointContext } from "../context-DS_VYja7.mjs";
2
+ import { f as runWithEndpointContext } from "../context-CioNtOxg.mjs";
3
3
  import { createEndpoint, createMiddleware } from "better-call";
4
4
 
5
5
  //#region src/api/index.ts
@@ -1,4 +1,4 @@
1
- import { Jn as DBTransactionAdapter, Un as DBAdapter, d as AuthContext } from "../index-_O87hA7T.mjs";
1
+ import { Jn as DBTransactionAdapter, Un as DBAdapter, d as AuthContext } from "../index-DfNcDLXx.mjs";
2
2
  import "../index-JSfspfWW.mjs";
3
3
  import { t as AsyncLocalStorage } from "../index-CRg-E-VF.mjs";
4
4
  import { EndpointContext, InputContext } from "better-call";
@@ -1,4 +1,4 @@
1
1
  import "../async_hooks-BQqSywfV.mjs";
2
- import { a as defineRequestState, c as hasRequestState, d as getCurrentAuthContextAsyncLocalStorage, f as runWithEndpointContext, i as runWithTransaction, l as runWithRequestState, n as getCurrentDBAdapterAsyncLocalStorage, o as getCurrentRequestState, r as runWithAdapter, s as getRequestStateAsyncLocalStorage, t as getCurrentAdapter, u as getCurrentAuthContext } from "../context-DS_VYja7.mjs";
2
+ import { a as defineRequestState, c as hasRequestState, d as getCurrentAuthContextAsyncLocalStorage, f as runWithEndpointContext, i as runWithTransaction, l as runWithRequestState, n as getCurrentDBAdapterAsyncLocalStorage, o as getCurrentRequestState, r as runWithAdapter, s as getRequestStateAsyncLocalStorage, t as getCurrentAdapter, u as getCurrentAuthContext } from "../context-CioNtOxg.mjs";
3
3
 
4
4
  export { defineRequestState, getCurrentAdapter, getCurrentAuthContext, getCurrentAuthContextAsyncLocalStorage, getCurrentDBAdapterAsyncLocalStorage, getCurrentRequestState, getRequestStateAsyncLocalStorage, hasRequestState, runWithAdapter, runWithEndpointContext, runWithRequestState, runWithTransaction };
@@ -1,5 +1,5 @@
1
1
  import { t as getAsyncLocalStorage } from "./async_hooks-BQqSywfV.mjs";
2
- import z from "zod";
2
+ import { z } from "zod";
3
3
 
4
4
  //#region src/context/endpoint-context.ts
5
5
  let currentContextAsyncStorage = null;
@@ -1,3 +1,3 @@
1
- import { Gn as DBAdapterFactoryConfig, Hn as CustomAdapter, Jn as DBTransactionAdapter, Kn as DBAdapterInstance, Un as DBAdapter, Vn as CleanedWhere, Wn as DBAdapterDebugLogOption, Yn as Where, qn as DBAdapterSchemaCreation } from "../../index-_O87hA7T.mjs";
1
+ import { Gn as DBAdapterFactoryConfig, Hn as CustomAdapter, Jn as DBTransactionAdapter, Kn as DBAdapterInstance, Un as DBAdapter, Vn as CleanedWhere, Wn as DBAdapterDebugLogOption, Yn as Where, qn as DBAdapterSchemaCreation } from "../../index-DfNcDLXx.mjs";
2
2
  import "../../index-JSfspfWW.mjs";
3
3
  export { CleanedWhere, CustomAdapter, DBAdapter, DBAdapterDebugLogOption, DBAdapterFactoryConfig, DBAdapterInstance, DBAdapterSchemaCreation, DBTransactionAdapter, Where };
@@ -1,3 +1,3 @@
1
- import { $n as FieldAttributeConfig, Qn as FieldAttribute, Xn as AuthPluginSchema, Zn as BetterAuthDbSchema, _r as DBFieldType, ar as userSchema, br as SecondaryStorage, cr as sessionSchema, dr as Account, er as FieldType, fr as accountSchema, gr as DBFieldAttributeConfig, hr as DBFieldAttribute, ir as User, lr as RateLimit, mr as BetterAuthDBSchema, nr as Verification, or as coreSchema, pr as BetterAuthPluginDBSchema, rr as verificationSchema, sr as Session, tr as Primitive, ur as rateLimitSchema, vr as DBPreservedModels, yr as DBPrimitive } from "../index-_O87hA7T.mjs";
1
+ import { $n as FieldAttributeConfig, Qn as FieldAttribute, Xn as AuthPluginSchema, Zn as BetterAuthDbSchema, _r as DBFieldType, ar as userSchema, br as SecondaryStorage, cr as sessionSchema, dr as Account, er as FieldType, fr as accountSchema, gr as DBFieldAttributeConfig, hr as DBFieldAttribute, ir as User, lr as RateLimit, mr as BetterAuthDBSchema, nr as Verification, or as coreSchema, pr as BetterAuthPluginDBSchema, rr as verificationSchema, sr as Session, tr as Primitive, ur as rateLimitSchema, vr as DBPreservedModels, yr as DBPrimitive } from "../index-DfNcDLXx.mjs";
2
2
  import "../index-JSfspfWW.mjs";
3
3
  export { Account, AuthPluginSchema, BetterAuthDBSchema, BetterAuthDbSchema, BetterAuthPluginDBSchema, DBFieldAttribute, DBFieldAttributeConfig, DBFieldType, DBPreservedModels, DBPrimitive, FieldAttribute, FieldAttributeConfig, FieldType, Primitive, RateLimit, SecondaryStorage, Session, User, Verification, accountSchema, coreSchema, rateLimitSchema, sessionSchema, userSchema, verificationSchema };
package/dist/db/index.mjs CHANGED
@@ -1,60 +1,60 @@
1
- import * as z$1 from "zod";
1
+ import { z } from "zod";
2
2
 
3
3
  //#region src/db/schema/shared.ts
4
- const coreSchema = z$1.object({
5
- id: z$1.string(),
6
- createdAt: z$1.date().default(() => /* @__PURE__ */ new Date()),
7
- updatedAt: z$1.date().default(() => /* @__PURE__ */ new Date())
4
+ const coreSchema = z.object({
5
+ id: z.string(),
6
+ createdAt: z.date().default(() => /* @__PURE__ */ new Date()),
7
+ updatedAt: z.date().default(() => /* @__PURE__ */ new Date())
8
8
  });
9
9
 
10
10
  //#endregion
11
11
  //#region src/db/schema/account.ts
12
12
  const accountSchema = coreSchema.extend({
13
- providerId: z$1.string(),
14
- accountId: z$1.string(),
15
- userId: z$1.coerce.string(),
16
- accessToken: z$1.string().nullish(),
17
- refreshToken: z$1.string().nullish(),
18
- idToken: z$1.string().nullish(),
19
- accessTokenExpiresAt: z$1.date().nullish(),
20
- refreshTokenExpiresAt: z$1.date().nullish(),
21
- scope: z$1.string().nullish(),
22
- password: z$1.string().nullish()
13
+ providerId: z.string(),
14
+ accountId: z.string(),
15
+ userId: z.coerce.string(),
16
+ accessToken: z.string().nullish(),
17
+ refreshToken: z.string().nullish(),
18
+ idToken: z.string().nullish(),
19
+ accessTokenExpiresAt: z.date().nullish(),
20
+ refreshTokenExpiresAt: z.date().nullish(),
21
+ scope: z.string().nullish(),
22
+ password: z.string().nullish()
23
23
  });
24
24
 
25
25
  //#endregion
26
26
  //#region src/db/schema/rate-limit.ts
27
- const rateLimitSchema = z$1.object({
28
- key: z$1.string(),
29
- count: z$1.number(),
30
- lastRequest: z$1.number()
27
+ const rateLimitSchema = z.object({
28
+ key: z.string(),
29
+ count: z.number(),
30
+ lastRequest: z.number()
31
31
  });
32
32
 
33
33
  //#endregion
34
34
  //#region src/db/schema/session.ts
35
35
  const sessionSchema = coreSchema.extend({
36
- userId: z$1.coerce.string(),
37
- expiresAt: z$1.date(),
38
- token: z$1.string(),
39
- ipAddress: z$1.string().nullish(),
40
- userAgent: z$1.string().nullish()
36
+ userId: z.coerce.string(),
37
+ expiresAt: z.date(),
38
+ token: z.string(),
39
+ ipAddress: z.string().nullish(),
40
+ userAgent: z.string().nullish()
41
41
  });
42
42
 
43
43
  //#endregion
44
44
  //#region src/db/schema/user.ts
45
45
  const userSchema = coreSchema.extend({
46
- email: z$1.string().transform((val) => val.toLowerCase()),
47
- emailVerified: z$1.boolean().default(false),
48
- name: z$1.string(),
49
- image: z$1.string().nullish()
46
+ email: z.string().transform((val) => val.toLowerCase()),
47
+ emailVerified: z.boolean().default(false),
48
+ name: z.string(),
49
+ image: z.string().nullish()
50
50
  });
51
51
 
52
52
  //#endregion
53
53
  //#region src/db/schema/verification.ts
54
54
  const verificationSchema = coreSchema.extend({
55
- value: z$1.string(),
56
- expiresAt: z$1.date(),
57
- identifier: z$1.string()
55
+ value: z.string(),
56
+ expiresAt: z.date(),
57
+ identifier: z.string()
58
58
  });
59
59
 
60
60
  //#endregion
@@ -1,7 +1,7 @@
1
1
  import { i as Logger, o as createLogger } from "./index-JSfspfWW.mjs";
2
2
  import * as better_call0 from "better-call";
3
3
  import { CookieOptions, Endpoint, EndpointContext, EndpointOptions, InputContext, Middleware } from "better-call";
4
- import * as z$1 from "zod";
4
+ import { z } from "zod";
5
5
  import { BetterFetch, BetterFetchOption, BetterFetchPlugin } from "@better-fetch/fetch";
6
6
  import * as jose0 from "jose";
7
7
  import { StandardSchemaV1, StandardSchemaV1 as StandardSchemaV1$1 } from "@standard-schema/spec";
@@ -152,96 +152,96 @@ type BetterAuthPluginDBSchema = { [table in string]: {
152
152
  } };
153
153
  //#endregion
154
154
  //#region src/db/schema/account.d.ts
155
- declare const accountSchema: z$1.ZodObject<{
156
- id: z$1.ZodString;
157
- createdAt: z$1.ZodDefault<z$1.ZodDate>;
158
- updatedAt: z$1.ZodDefault<z$1.ZodDate>;
159
- providerId: z$1.ZodString;
160
- accountId: z$1.ZodString;
161
- userId: z$1.ZodCoercedString<unknown>;
162
- accessToken: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
163
- refreshToken: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
164
- idToken: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
165
- accessTokenExpiresAt: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodDate>>;
166
- refreshTokenExpiresAt: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodDate>>;
167
- scope: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
168
- password: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
169
- }, z$1.core.$strip>;
155
+ declare const accountSchema: z.ZodObject<{
156
+ id: z.ZodString;
157
+ createdAt: z.ZodDefault<z.ZodDate>;
158
+ updatedAt: z.ZodDefault<z.ZodDate>;
159
+ providerId: z.ZodString;
160
+ accountId: z.ZodString;
161
+ userId: z.ZodCoercedString<unknown>;
162
+ accessToken: z.ZodOptional<z.ZodNullable<z.ZodString>>;
163
+ refreshToken: z.ZodOptional<z.ZodNullable<z.ZodString>>;
164
+ idToken: z.ZodOptional<z.ZodNullable<z.ZodString>>;
165
+ accessTokenExpiresAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
166
+ refreshTokenExpiresAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
167
+ scope: z.ZodOptional<z.ZodNullable<z.ZodString>>;
168
+ password: z.ZodOptional<z.ZodNullable<z.ZodString>>;
169
+ }, z.core.$strip>;
170
170
  /**
171
171
  * Account schema type used by better-auth, note that it's possible that account could have additional fields
172
172
  *
173
173
  * todo: we should use generics to extend this type with additional fields from plugins and options in the future
174
174
  */
175
- type Account = z$1.infer<typeof accountSchema>;
175
+ type Account = z.infer<typeof accountSchema>;
176
176
  //#endregion
177
177
  //#region src/db/schema/rate-limit.d.ts
178
- declare const rateLimitSchema: z$1.ZodObject<{
179
- key: z$1.ZodString;
180
- count: z$1.ZodNumber;
181
- lastRequest: z$1.ZodNumber;
182
- }, z$1.core.$strip>;
178
+ declare const rateLimitSchema: z.ZodObject<{
179
+ key: z.ZodString;
180
+ count: z.ZodNumber;
181
+ lastRequest: z.ZodNumber;
182
+ }, z.core.$strip>;
183
183
  /**
184
184
  * Rate limit schema type used by better-auth for rate limiting
185
185
  */
186
- type RateLimit = z$1.infer<typeof rateLimitSchema>;
186
+ type RateLimit = z.infer<typeof rateLimitSchema>;
187
187
  //#endregion
188
188
  //#region src/db/schema/session.d.ts
189
- declare const sessionSchema: z$1.ZodObject<{
190
- id: z$1.ZodString;
191
- createdAt: z$1.ZodDefault<z$1.ZodDate>;
192
- updatedAt: z$1.ZodDefault<z$1.ZodDate>;
193
- userId: z$1.ZodCoercedString<unknown>;
194
- expiresAt: z$1.ZodDate;
195
- token: z$1.ZodString;
196
- ipAddress: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
197
- userAgent: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
198
- }, z$1.core.$strip>;
189
+ declare const sessionSchema: z.ZodObject<{
190
+ id: z.ZodString;
191
+ createdAt: z.ZodDefault<z.ZodDate>;
192
+ updatedAt: z.ZodDefault<z.ZodDate>;
193
+ userId: z.ZodCoercedString<unknown>;
194
+ expiresAt: z.ZodDate;
195
+ token: z.ZodString;
196
+ ipAddress: z.ZodOptional<z.ZodNullable<z.ZodString>>;
197
+ userAgent: z.ZodOptional<z.ZodNullable<z.ZodString>>;
198
+ }, z.core.$strip>;
199
199
  /**
200
200
  * Session schema type used by better-auth, note that it's possible that session could have additional fields
201
201
  *
202
202
  * todo: we should use generics to extend this type with additional fields from plugins and options in the future
203
203
  */
204
- type Session = z$1.infer<typeof sessionSchema>;
204
+ type Session = z.infer<typeof sessionSchema>;
205
205
  //#endregion
206
206
  //#region src/db/schema/shared.d.ts
207
- declare const coreSchema: z$1.ZodObject<{
208
- id: z$1.ZodString;
209
- createdAt: z$1.ZodDefault<z$1.ZodDate>;
210
- updatedAt: z$1.ZodDefault<z$1.ZodDate>;
211
- }, z$1.core.$strip>;
207
+ declare const coreSchema: z.ZodObject<{
208
+ id: z.ZodString;
209
+ createdAt: z.ZodDefault<z.ZodDate>;
210
+ updatedAt: z.ZodDefault<z.ZodDate>;
211
+ }, z.core.$strip>;
212
212
  //#endregion
213
213
  //#region src/db/schema/user.d.ts
214
- declare const userSchema: z$1.ZodObject<{
215
- id: z$1.ZodString;
216
- createdAt: z$1.ZodDefault<z$1.ZodDate>;
217
- updatedAt: z$1.ZodDefault<z$1.ZodDate>;
218
- email: z$1.ZodPipe<z$1.ZodString, z$1.ZodTransform<string, string>>;
219
- emailVerified: z$1.ZodDefault<z$1.ZodBoolean>;
220
- name: z$1.ZodString;
221
- image: z$1.ZodOptional<z$1.ZodNullable<z$1.ZodString>>;
222
- }, z$1.core.$strip>;
214
+ declare const userSchema: z.ZodObject<{
215
+ id: z.ZodString;
216
+ createdAt: z.ZodDefault<z.ZodDate>;
217
+ updatedAt: z.ZodDefault<z.ZodDate>;
218
+ email: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
219
+ emailVerified: z.ZodDefault<z.ZodBoolean>;
220
+ name: z.ZodString;
221
+ image: z.ZodOptional<z.ZodNullable<z.ZodString>>;
222
+ }, z.core.$strip>;
223
223
  /**
224
224
  * User schema type used by better-auth, note that it's possible that user could have additional fields
225
225
  *
226
226
  * todo: we should use generics to extend this type with additional fields from plugins and options in the future
227
227
  */
228
- type User = z$1.infer<typeof userSchema>;
228
+ type User = z.infer<typeof userSchema>;
229
229
  //#endregion
230
230
  //#region src/db/schema/verification.d.ts
231
- declare const verificationSchema: z$1.ZodObject<{
232
- id: z$1.ZodString;
233
- createdAt: z$1.ZodDefault<z$1.ZodDate>;
234
- updatedAt: z$1.ZodDefault<z$1.ZodDate>;
235
- value: z$1.ZodString;
236
- expiresAt: z$1.ZodDate;
237
- identifier: z$1.ZodString;
238
- }, z$1.core.$strip>;
231
+ declare const verificationSchema: z.ZodObject<{
232
+ id: z.ZodString;
233
+ createdAt: z.ZodDefault<z.ZodDate>;
234
+ updatedAt: z.ZodDefault<z.ZodDate>;
235
+ value: z.ZodString;
236
+ expiresAt: z.ZodDate;
237
+ identifier: z.ZodString;
238
+ }, z.core.$strip>;
239
239
  /**
240
240
  * Verification schema type used by better-auth, note that it's possible that verification could have additional fields
241
241
  *
242
242
  * todo: we should use generics to extend this type with additional fields from plugins and options in the future
243
243
  */
244
- type Verification = z$1.infer<typeof verificationSchema>;
244
+ type Verification = z.infer<typeof verificationSchema>;
245
245
  //#endregion
246
246
  //#region src/db/index.d.ts
247
247
  /**
@@ -5689,8 +5689,8 @@ declare const socialProviders: {
5689
5689
  };
5690
5690
  };
5691
5691
  declare const socialProviderList: ["github", ...(keyof typeof socialProviders)[]];
5692
- declare const SocialProviderListEnum: z$1.ZodType<SocialProviderList[number] | (string & {})>;
5693
- type SocialProvider = z$1.infer<typeof SocialProviderListEnum>;
5692
+ declare const SocialProviderListEnum: z.ZodType<SocialProviderList[number] | (string & {})>;
5693
+ type SocialProvider = z.infer<typeof SocialProviderListEnum>;
5694
5694
  type SocialProviders = { [K in SocialProviderList[number]]?: Parameters<(typeof socialProviders)[K]>[0] & {
5695
5695
  enabled?: boolean | undefined;
5696
5696
  } };
@@ -5988,15 +5988,27 @@ type BetterAuthAdvancedOptions = {
5988
5988
  * Note: If enabled, we will not handle ID generation (including if you use `generateId`), and it would be expected that your database will provide the ID automatically.
5989
5989
  *
5990
5990
  * @default false
5991
+ *
5992
+ * @deprecated Please use `generateId` instead. This will be removed in future
5993
+ * releases.
5991
5994
  */
5992
5995
  useNumberId?: boolean;
5993
5996
  /**
5994
5997
  * Custom generateId function.
5995
5998
  *
5996
5999
  * If not provided, random ids will be generated.
5997
- * If set to false, the database's auto generated id will be used.
6000
+ * If set to false, the database's auto generated id
6001
+ * will be used.
6002
+ *
6003
+ * If set to "serial", the database's auto generated
6004
+ * id will be used.
6005
+ *
6006
+ * If set to "uuid", we generate a random UUID for
6007
+ * the id. If postgres, we use the `gen_random_uuid()
6008
+ * ` function. If mysql or mssql, we use the `uuid()`
6009
+ * function.
5998
6010
  */
5999
- generateId?: GenerateIdFn | false;
6011
+ generateId?: GenerateIdFn | false | "serial" | "uuid";
6000
6012
  } | undefined;
6001
6013
  /**
6002
6014
  * OAuth configuration
@@ -6092,7 +6104,8 @@ type BetterAuthOptions = {
6092
6104
  * Whether to execute multiple operations in a transaction.
6093
6105
  * If the database doesn't support transactions,
6094
6106
  * set this to `false` and operations will be executed sequentially.
6095
- * @default true
6107
+ *
6108
+ * @default false
6096
6109
  */
6097
6110
  transaction?: boolean;
6098
6111
  } | {
@@ -6120,7 +6133,8 @@ type BetterAuthOptions = {
6120
6133
  * Whether to execute multiple operations in a transaction.
6121
6134
  * If the database doesn't support transactions,
6122
6135
  * set this to `false` and operations will be executed sequentially.
6123
- * @default true
6136
+ *
6137
+ * @default false
6124
6138
  */
6125
6139
  transaction?: boolean;
6126
6140
  }) | undefined;
package/dist/index.d.mts CHANGED
@@ -1,3 +1,3 @@
1
- import { En as BetterAuthCookies, Tn as LiteralUnion, _ as GenerateIdFn, c as BetterAuthClientPlugin, d as AuthContext, f as GenericEndpointContext, g as BetterAuthRateLimitOptions, h as BetterAuthOptions, l as ClientAtomListener, m as BetterAuthAdvancedOptions, o as StandardSchemaV1, p as InternalAdapter, s as BetterAuthClientOptions, u as ClientStore, v as BetterAuthPlugin, wn as LiteralString, y as HookEndpointContext } from "./index-_O87hA7T.mjs";
1
+ import { En as BetterAuthCookies, Tn as LiteralUnion, _ as GenerateIdFn, c as BetterAuthClientPlugin, d as AuthContext, f as GenericEndpointContext, g as BetterAuthRateLimitOptions, h as BetterAuthOptions, l as ClientAtomListener, m as BetterAuthAdvancedOptions, o as StandardSchemaV1, p as InternalAdapter, s as BetterAuthClientOptions, u as ClientStore, v as BetterAuthPlugin, wn as LiteralString, y as HookEndpointContext } from "./index-DfNcDLXx.mjs";
2
2
  import "./index-JSfspfWW.mjs";
3
3
  export { AuthContext, BetterAuthAdvancedOptions, BetterAuthClientOptions, BetterAuthClientPlugin, BetterAuthCookies, BetterAuthOptions, BetterAuthPlugin, BetterAuthRateLimitOptions, ClientAtomListener, ClientStore, GenerateIdFn, GenericEndpointContext, HookEndpointContext, InternalAdapter, LiteralString, LiteralUnion, StandardSchemaV1 };
@@ -1,3 +1,3 @@
1
- import { An as generateCodeChallenge, Bn as ProviderOptions, Dn as createAuthorizationCodeRequest, Fn as clientCredentialsToken, In as createClientCredentialsTokenRequest, Ln as OAuth2Tokens, Mn as createRefreshAccessTokenRequest, Nn as refreshAccessToken, On as validateAuthorizationCode, Pn as createAuthorizationURL, Rn as OAuth2UserInfo, jn as getOAuth2Tokens, kn as validateToken, zn as OAuthProvider } from "../index-_O87hA7T.mjs";
1
+ import { An as generateCodeChallenge, Bn as ProviderOptions, Dn as createAuthorizationCodeRequest, Fn as clientCredentialsToken, In as createClientCredentialsTokenRequest, Ln as OAuth2Tokens, Mn as createRefreshAccessTokenRequest, Nn as refreshAccessToken, On as validateAuthorizationCode, Pn as createAuthorizationURL, Rn as OAuth2UserInfo, jn as getOAuth2Tokens, kn as validateToken, zn as OAuthProvider } from "../index-DfNcDLXx.mjs";
2
2
  import "../index-JSfspfWW.mjs";
3
3
  export { OAuth2Tokens, OAuth2UserInfo, OAuthProvider, ProviderOptions, clientCredentialsToken, createAuthorizationCodeRequest, createAuthorizationURL, createClientCredentialsTokenRequest, createRefreshAccessTokenRequest, generateCodeChallenge, getOAuth2Tokens, refreshAccessToken, validateAuthorizationCode, validateToken };
@@ -1,3 +1,3 @@
1
- import { $ as ZoomOptions, $t as microsoft, A as PayPalProfile, At as DropboxOptions, B as NaverOptions, Bt as SpotifyProfile, C as SocialProviders, Cn as getApplePublicKey, Ct as LinearOptions, D as PolarProfile, Dt as KickOptions, E as PolarOptions, Et as linear, F as paybin, Ft as twitter, G as kakao, Gt as HuggingFaceOptions, H as naver, Ht as SlackOptions, I as LineIdTokenPayload, It as TwitchOptions, J as notion, Jt as GoogleOptions, K as NotionOptions, Kt as HuggingFaceProfile, L as LineOptions, Lt as TwitchProfile, M as paypal, Mt as dropbox, N as PaybinOptions, Nt as TwitterOption, O as polar, Ot as KickProfile, P as PaybinProfile, Pt as TwitterProfile, Q as PronounOption, Qt as MicrosoftOptions, R as LineUserInfo, Rt as twitch, S as SocialProviderListEnum, Sn as apple, St as linkedin, T as socialProviders, Tt as LinearUser, U as KakaoOptions, Ut as SlackProfile, V as NaverProfile, Vt as spotify, W as KakaoProfile, Wt as slack, X as LoginType, Xt as google, Y as AccountStatus, Yt as GoogleProfile, Z as PhoneNumber, Zt as MicrosoftEntraIDProfile, _n as AtlassianProfile, _t as GitlabOptions, an as figma, at as SalesforceOptions, b as SocialProvider, bn as AppleOptions, bt as LinkedInOptions, cn as facebook, ct as RobloxOptions, dn as discord, dt as RedditOptions, en as GithubOptions, et as ZoomProfile, fn as CognitoOptions, ft as RedditProfile, gn as AtlassianOptions, gt as tiktok, hn as getCognitoPublicKey, ht as TiktokProfile, in as FigmaProfile, it as vk, j as PayPalTokenResponse, jt as DropboxProfile, k as PayPalOptions, kt as kick, ln as DiscordOptions, lt as RobloxProfile, mn as cognito, mt as TiktokOptions, nn as github, nt as VkOption, on as FacebookOptions, ot as SalesforceProfile, pn as CognitoProfile, pt as reddit, q as NotionProfile, qt as huggingface, rn as FigmaOptions, rt as VkProfile, sn as FacebookProfile, st as salesforce, tn as GithubProfile, tt as zoom, un as DiscordProfile, ut as roblox, vn as atlassian, vt as GitlabProfile, w as socialProviderList, wt as LinearProfile, x as SocialProviderList, xn as AppleProfile, xt as LinkedInProfile, yn as AppleNonConformUser, yt as gitlab, z as line, zt as SpotifyOptions } from "../index-_O87hA7T.mjs";
1
+ import { $ as ZoomOptions, $t as microsoft, A as PayPalProfile, At as DropboxOptions, B as NaverOptions, Bt as SpotifyProfile, C as SocialProviders, Cn as getApplePublicKey, Ct as LinearOptions, D as PolarProfile, Dt as KickOptions, E as PolarOptions, Et as linear, F as paybin, Ft as twitter, G as kakao, Gt as HuggingFaceOptions, H as naver, Ht as SlackOptions, I as LineIdTokenPayload, It as TwitchOptions, J as notion, Jt as GoogleOptions, K as NotionOptions, Kt as HuggingFaceProfile, L as LineOptions, Lt as TwitchProfile, M as paypal, Mt as dropbox, N as PaybinOptions, Nt as TwitterOption, O as polar, Ot as KickProfile, P as PaybinProfile, Pt as TwitterProfile, Q as PronounOption, Qt as MicrosoftOptions, R as LineUserInfo, Rt as twitch, S as SocialProviderListEnum, Sn as apple, St as linkedin, T as socialProviders, Tt as LinearUser, U as KakaoOptions, Ut as SlackProfile, V as NaverProfile, Vt as spotify, W as KakaoProfile, Wt as slack, X as LoginType, Xt as google, Y as AccountStatus, Yt as GoogleProfile, Z as PhoneNumber, Zt as MicrosoftEntraIDProfile, _n as AtlassianProfile, _t as GitlabOptions, an as figma, at as SalesforceOptions, b as SocialProvider, bn as AppleOptions, bt as LinkedInOptions, cn as facebook, ct as RobloxOptions, dn as discord, dt as RedditOptions, en as GithubOptions, et as ZoomProfile, fn as CognitoOptions, ft as RedditProfile, gn as AtlassianOptions, gt as tiktok, hn as getCognitoPublicKey, ht as TiktokProfile, in as FigmaProfile, it as vk, j as PayPalTokenResponse, jt as DropboxProfile, k as PayPalOptions, kt as kick, ln as DiscordOptions, lt as RobloxProfile, mn as cognito, mt as TiktokOptions, nn as github, nt as VkOption, on as FacebookOptions, ot as SalesforceProfile, pn as CognitoProfile, pt as reddit, q as NotionProfile, qt as huggingface, rn as FigmaOptions, rt as VkProfile, sn as FacebookProfile, st as salesforce, tn as GithubProfile, tt as zoom, un as DiscordProfile, ut as roblox, vn as atlassian, vt as GitlabProfile, w as socialProviderList, wt as LinearProfile, x as SocialProviderList, xn as AppleProfile, xt as LinkedInProfile, yn as AppleNonConformUser, yt as gitlab, z as line, zt as SpotifyOptions } from "../index-DfNcDLXx.mjs";
2
2
  import "../index-JSfspfWW.mjs";
3
3
  export { AccountStatus, AppleNonConformUser, AppleOptions, AppleProfile, AtlassianOptions, AtlassianProfile, CognitoOptions, CognitoProfile, DiscordOptions, DiscordProfile, DropboxOptions, DropboxProfile, FacebookOptions, FacebookProfile, FigmaOptions, FigmaProfile, GithubOptions, GithubProfile, GitlabOptions, GitlabProfile, GoogleOptions, GoogleProfile, HuggingFaceOptions, HuggingFaceProfile, KakaoOptions, KakaoProfile, KickOptions, KickProfile, LineIdTokenPayload, LineOptions, LineUserInfo, LinearOptions, LinearProfile, LinearUser, LinkedInOptions, LinkedInProfile, LoginType, MicrosoftEntraIDProfile, MicrosoftOptions, NaverOptions, NaverProfile, NotionOptions, NotionProfile, PayPalOptions, PayPalProfile, PayPalTokenResponse, PaybinOptions, PaybinProfile, PhoneNumber, PolarOptions, PolarProfile, PronounOption, RedditOptions, RedditProfile, RobloxOptions, RobloxProfile, SalesforceOptions, SalesforceProfile, SlackOptions, SlackProfile, SocialProvider, SocialProviderList, SocialProviderListEnum, SocialProviders, SpotifyOptions, SpotifyProfile, TiktokOptions, TiktokProfile, TwitchOptions, TwitchProfile, TwitterOption, TwitterProfile, VkOption, VkProfile, ZoomOptions, ZoomProfile, apple, atlassian, cognito, discord, dropbox, facebook, figma, getApplePublicKey, getCognitoPublicKey, github, gitlab, google, huggingface, kakao, kick, line, linear, linkedin, microsoft, naver, notion, paybin, paypal, polar, reddit, roblox, salesforce, slack, socialProviderList, socialProviders, spotify, tiktok, twitch, twitter, vk, zoom };
@@ -3,7 +3,7 @@ import "../utils-BFQCAfNW.mjs";
3
3
  import { t as BetterAuthError } from "../error-D6EqgOXr.mjs";
4
4
  import { a as refreshAccessToken, c as getOAuth2Tokens, n as validateAuthorizationCode, o as createAuthorizationURL, s as generateCodeChallenge } from "../oauth2-D4PPavcA.mjs";
5
5
  import { APIError } from "better-call";
6
- import * as z$1 from "zod";
6
+ import { z } from "zod";
7
7
  import { base64 } from "@better-auth/utils/base64";
8
8
  import { betterFetch } from "@better-fetch/fetch";
9
9
  import { createRemoteJWKSet, decodeJwt, decodeProtectedHeader, importJWK, jwtVerify } from "jose";
@@ -2507,7 +2507,7 @@ const socialProviders = {
2507
2507
  polar
2508
2508
  };
2509
2509
  const socialProviderList = Object.keys(socialProviders);
2510
- const SocialProviderListEnum = z$1.enum(socialProviderList).or(z$1.string());
2510
+ const SocialProviderListEnum = z.enum(socialProviderList).or(z.string());
2511
2511
 
2512
2512
  //#endregion
2513
2513
  export { SocialProviderListEnum, apple, atlassian, cognito, discord, dropbox, facebook, figma, getApplePublicKey, getCognitoPublicKey, github, gitlab, google, huggingface, kakao, kick, line, linear, linkedin, microsoft, naver, notion, paybin, paypal, polar, reddit, roblox, salesforce, slack, socialProviderList, socialProviders, spotify, tiktok, twitch, twitter, vk, zoom };
package/package.json CHANGED
@@ -1,63 +1,63 @@
1
1
  {
2
2
  "name": "@better-auth/core",
3
- "version": "1.4.0-beta.18",
3
+ "version": "1.4.0-beta.19",
4
4
  "description": "The most comprehensive authentication framework for TypeScript.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.mjs",
7
7
  "module": "./dist/index.mjs",
8
8
  "exports": {
9
9
  ".": {
10
- "better-auth-dev-source": "./src/index.ts",
10
+ "dev-source": "./src/index.ts",
11
11
  "types": "./dist/index.d.mts",
12
12
  "default": "./dist/index.mjs"
13
13
  },
14
14
  "./api": {
15
- "better-auth-dev-source": "./src/api/index.ts",
15
+ "dev-source": "./src/api/index.ts",
16
16
  "types": "./dist/api/index.d.mts",
17
17
  "default": "./dist/api/index.mjs"
18
18
  },
19
19
  "./async_hooks": {
20
- "better-auth-dev-source": "./src/async_hooks/index.ts",
20
+ "dev-source": "./src/async_hooks/index.ts",
21
21
  "types": "./dist/async_hooks/index.d.mts",
22
22
  "default": "./dist/async_hooks/index.mjs"
23
23
  },
24
24
  "./context": {
25
- "better-auth-dev-source": "./src/context/index.ts",
25
+ "dev-source": "./src/context/index.ts",
26
26
  "types": "./dist/context/index.d.mts",
27
27
  "default": "./dist/context/index.mjs"
28
28
  },
29
29
  "./env": {
30
- "better-auth-dev-source": "./src/env/index.ts",
30
+ "dev-source": "./src/env/index.ts",
31
31
  "types": "./dist/env/index.d.mts",
32
32
  "default": "./dist/env/index.mjs"
33
33
  },
34
34
  "./error": {
35
- "better-auth-dev-source": "./src/error/index.ts",
35
+ "dev-source": "./src/error/index.ts",
36
36
  "types": "./dist/error/index.d.mts",
37
37
  "default": "./dist/error/index.mjs"
38
38
  },
39
39
  "./utils": {
40
- "better-auth-dev-source": "./src/utils/index.ts",
40
+ "dev-source": "./src/utils/index.ts",
41
41
  "types": "./dist/utils/index.d.mts",
42
42
  "default": "./dist/utils/index.mjs"
43
43
  },
44
44
  "./social-providers": {
45
- "better-auth-dev-source": "./src/social-providers/index.ts",
45
+ "dev-source": "./src/social-providers/index.ts",
46
46
  "types": "./dist/social-providers/index.d.mts",
47
47
  "default": "./dist/social-providers/index.mjs"
48
48
  },
49
49
  "./db": {
50
- "better-auth-dev-source": "./src/db/index.ts",
50
+ "dev-source": "./src/db/index.ts",
51
51
  "types": "./dist/db/index.d.mts",
52
52
  "default": "./dist/db/index.mjs"
53
53
  },
54
54
  "./db/adapter": {
55
- "better-auth-dev-source": "./src/db/adapter/index.ts",
55
+ "dev-source": "./src/db/adapter/index.ts",
56
56
  "types": "./dist/db/adapter/index.d.mts",
57
57
  "default": "./dist/db/adapter/index.mjs"
58
58
  },
59
59
  "./oauth2": {
60
- "better-auth-dev-source": "./src/oauth2/index.ts",
60
+ "dev-source": "./src/oauth2/index.ts",
61
61
  "types": "./dist/oauth2/index.d.mts",
62
62
  "default": "./dist/oauth2/index.mjs"
63
63
  }
@@ -112,7 +112,7 @@
112
112
  },
113
113
  "dependencies": {
114
114
  "@standard-schema/spec": "^1.0.0",
115
- "zod": "^4.1.5"
115
+ "zod": "^4.1.12"
116
116
  },
117
117
  "peerDependencies": {
118
118
  "@better-auth/utils": "0.3.0",
@@ -1,5 +1,5 @@
1
1
  import { describe, expect, it } from "vitest";
2
- import z from "zod";
2
+ import { z } from "zod";
3
3
  import {
4
4
  defineRequestState,
5
5
  getCurrentRequestState,
@@ -1,5 +1,5 @@
1
1
  import type { StandardSchemaV1 } from "@standard-schema/spec";
2
- import z from "zod";
2
+ import { z } from "zod";
3
3
  import { type AsyncLocalStorage, getAsyncLocalStorage } from "../async_hooks";
4
4
 
5
5
  export type RequestStateWeakMap = WeakMap<StandardSchemaV1, any>;
@@ -1,4 +1,4 @@
1
- import * as z from "zod";
1
+ import { z } from "zod";
2
2
  import { coreSchema } from "./shared";
3
3
 
4
4
  export const accountSchema = coreSchema.extend({
@@ -1,4 +1,4 @@
1
- import * as z from "zod";
1
+ import { z } from "zod";
2
2
 
3
3
  export const rateLimitSchema = z.object({
4
4
  /**
@@ -1,4 +1,4 @@
1
- import * as z from "zod";
1
+ import { z } from "zod";
2
2
  import { coreSchema } from "./shared";
3
3
 
4
4
  export const sessionSchema = coreSchema.extend({
@@ -1,4 +1,4 @@
1
- import * as z from "zod";
1
+ import { z } from "zod";
2
2
 
3
3
  export const coreSchema = z.object({
4
4
  id: z.string(),
@@ -1,4 +1,4 @@
1
- import * as z from "zod";
1
+ import { z } from "zod";
2
2
  import { coreSchema } from "./shared";
3
3
 
4
4
  export const userSchema = coreSchema.extend({
@@ -1,4 +1,4 @@
1
- import * as z from "zod";
1
+ import { z } from "zod";
2
2
  import { coreSchema } from "./shared";
3
3
 
4
4
  export const verificationSchema = coreSchema.extend({
@@ -1,4 +1,4 @@
1
- import * as z from "zod";
1
+ import { z } from "zod";
2
2
  import { apple } from "./apple";
3
3
  import { atlassian } from "./atlassian";
4
4
  import { cognito } from "./cognito";
@@ -233,15 +233,27 @@ export type BetterAuthAdvancedOptions = {
233
233
  * Note: If enabled, we will not handle ID generation (including if you use `generateId`), and it would be expected that your database will provide the ID automatically.
234
234
  *
235
235
  * @default false
236
+ *
237
+ * @deprecated Please use `generateId` instead. This will be removed in future
238
+ * releases.
236
239
  */
237
240
  useNumberId?: boolean;
238
241
  /**
239
242
  * Custom generateId function.
240
243
  *
241
244
  * If not provided, random ids will be generated.
242
- * If set to false, the database's auto generated id will be used.
245
+ * If set to false, the database's auto generated id
246
+ * will be used.
247
+ *
248
+ * If set to "serial", the database's auto generated
249
+ * id will be used.
250
+ *
251
+ * If set to "uuid", we generate a random UUID for
252
+ * the id. If postgres, we use the `gen_random_uuid()
253
+ * ` function. If mysql or mssql, we use the `uuid()`
254
+ * function.
243
255
  */
244
- generateId?: GenerateIdFn | false;
256
+ generateId?: GenerateIdFn | false | "serial" | "uuid";
245
257
  }
246
258
  | undefined;
247
259
  /**
@@ -350,7 +362,8 @@ export type BetterAuthOptions = {
350
362
  * Whether to execute multiple operations in a transaction.
351
363
  * If the database doesn't support transactions,
352
364
  * set this to `false` and operations will be executed sequentially.
353
- * @default true
365
+ *
366
+ * @default false
354
367
  */
355
368
  transaction?: boolean;
356
369
  }
@@ -379,7 +392,8 @@ export type BetterAuthOptions = {
379
392
  * Whether to execute multiple operations in a transaction.
380
393
  * If the database doesn't support transactions,
381
394
  * set this to `false` and operations will be executed sequentially.
382
- * @default true
395
+ *
396
+ * @default false
383
397
  */
384
398
  transaction?: boolean;
385
399
  }