@crowi/api-contract 2.0.0-alpha.6 → 2.0.0-alpha.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -294,14 +294,37 @@ var ForbiddenErrorSchema = ApiErrorSchema.extend({
294
294
  });
295
295
 
296
296
  // src/schemas/app.ts
297
+ import { z as z4 } from "@hono/zod-openapi";
298
+
299
+ // src/schemas/app-capabilities.ts
297
300
  import { z as z3 } from "@hono/zod-openapi";
298
- var AppInfoResponseSchema = z3.object({
299
- title: z3.string().nullable(),
300
- confidential: z3.string().nullable(),
301
- version: z3.string(),
302
- apiVersion: z3.string(),
303
- capabilities: z3.array(z3.string()),
304
- canSelfRegister: z3.boolean()
301
+ var STATIC_CAPABILITIES = [
302
+ "oauth",
303
+ // The oauth:* tags mirror GRANT_TYPES_SUPPORTED + the S256 PKCE method
304
+ // (schemas/oauth-endpoints.ts / the RFC 8414 discovery doc). Keep in sync.
305
+ "oauth:auth-code",
306
+ "oauth:device",
307
+ "oauth:pkce",
308
+ "pat",
309
+ "pages",
310
+ "comments",
311
+ "bookmarks",
312
+ "attachments",
313
+ "notifications"
314
+ ];
315
+ var DYNAMIC_CAPABILITIES = ["search", "collab", "collab:redis"];
316
+ var ALL_CAPABILITIES = [...STATIC_CAPABILITIES, ...DYNAMIC_CAPABILITIES];
317
+ var CapabilitySchema = z3.enum(ALL_CAPABILITIES).openapi("Capability");
318
+ var API_SURFACE_VERSION = "v2";
319
+
320
+ // src/schemas/app.ts
321
+ var AppInfoResponseSchema = z4.object({
322
+ title: z4.string().nullable(),
323
+ confidential: z4.string().nullable(),
324
+ version: z4.string(),
325
+ apiVersion: z4.string(),
326
+ capabilities: z4.array(CapabilitySchema),
327
+ canSelfRegister: z4.boolean()
305
328
  });
306
329
 
307
330
  // src/contracts/app.ts
@@ -335,22 +358,22 @@ var appRoutes = { getAppInfoRoute };
335
358
  import { createRoute as createRoute2 } from "@hono/zod-openapi";
336
359
 
337
360
  // src/schemas/installer.ts
338
- import { z as z4 } from "@hono/zod-openapi";
339
- var InstallerStatusResponseSchema = z4.object({
340
- status: z4.enum(["installer_required", "already_installed"])
341
- });
342
- var CreateAdminRequestSchema = z4.object({
343
- registerForm: z4.object({
344
- username: z4.string().min(1).regex(/^[\da-zA-Z\-_.]+$/, "username may only contain letters, digits, hyphens, underscores, and dots"),
345
- name: z4.string().min(1),
346
- email: z4.string().email(),
347
- password: z4.string().min(6).regex(/^[\x20-\x7F]{6,}$/, "password must be 6+ printable ASCII characters")
361
+ import { z as z5 } from "@hono/zod-openapi";
362
+ var InstallerStatusResponseSchema = z5.object({
363
+ status: z5.enum(["installer_required", "already_installed"])
364
+ });
365
+ var CreateAdminRequestSchema = z5.object({
366
+ registerForm: z5.object({
367
+ username: z5.string().min(1).regex(/^[\da-zA-Z\-_.]+$/, "username may only contain letters, digits, hyphens, underscores, and dots"),
368
+ name: z5.string().min(1),
369
+ email: z5.string().email(),
370
+ password: z5.string().min(6).regex(/^[\x20-\x7F]{6,}$/, "password must be 6+ printable ASCII characters")
348
371
  })
349
372
  });
350
- var CreateAdminResponseSchema = z4.object({
351
- status: z4.enum(["ok", "error"]),
352
- message: z4.string().optional(),
353
- errors: z4.array(z4.string()).optional()
373
+ var CreateAdminResponseSchema = z5.object({
374
+ status: z5.enum(["ok", "error"]),
375
+ message: z5.string().optional(),
376
+ errors: z5.array(z5.string()).optional()
354
377
  });
355
378
 
356
379
  // src/contracts/installer.ts
@@ -422,53 +445,53 @@ var createAdminRoute = createRoute2({
422
445
  var installerRoutes = { getInstallerStatusRoute, createAdminRoute };
423
446
 
424
447
  // src/contracts/tokenAuth.ts
425
- import { createRoute as createRoute3, z as z6 } from "@hono/zod-openapi";
448
+ import { createRoute as createRoute3, z as z7 } from "@hono/zod-openapi";
426
449
 
427
450
  // src/schemas/auth.ts
428
- import { z as z5 } from "@hono/zod-openapi";
429
- var TokenAuthLoginRequestSchema = z5.object({
430
- email: z5.string().email(),
431
- password: z5.string().min(6)
432
- });
433
- var TokenAuthResponseSchema = z5.object({
434
- accessToken: z5.string(),
435
- refreshToken: z5.string(),
436
- expiresIn: z5.number(),
451
+ import { z as z6 } from "@hono/zod-openapi";
452
+ var TokenAuthLoginRequestSchema = z6.object({
453
+ email: z6.string().email(),
454
+ password: z6.string().min(6)
455
+ });
456
+ var TokenAuthResponseSchema = z6.object({
457
+ accessToken: z6.string(),
458
+ refreshToken: z6.string(),
459
+ expiresIn: z6.number(),
437
460
  // seconds until expiration
438
- user: z5.object({
439
- id: z5.string(),
440
- username: z5.string(),
441
- email: z5.string().email(),
442
- name: z5.string(),
443
- image: z5.string().optional(),
444
- admin: z5.boolean().optional()
461
+ user: z6.object({
462
+ id: z6.string(),
463
+ username: z6.string(),
464
+ email: z6.string().email(),
465
+ name: z6.string(),
466
+ image: z6.string().optional(),
467
+ admin: z6.boolean().optional()
445
468
  })
446
469
  });
447
- var RefreshTokenRequestSchema = z5.object({
448
- refreshToken: z5.string()
470
+ var RefreshTokenRequestSchema = z6.object({
471
+ refreshToken: z6.string()
449
472
  });
450
- var TokenAuthRegisterRequestSchema = z5.object({
451
- username: z5.string(),
452
- name: z5.string(),
453
- email: z5.string().email(),
454
- password: z5.string().min(6)
473
+ var TokenAuthRegisterRequestSchema = z6.object({
474
+ username: z6.string(),
475
+ name: z6.string(),
476
+ email: z6.string().email(),
477
+ password: z6.string().min(6)
455
478
  });
456
- var RegisterPendingResponseSchema = z5.object({
457
- status: z5.enum(["confirmation_required", "approval_required"])
479
+ var RegisterPendingResponseSchema = z6.object({
480
+ status: z6.enum(["confirmation_required", "approval_required"])
458
481
  });
459
482
 
460
483
  // src/contracts/tokenAuth.ts
461
- var TokenLogoutResponseSchema = z6.object({ message: z6.string() });
462
- var TokenMeResponseSchema = z6.object({
463
- user: z6.object({
464
- id: z6.string(),
465
- username: z6.string(),
466
- email: z6.string().email(),
467
- name: z6.string(),
468
- image: z6.string().optional(),
469
- status: z6.number(),
470
- admin: z6.boolean().optional(),
471
- createdAt: z6.string()
484
+ var TokenLogoutResponseSchema = z7.object({ message: z7.string() });
485
+ var TokenMeResponseSchema = z7.object({
486
+ user: z7.object({
487
+ id: z7.string(),
488
+ username: z7.string(),
489
+ email: z7.string().email(),
490
+ name: z7.string(),
491
+ image: z7.string().optional(),
492
+ status: z7.number(),
493
+ admin: z7.boolean().optional(),
494
+ createdAt: z7.string()
472
495
  })
473
496
  });
474
497
  var tokenLoginRoute = createRoute3({
@@ -596,7 +619,7 @@ var tokenLogoutRoute = createRoute3({
596
619
  body: {
597
620
  content: {
598
621
  "application/json": {
599
- schema: z6.object({ refreshToken: z6.string().optional() })
622
+ schema: z7.object({ refreshToken: z7.string().optional() })
600
623
  }
601
624
  }
602
625
  }
@@ -649,15 +672,15 @@ var tokenAuthRoutes = {
649
672
  import { createRoute as createRoute4 } from "@hono/zod-openapi";
650
673
 
651
674
  // src/schemas/inviteAccept.ts
652
- import { z as z7 } from "@hono/zod-openapi";
653
- var InviteAcceptRequestSchema = z7.object({
654
- token: z7.string(),
655
- username: z7.string().min(1),
656
- name: z7.string().min(1),
657
- password: z7.string().min(6)
675
+ import { z as z8 } from "@hono/zod-openapi";
676
+ var InviteAcceptRequestSchema = z8.object({
677
+ token: z8.string(),
678
+ username: z8.string().min(1),
679
+ name: z8.string().min(1),
680
+ password: z8.string().min(6)
658
681
  });
659
- var InvitePreviewResponseSchema = z7.object({
660
- email: z7.string().email()
682
+ var InvitePreviewResponseSchema = z8.object({
683
+ email: z8.string().email()
661
684
  });
662
685
 
663
686
  // src/contracts/inviteAccept.ts
@@ -734,16 +757,16 @@ var inviteAcceptRoutes = {
734
757
  import { createRoute as createRoute5 } from "@hono/zod-openapi";
735
758
 
736
759
  // src/schemas/passwordReset.ts
737
- import { z as z8 } from "@hono/zod-openapi";
738
- var ForgotPasswordRequestSchema = z8.object({
739
- email: z8.string().email()
760
+ import { z as z9 } from "@hono/zod-openapi";
761
+ var ForgotPasswordRequestSchema = z9.object({
762
+ email: z9.string().email()
740
763
  });
741
- var ForgotPasswordResponseSchema = z8.object({
742
- ok: z8.literal(true)
764
+ var ForgotPasswordResponseSchema = z9.object({
765
+ ok: z9.literal(true)
743
766
  });
744
- var ResetPasswordRequestSchema = z8.object({
745
- token: z8.string(),
746
- password: z8.string().min(6)
767
+ var ResetPasswordRequestSchema = z9.object({
768
+ token: z9.string(),
769
+ password: z9.string().min(6)
747
770
  });
748
771
 
749
772
  // src/contracts/passwordReset.ts
@@ -838,12 +861,12 @@ var passwordResetRoutes = {
838
861
  import { createRoute as createRoute6 } from "@hono/zod-openapi";
839
862
 
840
863
  // src/schemas/activation.ts
841
- import { z as z9 } from "@hono/zod-openapi";
842
- var ActivateRequestSchema = z9.object({
843
- token: z9.string()
864
+ import { z as z10 } from "@hono/zod-openapi";
865
+ var ActivateRequestSchema = z10.object({
866
+ token: z10.string()
844
867
  });
845
- var ActivateValidationResponseSchema = z9.object({
846
- ok: z9.literal(true)
868
+ var ActivateValidationResponseSchema = z10.object({
869
+ ok: z10.literal(true)
847
870
  });
848
871
 
849
872
  // src/contracts/activation.ts
@@ -908,14 +931,14 @@ var activationRoutes = {
908
931
  import { createRoute as createRoute7 } from "@hono/zod-openapi";
909
932
 
910
933
  // src/schemas/emailChange.ts
911
- import { z as z10 } from "@hono/zod-openapi";
912
- var ConfirmEmailChangeRequestSchema = z10.object({
913
- token: z10.string()
934
+ import { z as z11 } from "@hono/zod-openapi";
935
+ var ConfirmEmailChangeRequestSchema = z11.object({
936
+ token: z11.string()
914
937
  });
915
- var ConfirmEmailChangeResponseSchema = z10.object({
916
- ok: z10.literal(true),
938
+ var ConfirmEmailChangeResponseSchema = z11.object({
939
+ ok: z11.literal(true),
917
940
  /** The newly-confirmed email address. */
918
- email: z10.string().email()
941
+ email: z11.string().email()
919
942
  });
920
943
 
921
944
  // src/contracts/emailChange.ts
@@ -981,19 +1004,19 @@ var emailChangeRoutes = {
981
1004
  };
982
1005
 
983
1006
  // src/contracts/me.ts
984
- import { createRoute as createRoute8, z as z15 } from "@hono/zod-openapi";
1007
+ import { createRoute as createRoute8, z as z16 } from "@hono/zod-openapi";
985
1008
 
986
1009
  // src/schemas/me.ts
987
- import { z as z14 } from "@hono/zod-openapi";
1010
+ import { z as z15 } from "@hono/zod-openapi";
988
1011
 
989
1012
  // src/schemas/page.ts
990
- import { z as z13 } from "@hono/zod-openapi";
1013
+ import { z as z14 } from "@hono/zod-openapi";
991
1014
 
992
1015
  // src/schemas/collab.ts
993
- import { z as z12 } from "@hono/zod-openapi";
1016
+ import { z as z13 } from "@hono/zod-openapi";
994
1017
 
995
1018
  // src/schemas/userPublic.ts
996
- import { z as z11 } from "@hono/zod-openapi";
1019
+ import { z as z12 } from "@hono/zod-openapi";
997
1020
  var UserPublicStatus = {
998
1021
  REGISTERED: 1,
999
1022
  ACTIVE: 2,
@@ -1001,64 +1024,64 @@ var UserPublicStatus = {
1001
1024
  DELETED: 4,
1002
1025
  INVITED: 5
1003
1026
  };
1004
- var UserPublicStatusSchema = z11.nativeEnum(UserPublicStatus);
1005
- var UserPublicSchema = z11.object({
1006
- _id: z11.string(),
1007
- id: z11.string().optional(),
1027
+ var UserPublicStatusSchema = z12.nativeEnum(UserPublicStatus);
1028
+ var UserPublicSchema = z12.object({
1029
+ _id: z12.string(),
1030
+ id: z12.string().optional(),
1008
1031
  // for compatibility (virtual field)
1009
- username: z11.string(),
1010
- name: z11.string(),
1011
- email: z11.string().email(),
1012
- image: z11.string().nullable().optional(),
1013
- introduction: z11.string().optional(),
1014
- createdAt: z11.string(),
1015
- admin: z11.boolean().optional(),
1032
+ username: z12.string(),
1033
+ name: z12.string(),
1034
+ email: z12.string().email(),
1035
+ image: z12.string().nullable().optional(),
1036
+ introduction: z12.string().optional(),
1037
+ createdAt: z12.string(),
1038
+ admin: z12.boolean().optional(),
1016
1039
  status: UserPublicStatusSchema.optional()
1017
1040
  });
1018
1041
 
1019
1042
  // src/schemas/collab.ts
1020
1043
  var ContributorRefSchema = UserPublicSchema;
1021
- var RevisionTypeSchema = z12.enum(["snapshot", "incremental"]);
1022
- var WsTokenResponseSchema = z12.object({
1023
- wsToken: z12.string(),
1024
- pageId: z12.string(),
1025
- expiresAt: z12.string(),
1026
- readonly: z12.boolean()
1027
- });
1028
- var WsTokenPayloadSchema = z12.object({
1029
- userId: z12.string(),
1030
- pageId: z12.string(),
1031
- readonly: z12.boolean(),
1032
- iat: z12.number().int(),
1033
- exp: z12.number().int()
1034
- });
1035
- var CollabSaveMessageSchema = z12.object({
1036
- kind: z12.literal("crowi:save"),
1037
- message: z12.string().optional()
1038
- });
1039
- var CollabSaveOkSchema = z12.object({
1040
- kind: z12.literal("crowi:save-ok"),
1041
- revisionId: z12.string()
1042
- });
1043
- var CollabSaveErrorSchema = z12.object({
1044
- kind: z12.literal("crowi:save-error"),
1045
- code: z12.string(),
1046
- message: z12.string()
1047
- });
1048
- var CollabForceReloadMessageSchema = z12.object({
1049
- kind: z12.literal("crowi:force-reload"),
1050
- reason: z12.string().optional()
1044
+ var RevisionTypeSchema = z13.enum(["snapshot", "incremental"]);
1045
+ var WsTokenResponseSchema = z13.object({
1046
+ wsToken: z13.string(),
1047
+ pageId: z13.string(),
1048
+ expiresAt: z13.string(),
1049
+ readonly: z13.boolean()
1050
+ });
1051
+ var WsTokenPayloadSchema = z13.object({
1052
+ userId: z13.string(),
1053
+ pageId: z13.string(),
1054
+ readonly: z13.boolean(),
1055
+ iat: z13.number().int(),
1056
+ exp: z13.number().int()
1057
+ });
1058
+ var CollabSaveMessageSchema = z13.object({
1059
+ kind: z13.literal("crowi:save"),
1060
+ message: z13.string().optional()
1061
+ });
1062
+ var CollabSaveOkSchema = z13.object({
1063
+ kind: z13.literal("crowi:save-ok"),
1064
+ revisionId: z13.string()
1065
+ });
1066
+ var CollabSaveErrorSchema = z13.object({
1067
+ kind: z13.literal("crowi:save-error"),
1068
+ code: z13.string(),
1069
+ message: z13.string()
1070
+ });
1071
+ var CollabForceReloadMessageSchema = z13.object({
1072
+ kind: z13.literal("crowi:force-reload"),
1073
+ reason: z13.string().optional()
1051
1074
  });
1052
1075
 
1053
1076
  // src/schemas/page.ts
1054
- var PageGrantSchema = z13.enum(["1", "2", "3", "4"]).transform((val) => Number(val));
1077
+ var PageGrantSchema = z14.enum(["1", "2", "3", "4"]).transform((val) => Number(val));
1055
1078
  var PageGrantEnum = {
1056
1079
  PUBLIC: 1,
1057
1080
  RESTRICTED: 2,
1058
1081
  SPECIFIED: 3,
1059
1082
  OWNER: 4
1060
1083
  };
1061
- var PageStatusSchema = z13.enum(["wip", "published", "deleted", "deprecated", "draft"]);
1084
+ var PageStatusSchema = z14.enum(["wip", "published", "deleted", "deprecated", "draft"]);
1062
1085
  var PageStatusEnum = {
1063
1086
  WIP: "wip",
1064
1087
  PUBLISHED: "published",
@@ -1066,51 +1089,51 @@ var PageStatusEnum = {
1066
1089
  DEPRECATED: "deprecated",
1067
1090
  DRAFT: "draft"
1068
1091
  };
1069
- var PageTypeSchema = z13.enum(["portal", "user", "public"]);
1092
+ var PageTypeSchema = z14.enum(["portal", "user", "public"]);
1070
1093
  var PageTypeEnum = {
1071
1094
  PORTAL: "portal",
1072
1095
  USER: "user",
1073
1096
  PUBLIC: "public"
1074
1097
  };
1075
- var PageUserSchema = z13.object({
1076
- _id: z13.string(),
1077
- id: z13.string().optional(),
1098
+ var PageUserSchema = z14.object({
1099
+ _id: z14.string(),
1100
+ id: z14.string().optional(),
1078
1101
  // for compatibility
1079
- username: z13.string(),
1080
- name: z13.string(),
1081
- email: z13.string().email(),
1082
- image: z13.string().nullable().optional(),
1083
- createdAt: z13.string()
1084
- });
1085
- var TocEntrySchema = z13.object({
1086
- level: z13.number().int().min(1).max(6),
1087
- text: z13.string(),
1088
- anchorId: z13.string()
1089
- });
1090
- var WikiLinkSchema = z13.object({
1102
+ username: z14.string(),
1103
+ name: z14.string(),
1104
+ email: z14.string().email(),
1105
+ image: z14.string().nullable().optional(),
1106
+ createdAt: z14.string()
1107
+ });
1108
+ var TocEntrySchema = z14.object({
1109
+ level: z14.number().int().min(1).max(6),
1110
+ text: z14.string(),
1111
+ anchorId: z14.string()
1112
+ });
1113
+ var WikiLinkSchema = z14.object({
1091
1114
  /** Verbatim source between the `[[` `]]` (no surrounding brackets). */
1092
- raw: z13.string(),
1115
+ raw: z14.string(),
1093
1116
  /** Normalised target (left of the `|`, fragment trimmed for resolution). */
1094
- target: z13.string(),
1117
+ target: z14.string(),
1095
1118
  /** Optional pipe-aliased display text (right of the `|`). */
1096
- displayText: z13.string().optional()
1097
- });
1098
- var MentionSchema = z13.object({
1099
- username: z13.string()
1100
- });
1101
- var RevisionMetaSchemaShape = z13.object({
1102
- toc: z13.array(TocEntrySchema).optional(),
1103
- wikiLinks: z13.array(WikiLinkSchema).optional(),
1104
- mentions: z13.array(MentionSchema).optional(),
1105
- codeBlockLanguages: z13.array(z13.string()).optional()
1106
- });
1107
- var RevisionSchema = z13.object({
1108
- _id: z13.string(),
1109
- path: z13.string(),
1110
- body: z13.string(),
1111
- format: z13.string().default("markdown"),
1119
+ displayText: z14.string().optional()
1120
+ });
1121
+ var MentionSchema = z14.object({
1122
+ username: z14.string()
1123
+ });
1124
+ var RevisionMetaSchemaShape = z14.object({
1125
+ toc: z14.array(TocEntrySchema).optional(),
1126
+ wikiLinks: z14.array(WikiLinkSchema).optional(),
1127
+ mentions: z14.array(MentionSchema).optional(),
1128
+ codeBlockLanguages: z14.array(z14.string()).optional()
1129
+ });
1130
+ var RevisionSchema = z14.object({
1131
+ _id: z14.string(),
1132
+ path: z14.string(),
1133
+ body: z14.string(),
1134
+ format: z14.string().default("markdown"),
1112
1135
  author: PageUserSchema.nullable().optional(),
1113
- createdAt: z13.string(),
1136
+ createdAt: z14.string(),
1114
1137
  meta: RevisionMetaSchemaShape.optional(),
1115
1138
  // RFC-0002 Phase 3: transformed mdast (parse + core plugins +
1116
1139
  // shiki) for the web client to render without re-parsing the body.
@@ -1118,42 +1141,42 @@ var RevisionSchema = z13.object({
1118
1141
  // spec to maintain a strict Zod schema for. Only single-page detail
1119
1142
  // (`getPage`) and single-revision detail (`getRevision`) emit it;
1120
1143
  // list endpoints skip it for payload weight.
1121
- renderedAst: z13.unknown().optional(),
1144
+ renderedAst: z14.unknown().optional(),
1122
1145
  // RFC-0002 round 3.1: semver of the renderer pipeline that produced
1123
1146
  // `renderedAst`. The read path uses this to detect stale entries
1124
1147
  // (rebuilt by `renderer:rebuild` once RFC-0008 lands). Absent on
1125
1148
  // revisions saved before this field was introduced.
1126
- rendererVersion: z13.string().optional(),
1149
+ rendererVersion: z14.string().optional(),
1127
1150
  // RFC-0003 collaborative-save fields. All optional; v1.x revisions
1128
1151
  // emit none of them. See `packages/api/src/models/revision.ts` for
1129
1152
  // semantics. The list-page endpoint currently does not surface
1130
1153
  // these — they only appear on the Phase 5+ checkpoint Revisions
1131
1154
  // produced by Hocuspocus and on the single-revision detail route.
1132
- parentRevisionId: z13.string().nullable().optional(),
1155
+ parentRevisionId: z14.string().nullable().optional(),
1133
1156
  type: RevisionTypeSchema.optional(),
1134
- savedBy: z13.union([z13.string(), PageUserSchema]).nullable().optional(),
1135
- contributors: z13.array(z13.union([z13.string(), PageUserSchema])).optional(),
1136
- message: z13.string().optional(),
1157
+ savedBy: z14.union([z14.string(), PageUserSchema]).nullable().optional(),
1158
+ contributors: z14.array(z14.union([z14.string(), PageUserSchema])).optional(),
1159
+ message: z14.string().optional(),
1137
1160
  // RFC-0010 — edit channel ('web' | 'oauth' | 'pat'); absent on
1138
1161
  // pre-RFC-0010 / collaborative / browser revisions.
1139
- editVia: z13.enum(["web", "oauth", "pat"]).optional()
1140
- });
1141
- var PageExtendedSchema = z13.record(z13.string(), z13.any()).optional();
1142
- var PageSchema = z13.object({
1143
- _id: z13.string(),
1144
- path: z13.string(),
1145
- revision: z13.union([z13.string(), RevisionSchema]).optional(),
1146
- redirectTo: z13.string().nullable().optional(),
1162
+ editVia: z14.enum(["web", "oauth", "pat"]).optional()
1163
+ });
1164
+ var PageExtendedSchema = z14.record(z14.string(), z14.any()).optional();
1165
+ var PageSchema = z14.object({
1166
+ _id: z14.string(),
1167
+ path: z14.string(),
1168
+ revision: z14.union([z14.string(), RevisionSchema]).optional(),
1169
+ redirectTo: z14.string().nullable().optional(),
1147
1170
  status: PageStatusSchema.nullable().optional(),
1148
- grant: z13.number().optional(),
1149
- grantedUsers: z13.array(z13.string()).optional(),
1150
- creator: z13.union([z13.string(), PageUserSchema]).nullable().optional(),
1151
- lastUpdateUser: z13.union([z13.string(), PageUserSchema]).nullable().optional(),
1152
- liker: z13.array(z13.string()).optional(),
1153
- commentCount: z13.number().default(0),
1171
+ grant: z14.number().optional(),
1172
+ grantedUsers: z14.array(z14.string()).optional(),
1173
+ creator: z14.union([z14.string(), PageUserSchema]).nullable().optional(),
1174
+ lastUpdateUser: z14.union([z14.string(), PageUserSchema]).nullable().optional(),
1175
+ liker: z14.array(z14.string()).optional(),
1176
+ commentCount: z14.number().default(0),
1154
1177
  extended: PageExtendedSchema,
1155
- createdAt: z13.string(),
1156
- updatedAt: z13.string().optional(),
1178
+ createdAt: z14.string(),
1179
+ updatedAt: z14.string().optional(),
1157
1180
  // RFC-0003 collaborative-edit fields. All optional; `null` is the
1158
1181
  // "no live state yet" value. Existing read endpoints (list /
1159
1182
  // detail) do not currently emit these — the contract is widened
@@ -1161,31 +1184,32 @@ var PageSchema = z13.object({
1161
1184
  // bump. `yjsState` is intentionally omitted from the contract:
1162
1185
  // the binary blob lives only inside Hocuspocus and never crosses
1163
1186
  // the HTTP API.
1164
- currentRevision: z13.string().nullable().optional(),
1165
- yjsCheckpointAt: z13.string().nullable().optional(),
1187
+ currentRevision: z14.string().nullable().optional(),
1188
+ yjsCheckpointAt: z14.string().nullable().optional(),
1166
1189
  // dynamic fields
1167
- latestRevision: z13.string().optional(),
1168
- likerCount: z13.number().optional(),
1169
- seenUsersCount: z13.number().optional()
1190
+ latestRevision: z14.string().optional(),
1191
+ likerCount: z14.number().optional(),
1192
+ seenUsersCount: z14.number().optional()
1170
1193
  });
1171
1194
  var PageWithRevisionSchema = PageSchema.extend({
1172
1195
  revision: RevisionSchema,
1173
1196
  creator: PageUserSchema.nullable().optional(),
1174
1197
  lastUpdateUser: PageUserSchema.nullable().optional()
1175
1198
  });
1176
- var GetPageRequestSchema = z13.object({
1177
- path: z13.string().optional(),
1178
- page_id: z13.string().optional(),
1179
- revision_id: z13.string().optional()
1199
+ var GetPageRequestSchema = z14.object({
1200
+ path: z14.string().optional(),
1201
+ page_id: z14.string().optional(),
1202
+ revision_id: z14.string().optional()
1180
1203
  });
1181
- var GetPageResponseSchema = z13.object({
1204
+ var GetPageResponseSchema = z14.object({
1182
1205
  page: PageWithRevisionSchema
1183
1206
  });
1184
- var ListPagesRequestSchema = z13.object({
1185
- path: z13.string().optional(),
1186
- user: z13.string().optional(),
1187
- limit: z13.coerce.number().optional().default(50),
1188
- offset: z13.coerce.number().optional().default(0),
1207
+ var ClaimPageLinkAccessResponseSchema = GetPageResponseSchema.extend({ granted: z14.boolean() });
1208
+ var ListPagesRequestSchema = z14.object({
1209
+ path: z14.string().optional(),
1210
+ user: z14.string().optional(),
1211
+ limit: z14.coerce.number().optional().default(50),
1212
+ offset: z14.coerce.number().optional().default(0),
1189
1213
  // NOT `z.coerce.boolean()`: that uses JS `Boolean(v)`, so the string
1190
1214
  // `"false"` (which is how the web client serialises `false` on the
1191
1215
  // query string) coerces to `true`. That silently flipped
@@ -1193,25 +1217,25 @@ var ListPagesRequestSchema = z13.object({
1193
1217
  // filter and leak other users' drafts. Parse the string explicitly so
1194
1218
  // only `"true"` / `true` is truthy; anything else (incl. `"false"`,
1195
1219
  // absent) is `false`.
1196
- include_deleted: z13.preprocess((v) => v === true || v === "true" || v === "1", z13.boolean()).optional().default(false),
1220
+ include_deleted: z14.preprocess((v) => v === true || v === "true" || v === "1", z14.boolean()).optional().default(false),
1197
1221
  // Sort field + direction for the listing. Defaults preserve the legacy
1198
1222
  // "newest-updated first" order so existing callers are unaffected.
1199
1223
  // `path` sorts alphabetically by full page path (≈ name order).
1200
- sort: z13.enum(["updatedAt", "createdAt", "path"]).optional().default("updatedAt"),
1201
- order: z13.enum(["asc", "desc"]).optional().default("desc"),
1224
+ sort: z14.enum(["updatedAt", "createdAt", "path"]).optional().default("updatedAt"),
1225
+ order: z14.enum(["asc", "desc"]).optional().default("desc"),
1202
1226
  // When listing a portal path (`/foo/`), open the portal document at this
1203
1227
  // past revision so the catch-all can mirror `?revision_id=` on portals.
1204
1228
  // Only the `portalPage` is rewound — the child rows always reflect the
1205
1229
  // latest. Absent for normal listings.
1206
- revision_id: z13.string().optional()
1230
+ revision_id: z14.string().optional()
1207
1231
  });
1208
- var PagerSchema = z13.object({
1209
- prev: z13.number().nullable(),
1210
- next: z13.number().nullable(),
1211
- offset: z13.number()
1232
+ var PagerSchema = z14.object({
1233
+ prev: z14.number().nullable(),
1234
+ next: z14.number().nullable(),
1235
+ offset: z14.number()
1212
1236
  });
1213
- var ListPagesResponseSchema = z13.object({
1214
- pages: z13.array(PageSchema),
1237
+ var ListPagesResponseSchema = z14.object({
1238
+ pages: z14.array(PageSchema),
1215
1239
  pager: PagerSchema,
1216
1240
  portalPage: PageSchema.nullable().optional(),
1217
1241
  // When listing a portal path (`/foo/`) that has NO portal document of
@@ -1223,204 +1247,204 @@ var ListPagesResponseSchema = z13.object({
1223
1247
  // listings.
1224
1248
  contentPage: PageSchema.nullable().optional()
1225
1249
  });
1226
- var PageChildSegmentSchema = z13.object({
1250
+ var PageChildSegmentSchema = z14.object({
1227
1251
  // The bare segment name immediately under the queried path
1228
1252
  // (e.g. 'rfc' for /crowi/rfc/... when querying /crowi/).
1229
- segment: z13.string(),
1253
+ segment: z14.string(),
1230
1254
  // Portal-style path for this segment (always trailing-slashed),
1231
1255
  // e.g. '/crowi/rfc/'. Drop the trailing slash for the page path when
1232
1256
  // the segment is a leaf page (see `isPage`).
1233
- path: z13.string(),
1257
+ path: z14.string(),
1234
1258
  // True when a real page is saved at the segment path itself
1235
1259
  // (e.g. `/crowi/rfc`, no trailing slash) — i.e. the segment is a
1236
1260
  // navigable page, not only an inferred directory.
1237
- isPage: z13.boolean(),
1261
+ isPage: z14.boolean(),
1238
1262
  // True when a real portal page is saved at `path` (→ compass icon).
1239
- hasPortal: z13.boolean(),
1263
+ hasPortal: z14.boolean(),
1240
1264
  // Number of descendant content pages strictly under this segment
1241
1265
  // (excludes the segment's own page / portal docs). A rough "how much
1242
1266
  // lives here" hint; > 0 means the segment is an expandable directory.
1243
- count: z13.number()
1267
+ count: z14.number()
1244
1268
  });
1245
- var ListPageChildrenRequestSchema = z13.object({
1269
+ var ListPageChildrenRequestSchema = z14.object({
1246
1270
  // Portal path to list children of. Trailing slash optional — the
1247
1271
  // handler normalises it. '/' lists the top-level segments.
1248
- path: z13.string()
1272
+ path: z14.string()
1249
1273
  });
1250
- var ListPageChildrenResponseSchema = z13.object({
1274
+ var ListPageChildrenResponseSchema = z14.object({
1251
1275
  // Sorted alphabetically by segment.
1252
- children: z13.array(PageChildSegmentSchema)
1253
- });
1254
- var CreatePageRequestSchema = z13.object({
1255
- path: z13.string(),
1256
- body: z13.string(),
1257
- grant: z13.number().optional()
1258
- });
1259
- var UpdatePageRequestSchema = z13.object({
1260
- page_id: z13.string(),
1261
- body: z13.string(),
1262
- revision_id: z13.string().optional(),
1263
- grant: z13.number().optional()
1264
- });
1265
- var RevertToRevisionRequestSchema = z13.object({
1266
- page_id: z13.string(),
1267
- revision_id: z13.string()
1268
- });
1269
- var SetPageGrantRequestSchema = z13.object({
1270
- page_id: z13.string(),
1271
- grant: z13.number().int()
1272
- });
1273
- var RenamePageRequestSchema = z13.object({
1274
- page_id: z13.string(),
1275
- new_path: z13.string(),
1276
- revision_id: z13.string().optional(),
1277
- create_redirect: z13.boolean().optional(),
1276
+ children: z14.array(PageChildSegmentSchema)
1277
+ });
1278
+ var CreatePageRequestSchema = z14.object({
1279
+ path: z14.string(),
1280
+ body: z14.string(),
1281
+ grant: z14.number().optional()
1282
+ });
1283
+ var UpdatePageRequestSchema = z14.object({
1284
+ page_id: z14.string(),
1285
+ body: z14.string(),
1286
+ revision_id: z14.string().optional(),
1287
+ grant: z14.number().optional()
1288
+ });
1289
+ var RevertToRevisionRequestSchema = z14.object({
1290
+ page_id: z14.string(),
1291
+ revision_id: z14.string()
1292
+ });
1293
+ var SetPageGrantRequestSchema = z14.object({
1294
+ page_id: z14.string(),
1295
+ grant: z14.number().int()
1296
+ });
1297
+ var RenamePageRequestSchema = z14.object({
1298
+ page_id: z14.string(),
1299
+ new_path: z14.string(),
1300
+ revision_id: z14.string().optional(),
1301
+ create_redirect: z14.boolean().optional(),
1278
1302
  // When true, rename the page together with its whole (grant-visible)
1279
1303
  // descendant subtree (renameTree) instead of just the single page.
1280
1304
  // Defaults to false — the single-page rename behaviour.
1281
- include_descendants: z13.boolean().optional()
1305
+ include_descendants: z14.boolean().optional()
1282
1306
  });
1283
- var RenamePageResponseSchema = z13.object({
1307
+ var RenamePageResponseSchema = z14.object({
1284
1308
  page: PageSchema,
1285
- renamed_count: z13.number()
1286
- });
1287
- var RenameTreeErrorSchema = z13.object({
1288
- error: z13.object({
1289
- code: z13.literal("PAGE_RENAME_TREE_FAILED"),
1290
- message: z13.string(),
1291
- conflicts: z13.array(
1292
- z13.object({
1293
- path: z13.string(),
1294
- reasons: z13.array(z13.string())
1309
+ renamed_count: z14.number()
1310
+ });
1311
+ var RenameTreeErrorSchema = z14.object({
1312
+ error: z14.object({
1313
+ code: z14.literal("PAGE_RENAME_TREE_FAILED"),
1314
+ message: z14.string(),
1315
+ conflicts: z14.array(
1316
+ z14.object({
1317
+ path: z14.string(),
1318
+ reasons: z14.array(z14.string())
1295
1319
  })
1296
1320
  ),
1297
1321
  // True when the failure happened after some pages were already moved
1298
1322
  // (non-transactional best-effort). When omitted/false the failure was
1299
1323
  // detected up-front and nothing was moved.
1300
- partial: z13.boolean().optional()
1324
+ partial: z14.boolean().optional()
1301
1325
  })
1302
1326
  });
1303
- var RenameSubtreeRequestSchema = z13.object({
1304
- old_path: z13.string(),
1305
- new_path: z13.string(),
1306
- create_redirect: z13.boolean().optional()
1327
+ var RenameSubtreeRequestSchema = z14.object({
1328
+ old_path: z14.string(),
1329
+ new_path: z14.string(),
1330
+ create_redirect: z14.boolean().optional()
1307
1331
  });
1308
- var RenameSubtreeResponseSchema = z13.object({
1309
- renamed_count: z13.number()
1332
+ var RenameSubtreeResponseSchema = z14.object({
1333
+ renamed_count: z14.number()
1310
1334
  });
1311
- var PageNotFoundErrorSchema = z13.object({
1312
- error: z13.object({
1313
- code: z13.literal("PAGE_NOT_FOUND"),
1314
- message: z13.literal("Page not found")
1335
+ var PageNotFoundErrorSchema = z14.object({
1336
+ error: z14.object({
1337
+ code: z14.literal("PAGE_NOT_FOUND"),
1338
+ message: z14.literal("Page not found")
1315
1339
  })
1316
1340
  });
1317
- var PageNotGrantedErrorSchema = z13.object({
1318
- error: z13.object({
1319
- code: z13.literal("PAGE_NOT_GRANTED"),
1320
- message: z13.literal("Page is not granted for the user")
1341
+ var PageNotGrantedErrorSchema = z14.object({
1342
+ error: z14.object({
1343
+ code: z14.literal("PAGE_NOT_GRANTED"),
1344
+ message: z14.literal("Page is not granted for the user")
1321
1345
  })
1322
1346
  });
1323
- var PageRevisionErrorSchema = z13.object({
1324
- error: z13.object({
1325
- code: z13.literal("PAGE_REVISION_ERROR"),
1326
- message: z13.string()
1347
+ var PageRevisionErrorSchema = z14.object({
1348
+ error: z14.object({
1349
+ code: z14.literal("PAGE_REVISION_ERROR"),
1350
+ message: z14.string()
1327
1351
  })
1328
1352
  });
1329
- var SeenPageRequestSchema = z13.object({
1330
- page_id: z13.string()
1353
+ var SeenPageRequestSchema = z14.object({
1354
+ page_id: z14.string()
1331
1355
  });
1332
- var SeenUsersResponseSchema = z13.object({
1333
- seenUsers: z13.array(UserPublicSchema),
1334
- seenUsersCount: z13.number()
1356
+ var SeenUsersResponseSchema = z14.object({
1357
+ seenUsers: z14.array(UserPublicSchema),
1358
+ seenUsersCount: z14.number()
1335
1359
  });
1336
- var GetSeenUsersRequestSchema = z13.object({
1337
- page_id: z13.string(),
1360
+ var GetSeenUsersRequestSchema = z14.object({
1361
+ page_id: z14.string(),
1338
1362
  // Optional cap on returned `seenUsers`. `seenUsersCount` always reflects
1339
1363
  // the full count regardless of `limit`. Omit for the full list.
1340
- limit: z13.coerce.number().int().positive().optional()
1364
+ limit: z14.coerce.number().int().positive().optional()
1341
1365
  });
1342
- var GetWatchStatusRequestSchema = z13.object({
1343
- page_id: z13.string()
1366
+ var GetWatchStatusRequestSchema = z14.object({
1367
+ page_id: z14.string()
1344
1368
  });
1345
- var WatchStatusResponseSchema = z13.object({
1346
- watching: z13.boolean()
1369
+ var WatchStatusResponseSchema = z14.object({
1370
+ watching: z14.boolean()
1347
1371
  });
1348
- var SetWatchStatusRequestSchema = z13.object({
1349
- page_id: z13.string(),
1350
- watching: z13.boolean()
1372
+ var SetWatchStatusRequestSchema = z14.object({
1373
+ page_id: z14.string(),
1374
+ watching: z14.boolean()
1351
1375
  });
1352
1376
 
1353
1377
  // src/schemas/me.ts
1354
- var LanguageSchema = z14.enum(["en", "ja"]);
1355
- var ThemeSchema = z14.enum(["system", "light", "dark"]);
1356
- var UserProfileResponseSchema = z14.object({
1357
- id: z14.string(),
1358
- username: z14.string(),
1359
- name: z14.string(),
1360
- email: z14.string().email(),
1378
+ var LanguageSchema = z15.enum(["en", "ja"]);
1379
+ var ThemeSchema = z15.enum(["system", "light", "dark"]);
1380
+ var UserProfileResponseSchema = z15.object({
1381
+ id: z15.string(),
1382
+ username: z15.string(),
1383
+ name: z15.string(),
1384
+ email: z15.string().email(),
1361
1385
  lang: LanguageSchema,
1362
1386
  theme: ThemeSchema,
1363
- image: z14.string().nullable(),
1364
- introduction: z14.string().optional(),
1365
- hasPassword: z14.boolean(),
1366
- createdAt: z14.string(),
1387
+ image: z15.string().nullable(),
1388
+ introduction: z15.string().optional(),
1389
+ hasPassword: z15.boolean(),
1390
+ createdAt: z15.string(),
1367
1391
  /**
1368
1392
  * True when the profile update requested a new email that is awaiting
1369
1393
  * confirmation: the stored `email` is unchanged and a confirmation
1370
1394
  * link was sent to the new address.
1371
1395
  */
1372
- emailChangePending: z14.boolean().optional()
1396
+ emailChangePending: z15.boolean().optional()
1373
1397
  });
1374
- var UpdateProfileRequestSchema = z14.object({
1375
- userForm: z14.object({
1376
- name: z14.string().min(1, "Name is required"),
1377
- email: z14.string().email("Invalid email format"),
1398
+ var UpdateProfileRequestSchema = z15.object({
1399
+ userForm: z15.object({
1400
+ name: z15.string().min(1, "Name is required"),
1401
+ email: z15.string().email("Invalid email format"),
1378
1402
  lang: LanguageSchema
1379
1403
  })
1380
1404
  });
1381
- var UpdateThemeRequestSchema = z14.object({
1405
+ var UpdateThemeRequestSchema = z15.object({
1382
1406
  theme: ThemeSchema
1383
1407
  });
1384
- var ThemeUpdateResponseSchema = z14.object({
1385
- status: z14.literal("ok"),
1408
+ var ThemeUpdateResponseSchema = z15.object({
1409
+ status: z15.literal("ok"),
1386
1410
  theme: ThemeSchema
1387
1411
  });
1388
- var PictureUploadResponseSchema = z14.object({
1389
- status: z14.boolean(),
1390
- url: z14.string().optional(),
1391
- message: z14.string().optional()
1412
+ var PictureUploadResponseSchema = z15.object({
1413
+ status: z15.boolean(),
1414
+ url: z15.string().optional(),
1415
+ message: z15.string().optional()
1392
1416
  });
1393
- var SuccessResponseSchema = z14.object({
1394
- status: z14.literal("ok"),
1395
- message: z14.string().optional()
1417
+ var SuccessResponseSchema = z15.object({
1418
+ status: z15.literal("ok"),
1419
+ message: z15.string().optional()
1396
1420
  });
1397
- var ProfileErrorResponseSchema = z14.object({
1398
- status: z14.literal("error"),
1421
+ var ProfileErrorResponseSchema = z15.object({
1422
+ status: z15.literal("error"),
1399
1423
  /** Stable code so the web can localize the message (e.g. EMAIL_TAKEN). */
1400
- code: z14.string().optional(),
1401
- message: z14.string().optional(),
1402
- errors: z14.array(z14.string()).optional()
1424
+ code: z15.string().optional(),
1425
+ message: z15.string().optional(),
1426
+ errors: z15.array(z15.string()).optional()
1403
1427
  });
1404
1428
  var PASSWORD_REGEX = /^(?=.*[a-zA-Z])(?=.*\d)(?=.*[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?`~])[a-zA-Z\d!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?`~]+$/;
1405
- var UpdatePasswordRequestSchema = z14.object({
1406
- oldPassword: z14.string().optional(),
1407
- newPassword: z14.string().min(8, "Password must be at least 8 characters").max(100, "Password must be at most 100 characters").regex(PASSWORD_REGEX, "Password must contain at least one letter, one digit, and one special character"),
1408
- newPasswordConfirm: z14.string()
1429
+ var UpdatePasswordRequestSchema = z15.object({
1430
+ oldPassword: z15.string().optional(),
1431
+ newPassword: z15.string().min(8, "Password must be at least 8 characters").max(100, "Password must be at most 100 characters").regex(PASSWORD_REGEX, "Password must contain at least one letter, one digit, and one special character"),
1432
+ newPasswordConfirm: z15.string()
1409
1433
  }).refine((data) => data.newPassword === data.newPasswordConfirm, {
1410
1434
  message: "Passwords do not match",
1411
1435
  path: ["newPasswordConfirm"]
1412
1436
  });
1413
- var PasswordUpdateSuccessSchema = z14.object({
1414
- status: z14.literal("ok"),
1415
- message: z14.string()
1437
+ var PasswordUpdateSuccessSchema = z15.object({
1438
+ status: z15.literal("ok"),
1439
+ message: z15.string()
1416
1440
  });
1417
- var PasswordErrorResponseSchema = z14.object({
1418
- status: z14.literal("error"),
1419
- message: z14.string(),
1420
- errors: z14.array(z14.string()).optional()
1441
+ var PasswordErrorResponseSchema = z15.object({
1442
+ status: z15.literal("error"),
1443
+ message: z15.string(),
1444
+ errors: z15.array(z15.string()).optional()
1421
1445
  });
1422
- var RecentlyViewedPagesResponseSchema = z14.object({
1423
- pages: z14.array(PageSchema)
1446
+ var RecentlyViewedPagesResponseSchema = z15.object({
1447
+ pages: z15.array(PageSchema)
1424
1448
  });
1425
1449
 
1426
1450
  // src/contracts/me.ts
@@ -1503,8 +1527,8 @@ var uploadPictureRoute = createRoute8({
1503
1527
  body: {
1504
1528
  content: {
1505
1529
  "multipart/form-data": {
1506
- schema: z15.object({
1507
- file: z15.any().optional().describe("Profile picture file")
1530
+ schema: z16.object({
1531
+ file: z16.any().optional().describe("Profile picture file")
1508
1532
  })
1509
1533
  }
1510
1534
  }
@@ -1604,37 +1628,37 @@ var meRoutes = {
1604
1628
  };
1605
1629
 
1606
1630
  // src/contracts/access-token.ts
1607
- import { createRoute as createRoute9, z as z17 } from "@hono/zod-openapi";
1631
+ import { createRoute as createRoute9, z as z18 } from "@hono/zod-openapi";
1608
1632
 
1609
1633
  // src/schemas/access-token.ts
1610
- import { z as z16 } from "@hono/zod-openapi";
1611
- var AccessTokenSchema = z16.object({
1612
- id: z16.string(),
1613
- name: z16.string(),
1614
- scopes: z16.array(z16.string()),
1634
+ import { z as z17 } from "@hono/zod-openapi";
1635
+ var AccessTokenSchema = z17.object({
1636
+ id: z17.string(),
1637
+ name: z17.string(),
1638
+ scopes: z17.array(z17.string()),
1615
1639
  /** ISO-8601 expiry, or `null` for a non-expiring token. */
1616
- expiresAt: z16.string().nullable(),
1640
+ expiresAt: z17.string().nullable(),
1617
1641
  /** ISO-8601 of last successful use, or `null` if never used. */
1618
- lastUsedAt: z16.string().nullable(),
1619
- createdAt: z16.string()
1642
+ lastUsedAt: z17.string().nullable(),
1643
+ createdAt: z17.string()
1620
1644
  });
1621
- var ListAccessTokensResponseSchema = z16.object({
1622
- accessTokens: z16.array(AccessTokenSchema)
1645
+ var ListAccessTokensResponseSchema = z17.object({
1646
+ accessTokens: z17.array(AccessTokenSchema)
1623
1647
  });
1624
- var CreateAccessTokenRequestSchema = z16.object({
1625
- name: z16.string().min(1, "Name is required").max(200),
1626
- scopes: z16.array(z16.string()).min(1, "At least one scope is required"),
1627
- expiresAt: z16.string().datetime().nullable().optional()
1648
+ var CreateAccessTokenRequestSchema = z17.object({
1649
+ name: z17.string().min(1, "Name is required").max(200),
1650
+ scopes: z17.array(z17.string()).min(1, "At least one scope is required"),
1651
+ expiresAt: z17.string().datetime().nullable().optional()
1628
1652
  });
1629
1653
  var CreateAccessTokenResponseSchema = AccessTokenSchema.extend({
1630
- token: z16.string()
1631
- });
1632
- var InvalidScopeErrorSchema = z16.object({
1633
- error: z16.object({
1634
- code: z16.literal("INVALID_SCOPE"),
1635
- message: z16.string(),
1636
- details: z16.object({
1637
- invalidScopes: z16.array(z16.string())
1654
+ token: z17.string()
1655
+ });
1656
+ var InvalidScopeErrorSchema = z17.object({
1657
+ error: z17.object({
1658
+ code: z17.literal("INVALID_SCOPE"),
1659
+ message: z17.string(),
1660
+ details: z17.object({
1661
+ invalidScopes: z17.array(z17.string())
1638
1662
  }).optional()
1639
1663
  })
1640
1664
  });
@@ -1706,7 +1730,7 @@ var deleteAccessTokenRoute = createRoute9({
1706
1730
  security: [{ bearerAuth: [] }],
1707
1731
  summary: "Revoke a personal access token",
1708
1732
  request: {
1709
- params: z17.object({ id: z17.string() })
1733
+ params: z18.object({ id: z18.string() })
1710
1734
  },
1711
1735
  responses: {
1712
1736
  200: {
@@ -1738,13 +1762,13 @@ var accessTokenRoutes = {
1738
1762
  };
1739
1763
 
1740
1764
  // src/contracts/oauth.ts
1741
- import { createRoute as createRoute10, z as z20 } from "@hono/zod-openapi";
1765
+ import { createRoute as createRoute10, z as z21 } from "@hono/zod-openapi";
1742
1766
 
1743
1767
  // src/schemas/oauth-endpoints.ts
1744
- import { z as z19 } from "@hono/zod-openapi";
1768
+ import { z as z20 } from "@hono/zod-openapi";
1745
1769
 
1746
1770
  // src/schemas/oauth.ts
1747
- import { z as z18 } from "@hono/zod-openapi";
1771
+ import { z as z19 } from "@hono/zod-openapi";
1748
1772
  var SCOPES = [
1749
1773
  // umbrella
1750
1774
  "read",
@@ -1812,11 +1836,11 @@ function scopeSatisfies(required, granted) {
1812
1836
  return false;
1813
1837
  }
1814
1838
  var InsufficientScopeErrorSchema = ApiErrorSchema.extend({
1815
- error: z18.object({
1816
- code: z18.literal("INSUFFICIENT_SCOPE"),
1817
- message: z18.string(),
1818
- details: z18.object({
1819
- requiredScope: z18.string()
1839
+ error: z19.object({
1840
+ code: z19.literal("INSUFFICIENT_SCOPE"),
1841
+ message: z19.string(),
1842
+ details: z19.object({
1843
+ requiredScope: z19.string()
1820
1844
  }).optional()
1821
1845
  })
1822
1846
  });
@@ -1835,91 +1859,91 @@ var OAUTH_ERROR_CODES = [
1835
1859
  "slow_down",
1836
1860
  "expired_token"
1837
1861
  ];
1838
- var OAuthErrorSchema = z19.object({
1839
- error: z19.enum(OAUTH_ERROR_CODES),
1840
- error_description: z19.string().optional()
1841
- });
1842
- var AuthorizeRequestSchema = z19.object({
1843
- client_id: z19.string().min(1),
1844
- redirect_uri: z19.string().min(1),
1845
- scope: z19.string().min(1),
1846
- code_challenge: z19.string().min(1),
1847
- code_challenge_method: z19.literal("S256"),
1848
- state: z19.string().optional()
1849
- });
1850
- var AuthorizeResponseSchema = z19.object({
1851
- redirectUri: z19.string()
1852
- });
1853
- var TokenRequestSchema = z19.discriminatedUnion("grant_type", [
1854
- z19.object({
1855
- grant_type: z19.literal("authorization_code"),
1856
- code: z19.string().min(1),
1857
- code_verifier: z19.string().min(1),
1858
- redirect_uri: z19.string().min(1),
1859
- client_id: z19.string().min(1)
1862
+ var OAuthErrorSchema = z20.object({
1863
+ error: z20.enum(OAUTH_ERROR_CODES),
1864
+ error_description: z20.string().optional()
1865
+ });
1866
+ var AuthorizeRequestSchema = z20.object({
1867
+ client_id: z20.string().min(1),
1868
+ redirect_uri: z20.string().min(1),
1869
+ scope: z20.string().min(1),
1870
+ code_challenge: z20.string().min(1),
1871
+ code_challenge_method: z20.literal("S256"),
1872
+ state: z20.string().optional()
1873
+ });
1874
+ var AuthorizeResponseSchema = z20.object({
1875
+ redirectUri: z20.string()
1876
+ });
1877
+ var TokenRequestSchema = z20.discriminatedUnion("grant_type", [
1878
+ z20.object({
1879
+ grant_type: z20.literal("authorization_code"),
1880
+ code: z20.string().min(1),
1881
+ code_verifier: z20.string().min(1),
1882
+ redirect_uri: z20.string().min(1),
1883
+ client_id: z20.string().min(1)
1860
1884
  }),
1861
- z19.object({
1862
- grant_type: z19.literal("refresh_token"),
1863
- refresh_token: z19.string().min(1),
1864
- client_id: z19.string().min(1),
1865
- scope: z19.string().optional()
1885
+ z20.object({
1886
+ grant_type: z20.literal("refresh_token"),
1887
+ refresh_token: z20.string().min(1),
1888
+ client_id: z20.string().min(1),
1889
+ scope: z20.string().optional()
1866
1890
  }),
1867
1891
  // RFC 8628 §3.4 — device authorization grant. The client polls with the
1868
1892
  // opaque `device_code` returned by `/oauth/device/authorize`.
1869
- z19.object({
1870
- grant_type: z19.literal("urn:ietf:params:oauth:grant-type:device_code"),
1871
- device_code: z19.string().min(1),
1872
- client_id: z19.string().min(1)
1893
+ z20.object({
1894
+ grant_type: z20.literal("urn:ietf:params:oauth:grant-type:device_code"),
1895
+ device_code: z20.string().min(1),
1896
+ client_id: z20.string().min(1)
1873
1897
  })
1874
1898
  ]);
1875
1899
  var DEVICE_CODE_GRANT_TYPE = "urn:ietf:params:oauth:grant-type:device_code";
1876
- var TokenResponseSchema = z19.object({
1877
- access_token: z19.string(),
1878
- token_type: z19.literal("Bearer"),
1879
- expires_in: z19.number(),
1880
- refresh_token: z19.string(),
1881
- scope: z19.string()
1882
- });
1883
- var RevokeRequestSchema = z19.object({
1884
- token: z19.string().min(1),
1885
- token_type_hint: z19.string().optional()
1886
- });
1887
- var RevokeResponseSchema = z19.object({});
1888
- var DeviceAuthorizeRequestSchema = z19.object({
1889
- client_id: z19.string().min(1),
1890
- scope: z19.string().min(1)
1891
- });
1892
- var DeviceAuthorizeResponseSchema = z19.object({
1893
- device_code: z19.string(),
1894
- user_code: z19.string(),
1895
- verification_uri: z19.string(),
1896
- verification_uri_complete: z19.string(),
1897
- expires_in: z19.number(),
1898
- interval: z19.number()
1899
- });
1900
- var DeviceVerifyRequestSchema = z19.object({
1901
- user_code: z19.string().min(1),
1902
- action: z19.enum(["approve", "deny"])
1903
- });
1904
- var DeviceVerifyResponseSchema = z19.object({
1905
- status: z19.enum(["approved", "denied"])
1906
- });
1907
- var DeviceInfoResponseSchema = z19.object({
1908
- client_id: z19.string(),
1909
- scopes: z19.array(z19.string())
1900
+ var TokenResponseSchema = z20.object({
1901
+ access_token: z20.string(),
1902
+ token_type: z20.literal("Bearer"),
1903
+ expires_in: z20.number(),
1904
+ refresh_token: z20.string(),
1905
+ scope: z20.string()
1906
+ });
1907
+ var RevokeRequestSchema = z20.object({
1908
+ token: z20.string().min(1),
1909
+ token_type_hint: z20.string().optional()
1910
+ });
1911
+ var RevokeResponseSchema = z20.object({});
1912
+ var DeviceAuthorizeRequestSchema = z20.object({
1913
+ client_id: z20.string().min(1),
1914
+ scope: z20.string().min(1)
1915
+ });
1916
+ var DeviceAuthorizeResponseSchema = z20.object({
1917
+ device_code: z20.string(),
1918
+ user_code: z20.string(),
1919
+ verification_uri: z20.string(),
1920
+ verification_uri_complete: z20.string(),
1921
+ expires_in: z20.number(),
1922
+ interval: z20.number()
1923
+ });
1924
+ var DeviceVerifyRequestSchema = z20.object({
1925
+ user_code: z20.string().min(1),
1926
+ action: z20.enum(["approve", "deny"])
1927
+ });
1928
+ var DeviceVerifyResponseSchema = z20.object({
1929
+ status: z20.enum(["approved", "denied"])
1930
+ });
1931
+ var DeviceInfoResponseSchema = z20.object({
1932
+ client_id: z20.string(),
1933
+ scopes: z20.array(z20.string())
1910
1934
  });
1911
1935
  var GRANT_TYPES_SUPPORTED = ["authorization_code", "refresh_token", DEVICE_CODE_GRANT_TYPE];
1912
- var DiscoveryResponseSchema = z19.object({
1913
- issuer: z19.string(),
1914
- authorization_endpoint: z19.string(),
1915
- token_endpoint: z19.string(),
1916
- revocation_endpoint: z19.string(),
1917
- device_authorization_endpoint: z19.string().optional(),
1918
- scopes_supported: z19.array(z19.string()),
1919
- response_types_supported: z19.array(z19.string()),
1920
- grant_types_supported: z19.array(z19.string()),
1921
- code_challenge_methods_supported: z19.array(z19.string()),
1922
- token_endpoint_auth_methods_supported: z19.array(z19.string())
1936
+ var DiscoveryResponseSchema = z20.object({
1937
+ issuer: z20.string(),
1938
+ authorization_endpoint: z20.string(),
1939
+ token_endpoint: z20.string(),
1940
+ revocation_endpoint: z20.string(),
1941
+ device_authorization_endpoint: z20.string().optional(),
1942
+ scopes_supported: z20.array(z20.string()),
1943
+ response_types_supported: z20.array(z20.string()),
1944
+ grant_types_supported: z20.array(z20.string()),
1945
+ code_challenge_methods_supported: z20.array(z20.string()),
1946
+ token_endpoint_auth_methods_supported: z20.array(z20.string())
1923
1947
  });
1924
1948
  var DISCOVERY_SCOPES_SUPPORTED = ISSUABLE_SCOPES;
1925
1949
 
@@ -2055,7 +2079,7 @@ var deviceInfoRoute = createRoute10({
2055
2079
  // scopes so the web consent screen can show them before approval. Reveals
2056
2080
  // no secret. Unknown / expired / non-pending → 404 (PHASE4-Q9 option A).
2057
2081
  request: {
2058
- query: z20.object({ user_code: z20.string().min(1) })
2082
+ query: z21.object({ user_code: z21.string().min(1) })
2059
2083
  },
2060
2084
  responses: {
2061
2085
  200: {
@@ -2109,94 +2133,94 @@ var oauthRoutes = {
2109
2133
  };
2110
2134
 
2111
2135
  // src/contracts/user.ts
2112
- import { createRoute as createRoute11, z as z23 } from "@hono/zod-openapi";
2136
+ import { createRoute as createRoute11, z as z24 } from "@hono/zod-openapi";
2113
2137
 
2114
2138
  // src/schemas/user.ts
2115
- import { z as z22 } from "@hono/zod-openapi";
2139
+ import { z as z23 } from "@hono/zod-openapi";
2116
2140
 
2117
2141
  // src/schemas/bookmark.ts
2118
- import { z as z21 } from "@hono/zod-openapi";
2119
- var BookmarkSchema = z21.object({
2120
- _id: z21.string(),
2142
+ import { z as z22 } from "@hono/zod-openapi";
2143
+ var BookmarkSchema = z22.object({
2144
+ _id: z22.string(),
2121
2145
  page: PageSchema,
2122
- user: z21.union([z21.string(), UserPublicSchema]),
2123
- createdAt: z21.string()
2146
+ user: z22.union([z22.string(), UserPublicSchema]),
2147
+ createdAt: z22.string()
2124
2148
  });
2125
- var GetBookmarkRequestSchema = z21.object({
2126
- page_id: z21.string()
2149
+ var GetBookmarkRequestSchema = z22.object({
2150
+ page_id: z22.string()
2127
2151
  });
2128
- var BookmarkResponseSchema = z21.object({
2152
+ var BookmarkResponseSchema = z22.object({
2129
2153
  bookmark: BookmarkSchema.nullable()
2130
2154
  });
2131
- var ListMyBookmarksResponseSchema = z21.object({
2132
- bookmarks: z21.array(BookmarkSchema),
2155
+ var ListMyBookmarksResponseSchema = z22.object({
2156
+ bookmarks: z22.array(BookmarkSchema),
2133
2157
  pager: PagerSchema,
2134
- total: z21.number()
2158
+ total: z22.number()
2135
2159
  });
2136
- var AddBookmarkRequestSchema = z21.object({
2137
- page_id: z21.string()
2160
+ var AddBookmarkRequestSchema = z22.object({
2161
+ page_id: z22.string()
2138
2162
  });
2139
- var RemoveBookmarkRequestSchema = z21.object({
2140
- page_id: z21.string()
2163
+ var RemoveBookmarkRequestSchema = z22.object({
2164
+ page_id: z22.string()
2141
2165
  });
2142
- var RemoveBookmarkResponseSchema = z21.object({
2143
- ok: z21.literal(true)
2166
+ var RemoveBookmarkResponseSchema = z22.object({
2167
+ ok: z22.literal(true)
2144
2168
  });
2145
2169
 
2146
2170
  // src/schemas/user.ts
2147
- var UserStatusSchema = z22.enum(["1", "2", "3", "4", "5"]).transform((val) => Number(val));
2171
+ var UserStatusSchema = z23.enum(["1", "2", "3", "4", "5"]).transform((val) => Number(val));
2148
2172
  var UserStatusEnum = UserPublicStatus;
2149
- var UserLanguageSchema = z22.enum(["en", "ja"]);
2150
- var PaginationRequestSchema = z22.object({
2151
- limit: z22.coerce.number().optional().default(50),
2152
- offset: z22.coerce.number().optional().default(0)
2153
- });
2154
- var UserListItemSchema = z22.object({
2155
- _id: z22.string(),
2156
- username: z22.string(),
2157
- name: z22.string(),
2158
- image: z22.string().nullable().optional()
2159
- });
2160
- var ListUsersRequestSchema = z22.object({
2161
- q: z22.string().optional(),
2173
+ var UserLanguageSchema = z23.enum(["en", "ja"]);
2174
+ var PaginationRequestSchema = z23.object({
2175
+ limit: z23.coerce.number().optional().default(50),
2176
+ offset: z23.coerce.number().optional().default(0)
2177
+ });
2178
+ var UserListItemSchema = z23.object({
2179
+ _id: z23.string(),
2180
+ username: z23.string(),
2181
+ name: z23.string(),
2182
+ image: z23.string().nullable().optional()
2183
+ });
2184
+ var ListUsersRequestSchema = z23.object({
2185
+ q: z23.string().optional(),
2162
2186
  // Cap the page size so a client can't request the whole user table in one
2163
2187
  // unbounded find+sort (mirrors the page-list `limit` guard).
2164
- limit: z22.coerce.number().int().min(1).max(100).optional().default(24),
2165
- offset: z22.coerce.number().int().min(0).optional().default(0)
2188
+ limit: z23.coerce.number().int().min(1).max(100).optional().default(24),
2189
+ offset: z23.coerce.number().int().min(0).optional().default(0)
2166
2190
  });
2167
- var ListUsersResponseSchema = z22.object({
2168
- users: z22.array(UserListItemSchema),
2191
+ var ListUsersResponseSchema = z23.object({
2192
+ users: z23.array(UserListItemSchema),
2169
2193
  pager: PagerSchema,
2170
- total: z22.number()
2194
+ total: z23.number()
2171
2195
  });
2172
- var UserPageResponseSchema = z22.object({
2196
+ var UserPageResponseSchema = z23.object({
2173
2197
  user: UserPublicSchema,
2174
2198
  // Page statistics
2175
- createdPagesCount: z22.number(),
2176
- bookmarksCount: z22.number(),
2199
+ createdPagesCount: z23.number(),
2200
+ bookmarksCount: z23.number(),
2177
2201
  // Optionally include recent items for initial display
2178
- recentPages: z22.array(PageSchema).optional(),
2179
- recentBookmarks: z22.array(BookmarkSchema).optional()
2202
+ recentPages: z23.array(PageSchema).optional(),
2203
+ recentBookmarks: z23.array(BookmarkSchema).optional()
2180
2204
  });
2181
- var UserBookmarksResponseSchema = z22.object({
2182
- bookmarks: z22.array(BookmarkSchema),
2205
+ var UserBookmarksResponseSchema = z23.object({
2206
+ bookmarks: z23.array(BookmarkSchema),
2183
2207
  pager: PagerSchema,
2184
- total: z22.number()
2208
+ total: z23.number()
2185
2209
  });
2186
- var UserPagesResponseSchema = z22.object({
2187
- pages: z22.array(PageSchema),
2210
+ var UserPagesResponseSchema = z23.object({
2211
+ pages: z23.array(PageSchema),
2188
2212
  pager: PagerSchema,
2189
- total: z22.number()
2213
+ total: z23.number()
2190
2214
  });
2191
- var UserNotFoundErrorSchema = z22.object({
2192
- error: z22.object({
2193
- code: z22.literal("USER_NOT_FOUND"),
2194
- message: z22.literal("User not found")
2215
+ var UserNotFoundErrorSchema = z23.object({
2216
+ error: z23.object({
2217
+ code: z23.literal("USER_NOT_FOUND"),
2218
+ message: z23.literal("User not found")
2195
2219
  })
2196
2220
  });
2197
2221
 
2198
2222
  // src/contracts/user.ts
2199
- var UsernameParamSchema = z23.object({ username: z23.string() });
2223
+ var UsernameParamSchema = z24.object({ username: z24.string() });
2200
2224
  var getUserPageRoute = createRoute11({
2201
2225
  method: "get",
2202
2226
  path: "/user/{username}",
@@ -2439,34 +2463,34 @@ var bookmarkRoutes = {
2439
2463
  import { createRoute as createRoute13 } from "@hono/zod-openapi";
2440
2464
 
2441
2465
  // src/schemas/backlink.ts
2442
- import { z as z24 } from "@hono/zod-openapi";
2443
- var ObjectIdString = z24.string().regex(/^[0-9a-f]{24}$/, "Invalid ObjectId");
2444
- var BacklinkFromPageSchema = z24.object({
2445
- _id: z24.string(),
2446
- path: z24.string()
2447
- });
2448
- var BacklinkFromRevisionSchema = z24.object({
2449
- _id: z24.string(),
2466
+ import { z as z25 } from "@hono/zod-openapi";
2467
+ var ObjectIdString = z25.string().regex(/^[0-9a-f]{24}$/, "Invalid ObjectId");
2468
+ var BacklinkFromPageSchema = z25.object({
2469
+ _id: z25.string(),
2470
+ path: z25.string()
2471
+ });
2472
+ var BacklinkFromRevisionSchema = z25.object({
2473
+ _id: z25.string(),
2450
2474
  author: UserPublicSchema.nullable().optional()
2451
2475
  });
2452
- var BacklinkSchema = z24.object({
2453
- _id: z24.string(),
2476
+ var BacklinkSchema = z25.object({
2477
+ _id: z25.string(),
2454
2478
  // The destination page's id (the page being linked TO). Always the
2455
2479
  // page passed in the request, but echoed for cache-key parity with the
2456
2480
  // legacy response.
2457
- page: z24.string(),
2481
+ page: z25.string(),
2458
2482
  fromPage: BacklinkFromPageSchema,
2459
2483
  fromRevision: BacklinkFromRevisionSchema,
2460
- updatedAt: z24.string()
2484
+ updatedAt: z25.string()
2461
2485
  });
2462
- var GetBacklinksRequestSchema = z24.object({
2486
+ var GetBacklinksRequestSchema = z25.object({
2463
2487
  page_id: ObjectIdString,
2464
- limit: z24.coerce.number().int().min(1).max(100).optional().default(20),
2465
- offset: z24.coerce.number().int().min(0).optional().default(0)
2488
+ limit: z25.coerce.number().int().min(1).max(100).optional().default(20),
2489
+ offset: z25.coerce.number().int().min(0).optional().default(0)
2466
2490
  });
2467
- var GetBacklinksResponseSchema = z24.object({
2468
- backlinks: z24.array(BacklinkSchema),
2469
- hasNext: z24.boolean()
2491
+ var GetBacklinksResponseSchema = z25.object({
2492
+ backlinks: z25.array(BacklinkSchema),
2493
+ hasNext: z25.boolean()
2470
2494
  });
2471
2495
 
2472
2496
  // src/contracts/backlink.ts
@@ -2491,6 +2515,10 @@ var getBacklinksRoute = createRoute13({
2491
2515
  401: {
2492
2516
  description: "Authentication required",
2493
2517
  content: { "application/json": { schema: AuthenticationRequiredErrorSchema } }
2518
+ },
2519
+ 404: {
2520
+ description: "Page not found or not granted",
2521
+ content: { "application/json": { schema: PageNotFoundErrorSchema } }
2494
2522
  }
2495
2523
  }
2496
2524
  });
@@ -2502,51 +2530,51 @@ var backlinkRoutes = {
2502
2530
  import { createRoute as createRoute14 } from "@hono/zod-openapi";
2503
2531
 
2504
2532
  // src/schemas/comment.ts
2505
- import { z as z25 } from "@hono/zod-openapi";
2506
- var CommentSchema = z25.object({
2507
- _id: z25.string(),
2508
- page: z25.string(),
2533
+ import { z as z26 } from "@hono/zod-openapi";
2534
+ var CommentSchema = z26.object({
2535
+ _id: z26.string(),
2536
+ page: z26.string(),
2509
2537
  // creator is populated to a user object on the API side; allow string fallback for safety
2510
- creator: z25.union([z25.string(), PageUserSchema]).nullable(),
2511
- revision: z25.string(),
2512
- comment: z25.string(),
2513
- commentPosition: z25.number().default(-1),
2514
- createdAt: z25.string()
2515
- });
2516
- var ListCommentsRequestSchema = z25.object({
2517
- page_id: z25.string().optional(),
2518
- revision_id: z25.string().optional()
2519
- });
2520
- var ListCommentsResponseSchema = z25.object({
2521
- comments: z25.array(CommentSchema)
2522
- });
2523
- var AddCommentRequestSchema = z25.object({
2524
- page_id: z25.string().min(1, "page_id is required"),
2525
- revision_id: z25.string().min(1, "revision_id is required"),
2526
- comment: z25.string().min(1, "comment is required"),
2527
- comment_position: z25.number().int().optional()
2528
- });
2529
- var AddCommentResponseSchema = z25.object({
2538
+ creator: z26.union([z26.string(), PageUserSchema]).nullable(),
2539
+ revision: z26.string(),
2540
+ comment: z26.string(),
2541
+ commentPosition: z26.number().default(-1),
2542
+ createdAt: z26.string()
2543
+ });
2544
+ var ListCommentsRequestSchema = z26.object({
2545
+ page_id: z26.string().optional(),
2546
+ revision_id: z26.string().optional()
2547
+ });
2548
+ var ListCommentsResponseSchema = z26.object({
2549
+ comments: z26.array(CommentSchema)
2550
+ });
2551
+ var AddCommentRequestSchema = z26.object({
2552
+ page_id: z26.string().min(1, "page_id is required"),
2553
+ revision_id: z26.string().min(1, "revision_id is required"),
2554
+ comment: z26.string().min(1, "comment is required"),
2555
+ comment_position: z26.number().int().optional()
2556
+ });
2557
+ var AddCommentResponseSchema = z26.object({
2530
2558
  comment: CommentSchema,
2531
- newlyWatching: z25.boolean()
2559
+ newlyWatching: z26.boolean()
2532
2560
  });
2533
- var DeleteCommentRequestSchema = z25.object({
2534
- comment_id: z25.string().min(1, "comment_id is required"),
2535
- page_id: z25.string().min(1, "page_id is required")
2561
+ var DeleteCommentRequestSchema = z26.object({
2562
+ comment_id: z26.string().min(1, "comment_id is required"),
2563
+ page_id: z26.string().min(1, "page_id is required")
2536
2564
  });
2537
- var DeleteCommentResponseSchema = z25.object({
2538
- ok: z25.literal(true)
2565
+ var DeleteCommentResponseSchema = z26.object({
2566
+ ok: z26.literal(true)
2539
2567
  });
2540
- var CommentNotFoundErrorSchema = z25.object({
2541
- error: z25.object({
2542
- code: z25.literal("COMMENT_NOT_FOUND"),
2543
- message: z25.literal("Comment not found")
2568
+ var CommentNotFoundErrorSchema = z26.object({
2569
+ error: z26.object({
2570
+ code: z26.literal("COMMENT_NOT_FOUND"),
2571
+ message: z26.literal("Comment not found")
2544
2572
  })
2545
2573
  });
2546
- var CommentInvalidRequestErrorSchema = z25.object({
2547
- error: z25.object({
2548
- code: z25.literal("INVALID_REQUEST"),
2549
- message: z25.string()
2574
+ var CommentInvalidRequestErrorSchema = z26.object({
2575
+ error: z26.object({
2576
+ code: z26.literal("INVALID_REQUEST"),
2577
+ message: z26.string()
2550
2578
  })
2551
2579
  });
2552
2580
 
@@ -2650,49 +2678,49 @@ var commentRoutes = {
2650
2678
  };
2651
2679
 
2652
2680
  // src/contracts/revision.ts
2653
- import { createRoute as createRoute15, z as z27 } from "@hono/zod-openapi";
2681
+ import { createRoute as createRoute15, z as z28 } from "@hono/zod-openapi";
2654
2682
 
2655
2683
  // src/schemas/revision.ts
2656
- import { z as z26 } from "@hono/zod-openapi";
2657
- var RevisionMetaSchema = z26.object({
2658
- _id: z26.string(),
2659
- path: z26.string(),
2684
+ import { z as z27 } from "@hono/zod-openapi";
2685
+ var RevisionMetaSchema = z27.object({
2686
+ _id: z27.string(),
2687
+ path: z27.string(),
2660
2688
  author: PageUserSchema.nullable().optional(),
2661
2689
  savedBy: PageUserSchema.nullable().optional(),
2662
- contributors: z26.array(PageUserSchema).optional(),
2690
+ contributors: z27.array(PageUserSchema).optional(),
2663
2691
  // RFC-0010 — edit channel. `web` (browser / collab editor) vs the API
2664
2692
  // token paths (`oauth` / `pat`). Absent on pre-RFC-0010 revisions. The
2665
2693
  // history UI shows an "app" chip for the token paths.
2666
- editVia: z26.enum(["web", "oauth", "pat"]).optional(),
2667
- createdAt: z26.string()
2694
+ editVia: z27.enum(["web", "oauth", "pat"]).optional(),
2695
+ createdAt: z27.string()
2668
2696
  });
2669
- var ListRevisionsRequestSchema = z26.object({
2670
- limit: z26.coerce.number().int().positive().max(200).optional().default(50),
2671
- offset: z26.coerce.number().int().min(0).optional().default(0)
2697
+ var ListRevisionsRequestSchema = z27.object({
2698
+ limit: z27.coerce.number().int().positive().max(200).optional().default(50),
2699
+ offset: z27.coerce.number().int().min(0).optional().default(0)
2672
2700
  });
2673
- var ListRevisionsResponseSchema = z26.object({
2674
- revisions: z26.array(RevisionMetaSchema),
2701
+ var ListRevisionsResponseSchema = z27.object({
2702
+ revisions: z27.array(RevisionMetaSchema),
2675
2703
  pager: PagerSchema
2676
2704
  });
2677
- var GetRevisionResponseSchema = z26.object({
2705
+ var GetRevisionResponseSchema = z27.object({
2678
2706
  revision: RevisionSchema
2679
2707
  });
2680
- var GetRevisionsRequestSchema = z26.object({
2681
- ids: z26.string().min(1, "ids is required")
2708
+ var GetRevisionsRequestSchema = z27.object({
2709
+ ids: z27.string().min(1, "ids is required")
2682
2710
  });
2683
- var GetRevisionsResponseSchema = z26.object({
2684
- revisions: z26.array(RevisionSchema)
2711
+ var GetRevisionsResponseSchema = z27.object({
2712
+ revisions: z27.array(RevisionSchema)
2685
2713
  });
2686
- var RevisionInvalidRequestErrorSchema = z26.object({
2687
- error: z26.object({
2688
- code: z26.literal("INVALID_REQUEST"),
2689
- message: z26.string()
2714
+ var RevisionInvalidRequestErrorSchema = z27.object({
2715
+ error: z27.object({
2716
+ code: z27.literal("INVALID_REQUEST"),
2717
+ message: z27.string()
2690
2718
  })
2691
2719
  });
2692
2720
 
2693
2721
  // src/contracts/revision.ts
2694
- var PageIdParamSchema = z27.object({ page_id: z27.string() });
2695
- var RevisionIdParamSchema = z27.object({ id: z27.string() });
2722
+ var PageIdParamSchema = z28.object({ page_id: z28.string() });
2723
+ var RevisionIdParamSchema = z28.object({ id: z28.string() });
2696
2724
  var listRevisionsRoute = createRoute15({
2697
2725
  method: "get",
2698
2726
  path: "/pages/{page_id}/revisions",
@@ -2788,24 +2816,24 @@ var revisionRoutes = {
2788
2816
  };
2789
2817
 
2790
2818
  // src/contracts/notification.ts
2791
- import { createRoute as createRoute16, z as z29 } from "@hono/zod-openapi";
2819
+ import { createRoute as createRoute16, z as z30 } from "@hono/zod-openapi";
2792
2820
 
2793
2821
  // src/schemas/notification.ts
2794
- import { z as z28 } from "@hono/zod-openapi";
2795
- var NotificationStatusSchema = z28.enum(["UNREAD", "UNOPENED", "OPENED"]);
2822
+ import { z as z29 } from "@hono/zod-openapi";
2823
+ var NotificationStatusSchema = z29.enum(["UNREAD", "UNOPENED", "OPENED"]);
2796
2824
  var NotificationStatusEnum = {
2797
2825
  UNREAD: "UNREAD",
2798
2826
  UNOPENED: "UNOPENED",
2799
2827
  OPENED: "OPENED"
2800
2828
  };
2801
- var NotificationActionSchema = z28.enum(["COMMENT", "LIKE", "MENTION", "UPDATE"]);
2829
+ var NotificationActionSchema = z29.enum(["COMMENT", "LIKE", "MENTION", "UPDATE"]);
2802
2830
  var NotificationActionEnum = {
2803
2831
  COMMENT: "COMMENT",
2804
2832
  LIKE: "LIKE",
2805
2833
  MENTION: "MENTION",
2806
2834
  UPDATE: "UPDATE"
2807
2835
  };
2808
- var NotificationTargetModelSchema = z28.enum(["Page"]);
2836
+ var NotificationTargetModelSchema = z29.enum(["Page"]);
2809
2837
  var NotificationTargetModelEnum = {
2810
2838
  PAGE: "Page"
2811
2839
  };
@@ -2814,68 +2842,68 @@ var PageRefSchema = PageSchema.pick({
2814
2842
  path: true,
2815
2843
  status: true
2816
2844
  });
2817
- var NotificationSchema = z28.object({
2818
- _id: z28.string(),
2819
- user: z28.string(),
2845
+ var NotificationSchema = z29.object({
2846
+ _id: z29.string(),
2847
+ user: z29.string(),
2820
2848
  targetModel: NotificationTargetModelSchema,
2821
2849
  target: PageRefSchema,
2822
2850
  action: NotificationActionSchema,
2823
2851
  status: NotificationStatusSchema,
2824
- actionUsers: z28.array(UserPublicSchema),
2825
- createdAt: z28.string()
2852
+ actionUsers: z29.array(UserPublicSchema),
2853
+ createdAt: z29.string()
2826
2854
  });
2827
- var ListNotificationsRequestSchema = z28.object({
2828
- limit: z28.coerce.number().optional().default(10),
2829
- offset: z28.coerce.number().optional().default(0)
2855
+ var ListNotificationsRequestSchema = z29.object({
2856
+ limit: z29.coerce.number().optional().default(10),
2857
+ offset: z29.coerce.number().optional().default(0)
2830
2858
  });
2831
- var ListNotificationsResponseSchema = z28.object({
2832
- notifications: z28.array(NotificationSchema),
2859
+ var ListNotificationsResponseSchema = z29.object({
2860
+ notifications: z29.array(NotificationSchema),
2833
2861
  pager: PagerSchema
2834
2862
  });
2835
- var MarkAllAsReadResponseSchema = z28.object({
2836
- ok: z28.literal(true)
2863
+ var MarkAllAsReadResponseSchema = z29.object({
2864
+ ok: z29.literal(true)
2837
2865
  });
2838
- var OpenNotificationParamSchema = z28.object({
2839
- id: z28.string()
2866
+ var OpenNotificationParamSchema = z29.object({
2867
+ id: z29.string()
2840
2868
  });
2841
- var OpenNotificationResponseSchema = z28.object({
2869
+ var OpenNotificationResponseSchema = z29.object({
2842
2870
  notification: NotificationSchema
2843
2871
  });
2844
- var NotificationStatusResponseSchema = z28.object({
2845
- count: z28.number()
2872
+ var NotificationStatusResponseSchema = z29.object({
2873
+ count: z29.number()
2846
2874
  });
2847
- var NotificationNotFoundErrorSchema = z28.object({
2848
- error: z28.object({
2849
- code: z28.literal("NOTIFICATION_NOT_FOUND"),
2850
- message: z28.literal("Notification not found")
2875
+ var NotificationNotFoundErrorSchema = z29.object({
2876
+ error: z29.object({
2877
+ code: z29.literal("NOTIFICATION_NOT_FOUND"),
2878
+ message: z29.literal("Notification not found")
2851
2879
  })
2852
2880
  });
2853
- var NotificationsTokenResponseSchema = z28.object({
2854
- token: z28.string(),
2855
- selfUserId: z28.string(),
2856
- expiresAt: z28.string()
2881
+ var NotificationsTokenResponseSchema = z29.object({
2882
+ token: z29.string(),
2883
+ selfUserId: z29.string(),
2884
+ expiresAt: z29.string()
2857
2885
  });
2858
- var NotificationsTokenPayloadSchema = z28.object({
2859
- selfUserId: z28.string(),
2886
+ var NotificationsTokenPayloadSchema = z29.object({
2887
+ selfUserId: z29.string(),
2860
2888
  // Random UUID mixed into every signed token so two tokens minted
2861
2889
  // within the same second still produce byte-different JWT strings.
2862
2890
  // The browser uses the token as a React effect dependency to drive
2863
2891
  // the WebSocket reconnect — without `jti`, the iat/exp pair is
2864
2892
  // identical at second granularity and the dep stays stable.
2865
- jti: z28.string().uuid(),
2866
- iat: z28.number().int(),
2867
- exp: z28.number().int()
2893
+ jti: z29.string().uuid(),
2894
+ iat: z29.number().int(),
2895
+ exp: z29.number().int()
2868
2896
  });
2869
- var NotificationsChangedMessageSchema = z28.object({
2870
- type: z28.literal("changed")
2897
+ var NotificationsChangedMessageSchema = z29.object({
2898
+ type: z29.literal("changed")
2871
2899
  });
2872
2900
  var NotificationsServerMessageSchema = NotificationsChangedMessageSchema;
2873
2901
 
2874
2902
  // src/contracts/notification.ts
2875
- var NotificationInvalidRequestErrorSchema = z29.object({
2876
- error: z29.object({
2877
- code: z29.literal("INVALID_REQUEST"),
2878
- message: z29.string()
2903
+ var NotificationInvalidRequestErrorSchema = z30.object({
2904
+ error: z30.object({
2905
+ code: z30.literal("INVALID_REQUEST"),
2906
+ message: z30.string()
2879
2907
  })
2880
2908
  });
2881
2909
  var listNotificationsRoute = createRoute16({
@@ -3011,25 +3039,59 @@ var notificationRoutes = {
3011
3039
  };
3012
3040
 
3013
3041
  // src/contracts/page.ts
3014
- import { createRoute as createRoute17, z as z30 } from "@hono/zod-openapi";
3015
- var PageBadRequestErrorSchema = z30.object({
3016
- error: z30.object({
3017
- code: z30.string(),
3018
- message: z30.string()
3042
+ import { createRoute as createRoute17, z as z32 } from "@hono/zod-openapi";
3043
+
3044
+ // src/schemas/autocomplete.ts
3045
+ import { z as z31 } from "@hono/zod-openapi";
3046
+ var AutocompleteRequestSchema = z31.object({
3047
+ q: z31.string().min(1).max(128),
3048
+ limit: z31.coerce.number().int().min(1).max(25).optional().default(10),
3049
+ /**
3050
+ * How `q` is matched against the candidate text. `'substring'` (the
3051
+ * default, used by the editor's `@mention` / `[[wikilink]]` pickers)
3052
+ * keeps the historical anywhere-in-string match. `'prefix'` anchors
3053
+ * the match at the start — used by the "create page" modal, where the
3054
+ * user is building a `/`-rooted path and only true prefixes are valid
3055
+ * completions of what they have typed so far.
3056
+ */
3057
+ anchor: z31.enum(["substring", "prefix"]).optional().default("substring")
3058
+ });
3059
+ var AutocompleteResultSchema = z31.object({
3060
+ id: z31.string(),
3061
+ label: z31.string(),
3062
+ display: z31.string(),
3063
+ avatar: z31.string().nullable().optional(),
3064
+ modifiedAt: z31.string().nullable().optional(),
3065
+ score: z31.number()
3066
+ });
3067
+ var AutocompleteResponseSchema = z31.object({
3068
+ results: z31.array(AutocompleteResultSchema)
3069
+ });
3070
+ var AutocompleteRateLimitErrorSchema = z31.object({
3071
+ error: z31.literal("rate_limited"),
3072
+ message: z31.string(),
3073
+ retryAfterSeconds: z31.number()
3074
+ });
3075
+
3076
+ // src/contracts/page.ts
3077
+ var PageBadRequestErrorSchema = z32.object({
3078
+ error: z32.object({
3079
+ code: z32.string(),
3080
+ message: z32.string()
3019
3081
  })
3020
3082
  });
3021
- var DeletePageRequestSchema = z30.object({
3022
- page_id: z30.string(),
3023
- revision_id: z30.string().optional(),
3024
- completely: z30.boolean().optional()
3083
+ var DeletePageRequestSchema = z32.object({
3084
+ page_id: z32.string(),
3085
+ revision_id: z32.string().optional(),
3086
+ completely: z32.boolean().optional()
3025
3087
  });
3026
- var RevertDeletedPageRequestSchema = z30.object({
3027
- page_id: z30.string()
3088
+ var RevertDeletedPageRequestSchema = z32.object({
3089
+ page_id: z32.string()
3028
3090
  });
3029
- var PageIdBodySchema = z30.object({
3030
- page_id: z30.string()
3091
+ var PageIdBodySchema = z32.object({
3092
+ page_id: z32.string()
3031
3093
  });
3032
- var PageResponseSchema = z30.object({ page: PageSchema });
3094
+ var PageResponseSchema = z32.object({ page: PageSchema });
3033
3095
  var getPageRoute = createRoute17({
3034
3096
  method: "get",
3035
3097
  path: "/pages",
@@ -3055,6 +3117,15 @@ var getPageRoute = createRoute17({
3055
3117
  404: {
3056
3118
  description: "Page not found",
3057
3119
  content: { "application/json": { schema: PageNotFoundErrorSchema } }
3120
+ },
3121
+ // feature-live-page-sync-reconcile — separates a genuine unknown-error
3122
+ // 500 (e.g. a transient render-artifact / renderer failure) from the
3123
+ // not-found/not-granted 404/403 branches above, so a reconcile head-GET
3124
+ // can tell "page is really gone/forbidden" from "read failed, try
3125
+ // again later" (see `packages/api/src/hono/handlers/page.ts`'s split catch).
3126
+ 500: {
3127
+ description: "Internal server error",
3128
+ content: { "application/json": { schema: InternalServerErrorSchema } }
3058
3129
  }
3059
3130
  }
3060
3131
  });
@@ -3306,6 +3377,52 @@ var unlikePageRoute = createRoute17({
3306
3377
  }
3307
3378
  }
3308
3379
  });
3380
+ var claimPageLinkAccessRoute = createRoute17({
3381
+ method: "post",
3382
+ path: "/pages/link-access",
3383
+ tags: ["page"],
3384
+ security: [{ bearerAuth: [] }],
3385
+ summary: "Resolve a page by id, granting first-time link-share access to GRANT_RESTRICTED pages",
3386
+ request: {
3387
+ body: {
3388
+ content: { "application/json": { schema: PageIdBodySchema } }
3389
+ }
3390
+ },
3391
+ responses: {
3392
+ 200: {
3393
+ description: "The resolved page, with `granted` telling whether this call just added the caller to grantedUsers",
3394
+ content: { "application/json": { schema: ClaimPageLinkAccessResponseSchema } }
3395
+ },
3396
+ 400: {
3397
+ description: "Invalid page_id",
3398
+ content: { "application/json": { schema: InvalidPageIdErrorSchema } }
3399
+ },
3400
+ 401: {
3401
+ description: "Authentication required",
3402
+ content: { "application/json": { schema: AuthenticationRequiredErrorSchema } }
3403
+ },
3404
+ 403: {
3405
+ description: "The caller has no access to the page (isGrantedFor is false) or lacks scope / is a non-web session \u2014 403 is about the caller lacking access, never about the page grant type per se",
3406
+ content: {
3407
+ "application/json": {
3408
+ schema: z32.union([PageNotGrantedErrorSchema, InsufficientScopeErrorSchema])
3409
+ }
3410
+ }
3411
+ },
3412
+ 404: {
3413
+ description: "Page not found",
3414
+ content: { "application/json": { schema: PageNotFoundErrorSchema } }
3415
+ },
3416
+ // Per-user rate limit (30 req/min) — same wire shape as autocomplete's
3417
+ // 429 (`{ error: 'rate_limited', message, retryAfterSeconds }`), reused
3418
+ // rather than duplicated (see the `AutocompleteRateLimitErrorSchema`
3419
+ // import above).
3420
+ 429: {
3421
+ description: "Rate limit exceeded for POST /pages/link-access (per-user). Same wire shape as autocomplete rate limiting.",
3422
+ content: { "application/json": { schema: AutocompleteRateLimitErrorSchema } }
3423
+ }
3424
+ }
3425
+ });
3309
3426
  var getWatchStatusRoute = createRoute17({
3310
3427
  method: "get",
3311
3428
  path: "/pages/watch",
@@ -3478,7 +3595,7 @@ var renamePageRoute = createRoute17({
3478
3595
  description: "PAGE_INVALID_NAME / PAGE_EXISTS / PAGE_RENAME_FAILED / PAGE_RENAME_TREE_FAILED",
3479
3596
  content: {
3480
3597
  "application/json": {
3481
- schema: z30.union([PageBadRequestErrorSchema, RenameTreeErrorSchema])
3598
+ schema: z32.union([PageBadRequestErrorSchema, RenameTreeErrorSchema])
3482
3599
  }
3483
3600
  }
3484
3601
  },
@@ -3516,7 +3633,7 @@ var renameSubtreeRoute = createRoute17({
3516
3633
  description: "PAGE_INVALID_NAME / PAGE_RENAME_TREE_FAILED (collisions, nothing to move, or partial failure)",
3517
3634
  content: {
3518
3635
  "application/json": {
3519
- schema: z30.union([PageBadRequestErrorSchema, RenameTreeErrorSchema])
3636
+ schema: z32.union([PageBadRequestErrorSchema, RenameTreeErrorSchema])
3520
3637
  }
3521
3638
  }
3522
3639
  },
@@ -3547,6 +3664,8 @@ var pageRoutes = {
3547
3664
  likePageRoute,
3548
3665
  // POST /pages/unlike — unlikePage
3549
3666
  unlikePageRoute,
3667
+ // POST /pages/link-access — claimPageLinkAccess (grant-on-first-access)
3668
+ claimPageLinkAccessRoute,
3550
3669
  // GET /pages/watch — getWatchStatus
3551
3670
  getWatchStatusRoute,
3552
3671
  // PUT /pages/watch — setWatchStatus
@@ -3567,12 +3686,12 @@ var pageRoutes = {
3567
3686
  import { createRoute as createRoute18 } from "@hono/zod-openapi";
3568
3687
 
3569
3688
  // src/schemas/page-preview.ts
3570
- import { z as z31 } from "@hono/zod-openapi";
3571
- var PreviewPageRequestSchema = z31.object({
3572
- body: z31.string()
3689
+ import { z as z33 } from "@hono/zod-openapi";
3690
+ var PreviewPageRequestSchema = z33.object({
3691
+ body: z33.string()
3573
3692
  });
3574
- var PreviewPageResponseSchema = z31.object({
3575
- renderedAst: z31.unknown()
3693
+ var PreviewPageResponseSchema = z33.object({
3694
+ renderedAst: z33.unknown()
3576
3695
  });
3577
3696
 
3578
3697
  // src/contracts/page-preview.ts
@@ -3607,9 +3726,9 @@ var pagePreviewRoutes = {
3607
3726
  };
3608
3727
 
3609
3728
  // src/contracts/page-collab.ts
3610
- import { createRoute as createRoute19, z as z32 } from "@hono/zod-openapi";
3611
- var PageIdPathParamsSchema = z32.object({
3612
- id: z32.string().openapi({ description: "Page id (24-char hex ObjectId)", example: "507f1f77bcf86cd799439011" })
3729
+ import { createRoute as createRoute19, z as z34 } from "@hono/zod-openapi";
3730
+ var PageIdPathParamsSchema = z34.object({
3731
+ id: z34.string().openapi({ description: "Page id (24-char hex ObjectId)", example: "507f1f77bcf86cd799439011" })
3613
3732
  });
3614
3733
  var getYjsTokenRoute = createRoute19({
3615
3734
  method: "get",
@@ -3648,77 +3767,77 @@ var pageCollabRoutes = {
3648
3767
  };
3649
3768
 
3650
3769
  // src/contracts/presence.ts
3651
- import { createRoute as createRoute20, z as z34 } from "@hono/zod-openapi";
3770
+ import { createRoute as createRoute20, z as z36 } from "@hono/zod-openapi";
3652
3771
 
3653
3772
  // src/schemas/presence.ts
3654
- import { z as z33 } from "@hono/zod-openapi";
3655
- var PresenceTokenResponseSchema = z33.object({
3656
- token: z33.string(),
3657
- pageId: z33.string(),
3658
- selfUserId: z33.string(),
3659
- expiresAt: z33.string()
3660
- });
3661
- var PresenceTokenPayloadSchema = z33.object({
3662
- userId: z33.string(),
3663
- pageId: z33.string(),
3664
- iat: z33.number().int(),
3665
- exp: z33.number().int()
3666
- });
3667
- var PresenceViewerSchema = z33.object({
3668
- userId: z33.string(),
3669
- username: z33.string(),
3670
- displayName: z33.string(),
3671
- avatarUrl: z33.string().nullable(),
3672
- isEditing: z33.boolean(),
3673
- joinedAt: z33.number().int()
3674
- });
3675
- var PresenceHeartbeatMessageSchema = z33.object({
3676
- type: z33.literal("heartbeat")
3773
+ import { z as z35 } from "@hono/zod-openapi";
3774
+ var PresenceTokenResponseSchema = z35.object({
3775
+ token: z35.string(),
3776
+ pageId: z35.string(),
3777
+ selfUserId: z35.string(),
3778
+ expiresAt: z35.string()
3779
+ });
3780
+ var PresenceTokenPayloadSchema = z35.object({
3781
+ userId: z35.string(),
3782
+ pageId: z35.string(),
3783
+ iat: z35.number().int(),
3784
+ exp: z35.number().int()
3785
+ });
3786
+ var PresenceViewerSchema = z35.object({
3787
+ userId: z35.string(),
3788
+ username: z35.string(),
3789
+ displayName: z35.string(),
3790
+ avatarUrl: z35.string().nullable(),
3791
+ isEditing: z35.boolean(),
3792
+ joinedAt: z35.number().int()
3793
+ });
3794
+ var PresenceHeartbeatMessageSchema = z35.object({
3795
+ type: z35.literal("heartbeat")
3677
3796
  });
3678
3797
  var PresenceClientMessageSchema = PresenceHeartbeatMessageSchema;
3679
- var PresenceViewersMessageSchema = z33.object({
3680
- type: z33.literal("viewers"),
3681
- viewers: z33.array(PresenceViewerSchema)
3682
- });
3683
- var PresencePageUpdatedMessageSchema = z33.object({
3684
- type: z33.literal("page-updated"),
3685
- pageId: z33.string(),
3686
- revisionId: z33.string(),
3687
- editorUserId: z33.string(),
3688
- editorDisplayName: z33.string()
3689
- });
3690
- var PresenceCommentChangedMessageSchema = z33.object({
3691
- type: z33.literal("comment-changed"),
3692
- pageId: z33.string(),
3693
- changeType: z33.enum(["added", "removed"]),
3694
- commentId: z33.string(),
3695
- actorUserId: z33.string().optional()
3696
- });
3697
- var PresenceServerMessageSchema = z33.discriminatedUnion("type", [
3798
+ var PresenceViewersMessageSchema = z35.object({
3799
+ type: z35.literal("viewers"),
3800
+ viewers: z35.array(PresenceViewerSchema)
3801
+ });
3802
+ var PresencePageUpdatedMessageSchema = z35.object({
3803
+ type: z35.literal("page-updated"),
3804
+ pageId: z35.string(),
3805
+ revisionId: z35.string(),
3806
+ editorUserId: z35.string(),
3807
+ editorDisplayName: z35.string()
3808
+ });
3809
+ var PresenceCommentChangedMessageSchema = z35.object({
3810
+ type: z35.literal("comment-changed"),
3811
+ pageId: z35.string(),
3812
+ changeType: z35.enum(["added", "removed"]),
3813
+ commentId: z35.string(),
3814
+ actorUserId: z35.string().optional()
3815
+ });
3816
+ var PresenceServerMessageSchema = z35.discriminatedUnion("type", [
3698
3817
  PresenceViewersMessageSchema,
3699
3818
  PresencePageUpdatedMessageSchema,
3700
3819
  PresenceCommentChangedMessageSchema
3701
3820
  ]);
3702
- var LikerSchema = z33.object({
3703
- id: z33.string(),
3704
- username: z33.string(),
3705
- displayName: z33.string(),
3706
- avatarUrl: z33.string().nullable(),
3707
- likedAt: z33.string().nullable()
3708
- });
3709
- var LikersResponseSchema = z33.object({
3710
- users: z33.array(LikerSchema),
3711
- totalCount: z33.number().int().nonnegative()
3712
- });
3713
- var GetLikersRequestSchema = z33.object({
3821
+ var LikerSchema = z35.object({
3822
+ id: z35.string(),
3823
+ username: z35.string(),
3824
+ displayName: z35.string(),
3825
+ avatarUrl: z35.string().nullable(),
3826
+ likedAt: z35.string().nullable()
3827
+ });
3828
+ var LikersResponseSchema = z35.object({
3829
+ users: z35.array(LikerSchema),
3830
+ totalCount: z35.number().int().nonnegative()
3831
+ });
3832
+ var GetLikersRequestSchema = z35.object({
3714
3833
  // Optional cap on returned `users`. `totalCount` always reflects the
3715
3834
  // full count regardless of `limit`. Omit for the full list.
3716
- limit: z33.coerce.number().int().positive().optional()
3835
+ limit: z35.coerce.number().int().positive().optional()
3717
3836
  });
3718
3837
 
3719
3838
  // src/contracts/presence.ts
3720
- var PageIdPathParamsSchema2 = z34.object({
3721
- id: z34.string().openapi({ description: "Page id (24-char hex ObjectId)", example: "507f1f77bcf86cd799439011" })
3839
+ var PageIdPathParamsSchema2 = z36.object({
3840
+ id: z36.string().openapi({ description: "Page id (24-char hex ObjectId)", example: "507f1f77bcf86cd799439011" })
3722
3841
  });
3723
3842
  var getPresenceTokenRoute = createRoute20({
3724
3843
  method: "get",
@@ -3791,48 +3910,48 @@ var presenceRoutes = {
3791
3910
  };
3792
3911
 
3793
3912
  // src/contracts/draft.ts
3794
- import { createRoute as createRoute21, z as z36 } from "@hono/zod-openapi";
3913
+ import { createRoute as createRoute21, z as z38 } from "@hono/zod-openapi";
3795
3914
 
3796
3915
  // src/schemas/draft.ts
3797
- import { z as z35 } from "@hono/zod-openapi";
3798
- var CreateDraftRequestSchema = z35.object({
3799
- path: z35.string().min(1),
3800
- initialBody: z35.string().optional()
3916
+ import { z as z37 } from "@hono/zod-openapi";
3917
+ var CreateDraftRequestSchema = z37.object({
3918
+ path: z37.string().min(1),
3919
+ initialBody: z37.string().optional()
3801
3920
  });
3802
- var CreateDraftResponseSchema = z35.object({
3803
- pageId: z35.string()
3921
+ var CreateDraftResponseSchema = z37.object({
3922
+ pageId: z37.string()
3804
3923
  });
3805
- var DraftConflictOwnerSchema = z35.object({
3806
- id: z35.string(),
3807
- username: z35.string(),
3808
- displayName: z35.string()
3924
+ var DraftConflictOwnerSchema = z37.object({
3925
+ id: z37.string(),
3926
+ username: z37.string(),
3927
+ displayName: z37.string()
3809
3928
  });
3810
- var DraftPathConflictErrorSchema = z35.object({
3811
- error: z35.literal("path_taken_by_draft"),
3929
+ var DraftPathConflictErrorSchema = z37.object({
3930
+ error: z37.literal("path_taken_by_draft"),
3812
3931
  owner: DraftConflictOwnerSchema,
3813
- message: z35.string()
3932
+ message: z37.string()
3814
3933
  });
3815
- var DraftBadRequestErrorSchema = z35.object({
3816
- error: z35.enum(["invalid_path", "path_taken"]),
3817
- message: z35.string()
3934
+ var DraftBadRequestErrorSchema = z37.object({
3935
+ error: z37.enum(["invalid_path", "path_taken"]),
3936
+ message: z37.string()
3818
3937
  });
3819
- var DraftNotFoundErrorSchema = z35.object({
3820
- error: z35.literal("draft_not_found"),
3821
- message: z35.string()
3938
+ var DraftNotFoundErrorSchema = z37.object({
3939
+ error: z37.literal("draft_not_found"),
3940
+ message: z37.string()
3822
3941
  });
3823
- var DraftSummarySchema = z35.object({
3824
- pageId: z35.string(),
3825
- path: z35.string(),
3826
- createdAt: z35.string(),
3827
- updatedAt: z35.string()
3942
+ var DraftSummarySchema = z37.object({
3943
+ pageId: z37.string(),
3944
+ path: z37.string(),
3945
+ createdAt: z37.string(),
3946
+ updatedAt: z37.string()
3828
3947
  });
3829
- var ListDraftsResponseSchema = z35.object({
3830
- drafts: z35.array(DraftSummarySchema)
3948
+ var ListDraftsResponseSchema = z37.object({
3949
+ drafts: z37.array(DraftSummarySchema)
3831
3950
  });
3832
3951
 
3833
3952
  // src/contracts/draft.ts
3834
- var DraftIdPathParamsSchema = z36.object({
3835
- id: z36.string().openapi({ description: "Draft page id (24-char hex ObjectId)", example: "507f1f77bcf86cd799439011" })
3953
+ var DraftIdPathParamsSchema = z38.object({
3954
+ id: z38.string().openapi({ description: "Draft page id (24-char hex ObjectId)", example: "507f1f77bcf86cd799439011" })
3836
3955
  });
3837
3956
  var createDraftRoute = createRoute21({
3838
3957
  method: "post",
@@ -3913,40 +4032,6 @@ var draftRoutes = {
3913
4032
 
3914
4033
  // src/contracts/autocomplete.ts
3915
4034
  import { createRoute as createRoute22 } from "@hono/zod-openapi";
3916
-
3917
- // src/schemas/autocomplete.ts
3918
- import { z as z37 } from "@hono/zod-openapi";
3919
- var AutocompleteRequestSchema = z37.object({
3920
- q: z37.string().min(1).max(128),
3921
- limit: z37.coerce.number().int().min(1).max(25).optional().default(10),
3922
- /**
3923
- * How `q` is matched against the candidate text. `'substring'` (the
3924
- * default, used by the editor's `@mention` / `[[wikilink]]` pickers)
3925
- * keeps the historical anywhere-in-string match. `'prefix'` anchors
3926
- * the match at the start — used by the "create page" modal, where the
3927
- * user is building a `/`-rooted path and only true prefixes are valid
3928
- * completions of what they have typed so far.
3929
- */
3930
- anchor: z37.enum(["substring", "prefix"]).optional().default("substring")
3931
- });
3932
- var AutocompleteResultSchema = z37.object({
3933
- id: z37.string(),
3934
- label: z37.string(),
3935
- display: z37.string(),
3936
- avatar: z37.string().nullable().optional(),
3937
- modifiedAt: z37.string().nullable().optional(),
3938
- score: z37.number()
3939
- });
3940
- var AutocompleteResponseSchema = z37.object({
3941
- results: z37.array(AutocompleteResultSchema)
3942
- });
3943
- var AutocompleteRateLimitErrorSchema = z37.object({
3944
- error: z37.literal("rate_limited"),
3945
- message: z37.string(),
3946
- retryAfterSeconds: z37.number()
3947
- });
3948
-
3949
- // src/contracts/autocomplete.ts
3950
4035
  var autocompleteUsersRoute = createRoute22({
3951
4036
  method: "get",
3952
4037
  path: "/users/autocomplete",
@@ -4009,50 +4094,50 @@ var autocompleteRoutes = {
4009
4094
  };
4010
4095
 
4011
4096
  // src/contracts/attachment.ts
4012
- import { createRoute as createRoute23, z as z39 } from "@hono/zod-openapi";
4097
+ import { createRoute as createRoute23, z as z40 } from "@hono/zod-openapi";
4013
4098
 
4014
4099
  // src/schemas/attachment.ts
4015
- import { z as z38 } from "@hono/zod-openapi";
4016
- var AttachmentSchema = z38.object({
4017
- _id: z38.string(),
4018
- page: z38.string(),
4100
+ import { z as z39 } from "@hono/zod-openapi";
4101
+ var AttachmentSchema = z39.object({
4102
+ _id: z39.string(),
4103
+ page: z39.string(),
4019
4104
  creator: UserPublicSchema,
4020
- filePath: z38.string(),
4021
- fileName: z38.string(),
4022
- originalName: z38.string(),
4023
- fileFormat: z38.string(),
4024
- fileSize: z38.number(),
4025
- createdAt: z38.string(),
4026
- url: z38.string(),
4027
- inUse: z38.boolean()
4105
+ filePath: z39.string(),
4106
+ fileName: z39.string(),
4107
+ originalName: z39.string(),
4108
+ fileFormat: z39.string(),
4109
+ fileSize: z39.number(),
4110
+ createdAt: z39.string(),
4111
+ url: z39.string(),
4112
+ inUse: z39.boolean()
4028
4113
  });
4029
4114
  var AttachmentMetaSchema = AttachmentSchema.omit({ inUse: true });
4030
- var ListAttachmentsResponseSchema = z38.object({
4031
- attachments: z38.array(AttachmentSchema)
4115
+ var ListAttachmentsResponseSchema = z39.object({
4116
+ attachments: z39.array(AttachmentSchema)
4032
4117
  });
4033
- var PastAttachmentUsageSchema = z38.object({
4118
+ var PastAttachmentUsageSchema = z39.object({
4034
4119
  attachment: AttachmentSchema,
4035
- referencingRevisions: z38.array(
4036
- z38.object({
4037
- revisionId: z38.string(),
4038
- createdAt: z38.string(),
4120
+ referencingRevisions: z39.array(
4121
+ z39.object({
4122
+ revisionId: z39.string(),
4123
+ createdAt: z39.string(),
4039
4124
  author: UserPublicSchema
4040
4125
  })
4041
4126
  )
4042
4127
  });
4043
- var AttachmentUsageResponseSchema = z38.object({
4044
- pagePath: z38.string(),
4045
- latest: z38.array(AttachmentSchema),
4046
- past: z38.array(PastAttachmentUsageSchema)
4128
+ var AttachmentUsageResponseSchema = z39.object({
4129
+ pagePath: z39.string(),
4130
+ latest: z39.array(AttachmentSchema),
4131
+ past: z39.array(PastAttachmentUsageSchema)
4047
4132
  });
4048
- var AddAttachmentResponseSchema = z38.object({
4133
+ var AddAttachmentResponseSchema = z39.object({
4049
4134
  attachment: AttachmentSchema,
4050
- url: z38.string()
4135
+ url: z39.string()
4051
4136
  });
4052
- var RemoveAttachmentResponseSchema = z38.object({
4053
- success: z38.literal(true)
4137
+ var RemoveAttachmentResponseSchema = z39.object({
4138
+ success: z39.literal(true)
4054
4139
  });
4055
- var AttachmentErrorCodeSchema = z38.enum([
4140
+ var AttachmentErrorCodeSchema = z39.enum([
4056
4141
  "INVALID_PAGE_ID",
4057
4142
  "PAGE_NOT_FOUND",
4058
4143
  "FILE_MISSING",
@@ -4064,41 +4149,41 @@ var AttachmentErrorCodeSchema = z38.enum([
4064
4149
  "UPLOAD_FAILED",
4065
4150
  "REMOVE_FAILED"
4066
4151
  ]);
4067
- var AttachmentErrorSchema = z38.object({
4068
- error: z38.object({
4152
+ var AttachmentErrorSchema = z39.object({
4153
+ error: z39.object({
4069
4154
  code: AttachmentErrorCodeSchema,
4070
- message: z38.string()
4155
+ message: z39.string()
4071
4156
  })
4072
4157
  });
4073
- var UploadAttachmentResponseSchema = z38.object({
4074
- url: z38.string(),
4075
- filename: z38.string(),
4076
- mimeType: z38.string(),
4077
- sizeBytes: z38.number()
4158
+ var UploadAttachmentResponseSchema = z39.object({
4159
+ url: z39.string(),
4160
+ filename: z39.string(),
4161
+ mimeType: z39.string(),
4162
+ sizeBytes: z39.number()
4078
4163
  });
4079
- var UploadAttachmentErrorCodeSchema = z38.enum(["too_large", "disallowed_type", "rate_limited", "no_permission"]);
4080
- var UploadAttachmentErrorSchema = z38.object({
4164
+ var UploadAttachmentErrorCodeSchema = z39.enum(["too_large", "disallowed_type", "rate_limited", "no_permission"]);
4165
+ var UploadAttachmentErrorSchema = z39.object({
4081
4166
  error: UploadAttachmentErrorCodeSchema,
4082
- message: z38.string(),
4083
- details: z38.record(z38.string(), z38.unknown()).optional()
4167
+ message: z39.string(),
4168
+ details: z39.record(z39.string(), z39.unknown()).optional()
4084
4169
  });
4085
4170
  var IMAGE_UPLOAD_MIME = ["image/png", "image/jpeg", "image/gif", "image/webp", "image/svg+xml"];
4086
4171
  var DND_EXTRA_UPLOAD_MIME = ["application/pdf", "text/plain", "text/markdown", "text/csv", "application/zip"];
4087
4172
 
4088
4173
  // src/contracts/attachment.ts
4089
- var PageIdPathParamsSchema3 = z39.object({
4090
- pageId: z39.string().openapi({ description: "Page id (24-char hex ObjectId)", example: "507f1f77bcf86cd799439011" })
4174
+ var PageIdPathParamsSchema3 = z40.object({
4175
+ pageId: z40.string().openapi({ description: "Page id (24-char hex ObjectId)", example: "507f1f77bcf86cd799439011" })
4091
4176
  });
4092
- var AttachmentIdPathParamsSchema = z39.object({
4093
- id: z39.string().openapi({ description: "Attachment id (24-char hex ObjectId)", example: "507f1f77bcf86cd799439011" })
4177
+ var AttachmentIdPathParamsSchema = z40.object({
4178
+ id: z40.string().openapi({ description: "Attachment id (24-char hex ObjectId)", example: "507f1f77bcf86cd799439011" })
4094
4179
  });
4095
- var AddAttachmentBodySchema = z39.object({
4096
- file: z39.any().openapi({ type: "string", format: "binary" }).optional()
4180
+ var AddAttachmentBodySchema = z40.object({
4181
+ file: z40.any().openapi({ type: "string", format: "binary" }).optional()
4097
4182
  });
4098
- var UploadAttachmentBodySchema = z39.object({
4099
- file: z39.any().openapi({ type: "string", format: "binary" }).optional(),
4100
- pageId: z39.string().optional(),
4101
- intent: z39.string().optional().openapi({ enum: ["paste", "dnd"] })
4183
+ var UploadAttachmentBodySchema = z40.object({
4184
+ file: z40.any().openapi({ type: "string", format: "binary" }).optional(),
4185
+ pageId: z40.string().optional(),
4186
+ intent: z40.string().optional().openapi({ enum: ["paste", "dnd"] })
4102
4187
  });
4103
4188
  var listAttachmentsRoute = createRoute23({
4104
4189
  method: "get",
@@ -4335,30 +4420,30 @@ var attachmentRoutes = {
4335
4420
  import { createRoute as createRoute24 } from "@hono/zod-openapi";
4336
4421
 
4337
4422
  // src/schemas/search.ts
4338
- import { z as z40 } from "@hono/zod-openapi";
4339
- var SearchPageTypeSchema = z40.enum(["portal", "public", "user"]);
4340
- var SearchPagesRequestSchema = z40.object({
4341
- q: z40.string().min(1),
4342
- tree: z40.string().optional(),
4423
+ import { z as z41 } from "@hono/zod-openapi";
4424
+ var SearchPageTypeSchema = z41.enum(["portal", "public", "user"]);
4425
+ var SearchPagesRequestSchema = z41.object({
4426
+ q: z41.string().min(1),
4427
+ tree: z41.string().optional(),
4343
4428
  type: SearchPageTypeSchema.optional(),
4344
- page: z40.coerce.number().int().min(1).default(1),
4345
- limit: z40.coerce.number().int().min(1).max(100).default(50)
4346
- });
4347
- var SearchHitSchema = z40.object({
4348
- pageId: z40.string(),
4349
- path: z40.string(),
4350
- score: z40.number().optional(),
4351
- snippet: z40.string().optional(),
4352
- bookmarkCount: z40.number(),
4429
+ page: z41.coerce.number().int().min(1).default(1),
4430
+ limit: z41.coerce.number().int().min(1).max(100).default(50)
4431
+ });
4432
+ var SearchHitSchema = z41.object({
4433
+ pageId: z41.string(),
4434
+ path: z41.string(),
4435
+ score: z41.number().optional(),
4436
+ snippet: z41.string().optional(),
4437
+ bookmarkCount: z41.number(),
4353
4438
  page: PageSchema
4354
4439
  });
4355
- var SearchPagesResponseSchema = z40.object({
4356
- meta: z40.object({
4357
- took: z40.number().optional(),
4358
- total: z40.number(),
4359
- results: z40.number()
4440
+ var SearchPagesResponseSchema = z41.object({
4441
+ meta: z41.object({
4442
+ took: z41.number().optional(),
4443
+ total: z41.number(),
4444
+ results: z41.number()
4360
4445
  }),
4361
- data: z40.array(SearchHitSchema)
4446
+ data: z41.array(SearchHitSchema)
4362
4447
  });
4363
4448
 
4364
4449
  // src/contracts/search.ts
@@ -4402,31 +4487,31 @@ var searchRoutes = {
4402
4487
  import { createRoute as createRoute25 } from "@hono/zod-openapi";
4403
4488
 
4404
4489
  // src/schemas/adminCrypto.ts
4405
- import { z as z41 } from "@hono/zod-openapi";
4406
- var SensitiveConfigEntrySchema = z41.object({
4407
- ns: z41.string(),
4408
- key: z41.string(),
4409
- present: z41.boolean(),
4410
- encrypted: z41.boolean()
4411
- });
4412
- var CryptoStatusResponseSchema = z41.object({
4490
+ import { z as z42 } from "@hono/zod-openapi";
4491
+ var SensitiveConfigEntrySchema = z42.object({
4492
+ ns: z42.string(),
4493
+ key: z42.string(),
4494
+ present: z42.boolean(),
4495
+ encrypted: z42.boolean()
4496
+ });
4497
+ var CryptoStatusResponseSchema = z42.object({
4413
4498
  /** False when CROWI_ENCRYPTION_KEY is not configured — UI shows a setup hint. */
4414
- encryptionConfigured: z41.boolean(),
4415
- unencryptedCount: z41.number().int().min(0),
4416
- encryptedCount: z41.number().int().min(0),
4417
- entries: z41.array(SensitiveConfigEntrySchema)
4499
+ encryptionConfigured: z42.boolean(),
4500
+ unencryptedCount: z42.number().int().min(0),
4501
+ encryptedCount: z42.number().int().min(0),
4502
+ entries: z42.array(SensitiveConfigEntrySchema)
4418
4503
  });
4419
- var ReencryptResponseSchema = z41.object({
4420
- rewritten: z41.number().int().min(0),
4504
+ var ReencryptResponseSchema = z42.object({
4505
+ rewritten: z42.number().int().min(0),
4421
4506
  /** Already encrypted, skipped on this run. */
4422
- alreadyEncrypted: z41.number().int().min(0),
4507
+ alreadyEncrypted: z42.number().int().min(0),
4423
4508
  /** Sensitive registry entries that had no row in the DB at all. */
4424
- missing: z41.number().int().min(0)
4509
+ missing: z42.number().int().min(0)
4425
4510
  });
4426
- var EncryptionNotConfiguredErrorSchema = z41.object({
4427
- error: z41.object({
4428
- code: z41.literal("ENCRYPTION_NOT_CONFIGURED"),
4429
- message: z41.string()
4511
+ var EncryptionNotConfiguredErrorSchema = z42.object({
4512
+ error: z42.object({
4513
+ code: z42.literal("ENCRYPTION_NOT_CONFIGURED"),
4514
+ message: z42.string()
4430
4515
  })
4431
4516
  });
4432
4517
 
@@ -4494,53 +4579,53 @@ var adminCryptoRoutes = {
4494
4579
  import { createRoute as createRoute26 } from "@hono/zod-openapi";
4495
4580
 
4496
4581
  // src/schemas/admin/app.ts
4497
- import { z as z43 } from "@hono/zod-openapi";
4498
- var GetAppSettingsResponseSchema = z43.object({
4499
- app: z43.object({
4500
- title: z43.string(),
4501
- confidential: z43.string()
4582
+ import { z as z44 } from "@hono/zod-openapi";
4583
+ var GetAppSettingsResponseSchema = z44.object({
4584
+ app: z44.object({
4585
+ title: z44.string(),
4586
+ confidential: z44.string()
4502
4587
  }),
4503
4588
  /**
4504
4589
  * Whether a storage driver is registered (i.e. uploads are wired up).
4505
4590
  * Sourced from `Config.isUploadable()` which now consults PluginManager.
4506
4591
  */
4507
- isUploadable: z43.boolean(),
4592
+ isUploadable: z44.boolean(),
4508
4593
  /**
4509
4594
  * The Open / Restricted / Closed → open / restricted / closed mapping the
4510
4595
  * legacy admin controller exposed. Useful for the UI to render the current
4511
4596
  * registration mode label without knowing the internal capitalisation.
4512
4597
  */
4513
- registrationMode: z43.record(z43.string(), z43.string()),
4598
+ registrationMode: z44.record(z44.string(), z44.string()),
4514
4599
  /**
4515
4600
  * Whether the admin has dismissed the initial-setup checklist on the
4516
4601
  * dashboard. Persisted server-side (`app:setupChecklistDismissed`) so the
4517
4602
  * dismissal holds across browsers and devices, not just one localStorage.
4518
4603
  */
4519
- setupChecklistDismissed: z43.boolean()
4604
+ setupChecklistDismissed: z44.boolean()
4520
4605
  });
4521
- var UpdateAppSettingsRequestSchema = z43.object({
4522
- app: z43.object({
4523
- title: z43.string().trim().min(1).max(100).optional(),
4524
- confidential: z43.string().max(500).optional()
4606
+ var UpdateAppSettingsRequestSchema = z44.object({
4607
+ app: z44.object({
4608
+ title: z44.string().trim().min(1).max(100).optional(),
4609
+ confidential: z44.string().max(500).optional()
4525
4610
  }).optional(),
4526
4611
  /**
4527
4612
  * Toggle the dashboard initial-setup checklist's dismissed state. Sent on
4528
4613
  * its own (without the `app` block) when the admin clicks "mark as done".
4529
4614
  */
4530
- setupChecklistDismissed: z43.boolean().optional()
4615
+ setupChecklistDismissed: z44.boolean().optional()
4531
4616
  }).strict();
4532
- var UpdateAppSettingsResponseSchema = z43.object({
4533
- ok: z43.literal(true)
4534
- });
4535
- var AppSettingsValidationErrorSchema = z43.object({
4536
- bodyResult: z43.object({
4537
- issues: z43.array(
4538
- z43.object({
4539
- path: z43.array(z43.union([z43.string(), z43.number()])),
4540
- message: z43.string()
4617
+ var UpdateAppSettingsResponseSchema = z44.object({
4618
+ ok: z44.literal(true)
4619
+ });
4620
+ var AppSettingsValidationErrorSchema = z44.object({
4621
+ bodyResult: z44.object({
4622
+ issues: z44.array(
4623
+ z44.object({
4624
+ path: z44.array(z44.union([z44.string(), z44.number()])),
4625
+ message: z44.string()
4541
4626
  })
4542
4627
  ),
4543
- name: z43.string().optional()
4628
+ name: z44.string().optional()
4544
4629
  })
4545
4630
  });
4546
4631
 
@@ -4622,18 +4707,18 @@ var adminAppRoutes = {
4622
4707
  import { createRoute as createRoute27 } from "@hono/zod-openapi";
4623
4708
 
4624
4709
  // src/schemas/admin/auth.ts
4625
- import { z as z44 } from "@hono/zod-openapi";
4626
- var AuthSettingsSchema = z44.object({
4627
- requireThirdPartyAuth: z44.boolean(),
4628
- disablePasswordAuth: z44.boolean()
4710
+ import { z as z45 } from "@hono/zod-openapi";
4711
+ var AuthSettingsSchema = z45.object({
4712
+ requireThirdPartyAuth: z45.boolean(),
4713
+ disablePasswordAuth: z45.boolean()
4629
4714
  });
4630
4715
  var UpdateAuthSettingsRequestSchema = AuthSettingsSchema;
4631
4716
  var GetAuthSettingsResponseSchema = AuthSettingsSchema;
4632
4717
  var UpdateAuthSettingsResponseSchema = AuthSettingsSchema;
4633
- var ThirdPartyAuthUnavailableErrorSchema = z44.object({
4634
- error: z44.object({
4635
- code: z44.literal("THIRD_PARTY_AUTH_UNAVAILABLE"),
4636
- message: z44.string()
4718
+ var ThirdPartyAuthUnavailableErrorSchema = z45.object({
4719
+ error: z45.object({
4720
+ code: z45.literal("THIRD_PARTY_AUTH_UNAVAILABLE"),
4721
+ message: z45.string()
4637
4722
  })
4638
4723
  });
4639
4724
 
@@ -4706,41 +4791,41 @@ var adminAuthRoutes = {
4706
4791
  import { createRoute as createRoute28 } from "@hono/zod-openapi";
4707
4792
 
4708
4793
  // src/schemas/admin/mail.ts
4709
- import { z as z45 } from "@hono/zod-openapi";
4710
- var GetMailSettingsResponseSchema = z45.object({
4711
- from: z45.string(),
4712
- activeDriver: z45.string(),
4794
+ import { z as z46 } from "@hono/zod-openapi";
4795
+ var GetMailSettingsResponseSchema = z46.object({
4796
+ from: z46.string(),
4797
+ activeDriver: z46.string(),
4713
4798
  /** npm name of the plugin that registered the active driver, for
4714
4799
  * linking to its config page. Empty when no sender is active. */
4715
- activePlugin: z45.string()
4800
+ activePlugin: z46.string()
4716
4801
  });
4717
- var UpdateMailSettingsRequestSchema = z45.object({
4718
- from: z45.string().trim().max(254).optional()
4802
+ var UpdateMailSettingsRequestSchema = z46.object({
4803
+ from: z46.string().trim().max(254).optional()
4719
4804
  });
4720
- var UpdateMailSettingsResponseSchema = z45.object({
4721
- ok: z45.literal(true)
4805
+ var UpdateMailSettingsResponseSchema = z46.object({
4806
+ ok: z46.literal(true)
4722
4807
  });
4723
- var SendTestMailRequestSchema = z45.object({}).optional();
4724
- var SendTestMailResponseSchema = z45.object({
4725
- ok: z45.literal(true),
4808
+ var SendTestMailRequestSchema = z46.object({}).optional();
4809
+ var SendTestMailResponseSchema = z46.object({
4810
+ ok: z46.literal(true),
4726
4811
  /** Address the test mail was dispatched to (= the calling admin's email). */
4727
- to: z45.string()
4812
+ to: z46.string()
4728
4813
  });
4729
- var SendTestMailErrorSchema = z45.object({
4730
- error: z45.object({
4731
- code: z45.literal("MAIL_TEST_FAILED"),
4732
- message: z45.string()
4814
+ var SendTestMailErrorSchema = z46.object({
4815
+ error: z46.object({
4816
+ code: z46.literal("MAIL_TEST_FAILED"),
4817
+ message: z46.string()
4733
4818
  })
4734
4819
  });
4735
- var MailSettingsValidationErrorSchema = z45.object({
4736
- bodyResult: z45.object({
4737
- issues: z45.array(
4738
- z45.object({
4739
- path: z45.array(z45.union([z45.string(), z45.number()])),
4740
- message: z45.string()
4820
+ var MailSettingsValidationErrorSchema = z46.object({
4821
+ bodyResult: z46.object({
4822
+ issues: z46.array(
4823
+ z46.object({
4824
+ path: z46.array(z46.union([z46.string(), z46.number()])),
4825
+ message: z46.string()
4741
4826
  })
4742
4827
  ),
4743
- name: z45.string().optional()
4828
+ name: z46.string().optional()
4744
4829
  })
4745
4830
  });
4746
4831
 
@@ -4855,30 +4940,30 @@ var adminMailRoutes = {
4855
4940
  };
4856
4941
 
4857
4942
  // src/contracts/admin/plugins.ts
4858
- import { createRoute as createRoute29, z as z47 } from "@hono/zod-openapi";
4943
+ import { createRoute as createRoute29, z as z48 } from "@hono/zod-openapi";
4859
4944
 
4860
4945
  // src/schemas/admin/plugins.ts
4861
- import { z as z46 } from "@hono/zod-openapi";
4862
- var PluginFieldSchema = z46.object({
4863
- name: z46.string(),
4946
+ import { z as z47 } from "@hono/zod-openapi";
4947
+ var PluginFieldSchema = z47.object({
4948
+ name: z47.string(),
4864
4949
  /**
4865
4950
  * Localized display label. Falls back to `name` in the form when absent.
4866
4951
  * Filled from the plugin's `configI18n[locale]` overlay by the admin API.
4867
4952
  */
4868
- label: z46.string().optional(),
4869
- kind: z46.enum(["string", "secret", "number", "boolean", "enum", "string-array"]),
4870
- description: z46.string().optional(),
4871
- defaultValue: z46.unknown().optional(),
4872
- options: z46.array(z46.string()).optional(),
4873
- action: z46.object({
4874
- label: z46.string(),
4875
- method: z46.string(),
4876
- path: z46.string()
4953
+ label: z47.string().optional(),
4954
+ kind: z47.enum(["string", "secret", "number", "boolean", "enum", "string-array"]),
4955
+ description: z47.string().optional(),
4956
+ defaultValue: z47.unknown().optional(),
4957
+ options: z47.array(z47.string()).optional(),
4958
+ action: z47.object({
4959
+ label: z47.string(),
4960
+ method: z47.string(),
4961
+ path: z47.string()
4877
4962
  }).optional(),
4878
- optional: z46.boolean()
4963
+ optional: z47.boolean()
4879
4964
  });
4880
- var AdminSidebarSection = z46.enum(["settings", "shared", "storage", "mail", "notification", "auth", "search", "renderer", "platform"]);
4881
- var PluginAdminPlacementSchema = z46.object({
4965
+ var AdminSidebarSection = z47.enum(["settings", "shared", "storage", "mail", "notification", "auth", "search", "renderer", "platform"]);
4966
+ var PluginAdminPlacementSchema = z47.object({
4882
4967
  /**
4883
4968
  * Sidebar section to surface this plugin under. The runtime fills
4884
4969
  * this in — it's either declared by the plugin via `adminPlacement`
@@ -4887,21 +4972,28 @@ var PluginAdminPlacementSchema = z46.object({
4887
4972
  */
4888
4973
  section: AdminSidebarSection,
4889
4974
  /** Display label (defaults to the plugin's npm name). */
4890
- label: z46.string(),
4975
+ label: z47.string(),
4891
4976
  /** Lucide icon name from a fixed allow-list. */
4892
- icon: z46.string().optional()
4977
+ icon: z47.string().optional()
4893
4978
  });
4894
- var PluginInfoSchema = z46.object({
4895
- name: z46.string(),
4896
- version: z46.string(),
4897
- requires: z46.array(z46.string()).optional(),
4979
+ var PluginInfoSchema = z47.object({
4980
+ name: z47.string(),
4981
+ version: z47.string(),
4982
+ requires: z47.array(z47.string()).optional(),
4983
+ /**
4984
+ * Core Mongoose model names this plugin declared in its
4985
+ * `CrowiPlugin.modelAccess` allow-list — the only models it may
4986
+ * reach via `ctx.model(name)`. Surfaced so an admin can audit which
4987
+ * plugins touch which core collections.
4988
+ */
4989
+ modelAccess: z47.array(z47.string()).optional(),
4898
4990
  /** Has a configSchema (= showable config form). */
4899
- hasConfig: z46.boolean(),
4991
+ hasConfig: z47.boolean(),
4900
4992
  /**
4901
4993
  * Driver-registry slots this plugin currently fills. Useful for the
4902
4994
  * admin "this plugin is the active storage driver" badge.
4903
4995
  */
4904
- registers: z46.array(z46.string()),
4996
+ registers: z47.array(z47.string()),
4905
4997
  /**
4906
4998
  * Where the plugin appears in the admin sidebar. The server always
4907
4999
  * populates this even when the plugin didn't declare its own
@@ -4914,21 +5006,32 @@ var PluginInfoSchema = z46.object({
4914
5006
  * still apply their config on the next server restart; plugins with
4915
5007
  * it apply config changes live.
4916
5008
  */
4917
- supportsHotReload: z46.boolean()
5009
+ supportsHotReload: z47.boolean(),
5010
+ /**
5011
+ * `'failed'` means the plugin's `activate()` call threw during boot
5012
+ * (see `PluginManager.getFailedPlugins()`) — it is not in the loaded
5013
+ * set, has no live driver registration, and its config form is not
5014
+ * reachable. `'active'` (the default) is every plugin that activated
5015
+ * successfully. Defaults to `'active'` for wire back-compat with
5016
+ * responses that predate this field.
5017
+ */
5018
+ status: z47.enum(["active", "failed"]).default("active"),
5019
+ /** Present only when `status: 'failed'` — the activation error message. */
5020
+ error: z47.string().optional()
4918
5021
  });
4919
- var ListPluginsResponseSchema = z46.object({
4920
- plugins: z46.array(PluginInfoSchema)
5022
+ var ListPluginsResponseSchema = z47.object({
5023
+ plugins: z47.array(PluginInfoSchema)
4921
5024
  });
4922
- var PluginConfigResponseSchema = z46.object({
4923
- name: z46.string(),
4924
- fields: z46.array(PluginFieldSchema),
4925
- values: z46.record(z46.string(), z46.unknown())
5025
+ var PluginConfigResponseSchema = z47.object({
5026
+ name: z47.string(),
5027
+ fields: z47.array(PluginFieldSchema),
5028
+ values: z47.record(z47.string(), z47.unknown())
4926
5029
  });
4927
- var UpdatePluginConfigRequestSchema = z46.object({
4928
- values: z46.record(z46.string(), z46.unknown())
5030
+ var UpdatePluginConfigRequestSchema = z47.object({
5031
+ values: z47.record(z47.string(), z47.unknown())
4929
5032
  });
4930
- var UpdatePluginConfigResponseSchema = z46.object({
4931
- ok: z46.literal(true),
5033
+ var UpdatePluginConfigResponseSchema = z47.object({
5034
+ ok: z47.literal(true),
4932
5035
  /**
4933
5036
  * Whether at least one plugin's `reconfigure` hook ran successfully
4934
5037
  * for this save. `true` means the new values are already live on
@@ -4938,43 +5041,43 @@ var UpdatePluginConfigResponseSchema = z46.object({
4938
5041
  * "saved, but apply failed" warning in that case via the response
4939
5042
  * `reconfigureFailed` flag.
4940
5043
  */
4941
- hotReloaded: z46.boolean(),
5044
+ hotReloaded: z47.boolean(),
4942
5045
  /**
4943
5046
  * True when at least one plugin's `reconfigure` was attempted and
4944
5047
  * threw. The save itself succeeded (Mongo + cache are updated) so
4945
5048
  * the next process boot will see the new values, but the *running*
4946
5049
  * process couldn't apply them. UI surfaces a warning toast.
4947
5050
  */
4948
- reconfigureFailed: z46.boolean()
5051
+ reconfigureFailed: z47.boolean()
4949
5052
  });
4950
- var PluginNotFoundErrorSchema = z46.object({
4951
- error: z46.object({
4952
- code: z46.literal("PLUGIN_NOT_FOUND"),
4953
- message: z46.string()
5053
+ var PluginNotFoundErrorSchema = z47.object({
5054
+ error: z47.object({
5055
+ code: z47.literal("PLUGIN_NOT_FOUND"),
5056
+ message: z47.string()
4954
5057
  })
4955
5058
  });
4956
- var PluginConfigValidationErrorSchema = z46.object({
4957
- error: z46.object({
4958
- code: z46.literal("PLUGIN_CONFIG_VALIDATION_FAILED"),
4959
- message: z46.string(),
4960
- issues: z46.array(
4961
- z46.object({
4962
- path: z46.array(z46.union([z46.string(), z46.number()])),
4963
- message: z46.string()
5059
+ var PluginConfigValidationErrorSchema = z47.object({
5060
+ error: z47.object({
5061
+ code: z47.literal("PLUGIN_CONFIG_VALIDATION_FAILED"),
5062
+ message: z47.string(),
5063
+ issues: z47.array(
5064
+ z47.object({
5065
+ path: z47.array(z47.union([z47.string(), z47.number()])),
5066
+ message: z47.string()
4964
5067
  })
4965
5068
  )
4966
5069
  })
4967
5070
  });
4968
- var ClearRenderCacheResponseSchema = z46.object({
4969
- ok: z46.literal(true),
4970
- clearedAt: z46.string(),
5071
+ var ClearRenderCacheResponseSchema = z47.object({
5072
+ ok: z47.literal(true),
5073
+ clearedAt: z47.string(),
4971
5074
  /** Number of cache rows removed. */
4972
- removedCount: z46.number().int().min(0)
5075
+ removedCount: z47.number().int().min(0)
4973
5076
  });
4974
5077
 
4975
5078
  // src/contracts/admin/plugins.ts
4976
- var PluginNameQuerySchema = z47.object({ name: z47.string() });
4977
- var PluginConfigQuerySchema = z47.object({ name: z47.string(), locale: z47.string().optional() });
5079
+ var PluginNameQuerySchema = z48.object({ name: z48.string() });
5080
+ var PluginConfigQuerySchema = z48.object({ name: z48.string(), locale: z48.string().optional() });
4978
5081
  var listPluginsRoute = createRoute29({
4979
5082
  method: "get",
4980
5083
  path: "/admin/plugins",
@@ -5071,7 +5174,7 @@ var updatePluginConfigRoute = createRoute29({
5071
5174
  }
5072
5175
  }
5073
5176
  });
5074
- var ClearRenderCacheBodySchema = z47.object({}).optional();
5177
+ var ClearRenderCacheBodySchema = z48.object({}).optional();
5075
5178
  var clearRenderCacheAllRoute = createRoute29({
5076
5179
  method: "post",
5077
5180
  path: "/admin/plugins/render-cache/clear-all",
@@ -5149,21 +5252,21 @@ var adminPluginsRoutes = {
5149
5252
  import { createRoute as createRoute30 } from "@hono/zod-openapi";
5150
5253
 
5151
5254
  // src/schemas/admin/search.ts
5152
- import { z as z48 } from "@hono/zod-openapi";
5153
- var SearchDriverEntrySchema = z48.object({
5154
- driverName: z48.string(),
5155
- pluginName: z48.string(),
5156
- isActive: z48.boolean(),
5157
- supportsRebuild: z48.boolean()
5158
- });
5159
- var ActiveSearchDriverSchema = z48.object({
5160
- driverName: z48.string(),
5161
- pluginName: z48.string(),
5162
- supportsRebuild: z48.boolean()
5163
- });
5164
- var GetSearchStatusResponseSchema = z48.object({
5255
+ import { z as z49 } from "@hono/zod-openapi";
5256
+ var SearchDriverEntrySchema = z49.object({
5257
+ driverName: z49.string(),
5258
+ pluginName: z49.string(),
5259
+ isActive: z49.boolean(),
5260
+ supportsRebuild: z49.boolean()
5261
+ });
5262
+ var ActiveSearchDriverSchema = z49.object({
5263
+ driverName: z49.string(),
5264
+ pluginName: z49.string(),
5265
+ supportsRebuild: z49.boolean()
5266
+ });
5267
+ var GetSearchStatusResponseSchema = z49.object({
5165
5268
  active: ActiveSearchDriverSchema.nullable(),
5166
- drivers: z48.array(SearchDriverEntrySchema)
5269
+ drivers: z49.array(SearchDriverEntrySchema)
5167
5270
  });
5168
5271
 
5169
5272
  // src/contracts/admin/search.ts
@@ -5200,11 +5303,11 @@ var adminSearchRoutes = {
5200
5303
  import { createRoute as createRoute31 } from "@hono/zod-openapi";
5201
5304
 
5202
5305
  // src/schemas/admin/security.ts
5203
- import { z as z49 } from "@hono/zod-openapi";
5204
- var RegistrationModeSchema = z49.enum(["Open", "Resricted", "Closed"]);
5205
- var SecuritySettingsSchema = z49.object({
5306
+ import { z as z50 } from "@hono/zod-openapi";
5307
+ var RegistrationModeSchema = z50.enum(["Open", "Resricted", "Closed"]);
5308
+ var SecuritySettingsSchema = z50.object({
5206
5309
  registrationMode: RegistrationModeSchema,
5207
- registrationWhiteList: z49.array(z49.string())
5310
+ registrationWhiteList: z50.array(z50.string())
5208
5311
  });
5209
5312
  var UpdateSecuritySettingsRequestSchema = SecuritySettingsSchema;
5210
5313
  var GetSecuritySettingsResponseSchema = SecuritySettingsSchema;
@@ -5275,19 +5378,19 @@ var adminSecurityRoutes = {
5275
5378
  import { createRoute as createRoute32 } from "@hono/zod-openapi";
5276
5379
 
5277
5380
  // src/schemas/admin/storage.ts
5278
- import { z as z50 } from "@hono/zod-openapi";
5279
- var StorageDriverEntrySchema = z50.object({
5280
- driverName: z50.string(),
5281
- pluginName: z50.string(),
5282
- isActive: z50.boolean()
5381
+ import { z as z51 } from "@hono/zod-openapi";
5382
+ var StorageDriverEntrySchema = z51.object({
5383
+ driverName: z51.string(),
5384
+ pluginName: z51.string(),
5385
+ isActive: z51.boolean()
5283
5386
  });
5284
- var ActiveStorageDriverSchema = z50.object({
5285
- driverName: z50.string(),
5286
- pluginName: z50.string()
5387
+ var ActiveStorageDriverSchema = z51.object({
5388
+ driverName: z51.string(),
5389
+ pluginName: z51.string()
5287
5390
  });
5288
- var GetStorageStatusResponseSchema = z50.object({
5391
+ var GetStorageStatusResponseSchema = z51.object({
5289
5392
  active: ActiveStorageDriverSchema.nullable(),
5290
- drivers: z50.array(StorageDriverEntrySchema)
5393
+ drivers: z51.array(StorageDriverEntrySchema)
5291
5394
  });
5292
5395
 
5293
5396
  // src/contracts/admin/storage.ts
@@ -5324,87 +5427,87 @@ var adminStorageRoutes = {
5324
5427
  import { createRoute as createRoute33 } from "@hono/zod-openapi";
5325
5428
 
5326
5429
  // src/schemas/admin/users.ts
5327
- import { z as z52 } from "@hono/zod-openapi";
5430
+ import { z as z53 } from "@hono/zod-openapi";
5328
5431
 
5329
5432
  // src/schemas/admin/_pager.ts
5330
- import { z as z51 } from "@hono/zod-openapi";
5331
- var AdminPagerSchema = z51.object({
5332
- page: z51.number(),
5333
- pagesCount: z51.number(),
5334
- pages: z51.array(z51.number()),
5335
- total: z51.number(),
5336
- previous: z51.number().nullable(),
5337
- previousDots: z51.boolean(),
5338
- next: z51.number().nullable(),
5339
- nextDots: z51.boolean()
5433
+ import { z as z52 } from "@hono/zod-openapi";
5434
+ var AdminPagerSchema = z52.object({
5435
+ page: z52.number(),
5436
+ pagesCount: z52.number(),
5437
+ pages: z52.array(z52.number()),
5438
+ total: z52.number(),
5439
+ previous: z52.number().nullable(),
5440
+ previousDots: z52.boolean(),
5441
+ next: z52.number().nullable(),
5442
+ nextDots: z52.boolean()
5340
5443
  });
5341
5444
 
5342
5445
  // src/schemas/admin/users.ts
5343
- var ListAdminUsersRequestSchema = z52.object({
5344
- q: z52.string().optional(),
5446
+ var ListAdminUsersRequestSchema = z53.object({
5447
+ q: z53.string().optional(),
5345
5448
  /**
5346
5449
  * Optional numeric user-status filter (see `UserStatusEnum`). When set, only
5347
5450
  * users in that status are returned — used by the "user approval" queue
5348
5451
  * screen to list `REGISTERED` (= awaiting admin approval) users.
5349
5452
  */
5350
- status: z52.coerce.number().int().optional(),
5351
- page: z52.coerce.number().int().min(1).optional().default(1),
5352
- limit: z52.coerce.number().int().min(1).max(100).optional().default(50)
5453
+ status: z53.coerce.number().int().optional(),
5454
+ page: z53.coerce.number().int().min(1).optional().default(1),
5455
+ limit: z53.coerce.number().int().min(1).max(100).optional().default(50)
5353
5456
  });
5354
- var ListAdminUsersResponseSchema = z52.object({
5355
- users: z52.array(UserPublicSchema),
5457
+ var ListAdminUsersResponseSchema = z53.object({
5458
+ users: z53.array(UserPublicSchema),
5356
5459
  pager: AdminPagerSchema
5357
5460
  });
5358
- var SearchAdminUsersByEmailRequestSchema = z52.object({
5359
- email: z52.string().min(1)
5461
+ var SearchAdminUsersByEmailRequestSchema = z53.object({
5462
+ email: z53.string().min(1)
5360
5463
  });
5361
- var SearchAdminUsersByEmailResponseSchema = z52.object({
5362
- users: z52.array(UserPublicSchema)
5464
+ var SearchAdminUsersByEmailResponseSchema = z53.object({
5465
+ users: z53.array(UserPublicSchema)
5363
5466
  });
5364
- var AdminUserIdParamSchema = z52.object({
5365
- id: z52.string()
5467
+ var AdminUserIdParamSchema = z53.object({
5468
+ id: z53.string()
5366
5469
  });
5367
- var InviteUsersRequestSchema = z52.object({
5368
- emailList: z52.array(z52.string().email()).min(1),
5369
- sendEmail: z52.boolean().optional().default(false)
5470
+ var InviteUsersRequestSchema = z53.object({
5471
+ emailList: z53.array(z53.string().email()).min(1),
5472
+ sendEmail: z53.boolean().optional().default(false)
5370
5473
  });
5371
- var InvitedUserResultSchema = z52.discriminatedUnion("status", [
5372
- z52.object({
5373
- email: z52.string(),
5374
- status: z52.literal("created"),
5375
- userId: z52.string()
5474
+ var InvitedUserResultSchema = z53.discriminatedUnion("status", [
5475
+ z53.object({
5476
+ email: z53.string(),
5477
+ status: z53.literal("created"),
5478
+ userId: z53.string()
5376
5479
  }),
5377
- z52.object({
5378
- email: z52.string(),
5379
- status: z52.literal("exists")
5480
+ z53.object({
5481
+ email: z53.string(),
5482
+ status: z53.literal("exists")
5380
5483
  }),
5381
- z52.object({
5382
- email: z52.string(),
5383
- status: z52.literal("failed")
5484
+ z53.object({
5485
+ email: z53.string(),
5486
+ status: z53.literal("failed")
5384
5487
  })
5385
5488
  ]);
5386
- var InviteUsersResponseSchema = z52.object({
5387
- results: z52.array(InvitedUserResultSchema)
5489
+ var InviteUsersResponseSchema = z53.object({
5490
+ results: z53.array(InvitedUserResultSchema)
5388
5491
  });
5389
- var EditAdminUserRequestSchema = z52.object({
5390
- name: z52.string().min(1),
5391
- email: z52.string().email()
5492
+ var EditAdminUserRequestSchema = z53.object({
5493
+ name: z53.string().min(1),
5494
+ email: z53.string().email()
5392
5495
  });
5393
- var AdminUserMutationResponseSchema = z52.object({
5496
+ var AdminUserMutationResponseSchema = z53.object({
5394
5497
  user: UserPublicSchema
5395
5498
  });
5396
- var ResetPasswordResponseSchema = z52.object({
5499
+ var ResetPasswordResponseSchema = z53.object({
5397
5500
  user: UserPublicSchema,
5398
- newPassword: z52.string()
5501
+ newPassword: z53.string()
5399
5502
  });
5400
- var UpdateAdminUserEmailRequestSchema = z52.object({
5401
- email: z52.string().email()
5503
+ var UpdateAdminUserEmailRequestSchema = z53.object({
5504
+ email: z53.string().email()
5402
5505
  });
5403
- var DeleteAdminUserResponseSchema = z52.object({
5404
- deletedId: z52.string()
5506
+ var DeleteAdminUserResponseSchema = z53.object({
5507
+ deletedId: z53.string()
5405
5508
  });
5406
- var PendingUsersCountResponseSchema = z52.object({
5407
- count: z52.number().int().nonnegative()
5509
+ var PendingUsersCountResponseSchema = z53.object({
5510
+ count: z53.number().int().nonnegative()
5408
5511
  });
5409
5512
 
5410
5513
  // src/contracts/admin/users.ts
@@ -6166,7 +6269,7 @@ var appAuthMeUserChain = new OpenAPIHono().openapi(
6166
6269
  )
6167
6270
  ).openapi(meRoutes.getProfileRoute, (c) => c.json(stubProfile, 200)).openapi(meRoutes.updateProfileRoute, (c) => c.json(stubProfile, 200)).openapi(meRoutes.updateThemeRoute, (c) => c.json({ status: "ok", theme: "system" }, 200)).openapi(meRoutes.uploadPictureRoute, (c) => c.json({ status: true }, 200)).openapi(meRoutes.deletePictureRoute, (c) => c.json({ status: "ok" }, 200)).openapi(meRoutes.updatePasswordRoute, (c) => c.json({ status: "ok", message: "" }, 200)).openapi(meRoutes.recentlyViewedPagesRoute, (c) => c.json({ pages: [] }, 200)).openapi(accessTokenRoutes.listAccessTokensRoute, (c) => c.json({ accessTokens: [] }, 200)).openapi(accessTokenRoutes.createAccessTokenRoute, (c) => c.json(stubCreateAccessToken, 201)).openapi(accessTokenRoutes.deleteAccessTokenRoute, (c) => c.json(stubAccessToken, 200)).openapi(userRoutes.getUserPageRoute, (c) => c.json(stubUserPage, 200)).openapi(userRoutes.getUserBookmarksRoute, (c) => c.json(stubUserBookmarks, 200)).openapi(userRoutes.getUserPagesRoute, (c) => c.json(stubUserPages, 200)).openapi(userRoutes.listMembersRoute, (c) => c.json(stubListUsers, 200));
6168
6271
  var bookmarkBacklinkCommentRevisionChain = new OpenAPIHono().openapi(bookmarkRoutes.getBookmarkRoute, (c) => c.json(stubBookmarkResponse, 200)).openapi(bookmarkRoutes.listMyBookmarksRoute, (c) => c.json(stubListMyBookmarks, 200)).openapi(bookmarkRoutes.addBookmarkRoute, (c) => c.json(stubBookmarkResponse, 200)).openapi(bookmarkRoutes.removeBookmarkRoute, (c) => c.json(stubRemoveBookmark, 200)).openapi(backlinkRoutes.getBacklinksRoute, (c) => c.json(stubBacklinks, 200)).openapi(commentRoutes.listCommentsRoute, (c) => c.json(stubListComments, 200)).openapi(commentRoutes.addCommentRoute, (c) => c.json(stubAddComment, 200)).openapi(commentRoutes.deleteCommentRoute, (c) => c.json(stubDeleteComment, 200)).openapi(revisionRoutes.listRevisionsRoute, (c) => c.json(stubListRevisions, 200)).openapi(revisionRoutes.getRevisionsRoute, (c) => c.json(stubGetRevisions, 200)).openapi(revisionRoutes.getRevisionRoute, (c) => c.json(stubGetRevision, 200));
6169
- var pageChain = new OpenAPIHono().openapi(pageRoutes.getPageRoute, (c) => c.json(stubPageWithRevision, 200)).openapi(pageRoutes.listPagesRoute, (c) => c.json(stubListPages, 200)).openapi(pageRoutes.listPageChildrenRoute, (c) => c.json(stubListPageChildren, 200)).openapi(pageRoutes.createPageRoute, (c) => c.json(stubPageResponse, 200)).openapi(pageRoutes.updatePageRoute, (c) => c.json(stubPageResponse, 200)).openapi(pageRoutes.setPageGrantRoute, (c) => c.json(stubPageResponse, 200)).openapi(pageRoutes.seenPageRoute, (c) => c.json(stubSeenUsers, 200)).openapi(pageRoutes.getSeenUsersRoute, (c) => c.json(stubSeenUsers, 200)).openapi(pageRoutes.likePageRoute, (c) => c.json(stubPageResponse, 200)).openapi(pageRoutes.unlikePageRoute, (c) => c.json(stubPageResponse, 200)).openapi(pageRoutes.getWatchStatusRoute, (c) => c.json(stubWatchStatus, 200)).openapi(pageRoutes.setWatchStatusRoute, (c) => c.json(stubWatchStatus, 200)).openapi(pageRoutes.deletePageRoute, (c) => c.json(stubPageResponse, 200)).openapi(pageRoutes.revertDeletedPageRoute, (c) => c.json(stubPageResponse, 200)).openapi(pageRoutes.revertToRevisionRoute, (c) => c.json(stubPageResponse, 200)).openapi(pageRoutes.renamePageRoute, (c) => c.json({ ...stubPageResponse, renamed_count: 1 }, 200)).openapi(pageRoutes.renameSubtreeRoute, (c) => c.json({ renamed_count: 0 }, 200)).openapi(pagePreviewRoutes.previewPageRoute, (c) => c.json(stubPreview, 200)).openapi(pageCollabRoutes.getYjsTokenRoute, (c) => c.json(stubWsToken, 200)).openapi(presenceRoutes.getPresenceTokenRoute, (c) => c.json(stubPresenceToken, 200)).openapi(presenceRoutes.getLikersRoute, (c) => c.json(stubLikers, 200));
6272
+ var pageChain = new OpenAPIHono().openapi(pageRoutes.getPageRoute, (c) => c.json(stubPageWithRevision, 200)).openapi(pageRoutes.listPagesRoute, (c) => c.json(stubListPages, 200)).openapi(pageRoutes.listPageChildrenRoute, (c) => c.json(stubListPageChildren, 200)).openapi(pageRoutes.createPageRoute, (c) => c.json(stubPageResponse, 200)).openapi(pageRoutes.updatePageRoute, (c) => c.json(stubPageResponse, 200)).openapi(pageRoutes.setPageGrantRoute, (c) => c.json(stubPageResponse, 200)).openapi(pageRoutes.seenPageRoute, (c) => c.json(stubSeenUsers, 200)).openapi(pageRoutes.getSeenUsersRoute, (c) => c.json(stubSeenUsers, 200)).openapi(pageRoutes.likePageRoute, (c) => c.json(stubPageResponse, 200)).openapi(pageRoutes.unlikePageRoute, (c) => c.json(stubPageResponse, 200)).openapi(pageRoutes.claimPageLinkAccessRoute, (c) => c.json({ ...stubPageWithRevision, granted: false }, 200)).openapi(pageRoutes.getWatchStatusRoute, (c) => c.json(stubWatchStatus, 200)).openapi(pageRoutes.setWatchStatusRoute, (c) => c.json(stubWatchStatus, 200)).openapi(pageRoutes.deletePageRoute, (c) => c.json(stubPageResponse, 200)).openapi(pageRoutes.revertDeletedPageRoute, (c) => c.json(stubPageResponse, 200)).openapi(pageRoutes.revertToRevisionRoute, (c) => c.json(stubPageResponse, 200)).openapi(pageRoutes.renamePageRoute, (c) => c.json({ ...stubPageResponse, renamed_count: 1 }, 200)).openapi(pageRoutes.renameSubtreeRoute, (c) => c.json({ renamed_count: 0 }, 200)).openapi(pagePreviewRoutes.previewPageRoute, (c) => c.json(stubPreview, 200)).openapi(pageCollabRoutes.getYjsTokenRoute, (c) => c.json(stubWsToken, 200)).openapi(presenceRoutes.getPresenceTokenRoute, (c) => c.json(stubPresenceToken, 200)).openapi(presenceRoutes.getLikersRoute, (c) => c.json(stubLikers, 200));
6170
6273
  var lateContractApp = new OpenAPIHono().openapi(draftRoutes.createDraftRoute, (c) => c.json(stubCreateDraft, 201)).openapi(draftRoutes.listDraftsRoute, (c) => c.json(stubListDrafts, 200)).openapi(draftRoutes.cancelDraftRoute, (c) => c.json(stubCreateDraft, 200)).openapi(autocompleteRoutes.autocompleteUsersRoute, (c) => c.json(stubAutocomplete, 200)).openapi(autocompleteRoutes.autocompletePagesRoute, (c) => c.json(stubAutocomplete, 200)).openapi(attachmentRoutes.getAttachmentUsageRoute, (c) => c.json(stubAttachmentUsage, 200)).openapi(attachmentRoutes.listAttachmentsRoute, (c) => c.json(stubListAttachments, 200)).openapi(attachmentRoutes.addAttachmentRoute, (c) => c.json(stubAddAttachment, 200)).openapi(attachmentRoutes.uploadAttachmentRoute, (c) => c.json(stubUploadAttachment, 200)).openapi(attachmentRoutes.getAttachmentMetaRoute, (c) => c.json(stubAttachmentMeta, 200)).openapi(attachmentRoutes.removeAttachmentRoute, (c) => c.json(stubRemoveAttachment, 200)).openapi(searchRoutes.searchPagesRoute, (c) => c.json(stubSearchPages, 200)).openapi(adminCryptoRoutes.getCryptoStatusRoute, (c) => c.json(stubCryptoStatus, 200)).openapi(adminCryptoRoutes.reencryptAllRoute, (c) => c.json(stubReencrypt, 200)).openapi(notificationRoutes.listNotificationsRoute, (c) => c.json(stubListNotifications, 200)).openapi(notificationRoutes.markAllAsReadRoute, (c) => c.json(stubMarkAllAsRead, 200)).openapi(notificationRoutes.getNotificationsTokenRoute, (c) => c.json(stubNotificationsToken, 200)).openapi(notificationRoutes.getUnreadCountRoute, (c) => c.json(stubNotificationStatus, 200)).openapi(notificationRoutes.openNotificationRoute, (c) => c.json(stubOpenNotification, 200));
6171
6274
  var adminSettingsContractApp = new OpenAPIHono().openapi(adminAppRoutes.getAppSettingsRoute, (c) => c.json(stubGetAppSettings, 200)).openapi(adminAppRoutes.updateAppSettingsRoute, (c) => c.json(stubUpdateAppSettings, 200)).openapi(adminAuthRoutes.getAuthSettingsRoute, (c) => c.json(stubAuthSettings, 200)).openapi(adminAuthRoutes.updateAuthSettingsRoute, (c) => c.json(stubAuthSettings, 200)).openapi(adminSecurityRoutes.getSecuritySettingsRoute, (c) => c.json(stubSecuritySettings, 200)).openapi(adminSecurityRoutes.updateSecuritySettingsRoute, (c) => c.json(stubSecuritySettings, 200)).openapi(adminMailRoutes.getMailSettingsRoute, (c) => c.json(stubMailSettings, 200)).openapi(adminMailRoutes.updateMailSettingsRoute, (c) => c.json(stubUpdateMailSettings, 200)).openapi(adminMailRoutes.sendTestMailRoute, (c) => c.json(stubSendTestMail, 200)).openapi(adminStorageRoutes.getStorageStatusRoute, (c) => c.json(stubStorageStatus, 200)).openapi(adminSearchRoutes.getSearchStatusRoute, (c) => c.json(stubSearchStatus, 200));
6172
6275
  var adminUsersPluginsContractApp = new OpenAPIHono().openapi(adminUsersRoutes.listUsersRoute, (c) => c.json(stubListAdminUsers, 200)).openapi(adminUsersRoutes.searchUsersByEmailRoute, (c) => c.json(stubSearchAdminUsersByEmail, 200)).openapi(adminUsersRoutes.pendingUsersCountRoute, (c) => c.json(stubPendingUsersCount, 200)).openapi(adminUsersRoutes.inviteUsersRoute, (c) => c.json(stubInviteUsers, 200)).openapi(adminUsersRoutes.editUserRoute, (c) => c.json(stubAdminUserMutation, 200)).openapi(adminUsersRoutes.makeAdminRoute, (c) => c.json(stubAdminUserMutation, 200)).openapi(adminUsersRoutes.removeFromAdminRoute, (c) => c.json(stubAdminUserMutation, 200)).openapi(adminUsersRoutes.activateUserRoute, (c) => c.json(stubAdminUserMutation, 200)).openapi(adminUsersRoutes.suspendUserRoute, (c) => c.json(stubAdminUserMutation, 200)).openapi(adminUsersRoutes.resetPasswordRoute, (c) => c.json(stubResetPassword, 200)).openapi(adminUsersRoutes.resendInviteRoute, (c) => c.json(stubAdminUserMutation, 200)).openapi(adminUsersRoutes.updateUserEmailRoute, (c) => c.json(stubAdminUserMutation, 200)).openapi(adminUsersRoutes.deleteUserRoute, (c) => c.json(stubDeleteAdminUser, 200)).openapi(adminPluginsRoutes.listPluginsRoute, (c) => c.json(stubListPlugins, 200)).openapi(adminPluginsRoutes.getPluginConfigRoute, (c) => c.json(stubPluginConfig, 200)).openapi(adminPluginsRoutes.updatePluginConfigRoute, (c) => c.json(stubUpdatePluginConfig, 200)).openapi(adminPluginsRoutes.clearRenderCacheAllRoute, (c) => c.json(stubClearRenderCache, 200)).openapi(adminPluginsRoutes.clearRenderCachePluginRoute, (c) => c.json(stubClearRenderCache, 200));
@@ -6176,42 +6279,26 @@ var createClient = (baseUrl, options = {}) => hc(baseUrl, {
6176
6279
  fetch: options.fetch
6177
6280
  });
6178
6281
 
6179
- // src/schemas/app-capabilities.ts
6180
- var STATIC_CAPABILITIES = [
6181
- "oauth",
6182
- // The oauth:* tags mirror GRANT_TYPES_SUPPORTED + the S256 PKCE method
6183
- // (schemas/oauth-endpoints.ts / the RFC 8414 discovery doc). Keep in sync.
6184
- "oauth:auth-code",
6185
- "oauth:device",
6186
- "oauth:pkce",
6187
- "pat",
6188
- "pages",
6189
- "comments",
6190
- "bookmarks",
6191
- "attachments",
6192
- "notifications"
6193
- ];
6194
- var API_SURFACE_VERSION = "v2";
6195
-
6196
6282
  // src/schemas/mail-token.ts
6197
- import { z as z54 } from "@hono/zod-openapi";
6198
- var MailTokenPurposeSchema = z54.enum(["invite", "activate", "reset", "email-change"]);
6199
- var MailTokenPayloadSchema = z54.object({
6283
+ import { z as z55 } from "@hono/zod-openapi";
6284
+ var MailTokenPurposeSchema = z55.enum(["invite", "activate", "reset", "email-change"]);
6285
+ var MailTokenPayloadSchema = z55.object({
6200
6286
  purpose: MailTokenPurposeSchema,
6201
- userId: z54.string(),
6287
+ userId: z55.string(),
6202
6288
  /** Target address. For `email-change` this is the NEW address. */
6203
- email: z54.string().email(),
6289
+ email: z55.string().email(),
6204
6290
  /**
6205
6291
  * For `email-change`: the account's email at issue time. The confirm
6206
6292
  * endpoint rejects the token unless it still matches, making the token
6207
6293
  * single-use (a stale token cannot revert a later change).
6208
6294
  */
6209
- fromEmail: z54.string().email().optional(),
6295
+ fromEmail: z55.string().email().optional(),
6210
6296
  // iat / exp are injected and verified by the JWT layer.
6211
- iat: z54.number().optional(),
6212
- exp: z54.number().optional()
6297
+ iat: z55.number().optional(),
6298
+ exp: z55.number().optional()
6213
6299
  });
6214
6300
  export {
6301
+ ALL_CAPABILITIES,
6215
6302
  ALL_SCOPES,
6216
6303
  API_SURFACE_VERSION,
6217
6304
  AccessTokenSchema,
@@ -6250,6 +6337,8 @@ export {
6250
6337
  BacklinkSchema,
6251
6338
  BookmarkResponseSchema,
6252
6339
  BookmarkSchema,
6340
+ CapabilitySchema,
6341
+ ClaimPageLinkAccessResponseSchema,
6253
6342
  ClearRenderCacheResponseSchema,
6254
6343
  CollabForceReloadMessageSchema,
6255
6344
  CollabSaveErrorSchema,
@@ -6273,6 +6362,7 @@ export {
6273
6362
  DEVICE_CODE_GRANT_TYPE,
6274
6363
  DISCOVERY_SCOPES_SUPPORTED,
6275
6364
  DND_EXTRA_UPLOAD_MIME,
6365
+ DYNAMIC_CAPABILITIES,
6276
6366
  DeleteAdminUserResponseSchema,
6277
6367
  DeleteCommentRequestSchema,
6278
6368
  DeleteCommentResponseSchema,
@@ -6526,6 +6616,7 @@ export {
6526
6616
  backlinkRoutes,
6527
6617
  bookmarkRoutes,
6528
6618
  cancelDraftRoute,
6619
+ claimPageLinkAccessRoute,
6529
6620
  clearRenderCacheAllRoute,
6530
6621
  clearRenderCachePluginRoute,
6531
6622
  commentRoutes,