@better-auth/core 1.4.7-beta.2 → 1.4.7-beta.3
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 +6 -6
- package/dist/api/index.d.mts +1 -1
- package/dist/api/index.mjs +10 -3
- 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-CH_f5upI.d.mts → index-NeeRjOR2.d.mts} +5 -5
- 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/api/index.ts +62 -9
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @better-auth/core@1.4.7-beta.
|
|
2
|
+
> @better-auth/core@1.4.7-beta.3 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
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
[34mℹ[39m [2mdist/[22m[1msocial-providers/index.mjs[22m [2m 80.69 kB[22m [2m│ gzip: 10.32 kB[22m
|
|
11
11
|
[34mℹ[39m [2mdist/[22m[1mdb/adapter/index.mjs[22m [2m 38.13 kB[22m [2m│ gzip: 7.79 kB[22m
|
|
12
12
|
[34mℹ[39m [2mdist/[22m[1mdb/index.mjs[22m [2m 1.66 kB[22m [2m│ gzip: 0.54 kB[22m
|
|
13
|
+
[34mℹ[39m [2mdist/[22m[1mapi/index.mjs[22m [2m 1.23 kB[22m [2m│ gzip: 0.48 kB[22m
|
|
13
14
|
[34mℹ[39m [2mdist/[22m[1masync_hooks/index.mjs[22m [2m 1.03 kB[22m [2m│ gzip: 0.54 kB[22m
|
|
14
15
|
[34mℹ[39m [2mdist/[22m[1masync_hooks/pure.index.mjs[22m [2m 0.99 kB[22m [2m│ gzip: 0.49 kB[22m
|
|
15
|
-
[34mℹ[39m [2mdist/[22m[1mapi/index.mjs[22m [2m 0.80 kB[22m [2m│ gzip: 0.38 kB[22m
|
|
16
16
|
[34mℹ[39m [2mdist/[22m[1mcontext/index.mjs[22m [2m 0.70 kB[22m [2m│ gzip: 0.24 kB[22m
|
|
17
17
|
[34mℹ[39m [2mdist/[22m[1moauth2/index.mjs[22m [2m 0.61 kB[22m [2m│ gzip: 0.24 kB[22m
|
|
18
18
|
[34mℹ[39m [2mdist/[22m[1menv/index.mjs[22m [2m 0.44 kB[22m [2m│ gzip: 0.25 kB[22m
|
|
@@ -32,12 +32,12 @@
|
|
|
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[1mdb/index.d.mts[22m[39m [2m 1.04 kB[22m [2m│ gzip: 0.38 kB[22m
|
|
34
34
|
[34mℹ[39m [2mdist/[22m[32m[1mindex.d.mts[22m[39m [2m 0.86 kB[22m [2m│ gzip: 0.33 kB[22m
|
|
35
|
-
[34mℹ[39m [2mdist/[22m[32m[1moauth2/index.d.mts[22m[39m [2m 0.76 kB[22m [2m│ gzip: 0.
|
|
35
|
+
[34mℹ[39m [2mdist/[22m[32m[1moauth2/index.d.mts[22m[39m [2m 0.76 kB[22m [2m│ gzip: 0.28 kB[22m
|
|
36
36
|
[34mℹ[39m [2mdist/[22m[32m[1menv/index.d.mts[22m[39m [2m 0.59 kB[22m [2m│ gzip: 0.30 kB[22m
|
|
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-NeeRjOR2.d.mts[39m [2m218.68 kB[22m [2m│ gzip: 34.40 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: 393.46 kB
|
|
43
|
+
[32m✔[39m Build complete in [32m4810ms[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-NeeRjOR2.mjs";
|
|
2
2
|
export { AuthEndpoint, AuthMiddleware, createAuthEndpoint, createAuthMiddleware, optionsMiddleware };
|
package/dist/api/index.mjs
CHANGED
|
@@ -14,12 +14,19 @@ const createAuthMiddleware = createMiddleware.create({ use: [optionsMiddleware,
|
|
|
14
14
|
return {};
|
|
15
15
|
})] });
|
|
16
16
|
const use = [optionsMiddleware];
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
function createAuthEndpoint(pathOrOptions, handlerOrOptions, handlerOrNever) {
|
|
18
|
+
const path = typeof pathOrOptions === "string" ? pathOrOptions : void 0;
|
|
19
|
+
const options = typeof handlerOrOptions === "object" ? handlerOrOptions : pathOrOptions;
|
|
20
|
+
const handler = typeof handlerOrOptions === "function" ? handlerOrOptions : handlerOrNever;
|
|
21
|
+
if (path) return createEndpoint(path, {
|
|
19
22
|
...options,
|
|
20
23
|
use: [...options?.use || [], ...use]
|
|
21
24
|
}, async (ctx) => runWithEndpointContext(ctx, () => handler(ctx)));
|
|
22
|
-
|
|
25
|
+
return createEndpoint({
|
|
26
|
+
...options,
|
|
27
|
+
use: [...options?.use || [], ...use]
|
|
28
|
+
}, async (ctx) => runWithEndpointContext(ctx, () => handler(ctx)));
|
|
29
|
+
}
|
|
23
30
|
|
|
24
31
|
//#endregion
|
|
25
32
|
export { 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-NeeRjOR2.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, Gn as CustomAdapter, Jn as DBAdapterFactoryConfig, Kn as DBAdapter, Qn as JoinConfig, Wn as CleanedWhere, Xn as DBAdapterSchemaCreation, Yn as DBAdapterInstance, Zn as DBTransactionAdapter, _r as initGetIdField, ar as createAdapterFactory, br as initGetDefaultModelName, cr as AdapterFactoryCustomizeAdapterCreator, dr as CreateAdapterOptions, er as Where, fr as CreateCustomAdapter, gr as initGetModelName, 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 initGetFieldName, xr as initGetDefaultFieldName, yr as initGetFieldAttributes } from "../../index-
|
|
1
|
+
import { $n as JoinOption, Gn as CustomAdapter, Jn as DBAdapterFactoryConfig, Kn as DBAdapter, Qn as JoinConfig, Wn as CleanedWhere, Xn as DBAdapterSchemaCreation, Yn as DBAdapterInstance, Zn as DBTransactionAdapter, _r as initGetIdField, ar as createAdapterFactory, br as initGetDefaultModelName, cr as AdapterFactoryCustomizeAdapterCreator, dr as CreateAdapterOptions, er as Where, fr as CreateCustomAdapter, gr as initGetModelName, 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 initGetFieldName, xr as initGetDefaultFieldName, yr as initGetFieldAttributes } from "../../index-NeeRjOR2.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 verificationSchema, Br as BetterAuthPluginDBSchema, Cr as BetterAuthDbSchema, Dr as Primitive, Er as FieldType, Fr as sessionSchema, Gr as DBFieldType, Hr as BetterAuthDBSchema, Ir as RateLimit, Jr as SecondaryStorage, Kr as DBPrimitive, Lr as rateLimitSchema, Mr as userSchema, Nr as coreSchema, Or as getAuthTables, Pr as Session, Rr as Account, Sr as AuthPluginSchema, Tr as FieldAttributeConfig, Ur as DBFieldAttribute, Vr as BaseModelNames, Wr as DBFieldAttributeConfig, jr as User, kr as Verification, qr as ModelNames, wr as FieldAttribute, zr as accountSchema } from "../index-
|
|
1
|
+
import { Ar as verificationSchema, Br as BetterAuthPluginDBSchema, Cr as BetterAuthDbSchema, Dr as Primitive, Er as FieldType, Fr as sessionSchema, Gr as DBFieldType, Hr as BetterAuthDBSchema, Ir as RateLimit, Jr as SecondaryStorage, Kr as DBPrimitive, Lr as rateLimitSchema, Mr as userSchema, Nr as coreSchema, Or as getAuthTables, Pr as Session, Rr as Account, Sr as AuthPluginSchema, Tr as FieldAttributeConfig, Ur as DBFieldAttribute, Vr as BaseModelNames, Wr as DBFieldAttributeConfig, jr as User, kr as Verification, qr as ModelNames, wr as FieldAttribute, zr as accountSchema } from "../index-NeeRjOR2.mjs";
|
|
2
2
|
export { Account, AuthPluginSchema, BaseModelNames, BetterAuthDBSchema, BetterAuthDbSchema, BetterAuthPluginDBSchema, DBFieldAttribute, DBFieldAttributeConfig, DBFieldType, DBPrimitive, FieldAttribute, FieldAttributeConfig, FieldType, ModelNames, Primitive, RateLimit, SecondaryStorage, Session, User, Verification, accountSchema, coreSchema, getAuthTables, rateLimitSchema, sessionSchema, userSchema, verificationSchema };
|
|
@@ -3,7 +3,7 @@ import * as z from "zod";
|
|
|
3
3
|
import { BetterFetch, BetterFetchOption, BetterFetchPlugin } from "@better-fetch/fetch";
|
|
4
4
|
import * as jose0 from "jose";
|
|
5
5
|
import * as better_call0 from "better-call";
|
|
6
|
-
import { CookieOptions, Endpoint, EndpointContext, EndpointOptions, InputContext, Middleware } from "better-call";
|
|
6
|
+
import { CookieOptions, Endpoint, EndpointContext, EndpointOptions, InputContext, Middleware, StrictEndpoint } from "better-call";
|
|
7
7
|
import { StandardSchemaV1, StandardSchemaV1 as StandardSchemaV1$1 } from "@standard-schema/spec";
|
|
8
8
|
import { Database } from "bun:sqlite";
|
|
9
9
|
import { DatabaseSync } from "node:sqlite";
|
|
@@ -7744,10 +7744,10 @@ declare const createAuthMiddleware: {
|
|
|
7744
7744
|
responseHeaders?: Headers | undefined;
|
|
7745
7745
|
}>) => Promise<R_1>): (inputContext: better_call0.MiddlewareInputContext<Options>) => Promise<R_1>;
|
|
7746
7746
|
};
|
|
7747
|
-
|
|
7748
|
-
|
|
7749
|
-
|
|
7750
|
-
type AuthEndpoint = ReturnType<typeof createAuthEndpoint
|
|
7747
|
+
type EndpointHandler<Path extends string, Options extends EndpointOptions, R> = (context: EndpointContext<Path, Options, AuthContext>) => Promise<R>;
|
|
7748
|
+
declare function createAuthEndpoint<Path extends string, Options extends EndpointOptions, R>(path: Path, options: Options, handler: EndpointHandler<Path, Options, R>): StrictEndpoint<Path, Options, R>;
|
|
7749
|
+
declare function createAuthEndpoint<Path extends string, Options extends EndpointOptions, R>(options: Options, handler: EndpointHandler<Path, Options, R>): StrictEndpoint<Path, Options, R>;
|
|
7750
|
+
type AuthEndpoint<Path extends string, Opts extends EndpointOptions, R> = ReturnType<typeof createAuthEndpoint<Path, Opts, R>>;
|
|
7751
7751
|
type AuthMiddleware = ReturnType<typeof createAuthMiddleware>;
|
|
7752
7752
|
//#endregion
|
|
7753
7753
|
export { AccountStatus as $, JoinOption as $n, GoogleProfile as $t, PolarOptions as A, createAuthorizationCodeRequest as An, verificationSchema as Ar, linear as At, LineIdTokenPayload as B, OAuth2Tokens as Bn, BetterAuthPluginDBSchema as Br, TwitchOptions as Bt, SocialProviderListEnum as C, atlassian as Cn, BetterAuthDbSchema as Cr, gitlab as Ct, VercelOptions as D, apple as Dn, Primitive$1 as Dr, LinearOptions as Dt, socialProviders as E, AppleProfile as En, FieldType as Er, linkedin as Et, PayPalTokenResponse as F, createRefreshAccessTokenRequest as Fn, sessionSchema as Fr, DropboxProfile as Ft, NaverProfile as G, CustomAdapter as Gn, DBFieldType as Gr, spotify as Gt, LineUserInfo as H, OAuthProvider as Hn, BetterAuthDBSchema as Hr, twitch as Ht, paypal as I, refreshAccessToken as In, RateLimit as Ir, dropbox as It, KakaoProfile as J, DBAdapterFactoryConfig as Jn, SecondaryStorage as Jr, slack as Jt, naver as K, DBAdapter as Kn, DBPrimitive as Kr, SlackOptions as Kt, PaybinOptions as L, createAuthorizationURL as Ln, rateLimitSchema as Lr, TwitterOption as Lt, polar as M, validateToken as Mn, userSchema as Mr, KickProfile as Mt, PayPalOptions as N, generateCodeChallenge as Nn, coreSchema as Nr, kick as Nt, VercelProfile as O, getApplePublicKey as On, getAuthTables as Or, LinearProfile as Ot, PayPalProfile as P, getOAuth2Tokens as Pn, Session as Pr, DropboxOptions as Pt, notion as Q, JoinConfig as Qn, GoogleOptions as Qt, PaybinProfile as R, clientCredentialsToken as Rn, Account as Rr, TwitterProfile as Rt, SocialProviderList as S, AtlassianProfile as Sn, AuthPluginSchema as Sr, GitlabProfile as St, socialProviderList as T, AppleOptions as Tn, FieldAttributeConfig as Tr, LinkedInProfile as Tt, line as U, ProviderOptions as Un, DBFieldAttribute as Ur, SpotifyOptions as Ut, LineOptions as V, OAuth2UserInfo as Vn, BaseModelNames as Vr, TwitchProfile as Vt, NaverOptions as W, CleanedWhere as Wn, DBFieldAttributeConfig as Wr, SpotifyProfile as Wt, NotionOptions as X, DBAdapterSchemaCreation as Xn, HuggingFaceProfile as Xt, kakao as Y, DBAdapterInstance as Yn, HuggingFaceOptions as Yt, NotionProfile as Z, DBTransactionAdapter as Zn, huggingface as Zt, BetterAuthRateLimitOptions as _, CognitoOptions as _n, initGetIdField as _r, reddit as _t, optionsMiddleware as a, GithubOptions as an, createAdapterFactory as ar, zoom as at, HookEndpointContext as b, getCognitoPublicKey as bn, initGetDefaultModelName as br, tiktok as bt, BetterAuthClientPlugin as c, FigmaOptions as cn, AdapterFactoryCustomizeAdapterCreator as cr, vk as ct, ClientStore as d, FacebookOptions as dn, CreateAdapterOptions as dr, salesforce as dt, getGooglePublicKey as en, Where as er, LoginType as et, AuthContext as f, FacebookProfile as fn, CreateCustomAdapter as fr, RobloxOptions as ft, BetterAuthOptions as g, discord as gn, initGetModelName as gr, RedditProfile as gt, BetterAuthAdvancedOptions as h, DiscordProfile as hn, Prettify as hr, RedditOptions as ht, createAuthMiddleware as i, microsoft as in, createAdapter as ir, ZoomProfile as it, PolarProfile as j, validateAuthorizationCode as jn, User as jr, KickOptions as jt, vercel as k, BetterAuthCookies as kn, Verification as kr, LinearUser as kt, ClientAtomListener as l, FigmaProfile as ln, AdapterFactoryOptions as lr, SalesforceOptions as lt, InternalAdapter as m, DiscordOptions as mn, LiteralUnion as mr, roblox as mt, AuthMiddleware as n, MicrosoftEntraIDProfile as nn, withApplyDefault as nr, PronounOption as nt, StandardSchemaV1$1 as o, GithubProfile as on, AdapterConfig as or, VkOption as ot, GenericEndpointContext as p, facebook as pn, LiteralString as pr, RobloxProfile as pt, KakaoOptions as q, DBAdapterDebugLogOption as qn, ModelNames as qr, SlackProfile as qt, createAuthEndpoint as r, MicrosoftOptions as rn, AdapterFactory as rr, ZoomOptions as rt, BetterAuthClientOptions as s, github as sn, AdapterFactoryConfig as sr, VkProfile as st, AuthEndpoint as t, google as tn, deepmerge as tr, PhoneNumber as tt, ClientFetchOption as u, figma as un, AdapterTestDebugLogs as ur, SalesforceProfile as ut, GenerateIdFn as v, CognitoProfile as vn, initGetFieldName as vr, TiktokOptions as vt, SocialProviders as w, AppleNonConformUser as wn, FieldAttribute as wr, LinkedInOptions as wt, SocialProvider as x, AtlassianOptions as xn, initGetDefaultFieldName as xr, GitlabOptions as xt, BetterAuthPlugin as y, cognito as yn, initGetFieldAttributes as yr, TiktokProfile as yt, paybin as z, createClientCredentialsTokenRequest as zn, accountSchema as zr, twitter as zt };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as BetterAuthRateLimitOptions, b as HookEndpointContext, c as BetterAuthClientPlugin, d as ClientStore, f as AuthContext, g as BetterAuthOptions, h as BetterAuthAdvancedOptions, hr as Prettify, kn as BetterAuthCookies, l as ClientAtomListener, m as InternalAdapter, mr as LiteralUnion, o as StandardSchemaV1, p as GenericEndpointContext, pr as LiteralString, s as BetterAuthClientOptions, u as ClientFetchOption, v as GenerateIdFn, y as BetterAuthPlugin } from "./index-
|
|
1
|
+
import { _ as BetterAuthRateLimitOptions, b as HookEndpointContext, c as BetterAuthClientPlugin, d as ClientStore, f as AuthContext, g as BetterAuthOptions, h as BetterAuthAdvancedOptions, hr as Prettify, kn as BetterAuthCookies, l as ClientAtomListener, m as InternalAdapter, mr as LiteralUnion, o as StandardSchemaV1, p as GenericEndpointContext, pr as LiteralString, s as BetterAuthClientOptions, u as ClientFetchOption, v as GenerateIdFn, y as BetterAuthPlugin } from "./index-NeeRjOR2.mjs";
|
|
2
2
|
export { AuthContext, BetterAuthAdvancedOptions, BetterAuthClientOptions, BetterAuthClientPlugin, BetterAuthCookies, BetterAuthOptions, BetterAuthPlugin, BetterAuthRateLimitOptions, ClientAtomListener, ClientFetchOption, ClientStore, GenerateIdFn, GenericEndpointContext, HookEndpointContext, InternalAdapter, LiteralString, LiteralUnion, Prettify, 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-NeeRjOR2.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-NeeRjOR2.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.7-beta.
|
|
3
|
+
"version": "1.4.7-beta.3",
|
|
4
4
|
"description": "The most comprehensive authentication framework for TypeScript.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
},
|
|
114
114
|
"devDependencies": {
|
|
115
115
|
"@better-auth/utils": "0.3.0",
|
|
116
|
-
"@better-fetch/fetch": "1.1.
|
|
116
|
+
"@better-fetch/fetch": "1.1.21",
|
|
117
117
|
"better-call": "1.1.5",
|
|
118
118
|
"jose": "^6.1.0",
|
|
119
119
|
"kysely": "^0.28.5",
|
|
@@ -126,7 +126,7 @@
|
|
|
126
126
|
},
|
|
127
127
|
"peerDependencies": {
|
|
128
128
|
"@better-auth/utils": "0.3.0",
|
|
129
|
-
"@better-fetch/fetch": "1.1.
|
|
129
|
+
"@better-fetch/fetch": "1.1.21",
|
|
130
130
|
"better-call": "1.1.5",
|
|
131
131
|
"jose": "^6.1.0",
|
|
132
132
|
"kysely": "^0.28.5",
|
package/src/api/index.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
EndpointContext,
|
|
3
|
+
EndpointOptions,
|
|
4
|
+
StrictEndpoint,
|
|
5
|
+
} from "better-call";
|
|
2
6
|
import { createEndpoint, createMiddleware } from "better-call";
|
|
3
7
|
import { runWithEndpointContext } from "../context";
|
|
4
8
|
import type { AuthContext } from "../types";
|
|
@@ -29,17 +33,62 @@ export const createAuthMiddleware = createMiddleware.create({
|
|
|
29
33
|
|
|
30
34
|
const use = [optionsMiddleware];
|
|
31
35
|
|
|
32
|
-
|
|
36
|
+
type EndpointHandler<
|
|
33
37
|
Path extends string,
|
|
34
|
-
|
|
38
|
+
Options extends EndpointOptions,
|
|
39
|
+
R,
|
|
40
|
+
> = (context: EndpointContext<Path, Options, AuthContext>) => Promise<R>;
|
|
41
|
+
|
|
42
|
+
export function createAuthEndpoint<
|
|
43
|
+
Path extends string,
|
|
44
|
+
Options extends EndpointOptions,
|
|
35
45
|
R,
|
|
36
46
|
>(
|
|
37
47
|
path: Path,
|
|
38
|
-
options:
|
|
39
|
-
handler:
|
|
40
|
-
)
|
|
48
|
+
options: Options,
|
|
49
|
+
handler: EndpointHandler<Path, Options, R>,
|
|
50
|
+
): StrictEndpoint<Path, Options, R>;
|
|
51
|
+
|
|
52
|
+
export function createAuthEndpoint<
|
|
53
|
+
Path extends string,
|
|
54
|
+
Options extends EndpointOptions,
|
|
55
|
+
R,
|
|
56
|
+
>(
|
|
57
|
+
options: Options,
|
|
58
|
+
handler: EndpointHandler<Path, Options, R>,
|
|
59
|
+
): StrictEndpoint<Path, Options, R>;
|
|
60
|
+
|
|
61
|
+
export function createAuthEndpoint<
|
|
62
|
+
Path extends string,
|
|
63
|
+
Opts extends EndpointOptions,
|
|
64
|
+
R,
|
|
65
|
+
>(
|
|
66
|
+
pathOrOptions: Path | Opts,
|
|
67
|
+
handlerOrOptions: EndpointHandler<Path, Opts, R> | Opts,
|
|
68
|
+
handlerOrNever?: any,
|
|
69
|
+
) {
|
|
70
|
+
const path: Path | undefined =
|
|
71
|
+
typeof pathOrOptions === "string" ? pathOrOptions : undefined;
|
|
72
|
+
const options: Opts =
|
|
73
|
+
typeof handlerOrOptions === "object"
|
|
74
|
+
? handlerOrOptions
|
|
75
|
+
: (pathOrOptions as Opts);
|
|
76
|
+
const handler: EndpointHandler<Path, Opts, R> =
|
|
77
|
+
typeof handlerOrOptions === "function" ? handlerOrOptions : handlerOrNever;
|
|
78
|
+
|
|
79
|
+
if (path) {
|
|
80
|
+
return createEndpoint(
|
|
81
|
+
path,
|
|
82
|
+
{
|
|
83
|
+
...options,
|
|
84
|
+
use: [...(options?.use || []), ...use],
|
|
85
|
+
},
|
|
86
|
+
// todo: prettify the code, we want to call `runWithEndpointContext` to top level
|
|
87
|
+
async (ctx) => runWithEndpointContext(ctx as any, () => handler(ctx)),
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
|
|
41
91
|
return createEndpoint(
|
|
42
|
-
path,
|
|
43
92
|
{
|
|
44
93
|
...options,
|
|
45
94
|
use: [...(options?.use || []), ...use],
|
|
@@ -47,7 +96,11 @@ export const createAuthEndpoint = <
|
|
|
47
96
|
// todo: prettify the code, we want to call `runWithEndpointContext` to top level
|
|
48
97
|
async (ctx) => runWithEndpointContext(ctx as any, () => handler(ctx)),
|
|
49
98
|
);
|
|
50
|
-
}
|
|
99
|
+
}
|
|
51
100
|
|
|
52
|
-
export type AuthEndpoint
|
|
101
|
+
export type AuthEndpoint<
|
|
102
|
+
Path extends string,
|
|
103
|
+
Opts extends EndpointOptions,
|
|
104
|
+
R,
|
|
105
|
+
> = ReturnType<typeof createAuthEndpoint<Path, Opts, R>>;
|
|
53
106
|
export type AuthMiddleware = ReturnType<typeof createAuthMiddleware>;
|