@neondatabase/auth 0.1.0-beta.1

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.
@@ -0,0 +1,2247 @@
1
+ import { createAuthClient } from "better-auth/react";
2
+ import * as better_auth_client11 from "better-auth/client";
3
+ import { AuthClient, BetterAuthClientOptions } from "better-auth/client";
4
+ import * as better_auth_client_plugins7 from "better-auth/client/plugins";
5
+ import * as jose0 from "jose";
6
+ import * as better_auth220 from "better-auth";
7
+ import * as _better_fetch_fetch138 from "@better-fetch/fetch";
8
+ import * as nanostores1 from "nanostores";
9
+ import * as better_call0 from "better-call";
10
+ import * as zod0 from "zod";
11
+
12
+ //#region src/core/adapter-core.d.ts
13
+ interface NeonAuthAdapterCoreAuthOptions extends Omit<BetterAuthClientOptions, 'plugins'> {}
14
+ declare const supportedBetterAuthClientPlugins: ({
15
+ id: "better-auth-client";
16
+ $InferServerPlugin: ReturnType<(options?: better_auth_client_plugins7.JwtOptions | undefined) => {
17
+ id: "jwt";
18
+ options: better_auth_client_plugins7.JwtOptions | undefined;
19
+ endpoints: {
20
+ getJwks: better_call0.StrictEndpoint<string, {
21
+ method: "GET";
22
+ metadata: {
23
+ openapi: {
24
+ operationId: string;
25
+ description: string;
26
+ responses: {
27
+ "200": {
28
+ description: string;
29
+ content: {
30
+ "application/json": {
31
+ schema: {
32
+ type: "object";
33
+ properties: {
34
+ keys: {
35
+ type: string;
36
+ description: string;
37
+ items: {
38
+ type: string;
39
+ properties: {
40
+ kid: {
41
+ type: string;
42
+ description: string;
43
+ };
44
+ kty: {
45
+ type: string;
46
+ description: string;
47
+ };
48
+ alg: {
49
+ type: string;
50
+ description: string;
51
+ };
52
+ use: {
53
+ type: string;
54
+ description: string;
55
+ enum: string[];
56
+ nullable: boolean;
57
+ };
58
+ n: {
59
+ type: string;
60
+ description: string;
61
+ nullable: boolean;
62
+ };
63
+ e: {
64
+ type: string;
65
+ description: string;
66
+ nullable: boolean;
67
+ };
68
+ crv: {
69
+ type: string;
70
+ description: string;
71
+ nullable: boolean;
72
+ };
73
+ x: {
74
+ type: string;
75
+ description: string;
76
+ nullable: boolean;
77
+ };
78
+ y: {
79
+ type: string;
80
+ description: string;
81
+ nullable: boolean;
82
+ };
83
+ };
84
+ required: string[];
85
+ };
86
+ };
87
+ };
88
+ required: string[];
89
+ };
90
+ };
91
+ };
92
+ };
93
+ };
94
+ };
95
+ };
96
+ } & {
97
+ use: any[];
98
+ }, jose0.JSONWebKeySet>;
99
+ getToken: better_call0.StrictEndpoint<"/token", {
100
+ method: "GET";
101
+ requireHeaders: true;
102
+ use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
103
+ session: {
104
+ session: Record<string, any> & {
105
+ id: string;
106
+ createdAt: Date;
107
+ updatedAt: Date;
108
+ userId: string;
109
+ expiresAt: Date;
110
+ token: string;
111
+ ipAddress?: string | null | undefined;
112
+ userAgent?: string | null | undefined;
113
+ };
114
+ user: Record<string, any> & {
115
+ id: string;
116
+ createdAt: Date;
117
+ updatedAt: Date;
118
+ email: string;
119
+ emailVerified: boolean;
120
+ name: string;
121
+ image?: string | null | undefined;
122
+ };
123
+ };
124
+ }>)[];
125
+ metadata: {
126
+ openapi: {
127
+ operationId: string;
128
+ description: string;
129
+ responses: {
130
+ 200: {
131
+ description: string;
132
+ content: {
133
+ "application/json": {
134
+ schema: {
135
+ type: "object";
136
+ properties: {
137
+ token: {
138
+ type: string;
139
+ };
140
+ };
141
+ };
142
+ };
143
+ };
144
+ };
145
+ };
146
+ };
147
+ };
148
+ } & {
149
+ use: any[];
150
+ }, {
151
+ token: string;
152
+ }>;
153
+ signJWT: better_call0.StrictEndpoint<"/sign-jwt", {
154
+ method: "POST";
155
+ metadata: {
156
+ SERVER_ONLY: true;
157
+ $Infer: {
158
+ body: {
159
+ payload: jose0.JWTPayload;
160
+ overrideOptions?: better_auth_client_plugins7.JwtOptions | undefined;
161
+ };
162
+ };
163
+ };
164
+ body: zod0.ZodObject<{
165
+ payload: zod0.ZodRecord<zod0.ZodString, zod0.ZodAny>;
166
+ overrideOptions: zod0.ZodOptional<zod0.ZodRecord<zod0.ZodString, zod0.ZodAny>>;
167
+ }, better_auth220.$strip>;
168
+ } & {
169
+ use: any[];
170
+ }, {
171
+ token: string;
172
+ }>;
173
+ verifyJWT: better_call0.StrictEndpoint<"/verify-jwt", {
174
+ method: "POST";
175
+ metadata: {
176
+ SERVER_ONLY: true;
177
+ $Infer: {
178
+ body: {
179
+ token: string;
180
+ issuer?: string;
181
+ };
182
+ response: {
183
+ payload: {
184
+ sub: string;
185
+ aud: string;
186
+ [key: string]: any;
187
+ } | null;
188
+ };
189
+ };
190
+ };
191
+ body: zod0.ZodObject<{
192
+ token: zod0.ZodString;
193
+ issuer: zod0.ZodOptional<zod0.ZodString>;
194
+ }, better_auth220.$strip>;
195
+ } & {
196
+ use: any[];
197
+ }, {
198
+ payload: (jose0.JWTPayload & Required<Pick<jose0.JWTPayload, "sub" | "aud">>) | null;
199
+ }>;
200
+ };
201
+ hooks: {
202
+ after: {
203
+ matcher(context: better_auth220.HookEndpointContext): boolean;
204
+ handler: (inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<void>;
205
+ }[];
206
+ };
207
+ schema: {
208
+ jwks: {
209
+ fields: {
210
+ publicKey: {
211
+ type: "string";
212
+ required: true;
213
+ };
214
+ privateKey: {
215
+ type: "string";
216
+ required: true;
217
+ };
218
+ createdAt: {
219
+ type: "date";
220
+ required: true;
221
+ };
222
+ expiresAt: {
223
+ type: "date";
224
+ required: false;
225
+ };
226
+ };
227
+ };
228
+ };
229
+ }>;
230
+ pathMethods: {
231
+ [x: string]: "GET";
232
+ };
233
+ getActions: ($fetch: _better_fetch_fetch138.BetterFetch) => {
234
+ jwks: (fetchOptions?: any) => Promise<{
235
+ data: null;
236
+ error: {
237
+ message?: string | undefined;
238
+ status: number;
239
+ statusText: string;
240
+ };
241
+ } | {
242
+ data: jose0.JSONWebKeySet;
243
+ error: null;
244
+ }>;
245
+ };
246
+ } | {
247
+ id: "admin-client";
248
+ $InferServerPlugin: {
249
+ id: "admin";
250
+ init(): {
251
+ options: {
252
+ databaseHooks: {
253
+ user: {
254
+ create: {
255
+ before(user: {
256
+ id: string;
257
+ createdAt: Date;
258
+ updatedAt: Date;
259
+ email: string;
260
+ emailVerified: boolean;
261
+ name: string;
262
+ image?: string | null | undefined;
263
+ } & Record<string, unknown>): Promise<{
264
+ data: {
265
+ id: string;
266
+ createdAt: Date;
267
+ updatedAt: Date;
268
+ email: string;
269
+ emailVerified: boolean;
270
+ name: string;
271
+ image?: string | null | undefined;
272
+ role: string;
273
+ };
274
+ }>;
275
+ };
276
+ };
277
+ session: {
278
+ create: {
279
+ before(session: {
280
+ id: string;
281
+ createdAt: Date;
282
+ updatedAt: Date;
283
+ userId: string;
284
+ expiresAt: Date;
285
+ token: string;
286
+ ipAddress?: string | null | undefined;
287
+ userAgent?: string | null | undefined;
288
+ } & Record<string, unknown>, ctx: better_auth220.GenericEndpointContext | undefined): Promise<void>;
289
+ };
290
+ };
291
+ };
292
+ };
293
+ };
294
+ hooks: {
295
+ after: {
296
+ matcher(context: better_auth220.HookEndpointContext): boolean;
297
+ handler: (inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<better_auth_client_plugins7.SessionWithImpersonatedBy[] | undefined>;
298
+ }[];
299
+ };
300
+ endpoints: {
301
+ setRole: better_call0.StrictEndpoint<"/admin/set-role", {
302
+ method: "POST";
303
+ body: zod0.ZodObject<{
304
+ userId: zod0.ZodCoercedString<unknown>;
305
+ role: zod0.ZodUnion<readonly [zod0.ZodString, zod0.ZodArray<zod0.ZodString>]>;
306
+ }, better_auth220.$strip>;
307
+ requireHeaders: true;
308
+ use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
309
+ session: {
310
+ user: better_auth_client_plugins7.UserWithRole;
311
+ session: better_auth220.Session;
312
+ };
313
+ }>)[];
314
+ metadata: {
315
+ openapi: {
316
+ operationId: string;
317
+ summary: string;
318
+ description: string;
319
+ responses: {
320
+ 200: {
321
+ description: string;
322
+ content: {
323
+ "application/json": {
324
+ schema: {
325
+ type: "object";
326
+ properties: {
327
+ user: {
328
+ $ref: string;
329
+ };
330
+ };
331
+ };
332
+ };
333
+ };
334
+ };
335
+ };
336
+ };
337
+ $Infer: {
338
+ body: {
339
+ userId: string;
340
+ role: "user" | "admin" | ("user" | "admin")[];
341
+ };
342
+ };
343
+ };
344
+ } & {
345
+ use: any[];
346
+ }, {
347
+ user: better_auth_client_plugins7.UserWithRole;
348
+ }>;
349
+ getUser: better_call0.StrictEndpoint<"/admin/get-user", {
350
+ method: "GET";
351
+ query: zod0.ZodObject<{
352
+ id: zod0.ZodString;
353
+ }, better_auth220.$strip>;
354
+ use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
355
+ session: {
356
+ user: better_auth_client_plugins7.UserWithRole;
357
+ session: better_auth220.Session;
358
+ };
359
+ }>)[];
360
+ metadata: {
361
+ openapi: {
362
+ operationId: string;
363
+ summary: string;
364
+ description: string;
365
+ responses: {
366
+ 200: {
367
+ description: string;
368
+ content: {
369
+ "application/json": {
370
+ schema: {
371
+ type: "object";
372
+ properties: {
373
+ user: {
374
+ $ref: string;
375
+ };
376
+ };
377
+ };
378
+ };
379
+ };
380
+ };
381
+ };
382
+ };
383
+ };
384
+ } & {
385
+ use: any[];
386
+ }, {
387
+ id: string;
388
+ createdAt: Date;
389
+ updatedAt: Date;
390
+ email: string;
391
+ emailVerified: boolean;
392
+ name: string;
393
+ image?: string | null | undefined;
394
+ }>;
395
+ createUser: better_call0.StrictEndpoint<"/admin/create-user", {
396
+ method: "POST";
397
+ body: zod0.ZodObject<{
398
+ email: zod0.ZodString;
399
+ password: zod0.ZodString;
400
+ name: zod0.ZodString;
401
+ role: zod0.ZodOptional<zod0.ZodUnion<readonly [zod0.ZodString, zod0.ZodArray<zod0.ZodString>]>>;
402
+ data: zod0.ZodOptional<zod0.ZodRecord<zod0.ZodString, zod0.ZodAny>>;
403
+ }, better_auth220.$strip>;
404
+ metadata: {
405
+ openapi: {
406
+ operationId: string;
407
+ summary: string;
408
+ description: string;
409
+ responses: {
410
+ 200: {
411
+ description: string;
412
+ content: {
413
+ "application/json": {
414
+ schema: {
415
+ type: "object";
416
+ properties: {
417
+ user: {
418
+ $ref: string;
419
+ };
420
+ };
421
+ };
422
+ };
423
+ };
424
+ };
425
+ };
426
+ };
427
+ $Infer: {
428
+ body: {
429
+ email: string;
430
+ password: string;
431
+ name: string;
432
+ role?: "user" | "admin" | ("user" | "admin")[] | undefined;
433
+ data?: Record<string, any> | undefined;
434
+ };
435
+ };
436
+ };
437
+ } & {
438
+ use: any[];
439
+ }, {
440
+ user: better_auth_client_plugins7.UserWithRole;
441
+ }>;
442
+ adminUpdateUser: better_call0.StrictEndpoint<"/admin/update-user", {
443
+ method: "POST";
444
+ body: zod0.ZodObject<{
445
+ userId: zod0.ZodCoercedString<unknown>;
446
+ data: zod0.ZodRecord<zod0.ZodAny, zod0.ZodAny>;
447
+ }, better_auth220.$strip>;
448
+ use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
449
+ session: {
450
+ user: better_auth_client_plugins7.UserWithRole;
451
+ session: better_auth220.Session;
452
+ };
453
+ }>)[];
454
+ metadata: {
455
+ openapi: {
456
+ operationId: string;
457
+ summary: string;
458
+ description: string;
459
+ responses: {
460
+ 200: {
461
+ description: string;
462
+ content: {
463
+ "application/json": {
464
+ schema: {
465
+ type: "object";
466
+ properties: {
467
+ user: {
468
+ $ref: string;
469
+ };
470
+ };
471
+ };
472
+ };
473
+ };
474
+ };
475
+ };
476
+ };
477
+ };
478
+ } & {
479
+ use: any[];
480
+ }, better_auth_client_plugins7.UserWithRole>;
481
+ listUsers: better_call0.StrictEndpoint<"/admin/list-users", {
482
+ method: "GET";
483
+ use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
484
+ session: {
485
+ user: better_auth_client_plugins7.UserWithRole;
486
+ session: better_auth220.Session;
487
+ };
488
+ }>)[];
489
+ query: zod0.ZodObject<{
490
+ searchValue: zod0.ZodOptional<zod0.ZodString>;
491
+ searchField: zod0.ZodOptional<zod0.ZodEnum<{
492
+ name: "name";
493
+ email: "email";
494
+ }>>;
495
+ searchOperator: zod0.ZodOptional<zod0.ZodEnum<{
496
+ contains: "contains";
497
+ starts_with: "starts_with";
498
+ ends_with: "ends_with";
499
+ }>>;
500
+ limit: zod0.ZodOptional<zod0.ZodUnion<[zod0.ZodString, zod0.ZodNumber]>>;
501
+ offset: zod0.ZodOptional<zod0.ZodUnion<[zod0.ZodString, zod0.ZodNumber]>>;
502
+ sortBy: zod0.ZodOptional<zod0.ZodString>;
503
+ sortDirection: zod0.ZodOptional<zod0.ZodEnum<{
504
+ asc: "asc";
505
+ desc: "desc";
506
+ }>>;
507
+ filterField: zod0.ZodOptional<zod0.ZodString>;
508
+ filterValue: zod0.ZodOptional<zod0.ZodUnion<[zod0.ZodUnion<[zod0.ZodString, zod0.ZodNumber]>, zod0.ZodBoolean]>>;
509
+ filterOperator: zod0.ZodOptional<zod0.ZodEnum<{
510
+ eq: "eq";
511
+ ne: "ne";
512
+ lt: "lt";
513
+ lte: "lte";
514
+ gt: "gt";
515
+ gte: "gte";
516
+ contains: "contains";
517
+ }>>;
518
+ }, better_auth220.$strip>;
519
+ metadata: {
520
+ openapi: {
521
+ operationId: string;
522
+ summary: string;
523
+ description: string;
524
+ responses: {
525
+ 200: {
526
+ description: string;
527
+ content: {
528
+ "application/json": {
529
+ schema: {
530
+ type: "object";
531
+ properties: {
532
+ users: {
533
+ type: string;
534
+ items: {
535
+ $ref: string;
536
+ };
537
+ };
538
+ total: {
539
+ type: string;
540
+ };
541
+ limit: {
542
+ type: string;
543
+ };
544
+ offset: {
545
+ type: string;
546
+ };
547
+ };
548
+ required: string[];
549
+ };
550
+ };
551
+ };
552
+ };
553
+ };
554
+ };
555
+ };
556
+ } & {
557
+ use: any[];
558
+ }, {
559
+ users: better_auth_client_plugins7.UserWithRole[];
560
+ total: number;
561
+ limit: number | undefined;
562
+ offset: number | undefined;
563
+ } | {
564
+ users: never[];
565
+ total: number;
566
+ }>;
567
+ listUserSessions: better_call0.StrictEndpoint<"/admin/list-user-sessions", {
568
+ method: "POST";
569
+ use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
570
+ session: {
571
+ user: better_auth_client_plugins7.UserWithRole;
572
+ session: better_auth220.Session;
573
+ };
574
+ }>)[];
575
+ body: zod0.ZodObject<{
576
+ userId: zod0.ZodCoercedString<unknown>;
577
+ }, better_auth220.$strip>;
578
+ metadata: {
579
+ openapi: {
580
+ operationId: string;
581
+ summary: string;
582
+ description: string;
583
+ responses: {
584
+ 200: {
585
+ description: string;
586
+ content: {
587
+ "application/json": {
588
+ schema: {
589
+ type: "object";
590
+ properties: {
591
+ sessions: {
592
+ type: string;
593
+ items: {
594
+ $ref: string;
595
+ };
596
+ };
597
+ };
598
+ };
599
+ };
600
+ };
601
+ };
602
+ };
603
+ };
604
+ };
605
+ } & {
606
+ use: any[];
607
+ }, {
608
+ sessions: better_auth_client_plugins7.SessionWithImpersonatedBy[];
609
+ }>;
610
+ unbanUser: better_call0.StrictEndpoint<"/admin/unban-user", {
611
+ method: "POST";
612
+ body: zod0.ZodObject<{
613
+ userId: zod0.ZodCoercedString<unknown>;
614
+ }, better_auth220.$strip>;
615
+ use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
616
+ session: {
617
+ user: better_auth_client_plugins7.UserWithRole;
618
+ session: better_auth220.Session;
619
+ };
620
+ }>)[];
621
+ metadata: {
622
+ openapi: {
623
+ operationId: string;
624
+ summary: string;
625
+ description: string;
626
+ responses: {
627
+ 200: {
628
+ description: string;
629
+ content: {
630
+ "application/json": {
631
+ schema: {
632
+ type: "object";
633
+ properties: {
634
+ user: {
635
+ $ref: string;
636
+ };
637
+ };
638
+ };
639
+ };
640
+ };
641
+ };
642
+ };
643
+ };
644
+ };
645
+ } & {
646
+ use: any[];
647
+ }, {
648
+ user: {
649
+ id: string;
650
+ createdAt: Date;
651
+ updatedAt: Date;
652
+ email: string;
653
+ emailVerified: boolean;
654
+ name: string;
655
+ image?: string | null | undefined;
656
+ } & Record<string, any>;
657
+ }>;
658
+ banUser: better_call0.StrictEndpoint<"/admin/ban-user", {
659
+ method: "POST";
660
+ body: zod0.ZodObject<{
661
+ userId: zod0.ZodCoercedString<unknown>;
662
+ banReason: zod0.ZodOptional<zod0.ZodString>;
663
+ banExpiresIn: zod0.ZodOptional<zod0.ZodNumber>;
664
+ }, better_auth220.$strip>;
665
+ use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
666
+ session: {
667
+ user: better_auth_client_plugins7.UserWithRole;
668
+ session: better_auth220.Session;
669
+ };
670
+ }>)[];
671
+ metadata: {
672
+ openapi: {
673
+ operationId: string;
674
+ summary: string;
675
+ description: string;
676
+ responses: {
677
+ 200: {
678
+ description: string;
679
+ content: {
680
+ "application/json": {
681
+ schema: {
682
+ type: "object";
683
+ properties: {
684
+ user: {
685
+ $ref: string;
686
+ };
687
+ };
688
+ };
689
+ };
690
+ };
691
+ };
692
+ };
693
+ };
694
+ };
695
+ } & {
696
+ use: any[];
697
+ }, {
698
+ user: {
699
+ id: string;
700
+ createdAt: Date;
701
+ updatedAt: Date;
702
+ email: string;
703
+ emailVerified: boolean;
704
+ name: string;
705
+ image?: string | null | undefined;
706
+ } & Record<string, any>;
707
+ }>;
708
+ impersonateUser: better_call0.StrictEndpoint<"/admin/impersonate-user", {
709
+ method: "POST";
710
+ body: zod0.ZodObject<{
711
+ userId: zod0.ZodCoercedString<unknown>;
712
+ }, better_auth220.$strip>;
713
+ use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
714
+ session: {
715
+ user: better_auth_client_plugins7.UserWithRole;
716
+ session: better_auth220.Session;
717
+ };
718
+ }>)[];
719
+ metadata: {
720
+ openapi: {
721
+ operationId: string;
722
+ summary: string;
723
+ description: string;
724
+ responses: {
725
+ 200: {
726
+ description: string;
727
+ content: {
728
+ "application/json": {
729
+ schema: {
730
+ type: "object";
731
+ properties: {
732
+ session: {
733
+ $ref: string;
734
+ };
735
+ user: {
736
+ $ref: string;
737
+ };
738
+ };
739
+ };
740
+ };
741
+ };
742
+ };
743
+ };
744
+ };
745
+ };
746
+ } & {
747
+ use: any[];
748
+ }, {
749
+ session: {
750
+ id: string;
751
+ createdAt: Date;
752
+ updatedAt: Date;
753
+ userId: string;
754
+ expiresAt: Date;
755
+ token: string;
756
+ ipAddress?: string | null | undefined;
757
+ userAgent?: string | null | undefined;
758
+ };
759
+ user: {
760
+ id: string;
761
+ createdAt: Date;
762
+ updatedAt: Date;
763
+ email: string;
764
+ emailVerified: boolean;
765
+ name: string;
766
+ image?: string | null | undefined;
767
+ };
768
+ }>;
769
+ stopImpersonating: better_call0.StrictEndpoint<"/admin/stop-impersonating", {
770
+ method: "POST";
771
+ requireHeaders: true;
772
+ } & {
773
+ use: any[];
774
+ }, {
775
+ session: better_auth220.Session & Record<string, any>;
776
+ user: better_auth220.User & Record<string, any>;
777
+ }>;
778
+ revokeUserSession: better_call0.StrictEndpoint<"/admin/revoke-user-session", {
779
+ method: "POST";
780
+ body: zod0.ZodObject<{
781
+ sessionToken: zod0.ZodString;
782
+ }, better_auth220.$strip>;
783
+ use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
784
+ session: {
785
+ user: better_auth_client_plugins7.UserWithRole;
786
+ session: better_auth220.Session;
787
+ };
788
+ }>)[];
789
+ metadata: {
790
+ openapi: {
791
+ operationId: string;
792
+ summary: string;
793
+ description: string;
794
+ responses: {
795
+ 200: {
796
+ description: string;
797
+ content: {
798
+ "application/json": {
799
+ schema: {
800
+ type: "object";
801
+ properties: {
802
+ success: {
803
+ type: string;
804
+ };
805
+ };
806
+ };
807
+ };
808
+ };
809
+ };
810
+ };
811
+ };
812
+ };
813
+ } & {
814
+ use: any[];
815
+ }, {
816
+ success: boolean;
817
+ }>;
818
+ revokeUserSessions: better_call0.StrictEndpoint<"/admin/revoke-user-sessions", {
819
+ method: "POST";
820
+ body: zod0.ZodObject<{
821
+ userId: zod0.ZodCoercedString<unknown>;
822
+ }, better_auth220.$strip>;
823
+ use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
824
+ session: {
825
+ user: better_auth_client_plugins7.UserWithRole;
826
+ session: better_auth220.Session;
827
+ };
828
+ }>)[];
829
+ metadata: {
830
+ openapi: {
831
+ operationId: string;
832
+ summary: string;
833
+ description: string;
834
+ responses: {
835
+ 200: {
836
+ description: string;
837
+ content: {
838
+ "application/json": {
839
+ schema: {
840
+ type: "object";
841
+ properties: {
842
+ success: {
843
+ type: string;
844
+ };
845
+ };
846
+ };
847
+ };
848
+ };
849
+ };
850
+ };
851
+ };
852
+ };
853
+ } & {
854
+ use: any[];
855
+ }, {
856
+ success: boolean;
857
+ }>;
858
+ removeUser: better_call0.StrictEndpoint<"/admin/remove-user", {
859
+ method: "POST";
860
+ body: zod0.ZodObject<{
861
+ userId: zod0.ZodCoercedString<unknown>;
862
+ }, better_auth220.$strip>;
863
+ use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
864
+ session: {
865
+ user: better_auth_client_plugins7.UserWithRole;
866
+ session: better_auth220.Session;
867
+ };
868
+ }>)[];
869
+ metadata: {
870
+ openapi: {
871
+ operationId: string;
872
+ summary: string;
873
+ description: string;
874
+ responses: {
875
+ 200: {
876
+ description: string;
877
+ content: {
878
+ "application/json": {
879
+ schema: {
880
+ type: "object";
881
+ properties: {
882
+ success: {
883
+ type: string;
884
+ };
885
+ };
886
+ };
887
+ };
888
+ };
889
+ };
890
+ };
891
+ };
892
+ };
893
+ } & {
894
+ use: any[];
895
+ }, {
896
+ success: boolean;
897
+ }>;
898
+ setUserPassword: better_call0.StrictEndpoint<"/admin/set-user-password", {
899
+ method: "POST";
900
+ body: zod0.ZodObject<{
901
+ newPassword: zod0.ZodString;
902
+ userId: zod0.ZodCoercedString<unknown>;
903
+ }, better_auth220.$strip>;
904
+ use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<{
905
+ session: {
906
+ user: better_auth_client_plugins7.UserWithRole;
907
+ session: better_auth220.Session;
908
+ };
909
+ }>)[];
910
+ metadata: {
911
+ openapi: {
912
+ operationId: string;
913
+ summary: string;
914
+ description: string;
915
+ responses: {
916
+ 200: {
917
+ description: string;
918
+ content: {
919
+ "application/json": {
920
+ schema: {
921
+ type: "object";
922
+ properties: {
923
+ status: {
924
+ type: string;
925
+ };
926
+ };
927
+ };
928
+ };
929
+ };
930
+ };
931
+ };
932
+ };
933
+ };
934
+ } & {
935
+ use: any[];
936
+ }, {
937
+ status: boolean;
938
+ }>;
939
+ userHasPermission: better_call0.StrictEndpoint<"/admin/has-permission", {
940
+ method: "POST";
941
+ body: zod0.ZodIntersection<zod0.ZodObject<{
942
+ userId: zod0.ZodOptional<zod0.ZodCoercedString<unknown>>;
943
+ role: zod0.ZodOptional<zod0.ZodString>;
944
+ }, better_auth220.$strip>, zod0.ZodUnion<readonly [zod0.ZodObject<{
945
+ permission: zod0.ZodRecord<zod0.ZodString, zod0.ZodArray<zod0.ZodString>>;
946
+ permissions: zod0.ZodUndefined;
947
+ }, better_auth220.$strip>, zod0.ZodObject<{
948
+ permission: zod0.ZodUndefined;
949
+ permissions: zod0.ZodRecord<zod0.ZodString, zod0.ZodArray<zod0.ZodString>>;
950
+ }, better_auth220.$strip>]>>;
951
+ metadata: {
952
+ openapi: {
953
+ description: string;
954
+ requestBody: {
955
+ content: {
956
+ "application/json": {
957
+ schema: {
958
+ type: "object";
959
+ properties: {
960
+ permission: {
961
+ type: string;
962
+ description: string;
963
+ deprecated: boolean;
964
+ };
965
+ permissions: {
966
+ type: string;
967
+ description: string;
968
+ };
969
+ };
970
+ required: string[];
971
+ };
972
+ };
973
+ };
974
+ };
975
+ responses: {
976
+ "200": {
977
+ description: string;
978
+ content: {
979
+ "application/json": {
980
+ schema: {
981
+ type: "object";
982
+ properties: {
983
+ error: {
984
+ type: string;
985
+ };
986
+ success: {
987
+ type: string;
988
+ };
989
+ };
990
+ required: string[];
991
+ };
992
+ };
993
+ };
994
+ };
995
+ };
996
+ };
997
+ $Infer: {
998
+ body: ({
999
+ permission: {
1000
+ readonly user?: ("create" | "list" | "set-role" | "ban" | "impersonate" | "delete" | "set-password" | "get" | "update")[] | undefined;
1001
+ readonly session?: ("list" | "delete" | "revoke")[] | undefined;
1002
+ };
1003
+ permissions?: never | undefined;
1004
+ } | {
1005
+ permissions: {
1006
+ readonly user?: ("create" | "list" | "set-role" | "ban" | "impersonate" | "delete" | "set-password" | "get" | "update")[] | undefined;
1007
+ readonly session?: ("list" | "delete" | "revoke")[] | undefined;
1008
+ };
1009
+ permission?: never | undefined;
1010
+ }) & {
1011
+ userId?: string | undefined;
1012
+ role?: "user" | "admin" | undefined;
1013
+ };
1014
+ };
1015
+ };
1016
+ } & {
1017
+ use: any[];
1018
+ }, {
1019
+ error: null;
1020
+ success: boolean;
1021
+ }>;
1022
+ };
1023
+ $ERROR_CODES: {
1024
+ readonly FAILED_TO_CREATE_USER: "Failed to create user";
1025
+ readonly USER_ALREADY_EXISTS: "User already exists.";
1026
+ readonly USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL: "User already exists. Use another email.";
1027
+ readonly YOU_CANNOT_BAN_YOURSELF: "You cannot ban yourself";
1028
+ readonly YOU_ARE_NOT_ALLOWED_TO_CHANGE_USERS_ROLE: "You are not allowed to change users role";
1029
+ readonly YOU_ARE_NOT_ALLOWED_TO_CREATE_USERS: "You are not allowed to create users";
1030
+ readonly YOU_ARE_NOT_ALLOWED_TO_LIST_USERS: "You are not allowed to list users";
1031
+ readonly YOU_ARE_NOT_ALLOWED_TO_LIST_USERS_SESSIONS: "You are not allowed to list users sessions";
1032
+ readonly YOU_ARE_NOT_ALLOWED_TO_BAN_USERS: "You are not allowed to ban users";
1033
+ readonly YOU_ARE_NOT_ALLOWED_TO_IMPERSONATE_USERS: "You are not allowed to impersonate users";
1034
+ readonly YOU_ARE_NOT_ALLOWED_TO_REVOKE_USERS_SESSIONS: "You are not allowed to revoke users sessions";
1035
+ readonly YOU_ARE_NOT_ALLOWED_TO_DELETE_USERS: "You are not allowed to delete users";
1036
+ readonly YOU_ARE_NOT_ALLOWED_TO_SET_USERS_PASSWORD: "You are not allowed to set users password";
1037
+ readonly BANNED_USER: "You have been banned from this application";
1038
+ readonly YOU_ARE_NOT_ALLOWED_TO_GET_USER: "You are not allowed to get user";
1039
+ readonly NO_DATA_TO_UPDATE: "No data to update";
1040
+ readonly YOU_ARE_NOT_ALLOWED_TO_UPDATE_USERS: "You are not allowed to update users";
1041
+ readonly YOU_CANNOT_REMOVE_YOURSELF: "You cannot remove yourself";
1042
+ readonly YOU_ARE_NOT_ALLOWED_TO_SET_NON_EXISTENT_VALUE: "You are not allowed to set a non-existent role value";
1043
+ };
1044
+ schema: {
1045
+ user: {
1046
+ fields: {
1047
+ role: {
1048
+ type: "string";
1049
+ required: false;
1050
+ input: false;
1051
+ };
1052
+ banned: {
1053
+ type: "boolean";
1054
+ defaultValue: false;
1055
+ required: false;
1056
+ input: false;
1057
+ };
1058
+ banReason: {
1059
+ type: "string";
1060
+ required: false;
1061
+ input: false;
1062
+ };
1063
+ banExpires: {
1064
+ type: "date";
1065
+ required: false;
1066
+ input: false;
1067
+ };
1068
+ };
1069
+ };
1070
+ session: {
1071
+ fields: {
1072
+ impersonatedBy: {
1073
+ type: "string";
1074
+ required: false;
1075
+ };
1076
+ };
1077
+ };
1078
+ };
1079
+ options: any;
1080
+ };
1081
+ getActions: () => {
1082
+ admin: {
1083
+ checkRolePermission: <R extends "user" | "admin">(data: ({
1084
+ permission: {
1085
+ readonly user?: ("create" | "list" | "set-role" | "ban" | "impersonate" | "delete" | "set-password" | "get" | "update")[] | undefined;
1086
+ readonly session?: ("list" | "delete" | "revoke")[] | undefined;
1087
+ };
1088
+ permissions?: never | undefined;
1089
+ } | {
1090
+ permissions: {
1091
+ readonly user?: ("create" | "list" | "set-role" | "ban" | "impersonate" | "delete" | "set-password" | "get" | "update")[] | undefined;
1092
+ readonly session?: ("list" | "delete" | "revoke")[] | undefined;
1093
+ };
1094
+ permission?: never | undefined;
1095
+ }) & {
1096
+ role: R;
1097
+ }) => boolean;
1098
+ };
1099
+ };
1100
+ pathMethods: {
1101
+ "/admin/list-users": "GET";
1102
+ "/admin/stop-impersonating": "POST";
1103
+ };
1104
+ } | {
1105
+ id: "organization";
1106
+ $InferServerPlugin: better_auth_client11.OrganizationPlugin<{
1107
+ ac: better_auth_client11.AccessControl<{
1108
+ readonly organization: readonly ["update", "delete"];
1109
+ readonly member: readonly ["create", "update", "delete"];
1110
+ readonly invitation: readonly ["create", "cancel"];
1111
+ readonly team: readonly ["create", "update", "delete"];
1112
+ readonly ac: readonly ["create", "read", "update", "delete"];
1113
+ }>;
1114
+ roles: {
1115
+ admin: better_auth_client11.Role;
1116
+ member: better_auth_client11.Role;
1117
+ owner: better_auth_client11.Role;
1118
+ };
1119
+ teams: {
1120
+ enabled: false;
1121
+ };
1122
+ schema: {
1123
+ organization?: {
1124
+ additionalFields?: {
1125
+ [key: string]: better_auth220.DBFieldAttribute;
1126
+ };
1127
+ };
1128
+ member?: {
1129
+ additionalFields?: {
1130
+ [key: string]: better_auth220.DBFieldAttribute;
1131
+ };
1132
+ };
1133
+ invitation?: {
1134
+ additionalFields?: {
1135
+ [key: string]: better_auth220.DBFieldAttribute;
1136
+ };
1137
+ };
1138
+ team?: {
1139
+ additionalFields?: {
1140
+ [key: string]: better_auth220.DBFieldAttribute;
1141
+ };
1142
+ };
1143
+ organizationRole?: {
1144
+ additionalFields?: {
1145
+ [key: string]: better_auth220.DBFieldAttribute;
1146
+ };
1147
+ };
1148
+ } | undefined;
1149
+ dynamicAccessControl: {
1150
+ enabled: false;
1151
+ };
1152
+ }>;
1153
+ getActions: ($fetch: _better_fetch_fetch138.BetterFetch, _$store: better_auth220.ClientStore, co: BetterAuthClientOptions | undefined) => {
1154
+ $Infer: {
1155
+ ActiveOrganization: {
1156
+ members: {
1157
+ id: string;
1158
+ organizationId: string;
1159
+ role: "admin" | "member" | "owner";
1160
+ createdAt: Date;
1161
+ userId: string;
1162
+ user: {
1163
+ id: string;
1164
+ email: string;
1165
+ name: string;
1166
+ image?: string | undefined;
1167
+ };
1168
+ }[];
1169
+ invitations: {
1170
+ id: string;
1171
+ organizationId: string;
1172
+ email: string;
1173
+ role: "admin" | "member" | "owner";
1174
+ status: better_auth_client11.InvitationStatus;
1175
+ inviterId: string;
1176
+ expiresAt: Date;
1177
+ createdAt: Date;
1178
+ }[];
1179
+ } & {
1180
+ id: string;
1181
+ name: string;
1182
+ slug: string;
1183
+ createdAt: Date;
1184
+ logo?: string | null | undefined | undefined;
1185
+ metadata?: any;
1186
+ };
1187
+ Organization: {
1188
+ id: string;
1189
+ name: string;
1190
+ slug: string;
1191
+ createdAt: Date;
1192
+ logo?: string | null | undefined;
1193
+ metadata?: any;
1194
+ };
1195
+ Invitation: {
1196
+ id: string;
1197
+ organizationId: string;
1198
+ email: string;
1199
+ role: "admin" | "member" | "owner";
1200
+ status: better_auth_client11.InvitationStatus;
1201
+ inviterId: string;
1202
+ expiresAt: Date;
1203
+ createdAt: Date;
1204
+ };
1205
+ Member: {
1206
+ id: string;
1207
+ organizationId: string;
1208
+ role: "admin" | "member" | "owner";
1209
+ createdAt: Date;
1210
+ userId: string;
1211
+ user: {
1212
+ id: string;
1213
+ email: string;
1214
+ name: string;
1215
+ image?: string | undefined;
1216
+ };
1217
+ };
1218
+ Team: {
1219
+ id: string;
1220
+ name: string;
1221
+ organizationId: string;
1222
+ createdAt: Date;
1223
+ updatedAt?: Date | undefined;
1224
+ };
1225
+ };
1226
+ organization: {
1227
+ checkRolePermission: <R extends "admin" | "member" | "owner">(data: ({
1228
+ permission: {
1229
+ readonly organization?: ("delete" | "update")[] | undefined;
1230
+ readonly member?: ("create" | "delete" | "update")[] | undefined;
1231
+ readonly invitation?: ("create" | "cancel")[] | undefined;
1232
+ readonly team?: ("create" | "delete" | "update")[] | undefined;
1233
+ readonly ac?: ("create" | "delete" | "update" | "read")[] | undefined;
1234
+ };
1235
+ permissions?: never | undefined;
1236
+ } | {
1237
+ permissions: {
1238
+ readonly organization?: ("delete" | "update")[] | undefined;
1239
+ readonly member?: ("create" | "delete" | "update")[] | undefined;
1240
+ readonly invitation?: ("create" | "cancel")[] | undefined;
1241
+ readonly team?: ("create" | "delete" | "update")[] | undefined;
1242
+ readonly ac?: ("create" | "delete" | "update" | "read")[] | undefined;
1243
+ };
1244
+ permission?: never | undefined;
1245
+ }) & {
1246
+ role: R;
1247
+ }) => boolean;
1248
+ };
1249
+ };
1250
+ getAtoms: ($fetch: _better_fetch_fetch138.BetterFetch) => {
1251
+ $listOrg: nanostores1.PreinitializedWritableAtom<boolean> & object;
1252
+ $activeOrgSignal: nanostores1.PreinitializedWritableAtom<boolean> & object;
1253
+ $activeMemberSignal: nanostores1.PreinitializedWritableAtom<boolean> & object;
1254
+ $activeMemberRoleSignal: nanostores1.PreinitializedWritableAtom<boolean> & object;
1255
+ activeOrganization: nanostores1.PreinitializedWritableAtom<{
1256
+ data: better_auth220.Prettify<{
1257
+ id: string;
1258
+ name: string;
1259
+ slug: string;
1260
+ createdAt: Date;
1261
+ logo?: string | null | undefined | undefined;
1262
+ metadata?: any;
1263
+ } & {
1264
+ members: {
1265
+ id: string;
1266
+ organizationId: string;
1267
+ role: "admin" | "member" | "owner";
1268
+ createdAt: Date;
1269
+ userId: string;
1270
+ user: {
1271
+ id: string;
1272
+ email: string;
1273
+ name: string;
1274
+ image?: string | undefined;
1275
+ };
1276
+ }[];
1277
+ invitations: {
1278
+ id: string;
1279
+ organizationId: string;
1280
+ email: string;
1281
+ role: "admin" | "member" | "owner";
1282
+ status: better_auth_client11.InvitationStatus;
1283
+ inviterId: string;
1284
+ expiresAt: Date;
1285
+ createdAt: Date;
1286
+ }[];
1287
+ }> | null;
1288
+ error: null | _better_fetch_fetch138.BetterFetchError;
1289
+ isPending: boolean;
1290
+ isRefetching: boolean;
1291
+ refetch: (queryParams?: {
1292
+ query?: better_auth220.SessionQueryParams;
1293
+ } | undefined) => Promise<void>;
1294
+ }> & object;
1295
+ listOrganizations: nanostores1.PreinitializedWritableAtom<{
1296
+ data: {
1297
+ id: string;
1298
+ name: string;
1299
+ slug: string;
1300
+ createdAt: Date;
1301
+ logo?: string | null | undefined | undefined;
1302
+ metadata?: any;
1303
+ }[] | null;
1304
+ error: null | _better_fetch_fetch138.BetterFetchError;
1305
+ isPending: boolean;
1306
+ isRefetching: boolean;
1307
+ refetch: (queryParams?: {
1308
+ query?: better_auth220.SessionQueryParams;
1309
+ } | undefined) => Promise<void>;
1310
+ }> & object;
1311
+ activeMember: nanostores1.PreinitializedWritableAtom<{
1312
+ data: {
1313
+ id: string;
1314
+ organizationId: string;
1315
+ userId: string;
1316
+ role: string;
1317
+ createdAt: Date;
1318
+ } | null;
1319
+ error: null | _better_fetch_fetch138.BetterFetchError;
1320
+ isPending: boolean;
1321
+ isRefetching: boolean;
1322
+ refetch: (queryParams?: {
1323
+ query?: better_auth220.SessionQueryParams;
1324
+ } | undefined) => Promise<void>;
1325
+ }> & object;
1326
+ activeMemberRole: nanostores1.PreinitializedWritableAtom<{
1327
+ data: {
1328
+ role: string;
1329
+ } | null;
1330
+ error: null | _better_fetch_fetch138.BetterFetchError;
1331
+ isPending: boolean;
1332
+ isRefetching: boolean;
1333
+ refetch: (queryParams?: {
1334
+ query?: better_auth220.SessionQueryParams;
1335
+ } | undefined) => Promise<void>;
1336
+ }> & object;
1337
+ };
1338
+ pathMethods: {
1339
+ "/organization/get-full-organization": "GET";
1340
+ "/organization/list-user-teams": "GET";
1341
+ };
1342
+ atomListeners: ({
1343
+ matcher(path: string): path is "/organization/create" | "/organization/update" | "/organization/delete";
1344
+ signal: "$listOrg";
1345
+ } | {
1346
+ matcher(path: string): boolean;
1347
+ signal: "$activeOrgSignal";
1348
+ } | {
1349
+ matcher(path: string): boolean;
1350
+ signal: "$sessionSignal";
1351
+ } | {
1352
+ matcher(path: string): boolean;
1353
+ signal: "$activeMemberSignal";
1354
+ } | {
1355
+ matcher(path: string): boolean;
1356
+ signal: "$activeMemberRoleSignal";
1357
+ })[];
1358
+ } | {
1359
+ id: "email-otp";
1360
+ $InferServerPlugin: {
1361
+ id: "email-otp";
1362
+ init(ctx: better_auth220.AuthContext): {
1363
+ options: {
1364
+ emailVerification: {
1365
+ sendVerificationEmail(data: {
1366
+ user: better_auth220.User;
1367
+ url: string;
1368
+ token: string;
1369
+ }, request: Request | undefined): Promise<void>;
1370
+ };
1371
+ };
1372
+ } | undefined;
1373
+ endpoints: {
1374
+ sendVerificationOTP: better_call0.StrictEndpoint<"/email-otp/send-verification-otp", {
1375
+ method: "POST";
1376
+ body: zod0.ZodObject<{
1377
+ email: zod0.ZodString;
1378
+ type: zod0.ZodEnum<{
1379
+ "sign-in": "sign-in";
1380
+ "email-verification": "email-verification";
1381
+ "forget-password": "forget-password";
1382
+ }>;
1383
+ }, better_auth220.$strip>;
1384
+ metadata: {
1385
+ openapi: {
1386
+ operationId: string;
1387
+ description: string;
1388
+ responses: {
1389
+ 200: {
1390
+ description: string;
1391
+ content: {
1392
+ "application/json": {
1393
+ schema: {
1394
+ type: "object";
1395
+ properties: {
1396
+ success: {
1397
+ type: string;
1398
+ };
1399
+ };
1400
+ };
1401
+ };
1402
+ };
1403
+ };
1404
+ };
1405
+ };
1406
+ };
1407
+ } & {
1408
+ use: any[];
1409
+ }, {
1410
+ success: boolean;
1411
+ }>;
1412
+ createVerificationOTP: better_call0.StrictEndpoint<"/email-otp/create-verification-otp", {
1413
+ method: "POST";
1414
+ body: zod0.ZodObject<{
1415
+ email: zod0.ZodString;
1416
+ type: zod0.ZodEnum<{
1417
+ "sign-in": "sign-in";
1418
+ "email-verification": "email-verification";
1419
+ "forget-password": "forget-password";
1420
+ }>;
1421
+ }, better_auth220.$strip>;
1422
+ metadata: {
1423
+ SERVER_ONLY: true;
1424
+ openapi: {
1425
+ operationId: string;
1426
+ description: string;
1427
+ responses: {
1428
+ 200: {
1429
+ description: string;
1430
+ content: {
1431
+ "application/json": {
1432
+ schema: {
1433
+ type: "string";
1434
+ };
1435
+ };
1436
+ };
1437
+ };
1438
+ };
1439
+ };
1440
+ };
1441
+ } & {
1442
+ use: any[];
1443
+ }, string>;
1444
+ getVerificationOTP: better_call0.StrictEndpoint<"/email-otp/get-verification-otp", {
1445
+ method: "GET";
1446
+ query: zod0.ZodObject<{
1447
+ email: zod0.ZodString;
1448
+ type: zod0.ZodEnum<{
1449
+ "sign-in": "sign-in";
1450
+ "email-verification": "email-verification";
1451
+ "forget-password": "forget-password";
1452
+ }>;
1453
+ }, better_auth220.$strip>;
1454
+ metadata: {
1455
+ SERVER_ONLY: true;
1456
+ openapi: {
1457
+ operationId: string;
1458
+ description: string;
1459
+ responses: {
1460
+ "200": {
1461
+ description: string;
1462
+ content: {
1463
+ "application/json": {
1464
+ schema: {
1465
+ type: "object";
1466
+ properties: {
1467
+ otp: {
1468
+ type: string;
1469
+ nullable: boolean;
1470
+ description: string;
1471
+ };
1472
+ };
1473
+ required: string[];
1474
+ };
1475
+ };
1476
+ };
1477
+ };
1478
+ };
1479
+ };
1480
+ };
1481
+ } & {
1482
+ use: any[];
1483
+ }, {
1484
+ otp: null;
1485
+ } | {
1486
+ otp: string;
1487
+ }>;
1488
+ checkVerificationOTP: better_call0.StrictEndpoint<"/email-otp/check-verification-otp", {
1489
+ method: "POST";
1490
+ body: zod0.ZodObject<{
1491
+ email: zod0.ZodString;
1492
+ type: zod0.ZodEnum<{
1493
+ "sign-in": "sign-in";
1494
+ "email-verification": "email-verification";
1495
+ "forget-password": "forget-password";
1496
+ }>;
1497
+ otp: zod0.ZodString;
1498
+ }, better_auth220.$strip>;
1499
+ metadata: {
1500
+ openapi: {
1501
+ operationId: string;
1502
+ description: string;
1503
+ responses: {
1504
+ 200: {
1505
+ description: string;
1506
+ content: {
1507
+ "application/json": {
1508
+ schema: {
1509
+ type: "object";
1510
+ properties: {
1511
+ success: {
1512
+ type: string;
1513
+ };
1514
+ };
1515
+ };
1516
+ };
1517
+ };
1518
+ };
1519
+ };
1520
+ };
1521
+ };
1522
+ } & {
1523
+ use: any[];
1524
+ }, {
1525
+ success: boolean;
1526
+ }>;
1527
+ verifyEmailOTP: better_call0.StrictEndpoint<"/email-otp/verify-email", {
1528
+ method: "POST";
1529
+ body: zod0.ZodObject<{
1530
+ email: zod0.ZodString;
1531
+ otp: zod0.ZodString;
1532
+ }, better_auth220.$strip>;
1533
+ metadata: {
1534
+ openapi: {
1535
+ description: string;
1536
+ responses: {
1537
+ 200: {
1538
+ description: string;
1539
+ content: {
1540
+ "application/json": {
1541
+ schema: {
1542
+ type: "object";
1543
+ properties: {
1544
+ status: {
1545
+ type: string;
1546
+ description: string;
1547
+ enum: boolean[];
1548
+ };
1549
+ token: {
1550
+ type: string;
1551
+ nullable: boolean;
1552
+ description: string;
1553
+ };
1554
+ user: {
1555
+ $ref: string;
1556
+ };
1557
+ };
1558
+ required: string[];
1559
+ };
1560
+ };
1561
+ };
1562
+ };
1563
+ };
1564
+ };
1565
+ };
1566
+ } & {
1567
+ use: any[];
1568
+ }, {
1569
+ status: boolean;
1570
+ token: string;
1571
+ user: {
1572
+ id: string;
1573
+ email: string;
1574
+ emailVerified: boolean;
1575
+ name: string;
1576
+ image: string | null | undefined;
1577
+ createdAt: Date;
1578
+ updatedAt: Date;
1579
+ };
1580
+ } | {
1581
+ status: boolean;
1582
+ token: null;
1583
+ user: {
1584
+ id: string;
1585
+ email: string;
1586
+ emailVerified: boolean;
1587
+ name: string;
1588
+ image: string | null | undefined;
1589
+ createdAt: Date;
1590
+ updatedAt: Date;
1591
+ };
1592
+ }>;
1593
+ signInEmailOTP: better_call0.StrictEndpoint<"/sign-in/email-otp", {
1594
+ method: "POST";
1595
+ body: zod0.ZodObject<{
1596
+ email: zod0.ZodString;
1597
+ otp: zod0.ZodString;
1598
+ }, better_auth220.$strip>;
1599
+ metadata: {
1600
+ openapi: {
1601
+ operationId: string;
1602
+ description: string;
1603
+ responses: {
1604
+ 200: {
1605
+ description: string;
1606
+ content: {
1607
+ "application/json": {
1608
+ schema: {
1609
+ type: "object";
1610
+ properties: {
1611
+ token: {
1612
+ type: string;
1613
+ description: string;
1614
+ };
1615
+ user: {
1616
+ $ref: string;
1617
+ };
1618
+ };
1619
+ required: string[];
1620
+ };
1621
+ };
1622
+ };
1623
+ };
1624
+ };
1625
+ };
1626
+ };
1627
+ } & {
1628
+ use: any[];
1629
+ }, {
1630
+ token: string;
1631
+ user: {
1632
+ id: string;
1633
+ email: string;
1634
+ emailVerified: boolean;
1635
+ name: string;
1636
+ image: string | null | undefined;
1637
+ createdAt: Date;
1638
+ updatedAt: Date;
1639
+ };
1640
+ }>;
1641
+ forgetPasswordEmailOTP: better_call0.StrictEndpoint<"/forget-password/email-otp", {
1642
+ method: "POST";
1643
+ body: zod0.ZodObject<{
1644
+ email: zod0.ZodString;
1645
+ }, better_auth220.$strip>;
1646
+ metadata: {
1647
+ openapi: {
1648
+ operationId: string;
1649
+ description: string;
1650
+ responses: {
1651
+ 200: {
1652
+ description: string;
1653
+ content: {
1654
+ "application/json": {
1655
+ schema: {
1656
+ type: "object";
1657
+ properties: {
1658
+ success: {
1659
+ type: string;
1660
+ description: string;
1661
+ };
1662
+ };
1663
+ };
1664
+ };
1665
+ };
1666
+ };
1667
+ };
1668
+ };
1669
+ };
1670
+ } & {
1671
+ use: any[];
1672
+ }, {
1673
+ success: boolean;
1674
+ }>;
1675
+ resetPasswordEmailOTP: better_call0.StrictEndpoint<"/email-otp/reset-password", {
1676
+ method: "POST";
1677
+ body: zod0.ZodObject<{
1678
+ email: zod0.ZodString;
1679
+ otp: zod0.ZodString;
1680
+ password: zod0.ZodString;
1681
+ }, better_auth220.$strip>;
1682
+ metadata: {
1683
+ openapi: {
1684
+ operationId: string;
1685
+ description: string;
1686
+ responses: {
1687
+ 200: {
1688
+ description: string;
1689
+ contnt: {
1690
+ "application/json": {
1691
+ schema: {
1692
+ type: string;
1693
+ properties: {
1694
+ success: {
1695
+ type: string;
1696
+ };
1697
+ };
1698
+ };
1699
+ };
1700
+ };
1701
+ };
1702
+ };
1703
+ };
1704
+ };
1705
+ } & {
1706
+ use: any[];
1707
+ }, {
1708
+ success: boolean;
1709
+ }>;
1710
+ };
1711
+ hooks: {
1712
+ after: {
1713
+ matcher(context: better_auth220.HookEndpointContext): boolean;
1714
+ handler: (inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<void>;
1715
+ }[];
1716
+ };
1717
+ $ERROR_CODES: {
1718
+ readonly OTP_EXPIRED: "OTP expired";
1719
+ readonly INVALID_OTP: "Invalid OTP";
1720
+ readonly TOO_MANY_ATTEMPTS: "Too many attempts";
1721
+ };
1722
+ rateLimit: ({
1723
+ pathMatcher(path: string): path is "/email-otp/send-verification-otp";
1724
+ window: number;
1725
+ max: number;
1726
+ } | {
1727
+ pathMatcher(path: string): path is "/email-otp/check-verification-otp";
1728
+ window: number;
1729
+ max: number;
1730
+ } | {
1731
+ pathMatcher(path: string): path is "/email-otp/verify-email";
1732
+ window: number;
1733
+ max: number;
1734
+ } | {
1735
+ pathMatcher(path: string): path is "/sign-in/email-otp";
1736
+ window: number;
1737
+ max: number;
1738
+ })[];
1739
+ };
1740
+ atomListeners: {
1741
+ matcher: (path: string) => path is "/email-otp/verify-email" | "/sign-in/email-otp";
1742
+ signal: "$sessionSignal";
1743
+ }[];
1744
+ } | {
1745
+ id: "anonymous";
1746
+ $InferServerPlugin: ReturnType<(options?: better_auth_client_plugins7.AnonymousOptions | undefined) => {
1747
+ id: "anonymous";
1748
+ endpoints: {
1749
+ signInAnonymous: better_call0.StrictEndpoint<"/sign-in/anonymous", {
1750
+ method: "POST";
1751
+ metadata: {
1752
+ openapi: {
1753
+ description: string;
1754
+ responses: {
1755
+ 200: {
1756
+ description: string;
1757
+ content: {
1758
+ "application/json": {
1759
+ schema: {
1760
+ type: "object";
1761
+ properties: {
1762
+ user: {
1763
+ $ref: string;
1764
+ };
1765
+ session: {
1766
+ $ref: string;
1767
+ };
1768
+ };
1769
+ };
1770
+ };
1771
+ };
1772
+ };
1773
+ };
1774
+ };
1775
+ };
1776
+ } & {
1777
+ use: any[];
1778
+ }, {
1779
+ token: string;
1780
+ user: {
1781
+ id: string;
1782
+ email: string;
1783
+ emailVerified: boolean;
1784
+ name: string;
1785
+ createdAt: Date;
1786
+ updatedAt: Date;
1787
+ };
1788
+ } | null>;
1789
+ };
1790
+ hooks: {
1791
+ after: {
1792
+ matcher(ctx: better_auth220.HookEndpointContext): boolean;
1793
+ handler: (inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<void>;
1794
+ }[];
1795
+ };
1796
+ schema: {
1797
+ user: {
1798
+ fields: {
1799
+ isAnonymous: {
1800
+ type: "boolean";
1801
+ required: false;
1802
+ input: false;
1803
+ defaultValue: false;
1804
+ };
1805
+ };
1806
+ };
1807
+ };
1808
+ $ERROR_CODES: {
1809
+ readonly INVALID_EMAIL_FORMAT: "Email was not generated in a valid format";
1810
+ readonly FAILED_TO_CREATE_USER: "Failed to create user";
1811
+ readonly COULD_NOT_CREATE_SESSION: "Could not create session";
1812
+ readonly ANONYMOUS_USERS_CANNOT_SIGN_IN_AGAIN_ANONYMOUSLY: "Anonymous users cannot sign in again anonymously";
1813
+ };
1814
+ }>;
1815
+ pathMethods: {
1816
+ "/sign-in/anonymous": "POST";
1817
+ };
1818
+ atomListeners: {
1819
+ matcher: (path: string) => path is "/sign-in/anonymous";
1820
+ signal: "$sessionSignal";
1821
+ }[];
1822
+ } | {
1823
+ id: "phoneNumber";
1824
+ $InferServerPlugin: ReturnType<(options?: better_auth_client_plugins7.PhoneNumberOptions | undefined) => {
1825
+ id: "phone-number";
1826
+ hooks: {
1827
+ before: {
1828
+ matcher: (ctx: better_auth220.HookEndpointContext) => boolean;
1829
+ handler: (inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<never>;
1830
+ }[];
1831
+ };
1832
+ endpoints: {
1833
+ signInPhoneNumber: better_call0.StrictEndpoint<"/sign-in/phone-number", {
1834
+ method: "POST";
1835
+ body: zod0.ZodObject<{
1836
+ phoneNumber: zod0.ZodString;
1837
+ password: zod0.ZodString;
1838
+ rememberMe: zod0.ZodOptional<zod0.ZodBoolean>;
1839
+ }, better_auth220.$strip>;
1840
+ metadata: {
1841
+ openapi: {
1842
+ summary: string;
1843
+ description: string;
1844
+ responses: {
1845
+ 200: {
1846
+ description: string;
1847
+ content: {
1848
+ "application/json": {
1849
+ schema: {
1850
+ type: "object";
1851
+ properties: {
1852
+ user: {
1853
+ $ref: string;
1854
+ };
1855
+ session: {
1856
+ $ref: string;
1857
+ };
1858
+ };
1859
+ };
1860
+ };
1861
+ };
1862
+ };
1863
+ 400: {
1864
+ description: string;
1865
+ };
1866
+ };
1867
+ };
1868
+ };
1869
+ } & {
1870
+ use: any[];
1871
+ }, {
1872
+ token: string;
1873
+ user: better_auth_client_plugins7.UserWithPhoneNumber;
1874
+ }>;
1875
+ sendPhoneNumberOTP: better_call0.StrictEndpoint<"/phone-number/send-otp", {
1876
+ method: "POST";
1877
+ body: zod0.ZodObject<{
1878
+ phoneNumber: zod0.ZodString;
1879
+ }, better_auth220.$strip>;
1880
+ metadata: {
1881
+ openapi: {
1882
+ summary: string;
1883
+ description: string;
1884
+ responses: {
1885
+ 200: {
1886
+ description: string;
1887
+ content: {
1888
+ "application/json": {
1889
+ schema: {
1890
+ type: "object";
1891
+ properties: {
1892
+ message: {
1893
+ type: string;
1894
+ };
1895
+ };
1896
+ };
1897
+ };
1898
+ };
1899
+ };
1900
+ };
1901
+ };
1902
+ };
1903
+ } & {
1904
+ use: any[];
1905
+ }, {
1906
+ message: string;
1907
+ }>;
1908
+ verifyPhoneNumber: better_call0.StrictEndpoint<"/phone-number/verify", {
1909
+ method: "POST";
1910
+ body: zod0.ZodObject<{
1911
+ phoneNumber: zod0.ZodString;
1912
+ code: zod0.ZodString;
1913
+ disableSession: zod0.ZodOptional<zod0.ZodBoolean>;
1914
+ updatePhoneNumber: zod0.ZodOptional<zod0.ZodBoolean>;
1915
+ }, better_auth220.$strip>;
1916
+ metadata: {
1917
+ openapi: {
1918
+ summary: string;
1919
+ description: string;
1920
+ responses: {
1921
+ "200": {
1922
+ description: string;
1923
+ content: {
1924
+ "application/json": {
1925
+ schema: {
1926
+ type: "object";
1927
+ properties: {
1928
+ status: {
1929
+ type: string;
1930
+ description: string;
1931
+ enum: boolean[];
1932
+ };
1933
+ token: {
1934
+ type: string;
1935
+ nullable: boolean;
1936
+ description: string;
1937
+ };
1938
+ user: {
1939
+ type: string;
1940
+ nullable: boolean;
1941
+ properties: {
1942
+ id: {
1943
+ type: string;
1944
+ description: string;
1945
+ };
1946
+ email: {
1947
+ type: string;
1948
+ format: string;
1949
+ nullable: boolean;
1950
+ description: string;
1951
+ };
1952
+ emailVerified: {
1953
+ type: string;
1954
+ nullable: boolean;
1955
+ description: string;
1956
+ };
1957
+ name: {
1958
+ type: string;
1959
+ nullable: boolean;
1960
+ description: string;
1961
+ };
1962
+ image: {
1963
+ type: string;
1964
+ format: string;
1965
+ nullable: boolean;
1966
+ description: string;
1967
+ };
1968
+ phoneNumber: {
1969
+ type: string;
1970
+ description: string;
1971
+ };
1972
+ phoneNumberVerified: {
1973
+ type: string;
1974
+ description: string;
1975
+ };
1976
+ createdAt: {
1977
+ type: string;
1978
+ format: string;
1979
+ description: string;
1980
+ };
1981
+ updatedAt: {
1982
+ type: string;
1983
+ format: string;
1984
+ description: string;
1985
+ };
1986
+ };
1987
+ required: string[];
1988
+ description: string;
1989
+ };
1990
+ };
1991
+ required: string[];
1992
+ };
1993
+ };
1994
+ };
1995
+ };
1996
+ 400: {
1997
+ description: string;
1998
+ };
1999
+ };
2000
+ };
2001
+ };
2002
+ } & {
2003
+ use: any[];
2004
+ }, {
2005
+ status: boolean;
2006
+ token: string;
2007
+ user: better_auth_client_plugins7.UserWithPhoneNumber;
2008
+ } | {
2009
+ status: boolean;
2010
+ token: null;
2011
+ user: better_auth_client_plugins7.UserWithPhoneNumber;
2012
+ }>;
2013
+ requestPasswordResetPhoneNumber: better_call0.StrictEndpoint<"/phone-number/request-password-reset", {
2014
+ method: "POST";
2015
+ body: zod0.ZodObject<{
2016
+ phoneNumber: zod0.ZodString;
2017
+ }, better_auth220.$strip>;
2018
+ metadata: {
2019
+ openapi: {
2020
+ description: string;
2021
+ responses: {
2022
+ "200": {
2023
+ description: string;
2024
+ content: {
2025
+ "application/json": {
2026
+ schema: {
2027
+ type: "object";
2028
+ properties: {
2029
+ status: {
2030
+ type: string;
2031
+ description: string;
2032
+ enum: boolean[];
2033
+ };
2034
+ };
2035
+ required: string[];
2036
+ };
2037
+ };
2038
+ };
2039
+ };
2040
+ };
2041
+ };
2042
+ };
2043
+ } & {
2044
+ use: any[];
2045
+ }, {
2046
+ status: boolean;
2047
+ }>;
2048
+ resetPasswordPhoneNumber: better_call0.StrictEndpoint<"/phone-number/reset-password", {
2049
+ method: "POST";
2050
+ body: zod0.ZodObject<{
2051
+ otp: zod0.ZodString;
2052
+ phoneNumber: zod0.ZodString;
2053
+ newPassword: zod0.ZodString;
2054
+ }, better_auth220.$strip>;
2055
+ metadata: {
2056
+ openapi: {
2057
+ description: string;
2058
+ responses: {
2059
+ "200": {
2060
+ description: string;
2061
+ content: {
2062
+ "application/json": {
2063
+ schema: {
2064
+ type: "object";
2065
+ properties: {
2066
+ status: {
2067
+ type: string;
2068
+ description: string;
2069
+ enum: boolean[];
2070
+ };
2071
+ };
2072
+ required: string[];
2073
+ };
2074
+ };
2075
+ };
2076
+ };
2077
+ };
2078
+ };
2079
+ };
2080
+ } & {
2081
+ use: any[];
2082
+ }, {
2083
+ status: boolean;
2084
+ }>;
2085
+ };
2086
+ schema: {
2087
+ user: {
2088
+ fields: {
2089
+ phoneNumber: {
2090
+ type: "string";
2091
+ required: false;
2092
+ unique: true;
2093
+ sortable: true;
2094
+ returned: true;
2095
+ };
2096
+ phoneNumberVerified: {
2097
+ type: "boolean";
2098
+ required: false;
2099
+ returned: true;
2100
+ input: false;
2101
+ };
2102
+ };
2103
+ };
2104
+ };
2105
+ rateLimit: {
2106
+ pathMatcher(path: string): boolean;
2107
+ window: number;
2108
+ max: number;
2109
+ }[];
2110
+ $ERROR_CODES: {
2111
+ readonly INVALID_PHONE_NUMBER: "Invalid phone number";
2112
+ readonly PHONE_NUMBER_EXIST: "Phone number already exists";
2113
+ readonly PHONE_NUMBER_NOT_EXIST: "phone number isn't registered";
2114
+ readonly INVALID_PHONE_NUMBER_OR_PASSWORD: "Invalid phone number or password";
2115
+ readonly UNEXPECTED_ERROR: "Unexpected error";
2116
+ readonly OTP_NOT_FOUND: "OTP not found";
2117
+ readonly OTP_EXPIRED: "OTP expired";
2118
+ readonly INVALID_OTP: "Invalid OTP";
2119
+ readonly PHONE_NUMBER_NOT_VERIFIED: "Phone number not verified";
2120
+ readonly PHONE_NUMBER_CANNOT_BE_UPDATED: "Phone number cannot be updated";
2121
+ readonly SEND_OTP_NOT_IMPLEMENTED: "sendOTP not implemented";
2122
+ readonly TOO_MANY_ATTEMPTS: "Too many attempts";
2123
+ };
2124
+ }>;
2125
+ atomListeners: {
2126
+ matcher(path: string): path is "/phone-number/verify" | "/sign-in/phone-number" | "/phone-number/update";
2127
+ signal: "$sessionSignal";
2128
+ }[];
2129
+ } | {
2130
+ id: "magic-link";
2131
+ $InferServerPlugin: {
2132
+ id: "magic-link";
2133
+ endpoints: {
2134
+ signInMagicLink: better_call0.StrictEndpoint<"/sign-in/magic-link", {
2135
+ method: "POST";
2136
+ requireHeaders: true;
2137
+ body: zod0.ZodObject<{
2138
+ email: zod0.ZodEmail;
2139
+ name: zod0.ZodOptional<zod0.ZodString>;
2140
+ callbackURL: zod0.ZodOptional<zod0.ZodString>;
2141
+ newUserCallbackURL: zod0.ZodOptional<zod0.ZodString>;
2142
+ errorCallbackURL: zod0.ZodOptional<zod0.ZodString>;
2143
+ }, better_auth220.$strip>;
2144
+ metadata: {
2145
+ openapi: {
2146
+ operationId: string;
2147
+ description: string;
2148
+ responses: {
2149
+ 200: {
2150
+ description: string;
2151
+ content: {
2152
+ "application/json": {
2153
+ schema: {
2154
+ type: "object";
2155
+ properties: {
2156
+ status: {
2157
+ type: string;
2158
+ };
2159
+ };
2160
+ };
2161
+ };
2162
+ };
2163
+ };
2164
+ };
2165
+ };
2166
+ };
2167
+ } & {
2168
+ use: any[];
2169
+ }, {
2170
+ status: boolean;
2171
+ }>;
2172
+ magicLinkVerify: better_call0.StrictEndpoint<"/magic-link/verify", {
2173
+ method: "GET";
2174
+ query: zod0.ZodObject<{
2175
+ token: zod0.ZodString;
2176
+ callbackURL: zod0.ZodOptional<zod0.ZodString>;
2177
+ errorCallbackURL: zod0.ZodOptional<zod0.ZodString>;
2178
+ newUserCallbackURL: zod0.ZodOptional<zod0.ZodString>;
2179
+ }, better_auth220.$strip>;
2180
+ use: ((inputContext: better_call0.MiddlewareInputContext<better_call0.MiddlewareOptions>) => Promise<void>)[];
2181
+ requireHeaders: true;
2182
+ metadata: {
2183
+ openapi: {
2184
+ operationId: string;
2185
+ description: string;
2186
+ responses: {
2187
+ 200: {
2188
+ description: string;
2189
+ content: {
2190
+ "application/json": {
2191
+ schema: {
2192
+ type: "object";
2193
+ properties: {
2194
+ session: {
2195
+ $ref: string;
2196
+ };
2197
+ user: {
2198
+ $ref: string;
2199
+ };
2200
+ };
2201
+ };
2202
+ };
2203
+ };
2204
+ };
2205
+ };
2206
+ };
2207
+ };
2208
+ } & {
2209
+ use: any[];
2210
+ }, {
2211
+ token: string;
2212
+ user: {
2213
+ id: string;
2214
+ email: string;
2215
+ emailVerified: boolean;
2216
+ name: string;
2217
+ image: string | null | undefined;
2218
+ createdAt: Date;
2219
+ updatedAt: Date;
2220
+ };
2221
+ }>;
2222
+ };
2223
+ rateLimit: {
2224
+ pathMatcher(path: string): boolean;
2225
+ window: number;
2226
+ max: number;
2227
+ }[];
2228
+ };
2229
+ })[];
2230
+ type SupportedBetterAuthClientPlugins = typeof supportedBetterAuthClientPlugins;
2231
+ declare abstract class NeonAuthAdapterCore {
2232
+ protected betterAuthOptions: BetterAuthClientOptions & {
2233
+ plugins: SupportedBetterAuthClientPlugins;
2234
+ fetchOptions: {
2235
+ throw: false;
2236
+ };
2237
+ };
2238
+ /**
2239
+ * Better Auth adapter implementing the NeonAuthClient interface.
2240
+ * See CLAUDE.md for architecture details and API mappings.
2241
+ */
2242
+ constructor(betterAuthClientOptions: NeonAuthAdapterCoreAuthOptions);
2243
+ abstract getBetterAuthInstance?(): AuthClient<BetterAuthClientOptions> | ReturnType<typeof createAuthClient>;
2244
+ abstract getJWTToken(): Promise<string | null>;
2245
+ }
2246
+ //#endregion
2247
+ export { NeonAuthAdapterCoreAuthOptions as n, SupportedBetterAuthClientPlugins as r, NeonAuthAdapterCore as t };