@neondatabase/auth 0.1.0-beta.16 → 0.1.0-beta.18

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,24 +1,21 @@
1
- import { n as NeonAuthAdapterCoreAuthOptions, r as SupportedBetterAuthClientPlugins, t as NeonAuthAdapterCore } from "./adapter-core-DYWYECKK.mjs";
1
+ import { n as NeonAuthAdapterCoreAuthOptions, t as NeonAuthAdapterCore } from "./adapter-core-Sx7jkLdB.mjs";
2
2
  import * as better_auth_client11 from "better-auth/client";
3
- import { createAuthClient } from "better-auth/client";
4
3
  import * as better_auth_client_plugins5 from "better-auth/client/plugins";
5
- import * as _supabase_auth_js0 from "@supabase/auth-js";
6
- import { AuthClient, JwtHeader, JwtPayload } from "@supabase/auth-js";
7
4
  import * as jose0 from "jose";
8
5
  import * as better_auth151 from "better-auth";
9
6
  import * as _better_fetch_fetch88 from "@better-fetch/fetch";
10
7
  import * as nanostores0 from "nanostores";
11
8
 
12
- //#region src/adapters/better-auth-vanilla/better-auth-vanilla-adapter.d.ts
13
- type BetterAuthVanillaAdapterOptions = Omit<NeonAuthAdapterCoreAuthOptions, 'baseURL'>;
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 BetterAuthVanillaAdapter factory function instead
12
+ * Internal implementation class - use BetterAuthReactAdapter factory function instead
16
13
  */
