@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.
Files changed (38) hide show
  1. package/dist/{adapter-core-8s6XdCco.mjs → adapter-core-PD5NQpLE.mjs} +1 -1
  2. package/dist/{adapter-core-23fYTUxT.d.mts → adapter-core-y53SWo8w.d.mts} +8 -2
  3. package/dist/{better-auth-react-adapter-D9tIaEyQ.mjs → better-auth-react-adapter-B0XIXPUH.mjs} +1 -1
  4. package/dist/{supabase-adapter-Dr-pKvPt.d.mts → better-auth-react-adapter-B7zoQmoL.d.mts} +56 -144
  5. package/dist/index.d.mts +4 -5
  6. package/dist/index.mjs +2 -2
  7. package/dist/{neon-auth-2f58U8_-.mjs → neon-auth-DUbqaO2v.mjs} +1 -1
  8. package/dist/{neon-auth-CDYpC_O1.d.mts → neon-auth-oDgy6lQm.d.mts} +3 -3
  9. package/dist/next/index.d.mts +1 -64
  10. package/dist/next/index.mjs +4 -35
  11. package/dist/next/server/index.d.mts +50 -6
  12. package/dist/next/server/index.mjs +300 -1
  13. package/dist/react/adapters/index.d.mts +3 -4
  14. package/dist/react/adapters/index.mjs +2 -2
  15. package/dist/react/index.d.mts +4 -5
  16. package/dist/react/index.mjs +3 -3
  17. package/dist/react/ui/index.d.mts +1 -1
  18. package/dist/react/ui/index.mjs +1 -1
  19. package/dist/{supabase-adapter-BYMJSxOT.mjs → supabase-adapter-Bdw6aPGx.mjs} +1 -1
  20. package/dist/{better-auth-react-adapter-QFe5RtaM.d.mts → supabase-adapter-Dm56RKRF.d.mts} +287 -199
  21. package/dist/types/index.d.mts +1 -2
  22. package/dist/ui/.safelist.html +1 -1
  23. package/dist/ui/css.css +1 -1
  24. package/dist/ui/tailwind.css +1 -1
  25. package/dist/ui/theme-inline.css +41 -36
  26. package/dist/ui/theme.css +102 -75
  27. package/dist/{ui-Cg1EZzGG.mjs → ui-CrxGg6vQ.mjs} +27 -18
  28. package/dist/vanilla/adapters/index.d.mts +3 -4
  29. package/dist/vanilla/adapters/index.mjs +2 -2
  30. package/dist/vanilla/index.d.mts +3 -4
  31. package/dist/vanilla/index.mjs +2 -2
  32. package/package.json +3 -3
  33. package/dist/better-auth-types-BUiggBfa.d.mts +0 -9
  34. package/dist/index-Bga0CzOO.d.mts +0 -49
  35. package/dist/middleware-C7jHeulu.mjs +0 -303
  36. /package/dist/{index-BHI9uOzY.d.mts → index-CPnFzULh.d.mts} +0 -0
  37. /package/dist/{index-CSe4aQIZ.d.mts → index-CzsGMS7C.d.mts} +0 -0
  38. /package/dist/{index-LhFpnU-f.d.mts → index-OEBbnNdr.d.mts} +0 -0
package/dist/ui/theme.css CHANGED
@@ -93,87 +93,114 @@
93
93
  --team-5: oklch(0.769 0.188 70.08);
94
94
  }
95
95
  }
