vestrycms 0.0.0-stage → 0.1.0

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 (118) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +348 -2
  3. package/dist/config/fields.d.ts +30 -0
  4. package/dist/config/fields.js +75 -0
  5. package/dist/config/index.d.ts +9 -0
  6. package/dist/config/index.js +18 -0
  7. package/dist/config/types.d.ts +403 -0
  8. package/dist/config/types.js +10 -0
  9. package/dist/core/api.d.ts +67 -0
  10. package/dist/core/api.js +538 -0
  11. package/dist/core/auth.d.ts +1561 -0
  12. package/dist/core/auth.js +234 -0
  13. package/dist/core/cache.d.ts +27 -0
  14. package/dist/core/cache.js +52 -0
  15. package/dist/core/entries.d.ts +19 -0
  16. package/dist/core/entries.js +127 -0
  17. package/dist/core/index-types.d.ts +20 -0
  18. package/dist/core/index-types.js +1 -0
  19. package/dist/core/index.d.ts +13 -0
  20. package/dist/core/index.js +13 -0
  21. package/dist/core/mail.d.ts +28 -0
  22. package/dist/core/mail.js +62 -0
  23. package/dist/core/paths.d.ts +35 -0
  24. package/dist/core/paths.js +148 -0
  25. package/dist/core/roles.d.ts +24 -0
  26. package/dist/core/roles.js +15 -0
  27. package/dist/core/service.d.ts +102 -0
  28. package/dist/core/service.js +478 -0
  29. package/dist/core/source.d.ts +82 -0
  30. package/dist/core/source.js +75 -0
  31. package/dist/core/sources/github-app.d.ts +26 -0
  32. package/dist/core/sources/github-app.js +161 -0
  33. package/dist/core/sources/github.d.ts +40 -0
  34. package/dist/core/sources/github.js +278 -0
  35. package/dist/core/sources/local.d.ts +16 -0
  36. package/dist/core/sources/local.js +98 -0
  37. package/dist/core/values.d.ts +22 -0
  38. package/dist/core/values.js +123 -0
  39. package/dist/env.d.ts +19 -0
  40. package/dist/index.d.ts +18 -0
  41. package/dist/index.js +167 -0
  42. package/dist/integration/build-index.d.ts +8 -0
  43. package/dist/integration/build-index.js +67 -0
  44. package/dist/integration/client-deps.d.ts +10 -0
  45. package/dist/integration/client-deps.js +43 -0
  46. package/dist/integration/dev-middleware.d.ts +6 -0
  47. package/dist/integration/dev-middleware.js +48 -0
  48. package/dist/integration/formatter.d.ts +7 -0
  49. package/dist/integration/formatter.js +56 -0
  50. package/dist/mdx/expressions.d.ts +14 -0
  51. package/dist/mdx/expressions.js +141 -0
  52. package/dist/mdx/index.d.ts +4 -0
  53. package/dist/mdx/index.js +4 -0
  54. package/dist/mdx/parse.d.ts +6 -0
  55. package/dist/mdx/parse.js +378 -0
  56. package/dist/mdx/serialize.d.ts +9 -0
  57. package/dist/mdx/serialize.js +396 -0
  58. package/dist/mdx/types.d.ts +40 -0
  59. package/dist/mdx/types.js +6 -0
  60. package/dist/pages/admin.astro +27 -0
  61. package/dist/pages/api.d.ts +3 -0
  62. package/dist/pages/api.js +31 -0
  63. package/dist/ui/App.d.ts +4 -0
  64. package/dist/ui/App.js +70 -0
  65. package/dist/ui/api.d.ts +83 -0
  66. package/dist/ui/api.js +97 -0
  67. package/dist/ui/auth-client.d.ts +27 -0
  68. package/dist/ui/auth-client.js +29 -0
  69. package/dist/ui/components/AssetPicker.d.ts +27 -0
  70. package/dist/ui/components/AssetPicker.js +97 -0
  71. package/dist/ui/components/Icon.d.ts +11 -0
  72. package/dist/ui/components/Icon.js +46 -0
  73. package/dist/ui/components/Layout.d.ts +15 -0
  74. package/dist/ui/components/Layout.js +87 -0
  75. package/dist/ui/components/editor/EditorContext.d.ts +15 -0
  76. package/dist/ui/components/editor/EditorContext.js +9 -0
  77. package/dist/ui/components/editor/NodeViews.d.ts +4 -0
  78. package/dist/ui/components/editor/NodeViews.js +127 -0
  79. package/dist/ui/components/editor/RichTextEditor.d.ts +24 -0
  80. package/dist/ui/components/editor/RichTextEditor.js +253 -0
  81. package/dist/ui/components/editor/extensions.d.ts +20 -0
  82. package/dist/ui/components/editor/extensions.js +156 -0
  83. package/dist/ui/components/fields/CodeInput.d.ts +10 -0
  84. package/dist/ui/components/fields/CodeInput.js +8 -0
  85. package/dist/ui/components/fields/CodeMirrorInput.d.ts +2 -0
  86. package/dist/ui/components/fields/CodeMirrorInput.js +44 -0
  87. package/dist/ui/components/fields/FieldRenderer.d.ts +41 -0
  88. package/dist/ui/components/fields/FieldRenderer.js +299 -0
  89. package/dist/ui/components/fields/ImageTools.d.ts +31 -0
  90. package/dist/ui/components/fields/ImageTools.js +296 -0
  91. package/dist/ui/components/fields/MarkdownField.d.ts +7 -0
  92. package/dist/ui/components/fields/MarkdownField.js +16 -0
  93. package/dist/ui/components/fields/TreeInput.d.ts +13 -0
  94. package/dist/ui/components/fields/TreeInput.js +221 -0
  95. package/dist/ui/components/ui.d.ts +63 -0
  96. package/dist/ui/components/ui.js +113 -0
  97. package/dist/ui/context.d.ts +17 -0
  98. package/dist/ui/context.js +13 -0
  99. package/dist/ui/lib/format.d.ts +5 -0
  100. package/dist/ui/lib/format.js +11 -0
  101. package/dist/ui/lib/utils.d.ts +24 -0
  102. package/dist/ui/lib/utils.js +255 -0
  103. package/dist/ui/main.d.ts +1 -0
  104. package/dist/ui/main.js +11 -0
  105. package/dist/ui/pages/Assets.d.ts +1 -0
  106. package/dist/ui/pages/Assets.js +69 -0
  107. package/dist/ui/pages/CollectionList.d.ts +6 -0
  108. package/dist/ui/pages/CollectionList.js +115 -0
  109. package/dist/ui/pages/Dashboard.d.ts +1 -0
  110. package/dist/ui/pages/Dashboard.js +57 -0
  111. package/dist/ui/pages/EntryEditor.d.ts +3 -0
  112. package/dist/ui/pages/EntryEditor.js +313 -0
  113. package/dist/ui/pages/Login.d.ts +6 -0
  114. package/dist/ui/pages/Login.js +88 -0
  115. package/dist/ui/pages/Users.d.ts +1 -0
  116. package/dist/ui/pages/Users.js +102 -0
  117. package/dist/ui/styles.css +2536 -0
  118. package/package.json +121 -3
