@rolder/kit 3.0.0-alpha.97 → 3.0.0-alpha.99

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,1211 @@
1
+ export declare const defaultAuthServerConfig: {
2
+ baseURL: string;
3
+ secret: string | undefined;
4
+ database: (options: Parameters<import("better-auth/adapters").AdapterFactory>[0]) => import("better-auth").DBAdapter<import("better-auth").BetterAuthOptions>;
5
+ experimental: {
6
+ joins: boolean;
7
+ };
8
+ emailAndPassword: {
9
+ enabled: boolean;
10
+ };
11
+ plugins: ({
12
+ id: "username";
13
+ init(ctx: import("better-auth").AuthContext): {
14
+ options: {
15
+ databaseHooks: {
16
+ user: {
17
+ create: {
18
+ before(user: {
19
+ id: string;
20
+ createdAt: Date;
21
+ updatedAt: Date;
22
+ email: string;
23
+ emailVerified: boolean;
24
+ name: string;
25
+ image?: string | null | undefined;
26
+ } & Record<string, unknown>, context: import("better-auth").GenericEndpointContext | null): Promise<{
27
+ data: {
28
+ displayUsername?: string | undefined;
29
+ username?: string | undefined;
30
+ id: string;
31
+ createdAt: Date;
32
+ updatedAt: Date;
33
+ email: string;
34
+ emailVerified: boolean;
35
+ name: string;
36
+ image?: string | null | undefined;
37
+ };
38
+ }>;
39
+ };
40
+ update: {
41
+ before(user: Partial<{
42
+ id: string;
43
+ createdAt: Date;
44
+ updatedAt: Date;
45
+ email: string;
46
+ emailVerified: boolean;
47
+ name: string;
48
+ image?: string | null | undefined;
49
+ }> & Record<string, unknown>, context: import("better-auth").GenericEndpointContext | null): Promise<{
50
+ data: {
51
+ displayUsername?: string | undefined;
52
+ username?: string | undefined;
53
+ id?: string | undefined;
54
+ createdAt?: Date | undefined;
55
+ updatedAt?: Date | undefined;
56
+ email?: string | undefined;
57
+ emailVerified?: boolean | undefined;
58
+ name?: string | undefined;
59
+ image?: string | null | undefined;
60
+ };
61
+ }>;
62
+ };
63
+ };
64
+ };
65
+ };
66
+ };
67
+ endpoints: {
68
+ signInUsername: import("better-auth").StrictEndpoint<"/sign-in/username", {
69
+ method: "POST";
70
+ body: import("zod").ZodObject<{
71
+ username: import("zod").ZodString;
72
+ password: import("zod").ZodString;
73
+ rememberMe: import("zod").ZodOptional<import("zod").ZodBoolean>;
74
+ callbackURL: import("zod").ZodOptional<import("zod").ZodString>;
75
+ }, import("better-auth").$strip>;
76
+ metadata: {
77
+ openapi: {
78
+ summary: string;
79
+ description: string;
80
+ responses: {
81
+ 200: {
82
+ description: string;
83
+ content: {
84
+ "application/json": {
85
+ schema: {
86
+ type: "object";
87
+ properties: {
88
+ token: {
89
+ type: string;
90
+ description: string;
91
+ };
92
+ user: {
93
+ $ref: string;
94
+ };
95
+ };
96
+ required: string[];
97
+ };
98
+ };
99
+ };
100
+ };
101
+ 422: {
102
+ description: string;
103
+ content: {
104
+ "application/json": {
105
+ schema: {
106
+ type: "object";
107
+ properties: {
108
+ message: {
109
+ type: string;
110
+ };
111
+ };
112
+ };
113
+ };
114
+ };
115
+ };
116
+ };
117
+ };
118
+ };
119
+ }, {
120
+ token: string;
121
+ user: {
122
+ id: string;
123
+ createdAt: Date;
124
+ updatedAt: Date;
125
+ email: string;
126
+ emailVerified: boolean;
127
+ name: string;
128
+ image?: string | null | undefined;
129
+ } & {
130
+ username: string;
131
+ displayUsername: string;
132
+ };
133
+ } | null>;
134
+ isUsernameAvailable: import("better-auth").StrictEndpoint<"/is-username-available", {
135
+ method: "POST";
136
+ body: import("zod").ZodObject<{
137
+ username: import("zod").ZodString;
138
+ }, import("better-auth").$strip>;
139
+ }, {
140
+ available: boolean;
141
+ }>;
142
+ };
143
+ schema: {
144
+ user: {
145
+ fields: {
146
+ username: {
147
+ type: "string";
148
+ required: false;
149
+ sortable: true;
150
+ unique: true;
151
+ returned: true;
152
+ transform: {
153
+ input(value: import("better-auth").DBPrimitive): string | number | boolean | Date | unknown[] | Record<string, unknown> | null | undefined;
154
+ };
155
+ };
156
+ displayUsername: {
157
+ type: "string";
158
+ required: false;
159
+ transform: {
160
+ input(value: import("better-auth").DBPrimitive): string | number | boolean | Date | unknown[] | Record<string, unknown> | null | undefined;
161
+ };
162
+ };
163
+ };
164
+ };
165
+ };
166
+ hooks: {
167
+ before: {
168
+ matcher(context: import("better-auth").HookEndpointContext): boolean;
169
+ handler: (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<void>;
170
+ }[];
171
+ };
172
+ options: import("better-auth/plugins").UsernameOptions | undefined;
173
+ $ERROR_CODES: {
174
+ readonly INVALID_USERNAME_OR_PASSWORD: "Invalid username or password";
175
+ readonly EMAIL_NOT_VERIFIED: "Email not verified";
176
+ readonly UNEXPECTED_ERROR: "Unexpected error";
177
+ readonly USERNAME_IS_ALREADY_TAKEN: "Username is already taken. Please try another.";
178
+ readonly USERNAME_TOO_SHORT: "Username is too short";
179
+ readonly USERNAME_TOO_LONG: "Username is too long";
180
+ readonly INVALID_USERNAME: "Username is invalid";
181
+ readonly INVALID_DISPLAY_USERNAME: "Display username is invalid";
182
+ };
183
+ } | {
184
+ id: "admin";
185
+ init(): {
186
+ options: {
187
+ databaseHooks: {
188
+ user: {
189
+ create: {
190
+ before(user: {
191
+ id: string;
192
+ createdAt: Date;
193
+ updatedAt: Date;
194
+ email: string;
195
+ emailVerified: boolean;
196
+ name: string;
197
+ image?: string | null | undefined;
198
+ } & Record<string, unknown>): Promise<{
199
+ data: {
200
+ id: string;
201
+ createdAt: Date;
202
+ updatedAt: Date;
203
+ email: string;
204
+ emailVerified: boolean;
205
+ name: string;
206
+ image?: string | null | undefined;
207
+ role: string;
208
+ };
209
+ }>;
210
+ };
211
+ };
212
+ session: {
213
+ create: {
214
+ before(session: {
215
+ id: string;
216
+ createdAt: Date;
217
+ updatedAt: Date;
218
+ userId: string;
219
+ expiresAt: Date;
220
+ token: string;
221
+ ipAddress?: string | null | undefined;
222
+ userAgent?: string | null | undefined;
223
+ } & Record<string, unknown>, ctx: import("better-auth").GenericEndpointContext | null): Promise<void>;
224
+ };
225
+ };
226
+ };
227
+ };
228
+ };
229
+ hooks: {
230
+ after: {
231
+ matcher(context: import("better-auth").HookEndpointContext): boolean;
232
+ handler: (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<import("better-auth/plugins").SessionWithImpersonatedBy[] | undefined>;
233
+ }[];
234
+ };
235
+ endpoints: {
236
+ setRole: import("better-auth").StrictEndpoint<"/admin/set-role", {
237
+ method: "POST";
238
+ body: import("zod").ZodObject<{
239
+ userId: import("zod").ZodCoercedString<unknown>;
240
+ role: import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString>]>;
241
+ }, import("better-auth").$strip>;
242
+ requireHeaders: true;
243
+ use: ((inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
244
+ session: {
245
+ user: import("better-auth/plugins").UserWithRole;
246
+ session: import("better-auth").Session;
247
+ };
248
+ }>)[];
249
+ metadata: {
250
+ openapi: {
251
+ operationId: string;
252
+ summary: string;
253
+ description: string;
254
+ responses: {
255
+ 200: {
256
+ description: string;
257
+ content: {
258
+ "application/json": {
259
+ schema: {
260
+ type: "object";
261
+ properties: {
262
+ user: {
263
+ $ref: string;
264
+ };
265
+ };
266
+ };
267
+ };
268
+ };
269
+ };
270
+ };
271
+ };
272
+ $Infer: {
273
+ body: {
274
+ userId: string;
275
+ role: "user" | "admin" | ("user" | "admin")[];
276
+ };
277
+ };
278
+ };
279
+ }, {
280
+ user: import("better-auth/plugins").UserWithRole;
281
+ }>;
282
+ getUser: import("better-auth").StrictEndpoint<"/admin/get-user", {
283
+ method: "GET";
284
+ query: import("zod").ZodObject<{
285
+ id: import("zod").ZodString;
286
+ }, import("better-auth").$strip>;
287
+ use: ((inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
288
+ session: {
289
+ user: import("better-auth/plugins").UserWithRole;
290
+ session: import("better-auth").Session;
291
+ };
292
+ }>)[];
293
+ metadata: {
294
+ openapi: {
295
+ operationId: string;
296
+ summary: string;
297
+ description: string;
298
+ responses: {
299
+ 200: {
300
+ description: string;
301
+ content: {
302
+ "application/json": {
303
+ schema: {
304
+ type: "object";
305
+ properties: {
306
+ user: {
307
+ $ref: string;
308
+ };
309
+ };
310
+ };
311
+ };
312
+ };
313
+ };
314
+ };
315
+ };
316
+ };
317
+ }, import("better-auth/plugins").UserWithRole>;
318
+ createUser: import("better-auth").StrictEndpoint<"/admin/create-user", {
319
+ method: "POST";
320
+ body: import("zod").ZodObject<{
321
+ email: import("zod").ZodString;
322
+ password: import("zod").ZodOptional<import("zod").ZodString>;
323
+ name: import("zod").ZodString;
324
+ role: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString>]>>;
325
+ data: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodAny>>;
326
+ }, import("better-auth").$strip>;
327
+ metadata: {
328
+ openapi: {
329
+ operationId: string;
330
+ summary: string;
331
+ description: string;
332
+ responses: {
333
+ 200: {
334
+ description: string;
335
+ content: {
336
+ "application/json": {
337
+ schema: {
338
+ type: "object";
339
+ properties: {
340
+ user: {
341
+ $ref: string;
342
+ };
343
+ };
344
+ };
345
+ };
346
+ };
347
+ };
348
+ };
349
+ };
350
+ $Infer: {
351
+ body: {
352
+ email: string;
353
+ password?: string | undefined;
354
+ name: string;
355
+ role?: "user" | "admin" | ("user" | "admin")[] | undefined;
356
+ data?: Record<string, any> | undefined;
357
+ };
358
+ };
359
+ };
360
+ }, {
361
+ user: import("better-auth/plugins").UserWithRole;
362
+ }>;
363
+ adminUpdateUser: import("better-auth").StrictEndpoint<"/admin/update-user", {
364
+ method: "POST";
365
+ body: import("zod").ZodObject<{
366
+ userId: import("zod").ZodCoercedString<unknown>;
367
+ data: import("zod").ZodRecord<import("zod").ZodAny, import("zod").ZodAny>;
368
+ }, import("better-auth").$strip>;
369
+ use: ((inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
370
+ session: {
371
+ user: import("better-auth/plugins").UserWithRole;
372
+ session: import("better-auth").Session;
373
+ };
374
+ }>)[];
375
+ metadata: {
376
+ openapi: {
377
+ operationId: string;
378
+ summary: string;
379
+ description: string;
380
+ responses: {
381
+ 200: {
382
+ description: string;
383
+ content: {
384
+ "application/json": {
385
+ schema: {
386
+ type: "object";
387
+ properties: {
388
+ user: {
389
+ $ref: string;
390
+ };
391
+ };
392
+ };
393
+ };
394
+ };
395
+ };
396
+ };
397
+ };
398
+ };
399
+ }, import("better-auth/plugins").UserWithRole>;
400
+ listUsers: import("better-auth").StrictEndpoint<"/admin/list-users", {
401
+ method: "GET";
402
+ use: ((inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
403
+ session: {
404
+ user: import("better-auth/plugins").UserWithRole;
405
+ session: import("better-auth").Session;
406
+ };
407
+ }>)[];
408
+ query: import("zod").ZodObject<{
409
+ searchValue: import("zod").ZodOptional<import("zod").ZodString>;
410
+ searchField: import("zod").ZodOptional<import("zod").ZodEnum<{
411
+ name: "name";
412
+ email: "email";
413
+ }>>;
414
+ searchOperator: import("zod").ZodOptional<import("zod").ZodEnum<{
415
+ contains: "contains";
416
+ starts_with: "starts_with";
417
+ ends_with: "ends_with";
418
+ }>>;
419
+ limit: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodNumber]>>;
420
+ offset: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodNumber]>>;
421
+ sortBy: import("zod").ZodOptional<import("zod").ZodString>;
422
+ sortDirection: import("zod").ZodOptional<import("zod").ZodEnum<{
423
+ asc: "asc";
424
+ desc: "desc";
425
+ }>>;
426
+ filterField: import("zod").ZodOptional<import("zod").ZodString>;
427
+ filterValue: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodNumber]>, import("zod").ZodBoolean]>>;
428
+ filterOperator: import("zod").ZodOptional<import("zod").ZodEnum<{
429
+ eq: "eq";
430
+ ne: "ne";
431
+ lt: "lt";
432
+ lte: "lte";
433
+ gt: "gt";
434
+ gte: "gte";
435
+ contains: "contains";
436
+ }>>;
437
+ }, import("better-auth").$strip>;
438
+ metadata: {
439
+ openapi: {
440
+ operationId: string;
441
+ summary: string;
442
+ description: string;
443
+ responses: {
444
+ 200: {
445
+ description: string;
446
+ content: {
447
+ "application/json": {
448
+ schema: {
449
+ type: "object";
450
+ properties: {
451
+ users: {
452
+ type: string;
453
+ items: {
454
+ $ref: string;
455
+ };
456
+ };
457
+ total: {
458
+ type: string;
459
+ };
460
+ limit: {
461
+ type: string;
462
+ };
463
+ offset: {
464
+ type: string;
465
+ };
466
+ };
467
+ required: string[];
468
+ };
469
+ };
470
+ };
471
+ };
472
+ };
473
+ };
474
+ };
475
+ }, {
476
+ users: import("better-auth/plugins").UserWithRole[];
477
+ total: number;
478
+ limit: number | undefined;
479
+ offset: number | undefined;
480
+ } | {
481
+ users: never[];
482
+ total: number;
483
+ }>;
484
+ listUserSessions: import("better-auth").StrictEndpoint<"/admin/list-user-sessions", {
485
+ method: "POST";
486
+ use: ((inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
487
+ session: {
488
+ user: import("better-auth/plugins").UserWithRole;
489
+ session: import("better-auth").Session;
490
+ };
491
+ }>)[];
492
+ body: import("zod").ZodObject<{
493
+ userId: import("zod").ZodCoercedString<unknown>;
494
+ }, import("better-auth").$strip>;
495
+ metadata: {
496
+ openapi: {
497
+ operationId: string;
498
+ summary: string;
499
+ description: string;
500
+ responses: {
501
+ 200: {
502
+ description: string;
503
+ content: {
504
+ "application/json": {
505
+ schema: {
506
+ type: "object";
507
+ properties: {
508
+ sessions: {
509
+ type: string;
510
+ items: {
511
+ $ref: string;
512
+ };
513
+ };
514
+ };
515
+ };
516
+ };
517
+ };
518
+ };
519
+ };
520
+ };
521
+ };
522
+ }, {
523
+ sessions: import("better-auth/plugins").SessionWithImpersonatedBy[];
524
+ }>;
525
+ unbanUser: import("better-auth").StrictEndpoint<"/admin/unban-user", {
526
+ method: "POST";
527
+ body: import("zod").ZodObject<{
528
+ userId: import("zod").ZodCoercedString<unknown>;
529
+ }, import("better-auth").$strip>;
530
+ use: ((inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
531
+ session: {
532
+ user: import("better-auth/plugins").UserWithRole;
533
+ session: import("better-auth").Session;
534
+ };
535
+ }>)[];
536
+ metadata: {
537
+ openapi: {
538
+ operationId: string;
539
+ summary: string;
540
+ description: string;
541
+ responses: {
542
+ 200: {
543
+ description: string;
544
+ content: {
545
+ "application/json": {
546
+ schema: {
547
+ type: "object";
548
+ properties: {
549
+ user: {
550
+ $ref: string;
551
+ };
552
+ };
553
+ };
554
+ };
555
+ };
556
+ };
557
+ };
558
+ };
559
+ };
560
+ }, {
561
+ user: import("better-auth/plugins").UserWithRole;
562
+ }>;
563
+ banUser: import("better-auth").StrictEndpoint<"/admin/ban-user", {
564
+ method: "POST";
565
+ body: import("zod").ZodObject<{
566
+ userId: import("zod").ZodCoercedString<unknown>;
567
+ banReason: import("zod").ZodOptional<import("zod").ZodString>;
568
+ banExpiresIn: import("zod").ZodOptional<import("zod").ZodNumber>;
569
+ }, import("better-auth").$strip>;
570
+ use: ((inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
571
+ session: {
572
+ user: import("better-auth/plugins").UserWithRole;
573
+ session: import("better-auth").Session;
574
+ };
575
+ }>)[];
576
+ metadata: {
577
+ openapi: {
578
+ operationId: string;
579
+ summary: string;
580
+ description: string;
581
+ responses: {
582
+ 200: {
583
+ description: string;
584
+ content: {
585
+ "application/json": {
586
+ schema: {
587
+ type: "object";
588
+ properties: {
589
+ user: {
590
+ $ref: string;
591
+ };
592
+ };
593
+ };
594
+ };
595
+ };
596
+ };
597
+ };
598
+ };
599
+ };
600
+ }, {
601
+ user: import("better-auth/plugins").UserWithRole;
602
+ }>;
603
+ impersonateUser: import("better-auth").StrictEndpoint<"/admin/impersonate-user", {
604
+ method: "POST";
605
+ body: import("zod").ZodObject<{
606
+ userId: import("zod").ZodCoercedString<unknown>;
607
+ }, import("better-auth").$strip>;
608
+ use: ((inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
609
+ session: {
610
+ user: import("better-auth/plugins").UserWithRole;
611
+ session: import("better-auth").Session;
612
+ };
613
+ }>)[];
614
+ metadata: {
615
+ openapi: {
616
+ operationId: string;
617
+ summary: string;
618
+ description: string;
619
+ responses: {
620
+ 200: {
621
+ description: string;
622
+ content: {
623
+ "application/json": {
624
+ schema: {
625
+ type: "object";
626
+ properties: {
627
+ session: {
628
+ $ref: string;
629
+ };
630
+ user: {
631
+ $ref: string;
632
+ };
633
+ };
634
+ };
635
+ };
636
+ };
637
+ };
638
+ };
639
+ };
640
+ };
641
+ }, {
642
+ session: {
643
+ id: string;
644
+ createdAt: Date;
645
+ updatedAt: Date;
646
+ userId: string;
647
+ expiresAt: Date;
648
+ token: string;
649
+ ipAddress?: string | null | undefined;
650
+ userAgent?: string | null | undefined;
651
+ };
652
+ user: import("better-auth/plugins").UserWithRole;
653
+ }>;
654
+ stopImpersonating: import("better-auth").StrictEndpoint<"/admin/stop-impersonating", {
655
+ method: "POST";
656
+ requireHeaders: true;
657
+ }, {
658
+ session: {
659
+ id: string;
660
+ createdAt: Date;
661
+ updatedAt: Date;
662
+ userId: string;
663
+ expiresAt: Date;
664
+ token: string;
665
+ ipAddress?: string | null | undefined;
666
+ userAgent?: string | null | undefined;
667
+ } & Record<string, any>;
668
+ user: {
669
+ id: string;
670
+ createdAt: Date;
671
+ updatedAt: Date;
672
+ email: string;
673
+ emailVerified: boolean;
674
+ name: string;
675
+ image?: string | null | undefined;
676
+ } & Record<string, any>;
677
+ }>;
678
+ revokeUserSession: import("better-auth").StrictEndpoint<"/admin/revoke-user-session", {
679
+ method: "POST";
680
+ body: import("zod").ZodObject<{
681
+ sessionToken: import("zod").ZodString;
682
+ }, import("better-auth").$strip>;
683
+ use: ((inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
684
+ session: {
685
+ user: import("better-auth/plugins").UserWithRole;
686
+ session: import("better-auth").Session;
687
+ };
688
+ }>)[];
689
+ metadata: {
690
+ openapi: {
691
+ operationId: string;
692
+ summary: string;
693
+ description: string;
694
+ responses: {
695
+ 200: {
696
+ description: string;
697
+ content: {
698
+ "application/json": {
699
+ schema: {
700
+ type: "object";
701
+ properties: {
702
+ success: {
703
+ type: string;
704
+ };
705
+ };
706
+ };
707
+ };
708
+ };
709
+ };
710
+ };
711
+ };
712
+ };
713
+ }, {
714
+ success: boolean;
715
+ }>;
716
+ revokeUserSessions: import("better-auth").StrictEndpoint<"/admin/revoke-user-sessions", {
717
+ method: "POST";
718
+ body: import("zod").ZodObject<{
719
+ userId: import("zod").ZodCoercedString<unknown>;
720
+ }, import("better-auth").$strip>;
721
+ use: ((inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
722
+ session: {
723
+ user: import("better-auth/plugins").UserWithRole;
724
+ session: import("better-auth").Session;
725
+ };
726
+ }>)[];
727
+ metadata: {
728
+ openapi: {
729
+ operationId: string;
730
+ summary: string;
731
+ description: string;
732
+ responses: {
733
+ 200: {
734
+ description: string;
735
+ content: {
736
+ "application/json": {
737
+ schema: {
738
+ type: "object";
739
+ properties: {
740
+ success: {
741
+ type: string;
742
+ };
743
+ };
744
+ };
745
+ };
746
+ };
747
+ };
748
+ };
749
+ };
750
+ };
751
+ }, {
752
+ success: boolean;
753
+ }>;
754
+ removeUser: import("better-auth").StrictEndpoint<"/admin/remove-user", {
755
+ method: "POST";
756
+ body: import("zod").ZodObject<{
757
+ userId: import("zod").ZodCoercedString<unknown>;
758
+ }, import("better-auth").$strip>;
759
+ use: ((inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
760
+ session: {
761
+ user: import("better-auth/plugins").UserWithRole;
762
+ session: import("better-auth").Session;
763
+ };
764
+ }>)[];
765
+ metadata: {
766
+ openapi: {
767
+ operationId: string;
768
+ summary: string;
769
+ description: string;
770
+ responses: {
771
+ 200: {
772
+ description: string;
773
+ content: {
774
+ "application/json": {
775
+ schema: {
776
+ type: "object";
777
+ properties: {
778
+ success: {
779
+ type: string;
780
+ };
781
+ };
782
+ };
783
+ };
784
+ };
785
+ };
786
+ };
787
+ };
788
+ };
789
+ }, {
790
+ success: boolean;
791
+ }>;
792
+ setUserPassword: import("better-auth").StrictEndpoint<"/admin/set-user-password", {
793
+ method: "POST";
794
+ body: import("zod").ZodObject<{
795
+ newPassword: import("zod").ZodString;
796
+ userId: import("zod").ZodCoercedString<unknown>;
797
+ }, import("better-auth").$strip>;
798
+ use: ((inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
799
+ session: {
800
+ user: import("better-auth/plugins").UserWithRole;
801
+ session: import("better-auth").Session;
802
+ };
803
+ }>)[];
804
+ metadata: {
805
+ openapi: {
806
+ operationId: string;
807
+ summary: string;
808
+ description: string;
809
+ responses: {
810
+ 200: {
811
+ description: string;
812
+ content: {
813
+ "application/json": {
814
+ schema: {
815
+ type: "object";
816
+ properties: {
817
+ status: {
818
+ type: string;
819
+ };
820
+ };
821
+ };
822
+ };
823
+ };
824
+ };
825
+ };
826
+ };
827
+ };
828
+ }, {
829
+ status: boolean;
830
+ }>;
831
+ userHasPermission: import("better-auth").StrictEndpoint<"/admin/has-permission", {
832
+ method: "POST";
833
+ body: import("zod").ZodIntersection<import("zod").ZodObject<{
834
+ userId: import("zod").ZodOptional<import("zod").ZodCoercedString<unknown>>;
835
+ role: import("zod").ZodOptional<import("zod").ZodString>;
836
+ }, import("better-auth").$strip>, import("zod").ZodUnion<readonly [import("zod").ZodObject<{
837
+ permission: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString>>;
838
+ permissions: import("zod").ZodUndefined;
839
+ }, import("better-auth").$strip>, import("zod").ZodObject<{
840
+ permission: import("zod").ZodUndefined;
841
+ permissions: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString>>;
842
+ }, import("better-auth").$strip>]>>;
843
+ metadata: {
844
+ openapi: {
845
+ description: string;
846
+ requestBody: {
847
+ content: {
848
+ "application/json": {
849
+ schema: {
850
+ type: "object";
851
+ properties: {
852
+ permission: {
853
+ type: string;
854
+ description: string;
855
+ deprecated: boolean;
856
+ };
857
+ permissions: {
858
+ type: string;
859
+ description: string;
860
+ };
861
+ };
862
+ required: string[];
863
+ };
864
+ };
865
+ };
866
+ };
867
+ responses: {
868
+ "200": {
869
+ description: string;
870
+ content: {
871
+ "application/json": {
872
+ schema: {
873
+ type: "object";
874
+ properties: {
875
+ error: {
876
+ type: string;
877
+ };
878
+ success: {
879
+ type: string;
880
+ };
881
+ };
882
+ required: string[];
883
+ };
884
+ };
885
+ };
886
+ };
887
+ };
888
+ };
889
+ $Infer: {
890
+ body: ({
891
+ permission: {
892
+ readonly user?: ("list" | "create" | "update" | "set-role" | "ban" | "impersonate" | "delete" | "set-password" | "get")[] | undefined;
893
+ readonly session?: ("list" | "delete" | "revoke")[] | undefined;
894
+ };
895
+ permissions?: never | undefined;
896
+ } | {
897
+ permissions: {
898
+ readonly user?: ("list" | "create" | "update" | "set-role" | "ban" | "impersonate" | "delete" | "set-password" | "get")[] | undefined;
899
+ readonly session?: ("list" | "delete" | "revoke")[] | undefined;
900
+ };
901
+ permission?: never | undefined;
902
+ }) & {
903
+ userId?: string | undefined;
904
+ role?: "user" | "admin" | undefined;
905
+ };
906
+ };
907
+ };
908
+ }, {
909
+ error: null;
910
+ success: boolean;
911
+ }>;
912
+ };
913
+ $ERROR_CODES: {
914
+ readonly FAILED_TO_CREATE_USER: "Failed to create user";
915
+ readonly USER_ALREADY_EXISTS: "User already exists.";
916
+ readonly USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL: "User already exists. Use another email.";
917
+ readonly YOU_CANNOT_BAN_YOURSELF: "You cannot ban yourself";
918
+ readonly YOU_ARE_NOT_ALLOWED_TO_CHANGE_USERS_ROLE: "You are not allowed to change users role";
919
+ readonly YOU_ARE_NOT_ALLOWED_TO_CREATE_USERS: "You are not allowed to create users";
920
+ readonly YOU_ARE_NOT_ALLOWED_TO_LIST_USERS: "You are not allowed to list users";
921
+ readonly YOU_ARE_NOT_ALLOWED_TO_LIST_USERS_SESSIONS: "You are not allowed to list users sessions";
922
+ readonly YOU_ARE_NOT_ALLOWED_TO_BAN_USERS: "You are not allowed to ban users";
923
+ readonly YOU_ARE_NOT_ALLOWED_TO_IMPERSONATE_USERS: "You are not allowed to impersonate users";
924
+ readonly YOU_ARE_NOT_ALLOWED_TO_REVOKE_USERS_SESSIONS: "You are not allowed to revoke users sessions";
925
+ readonly YOU_ARE_NOT_ALLOWED_TO_DELETE_USERS: "You are not allowed to delete users";
926
+ readonly YOU_ARE_NOT_ALLOWED_TO_SET_USERS_PASSWORD: "You are not allowed to set users password";
927
+ readonly BANNED_USER: "You have been banned from this application";
928
+ readonly YOU_ARE_NOT_ALLOWED_TO_GET_USER: "You are not allowed to get user";
929
+ readonly NO_DATA_TO_UPDATE: "No data to update";
930
+ readonly YOU_ARE_NOT_ALLOWED_TO_UPDATE_USERS: "You are not allowed to update users";
931
+ readonly YOU_CANNOT_REMOVE_YOURSELF: "You cannot remove yourself";
932
+ readonly YOU_ARE_NOT_ALLOWED_TO_SET_NON_EXISTENT_VALUE: "You are not allowed to set a non-existent role value";
933
+ readonly YOU_CANNOT_IMPERSONATE_ADMINS: "You cannot impersonate admins";
934
+ readonly INVALID_ROLE_TYPE: "Invalid role type";
935
+ };
936
+ schema: {
937
+ user: {
938
+ fields: {
939
+ role: {
940
+ type: "string";
941
+ required: false;
942
+ input: false;
943
+ };
944
+ banned: {
945
+ type: "boolean";
946
+ defaultValue: false;
947
+ required: false;
948
+ input: false;
949
+ };
950
+ banReason: {
951
+ type: "string";
952
+ required: false;
953
+ input: false;
954
+ };
955
+ banExpires: {
956
+ type: "date";
957
+ required: false;
958
+ input: false;
959
+ };
960
+ };
961
+ };
962
+ session: {
963
+ fields: {
964
+ impersonatedBy: {
965
+ type: "string";
966
+ required: false;
967
+ };
968
+ };
969
+ };
970
+ };
971
+ options: NoInfer<{
972
+ bannedUserMessage: string;
973
+ }>;
974
+ } | {
975
+ id: "jwt";
976
+ options: NoInfer<{
977
+ jwks: {
978
+ keyPairConfig: {
979
+ alg: "EdDSA";
980
+ crv: "Ed25519";
981
+ };
982
+ };
983
+ jwt: {
984
+ issuer: string;
985
+ audience: string;
986
+ expirationTime: string;
987
+ definePayload: ({ user, session }: {
988
+ user: import("better-auth").User & Record<string, any>;
989
+ session: import("better-auth").Session & Record<string, any>;
990
+ }) => {
991
+ id: string;
992
+ ns: string;
993
+ db: string;
994
+ ac: string;
995
+ email: string;
996
+ name: string;
997
+ role: string;
998
+ sessionId: string;
999
+ };
1000
+ };
1001
+ }>;
1002
+ endpoints: {
1003
+ getJwks: import("better-auth").StrictEndpoint<string, {
1004
+ method: "GET";
1005
+ metadata: {
1006
+ openapi: {
1007
+ operationId: string;
1008
+ description: string;
1009
+ responses: {
1010
+ "200": {
1011
+ description: string;
1012
+ content: {
1013
+ "application/json": {
1014
+ schema: {
1015
+ type: "object";
1016
+ properties: {
1017
+ keys: {
1018
+ type: string;
1019
+ description: string;
1020
+ items: {
1021
+ type: string;
1022
+ properties: {
1023
+ kid: {
1024
+ type: string;
1025
+ description: string;
1026
+ };
1027
+ kty: {
1028
+ type: string;
1029
+ description: string;
1030
+ };
1031
+ alg: {
1032
+ type: string;
1033
+ description: string;
1034
+ };
1035
+ use: {
1036
+ type: string;
1037
+ description: string;
1038
+ enum: string[];
1039
+ nullable: boolean;
1040
+ };
1041
+ n: {
1042
+ type: string;
1043
+ description: string;
1044
+ nullable: boolean;
1045
+ };
1046
+ e: {
1047
+ type: string;
1048
+ description: string;
1049
+ nullable: boolean;
1050
+ };
1051
+ crv: {
1052
+ type: string;
1053
+ description: string;
1054
+ nullable: boolean;
1055
+ };
1056
+ x: {
1057
+ type: string;
1058
+ description: string;
1059
+ nullable: boolean;
1060
+ };
1061
+ y: {
1062
+ type: string;
1063
+ description: string;
1064
+ nullable: boolean;
1065
+ };
1066
+ };
1067
+ required: string[];
1068
+ };
1069
+ };
1070
+ };
1071
+ required: string[];
1072
+ };
1073
+ };
1074
+ };
1075
+ };
1076
+ };
1077
+ };
1078
+ };
1079
+ }, import("better-auth").JSONWebKeySet>;
1080
+ getToken: import("better-auth").StrictEndpoint<"/token", {
1081
+ method: "GET";
1082
+ requireHeaders: true;
1083
+ use: ((inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
1084
+ session: {
1085
+ session: Record<string, any> & {
1086
+ id: string;
1087
+ createdAt: Date;
1088
+ updatedAt: Date;
1089
+ userId: string;
1090
+ expiresAt: Date;
1091
+ token: string;
1092
+ ipAddress?: string | null | undefined;
1093
+ userAgent?: string | null | undefined;
1094
+ };
1095
+ user: Record<string, any> & {
1096
+ id: string;
1097
+ createdAt: Date;
1098
+ updatedAt: Date;
1099
+ email: string;
1100
+ emailVerified: boolean;
1101
+ name: string;
1102
+ image?: string | null | undefined;
1103
+ };
1104
+ };
1105
+ }>)[];
1106
+ metadata: {
1107
+ openapi: {
1108
+ operationId: string;
1109
+ description: string;
1110
+ responses: {
1111
+ 200: {
1112
+ description: string;
1113
+ content: {
1114
+ "application/json": {
1115
+ schema: {
1116
+ type: "object";
1117
+ properties: {
1118
+ token: {
1119
+ type: string;
1120
+ };
1121
+ };
1122
+ };
1123
+ };
1124
+ };
1125
+ };
1126
+ };
1127
+ };
1128
+ };
1129
+ }, {
1130
+ token: string;
1131
+ }>;
1132
+ signJWT: import("better-auth").StrictEndpoint<string, {
1133
+ method: "POST";
1134
+ metadata: {
1135
+ $Infer: {
1136
+ body: {
1137
+ payload: import("better-auth").JWTPayload;
1138
+ overrideOptions?: import("better-auth/plugins").JwtOptions | undefined;
1139
+ };
1140
+ };
1141
+ };
1142
+ body: import("zod").ZodObject<{
1143
+ payload: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodAny>;
1144
+ overrideOptions: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodAny>>;
1145
+ }, import("better-auth").$strip>;
1146
+ }, {
1147
+ token: string;
1148
+ }>;
1149
+ verifyJWT: import("better-auth").StrictEndpoint<string, {
1150
+ method: "POST";
1151
+ metadata: {
1152
+ $Infer: {
1153
+ body: {
1154
+ token: string;
1155
+ issuer?: string;
1156
+ };
1157
+ response: {
1158
+ payload: {
1159
+ sub: string;
1160
+ aud: string;
1161
+ [key: string]: any;
1162
+ } | null;
1163
+ };
1164
+ };
1165
+ };
1166
+ body: import("zod").ZodObject<{
1167
+ token: import("zod").ZodString;
1168
+ issuer: import("zod").ZodOptional<import("zod").ZodString>;
1169
+ }, import("better-auth").$strip>;
1170
+ }, {
1171
+ payload: (import("better-auth").JWTPayload & Required<Pick<import("better-auth").JWTPayload, "sub" | "aud">>) | null;
1172
+ }>;
1173
+ };
1174
+ hooks: {
1175
+ after: {
1176
+ matcher(context: import("better-auth").HookEndpointContext): boolean;
1177
+ handler: (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<void>;
1178
+ }[];
1179
+ };
1180
+ schema: {
1181
+ jwks: {
1182
+ fields: {
1183
+ publicKey: {
1184
+ type: "string";
1185
+ required: true;
1186
+ };
1187
+ privateKey: {
1188
+ type: "string";
1189
+ required: true;
1190
+ };
1191
+ createdAt: {
1192
+ type: "date";
1193
+ required: true;
1194
+ };
1195
+ expiresAt: {
1196
+ type: "date";
1197
+ required: false;
1198
+ };
1199
+ };
1200
+ };
1201
+ };
1202
+ } | {
1203
+ id: "tanstack-start-cookies";
1204
+ hooks: {
1205
+ after: {
1206
+ matcher(ctx: import("better-auth").HookEndpointContext): true;
1207
+ handler: (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<void>;
1208
+ }[];
1209
+ };
1210
+ })[];
1211
+ };