@neondatabase/auth 0.1.0-beta.14 → 0.1.0-beta.16
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/README.md +1 -0
- package/dist/{adapter-core-BPv4mLT0.mjs → adapter-core-BQ6ga1zK.mjs} +119 -20
- package/dist/{adapter-core-9F3bfyWA.d.mts → adapter-core-DYWYECKK.d.mts} +16 -8
- package/dist/{better-auth-react-adapter-BkeuhSFt.mjs → better-auth-react-adapter-BLKXYcWM.mjs} +1 -1
- package/dist/{supabase-adapter-_2wgvfZ3.d.mts → better-auth-react-adapter-tKs79AwE.d.mts} +204 -290
- package/dist/constants-2bpp2_-f.mjs +30 -0
- package/dist/index-B6dAIdkW.d.mts +100 -0
- package/dist/index.d.mts +5 -104
- package/dist/index.mjs +2 -1
- package/dist/middleware-DXwLKcbA.mjs +305 -0
- package/dist/neon-auth-B_otuPjh.d.mts +105 -0
- package/dist/{neon-auth-BhLZg9v8.mjs → neon-auth-ClDZNB9a.mjs} +1 -1
- package/dist/next/index.d.mts +8 -104
- package/dist/next/index.mjs +4 -310
- package/dist/next/server/index.d.mts +340 -0
- package/dist/next/server/index.mjs +432 -0
- package/dist/react/adapters/index.d.mts +4 -3
- package/dist/react/adapters/index.mjs +2 -1
- package/dist/react/index.d.mts +5 -4
- package/dist/react/index.mjs +4 -4
- package/dist/react/ui/index.d.mts +1 -1
- package/dist/react/ui/index.mjs +2 -3
- package/dist/react/ui/server.mjs +2 -2
- package/dist/{supabase-adapter-rl2coLdb.mjs → supabase-adapter-Bl576usk.mjs} +2 -1
- package/dist/{better-auth-react-adapter-BYvAsZdj.d.mts → supabase-adapter-DtT0d6It.d.mts} +147 -61
- package/dist/types/index.d.mts +3 -7
- package/dist/ui/css.css +1 -1
- package/dist/ui/theme.css +1 -1
- package/dist/ui-DLtIc4wi.mjs +4 -0
- package/dist/vanilla/adapters/index.d.mts +4 -3
- package/dist/vanilla/adapters/index.mjs +2 -1
- package/dist/vanilla/index.d.mts +4 -3
- package/dist/vanilla/index.mjs +2 -1
- package/llms.txt +157 -0
- package/package.json +7 -2
- package/dist/chunk-5DLVHPZS-Bxj7snpZ-EhdAQJMu.mjs +0 -533
- package/dist/ui-C1IRQzLY.mjs +0 -9449
- /package/dist/{adapters-D0mxG3F-.mjs → adapters-CUvhsAvY.mjs} +0 -0
- /package/dist/{adapters-Df6Dd3KK.mjs → adapters-CivF9wql.mjs} +0 -0
- /package/dist/{better-auth-types-CE4hLv9E.d.mts → better-auth-types-Kq3kGuiz.d.mts} +0 -0
- /package/dist/{index-ClXLQ1fw.d.mts → index-D8dPsry7.d.mts} +0 -0
- /package/dist/{index-BXlAjlSt.d.mts → index-D_HDtZfY.d.mts} +0 -0
- /package/dist/{index-DCQ5Y2ED.d.mts → index-OEBbnNdr.d.mts} +0 -0
|
@@ -0,0 +1,340 @@
|
|
|
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";
|
|
7
|
+
|
|
8
|
+
//#region src/server/endpoints.d.ts
|
|
9
|
+
|
|
10
|
+
declare const API_ENDPOINTS: {
|
|
11
|
+
readonly getSession: {
|
|
12
|
+
readonly path: "get-session";
|
|
13
|
+
readonly method: "GET";
|
|
14
|
+
};
|
|
15
|
+
readonly getAccessToken: {
|
|
16
|
+
readonly path: "get-access-token";
|
|
17
|
+
readonly method: "GET";
|
|
18
|
+
};
|
|
19
|
+
readonly listSessions: {
|
|
20
|
+
readonly path: "list-sessions";
|
|
21
|
+
readonly method: "GET";
|
|
22
|
+
};
|
|
23
|
+
readonly revokeSession: {
|
|
24
|
+
readonly path: "revoke-session";
|
|
25
|
+
readonly method: "POST";
|
|
26
|
+
};
|
|
27
|
+
readonly revokeSessions: {
|
|
28
|
+
readonly path: "revoke-sessions";
|
|
29
|
+
readonly method: "POST";
|
|
30
|
+
};
|
|
31
|
+
readonly revokeOtherSessions: {
|
|
32
|
+
readonly path: "revoke-all-sessions";
|
|
33
|
+
readonly method: "POST";
|
|
34
|
+
};
|
|
35
|
+
readonly refreshToken: {
|
|
36
|
+
readonly path: "refresh-token";
|
|
37
|
+
readonly method: "POST";
|
|
38
|
+
};
|
|
39
|
+
readonly signIn: {
|
|
40
|
+
readonly email: {
|
|
41
|
+
readonly path: "sign-in/email";
|
|
42
|
+
readonly method: "POST";
|
|
43
|
+
};
|
|
44
|
+
readonly social: {
|
|
45
|
+
readonly path: "sign-in/social";
|
|
46
|
+
readonly method: "POST";
|
|
47
|
+
};
|
|
48
|
+
readonly emailOtp: {
|
|
49
|
+
readonly path: "sign-in/email-otp";
|
|
50
|
+
readonly method: "POST";
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
readonly signUp: {
|
|
54
|
+
readonly email: {
|
|
55
|
+
readonly path: "sign-up/email";
|
|
56
|
+
readonly method: "POST";
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
readonly signOut: {
|
|
60
|
+
readonly path: "sign-out";
|
|
61
|
+
readonly method: "POST";
|
|
62
|
+
};
|
|
63
|
+
readonly listAccounts: {
|
|
64
|
+
readonly path: "list-accounts";
|
|
65
|
+
readonly method: "GET";
|
|
66
|
+
};
|
|
67
|
+
readonly accountInfo: {
|
|
68
|
+
readonly path: "account-info";
|
|
69
|
+
readonly method: "GET";
|
|
70
|
+
};
|
|
71
|
+
readonly updateUser: {
|
|
72
|
+
readonly path: "update-user";
|
|
73
|
+
readonly method: "POST";
|
|
74
|
+
};
|
|
75
|
+
readonly deleteUser: {
|
|
76
|
+
readonly path: "delete-user";
|
|
77
|
+
readonly method: "POST";
|
|
78
|
+
};
|
|
79
|
+
readonly changePassword: {
|
|
80
|
+
readonly path: "change-password";
|
|
81
|
+
readonly method: "POST";
|
|
82
|
+
};
|
|
83
|
+
readonly sendVerificationEmail: {
|
|
84
|
+
readonly path: "send-verification-email";
|
|
85
|
+
readonly method: "POST";
|
|
86
|
+
};
|
|
87
|
+
readonly verifyEmail: {
|
|
88
|
+
readonly path: "verify-email";
|
|
89
|
+
readonly method: "POST";
|
|
90
|
+
};
|
|
91
|
+
readonly resetPassword: {
|
|
92
|
+
readonly path: "reset-password";
|
|
93
|
+
readonly method: "POST";
|
|
94
|
+
};
|
|
95
|
+
readonly requestPasswordReset: {
|
|
96
|
+
readonly path: "request-password-reset";
|
|
97
|
+
readonly method: "POST";
|
|
98
|
+
};
|
|
99
|
+
readonly token: {
|
|
100
|
+
readonly path: "token";
|
|
101
|
+
readonly method: "GET";
|
|
102
|
+
};
|
|
103
|
+
readonly jwks: {
|
|
104
|
+
readonly path: "jwt";
|
|
105
|
+
readonly method: "GET";
|
|
106
|
+
};
|
|
107
|
+
readonly getAnonymousToken: {
|
|
108
|
+
readonly path: "token/anonymous";
|
|
109
|
+
readonly method: "GET";
|
|
110
|
+
};
|
|
111
|
+
readonly admin: {
|
|
112
|
+
readonly createUser: {
|
|
113
|
+
readonly path: "admin/create-user";
|
|
114
|
+
readonly method: "POST";
|
|
115
|
+
};
|
|
116
|
+
readonly listUsers: {
|
|
117
|
+
readonly path: "admin/list-users";
|
|
118
|
+
readonly method: "GET";
|
|
119
|
+
};
|
|
120
|
+
readonly setRole: {
|
|
121
|
+
readonly path: "admin/set-role";
|
|
122
|
+
readonly method: "POST";
|
|
123
|
+
};
|
|
124
|
+
readonly setUserPassword: {
|
|
125
|
+
readonly path: "admin/set-user-password";
|
|
126
|
+
readonly method: "POST";
|
|
127
|
+
};
|
|
128
|
+
readonly updateUser: {
|
|
129
|
+
readonly path: "admin/update-user";
|
|
130
|
+
readonly method: "POST";
|
|
131
|
+
};
|
|
132
|
+
readonly banUser: {
|
|
133
|
+
readonly path: "admin/ban-user";
|
|
134
|
+
readonly method: "POST";
|
|
135
|
+
};
|
|
136
|
+
readonly unbanUser: {
|
|
137
|
+
readonly path: "admin/unban-user";
|
|
138
|
+
readonly method: "POST";
|
|
139
|
+
};
|
|
140
|
+
readonly listUserSessions: {
|
|
141
|
+
readonly path: "admin/list-user-sessions";
|
|
142
|
+
readonly method: "GET";
|
|
143
|
+
};
|
|
144
|
+
readonly revokeUserSession: {
|
|
145
|
+
readonly path: "admin/revoke-user-session";
|
|
146
|
+
readonly method: "POST";
|
|
147
|
+
};
|
|
148
|
+
readonly revokeUserSessions: {
|
|
149
|
+
readonly path: "admin/revoke-user-sessions";
|
|
150
|
+
readonly method: "POST";
|
|
151
|
+
};
|
|
152
|
+
readonly impersonateUser: {
|
|
153
|
+
readonly path: "admin/impersonate-user";
|
|
154
|
+
readonly method: "POST";
|
|
155
|
+
};
|
|
156
|
+
readonly stopImpersonating: {
|
|
157
|
+
readonly path: "admin/stop-impersonating";
|
|
158
|
+
readonly method: "POST";
|
|
159
|
+
};
|
|
160
|
+
readonly removeUser: {
|
|
161
|
+
readonly path: "admin/remove-user";
|
|
162
|
+
readonly method: "POST";
|
|
163
|
+
};
|
|
164
|
+
readonly hasPermission: {
|
|
165
|
+
readonly path: "admin/has-permission";
|
|
166
|
+
readonly method: "POST";
|
|
167
|
+
};
|
|
168
|
+
};
|
|
169
|
+
readonly organization: {
|
|
170
|
+
readonly create: {
|
|
171
|
+
readonly path: "organization/create";
|
|
172
|
+
readonly method: "POST";
|
|
173
|
+
};
|
|
174
|
+
readonly update: {
|
|
175
|
+
readonly path: "organization/update";
|
|
176
|
+
readonly method: "POST";
|
|
177
|
+
};
|
|
178
|
+
readonly delete: {
|
|
179
|
+
readonly path: "organization/delete";
|
|
180
|
+
readonly method: "POST";
|
|
181
|
+
};
|
|
182
|
+
readonly list: {
|
|
183
|
+
readonly path: "organization/list";
|
|
184
|
+
readonly method: "GET";
|
|
185
|
+
};
|
|
186
|
+
readonly getFullOrganization: {
|
|
187
|
+
readonly path: "organization/get-full-organization";
|
|
188
|
+
readonly method: "GET";
|
|
189
|
+
};
|
|
190
|
+
readonly setActive: {
|
|
191
|
+
readonly path: "organization/set-active";
|
|
192
|
+
readonly method: "POST";
|
|
193
|
+
};
|
|
194
|
+
readonly checkSlug: {
|
|
195
|
+
readonly path: "organization/check-slug";
|
|
196
|
+
readonly method: "GET";
|
|
197
|
+
};
|
|
198
|
+
readonly listMembers: {
|
|
199
|
+
readonly path: "organization/list-members";
|
|
200
|
+
readonly method: "GET";
|
|
201
|
+
};
|
|
202
|
+
readonly removeMember: {
|
|
203
|
+
readonly path: "organization/remove-member";
|
|
204
|
+
readonly method: "POST";
|
|
205
|
+
};
|
|
206
|
+
readonly updateMemberRole: {
|
|
207
|
+
readonly path: "organization/update-member-role";
|
|
208
|
+
readonly method: "POST";
|
|
209
|
+
};
|
|
210
|
+
readonly leave: {
|
|
211
|
+
readonly path: "organization/leave";
|
|
212
|
+
readonly method: "POST";
|
|
213
|
+
};
|
|
214
|
+
readonly getActiveMember: {
|
|
215
|
+
readonly path: "organization/get-active-member";
|
|
216
|
+
readonly method: "GET";
|
|
217
|
+
};
|
|
218
|
+
readonly getActiveMemberRole: {
|
|
219
|
+
readonly path: "organization/get-active-member-role";
|
|
220
|
+
readonly method: "GET";
|
|
221
|
+
};
|
|
222
|
+
readonly inviteMember: {
|
|
223
|
+
readonly path: "organization/invite-member";
|
|
224
|
+
readonly method: "POST";
|
|
225
|
+
};
|
|
226
|
+
readonly acceptInvitation: {
|
|
227
|
+
readonly path: "organization/accept-invitation";
|
|
228
|
+
readonly method: "POST";
|
|
229
|
+
};
|
|
230
|
+
readonly rejectInvitation: {
|
|
231
|
+
readonly path: "organization/reject-invitation";
|
|
232
|
+
readonly method: "POST";
|
|
233
|
+
};
|
|
234
|
+
readonly cancelInvitation: {
|
|
235
|
+
readonly path: "organization/cancel-invitation";
|
|
236
|
+
readonly method: "POST";
|
|
237
|
+
};
|
|
238
|
+
readonly getInvitation: {
|
|
239
|
+
readonly path: "organization/get-invitation";
|
|
240
|
+
readonly method: "GET";
|
|
241
|
+
};
|
|
242
|
+
readonly listInvitations: {
|
|
243
|
+
readonly path: "organization/list-invitations";
|
|
244
|
+
readonly method: "GET";
|
|
245
|
+
};
|
|
246
|
+
readonly listUserInvitations: {
|
|
247
|
+
readonly path: "organization/list-user-invitations";
|
|
248
|
+
readonly method: "GET";
|
|
249
|
+
};
|
|
250
|
+
readonly hasPermission: {
|
|
251
|
+
readonly path: "organization/has-permission";
|
|
252
|
+
readonly method: "POST";
|
|
253
|
+
};
|
|
254
|
+
};
|
|
255
|
+
readonly emailOtp: {
|
|
256
|
+
readonly sendVerificationOtp: {
|
|
257
|
+
readonly path: "email-otp/send-verification-otp";
|
|
258
|
+
readonly method: "POST";
|
|
259
|
+
};
|
|
260
|
+
readonly verifyEmail: {
|
|
261
|
+
readonly path: "email-otp/verify-email";
|
|
262
|
+
readonly method: "POST";
|
|
263
|
+
};
|
|
264
|
+
readonly checkVerificationOtp: {
|
|
265
|
+
readonly path: "email-otp/check-verification-otp";
|
|
266
|
+
readonly method: "POST";
|
|
267
|
+
};
|
|
268
|
+
readonly resetPassword: {
|
|
269
|
+
readonly path: "email-otp/passcode";
|
|
270
|
+
readonly method: "POST";
|
|
271
|
+
};
|
|
272
|
+
};
|
|
273
|
+
};
|
|
274
|
+
//#endregion
|
|
275
|
+
//#region src/server/types.d.ts
|
|
276
|
+
/**
|
|
277
|
+
* Extract top-level keys from API_ENDPOINTS.
|
|
278
|
+
* For nested endpoints like signIn.email, this extracts 'signIn' (not 'email').
|
|
279
|
+
*/
|
|
280
|
+
type TopLevelEndpointKeys<T> = { [K in keyof T]: K }[keyof T];
|
|
281
|
+
type ServerAuthMethods = TopLevelEndpointKeys<typeof API_ENDPOINTS>;
|
|
282
|
+
type NeonAuthServer = Pick<VanillaBetterAuthClient, ServerAuthMethods>;
|
|
283
|
+
//#endregion
|
|
284
|
+
//#region src/next/server/index.d.ts
|
|
285
|
+
/**
|
|
286
|
+
* Creates a server-side auth API client for Next.js.
|
|
287
|
+
*
|
|
288
|
+
* This client exposes the Neon Auth APIs including authentication, user management, organizations, and admin operations.
|
|
289
|
+
*
|
|
290
|
+
* **Where to use:**
|
|
291
|
+
* - React Server Components
|
|
292
|
+
* - Server Actions
|
|
293
|
+
* - Route Handlers
|
|
294
|
+
*
|
|
295
|
+
* **Requirements:**
|
|
296
|
+
* - `NEON_AUTH_BASE_URL` environment variable must be set
|
|
297
|
+
* - Cookies are automatically read/written via `next/headers`
|
|
298
|
+
*
|
|
299
|
+
* @returns Auth server API client for Next.js
|
|
300
|
+
* @throws Error if `NEON_AUTH_BASE_URL` environment variable is not set
|
|
301
|
+
*
|
|
302
|
+
* @example
|
|
303
|
+
* ```typescript
|
|
304
|
+
* // lib/auth/server.ts - Create a singleton instance
|
|
305
|
+
* import { createAuthServer } from '@neondatabase/auth/next/server';
|
|
306
|
+
* export const authServer = createAuthServer();
|
|
307
|
+
* ```
|
|
308
|
+
*
|
|
309
|
+
* @example
|
|
310
|
+
* ```typescript
|
|
311
|
+
* // Server Component - Reading session
|
|
312
|
+
* import { authServer } from '@/lib/auth/server';
|
|
313
|
+
*
|
|
314
|
+
* export default async function Page() {
|
|
315
|
+
* const { data: session } = await authServer.getSession();
|
|
316
|
+
* if (!session?.user) return <div>Not logged in</div>;
|
|
317
|
+
* return <div>Hello {session.user.name}</div>;
|
|
318
|
+
* }
|
|
319
|
+
* ```
|
|
320
|
+
*
|
|
321
|
+
* @example
|
|
322
|
+
* ```typescript
|
|
323
|
+
* // Server Action - Sign in
|
|
324
|
+
* 'use server';
|
|
325
|
+
* import { authServer } from '@/lib/auth/server';
|
|
326
|
+
* import { redirect } from 'next/navigation';
|
|
327
|
+
*
|
|
328
|
+
* export async function signIn(formData: FormData) {
|
|
329
|
+
* const { error } = await authServer.signIn.email({
|
|
330
|
+
* email: formData.get('email') as string,
|
|
331
|
+
* password: formData.get('password') as string,
|
|
332
|
+
* });
|
|
333
|
+
* if (error) return { error: error.message };
|
|
334
|
+
* redirect('/dashboard');
|
|
335
|
+
* }
|
|
336
|
+
* ```
|
|
337
|
+
*/
|
|
338
|
+
declare function createAuthServer(): NeonAuthServer;
|
|
339
|
+
//#endregion
|
|
340
|
+
export { authApiHandler, createAuthServer, neonAuth, neonAuthMiddleware };
|