@better-auth/core 1.4.0-beta.13 → 1.4.0-beta.14

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 (91) hide show
  1. package/.turbo/turbo-build.log +37 -45
  2. package/dist/api/index.cjs +1 -1
  3. package/dist/api/index.d.cts +2 -6
  4. package/dist/api/index.d.ts +2 -6
  5. package/dist/api/index.js +1 -1
  6. package/dist/async_hooks/index.d.cts +1 -1
  7. package/dist/async_hooks/index.d.ts +1 -1
  8. package/dist/context/index.cjs +1 -1
  9. package/dist/context/index.d.cts +14 -18
  10. package/dist/context/index.d.ts +14 -18
  11. package/dist/context/index.js +1 -1
  12. package/dist/{context-Bm0rm76r.js → context-BAOGRjRS.js} +30 -30
  13. package/dist/{context-7VgEbfs3.cjs → context-BRDf96na.cjs} +29 -29
  14. package/dist/db/adapter/index.d.cts +2 -6
  15. package/dist/db/adapter/index.d.ts +2 -6
  16. package/dist/db/index.cjs +17 -17
  17. package/dist/db/index.d.cts +2 -2
  18. package/dist/db/index.d.ts +2 -2
  19. package/dist/db/index.js +17 -17
  20. package/dist/env/index.d.cts +1 -1
  21. package/dist/env/index.d.ts +1 -1
  22. package/dist/{index-Cg7SVnu9.d.cts → index-6-zeCbRA.d.cts} +5005 -2553
  23. package/dist/{index-D5uj-vER.d.ts → index-C8vNYjIq.d.ts} +4 -4
  24. package/dist/{index-Dy_s5RNc.d.cts → index-DAzyP5GG.d.cts} +4 -4
  25. package/dist/{index-RfHoxHB4.d.ts → index-DTT2geV_.d.ts} +3662 -1211
  26. package/dist/index.d.cts +3 -65
  27. package/dist/index.d.ts +3 -65
  28. package/dist/oauth2/index.cjs +1 -1
  29. package/dist/oauth2/index.d.cts +2 -2
  30. package/dist/oauth2/index.d.ts +2 -2
  31. package/dist/oauth2/index.js +1 -1
  32. package/dist/{oauth2-C8-hfKTF.cjs → oauth2-C4Pt8KMZ.cjs} +87 -87
  33. package/dist/{oauth2-CjVUvPq7.js → oauth2-CP3eVHS_.js} +88 -88
  34. package/dist/social-providers/index.cjs +891 -891
  35. package/dist/social-providers/index.d.cts +2 -3
  36. package/dist/social-providers/index.d.ts +2 -3
  37. package/dist/social-providers/index.js +891 -891
  38. package/package.json +4 -3
  39. package/src/api/index.ts +1 -1
  40. package/src/context/endpoint-context.ts +1 -1
  41. package/src/context/index.ts +7 -7
  42. package/src/context/transaction.ts +2 -2
  43. package/src/db/adapter/index.ts +1 -1
  44. package/src/db/index.ts +11 -11
  45. package/src/db/plugin.ts +1 -1
  46. package/src/db/type.ts +3 -3
  47. package/src/env/index.ts +9 -9
  48. package/src/env/logger.test.ts +2 -2
  49. package/src/oauth2/client-credentials-token.ts +1 -1
  50. package/src/oauth2/index.ts +10 -11
  51. package/src/oauth2/refresh-access-token.ts +1 -1
  52. package/src/oauth2/validate-authorization-code.ts +1 -1
  53. package/src/social-providers/apple.ts +1 -1
  54. package/src/social-providers/atlassian.ts +6 -3
  55. package/src/social-providers/cognito.ts +7 -4
  56. package/src/social-providers/facebook.ts +6 -3
  57. package/src/social-providers/figma.ts +6 -3
  58. package/src/social-providers/gitlab.ts +1 -1
  59. package/src/social-providers/google.ts +6 -3
  60. package/src/social-providers/huggingface.ts +1 -1
  61. package/src/social-providers/index.ts +25 -25
  62. package/src/social-providers/kakao.ts +1 -1
  63. package/src/social-providers/kick.ts +1 -1
  64. package/src/social-providers/linkedin.ts +1 -1
  65. package/src/social-providers/microsoft-entra-id.ts +6 -6
  66. package/src/social-providers/naver.ts +1 -1
  67. package/src/social-providers/paypal.ts +3 -3
  68. package/src/social-providers/polar.ts +1 -1
  69. package/src/social-providers/reddit.ts +1 -1
  70. package/src/social-providers/roblox.ts +1 -1
  71. package/src/social-providers/salesforce.ts +6 -3
  72. package/src/social-providers/slack.ts +1 -1
  73. package/src/social-providers/spotify.ts +1 -1
  74. package/src/social-providers/twitch.ts +3 -3
  75. package/src/social-providers/vk.ts +3 -2
  76. package/src/social-providers/zoom.ts +1 -1
  77. package/src/types/context.ts +5 -4
  78. package/src/types/index.ts +11 -10
  79. package/src/types/init-options.ts +33 -7
  80. package/src/types/plugin-client.ts +2 -2
  81. package/src/types/plugin.ts +3 -3
  82. package/dist/helper-BH5srn6K.d.ts +0 -6
  83. package/dist/helper-ChPUVnMr.d.cts +0 -6
  84. package/dist/index-BCxkjvux.d.cts +0 -344
  85. package/dist/index-CZCOI9An.d.ts +0 -344
  86. package/dist/index-DQNPxXof.d.ts +0 -262
  87. package/dist/index-DXj1sY8B.d.cts +0 -1772
  88. package/dist/index-DgTKobWC.d.ts +0 -1772
  89. package/dist/index-daoIWR6L.d.cts +0 -262
  90. /package/dist/{index-CR-gJyzm.d.ts → index-BzepAavo.d.cts} +0 -0
  91. /package/dist/{index-CilaMiAm.d.cts → index-DT7CRnvv.d.ts} +0 -0