96
- :root {
97
- --radius: 0.625rem;
98
- --background: oklch(1 0 0);
99
- --foreground: oklch(0.145 0 0);
100
- --card: oklch(1 0 0);
101
- --card-foreground: oklch(0.145 0 0);
102
- --popover: oklch(1 0 0);
103
- --popover-foreground: oklch(0.145 0 0);
104
- --primary: oklch(0.205 0 0);
105
- --primary-foreground: oklch(0.985 0 0);
106
- --secondary: oklch(0.97 0 0);
107
- --secondary-foreground: oklch(0.205 0 0);
108
- --muted: oklch(0.97 0 0);
109
- --muted-foreground: oklch(0.556 0 0);
110
- --accent: oklch(0.97 0 0);
111
- --accent-foreground: oklch(0.205 0 0);
112
- --destructive: oklch(0.577 0.245 27.325);
113
- --border: oklch(0.922 0 0);
114
- --input: oklch(0.922 0 0);
115
- --ring: oklch(0.708 0 0);
116
- --chart-1: oklch(0.646 0.222 41.116);
117
- --chart-2: oklch(0.6 0.118 184.704);
118
- --chart-3: oklch(0.398 0.07 227.392);
119
- --chart-4: oklch(0.828 0.189 84.429);
120
- --chart-5: oklch(0.769 0.188 70.08);
121
- --sidebar: oklch(0.985 0 0);
122
- --sidebar-foreground: oklch(0.145 0 0);
123
- --sidebar-primary: oklch(0.205 0 0);
124
- --sidebar-primary-foreground: oklch(0.985 0 0);
125
- --sidebar-accent: oklch(0.97 0 0);
126
- --sidebar-accent-foreground: oklch(0.205 0 0);
127
- --sidebar-border: oklch(0.922 0 0);
128
- --sidebar-ring: oklch(0.708 0 0);
129
- }
130
- .dark {
131
- --background: oklch(0.145 0 0);
132
- --foreground: oklch(0.985 0 0);
133
- --card: oklch(0.205 0 0);
134
- --card-foreground: oklch(0.985 0 0);
135
- --popover: oklch(0.205 0 0);
136
- --popover-foreground: oklch(0.985 0 0);
137
- --primary: oklch(0.922 0 0);
138
- --primary-foreground: oklch(0.205 0 0);
139
- --secondary: oklch(0.269 0 0);
140
- --secondary-foreground: oklch(0.985 0 0);
141
- --muted: oklch(0.269 0 0);
142
- --muted-foreground: oklch(0.708 0 0);
143
- --accent: oklch(0.269 0 0);
144
- --accent-foreground: oklch(0.985 0 0);
145
- --destructive: oklch(0.704 0.191 22.216);
146
- --border: oklch(1 0 0 / 10%);
147
- --input: oklch(1 0 0 / 15%);
148
- --ring: oklch(0.556 0 0);
149
- --chart-1: oklch(0.488 0.243 264.376);
150
- --chart-2: oklch(0.696 0.17 162.48);
151
- --chart-3: oklch(0.769 0.188 70.08);
152
- --chart-4: oklch(0.627 0.265 303.9);
153
- --chart-5: oklch(0.645 0.246 16.439);
154
- --sidebar: oklch(0.205 0 0);
155
- --sidebar-foreground: oklch(0.985 0 0);
156
- --sidebar-primary: oklch(0.488 0.243 264.376);
157
- --sidebar-primary-foreground: oklch(0.985 0 0);
158
- --sidebar-accent: oklch(0.269 0 0);
159
- --sidebar-accent-foreground: oklch(0.985 0 0);
160
- --sidebar-border: oklch(1 0 0 / 10%);
161
- --sidebar-ring: oklch(0.556 0 0);
162
- }
163
- @layer base {
96
+ @layer neon-auth {
97
+ :root {
98
+ --neon-radius: 0.625rem;
99
+ --neon-background: var(--background, oklch(1 0 0));
100
+ --neon-foreground: var(--foreground, oklch(0.145 0 0));
101
+ --neon-card: var(--card, oklch(1 0 0));
102
+ --neon-card-foreground: var(--card-foreground, oklch(0.145 0 0));
103
+ --neon-popover: var(--popover, oklch(1 0 0));
104
+ --neon-popover-foreground: var(--popover-foreground, oklch(0.145 0 0));
105
+ --neon-primary: var(--primary, oklch(0.205 0 0));
106
+ --neon-primary-foreground: var(--primary-foreground, oklch(0.985 0 0));
107
+ --neon-secondary: var(--secondary, oklch(0.97 0 0));
108
+ --neon-secondary-foreground: var(--secondary-foreground, oklch(0.205 0 0));
109
+ --neon-muted: var(--muted, oklch(0.97 0 0));
110
+ --neon-muted-foreground: var(--muted-foreground, oklch(0.556 0 0));
111
+ --neon-accent: var(--accent, oklch(0.97 0 0));
112
+ --neon-accent-foreground: var(--accent-foreground, oklch(0.205 0 0));
113
+ --neon-destructive: var(--destructive, oklch(0.577 0.245 27.325));
114
+ --neon-destructive-foreground: var(
115
+ --destructive-foreground,
116
+ oklch(0.577 0.245 27.325)
117
+ );
118
+ --neon-border: var(--border, oklch(0.922 0 0));
119
+ --neon-input: var(--input, oklch(0.922 0 0));
120
+ --neon-ring: var(--ring, oklch(0.708 0 0));
121
+ --neon-chart-1: var(--chart-1, oklch(0.646 0.222 41.116));
122
+ --neon-chart-2: var(--chart-2, oklch(0.6 0.118 184.704));
123
+ --neon-chart-3: var(--chart-3, oklch(0.398 0.07 227.392));
124
+ --neon-chart-4: var(--chart-4, oklch(0.828 0.189 84.429));
125
+ --neon-chart-5: var(--chart-5, oklch(0.769 0.188 70.08));
126
+ --neon-sidebar: var(--sidebar, oklch(0.985 0 0));
127
+ --neon-sidebar-foreground: var(--sidebar-foreground, oklch(0.145 0 0));
128
+ --neon-sidebar-primary: var(--sidebar-primary, oklch(0.205 0 0));
129
+ --neon-sidebar-primary-foreground: var(
130
+ --sidebar-primary-foreground,
131
+ oklch(0.985 0 0)
132
+ );
133
+ --neon-sidebar-accent: var(--sidebar-accent, oklch(0.97 0 0));
134
+ --neon-sidebar-accent-foreground: var(
135
+ --sidebar-accent-foreground,
136
+ oklch(0.205 0 0)
137
+ );
138
+ --neon-sidebar-border: var(--sidebar-border, oklch(0.922 0 0));
139
+ --neon-sidebar-ring: var(--sidebar-ring, oklch(0.708 0 0));
140
+ --neon-team-1: var(--team-1, oklch(0.646 0.222 41.116));
141
+ --neon-team-2: var(--team-2, oklch(0.6 0.118 184.704));
142
+ --neon-team-3: var(--team-3, oklch(0.398 0.07 227.392));
143
+ --neon-team-4: var(--team-4, oklch(0.828 0.189 84.429));
144
+ --neon-team-5: var(--team-5, oklch(0.769 0.188 70.08));
145
+ }
146
+ :root.dark {
147
+ --neon-background: var(--background, oklch(0.145 0 0));
148
+ --neon-foreground: var(--foreground, oklch(0.985 0 0));
149
+ --neon-card: var(--card, oklch(0.205 0 0));
150
+ --neon-card-foreground: var(--card-foreground, oklch(0.985 0 0));
151
+ --neon-popover: var(--popover, oklch(0.205 0 0));
152
+ --neon-popover-foreground: var(--popover-foreground, oklch(0.985 0 0));
153
+ --neon-primary: var(--primary, oklch(0.922 0 0));
154
+ --neon-primary-foreground: var(--primary-foreground, oklch(0.205 0 0));
155
+ --neon-secondary: var(--secondary, oklch(0.269 0 0));
156
+ --neon-secondary-foreground: var(--secondary-foreground, oklch(0.985 0 0));
157
+ --neon-muted: var(--muted, oklch(0.269 0 0));
158
+ --neon-muted-foreground: var(--muted-foreground, oklch(0.708 0 0));
159
+ --neon-accent: var(--accent, oklch(0.269 0 0));
160
+ --neon-accent-foreground: var(--accent-foreground, oklch(0.985 0 0));
161
+ --neon-destructive: var(--destructive, oklch(0.704 0.191 22.216));
162
+ --neon-destructive-foreground: var(
163
+ --destructive-foreground,
164
+ oklch(0.704 0.191 22.216)
165
+ );
166
+ --neon-border: var(--border, oklch(1 0 0 / 10%));
167
+ --neon-input: var(--input, oklch(1 0 0 / 15%));
168
+ --neon-ring: var(--ring, oklch(0.556 0 0));
169
+ --neon-chart-1: var(--chart-1, oklch(0.488 0.243 264.376));
170
+ --neon-chart-2: var(--chart-2, oklch(0.696 0.17 162.48));
171
+ --neon-chart-3: var(--chart-3, oklch(0.769 0.188 70.08));
172
+ --neon-chart-4: var(--chart-4, oklch(0.627 0.265 303.9));
173
+ --neon-chart-5: var(--chart-5, oklch(0.645 0.246 16.439));
174
+ --neon-sidebar: var(--sidebar, oklch(0.205 0 0));
175
+ --neon-sidebar-foreground: var(--sidebar-foreground, oklch(0.985 0 0));
176
+ --neon-sidebar-primary: var(--sidebar-primary, oklch(0.488 0.243 264.376));
177
+ --neon-sidebar-primary-foreground: var(
178
+ --sidebar-primary-foreground,
179
+ oklch(0.985 0 0)
180
+ );
181
+ --neon-sidebar-accent: var(--sidebar-accent, oklch(0.269 0 0));
182
+ --neon-sidebar-accent-foreground: var(
183
+ --sidebar-accent-foreground,
184
+ oklch(0.985 0 0)
185
+ );
186
+ --neon-sidebar-border: var(--sidebar-border, oklch(1 0 0 / 10%));
187
+ --neon-sidebar-ring: var(--sidebar-ring, oklch(0.488 0.243 264.376));
188
+ --neon-team-1: var(--team-1, oklch(0.488 0.243 264.376));
189
+ --neon-team-2: var(--team-2, oklch(0.696 0.17 162.48));
190
+ --neon-team-3: var(--team-3, oklch(0.769 0.188 70.08));
191
+ --neon-team-4: var(--team-4, oklch(0.627 0.265 303.9));
192
+ --neon-team-5: var(--team-5, oklch(0.645 0.246 16.439));
193
+ }
164
194
  * {
165
195
  box-sizing: border-box;
166
- margin: 0;
167
- padding: 0;
168
- border-color: var(--border);
169
- outline-color: var(--ring);
196
+ border-color: var(--neon-border);
197
+ outline-color: var(--neon-ring);
170
198
  @supports (color: color-mix(in lab, red, red)) {
171
- outline-color: color-mix(in oklab, var(--ring) 50%, transparent);
199
+ outline-color: color-mix(in oklab, var(--neon-ring) 50%, transparent);
172
200
  }
173
201
  }
174
202
  body {
175
- background-color: var(--background);
176
- color: var(--foreground);
203
+ color: var(--neon-foreground);
177
204
  }
178
205
  }
179
206
  @layer properties {
@@ -1,6 +1,8 @@
1
1
  'use client';
2
2
  import { a as getLocalizedError, c as getViewByPath, i as cn, l as isValidEmail, n as authLocalization, o as getPasswordSchema, r as authViewPaths, s as getSearchParam, t as accountViewPaths, u as organizationViewPaths } from "./chunk-VCZJYX65-CLnrj1o7-D6ZQkcc_.mjs";
3
3
  import * as z$1 from "zod";
4
+ import { clsx } from "clsx";
5
+ import { twMerge } from "tailwind-merge";
4
6
  import * as React from "react";
5
7
  import { Fragment, createContext, useCallback, useContext, useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
6
8
  import { Toaster, toast } from "sonner";
@@ -12078,24 +12080,31 @@ function getReactClient(client) {
12078
12080
  if (isVanillaClient(client)) return toReactClient(client);
12079
12081
  return client;
12080
12082
  }
12081
- function NeonAuthUIProvider({ authClient: authClient$1, children, ...props }) {
12082
- return /* @__PURE__ */ jsx(ThemeProvider, {
12083
- attribute: "class",
12084
- defaultTheme: "system",
12085
- enableSystem: true,
12086
- children: /* @__PURE__ */ jsxs(AuthUIProvider, {
12087
- authClient: useMemo(() => {
12088
- return "getBetterAuthInstance" in authClient$1 ? getReactClient(authClient$1.getBetterAuthInstance()) : getReactClient(authClient$1);
12089
- }, [authClient$1]),
12090
- ...props,
12091
- multiSession: false,
12092
- apiKey: false,
12093
- magicLink: false,
12094
- passkey: false,
12095
- oneTap: false,
12096
- genericOAuth: void 0,
12097
- twoFactor: void 0,
12098
- children: [children, /* @__PURE__ */ jsx(Toaster, {})]
12083
+ function cn$1(...inputs) {
12084
+ return twMerge(clsx(inputs));
12085
+ }
12086
+ function NeonAuthUIProvider({ authClient: authClient$1, children, className, defaultTheme = "system", ...props }) {
12087
+ const reactClient = useMemo(() => {
12088
+ return "getBetterAuthInstance" in authClient$1 ? getReactClient(authClient$1.getBetterAuthInstance()) : getReactClient(authClient$1);
12089
+ }, [authClient$1]);
12090
+ return /* @__PURE__ */ jsx("div", {
12091
+ className: cn$1("neon-auth-ui", className),
12092
+ children: /* @__PURE__ */ jsx(ThemeProvider, {
12093
+ attribute: "class",
12094
+ defaultTheme,
12095
+ enableSystem: true,
12096
+ children: /* @__PURE__ */ jsxs(AuthUIProvider, {
12097
+ authClient: reactClient,
12098
+ ...props,
12099
+ multiSession: false,
12100
+ apiKey: false,
12101
+ magicLink: false,
12102
+ passkey: false,
12103
+ oneTap: false,
12104
+ genericOAuth: void 0,
12105
+ twoFactor: void 0,
12106
+ children: [children, /* @__PURE__ */ jsx(Toaster, {})]
12107
+ })
12099
12108
  })
12100
12109
  });
12101
12110
  }
@@ -1,5 +1,4 @@
1
- import "../../better-auth-types-BUiggBfa.mjs";
2
- import "../../adapter-core-23fYTUxT.mjs";
3
- import { a as BetterAuthVanillaAdapter, c as BetterAuthVanillaAdapterOptions, i as SupabaseAuthAdapterOptions, n as SupabaseAuthAdapterBuilder, o as BetterAuthVanillaAdapterBuilder, r as SupabaseAuthAdapterInstance, s as BetterAuthVanillaAdapterInstance, t as SupabaseAuthAdapter } from "../../supabase-adapter-Dr-pKvPt.mjs";
4
- import "../../index-LhFpnU-f.mjs";
1
+ import "../../adapter-core-y53SWo8w.mjs";
2
+ import { a as BetterAuthVanillaAdapter, c as BetterAuthVanillaAdapterOptions, i as SupabaseAuthAdapterOptions, n as SupabaseAuthAdapterBuilder, o as BetterAuthVanillaAdapterBuilder, r as SupabaseAuthAdapterInstance, s as BetterAuthVanillaAdapterInstance, t as SupabaseAuthAdapter } from "../../supabase-adapter-Dm56RKRF.mjs";
3
+ import "../../index-OEBbnNdr.mjs";
5
4
  export { BetterAuthVanillaAdapter, BetterAuthVanillaAdapterBuilder, BetterAuthVanillaAdapterInstance, BetterAuthVanillaAdapterOptions, SupabaseAuthAdapter, SupabaseAuthAdapterBuilder, SupabaseAuthAdapterInstance, SupabaseAuthAdapterOptions };
@@ -1,4 +1,4 @@
1
- import "../../adapter-core-8s6XdCco.mjs";
2
- import { n as BetterAuthVanillaAdapter, t as SupabaseAuthAdapter } from "../../supabase-adapter-BYMJSxOT.mjs";
1
+ import "../../adapter-core-PD5NQpLE.mjs";
2
+ import { n as BetterAuthVanillaAdapter, t as SupabaseAuthAdapter } from "../../supabase-adapter-Bdw6aPGx.mjs";
3
3
 
4
4
  export { BetterAuthVanillaAdapter, SupabaseAuthAdapter };
@@ -1,5 +1,4 @@
1
- import "../better-auth-types-BUiggBfa.mjs";
2
- import "../adapter-core-23fYTUxT.mjs";
3
- import { a as BetterAuthVanillaAdapter, c as BetterAuthVanillaAdapterOptions, i as SupabaseAuthAdapterOptions, n as SupabaseAuthAdapterBuilder, o as BetterAuthVanillaAdapterBuilder, r as SupabaseAuthAdapterInstance, s as BetterAuthVanillaAdapterInstance, t as SupabaseAuthAdapter } from "../supabase-adapter-Dr-pKvPt.mjs";
4
- import "../index-LhFpnU-f.mjs";
1
+ import "../adapter-core-y53SWo8w.mjs";
2
+ import { a as BetterAuthVanillaAdapter, c as BetterAuthVanillaAdapterOptions, i as SupabaseAuthAdapterOptions, n as SupabaseAuthAdapterBuilder, o as BetterAuthVanillaAdapterBuilder, r as SupabaseAuthAdapterInstance, s as BetterAuthVanillaAdapterInstance, t as SupabaseAuthAdapter } from "../supabase-adapter-Dm56RKRF.mjs";
3
+ import "../index-OEBbnNdr.mjs";
5
4
  export { BetterAuthVanillaAdapter, BetterAuthVanillaAdapterBuilder, BetterAuthVanillaAdapterInstance, BetterAuthVanillaAdapterOptions, SupabaseAuthAdapter, SupabaseAuthAdapterBuilder, SupabaseAuthAdapterInstance, SupabaseAuthAdapterOptions };
@@ -1,4 +1,4 @@
1
- import "../adapter-core-8s6XdCco.mjs";
2
- import { n as BetterAuthVanillaAdapter, t as SupabaseAuthAdapter } from "../supabase-adapter-BYMJSxOT.mjs";
1
+ import "../adapter-core-PD5NQpLE.mjs";
2
+ import { n as BetterAuthVanillaAdapter, t as SupabaseAuthAdapter } from "../supabase-adapter-Bdw6aPGx.mjs";
3
3
 
4
4
  export { BetterAuthVanillaAdapter, SupabaseAuthAdapter };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neondatabase/auth",
3
- "version": "0.1.0-beta.20",
3
+ "version": "0.1.0-beta.21",
4
4
  "description": "TypeScript SDK for Neon Auth - authentication for PostgreSQL with multiple adapter support",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -96,7 +96,7 @@
96
96
  "dev": "tsdown --watch",
97
97
  "test": "vitest",
98
98
  "test:node": "node --run test",
99
- "test:ci": "vitest run",
99
+ "test:ci": "vitest run --passWithNoTests",
100
100
  "typecheck": "tsc --noEmit",
101
101
  "test:types": "tsc --noEmit",
102
102
  "lint": "eslint .",
@@ -109,7 +109,7 @@
109
109
  "next": "16.0.6"
110
110
  },
111
111
  "dependencies": {
112
- "@neondatabase/auth-ui": "0.1.0-alpha.10",
112
+ "@neondatabase/auth-ui": "0.1.0-alpha.11",
113
113
  "@supabase/auth-js": "2.79.0",
114
114
  "better-auth": "1.4.6",
115
115
  "jose": "6.1.2",
@@ -1,9 +0,0 @@
1
- import { Session, User } from "better-auth/types";
2
- import { BetterFetchError } from "@better-fetch/fetch";
3
-
4
- //#region src/core/better-auth-types.d.ts
5
- type BetterAuthSession = Session;
6
- type BetterAuthUser = User;
7
- type BetterAuthErrorResponse = BetterFetchError;
8
- //#endregion
9
- export { BetterAuthSession as n, BetterAuthUser as r, BetterAuthErrorResponse as t };
@@ -1,49 +0,0 @@
1
- import { n as BetterAuthSession, r as BetterAuthUser } from "./better-auth-types-BUiggBfa.mjs";
2
- import { NextRequest, NextResponse } from "next/server";
3
-
4
- //#region src/next/auth/session.d.ts
5
- type SessionData = {
6
- session: BetterAuthSession;
7
- user: BetterAuthUser;
8
- } | {
9
- session: null;
10
- user: null;
11
- };
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.
14
- *
15
- * @returns - `{ session: Session, user: User }` | `{ session: null, user: null}`.
16
- *
17
- * @example
18
- * ```ts
19
- * import { neonAuth } from "@neondatabase/auth/next"
20
- *
21
- * const { session, user } = await neonAuth()
22
- * ```
23
- */
24
- declare const neonAuth: () => Promise<SessionData>;
25
- //#endregion
26
- //#region src/next/middleware/index.d.ts
27
- type NeonAuthMiddlewareOptions = {
28
- loginUrl?: string;
29
- };
30
- /**
31
- * A Next.js middleware to protect routes from unauthenticated requests and refresh the session if required.
32
- *
33
- * @param loginUrl - The URL to redirect to when the user is not authenticated.
34
- * @returns A middleware function that can be used in the Next.js app.
35
- *
36
- * @example
37
- * ```ts
38
- * import { neonAuthMiddleware } from "@neondatabase/auth/next"
39
- *
40
- * export default neonAuthMiddleware({
41
- * loginUrl: '/auth/sign-in',
42
- * });
43
- * ```
44
- */
45
- declare function neonAuthMiddleware({
46
- loginUrl
47
- }: NeonAuthMiddlewareOptions): (request: NextRequest) => Promise<NextResponse<unknown>>;
48
- //#endregion
49
- export { SessionData as n, neonAuth as r, neonAuthMiddleware as t };