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

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 (108) hide show
  1. package/.turbo/turbo-build.log +34 -58
  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/error/index.d.cts +1 -1
  23. package/dist/error/index.d.ts +1 -1
  24. package/dist/{index-D5uj-vER.d.ts → index-B_YiOlcX.d.cts} +9 -9
  25. package/dist/index-Bab6W0hG.d.ts +7155 -0
  26. package/dist/index-CGS5U4X6.d.cts +7155 -0
  27. package/dist/{index-Dy_s5RNc.d.cts → index-CSISZQGm.d.ts} +9 -9
  28. package/dist/index.d.cts +3 -65
  29. package/dist/index.d.ts +3 -65
  30. package/dist/oauth2/index.cjs +1 -1
  31. package/dist/oauth2/index.d.cts +2 -2
  32. package/dist/oauth2/index.d.ts +2 -2
  33. package/dist/oauth2/index.js +1 -1
  34. package/dist/{oauth2-C8-hfKTF.cjs → oauth2-C4Pt8KMZ.cjs} +87 -87
  35. package/dist/{oauth2-CjVUvPq7.js → oauth2-CP3eVHS_.js} +88 -88
  36. package/dist/social-providers/index.cjs +963 -888
  37. package/dist/social-providers/index.d.cts +3 -4
  38. package/dist/social-providers/index.d.ts +3 -4
  39. package/dist/social-providers/index.js +1023 -948
  40. package/package.json +4 -3
  41. package/src/api/index.ts +3 -3
  42. package/src/context/endpoint-context.ts +1 -1
  43. package/src/context/index.ts +7 -7
  44. package/src/context/transaction.ts +2 -2
  45. package/src/db/adapter/index.ts +146 -128
  46. package/src/db/index.ts +11 -11
  47. package/src/db/plugin.ts +3 -3
  48. package/src/db/type.ts +47 -41
  49. package/src/env/index.ts +9 -9
  50. package/src/env/logger.test.ts +2 -2
  51. package/src/env/logger.ts +11 -9
  52. package/src/error/index.ts +1 -1
  53. package/src/oauth2/client-credentials-token.ts +9 -9
  54. package/src/oauth2/create-authorization-url.ts +12 -12
  55. package/src/oauth2/index.ts +10 -11
  56. package/src/oauth2/oauth-provider.ts +91 -74
  57. package/src/oauth2/refresh-access-token.ts +12 -12
  58. package/src/oauth2/validate-authorization-code.ts +13 -13
  59. package/src/social-providers/apple.ts +6 -6
  60. package/src/social-providers/atlassian.ts +23 -18
  61. package/src/social-providers/cognito.ts +17 -14
  62. package/src/social-providers/discord.ts +6 -6
  63. package/src/social-providers/dropbox.ts +3 -3
  64. package/src/social-providers/facebook.ts +10 -7
  65. package/src/social-providers/figma.ts +8 -5
  66. package/src/social-providers/github.ts +2 -2
  67. package/src/social-providers/gitlab.ts +7 -7
  68. package/src/social-providers/google.ts +15 -12
  69. package/src/social-providers/huggingface.ts +25 -23
  70. package/src/social-providers/index.ts +29 -26
  71. package/src/social-providers/kakao.ts +39 -39
  72. package/src/social-providers/kick.ts +3 -3
  73. package/src/social-providers/line.ts +10 -10
  74. package/src/social-providers/linear.ts +4 -4
  75. package/src/social-providers/linkedin.ts +3 -3
  76. package/src/social-providers/microsoft-entra-id.ts +15 -13
  77. package/src/social-providers/naver.ts +3 -3
  78. package/src/social-providers/notion.ts +9 -7
  79. package/src/social-providers/paybin.ts +122 -0
  80. package/src/social-providers/paypal.ts +29 -27
  81. package/src/social-providers/polar.ts +20 -18
  82. package/src/social-providers/reddit.ts +4 -4
  83. package/src/social-providers/roblox.ts +11 -8
  84. package/src/social-providers/salesforce.ts +22 -17
  85. package/src/social-providers/slack.ts +3 -3
  86. package/src/social-providers/spotify.ts +3 -3
  87. package/src/social-providers/tiktok.ts +30 -28
  88. package/src/social-providers/twitch.ts +6 -6
  89. package/src/social-providers/twitter.ts +47 -43
  90. package/src/social-providers/vk.ts +11 -10
  91. package/src/social-providers/zoom.ts +15 -13
  92. package/src/types/context.ts +23 -17
  93. package/src/types/index.ts +11 -10
  94. package/src/types/init-options.ts +1037 -932
  95. package/src/types/plugin-client.ts +44 -13
  96. package/src/types/plugin.ts +66 -52
  97. package/dist/helper-BH5srn6K.d.ts +0 -6
  98. package/dist/helper-ChPUVnMr.d.cts +0 -6
  99. package/dist/index-BCxkjvux.d.cts +0 -344
  100. package/dist/index-CZCOI9An.d.ts +0 -344
  101. package/dist/index-Cg7SVnu9.d.cts +0 -4645
  102. package/dist/index-DQNPxXof.d.ts +0 -262
  103. package/dist/index-DXj1sY8B.d.cts +0 -1772
  104. package/dist/index-DgTKobWC.d.ts +0 -1772
  105. package/dist/index-RfHoxHB4.d.ts +0 -4531
  106. package/dist/index-daoIWR6L.d.cts +0 -262
  107. /package/dist/{index-CR-gJyzm.d.ts → index-BzepAavo.d.cts} +0 -0
  108. /package/dist/{index-CilaMiAm.d.cts → index-DT7CRnvv.d.ts} +0 -0
