@neondatabase/auth 0.1.0-beta.20 → 0.1.0-beta.21
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/dist/{adapter-core-8s6XdCco.mjs → adapter-core-PD5NQpLE.mjs} +1 -1
- package/dist/{adapter-core-23fYTUxT.d.mts → adapter-core-y53SWo8w.d.mts} +8 -2
- package/dist/{better-auth-react-adapter-D9tIaEyQ.mjs → better-auth-react-adapter-B0XIXPUH.mjs} +1 -1
- package/dist/{supabase-adapter-Dr-pKvPt.d.mts → better-auth-react-adapter-B7zoQmoL.d.mts} +56 -144
- package/dist/index.d.mts +4 -5
- package/dist/index.mjs +2 -2
- package/dist/{neon-auth-2f58U8_-.mjs → neon-auth-DUbqaO2v.mjs} +1 -1
- package/dist/{neon-auth-CDYpC_O1.d.mts → neon-auth-oDgy6lQm.d.mts} +3 -3
- package/dist/next/index.d.mts +1 -64
- package/dist/next/index.mjs +4 -35
- package/dist/next/server/index.d.mts +50 -6
- package/dist/next/server/index.mjs +300 -1
- package/dist/react/adapters/index.d.mts +3 -4
- package/dist/react/adapters/index.mjs +2 -2
- package/dist/react/index.d.mts +4 -5
- package/dist/react/index.mjs +3 -3
- package/dist/react/ui/index.d.mts +1 -1
- package/dist/react/ui/index.mjs +1 -1
- package/dist/{supabase-adapter-BYMJSxOT.mjs → supabase-adapter-Bdw6aPGx.mjs} +1 -1
- package/dist/{better-auth-react-adapter-QFe5RtaM.d.mts → supabase-adapter-Dm56RKRF.d.mts} +287 -199
- package/dist/types/index.d.mts +1 -2
- package/dist/ui/.safelist.html +1 -1
- package/dist/ui/css.css +1 -1
- package/dist/ui/tailwind.css +1 -1
- package/dist/ui/theme-inline.css +41 -36
- package/dist/ui/theme.css +102 -75
- package/dist/{ui-Cg1EZzGG.mjs → ui-CrxGg6vQ.mjs} +27 -18
- package/dist/vanilla/adapters/index.d.mts +3 -4
- package/dist/vanilla/adapters/index.mjs +2 -2
- package/dist/vanilla/index.d.mts +3 -4
- package/dist/vanilla/index.mjs +2 -2
- package/package.json +3 -3
- package/dist/better-auth-types-BUiggBfa.d.mts +0 -9
- package/dist/index-Bga0CzOO.d.mts +0 -49
- package/dist/middleware-C7jHeulu.mjs +0 -303
- /package/dist/{index-BHI9uOzY.d.mts → index-CPnFzULh.d.mts} +0 -0
- /package/dist/{index-CSe4aQIZ.d.mts → index-CzsGMS7C.d.mts} +0 -0
- /package/dist/{index-LhFpnU-f.d.mts → index-OEBbnNdr.d.mts} +0 -0
|
@@ -3,9 +3,10 @@ import * as better_auth_client35 from "better-auth/client";
|
|
|
3
3
|
import { BetterAuthClientOptions, createAuthClient as createAuthClient$1 } from "better-auth/client";
|
|
4
4
|
import * as zod0 from "zod";
|
|
5
5
|
import * as jose2 from "jose";
|
|
6
|
+
import { Session, User } from "better-auth/types";
|
|
6
7
|
import * as better_auth454 from "better-auth";
|
|
7
8
|
import * as _better_fetch_fetch266 from "@better-fetch/fetch";
|
|
8
|
-
import { BetterFetchError as BetterFetchError$1 } from "@better-fetch/fetch";
|
|
9
|
+
import { BetterFetchError, BetterFetchError as BetterFetchError$1 } from "@better-fetch/fetch";
|
|
9
10
|
import * as better_auth_plugins17 from "better-auth/plugins";
|
|
10
11
|
import * as nanostores7 from "nanostores";
|
|
11
12
|
import * as better_call0 from "better-call";
|
|
@@ -14,6 +15,11 @@ import { JWKOptions, JWSAlgorithms, Jwk, JwtOptions } from "better-auth/plugins/
|
|
|
14
15
|
import { AdminOptions, InferAdminRolesFromOption, SessionWithImpersonatedBy, UserWithRole } from "better-auth/plugins/admin";
|
|
15
16
|
import { EmailOTPOptions } from "better-auth/plugins/email-otp";
|
|
16
17
|
|
|
18
|
+
//#region src/core/better-auth-types.d.ts
|
|
19
|
+
type BetterAuthSession = Session;
|
|
20
|
+
type BetterAuthUser = User;
|
|
21
|
+
type BetterAuthErrorResponse = BetterFetchError;
|
|
22
|
+
//#endregion
|
|
17
23
|
//#region src/types/index.d.ts
|
|
18
24
|
type BetterAuthInstance = ReturnType<typeof createAuthClient$1<{
|
|
19
25
|
plugins: SupportedBetterAuthClientPlugins;
|
|
@@ -1792,4 +1798,4 @@ declare abstract class NeonAuthAdapterCore {
|
|
|
1792
1798
|
getJWTToken(allowAnonymous: boolean): Promise<string | null>;
|
|
1793
1799
|
}
|
|
1794
1800
|
//#endregion
|
|
1795
|
-
export { TeamInput as C, UserWithRole as E, Team as S, TeamMemberInput as T, MemberInput as _, BetterAuthInstance as a, OrganizationRole as b, InferAdminRolesFromOption as c, InvitationStatus as d, JWKOptions as f, Member as g, JwtOptions as h, AdminOptions as i, Invitation as l, Jwk as m, NeonAuthAdapterCoreAuthOptions as n, BetterFetchError$1 as o, JWSAlgorithms as p, SupportedBetterAuthClientPlugins as r, EmailOTPOptions as s, NeonAuthAdapterCore as t, InvitationInput as u, Organization as v, TeamMember as w, SessionWithImpersonatedBy as x, OrganizationInput as y };
|
|
1801
|
+
export { TeamInput as C, BetterAuthErrorResponse as D, UserWithRole as E, BetterAuthSession as O, Team as S, TeamMemberInput as T, MemberInput as _, BetterAuthInstance as a, OrganizationRole as b, InferAdminRolesFromOption as c, InvitationStatus as d, JWKOptions as f, Member as g, JwtOptions as h, AdminOptions as i, BetterAuthUser as k, Invitation as l, Jwk as m, NeonAuthAdapterCoreAuthOptions as n, BetterFetchError$1 as o, JWSAlgorithms as p, SupportedBetterAuthClientPlugins as r, EmailOTPOptions as s, NeonAuthAdapterCore as t, InvitationInput as u, Organization as v, TeamMember as w, SessionWithImpersonatedBy as x, OrganizationInput as y };
|
package/dist/{better-auth-react-adapter-D9tIaEyQ.mjs → better-auth-react-adapter-B0XIXPUH.mjs}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as NeonAuthAdapterCore } from "./adapter-core-
|
|
1
|
+
import { t as NeonAuthAdapterCore } from "./adapter-core-PD5NQpLE.mjs";
|
|
2
2
|
import { createAuthClient } from "better-auth/react";
|
|
3
3
|
|
|
4
4
|
//#region src/adapters/better-auth-react/better-auth-react-adapter.ts
|
|
@@ -1,24 +1,21 @@
|
|
|
1
|
-
import { n as NeonAuthAdapterCoreAuthOptions,
|
|
1
|
+
import { n as NeonAuthAdapterCoreAuthOptions, t as NeonAuthAdapterCore } from "./adapter-core-y53SWo8w.mjs";
|
|
2
2
|
import * as better_auth_client11 from "better-auth/client";
|
|
3
|
-
import { createAuthClient } from "better-auth/client";
|
|
4
|
-
import * as _supabase_auth_js0 from "@supabase/auth-js";
|
|
5
|
-
import { AuthClient, JwtHeader, JwtPayload } from "@supabase/auth-js";
|
|
6
3
|
import * as jose0 from "jose";
|
|
7
4
|
import * as better_auth151 from "better-auth";
|
|
8
5
|
import * as _better_fetch_fetch88 from "@better-fetch/fetch";
|
|
9
6
|
import * as better_auth_plugins5 from "better-auth/plugins";
|
|
10
7
|
import * as nanostores0 from "nanostores";
|
|
11
8
|
|
|
12
|
-
//#region src/adapters/better-auth-
|
|
13
|
-
type
|
|
9
|
+
//#region src/adapters/better-auth-react/better-auth-react-adapter.d.ts
|
|
10
|
+
type BetterAuthReactAdapterOptions = Omit<NeonAuthAdapterCoreAuthOptions, 'baseURL'>;
|
|
14
11
|
/**
|
|
15
|
-
* Internal implementation class - use
|
|
12
|
+
* Internal implementation class - use BetterAuthReactAdapter factory function instead
|
|
16
13
|
*/
|
|
17
|
-
declare class
|
|
14
|
+
declare class BetterAuthReactAdapterImpl extends NeonAuthAdapterCore {
|
|
18
15
|
private _betterAuth;
|
|
19
16
|
constructor(betterAuthClientOptions: NeonAuthAdapterCoreAuthOptions);
|
|
20
17
|
getBetterAuthInstance(): {
|
|
21
|
-
useActiveOrganization:
|
|
18
|
+
useActiveOrganization: () => {
|
|
22
19
|
data: better_auth151.Prettify<{
|
|
23
20
|
id: string;
|
|
24
21
|
name: string;
|
|
@@ -57,8 +54,8 @@ declare class BetterAuthVanillaAdapterImpl extends NeonAuthAdapterCore {
|
|
|
57
54
|
refetch: (queryParams?: {
|
|
58
55
|
query?: better_auth151.SessionQueryParams;
|
|
59
56
|
} | undefined) => Promise<void>;
|
|
60
|
-
}
|
|
61
|
-
useListOrganizations:
|
|
57
|
+
};
|
|
58
|
+
useListOrganizations: () => {
|
|
62
59
|
data: {
|
|
63
60
|
id: string;
|
|
64
61
|
name: string;
|
|
@@ -73,8 +70,8 @@ declare class BetterAuthVanillaAdapterImpl extends NeonAuthAdapterCore {
|
|
|
73
70
|
refetch: (queryParams?: {
|
|
74
71
|
query?: better_auth151.SessionQueryParams;
|
|
75
72
|
} | undefined) => Promise<void>;
|
|
76
|
-
}
|
|
77
|
-
useActiveMember:
|
|
73
|
+
};
|
|
74
|
+
useActiveMember: () => {
|
|
78
75
|
data: {
|
|
79
76
|
id: string;
|
|
80
77
|
organizationId: string;
|
|
@@ -88,8 +85,8 @@ declare class BetterAuthVanillaAdapterImpl extends NeonAuthAdapterCore {
|
|
|
88
85
|
refetch: (queryParams?: {
|
|
89
86
|
query?: better_auth151.SessionQueryParams;
|
|
90
87
|
} | undefined) => Promise<void>;
|
|
91
|
-
}
|
|
92
|
-
useActiveMemberRole:
|
|
88
|
+
};
|
|
89
|
+
useActiveMemberRole: () => {
|
|
93
90
|
data: {
|
|
94
91
|
role: string;
|
|
95
92
|
} | null;
|
|
@@ -99,7 +96,7 @@ declare class BetterAuthVanillaAdapterImpl extends NeonAuthAdapterCore {
|
|
|
99
96
|
refetch: (queryParams?: {
|
|
100
97
|
query?: better_auth151.SessionQueryParams;
|
|
101
98
|
} | undefined) => Promise<void>;
|
|
102
|
-
}
|
|
99
|
+
};
|
|
103
100
|
} & {
|
|
104
101
|
token: <FetchOptions extends better_auth151.ClientFetchOption<never, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: better_auth151.Prettify<{
|
|
105
102
|
query?: Record<string, any> | undefined;
|
|
@@ -1904,7 +1901,7 @@ declare class BetterAuthVanillaAdapterImpl extends NeonAuthAdapterCore {
|
|
|
1904
1901
|
}) => boolean;
|
|
1905
1902
|
};
|
|
1906
1903
|
} & {
|
|
1907
|
-
useSession:
|
|
1904
|
+
useSession: () => {
|
|
1908
1905
|
data: {
|
|
1909
1906
|
user: {
|
|
1910
1907
|
id: string;
|
|
@@ -1932,9 +1929,42 @@ declare class BetterAuthVanillaAdapterImpl extends NeonAuthAdapterCore {
|
|
|
1932
1929
|
activeOrganizationId?: string | null | undefined;
|
|
1933
1930
|
};
|
|
1934
1931
|
} | null;
|
|
1935
|
-
error: _better_fetch_fetch88.BetterFetchError | null;
|
|
1936
1932
|
isPending: boolean;
|
|
1937
|
-
|
|
1933
|
+
isRefetching: boolean;
|
|
1934
|
+
error: _better_fetch_fetch88.BetterFetchError | null;
|
|
1935
|
+
refetch: (queryParams?: {
|
|
1936
|
+
query?: better_auth151.SessionQueryParams;
|
|
1937
|
+
} | undefined) => Promise<void>;
|
|
1938
|
+
};
|
|
1939
|
+
$Infer: {
|
|
1940
|
+
Session: {
|
|
1941
|
+
user: {
|
|
1942
|
+
id: string;
|
|
1943
|
+
createdAt: Date;
|
|
1944
|
+
updatedAt: Date;
|
|
1945
|
+
email: string;
|
|
1946
|
+
emailVerified: boolean;
|
|
1947
|
+
name: string;
|
|
1948
|
+
image?: string | null | undefined;
|
|
1949
|
+
banned: boolean | null | undefined;
|
|
1950
|
+
role?: string | null | undefined;
|
|
1951
|
+
banReason?: string | null | undefined;
|
|
1952
|
+
banExpires?: Date | null | undefined;
|
|
1953
|
+
};
|
|
1954
|
+
session: {
|
|
1955
|
+
id: string;
|
|
1956
|
+
createdAt: Date;
|
|
1957
|
+
updatedAt: Date;
|
|
1958
|
+
userId: string;
|
|
1959
|
+
expiresAt: Date;
|
|
1960
|
+
token: string;
|
|
1961
|
+
ipAddress?: string | null | undefined;
|
|
1962
|
+
userAgent?: string | null | undefined;
|
|
1963
|
+
impersonatedBy?: string | null | undefined;
|
|
1964
|
+
activeOrganizationId?: string | null | undefined;
|
|
1965
|
+
};
|
|
1966
|
+
};
|
|
1967
|
+
};
|
|
1938
1968
|
$fetch: _better_fetch_fetch88.BetterFetch<{
|
|
1939
1969
|
plugins: (_better_fetch_fetch88.BetterFetchPlugin | {
|
|
1940
1970
|
id: string;
|
|
@@ -2006,35 +2036,6 @@ declare class BetterAuthVanillaAdapterImpl extends NeonAuthAdapterCore {
|
|
|
2006
2036
|
listen: (signal: Omit<string, "$sessionSignal"> | "$sessionSignal", listener: (value: boolean, oldValue?: boolean | undefined) => void) => void;
|
|
2007
2037
|
atoms: Record<string, nanostores0.WritableAtom<any>>;
|
|
2008
2038
|
};
|
|
2009
|
-
$Infer: {
|
|
2010
|
-
Session: {
|
|
2011
|
-
user: {
|
|
2012
|
-
id: string;
|
|
2013
|
-
createdAt: Date;
|
|
2014
|
-
updatedAt: Date;
|
|
2015
|
-
email: string;
|
|
2016
|
-
emailVerified: boolean;
|
|
2017
|
-
name: string;
|
|
2018
|
-
image?: string | null | undefined;
|
|
2019
|
-
banned: boolean | null | undefined;
|
|
2020
|
-
role?: string | null | undefined;
|
|
2021
|
-
banReason?: string | null | undefined;
|
|
2022
|
-
banExpires?: Date | null | undefined;
|
|
2023
|
-
};
|
|
2024
|
-
session: {
|
|
2025
|
-
id: string;
|
|
2026
|
-
createdAt: Date;
|
|
2027
|
-
updatedAt: Date;
|
|
2028
|
-
userId: string;
|
|
2029
|
-
expiresAt: Date;
|
|
2030
|
-
token: string;
|
|
2031
|
-
ipAddress?: string | null | undefined;
|
|
2032
|
-
userAgent?: string | null | undefined;
|
|
2033
|
-
impersonatedBy?: string | null | undefined;
|
|
2034
|
-
activeOrganizationId?: string | null | undefined;
|
|
2035
|
-
};
|
|
2036
|
-
};
|
|
2037
|
-
};
|
|
2038
2039
|
$ERROR_CODES: {
|
|
2039
2040
|
readonly FAILED_TO_CREATE_USER: "Failed to create user";
|
|
2040
2041
|
readonly USER_ALREADY_EXISTS: "User already exists.";
|
|
@@ -2140,101 +2141,12 @@ declare class BetterAuthVanillaAdapterImpl extends NeonAuthAdapterCore {
|
|
|
2140
2141
|
};
|
|
2141
2142
|
};
|
|
2142
2143
|
}
|
|
2143
|
-
/** Instance type for
|
|
2144
|
-
type
|
|
2145
|
-
/** Builder type that creates adapter instances */
|
|
2146
|
-
type BetterAuthVanillaAdapterBuilder = (url: string, fetchOptions?: {
|
|
2147
|
-
headers?: Record<string, string>;
|
|
2148
|
-
}) => BetterAuthVanillaAdapterInstance;
|
|
2149
|
-
/**
|
|
2150
|
-
* Factory function that returns an adapter builder.
|
|
2151
|
-
* The builder is called by createClient/createAuthClient with the URL.
|
|
2152
|
-
*
|
|
2153
|
-
* @param options - Optional adapter configuration (baseURL is injected separately)
|
|
2154
|
-
* @returns A builder function that creates the adapter instance
|
|
2155
|
-
*
|
|
2156
|
-
* @example
|
|
2157
|
-
* ```typescript
|
|
2158
|
-
* const client = createClient({
|
|
2159
|
-
* auth: {
|
|
2160
|
-
* url: 'https://auth.example.com',
|
|
2161
|
-
* adapter: BetterAuthVanillaAdapter(),
|
|
2162
|
-
* },
|
|
2163
|
-
* dataApi: { url: 'https://data-api.example.com' },
|
|
2164
|
-
* });
|
|
2165
|
-
* ```
|
|
2166
|
-
*/
|
|
2167
|
-
declare function BetterAuthVanillaAdapter(options?: BetterAuthVanillaAdapterOptions): BetterAuthVanillaAdapterBuilder;
|
|
2168
|
-
//#endregion
|
|
2169
|
-
//#region src/adapters/supabase/auth-interface.d.ts
|
|
2170
|
-
type _UpstreamAuthClientInstance = InstanceType<typeof AuthClient>;
|
|
2171
|
-
type _AuthClientBase = { [K in keyof _UpstreamAuthClientInstance as _UpstreamAuthClientInstance[K] extends never ? never : K]: _UpstreamAuthClientInstance[K] };
|
|
2172
|
-
type SupabaseAuthClientInterface = _AuthClientBase;
|
|
2173
|
-
//#endregion
|
|
2174
|
-
//#region src/adapters/supabase/supabase-adapter.d.ts
|
|
2175
|
-
type SupabaseAuthAdapterOptions = Omit<NeonAuthAdapterCoreAuthOptions, 'baseURL'>;
|
|
2176
|
-
/**
|
|
2177
|
-
* Internal implementation class - use SupabaseAuthAdapter factory function instead
|
|
2178
|
-
*/
|
|
2179
|
-
declare class SupabaseAuthAdapterImpl extends NeonAuthAdapterCore implements SupabaseAuthClientInterface {
|
|
2180
|
-
admin: SupabaseAuthClientInterface['admin'];
|
|
2181
|
-
mfa: SupabaseAuthClientInterface['mfa'];
|
|
2182
|
-
oauth: SupabaseAuthClientInterface['oauth'];
|
|
2183
|
-
private _betterAuth;
|
|
2184
|
-
private _stateChangeEmitters;
|
|
2185
|
-
constructor(betterAuthClientOptions: NeonAuthAdapterCoreAuthOptions);
|
|
2186
|
-
getBetterAuthInstance(): ReturnType<typeof createAuthClient<{
|
|
2187
|
-
plugins: SupportedBetterAuthClientPlugins;
|
|
2188
|
-
}>>;
|
|
2189
|
-
initialize: SupabaseAuthClientInterface['initialize'];
|
|
2190
|
-
getSession(options?: {
|
|
2191
|
-
forceFetch?: boolean;
|
|
2192
|
-
}): ReturnType<SupabaseAuthClientInterface['getSession']>;
|
|
2193
|
-
refreshSession: SupabaseAuthClientInterface['refreshSession'];
|
|
2194
|
-
setSession: SupabaseAuthClientInterface['setSession'];
|
|
2195
|
-
signUp: SupabaseAuthClientInterface['signUp'];
|
|
2196
|
-
signInAnonymously: SupabaseAuthClientInterface['signInAnonymously'];
|
|
2197
|
-
signInWithPassword: SupabaseAuthClientInterface['signInWithPassword'];
|
|
2198
|
-
signInWithOAuth: SupabaseAuthClientInterface['signInWithOAuth'];
|
|
2199
|
-
signInWithOtp: SupabaseAuthClientInterface['signInWithOtp'];
|
|
2200
|
-
signInWithIdToken: SupabaseAuthClientInterface['signInWithIdToken'];
|
|
2201
|
-
signInWithSSO: SupabaseAuthClientInterface['signInWithSSO'];
|
|
2202
|
-
signInWithWeb3: SupabaseAuthClientInterface['signInWithWeb3'];
|
|
2203
|
-
signOut: SupabaseAuthClientInterface['signOut'];
|
|
2204
|
-
getUser: SupabaseAuthClientInterface['getUser'];
|
|
2205
|
-
getClaims: (jwtArg?: string) => Promise<{
|
|
2206
|
-
data: {
|
|
2207
|
-
header: JwtHeader;
|
|
2208
|
-
claims: JwtPayload;
|
|
2209
|
-
signature: Uint8Array<ArrayBufferLike>;
|
|
2210
|
-
};
|
|
2211
|
-
error: null;
|
|
2212
|
-
} | {
|
|
2213
|
-
data: null;
|
|
2214
|
-
error: _supabase_auth_js0.AuthError;
|
|
2215
|
-
}>;
|
|
2216
|
-
updateUser: SupabaseAuthClientInterface['updateUser'];
|
|
2217
|
-
getUserIdentities: SupabaseAuthClientInterface['getUserIdentities'];
|
|
2218
|
-
linkIdentity: SupabaseAuthClientInterface['linkIdentity'];
|
|
2219
|
-
unlinkIdentity: SupabaseAuthClientInterface['unlinkIdentity'];
|
|
2220
|
-
verifyOtp: SupabaseAuthClientInterface['verifyOtp'];
|
|
2221
|
-
resetPasswordForEmail: SupabaseAuthClientInterface['resetPasswordForEmail'];
|
|
2222
|
-
reauthenticate: SupabaseAuthClientInterface['reauthenticate'];
|
|
2223
|
-
resend: SupabaseAuthClientInterface['resend'];
|
|
2224
|
-
exchangeCodeForSession: SupabaseAuthClientInterface['exchangeCodeForSession'];
|
|
2225
|
-
onAuthStateChange: SupabaseAuthClientInterface['onAuthStateChange'];
|
|
2226
|
-
isThrowOnErrorEnabled: SupabaseAuthClientInterface['isThrowOnErrorEnabled'];
|
|
2227
|
-
startAutoRefresh: SupabaseAuthClientInterface['startAutoRefresh'];
|
|
2228
|
-
stopAutoRefresh: SupabaseAuthClientInterface['stopAutoRefresh'];
|
|
2229
|
-
private verifyEmailOtp;
|
|
2230
|
-
private emitInitialSession;
|
|
2231
|
-
}
|
|
2232
|
-
/** Instance type for SupabaseAuthAdapter */
|
|
2233
|
-
type SupabaseAuthAdapterInstance = SupabaseAuthAdapterImpl;
|
|
2144
|
+
/** Instance type for BetterAuthReactAdapter */
|
|
2145
|
+
type BetterAuthReactAdapterInstance = BetterAuthReactAdapterImpl;
|
|
2234
2146
|
/** Builder type that creates adapter instances */
|
|
2235
|
-
type
|
|
2147
|
+
type BetterAuthReactAdapterBuilder = (url: string, fetchOptions?: {
|
|
2236
2148
|
headers?: Record<string, string>;
|
|
2237
|
-
}) =>
|
|
2149
|
+
}) => BetterAuthReactAdapterInstance;
|
|
2238
2150
|
/**
|
|
2239
2151
|
* Factory function that returns an adapter builder.
|
|
2240
2152
|
* The builder is called by createClient/createAuthClient with the URL.
|
|
@@ -2247,12 +2159,12 @@ type SupabaseAuthAdapterBuilder = (url: string, fetchOptions?: {
|
|
|
2247
2159
|
* const client = createClient({
|
|
2248
2160
|
* auth: {
|
|
2249
2161
|
* url: 'https://auth.example.com',
|
|
2250
|
-
* adapter:
|
|
2162
|
+
* adapter: BetterAuthReactAdapter(),
|
|
2251
2163
|
* },
|
|
2252
2164
|
* dataApi: { url: 'https://data-api.example.com' },
|
|
2253
2165
|
* });
|
|
2254
2166
|
* ```
|
|
2255
2167
|
*/
|
|
2256
|
-
declare function
|
|
2168
|
+
declare function BetterAuthReactAdapter(options?: BetterAuthReactAdapterOptions): BetterAuthReactAdapterBuilder;
|
|
2257
2169
|
//#endregion
|
|
2258
|
-
export {
|
|
2170
|
+
export { BetterAuthReactAdapterInstance as n, BetterAuthReactAdapterOptions as r, BetterAuthReactAdapter as t };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import "./adapter-
|
|
3
|
-
import "./
|
|
4
|
-
import "./
|
|
5
|
-
import { a as ReactBetterAuthClient, c as createInternalNeonAuth, i as NeonAuthPublicApi, n as NeonAuthAdapter, o as VanillaBetterAuthClient, r as NeonAuthConfig, s as createAuthClient, t as NeonAuth } from "./neon-auth-CDYpC_O1.mjs";
|
|
1
|
+
import "./adapter-core-y53SWo8w.mjs";
|
|
2
|
+
import "./better-auth-react-adapter-B7zoQmoL.mjs";
|
|
3
|
+
import "./supabase-adapter-Dm56RKRF.mjs";
|
|
4
|
+
import { a as ReactBetterAuthClient, c as createInternalNeonAuth, i as NeonAuthPublicApi, n as NeonAuthAdapter, o as VanillaBetterAuthClient, r as NeonAuthConfig, s as createAuthClient, t as NeonAuth } from "./neon-auth-oDgy6lQm.mjs";
|
|
6
5
|
export { type NeonAuth, type NeonAuthAdapter, type NeonAuthConfig, type NeonAuthPublicApi, type ReactBetterAuthClient, type VanillaBetterAuthClient, createAuthClient, createInternalNeonAuth };
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "./adapter-core-
|
|
2
|
-
import { n as createInternalNeonAuth, t as createAuthClient } from "./neon-auth-
|
|
1
|
+
import "./adapter-core-PD5NQpLE.mjs";
|
|
2
|
+
import { n as createInternalNeonAuth, t as createAuthClient } from "./neon-auth-DUbqaO2v.mjs";
|
|
3
3
|
|
|
4
4
|
export { createAuthClient, createInternalNeonAuth };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { r as SupportedBetterAuthClientPlugins } from "./adapter-core-
|
|
2
|
-
import { n as BetterAuthReactAdapterInstance } from "./better-auth-react-adapter-
|
|
3
|
-
import { r as SupabaseAuthAdapterInstance, s as BetterAuthVanillaAdapterInstance } from "./supabase-adapter-
|
|
1
|
+
import { r as SupportedBetterAuthClientPlugins } from "./adapter-core-y53SWo8w.mjs";
|
|
2
|
+
import { n as BetterAuthReactAdapterInstance } from "./better-auth-react-adapter-B7zoQmoL.mjs";
|
|
3
|
+
import { r as SupabaseAuthAdapterInstance, s as BetterAuthVanillaAdapterInstance } from "./supabase-adapter-Dm56RKRF.mjs";
|
|
4
4
|
import { createAuthClient } from "better-auth/react";
|
|
5
5
|
import { createAuthClient as createAuthClient$1 } from "better-auth/client";
|
|
6
6
|
|
package/dist/next/index.d.mts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import "../better-auth-types-BUiggBfa.mjs";
|
|
2
|
-
import { n as SessionData, t as neonAuthMiddleware$1 } from "../index-Bga0CzOO.mjs";
|
|
3
1
|
import * as better_auth_client0 from "better-auth/client";
|
|
4
2
|
import * as jose0 from "jose";
|
|
5
|
-
import * as next_server0 from "next/server";
|
|
6
3
|
import * as better_auth0 from "better-auth";
|
|
7
4
|
import * as _better_fetch_fetch0 from "@better-fetch/fetch";
|
|
8
5
|
import * as better_auth_plugins0 from "better-auth/plugins";
|
|
@@ -2135,65 +2132,5 @@ declare function createAuthClient(): {
|
|
|
2135
2132
|
readonly USER_ALREADY_HAS_PASSWORD: "User already has a password. Provide that to delete the account.";
|
|
2136
2133
|
};
|
|
2137
2134
|
};
|
|
2138
|
-
/**
|
|
2139
|
-
* @deprecated
|
|
2140
|
-
* - Moved to `@neondatabase/auth/next/server` and
|
|
2141
|
-
* - Moved to `@neondatabase/neon-js/auth/next/server`
|
|
2142
|
-
*
|
|
2143
|
-
* An API route handler to handle the auth requests from the client and proxy them to the Neon Auth.
|
|
2144
|
-
*/
|
|
2145
|
-
declare function authApiHandler(): {
|
|
2146
|
-
GET: (request: Request, {
|
|
2147
|
-
params
|
|
2148
|
-
}: {
|
|
2149
|
-
params: Promise<{
|
|
2150
|
-
path: string[];
|
|
2151
|
-
}>;
|
|
2152
|
-
}) => Promise<Response>;
|
|
2153
|
-
POST: (request: Request, {
|
|
2154
|
-
params
|
|
2155
|
-
}: {
|
|
2156
|
-
params: Promise<{
|
|
2157
|
-
path: string[];
|
|
2158
|
-
}>;
|
|
2159
|
-
}) => Promise<Response>;
|
|
2160
|
-
PUT: (request: Request, {
|
|
2161
|
-
params
|
|
2162
|
-
}: {
|
|
2163
|
-
params: Promise<{
|
|
2164
|
-
path: string[];
|
|
2165
|
-
}>;
|
|
2166
|
-
}) => Promise<Response>;
|
|
2167
|
-
DELETE: (request: Request, {
|
|
2168
|
-
params
|
|
2169
|
-
}: {
|
|
2170
|
-
params: Promise<{
|
|
2171
|
-
path: string[];
|
|
2172
|
-
}>;
|
|
2173
|
-
}) => Promise<Response>;
|
|
2174
|
-
PATCH: (request: Request, {
|
|
2175
|
-
params
|
|
2176
|
-
}: {
|
|
2177
|
-
params: Promise<{
|
|
2178
|
-
path: string[];
|
|
2179
|
-
}>;
|
|
2180
|
-
}) => Promise<Response>;
|
|
2181
|
-
};
|
|
2182
|
-
/**
|
|
2183
|
-
* @deprecated
|
|
2184
|
-
* - Moved to `@neondatabase/auth/next/server` and
|
|
2185
|
-
* - Moved to `@neondatabase/neon-js/auth/next/server`
|
|
2186
|
-
*
|
|
2187
|
-
* A Next.js middleware to protect routes from unauthenticated requests and refresh the session if required.
|
|
2188
|
-
*/
|
|
2189
|
-
declare function neonAuthMiddleware(args: Parameters<typeof neonAuthMiddleware$1>[0]): (request: next_server0.NextRequest) => Promise<next_server0.NextResponse<unknown>>;
|
|
2190
|
-
/**
|
|
2191
|
-
* @deprecated
|
|
2192
|
-
* - Moved to `@neondatabase/auth/next/server` and
|
|
2193
|
-
* - Moved to `@neondatabase/neon-js/auth/next/server`
|
|
2194
|
-
*
|
|
2195
|
-
* A utility function to be used in react server components fetch the session details from the Neon Auth API, if session token is available in cookie.
|
|
2196
|
-
*/
|
|
2197
|
-
declare function neonAuth(): Promise<SessionData>;
|
|
2198
2135
|
//#endregion
|
|
2199
|
-
export {
|
|
2136
|
+
export { createAuthClient };
|
package/dist/next/index.mjs
CHANGED
|
@@ -1,42 +1,11 @@
|
|
|
1
|
-
import "../adapter-core-
|
|
2
|
-
import { t as BetterAuthReactAdapter } from "../better-auth-react-adapter-
|
|
3
|
-
import { t as createAuthClient$1 } from "../neon-auth-
|
|
4
|
-
import { n as neonAuth$1, r as authApiHandler$1, t as neonAuthMiddleware$1 } from "../middleware-C7jHeulu.mjs";
|
|
1
|
+
import "../adapter-core-PD5NQpLE.mjs";
|
|
2
|
+
import { t as BetterAuthReactAdapter } from "../better-auth-react-adapter-B0XIXPUH.mjs";
|
|
3
|
+
import { t as createAuthClient$1 } from "../neon-auth-DUbqaO2v.mjs";
|
|
5
4
|
|
|
6
5
|
//#region src/next/index.ts
|
|
7
6
|
function createAuthClient() {
|
|
8
7
|
return createAuthClient$1(void 0, { adapter: BetterAuthReactAdapter() });
|
|
9
8
|
}
|
|
10
|
-
/**
|
|
11
|
-
* @deprecated
|
|
12
|
-
* - Moved to `@neondatabase/auth/next/server` and
|
|
13
|
-
* - Moved to `@neondatabase/neon-js/auth/next/server`
|
|
14
|
-
*
|
|
15
|
-
* An API route handler to handle the auth requests from the client and proxy them to the Neon Auth.
|
|
16
|
-
*/
|
|
17
|
-
function authApiHandler() {
|
|
18
|
-
return authApiHandler$1();
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* @deprecated
|
|
22
|
-
* - Moved to `@neondatabase/auth/next/server` and
|
|
23
|
-
* - Moved to `@neondatabase/neon-js/auth/next/server`
|
|
24
|
-
*
|
|
25
|
-
* A Next.js middleware to protect routes from unauthenticated requests and refresh the session if required.
|
|
26
|
-
*/
|
|
27
|
-
function neonAuthMiddleware(args) {
|
|
28
|
-
return neonAuthMiddleware$1(args);
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* @deprecated
|
|
32
|
-
* - Moved to `@neondatabase/auth/next/server` and
|
|
33
|
-
* - Moved to `@neondatabase/neon-js/auth/next/server`
|
|
34
|
-
*
|
|
35
|
-
* A utility function to be used in react server components fetch the session details from the Neon Auth API, if session token is available in cookie.
|
|
36
|
-
*/
|
|
37
|
-
function neonAuth() {
|
|
38
|
-
return neonAuth$1();
|
|
39
|
-
}
|
|
40
9
|
|
|
41
10
|
//#endregion
|
|
42
|
-
export {
|
|
11
|
+
export { createAuthClient };
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import "../../
|
|
2
|
-
import "../../adapter-
|
|
3
|
-
import "../../
|
|
4
|
-
import "../../
|
|
5
|
-
import {
|
|
6
|
-
import { r as neonAuth, t as neonAuthMiddleware } from "../../index-Bga0CzOO.mjs";
|
|
1
|
+
import { O as BetterAuthSession, k as BetterAuthUser } from "../../adapter-core-y53SWo8w.mjs";
|
|
2
|
+
import "../../better-auth-react-adapter-B7zoQmoL.mjs";
|
|
3
|
+
import "../../supabase-adapter-Dm56RKRF.mjs";
|
|
4
|
+
import { o as VanillaBetterAuthClient } from "../../neon-auth-oDgy6lQm.mjs";
|
|
5
|
+
import { NextRequest, NextResponse } from "next/server";
|
|
7
6
|
|
|
8
7
|
//#region src/server/endpoints.d.ts
|
|
9
8
|
|
|
@@ -281,6 +280,51 @@ type TopLevelEndpointKeys<T> = { [K in keyof T]: K }[keyof T];
|
|
|
281
280
|
type ServerAuthMethods = TopLevelEndpointKeys<typeof API_ENDPOINTS>;
|
|
282
281
|
type NeonAuthServer = Pick<VanillaBetterAuthClient, ServerAuthMethods>;
|
|
283
282
|
//#endregion
|
|
283
|
+
//#region src/next/auth/session.d.ts
|
|
284
|
+
type SessionData = {
|
|
285
|
+
session: BetterAuthSession;
|
|
286
|
+
user: BetterAuthUser;
|
|
287
|
+
} | {
|
|
288
|
+
session: null;
|
|
289
|
+
user: null;
|
|
290
|
+
};
|
|
291
|
+
/**
|
|
292
|
+
* A utility function to be used in react server components fetch the session details from the Neon Auth API, if session token is available in cookie.
|
|
293
|
+
*
|
|
294
|
+
* @returns - `{ session: Session, user: User }` | `{ session: null, user: null}`.
|
|
295
|
+
*
|
|
296
|
+
* @example
|
|
297
|
+
* ```ts
|
|
298
|
+
* import { neonAuth } from "@neondatabase/auth/next/server"
|
|
299
|
+
*
|
|
300
|
+
* const { session, user } = await neonAuth()
|
|
301
|
+
* ```
|
|
302
|
+
*/
|
|
303
|
+
declare const neonAuth: () => Promise<SessionData>;
|
|
304
|
+
//#endregion
|
|
305
|
+
//#region src/next/middleware/index.d.ts
|
|
306
|
+
type NeonAuthMiddlewareOptions = {
|
|
307
|
+
loginUrl?: string;
|
|
308
|
+
};
|
|
309
|
+
/**
|
|
310
|
+
* A Next.js middleware to protect routes from unauthenticated requests and refresh the session if required.
|
|
311
|
+
*
|
|
312
|
+
* @param loginUrl - The URL to redirect to when the user is not authenticated.
|
|
313
|
+
* @returns A middleware function that can be used in the Next.js app.
|
|
314
|
+
*
|
|
315
|
+
* @example
|
|
316
|
+
* ```ts
|
|
317
|
+
* import { neonAuthMiddleware } from "@neondatabase/auth/next"
|
|
318
|
+
*
|
|
319
|
+
* export default neonAuthMiddleware({
|
|
320
|
+
* loginUrl: '/auth/sign-in',
|
|
321
|
+
* });
|
|
322
|
+
* ```
|
|
323
|
+
*/
|
|
324
|
+
declare function neonAuthMiddleware({
|
|
325
|
+
loginUrl
|
|
326
|
+
}: NeonAuthMiddlewareOptions): (request: NextRequest) => Promise<NextResponse<unknown>>;
|
|
327
|
+
//#endregion
|
|
284
328
|
//#region src/next/handler/index.d.ts
|
|
285
329
|
type Params = {
|
|
286
330
|
path: string[];
|