@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
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
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
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
|
-
|
|
167
|
-
|
|
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
|
-
|
|
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
|
|
12082
|
-
return
|
|
12083
|
-
|
|
12084
|
-
|
|
12085
|
-
|
|
12086
|
-
|
|
12087
|
-
|
|
12088
|
-
|
|
12089
|
-
|
|
12090
|
-
|
|
12091
|
-
|
|
12092
|
-
|
|
12093
|
-
|
|
12094
|
-
|
|
12095
|
-
|
|
12096
|
-
|
|
12097
|
-
|
|
12098
|
-
|
|
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 "../../
|
|
2
|
-
import "../../adapter-
|
|
3
|
-
import
|
|
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-
|
|
2
|
-
import { n as BetterAuthVanillaAdapter, t as SupabaseAuthAdapter } from "../../supabase-adapter-
|
|
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/dist/vanilla/index.d.mts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import "../
|
|
2
|
-
import "../adapter-
|
|
3
|
-
import
|
|
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 };
|
package/dist/vanilla/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "../adapter-core-
|
|
2
|
-
import { n as BetterAuthVanillaAdapter, t as SupabaseAuthAdapter } from "../supabase-adapter-
|
|
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.
|
|
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.
|
|
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 };
|