@@ -1,344 +0,0 @@
1
- import { t as LiteralString } from "./helper-BH5srn6K.js";
2
- import * as jose0 from "jose";
3
-
4
- //#region src/oauth2/oauth-provider.d.ts
5
- interface OAuth2Tokens {
6
- tokenType?: string;
7
- accessToken?: string;
8
- refreshToken?: string;
9
- accessTokenExpiresAt?: Date;
10
- refreshTokenExpiresAt?: Date;
11
- scopes?: string[];
12
- idToken?: string;
13
- }
14
- type OAuth2UserInfo = {
15
- id: string | number;
16
- name?: string;
17
- email?: string | null;
18
- image?: string;
19
- emailVerified: boolean;
20
- };
21
- interface OAuthProvider<T extends Record<string, any> = Record<string, any>, O extends Record<string, any> = Partial<ProviderOptions>> {
22
- id: LiteralString;
23
- createAuthorizationURL: (data: {
24
- state: string;
25
- codeVerifier: string;
26
- scopes?: string[];
27
- redirectURI: string;
28
- display?: string;
29
- loginHint?: string;
30
- }) => Promise<URL> | URL;
31
- name: string;
32
- validateAuthorizationCode: (data: {
33
- code: string;
34
- redirectURI: string;
35
- codeVerifier?: string;
36
- deviceId?: string;
37
- }) => Promise<OAuth2Tokens>;
38
- getUserInfo: (token: OAuth2Tokens & {
39
- /**
40
- * The user object from the provider
41
- * This is only available for some providers like Apple
42
- */
43
- user?: {
44
- name?: {
45
- firstName?: string;
46
- lastName?: string;
47
- };
48
- email?: string;
49
- };
50
- }) => Promise<{
51
- user: OAuth2UserInfo;
52
- data: T;
53
- } | null>;
54
- /**
55
- * Custom function to refresh a token
56
- */
57
- refreshAccessToken?: (refreshToken: string) => Promise<OAuth2Tokens>;
58
- revokeToken?: (token: string) => Promise<void>;
59
- /**
60
- * Verify the id token
61
- * @param token - The id token
62
- * @param nonce - The nonce
63
- * @returns True if the id token is valid, false otherwise
64
- */
65
- verifyIdToken?: (token: string, nonce?: string) => Promise<boolean>;
66
- /**
67
- * Disable implicit sign up for new users. When set to true for the provider,
68
- * sign-in need to be called with with requestSignUp as true to create new users.
69
- */
70
- disableImplicitSignUp?: boolean;
71
- /**
72
- * Disable sign up for new users.
73
- */
74
- disableSignUp?: boolean;
75
- /**
76
- * Options for the provider
77
- */
78
- options?: O;
79
- }
80
- type ProviderOptions<Profile extends Record<string, any> = any> = {
81
- /**
82
- * The client ID of your application.
83
- *
84
- * This is usually a string but can be any type depending on the provider.
85
- */
86
- clientId?: unknown;
87
- /**
88
- * The client secret of your application
89
- */
90
- clientSecret?: string;
91
- /**
92
- * The scopes you want to request from the provider
93
- */
94
- scope?: string[];
95
- /**
96
- * Remove default scopes of the provider
97
- */
98
- disableDefaultScope?: boolean;
99
- /**
100
- * The redirect URL for your application. This is where the provider will
101
- * redirect the user after the sign in process. Make sure this URL is
102
- * whitelisted in the provider's dashboard.
103
- */
104
- redirectURI?: string;
105
- /**
106
- * The client key of your application
107
- * Tiktok Social Provider uses this field instead of clientId
108
- */
109
- clientKey?: string;
110
- /**
111
- * Disable provider from allowing users to sign in
112
- * with this provider with an id token sent from the
113
- * client.
114
- */
115
- disableIdTokenSignIn?: boolean;
116
- /**
117
- * verifyIdToken function to verify the id token
118
- */
119
- verifyIdToken?: (token: string, nonce?: string) => Promise<boolean>;
120
- /**
121
- * Custom function to get user info from the provider
122
- */
123
- getUserInfo?: (token: OAuth2Tokens) => Promise<{
124
- user: {
125
- id: string;
126
- name?: string;
127
- email?: string | null;
128
- image?: string;
129
- emailVerified: boolean;
130
- [key: string]: any;
131
- };
132
- data: any;
133
- }>;
134
- /**
135
- * Custom function to refresh a token
136
- */
137
- refreshAccessToken?: (refreshToken: string) => Promise<OAuth2Tokens>;
138
- /**
139
- * Custom function to map the provider profile to a
140
- * user.
141
- */
142
- mapProfileToUser?: (profile: Profile) => {
143
- id?: string;
144
- name?: string;
145
- email?: string | null;
146
- image?: string;
147
- emailVerified?: boolean;
148
- [key: string]: any;
149
- } | Promise<{
150
- id?: string;
151
- name?: string;
152
- email?: string | null;
153
- image?: string;
154
- emailVerified?: boolean;
155
- [key: string]: any;
156
- }>;
157
- /**
158
- * Disable implicit sign up for new users. When set to true for the provider,
159
- * sign-in need to be called with with requestSignUp as true to create new users.
160
- */
161
- disableImplicitSignUp?: boolean;
162
- /**
163
- * Disable sign up for new users.
164
- */
165
- disableSignUp?: boolean;
166
- /**
167
- * The prompt to use for the authorization code request
168
- */
169
- prompt?: "select_account" | "consent" | "login" | "none" | "select_account consent";
170
- /**
171
- * The response mode to use for the authorization code request
172
- */
173
- responseMode?: "query" | "form_post";
174
- /**
175
- * If enabled, the user info will be overridden with the provider user info
176
- * This is useful if you want to use the provider user info to update the user info
177
- *
178
- * @default false
179
- */
180
- overrideUserInfoOnSignIn?: boolean;
181
- };
182
- //#endregion
183
- //#region src/oauth2/utils.d.ts
184
- declare function getOAuth2Tokens(data: Record<string, any>): OAuth2Tokens;
185
- declare function generateCodeChallenge(codeVerifier: string): Promise<string>;
186
- //#endregion
187
- //#region src/oauth2/create-authorization-url.d.ts
188
- declare function createAuthorizationURL({
189
- id,
190
- options,
191
- authorizationEndpoint,
192
- state,
193
- codeVerifier,
194
- scopes,
195
- claims,
196
- redirectURI,
197
- duration,
198
- prompt,
199
- accessType,
200
- responseType,
201
- display,
202
- loginHint,
203
- hd,
204
- responseMode,
205
- additionalParams,
206
- scopeJoiner
207
- }: {
208
- id: string;
209
- options: ProviderOptions;
210
- redirectURI: string;
211
- authorizationEndpoint: string;
212
- state: string;
213
- codeVerifier?: string;
214
- scopes: string[];
215
- claims?: string[];
216
- duration?: string;
217
- prompt?: string;
218
- accessType?: string;
219
- responseType?: string;
220
- display?: string;
221
- loginHint?: string;
222
- hd?: string;
223
- responseMode?: string;
224
- additionalParams?: Record<string, string>;
225
- scopeJoiner?: string;
226
- }): Promise<URL>;
227
- //#endregion
228
- //#region src/oauth2/validate-authorization-code.d.ts
229
- declare function createAuthorizationCodeRequest({
230
- code,
231
- codeVerifier,
232
- redirectURI,
233
- options,
234
- authentication,
235
- deviceId,
236
- headers,
237
- additionalParams,
238
- resource
239
- }: {
240
- code: string;
241
- redirectURI: string;
242
- options: Partial<ProviderOptions>;
243
- codeVerifier?: string;
244
- deviceId?: string;
245
- authentication?: "basic" | "post";
246
- headers?: Record<string, string>;
247
- additionalParams?: Record<string, string>;
248
- resource?: string | string[];
249
- }): {
250
- body: URLSearchParams;
251
- headers: Record<string, any>;
252
- };
253
- declare function validateAuthorizationCode({
254
- code,
255
- codeVerifier,
256
- redirectURI,
257
- options,
258
- tokenEndpoint,
259
- authentication,
260
- deviceId,
261
- headers,
262
- additionalParams,
263
- resource
264
- }: {
265
- code: string;
266
- redirectURI: string;
267
- options: Partial<ProviderOptions>;
268
- codeVerifier?: string;
269
- deviceId?: string;
270
- tokenEndpoint: string;
271
- authentication?: "basic" | "post";
272
- headers?: Record<string, string>;
273
- additionalParams?: Record<string, string>;
274
- resource?: string | string[];
275
- }): Promise<OAuth2Tokens>;
276
- declare function validateToken(token: string, jwksEndpoint: string): Promise<jose0.JWTVerifyResult<jose0.JWTPayload>>;
277
- //#endregion
278
- //#region src/oauth2/refresh-access-token.d.ts
279
- declare function createRefreshAccessTokenRequest({
280
- refreshToken,
281
- options,
282
- authentication,
283
- extraParams,
284
- resource
285
- }: {
286
- refreshToken: string;
287
- options: Partial<ProviderOptions>;
288
- authentication?: "basic" | "post";
289
- extraParams?: Record<string, string>;
290
- resource?: string | string[];
291
- }): {
292
- body: URLSearchParams;
293
- headers: Record<string, any>;
294
- };
295
- declare function refreshAccessToken({
296
- refreshToken,
297
- options,
298
- tokenEndpoint,
299
- authentication,
300
- extraParams
301
- }: {
302
- refreshToken: string;
303
- options: Partial<ProviderOptions>;
304
- tokenEndpoint: string;
305
- authentication?: "basic" | "post";
306
- extraParams?: Record<string, string>;
307
- /** @deprecated always "refresh_token" */
308
- grantType?: string;
309
- }): Promise<OAuth2Tokens>;
310
- //#endregion
311
- //#region src/oauth2/client-credentials-token.d.ts
312
- declare function createClientCredentialsTokenRequest({
313
- options,
314
- scope,
315
- authentication,
316
- resource
317
- }: {
318
- options: ProviderOptions & {
319
- clientSecret: string;
320
- };
321
- scope?: string;
322
- authentication?: "basic" | "post";
323
- resource?: string | string[];
324
- }): {
325
- body: URLSearchParams;
326
- headers: Record<string, any>;
327
- };
328
- declare function clientCredentialsToken({
329
- options,
330
- tokenEndpoint,
331
- scope,
332
- authentication,
333
- resource
334
- }: {
335
- options: ProviderOptions & {
336
- clientSecret: string;
337
- };
338
- tokenEndpoint: string;
339
- scope: string;
340
- authentication?: "basic" | "post";
341
- resource?: string | string[];
342
- }): Promise<OAuth2Tokens>;
343
- //#endregion
344
- export { createAuthorizationCodeRequest as a, createAuthorizationURL as c, OAuth2Tokens as d, OAuth2UserInfo as f, refreshAccessToken as i, generateCodeChallenge as l, ProviderOptions as m, createClientCredentialsTokenRequest as n, validateAuthorizationCode as o, OAuthProvider as p, createRefreshAccessTokenRequest as r, validateToken as s, clientCredentialsToken as t, getOAuth2Tokens as u };