@better-auth/core 1.4.6-beta.4 → 1.4.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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @better-auth/core@1.4.6-beta.4 build /home/runner/work/better-auth/better-auth/packages/core
2
+ > @better-auth/core@1.4.6 build /home/runner/work/better-auth/better-auth/packages/core
3
3
  > tsdown
4
4
 
5
5
  ℹ tsdown v0.17.0 powered by rolldown v1.0.0-beta.53
@@ -7,7 +7,7 @@
7
7
  ℹ entry: src/index.ts, src/db/index.ts, src/db/adapter/index.ts, src/async_hooks/index.ts, src/context/index.ts, src/env/index.ts, src/oauth2/index.ts, src/api/index.ts, src/social-providers/index.ts, src/utils/index.ts, src/error/index.ts
8
8
  ℹ tsconfig: tsconfig.json
9
9
  ℹ Build start
10
- ℹ dist/social-providers/index.mjs  80.39 kB │ gzip: 10.31 kB
10
+ ℹ dist/social-providers/index.mjs  80.70 kB │ gzip: 10.32 kB
11
11
  ℹ dist/db/adapter/index.mjs  38.13 kB │ gzip: 7.79 kB
12
12
  ℹ dist/db/index.mjs  1.66 kB │ gzip: 0.54 kB
13
13
  ℹ dist/api/index.mjs  0.86 kB │ gzip: 0.42 kB
@@ -28,16 +28,16 @@
28
28
  ℹ dist/social-providers/index.d.mts  3.88 kB │ gzip: 1.19 kB
29
29
  ℹ dist/context/index.d.mts  3.02 kB │ gzip: 0.95 kB
30
30
  ℹ dist/error/index.d.mts  1.84 kB │ gzip: 0.72 kB
31
- ℹ dist/db/adapter/index.d.mts  1.34 kB │ gzip: 0.42 kB
31
+ ℹ dist/db/adapter/index.d.mts  1.34 kB │ gzip: 0.43 kB
32
32
  ℹ dist/utils/index.d.mts  1.19 kB │ gzip: 0.55 kB
33
33
  ℹ dist/db/index.d.mts  1.04 kB │ gzip: 0.38 kB
34
34
  ℹ dist/index.d.mts  0.86 kB │ gzip: 0.33 kB
35
- ℹ dist/oauth2/index.d.mts  0.76 kB │ gzip: 0.28 kB
35
+ ℹ dist/oauth2/index.d.mts  0.76 kB │ gzip: 0.29 kB
36
36
  ℹ dist/env/index.d.mts  0.59 kB │ gzip: 0.30 kB
37
37
  ℹ dist/api/index.d.mts  0.26 kB │ gzip: 0.14 kB
38
38
  ℹ dist/async_hooks/index.d.mts  0.14 kB │ gzip: 0.10 kB
39
- ℹ dist/index-Bp1Bfmzt.d.mts 218.16 kB │ gzip: 34.38 kB
39
+ ℹ dist/index-D6KwwQy5.d.mts 218.31 kB │ gzip: 34.38 kB
40
40
  ℹ dist/index-D4vfN5ui.d.mts  3.31 kB │ gzip: 1.11 kB
41
41
  ℹ dist/index-Da4Ujjef.d.mts  0.24 kB │ gzip: 0.16 kB
42
- ℹ 32 files, total: 392.08 kB
43
- ✔ Build complete in 4911ms
42
+ ℹ 32 files, total: 392.54 kB
43
+ ✔ Build complete in 4673ms
@@ -1,2 +1,2 @@
1
- import { a as optionsMiddleware, i as createAuthMiddleware, n as AuthMiddleware, r as createAuthEndpoint, t as AuthEndpoint } from "../index-Bp1Bfmzt.mjs";
1
+ import { a as optionsMiddleware, i as createAuthMiddleware, n as AuthMiddleware, r as createAuthEndpoint, t as AuthEndpoint } from "../index-D6KwwQy5.mjs";
2
2
  export { AuthEndpoint, AuthMiddleware, createAuthEndpoint, createAuthMiddleware, optionsMiddleware };
