@crowi/api-contract 2.0.0-alpha.5 → 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
 
@@ -2572,6 +2600,10 @@ var listCommentsRoute = createRoute14({
2572
2600
  401: {
2573
2601
  description: "Authentication required",
2574
2602
  content: { "application/json": { schema: AuthenticationRequiredErrorSchema } }
2603
+ },
2604
+ 404: {
2605
+ description: "Page / revision not found, or the caller cannot access it (existence hidden)",
2606
+ content: { "application/json": { schema: PageNotFoundErrorSchema } }
2575
2607
  }
2576
2608
  }
2577
2609
  });
@@ -2646,49 +2678,49 @@ var commentRoutes = {
2646
2678
  };
2647
2679
 
2648
2680
  // src/contracts/revision.ts
2649
- import { createRoute as createRoute15, z as z27 } from "@hono/zod-openapi";
2681
+ import { createRoute as createRoute15, z as z28 } from "@hono/zod-openapi";
2650
2682
 
2651
2683
  // src/schemas/revision.ts
2652
- import { z as z26 } from "@hono/zod-openapi";
2653
- var RevisionMetaSchema = z26.object({
2654
- _id: z26.string(),
2655
- 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(),
2656
2688
  author: PageUserSchema.nullable().optional(),
2657
2689
  savedBy: PageUserSchema.nullable().optional(),
2658
- contributors: z26.array(PageUserSchema).optional(),
2690
+ contributors: z27.array(PageUserSchema).optional(),
2659
2691
  // RFC-0010 — edit channel. `web` (browser / collab editor) vs the API
2660
2692
  // token paths (`oauth` / `pat`). Absent on pre-RFC-0010 revisions. The
2661
2693
  // history UI shows an "app" chip for the token paths.
2662
- editVia: z26.enum(["web", "oauth", "pat"]).optional(),
2663
- createdAt: z26.string()
2694
+ editVia: z27.enum(["web", "oauth", "pat"]).optional(),
2695
+ createdAt: z27.string()
2664
2696
  });
2665
- var ListRevisionsRequestSchema = z26.object({
2666
- limit: z26.coerce.number().int().positive().max(200).optional().default(50),
2667
- 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)
2668
2700
  });
