@better-auth/core 1.4.8-beta.4 → 1.4.8-beta.6
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.
- package/.turbo/turbo-build.log +5 -5
- package/dist/api/index.d.mts +1 -1
- package/dist/context/index.d.mts +1 -1
- package/dist/db/adapter/index.d.mts +1 -1
- package/dist/db/index.d.mts +1 -1
- package/dist/{index-CTa0oOlQ.d.mts → index-D0VJf1xh.d.mts} +50 -1
- package/dist/index.d.mts +1 -1
- package/dist/oauth2/index.d.mts +1 -1
- package/dist/social-providers/index.d.mts +1 -1
- package/package.json +3 -3
- package/src/types/context.ts +18 -0
- package/src/types/init-options.ts +34 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @better-auth/core@1.4.8-beta.
|
|
2
|
+
> @better-auth/core@1.4.8-beta.6 build /home/runner/work/better-auth/better-auth/packages/core
|
|
3
3
|
> tsdown
|
|
4
4
|
|
|
5
5
|
[34mℹ[39m tsdown [2mv0.17.2[22m powered by rolldown [2mv1.0.0-beta.53[22m
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
[34mℹ[39m [2mdist/[22m[32m[1msocial-providers/index.d.mts[22m[39m [2m 3.88 kB[22m [2m│ gzip: 1.19 kB[22m
|
|
29
29
|
[34mℹ[39m [2mdist/[22m[32m[1mcontext/index.d.mts[22m[39m [2m 3.02 kB[22m [2m│ gzip: 0.96 kB[22m
|
|
30
30
|
[34mℹ[39m [2mdist/[22m[32m[1merror/index.d.mts[22m[39m [2m 1.84 kB[22m [2m│ gzip: 0.72 kB[22m
|
|
31
|
-
[34mℹ[39m [2mdist/[22m[32m[1mdb/adapter/index.d.mts[22m[39m [2m 1.34 kB[22m [2m│ gzip: 0.
|
|
31
|
+
[34mℹ[39m [2mdist/[22m[32m[1mdb/adapter/index.d.mts[22m[39m [2m 1.34 kB[22m [2m│ gzip: 0.43 kB[22m
|
|
32
32
|
[34mℹ[39m [2mdist/[22m[32m[1mutils/index.d.mts[22m[39m [2m 1.19 kB[22m [2m│ gzip: 0.55 kB[22m
|
|
33
33
|
[34mℹ[39m [2mdist/[22m[32m[1mindex.d.mts[22m[39m [2m 0.92 kB[22m [2m│ gzip: 0.35 kB[22m
|
|
34
34
|
[34mℹ[39m [2mdist/[22m[32m[1mdb/index.d.mts[22m[39m [2m 0.81 kB[22m [2m│ gzip: 0.34 kB[22m
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
[34mℹ[39m [2mdist/[22m[32m[1mapi/index.d.mts[22m[39m [2m 0.26 kB[22m [2m│ gzip: 0.14 kB[22m
|
|
38
38
|
[34mℹ[39m [2mdist/[22m[32m[1masync_hooks/index.d.mts[22m[39m [2m 0.24 kB[22m [2m│ gzip: 0.16 kB[22m
|
|
39
39
|
[34mℹ[39m [2mdist/[22m[32m[1masync_hooks/pure.index.d.mts[22m[39m [2m 0.22 kB[22m [2m│ gzip: 0.16 kB[22m
|
|
40
|
-
[34mℹ[39m [2mdist/[22m[32mindex-
|
|
40
|
+
[34mℹ[39m [2mdist/[22m[32mindex-D0VJf1xh.d.mts[39m [2m219.53 kB[22m [2m│ gzip: 34.87 kB[22m
|
|
41
41
|
[34mℹ[39m [2mdist/[22m[32mindex-BRBu0-5h.d.mts[39m [2m 3.31 kB[22m [2m│ gzip: 1.11 kB[22m
|
|
42
|
-
[34mℹ[39m 32 files, total:
|
|
43
|
-
[32m✔[39m Build complete in [
|
|
42
|
+
[34mℹ[39m 32 files, total: 394.13 kB
|
|
43
|
+
[32m✔[39m Build complete in [32m4813ms[39m
|
package/dist/api/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as optionsMiddleware, i as createAuthMiddleware, n as AuthMiddleware, r as createAuthEndpoint, t as AuthEndpoint } from "../index-
|
|
1
|
+
import { a as optionsMiddleware, i as createAuthMiddleware, n as AuthMiddleware, r as createAuthEndpoint, t as AuthEndpoint } from "../index-D0VJf1xh.mjs";
|
|
2
2
|
export { AuthEndpoint, AuthMiddleware, createAuthEndpoint, createAuthMiddleware, optionsMiddleware };
|
package/dist/context/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Kn as DBAdapter, Zn as DBTransactionAdapter, f as AuthContext } from "../index-
|
|
1
|
+
import { Kn as DBAdapter, Zn as DBTransactionAdapter, f as AuthContext } from "../index-D0VJf1xh.mjs";
|
|
2
2
|
import { AsyncLocalStorage } from "@better-auth/core/async_hooks";
|
|
3
3
|
import { EndpointContext, InputContext } from "better-call";
|
|
4
4
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $n as JoinOption, Cr as initGetDefaultFieldName, Gn as CustomAdapter, Jn as DBAdapterFactoryConfig, Kn as DBAdapter, Qn as JoinConfig, Sr as initGetDefaultModelName, Wn as CleanedWhere, Xn as DBAdapterSchemaCreation, Yn as DBAdapterInstance, Zn as DBTransactionAdapter, ar as createAdapterFactory, br as initGetFieldName, cr as AdapterFactoryCustomizeAdapterCreator, dr as CreateAdapterOptions, er as Where, fr as CreateCustomAdapter, ir as createAdapter, lr as AdapterFactoryOptions, nr as withApplyDefault, or as AdapterConfig, qn as DBAdapterDebugLogOption, rr as AdapterFactory, sr as AdapterFactoryConfig, tr as deepmerge, ur as AdapterTestDebugLogs, vr as initGetModelName, xr as initGetFieldAttributes, yr as initGetIdField } from "../../index-
|
|
1
|
+
import { $n as JoinOption, Cr as initGetDefaultFieldName, Gn as CustomAdapter, Jn as DBAdapterFactoryConfig, Kn as DBAdapter, Qn as JoinConfig, Sr as initGetDefaultModelName, Wn as CleanedWhere, Xn as DBAdapterSchemaCreation, Yn as DBAdapterInstance, Zn as DBTransactionAdapter, ar as createAdapterFactory, br as initGetFieldName, cr as AdapterFactoryCustomizeAdapterCreator, dr as CreateAdapterOptions, er as Where, fr as CreateCustomAdapter, ir as createAdapter, lr as AdapterFactoryOptions, nr as withApplyDefault, or as AdapterConfig, qn as DBAdapterDebugLogOption, rr as AdapterFactory, sr as AdapterFactoryConfig, tr as deepmerge, ur as AdapterTestDebugLogs, vr as initGetModelName, xr as initGetFieldAttributes, yr as initGetIdField } from "../../index-D0VJf1xh.mjs";
|
|
2
2
|
export { AdapterConfig, AdapterFactory, AdapterFactoryConfig, AdapterFactoryCustomizeAdapterCreator, AdapterFactoryOptions, AdapterTestDebugLogs, CleanedWhere, CreateAdapterOptions, CreateCustomAdapter, CustomAdapter, DBAdapter, DBAdapterDebugLogOption, DBAdapterFactoryConfig, DBAdapterInstance, DBAdapterSchemaCreation, DBTransactionAdapter, JoinConfig, JoinOption, Where, createAdapter, createAdapterFactory, deepmerge, initGetDefaultFieldName, initGetDefaultModelName, initGetFieldAttributes, initGetFieldName, initGetIdField, initGetModelName, withApplyDefault };
|
package/dist/db/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Ar as sessionSchema, Br as DBFieldAttributeConfig, Dr as userSchema, Er as User, Fr as BetterAuthPluginDBSchema, Hr as DBPrimitive, Ir as getAuthTables, Lr as BaseModelNames, Mr as rateLimitSchema, Nr as Account, Or as coreSchema, Pr as accountSchema, Rr as BetterAuthDBSchema, Tr as verificationSchema, Ur as ModelNames, Vr as DBFieldType, Wr as SecondaryStorage, jr as RateLimit, kr as Session, wr as Verification, zr as DBFieldAttribute } from "../index-
|
|
1
|
+
import { Ar as sessionSchema, Br as DBFieldAttributeConfig, Dr as userSchema, Er as User, Fr as BetterAuthPluginDBSchema, Hr as DBPrimitive, Ir as getAuthTables, Lr as BaseModelNames, Mr as rateLimitSchema, Nr as Account, Or as coreSchema, Pr as accountSchema, Rr as BetterAuthDBSchema, Tr as verificationSchema, Ur as ModelNames, Vr as DBFieldType, Wr as SecondaryStorage, jr as RateLimit, kr as Session, wr as Verification, zr as DBFieldAttribute } from "../index-D0VJf1xh.mjs";
|
|
2
2
|
export { Account, BaseModelNames, BetterAuthDBSchema, BetterAuthPluginDBSchema, DBFieldAttribute, DBFieldAttributeConfig, DBFieldType, DBPrimitive, ModelNames, RateLimit, SecondaryStorage, Session, User, Verification, accountSchema, coreSchema, getAuthTables, rateLimitSchema, sessionSchema, userSchema, verificationSchema };
|
|
@@ -6465,6 +6465,31 @@ type BetterAuthAdvancedOptions = {
|
|
|
6465
6465
|
* used correctly. Please use this with caution.
|
|
6466
6466
|
*/
|
|
6467
6467
|
trustedProxyHeaders?: boolean | undefined;
|
|
6468
|
+
/**
|
|
6469
|
+
* Configure background task handling for deferred operations.
|
|
6470
|
+
*
|
|
6471
|
+
* Background tasks allow non-critical operations (like cleanup, analytics,
|
|
6472
|
+
* or timing-attack mitigation) to run after the response is sent.
|
|
6473
|
+
*
|
|
6474
|
+
* Use `waitUntil` from `@vercel/functions` on Vercel,
|
|
6475
|
+
* or `ctx.waitUntil` on Cloudflare Workers.
|
|
6476
|
+
*
|
|
6477
|
+
* @example
|
|
6478
|
+
* // Vercel
|
|
6479
|
+
* import { waitUntil } from "@vercel/functions";
|
|
6480
|
+
* advanced: { backgroundTasks: { handler: waitUntil } }
|
|
6481
|
+
*
|
|
6482
|
+
* @example
|
|
6483
|
+
* // Cloudflare Workers (with AsyncLocalStorage)
|
|
6484
|
+
* advanced: {
|
|
6485
|
+
* backgroundTasks: {
|
|
6486
|
+
* handler: (p) => execCtxStorage.getStore()?.waitUntil(p)
|
|
6487
|
+
* }
|
|
6488
|
+
* }
|
|
6489
|
+
*/
|
|
6490
|
+
backgroundTasks?: {
|
|
6491
|
+
handler: (promise: Promise<void>) => void;
|
|
6492
|
+
};
|
|
6468
6493
|
};
|
|
6469
6494
|
type BetterAuthOptions = {
|
|
6470
6495
|
/**
|
|
@@ -7114,8 +7139,16 @@ type BetterAuthOptions = {
|
|
|
7114
7139
|
} | undefined;
|
|
7115
7140
|
/**
|
|
7116
7141
|
* List of trusted origins.
|
|
7142
|
+
*
|
|
7143
|
+
* @param request - The request object.
|
|
7144
|
+
* It'll be undefined if no request was
|
|
7145
|
+
* made. Like during a create context call
|
|
7146
|
+
* or `auth.api` call.
|
|
7147
|
+
*
|
|
7148
|
+
* Trusted origins will be dynamically
|
|
7149
|
+
* calculated based on the request.
|
|
7117
7150
|
*/
|
|
7118
|
-
trustedOrigins?: (string[] | ((request
|
|
7151
|
+
trustedOrigins?: (string[] | ((request?: Request | undefined) => Awaitable<string[]>)) | undefined;
|
|
7119
7152
|
/**
|
|
7120
7153
|
* Rate limiting configuration
|
|
7121
7154
|
*/
|
|
@@ -7606,6 +7639,22 @@ type AuthContext<Options extends BetterAuthOptions = BetterAuthOptions> = {
|
|
|
7606
7639
|
* @default false
|
|
7607
7640
|
*/
|
|
7608
7641
|
skipCSRFCheck: boolean;
|
|
7642
|
+
/**
|
|
7643
|
+
* Background task handler for deferred operations.
|
|
7644
|
+
*
|
|
7645
|
+
* This is inferred from the `options.advanced?.backgroundTasks?.handler` option.
|
|
7646
|
+
* Defaults to a no-op that just runs the promise.
|
|
7647
|
+
*/
|
|
7648
|
+
runInBackground: (promise: Promise<void>) => void;
|
|
7649
|
+
/**
|
|
7650
|
+
* Runs a task in the background if `runInBackground` is configured,
|
|
7651
|
+
* otherwise awaits the task directly.
|
|
7652
|
+
*
|
|
7653
|
+
* This is useful for operations like sending emails where we want
|
|
7654
|
+
* to avoid blocking the response when possible (for timing attack
|
|
7655
|
+
* mitigation), but still ensure the operation completes.
|
|
7656
|
+
*/
|
|
7657
|
+
runInBackgroundOrAwait: (promise: Promise<unknown> | Promise<void> | void | unknown) => Promise<unknown>;
|
|
7609
7658
|
};
|
|
7610
7659
|
//#endregion
|
|
7611
7660
|
//#region src/types/plugin-client.d.ts
|
package/dist/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as BetterAuthRateLimitOptions, _r as Primitive, b as HookEndpointContext, c as BetterAuthClientPlugin, d as ClientStore, f as AuthContext, g as BetterAuthOptions, gr as Prettify, h as BetterAuthAdvancedOptions, hr as LiteralUnion, kn as BetterAuthCookies, l as ClientAtomListener, m as InternalAdapter, mr as LiteralString, o as StandardSchemaV1, p as GenericEndpointContext, pr as Awaitable, s as BetterAuthClientOptions, u as ClientFetchOption, v as GenerateIdFn, y as BetterAuthPlugin } from "./index-
|
|
1
|
+
import { _ as BetterAuthRateLimitOptions, _r as Primitive, b as HookEndpointContext, c as BetterAuthClientPlugin, d as ClientStore, f as AuthContext, g as BetterAuthOptions, gr as Prettify, h as BetterAuthAdvancedOptions, hr as LiteralUnion, kn as BetterAuthCookies, l as ClientAtomListener, m as InternalAdapter, mr as LiteralString, o as StandardSchemaV1, p as GenericEndpointContext, pr as Awaitable, s as BetterAuthClientOptions, u as ClientFetchOption, v as GenerateIdFn, y as BetterAuthPlugin } from "./index-D0VJf1xh.mjs";
|
|
2
2
|
export { AuthContext, Awaitable, BetterAuthAdvancedOptions, BetterAuthClientOptions, BetterAuthClientPlugin, BetterAuthCookies, BetterAuthOptions, BetterAuthPlugin, BetterAuthRateLimitOptions, ClientAtomListener, ClientFetchOption, ClientStore, GenerateIdFn, GenericEndpointContext, HookEndpointContext, InternalAdapter, LiteralString, LiteralUnion, Prettify, Primitive, StandardSchemaV1 };
|
package/dist/oauth2/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { An as createAuthorizationCodeRequest, Bn as OAuth2Tokens, Fn as createRefreshAccessTokenRequest, Hn as OAuthProvider, In as refreshAccessToken, Ln as createAuthorizationURL, Mn as validateToken, Nn as generateCodeChallenge, Pn as getOAuth2Tokens, Rn as clientCredentialsToken, Un as ProviderOptions, Vn as OAuth2UserInfo, jn as validateAuthorizationCode, zn as createClientCredentialsTokenRequest } from "../index-
|
|
1
|
+
import { An as createAuthorizationCodeRequest, Bn as OAuth2Tokens, Fn as createRefreshAccessTokenRequest, Hn as OAuthProvider, In as refreshAccessToken, Ln as createAuthorizationURL, Mn as validateToken, Nn as generateCodeChallenge, Pn as getOAuth2Tokens, Rn as clientCredentialsToken, Un as ProviderOptions, Vn as OAuth2UserInfo, jn as validateAuthorizationCode, zn as createClientCredentialsTokenRequest } from "../index-D0VJf1xh.mjs";
|
|
2
2
|
export { OAuth2Tokens, OAuth2UserInfo, OAuthProvider, ProviderOptions, clientCredentialsToken, createAuthorizationCodeRequest, createAuthorizationURL, createClientCredentialsTokenRequest, createRefreshAccessTokenRequest, generateCodeChallenge, getOAuth2Tokens, refreshAccessToken, validateAuthorizationCode, validateToken };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as AccountStatus, $t as GoogleProfile, A as PolarOptions, At as linear, B as LineIdTokenPayload, Bt as TwitchOptions, C as SocialProviderListEnum, Cn as atlassian, Ct as gitlab, D as VercelOptions, Dn as apple, Dt as LinearOptions, E as socialProviders, En as AppleProfile, Et as linkedin, F as PayPalTokenResponse, Ft as DropboxProfile, G as NaverProfile, Gt as spotify, H as LineUserInfo, Ht as twitch, I as paypal, It as dropbox, J as KakaoProfile, Jt as slack, K as naver, Kt as SlackOptions, L as PaybinOptions, Lt as TwitterOption, M as polar, Mt as KickProfile, N as PayPalOptions, Nt as kick, O as VercelProfile, On as getApplePublicKey, Ot as LinearProfile, P as PayPalProfile, Pt as DropboxOptions, Q as notion, Qt as GoogleOptions, R as PaybinProfile, Rt as TwitterProfile, S as SocialProviderList, Sn as AtlassianProfile, St as GitlabProfile, T as socialProviderList, Tn as AppleOptions, Tt as LinkedInProfile, U as line, Ut as SpotifyOptions, V as LineOptions, Vt as TwitchProfile, W as NaverOptions, Wt as SpotifyProfile, X as NotionOptions, Xt as HuggingFaceProfile, Y as kakao, Yt as HuggingFaceOptions, Z as NotionProfile, Zt as huggingface, _n as CognitoOptions, _t as reddit, an as GithubOptions, at as zoom, bn as getCognitoPublicKey, bt as tiktok, cn as FigmaOptions, ct as vk, dn as FacebookOptions, dt as salesforce, en as getGooglePublicKey, et as LoginType, fn as FacebookProfile, ft as RobloxOptions, gn as discord, gt as RedditProfile, hn as DiscordProfile, ht as RedditOptions, in as microsoft, it as ZoomProfile, j as PolarProfile, jt as KickOptions, k as vercel, kt as LinearUser, ln as FigmaProfile, lt as SalesforceOptions, mn as DiscordOptions, mt as roblox, nn as MicrosoftEntraIDProfile, nt as PronounOption, on as GithubProfile, ot as VkOption, pn as facebook, pt as RobloxProfile, q as KakaoOptions, qt as SlackProfile, rn as MicrosoftOptions, rt as ZoomOptions, sn as github, st as VkProfile, tn as google, tt as PhoneNumber, un as figma, ut as SalesforceProfile, vn as CognitoProfile, vt as TiktokOptions, w as SocialProviders, wn as AppleNonConformUser, wt as LinkedInOptions, x as SocialProvider, xn as AtlassianOptions, xt as GitlabOptions, yn as cognito, yt as TiktokProfile, z as paybin, zt as twitter } from "../index-
|
|
1
|
+
import { $ as AccountStatus, $t as GoogleProfile, A as PolarOptions, At as linear, B as LineIdTokenPayload, Bt as TwitchOptions, C as SocialProviderListEnum, Cn as atlassian, Ct as gitlab, D as VercelOptions, Dn as apple, Dt as LinearOptions, E as socialProviders, En as AppleProfile, Et as linkedin, F as PayPalTokenResponse, Ft as DropboxProfile, G as NaverProfile, Gt as spotify, H as LineUserInfo, Ht as twitch, I as paypal, It as dropbox, J as KakaoProfile, Jt as slack, K as naver, Kt as SlackOptions, L as PaybinOptions, Lt as TwitterOption, M as polar, Mt as KickProfile, N as PayPalOptions, Nt as kick, O as VercelProfile, On as getApplePublicKey, Ot as LinearProfile, P as PayPalProfile, Pt as DropboxOptions, Q as notion, Qt as GoogleOptions, R as PaybinProfile, Rt as TwitterProfile, S as SocialProviderList, Sn as AtlassianProfile, St as GitlabProfile, T as socialProviderList, Tn as AppleOptions, Tt as LinkedInProfile, U as line, Ut as SpotifyOptions, V as LineOptions, Vt as TwitchProfile, W as NaverOptions, Wt as SpotifyProfile, X as NotionOptions, Xt as HuggingFaceProfile, Y as kakao, Yt as HuggingFaceOptions, Z as NotionProfile, Zt as huggingface, _n as CognitoOptions, _t as reddit, an as GithubOptions, at as zoom, bn as getCognitoPublicKey, bt as tiktok, cn as FigmaOptions, ct as vk, dn as FacebookOptions, dt as salesforce, en as getGooglePublicKey, et as LoginType, fn as FacebookProfile, ft as RobloxOptions, gn as discord, gt as RedditProfile, hn as DiscordProfile, ht as RedditOptions, in as microsoft, it as ZoomProfile, j as PolarProfile, jt as KickOptions, k as vercel, kt as LinearUser, ln as FigmaProfile, lt as SalesforceOptions, mn as DiscordOptions, mt as roblox, nn as MicrosoftEntraIDProfile, nt as PronounOption, on as GithubProfile, ot as VkOption, pn as facebook, pt as RobloxProfile, q as KakaoOptions, qt as SlackProfile, rn as MicrosoftOptions, rt as ZoomOptions, sn as github, st as VkProfile, tn as google, tt as PhoneNumber, un as figma, ut as SalesforceProfile, vn as CognitoProfile, vt as TiktokOptions, w as SocialProviders, wn as AppleNonConformUser, wt as LinkedInOptions, x as SocialProvider, xn as AtlassianOptions, xt as GitlabOptions, yn as cognito, yt as TiktokProfile, z as paybin, zt as twitter } from "../index-D0VJf1xh.mjs";
|
|
2
2
|
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, VercelOptions, VercelProfile, VkOption, VkProfile, ZoomOptions, ZoomProfile, apple, atlassian, cognito, discord, dropbox, facebook, figma, getApplePublicKey, getCognitoPublicKey, getGooglePublicKey, 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, vercel, vk, zoom };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@better-auth/core",
|
|
3
|
-
"version": "1.4.8-beta.
|
|
3
|
+
"version": "1.4.8-beta.6",
|
|
4
4
|
"description": "The most comprehensive authentication framework for TypeScript.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
"devDependencies": {
|
|
115
115
|
"@better-auth/utils": "0.3.0",
|
|
116
116
|
"@better-fetch/fetch": "1.1.21",
|
|
117
|
-
"better-call": "1.1.
|
|
117
|
+
"better-call": "1.1.7",
|
|
118
118
|
"jose": "^6.1.0",
|
|
119
119
|
"kysely": "^0.28.5",
|
|
120
120
|
"nanostores": "^1.0.1",
|
|
@@ -127,7 +127,7 @@
|
|
|
127
127
|
"peerDependencies": {
|
|
128
128
|
"@better-auth/utils": "0.3.0",
|
|
129
129
|
"@better-fetch/fetch": "1.1.21",
|
|
130
|
-
"better-call": "1.1.
|
|
130
|
+
"better-call": "1.1.7",
|
|
131
131
|
"jose": "^6.1.0",
|
|
132
132
|
"kysely": "^0.28.5",
|
|
133
133
|
"nanostores": "^1.0.1"
|
package/src/types/context.ts
CHANGED
|
@@ -276,4 +276,22 @@ export type AuthContext<Options extends BetterAuthOptions = BetterAuthOptions> =
|
|
|
276
276
|
* @default false
|
|
277
277
|
*/
|
|
278
278
|
skipCSRFCheck: boolean;
|
|
279
|
+
/**
|
|
280
|
+
* Background task handler for deferred operations.
|
|
281
|
+
*
|
|
282
|
+
* This is inferred from the `options.advanced?.backgroundTasks?.handler` option.
|
|
283
|
+
* Defaults to a no-op that just runs the promise.
|
|
284
|
+
*/
|
|
285
|
+
runInBackground: (promise: Promise<void>) => void;
|
|
286
|
+
/**
|
|
287
|
+
* Runs a task in the background if `runInBackground` is configured,
|
|
288
|
+
* otherwise awaits the task directly.
|
|
289
|
+
*
|
|
290
|
+
* This is useful for operations like sending emails where we want
|
|
291
|
+
* to avoid blocking the response when possible (for timing attack
|
|
292
|
+
* mitigation), but still ensure the operation completes.
|
|
293
|
+
*/
|
|
294
|
+
runInBackgroundOrAwait: (
|
|
295
|
+
promise: Promise<unknown> | Promise<void> | void | unknown,
|
|
296
|
+
) => Promise<unknown>;
|
|
279
297
|
};
|
|
@@ -271,6 +271,31 @@ export type BetterAuthAdvancedOptions = {
|
|
|
271
271
|
* used correctly. Please use this with caution.
|
|
272
272
|
*/
|
|
273
273
|
trustedProxyHeaders?: boolean | undefined;
|
|
274
|
+
/**
|
|
275
|
+
* Configure background task handling for deferred operations.
|
|
276
|
+
*
|
|
277
|
+
* Background tasks allow non-critical operations (like cleanup, analytics,
|
|
278
|
+
* or timing-attack mitigation) to run after the response is sent.
|
|
279
|
+
*
|
|
280
|
+
* Use `waitUntil` from `@vercel/functions` on Vercel,
|
|
281
|
+
* or `ctx.waitUntil` on Cloudflare Workers.
|
|
282
|
+
*
|
|
283
|
+
* @example
|
|
284
|
+
* // Vercel
|
|
285
|
+
* import { waitUntil } from "@vercel/functions";
|
|
286
|
+
* advanced: { backgroundTasks: { handler: waitUntil } }
|
|
287
|
+
*
|
|
288
|
+
* @example
|
|
289
|
+
* // Cloudflare Workers (with AsyncLocalStorage)
|
|
290
|
+
* advanced: {
|
|
291
|
+
* backgroundTasks: {
|
|
292
|
+
* handler: (p) => execCtxStorage.getStore()?.waitUntil(p)
|
|
293
|
+
* }
|
|
294
|
+
* }
|
|
295
|
+
*/
|
|
296
|
+
backgroundTasks?: {
|
|
297
|
+
handler: (promise: Promise<void>) => void;
|
|
298
|
+
};
|
|
274
299
|
};
|
|
275
300
|
|
|
276
301
|
export type BetterAuthOptions = {
|
|
@@ -969,9 +994,17 @@ export type BetterAuthOptions = {
|
|
|
969
994
|
| undefined;
|
|
970
995
|
/**
|
|
971
996
|
* List of trusted origins.
|
|
997
|
+
*
|
|
998
|
+
* @param request - The request object.
|
|
999
|
+
* It'll be undefined if no request was
|
|
1000
|
+
* made. Like during a create context call
|
|
1001
|
+
* or `auth.api` call.
|
|
1002
|
+
*
|
|
1003
|
+
* Trusted origins will be dynamically
|
|
1004
|
+
* calculated based on the request.
|
|
972
1005
|
*/
|
|
973
1006
|
trustedOrigins?:
|
|
974
|
-
| (string[] | ((request
|
|
1007
|
+
| (string[] | ((request?: Request | undefined) => Awaitable<string[]>))
|
|
975
1008
|
| undefined;
|
|
976
1009
|
/**
|
|
977
1010
|
* Rate limiting configuration
|