17
- declare class BetterAuthVanillaAdapterImpl extends NeonAuthAdapterCore {
14
+ declare class BetterAuthReactAdapterImpl extends NeonAuthAdapterCore {
18
15
  private _betterAuth;
19
16
  constructor(betterAuthClientOptions: NeonAuthAdapterCoreAuthOptions);
20
17
  getBetterAuthInstance(): {
21
- useActiveOrganization: nanostores0.PreinitializedWritableAtom<{
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
- }> & object;
61
- useListOrganizations: nanostores0.PreinitializedWritableAtom<{
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
- }> & object;
77
- useActiveMember: nanostores0.PreinitializedWritableAtom<{
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
- }> & object;
92
- useActiveMemberRole: nanostores0.PreinitializedWritableAtom<{
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
- }> & object;
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: nanostores0.Atom<{
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,97 +2141,10 @@ declare class BetterAuthVanillaAdapterImpl extends NeonAuthAdapterCore {
2140
2141
  };
2141
2142
  };
2142
2143
  }
2143
- /** Instance type for BetterAuthVanillaAdapter */
2144
- type BetterAuthVanillaAdapterInstance = BetterAuthVanillaAdapterImpl;
2145
- /** Builder type that creates adapter instances */
2146
- type BetterAuthVanillaAdapterBuilder = (url: string) => BetterAuthVanillaAdapterInstance;
2147
- /**
2148
- * Factory function that returns an adapter builder.
2149
- * The builder is called by createClient/createAuthClient with the URL.
2150
- *
2151
- * @param options - Optional adapter configuration (baseURL is injected separately)
2152
- * @returns A builder function that creates the adapter instance
2153
- *
2154
- * @example
2155
- * ```typescript
2156
- * const client = createClient({
2157
- * auth: {
2158
- * url: 'https://auth.example.com',
2159
- * adapter: BetterAuthVanillaAdapter(),
2160
- * },
2161
- * dataApi: { url: 'https://data-api.example.com' },
2162
- * });
2163
- * ```
2164
- */
2165
- declare function BetterAuthVanillaAdapter(options?: BetterAuthVanillaAdapterOptions): BetterAuthVanillaAdapterBuilder;
2166
- //#endregion
2167
- //#region src/adapters/supabase/auth-interface.d.ts
2168
- type _UpstreamAuthClientInstance = InstanceType<typeof AuthClient>;
2169
- type _AuthClientBase = { [K in keyof _UpstreamAuthClientInstance as _UpstreamAuthClientInstance[K] extends never ? never : K]: _UpstreamAuthClientInstance[K] };
2170
- type SupabaseAuthClientInterface = _AuthClientBase;
2171
- //#endregion
2172
- //#region src/adapters/supabase/supabase-adapter.d.ts
2173
- type SupabaseAuthAdapterOptions = Omit<NeonAuthAdapterCoreAuthOptions, 'baseURL'>;
2174
- /**
2175
- * Internal implementation class - use SupabaseAuthAdapter factory function instead
2176
- */
2177
- declare class SupabaseAuthAdapterImpl extends NeonAuthAdapterCore implements SupabaseAuthClientInterface {
2178
- admin: SupabaseAuthClientInterface['admin'];
2179
- mfa: SupabaseAuthClientInterface['mfa'];
2180
- oauth: SupabaseAuthClientInterface['oauth'];
2181
- private _betterAuth;
2182
- private _stateChangeEmitters;
2183
- constructor(betterAuthClientOptions: NeonAuthAdapterCoreAuthOptions);
2184
- getBetterAuthInstance(): ReturnType<typeof createAuthClient<{
2185
- plugins: SupportedBetterAuthClientPlugins;
2186
- }>>;
2187
- initialize: SupabaseAuthClientInterface['initialize'];
2188
- getSession(options?: {
2189
- forceFetch?: boolean;
2190
- }): ReturnType<SupabaseAuthClientInterface['getSession']>;
2191
- refreshSession: SupabaseAuthClientInterface['refreshSession'];
2192
- setSession: SupabaseAuthClientInterface['setSession'];
2193
- signUp: SupabaseAuthClientInterface['signUp'];
2194
- signInAnonymously: SupabaseAuthClientInterface['signInAnonymously'];
2195
- signInWithPassword: SupabaseAuthClientInterface['signInWithPassword'];
2196
- signInWithOAuth: SupabaseAuthClientInterface['signInWithOAuth'];
2197
- signInWithOtp: SupabaseAuthClientInterface['signInWithOtp'];
2198
- signInWithIdToken: SupabaseAuthClientInterface['signInWithIdToken'];
2199
- signInWithSSO: SupabaseAuthClientInterface['signInWithSSO'];
2200
- signInWithWeb3: SupabaseAuthClientInterface['signInWithWeb3'];
2201
- signOut: SupabaseAuthClientInterface['signOut'];
2202
- getUser: SupabaseAuthClientInterface['getUser'];
2203
- getClaims: (jwtArg?: string) => Promise<{
2204
- data: {
2205
- header: JwtHeader;
2206
- claims: JwtPayload;
2207
- signature: Uint8Array<ArrayBufferLike>;
2208
- };
2209
- error: null;
2210
- } | {
2211
- data: null;
2212
- error: _supabase_auth_js0.AuthError;
2213
- }>;
2214
- updateUser: SupabaseAuthClientInterface['updateUser'];
2215
- getUserIdentities: SupabaseAuthClientInterface['getUserIdentities'];
2216
- linkIdentity: SupabaseAuthClientInterface['linkIdentity'];
2217
- unlinkIdentity: SupabaseAuthClientInterface['unlinkIdentity'];
2218
- verifyOtp: SupabaseAuthClientInterface['verifyOtp'];
2219
- resetPasswordForEmail: SupabaseAuthClientInterface['resetPasswordForEmail'];
2220
- reauthenticate: SupabaseAuthClientInterface['reauthenticate'];
2221
- resend: SupabaseAuthClientInterface['resend'];
2222
- exchangeCodeForSession: SupabaseAuthClientInterface['exchangeCodeForSession'];
2223
- onAuthStateChange: SupabaseAuthClientInterface['onAuthStateChange'];
2224
- isThrowOnErrorEnabled: SupabaseAuthClientInterface['isThrowOnErrorEnabled'];
2225
- startAutoRefresh: SupabaseAuthClientInterface['startAutoRefresh'];
2226
- stopAutoRefresh: SupabaseAuthClientInterface['stopAutoRefresh'];
2227
- private verifyEmailOtp;
2228
- private emitInitialSession;
2229
- }
2230
- /** Instance type for SupabaseAuthAdapter */
2231
- type SupabaseAuthAdapterInstance = SupabaseAuthAdapterImpl;
2144
+ /** Instance type for BetterAuthReactAdapter */
2145
+ type BetterAuthReactAdapterInstance = BetterAuthReactAdapterImpl;
2232
2146
  /** Builder type that creates adapter instances */
2233
- type SupabaseAuthAdapterBuilder = (url: string) => SupabaseAuthAdapterInstance;
2147
+ type BetterAuthReactAdapterBuilder = (url: string) => BetterAuthReactAdapterInstance;
2234
2148
  /**
2235
2149
  * Factory function that returns an adapter builder.
2236
2150
  * The builder is called by createClient/createAuthClient with the URL.
@@ -2243,12 +2157,12 @@ type SupabaseAuthAdapterBuilder = (url: string) => SupabaseAuthAdapterInstance;
2243
2157
  * const client = createClient({
2244
2158
  * auth: {
2245
2159
  * url: 'https://auth.example.com',
2246
- * adapter: SupabaseAuthAdapter(),
2160
+ * adapter: BetterAuthReactAdapter(),
2247
2161
  * },
2248
2162
  * dataApi: { url: 'https://data-api.example.com' },
2249
2163
  * });
2250
2164
  * ```
2251
2165
  */
2252
- declare function SupabaseAuthAdapter(options?: SupabaseAuthAdapterOptions): SupabaseAuthAdapterBuilder;
2166
+ declare function BetterAuthReactAdapter(options?: BetterAuthReactAdapterOptions): BetterAuthReactAdapterBuilder;
2253
2167
  //#endregion
2254
- export { BetterAuthVanillaAdapter as a, BetterAuthVanillaAdapterOptions as c, SupabaseAuthAdapterOptions as i, SupabaseAuthAdapterBuilder as n, BetterAuthVanillaAdapterBuilder as o, SupabaseAuthAdapterInstance as r, BetterAuthVanillaAdapterInstance as s, SupabaseAuthAdapter as t };
2168
+ export { BetterAuthReactAdapterOptions as i, BetterAuthReactAdapterBuilder as n, BetterAuthReactAdapterInstance as r, BetterAuthReactAdapter as t };
@@ -1,56 +1,27 @@
1
1
  import { n as BetterAuthSession, r as BetterAuthUser } from "./better-auth-types-Kq3kGuiz.mjs";
2
2
  import { NextRequest, NextResponse } from "next/server";
3
3
 
4
- //#region src/next/handler/index.d.ts
5
- type Params = {
6
- path: string[];
4
+ //#region src/next/auth/session.d.ts
5
+ type SessionData = {
6
+ session: BetterAuthSession;
7
+ user: BetterAuthUser;
8
+ } | {
9
+ session: null;
10
+ user: null;
7
11
  };
8
12
  /**
13
+ * 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.
9
14
  *
10
- * An API route handler to handle the auth requests from the client and proxy them to the Neon Auth.
11
- *
12
- * @returns A Next.js API handler functions those can be used in a Next.js route.
15
+ * @returns - `{ session: Session, user: User }` | `{ session: null, user: null}`.
13
16
  *
14
17
  * @example
15
- *
16
- * Mount the `authApiHandler` to an API route. Create a route file inside `/api/auth/[...all]/route.ts` directory.
17
- * And add the following code:
18
- *
19
18
  * ```ts
19
+ * import { neonAuth } from "@neondatabase/auth/next"
20
20
  *
21
- * import { authApiHandler } from '@neondatabase/auth/next';
22
- *
23
- * export const { GET, POST } = authApiHandler();
21
+ * const { session, user } = await neonAuth()
24
22
  * ```
25
- *
26
23
  */
27
- declare function authApiHandler(): {
28
- GET: (request: Request, {
29
- params
30
- }: {
31
- params: Promise<Params>;
32
- }) => Promise<Response>;
33
- POST: (request: Request, {
34
- params
35
- }: {
36
- params: Promise<Params>;
37
- }) => Promise<Response>;
38
- PUT: (request: Request, {
39
- params
40
- }: {
41
- params: Promise<Params>;
42
- }) => Promise<Response>;
43
- DELETE: (request: Request, {
44
- params
45
- }: {
46
- params: Promise<Params>;
47
- }) => Promise<Response>;
48
- PATCH: (request: Request, {
49
- params
50
- }: {
51
- params: Promise<Params>;
52
- }) => Promise<Response>;
53
- };
24
+ declare const neonAuth: () => Promise<SessionData>;
54
25
  //#endregion
55
26
  //#region src/next/middleware/index.d.ts
56
27
  type NeonAuthMiddlewareOptions = {
@@ -75,26 +46,4 @@ declare function neonAuthMiddleware({
75
46
  loginUrl
76
47
  }: NeonAuthMiddlewareOptions): (request: NextRequest) => Promise<NextResponse<unknown>>;
77
48
  //#endregion
78
- //#region src/next/auth/session.d.ts
79
- type SessionData = {
80
- session: BetterAuthSession;
81
- user: BetterAuthUser;
82
- } | {
83
- session: null;
84
- user: null;
85
- };
86
- /**
87
- * 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.
88
- *
89
- * @returns - `{ session: Session, user: User }` | `{ session: null, user: null}`.
90
- *
91
- * @example
92
- * ```ts
93
- * import { neonAuth } from "@neondatabase/auth/next"
94
- *
95
- * const { session, user } = await neonAuth()
96
- * ```
97
- */
98
- declare const neonAuth: () => Promise<SessionData>;
99
- //#endregion
100
- export { neonAuthMiddleware as n, authApiHandler as r, neonAuth as t };
49
+ export { SessionData as n, neonAuth as r, neonAuthMiddleware as t };
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import "./better-auth-types-Kq3kGuiz.mjs";
2
- import "./adapter-core-DYWYECKK.mjs";
3
- import "./better-auth-react-adapter-tKs79AwE.mjs";
4
- import "./supabase-adapter-DtT0d6It.mjs";
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-B_otuPjh.mjs";
2
+ import "./adapter-core-Sx7jkLdB.mjs";
3
+ import "./better-auth-react-adapter-BWH-XVdf.mjs";
4
+ import "./supabase-adapter-k8RBezY9.mjs";
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-DDPaciiS.mjs";
6
6
  export { type NeonAuth, type NeonAuthAdapter, type NeonAuthConfig, type NeonAuthPublicApi, type ReactBetterAuthClient, type VanillaBetterAuthClient, createAuthClient, createInternalNeonAuth };
@@ -140,17 +140,15 @@ const prepareResponseHeaders = (response) => {
140
140
  * @returns A Next.js API handler functions those can be used in a Next.js route.
141
141
  *
142
142
  * @example
143
- *
144
143
  * Mount the `authApiHandler` to an API route. Create a route file inside `/api/auth/[...all]/route.ts` directory.
145
144
  * And add the following code:
146
145
  *
147
146
  * ```ts
148
- *
147
+ * // app/api/auth/[...all]/route.ts
149
148
  * import { authApiHandler } from '@neondatabase/auth/next';
150
149
  *
151
150
  * export const { GET, POST } = authApiHandler();
152
151
  * ```
153
- *
154
152
  */
155
153
  function authApiHandler() {
156
154
  const baseURL = process.env.NEON_AUTH_BASE_URL;
@@ -1,6 +1,6 @@
1
- import { r as SupportedBetterAuthClientPlugins } from "./adapter-core-DYWYECKK.mjs";
2
- import { r as BetterAuthReactAdapterInstance } from "./better-auth-react-adapter-tKs79AwE.mjs";
3
- import { r as SupabaseAuthAdapterInstance, s as BetterAuthVanillaAdapterInstance } from "./supabase-adapter-DtT0d6It.mjs";
1
+ import { r as SupportedBetterAuthClientPlugins } from "./adapter-core-Sx7jkLdB.mjs";
2
+ import { r as BetterAuthReactAdapterInstance } from "./better-auth-react-adapter-BWH-XVdf.mjs";
3
+ import { r as SupabaseAuthAdapterInstance, s as BetterAuthVanillaAdapterInstance } from "./supabase-adapter-k8RBezY9.mjs";
4
4
  import { createAuthClient } from "better-auth/react";
5
5
  import { createAuthClient as createAuthClient$1 } from "better-auth/client";
6
6
 
@@ -1,8 +1,9 @@
1
1
  import "../better-auth-types-Kq3kGuiz.mjs";
2
- import { n as neonAuthMiddleware, r as authApiHandler, t as neonAuth } from "../index-B6dAIdkW.mjs";
2
+ import { n as SessionData, t as neonAuthMiddleware$1 } from "../index-B4dy0AqC.mjs";
3
3
  import * as better_auth_client0 from "better-auth/client";
4
4
  import * as better_auth_client_plugins0 from "better-auth/client/plugins";
5
5
  import * as jose0 from "jose";
6
+ import * as next_server0 from "next/server";
6
7
  import * as better_auth0 from "better-auth";
7
8
  import * as _better_fetch_fetch0 from "@better-fetch/fetch";
8
9
  import * as nanostores0 from "nanostores";
@@ -2134,5 +2135,65 @@ declare function createAuthClient(): {
2134
2135
  readonly USER_ALREADY_HAS_PASSWORD: "User already has a password. Provide that to delete the account.";
2135
2136
  };
2136
2137
  };
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>;
2137
2198
  //#endregion
2138
2199
  export { authApiHandler, createAuthClient, neonAuth, neonAuthMiddleware };
@@ -1,12 +1,42 @@
1
1
  import "../adapter-core-BQ6ga1zK.mjs";
2
2
  import { t as BetterAuthReactAdapter } from "../better-auth-react-adapter-BLKXYcWM.mjs";
3
3
  import { t as createAuthClient$1 } from "../neon-auth-ClDZNB9a.mjs";
4
- import { n as neonAuth, r as authApiHandler, t as neonAuthMiddleware } from "../middleware-DXwLKcbA.mjs";
4
+ import { n as neonAuth$1, r as authApiHandler$1, t as neonAuthMiddleware$1 } from "../middleware-DPLYghmx.mjs";
5
5
 
6
6
  //#region src/next/index.ts
7
7
  function createAuthClient() {
8
8
  return createAuthClient$1(void 0, { adapter: BetterAuthReactAdapter() });
9
9
  }
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
+ }
10
40
 
11
41
  //#endregion
12
42
  export { authApiHandler, createAuthClient, neonAuth, neonAuthMiddleware };
@@ -1,9 +1,9 @@
1
1
  import "../../better-auth-types-Kq3kGuiz.mjs";
2
- import "../../adapter-core-DYWYECKK.mjs";
3
- import "../../better-auth-react-adapter-tKs79AwE.mjs";
4
- import "../../supabase-adapter-DtT0d6It.mjs";
5
- import { o as VanillaBetterAuthClient } from "../../neon-auth-B_otuPjh.mjs";
6
- import { n as neonAuthMiddleware, r as authApiHandler, t as neonAuth } from "../../index-B6dAIdkW.mjs";
2
+ import "../../adapter-core-Sx7jkLdB.mjs";
3
+ import "../../better-auth-react-adapter-BWH-XVdf.mjs";
4
+ import "../../supabase-adapter-k8RBezY9.mjs";
5
+ import { o as VanillaBetterAuthClient } from "../../neon-auth-DDPaciiS.mjs";
6
+ import { r as neonAuth, t as neonAuthMiddleware } from "../../index-B4dy0AqC.mjs";
7
7
 
8
8
  //#region src/server/endpoints.d.ts
9
9
 
@@ -281,6 +281,55 @@ type TopLevelEndpointKeys<T> = { [K in keyof T]: K }[keyof T];
281
281
  type ServerAuthMethods = TopLevelEndpointKeys<typeof API_ENDPOINTS>;
282
282
  type NeonAuthServer = Pick<VanillaBetterAuthClient, ServerAuthMethods>;
283
283
  //#endregion
284
+ //#region src/next/handler/index.d.ts
285
+ type Params = {
286
+ path: string[];
287
+ };
288
+ /**
289
+ *
290
+ * An API route handler to handle the auth requests from the client and proxy them to the Neon Auth.
291
+ *
292
+ * @returns A Next.js API handler functions those can be used in a Next.js route.
293
+ *
294
+ * @example
295
+ * Mount the `authApiHandler` to an API route. Create a route file inside `/api/auth/[...all]/route.ts` directory.
296
+ * And add the following code:
297
+ *
298
+ * ```ts
299
+ * // app/api/auth/[...all]/route.ts
300
+ * import { authApiHandler } from '@neondatabase/auth/next';
301
+ *
302
+ * export const { GET, POST } = authApiHandler();
303
+ * ```
304
+ */
305
+ declare function authApiHandler(): {
306
+ GET: (request: Request, {
307
+ params
308
+ }: {
309
+ params: Promise<Params>;
310
+ }) => Promise<Response>;
311
+ POST: (request: Request, {
312
+ params
313
+ }: {
314
+ params: Promise<Params>;
315
+ }) => Promise<Response>;
316
+ PUT: (request: Request, {
317
+ params
318
+ }: {
319
+ params: Promise<Params>;
320
+ }) => Promise<Response>;
321
+ DELETE: (request: Request, {
322
+ params
323
+ }: {
324
+ params: Promise<Params>;
325
+ }) => Promise<Response>;
326
+ PATCH: (request: Request, {
327
+ params
328
+ }: {
329
+ params: Promise<Params>;
330
+ }) => Promise<Response>;
331
+ };
332
+ //#endregion
284
333
  //#region src/next/server/index.d.ts
285
334
  /**
286
335
  * Creates a server-side auth API client for Next.js.
@@ -1,4 +1,4 @@
1
- import { a as parseSetCookies, i as extractNeonAuthCookies, n as neonAuth, r as authApiHandler, t as neonAuthMiddleware } from "../../middleware-DXwLKcbA.mjs";
1
+ import { a as parseSetCookies, i as extractNeonAuthCookies, n as neonAuth, r as authApiHandler, t as neonAuthMiddleware } from "../../middleware-DPLYghmx.mjs";
2
2
  import { cookies, headers } from "next/headers";
3
3
 
4
4
  //#region src/server/request-context.ts
@@ -1,5 +1,5 @@
1
1
  import "../../better-auth-types-Kq3kGuiz.mjs";
2
- import "../../adapter-core-DYWYECKK.mjs";
3
- import { i as BetterAuthReactAdapterOptions, n as BetterAuthReactAdapterBuilder, r as BetterAuthReactAdapterInstance, t as BetterAuthReactAdapter } from "../../better-auth-react-adapter-tKs79AwE.mjs";
2
+ import "../../adapter-core-Sx7jkLdB.mjs";
3
+ import { i as BetterAuthReactAdapterOptions, n as BetterAuthReactAdapterBuilder, r as BetterAuthReactAdapterInstance, t as BetterAuthReactAdapter } from "../../better-auth-react-adapter-BWH-XVdf.mjs";
4
4
  import "../../index-OEBbnNdr.mjs";
5
5
  export { BetterAuthReactAdapter, BetterAuthReactAdapterBuilder, BetterAuthReactAdapterInstance, BetterAuthReactAdapterOptions };
@@ -1,6 +1,6 @@
1
1
  import "../better-auth-types-Kq3kGuiz.mjs";
2
- import "../adapter-core-DYWYECKK.mjs";
3
- import { i as BetterAuthReactAdapterOptions, n as BetterAuthReactAdapterBuilder, r as BetterAuthReactAdapterInstance, t as BetterAuthReactAdapter } from "../better-auth-react-adapter-tKs79AwE.mjs";
2
+ import "../adapter-core-Sx7jkLdB.mjs";
3
+ import { i as BetterAuthReactAdapterOptions, n as BetterAuthReactAdapterBuilder, r as BetterAuthReactAdapterInstance, t as BetterAuthReactAdapter } from "../better-auth-react-adapter-BWH-XVdf.mjs";
4
4
  import "../index-OEBbnNdr.mjs";
5
5
  import { $ as MagicLinkFormProps, $t as SignUpFormProps, A as ChangePasswordCard, An as UserViewClassNames, At as PasswordInput, B as DropboxIcon, Bn as socialProviders, Bt as ResetPasswordFormProps, C as AuthUIProviderProps, Cn as UserAvatarClassNames, Ct as OrganizationViewPageProps, D as AuthViewPaths, Dn as UserButtonProps, Dt as OrganizationsCard, E as AuthViewPath, En as UserButtonClassNames, Et as OrganizationViewProps, F as CreateTeamDialogProps, Fn as accountViewPaths, Ft as RecoverAccountFormProps, G as GitLabIcon, Gt as SettingsCard, H as ForgotPasswordForm, Hn as useAuthenticate, Ht as SecuritySettingsCards, I as DeleteAccountCard, In as authLocalization, It as RedditIcon, J as InputFieldSkeleton, Jt as SettingsCellSkeleton, K as GoogleIcon, Kt as SettingsCardClassNames, L as DeleteAccountCardProps, Ln as authViewPaths, Lt as RedirectToSignIn, M as CreateOrganizationDialog, Mn as VKIcon, Mt as ProvidersCard, N as CreateOrganizationDialogProps, Nn as XIcon, Nt as ProvidersCardProps, O as AuthViewProps, On as UserInvitationsCard, Ot as PasskeysCard, P as CreateTeamDialog, Pn as ZoomIcon, Pt as RecoverAccountForm, Q as MagicLinkForm, Qt as SignUpForm, R as DeleteOrganizationCard, Rn as getViewByPath, Rt as RedirectToSignUp, S as AuthUIProvider, Sn as UserAvatar, St as OrganizationViewClassNames, T as AuthViewClassNames, Tn as UserButton, Tt as OrganizationViewPaths, U as ForgotPasswordFormProps, Un as useCurrentOrganization, Ut as SessionsCard, V as FacebookIcon, Vn as useAuthData, Vt as RobloxIcon, W as GitHubIcon, Wn as useTheme, Wt as SessionsCardProps, X as LinearIcon, Xt as SignInFormProps, Y as KickIcon, Yt as SignInForm, Z as LinkedInIcon, Zt as SignOut, _ as AuthLoading, _n as UpdateAvatarCardProps, _t as OrganizationSlugCardProps, a as AccountViewPath, an as TeamCell, at as OrganizationInvitationsCard, b as AuthUIContext, bn as UpdateNameCard, bt as OrganizationSwitcherProps, c as AccountsCard, cn as TeamOptionsContext, ct as OrganizationLogoCardProps, d as AppleIcon, dn as TwitchIcon, dt as OrganizationMembersCard, en as SignedIn, et as MicrosoftIcon, f as AuthCallback, fn as TwoFactorCard, ft as OrganizationNameCard, g as AuthHooks, gn as UpdateAvatarCard, gt as OrganizationSlugCard, h as AuthFormProps, hn as TwoFactorFormProps, ht as OrganizationSettingsCardsProps, i as AccountView, in as Team, it as OrganizationCellView, j as ChangePasswordCardProps, jn as UserViewProps, jt as Provider, k as ChangeEmailCard, kn as UserView, kt as PasskeysCardProps, l as AccountsCardProps, ln as TeamsCard, lt as OrganizationLogoClassNames, m as AuthFormClassNames, mn as TwoFactorForm, mt as OrganizationSettingsCards, n as AcceptInvitationCardProps, nn as SlackIcon, nt as NeonAuthUIProviderProps, o as AccountViewPaths, on as TeamCellProps, ot as OrganizationLogo, p as AuthForm, pn as TwoFactorCardProps, pt as OrganizationNameCardProps, q as HuggingFaceIcon, qt as SettingsCardProps, r as AccountSettingsCards, rn as SpotifyIcon, rt as NotionIcon, s as AccountViewProps, sn as TeamOptions, st as OrganizationLogoCard, t as AcceptInvitationCard, tn as SignedOut, tt as NeonAuthUIProvider, u as ApiKeysCardProps, un as TikTokIcon, ut as OrganizationLogoProps, v as AuthLocalization, vn as UpdateFieldCard, vt as OrganizationSwitcher, w as AuthView, wn as UserAvatarProps, wt as OrganizationViewPath, x as AuthUIContextType, xn as UpdateUsernameCard, xt as OrganizationView, y as AuthMutators, yn as UpdateFieldCardProps, yt as OrganizationSwitcherClassNames, z as DiscordIcon, zn as organizationViewPaths, zt as ResetPasswordForm } from "../index-D_HDtZfY.mjs";
6
6
  export { AcceptInvitationCard, AcceptInvitationCardProps, AccountSettingsCards, AccountView, AccountViewPath, AccountViewPaths, AccountViewProps, AccountsCard, AccountsCardProps, ApiKeysCardProps, AppleIcon, AuthCallback, AuthForm, AuthFormClassNames, AuthFormProps, AuthHooks, AuthLoading, AuthLocalization, AuthMutators, AuthUIContext, AuthUIContextType, AuthUIProvider, AuthUIProviderProps, AuthView, AuthViewClassNames, AuthViewPath, AuthViewPaths, AuthViewProps, BetterAuthReactAdapter, BetterAuthReactAdapterBuilder, BetterAuthReactAdapterInstance, BetterAuthReactAdapterOptions, ChangeEmailCard, ChangePasswordCard, ChangePasswordCardProps, CreateOrganizationDialog, CreateOrganizationDialogProps, CreateTeamDialog, CreateTeamDialogProps, DeleteAccountCard, DeleteAccountCardProps, DeleteOrganizationCard, DiscordIcon, DropboxIcon, FacebookIcon, ForgotPasswordForm, ForgotPasswordFormProps, GitHubIcon, GitLabIcon, GoogleIcon, HuggingFaceIcon, InputFieldSkeleton, KickIcon, LinearIcon, LinkedInIcon, MagicLinkForm, MagicLinkFormProps, MicrosoftIcon, NeonAuthUIProvider, NeonAuthUIProviderProps, NotionIcon, OrganizationCellView, OrganizationInvitationsCard, OrganizationLogo, OrganizationLogoCard, OrganizationLogoCardProps, OrganizationLogoClassNames, OrganizationLogoProps, OrganizationMembersCard, OrganizationNameCard, OrganizationNameCardProps, OrganizationSettingsCards, OrganizationSettingsCardsProps, OrganizationSlugCard, OrganizationSlugCardProps, OrganizationSwitcher, OrganizationSwitcherClassNames, OrganizationSwitcherProps, OrganizationView, OrganizationViewClassNames, OrganizationViewPageProps, OrganizationViewPath, OrganizationViewPaths, OrganizationViewProps, OrganizationsCard, PasskeysCard, PasskeysCardProps, PasswordInput, Provider, ProvidersCard, ProvidersCardProps, RecoverAccountForm, RecoverAccountFormProps, RedditIcon, RedirectToSignIn, RedirectToSignUp, ResetPasswordForm, ResetPasswordFormProps, RobloxIcon, SecuritySettingsCards, SessionsCard, SessionsCardProps, SettingsCard, SettingsCardClassNames, SettingsCardProps, SettingsCellSkeleton, SignInForm, SignInFormProps, SignOut, SignUpForm, SignUpFormProps, SignedIn, SignedOut, SlackIcon, SpotifyIcon, Team, TeamCell, TeamCellProps, TeamOptions, TeamOptionsContext, TeamsCard, TikTokIcon, TwitchIcon, TwoFactorCard, TwoFactorCardProps, TwoFactorForm, TwoFactorFormProps, UpdateAvatarCard, UpdateAvatarCardProps, UpdateFieldCard, UpdateFieldCardProps, UpdateNameCard, UpdateUsernameCard, UserAvatar, UserAvatarClassNames, UserAvatarProps, UserButton, UserButtonClassNames, UserButtonProps, UserInvitationsCard, UserView, UserViewClassNames, UserViewProps, VKIcon, XIcon, ZoomIcon, accountViewPaths, authLocalization, authViewPaths, getViewByPath, organizationViewPaths, socialProviders, useAuthData, useAuthenticate, useCurrentOrganization, useTheme };