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