@neondatabase/auth 0.1.0-beta.6 → 0.1.0-beta.7

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 (37) hide show
  1. package/README.md +8 -8
  2. package/dist/{adapter-core-CTmuBvuA.d.mts → adapter-core-Bw9mn_AS.d.mts} +27 -34
  3. package/dist/{better-auth-react-adapter-C-jXL6Ba.mjs → better-auth-react-adapter-BbM3jLLv.mjs} +1 -1
  4. package/dist/{better-auth-react-adapter-Dx3CfB7p.d.mts → better-auth-react-adapter-JoscqoDc.d.mts} +1 -1
  5. package/dist/chunk-5DLVHPZS-Bxj7snpZ-DoVNlsyk.mjs +533 -0
  6. package/dist/index.d.mts +3 -3
  7. package/dist/index.mjs +1 -1
  8. package/dist/{neon-auth-CgnFwwHq.mjs → neon-auth-DdlToh7_.mjs} +1 -1
  9. package/dist/next/index.d.mts +16 -12
  10. package/dist/next/index.mjs +2 -2
  11. package/dist/react/adapters/index.d.mts +3 -3
  12. package/dist/react/adapters/index.mjs +1 -1
  13. package/dist/react/index.d.mts +4 -4
  14. package/dist/react/index.mjs +4 -92
  15. package/dist/react/ui/index.d.mts +1 -1
  16. package/dist/react/ui/index.mjs +3 -91
  17. package/dist/react/ui/server.mjs +1 -1
  18. package/dist/{supabase-adapter-yCWWsIii.mjs → supabase-adapter-CAqbpOC7.mjs} +1 -1
  19. package/dist/{supabase-adapter-CiWRH5H6.d.mts → supabase-adapter-Clxlqg1x.d.mts} +1 -1
  20. package/dist/types/index.d.mts +1 -1
  21. package/dist/ui/css.css +1 -1
  22. package/dist/ui/tailwind.css +0 -3
  23. package/dist/ui/theme.css +125 -49
  24. package/dist/ui-aMoA-9nq.mjs +9449 -0
  25. package/dist/vanilla/adapters/index.d.mts +3 -3
  26. package/dist/vanilla/adapters/index.mjs +1 -1
  27. package/dist/vanilla/index.d.mts +3 -3
  28. package/dist/vanilla/index.mjs +1 -1
  29. package/package.json +3 -3
  30. package/dist/ui-DAV9H8gz.mjs +0 -401
  31. /package/dist/{adapter-core-FGGtjVtJ.mjs → adapter-core-C_NEMs0b.mjs} +0 -0
  32. /package/dist/{adapters-C4sibmzW.mjs → adapters-D0mxG3F-.mjs} +0 -0
  33. /package/dist/{adapters-D7Wxk4MT.mjs → adapters-Df6Dd3KK.mjs} +0 -0
  34. /package/dist/{better-auth-types-BSQToNou.d.mts → better-auth-types-CE4hLv9E.d.mts} +0 -0
  35. /package/dist/{index-BFF7W17u.d.mts → index-BXlAjlSt.d.mts} +0 -0
  36. /package/dist/{index-BXxhKmeA.d.mts → index-ClXLQ1fw.d.mts} +0 -0
  37. /package/dist/{index-sBeFMSCP.d.mts → index-DCQ5Y2ED.d.mts} +0 -0
package/README.md CHANGED
@@ -215,16 +215,18 @@ Multiple concurrent `getSession()` calls are automatically deduplicated:
215
215
 
216
216
  For Next.js projects, this package provides built-in integration via `@neondatabase/auth/next`. See the [Next.js Setup Guide](./NEXT-JS.md) for:
217
217
 
218
- - Settting up the auth handler with `authApiHandler()`
219
- - Protecting routes with `neonAuthMiddleware()`
220
- - creating the auth client with `createAuthClient()` for client components
221
- - Configuring the `NeonAuthUIProvider`
218
+ - Setting up the auth handler with `authApiHandler()`
219
+ - Protecting routes with `neonAuthMiddleware()`
220
+ - Creating the auth client with `createAuthClient()` for client components
221
+ - Configuring the `NeonAuthUIProvider` with Email OTP, Social Login, and Organizations
222
+ - Creating auth pages (`AuthView`, `AccountView`, `OrganizationView`)
222
223
  - Importing styles (with or without Tailwind CSS)
223
- - Access session and users details with `neonAuth()` in server components
224
+ - Accessing session data with `neonAuth()` in server components
225
+ - Using `authClient.useSession()` hook in client components
224
226
 
225
227
  ## CSS for UI Components
226
228
 