2669
- var ListRevisionsResponseSchema = z26.object({
2670
- revisions: z26.array(RevisionMetaSchema),
2701
+ var ListRevisionsResponseSchema = z27.object({
2702
+ revisions: z27.array(RevisionMetaSchema),
2671
2703
  pager: PagerSchema
2672
2704
  });
2673
- var GetRevisionResponseSchema = z26.object({
2705
+ var GetRevisionResponseSchema = z27.object({
2674
2706
  revision: RevisionSchema
2675
2707
  });
2676
- var GetRevisionsRequestSchema = z26.object({
2677
- ids: z26.string().min(1, "ids is required")
2708
+ var GetRevisionsRequestSchema = z27.object({
2709
+ ids: z27.string().min(1, "ids is required")
2678
2710
  });
2679
- var GetRevisionsResponseSchema = z26.object({
2680
- revisions: z26.array(RevisionSchema)
2711
+ var GetRevisionsResponseSchema = z27.object({
2712
+ revisions: z27.array(RevisionSchema)
2681
2713
  });
2682
- var RevisionInvalidRequestErrorSchema = z26.object({
2683
- error: z26.object({
2684
- code: z26.literal("INVALID_REQUEST"),
2685
- message: z26.string()
2714
+ var RevisionInvalidRequestErrorSchema = z27.object({
2715
+ error: z27.object({
2716
+ code: z27.literal("INVALID_REQUEST"),
2717
+ message: z27.string()
2686
2718
  })
2687
2719
  });
2688
2720
 
2689
2721
  // src/contracts/revision.ts
2690
- var PageIdParamSchema = z27.object({ page_id: z27.string() });
2691
- var RevisionIdParamSchema = z27.object({ id: z27.string() });
2722
+ var PageIdParamSchema = z28.object({ page_id: z28.string() });
2723
+ var RevisionIdParamSchema = z28.object({ id: z28.string() });
2692
2724
  var listRevisionsRoute = createRoute15({
2693
2725
  method: "get",
2694
2726
  path: "/pages/{page_id}/revisions",
@@ -2784,24 +2816,24 @@ var revisionRoutes = {
2784
2816
  };
2785
2817
 
2786
2818
  // src/contracts/notification.ts
2787
- import { createRoute as createRoute16, z as z29 } from "@hono/zod-openapi";
2819
+ import { createRoute as createRoute16, z as z30 } from "@hono/zod-openapi";
2788
2820
 
2789
2821
  // src/schemas/notification.ts
2790
- import { z as z28 } from "@hono/zod-openapi";
2791
- var NotificationStatusSchema = z28.enum(["UNREAD", "UNOPENED", "OPENED"]);
2822
+ import { z as z29 } from "@hono/zod-openapi";
2823
+ var NotificationStatusSchema = z29.enum(["UNREAD", "UNOPENED", "OPENED"]);
2792
2824
  var NotificationStatusEnum = {
2793
2825
  UNREAD: "UNREAD",
2794
2826
  UNOPENED: "UNOPENED",
2795
2827
  OPENED: "OPENED"
2796
2828
  };
2797
- var NotificationActionSchema = z28.enum(["COMMENT", "LIKE", "MENTION", "UPDATE"]);
2829
+ var NotificationActionSchema = z29.enum(["COMMENT", "LIKE", "MENTION", "UPDATE"]);
2798
2830
  var NotificationActionEnum = {
2799
2831
  COMMENT: "COMMENT",
2800
2832
  LIKE: "LIKE",
2801
2833
  MENTION: "MENTION",
2802
2834
  UPDATE: "UPDATE"
2803
2835
  };
2804
- var NotificationTargetModelSchema = z28.enum(["Page"]);
2836
+ var NotificationTargetModelSchema = z29.enum(["Page"]);
2805
2837
  var NotificationTargetModelEnum = {
2806
2838
  PAGE: "Page"
2807
2839
  };
@@ -2810,68 +2842,68 @@ var PageRefSchema = PageSchema.pick({
2810
2842
  path: true,
2811
2843
  status: true
2812
2844
  });
2813
- var NotificationSchema = z28.object({
2814
- _id: z28.string(),
2815
- user: z28.string(),
2845
+ var NotificationSchema = z29.object({
2846
+ _id: z29.string(),
2847
+ user: z29.string(),
2816
2848
  targetModel: NotificationTargetModelSchema,
2817
2849
  target: PageRefSchema,
2818
2850
  action: NotificationActionSchema,
2819
2851
  status: NotificationStatusSchema,
2820
- actionUsers: z28.array(UserPublicSchema),
2821
- createdAt: z28.string()
2852
+ actionUsers: z29.array(UserPublicSchema),
2853
+ createdAt: z29.string()
2822
2854
  });
2823
- var ListNotificationsRequestSchema = z28.object({
2824
- limit: z28.coerce.number().optional().default(10),
2825
- 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)
2826
2858
  });
2827
- var ListNotificationsResponseSchema = z28.object({
2828
- notifications: z28.array(NotificationSchema),
2859
+ var ListNotificationsResponseSchema = z29.object({
2860
+ notifications: z29.array(NotificationSchema),
2829
2861
  pager: PagerSchema
2830
2862
  });
2831
- var MarkAllAsReadResponseSchema = z28.object({
2832
- ok: z28.literal(true)
2863
+ var MarkAllAsReadResponseSchema = z29.object({
2864
+ ok: z29.literal(true)
2833
2865
  });
2834
- var OpenNotificationParamSchema = z28.object({
2835
- id: z28.string()
2866
+ var OpenNotificationParamSchema = z29.object({
2867
+ id: z29.string()
2836
2868
  });
2837
- var OpenNotificationResponseSchema = z28.object({
2869
+ var OpenNotificationResponseSchema = z29.object({
2838
2870
  notification: NotificationSchema
2839
2871
  });
2840
- var NotificationStatusResponseSchema = z28.object({
2841
- count: z28.number()
2872
+ var NotificationStatusResponseSchema = z29.object({
2873
+ count: z29.number()
2842
2874
  });
2843
- var NotificationNotFoundErrorSchema = z28.object({
2844
- error: z28.object({
2845
- code: z28.literal("NOTIFICATION_NOT_FOUND"),
2846
- 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")
2847
2879
  })
2848
2880
  });
2849
- var NotificationsTokenResponseSchema = z28.object({
2850
- token: z28.string(),
2851
- selfUserId: z28.string(),
2852
- expiresAt: z28.string()
2881
+ var NotificationsTokenResponseSchema = z29.object({
2882
+ token: z29.string(),
2883
+ selfUserId: z29.string(),
2884
+ expiresAt: z29.string()
2853
2885
  });
2854
- var NotificationsTokenPayloadSchema = z28.object({
2855
- selfUserId: z28.string(),
2886
+ var NotificationsTokenPayloadSchema = z29.object({
2887
+ selfUserId: z29.string(),
2856
2888
  // Random UUID mixed into every signed token so two tokens minted
2857
2889
  // within the same second still produce byte-different JWT strings.
2858
2890
  // The browser uses the token as a React effect dependency to drive
2859
2891
  // the WebSocket reconnect — without `jti`, the iat/exp pair is
2860
2892
  // identical at second granularity and the dep stays stable.
2861
- jti: z28.string().uuid(),
2862
- iat: z28.number().int(),
2863
- exp: z28.number().int()
2893
+ jti: z29.string().uuid(),
2894
+ iat: z29.number().int(),
2895
+ exp: z29.number().int()
2864
2896
  });
2865
- var NotificationsChangedMessageSchema = z28.object({
2866
- type: z28.literal("changed")
2897
+ var NotificationsChangedMessageSchema = z29.object({
2898
+ type: z29.literal("changed")
2867
2899
  });
2868
2900
  var NotificationsServerMessageSchema = NotificationsChangedMessageSchema;
2869
2901
 
2870
2902
  // src/contracts/notification.ts
2871
- var NotificationInvalidRequestErrorSchema = z29.object({
2872
- error: z29.object({
2873
- code: z29.literal("INVALID_REQUEST"),
2874
- message: z29.string()
2903
+ var NotificationInvalidRequestErrorSchema = z30.object({
2904
+ error: z30.object({
2905
+ code: z30.literal("INVALID_REQUEST"),
2906
+ message: z30.string()
2875
2907
  })
2876
2908
  });
2877
2909
  var listNotificationsRoute = createRoute16({
@@ -3007,25 +3039,59 @@ var notificationRoutes = {
3007
3039
  };
3008
3040
 
3009
3041
  // src/contracts/page.ts
3010
- import { createRoute as createRoute17, z as z30 } from "@hono/zod-openapi";
3011
- var PageBadRequestErrorSchema = z30.object({
3012
- error: z30.object({
3013
- code: z30.string(),
3014
- 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()
3015
3081
  })
3016
3082
  });
3017
- var DeletePageRequestSchema = z30.object({
3018
- page_id: z30.string(),
3019
- revision_id: z30.string().optional(),
3020
- 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()
3021
3087
  });
3022
- var RevertDeletedPageRequestSchema = z30.object({
3023
- page_id: z30.string()
3088
+ var RevertDeletedPageRequestSchema = z32.object({
3089
+ page_id: z32.string()
3024
3090
  });
3025
- var PageIdBodySchema = z30.object({
3026
- page_id: z30.string()
3091
+ var PageIdBodySchema = z32.object({
3092
+ page_id: z32.string()
3027
3093
  });
3028
- var PageResponseSchema = z30.object({ page: PageSchema });
3094
+ var PageResponseSchema = z32.object({ page: PageSchema });
3029
3095
  var getPageRoute = createRoute17({
3030
3096
  method: "get",
3031
3097
  path: "/pages",
@@ -3051,6 +3117,15 @@ var getPageRoute = createRoute17({
3051
3117
  404: {
3052
3118
  description: "Page not found",
3053
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 } }
3054
3129
  }
3055
3130
  }
3056
3131
  });
@@ -3302,6 +3377,52 @@ var unlikePageRoute = createRoute17({
3302
3377
  }
3303
3378
  }
3304
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
+ });
3305
3426
  var getWatchStatusRoute = createRoute17({
3306
3427
  method: "get",
3307
3428
  path: "/pages/watch",
@@ -3474,7 +3595,7 @@ var renamePageRoute = createRoute17({
3474
3595
  description: "PAGE_INVALID_NAME / PAGE_EXISTS / PAGE_RENAME_FAILED / PAGE_RENAME_TREE_FAILED",
3475
3596
  content: {
3476
3597
  "application/json": {
3477
- schema: z30.union([PageBadRequestErrorSchema, RenameTreeErrorSchema])
3598
+ schema: z32.union([PageBadRequestErrorSchema, RenameTreeErrorSchema])
3478
3599
  }
3479
3600
  }
3480
3601
  },
@@ -3512,7 +3633,7 @@ var renameSubtreeRoute = createRoute17({
3512
3633
  description: "PAGE_INVALID_NAME / PAGE_RENAME_TREE_FAILED (collisions, nothing to move, or partial failure)",
3513
3634
  content: {
3514
3635
  "application/json": {
3515
- schema: z30.union([PageBadRequestErrorSchema, RenameTreeErrorSchema])
3636
+ schema: z32.union([PageBadRequestErrorSchema, RenameTreeErrorSchema])
3516
3637
  }
3517
3638
  }
3518
3639
  },
@@ -3543,6 +3664,8 @@ var pageRoutes = {
3543
3664
  likePageRoute,
3544
3665
  // POST /pages/unlike — unlikePage
3545
3666
  unlikePageRoute,
3667
+ // POST /pages/link-access — claimPageLinkAccess (grant-on-first-access)
3668
+ claimPageLinkAccessRoute,
3546
3669
  // GET /pages/watch — getWatchStatus
3547
3670
  getWatchStatusRoute,
3548
3671
  // PUT /pages/watch — setWatchStatus
@@ -3563,12 +3686,12 @@ var pageRoutes = {
3563
3686
  import { createRoute as createRoute18 } from "@hono/zod-openapi";
3564
3687
 
3565
3688
  // src/schemas/page-preview.ts
3566
- import { z as z31 } from "@hono/zod-openapi";
3567
- var PreviewPageRequestSchema = z31.object({
3568
- body: z31.string()
3689
+ import { z as z33 } from "@hono/zod-openapi";
3690
+ var PreviewPageRequestSchema = z33.object({
3691
+ body: z33.string()
3569
3692
  });
3570
- var PreviewPageResponseSchema = z31.object({
3571
- renderedAst: z31.unknown()
3693
+ var PreviewPageResponseSchema = z33.object({
3694
+ renderedAst: z33.unknown()
3572
3695
  });
3573
3696
 
3574
3697
  // src/contracts/page-preview.ts
@@ -3603,9 +3726,9 @@ var pagePreviewRoutes = {
3603
3726
  };
3604
3727
 
3605
3728
  // src/contracts/page-collab.ts
3606
- import { createRoute as createRoute19, z as z32 } from "@hono/zod-openapi";
3607
- var PageIdPathParamsSchema = z32.object({
3608
- 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" })
3609
3732
  });
3610
3733
  var getYjsTokenRoute = createRoute19({
3611
3734
  method: "get",
@@ -3644,59 +3767,77 @@ var pageCollabRoutes = {
3644
3767
  };
3645
3768
 
3646
3769
  // src/contracts/presence.ts
3647
- import { createRoute as createRoute20, z as z34 } from "@hono/zod-openapi";
3770
+ import { createRoute as createRoute20, z as z36 } from "@hono/zod-openapi";
3648
3771
 
3649
3772
  // src/schemas/presence.ts
3650
- import { z as z33 } from "@hono/zod-openapi";
3651
- var PresenceTokenResponseSchema = z33.object({
3652
- token: z33.string(),
3653
- pageId: z33.string(),
3654
- selfUserId: z33.string(),
3655
- expiresAt: z33.string()
3656
- });
3657
- var PresenceTokenPayloadSchema = z33.object({
3658
- userId: z33.string(),
3659
- pageId: z33.string(),
3660
- iat: z33.number().int(),
3661
- exp: z33.number().int()
3662
- });
3663
- var PresenceViewerSchema = z33.object({
3664
- userId: z33.string(),
3665
- username: z33.string(),
3666
- displayName: z33.string(),
3667
- avatarUrl: z33.string().nullable(),
3668
- isEditing: z33.boolean(),
3669
- joinedAt: z33.number().int()
3670
- });
3671
- var PresenceHeartbeatMessageSchema = z33.object({
3672
- 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")
3673
3796
  });
3674
3797
  var PresenceClientMessageSchema = PresenceHeartbeatMessageSchema;
3675
- var PresenceViewersMessageSchema = z33.object({
3676
- type: z33.literal("viewers"),
3677
- viewers: z33.array(PresenceViewerSchema)
3678
- });
3679
- var PresenceServerMessageSchema = PresenceViewersMessageSchema;
3680
- var LikerSchema = z33.object({
3681
- id: z33.string(),
3682
- username: z33.string(),
3683
- displayName: z33.string(),
3684
- avatarUrl: z33.string().nullable(),
3685
- likedAt: z33.string().nullable()
3686
- });
3687
- var LikersResponseSchema = z33.object({
3688
- users: z33.array(LikerSchema),
3689
- totalCount: z33.number().int().nonnegative()
3690
- });
3691
- var GetLikersRequestSchema = z33.object({
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", [
3817
+ PresenceViewersMessageSchema,
3818
+ PresencePageUpdatedMessageSchema,
3819
+ PresenceCommentChangedMessageSchema
3820
+ ]);
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({
3692
3833
  // Optional cap on returned `users`. `totalCount` always reflects the
3693
3834
  // full count regardless of `limit`. Omit for the full list.
3694
- limit: z33.coerce.number().int().positive().optional()
3835
+ limit: z35.coerce.number().int().positive().optional()
3695
3836
  });
3696
3837
 
3697
3838
  // src/contracts/presence.ts
3698
- var PageIdPathParamsSchema2 = z34.object({
3699
- 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" })
3700
3841
  });
3701
3842
  var getPresenceTokenRoute = createRoute20({
3702
3843
  method: "get",
@@ -3769,48 +3910,48 @@ var presenceRoutes = {
3769
3910
  };
3770
3911
 
3771
3912
  // src/contracts/draft.ts
3772
- import { createRoute as createRoute21, z as z36 } from "@hono/zod-openapi";
3913
+ import { createRoute as createRoute21, z as z38 } from "@hono/zod-openapi";
3773
3914
 
3774
3915
  // src/schemas/draft.ts
3775
- import { z as z35 } from "@hono/zod-openapi";
3776
- var CreateDraftRequestSchema = z35.object({
3777
- path: z35.string().min(1),
3778
- 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()
3779
3920
  });
3780
- var CreateDraftResponseSchema = z35.object({
3781
- pageId: z35.string()
3921
+ var CreateDraftResponseSchema = z37.object({
3922
+ pageId: z37.string()
3782
3923
  });
3783
- var DraftConflictOwnerSchema = z35.object({
3784
- id: z35.string(),
3785
- username: z35.string(),
3786
- displayName: z35.string()
3924
+ var DraftConflictOwnerSchema = z37.object({
3925
+ id: z37.string(),
3926
+ username: z37.string(),
3927
+ displayName: z37.string()
3787
3928
  });
3788
- var DraftPathConflictErrorSchema = z35.object({
3789
- error: z35.literal("path_taken_by_draft"),
3929
+ var DraftPathConflictErrorSchema = z37.object({
3930
+ error: z37.literal("path_taken_by_draft"),
3790
3931
  owner: DraftConflictOwnerSchema,
3791
- message: z35.string()
3932
+ message: z37.string()
3792
3933
  });
3793
- var DraftBadRequestErrorSchema = z35.object({
3794
- error: z35.enum(["invalid_path", "path_taken"]),
3795
- message: z35.string()
3934
+ var DraftBadRequestErrorSchema = z37.object({
3935
+ error: z37.enum(["invalid_path", "path_taken"]),
3936
+ message: z37.string()
3796
3937
  });
3797
- var DraftNotFoundErrorSchema = z35.object({
3798
- error: z35.literal("draft_not_found"),
3799
- message: z35.string()
3938
+ var DraftNotFoundErrorSchema = z37.object({
3939
+ error: z37.literal("draft_not_found"),
3940
+ message: z37.string()
3800
3941
  });
3801
- var DraftSummarySchema = z35.object({
3802
- pageId: z35.string(),
3803
- path: z35.string(),
3804
- createdAt: z35.string(),
3805
- updatedAt: z35.string()
3942
+ var DraftSummarySchema = z37.object({
3943
+ pageId: z37.string(),
3944
+ path: z37.string(),
3945
+ createdAt: z37.string(),
3946
+ updatedAt: z37.string()
3806
3947
  });
3807
- var ListDraftsResponseSchema = z35.object({
3808
- drafts: z35.array(DraftSummarySchema)
3948
+ var ListDraftsResponseSchema = z37.object({
3949
+ drafts: z37.array(DraftSummarySchema)
3809
3950
  });
3810
3951
 
3811
3952
  // src/contracts/draft.ts
3812
- var DraftIdPathParamsSchema = z36.object({
3813
- 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" })
3814
3955
  });
3815
3956
  var createDraftRoute = createRoute21({
3816
3957
  method: "post",
@@ -3891,40 +4032,6 @@ var draftRoutes = {
3891
4032
 
3892
4033
  // src/contracts/autocomplete.ts
3893
4034
  import { createRoute as createRoute22 } from "@hono/zod-openapi";
3894
-
3895
- // src/schemas/autocomplete.ts
3896
- import { z as z37 } from "@hono/zod-openapi";
3897
- var AutocompleteRequestSchema = z37.object({
3898
- q: z37.string().min(1).max(128),
3899
- limit: z37.coerce.number().int().min(1).max(25).optional().default(10),
3900
- /**
3901
- * How `q` is matched against the candidate text. `'substring'` (the
3902
- * default, used by the editor's `@mention` / `[[wikilink]]` pickers)
3903
- * keeps the historical anywhere-in-string match. `'prefix'` anchors
3904
- * the match at the start — used by the "create page" modal, where the
3905
- * user is building a `/`-rooted path and only true prefixes are valid
3906
- * completions of what they have typed so far.
3907
- */
3908
- anchor: z37.enum(["substring", "prefix"]).optional().default("substring")
3909
- });
3910
- var AutocompleteResultSchema = z37.object({
3911
- id: z37.string(),
3912
- label: z37.string(),
3913
- display: z37.string(),
3914
- avatar: z37.string().nullable().optional(),
3915
- modifiedAt: z37.string().nullable().optional(),
3916
- score: z37.number()
3917
- });
3918
- var AutocompleteResponseSchema = z37.object({
3919
- results: z37.array(AutocompleteResultSchema)
3920
- });
3921
- var AutocompleteRateLimitErrorSchema = z37.object({
3922
- error: z37.literal("rate_limited"),
3923
- message: z37.string(),
3924
- retryAfterSeconds: z37.number()
3925
- });
3926
-
3927
- // src/contracts/autocomplete.ts
3928
4035
  var autocompleteUsersRoute = createRoute22({
3929
4036
  method: "get",
3930
4037
  path: "/users/autocomplete",
@@ -3987,50 +4094,50 @@ var autocompleteRoutes = {
3987
4094
  };
3988
4095
 
3989
4096
  // src/contracts/attachment.ts
3990
- import { createRoute as createRoute23, z as z39 } from "@hono/zod-openapi";
4097
+ import { createRoute as createRoute23, z as z40 } from "@hono/zod-openapi";
3991
4098
 
3992
4099
  // src/schemas/attachment.ts
3993
- import { z as z38 } from "@hono/zod-openapi";
3994
- var AttachmentSchema = z38.object({
3995
- _id: z38.string(),
3996
- 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(),
3997
4104
  creator: UserPublicSchema,
3998
- filePath: z38.string(),
3999
- fileName: z38.string(),
4000
- originalName: z38.string(),
4001
- fileFormat: z38.string(),
4002
- fileSize: z38.number(),
4003
- createdAt: z38.string(),
4004
- url: z38.string(),
4005
- 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()
4006
4113
  });
4007
4114
  var AttachmentMetaSchema = AttachmentSchema.omit({ inUse: true });
4008
- var ListAttachmentsResponseSchema = z38.object({
4009
- attachments: z38.array(AttachmentSchema)
4115
+ var ListAttachmentsResponseSchema = z39.object({
4116
+ attachments: z39.array(AttachmentSchema)
4010
4117
  });
4011
- var PastAttachmentUsageSchema = z38.object({
4118
+ var PastAttachmentUsageSchema = z39.object({
4012
4119
  attachment: AttachmentSchema,
4013
- referencingRevisions: z38.array(
4014
- z38.object({
4015
- revisionId: z38.string(),
4016
- createdAt: z38.string(),
4120
+ referencingRevisions: z39.array(
4121
+ z39.object({
4122
+ revisionId: z39.string(),
4123
+ createdAt: z39.string(),
4017
4124
  author: UserPublicSchema
4018
4125
  })
4019
4126
  )
4020
4127
  });
4021
- var AttachmentUsageResponseSchema = z38.object({
4022
- pagePath: z38.string(),
4023
- latest: z38.array(AttachmentSchema),
4024
- past: z38.array(PastAttachmentUsageSchema)
4128
+ var AttachmentUsageResponseSchema = z39.object({
4129
+ pagePath: z39.string(),
4130
+ latest: z39.array(AttachmentSchema),
4131
+ past: z39.array(PastAttachmentUsageSchema)
4025
4132
  });
4026
- var AddAttachmentResponseSchema = z38.object({
4133
+ var AddAttachmentResponseSchema = z39.object({
4027
4134
  attachment: AttachmentSchema,
4028
- url: z38.string()
4135
+ url: z39.string()
4029
4136
  });
4030
- var RemoveAttachmentResponseSchema = z38.object({
4031
- success: z38.literal(true)
4137
+ var RemoveAttachmentResponseSchema = z39.object({
4138
+ success: z39.literal(true)
4032
4139
  });
4033
- var AttachmentErrorCodeSchema = z38.enum([
4140
+ var AttachmentErrorCodeSchema = z39.enum([
4034
4141
  "INVALID_PAGE_ID",
4035
4142
  "PAGE_NOT_FOUND",
4036
4143
  "FILE_MISSING",
@@ -4042,41 +4149,41 @@ var AttachmentErrorCodeSchema = z38.enum([
4042
4149
  "UPLOAD_FAILED",
4043
4150
  "REMOVE_FAILED"
4044
4151
  ]);
4045
- var AttachmentErrorSchema = z38.object({
4046
- error: z38.object({
4152
+ var AttachmentErrorSchema = z39.object({
4153
+ error: z39.object({
4047
4154
  code: AttachmentErrorCodeSchema,
4048
- message: z38.string()
4155
+ message: z39.string()
4049
4156
  })
4050
4157
  });
4051
- var UploadAttachmentResponseSchema = z38.object({
4052
- url: z38.string(),
4053
- filename: z38.string(),
4054
- mimeType: z38.string(),
4055
- sizeBytes: z38.number()
4158
+ var UploadAttachmentResponseSchema = z39.object({
4159
+ url: z39.string(),
4160
+ filename: z39.string(),
4161
+ mimeType: z39.string(),
4162
+ sizeBytes: z39.number()
4056
4163
  });
4057
- var UploadAttachmentErrorCodeSchema = z38.enum(["too_large", "disallowed_type", "rate_limited", "no_permission"]);
4058
- var UploadAttachmentErrorSchema = z38.object({
4164
+ var UploadAttachmentErrorCodeSchema = z39.enum(["too_large", "disallowed_type", "rate_limited", "no_permission"]);
4165
+ var UploadAttachmentErrorSchema = z39.object({
4059
4166
  error: UploadAttachmentErrorCodeSchema,
4060
- message: z38.string(),
4061
- details: z38.record(z38.string(), z38.unknown()).optional()
4167
+ message: z39.string(),
4168
+ details: z39.record(z39.string(), z39.unknown()).optional()
4062
4169
  });
4063
4170
  var IMAGE_UPLOAD_MIME = ["image/png", "image/jpeg", "image/gif", "image/webp", "image/svg+xml"];
4064
4171
  var DND_EXTRA_UPLOAD_MIME = ["application/pdf", "text/plain", "text/markdown", "text/csv", "application/zip"];
4065
4172
 
4066
4173
  // src/contracts/attachment.ts
4067
- var PageIdPathParamsSchema3 = z39.object({
4068
- 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" })
4069
4176
  });
4070
- var AttachmentIdPathParamsSchema = z39.object({
4071
- 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" })
4072
4179
  });
4073
- var AddAttachmentBodySchema = z39.object({
4074
- file: z39.any().openapi({ type: "string", format: "binary" }).optional()
4180
+ var AddAttachmentBodySchema = z40.object({
4181
+ file: z40.any().openapi({ type: "string", format: "binary" }).optional()
4075
4182
  });
4076
- var UploadAttachmentBodySchema = z39.object({
4077
- file: z39.any().openapi({ type: "string", format: "binary" }).optional(),
4078
- pageId: z39.string().optional(),
4079
- 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"] })
4080
4187
  });
4081
4188
  var listAttachmentsRoute = createRoute23({
4082
4189
  method: "get",
@@ -4313,30 +4420,30 @@ var attachmentRoutes = {
4313
4420
  import { createRoute as createRoute24 } from "@hono/zod-openapi";
4314
4421
 
4315
4422
  // src/schemas/search.ts
4316
- import { z as z40 } from "@hono/zod-openapi";
4317
- var SearchPageTypeSchema = z40.enum(["portal", "public", "user"]);
4318
- var SearchPagesRequestSchema = z40.object({
4319
- q: z40.string().min(1),
4320
- 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(),
4321
4428
  type: SearchPageTypeSchema.optional(),
4322
- page: z40.coerce.number().int().min(1).default(1),
4323
- limit: z40.coerce.number().int().min(1).max(100).default(50)
4324
- });
4325
- var SearchHitSchema = z40.object({
4326
- pageId: z40.string(),
4327
- path: z40.string(),
4328
- score: z40.number().optional(),
4329
- snippet: z40.string().optional(),
4330
- 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(),
4331
4438
  page: PageSchema
4332
4439
  });
4333
- var SearchPagesResponseSchema = z40.object({
4334
- meta: z40.object({
4335
- took: z40.number().optional(),
4336
- total: z40.number(),
4337
- 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()
4338
4445
  }),
4339
- data: z40.array(SearchHitSchema)
4446
+ data: z41.array(SearchHitSchema)
4340
4447
  });
4341
4448
 
4342
4449
  // src/contracts/search.ts
@@ -4380,31 +4487,31 @@ var searchRoutes = {
4380
4487
  import { createRoute as createRoute25 } from "@hono/zod-openapi";
4381
4488
 
4382
4489
  // src/schemas/adminCrypto.ts
4383
- import { z as z41 } from "@hono/zod-openapi";
4384
- var SensitiveConfigEntrySchema = z41.object({
4385
- ns: z41.string(),
4386
- key: z41.string(),
4387
- present: z41.boolean(),
4388
- encrypted: z41.boolean()
4389
- });
4390
- 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({
4391
4498
  /** False when CROWI_ENCRYPTION_KEY is not configured — UI shows a setup hint. */
4392
- encryptionConfigured: z41.boolean(),
4393
- unencryptedCount: z41.number().int().min(0),
4394
- encryptedCount: z41.number().int().min(0),
4395
- 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)
4396
4503
  });
4397
- var ReencryptResponseSchema = z41.object({
4398
- rewritten: z41.number().int().min(0),
4504
+ var ReencryptResponseSchema = z42.object({
4505
+ rewritten: z42.number().int().min(0),
4399
4506
  /** Already encrypted, skipped on this run. */
4400
- alreadyEncrypted: z41.number().int().min(0),
4507
+ alreadyEncrypted: z42.number().int().min(0),
4401
4508
  /** Sensitive registry entries that had no row in the DB at all. */
4402
- missing: z41.number().int().min(0)
4509
+ missing: z42.number().int().min(0)
4403
4510
  });
4404
- var EncryptionNotConfiguredErrorSchema = z41.object({
4405
- error: z41.object({
4406
- code: z41.literal("ENCRYPTION_NOT_CONFIGURED"),
4407
- message: z41.string()
4511
+ var EncryptionNotConfiguredErrorSchema = z42.object({
4512
+ error: z42.object({
4513
+ code: z42.literal("ENCRYPTION_NOT_CONFIGURED"),
4514
+ message: z42.string()
4408
4515
  })
4409
4516
  });
4410
4517
 
@@ -4472,53 +4579,53 @@ var adminCryptoRoutes = {
4472
4579
  import { createRoute as createRoute26 } from "@hono/zod-openapi";
4473
4580
 
4474
4581
  // src/schemas/admin/app.ts
4475
- import { z as z43 } from "@hono/zod-openapi";
4476
- var GetAppSettingsResponseSchema = z43.object({
4477
- app: z43.object({
4478
- title: z43.string(),
4479
- 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()
4480
4587
  }),
4481
4588
  /**
4482
4589
  * Whether a storage driver is registered (i.e. uploads are wired up).
4483
4590
  * Sourced from `Config.isUploadable()` which now consults PluginManager.
4484
4591
  */
4485
- isUploadable: z43.boolean(),
4592
+ isUploadable: z44.boolean(),
4486
4593
  /**
4487
4594
  * The Open / Restricted / Closed → open / restricted / closed mapping the
4488
4595
  * legacy admin controller exposed. Useful for the UI to render the current
4489
4596
  * registration mode label without knowing the internal capitalisation.
4490
4597
  */
4491
- registrationMode: z43.record(z43.string(), z43.string()),
4598
+ registrationMode: z44.record(z44.string(), z44.string()),
4492
4599
  /**
4493
4600
  * Whether the admin has dismissed the initial-setup checklist on the
4494
4601
  * dashboard. Persisted server-side (`app:setupChecklistDismissed`) so the
4495
4602
  * dismissal holds across browsers and devices, not just one localStorage.
4496
4603
  */
4497
- setupChecklistDismissed: z43.boolean()
4604
+ setupChecklistDismissed: z44.boolean()
4498
4605
  });
4499
- var UpdateAppSettingsRequestSchema = z43.object({
4500
- app: z43.object({
4501
- title: z43.string().trim().min(1).max(100).optional(),
4502
- 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()
4503
4610
  }).optional(),
4504
4611
  /**
4505
4612
  * Toggle the dashboard initial-setup checklist's dismissed state. Sent on
4506
4613
  * its own (without the `app` block) when the admin clicks "mark as done".
4507
4614
  */
4508
- setupChecklistDismissed: z43.boolean().optional()
4615
+ setupChecklistDismissed: z44.boolean().optional()
4509
4616
  }).strict();
4510
- var UpdateAppSettingsResponseSchema = z43.object({
4511
- ok: z43.literal(true)
4512
- });
4513
- var AppSettingsValidationErrorSchema = z43.object({
4514
- bodyResult: z43.object({
4515
- issues: z43.array(
4516
- z43.object({
4517
- path: z43.array(z43.union([z43.string(), z43.number()])),
4518
- 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()
4519
4626
  })
4520
4627
  ),
4521
- name: z43.string().optional()
4628
+ name: z44.string().optional()
4522
4629
  })
4523
4630
  });
4524
4631
 
@@ -4600,18 +4707,18 @@ var adminAppRoutes = {
4600
4707
  import { createRoute as createRoute27 } from "@hono/zod-openapi";
4601
4708
 
4602
4709
  // src/schemas/admin/auth.ts
4603
- import { z as z44 } from "@hono/zod-openapi";
4604
- var AuthSettingsSchema = z44.object({
4605
- requireThirdPartyAuth: z44.boolean(),
4606
- 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()
4607
4714
  });
4608
4715
  var UpdateAuthSettingsRequestSchema = AuthSettingsSchema;
4609
4716
  var GetAuthSettingsResponseSchema = AuthSettingsSchema;
4610
4717
  var UpdateAuthSettingsResponseSchema = AuthSettingsSchema;
4611
- var ThirdPartyAuthUnavailableErrorSchema = z44.object({
4612
- error: z44.object({
4613
- code: z44.literal("THIRD_PARTY_AUTH_UNAVAILABLE"),
4614
- message: z44.string()
4718
+ var ThirdPartyAuthUnavailableErrorSchema = z45.object({
4719
+ error: z45.object({
4720
+ code: z45.literal("THIRD_PARTY_AUTH_UNAVAILABLE"),
4721
+ message: z45.string()
4615
4722
  })
4616
4723
  });
4617
4724
 
@@ -4684,41 +4791,41 @@ var adminAuthRoutes = {
4684
4791
  import { createRoute as createRoute28 } from "@hono/zod-openapi";
4685
4792
 
4686
4793
  // src/schemas/admin/mail.ts
4687
- import { z as z45 } from "@hono/zod-openapi";
4688
- var GetMailSettingsResponseSchema = z45.object({
4689
- from: z45.string(),
4690
- 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(),
4691
4798
  /** npm name of the plugin that registered the active driver, for
4692
4799
  * linking to its config page. Empty when no sender is active. */
4693
- activePlugin: z45.string()
4800
+ activePlugin: z46.string()
4694
4801
  });
4695
- var UpdateMailSettingsRequestSchema = z45.object({
4696
- from: z45.string().trim().max(254).optional()
4802
+ var UpdateMailSettingsRequestSchema = z46.object({
4803
+ from: z46.string().trim().max(254).optional()
4697
4804
  });
4698
- var UpdateMailSettingsResponseSchema = z45.object({
4699
- ok: z45.literal(true)
4805
+ var UpdateMailSettingsResponseSchema = z46.object({
4806
+ ok: z46.literal(true)
4700
4807
  });
4701
- var SendTestMailRequestSchema = z45.object({}).optional();
4702
- var SendTestMailResponseSchema = z45.object({
4703
- ok: z45.literal(true),
4808
+ var SendTestMailRequestSchema = z46.object({}).optional();
4809
+ var SendTestMailResponseSchema = z46.object({
4810
+ ok: z46.literal(true),
4704
4811
  /** Address the test mail was dispatched to (= the calling admin's email). */
4705
- to: z45.string()
4812
+ to: z46.string()
4706
4813
  });
4707
- var SendTestMailErrorSchema = z45.object({
4708
- error: z45.object({
4709
- code: z45.literal("MAIL_TEST_FAILED"),
4710
- message: z45.string()
4814
+ var SendTestMailErrorSchema = z46.object({
4815
+ error: z46.object({
4816
+ code: z46.literal("MAIL_TEST_FAILED"),
4817
+ message: z46.string()
4711
4818
  })
4712
4819
  });
4713
- var MailSettingsValidationErrorSchema = z45.object({
4714
- bodyResult: z45.object({
4715
- issues: z45.array(
4716
- z45.object({
4717
- path: z45.array(z45.union([z45.string(), z45.number()])),
4718
- 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()
4719
4826
  })
4720
4827
  ),
4721
- name: z45.string().optional()
4828
+ name: z46.string().optional()
4722
4829
  })
4723
4830
  });
4724
4831
 
@@ -4833,30 +4940,30 @@ var adminMailRoutes = {
4833
4940
  };
4834
4941
 
4835
4942
  // src/contracts/admin/plugins.ts
4836
- import { createRoute as createRoute29, z as z47 } from "@hono/zod-openapi";
4943
+ import { createRoute as createRoute29, z as z48 } from "@hono/zod-openapi";
4837
4944
 
4838
4945
  // src/schemas/admin/plugins.ts
4839
- import { z as z46 } from "@hono/zod-openapi";
4840
- var PluginFieldSchema = z46.object({
4841
- name: z46.string(),
4946
+ import { z as z47 } from "@hono/zod-openapi";
4947
+ var PluginFieldSchema = z47.object({
4948
+ name: z47.string(),
4842
4949
  /**
4843
4950
  * Localized display label. Falls back to `name` in the form when absent.
4844
4951
  * Filled from the plugin's `configI18n[locale]` overlay by the admin API.
4845
4952
  */
4846
- label: z46.string().optional(),
4847
- kind: z46.enum(["string", "secret", "number", "boolean", "enum", "string-array"]),
4848
- description: z46.string().optional(),
4849
- defaultValue: z46.unknown().optional(),
4850
- options: z46.array(z46.string()).optional(),
4851
- action: z46.object({
4852
- label: z46.string(),
4853
- method: z46.string(),
4854
- 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()
4855
4962
  }).optional(),
4856
- optional: z46.boolean()
4963
+ optional: z47.boolean()
4857
4964
  });
4858
- var AdminSidebarSection = z46.enum(["settings", "shared", "storage", "mail", "notification", "auth", "search", "renderer", "platform"]);
4859
- var PluginAdminPlacementSchema = z46.object({
4965
+ var AdminSidebarSection = z47.enum(["settings", "shared", "storage", "mail", "notification", "auth", "search", "renderer", "platform"]);
4966
+ var PluginAdminPlacementSchema = z47.object({
4860
4967
  /**
4861
4968
  * Sidebar section to surface this plugin under. The runtime fills
4862
4969
  * this in — it's either declared by the plugin via `adminPlacement`
@@ -4865,21 +4972,28 @@ var PluginAdminPlacementSchema = z46.object({
4865
4972
  */
4866
4973
  section: AdminSidebarSection,
4867
4974
  /** Display label (defaults to the plugin's npm name). */
4868
- label: z46.string(),
4975
+ label: z47.string(),
4869
4976
  /** Lucide icon name from a fixed allow-list. */
4870
- icon: z46.string().optional()
4977
+ icon: z47.string().optional()
4871
4978
  });
4872
- var PluginInfoSchema = z46.object({
4873
- name: z46.string(),
4874
- version: z46.string(),
4875
- 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(),
4876
4990
  /** Has a configSchema (= showable config form). */
4877
- hasConfig: z46.boolean(),
4991
+ hasConfig: z47.boolean(),
4878
4992
  /**
4879
4993
  * Driver-registry slots this plugin currently fills. Useful for the
4880
4994
  * admin "this plugin is the active storage driver" badge.
4881
4995
  */
4882
- registers: z46.array(z46.string()),
4996
+ registers: z47.array(z47.string()),
4883
4997
  /**
4884
4998
  * Where the plugin appears in the admin sidebar. The server always
4885
4999
  * populates this even when the plugin didn't declare its own
@@ -4892,21 +5006,32 @@ var PluginInfoSchema = z46.object({
4892
5006
  * still apply their config on the next server restart; plugins with
4893
5007
  * it apply config changes live.
4894
5008
  */
4895
- 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()
4896
5021
  });
4897
- var ListPluginsResponseSchema = z46.object({
4898
- plugins: z46.array(PluginInfoSchema)
5022
+ var ListPluginsResponseSchema = z47.object({
5023
+ plugins: z47.array(PluginInfoSchema)
4899
5024
  });
4900
- var PluginConfigResponseSchema = z46.object({
4901
- name: z46.string(),
4902
- fields: z46.array(PluginFieldSchema),
4903
- 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())
4904
5029
  });
4905
- var UpdatePluginConfigRequestSchema = z46.object({
4906
- values: z46.record(z46.string(), z46.unknown())
5030
+ var UpdatePluginConfigRequestSchema = z47.object({
5031
+ values: z47.record(z47.string(), z47.unknown())
4907
5032
  });
4908
- var UpdatePluginConfigResponseSchema = z46.object({
4909
- ok: z46.literal(true),
5033
+ var UpdatePluginConfigResponseSchema = z47.object({
5034
+ ok: z47.literal(true),
4910
5035
  /**
4911
5036
  * Whether at least one plugin's `reconfigure` hook ran successfully
4912
5037
  * for this save. `true` means the new values are already live on
@@ -4916,43 +5041,43 @@ var UpdatePluginConfigResponseSchema = z46.object({
4916
5041
  * "saved, but apply failed" warning in that case via the response
4917
5042
  * `reconfigureFailed` flag.
4918
5043
  */
4919
- hotReloaded: z46.boolean(),
5044
+ hotReloaded: z47.boolean(),
4920
5045
  /**
4921
5046
  * True when at least one plugin's `reconfigure` was attempted and
4922
5047
  * threw. The save itself succeeded (Mongo + cache are updated) so
4923
5048
  * the next process boot will see the new values, but the *running*
4924
5049
  * process couldn't apply them. UI surfaces a warning toast.
4925
5050
  */
4926
- reconfigureFailed: z46.boolean()
5051
+ reconfigureFailed: z47.boolean()
4927
5052
  });
4928
- var PluginNotFoundErrorSchema = z46.object({
4929
- error: z46.object({
4930
- code: z46.literal("PLUGIN_NOT_FOUND"),
4931
- message: z46.string()
5053
+ var PluginNotFoundErrorSchema = z47.object({
5054
+ error: z47.object({
5055
+ code: z47.literal("PLUGIN_NOT_FOUND"),
5056
+ message: z47.string()
4932
5057
  })
4933
5058
  });
4934
- var PluginConfigValidationErrorSchema = z46.object({
4935
- error: z46.object({
4936
- code: z46.literal("PLUGIN_CONFIG_VALIDATION_FAILED"),
4937
- message: z46.string(),
4938
- issues: z46.array(
4939
- z46.object({
4940
- path: z46.array(z46.union([z46.string(), z46.number()])),
4941
- 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()
4942
5067
  })
4943
5068
  )
4944
5069
  })
4945
5070
  });
4946
- var ClearRenderCacheResponseSchema = z46.object({
4947
- ok: z46.literal(true),
4948
- clearedAt: z46.string(),
5071
+ var ClearRenderCacheResponseSchema = z47.object({
5072
+ ok: z47.literal(true),
5073
+ clearedAt: z47.string(),
4949
5074
  /** Number of cache rows removed. */
4950
- removedCount: z46.number().int().min(0)
5075
+ removedCount: z47.number().int().min(0)
4951
5076
  });
4952
5077
 
4953
5078
  // src/contracts/admin/plugins.ts
4954
- var PluginNameQuerySchema = z47.object({ name: z47.string() });
4955
- 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() });
4956
5081
  var listPluginsRoute = createRoute29({
4957
5082
  method: "get",
4958
5083
  path: "/admin/plugins",
@@ -5049,7 +5174,7 @@ var updatePluginConfigRoute = createRoute29({
5049
5174
  }
5050
5175
  }
5051
5176
  });
5052
- var ClearRenderCacheBodySchema = z47.object({}).optional();
5177
+ var ClearRenderCacheBodySchema = z48.object({}).optional();
5053
5178
  var clearRenderCacheAllRoute = createRoute29({
5054
5179
  method: "post",
5055
5180
  path: "/admin/plugins/render-cache/clear-all",
@@ -5127,21 +5252,21 @@ var adminPluginsRoutes = {
5127
5252
  import { createRoute as createRoute30 } from "@hono/zod-openapi";
5128
5253
 
5129
5254
  // src/schemas/admin/search.ts
5130
- import { z as z48 } from "@hono/zod-openapi";
5131
- var SearchDriverEntrySchema = z48.object({
5132
- driverName: z48.string(),
5133
- pluginName: z48.string(),
5134
- isActive: z48.boolean(),
5135
- supportsRebuild: z48.boolean()
5136
- });
5137
- var ActiveSearchDriverSchema = z48.object({
5138
- driverName: z48.string(),
5139
- pluginName: z48.string(),
5140
- supportsRebuild: z48.boolean()
5141
- });
5142
- 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({
5143
5268
  active: ActiveSearchDriverSchema.nullable(),
5144
- drivers: z48.array(SearchDriverEntrySchema)
5269
+ drivers: z49.array(SearchDriverEntrySchema)
5145
5270
  });
5146
5271
 
5147
5272
  // src/contracts/admin/search.ts
@@ -5178,11 +5303,11 @@ var adminSearchRoutes = {
5178
5303
  import { createRoute as createRoute31 } from "@hono/zod-openapi";
5179
5304
 
5180
5305
  // src/schemas/admin/security.ts
5181
- import { z as z49 } from "@hono/zod-openapi";
5182
- var RegistrationModeSchema = z49.enum(["Open", "Resricted", "Closed"]);
5183
- 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({
5184
5309
  registrationMode: RegistrationModeSchema,
5185
- registrationWhiteList: z49.array(z49.string())
5310
+ registrationWhiteList: z50.array(z50.string())
5186
5311
  });
5187
5312
  var UpdateSecuritySettingsRequestSchema = SecuritySettingsSchema;
5188
5313
  var GetSecuritySettingsResponseSchema = SecuritySettingsSchema;
@@ -5253,19 +5378,19 @@ var adminSecurityRoutes = {
5253
5378
  import { createRoute as createRoute32 } from "@hono/zod-openapi";
5254
5379
 
5255
5380
  // src/schemas/admin/storage.ts
5256
- import { z as z50 } from "@hono/zod-openapi";
5257
- var StorageDriverEntrySchema = z50.object({
5258
- driverName: z50.string(),
5259
- pluginName: z50.string(),
5260
- 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()
5261
5386
  });
5262
- var ActiveStorageDriverSchema = z50.object({
5263
- driverName: z50.string(),
5264
- pluginName: z50.string()
5387
+ var ActiveStorageDriverSchema = z51.object({
5388
+ driverName: z51.string(),
5389
+ pluginName: z51.string()
5265
5390
  });
5266
- var GetStorageStatusResponseSchema = z50.object({
5391
+ var GetStorageStatusResponseSchema = z51.object({
5267
5392
  active: ActiveStorageDriverSchema.nullable(),
5268
- drivers: z50.array(StorageDriverEntrySchema)
5393
+ drivers: z51.array(StorageDriverEntrySchema)
5269
5394
  });
5270
5395
 
5271
5396
  // src/contracts/admin/storage.ts
@@ -5302,87 +5427,87 @@ var adminStorageRoutes = {
5302
5427
  import { createRoute as createRoute33 } from "@hono/zod-openapi";
5303
5428
 
5304
5429
  // src/schemas/admin/users.ts
5305
- import { z as z52 } from "@hono/zod-openapi";
5430
+ import { z as z53 } from "@hono/zod-openapi";
5306
5431
 
5307
5432
  // src/schemas/admin/_pager.ts
5308
- import { z as z51 } from "@hono/zod-openapi";
5309
- var AdminPagerSchema = z51.object({
5310
- page: z51.number(),
5311
- pagesCount: z51.number(),
5312
- pages: z51.array(z51.number()),
5313
- total: z51.number(),
5314
- previous: z51.number().nullable(),
5315
- previousDots: z51.boolean(),
5316
- next: z51.number().nullable(),
5317
- 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()
5318
5443
  });
5319
5444
 
5320
5445
  // src/schemas/admin/users.ts
5321
- var ListAdminUsersRequestSchema = z52.object({
5322
- q: z52.string().optional(),
5446
+ var ListAdminUsersRequestSchema = z53.object({
5447
+ q: z53.string().optional(),
5323
5448
  /**
5324
5449
  * Optional numeric user-status filter (see `UserStatusEnum`). When set, only
5325
5450
  * users in that status are returned — used by the "user approval" queue
5326
5451
  * screen to list `REGISTERED` (= awaiting admin approval) users.
5327
5452
  */
5328
- status: z52.coerce.number().int().optional(),
5329
- page: z52.coerce.number().int().min(1).optional().default(1),
5330
- 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)
5331
5456
  });
5332
- var ListAdminUsersResponseSchema = z52.object({
5333
- users: z52.array(UserPublicSchema),
5457
+ var ListAdminUsersResponseSchema = z53.object({
5458
+ users: z53.array(UserPublicSchema),
5334
5459
  pager: AdminPagerSchema
5335
5460
  });
5336
- var SearchAdminUsersByEmailRequestSchema = z52.object({
5337
- email: z52.string().min(1)
5461
+ var SearchAdminUsersByEmailRequestSchema = z53.object({
5462
+ email: z53.string().min(1)
5338
5463
  });
5339
- var SearchAdminUsersByEmailResponseSchema = z52.object({
5340
- users: z52.array(UserPublicSchema)
5464
+ var SearchAdminUsersByEmailResponseSchema = z53.object({
5465
+ users: z53.array(UserPublicSchema)
5341
5466
  });
5342
- var AdminUserIdParamSchema = z52.object({
5343
- id: z52.string()
5467
+ var AdminUserIdParamSchema = z53.object({
5468
+ id: z53.string()
5344
5469
  });
5345
- var InviteUsersRequestSchema = z52.object({
5346
- emailList: z52.array(z52.string().email()).min(1),
5347
- 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)
5348
5473
  });
5349
- var InvitedUserResultSchema = z52.discriminatedUnion("status", [
5350
- z52.object({
5351
- email: z52.string(),
5352
- status: z52.literal("created"),
5353
- 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()
5354
5479
  }),
5355
- z52.object({
5356
- email: z52.string(),
5357
- status: z52.literal("exists")
5480
+ z53.object({
5481
+ email: z53.string(),
5482
+ status: z53.literal("exists")
5358
5483
  }),
5359
- z52.object({
5360
- email: z52.string(),
5361
- status: z52.literal("failed")
5484
+ z53.object({
5485
+ email: z53.string(),
5486
+ status: z53.literal("failed")
5362
5487
  })
5363
5488
  ]);
5364
- var InviteUsersResponseSchema = z52.object({
5365
- results: z52.array(InvitedUserResultSchema)
5489
+ var InviteUsersResponseSchema = z53.object({
5490
+ results: z53.array(InvitedUserResultSchema)
5366
5491
  });
5367
- var EditAdminUserRequestSchema = z52.object({
5368
- name: z52.string().min(1),
5369
- email: z52.string().email()
5492
+ var EditAdminUserRequestSchema = z53.object({
5493
+ name: z53.string().min(1),
5494
+ email: z53.string().email()
5370
5495
  });
5371
- var AdminUserMutationResponseSchema = z52.object({
5496
+ var AdminUserMutationResponseSchema = z53.object({
5372
5497
  user: UserPublicSchema
5373
5498
  });
5374
- var ResetPasswordResponseSchema = z52.object({
5499
+ var ResetPasswordResponseSchema = z53.object({
5375
5500
  user: UserPublicSchema,
5376
- newPassword: z52.string()
5501
+ newPassword: z53.string()
5377
5502
  });
5378
- var UpdateAdminUserEmailRequestSchema = z52.object({
5379
- email: z52.string().email()
5503
+ var UpdateAdminUserEmailRequestSchema = z53.object({
5504
+ email: z53.string().email()
5380
5505
  });
5381
- var DeleteAdminUserResponseSchema = z52.object({
5382
- deletedId: z52.string()
5506
+ var DeleteAdminUserResponseSchema = z53.object({
5507
+ deletedId: z53.string()
5383
5508
  });
5384
- var PendingUsersCountResponseSchema = z52.object({
5385
- count: z52.number().int().nonnegative()
5509
+ var PendingUsersCountResponseSchema = z53.object({
5510
+ count: z53.number().int().nonnegative()
5386
5511
  });
5387
5512
 
5388
5513
  // src/contracts/admin/users.ts
@@ -6144,7 +6269,7 @@ var appAuthMeUserChain = new OpenAPIHono().openapi(
6144
6269
  )
6145
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));
6146
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));
6147
- 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));
6148
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));
6149
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));
6150
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));
@@ -6154,42 +6279,26 @@ var createClient = (baseUrl, options = {}) => hc(baseUrl, {
6154
6279
  fetch: options.fetch
6155
6280
  });
6156
6281
 
6157
- // src/schemas/app-capabilities.ts
6158
- var STATIC_CAPABILITIES = [
6159
- "oauth",
6160
- // The oauth:* tags mirror GRANT_TYPES_SUPPORTED + the S256 PKCE method
6161
- // (schemas/oauth-endpoints.ts / the RFC 8414 discovery doc). Keep in sync.
6162
- "oauth:auth-code",
6163
- "oauth:device",
6164
- "oauth:pkce",
6165
- "pat",
6166
- "pages",
6167
- "comments",
6168
- "bookmarks",
6169
- "attachments",
6170
- "notifications"
6171
- ];
6172
- var API_SURFACE_VERSION = "v2";
6173
-
6174
6282
  // src/schemas/mail-token.ts
6175
- import { z as z54 } from "@hono/zod-openapi";
6176
- var MailTokenPurposeSchema = z54.enum(["invite", "activate", "reset", "email-change"]);
6177
- 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({
6178
6286
  purpose: MailTokenPurposeSchema,
6179
- userId: z54.string(),
6287
+ userId: z55.string(),
6180
6288
  /** Target address. For `email-change` this is the NEW address. */
6181
- email: z54.string().email(),
6289
+ email: z55.string().email(),
6182
6290
  /**
6183
6291
  * For `email-change`: the account's email at issue time. The confirm
6184
6292
  * endpoint rejects the token unless it still matches, making the token
6185
6293
  * single-use (a stale token cannot revert a later change).
6186
6294
  */
6187
- fromEmail: z54.string().email().optional(),
6295
+ fromEmail: z55.string().email().optional(),
6188
6296
  // iat / exp are injected and verified by the JWT layer.
6189
- iat: z54.number().optional(),
6190
- exp: z54.number().optional()
6297
+ iat: z55.number().optional(),
6298
+ exp: z55.number().optional()
6191
6299
  });
6192
6300
  export {
6301
+ ALL_CAPABILITIES,
6193
6302
  ALL_SCOPES,
6194
6303
  API_SURFACE_VERSION,
6195
6304
  AccessTokenSchema,
@@ -6228,6 +6337,8 @@ export {
6228
6337
  BacklinkSchema,
6229
6338
  BookmarkResponseSchema,
6230
6339
  BookmarkSchema,
6340
+ CapabilitySchema,
6341
+ ClaimPageLinkAccessResponseSchema,
6231
6342
  ClearRenderCacheResponseSchema,
6232
6343
  CollabForceReloadMessageSchema,
6233
6344
  CollabSaveErrorSchema,
@@ -6251,6 +6362,7 @@ export {
6251
6362
  DEVICE_CODE_GRANT_TYPE,
6252
6363
  DISCOVERY_SCOPES_SUPPORTED,
6253
6364
  DND_EXTRA_UPLOAD_MIME,
6365
+ DYNAMIC_CAPABILITIES,
6254
6366
  DeleteAdminUserResponseSchema,
6255
6367
  DeleteCommentRequestSchema,
6256
6368
  DeleteCommentResponseSchema,
@@ -6377,7 +6489,9 @@ export {
6377
6489
  PluginInfoSchema,
6378
6490
  PluginNotFoundErrorSchema,
6379
6491
  PresenceClientMessageSchema,
6492
+ PresenceCommentChangedMessageSchema,
6380
6493
  PresenceHeartbeatMessageSchema,
6494
+ PresencePageUpdatedMessageSchema,
6381
6495
  PresenceServerMessageSchema,
6382
6496
  PresenceTokenPayloadSchema,
6383
6497
  PresenceTokenResponseSchema,
@@ -6502,6 +6616,7 @@ export {
6502
6616
  backlinkRoutes,
6503
6617
  bookmarkRoutes,
6504
6618
  cancelDraftRoute,
6619
+ claimPageLinkAccessRoute,
6505
6620
  clearRenderCacheAllRoute,
6506
6621
  clearRenderCachePluginRoute,
6507
6622
  commentRoutes,