@@ -1,4 +1,4 @@
1
- import { Kn as DBAdapter, Zn as DBTransactionAdapter, f as AuthContext } from "../index-Bp1Bfmzt.mjs";
1
+ import { Kn as DBAdapter, Zn as DBTransactionAdapter, f as AuthContext } from "../index-D6KwwQy5.mjs";
2
2
  import { t as AsyncLocalStorage } from "../index-Da4Ujjef.mjs";
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-Bp1Bfmzt.mjs";
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-D6KwwQy5.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 };
@@ -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-Bp1Bfmzt.mjs";
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-D6KwwQy5.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 };
@@ -2842,6 +2842,7 @@ declare const kick: (options: KickOptions) => {
2842
2842
  codeVerifier?: string | undefined;
2843
2843
  deviceId?: string | undefined;
2844
2844
  }): Promise<OAuth2Tokens>;
2845
+ refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
2845
2846
  getUserInfo(token: OAuth2Tokens & {
2846
2847
  user?: {
2847
2848
  name?: {
@@ -5222,6 +5223,7 @@ declare const socialProviders: {
5222
5223
  codeVerifier?: string | undefined;
5223
5224
  deviceId?: string | undefined;
5224
5225
  }): Promise<OAuth2Tokens>;
5226
+ refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
5225
5227
  getUserInfo(token: OAuth2Tokens & {
5226
5228
  user?: {
5227
5229
  name?: {
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-Bp1Bfmzt.mjs";
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-D6KwwQy5.mjs";
2
2
  export { AuthContext, BetterAuthAdvancedOptions, BetterAuthClientOptions, BetterAuthClientPlugin, BetterAuthCookies, BetterAuthOptions, BetterAuthPlugin, BetterAuthRateLimitOptions, ClientAtomListener, ClientFetchOption, ClientStore, GenerateIdFn, GenericEndpointContext, HookEndpointContext, InternalAdapter, LiteralString, LiteralUnion, Prettify, StandardSchemaV1 };
@@ -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-Bp1Bfmzt.mjs";
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-D6KwwQy5.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-Bp1Bfmzt.mjs";
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-D6KwwQy5.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 };
@@ -1037,6 +1037,16 @@ const kick = (options) => {
1037
1037
  codeVerifier
1038
1038
  });
1039
1039
  },
1040
+ refreshAccessToken: options.refreshAccessToken ? options.refreshAccessToken : async (refreshToken) => {
1041
+ return refreshAccessToken({
1042
+ refreshToken,
1043
+ options: {
1044
+ clientId: options.clientId,
1045
+ clientSecret: options.clientSecret
1046
+ },
1047
+ tokenEndpoint: "https://id.kick.com/oauth/token"
1048
+ });
1049
+ },
1040
1050
  async getUserInfo(token) {
1041
1051
  if (options.getUserInfo) return options.getUserInfo(token);
1042
1052
  const { data, error } = await betterFetch("https://api.kick.com/public/v1/users", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@better-auth/core",
3
- "version": "1.4.6-beta.4",
3
+ "version": "1.4.6",
4
4
  "description": "The most comprehensive authentication framework for TypeScript.",
5
5
  "type": "module",
6
6
  "repository": {
@@ -1,6 +1,10 @@
1
1
  import { betterFetch } from "@better-fetch/fetch";
2
2
  import type { OAuthProvider, ProviderOptions } from "../oauth2";
3
- import { createAuthorizationURL, validateAuthorizationCode } from "../oauth2";
3
+ import {
4
+ createAuthorizationURL,
5
+ refreshAccessToken,
6
+ validateAuthorizationCode,
7
+ } from "../oauth2";
4
8
 
5
9
  export interface KickProfile {
6
10
  /**
@@ -53,6 +57,18 @@ export const kick = (options: KickOptions) => {
53
57
  codeVerifier,
54
58
  });
55
59
  },
60
+ refreshAccessToken: options.refreshAccessToken
61
+ ? options.refreshAccessToken
62
+ : async (refreshToken) => {
63
+ return refreshAccessToken({
64
+ refreshToken,
65
+ options: {
66
+ clientId: options.clientId,
67
+ clientSecret: options.clientSecret,
68
+ },
69
+ tokenEndpoint: "https://id.kick.com/oauth/token",
70
+ });
71
+ },
56
72
  async getUserInfo(token) {
57
73
  if (options.getUserInfo) {
58
74
  return options.getUserInfo(token);