227
- If you're using `@neondatabase/auth-ui` components, CSS is conveniently re-exported from this package:
229
+ Styles for Neon Auth UI components are available from this package:
228
230
 
229
231
  | Export | Use Case |
230
232
  |--------|----------|
@@ -244,13 +246,11 @@ If you're using `@neondatabase/auth-ui` components, CSS is conveniently re-expor
244
246
 
245
247
  - [`@neondatabase/neon-js`](../neon-js) - Full SDK with database and auth integration
246
248
  - [`@neondatabase/postgrest-js`](../postgrest-js) - PostgreSQL client without auth
247
- - [`@neondatabase/auth-ui`](../auth-ui) - UI components for Neon Auth
248
249
 
249
250
  ## Resources
250
251
 
251
252
  - [Neon Auth Documentation](https://neon.tech/docs/neon-auth)
252
253
  - [Better Auth Documentation](https://www.better-auth.com/docs)
253
- - [Supabase Auth Reference](https://supabase.com/docs/reference/javascript/auth-signup)
254
254
 
255
255
  ## Support
256
256
 
@@ -1,22 +1,22 @@
1
1
  import { createAuthClient } from "better-auth/react";
2
2
  import * as better_auth_client11 from "better-auth/client";
3
3
  import { AuthClient, BetterAuthClientOptions } from "better-auth/client";
4
- import * as better_auth_client_plugins4 from "better-auth/client/plugins";
4
+ import * as better_auth_client_plugins5 from "better-auth/client/plugins";
5
5
  import * as jose0 from "jose";
6
+ import * as zod0 from "zod";
6
7
  import * as better_auth206 from "better-auth";
7
8
  import * as _better_fetch_fetch131 from "@better-fetch/fetch";
8
9
  import * as nanostores1 from "nanostores";
9
10
  import * as better_call0 from "better-call";
10
- import * as zod0 from "zod";
11
11
  import * as better_auth_plugins_email_otp0 from "better-auth/plugins/email-otp";
12
12
 
13
13
  //#region src/core/adapter-core.d.ts
14
14
  interface NeonAuthAdapterCoreAuthOptions extends Omit<BetterAuthClientOptions, 'plugins'> {}
15
15
  declare const supportedBetterAuthClientPlugins: ({
16
16
  id: "better-auth-client";
17
- $InferServerPlugin: ReturnType<(options?: better_auth_client_plugins4.JwtOptions | undefined) => {
17
+ $InferServerPlugin: ReturnType<(options?: better_auth_client_plugins5.JwtOptions | undefined) => {
18
18
  id: "jwt";
19
- options: better_auth_client_plugins4.JwtOptions | undefined;
19
+ options: better_auth_client_plugins5.JwtOptions | undefined;
20
20
  endpoints: {
21
21
  getJwks: better_call0.StrictEndpoint<string, {
22
22
  method: "GET";
@@ -158,7 +158,7 @@ declare const supportedBetterAuthClientPlugins: ({
158
158
  $Infer: {
159
159
  body: {
160
160
  payload: jose0.JWTPayload;
161
- overrideOptions?: better_auth_client_plugins4.JwtOptions | undefined;
161
+ overrideOptions?: better_auth_client_plugins5.JwtOptions | undefined;
162
162
  };
163
163
  };
164
164
  };
@@ -286,7 +286,7 @@ declare const supportedBetterAuthClientPlugins: ({
286
286
  token: string;
287
287
  ipAddress?: string | null | undefined;
288
288
  userAgent?: string | null | undefined;
289
- } & Record<string, unknown>, ctx: better_auth206.GenericEndpointContext | undefined): Promise<void>;
289
+ } & Record<string, unknown>, ctx: better_auth206.GenericEndpointContext | null): Promise<void>;
290
290
  };
291
291
  };
292
292
  };
@@ -295,7 +295,7 @@ declare const supportedBetterAuthClientPlugins: ({
295
295
  hooks: {
296
296
  after: {
297
297
  matcher(context: better_auth206.HookEndpointContext): boolean;
298
- handler: (inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<better_auth_client_plugins4.SessionWithImpersonatedBy[] | undefined>;
298
+ handler: (inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<better_auth_client_plugins5.SessionWithImpersonatedBy[] | undefined>;
299
299
  }[];
300
300
  };
301
301
  endpoints: {
@@ -308,7 +308,7 @@ declare const supportedBetterAuthClientPlugins: ({
308
308
  requireHeaders: true;
309
309
  use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
310
310
  session: {
311
- user: better_auth_client_plugins4.UserWithRole;
311
+ user: better_auth_client_plugins5.UserWithRole;
312
312
  session: better_auth206.Session;
313
313
  };
314
314
  }>)[];
@@ -345,7 +345,7 @@ declare const supportedBetterAuthClientPlugins: ({
345
345
  } & {
346
346
  use: any[];
347
347
  }, {
348
- user: better_auth_client_plugins4.UserWithRole;
348
+ user: better_auth_client_plugins5.UserWithRole;
349
349
  }>;
350
350
  getUser: better_call0.StrictEndpoint<"/admin/get-user", {
351
351
  method: "GET";
@@ -354,7 +354,7 @@ declare const supportedBetterAuthClientPlugins: ({
354
354
  }, better_auth206.$strip>;
355
355
  use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
356
356
  session: {
357
- user: better_auth_client_plugins4.UserWithRole;
357
+ user: better_auth_client_plugins5.UserWithRole;
358
358
  session: better_auth206.Session;
359
359
  };
360
360
  }>)[];
@@ -438,7 +438,7 @@ declare const supportedBetterAuthClientPlugins: ({
438
438
  } & {
439
439
  use: any[];
440
440
  }, {
441
- user: better_auth_client_plugins4.UserWithRole;
441
+ user: better_auth_client_plugins5.UserWithRole;
442
442
  }>;
443
443
  adminUpdateUser: better_call0.StrictEndpoint<"/admin/update-user", {
444
444
  method: "POST";
@@ -448,7 +448,7 @@ declare const supportedBetterAuthClientPlugins: ({
448
448
  }, better_auth206.$strip>;
449
449
  use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
450
450
  session: {
451
- user: better_auth_client_plugins4.UserWithRole;
451
+ user: better_auth_client_plugins5.UserWithRole;
452
452
  session: better_auth206.Session;
453
453
  };
454
454
  }>)[];
@@ -478,12 +478,12 @@ declare const supportedBetterAuthClientPlugins: ({
478
478
  };
479
479
  } & {
480
480
  use: any[];
481
- }, better_auth_client_plugins4.UserWithRole>;
481
+ }, better_auth_client_plugins5.UserWithRole>;
482
482
  listUsers: better_call0.StrictEndpoint<"/admin/list-users", {
483
483
  method: "GET";
484
484
  use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
485
485
  session: {
486
- user: better_auth_client_plugins4.UserWithRole;
486
+ user: better_auth_client_plugins5.UserWithRole;
487
487
  session: better_auth206.Session;
488
488
  };
489
489
  }>)[];
@@ -557,7 +557,7 @@ declare const supportedBetterAuthClientPlugins: ({
557
557
  } & {
558
558
  use: any[];
559
559
  }, {
560
- users: better_auth_client_plugins4.UserWithRole[];
560
+ users: better_auth_client_plugins5.UserWithRole[];
561
561
  total: number;
562
562
  limit: number | undefined;
563
563
  offset: number | undefined;
@@ -569,7 +569,7 @@ declare const supportedBetterAuthClientPlugins: ({
569
569
  method: "POST";
570
570
  use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
571
571
  session: {
572
- user: better_auth_client_plugins4.UserWithRole;
572
+ user: better_auth_client_plugins5.UserWithRole;
573
573
  session: better_auth206.Session;
574
574
  };
575
575
  }>)[];
@@ -606,7 +606,7 @@ declare const supportedBetterAuthClientPlugins: ({
606
606
  } & {
607
607
  use: any[];
608
608
  }, {
609
- sessions: better_auth_client_plugins4.SessionWithImpersonatedBy[];
609
+ sessions: better_auth_client_plugins5.SessionWithImpersonatedBy[];
610
610
  }>;
611
611
  unbanUser: better_call0.StrictEndpoint<"/admin/unban-user", {
612
612
  method: "POST";
@@ -615,7 +615,7 @@ declare const supportedBetterAuthClientPlugins: ({
615
615
  }, better_auth206.$strip>;
616
616
  use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
617
617
  session: {
618
- user: better_auth_client_plugins4.UserWithRole;
618
+ user: better_auth_client_plugins5.UserWithRole;
619
619
  session: better_auth206.Session;
620
620
  };
621
621
  }>)[];
@@ -665,7 +665,7 @@ declare const supportedBetterAuthClientPlugins: ({
665
665
  }, better_auth206.$strip>;
666
666
  use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
667
667
  session: {
668
- user: better_auth_client_plugins4.UserWithRole;
668
+ user: better_auth_client_plugins5.UserWithRole;
669
669
  session: better_auth206.Session;
670
670
  };
671
671
  }>)[];
@@ -713,7 +713,7 @@ declare const supportedBetterAuthClientPlugins: ({
713
713
  }, better_auth206.$strip>;
714
714
  use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
715
715
  session: {
716
- user: better_auth_client_plugins4.UserWithRole;
716
+ user: better_auth_client_plugins5.UserWithRole;
717
717
  session: better_auth206.Session;
718
718
  };
719
719
  }>)[];
@@ -757,15 +757,7 @@ declare const supportedBetterAuthClientPlugins: ({
757
757
  ipAddress?: string | null | undefined;
758
758
  userAgent?: string | null | undefined;
759
759
  };
760
- user: {
761
- id: string;
762
- createdAt: Date;
763
- updatedAt: Date;
764
- email: string;
765
- emailVerified: boolean;
766
- name: string;
767
- image?: string | null | undefined;
768
- };
760
+ user: better_auth_client_plugins5.UserWithRole;
769
761
  }>;
770
762
  stopImpersonating: better_call0.StrictEndpoint<"/admin/stop-impersonating", {
771
763
  method: "POST";
@@ -783,7 +775,7 @@ declare const supportedBetterAuthClientPlugins: ({
783
775
  }, better_auth206.$strip>;
784
776
  use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
785
777
  session: {
786
- user: better_auth_client_plugins4.UserWithRole;
778
+ user: better_auth_client_plugins5.UserWithRole;
787
779
  session: better_auth206.Session;
788
780
  };
789
781
  }>)[];
@@ -823,7 +815,7 @@ declare const supportedBetterAuthClientPlugins: ({
823
815
  }, better_auth206.$strip>;
824
816
  use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
825
817
  session: {
826
- user: better_auth_client_plugins4.UserWithRole;
818
+ user: better_auth_client_plugins5.UserWithRole;
827
819
  session: better_auth206.Session;
828
820
  };
829
821
  }>)[];
@@ -863,7 +855,7 @@ declare const supportedBetterAuthClientPlugins: ({
863
855
  }, better_auth206.$strip>;
864
856
  use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
865
857
  session: {
866
- user: better_auth_client_plugins4.UserWithRole;
858
+ user: better_auth_client_plugins5.UserWithRole;
867
859
  session: better_auth206.Session;
868
860
  };
869
861
  }>)[];
@@ -904,7 +896,7 @@ declare const supportedBetterAuthClientPlugins: ({
904
896
  }, better_auth206.$strip>;
905
897
  use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
906
898
  session: {
907
- user: better_auth_client_plugins4.UserWithRole;
899
+ user: better_auth_client_plugins5.UserWithRole;
908
900
  session: better_auth206.Session;
909
901
  };
910
902
  }>)[];
@@ -1041,6 +1033,7 @@ declare const supportedBetterAuthClientPlugins: ({
1041
1033
  readonly YOU_ARE_NOT_ALLOWED_TO_UPDATE_USERS: "You are not allowed to update users";
1042
1034
  readonly YOU_CANNOT_REMOVE_YOURSELF: "You cannot remove yourself";
1043
1035
  readonly YOU_ARE_NOT_ALLOWED_TO_SET_NON_EXISTENT_VALUE: "You are not allowed to set a non-existent role value";
1036
+ readonly YOU_CANNOT_IMPERSONATE_ADMINS: "You cannot impersonate admins";
1044
1037
  };
1045
1038
  schema: {
1046
1039
  user: {
@@ -1744,7 +1737,7 @@ declare const supportedBetterAuthClientPlugins: ({
1744
1737
  }[];
1745
1738
  } | {
1746
1739
  id: "anonymous";
1747
- $InferServerPlugin: ReturnType<(options?: better_auth_client_plugins4.AnonymousOptions | undefined) => {
1740
+ $InferServerPlugin: ReturnType<(options?: better_auth_client_plugins5.AnonymousOptions | undefined) => {
1748
1741
  id: "anonymous";
1749
1742
  endpoints: {
1750
1743
  signInAnonymous: better_call0.StrictEndpoint<"/sign-in/anonymous", {
@@ -1,4 +1,4 @@
1
- import { t as NeonAuthAdapterCore } from "./adapter-core-FGGtjVtJ.mjs";
1
+ import { t as NeonAuthAdapterCore } from "./adapter-core-C_NEMs0b.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,4 +1,4 @@
1
- import { n as NeonAuthAdapterCoreAuthOptions, t as NeonAuthAdapterCore } from "./adapter-core-CTmuBvuA.mjs";
1
+ import { n as NeonAuthAdapterCoreAuthOptions, t as NeonAuthAdapterCore } from "./adapter-core-Bw9mn_AS.mjs";
2
2
  import * as better_auth153 from "better-auth";
3
3
  import * as _better_fetch_fetch89 from "@better-fetch/fetch";
4
4
  import * as nanostores0 from "nanostores";