@crowi/api-contract 2.0.0-alpha.10 → 2.0.0-alpha.12

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
@@ -649,6 +649,18 @@ var ClearRenderCacheResponseSchema = z6.object({
649
649
  /** Number of cache rows removed. */
650
650
  removedCount: z6.number().int().min(0)
651
651
  });
652
+ var PluginReadinessFieldSchema = z6.object({
653
+ name: z6.string(),
654
+ configured: z6.literal(false)
655
+ });
656
+ var PluginReadinessIssueSchema = z6.object({
657
+ name: z6.string(),
658
+ adminPlacement: PluginAdminPlacementSchema,
659
+ fields: z6.array(PluginReadinessFieldSchema)
660
+ });
661
+ var PluginReadinessResponseSchema = z6.object({
662
+ issues: z6.array(PluginReadinessIssueSchema)
663
+ });
652
664
 
653
665
  // src/contracts/admin/plugins.ts
654
666
  var PluginNameQuerySchema = z7.object({ name: z7.string() });
@@ -780,6 +792,27 @@ var clearRenderCacheAllRoute = createRoute4({
780
792
  }
781
793
  }
782
794
  });
795
+ var getPluginReadinessRoute = createRoute4({
796
+ method: "get",
797
+ path: "/admin/plugins/readiness",
798
+ tags: ["admin.plugins"],
799
+ security: [{ bearerAuth: [] }],
800
+ summary: "List active plugins missing required readiness config fields",
801
+ responses: {
802
+ 200: {
803
+ description: "Readiness issues for active plugins (empty when everything is configured)",
804
+ content: { "application/json": { schema: PluginReadinessResponseSchema } }
805
+ },
806
+ 401: {
807
+ description: "Authentication required",
808
+ content: { "application/json": { schema: AuthenticationRequiredErrorSchema } }
809
+ },
810
+ 403: {
811
+ description: "Admin permission required",
812
+ content: { "application/json": { schema: AdminRequiredErrorSchema } }
813
+ }
814
+ }
815
+ });
783
816
  var clearRenderCachePluginRoute = createRoute4({
784
817
  method: "post",
785
818
  path: "/admin/plugins/render-cache/clear-plugin",
@@ -819,6 +852,7 @@ var adminPluginsRoutes = {
819
852
  listPluginsRoute,
820
853
  getPluginConfigRoute,
821
854
  updatePluginConfigRoute,
855
+ getPluginReadinessRoute,
822
856
  clearRenderCacheAllRoute,
823
857
  clearRenderCachePluginRoute
824
858
  };
@@ -1722,14 +1756,51 @@ var UploadAttachmentResponseSchema = z17.object({
1722
1756
  mimeType: z17.string(),
1723
1757
  sizeBytes: z17.number()
1724
1758
  });
1725
- var UploadAttachmentErrorCodeSchema = z17.enum(["too_large", "disallowed_type", "rate_limited", "no_permission"]);
1759
+ var UploadAttachmentErrorCodeSchema = z17.enum(["too_large", "disallowed_type", "DISALLOWED_MIME", "rate_limited", "no_permission"]);
1726
1760
  var UploadAttachmentErrorSchema = z17.object({
1727
1761
  error: UploadAttachmentErrorCodeSchema,
1728
1762
  message: z17.string(),
1729
1763
  details: z17.record(z17.string(), z17.unknown()).optional()
1730
1764
  });
1731
- var IMAGE_UPLOAD_MIME = ["image/png", "image/jpeg", "image/gif", "image/webp", "image/svg+xml"];
1732
- var DND_EXTRA_UPLOAD_MIME = ["application/pdf", "text/plain", "text/markdown", "text/csv", "application/zip"];
1765
+ var UPLOAD_ALLOWED_MIME = [
1766
+ // Raster + vector images.
1767
+ "image/png",
1768
+ "image/jpeg",
1769
+ "image/gif",
1770
+ "image/webp",
1771
+ "image/svg+xml",
1772
+ "image/bmp",
1773
+ "image/avif",
1774
+ "image/apng",
1775
+ "image/x-icon",
1776
+ // Documents / text.
1777
+ "application/pdf",
1778
+ "text/plain",
1779
+ "text/markdown",
1780
+ "text/csv",
1781
+ "application/json",
1782
+ "application/xml",
1783
+ "text/html",
1784
+ // Office documents.
1785
+ "application/msword",
1786
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
1787
+ "application/vnd.ms-excel",
1788
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
1789
+ "application/vnd.ms-powerpoint",
1790
+ "application/vnd.openxmlformats-officedocument.presentationml.presentation",
1791
+ // Archives.
1792
+ "application/zip",
1793
+ "application/gzip",
1794
+ "application/x-tar",
1795
+ // Audio / video.
1796
+ "audio/mpeg",
1797
+ "audio/wav",
1798
+ "video/mp4",
1799
+ "video/webm",
1800
+ "video/quicktime",
1801
+ // Unknown / unset — see the note above.
1802
+ "application/octet-stream"
1803
+ ];
1733
1804
 
1734
1805
  // src/contracts/attachment.ts
1735
1806
  var PageIdPathParamsSchema = z18.object({
@@ -1811,6 +1882,10 @@ var addAttachmentRoute = createRoute10({
1811
1882
  description: "Request body exceeds the multipart envelope ceiling",
1812
1883
  content: { "application/json": { schema: AttachmentErrorSchema } }
1813
1884
  },
1885
+ 415: {
1886
+ description: "MIME type not in the unified upload allow-list (feature-attachment-upload-policy)",
1887
+ content: { "application/json": { schema: AttachmentErrorSchema } }
1888
+ },
1814
1889
  500: {
1815
1890
  description: "Upload / storage failure",
1816
1891
  content: { "application/json": { schema: AttachmentErrorSchema } }
@@ -1914,7 +1989,7 @@ var uploadAttachmentRoute = createRoute10({
1914
1989
  content: { "application/json": { schema: UploadAttachmentErrorSchema } }
1915
1990
  },
1916
1991
  415: {
1917
- description: "MIME type not in the per-intent allow-list",
1992
+ description: "MIME type not in the unified upload allow-list (feature-attachment-upload-policy)",
1918
1993
  content: { "application/json": { schema: UploadAttachmentErrorSchema } }
1919
1994
  },
1920
1995
  429: {
@@ -2109,7 +2184,7 @@ var GetBacklinksResponseSchema = z20.object({
2109
2184
  });
2110
2185
 
2111
2186
  // src/schemas/page.ts
2112
- import { z as z22 } from "@hono/zod-openapi";
2187
+ import { z as z23 } from "@hono/zod-openapi";
2113
2188
 
2114
2189
  // src/schemas/collab.ts
2115
2190
  import { z as z21 } from "@hono/zod-openapi";
@@ -2147,15 +2222,341 @@ var CollabForceReloadMessageSchema = z21.object({
2147
2222
  reason: z21.string().optional()
2148
2223
  });
2149
2224
 
2225
+ // src/schemas/rendered-ast.ts
2226
+ import { z as z22 } from "@hono/zod-openapi";
2227
+ var CURRENT_AST_VERSION = 1;
2228
+ var AST_INPUT_LIMIT_BYTES = 8 * 1024 * 1024;
2229
+ var AST_OUTPUT_WARN_BYTES = 512 * 1024;
2230
+ var AST_OUTPUT_BUDGET_BYTES = 2 * 1024 * 1024;
2231
+ var AST_MAX_TREE_DEPTH = 64;
2232
+ var AST_MAX_HAST_DEPTH = 16;
2233
+ var AST_MAX_IMAGE_BASE64_CHARS = 14e4;
2234
+ var AST_MAX_VALUE_CHARS = 2e5;
2235
+ var HPropertyValueSchema = z22.union([
2236
+ z22.string().max(4096),
2237
+ z22.number(),
2238
+ z22.boolean(),
2239
+ z22.array(z22.union([z22.string().max(4096), z22.number()])).max(64)
2240
+ // className etc.
2241
+ ]);
2242
+ var HPropertiesSchema = z22.object({
2243
+ id: z22.string().max(256).optional(),
2244
+ className: z22.union([z22.string().max(4096), z22.array(z22.string().max(256)).max(64)]).optional(),
2245
+ role: z22.string().max(64).optional(),
2246
+ ariaLabel: z22.string().max(256).optional(),
2247
+ "data-source-line": z22.union([z22.string().max(32), z22.number()]).optional(),
2248
+ "data-crowi-image-align": z22.string().max(16).optional(),
2249
+ "data-crowi-image-float": z22.string().max(16).optional(),
2250
+ "data-crowi-image-width": z22.string().max(16).optional(),
2251
+ "data-crowi-image-height": z22.string().max(16).optional()
2252
+ }).catchall(HPropertyValueSchema);
2253
+ var HChildSchema = z22.lazy(
2254
+ () => z22.discriminatedUnion("type", [
2255
+ z22.object({ type: z22.literal("raw"), value: z22.string().max(AST_MAX_VALUE_CHARS) }),
2256
+ z22.object({ type: z22.literal("text"), value: z22.string().max(AST_MAX_VALUE_CHARS) }),
2257
+ z22.object({
2258
+ type: z22.literal("element"),
2259
+ tagName: z22.string().max(32).regex(/^[a-zA-Z][a-zA-Z0-9-]*$/),
2260
+ properties: HPropertiesSchema.optional(),
2261
+ children: z22.array(HChildSchema)
2262
+ })
2263
+ ])
2264
+ );
2265
+ var HChildrenSchema = z22.array(HChildSchema).max(256);
2266
+ var HNameSchema = z22.string().max(32).regex(/^[a-zA-Z][a-zA-Z0-9-]*$/);
2267
+ var HastHintDataSchema = z22.object({
2268
+ hName: HNameSchema.optional(),
2269
+ hProperties: HPropertiesSchema.optional(),
2270
+ hChildren: HChildrenSchema.optional()
2271
+ });
2272
+ var CrowiDimensionSchema = z22.number().int().min(1).max(16384);
2273
+ var CrowiImagePayloadSchema = z22.object({
2274
+ mediaType: z22.enum(["image/svg+xml", "image/png"]),
2275
+ base64: z22.string().max(AST_MAX_IMAGE_BASE64_CHARS),
2276
+ /** Intrinsic dimensions — required (parent spec §3). Producers that cannot derive them fall back to html-only. */
2277
+ width: CrowiDimensionSchema,
2278
+ height: CrowiDimensionSchema
2279
+ });
2280
+ var ShikiTokenStyleSchema = z22.object({
2281
+ color: z22.string().max(32),
2282
+ bgColor: z22.string().max(32).optional(),
2283
+ fontStyle: z22.array(z22.enum(["italic", "bold", "underline", "strikethrough"])).max(4).optional()
2284
+ });
2285
+ var ShikiTokenSchema = z22.object({
2286
+ content: z22.string().max(4096),
2287
+ light: ShikiTokenStyleSchema,
2288
+ dark: ShikiTokenStyleSchema
2289
+ });
2290
+ var ShikiTokenLinesSchema = z22.array(z22.array(ShikiTokenSchema)).max(2e4);
2291
+ var CrowiCodeSidecarSchema = z22.object({
2292
+ lang: z22.string().max(64).optional(),
2293
+ value: z22.string().max(AST_MAX_VALUE_CHARS),
2294
+ /** Lines of themed tokens (light/dark both, `defaultColor: false`). */
2295
+ tokens: ShikiTokenLinesSchema
2296
+ });
2297
+ var CrowiMathSidecarSchema = z22.object({
2298
+ tex: z22.string().max(AST_MAX_VALUE_CHARS),
2299
+ display: z22.boolean()
2300
+ });
2301
+ var CrowiDiagramSidecarSchema = z22.object({
2302
+ kind: z22.enum(["mermaid", "plantuml"]),
2303
+ /** Mermaid's closed-enum diagram-type keyword (flowchart / sequence / ...). */
2304
+ diagramType: z22.string().max(32).optional(),
2305
+ alt: z22.string().max(256),
2306
+ image: CrowiImagePayloadSchema
2307
+ });
2308
+ var CrowiLinkCardSidecarSchema = z22.object({
2309
+ url: z22.string().max(4096),
2310
+ title: z22.string().max(512).optional(),
2311
+ description: z22.string().max(2048).optional(),
2312
+ /** OGP image stays an external URL (never inlined server-side — parent spec §10). */
2313
+ image: z22.object({ url: z22.string().max(4096) }).optional(),
2314
+ siteName: z22.string().max(256).optional(),
2315
+ domain: z22.string().max(256).optional()
2316
+ });
2317
+ var CrowiPlaceholderKindSchema = z22.enum([
2318
+ "error-auth",
2319
+ "error-rate-limit",
2320
+ "error-not-found",
2321
+ "error-network",
2322
+ "error-timeout",
2323
+ "error-unknown",
2324
+ "error-blocked",
2325
+ "error-busy",
2326
+ "size-limit-entry",
2327
+ "size-limit-page",
2328
+ "dispatch-limit",
2329
+ "validation-failed",
2330
+ "envelope-invalid"
2331
+ ]);
2332
+ var ReservationSchema = z22.discriminatedUnion("variant", [
2333
+ z22.object({ variant: z22.literal("fixed"), widthPx: z22.number().optional(), heightPx: z22.number() }),
2334
+ z22.object({ variant: z22.literal("aspect"), aspectRatio: z22.number() }),
2335
+ z22.object({ variant: z22.literal("card"), size: z22.enum(["small", "medium", "large"]) })
2336
+ ]);
2337
+ var CrowiPlaceholderSidecarSchema = z22.object({
2338
+ kind: CrowiPlaceholderKindSchema,
2339
+ label: z22.string().max(512),
2340
+ reservation: ReservationSchema
2341
+ });
2342
+ var SIDECAR_KEYS = ["crowiCode", "crowiMath", "crowiDiagram", "crowiLinkCard", "crowiPlaceholder"];
2343
+ var noFields = z22.object({});
2344
+ var headingFields = z22.object({ depth: z22.number().int().min(1).max(6) });
2345
+ var valueFields = z22.object({ value: z22.string().max(AST_MAX_VALUE_CHARS) });
2346
+ var codeFields = z22.object({
2347
+ value: z22.string().max(AST_MAX_VALUE_CHARS),
2348
+ lang: z22.string().max(64).nullable().optional(),
2349
+ meta: z22.string().max(1024).nullable().optional()
2350
+ });
2351
+ var mathFields = z22.object({
2352
+ value: z22.string().max(AST_MAX_VALUE_CHARS),
2353
+ meta: z22.string().max(1024).nullable().optional()
2354
+ });
2355
+ var listFields = z22.object({
2356
+ ordered: z22.boolean().nullable().optional(),
2357
+ start: z22.number().int().nullable().optional(),
2358
+ spread: z22.boolean().nullable().optional()
2359
+ });
2360
+ var listItemFields = z22.object({
2361
+ checked: z22.boolean().nullable().optional(),
2362
+ spread: z22.boolean().nullable().optional()
2363
+ });
2364
+ var linkFields = z22.object({
2365
+ url: z22.string().max(4096),
2366
+ title: z22.string().max(512).nullable().optional()
2367
+ });
2368
+ var imageFields = z22.object({
2369
+ url: z22.string().max(4096),
2370
+ alt: z22.string().max(1024).nullable().optional(),
2371
+ title: z22.string().max(512).nullable().optional()
2372
+ });
2373
+ var tableFields = z22.object({
2374
+ align: z22.array(z22.enum(["left", "right", "center"]).nullable()).max(256).nullable().optional()
2375
+ });
2376
+ var definitionFields = z22.object({
2377
+ identifier: z22.string().max(256),
2378
+ url: z22.string().max(4096),
2379
+ label: z22.string().max(256).optional(),
2380
+ title: z22.string().max(512).nullable().optional()
2381
+ });
2382
+ var footnoteDefinitionFields = z22.object({
2383
+ identifier: z22.string().max(256),
2384
+ label: z22.string().max(256).optional()
2385
+ });
2386
+ var footnoteReferenceFields = footnoteDefinitionFields;
2387
+ var referenceTypeSchema = z22.enum(["shortcut", "collapsed", "full"]);
2388
+ var linkReferenceFields = z22.object({
2389
+ identifier: z22.string().max(256),
2390
+ referenceType: referenceTypeSchema,
2391
+ label: z22.string().max(256).optional()
2392
+ });
2393
+ var imageReferenceFields = z22.object({
2394
+ identifier: z22.string().max(256),
2395
+ referenceType: referenceTypeSchema,
2396
+ label: z22.string().max(256).optional(),
2397
+ alt: z22.string().max(1024).nullable().optional()
2398
+ });
2399
+ var crowiOpaqueFields = z22.object({
2400
+ reason: z22.enum(["unknown-type", "invalid-shape", "invalid-position"]),
2401
+ /** Best-effort diagnostics only — never a rendering hint. Truncated to 64 chars before assignment. */
2402
+ originalType: z22.string().max(64).optional()
2403
+ });
2404
+ var RENDERED_AST_NODE_DEFS = {
2405
+ root: { placement: "flow", childModel: "flow", fields: noFields },
2406
+ paragraph: { placement: "flow", childModel: "phrasing", fields: noFields },
2407
+ heading: { placement: "flow", childModel: "phrasing", fields: headingFields },
2408
+ thematicBreak: { placement: "flow", childModel: "none", fields: noFields },
2409
+ blockquote: { placement: "flow", childModel: "flow", fields: noFields },
2410
+ list: { placement: "flow", childModel: "listItems", fields: listFields },
2411
+ listItem: { placement: "listItems", childModel: "flow", fields: listItemFields },
2412
+ html: { placement: "both", childModel: "none", fields: valueFields },
2413
+ code: { placement: "flow", childModel: "none", fields: codeFields },
2414
+ inlineCode: { placement: "phrasing", childModel: "none", fields: valueFields },
2415
+ math: { placement: "flow", childModel: "none", fields: mathFields },
2416
+ inlineMath: { placement: "phrasing", childModel: "none", fields: mathFields },
2417
+ text: { placement: "phrasing", childModel: "none", fields: valueFields },
2418
+ strong: { placement: "phrasing", childModel: "phrasing", fields: noFields },
2419
+ emphasis: { placement: "phrasing", childModel: "phrasing", fields: noFields },
2420
+ delete: { placement: "phrasing", childModel: "phrasing", fields: noFields },
2421
+ break: { placement: "phrasing", childModel: "none", fields: noFields },
2422
+ link: { placement: "phrasing", childModel: "phrasing", fields: linkFields },
2423
+ image: { placement: "phrasing", childModel: "none", fields: imageFields },
2424
+ table: { placement: "flow", childModel: "tableRows", fields: tableFields },
2425
+ tableRow: { placement: "tableRows", childModel: "tableCells", fields: noFields },
2426
+ tableCell: { placement: "tableCells", childModel: "phrasing", fields: noFields },
2427
+ definition: { placement: "flow", childModel: "none", fields: definitionFields },
2428
+ footnoteDefinition: { placement: "flow", childModel: "flow", fields: footnoteDefinitionFields },
2429
+ footnoteReference: { placement: "phrasing", childModel: "none", fields: footnoteReferenceFields },
2430
+ linkReference: { placement: "phrasing", childModel: "phrasing", fields: linkReferenceFields },
2431
+ imageReference: { placement: "phrasing", childModel: "none", fields: imageReferenceFields },
2432
+ // Crowi-owned types. `crowiFigure` is the only one that also appears
2433
+ // in stored ASTs; the other three only exist as projection outputs
2434
+ // (or as defensively-validated plugin-injected nodes).
2435
+ crowiFigure: { placement: "flow", childModel: "phrasing", fields: noFields },
2436
+ crowiDiagram: { placement: "flow", childModel: "none", fields: CrowiDiagramSidecarSchema },
2437
+ crowiLinkCard: { placement: "flow", childModel: "none", fields: CrowiLinkCardSidecarSchema },
2438
+ crowiPlaceholder: { placement: "both", childModel: "none", fields: CrowiPlaceholderSidecarSchema },
2439
+ crowiOpaque: { placement: "both", childModel: "none", fields: crowiOpaqueFields }
2440
+ };
2441
+ var RenderedAstNodeSchema = z22.lazy(
2442
+ () => z22.discriminatedUnion("type", [
2443
+ RootNodeSchema,
2444
+ ParagraphNodeSchema,
2445
+ HeadingNodeSchema,
2446
+ ThematicBreakNodeSchema,
2447
+ BlockquoteNodeSchema,
2448
+ ListNodeSchema,
2449
+ ListItemNodeSchema,
2450
+ HtmlNodeSchema,
2451
+ CodeNodeSchema,
2452
+ InlineCodeNodeSchema,
2453
+ MathNodeSchema,
2454
+ InlineMathNodeSchema,
2455
+ TextNodeSchema,
2456
+ StrongNodeSchema,
2457
+ EmphasisNodeSchema,
2458
+ DeleteNodeSchema,
2459
+ BreakNodeSchema,
2460
+ LinkNodeSchema,
2461
+ ImageNodeSchema,
2462
+ TableNodeSchema,
2463
+ TableRowNodeSchema,
2464
+ TableCellNodeSchema,
2465
+ DefinitionNodeSchema,
2466
+ FootnoteDefinitionNodeSchema,
2467
+ FootnoteReferenceNodeSchema,
2468
+ LinkReferenceNodeSchema,
2469
+ ImageReferenceNodeSchema,
2470
+ CrowiFigureNodeSchema,
2471
+ CrowiDiagramNodeSchema,
2472
+ CrowiLinkCardNodeSchema,
2473
+ CrowiPlaceholderNodeSchema,
2474
+ CrowiOpaqueNodeSchema
2475
+ ])
2476
+ );
2477
+ var childrenSchema = z22.array(RenderedAstNodeSchema);
2478
+ var dataSchema = HastHintDataSchema.optional();
2479
+ var RootNodeSchema = z22.object({ type: z22.literal("root"), data: dataSchema, children: childrenSchema });
2480
+ var ParagraphNodeSchema = z22.object({ type: z22.literal("paragraph"), data: dataSchema, children: childrenSchema });
2481
+ var HeadingNodeSchema = headingFields.extend({ type: z22.literal("heading"), data: dataSchema, children: childrenSchema });
2482
+ var ThematicBreakNodeSchema = z22.object({ type: z22.literal("thematicBreak"), data: dataSchema });
2483
+ var BlockquoteNodeSchema = z22.object({ type: z22.literal("blockquote"), data: dataSchema, children: childrenSchema });
2484
+ var ListNodeSchema = listFields.extend({ type: z22.literal("list"), data: dataSchema, children: childrenSchema });
2485
+ var ListItemNodeSchema = listItemFields.extend({ type: z22.literal("listItem"), data: dataSchema, children: childrenSchema });
2486
+ var HtmlNodeSchema = valueFields.extend({ type: z22.literal("html"), data: dataSchema });
2487
+ var CodeDataSchema = HastHintDataSchema.extend({
2488
+ renderPending: z22.boolean().optional(),
2489
+ tokens: ShikiTokenLinesSchema.optional()
2490
+ }).optional();
2491
+ var CodeNodeSchema = codeFields.extend({ type: z22.literal("code"), data: CodeDataSchema });
2492
+ var InlineCodeNodeSchema = valueFields.extend({ type: z22.literal("inlineCode"), data: dataSchema });
2493
+ var MathNodeSchema = mathFields.extend({ type: z22.literal("math"), data: dataSchema });
2494
+ var InlineMathNodeSchema = mathFields.extend({ type: z22.literal("inlineMath"), data: dataSchema });
2495
+ var TextNodeSchema = valueFields.extend({ type: z22.literal("text"), data: dataSchema });
2496
+ var StrongNodeSchema = z22.object({ type: z22.literal("strong"), data: dataSchema, children: childrenSchema });
2497
+ var EmphasisNodeSchema = z22.object({ type: z22.literal("emphasis"), data: dataSchema, children: childrenSchema });
2498
+ var DeleteNodeSchema = z22.object({ type: z22.literal("delete"), data: dataSchema, children: childrenSchema });
2499
+ var BreakNodeSchema = z22.object({ type: z22.literal("break"), data: dataSchema });
2500
+ var LinkNodeSchema = linkFields.extend({ type: z22.literal("link"), data: dataSchema, children: childrenSchema });
2501
+ var ImageNodeSchema = imageFields.extend({ type: z22.literal("image"), data: dataSchema });
2502
+ var TableNodeSchema = tableFields.extend({ type: z22.literal("table"), data: dataSchema, children: childrenSchema });
2503
+ var TableRowNodeSchema = z22.object({ type: z22.literal("tableRow"), data: dataSchema, children: childrenSchema });
2504
+ var TableCellNodeSchema = z22.object({ type: z22.literal("tableCell"), data: dataSchema, children: childrenSchema });
2505
+ var DefinitionNodeSchema = definitionFields.extend({ type: z22.literal("definition"), data: dataSchema });
2506
+ var FootnoteDefinitionNodeSchema = footnoteDefinitionFields.extend({
2507
+ type: z22.literal("footnoteDefinition"),
2508
+ data: dataSchema,
2509
+ children: childrenSchema
2510
+ });
2511
+ var FootnoteReferenceNodeSchema = footnoteReferenceFields.extend({ type: z22.literal("footnoteReference"), data: dataSchema });
2512
+ var LinkReferenceNodeSchema = linkReferenceFields.extend({ type: z22.literal("linkReference"), data: dataSchema, children: childrenSchema });
2513
+ var ImageReferenceNodeSchema = imageReferenceFields.extend({ type: z22.literal("imageReference"), data: dataSchema });
2514
+ var CrowiFigureNodeSchema = z22.object({
2515
+ type: z22.literal("crowiFigure"),
2516
+ data: HastHintDataSchema.extend({ hName: z22.literal("figure"), hProperties: HPropertiesSchema }),
2517
+ children: childrenSchema
2518
+ });
2519
+ var CrowiDiagramNodeSchema = CrowiDiagramSidecarSchema.extend({ type: z22.literal("crowiDiagram"), data: dataSchema });
2520
+ var CrowiLinkCardNodeSchema = CrowiLinkCardSidecarSchema.extend({ type: z22.literal("crowiLinkCard"), data: dataSchema });
2521
+ var CrowiPlaceholderNodeSchema = CrowiPlaceholderSidecarSchema.extend({ type: z22.literal("crowiPlaceholder"), data: dataSchema });
2522
+ var CrowiOpaqueNodeSchema = crowiOpaqueFields.extend({ type: z22.literal("crowiOpaque"), data: dataSchema });
2523
+ var RenderedAstRootSchema = RootNodeSchema;
2524
+ var RenderedAstEnvelopeSchema = z22.object({
2525
+ astVersion: z22.literal(CURRENT_AST_VERSION),
2526
+ root: RenderedAstRootSchema
2527
+ });
2528
+ var RenderedAstEnvelopeOpenApiSchema = z22.object({
2529
+ astVersion: z22.literal(CURRENT_AST_VERSION),
2530
+ root: z22.unknown()
2531
+ }).openapi("RenderedAstEnvelope");
2532
+ var LooseRenderedAstRootSchema = z22.object({
2533
+ type: z22.literal("root"),
2534
+ children: z22.array(z22.unknown())
2535
+ }).openapi("LegacyRenderedAstRoot");
2536
+ var RenderedAstValueSchema = z22.union([RenderedAstEnvelopeOpenApiSchema, LooseRenderedAstRootSchema]);
2537
+ var RenderedAstArtifactKeySchema = z22.string().max(64);
2538
+ function unwrapRenderedAst(value) {
2539
+ if (value === void 0 || value === null) return void 0;
2540
+ if (typeof value !== "object") return void 0;
2541
+ if (value.astVersion === CURRENT_AST_VERSION) {
2542
+ const root = value.root;
2543
+ return root === null ? void 0 : root;
2544
+ }
2545
+ if (value.type === "root" && Array.isArray(value.children)) {
2546
+ return value;
2547
+ }
2548
+ return void 0;
2549
+ }
2550
+
2150
2551
  // src/schemas/page.ts
2151
- var PageGrantSchema = z22.enum(["1", "2", "3", "4"]).transform((val) => Number(val));
2552
+ var PageGrantSchema = z23.enum(["1", "2", "3", "4"]).transform((val) => Number(val));
2152
2553
  var PageGrantEnum = {
2153
2554
  PUBLIC: 1,
2154
2555
  RESTRICTED: 2,
2155
2556
  SPECIFIED: 3,
2156
2557
  OWNER: 4
2157
2558
  };
2158
- var PageStatusSchema = z22.enum(["wip", "published", "deleted", "deprecated", "draft"]);
2559
+ var PageStatusSchema = z23.enum(["wip", "published", "deleted", "deprecated", "draft"]);
2159
2560
  var PageStatusEnum = {
2160
2561
  WIP: "wip",
2161
2562
  PUBLISHED: "published",
@@ -2163,43 +2564,43 @@ var PageStatusEnum = {
2163
2564
  DEPRECATED: "deprecated",
2164
2565
  DRAFT: "draft"
2165
2566
  };
2166
- var PageTypeSchema = z22.enum(["portal", "user", "public"]);
2567
+ var PageTypeSchema = z23.enum(["portal", "user", "public"]);
2167
2568
  var PageTypeEnum = {
2168
2569
  PORTAL: "portal",
2169
2570
  USER: "user",
2170
2571
  PUBLIC: "public"
2171
2572
  };
2172
- var PageUserSchema = z22.object({
2173
- _id: z22.string(),
2174
- id: z22.string().optional(),
2573
+ var PageUserSchema = z23.object({
2574
+ _id: z23.string(),
2575
+ id: z23.string().optional(),
2175
2576
  // for compatibility
2176
- username: z22.string(),
2177
- name: z22.string(),
2178
- email: z22.string().email(),
2179
- image: z22.string().nullable().optional(),
2180
- createdAt: z22.string()
2181
- });
2182
- var TocEntrySchema = z22.object({
2183
- level: z22.number().int().min(1).max(6),
2184
- text: z22.string(),
2185
- anchorId: z22.string()
2186
- });
2187
- var WikiLinkSchema = z22.object({
2577
+ username: z23.string(),
2578
+ name: z23.string(),
2579
+ email: z23.string().email(),
2580
+ image: z23.string().nullable().optional(),
2581
+ createdAt: z23.string()
2582
+ });
2583
+ var TocEntrySchema = z23.object({
2584
+ level: z23.number().int().min(1).max(6),
2585
+ text: z23.string(),
2586
+ anchorId: z23.string()
2587
+ });
2588
+ var WikiLinkSchema = z23.object({
2188
2589
  /** Verbatim source between the `[[` `]]` (no surrounding brackets). */
2189
- raw: z22.string(),
2590
+ raw: z23.string(),
2190
2591
  /** Normalised target (left of the `|`, fragment trimmed for resolution). */
2191
- target: z22.string(),
2592
+ target: z23.string(),
2192
2593
  /** Optional pipe-aliased display text (right of the `|`). */
2193
- displayText: z22.string().optional()
2594
+ displayText: z23.string().optional()
2194
2595
  });
2195
- var MentionSchema = z22.object({
2196
- username: z22.string()
2596
+ var MentionSchema = z23.object({
2597
+ username: z23.string()
2197
2598
  });
2198
- var RevisionMetaSchemaShape = z22.object({
2199
- toc: z22.array(TocEntrySchema).optional(),
2200
- wikiLinks: z22.array(WikiLinkSchema).optional(),
2201
- mentions: z22.array(MentionSchema).optional(),
2202
- codeBlockLanguages: z22.array(z22.string()).optional(),
2599
+ var RevisionMetaSchemaShape = z23.object({
2600
+ toc: z23.array(TocEntrySchema).optional(),
2601
+ wikiLinks: z23.array(WikiLinkSchema).optional(),
2602
+ mentions: z23.array(MentionSchema).optional(),
2603
+ codeBlockLanguages: z23.array(z23.string()).optional(),
2203
2604
  // feature-backlink-raw-space-metadata: raw destinations recovered by
2204
2605
  // `renderer/core/raw-space-links.ts` (`[label](/a b)` — a raw-space
2205
2606
  // absolute path CommonMark itself rejects as a link). Verbatim, NOT
@@ -2207,58 +2608,66 @@ var RevisionMetaSchemaShape = z22.object({
2207
2608
  // `stripFragmentAndQuery` -> `decodeLinkPath` pipeline the regex-based
2208
2609
  // extraction path uses. Mirrors `wikiLinks` above: pushed by the core
2209
2610
  // transform into `PipelineMetadata`, persisted verbatim on `revision.meta`.
2210
- rawSpaceLinks: z22.array(z22.string()).optional()
2611
+ rawSpaceLinks: z23.array(z23.string()).optional()
2211
2612
  });
2212
- var RevisionSchema = z22.object({
2213
- _id: z22.string(),
2214
- path: z22.string(),
2215
- body: z22.string(),
2216
- format: z22.string().default("markdown"),
2613
+ var RevisionSchema = z23.object({
2614
+ _id: z23.string(),
2615
+ path: z23.string(),
2616
+ body: z23.string(),
2617
+ format: z23.string().default("markdown"),
2217
2618
  author: PageUserSchema.nullable().optional(),
2218
- createdAt: z22.string(),
2619
+ createdAt: z23.string(),
2219
2620
  meta: RevisionMetaSchemaShape.optional(),
2220
- // RFC-0002 Phase 3: transformed mdast (parse + core plugins +
2221
- // shiki) for the web client to render without re-parsing the body.
2222
- // Typed as opaque `unknown` because mdast is too deep / external-
2223
- // spec to maintain a strict Zod schema for. Only single-page detail
2224
- // (`getPage`) and single-revision detail (`getRevision`) emit it;
2225
- // list endpoints skip it for payload weight.
2226
- renderedAst: z22.unknown().optional(),
2621
+ // RFC-0002 Phase 3 / RFC-0023: transformed mdast. Requests that
2622
+ // declare `X-Crowi-Ast-Version: 1` receive the typed envelope
2623
+ // (`{astVersion, root}`); everyone else (including the web,
2624
+ // permanently) receives the stored bare mdast `Root` verbatim and
2625
+ // unvalidated see `schemas/rendered-ast.ts` for the full contract.
2626
+ // Only single-page detail (`getPage`), the listPages portal document
2627
+ // and single-revision detail (`getRevision`) emit it; list rows skip
2628
+ // it for payload weight.
2629
+ renderedAst: RenderedAstValueSchema.optional(),
2630
+ // RFC-0023 (design doc §14): identity of the served AST artifact —
2631
+ // `rendererVersion` for a verbatim stored AST, a per-response nonce
2632
+ // when the served tree differs from the stored one (pending-marker
2633
+ // retry / freshness-mismatch recompute). The web render memo keys on
2634
+ // `[revisionId, renderedAstArtifactKey]`.
2635
+ renderedAstArtifactKey: RenderedAstArtifactKeySchema.optional(),
2227
2636
  // RFC-0002 round 3.1: semver of the renderer pipeline that produced
2228
2637
  // `renderedAst`. The read path uses this to detect stale entries
2229
2638
  // (rebuilt by `renderer:rebuild` once RFC-0008 lands). Absent on
2230
2639
  // revisions saved before this field was introduced.
2231
- rendererVersion: z22.string().optional(),
2640
+ rendererVersion: z23.string().optional(),
2232
2641
  // RFC-0003 collaborative-save fields. All optional; v1.x revisions
2233
2642
  // emit none of them. See `packages/api/src/models/revision.ts` for
2234
2643
  // semantics. The list-page endpoint currently does not surface
2235
2644
  // these — they only appear on the Phase 5+ checkpoint Revisions
2236
2645
  // produced by Hocuspocus and on the single-revision detail route.
2237
- parentRevisionId: z22.string().nullable().optional(),
2646
+ parentRevisionId: z23.string().nullable().optional(),
2238
2647
  type: RevisionTypeSchema.optional(),
2239
- savedBy: z22.union([z22.string(), PageUserSchema]).nullable().optional(),
2240
- contributors: z22.array(z22.union([z22.string(), PageUserSchema])).optional(),
2241
- message: z22.string().optional(),
2648
+ savedBy: z23.union([z23.string(), PageUserSchema]).nullable().optional(),
2649
+ contributors: z23.array(z23.union([z23.string(), PageUserSchema])).optional(),
2650
+ message: z23.string().optional(),
2242
2651
  // RFC-0010 — edit channel ('web' | 'oauth' | 'pat'); absent on
2243
2652
  // pre-RFC-0010 / collaborative / browser revisions.
2244
- editVia: z22.enum(["web", "oauth", "pat"]).optional()
2245
- });
2246
- var PageExtendedSchema = z22.record(z22.string(), z22.any()).optional();
2247
- var PageSchema = z22.object({
2248
- _id: z22.string(),
2249
- path: z22.string(),
2250
- revision: z22.union([z22.string(), RevisionSchema]).optional(),
2251
- redirectTo: z22.string().nullable().optional(),
2653
+ editVia: z23.enum(["web", "oauth", "pat"]).optional()
2654
+ });
2655
+ var PageExtendedSchema = z23.record(z23.string(), z23.any()).optional();
2656
+ var PageSchema = z23.object({
2657
+ _id: z23.string(),
2658
+ path: z23.string(),
2659
+ revision: z23.union([z23.string(), RevisionSchema]).optional(),
2660
+ redirectTo: z23.string().nullable().optional(),
2252
2661
  status: PageStatusSchema.nullable().optional(),
2253
- grant: z22.number().optional(),
2254
- grantedUsers: z22.array(z22.string()).optional(),
2255
- creator: z22.union([z22.string(), PageUserSchema]).nullable().optional(),
2256
- lastUpdateUser: z22.union([z22.string(), PageUserSchema]).nullable().optional(),
2257
- liker: z22.array(z22.string()).optional(),
2258
- commentCount: z22.number().default(0),
2662
+ grant: z23.number().optional(),
2663
+ grantedUsers: z23.array(z23.string()).optional(),
2664
+ creator: z23.union([z23.string(), PageUserSchema]).nullable().optional(),
2665
+ lastUpdateUser: z23.union([z23.string(), PageUserSchema]).nullable().optional(),
2666
+ liker: z23.array(z23.string()).optional(),
2667
+ commentCount: z23.number().default(0),
2259
2668
  extended: PageExtendedSchema,
2260
- createdAt: z22.string(),
2261
- updatedAt: z22.string().optional(),
2669
+ createdAt: z23.string(),
2670
+ updatedAt: z23.string().optional(),
2262
2671
  // RFC-0003 collaborative-edit fields. All optional; `null` is the
2263
2672
  // "no live state yet" value. Existing read endpoints (list /
2264
2673
  // detail) do not currently emit these — the contract is widened
@@ -2266,32 +2675,32 @@ var PageSchema = z22.object({
2266
2675
  // bump. `yjsState` is intentionally omitted from the contract:
2267
2676
  // the binary blob lives only inside Hocuspocus and never crosses
2268
2677
  // the HTTP API.
2269
- currentRevision: z22.string().nullable().optional(),
2270
- yjsCheckpointAt: z22.string().nullable().optional(),
2678
+ currentRevision: z23.string().nullable().optional(),
2679
+ yjsCheckpointAt: z23.string().nullable().optional(),
2271
2680
  // dynamic fields
2272
- latestRevision: z22.string().optional(),
2273
- likerCount: z22.number().optional(),
2274
- seenUsersCount: z22.number().optional()
2681
+ latestRevision: z23.string().optional(),
2682
+ likerCount: z23.number().optional(),
2683
+ seenUsersCount: z23.number().optional()
2275
2684
  });
2276
2685
  var PageWithRevisionSchema = PageSchema.extend({
2277
2686
  revision: RevisionSchema,
2278
2687
  creator: PageUserSchema.nullable().optional(),
2279
2688
  lastUpdateUser: PageUserSchema.nullable().optional()
2280
2689
  });
2281
- var GetPageRequestSchema = z22.object({
2282
- path: z22.string().optional(),
2283
- page_id: z22.string().optional(),
2284
- revision_id: z22.string().optional()
2690
+ var GetPageRequestSchema = z23.object({
2691
+ path: z23.string().optional(),
2692
+ page_id: z23.string().optional(),
2693
+ revision_id: z23.string().optional()
2285
2694
  });
2286
- var GetPageResponseSchema = z22.object({
2695
+ var GetPageResponseSchema = z23.object({
2287
2696
  page: PageWithRevisionSchema
2288
2697
  });
2289
- var ClaimPageLinkAccessResponseSchema = GetPageResponseSchema.extend({ granted: z22.boolean() });
2290
- var ListPagesRequestSchema = z22.object({
2291
- path: z22.string().optional(),
2292
- user: z22.string().optional(),
2293
- limit: z22.coerce.number().optional().default(50),
2294
- offset: z22.coerce.number().optional().default(0),
2698
+ var ClaimPageLinkAccessResponseSchema = GetPageResponseSchema.extend({ granted: z23.boolean() });
2699
+ var ListPagesRequestSchema = z23.object({
2700
+ path: z23.string().optional(),
2701
+ user: z23.string().optional(),
2702
+ limit: z23.coerce.number().optional().default(50),
2703
+ offset: z23.coerce.number().optional().default(0),
2295
2704
  // NOT `z.coerce.boolean()`: that uses JS `Boolean(v)`, so the string
2296
2705
  // `"false"` (which is how the web client serialises `false` on the
2297
2706
  // query string) coerces to `true`. That silently flipped
@@ -2299,25 +2708,25 @@ var ListPagesRequestSchema = z22.object({
2299
2708
  // filter and leak other users' drafts. Parse the string explicitly so
2300
2709
  // only `"true"` / `true` is truthy; anything else (incl. `"false"`,
2301
2710
  // absent) is `false`.
2302
- include_deleted: z22.preprocess((v) => v === true || v === "true" || v === "1", z22.boolean()).optional().default(false),
2711
+ include_deleted: z23.preprocess((v) => v === true || v === "true" || v === "1", z23.boolean()).optional().default(false),
2303
2712
  // Sort field + direction for the listing. Defaults preserve the legacy
2304
2713
  // "newest-updated first" order so existing callers are unaffected.
2305
2714
  // `path` sorts alphabetically by full page path (≈ name order).
2306
- sort: z22.enum(["updatedAt", "createdAt", "path"]).optional().default("updatedAt"),
2307
- order: z22.enum(["asc", "desc"]).optional().default("desc"),
2715
+ sort: z23.enum(["updatedAt", "createdAt", "path"]).optional().default("updatedAt"),
2716
+ order: z23.enum(["asc", "desc"]).optional().default("desc"),
2308
2717
  // When listing a portal path (`/foo/`), open the portal document at this
2309
2718
  // past revision so the catch-all can mirror `?revision_id=` on portals.
2310
2719
  // Only the `portalPage` is rewound — the child rows always reflect the
2311
2720
  // latest. Absent for normal listings.
2312
- revision_id: z22.string().optional()
2721
+ revision_id: z23.string().optional()
2313
2722
  });
2314
- var PagerSchema = z22.object({
2315
- prev: z22.number().nullable(),
2316
- next: z22.number().nullable(),
2317
- offset: z22.number()
2723
+ var PagerSchema = z23.object({
2724
+ prev: z23.number().nullable(),
2725
+ next: z23.number().nullable(),
2726
+ offset: z23.number()
2318
2727
  });
2319
- var ListPagesResponseSchema = z22.object({
2320
- pages: z22.array(PageSchema),
2728
+ var ListPagesResponseSchema = z23.object({
2729
+ pages: z23.array(PageSchema),
2321
2730
  pager: PagerSchema,
2322
2731
  portalPage: PageSchema.nullable().optional(),
2323
2732
  // When listing a portal path (`/foo/`) that has NO portal document of
@@ -2327,144 +2736,151 @@ var ListPagesResponseSchema = z22.object({
2327
2736
  // (feature-update-pages-list-ux §4). Mutually exclusive with `portalPage`
2328
2737
  // — only set when `portalPage` is null. Absent / null for ordinary
2329
2738
  // listings.
2330
- contentPage: PageSchema.nullable().optional()
2739
+ contentPage: PageSchema.nullable().optional(),
2740
+ // feature-profile-stats-and-page-total — the exact count of the viewer-
2741
+ // visible set `pages` pages from (i.e. matching `pages`' visibility
2742
+ // conditions, independent of `limit`/`offset`, and excluding whichever
2743
+ // ids `portalPage`/`contentPage` already removed from `pages`). Not part
2744
+ // of `PagerSchema` — mirrors `ListUsersResponseSchema.total`, a sibling
2745
+ // top-level field alongside `pager`.
2746
+ total: z23.number()
2331
2747
  });
2332
- var PageChildSegmentSchema = z22.object({
2748
+ var PageChildSegmentSchema = z23.object({
2333
2749
  // The bare segment name immediately under the queried path
2334
2750
  // (e.g. 'rfc' for /crowi/rfc/... when querying /crowi/).
2335
- segment: z22.string(),
2751
+ segment: z23.string(),
2336
2752
  // Portal-style path for this segment (always trailing-slashed),
2337
2753
  // e.g. '/crowi/rfc/'. Drop the trailing slash for the page path when
2338
2754
  // the segment is a leaf page (see `isPage`).
2339
- path: z22.string(),
2755
+ path: z23.string(),
2340
2756
  // True when a real page is saved at the segment path itself
2341
2757
  // (e.g. `/crowi/rfc`, no trailing slash) — i.e. the segment is a
2342
2758
  // navigable page, not only an inferred directory.
2343
- isPage: z22.boolean(),
2759
+ isPage: z23.boolean(),
2344
2760
  // True when a real portal page is saved at `path` (→ compass icon).
2345
- hasPortal: z22.boolean(),
2761
+ hasPortal: z23.boolean(),
2346
2762
  // Number of descendant content pages strictly under this segment
2347
2763
  // (excludes the segment's own page / portal docs). A rough "how much
2348
2764
  // lives here" hint; > 0 means the segment is an expandable directory.
2349
- count: z22.number(),
2765
+ count: z23.number(),
2350
2766
  // ISO8601 timestamp of the segment's representative page: the segment's
2351
2767
  // own page when `isPage` is true, otherwise the most-recently-updated
2352
2768
  // descendant (including the portal doc itself). `null` when no
2353
2769
  // representative page's timestamp could be derived. Optional so
2354
2770
  // existing clients (web SidebarTree) that don't read it keep working
2355
2771
  // unchanged — additive contract extension, feature-child-segments-metadata.
2356
- lastUpdatedAt: z22.string().nullable().optional(),
2772
+ lastUpdatedAt: z23.string().nullable().optional(),
2357
2773
  // The representative page's last updater (same page as `lastUpdatedAt`
2358
2774
  // above). `null` when the updater can't be resolved (e.g. a deleted
2359
2775
  // user, or legacy rows predating `lastUpdateUser`).
2360
2776
  updater: PageUserSchema.nullable().optional()
2361
2777
  });
2362
- var ListPageChildrenRequestSchema = z22.object({
2778
+ var ListPageChildrenRequestSchema = z23.object({
2363
2779
  // Portal path to list children of. Trailing slash optional — the
2364
2780
  // handler normalises it. '/' lists the top-level segments.
2365
- path: z22.string()
2781
+ path: z23.string()
2366
2782
  });
2367
- var ListPageChildrenResponseSchema = z22.object({
2783
+ var ListPageChildrenResponseSchema = z23.object({
2368
2784
  // Sorted alphabetically by segment.
2369
- children: z22.array(PageChildSegmentSchema)
2370
- });
2371
- var CreatePageRequestSchema = z22.object({
2372
- path: z22.string(),
2373
- body: z22.string(),
2374
- grant: z22.number().optional()
2375
- });
2376
- var UpdatePageRequestSchema = z22.object({
2377
- page_id: z22.string(),
2378
- body: z22.string(),
2379
- revision_id: z22.string().optional(),
2380
- grant: z22.number().optional()
2381
- });
2382
- var RevertToRevisionRequestSchema = z22.object({
2383
- page_id: z22.string(),
2384
- revision_id: z22.string()
2385
- });
2386
- var SetPageGrantRequestSchema = z22.object({
2387
- page_id: z22.string(),
2388
- grant: z22.number().int()
2389
- });
2390
- var RenamePageRequestSchema = z22.object({
2391
- page_id: z22.string(),
2392
- new_path: z22.string(),
2393
- revision_id: z22.string().optional(),
2394
- create_redirect: z22.boolean().optional(),
2785
+ children: z23.array(PageChildSegmentSchema)
2786
+ });
2787
+ var CreatePageRequestSchema = z23.object({
2788
+ path: z23.string(),
2789
+ body: z23.string(),
2790
+ grant: z23.number().optional()
2791
+ });
2792
+ var UpdatePageRequestSchema = z23.object({
2793
+ page_id: z23.string(),
2794
+ body: z23.string(),
2795
+ revision_id: z23.string().optional(),
2796
+ grant: z23.number().optional()
2797
+ });
2798
+ var RevertToRevisionRequestSchema = z23.object({
2799
+ page_id: z23.string(),
2800
+ revision_id: z23.string()
2801
+ });
2802
+ var SetPageGrantRequestSchema = z23.object({
2803
+ page_id: z23.string(),
2804
+ grant: z23.number().int()
2805
+ });
2806
+ var RenamePageRequestSchema = z23.object({
2807
+ page_id: z23.string(),
2808
+ new_path: z23.string(),
2809
+ revision_id: z23.string().optional(),
2810
+ create_redirect: z23.boolean().optional(),
2395
2811
  // When true, rename the page together with its whole (grant-visible)
2396
2812
  // descendant subtree (renameTree) instead of just the single page.
2397
2813
  // Defaults to false — the single-page rename behaviour.
2398
- include_descendants: z22.boolean().optional()
2814
+ include_descendants: z23.boolean().optional()
2399
2815
  });
2400
- var RenamePageResponseSchema = z22.object({
2816
+ var RenamePageResponseSchema = z23.object({
2401
2817
  page: PageSchema,
2402
- renamed_count: z22.number()
2403
- });
2404
- var RenameTreeErrorSchema = z22.object({
2405
- error: z22.object({
2406
- code: z22.literal("PAGE_RENAME_TREE_FAILED"),
2407
- message: z22.string(),
2408
- conflicts: z22.array(
2409
- z22.object({
2410
- path: z22.string(),
2411
- reasons: z22.array(z22.string())
2818
+ renamed_count: z23.number()
2819
+ });
2820
+ var RenameTreeErrorSchema = z23.object({
2821
+ error: z23.object({
2822
+ code: z23.literal("PAGE_RENAME_TREE_FAILED"),
2823
+ message: z23.string(),
2824
+ conflicts: z23.array(
2825
+ z23.object({
2826
+ path: z23.string(),
2827
+ reasons: z23.array(z23.string())
2412
2828
  })
2413
2829
  ),
2414
2830
  // True when the failure happened after some pages were already moved
2415
2831
  // (non-transactional best-effort). When omitted/false the failure was
2416
2832
  // detected up-front and nothing was moved.
2417
- partial: z22.boolean().optional()
2833
+ partial: z23.boolean().optional()
2418
2834
  })
2419
2835
  });
2420
- var RenameSubtreeRequestSchema = z22.object({
2421
- old_path: z22.string(),
2422
- new_path: z22.string(),
2423
- create_redirect: z22.boolean().optional()
2836
+ var RenameSubtreeRequestSchema = z23.object({
2837
+ old_path: z23.string(),
2838
+ new_path: z23.string(),
2839
+ create_redirect: z23.boolean().optional()
2424
2840
  });
2425
- var RenameSubtreeResponseSchema = z22.object({
2426
- renamed_count: z22.number()
2841
+ var RenameSubtreeResponseSchema = z23.object({
2842
+ renamed_count: z23.number()
2427
2843
  });
2428
- var PageNotFoundErrorSchema = z22.object({
2429
- error: z22.object({
2430
- code: z22.literal("PAGE_NOT_FOUND"),
2431
- message: z22.literal("Page not found")
2844
+ var PageNotFoundErrorSchema = z23.object({
2845
+ error: z23.object({
2846
+ code: z23.literal("PAGE_NOT_FOUND"),
2847
+ message: z23.literal("Page not found")
2432
2848
  })
2433
2849
  });
2434
- var PageNotGrantedErrorSchema = z22.object({
2435
- error: z22.object({
2436
- code: z22.literal("PAGE_NOT_GRANTED"),
2437
- message: z22.literal("Page is not granted for the user")
2850
+ var PageNotGrantedErrorSchema = z23.object({
2851
+ error: z23.object({
2852
+ code: z23.literal("PAGE_NOT_GRANTED"),
2853
+ message: z23.literal("Page is not granted for the user")
2438
2854
  })
2439
2855
  });
2440
- var PageRevisionErrorSchema = z22.object({
2441
- error: z22.object({
2442
- code: z22.literal("PAGE_REVISION_ERROR"),
2443
- message: z22.string()
2856
+ var PageRevisionErrorSchema = z23.object({
2857
+ error: z23.object({
2858
+ code: z23.literal("PAGE_REVISION_ERROR"),
2859
+ message: z23.string()
2444
2860
  })
2445
2861
  });
2446
- var SeenPageRequestSchema = z22.object({
2447
- page_id: z22.string()
2862
+ var SeenPageRequestSchema = z23.object({
2863
+ page_id: z23.string()
2448
2864
  });
2449
- var SeenUsersResponseSchema = z22.object({
2450
- seenUsers: z22.array(UserPublicSchema),
2451
- seenUsersCount: z22.number()
2865
+ var SeenUsersResponseSchema = z23.object({
2866
+ seenUsers: z23.array(UserPublicSchema),
2867
+ seenUsersCount: z23.number()
2452
2868
  });
2453
- var GetSeenUsersRequestSchema = z22.object({
2454
- page_id: z22.string(),
2869
+ var GetSeenUsersRequestSchema = z23.object({
2870
+ page_id: z23.string(),
2455
2871
  // Optional cap on returned `seenUsers`. `seenUsersCount` always reflects
2456
2872
  // the full count regardless of `limit`. Omit for the full list.
2457
- limit: z22.coerce.number().int().positive().optional()
2873
+ limit: z23.coerce.number().int().positive().optional()
2458
2874
  });
2459
- var GetWatchStatusRequestSchema = z22.object({
2460
- page_id: z22.string()
2875
+ var GetWatchStatusRequestSchema = z23.object({
2876
+ page_id: z23.string()
2461
2877
  });
2462
- var WatchStatusResponseSchema = z22.object({
2463
- watching: z22.boolean()
2878
+ var WatchStatusResponseSchema = z23.object({
2879
+ watching: z23.boolean()
2464
2880
  });
2465
- var SetWatchStatusRequestSchema = z22.object({
2466
- page_id: z22.string(),
2467
- watching: z22.boolean()
2881
+ var SetWatchStatusRequestSchema = z23.object({
2882
+ page_id: z23.string(),
2883
+ watching: z23.boolean()
2468
2884
  });
2469
2885
 
2470
2886
  // src/contracts/backlink.ts
@@ -2504,88 +2920,95 @@ var backlinkRoutes = {
2504
2920
  import { createRoute as createRoute13 } from "@hono/zod-openapi";
2505
2921
 
2506
2922
  // src/schemas/bookmark.ts
2507
- import { z as z23 } from "@hono/zod-openapi";
2508
- var BookmarkSchema = z23.object({
2509
- _id: z23.string(),
2923
+ import { z as z24 } from "@hono/zod-openapi";
2924
+ var BookmarkSchema = z24.object({
2925
+ _id: z24.string(),
2510
2926
  page: PageSchema,
2511
- user: z23.union([z23.string(), UserPublicSchema]),
2512
- createdAt: z23.string()
2927
+ user: z24.union([z24.string(), UserPublicSchema]),
2928
+ createdAt: z24.string()
2513
2929
  });
2514
- var GetBookmarkRequestSchema = z23.object({
2515
- page_id: z23.string()
2930
+ var GetBookmarkRequestSchema = z24.object({
2931
+ page_id: z24.string()
2516
2932
  });
2517
- var BookmarkResponseSchema = z23.object({
2933
+ var BookmarkResponseSchema = z24.object({
2518
2934
  bookmark: BookmarkSchema.nullable()
2519
2935
  });
2520
- var ListMyBookmarksResponseSchema = z23.object({
2521
- bookmarks: z23.array(BookmarkSchema),
2936
+ var ListMyBookmarksResponseSchema = z24.object({
2937
+ bookmarks: z24.array(BookmarkSchema),
2522
2938
  pager: PagerSchema,
2523
- total: z23.number()
2939
+ total: z24.number()
2524
2940
  });
2525
- var AddBookmarkRequestSchema = z23.object({
2526
- page_id: z23.string()
2941
+ var AddBookmarkRequestSchema = z24.object({
2942
+ page_id: z24.string()
2527
2943
  });
2528
- var RemoveBookmarkRequestSchema = z23.object({
2529
- page_id: z23.string()
2944
+ var RemoveBookmarkRequestSchema = z24.object({
2945
+ page_id: z24.string()
2530
2946
  });
2531
- var RemoveBookmarkResponseSchema = z23.object({
2532
- ok: z23.literal(true)
2947
+ var RemoveBookmarkResponseSchema = z24.object({
2948
+ ok: z24.literal(true)
2533
2949
  });
2534
2950
 
2535
2951
  // src/schemas/user.ts
2536
- import { z as z24 } from "@hono/zod-openapi";
2537
- var UserStatusSchema = z24.enum(["1", "2", "3", "4", "5"]).transform((val) => Number(val));
2952
+ import { z as z25 } from "@hono/zod-openapi";
2953
+ var UserStatusSchema = z25.enum(["1", "2", "3", "4", "5"]).transform((val) => Number(val));
2538
2954
  var UserStatusEnum = UserPublicStatus;
2539
- var UserLanguageSchema = z24.enum(["en", "ja"]);
2540
- var PaginationRequestSchema = z24.object({
2541
- limit: z24.coerce.number().optional().default(50),
2542
- offset: z24.coerce.number().optional().default(0)
2955
+ var UserLanguageSchema = z25.enum(["en", "ja"]);
2956
+ var PaginationRequestSchema = z25.object({
2957
+ limit: z25.coerce.number().optional().default(50),
2958
+ offset: z25.coerce.number().optional().default(0)
2543
2959
  });
2544
- var UserListItemSchema = z24.object({
2545
- _id: z24.string(),
2546
- username: z24.string(),
2547
- name: z24.string(),
2548
- image: z24.string().nullable().optional()
2960
+ var UserListItemSchema = z25.object({
2961
+ _id: z25.string(),
2962
+ username: z25.string(),
2963
+ name: z25.string(),
2964
+ image: z25.string().nullable().optional()
2549
2965
  });
2550
- var ListUsersRequestSchema = z24.object({
2551
- q: z24.string().optional(),
2966
+ var ListUsersRequestSchema = z25.object({
2967
+ q: z25.string().optional(),
2552
2968
  // Cap the page size so a client can't request the whole user table in one
2553
2969
  // unbounded find+sort (mirrors the page-list `limit` guard).
2554
- limit: z24.coerce.number().int().min(1).max(100).optional().default(24),
2555
- offset: z24.coerce.number().int().min(0).optional().default(0)
2970
+ limit: z25.coerce.number().int().min(1).max(100).optional().default(24),
2971
+ offset: z25.coerce.number().int().min(0).optional().default(0)
2556
2972
  });
2557
- var UserSubpagesRequestSchema = z24.object({
2558
- limit: z24.coerce.number().int().min(1).max(50).optional().default(30),
2559
- offset: z24.coerce.number().int().min(0).optional().default(0)
2973
+ var UserSubpagesRequestSchema = z25.object({
2974
+ limit: z25.coerce.number().int().min(1).max(50).optional().default(30),
2975
+ offset: z25.coerce.number().int().min(0).optional().default(0)
2560
2976
  });
2561
- var ListUsersResponseSchema = z24.object({
2562
- users: z24.array(UserListItemSchema),
2977
+ var ListUsersResponseSchema = z25.object({
2978
+ users: z25.array(UserListItemSchema),
2563
2979
  pager: PagerSchema,
2564
- total: z24.number()
2980
+ total: z25.number()
2565
2981
  });
2566
- var UserPageResponseSchema = z24.object({
2982
+ var UserPageResponseSchema = z25.object({
2567
2983
  user: UserPublicSchema,
2568
2984
  // Page statistics
2569
- createdPagesCount: z24.number(),
2570
- bookmarksCount: z24.number(),
2985
+ createdPagesCount: z25.number(),
2986
+ bookmarksCount: z25.number(),
2987
+ // feature-profile-stats-and-page-total — the target user's OWN actions:
2988
+ // pages they liked (`Page.liker` contains their id) and comments they
2989
+ // wrote (`Comment.creator` is their id). NOT activity their own pages
2990
+ // received from others, and not re-filtered by the viewer's grants —
2991
+ // see the spec's "プロフィール統計の主語と API 契約" section.
2992
+ likesCount: z25.number(),
2993
+ commentsCount: z25.number(),
2571
2994
  // Optionally include recent items for initial display
2572
- recentPages: z24.array(PageSchema).optional(),
2573
- recentBookmarks: z24.array(BookmarkSchema).optional()
2995
+ recentPages: z25.array(PageSchema).optional(),
2996
+ recentBookmarks: z25.array(BookmarkSchema).optional()
2574
2997
  });
2575
- var UserBookmarksResponseSchema = z24.object({
2576
- bookmarks: z24.array(BookmarkSchema),
2998
+ var UserBookmarksResponseSchema = z25.object({
2999
+ bookmarks: z25.array(BookmarkSchema),
2577
3000
  pager: PagerSchema,
2578
- total: z24.number()
3001
+ total: z25.number()
2579
3002
  });
2580
- var UserPagesResponseSchema = z24.object({
2581
- pages: z24.array(PageSchema),
3003
+ var UserPagesResponseSchema = z25.object({
3004
+ pages: z25.array(PageSchema),
2582
3005
  pager: PagerSchema,
2583
- total: z24.number()
3006
+ total: z25.number()
2584
3007
  });
2585
- var UserNotFoundErrorSchema = z24.object({
2586
- error: z24.object({
2587
- code: z24.literal("USER_NOT_FOUND"),
2588
- message: z24.literal("User not found")
3008
+ var UserNotFoundErrorSchema = z25.object({
3009
+ error: z25.object({
3010
+ code: z25.literal("USER_NOT_FOUND"),
3011
+ message: z25.literal("User not found")
2589
3012
  })
2590
3013
  });
2591
3014
 
@@ -2713,51 +3136,51 @@ var bookmarkRoutes = {
2713
3136
  import { createRoute as createRoute14 } from "@hono/zod-openapi";
2714
3137
 
2715
3138
  // src/schemas/comment.ts
2716
- import { z as z25 } from "@hono/zod-openapi";
2717
- var CommentSchema = z25.object({
2718
- _id: z25.string(),
2719
- page: z25.string(),
3139
+ import { z as z26 } from "@hono/zod-openapi";
3140
+ var CommentSchema = z26.object({
3141
+ _id: z26.string(),
3142
+ page: z26.string(),
2720
3143
  // creator is populated to a user object on the API side; allow string fallback for safety
2721
- creator: z25.union([z25.string(), PageUserSchema]).nullable(),
2722
- revision: z25.string(),
2723
- comment: z25.string(),
2724
- commentPosition: z25.number().default(-1),
2725
- createdAt: z25.string()
2726
- });
2727
- var ListCommentsRequestSchema = z25.object({
2728
- page_id: z25.string().optional(),
2729
- revision_id: z25.string().optional()
2730
- });
2731
- var ListCommentsResponseSchema = z25.object({
2732
- comments: z25.array(CommentSchema)
2733
- });
2734
- var AddCommentRequestSchema = z25.object({
2735
- page_id: z25.string().min(1, "page_id is required"),
2736
- revision_id: z25.string().min(1, "revision_id is required"),
2737
- comment: z25.string().min(1, "comment is required"),
2738
- comment_position: z25.number().int().optional()
2739
- });
2740
- var AddCommentResponseSchema = z25.object({
3144
+ creator: z26.union([z26.string(), PageUserSchema]).nullable(),
3145
+ revision: z26.string(),
3146
+ comment: z26.string(),
3147
+ commentPosition: z26.number().default(-1),
3148
+ createdAt: z26.string()
3149
+ });
3150
+ var ListCommentsRequestSchema = z26.object({
3151
+ page_id: z26.string().optional(),
3152
+ revision_id: z26.string().optional()
3153
+ });
3154
+ var ListCommentsResponseSchema = z26.object({
3155
+ comments: z26.array(CommentSchema)
3156
+ });
3157
+ var AddCommentRequestSchema = z26.object({
3158
+ page_id: z26.string().min(1, "page_id is required"),
3159
+ revision_id: z26.string().min(1, "revision_id is required"),
3160
+ comment: z26.string().min(1, "comment is required"),
3161
+ comment_position: z26.number().int().optional()
3162
+ });
3163
+ var AddCommentResponseSchema = z26.object({
2741
3164
  comment: CommentSchema,
2742
- newlyWatching: z25.boolean()
3165
+ newlyWatching: z26.boolean()
2743
3166
  });
2744
- var DeleteCommentRequestSchema = z25.object({
2745
- comment_id: z25.string().min(1, "comment_id is required"),
2746
- page_id: z25.string().min(1, "page_id is required")
3167
+ var DeleteCommentRequestSchema = z26.object({
3168
+ comment_id: z26.string().min(1, "comment_id is required"),
3169
+ page_id: z26.string().min(1, "page_id is required")
2747
3170
  });
2748
- var DeleteCommentResponseSchema = z25.object({
2749
- ok: z25.literal(true)
3171
+ var DeleteCommentResponseSchema = z26.object({
3172
+ ok: z26.literal(true)
2750
3173
  });
2751
- var CommentNotFoundErrorSchema = z25.object({
2752
- error: z25.object({
2753
- code: z25.literal("COMMENT_NOT_FOUND"),
2754
- message: z25.literal("Comment not found")
3174
+ var CommentNotFoundErrorSchema = z26.object({
3175
+ error: z26.object({
3176
+ code: z26.literal("COMMENT_NOT_FOUND"),
3177
+ message: z26.literal("Comment not found")
2755
3178
  })
2756
3179
  });
2757
- var CommentInvalidRequestErrorSchema = z25.object({
2758
- error: z25.object({
2759
- code: z25.literal("INVALID_REQUEST"),
2760
- message: z25.string()
3180
+ var CommentInvalidRequestErrorSchema = z26.object({
3181
+ error: z26.object({
3182
+ code: z26.literal("INVALID_REQUEST"),
3183
+ message: z26.string()
2761
3184
  })
2762
3185
  });
2763
3186
 
@@ -2861,48 +3284,48 @@ var commentRoutes = {
2861
3284
  };
2862
3285
 
2863
3286
  // src/contracts/draft.ts
2864
- import { createRoute as createRoute15, z as z27 } from "@hono/zod-openapi";
3287
+ import { createRoute as createRoute15, z as z28 } from "@hono/zod-openapi";
2865
3288
 
2866
3289
  // src/schemas/draft.ts
2867
- import { z as z26 } from "@hono/zod-openapi";
2868
- var CreateDraftRequestSchema = z26.object({
2869
- path: z26.string().min(1),
2870
- initialBody: z26.string().optional()
3290
+ import { z as z27 } from "@hono/zod-openapi";
3291
+ var CreateDraftRequestSchema = z27.object({
3292
+ path: z27.string().min(1),
3293
+ initialBody: z27.string().optional()
2871
3294
  });
2872
- var CreateDraftResponseSchema = z26.object({
2873
- pageId: z26.string()
3295
+ var CreateDraftResponseSchema = z27.object({
3296
+ pageId: z27.string()
2874
3297
  });
2875
- var DraftConflictOwnerSchema = z26.object({
2876
- id: z26.string(),
2877
- username: z26.string(),
2878
- displayName: z26.string()
3298
+ var DraftConflictOwnerSchema = z27.object({
3299
+ id: z27.string(),
3300
+ username: z27.string(),
3301
+ displayName: z27.string()
2879
3302
  });
2880
- var DraftPathConflictErrorSchema = z26.object({
2881
- error: z26.literal("path_taken_by_draft"),
3303
+ var DraftPathConflictErrorSchema = z27.object({
3304
+ error: z27.literal("path_taken_by_draft"),
2882
3305
  owner: DraftConflictOwnerSchema,
2883
- message: z26.string()
3306
+ message: z27.string()
2884
3307
  });
2885
- var DraftBadRequestErrorSchema = z26.object({
2886
- error: z26.enum(["invalid_path", "path_taken"]),
2887
- message: z26.string()
3308
+ var DraftBadRequestErrorSchema = z27.object({
3309
+ error: z27.enum(["invalid_path", "path_taken"]),
3310
+ message: z27.string()
2888
3311
  });
2889
- var DraftNotFoundErrorSchema = z26.object({
2890
- error: z26.literal("draft_not_found"),
2891
- message: z26.string()
3312
+ var DraftNotFoundErrorSchema = z27.object({
3313
+ error: z27.literal("draft_not_found"),
3314
+ message: z27.string()
2892
3315
  });
2893
- var DraftSummarySchema = z26.object({
2894
- pageId: z26.string(),
2895
- path: z26.string(),
2896
- createdAt: z26.string(),
2897
- updatedAt: z26.string()
3316
+ var DraftSummarySchema = z27.object({
3317
+ pageId: z27.string(),
3318
+ path: z27.string(),
3319
+ createdAt: z27.string(),
3320
+ updatedAt: z27.string()
2898
3321
  });
2899
- var ListDraftsResponseSchema = z26.object({
2900
- drafts: z26.array(DraftSummarySchema)
3322
+ var ListDraftsResponseSchema = z27.object({
3323
+ drafts: z27.array(DraftSummarySchema)
2901
3324
  });
2902
3325
 
2903
3326
  // src/contracts/draft.ts
2904
- var DraftIdPathParamsSchema = z27.object({
2905
- id: z27.string().openapi({ description: "Draft page id (24-char hex ObjectId)", example: "507f1f77bcf86cd799439011" })
3327
+ var DraftIdPathParamsSchema = z28.object({
3328
+ id: z28.string().openapi({ description: "Draft page id (24-char hex ObjectId)", example: "507f1f77bcf86cd799439011" })
2906
3329
  });
2907
3330
  var createDraftRoute = createRoute15({
2908
3331
  method: "post",
@@ -2985,22 +3408,28 @@ var draftRoutes = {
2985
3408
  import { createRoute as createRoute16 } from "@hono/zod-openapi";
2986
3409
 
2987
3410
  // src/schemas/installer.ts
2988
- import { z as z28 } from "@hono/zod-openapi";
2989
- var InstallerStatusResponseSchema = z28.object({
2990
- status: z28.enum(["installer_required", "already_installed"])
2991
- });
2992
- var CreateAdminRequestSchema = z28.object({
2993
- registerForm: z28.object({
2994
- username: z28.string().min(1).regex(/^[\da-zA-Z\-_.]+$/, "username may only contain letters, digits, hyphens, underscores, and dots"),
2995
- name: z28.string().min(1),
2996
- email: z28.string().email(),
2997
- password: z28.string().min(6).regex(/^[\x20-\x7F]{6,}$/, "password must be 6+ printable ASCII characters")
3411
+ import { z as z30 } from "@hono/zod-openapi";
3412
+
3413
+ // src/schemas/username.ts
3414
+ import { z as z29 } from "@hono/zod-openapi";
3415
+ var UsernameSchema = z29.string().min(1).max(64).regex(/^[A-Za-z0-9_-]+$/, "username may only contain letters, digits, hyphens, and underscores");
3416
+
3417
+ // src/schemas/installer.ts
3418
+ var InstallerStatusResponseSchema = z30.object({
3419
+ status: z30.enum(["installer_required", "already_installed"])
3420
+ });
3421
+ var CreateAdminRequestSchema = z30.object({
3422
+ registerForm: z30.object({
3423
+ username: UsernameSchema,
3424
+ name: z30.string().min(1),
3425
+ email: z30.string().email(),
3426
+ password: z30.string().min(6).regex(/^[\x20-\x7F]{6,}$/, "password must be 6+ printable ASCII characters")
2998
3427
  })
2999
3428
  });
3000
- var CreateAdminResponseSchema = z28.object({
3001
- status: z28.enum(["ok", "error"]),
3002
- message: z28.string().optional(),
3003
- errors: z28.array(z28.string()).optional()
3429
+ var CreateAdminResponseSchema = z30.object({
3430
+ status: z30.enum(["ok", "error"]),
3431
+ message: z30.string().optional(),
3432
+ errors: z30.array(z30.string()).optional()
3004
3433
  });
3005
3434
 
3006
3435
  // src/contracts/installer.ts
@@ -3072,84 +3501,84 @@ var createAdminRoute = createRoute16({
3072
3501
  var installerRoutes = { getInstallerStatusRoute, createAdminRoute };
3073
3502
 
3074
3503
  // src/contracts/me.ts
3075
- import { createRoute as createRoute17, z as z30 } from "@hono/zod-openapi";
3504
+ import { createRoute as createRoute17, z as z32 } from "@hono/zod-openapi";
3076
3505
 
3077
3506
  // src/schemas/me.ts
3078
- import { z as z29 } from "@hono/zod-openapi";
3079
- var LanguageSchema = z29.enum(["en", "ja"]);
3080
- var ThemeSchema = z29.enum(["system", "light", "dark"]);
3081
- var UserProfileResponseSchema = z29.object({
3082
- id: z29.string(),
3083
- username: z29.string(),
3084
- name: z29.string(),
3085
- email: z29.string().email(),
3507
+ import { z as z31 } from "@hono/zod-openapi";
3508
+ var LanguageSchema = z31.enum(["en", "ja"]);
3509
+ var ThemeSchema = z31.enum(["system", "light", "dark"]);
3510
+ var UserProfileResponseSchema = z31.object({
3511
+ id: z31.string(),
3512
+ username: z31.string(),
3513
+ name: z31.string(),
3514
+ email: z31.string().email(),
3086
3515
  lang: LanguageSchema,
3087
3516
  theme: ThemeSchema,
3088
- image: z29.string().nullable(),
3089
- introduction: z29.string().optional(),
3090
- hasPassword: z29.boolean(),
3091
- createdAt: z29.string(),
3517
+ image: z31.string().nullable(),
3518
+ introduction: z31.string().optional(),
3519
+ hasPassword: z31.boolean(),
3520
+ createdAt: z31.string(),
3092
3521
  /**
3093
3522
  * True when the profile update requested a new email that is awaiting
3094
3523
  * confirmation: the stored `email` is unchanged and a confirmation
3095
3524
  * link was sent to the new address.
3096
3525
  */
3097
- emailChangePending: z29.boolean().optional()
3526
+ emailChangePending: z31.boolean().optional()
3098
3527
  });
3099
- var UpdateProfileRequestSchema = z29.object({
3100
- userForm: z29.object({
3101
- name: z29.string().min(1, "Name is required"),
3102
- email: z29.string().email("Invalid email format"),
3528
+ var UpdateProfileRequestSchema = z31.object({
3529
+ userForm: z31.object({
3530
+ name: z31.string().min(1, "Name is required"),
3531
+ email: z31.string().email("Invalid email format"),
3103
3532
  lang: LanguageSchema
3104
3533
  })
3105
3534
  });
3106
- var UpdateThemeRequestSchema = z29.object({
3535
+ var UpdateThemeRequestSchema = z31.object({
3107
3536
  theme: ThemeSchema
3108
3537
  });
3109
- var ThemeUpdateResponseSchema = z29.object({
3110
- status: z29.literal("ok"),
3538
+ var ThemeUpdateResponseSchema = z31.object({
3539
+ status: z31.literal("ok"),
3111
3540
  theme: ThemeSchema
3112
3541
  });
3113
- var PictureUploadResponseSchema = z29.object({
3114
- status: z29.boolean(),
3115
- url: z29.string().optional(),
3116
- message: z29.string().optional()
3542
+ var PictureUploadResponseSchema = z31.object({
3543
+ status: z31.boolean(),
3544
+ url: z31.string().optional(),
3545
+ message: z31.string().optional()
3117
3546
  });
3118
- var SuccessResponseSchema = z29.object({
3119
- status: z29.literal("ok"),
3120
- message: z29.string().optional()
3547
+ var SuccessResponseSchema = z31.object({
3548
+ status: z31.literal("ok"),
3549
+ message: z31.string().optional()
3121
3550
  });
3122
- var ProfileErrorResponseSchema = z29.object({
3123
- status: z29.literal("error"),
3551
+ var ProfileErrorResponseSchema = z31.object({
3552
+ status: z31.literal("error"),
3124
3553
  /** Stable code so the web can localize the message (e.g. EMAIL_TAKEN). */
3125
- code: z29.string().optional(),
3126
- message: z29.string().optional(),
3127
- errors: z29.array(z29.string()).optional()
3554
+ code: z31.string().optional(),
3555
+ message: z31.string().optional(),
3556
+ errors: z31.array(z31.string()).optional()
3128
3557
  });
3129
3558
  var PASSWORD_REGEX = /^(?=.*[a-zA-Z])(?=.*\d)(?=.*[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?`~])[a-zA-Z\d!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?`~]+$/;
3130
- var UpdatePasswordRequestSchema = z29.object({
3131
- oldPassword: z29.string().optional(),
3132
- newPassword: z29.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"),
3133
- newPasswordConfirm: z29.string()
3559
+ var UpdatePasswordRequestSchema = z31.object({
3560
+ oldPassword: z31.string().optional(),
3561
+ newPassword: z31.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"),
3562
+ newPasswordConfirm: z31.string()
3134
3563
  }).refine((data) => data.newPassword === data.newPasswordConfirm, {
3135
3564
  message: "Passwords do not match",
3136
3565
  path: ["newPasswordConfirm"]
3137
3566
  });
3138
- var PasswordUpdateSuccessSchema = z29.object({
3139
- status: z29.literal("ok"),
3140
- message: z29.string(),
3141
- accessToken: z29.string(),
3142
- refreshToken: z29.string(),
3567
+ var PasswordUpdateSuccessSchema = z31.object({
3568
+ status: z31.literal("ok"),
3569
+ message: z31.string(),
3570
+ accessToken: z31.string(),
3571
+ refreshToken: z31.string(),
3143
3572
  /** Access-token lifetime in seconds. */
3144
- expiresIn: z29.number()
3573
+ expiresIn: z31.number()
3145
3574
  });
3146
- var PasswordErrorResponseSchema = z29.object({
3147
- status: z29.literal("error"),
3148
- message: z29.string(),
3149
- errors: z29.array(z29.string()).optional()
3575
+ var PasswordErrorResponseSchema = z31.object({
3576
+ status: z31.literal("error"),
3577
+ message: z31.string(),
3578
+ errors: z31.array(z31.string()).optional()
3150
3579
  });
3151
- var RecentlyViewedPagesResponseSchema = z29.object({
3152
- pages: z29.array(PageSchema)
3580
+ var RecentlyViewedPagesResponseSchema = z31.object({
3581
+ pages: z31.array(PageSchema)
3153
3582
  });
3154
3583
 
3155
3584
  // src/contracts/me.ts
@@ -3232,8 +3661,8 @@ var uploadPictureRoute = createRoute17({
3232
3661
  body: {
3233
3662
  content: {
3234
3663
  "multipart/form-data": {
3235
- schema: z30.object({
3236
- file: z30.any().optional().describe("Profile picture file")
3664
+ schema: z32.object({
3665
+ file: z32.any().optional().describe("Profile picture file")
3237
3666
  })
3238
3667
  }
3239
3668
  }
@@ -3333,37 +3762,37 @@ var meRoutes = {
3333
3762
  };
3334
3763
 
3335
3764
  // src/contracts/access-token.ts
3336
- import { createRoute as createRoute18, z as z32 } from "@hono/zod-openapi";
3765
+ import { createRoute as createRoute18, z as z34 } from "@hono/zod-openapi";
3337
3766
 
3338
3767
  // src/schemas/access-token.ts
3339
- import { z as z31 } from "@hono/zod-openapi";
3340
- var AccessTokenSchema = z31.object({
3341
- id: z31.string(),
3342
- name: z31.string(),
3343
- scopes: z31.array(z31.string()),
3768
+ import { z as z33 } from "@hono/zod-openapi";
3769
+ var AccessTokenSchema = z33.object({
3770
+ id: z33.string(),
3771
+ name: z33.string(),
3772
+ scopes: z33.array(z33.string()),
3344
3773
  /** ISO-8601 expiry, or `null` for a non-expiring token. */
3345
- expiresAt: z31.string().nullable(),
3774
+ expiresAt: z33.string().nullable(),
3346
3775
  /** ISO-8601 of last successful use, or `null` if never used. */
3347
- lastUsedAt: z31.string().nullable(),
3348
- createdAt: z31.string()
3776
+ lastUsedAt: z33.string().nullable(),
3777
+ createdAt: z33.string()
3349
3778
  });
3350
- var ListAccessTokensResponseSchema = z31.object({
3351
- accessTokens: z31.array(AccessTokenSchema)
3779
+ var ListAccessTokensResponseSchema = z33.object({
3780
+ accessTokens: z33.array(AccessTokenSchema)
3352
3781
  });
3353
- var CreateAccessTokenRequestSchema = z31.object({
3354
- name: z31.string().min(1, "Name is required").max(200),
3355
- scopes: z31.array(z31.string()).min(1, "At least one scope is required"),
3356
- expiresAt: z31.string().datetime().nullable().optional()
3782
+ var CreateAccessTokenRequestSchema = z33.object({
3783
+ name: z33.string().min(1, "Name is required").max(200),
3784
+ scopes: z33.array(z33.string()).min(1, "At least one scope is required"),
3785
+ expiresAt: z33.string().datetime().nullable().optional()
3357
3786
  });
3358
3787
  var CreateAccessTokenResponseSchema = AccessTokenSchema.extend({
3359
- token: z31.string()
3360
- });
3361
- var InvalidScopeErrorSchema = z31.object({
3362
- error: z31.object({
3363
- code: z31.literal("INVALID_SCOPE"),
3364
- message: z31.string(),
3365
- details: z31.object({
3366
- invalidScopes: z31.array(z31.string())
3788
+ token: z33.string()
3789
+ });
3790
+ var InvalidScopeErrorSchema = z33.object({
3791
+ error: z33.object({
3792
+ code: z33.literal("INVALID_SCOPE"),
3793
+ message: z33.string(),
3794
+ details: z33.object({
3795
+ invalidScopes: z33.array(z33.string())
3367
3796
  }).optional()
3368
3797
  })
3369
3798
  });
@@ -3435,7 +3864,7 @@ var deleteAccessTokenRoute = createRoute18({
3435
3864
  security: [{ bearerAuth: [] }],
3436
3865
  summary: "Revoke a personal access token",
3437
3866
  request: {
3438
- params: z32.object({ id: z32.string() })
3867
+ params: z34.object({ id: z34.string() })
3439
3868
  },
3440
3869
  responses: {
3441
3870
  200: {
@@ -3467,13 +3896,13 @@ var accessTokenRoutes = {
3467
3896
  };
3468
3897
 
3469
3898
  // src/contracts/oauth.ts
3470
- import { createRoute as createRoute19, z as z35 } from "@hono/zod-openapi";
3899
+ import { createRoute as createRoute19, z as z37 } from "@hono/zod-openapi";
3471
3900
 
3472
3901
  // src/schemas/oauth-endpoints.ts
3473
- import { z as z34 } from "@hono/zod-openapi";
3902
+ import { z as z36 } from "@hono/zod-openapi";
3474
3903
 
3475
3904
  // src/schemas/oauth.ts
3476
- import { z as z33 } from "@hono/zod-openapi";
3905
+ import { z as z35 } from "@hono/zod-openapi";
3477
3906
  var SCOPES = [
3478
3907
  // umbrella
3479
3908
  "read",
@@ -3541,11 +3970,11 @@ function scopeSatisfies(required, granted) {
3541
3970
  return false;
3542
3971
  }
3543
3972
  var InsufficientScopeErrorSchema = ApiErrorSchema.extend({
3544
- error: z33.object({
3545
- code: z33.literal("INSUFFICIENT_SCOPE"),
3546
- message: z33.string(),
3547
- details: z33.object({
3548
- requiredScope: z33.string()
3973
+ error: z35.object({
3974
+ code: z35.literal("INSUFFICIENT_SCOPE"),
3975
+ message: z35.string(),
3976
+ details: z35.object({
3977
+ requiredScope: z35.string()
3549
3978
  }).optional()
3550
3979
  })
3551
3980
  });
@@ -3564,97 +3993,97 @@ var OAUTH_ERROR_CODES = [
3564
3993
  "slow_down",
3565
3994
  "expired_token"
3566
3995
  ];
3567
- var OAuthErrorSchema = z34.object({
3568
- error: z34.enum(OAUTH_ERROR_CODES),
3569
- error_description: z34.string().optional()
3570
- });
3571
- var AuthorizeRequestSchema = z34.object({
3572
- client_id: z34.string().min(1),
3573
- redirect_uri: z34.string().min(1),
3574
- scope: z34.string().min(1),
3575
- code_challenge: z34.string().min(1),
3576
- code_challenge_method: z34.literal("S256"),
3577
- state: z34.string().optional()
3578
- });
3579
- var AuthorizeResponseSchema = z34.object({
3580
- redirectUri: z34.string()
3581
- });
3582
- var TokenRequestSchema = z34.discriminatedUnion("grant_type", [
3583
- z34.object({
3584
- grant_type: z34.literal("authorization_code"),
3585
- code: z34.string().min(1),
3586
- code_verifier: z34.string().min(1),
3587
- redirect_uri: z34.string().min(1),
3588
- client_id: z34.string().min(1)
3996
+ var OAuthErrorSchema = z36.object({
3997
+ error: z36.enum(OAUTH_ERROR_CODES),
3998
+ error_description: z36.string().optional()
3999
+ });
4000
+ var AuthorizeRequestSchema = z36.object({
4001
+ client_id: z36.string().min(1),
4002
+ redirect_uri: z36.string().min(1),
4003
+ scope: z36.string().min(1),
4004
+ code_challenge: z36.string().min(1),
4005
+ code_challenge_method: z36.literal("S256"),
4006
+ state: z36.string().optional()
4007
+ });
4008
+ var AuthorizeResponseSchema = z36.object({
4009
+ redirectUri: z36.string()
4010
+ });
4011
+ var TokenRequestSchema = z36.discriminatedUnion("grant_type", [
4012
+ z36.object({
4013
+ grant_type: z36.literal("authorization_code"),
4014
+ code: z36.string().min(1),
4015
+ code_verifier: z36.string().min(1),
4016
+ redirect_uri: z36.string().min(1),
4017
+ client_id: z36.string().min(1)
3589
4018
  }),
3590
- z34.object({
3591
- grant_type: z34.literal("refresh_token"),
3592
- refresh_token: z34.string().min(1),
3593
- client_id: z34.string().min(1),
3594
- scope: z34.string().optional()
4019
+ z36.object({
4020
+ grant_type: z36.literal("refresh_token"),
4021
+ refresh_token: z36.string().min(1),
4022
+ client_id: z36.string().min(1),
4023
+ scope: z36.string().optional()
3595
4024
  }),
3596
4025
  // RFC 8628 §3.4 — device authorization grant. The client polls with the
3597
4026
  // opaque `device_code` returned by `/oauth/device/authorize`.
3598
- z34.object({
3599
- grant_type: z34.literal("urn:ietf:params:oauth:grant-type:device_code"),
3600
- device_code: z34.string().min(1),
3601
- client_id: z34.string().min(1)
4027
+ z36.object({
4028
+ grant_type: z36.literal("urn:ietf:params:oauth:grant-type:device_code"),
4029
+ device_code: z36.string().min(1),
4030
+ client_id: z36.string().min(1)
3602
4031
  })
3603
4032
  ]);
3604
4033
  var DEVICE_CODE_GRANT_TYPE = "urn:ietf:params:oauth:grant-type:device_code";
3605
- var TokenResponseSchema = z34.object({
3606
- access_token: z34.string(),
3607
- token_type: z34.literal("Bearer"),
3608
- expires_in: z34.number(),
3609
- refresh_token: z34.string(),
3610
- scope: z34.string()
3611
- });
3612
- var RevokeRequestSchema = z34.object({
3613
- token: z34.string().min(1),
3614
- token_type_hint: z34.string().optional()
3615
- });
3616
- var RevokeResponseSchema = z34.object({});
3617
- var DeviceAuthorizeRequestSchema = z34.object({
3618
- client_id: z34.string().min(1),
3619
- scope: z34.string().min(1)
3620
- });
3621
- var DeviceAuthorizeResponseSchema = z34.object({
3622
- device_code: z34.string(),
3623
- user_code: z34.string(),
3624
- verification_uri: z34.string(),
3625
- verification_uri_complete: z34.string(),
3626
- expires_in: z34.number(),
3627
- interval: z34.number()
3628
- });
3629
- var DeviceVerifyRequestSchema = z34.object({
3630
- user_code: z34.string().min(1),
3631
- action: z34.enum(["approve", "deny"])
3632
- });
3633
- var DeviceVerifyResponseSchema = z34.object({
3634
- status: z34.enum(["approved", "denied"])
3635
- });
3636
- var DeviceInfoResponseSchema = z34.object({
3637
- client_id: z34.string(),
3638
- scopes: z34.array(z34.string())
3639
- });
3640
- var ClientInfoResponseSchema = z34.object({
3641
- clientId: z34.string(),
3642
- name: z34.string(),
3643
- firstParty: z34.boolean(),
3644
- trusted: z34.boolean()
4034
+ var TokenResponseSchema = z36.object({
4035
+ access_token: z36.string(),
4036
+ token_type: z36.literal("Bearer"),
4037
+ expires_in: z36.number(),
4038
+ refresh_token: z36.string(),
4039
+ scope: z36.string()
4040
+ });
4041
+ var RevokeRequestSchema = z36.object({
4042
+ token: z36.string().min(1),
4043
+ token_type_hint: z36.string().optional()
4044
+ });
4045
+ var RevokeResponseSchema = z36.object({});
4046
+ var DeviceAuthorizeRequestSchema = z36.object({
4047
+ client_id: z36.string().min(1),
4048
+ scope: z36.string().min(1)
4049
+ });
4050
+ var DeviceAuthorizeResponseSchema = z36.object({
4051
+ device_code: z36.string(),
4052
+ user_code: z36.string(),
4053
+ verification_uri: z36.string(),
4054
+ verification_uri_complete: z36.string(),
4055
+ expires_in: z36.number(),
4056
+ interval: z36.number()
4057
+ });
4058
+ var DeviceVerifyRequestSchema = z36.object({
4059
+ user_code: z36.string().min(1),
4060
+ action: z36.enum(["approve", "deny"])
4061
+ });
4062
+ var DeviceVerifyResponseSchema = z36.object({
4063
+ status: z36.enum(["approved", "denied"])
4064
+ });
4065
+ var DeviceInfoResponseSchema = z36.object({
4066
+ client_id: z36.string(),
4067
+ scopes: z36.array(z36.string())
4068
+ });
4069
+ var ClientInfoResponseSchema = z36.object({
4070
+ clientId: z36.string(),
4071
+ name: z36.string(),
4072
+ firstParty: z36.boolean(),
4073
+ trusted: z36.boolean()
3645
4074
  });
3646
4075
  var GRANT_TYPES_SUPPORTED = ["authorization_code", "refresh_token", DEVICE_CODE_GRANT_TYPE];
3647
- var DiscoveryResponseSchema = z34.object({
3648
- issuer: z34.string(),
3649
- authorization_endpoint: z34.string(),
3650
- token_endpoint: z34.string(),
3651
- revocation_endpoint: z34.string(),
3652
- device_authorization_endpoint: z34.string().optional(),
3653
- scopes_supported: z34.array(z34.string()),
3654
- response_types_supported: z34.array(z34.string()),
3655
- grant_types_supported: z34.array(z34.string()),
3656
- code_challenge_methods_supported: z34.array(z34.string()),
3657
- token_endpoint_auth_methods_supported: z34.array(z34.string())
4076
+ var DiscoveryResponseSchema = z36.object({
4077
+ issuer: z36.string(),
4078
+ authorization_endpoint: z36.string(),
4079
+ token_endpoint: z36.string(),
4080
+ revocation_endpoint: z36.string(),
4081
+ device_authorization_endpoint: z36.string().optional(),
4082
+ scopes_supported: z36.array(z36.string()),
4083
+ response_types_supported: z36.array(z36.string()),
4084
+ grant_types_supported: z36.array(z36.string()),
4085
+ code_challenge_methods_supported: z36.array(z36.string()),
4086
+ token_endpoint_auth_methods_supported: z36.array(z36.string())
3658
4087
  });
3659
4088
  var DISCOVERY_SCOPES_SUPPORTED = ISSUABLE_SCOPES;
3660
4089
 
@@ -3790,7 +4219,7 @@ var deviceInfoRoute = createRoute19({
3790
4219
  // scopes so the web consent screen can show them before approval. Reveals
3791
4220
  // no secret. Unknown / expired / non-pending → 404 (PHASE4-Q9 option A).
3792
4221
  request: {
3793
- query: z35.object({ user_code: z35.string().min(1) })
4222
+ query: z37.object({ user_code: z37.string().min(1) })
3794
4223
  },
3795
4224
  responses: {
3796
4225
  200: {
@@ -3844,7 +4273,7 @@ var clientInfoRoute = createRoute19({
3844
4273
  // no redirectUris/allowedScopes — mirroring deviceInfoRoute's own
3845
4274
  // non-secret-lookup shape. Unknown client_id → 404.
3846
4275
  request: {
3847
- query: z35.object({ client_id: z35.string().min(1) })
4276
+ query: z37.object({ client_id: z37.string().min(1) })
3848
4277
  },
3849
4278
  responses: {
3850
4279
  200: {
@@ -3869,24 +4298,24 @@ var oauthRoutes = {
3869
4298
  };
3870
4299
 
3871
4300
  // src/contracts/notification.ts
3872
- import { createRoute as createRoute20, z as z37 } from "@hono/zod-openapi";
4301
+ import { createRoute as createRoute20, z as z39 } from "@hono/zod-openapi";
3873
4302
 
3874
4303
  // src/schemas/notification.ts
3875
- import { z as z36 } from "@hono/zod-openapi";
3876
- var NotificationStatusSchema = z36.enum(["UNREAD", "UNOPENED", "OPENED"]);
4304
+ import { z as z38 } from "@hono/zod-openapi";
4305
+ var NotificationStatusSchema = z38.enum(["UNREAD", "UNOPENED", "OPENED"]);
3877
4306
  var NotificationStatusEnum = {
3878
4307
  UNREAD: "UNREAD",
3879
4308
  UNOPENED: "UNOPENED",
3880
4309
  OPENED: "OPENED"
3881
4310
  };
3882
- var NotificationActionSchema = z36.enum(["COMMENT", "LIKE", "MENTION", "UPDATE"]);
4311
+ var NotificationActionSchema = z38.enum(["COMMENT", "LIKE", "MENTION", "UPDATE"]);
3883
4312
  var NotificationActionEnum = {
3884
4313
  COMMENT: "COMMENT",
3885
4314
  LIKE: "LIKE",
3886
4315
  MENTION: "MENTION",
3887
4316
  UPDATE: "UPDATE"
3888
4317
  };
3889
- var NotificationTargetModelSchema = z36.enum(["Page"]);
4318
+ var NotificationTargetModelSchema = z38.enum(["Page"]);
3890
4319
  var NotificationTargetModelEnum = {
3891
4320
  PAGE: "Page"
3892
4321
  };
@@ -3895,68 +4324,68 @@ var PageRefSchema = PageSchema.pick({
3895
4324
  path: true,
3896
4325
  status: true
3897
4326
  });
3898
- var NotificationSchema = z36.object({
3899
- _id: z36.string(),
3900
- user: z36.string(),
4327
+ var NotificationSchema = z38.object({
4328
+ _id: z38.string(),
4329
+ user: z38.string(),
3901
4330
  targetModel: NotificationTargetModelSchema,
3902
4331
  target: PageRefSchema,
3903
4332
  action: NotificationActionSchema,
3904
4333
  status: NotificationStatusSchema,
3905
- actionUsers: z36.array(UserPublicSchema),
3906
- createdAt: z36.string()
4334
+ actionUsers: z38.array(UserPublicSchema),
4335
+ createdAt: z38.string()
3907
4336
  });
3908
- var ListNotificationsRequestSchema = z36.object({
3909
- limit: z36.coerce.number().optional().default(10),
3910
- offset: z36.coerce.number().optional().default(0)
4337
+ var ListNotificationsRequestSchema = z38.object({
4338
+ limit: z38.coerce.number().optional().default(10),
4339
+ offset: z38.coerce.number().optional().default(0)
3911
4340
  });
3912
- var ListNotificationsResponseSchema = z36.object({
3913
- notifications: z36.array(NotificationSchema),
4341
+ var ListNotificationsResponseSchema = z38.object({
4342
+ notifications: z38.array(NotificationSchema),
3914
4343
  pager: PagerSchema
3915
4344
  });
3916
- var MarkAllAsReadResponseSchema = z36.object({
3917
- ok: z36.literal(true)
4345
+ var MarkAllAsReadResponseSchema = z38.object({
4346
+ ok: z38.literal(true)
3918
4347
  });
3919
- var OpenNotificationParamSchema = z36.object({
3920
- id: z36.string()
4348
+ var OpenNotificationParamSchema = z38.object({
4349
+ id: z38.string()
3921
4350
  });
3922
- var OpenNotificationResponseSchema = z36.object({
4351
+ var OpenNotificationResponseSchema = z38.object({
3923
4352
  notification: NotificationSchema
3924
4353
  });
3925
- var NotificationStatusResponseSchema = z36.object({
3926
- count: z36.number()
4354
+ var NotificationStatusResponseSchema = z38.object({
4355
+ count: z38.number()
3927
4356
  });
3928
- var NotificationNotFoundErrorSchema = z36.object({
3929
- error: z36.object({
3930
- code: z36.literal("NOTIFICATION_NOT_FOUND"),
3931
- message: z36.literal("Notification not found")
4357
+ var NotificationNotFoundErrorSchema = z38.object({
4358
+ error: z38.object({
4359
+ code: z38.literal("NOTIFICATION_NOT_FOUND"),
4360
+ message: z38.literal("Notification not found")
3932
4361
  })
3933
4362
  });
3934
- var NotificationsTokenResponseSchema = z36.object({
3935
- token: z36.string(),
3936
- selfUserId: z36.string(),
3937
- expiresAt: z36.string()
4363
+ var NotificationsTokenResponseSchema = z38.object({
4364
+ token: z38.string(),
4365
+ selfUserId: z38.string(),
4366
+ expiresAt: z38.string()
3938
4367
  });
3939
- var NotificationsTokenPayloadSchema = z36.object({
3940
- selfUserId: z36.string(),
4368
+ var NotificationsTokenPayloadSchema = z38.object({
4369
+ selfUserId: z38.string(),
3941
4370
  // Random UUID mixed into every signed token so two tokens minted
3942
4371
  // within the same second still produce byte-different JWT strings.
3943
4372
  // The browser uses the token as a React effect dependency to drive
3944
4373
  // the WebSocket reconnect — without `jti`, the iat/exp pair is
3945
4374
  // identical at second granularity and the dep stays stable.
3946
- jti: z36.string().uuid(),
3947
- iat: z36.number().int(),
3948
- exp: z36.number().int()
4375
+ jti: z38.string().uuid(),
4376
+ iat: z38.number().int(),
4377
+ exp: z38.number().int()
3949
4378
  });
3950
- var NotificationsChangedMessageSchema = z36.object({
3951
- type: z36.literal("changed")
4379
+ var NotificationsChangedMessageSchema = z38.object({
4380
+ type: z38.literal("changed")
3952
4381
  });
3953
4382
  var NotificationsServerMessageSchema = NotificationsChangedMessageSchema;
3954
4383
 
3955
4384
  // src/contracts/notification.ts
3956
- var NotificationInvalidRequestErrorSchema = z37.object({
3957
- error: z37.object({
3958
- code: z37.literal("INVALID_REQUEST"),
3959
- message: z37.string()
4385
+ var NotificationInvalidRequestErrorSchema = z39.object({
4386
+ error: z39.object({
4387
+ code: z39.literal("INVALID_REQUEST"),
4388
+ message: z39.string()
3960
4389
  })
3961
4390
  });
3962
4391
  var listNotificationsRoute = createRoute20({
@@ -4092,9 +4521,9 @@ var notificationRoutes = {
4092
4521
  };
4093
4522
 
4094
4523
  // src/contracts/page-collab.ts
4095
- import { createRoute as createRoute21, z as z38 } from "@hono/zod-openapi";
4096
- var PageIdPathParamsSchema2 = z38.object({
4097
- id: z38.string().openapi({ description: "Page id (24-char hex ObjectId)", example: "507f1f77bcf86cd799439011" })
4524
+ import { createRoute as createRoute21, z as z40 } from "@hono/zod-openapi";
4525
+ var PageIdPathParamsSchema2 = z40.object({
4526
+ id: z40.string().openapi({ description: "Page id (24-char hex ObjectId)", example: "507f1f77bcf86cd799439011" })
4098
4527
  });
4099
4528
  var getYjsTokenRoute = createRoute21({
4100
4529
  method: "get",
@@ -4133,25 +4562,25 @@ var pageCollabRoutes = {
4133
4562
  };
4134
4563
 
4135
4564
  // src/contracts/page.ts
4136
- import { createRoute as createRoute22, z as z39 } from "@hono/zod-openapi";
4137
- var PageBadRequestErrorSchema = z39.object({
4138
- error: z39.object({
4139
- code: z39.string(),
4140
- message: z39.string()
4565
+ import { createRoute as createRoute22, z as z41 } from "@hono/zod-openapi";
4566
+ var PageBadRequestErrorSchema = z41.object({
4567
+ error: z41.object({
4568
+ code: z41.string(),
4569
+ message: z41.string()
4141
4570
  })
4142
4571
  });
4143
- var DeletePageRequestSchema = z39.object({
4144
- page_id: z39.string(),
4145
- revision_id: z39.string().optional(),
4146
- completely: z39.boolean().optional()
4572
+ var DeletePageRequestSchema = z41.object({
4573
+ page_id: z41.string(),
4574
+ revision_id: z41.string().optional(),
4575
+ completely: z41.boolean().optional()
4147
4576
  });
4148
- var RevertDeletedPageRequestSchema = z39.object({
4149
- page_id: z39.string()
4577
+ var RevertDeletedPageRequestSchema = z41.object({
4578
+ page_id: z41.string()
4150
4579
  });
4151
- var PageIdBodySchema = z39.object({
4152
- page_id: z39.string()
4580
+ var PageIdBodySchema = z41.object({
4581
+ page_id: z41.string()
4153
4582
  });
4154
- var PageResponseSchema = z39.object({ page: PageSchema });
4583
+ var PageResponseSchema = z41.object({ page: PageSchema });
4155
4584
  var getPageRoute = createRoute22({
4156
4585
  method: "get",
4157
4586
  path: "/pages",
@@ -4163,7 +4592,7 @@ var getPageRoute = createRoute22({
4163
4592
  },
4164
4593
  responses: {
4165
4594
  200: {
4166
- description: "The requested page with populated revision",
4595
+ description: "The requested page with populated revision. `revision.renderedAst` shape is content-negotiated via the `X-Crowi-Ast-Version` request header (RFC-0023): requests declaring `X-Crowi-Ast-Version: 1` receive the typed `{astVersion, root}` envelope; all other requests receive the stored bare mdast Root verbatim. The response varies on this header (`Vary: X-Crowi-Ast-Version`).",
4167
4596
  content: { "application/json": { schema: GetPageResponseSchema } }
4168
4597
  },
4169
4598
  401: {
@@ -4200,7 +4629,7 @@ var listPagesRoute = createRoute22({
4200
4629
  },
4201
4630
  responses: {
4202
4631
  200: {
4203
- description: "Page list (newest first) with optional portal page",
4632
+ description: "Page list (newest first) with optional portal page and an accurate `total` (the full, unpaginated count of the same viewer-visible set `pages` is a page of). The portal document is the only row carrying `revision.renderedAst`; its shape is content-negotiated via the `X-Crowi-Ast-Version` request header (RFC-0023, same semantics as GET /pages). The response varies on this header (`Vary: X-Crowi-Ast-Version`).",
4204
4633
  content: { "application/json": { schema: ListPagesResponseSchema } }
4205
4634
  },
4206
4635
  401: {
@@ -4465,7 +4894,7 @@ var claimPageLinkAccessRoute = createRoute22({
4465
4894
  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",
4466
4895
  content: {
4467
4896
  "application/json": {
4468
- schema: z39.union([PageNotGrantedErrorSchema, InsufficientScopeErrorSchema])
4897
+ schema: z41.union([PageNotGrantedErrorSchema, InsufficientScopeErrorSchema])
4469
4898
  }
4470
4899
  }
4471
4900
  },
@@ -4655,7 +5084,7 @@ var renamePageRoute = createRoute22({
4655
5084
  description: "PAGE_INVALID_NAME / PAGE_EXISTS / PAGE_RENAME_FAILED / PAGE_RENAME_TREE_FAILED",
4656
5085
  content: {
4657
5086
  "application/json": {
4658
- schema: z39.union([PageBadRequestErrorSchema, RenameTreeErrorSchema])
5087
+ schema: z41.union([PageBadRequestErrorSchema, RenameTreeErrorSchema])
4659
5088
  }
4660
5089
  }
4661
5090
  },
@@ -4693,7 +5122,7 @@ var renameSubtreeRoute = createRoute22({
4693
5122
  description: "PAGE_INVALID_NAME / PAGE_RENAME_TREE_FAILED (collisions, nothing to move, or partial failure)",
4694
5123
  content: {
4695
5124
  "application/json": {
4696
- schema: z39.union([PageBadRequestErrorSchema, RenameTreeErrorSchema])
5125
+ schema: z41.union([PageBadRequestErrorSchema, RenameTreeErrorSchema])
4697
5126
  }
4698
5127
  }
4699
5128
  },
@@ -4746,12 +5175,13 @@ var pageRoutes = {
4746
5175
  import { createRoute as createRoute23 } from "@hono/zod-openapi";
4747
5176
 
4748
5177
  // src/schemas/page-preview.ts
4749
- import { z as z40 } from "@hono/zod-openapi";
4750
- var PreviewPageRequestSchema = z40.object({
4751
- body: z40.string()
5178
+ import { z as z42 } from "@hono/zod-openapi";
5179
+ var PreviewPageRequestSchema = z42.object({
5180
+ body: z42.string()
4752
5181
  });
4753
- var PreviewPageResponseSchema = z40.object({
4754
- renderedAst: z40.unknown()
5182
+ var PreviewPageResponseSchema = z42.object({
5183
+ renderedAst: RenderedAstValueSchema.optional(),
5184
+ renderedAstArtifactKey: RenderedAstArtifactKeySchema.optional()
4755
5185
  });
4756
5186
 
4757
5187
  // src/contracts/page-preview.ts
@@ -4768,7 +5198,7 @@ var previewPageRoute = createRoute23({
4768
5198
  },
4769
5199
  responses: {
4770
5200
  200: {
4771
- description: "Rendered mdast tree (serialised \u2014 same shape as a persisted revision.renderedAst)",
5201
+ description: "Rendered mdast tree (serialised \u2014 same shape as a persisted revision.renderedAst). Content-negotiated via the `X-Crowi-Ast-Version` request header (RFC-0023): requests declaring `X-Crowi-Ast-Version: 1` receive the typed `{astVersion, root}` envelope; all other requests receive the bare mdast Root. The response varies on this header (`Vary: X-Crowi-Ast-Version`).",
4772
5202
  content: { "application/json": { schema: PreviewPageResponseSchema } }
4773
5203
  },
4774
5204
  401: {
@@ -4793,78 +5223,78 @@ var pagePreviewRoutes = {
4793
5223
  };
4794
5224
 
4795
5225
  // src/contracts/presence.ts
4796
- import { createRoute as createRoute24, z as z42 } from "@hono/zod-openapi";
5226
+ import { createRoute as createRoute24, z as z44 } from "@hono/zod-openapi";
4797
5227
 
4798
5228
  // src/schemas/presence.ts
4799
- import { z as z41 } from "@hono/zod-openapi";
4800
- var PresenceTokenResponseSchema = z41.object({
4801
- token: z41.string(),
4802
- pageId: z41.string(),
4803
- selfUserId: z41.string(),
4804
- expiresAt: z41.string()
4805
- });
4806
- var PresenceTokenPayloadSchema = z41.object({
4807
- userId: z41.string(),
4808
- pageId: z41.string(),
4809
- iat: z41.number().int(),
4810
- exp: z41.number().int()
4811
- });
4812
- var PresenceViewerSchema = z41.object({
4813
- userId: z41.string(),
4814
- username: z41.string(),
4815
- displayName: z41.string(),
4816
- avatarUrl: z41.string().nullable(),
4817
- isEditing: z41.boolean(),
4818
- joinedAt: z41.number().int()
4819
- });
4820
- var PresenceHeartbeatMessageSchema = z41.object({
4821
- type: z41.literal("heartbeat")
5229
+ import { z as z43 } from "@hono/zod-openapi";
5230
+ var PresenceTokenResponseSchema = z43.object({
5231
+ token: z43.string(),
5232
+ pageId: z43.string(),
5233
+ selfUserId: z43.string(),
5234
+ expiresAt: z43.string()
5235
+ });
5236
+ var PresenceTokenPayloadSchema = z43.object({
5237
+ userId: z43.string(),
5238
+ pageId: z43.string(),
5239
+ iat: z43.number().int(),
5240
+ exp: z43.number().int()
5241
+ });
5242
+ var PresenceViewerSchema = z43.object({
5243
+ userId: z43.string(),
5244
+ username: z43.string(),
5245
+ displayName: z43.string(),
5246
+ avatarUrl: z43.string().nullable(),
5247
+ isEditing: z43.boolean(),
5248
+ joinedAt: z43.number().int()
5249
+ });
5250
+ var PresenceHeartbeatMessageSchema = z43.object({
5251
+ type: z43.literal("heartbeat")
4822
5252
  });
4823
5253
  var PresenceClientMessageSchema = PresenceHeartbeatMessageSchema;
4824
- var PresenceViewersMessageSchema = z41.object({
4825
- type: z41.literal("viewers"),
4826
- viewers: z41.array(PresenceViewerSchema),
4827
- generation: z41.number().int()
4828
- });
4829
- var PresencePageUpdatedMessageSchema = z41.object({
4830
- type: z41.literal("page-updated"),
4831
- pageId: z41.string(),
4832
- revisionId: z41.string(),
4833
- editorUserId: z41.string(),
4834
- editorDisplayName: z41.string()
4835
- });
4836
- var PresenceCommentChangedMessageSchema = z41.object({
4837
- type: z41.literal("comment-changed"),
4838
- pageId: z41.string(),
4839
- changeType: z41.enum(["added", "removed"]),
4840
- commentId: z41.string(),
4841
- actorUserId: z41.string().optional()
4842
- });
4843
- var PresenceServerMessageSchema = z41.discriminatedUnion("type", [
5254
+ var PresenceViewersMessageSchema = z43.object({
5255
+ type: z43.literal("viewers"),
5256
+ viewers: z43.array(PresenceViewerSchema),
5257
+ generation: z43.number().int()
5258
+ });
5259
+ var PresencePageUpdatedMessageSchema = z43.object({
5260
+ type: z43.literal("page-updated"),
5261
+ pageId: z43.string(),
5262
+ revisionId: z43.string(),
5263
+ editorUserId: z43.string(),
5264
+ editorDisplayName: z43.string()
5265
+ });
5266
+ var PresenceCommentChangedMessageSchema = z43.object({
5267
+ type: z43.literal("comment-changed"),
5268
+ pageId: z43.string(),
5269
+ changeType: z43.enum(["added", "removed"]),
5270
+ commentId: z43.string(),
5271
+ actorUserId: z43.string().optional()
5272
+ });
5273
+ var PresenceServerMessageSchema = z43.discriminatedUnion("type", [
4844
5274
  PresenceViewersMessageSchema,
4845
5275
  PresencePageUpdatedMessageSchema,
4846
5276
  PresenceCommentChangedMessageSchema
4847
5277
  ]);
4848
- var LikerSchema = z41.object({
4849
- id: z41.string(),
4850
- username: z41.string(),
4851
- displayName: z41.string(),
4852
- avatarUrl: z41.string().nullable(),
4853
- likedAt: z41.string().nullable()
4854
- });
4855
- var LikersResponseSchema = z41.object({
4856
- users: z41.array(LikerSchema),
4857
- totalCount: z41.number().int().nonnegative()
4858
- });
4859
- var GetLikersRequestSchema = z41.object({
5278
+ var LikerSchema = z43.object({
5279
+ id: z43.string(),
5280
+ username: z43.string(),
5281
+ displayName: z43.string(),
5282
+ avatarUrl: z43.string().nullable(),
5283
+ likedAt: z43.string().nullable()
5284
+ });
5285
+ var LikersResponseSchema = z43.object({
5286
+ users: z43.array(LikerSchema),
5287
+ totalCount: z43.number().int().nonnegative()
5288
+ });
5289
+ var GetLikersRequestSchema = z43.object({
4860
5290
  // Optional cap on returned `users`. `totalCount` always reflects the
4861
5291
  // full count regardless of `limit`. Omit for the full list.
4862
- limit: z41.coerce.number().int().positive().optional()
5292
+ limit: z43.coerce.number().int().positive().optional()
4863
5293
  });
4864
5294
 
4865
5295
  // src/contracts/presence.ts
4866
- var PageIdPathParamsSchema3 = z42.object({
4867
- id: z42.string().openapi({ description: "Page id (24-char hex ObjectId)", example: "507f1f77bcf86cd799439011" })
5296
+ var PageIdPathParamsSchema3 = z44.object({
5297
+ id: z44.string().openapi({ description: "Page id (24-char hex ObjectId)", example: "507f1f77bcf86cd799439011" })
4868
5298
  });
4869
5299
  var getPresenceTokenRoute = createRoute24({
4870
5300
  method: "get",
@@ -4937,49 +5367,49 @@ var presenceRoutes = {
4937
5367
  };
4938
5368
 
4939
5369
  // src/contracts/revision.ts
4940
- import { createRoute as createRoute25, z as z44 } from "@hono/zod-openapi";
5370
+ import { createRoute as createRoute25, z as z46 } from "@hono/zod-openapi";
4941
5371
 
4942
5372
  // src/schemas/revision.ts
4943
- import { z as z43 } from "@hono/zod-openapi";
4944
- var RevisionMetaSchema = z43.object({
4945
- _id: z43.string(),
4946
- path: z43.string(),
5373
+ import { z as z45 } from "@hono/zod-openapi";
5374
+ var RevisionMetaSchema = z45.object({
5375
+ _id: z45.string(),
5376
+ path: z45.string(),
4947
5377
  author: PageUserSchema.nullable().optional(),
4948
5378
  savedBy: PageUserSchema.nullable().optional(),
4949
- contributors: z43.array(PageUserSchema).optional(),
5379
+ contributors: z45.array(PageUserSchema).optional(),
4950
5380
  // RFC-0010 — edit channel. `web` (browser / collab editor) vs the API
4951
5381
  // token paths (`oauth` / `pat`). Absent on pre-RFC-0010 revisions. The
4952
5382
  // history UI shows an "app" chip for the token paths.
4953
- editVia: z43.enum(["web", "oauth", "pat"]).optional(),
4954
- createdAt: z43.string()
5383
+ editVia: z45.enum(["web", "oauth", "pat"]).optional(),
5384
+ createdAt: z45.string()
4955
5385
  });
4956
- var ListRevisionsRequestSchema = z43.object({
4957
- limit: z43.coerce.number().int().positive().max(200).optional().default(50),
4958
- offset: z43.coerce.number().int().min(0).optional().default(0)
5386
+ var ListRevisionsRequestSchema = z45.object({
5387
+ limit: z45.coerce.number().int().positive().max(200).optional().default(50),
5388
+ offset: z45.coerce.number().int().min(0).optional().default(0)
4959
5389
  });
4960
- var ListRevisionsResponseSchema = z43.object({
4961
- revisions: z43.array(RevisionMetaSchema),
5390
+ var ListRevisionsResponseSchema = z45.object({
5391
+ revisions: z45.array(RevisionMetaSchema),
4962
5392
  pager: PagerSchema
4963
5393
  });
4964
- var GetRevisionResponseSchema = z43.object({
5394
+ var GetRevisionResponseSchema = z45.object({
4965
5395
  revision: RevisionSchema
4966
5396
  });
4967
- var GetRevisionsRequestSchema = z43.object({
4968
- ids: z43.string().min(1, "ids is required")
5397
+ var GetRevisionsRequestSchema = z45.object({
5398
+ ids: z45.string().min(1, "ids is required")
4969
5399
  });
4970
- var GetRevisionsResponseSchema = z43.object({
4971
- revisions: z43.array(RevisionSchema)
5400
+ var GetRevisionsResponseSchema = z45.object({
5401
+ revisions: z45.array(RevisionSchema)
4972
5402
  });
4973
- var RevisionInvalidRequestErrorSchema = z43.object({
4974
- error: z43.object({
4975
- code: z43.literal("INVALID_REQUEST"),
4976
- message: z43.string()
5403
+ var RevisionInvalidRequestErrorSchema = z45.object({
5404
+ error: z45.object({
5405
+ code: z45.literal("INVALID_REQUEST"),
5406
+ message: z45.string()
4977
5407
  })
4978
5408
  });
4979
5409
 
4980
5410
  // src/contracts/revision.ts
4981
- var PageIdParamSchema = z44.object({ page_id: z44.string() });
4982
- var RevisionIdParamSchema = z44.object({ id: z44.string() });
5411
+ var PageIdParamSchema = z46.object({ page_id: z46.string() });
5412
+ var RevisionIdParamSchema = z46.object({ id: z46.string() });
4983
5413
  var listRevisionsRoute = createRoute25({
4984
5414
  method: "get",
4985
5415
  path: "/pages/{page_id}/revisions",
@@ -5048,7 +5478,7 @@ var getRevisionRoute = createRoute25({
5048
5478
  },
5049
5479
  responses: {
5050
5480
  200: {
5051
- description: "Full revision document",
5481
+ description: "Full revision document. `renderedAst` shape is content-negotiated via the `X-Crowi-Ast-Version` request header (RFC-0023): requests declaring `X-Crowi-Ast-Version: 1` receive the typed `{astVersion, root}` envelope; all other requests receive the stored bare mdast Root verbatim. The response varies on this header (`Vary: X-Crowi-Ast-Version`).",
5052
5482
  content: { "application/json": { schema: GetRevisionResponseSchema } }
5053
5483
  },
5054
5484
  400: {
@@ -5078,31 +5508,31 @@ var revisionRoutes = {
5078
5508
  import { createRoute as createRoute26 } from "@hono/zod-openapi";
5079
5509
 
5080
5510
  // src/schemas/admin-crypto.ts
5081
- import { z as z45 } from "@hono/zod-openapi";
5082
- var SensitiveConfigEntrySchema = z45.object({
5083
- ns: z45.string(),
5084
- key: z45.string(),
5085
- present: z45.boolean(),
5086
- encrypted: z45.boolean()
5511
+ import { z as z47 } from "@hono/zod-openapi";
5512
+ var SensitiveConfigEntrySchema = z47.object({
5513
+ ns: z47.string(),
5514
+ key: z47.string(),
5515
+ present: z47.boolean(),
5516
+ encrypted: z47.boolean()
5087
5517
  });
5088
- var CryptoStatusResponseSchema = z45.object({
5518
+ var CryptoStatusResponseSchema = z47.object({
5089
5519
  /** False when CROWI_ENCRYPTION_KEY is not configured — UI shows a setup hint. */
5090
- encryptionConfigured: z45.boolean(),
5091
- unencryptedCount: z45.number().int().min(0),
5092
- encryptedCount: z45.number().int().min(0),
5093
- entries: z45.array(SensitiveConfigEntrySchema)
5520
+ encryptionConfigured: z47.boolean(),
5521
+ unencryptedCount: z47.number().int().min(0),
5522
+ encryptedCount: z47.number().int().min(0),
5523
+ entries: z47.array(SensitiveConfigEntrySchema)
5094
5524
  });
5095
- var ReencryptResponseSchema = z45.object({
5096
- rewritten: z45.number().int().min(0),
5525
+ var ReencryptResponseSchema = z47.object({
5526
+ rewritten: z47.number().int().min(0),
5097
5527
  /** Already encrypted, skipped on this run. */
5098
- alreadyEncrypted: z45.number().int().min(0),
5528
+ alreadyEncrypted: z47.number().int().min(0),
5099
5529
  /** Sensitive registry entries that had no row in the DB at all. */
5100
- missing: z45.number().int().min(0)
5530
+ missing: z47.number().int().min(0)
5101
5531
  });
5102
- var EncryptionNotConfiguredErrorSchema = z45.object({
5103
- error: z45.object({
5104
- code: z45.literal("ENCRYPTION_NOT_CONFIGURED"),
5105
- message: z45.string()
5532
+ var EncryptionNotConfiguredErrorSchema = z47.object({
5533
+ error: z47.object({
5534
+ code: z47.literal("ENCRYPTION_NOT_CONFIGURED"),
5535
+ message: z47.string()
5106
5536
  })
5107
5537
  });
5108
5538
 
@@ -5170,30 +5600,30 @@ var adminCryptoRoutes = {
5170
5600
  import { createRoute as createRoute27 } from "@hono/zod-openapi";
5171
5601
 
5172
5602
  // src/schemas/search.ts
5173
- import { z as z47 } from "@hono/zod-openapi";
5174
- var SearchPageTypeSchema = z47.enum(["portal", "public", "user"]);
5175
- var SearchPagesRequestSchema = z47.object({
5176
- q: z47.string().min(1),
5177
- tree: z47.string().optional(),
5603
+ import { z as z49 } from "@hono/zod-openapi";
5604
+ var SearchPageTypeSchema = z49.enum(["portal", "public", "user"]);
5605
+ var SearchPagesRequestSchema = z49.object({
5606
+ q: z49.string().min(1),
5607
+ tree: z49.string().optional(),
5178
5608
  type: SearchPageTypeSchema.optional(),
5179
- page: z47.coerce.number().int().min(1).default(1),
5180
- limit: z47.coerce.number().int().min(1).max(100).default(50)
5181
- });
5182
- var SearchHitSchema = z47.object({
5183
- pageId: z47.string(),
5184
- path: z47.string(),
5185
- score: z47.number().optional(),
5186
- snippet: z47.string().optional(),
5187
- bookmarkCount: z47.number(),
5609
+ page: z49.coerce.number().int().min(1).default(1),
5610
+ limit: z49.coerce.number().int().min(1).max(100).default(50)
5611
+ });
5612
+ var SearchHitSchema = z49.object({
5613
+ pageId: z49.string(),
5614
+ path: z49.string(),
5615
+ score: z49.number().optional(),
5616
+ snippet: z49.string().optional(),
5617
+ bookmarkCount: z49.number(),
5188
5618
  page: PageSchema
5189
5619
  });
5190
- var SearchPagesResponseSchema = z47.object({
5191
- meta: z47.object({
5192
- took: z47.number().optional(),
5193
- total: z47.number(),
5194
- results: z47.number()
5620
+ var SearchPagesResponseSchema = z49.object({
5621
+ meta: z49.object({
5622
+ took: z49.number().optional(),
5623
+ total: z49.number(),
5624
+ results: z49.number()
5195
5625
  }),
5196
- data: z47.array(SearchHitSchema)
5626
+ data: z49.array(SearchHitSchema)
5197
5627
  });
5198
5628
 
5199
5629
  // src/contracts/search.ts
@@ -5234,53 +5664,53 @@ var searchRoutes = {
5234
5664
  };
5235
5665
 
5236
5666
  // src/contracts/token-auth.ts
5237
- import { createRoute as createRoute28, z as z49 } from "@hono/zod-openapi";
5667
+ import { createRoute as createRoute28, z as z51 } from "@hono/zod-openapi";
5238
5668
 
5239
5669
  // src/schemas/auth.ts
5240
- import { z as z48 } from "@hono/zod-openapi";
5241
- var TokenAuthLoginRequestSchema = z48.object({
5242
- email: z48.string().email(),
5243
- password: z48.string().min(6)
5244
- });
5245
- var TokenAuthResponseSchema = z48.object({
5246
- accessToken: z48.string(),
5247
- refreshToken: z48.string(),
5248
- expiresIn: z48.number(),
5670
+ import { z as z50 } from "@hono/zod-openapi";
5671
+ var TokenAuthLoginRequestSchema = z50.object({
5672
+ email: z50.string().email(),
5673
+ password: z50.string().min(6)
5674
+ });
5675
+ var TokenAuthResponseSchema = z50.object({
5676
+ accessToken: z50.string(),
5677
+ refreshToken: z50.string(),
5678
+ expiresIn: z50.number(),
5249
5679
  // seconds until expiration
5250
- user: z48.object({
5251
- id: z48.string(),
5252
- username: z48.string(),
5253
- email: z48.string().email(),
5254
- name: z48.string(),
5255
- image: z48.string().optional(),
5256
- admin: z48.boolean().optional()
5680
+ user: z50.object({
5681
+ id: z50.string(),
5682
+ username: z50.string(),
5683
+ email: z50.string().email(),
5684
+ name: z50.string(),
5685
+ image: z50.string().optional(),
5686
+ admin: z50.boolean().optional()
5257
5687
  })
5258
5688
  });
5259
- var RefreshTokenRequestSchema = z48.object({
5260
- refreshToken: z48.string()
5689
+ var RefreshTokenRequestSchema = z50.object({
5690
+ refreshToken: z50.string()
5261
5691
  });
5262
- var TokenAuthRegisterRequestSchema = z48.object({
5263
- username: z48.string(),
5264
- name: z48.string(),
5265
- email: z48.string().email(),
5266
- password: z48.string().min(6)
5692
+ var TokenAuthRegisterRequestSchema = z50.object({
5693
+ username: UsernameSchema,
5694
+ name: z50.string(),
5695
+ email: z50.string().email(),
5696
+ password: z50.string().min(6)
5267
5697
  });
5268
- var RegisterPendingResponseSchema = z48.object({
5269
- status: z48.enum(["confirmation_required", "approval_required"])
5698
+ var RegisterPendingResponseSchema = z50.object({
5699
+ status: z50.enum(["confirmation_required", "approval_required"])
5270
5700
  });
5271
5701
 
5272
5702
  // src/contracts/token-auth.ts
5273
- var TokenLogoutResponseSchema = z49.object({ message: z49.string() });
5274
- var TokenMeResponseSchema = z49.object({
5275
- user: z49.object({
5276
- id: z49.string(),
5277
- username: z49.string(),
5278
- email: z49.string().email(),
5279
- name: z49.string(),
5280
- image: z49.string().optional(),
5281
- status: z49.number(),
5282
- admin: z49.boolean().optional(),
5283
- createdAt: z49.string()
5703
+ var TokenLogoutResponseSchema = z51.object({ message: z51.string() });
5704
+ var TokenMeResponseSchema = z51.object({
5705
+ user: z51.object({
5706
+ id: z51.string(),
5707
+ username: z51.string(),
5708
+ email: z51.string().email(),
5709
+ name: z51.string(),
5710
+ image: z51.string().optional(),
5711
+ status: z51.number(),
5712
+ admin: z51.boolean().optional(),
5713
+ createdAt: z51.string()
5284
5714
  })
5285
5715
  });
5286
5716
  var tokenLoginRoute = createRoute28({
@@ -5408,7 +5838,7 @@ var tokenLogoutRoute = createRoute28({
5408
5838
  body: {
5409
5839
  content: {
5410
5840
  "application/json": {
5411
- schema: z49.object({ refreshToken: z49.string().optional() })
5841
+ schema: z51.object({ refreshToken: z51.string().optional() })
5412
5842
  }
5413
5843
  }
5414
5844
  }
@@ -5461,15 +5891,15 @@ var tokenAuthRoutes = {
5461
5891
  import { createRoute as createRoute29 } from "@hono/zod-openapi";
5462
5892
 
5463
5893
  // src/schemas/invite-accept.ts
5464
- import { z as z50 } from "@hono/zod-openapi";
5465
- var InviteAcceptRequestSchema = z50.object({
5466
- token: z50.string(),
5467
- username: z50.string().min(1),
5468
- name: z50.string().min(1),
5469
- password: z50.string().min(6)
5894
+ import { z as z52 } from "@hono/zod-openapi";
5895
+ var InviteAcceptRequestSchema = z52.object({
5896
+ token: z52.string(),
5897
+ username: UsernameSchema,
5898
+ name: z52.string().min(1),
5899
+ password: z52.string().min(6)
5470
5900
  });
5471
- var InvitePreviewResponseSchema = z50.object({
5472
- email: z50.string().email()
5901
+ var InvitePreviewResponseSchema = z52.object({
5902
+ email: z52.string().email()
5473
5903
  });
5474
5904
 
5475
5905
  // src/contracts/invite-accept.ts
@@ -5546,16 +5976,16 @@ var inviteAcceptRoutes = {
5546
5976
  import { createRoute as createRoute30 } from "@hono/zod-openapi";
5547
5977
 
5548
5978
  // src/schemas/password-reset.ts
5549
- import { z as z51 } from "@hono/zod-openapi";
5550
- var ForgotPasswordRequestSchema = z51.object({
5551
- email: z51.string().email()
5979
+ import { z as z53 } from "@hono/zod-openapi";
5980
+ var ForgotPasswordRequestSchema = z53.object({
5981
+ email: z53.string().email()
5552
5982
  });
5553
- var ForgotPasswordResponseSchema = z51.object({
5554
- ok: z51.literal(true)
5983
+ var ForgotPasswordResponseSchema = z53.object({
5984
+ ok: z53.literal(true)
5555
5985
  });
5556
- var ResetPasswordRequestSchema = z51.object({
5557
- token: z51.string(),
5558
- password: z51.string().min(6)
5986
+ var ResetPasswordRequestSchema = z53.object({
5987
+ token: z53.string(),
5988
+ password: z53.string().min(6)
5559
5989
  });
5560
5990
 
5561
5991
  // src/contracts/password-reset.ts
@@ -5650,12 +6080,12 @@ var passwordResetRoutes = {
5650
6080
  import { createRoute as createRoute31 } from "@hono/zod-openapi";
5651
6081
 
5652
6082
  // src/schemas/activation.ts
5653
- import { z as z52 } from "@hono/zod-openapi";
5654
- var ActivateRequestSchema = z52.object({
5655
- token: z52.string()
6083
+ import { z as z54 } from "@hono/zod-openapi";
6084
+ var ActivateRequestSchema = z54.object({
6085
+ token: z54.string()
5656
6086
  });
5657
- var ActivateValidationResponseSchema = z52.object({
5658
- ok: z52.literal(true)
6087
+ var ActivateValidationResponseSchema = z54.object({
6088
+ ok: z54.literal(true)
5659
6089
  });
5660
6090
 
5661
6091
  // src/contracts/activation.ts
@@ -5720,14 +6150,14 @@ var activationRoutes = {
5720
6150
  import { createRoute as createRoute32 } from "@hono/zod-openapi";
5721
6151
 
5722
6152
  // src/schemas/email-change.ts
5723
- import { z as z53 } from "@hono/zod-openapi";
5724
- var ConfirmEmailChangeRequestSchema = z53.object({
5725
- token: z53.string()
6153
+ import { z as z55 } from "@hono/zod-openapi";
6154
+ var ConfirmEmailChangeRequestSchema = z55.object({
6155
+ token: z55.string()
5726
6156
  });
5727
- var ConfirmEmailChangeResponseSchema = z53.object({
5728
- ok: z53.literal(true),
6157
+ var ConfirmEmailChangeResponseSchema = z55.object({
6158
+ ok: z55.literal(true),
5729
6159
  /** The newly-confirmed email address. */
5730
- email: z53.string().email()
6160
+ email: z55.string().email()
5731
6161
  });
5732
6162
 
5733
6163
  // src/contracts/email-change.ts
@@ -5793,8 +6223,8 @@ var emailChangeRoutes = {
5793
6223
  };
5794
6224
 
5795
6225
  // src/contracts/user.ts
5796
- import { createRoute as createRoute33, z as z54 } from "@hono/zod-openapi";
5797
- var UsernameParamSchema = z54.object({ username: z54.string() });
6226
+ import { createRoute as createRoute33, z as z56 } from "@hono/zod-openapi";
6227
+ var UsernameParamSchema = z56.object({ username: z56.string() });
5798
6228
  var getUserPageRoute = createRoute33({
5799
6229
  method: "get",
5800
6230
  path: "/user/{username}",
@@ -5806,7 +6236,7 @@ var getUserPageRoute = createRoute33({
5806
6236
  },
5807
6237
  responses: {
5808
6238
  200: {
5809
- description: "User profile with statistics + recent activity",
6239
+ description: "User profile with statistics (createdPagesCount, bookmarksCount, likesCount, commentsCount \u2014 the last two are the target user's OWN likes/comments, not activity their pages received) + recent activity",
5810
6240
  content: { "application/json": { schema: UserPageResponseSchema } }
5811
6241
  },
5812
6242
  401: {
@@ -6029,7 +6459,9 @@ var stubUserPublic = {
6029
6459
  var stubUserPage = {
6030
6460
  user: stubUserPublic,
6031
6461
  createdPagesCount: 0,
6032
- bookmarksCount: 0
6462
+ bookmarksCount: 0,
6463
+ likesCount: 0,
6464
+ commentsCount: 0
6033
6465
  };
6034
6466
  var stubPager = { prev: null, next: null, offset: 0 };
6035
6467
  var stubUserBookmarks = {
@@ -6116,11 +6548,11 @@ var stubPageWithRevision = {
6116
6548
  }
6117
6549
  };
6118
6550
  var stubPageResponse = { page: stubPage };
6119
- var stubListPages = { pages: [], pager: stubPager, portalPage: null };
6551
+ var stubListPages = { pages: [], pager: stubPager, portalPage: null, total: 0 };
6120
6552
  var stubListPageChildren = { children: [] };
6121
6553
  var stubSeenUsers = { seenUsers: [], seenUsersCount: 0 };
6122
6554
  var stubWatchStatus = { watching: false };
6123
- var stubPreview = { renderedAst: null };
6555
+ var stubPreview = {};
6124
6556
  var stubWsToken = {
6125
6557
  wsToken: "",
6126
6558
  pageId: "",
@@ -6210,6 +6642,7 @@ var stubPendingUsersCount = { count: 0 };
6210
6642
  var stubListPlugins = { plugins: [] };
6211
6643
  var stubPluginConfig = { name: "", fields: [], values: {} };
6212
6644
  var stubUpdatePluginConfig = { ok: true, hotReloaded: false, reconfigureFailed: false };
6645
+ var stubPluginReadiness = { issues: [] };
6213
6646
  var stubClearRenderCache = { ok: true, clearedAt: "", removedCount: 0 };
6214
6647
  var appAuthMeUserChain = new OpenAPIHono().openapi(
6215
6648
  appRoutes.getAppInfoRoute,
@@ -6249,7 +6682,7 @@ var bookmarkBacklinkCommentRevisionChain = new OpenAPIHono().openapi(bookmarkRou
6249
6682
  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));
6250
6683
  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));
6251
6684
  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));
6252
- 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));
6685
+ 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.getPluginReadinessRoute, (c) => c.json(stubPluginReadiness, 200)).openapi(adminPluginsRoutes.clearRenderCacheAllRoute, (c) => c.json(stubClearRenderCache, 200)).openapi(adminPluginsRoutes.clearRenderCachePluginRoute, (c) => c.json(stubClearRenderCache, 200));
6253
6686
  var oauthContractApp = new OpenAPIHono().openapi(oauthRoutes.authorizeRoute, (c) => c.json(stubAuthorize, 200)).openapi(oauthRoutes.tokenRoute, (c) => c.json(stubToken, 200)).openapi(oauthRoutes.revokeRoute, (c) => c.json(stubRevoke, 200)).openapi(oauthRoutes.discoveryRoute, (c) => c.json(stubDiscovery, 200)).openapi(oauthRoutes.deviceAuthorizeRoute, (c) => c.json(stubDeviceAuthorize, 200)).openapi(oauthRoutes.deviceInfoRoute, (c) => c.json(stubDeviceInfo, 200)).openapi(oauthRoutes.deviceVerifyRoute, (c) => c.json(stubDeviceVerify, 200)).openapi(oauthRoutes.clientInfoRoute, (c) => c.json(stubClientInfo, 200));
6254
6687
  var createClient = (baseUrl, options = {}) => hc(baseUrl, {
6255
6688
  headers: options.headers,
@@ -6257,19 +6690,19 @@ var createClient = (baseUrl, options = {}) => hc(baseUrl, {
6257
6690
  });
6258
6691
 
6259
6692
  // src/schemas/mail-token.ts
6260
- import { z as z55 } from "@hono/zod-openapi";
6261
- var MailTokenPurposeSchema = z55.enum(["invite", "activate", "reset", "email-change"]);
6262
- var MailTokenPayloadSchema = z55.object({
6693
+ import { z as z57 } from "@hono/zod-openapi";
6694
+ var MailTokenPurposeSchema = z57.enum(["invite", "activate", "reset", "email-change"]);
6695
+ var MailTokenPayloadSchema = z57.object({
6263
6696
  purpose: MailTokenPurposeSchema,
6264
- userId: z55.string(),
6697
+ userId: z57.string(),
6265
6698
  /** Target address. For `email-change` this is the NEW address. */
6266
- email: z55.string().email(),
6699
+ email: z57.string().email(),
6267
6700
  /**
6268
6701
  * For `email-change`: the account's email at issue time. The confirm
6269
6702
  * endpoint rejects the token unless it still matches, making the token
6270
6703
  * single-use (a stale token cannot revert a later change).
6271
6704
  */
6272
- fromEmail: z55.string().email().optional(),
6705
+ fromEmail: z57.string().email().optional(),
6273
6706
  /**
6274
6707
  * For `reset`: the account's `passwordResetGeneration` at issue time.
6275
6708
  * Consuming the link increments that counter, so the token only matches
@@ -6278,7 +6711,7 @@ var MailTokenPayloadSchema = z55.object({
6278
6711
  * schema because the other purposes don't carry it (and links minted
6279
6712
  * before the claim existed simply no longer match).
6280
6713
  */
6281
- resetGeneration: z55.number().int().nonnegative().optional(),
6714
+ resetGeneration: z57.number().int().nonnegative().optional(),
6282
6715
  /**
6283
6716
  * For `email-change`: the account's `authVersion` at issue time. The
6284
6717
  * confirm endpoint requires it to still match, so a pending address change
@@ -6290,10 +6723,22 @@ var MailTokenPayloadSchema = z55.object({
6290
6723
  * semantics wanted are exactly "the session that asked for this is gone",
6291
6724
  * and that is what every bump of it already means.
6292
6725
  */
6293
- authVersion: z55.number().int().nonnegative().optional(),
6726
+ authVersion: z57.number().int().nonnegative().optional(),
6727
+ /**
6728
+ * For `email-change`: the account's `emailChangeGeneration` at issue time.
6729
+ * Requesting a change increments it, so asking for a different address
6730
+ * supersedes any link still pending — which is what lets a user call off a
6731
+ * change they did not want (one an attacker started with a stolen session,
6732
+ * or one sent to a mistyped address). `authVersion` cannot serve this: it
6733
+ * means "the session that asked is gone", and bumping it on a mere request
6734
+ * would log the user out of their own account for editing their profile.
6735
+ * Optional in the schema for the same reason as the others — links minted
6736
+ * before the claim existed simply no longer match.
6737
+ */
6738
+ emailChangeGeneration: z57.number().int().nonnegative().optional(),
6294
6739
  // iat / exp are injected and verified by the JWT layer.
6295
- iat: z55.number().optional(),
6296
- exp: z55.number().optional()
6740
+ iat: z57.number().optional(),
6741
+ exp: z57.number().optional()
6297
6742
  });
6298
6743
 
6299
6744
  // src/util/html-elements.ts
@@ -6453,6 +6898,13 @@ export {
6453
6898
  ALL_CAPABILITIES,
6454
6899
  ALL_SCOPES,
6455
6900
  API_SURFACE_VERSION,
6901
+ AST_INPUT_LIMIT_BYTES,
6902
+ AST_MAX_HAST_DEPTH,
6903
+ AST_MAX_IMAGE_BASE64_CHARS,
6904
+ AST_MAX_TREE_DEPTH,
6905
+ AST_MAX_VALUE_CHARS,
6906
+ AST_OUTPUT_BUDGET_BYTES,
6907
+ AST_OUTPUT_WARN_BYTES,
6456
6908
  AccessTokenSchema,
6457
6909
  ActivateRequestSchema,
6458
6910
  ActivateValidationResponseSchema,
@@ -6489,6 +6941,7 @@ export {
6489
6941
  BacklinkSchema,
6490
6942
  BookmarkResponseSchema,
6491
6943
  BookmarkSchema,
6944
+ CURRENT_AST_VERSION,
6492
6945
  CapabilitySchema,
6493
6946
  ClaimPageLinkAccessResponseSchema,
6494
6947
  ClearRenderCacheResponseSchema,
@@ -6511,10 +6964,21 @@ export {
6511
6964
  CreateDraftRequestSchema,
6512
6965
  CreateDraftResponseSchema,
6513
6966
  CreatePageRequestSchema,
6967
+ CrowiCodeSidecarSchema,
6968
+ CrowiDiagramNodeSchema,
6969
+ CrowiDiagramSidecarSchema,
6970
+ CrowiDimensionSchema,
6971
+ CrowiImagePayloadSchema,
6972
+ CrowiLinkCardNodeSchema,
6973
+ CrowiLinkCardSidecarSchema,
6974
+ CrowiMathSidecarSchema,
6975
+ CrowiOpaqueNodeSchema,
6976
+ CrowiPlaceholderKindSchema,
6977
+ CrowiPlaceholderNodeSchema,
6978
+ CrowiPlaceholderSidecarSchema,
6514
6979
  CryptoStatusResponseSchema,
6515
6980
  DEVICE_CODE_GRANT_TYPE,
6516
6981
  DISCOVERY_SCOPES_SUPPORTED,
6517
- DND_EXTRA_UPLOAD_MIME,
6518
6982
  DYNAMIC_CAPABILITIES,
6519
6983
  DeleteAdminUserResponseSchema,
6520
6984
  DeleteCommentRequestSchema,
@@ -6555,7 +7019,11 @@ export {
6555
7019
  GetSeenUsersRequestSchema,
6556
7020
  GetStorageStatusResponseSchema,
6557
7021
  GetWatchStatusRequestSchema,
6558
- IMAGE_UPLOAD_MIME,
7022
+ HChildSchema,
7023
+ HChildrenSchema,
7024
+ HNameSchema,
7025
+ HPropertiesSchema,
7026
+ HastHintDataSchema,
6559
7027
  ISSUABLE_SCOPES,
6560
7028
  InstallerStatusResponseSchema,
6561
7029
  InsufficientScopeErrorSchema,
@@ -6590,6 +7058,7 @@ export {
6590
7058
  ListRevisionsResponseSchema,
6591
7059
  ListUsersRequestSchema,
6592
7060
  ListUsersResponseSchema,
7061
+ LooseRenderedAstRootSchema,
6593
7062
  MailSettingsValidationErrorSchema,
6594
7063
  MailTokenPayloadSchema,
6595
7064
  MailTokenPurposeSchema,
@@ -6641,6 +7110,9 @@ export {
6641
7110
  PluginFieldSchema,
6642
7111
  PluginInfoSchema,
6643
7112
  PluginNotFoundErrorSchema,
7113
+ PluginReadinessFieldSchema,
7114
+ PluginReadinessIssueSchema,
7115
+ PluginReadinessResponseSchema,
6644
7116
  PresenceClientMessageSchema,
6645
7117
  PresenceCommentChangedMessageSchema,
6646
7118
  PresenceHeartbeatMessageSchema,
@@ -6653,6 +7125,7 @@ export {
6653
7125
  PreviewPageRequestSchema,
6654
7126
  PreviewPageResponseSchema,
6655
7127
  ProfileErrorResponseSchema,
7128
+ RENDERED_AST_NODE_DEFS,
6656
7129
  RecentlyViewedPagesResponseSchema,
6657
7130
  ReencryptResponseSchema,
6658
7131
  RefreshTokenRequestSchema,
@@ -6666,6 +7139,13 @@ export {
6666
7139
  RenameSubtreeRequestSchema,
6667
7140
  RenameSubtreeResponseSchema,
6668
7141
  RenameTreeErrorSchema,
7142
+ RenderedAstArtifactKeySchema,
7143
+ RenderedAstEnvelopeOpenApiSchema,
7144
+ RenderedAstEnvelopeSchema,
7145
+ RenderedAstNodeSchema,
7146
+ RenderedAstRootSchema,
7147
+ RenderedAstValueSchema,
7148
+ ReservationSchema,
6669
7149
  ResetPasswordRequestSchema,
6670
7150
  ResetPasswordResponseSchema,
6671
7151
  RevertToRevisionRequestSchema,
@@ -6677,6 +7157,7 @@ export {
6677
7157
  RevokeRequestSchema,
6678
7158
  RevokeResponseSchema,
6679
7159
  SCOPES,
7160
+ SIDECAR_KEYS,
6680
7161
  STATIC_CAPABILITIES,
6681
7162
  STRIP_KNOWN_HTML_TAGS_MAX_LENGTH,
6682
7163
  SearchAdminUsersByEmailRequestSchema,
@@ -6696,6 +7177,9 @@ export {
6696
7177
  ServiceUnavailableErrorSchema,
6697
7178
  SetPageGrantRequestSchema,
6698
7179
  SetWatchStatusRequestSchema,
7180
+ ShikiTokenLinesSchema,
7181
+ ShikiTokenSchema,
7182
+ ShikiTokenStyleSchema,
6699
7183
  StorageDriverEntrySchema,
6700
7184
  SuccessResponseSchema,
6701
7185
  ThemeSchema,
@@ -6708,6 +7192,7 @@ export {
6708
7192
  TokenAuthResponseSchema,
6709
7193
  TokenRequestSchema,
6710
7194
  TokenResponseSchema,
7195
+ UPLOAD_ALLOWED_MIME,
6711
7196
  UpdateAdminUserEmailRequestSchema,
6712
7197
  UpdateAppSettingsRequestSchema,
6713
7198
  UpdateAppSettingsResponseSchema,
@@ -6739,6 +7224,7 @@ export {
6739
7224
  UserStatusErrorSchema,
6740
7225
  UserStatusSchema,
6741
7226
  UserSubpagesRequestSchema,
7227
+ UsernameSchema,
6742
7228
  ValidationErrorSchema,
6743
7229
  WS_CLOSE_CODES,
6744
7230
  WatchStatusResponseSchema,
@@ -6809,6 +7295,7 @@ export {
6809
7295
  getNotificationsTokenRoute,
6810
7296
  getPageRoute,
6811
7297
  getPluginConfigRoute,
7298
+ getPluginReadinessRoute,
6812
7299
  getPresenceTokenRoute,
6813
7300
  getProfileRoute,
6814
7301
  getRevisionRoute,
@@ -6889,6 +7376,7 @@ export {
6889
7376
  tokenRegisterRoute,
6890
7377
  tokenRoute,
6891
7378
  unlikePageRoute,
7379
+ unwrapRenderedAst,
6892
7380
  updateAppSettingsRoute,
6893
7381
  updateAuthSettingsRoute,
6894
7382
  updateMailSettingsRoute,