@@ -1,262 +0,0 @@
1
- import { t as LiteralString } from "./helper-ChPUVnMr.cjs";
2
- import * as z from "zod";
3
- import { ZodType } from "zod";
4
-
5
- //#region src/db/type.d.ts
6
- type DBPreservedModels = "user" | "account" | "session" | "verification" | "rate-limit" | "organization" | "member" | "invitation" | "jwks" | "passkey" | "two-factor";
7
- type DBFieldType = "string" | "number" | "boolean" | "date" | "json" | `${"string" | "number"}[]` | Array<LiteralString>;
8
- type DBPrimitive = string | number | boolean | Date | null | undefined | string[] | number[];
9
- type DBFieldAttributeConfig = {
10
- /**
11
- * If the field should be required on a new record.
12
- * @default true
13
- */
14
- required?: boolean;
15
- /**
16
- * If the value should be returned on a response body.
17
- * @default true
18
- */
19
- returned?: boolean;
20
- /**
21
- * If a value should be provided when creating a new record.
22
- * @default true
23
- */
24
- input?: boolean;
25
- /**
26
- * Default value for the field
27
- *
28
- * Note: This will not create a default value on the database level. It will only
29
- * be used when creating a new record.
30
- */
31
- defaultValue?: DBPrimitive | (() => DBPrimitive);
32
- /**
33
- * Update value for the field
34
- *
35
- * Note: This will create an onUpdate trigger on the database level for supported adapters.
36
- * It will be called when updating a record.
37
- */
38
- onUpdate?: () => DBPrimitive;
39
- /**
40
- * transform the value before storing it.
41
- */
42
- transform?: {
43
- input?: (value: DBPrimitive) => DBPrimitive | Promise<DBPrimitive>;
44
- output?: (value: DBPrimitive) => DBPrimitive | Promise<DBPrimitive>;
45
- };
46
- /**
47
- * Reference to another model.
48
- */
49
- references?: {
50
- /**
51
- * The model to reference.
52
- */
53
- model: string;
54
- /**
55
- * The field on the referenced model.
56
- */
57
- field: string;
58
- /**
59
- * The action to perform when the reference is deleted.
60
- * @default "cascade"
61
- */
62
- onDelete?: "no action" | "restrict" | "cascade" | "set null" | "set default";
63
- };
64
- unique?: boolean;
65
- /**
66
- * If the field should be a bigint on the database instead of integer.
67
- */
68
- bigint?: boolean;
69
- /**
70
- * A zod schema to validate the value.
71
- */
72
- validator?: {
73
- input?: ZodType;
74
- output?: ZodType;
75
- };
76
- /**
77
- * The name of the field on the database.
78
- */
79
- fieldName?: string;
80
- /**
81
- * If the field should be sortable.
82
- *
83
- * applicable only for `text` type.
84
- * It's useful to mark fields varchar instead of text.
85
- */
86
- sortable?: boolean;
87
- };
88
- type DBFieldAttribute<T extends DBFieldType = DBFieldType> = {
89
- type: T;
90
- } & DBFieldAttributeConfig;
91
- type BetterAuthDBSchema = Record<string, {
92
- /**
93
- * The name of the table in the database
94
- */
95
- modelName: string;
96
- /**
97
- * The fields of the table
98
- */
99
- fields: Record<string, DBFieldAttribute>;
100
- /**
101
- * Whether to disable migrations for this table
102
- * @default false
103
- */
104
- disableMigrations?: boolean;
105
- /**
106
- * The order of the table
107
- */
108
- order?: number;
109
- }>;
110
- interface SecondaryStorage {
111
- /**
112
- *
113
- * @param key - Key to get
114
- * @returns - Value of the key
115
- */
116
- get: (key: string) => Promise<unknown> | unknown;
117
- set: (
118
- /**
119
- * Key to store
120
- */
121
- key: string,
122
- /**
123
- * Value to store
124
- */
125
- value: string,
126
- /**
127
- * Time to live in seconds
128
- */
129
- ttl?: number) => Promise<void | null | unknown> | void;
130
- /**
131
- *
132
- * @param key - Key to delete
133
- */
134
- delete: (key: string) => Promise<void | null | string> | void;
135
- }
136
- //#endregion
137
- //#region src/db/plugin.d.ts
138
- type BetterAuthPluginDBSchema = { [table in string]: {
139
- fields: { [field in string]: DBFieldAttribute };
140
- disableMigration?: boolean;
141
- modelName?: string;
142
- } };
143
- //#endregion
144
- //#region src/db/schema/shared.d.ts
145
- declare const coreSchema: z.ZodObject<{
146
- id: z.ZodString;
147
- createdAt: z.ZodDefault<z.ZodDate>;
148
- updatedAt: z.ZodDefault<z.ZodDate>;
149
- }, z.core.$strip>;
150
- //#endregion
151
- //#region src/db/schema/user.d.ts
152
- declare const userSchema: z.ZodObject<{
153
- id: z.ZodString;
154
- createdAt: z.ZodDefault<z.ZodDate>;
155
- updatedAt: z.ZodDefault<z.ZodDate>;
156
- email: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
157
- emailVerified: z.ZodDefault<z.ZodBoolean>;
158
- name: z.ZodString;
159
- image: z.ZodOptional<z.ZodNullable<z.ZodString>>;
160
- }, z.core.$strip>;
161
- /**
162
- * User schema type used by better-auth, note that it's possible that user could have additional fields
163
- *
164
- * todo: we should use generics to extend this type with additional fields from plugins and options in the future
165
- */
166
- type User = z.infer<typeof userSchema>;
167
- //#endregion
168
- //#region src/db/schema/account.d.ts
169
- declare const accountSchema: z.ZodObject<{
170
- id: z.ZodString;
171
- createdAt: z.ZodDefault<z.ZodDate>;
172
- updatedAt: z.ZodDefault<z.ZodDate>;
173
- providerId: z.ZodString;
174
- accountId: z.ZodString;
175
- userId: z.ZodCoercedString<unknown>;
176
- accessToken: z.ZodOptional<z.ZodNullable<z.ZodString>>;
177
- refreshToken: z.ZodOptional<z.ZodNullable<z.ZodString>>;
178
- idToken: z.ZodOptional<z.ZodNullable<z.ZodString>>;
179
- accessTokenExpiresAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
180
- refreshTokenExpiresAt: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
181
- scope: z.ZodOptional<z.ZodNullable<z.ZodString>>;
182
- password: z.ZodOptional<z.ZodNullable<z.ZodString>>;
183
- }, z.core.$strip>;
184
- /**
185
- * Account schema type used by better-auth, note that it's possible that account could have additional fields
186
- *
187
- * todo: we should use generics to extend this type with additional fields from plugins and options in the future
188
- */
189
- type Account = z.infer<typeof accountSchema>;
190
- //#endregion
191
- //#region src/db/schema/session.d.ts
192
- declare const sessionSchema: z.ZodObject<{
193
- id: z.ZodString;
194
- createdAt: z.ZodDefault<z.ZodDate>;
195
- updatedAt: z.ZodDefault<z.ZodDate>;
196
- userId: z.ZodCoercedString<unknown>;
197
- expiresAt: z.ZodDate;
198
- token: z.ZodString;
199
- ipAddress: z.ZodOptional<z.ZodNullable<z.ZodString>>;
200
- userAgent: z.ZodOptional<z.ZodNullable<z.ZodString>>;
201
- }, z.core.$strip>;
202
- /**
203
- * Session schema type used by better-auth, note that it's possible that session could have additional fields
204
- *
205
- * todo: we should use generics to extend this type with additional fields from plugins and options in the future
206
- */
207
- type Session = z.infer<typeof sessionSchema>;
208
- //#endregion
209
- //#region src/db/schema/verification.d.ts
210
- declare const verificationSchema: z.ZodObject<{
211
- id: z.ZodString;
212
- createdAt: z.ZodDefault<z.ZodDate>;
213
- updatedAt: z.ZodDefault<z.ZodDate>;
214
- value: z.ZodString;
215
- expiresAt: z.ZodDate;
216
- identifier: z.ZodString;
217
- }, z.core.$strip>;
218
- /**
219
- * Verification schema type used by better-auth, note that it's possible that verification could have additional fields
220
- *
221
- * todo: we should use generics to extend this type with additional fields from plugins and options in the future
222
- */
223
- type Verification = z.infer<typeof verificationSchema>;
224
- //#endregion
225
- //#region src/db/schema/rate-limit.d.ts
226
- declare const rateLimitSchema: z.ZodObject<{
227
- key: z.ZodString;
228
- count: z.ZodNumber;
229
- lastRequest: z.ZodNumber;
230
- }, z.core.$strip>;
231
- /**
232
- * Rate limit schema type used by better-auth for rate limiting
233
- */
234
- type RateLimit = z.infer<typeof rateLimitSchema>;
235
- //#endregion
236
- //#region src/db/index.d.ts
237
- /**
238
- * @deprecated Backport for 1.3.x, we will remove this in 1.4.x
239
- */
240
- type AuthPluginSchema = BetterAuthPluginDBSchema;
241
- /**
242
- * @deprecated Backport for 1.3.x, we will remove this in 1.4.x
243
- */
244
- type FieldAttribute = DBFieldAttribute;
245
- /**
246
- * @deprecated Backport for 1.3.x, we will remove this in 1.4.x
247
- */
248
- type FieldAttributeConfig = DBFieldAttributeConfig;
249
- /**
250
- * @deprecated Backport for 1.3.x, we will remove this in 1.4.x
251
- */
252
- type FieldType = DBFieldType;
253
- /**
254
- * @deprecated Backport for 1.3.x, we will remove this in 1.4.x
255
- */
256
- type Primitive = DBPrimitive;
257
- /**
258
- * @deprecated Backport for 1.3.x, we will remove this in 1.4.x
259
- */
260
- type BetterAuthDbSchema = BetterAuthDBSchema;
261
- //#endregion
262
- export { DBPreservedModels as C, DBFieldType as S, SecondaryStorage as T, coreSchema as _, FieldType as a, DBFieldAttribute as b, rateLimitSchema as c, Session as d, sessionSchema as f, userSchema as g, User as h, FieldAttributeConfig as i, Verification as l, accountSchema as m, BetterAuthDbSchema as n, Primitive as o, Account as p, FieldAttribute as r, RateLimit as s, AuthPluginSchema as t, verificationSchema as u, BetterAuthPluginDBSchema as v, DBPrimitive as w, DBFieldAttributeConfig as x, BetterAuthDBSchema as y };