@@ -0,0 +1,1561 @@
1
+ /**
2
+ * Sign-in and users, on Better Auth. Editors sign in with a one-time code
3
+ * emailed to them (the email OTP plugin); admins manage users through the
4
+ * admin plugin. Vestry adds: config-listed bootstrap admins, invitations,
5
+ * and a `lastLoginAt` field.
6
+ *
7
+ * Storage is whatever Better Auth accepts: a Cloudflare D1 binding in
8
+ * production, a `node:sqlite` database in development, the memory adapter
9
+ * in tests. Tables are created on first use with Better Auth's migrator.
10
+ */
11
+ import { type BetterAuthOptions } from "better-auth";
12
+ import type { Mailer } from "./mail.js";
13
+ import { type PublicUser } from "./roles.js";
14
+ export type AuthDatabase = NonNullable<BetterAuthOptions["database"]>;
15
+ export interface VestryAuthOptions {
16
+ database: AuthDatabase;
17
+ mailer: Mailer;
18
+ /** Signs cookies and hashes codes. Required outside development. */
19
+ secret: string;
20
+ /** Origin the panel is served from, e.g. `https://example.org`. */
21
+ baseURL: string;
22
+ /** Path Better Auth's routes are mounted at, e.g. `/admin/api/auth`. */
23
+ basePath: string;
24
+ /** Cookie path, so the session cookie only travels with control-panel requests. */
25
+ cookiePath?: string;
26
+ /** Name of the site, used in emails. */
27
+ siteName: string;
28
+ /** Absolute URL of the control panel, used in invitation emails. */
29
+ adminUrl: string;
30
+ /** Addresses that are always admins (from the config). */
31
+ admins?: string[];
32
+ /** Development: no rate limiting, cookies without `Secure`. */
33
+ dev?: boolean;
34
+ /** Create or update the tables on first use (Kysely-backed databases only). */
35
+ migrate?: boolean;
36
+ }
37
+ export declare const SESSION_TTL_SECONDS: number;
38
+ export declare const CODE_TTL_SECONDS: number;
39
+ export declare function normalizeEmail(email: string): string;
40
+ /** Display name fallback: the part before the `@`, title-cased a little. */
41
+ export declare function nameFromEmail(email: string): string;
42
+ export declare function createVestryAuth(opts: VestryAuthOptions): {
43
+ auth: import("better-auth").Auth<{
44
+ appName: string;
45
+ secret: string;
46
+ baseURL: string;
47
+ basePath: string;
48
+ database: any;
49
+ session: {
50
+ expiresIn: number;
51
+ updateAge: number;
52
+ };
53
+ rateLimit: {
54
+ enabled: boolean;
55
+ storage: "database";
56
+ };
57
+ advanced: {
58
+ cookiePrefix: string;
59
+ useSecureCookies: boolean;
60
+ defaultCookieAttributes: {
61
+ path: string;
62
+ };
63
+ ipAddress: {
64
+ ipAddressHeaders: string[];
65
+ };
66
+ };
67
+ user: {
68
+ additionalFields: {
69
+ lastLoginAt: {
70
+ type: "date";
71
+ required: false;
72
+ input: false;
73
+ };
74
+ };
75
+ };
76
+ databaseHooks: {
77
+ session: {
78
+ create: {
79
+ after: (session: {
80
+ id: string;
81
+ createdAt: Date;
82
+ updatedAt: Date;
83
+ userId: string;
84
+ expiresAt: Date;
85
+ token: string;
86
+ ipAddress?: string | null | undefined;
87
+ userAgent?: string | null | undefined;
88
+ } & Record<string, unknown>, ctx: import("better-auth").GenericEndpointContext | null) => Promise<void>;
89
+ };
90
+ };
91
+ };
92
+ hooks: {
93
+ before: import("better-auth").Middleware<import("better-auth").MiddlewareOptions, (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<void>>;
94
+ };
95
+ plugins: [{
96
+ id: "email-otp";
97
+ version: string;
98
+ init(ctx: import("better-auth").AuthContext): {
99
+ options: {
100
+ emailVerification: {
101
+ sendVerificationEmail(data: {
102
+ user: import("better-auth").User;
103
+ url: string;
104
+ token: string;
105
+ }, request: Request | undefined): Promise<void>;
106
+ };
107
+ };
108
+ } | undefined;
109
+ endpoints: {
110
+ sendVerificationOTP: import("better-auth").StrictEndpoint<"/email-otp/send-verification-otp", {
111
+ method: "POST";
112
+ use: import("better-auth").Middleware<import("better-auth").MiddlewareOptions, (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<void>>[];
113
+ body: import("zod").ZodObject<{
114
+ email: import("zod").ZodString;
115
+ type: import("zod").ZodEnum<{
116
+ "sign-in": "sign-in";
117
+ "change-email": "change-email";
118
+ "email-verification": "email-verification";
119
+ "forget-password": "forget-password";
120
+ }>;
121
+ }, import("zod/v4/core").$strip>;
122
+ metadata: {
123
+ openapi: {
124
+ operationId: string;
125
+ description: string;
126
+ responses: {
127
+ 200: {
128
+ description: string;
129
+ content: {
130
+ "application/json": {
131
+ schema: {
132
+ type: "object";
133
+ properties: {
134
+ success: {
135
+ type: string;
136
+ };
137
+ };
138
+ };
139
+ };
140
+ };
141
+ };
142
+ };
143
+ };
144
+ };
145
+ }, {
146
+ success: boolean;
147
+ }>;
148
+ createVerificationOTP: import("better-auth").StrictEndpoint<string, {
149
+ method: "POST";
150
+ body: import("zod").ZodObject<{
151
+ email: import("zod").ZodString;
152
+ type: import("zod").ZodEnum<{
153
+ "sign-in": "sign-in";
154
+ "change-email": "change-email";
155
+ "email-verification": "email-verification";
156
+ "forget-password": "forget-password";
157
+ }>;
158
+ }, import("zod/v4/core").$strip>;
159
+ metadata: {
160
+ openapi: {
161
+ operationId: string;
162
+ description: string;
163
+ responses: {
164
+ 200: {
165
+ description: string;
166
+ content: {
167
+ "application/json": {
168
+ schema: {
169
+ type: "string";
170
+ };
171
+ };
172
+ };
173
+ };
174
+ };
175
+ };
176
+ };
177
+ }, string>;
178
+ getVerificationOTP: import("better-auth").StrictEndpoint<string, {
179
+ method: "GET";
180
+ query: import("zod").ZodObject<{
181
+ email: import("zod").ZodString;
182
+ type: import("zod").ZodEnum<{
183
+ "sign-in": "sign-in";
184
+ "change-email": "change-email";
185
+ "email-verification": "email-verification";
186
+ "forget-password": "forget-password";
187
+ }>;
188
+ }, import("zod/v4/core").$strip>;
189
+ metadata: {
190
+ openapi: {
191
+ operationId: string;
192
+ description: string;
193
+ responses: {
194
+ "200": {
195
+ description: string;
196
+ content: {
197
+ "application/json": {
198
+ schema: {
199
+ type: "object";
200
+ properties: {
201
+ otp: {
202
+ type: string;
203
+ nullable: boolean;
204
+ description: string;
205
+ };
206
+ };
207
+ required: string[];
208
+ };
209
+ };
210
+ };
211
+ };
212
+ };
213
+ };
214
+ };
215
+ }, {
216
+ otp: null;
217
+ } | {
218
+ otp: string;
219
+ }>;
220
+ checkVerificationOTP: import("better-auth").StrictEndpoint<"/email-otp/check-verification-otp", {
221
+ method: "POST";
222
+ body: import("zod").ZodObject<{
223
+ email: import("zod").ZodString;
224
+ type: import("zod").ZodEnum<{
225
+ "sign-in": "sign-in";
226
+ "change-email": "change-email";
227
+ "email-verification": "email-verification";
228
+ "forget-password": "forget-password";
229
+ }>;
230
+ otp: import("zod").ZodString;
231
+ }, import("zod/v4/core").$strip>;
232
+ metadata: {
233
+ openapi: {
234
+ operationId: string;
235
+ description: string;
236
+ responses: {
237
+ 200: {
238
+ description: string;
239
+ content: {
240
+ "application/json": {
241
+ schema: {
242
+ type: "object";
243
+ properties: {
244
+ success: {
245
+ type: string;
246
+ };
247
+ };
248
+ };
249
+ };
250
+ };
251
+ };
252
+ };
253
+ };
254
+ };
255
+ }, {
256
+ success: boolean;
257
+ }>;
258
+ verifyEmailOTP: import("better-auth").StrictEndpoint<"/email-otp/verify-email", {
259
+ method: "POST";
260
+ body: import("zod").ZodObject<{
261
+ email: import("zod").ZodString;
262
+ otp: import("zod").ZodString;
263
+ }, import("zod/v4/core").$strip>;
264
+ metadata: {
265
+ openapi: {
266
+ description: string;
267
+ responses: {
268
+ 200: {
269
+ description: string;
270
+ content: {
271
+ "application/json": {
272
+ schema: {
273
+ type: "object";
274
+ properties: {
275
+ status: {
276
+ type: string;
277
+ description: string;
278
+ enum: boolean[];
279
+ };
280
+ token: {
281
+ type: string;
282
+ nullable: boolean;
283
+ description: string;
284
+ };
285
+ user: {
286
+ $ref: string;
287
+ };
288
+ };
289
+ required: string[];
290
+ };
291
+ };
292
+ };
293
+ };
294
+ };
295
+ };
296
+ };
297
+ }, {
298
+ status: boolean;
299
+ token: string;
300
+ user: {
301
+ id: string;
302
+ createdAt: Date;
303
+ updatedAt: Date;
304
+ email: string;
305
+ emailVerified: boolean;
306
+ name: string;
307
+ image?: string | null | undefined;
308
+ } & Record<string, any>;
309
+ } | {
310
+ status: boolean;
311
+ token: null;
312
+ user: {
313
+ id: string;
314
+ createdAt: Date;
315
+ updatedAt: Date;
316
+ email: string;
317
+ emailVerified: boolean;
318
+ name: string;
319
+ image?: string | null | undefined;
320
+ } & Record<string, any>;
321
+ }>;
322
+ signInEmailOTP: import("better-auth").StrictEndpoint<"/sign-in/email-otp", {
323
+ method: "POST";
324
+ body: import("zod").ZodIntersection<import("zod").ZodObject<{
325
+ email: import("zod").ZodString;
326
+ otp: import("zod").ZodString;
327
+ name: import("zod").ZodOptional<import("zod").ZodString>;
328
+ image: import("zod").ZodOptional<import("zod").ZodString>;
329
+ }, import("zod/v4/core").$strip>, import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodAny>>;
330
+ metadata: {
331
+ openapi: {
332
+ operationId: string;
333
+ description: string;
334
+ responses: {
335
+ 200: {
336
+ description: string;
337
+ content: {
338
+ "application/json": {
339
+ schema: {
340
+ type: "object";
341
+ properties: {
342
+ token: {
343
+ type: string;
344
+ description: string;
345
+ };
346
+ user: {
347
+ $ref: string;
348
+ };
349
+ };
350
+ required: string[];
351
+ };
352
+ };
353
+ };
354
+ };
355
+ };
356
+ };
357
+ };
358
+ }, {
359
+ token: string;
360
+ user: {
361
+ id: string;
362
+ createdAt: Date;
363
+ updatedAt: Date;
364
+ email: string;
365
+ emailVerified: boolean;
366
+ name: string;
367
+ image?: string | null | undefined;
368
+ };
369
+ }>;
370
+ requestPasswordResetEmailOTP: import("better-auth").StrictEndpoint<"/email-otp/request-password-reset", {
371
+ method: "POST";
372
+ body: import("zod").ZodObject<{
373
+ email: import("zod").ZodString;
374
+ }, import("zod/v4/core").$strip>;
375
+ metadata: {
376
+ openapi: {
377
+ operationId: string;
378
+ description: string;
379
+ responses: {
380
+ 200: {
381
+ description: string;
382
+ content: {
383
+ "application/json": {
384
+ schema: {
385
+ type: "object";
386
+ properties: {
387
+ success: {
388
+ type: string;
389
+ description: string;
390
+ };
391
+ };
392
+ };
393
+ };
394
+ };
395
+ };
396
+ };
397
+ };
398
+ };
399
+ }, {
400
+ success: boolean;
401
+ }>;
402
+ forgetPasswordEmailOTP: import("better-auth").StrictEndpoint<"/forget-password/email-otp", {
403
+ method: "POST";
404
+ body: import("zod").ZodObject<{
405
+ email: import("zod").ZodString;
406
+ }, import("zod/v4/core").$strip>;
407
+ metadata: {
408
+ openapi: {
409
+ operationId: string;
410
+ description: string;
411
+ responses: {
412
+ 200: {
413
+ description: string;
414
+ content: {
415
+ "application/json": {
416
+ schema: {
417
+ type: "object";
418
+ properties: {
419
+ success: {
420
+ type: string;
421
+ description: string;
422
+ };
423
+ };
424
+ };
425
+ };
426
+ };
427
+ };
428
+ };
429
+ };
430
+ };
431
+ }, {
432
+ success: boolean;
433
+ }>;
434
+ resetPasswordEmailOTP: import("better-auth").StrictEndpoint<"/email-otp/reset-password", {
435
+ method: "POST";
436
+ body: import("zod").ZodObject<{
437
+ email: import("zod").ZodString;
438
+ otp: import("zod").ZodString;
439
+ password: import("zod").ZodString;
440
+ }, import("zod/v4/core").$strip>;
441
+ metadata: {
442
+ openapi: {
443
+ operationId: string;
444
+ description: string;
445
+ responses: {
446
+ 200: {
447
+ description: string;
448
+ content: {
449
+ "application/json": {
450
+ schema: {
451
+ type: "object";
452
+ properties: {
453
+ success: {
454
+ type: string;
455
+ };
456
+ };
457
+ };
458
+ };
459
+ };
460
+ };
461
+ };
462
+ };
463
+ };
464
+ }, {
465
+ success: boolean;
466
+ }>;
467
+ requestEmailChangeEmailOTP: import("better-auth").StrictEndpoint<"/email-otp/request-email-change", {
468
+ method: "POST";
469
+ body: import("zod").ZodObject<{
470
+ newEmail: import("zod").ZodString;
471
+ otp: import("zod").ZodOptional<import("zod").ZodString>;
472
+ }, import("zod/v4/core").$strip>;
473
+ use: import("better-auth").Middleware<import("better-auth").MiddlewareOptions, (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
474
+ session: {
475
+ session: Record<string, any> & {
476
+ id: string;
477
+ createdAt: Date;
478
+ updatedAt: Date;
479
+ userId: string;
480
+ expiresAt: Date;
481
+ token: string;
482
+ ipAddress?: string | null | undefined;
483
+ userAgent?: string | null | undefined;
484
+ };
485
+ user: Record<string, any> & {
486
+ id: string;
487
+ createdAt: Date;
488
+ updatedAt: Date;
489
+ email: string;
490
+ emailVerified: boolean;
491
+ name: string;
492
+ image?: string | null | undefined;
493
+ };
494
+ };
495
+ }>>[];
496
+ metadata: {
497
+ openapi: {
498
+ operationId: string;
499
+ description: string;
500
+ responses: {
501
+ 200: {
502
+ description: string;
503
+ content: {
504
+ "application/json": {
505
+ schema: {
506
+ type: "object";
507
+ properties: {
508
+ success: {
509
+ type: string;
510
+ };
511
+ };
512
+ };
513
+ };
514
+ };
515
+ };
516
+ };
517
+ };
518
+ };
519
+ }, {
520
+ success: boolean;
521
+ }>;
522
+ changeEmailEmailOTP: import("better-auth").StrictEndpoint<"/email-otp/change-email", {
523
+ method: "POST";
524
+ body: import("zod").ZodObject<{
525
+ newEmail: import("zod").ZodString;
526
+ otp: import("zod").ZodString;
527
+ }, import("zod/v4/core").$strip>;
528
+ use: import("better-auth").Middleware<import("better-auth").MiddlewareOptions, (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
529
+ session: {
530
+ session: Record<string, any> & {
531
+ id: string;
532
+ createdAt: Date;
533
+ updatedAt: Date;
534
+ userId: string;
535
+ expiresAt: Date;
536
+ token: string;
537
+ ipAddress?: string | null | undefined;
538
+ userAgent?: string | null | undefined;
539
+ };
540
+ user: Record<string, any> & {
541
+ id: string;
542
+ createdAt: Date;
543
+ updatedAt: Date;
544
+ email: string;
545
+ emailVerified: boolean;
546
+ name: string;
547
+ image?: string | null | undefined;
548
+ };
549
+ };
550
+ }>>[];
551
+ metadata: {
552
+ openapi: {
553
+ operationId: string;
554
+ description: string;
555
+ responses: {
556
+ 200: {
557
+ description: string;
558
+ content: {
559
+ "application/json": {
560
+ schema: {
561
+ type: "object";
562
+ properties: {
563
+ success: {
564
+ type: string;
565
+ };
566
+ };
567
+ };
568
+ };
569
+ };
570
+ };
571
+ };
572
+ };
573
+ };
574
+ }, {
575
+ success: boolean;
576
+ }>;
577
+ };
578
+ hooks: {
579
+ after: {
580
+ matcher(context: import("better-auth").HookEndpointContext): boolean;
581
+ handler: import("better-auth").Middleware<import("better-auth").MiddlewareOptions, (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<void>>;
582
+ }[];
583
+ };
584
+ rateLimit: ({
585
+ pathMatcher(path: string): path is "/email-otp/send-verification-otp";
586
+ window: number;
587
+ max: number;
588
+ } | {
589
+ pathMatcher(path: string): path is "/email-otp/check-verification-otp";
590
+ window: number;
591
+ max: number;
592
+ } | {
593
+ pathMatcher(path: string): path is "/email-otp/verify-email";
594
+ window: number;
595
+ max: number;
596
+ } | {
597
+ pathMatcher(path: string): path is "/sign-in/email-otp";
598
+ window: number;
599
+ max: number;
600
+ } | {
601
+ pathMatcher(path: string): path is "/email-otp/request-password-reset";
602
+ window: number;
603
+ max: number;
604
+ } | {
605
+ pathMatcher(path: string): path is "/email-otp/reset-password";
606
+ window: number;
607
+ max: number;
608
+ } | {
609
+ pathMatcher(path: string): path is "/forget-password/email-otp";
610
+ window: number;
611
+ max: number;
612
+ } | {
613
+ pathMatcher(path: string): path is "/email-otp/request-email-change";
614
+ window: number;
615
+ max: number;
616
+ } | {
617
+ pathMatcher(path: string): path is "/email-otp/change-email";
618
+ window: number;
619
+ max: number;
620
+ })[];
621
+ options: import("better-auth/plugins").EmailOTPOptions;
622
+ $ERROR_CODES: {
623
+ OTP_EXPIRED: import("better-auth").RawError<"OTP_EXPIRED">;
624
+ INVALID_OTP: import("better-auth").RawError<"INVALID_OTP">;
625
+ TOO_MANY_ATTEMPTS: import("better-auth").RawError<"TOO_MANY_ATTEMPTS">;
626
+ };
627
+ }, {
628
+ id: "admin";
629
+ version: string;
630
+ init(authContext: import("better-auth").AuthContext): {
631
+ options: {
632
+ databaseHooks: {
633
+ user: {
634
+ create: {
635
+ before(user: {
636
+ id: string;
637
+ createdAt: Date;
638
+ updatedAt: Date;
639
+ email: string;
640
+ emailVerified: boolean;
641
+ name: string;
642
+ image?: string | null | undefined;
643
+ } & Record<string, unknown>): Promise<{
644
+ data: {
645
+ id: string;
646
+ createdAt: Date;
647
+ updatedAt: Date;
648
+ email: string;
649
+ emailVerified: boolean;
650
+ name: string;
651
+ image?: string | null | undefined;
652
+ role: string;
653
+ };
654
+ }>;
655
+ };
656
+ };
657
+ session: {
658
+ create: {
659
+ before(session: {
660
+ id: string;
661
+ createdAt: Date;
662
+ updatedAt: Date;
663
+ userId: string;
664
+ expiresAt: Date;
665
+ token: string;
666
+ ipAddress?: string | null | undefined;
667
+ userAgent?: string | null | undefined;
668
+ } & Record<string, unknown>, ctx: import("better-auth").GenericEndpointContext | null): Promise<void>;
669
+ };
670
+ };
671
+ };
672
+ };
673
+ };
674
+ hooks: {
675
+ after: {
676
+ matcher(context: import("better-auth").HookEndpointContext): boolean;
677
+ handler: import("better-auth").Middleware<import("better-auth").MiddlewareOptions, (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<import("better-auth/plugins").SessionWithImpersonatedBy[] | undefined>>;
678
+ }[];
679
+ };
680
+ endpoints: {
681
+ setRole: import("better-auth").StrictEndpoint<"/admin/set-role", {
682
+ method: "POST";
683
+ body: import("zod").ZodObject<{
684
+ userId: import("zod").ZodCoercedString<unknown>;
685
+ role: import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString>]>;
686
+ }, import("zod/v4/core").$strip>;
687
+ requireHeaders: true;
688
+ use: import("better-auth").Middleware<import("better-auth").MiddlewareOptions, (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
689
+ session: {
690
+ user: import("better-auth/plugins").UserWithRole;
691
+ session: {
692
+ id: string;
693
+ createdAt: Date;
694
+ updatedAt: Date;
695
+ userId: string;
696
+ expiresAt: Date;
697
+ token: string;
698
+ ipAddress?: string | null | undefined;
699
+ userAgent?: string | null | undefined;
700
+ };
701
+ };
702
+ }>>[];
703
+ metadata: {
704
+ openapi: {
705
+ operationId: string;
706
+ summary: string;
707
+ description: string;
708
+ responses: {
709
+ 200: {
710
+ description: string;
711
+ content: {
712
+ "application/json": {
713
+ schema: {
714
+ type: "object";
715
+ properties: {
716
+ user: {
717
+ $ref: string;
718
+ };
719
+ };
720
+ };
721
+ };
722
+ };
723
+ };
724
+ };
725
+ };
726
+ $Infer: {
727
+ body: {
728
+ userId: string;
729
+ role: "admin" | "editor" | ("admin" | "editor")[];
730
+ };
731
+ };
732
+ };
733
+ }, {
734
+ user: import("better-auth/plugins").UserWithRole;
735
+ }>;
736
+ getUser: import("better-auth").StrictEndpoint<"/admin/get-user", {
737
+ method: "GET";
738
+ query: import("zod").ZodObject<{
739
+ id: import("zod").ZodString;
740
+ }, import("zod/v4/core").$strip>;
741
+ use: import("better-auth").Middleware<import("better-auth").MiddlewareOptions, (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
742
+ session: {
743
+ user: import("better-auth/plugins").UserWithRole;
744
+ session: {
745
+ id: string;
746
+ createdAt: Date;
747
+ updatedAt: Date;
748
+ userId: string;
749
+ expiresAt: Date;
750
+ token: string;
751
+ ipAddress?: string | null | undefined;
752
+ userAgent?: string | null | undefined;
753
+ };
754
+ };
755
+ }>>[];
756
+ metadata: {
757
+ openapi: {
758
+ operationId: string;
759
+ summary: string;
760
+ description: string;
761
+ responses: {
762
+ 200: {
763
+ description: string;
764
+ content: {
765
+ "application/json": {
766
+ schema: {
767
+ type: "object";
768
+ properties: {
769
+ user: {
770
+ $ref: string;
771
+ };
772
+ };
773
+ };
774
+ };
775
+ };
776
+ };
777
+ };
778
+ };
779
+ };
780
+ }, import("better-auth/plugins").UserWithRole>;
781
+ createUser: import("better-auth").StrictEndpoint<"/admin/create-user", {
782
+ method: "POST";
783
+ body: import("zod").ZodObject<{
784
+ email: import("zod").ZodString;
785
+ password: import("zod").ZodOptional<import("zod").ZodString>;
786
+ name: import("zod").ZodString;
787
+ role: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString>]>>;
788
+ data: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodAny>>;
789
+ }, import("zod/v4/core").$strip>;
790
+ metadata: {
791
+ openapi: {
792
+ operationId: string;
793
+ summary: string;
794
+ description: string;
795
+ responses: {
796
+ 200: {
797
+ description: string;
798
+ content: {
799
+ "application/json": {
800
+ schema: {
801
+ type: "object";
802
+ properties: {
803
+ user: {
804
+ $ref: string;
805
+ };
806
+ };
807
+ };
808
+ };
809
+ };
810
+ };
811
+ };
812
+ };
813
+ $Infer: {
814
+ body: {
815
+ email: string;
816
+ password?: string | undefined;
817
+ name: string;
818
+ role?: "admin" | "editor" | ("admin" | "editor")[] | undefined;
819
+ data?: Record<string, any> | undefined;
820
+ };
821
+ };
822
+ };
823
+ }, {
824
+ user: import("better-auth/plugins").UserWithRole;
825
+ }>;
826
+ adminUpdateUser: import("better-auth").StrictEndpoint<"/admin/update-user", {
827
+ method: "POST";
828
+ body: import("zod").ZodObject<{
829
+ userId: import("zod").ZodCoercedString<unknown>;
830
+ data: import("zod").ZodRecord<import("zod").ZodAny, import("zod").ZodAny>;
831
+ }, import("zod/v4/core").$strip>;
832
+ use: import("better-auth").Middleware<import("better-auth").MiddlewareOptions, (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
833
+ session: {
834
+ user: import("better-auth/plugins").UserWithRole;
835
+ session: {
836
+ id: string;
837
+ createdAt: Date;
838
+ updatedAt: Date;
839
+ userId: string;
840
+ expiresAt: Date;
841
+ token: string;
842
+ ipAddress?: string | null | undefined;
843
+ userAgent?: string | null | undefined;
844
+ };
845
+ };
846
+ }>>[];
847
+ metadata: {
848
+ openapi: {
849
+ operationId: string;
850
+ summary: string;
851
+ description: string;
852
+ responses: {
853
+ 200: {
854
+ description: string;
855
+ content: {
856
+ "application/json": {
857
+ schema: {
858
+ type: "object";
859
+ properties: {
860
+ user: {
861
+ $ref: string;
862
+ };
863
+ };
864
+ };
865
+ };
866
+ };
867
+ };
868
+ };
869
+ };
870
+ };
871
+ }, import("better-auth/plugins").UserWithRole>;
872
+ listUsers: import("better-auth").StrictEndpoint<"/admin/list-users", {
873
+ method: "GET";
874
+ use: import("better-auth").Middleware<import("better-auth").MiddlewareOptions, (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
875
+ session: {
876
+ user: import("better-auth/plugins").UserWithRole;
877
+ session: {
878
+ id: string;
879
+ createdAt: Date;
880
+ updatedAt: Date;
881
+ userId: string;
882
+ expiresAt: Date;
883
+ token: string;
884
+ ipAddress?: string | null | undefined;
885
+ userAgent?: string | null | undefined;
886
+ };
887
+ };
888
+ }>>[];
889
+ query: import("zod").ZodObject<{
890
+ searchValue: import("zod").ZodOptional<import("zod").ZodString>;
891
+ searchField: import("zod").ZodOptional<import("zod").ZodEnum<{
892
+ email: "email";
893
+ name: "name";
894
+ }>>;
895
+ searchOperator: import("zod").ZodOptional<import("zod").ZodEnum<{
896
+ contains: "contains";
897
+ starts_with: "starts_with";
898
+ ends_with: "ends_with";
899
+ }>>;
900
+ limit: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodNumber]>>;
901
+ offset: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodNumber]>>;
902
+ sortBy: import("zod").ZodOptional<import("zod").ZodString>;
903
+ sortDirection: import("zod").ZodOptional<import("zod").ZodEnum<{
904
+ asc: "asc";
905
+ desc: "desc";
906
+ }>>;
907
+ filterField: import("zod").ZodOptional<import("zod").ZodString>;
908
+ filterValue: import("zod").ZodOptional<import("zod").ZodUnion<[import("zod").ZodUnion<[import("zod").ZodUnion<[import("zod").ZodUnion<[import("zod").ZodString, import("zod").ZodNumber]>, import("zod").ZodBoolean]>, import("zod").ZodArray<import("zod").ZodString>]>, import("zod").ZodArray<import("zod").ZodNumber>]>>;
909
+ filterOperator: import("zod").ZodOptional<import("zod").ZodEnum<{
910
+ in: "in";
911
+ lte: "lte";
912
+ eq: "eq";
913
+ ne: "ne";
914
+ lt: "lt";
915
+ gt: "gt";
916
+ gte: "gte";
917
+ not_in: "not_in";
918
+ contains: "contains";
919
+ starts_with: "starts_with";
920
+ ends_with: "ends_with";
921
+ }>>;
922
+ }, import("zod/v4/core").$strip>;
923
+ metadata: {
924
+ openapi: {
925
+ operationId: string;
926
+ summary: string;
927
+ description: string;
928
+ responses: {
929
+ 200: {
930
+ description: string;
931
+ content: {
932
+ "application/json": {
933
+ schema: {
934
+ type: "object";
935
+ properties: {
936
+ users: {
937
+ type: string;
938
+ items: {
939
+ $ref: string;
940
+ };
941
+ };
942
+ total: {
943
+ type: string;
944
+ };
945
+ limit: {
946
+ type: string;
947
+ };
948
+ offset: {
949
+ type: string;
950
+ };
951
+ };
952
+ required: string[];
953
+ };
954
+ };
955
+ };
956
+ };
957
+ };
958
+ };
959
+ };
960
+ }, {
961
+ users: import("better-auth/plugins").UserWithRole[];
962
+ total: number;
963
+ }>;
964
+ listUserSessions: import("better-auth").StrictEndpoint<"/admin/list-user-sessions", {
965
+ method: "POST";
966
+ use: import("better-auth").Middleware<import("better-auth").MiddlewareOptions, (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
967
+ session: {
968
+ user: import("better-auth/plugins").UserWithRole;
969
+ session: {
970
+ id: string;
971
+ createdAt: Date;
972
+ updatedAt: Date;
973
+ userId: string;
974
+ expiresAt: Date;
975
+ token: string;
976
+ ipAddress?: string | null | undefined;
977
+ userAgent?: string | null | undefined;
978
+ };
979
+ };
980
+ }>>[];
981
+ body: import("zod").ZodObject<{
982
+ userId: import("zod").ZodCoercedString<unknown>;
983
+ }, import("zod/v4/core").$strip>;
984
+ metadata: {
985
+ openapi: {
986
+ operationId: string;
987
+ summary: string;
988
+ description: string;
989
+ responses: {
990
+ 200: {
991
+ description: string;
992
+ content: {
993
+ "application/json": {
994
+ schema: {
995
+ type: "object";
996
+ properties: {
997
+ sessions: {
998
+ type: string;
999
+ items: {
1000
+ $ref: string;
1001
+ };
1002
+ };
1003
+ };
1004
+ };
1005
+ };
1006
+ };
1007
+ };
1008
+ };
1009
+ };
1010
+ };
1011
+ }, {
1012
+ sessions: import("better-auth/plugins").SessionWithImpersonatedBy[];
1013
+ }>;
1014
+ unbanUser: import("better-auth").StrictEndpoint<"/admin/unban-user", {
1015
+ method: "POST";
1016
+ body: import("zod").ZodObject<{
1017
+ userId: import("zod").ZodCoercedString<unknown>;
1018
+ }, import("zod/v4/core").$strip>;
1019
+ use: import("better-auth").Middleware<import("better-auth").MiddlewareOptions, (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
1020
+ session: {
1021
+ user: import("better-auth/plugins").UserWithRole;
1022
+ session: {
1023
+ id: string;
1024
+ createdAt: Date;
1025
+ updatedAt: Date;
1026
+ userId: string;
1027
+ expiresAt: Date;
1028
+ token: string;
1029
+ ipAddress?: string | null | undefined;
1030
+ userAgent?: string | null | undefined;
1031
+ };
1032
+ };
1033
+ }>>[];
1034
+ metadata: {
1035
+ openapi: {
1036
+ operationId: string;
1037
+ summary: string;
1038
+ description: string;
1039
+ responses: {
1040
+ 200: {
1041
+ description: string;
1042
+ content: {
1043
+ "application/json": {
1044
+ schema: {
1045
+ type: "object";
1046
+ properties: {
1047
+ user: {
1048
+ $ref: string;
1049
+ };
1050
+ };
1051
+ };
1052
+ };
1053
+ };
1054
+ };
1055
+ };
1056
+ };
1057
+ };
1058
+ }, {
1059
+ user: import("better-auth/plugins").UserWithRole;
1060
+ }>;
1061
+ banUser: import("better-auth").StrictEndpoint<"/admin/ban-user", {
1062
+ method: "POST";
1063
+ body: import("zod").ZodObject<{
1064
+ userId: import("zod").ZodCoercedString<unknown>;
1065
+ banReason: import("zod").ZodOptional<import("zod").ZodString>;
1066
+ banExpiresIn: import("zod").ZodOptional<import("zod").ZodNumber>;
1067
+ }, import("zod/v4/core").$strip>;
1068
+ use: import("better-auth").Middleware<import("better-auth").MiddlewareOptions, (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
1069
+ session: {
1070
+ user: import("better-auth/plugins").UserWithRole;
1071
+ session: {
1072
+ id: string;
1073
+ createdAt: Date;
1074
+ updatedAt: Date;
1075
+ userId: string;
1076
+ expiresAt: Date;
1077
+ token: string;
1078
+ ipAddress?: string | null | undefined;
1079
+ userAgent?: string | null | undefined;
1080
+ };
1081
+ };
1082
+ }>>[];
1083
+ metadata: {
1084
+ openapi: {
1085
+ operationId: string;
1086
+ summary: string;
1087
+ description: string;
1088
+ responses: {
1089
+ 200: {
1090
+ description: string;
1091
+ content: {
1092
+ "application/json": {
1093
+ schema: {
1094
+ type: "object";
1095
+ properties: {
1096
+ user: {
1097
+ $ref: string;
1098
+ };
1099
+ };
1100
+ };
1101
+ };
1102
+ };
1103
+ };
1104
+ };
1105
+ };
1106
+ };
1107
+ }, {
1108
+ user: import("better-auth/plugins").UserWithRole;
1109
+ }>;
1110
+ impersonateUser: import("better-auth").StrictEndpoint<"/admin/impersonate-user", {
1111
+ method: "POST";
1112
+ body: import("zod").ZodObject<{
1113
+ userId: import("zod").ZodCoercedString<unknown>;
1114
+ }, import("zod/v4/core").$strip>;
1115
+ use: import("better-auth").Middleware<import("better-auth").MiddlewareOptions, (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
1116
+ session: {
1117
+ user: import("better-auth/plugins").UserWithRole;
1118
+ session: {
1119
+ id: string;
1120
+ createdAt: Date;
1121
+ updatedAt: Date;
1122
+ userId: string;
1123
+ expiresAt: Date;
1124
+ token: string;
1125
+ ipAddress?: string | null | undefined;
1126
+ userAgent?: string | null | undefined;
1127
+ };
1128
+ };
1129
+ }>>[];
1130
+ metadata: {
1131
+ openapi: {
1132
+ operationId: string;
1133
+ summary: string;
1134
+ description: string;
1135
+ responses: {
1136
+ 200: {
1137
+ description: string;
1138
+ content: {
1139
+ "application/json": {
1140
+ schema: {
1141
+ type: "object";
1142
+ properties: {
1143
+ session: {
1144
+ $ref: string;
1145
+ };
1146
+ user: {
1147
+ $ref: string;
1148
+ };
1149
+ };
1150
+ };
1151
+ };
1152
+ };
1153
+ };
1154
+ };
1155
+ };
1156
+ };
1157
+ }, {
1158
+ session: {
1159
+ id: string;
1160
+ createdAt: Date;
1161
+ updatedAt: Date;
1162
+ userId: string;
1163
+ expiresAt: Date;
1164
+ token: string;
1165
+ ipAddress?: string | null | undefined;
1166
+ userAgent?: string | null | undefined;
1167
+ };
1168
+ user: import("better-auth/plugins").UserWithRole;
1169
+ }>;
1170
+ stopImpersonating: import("better-auth").StrictEndpoint<"/admin/stop-impersonating", {
1171
+ method: "POST";
1172
+ requireHeaders: true;
1173
+ }, {
1174
+ session: {
1175
+ id: string;
1176
+ createdAt: Date;
1177
+ updatedAt: Date;
1178
+ userId: string;
1179
+ expiresAt: Date;
1180
+ token: string;
1181
+ ipAddress?: string | null | undefined;
1182
+ userAgent?: string | null | undefined;
1183
+ } & Record<string, any>;
1184
+ user: {
1185
+ id: string;
1186
+ createdAt: Date;
1187
+ updatedAt: Date;
1188
+ email: string;
1189
+ emailVerified: boolean;
1190
+ name: string;
1191
+ image?: string | null | undefined;
1192
+ } & Record<string, any>;
1193
+ }>;
1194
+ revokeUserSession: import("better-auth").StrictEndpoint<"/admin/revoke-user-session", {
1195
+ method: "POST";
1196
+ body: import("zod").ZodObject<{
1197
+ sessionToken: import("zod").ZodString;
1198
+ }, import("zod/v4/core").$strip>;
1199
+ use: import("better-auth").Middleware<import("better-auth").MiddlewareOptions, (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
1200
+ session: {
1201
+ user: import("better-auth/plugins").UserWithRole;
1202
+ session: {
1203
+ id: string;
1204
+ createdAt: Date;
1205
+ updatedAt: Date;
1206
+ userId: string;
1207
+ expiresAt: Date;
1208
+ token: string;
1209
+ ipAddress?: string | null | undefined;
1210
+ userAgent?: string | null | undefined;
1211
+ };
1212
+ };
1213
+ }>>[];
1214
+ metadata: {
1215
+ openapi: {
1216
+ operationId: string;
1217
+ summary: string;
1218
+ description: string;
1219
+ responses: {
1220
+ 200: {
1221
+ description: string;
1222
+ content: {
1223
+ "application/json": {
1224
+ schema: {
1225
+ type: "object";
1226
+ properties: {
1227
+ success: {
1228
+ type: string;
1229
+ };
1230
+ };
1231
+ };
1232
+ };
1233
+ };
1234
+ };
1235
+ };
1236
+ };
1237
+ };
1238
+ }, {
1239
+ success: boolean;
1240
+ }>;
1241
+ revokeUserSessions: import("better-auth").StrictEndpoint<"/admin/revoke-user-sessions", {
1242
+ method: "POST";
1243
+ body: import("zod").ZodObject<{
1244
+ userId: import("zod").ZodCoercedString<unknown>;
1245
+ }, import("zod/v4/core").$strip>;
1246
+ use: import("better-auth").Middleware<import("better-auth").MiddlewareOptions, (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
1247
+ session: {
1248
+ user: import("better-auth/plugins").UserWithRole;
1249
+ session: {
1250
+ id: string;
1251
+ createdAt: Date;
1252
+ updatedAt: Date;
1253
+ userId: string;
1254
+ expiresAt: Date;
1255
+ token: string;
1256
+ ipAddress?: string | null | undefined;
1257
+ userAgent?: string | null | undefined;
1258
+ };
1259
+ };
1260
+ }>>[];
1261
+ metadata: {
1262
+ openapi: {
1263
+ operationId: string;
1264
+ summary: string;
1265
+ description: string;
1266
+ responses: {
1267
+ 200: {
1268
+ description: string;
1269
+ content: {
1270
+ "application/json": {
1271
+ schema: {
1272
+ type: "object";
1273
+ properties: {
1274
+ success: {
1275
+ type: string;
1276
+ };
1277
+ };
1278
+ };
1279
+ };
1280
+ };
1281
+ };
1282
+ };
1283
+ };
1284
+ };
1285
+ }, {
1286
+ success: boolean;
1287
+ }>;
1288
+ removeUser: import("better-auth").StrictEndpoint<"/admin/remove-user", {
1289
+ method: "POST";
1290
+ body: import("zod").ZodObject<{
1291
+ userId: import("zod").ZodCoercedString<unknown>;
1292
+ }, import("zod/v4/core").$strip>;
1293
+ use: import("better-auth").Middleware<import("better-auth").MiddlewareOptions, (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
1294
+ session: {
1295
+ user: import("better-auth/plugins").UserWithRole;
1296
+ session: {
1297
+ id: string;
1298
+ createdAt: Date;
1299
+ updatedAt: Date;
1300
+ userId: string;
1301
+ expiresAt: Date;
1302
+ token: string;
1303
+ ipAddress?: string | null | undefined;
1304
+ userAgent?: string | null | undefined;
1305
+ };
1306
+ };
1307
+ }>>[];
1308
+ metadata: {
1309
+ openapi: {
1310
+ operationId: string;
1311
+ summary: string;
1312
+ description: string;
1313
+ responses: {
1314
+ 200: {
1315
+ description: string;
1316
+ content: {
1317
+ "application/json": {
1318
+ schema: {
1319
+ type: "object";
1320
+ properties: {
1321
+ success: {
1322
+ type: string;
1323
+ };
1324
+ };
1325
+ };
1326
+ };
1327
+ };
1328
+ };
1329
+ };
1330
+ };
1331
+ };
1332
+ }, {
1333
+ success: boolean;
1334
+ }>;
1335
+ setUserPassword: import("better-auth").StrictEndpoint<"/admin/set-user-password", {
1336
+ method: "POST";
1337
+ body: import("zod").ZodObject<{
1338
+ newPassword: import("zod").ZodString;
1339
+ userId: import("zod").ZodCoercedString<unknown>;
1340
+ }, import("zod/v4/core").$strip>;
1341
+ use: import("better-auth").Middleware<import("better-auth").MiddlewareOptions, (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
1342
+ session: {
1343
+ user: import("better-auth/plugins").UserWithRole;
1344
+ session: {
1345
+ id: string;
1346
+ createdAt: Date;
1347
+ updatedAt: Date;
1348
+ userId: string;
1349
+ expiresAt: Date;
1350
+ token: string;
1351
+ ipAddress?: string | null | undefined;
1352
+ userAgent?: string | null | undefined;
1353
+ };
1354
+ };
1355
+ }>>[];
1356
+ metadata: {
1357
+ openapi: {
1358
+ operationId: string;
1359
+ summary: string;
1360
+ description: string;
1361
+ responses: {
1362
+ 200: {
1363
+ description: string;
1364
+ content: {
1365
+ "application/json": {
1366
+ schema: {
1367
+ type: "object";
1368
+ properties: {
1369
+ status: {
1370
+ type: string;
1371
+ };
1372
+ };
1373
+ };
1374
+ };
1375
+ };
1376
+ };
1377
+ };
1378
+ };
1379
+ };
1380
+ }, {
1381
+ status: boolean;
1382
+ }>;
1383
+ userHasPermission: import("better-auth").StrictEndpoint<"/admin/has-permission", {
1384
+ method: "POST";
1385
+ body: import("zod").ZodIntersection<import("zod").ZodObject<{
1386
+ userId: import("zod").ZodOptional<import("zod").ZodCoercedString<unknown>>;
1387
+ role: import("zod").ZodOptional<import("zod").ZodString>;
1388
+ }, import("zod/v4/core").$strip>, import("zod").ZodXor<readonly [import("zod").ZodObject<{
1389
+ permission: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString>>;
1390
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
1391
+ permissions: import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodArray<import("zod").ZodString>>;
1392
+ }, import("zod/v4/core").$strip>]>>;
1393
+ metadata: {
1394
+ openapi: {
1395
+ description: string;
1396
+ requestBody: {
1397
+ content: {
1398
+ "application/json": {
1399
+ schema: {
1400
+ type: "object";
1401
+ properties: {
1402
+ permissions: {
1403
+ type: string;
1404
+ description: string;
1405
+ };
1406
+ };
1407
+ required: string[];
1408
+ };
1409
+ };
1410
+ };
1411
+ };
1412
+ responses: {
1413
+ "200": {
1414
+ description: string;
1415
+ content: {
1416
+ "application/json": {
1417
+ schema: {
1418
+ type: "object";
1419
+ properties: {
1420
+ error: {
1421
+ type: string;
1422
+ };
1423
+ success: {
1424
+ type: string;
1425
+ };
1426
+ };
1427
+ required: string[];
1428
+ };
1429
+ };
1430
+ };
1431
+ };
1432
+ };
1433
+ };
1434
+ $Infer: {
1435
+ body: {
1436
+ permissions: {
1437
+ readonly user?: ("create" | "list" | "set-role" | "ban" | "impersonate" | "impersonate-admins" | "delete" | "set-password" | "set-email" | "get" | "update")[] | undefined;
1438
+ readonly session?: ("list" | "delete" | "revoke")[] | undefined;
1439
+ };
1440
+ } & {
1441
+ userId?: string | undefined;
1442
+ role?: "admin" | "editor" | undefined;
1443
+ };
1444
+ };
1445
+ };
1446
+ }, {
1447
+ error: null;
1448
+ success: boolean;
1449
+ }>;
1450
+ };
1451
+ $ERROR_CODES: {
1452
+ USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL: import("better-auth").RawError<"USER_ALREADY_EXISTS_USE_ANOTHER_EMAIL">;
1453
+ FAILED_TO_CREATE_USER: import("better-auth").RawError<"FAILED_TO_CREATE_USER">;
1454
+ USER_ALREADY_EXISTS: import("better-auth").RawError<"USER_ALREADY_EXISTS">;
1455
+ YOU_CANNOT_BAN_YOURSELF: import("better-auth").RawError<"YOU_CANNOT_BAN_YOURSELF">;
1456
+ YOU_ARE_NOT_ALLOWED_TO_CHANGE_USERS_ROLE: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_CHANGE_USERS_ROLE">;
1457
+ YOU_ARE_NOT_ALLOWED_TO_CREATE_USERS: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_CREATE_USERS">;
1458
+ YOU_ARE_NOT_ALLOWED_TO_LIST_USERS: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_LIST_USERS">;
1459
+ YOU_ARE_NOT_ALLOWED_TO_LIST_USERS_SESSIONS: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_LIST_USERS_SESSIONS">;
1460
+ YOU_ARE_NOT_ALLOWED_TO_BAN_USERS: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_BAN_USERS">;
1461
+ YOU_ARE_NOT_ALLOWED_TO_IMPERSONATE_USERS: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_IMPERSONATE_USERS">;
1462
+ YOU_ARE_NOT_ALLOWED_TO_REVOKE_USERS_SESSIONS: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_REVOKE_USERS_SESSIONS">;
1463
+ YOU_ARE_NOT_ALLOWED_TO_DELETE_USERS: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_DELETE_USERS">;
1464
+ YOU_ARE_NOT_ALLOWED_TO_SET_USERS_PASSWORD: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_SET_USERS_PASSWORD">;
1465
+ BANNED_USER: import("better-auth").RawError<"BANNED_USER">;
1466
+ YOU_ARE_NOT_ALLOWED_TO_GET_USER: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_GET_USER">;
1467
+ NO_DATA_TO_UPDATE: import("better-auth").RawError<"NO_DATA_TO_UPDATE">;
1468
+ YOU_ARE_NOT_ALLOWED_TO_UPDATE_USERS: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_UPDATE_USERS">;
1469
+ YOU_CANNOT_REMOVE_YOURSELF: import("better-auth").RawError<"YOU_CANNOT_REMOVE_YOURSELF">;
1470
+ YOU_ARE_NOT_ALLOWED_TO_SET_NON_EXISTENT_VALUE: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_SET_NON_EXISTENT_VALUE">;
1471
+ YOU_CANNOT_IMPERSONATE_ADMINS: import("better-auth").RawError<"YOU_CANNOT_IMPERSONATE_ADMINS">;
1472
+ INVALID_ROLE_TYPE: import("better-auth").RawError<"INVALID_ROLE_TYPE">;
1473
+ YOU_ARE_NOT_ALLOWED_TO_SET_USERS_EMAIL: import("better-auth").RawError<"YOU_ARE_NOT_ALLOWED_TO_SET_USERS_EMAIL">;
1474
+ PASSWORD_CANNOT_BE_UPDATED_VIA_UPDATE_USER: import("better-auth").RawError<"PASSWORD_CANNOT_BE_UPDATED_VIA_UPDATE_USER">;
1475
+ USER_ID_CANNOT_BE_UPDATED: import("better-auth").RawError<"USER_ID_CANNOT_BE_UPDATED">;
1476
+ };
1477
+ schema: {
1478
+ user: {
1479
+ fields: {
1480
+ role: {
1481
+ type: "string";
1482
+ required: false;
1483
+ input: false;
1484
+ };
1485
+ banned: {
1486
+ type: "boolean";
1487
+ defaultValue: false;
1488
+ required: false;
1489
+ input: false;
1490
+ };
1491
+ banReason: {
1492
+ type: "string";
1493
+ required: false;
1494
+ input: false;
1495
+ };
1496
+ banExpires: {
1497
+ type: "date";
1498
+ required: false;
1499
+ input: false;
1500
+ };
1501
+ };
1502
+ };
1503
+ session: {
1504
+ fields: {
1505
+ impersonatedBy: {
1506
+ type: "string";
1507
+ required: false;
1508
+ input: false;
1509
+ };
1510
+ };
1511
+ };
1512
+ };
1513
+ options: NoInfer<{
1514
+ ac: {
1515
+ newRole<const TRoleStatements extends import("better-auth/plugins").Statements>(statements: import("better-auth/plugins").RoleInput<{
1516
+ readonly user: readonly ["create", "list", "set-role", "ban", "impersonate", "impersonate-admins", "delete", "set-password", "set-email", "get", "update"];
1517
+ readonly session: readonly ["list", "revoke", "delete"];
1518
+ }, TRoleStatements>): import("better-auth/plugins").Role<import("better-auth/plugins").ExactRoleStatements<TRoleStatements>, {
1519
+ readonly user: readonly ["create", "list", "set-role", "ban", "impersonate", "impersonate-admins", "delete", "set-password", "set-email", "get", "update"];
1520
+ readonly session: readonly ["list", "revoke", "delete"];
1521
+ }>;
1522
+ statements: {
1523
+ readonly user: readonly ["create", "list", "set-role", "ban", "impersonate", "impersonate-admins", "delete", "set-password", "set-email", "get", "update"];
1524
+ readonly session: readonly ["list", "revoke", "delete"];
1525
+ };
1526
+ };
1527
+ roles: {
1528
+ admin: import("better-auth/plugins").Role<import("better-auth/plugins").ExactRoleStatements<{
1529
+ readonly user: ["create", "list", "get", "update", "set-role", "delete"];
1530
+ }>, {
1531
+ readonly user: readonly ["create", "list", "set-role", "ban", "impersonate", "impersonate-admins", "delete", "set-password", "set-email", "get", "update"];
1532
+ readonly session: readonly ["list", "revoke", "delete"];
1533
+ }>;
1534
+ editor: import("better-auth/plugins").Role<import("better-auth/plugins").ExactRoleStatements<{
1535
+ readonly user: [];
1536
+ }>, {
1537
+ readonly user: readonly ["create", "list", "set-role", "ban", "impersonate", "impersonate-admins", "delete", "set-password", "set-email", "get", "update"];
1538
+ readonly session: readonly ["list", "revoke", "delete"];
1539
+ }>;
1540
+ };
1541
+ defaultRole: string;
1542
+ adminRoles: string[];
1543
+ }>;
1544
+ }];
1545
+ }>;
1546
+ ensureMigrated: () => Promise<void>;
1547
+ toPublicUser: (user: {
1548
+ id: string;
1549
+ email: string;
1550
+ name: string;
1551
+ role?: string | null;
1552
+ emailVerified?: boolean;
1553
+ createdAt: Date | string;
1554
+ lastLoginAt?: Date | string | null;
1555
+ }) => PublicUser;
1556
+ isConfigAdmin: (email: string) => boolean;
1557
+ sendInvite: (by: {
1558
+ name: string;
1559
+ }, user: PublicUser) => Promise<void>;
1560
+ };
1561
+ export type VestryAuth = ReturnType<typeof createVestryAuth>;