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

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
@@ -1722,14 +1722,51 @@ var UploadAttachmentResponseSchema = z17.object({
1722
1722
  mimeType: z17.string(),
1723
1723
  sizeBytes: z17.number()
1724
1724
  });
1725
- var UploadAttachmentErrorCodeSchema = z17.enum(["too_large", "disallowed_type", "rate_limited", "no_permission"]);
1725
+ var UploadAttachmentErrorCodeSchema = z17.enum(["too_large", "disallowed_type", "DISALLOWED_MIME", "rate_limited", "no_permission"]);
1726
1726
  var UploadAttachmentErrorSchema = z17.object({
1727
1727
  error: UploadAttachmentErrorCodeSchema,
1728
1728
  message: z17.string(),
1729
1729
  details: z17.record(z17.string(), z17.unknown()).optional()
1730
1730
  });
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"];
1731
+ var UPLOAD_ALLOWED_MIME = [
1732
+ // Raster + vector images.
1733
+ "image/png",
1734
+ "image/jpeg",
1735
+ "image/gif",
1736
+ "image/webp",
1737
+ "image/svg+xml",
1738
+ "image/bmp",
1739
+ "image/avif",
1740
+ "image/apng",
1741
+ "image/x-icon",
1742
+ // Documents / text.
1743
+ "application/pdf",
1744
+ "text/plain",
1745
+ "text/markdown",
1746
+ "text/csv",
1747
+ "application/json",
1748
+ "application/xml",
1749
+ "text/html",
1750
+ // Office documents.
1751
+ "application/msword",
1752
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
1753
+ "application/vnd.ms-excel",
1754
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
1755
+ "application/vnd.ms-powerpoint",
1756
+ "application/vnd.openxmlformats-officedocument.presentationml.presentation",
1757
+ // Archives.
1758
+ "application/zip",
1759
+ "application/gzip",
1760
+ "application/x-tar",
1761
+ // Audio / video.
1762
+ "audio/mpeg",
1763
+ "audio/wav",
1764
+ "video/mp4",
1765
+ "video/webm",
1766
+ "video/quicktime",
1767
+ // Unknown / unset — see the note above.
1768
+ "application/octet-stream"
1769
+ ];
1733
1770
 
1734
1771
  // src/contracts/attachment.ts
1735
1772
  var PageIdPathParamsSchema = z18.object({
@@ -1811,6 +1848,10 @@ var addAttachmentRoute = createRoute10({
1811
1848
  description: "Request body exceeds the multipart envelope ceiling",
1812
1849
  content: { "application/json": { schema: AttachmentErrorSchema } }
1813
1850
  },
1851
+ 415: {
1852
+ description: "MIME type not in the unified upload allow-list (feature-attachment-upload-policy)",
1853
+ content: { "application/json": { schema: AttachmentErrorSchema } }
1854
+ },
1814
1855
  500: {
1815
1856
  description: "Upload / storage failure",
1816
1857
  content: { "application/json": { schema: AttachmentErrorSchema } }
@@ -1914,7 +1955,7 @@ var uploadAttachmentRoute = createRoute10({
1914
1955
  content: { "application/json": { schema: UploadAttachmentErrorSchema } }
1915
1956
  },
1916
1957
  415: {
1917
- description: "MIME type not in the per-intent allow-list",
1958
+ description: "MIME type not in the unified upload allow-list (feature-attachment-upload-policy)",
1918
1959
  content: { "application/json": { schema: UploadAttachmentErrorSchema } }
1919
1960
  },
1920
1961
  429: {
@@ -2109,7 +2150,7 @@ var GetBacklinksResponseSchema = z20.object({
2109
2150
  });
2110
2151
 
2111
2152
  // src/schemas/page.ts
2112
- import { z as z22 } from "@hono/zod-openapi";
2153
+ import { z as z23 } from "@hono/zod-openapi";
2113
2154
 
2114
2155
  // src/schemas/collab.ts
2115
2156
  import { z as z21 } from "@hono/zod-openapi";
@@ -2147,15 +2188,341 @@ var CollabForceReloadMessageSchema = z21.object({
2147
2188
  reason: z21.string().optional()
2148
2189
  });
2149
2190
 
2191
+ // src/schemas/rendered-ast.ts
2192
+ import { z as z22 } from "@hono/zod-openapi";
2193
+ var CURRENT_AST_VERSION = 1;
2194
+ var AST_INPUT_LIMIT_BYTES = 8 * 1024 * 1024;
2195
+ var AST_OUTPUT_WARN_BYTES = 512 * 1024;
2196
+ var AST_OUTPUT_BUDGET_BYTES = 2 * 1024 * 1024;
2197
+ var AST_MAX_TREE_DEPTH = 64;
2198
+ var AST_MAX_HAST_DEPTH = 16;
2199
+ var AST_MAX_IMAGE_BASE64_CHARS = 14e4;
2200
+ var AST_MAX_VALUE_CHARS = 2e5;
2201
+ var HPropertyValueSchema = z22.union([
2202
+ z22.string().max(4096),
2203
+ z22.number(),
2204
+ z22.boolean(),
2205
+ z22.array(z22.union([z22.string().max(4096), z22.number()])).max(64)
2206
+ // className etc.
2207
+ ]);
2208
+ var HPropertiesSchema = z22.object({
2209
+ id: z22.string().max(256).optional(),
2210
+ className: z22.union([z22.string().max(4096), z22.array(z22.string().max(256)).max(64)]).optional(),
2211
+ role: z22.string().max(64).optional(),
2212
+ ariaLabel: z22.string().max(256).optional(),
2213
+ "data-source-line": z22.union([z22.string().max(32), z22.number()]).optional(),
2214
+ "data-crowi-image-align": z22.string().max(16).optional(),
2215
+ "data-crowi-image-float": z22.string().max(16).optional(),
2216
+ "data-crowi-image-width": z22.string().max(16).optional(),
2217
+ "data-crowi-image-height": z22.string().max(16).optional()
2218
+ }).catchall(HPropertyValueSchema);
2219
+ var HChildSchema = z22.lazy(
2220
+ () => z22.discriminatedUnion("type", [
2221
+ z22.object({ type: z22.literal("raw"), value: z22.string().max(AST_MAX_VALUE_CHARS) }),
2222
+ z22.object({ type: z22.literal("text"), value: z22.string().max(AST_MAX_VALUE_CHARS) }),
2223
+ z22.object({
2224
+ type: z22.literal("element"),
2225
+ tagName: z22.string().max(32).regex(/^[a-zA-Z][a-zA-Z0-9-]*$/),
2226
+ properties: HPropertiesSchema.optional(),
2227
+ children: z22.array(HChildSchema)
2228
+ })
2229
+ ])
2230
+ );
2231
+ var HChildrenSchema = z22.array(HChildSchema).max(256);
2232
+ var HNameSchema = z22.string().max(32).regex(/^[a-zA-Z][a-zA-Z0-9-]*$/);
2233
+ var HastHintDataSchema = z22.object({
2234
+ hName: HNameSchema.optional(),
2235
+ hProperties: HPropertiesSchema.optional(),
2236
+ hChildren: HChildrenSchema.optional()
2237
+ });
2238
+ var CrowiDimensionSchema = z22.number().int().min(1).max(16384);
2239
+ var CrowiImagePayloadSchema = z22.object({
2240
+ mediaType: z22.enum(["image/svg+xml", "image/png"]),
2241
+ base64: z22.string().max(AST_MAX_IMAGE_BASE64_CHARS),
2242
+ /** Intrinsic dimensions — required (parent spec §3). Producers that cannot derive them fall back to html-only. */
2243
+ width: CrowiDimensionSchema,
2244
+ height: CrowiDimensionSchema
2245
+ });
2246
+ var ShikiTokenStyleSchema = z22.object({
2247
+ color: z22.string().max(32),
2248
+ bgColor: z22.string().max(32).optional(),
2249
+ fontStyle: z22.array(z22.enum(["italic", "bold", "underline", "strikethrough"])).max(4).optional()
2250
+ });
2251
+ var ShikiTokenSchema = z22.object({
2252
+ content: z22.string().max(4096),
2253
+ light: ShikiTokenStyleSchema,
2254
+ dark: ShikiTokenStyleSchema
2255
+ });
2256
+ var ShikiTokenLinesSchema = z22.array(z22.array(ShikiTokenSchema)).max(2e4);
2257
+ var CrowiCodeSidecarSchema = z22.object({
2258
+ lang: z22.string().max(64).optional(),
2259
+ value: z22.string().max(AST_MAX_VALUE_CHARS),
2260
+ /** Lines of themed tokens (light/dark both, `defaultColor: false`). */
2261
+ tokens: ShikiTokenLinesSchema
2262
+ });
2263
+ var CrowiMathSidecarSchema = z22.object({
2264
+ tex: z22.string().max(AST_MAX_VALUE_CHARS),
2265
+ display: z22.boolean()
2266
+ });
2267
+ var CrowiDiagramSidecarSchema = z22.object({
2268
+ kind: z22.enum(["mermaid", "plantuml"]),
2269
+ /** Mermaid's closed-enum diagram-type keyword (flowchart / sequence / ...). */
2270
+ diagramType: z22.string().max(32).optional(),
2271
+ alt: z22.string().max(256),
2272
+ image: CrowiImagePayloadSchema
2273
+ });
2274
+ var CrowiLinkCardSidecarSchema = z22.object({
2275
+ url: z22.string().max(4096),
2276
+ title: z22.string().max(512).optional(),
2277
+ description: z22.string().max(2048).optional(),
2278
+ /** OGP image stays an external URL (never inlined server-side — parent spec §10). */
2279
+ image: z22.object({ url: z22.string().max(4096) }).optional(),
2280
+ siteName: z22.string().max(256).optional(),
2281
+ domain: z22.string().max(256).optional()
2282
+ });
2283
+ var CrowiPlaceholderKindSchema = z22.enum([
2284
+ "error-auth",
2285
+ "error-rate-limit",
2286
+ "error-not-found",
2287
+ "error-network",
2288
+ "error-timeout",
2289
+ "error-unknown",
2290
+ "error-blocked",
2291
+ "error-busy",
2292
+ "size-limit-entry",
2293
+ "size-limit-page",
2294
+ "dispatch-limit",
2295
+ "validation-failed",
2296
+ "envelope-invalid"
2297
+ ]);
2298
+ var ReservationSchema = z22.discriminatedUnion("variant", [
2299
+ z22.object({ variant: z22.literal("fixed"), widthPx: z22.number().optional(), heightPx: z22.number() }),
2300
+ z22.object({ variant: z22.literal("aspect"), aspectRatio: z22.number() }),
2301
+ z22.object({ variant: z22.literal("card"), size: z22.enum(["small", "medium", "large"]) })
2302
+ ]);
2303
+ var CrowiPlaceholderSidecarSchema = z22.object({
2304
+ kind: CrowiPlaceholderKindSchema,
2305
+ label: z22.string().max(512),
2306
+ reservation: ReservationSchema
2307
+ });
2308
+ var SIDECAR_KEYS = ["crowiCode", "crowiMath", "crowiDiagram", "crowiLinkCard", "crowiPlaceholder"];
2309
+ var noFields = z22.object({});
2310
+ var headingFields = z22.object({ depth: z22.number().int().min(1).max(6) });
2311
+ var valueFields = z22.object({ value: z22.string().max(AST_MAX_VALUE_CHARS) });
2312
+ var codeFields = z22.object({
2313
+ value: z22.string().max(AST_MAX_VALUE_CHARS),
2314
+ lang: z22.string().max(64).nullable().optional(),
2315
+ meta: z22.string().max(1024).nullable().optional()
2316
+ });
2317
+ var mathFields = z22.object({
2318
+ value: z22.string().max(AST_MAX_VALUE_CHARS),
2319
+ meta: z22.string().max(1024).nullable().optional()
2320
+ });
2321
+ var listFields = z22.object({
2322
+ ordered: z22.boolean().nullable().optional(),
2323
+ start: z22.number().int().nullable().optional(),
2324
+ spread: z22.boolean().nullable().optional()
2325
+ });
2326
+ var listItemFields = z22.object({
2327
+ checked: z22.boolean().nullable().optional(),
2328
+ spread: z22.boolean().nullable().optional()
2329
+ });
2330
+ var linkFields = z22.object({
2331
+ url: z22.string().max(4096),
2332
+ title: z22.string().max(512).nullable().optional()
2333
+ });
2334
+ var imageFields = z22.object({
2335
+ url: z22.string().max(4096),
2336
+ alt: z22.string().max(1024).nullable().optional(),
2337
+ title: z22.string().max(512).nullable().optional()
2338
+ });
2339
+ var tableFields = z22.object({
2340
+ align: z22.array(z22.enum(["left", "right", "center"]).nullable()).max(256).nullable().optional()
2341
+ });
2342
+ var definitionFields = z22.object({
2343
+ identifier: z22.string().max(256),
2344
+ url: z22.string().max(4096),
2345
+ label: z22.string().max(256).optional(),
2346
+ title: z22.string().max(512).nullable().optional()
2347
+ });
2348
+ var footnoteDefinitionFields = z22.object({
2349
+ identifier: z22.string().max(256),
2350
+ label: z22.string().max(256).optional()
2351
+ });
2352
+ var footnoteReferenceFields = footnoteDefinitionFields;
2353
+ var referenceTypeSchema = z22.enum(["shortcut", "collapsed", "full"]);
2354
+ var linkReferenceFields = z22.object({
2355
+ identifier: z22.string().max(256),
2356
+ referenceType: referenceTypeSchema,
2357
+ label: z22.string().max(256).optional()
2358
+ });
2359
+ var imageReferenceFields = z22.object({
2360
+ identifier: z22.string().max(256),
2361
+ referenceType: referenceTypeSchema,
2362
+ label: z22.string().max(256).optional(),
2363
+ alt: z22.string().max(1024).nullable().optional()
2364
+ });
2365
+ var crowiOpaqueFields = z22.object({
2366
+ reason: z22.enum(["unknown-type", "invalid-shape", "invalid-position"]),
2367
+ /** Best-effort diagnostics only — never a rendering hint. Truncated to 64 chars before assignment. */
2368
+ originalType: z22.string().max(64).optional()
2369
+ });
2370
+ var RENDERED_AST_NODE_DEFS = {
2371
+ root: { placement: "flow", childModel: "flow", fields: noFields },
2372
+ paragraph: { placement: "flow", childModel: "phrasing", fields: noFields },
2373
+ heading: { placement: "flow", childModel: "phrasing", fields: headingFields },
2374
+ thematicBreak: { placement: "flow", childModel: "none", fields: noFields },
2375
+ blockquote: { placement: "flow", childModel: "flow", fields: noFields },
2376
+ list: { placement: "flow", childModel: "listItems", fields: listFields },
2377
+ listItem: { placement: "listItems", childModel: "flow", fields: listItemFields },
2378
+ html: { placement: "both", childModel: "none", fields: valueFields },
2379
+ code: { placement: "flow", childModel: "none", fields: codeFields },
2380
+ inlineCode: { placement: "phrasing", childModel: "none", fields: valueFields },
2381
+ math: { placement: "flow", childModel: "none", fields: mathFields },
2382
+ inlineMath: { placement: "phrasing", childModel: "none", fields: mathFields },
2383
+ text: { placement: "phrasing", childModel: "none", fields: valueFields },
2384
+ strong: { placement: "phrasing", childModel: "phrasing", fields: noFields },
2385
+ emphasis: { placement: "phrasing", childModel: "phrasing", fields: noFields },
2386
+ delete: { placement: "phrasing", childModel: "phrasing", fields: noFields },
2387
+ break: { placement: "phrasing", childModel: "none", fields: noFields },
2388
+ link: { placement: "phrasing", childModel: "phrasing", fields: linkFields },
2389
+ image: { placement: "phrasing", childModel: "none", fields: imageFields },
2390
+ table: { placement: "flow", childModel: "tableRows", fields: tableFields },
2391
+ tableRow: { placement: "tableRows", childModel: "tableCells", fields: noFields },
2392
+ tableCell: { placement: "tableCells", childModel: "phrasing", fields: noFields },
2393
+ definition: { placement: "flow", childModel: "none", fields: definitionFields },
2394
+ footnoteDefinition: { placement: "flow", childModel: "flow", fields: footnoteDefinitionFields },
2395
+ footnoteReference: { placement: "phrasing", childModel: "none", fields: footnoteReferenceFields },
2396
+ linkReference: { placement: "phrasing", childModel: "phrasing", fields: linkReferenceFields },
2397
+ imageReference: { placement: "phrasing", childModel: "none", fields: imageReferenceFields },
2398
+ // Crowi-owned types. `crowiFigure` is the only one that also appears
2399
+ // in stored ASTs; the other three only exist as projection outputs
2400
+ // (or as defensively-validated plugin-injected nodes).
2401
+ crowiFigure: { placement: "flow", childModel: "phrasing", fields: noFields },
2402
+ crowiDiagram: { placement: "flow", childModel: "none", fields: CrowiDiagramSidecarSchema },
2403
+ crowiLinkCard: { placement: "flow", childModel: "none", fields: CrowiLinkCardSidecarSchema },
2404
+ crowiPlaceholder: { placement: "both", childModel: "none", fields: CrowiPlaceholderSidecarSchema },
2405
+ crowiOpaque: { placement: "both", childModel: "none", fields: crowiOpaqueFields }
2406
+ };
2407
+ var RenderedAstNodeSchema = z22.lazy(
2408
+ () => z22.discriminatedUnion("type", [
2409
+ RootNodeSchema,
2410
+ ParagraphNodeSchema,
2411
+ HeadingNodeSchema,
2412
+ ThematicBreakNodeSchema,
2413
+ BlockquoteNodeSchema,
2414
+ ListNodeSchema,
2415
+ ListItemNodeSchema,
2416
+ HtmlNodeSchema,
2417
+ CodeNodeSchema,
2418
+ InlineCodeNodeSchema,
2419
+ MathNodeSchema,
2420
+ InlineMathNodeSchema,
2421
+ TextNodeSchema,
2422
+ StrongNodeSchema,
2423
+ EmphasisNodeSchema,
2424
+ DeleteNodeSchema,
2425
+ BreakNodeSchema,
2426
+ LinkNodeSchema,
2427
+ ImageNodeSchema,
2428
+ TableNodeSchema,
2429
+ TableRowNodeSchema,
2430
+ TableCellNodeSchema,
2431
+ DefinitionNodeSchema,
2432
+ FootnoteDefinitionNodeSchema,
2433
+ FootnoteReferenceNodeSchema,
2434
+ LinkReferenceNodeSchema,
2435
+ ImageReferenceNodeSchema,
2436
+ CrowiFigureNodeSchema,
2437
+ CrowiDiagramNodeSchema,
2438
+ CrowiLinkCardNodeSchema,
2439
+ CrowiPlaceholderNodeSchema,
2440
+ CrowiOpaqueNodeSchema
2441
+ ])
2442
+ );
2443
+ var childrenSchema = z22.array(RenderedAstNodeSchema);
2444
+ var dataSchema = HastHintDataSchema.optional();
2445
+ var RootNodeSchema = z22.object({ type: z22.literal("root"), data: dataSchema, children: childrenSchema });
2446
+ var ParagraphNodeSchema = z22.object({ type: z22.literal("paragraph"), data: dataSchema, children: childrenSchema });
2447
+ var HeadingNodeSchema = headingFields.extend({ type: z22.literal("heading"), data: dataSchema, children: childrenSchema });
2448
+ var ThematicBreakNodeSchema = z22.object({ type: z22.literal("thematicBreak"), data: dataSchema });
2449
+ var BlockquoteNodeSchema = z22.object({ type: z22.literal("blockquote"), data: dataSchema, children: childrenSchema });
2450
+ var ListNodeSchema = listFields.extend({ type: z22.literal("list"), data: dataSchema, children: childrenSchema });
2451
+ var ListItemNodeSchema = listItemFields.extend({ type: z22.literal("listItem"), data: dataSchema, children: childrenSchema });
2452
+ var HtmlNodeSchema = valueFields.extend({ type: z22.literal("html"), data: dataSchema });
2453
+ var CodeDataSchema = HastHintDataSchema.extend({
2454
+ renderPending: z22.boolean().optional(),
2455
+ tokens: ShikiTokenLinesSchema.optional()
2456
+ }).optional();
2457
+ var CodeNodeSchema = codeFields.extend({ type: z22.literal("code"), data: CodeDataSchema });
2458
+ var InlineCodeNodeSchema = valueFields.extend({ type: z22.literal("inlineCode"), data: dataSchema });
2459
+ var MathNodeSchema = mathFields.extend({ type: z22.literal("math"), data: dataSchema });
2460
+ var InlineMathNodeSchema = mathFields.extend({ type: z22.literal("inlineMath"), data: dataSchema });
2461
+ var TextNodeSchema = valueFields.extend({ type: z22.literal("text"), data: dataSchema });
2462
+ var StrongNodeSchema = z22.object({ type: z22.literal("strong"), data: dataSchema, children: childrenSchema });
2463
+ var EmphasisNodeSchema = z22.object({ type: z22.literal("emphasis"), data: dataSchema, children: childrenSchema });
2464
+ var DeleteNodeSchema = z22.object({ type: z22.literal("delete"), data: dataSchema, children: childrenSchema });
2465
+ var BreakNodeSchema = z22.object({ type: z22.literal("break"), data: dataSchema });
2466
+ var LinkNodeSchema = linkFields.extend({ type: z22.literal("link"), data: dataSchema, children: childrenSchema });
2467
+ var ImageNodeSchema = imageFields.extend({ type: z22.literal("image"), data: dataSchema });
2468
+ var TableNodeSchema = tableFields.extend({ type: z22.literal("table"), data: dataSchema, children: childrenSchema });
2469
+ var TableRowNodeSchema = z22.object({ type: z22.literal("tableRow"), data: dataSchema, children: childrenSchema });
2470
+ var TableCellNodeSchema = z22.object({ type: z22.literal("tableCell"), data: dataSchema, children: childrenSchema });
2471
+ var DefinitionNodeSchema = definitionFields.extend({ type: z22.literal("definition"), data: dataSchema });
2472
+ var FootnoteDefinitionNodeSchema = footnoteDefinitionFields.extend({
2473
+ type: z22.literal("footnoteDefinition"),
2474
+ data: dataSchema,
2475
+ children: childrenSchema
2476
+ });
2477
+ var FootnoteReferenceNodeSchema = footnoteReferenceFields.extend({ type: z22.literal("footnoteReference"), data: dataSchema });
2478
+ var LinkReferenceNodeSchema = linkReferenceFields.extend({ type: z22.literal("linkReference"), data: dataSchema, children: childrenSchema });
2479
+ var ImageReferenceNodeSchema = imageReferenceFields.extend({ type: z22.literal("imageReference"), data: dataSchema });
2480
+ var CrowiFigureNodeSchema = z22.object({
2481
+ type: z22.literal("crowiFigure"),
2482
+ data: HastHintDataSchema.extend({ hName: z22.literal("figure"), hProperties: HPropertiesSchema }),
2483
+ children: childrenSchema
2484
+ });
2485
+ var CrowiDiagramNodeSchema = CrowiDiagramSidecarSchema.extend({ type: z22.literal("crowiDiagram"), data: dataSchema });
2486
+ var CrowiLinkCardNodeSchema = CrowiLinkCardSidecarSchema.extend({ type: z22.literal("crowiLinkCard"), data: dataSchema });
2487
+ var CrowiPlaceholderNodeSchema = CrowiPlaceholderSidecarSchema.extend({ type: z22.literal("crowiPlaceholder"), data: dataSchema });
2488
+ var CrowiOpaqueNodeSchema = crowiOpaqueFields.extend({ type: z22.literal("crowiOpaque"), data: dataSchema });
2489
+ var RenderedAstRootSchema = RootNodeSchema;
2490
+ var RenderedAstEnvelopeSchema = z22.object({
2491
+ astVersion: z22.literal(CURRENT_AST_VERSION),
2492
+ root: RenderedAstRootSchema
2493
+ });
2494
+ var RenderedAstEnvelopeOpenApiSchema = z22.object({
2495
+ astVersion: z22.literal(CURRENT_AST_VERSION),
2496
+ root: z22.unknown()
2497
+ }).openapi("RenderedAstEnvelope");
2498
+ var LooseRenderedAstRootSchema = z22.object({
2499
+ type: z22.literal("root"),
2500
+ children: z22.array(z22.unknown())
2501
+ }).openapi("LegacyRenderedAstRoot");
2502
+ var RenderedAstValueSchema = z22.union([RenderedAstEnvelopeOpenApiSchema, LooseRenderedAstRootSchema]);
2503
+ var RenderedAstArtifactKeySchema = z22.string().max(64);
2504
+ function unwrapRenderedAst(value) {
2505
+ if (value === void 0 || value === null) return void 0;
2506
+ if (typeof value !== "object") return void 0;
2507
+ if (value.astVersion === CURRENT_AST_VERSION) {
2508
+ const root = value.root;
2509
+ return root === null ? void 0 : root;
2510
+ }
2511
+ if (value.type === "root" && Array.isArray(value.children)) {
2512
+ return value;
2513
+ }
2514
+ return void 0;
2515
+ }
2516
+
2150
2517
  // src/schemas/page.ts
2151
- var PageGrantSchema = z22.enum(["1", "2", "3", "4"]).transform((val) => Number(val));
2518
+ var PageGrantSchema = z23.enum(["1", "2", "3", "4"]).transform((val) => Number(val));
2152
2519
  var PageGrantEnum = {
2153
2520
  PUBLIC: 1,
2154
2521
  RESTRICTED: 2,
2155
2522
  SPECIFIED: 3,
2156
2523
  OWNER: 4
2157
2524
  };
2158
- var PageStatusSchema = z22.enum(["wip", "published", "deleted", "deprecated", "draft"]);
2525
+ var PageStatusSchema = z23.enum(["wip", "published", "deleted", "deprecated", "draft"]);
2159
2526
  var PageStatusEnum = {
2160
2527
  WIP: "wip",
2161
2528
  PUBLISHED: "published",
@@ -2163,43 +2530,43 @@ var PageStatusEnum = {
2163
2530
  DEPRECATED: "deprecated",
2164
2531
  DRAFT: "draft"
2165
2532
  };
2166
- var PageTypeSchema = z22.enum(["portal", "user", "public"]);
2533
+ var PageTypeSchema = z23.enum(["portal", "user", "public"]);
2167
2534
  var PageTypeEnum = {
2168
2535
  PORTAL: "portal",
2169
2536
  USER: "user",
2170
2537
  PUBLIC: "public"
2171
2538
  };
2172
- var PageUserSchema = z22.object({
2173
- _id: z22.string(),
2174
- id: z22.string().optional(),
2539
+ var PageUserSchema = z23.object({
2540
+ _id: z23.string(),
2541
+ id: z23.string().optional(),
2175
2542
  // 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({
2543
+ username: z23.string(),
2544
+ name: z23.string(),
2545
+ email: z23.string().email(),
2546
+ image: z23.string().nullable().optional(),
2547
+ createdAt: z23.string()
2548
+ });
2549
+ var TocEntrySchema = z23.object({
2550
+ level: z23.number().int().min(1).max(6),
2551
+ text: z23.string(),
2552
+ anchorId: z23.string()
2553
+ });
2554
+ var WikiLinkSchema = z23.object({
2188
2555
  /** Verbatim source between the `[[` `]]` (no surrounding brackets). */
2189
- raw: z22.string(),
2556
+ raw: z23.string(),
2190
2557
  /** Normalised target (left of the `|`, fragment trimmed for resolution). */
2191
- target: z22.string(),
2558
+ target: z23.string(),
2192
2559
  /** Optional pipe-aliased display text (right of the `|`). */
2193
- displayText: z22.string().optional()
2560
+ displayText: z23.string().optional()
2194
2561
  });
2195
- var MentionSchema = z22.object({
2196
- username: z22.string()
2562
+ var MentionSchema = z23.object({
2563
+ username: z23.string()
2197
2564
  });
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(),
2565
+ var RevisionMetaSchemaShape = z23.object({
2566
+ toc: z23.array(TocEntrySchema).optional(),
2567
+ wikiLinks: z23.array(WikiLinkSchema).optional(),
2568
+ mentions: z23.array(MentionSchema).optional(),
2569
+ codeBlockLanguages: z23.array(z23.string()).optional(),
2203
2570
  // feature-backlink-raw-space-metadata: raw destinations recovered by
2204
2571
  // `renderer/core/raw-space-links.ts` (`[label](/a b)` — a raw-space
2205
2572
  // absolute path CommonMark itself rejects as a link). Verbatim, NOT
@@ -2207,58 +2574,66 @@ var RevisionMetaSchemaShape = z22.object({
2207
2574
  // `stripFragmentAndQuery` -> `decodeLinkPath` pipeline the regex-based
2208
2575
  // extraction path uses. Mirrors `wikiLinks` above: pushed by the core
2209
2576
  // transform into `PipelineMetadata`, persisted verbatim on `revision.meta`.
2210
- rawSpaceLinks: z22.array(z22.string()).optional()
2577
+ rawSpaceLinks: z23.array(z23.string()).optional()
2211
2578
  });
2212
- var RevisionSchema = z22.object({
2213
- _id: z22.string(),
2214
- path: z22.string(),
2215
- body: z22.string(),
2216
- format: z22.string().default("markdown"),
2579
+ var RevisionSchema = z23.object({
2580
+ _id: z23.string(),
2581
+ path: z23.string(),
2582
+ body: z23.string(),
2583
+ format: z23.string().default("markdown"),
2217
2584
  author: PageUserSchema.nullable().optional(),
2218
- createdAt: z22.string(),
2585
+ createdAt: z23.string(),
2219
2586
  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(),
2587
+ // RFC-0002 Phase 3 / RFC-0023: transformed mdast. Requests that
2588
+ // declare `X-Crowi-Ast-Version: 1` receive the typed envelope
2589
+ // (`{astVersion, root}`); everyone else (including the web,
2590
+ // permanently) receives the stored bare mdast `Root` verbatim and
2591
+ // unvalidated see `schemas/rendered-ast.ts` for the full contract.
2592
+ // Only single-page detail (`getPage`), the listPages portal document
2593
+ // and single-revision detail (`getRevision`) emit it; list rows skip
2594
+ // it for payload weight.
2595
+ renderedAst: RenderedAstValueSchema.optional(),
2596
+ // RFC-0023 (design doc §14): identity of the served AST artifact —
2597
+ // `rendererVersion` for a verbatim stored AST, a per-response nonce
2598
+ // when the served tree differs from the stored one (pending-marker
2599
+ // retry / freshness-mismatch recompute). The web render memo keys on
2600
+ // `[revisionId, renderedAstArtifactKey]`.
2601
+ renderedAstArtifactKey: RenderedAstArtifactKeySchema.optional(),
2227
2602
  // RFC-0002 round 3.1: semver of the renderer pipeline that produced
2228
2603
  // `renderedAst`. The read path uses this to detect stale entries
2229
2604
  // (rebuilt by `renderer:rebuild` once RFC-0008 lands). Absent on
2230
2605
  // revisions saved before this field was introduced.
2231
- rendererVersion: z22.string().optional(),
2606
+ rendererVersion: z23.string().optional(),
2232
2607
  // RFC-0003 collaborative-save fields. All optional; v1.x revisions
2233
2608
  // emit none of them. See `packages/api/src/models/revision.ts` for
2234
2609
  // semantics. The list-page endpoint currently does not surface
2235
2610
  // these — they only appear on the Phase 5+ checkpoint Revisions
2236
2611
  // produced by Hocuspocus and on the single-revision detail route.
2237
- parentRevisionId: z22.string().nullable().optional(),
2612
+ parentRevisionId: z23.string().nullable().optional(),
2238
2613
  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(),
2614
+ savedBy: z23.union([z23.string(), PageUserSchema]).nullable().optional(),
2615
+ contributors: z23.array(z23.union([z23.string(), PageUserSchema])).optional(),
2616
+ message: z23.string().optional(),
2242
2617
  // RFC-0010 — edit channel ('web' | 'oauth' | 'pat'); absent on
2243
2618
  // 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(),
2619
+ editVia: z23.enum(["web", "oauth", "pat"]).optional()
2620
+ });
2621
+ var PageExtendedSchema = z23.record(z23.string(), z23.any()).optional();
2622
+ var PageSchema = z23.object({
2623
+ _id: z23.string(),
2624
+ path: z23.string(),
2625
+ revision: z23.union([z23.string(), RevisionSchema]).optional(),
2626
+ redirectTo: z23.string().nullable().optional(),
2252
2627
  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),
2628
+ grant: z23.number().optional(),
2629
+ grantedUsers: z23.array(z23.string()).optional(),
2630
+ creator: z23.union([z23.string(), PageUserSchema]).nullable().optional(),
2631
+ lastUpdateUser: z23.union([z23.string(), PageUserSchema]).nullable().optional(),
2632
+ liker: z23.array(z23.string()).optional(),
2633
+ commentCount: z23.number().default(0),
2259
2634
  extended: PageExtendedSchema,
2260
- createdAt: z22.string(),
2261
- updatedAt: z22.string().optional(),
2635
+ createdAt: z23.string(),
2636
+ updatedAt: z23.string().optional(),
2262
2637
  // RFC-0003 collaborative-edit fields. All optional; `null` is the
2263
2638
  // "no live state yet" value. Existing read endpoints (list /
2264
2639
  // detail) do not currently emit these — the contract is widened
@@ -2266,32 +2641,32 @@ var PageSchema = z22.object({
2266
2641
  // bump. `yjsState` is intentionally omitted from the contract:
2267
2642
  // the binary blob lives only inside Hocuspocus and never crosses
2268
2643
  // the HTTP API.
2269
- currentRevision: z22.string().nullable().optional(),
2270
- yjsCheckpointAt: z22.string().nullable().optional(),
2644
+ currentRevision: z23.string().nullable().optional(),
2645
+ yjsCheckpointAt: z23.string().nullable().optional(),
2271
2646
  // dynamic fields
2272
- latestRevision: z22.string().optional(),
2273
- likerCount: z22.number().optional(),
2274
- seenUsersCount: z22.number().optional()
2647
+ latestRevision: z23.string().optional(),
2648
+ likerCount: z23.number().optional(),
2649
+ seenUsersCount: z23.number().optional()
2275
2650
  });
2276
2651
  var PageWithRevisionSchema = PageSchema.extend({
2277
2652
  revision: RevisionSchema,
2278
2653
  creator: PageUserSchema.nullable().optional(),
2279
2654
  lastUpdateUser: PageUserSchema.nullable().optional()
2280
2655
  });
2281
- var GetPageRequestSchema = z22.object({
2282
- path: z22.string().optional(),
2283
- page_id: z22.string().optional(),
2284
- revision_id: z22.string().optional()
2656
+ var GetPageRequestSchema = z23.object({
2657
+ path: z23.string().optional(),
2658
+ page_id: z23.string().optional(),
2659
+ revision_id: z23.string().optional()
2285
2660
  });
2286
- var GetPageResponseSchema = z22.object({
2661
+ var GetPageResponseSchema = z23.object({
2287
2662
  page: PageWithRevisionSchema
2288
2663
  });
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),
2664
+ var ClaimPageLinkAccessResponseSchema = GetPageResponseSchema.extend({ granted: z23.boolean() });
2665
+ var ListPagesRequestSchema = z23.object({
2666
+ path: z23.string().optional(),
2667
+ user: z23.string().optional(),
2668
+ limit: z23.coerce.number().optional().default(50),
2669
+ offset: z23.coerce.number().optional().default(0),
2295
2670
  // NOT `z.coerce.boolean()`: that uses JS `Boolean(v)`, so the string
2296
2671
  // `"false"` (which is how the web client serialises `false` on the
2297
2672
  // query string) coerces to `true`. That silently flipped
@@ -2299,25 +2674,25 @@ var ListPagesRequestSchema = z22.object({
2299
2674
  // filter and leak other users' drafts. Parse the string explicitly so
2300
2675
  // only `"true"` / `true` is truthy; anything else (incl. `"false"`,
2301
2676
  // absent) is `false`.
2302
- include_deleted: z22.preprocess((v) => v === true || v === "true" || v === "1", z22.boolean()).optional().default(false),
2677
+ include_deleted: z23.preprocess((v) => v === true || v === "true" || v === "1", z23.boolean()).optional().default(false),
2303
2678
  // Sort field + direction for the listing. Defaults preserve the legacy
2304
2679
  // "newest-updated first" order so existing callers are unaffected.
2305
2680
  // `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"),
2681
+ sort: z23.enum(["updatedAt", "createdAt", "path"]).optional().default("updatedAt"),
2682
+ order: z23.enum(["asc", "desc"]).optional().default("desc"),
2308
2683
  // When listing a portal path (`/foo/`), open the portal document at this
2309
2684
  // past revision so the catch-all can mirror `?revision_id=` on portals.
2310
2685
  // Only the `portalPage` is rewound — the child rows always reflect the
2311
2686
  // latest. Absent for normal listings.
2312
- revision_id: z22.string().optional()
2687
+ revision_id: z23.string().optional()
2313
2688
  });
2314
- var PagerSchema = z22.object({
2315
- prev: z22.number().nullable(),
2316
- next: z22.number().nullable(),
2317
- offset: z22.number()
2689
+ var PagerSchema = z23.object({
2690
+ prev: z23.number().nullable(),
2691
+ next: z23.number().nullable(),
2692
+ offset: z23.number()
2318
2693
  });
2319
- var ListPagesResponseSchema = z22.object({
2320
- pages: z22.array(PageSchema),
2694
+ var ListPagesResponseSchema = z23.object({
2695
+ pages: z23.array(PageSchema),
2321
2696
  pager: PagerSchema,
2322
2697
  portalPage: PageSchema.nullable().optional(),
2323
2698
  // When listing a portal path (`/foo/`) that has NO portal document of
@@ -2327,144 +2702,151 @@ var ListPagesResponseSchema = z22.object({
2327
2702
  // (feature-update-pages-list-ux §4). Mutually exclusive with `portalPage`
2328
2703
  // — only set when `portalPage` is null. Absent / null for ordinary
2329
2704
  // listings.
2330
- contentPage: PageSchema.nullable().optional()
2705
+ contentPage: PageSchema.nullable().optional(),
2706
+ // feature-profile-stats-and-page-total — the exact count of the viewer-
2707
+ // visible set `pages` pages from (i.e. matching `pages`' visibility
2708
+ // conditions, independent of `limit`/`offset`, and excluding whichever
2709
+ // ids `portalPage`/`contentPage` already removed from `pages`). Not part
2710
+ // of `PagerSchema` — mirrors `ListUsersResponseSchema.total`, a sibling
2711
+ // top-level field alongside `pager`.
2712
+ total: z23.number()
2331
2713
  });
2332
- var PageChildSegmentSchema = z22.object({
2714
+ var PageChildSegmentSchema = z23.object({
2333
2715
  // The bare segment name immediately under the queried path
2334
2716
  // (e.g. 'rfc' for /crowi/rfc/... when querying /crowi/).
2335
- segment: z22.string(),
2717
+ segment: z23.string(),
2336
2718
  // Portal-style path for this segment (always trailing-slashed),
2337
2719
  // e.g. '/crowi/rfc/'. Drop the trailing slash for the page path when
2338
2720
  // the segment is a leaf page (see `isPage`).
2339
- path: z22.string(),
2721
+ path: z23.string(),
2340
2722
  // True when a real page is saved at the segment path itself
2341
2723
  // (e.g. `/crowi/rfc`, no trailing slash) — i.e. the segment is a
2342
2724
  // navigable page, not only an inferred directory.
2343
- isPage: z22.boolean(),
2725
+ isPage: z23.boolean(),
2344
2726
  // True when a real portal page is saved at `path` (→ compass icon).
2345
- hasPortal: z22.boolean(),
2727
+ hasPortal: z23.boolean(),
2346
2728
  // Number of descendant content pages strictly under this segment
2347
2729
  // (excludes the segment's own page / portal docs). A rough "how much
2348
2730
  // lives here" hint; > 0 means the segment is an expandable directory.
2349
- count: z22.number(),
2731
+ count: z23.number(),
2350
2732
  // ISO8601 timestamp of the segment's representative page: the segment's
2351
2733
  // own page when `isPage` is true, otherwise the most-recently-updated
2352
2734
  // descendant (including the portal doc itself). `null` when no
2353
2735
  // representative page's timestamp could be derived. Optional so
2354
2736
  // existing clients (web SidebarTree) that don't read it keep working
2355
2737
  // unchanged — additive contract extension, feature-child-segments-metadata.
2356
- lastUpdatedAt: z22.string().nullable().optional(),
2738
+ lastUpdatedAt: z23.string().nullable().optional(),
2357
2739
  // The representative page's last updater (same page as `lastUpdatedAt`
2358
2740
  // above). `null` when the updater can't be resolved (e.g. a deleted
2359
2741
  // user, or legacy rows predating `lastUpdateUser`).
2360
2742
  updater: PageUserSchema.nullable().optional()
2361
2743
  });
2362
- var ListPageChildrenRequestSchema = z22.object({
2744
+ var ListPageChildrenRequestSchema = z23.object({
2363
2745
  // Portal path to list children of. Trailing slash optional — the
2364
2746
  // handler normalises it. '/' lists the top-level segments.
2365
- path: z22.string()
2747
+ path: z23.string()
2366
2748
  });
2367
- var ListPageChildrenResponseSchema = z22.object({
2749
+ var ListPageChildrenResponseSchema = z23.object({
2368
2750
  // 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(),
2751
+ children: z23.array(PageChildSegmentSchema)
2752
+ });
2753
+ var CreatePageRequestSchema = z23.object({
2754
+ path: z23.string(),
2755
+ body: z23.string(),
2756
+ grant: z23.number().optional()
2757
+ });
2758
+ var UpdatePageRequestSchema = z23.object({
2759
+ page_id: z23.string(),
2760
+ body: z23.string(),
2761
+ revision_id: z23.string().optional(),
2762
+ grant: z23.number().optional()
2763
+ });
2764
+ var RevertToRevisionRequestSchema = z23.object({
2765
+ page_id: z23.string(),
2766
+ revision_id: z23.string()
2767
+ });
2768
+ var SetPageGrantRequestSchema = z23.object({
2769
+ page_id: z23.string(),
2770
+ grant: z23.number().int()
2771
+ });
2772
+ var RenamePageRequestSchema = z23.object({
2773
+ page_id: z23.string(),
2774
+ new_path: z23.string(),
2775
+ revision_id: z23.string().optional(),
2776
+ create_redirect: z23.boolean().optional(),
2395
2777
  // When true, rename the page together with its whole (grant-visible)
2396
2778
  // descendant subtree (renameTree) instead of just the single page.
2397
2779
  // Defaults to false — the single-page rename behaviour.
2398
- include_descendants: z22.boolean().optional()
2780
+ include_descendants: z23.boolean().optional()
2399
2781
  });
2400
- var RenamePageResponseSchema = z22.object({
2782
+ var RenamePageResponseSchema = z23.object({
2401
2783
  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())
2784
+ renamed_count: z23.number()
2785
+ });
2786
+ var RenameTreeErrorSchema = z23.object({
2787
+ error: z23.object({
2788
+ code: z23.literal("PAGE_RENAME_TREE_FAILED"),
2789
+ message: z23.string(),
2790
+ conflicts: z23.array(
2791
+ z23.object({
2792
+ path: z23.string(),
2793
+ reasons: z23.array(z23.string())
2412
2794
  })
2413
2795
  ),
2414
2796
  // True when the failure happened after some pages were already moved
2415
2797
  // (non-transactional best-effort). When omitted/false the failure was
2416
2798
  // detected up-front and nothing was moved.
2417
- partial: z22.boolean().optional()
2799
+ partial: z23.boolean().optional()
2418
2800
  })
2419
2801
  });
2420
- var RenameSubtreeRequestSchema = z22.object({
2421
- old_path: z22.string(),
2422
- new_path: z22.string(),
2423
- create_redirect: z22.boolean().optional()
2802
+ var RenameSubtreeRequestSchema = z23.object({
2803
+ old_path: z23.string(),
2804
+ new_path: z23.string(),
2805
+ create_redirect: z23.boolean().optional()
2424
2806
  });
2425
- var RenameSubtreeResponseSchema = z22.object({
2426
- renamed_count: z22.number()
2807
+ var RenameSubtreeResponseSchema = z23.object({
2808
+ renamed_count: z23.number()
2427
2809
  });
2428
- var PageNotFoundErrorSchema = z22.object({
2429
- error: z22.object({
2430
- code: z22.literal("PAGE_NOT_FOUND"),
2431
- message: z22.literal("Page not found")
2810
+ var PageNotFoundErrorSchema = z23.object({
2811
+ error: z23.object({
2812
+ code: z23.literal("PAGE_NOT_FOUND"),
2813
+ message: z23.literal("Page not found")
2432
2814
  })
2433
2815
  });
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")
2816
+ var PageNotGrantedErrorSchema = z23.object({
2817
+ error: z23.object({
2818
+ code: z23.literal("PAGE_NOT_GRANTED"),
2819
+ message: z23.literal("Page is not granted for the user")
2438
2820
  })
2439
2821
  });
2440
- var PageRevisionErrorSchema = z22.object({
2441
- error: z22.object({
2442
- code: z22.literal("PAGE_REVISION_ERROR"),
2443
- message: z22.string()
2822
+ var PageRevisionErrorSchema = z23.object({
2823
+ error: z23.object({
2824
+ code: z23.literal("PAGE_REVISION_ERROR"),
2825
+ message: z23.string()
2444
2826
  })
2445
2827
  });
2446
- var SeenPageRequestSchema = z22.object({
2447
- page_id: z22.string()
2828
+ var SeenPageRequestSchema = z23.object({
2829
+ page_id: z23.string()
2448
2830
  });
2449
- var SeenUsersResponseSchema = z22.object({
2450
- seenUsers: z22.array(UserPublicSchema),
2451
- seenUsersCount: z22.number()
2831
+ var SeenUsersResponseSchema = z23.object({
2832
+ seenUsers: z23.array(UserPublicSchema),
2833
+ seenUsersCount: z23.number()
2452
2834
  });
2453
- var GetSeenUsersRequestSchema = z22.object({
2454
- page_id: z22.string(),
2835
+ var GetSeenUsersRequestSchema = z23.object({
2836
+ page_id: z23.string(),
2455
2837
  // Optional cap on returned `seenUsers`. `seenUsersCount` always reflects
2456
2838
  // the full count regardless of `limit`. Omit for the full list.
2457
- limit: z22.coerce.number().int().positive().optional()
2839
+ limit: z23.coerce.number().int().positive().optional()
2458
2840
  });
2459
- var GetWatchStatusRequestSchema = z22.object({
2460
- page_id: z22.string()
2841
+ var GetWatchStatusRequestSchema = z23.object({
2842
+ page_id: z23.string()
2461
2843
  });
2462
- var WatchStatusResponseSchema = z22.object({
2463
- watching: z22.boolean()
2844
+ var WatchStatusResponseSchema = z23.object({
2845
+ watching: z23.boolean()
2464
2846
  });
2465
- var SetWatchStatusRequestSchema = z22.object({
2466
- page_id: z22.string(),
2467
- watching: z22.boolean()
2847
+ var SetWatchStatusRequestSchema = z23.object({
2848
+ page_id: z23.string(),
2849
+ watching: z23.boolean()
2468
2850
  });
2469
2851
 
2470
2852
  // src/contracts/backlink.ts
@@ -2504,88 +2886,95 @@ var backlinkRoutes = {
2504
2886
  import { createRoute as createRoute13 } from "@hono/zod-openapi";
2505
2887
 
2506
2888
  // src/schemas/bookmark.ts
2507
- import { z as z23 } from "@hono/zod-openapi";
2508
- var BookmarkSchema = z23.object({
2509
- _id: z23.string(),
2889
+ import { z as z24 } from "@hono/zod-openapi";
2890
+ var BookmarkSchema = z24.object({
2891
+ _id: z24.string(),
2510
2892
  page: PageSchema,
2511
- user: z23.union([z23.string(), UserPublicSchema]),
2512
- createdAt: z23.string()
2893
+ user: z24.union([z24.string(), UserPublicSchema]),
2894
+ createdAt: z24.string()
2513
2895
  });
2514
- var GetBookmarkRequestSchema = z23.object({
2515
- page_id: z23.string()
2896
+ var GetBookmarkRequestSchema = z24.object({
2897
+ page_id: z24.string()
2516
2898
  });
2517
- var BookmarkResponseSchema = z23.object({
2899
+ var BookmarkResponseSchema = z24.object({
2518
2900
  bookmark: BookmarkSchema.nullable()
2519
2901
  });
2520
- var ListMyBookmarksResponseSchema = z23.object({
2521
- bookmarks: z23.array(BookmarkSchema),
2902
+ var ListMyBookmarksResponseSchema = z24.object({
2903
+ bookmarks: z24.array(BookmarkSchema),
2522
2904
  pager: PagerSchema,
2523
- total: z23.number()
2905
+ total: z24.number()
2524
2906
  });
2525
- var AddBookmarkRequestSchema = z23.object({
2526
- page_id: z23.string()
2907
+ var AddBookmarkRequestSchema = z24.object({
2908
+ page_id: z24.string()
2527
2909
  });
2528
- var RemoveBookmarkRequestSchema = z23.object({
2529
- page_id: z23.string()
2910
+ var RemoveBookmarkRequestSchema = z24.object({
2911
+ page_id: z24.string()
2530
2912
  });
2531
- var RemoveBookmarkResponseSchema = z23.object({
2532
- ok: z23.literal(true)
2913
+ var RemoveBookmarkResponseSchema = z24.object({
2914
+ ok: z24.literal(true)
2533
2915
  });
2534
2916
 
2535
2917
  // 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));
2918
+ import { z as z25 } from "@hono/zod-openapi";
2919
+ var UserStatusSchema = z25.enum(["1", "2", "3", "4", "5"]).transform((val) => Number(val));
2538
2920
  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)
2921
+ var UserLanguageSchema = z25.enum(["en", "ja"]);
2922
+ var PaginationRequestSchema = z25.object({
2923
+ limit: z25.coerce.number().optional().default(50),
2924
+ offset: z25.coerce.number().optional().default(0)
2543
2925
  });
2544
- var UserListItemSchema = z24.object({
2545
- _id: z24.string(),
2546
- username: z24.string(),
2547
- name: z24.string(),
2548
- image: z24.string().nullable().optional()
2926
+ var UserListItemSchema = z25.object({
2927
+ _id: z25.string(),
2928
+ username: z25.string(),
2929
+ name: z25.string(),
2930
+ image: z25.string().nullable().optional()
2549
2931
  });
2550
- var ListUsersRequestSchema = z24.object({
2551
- q: z24.string().optional(),
2932
+ var ListUsersRequestSchema = z25.object({
2933
+ q: z25.string().optional(),
2552
2934
  // Cap the page size so a client can't request the whole user table in one
2553
2935
  // 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)
2936
+ limit: z25.coerce.number().int().min(1).max(100).optional().default(24),
2937
+ offset: z25.coerce.number().int().min(0).optional().default(0)
2556
2938
  });
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)
2939
+ var UserSubpagesRequestSchema = z25.object({
2940
+ limit: z25.coerce.number().int().min(1).max(50).optional().default(30),
2941
+ offset: z25.coerce.number().int().min(0).optional().default(0)
2560
2942
  });
2561
- var ListUsersResponseSchema = z24.object({
2562
- users: z24.array(UserListItemSchema),
2943
+ var ListUsersResponseSchema = z25.object({
2944
+ users: z25.array(UserListItemSchema),
2563
2945
  pager: PagerSchema,
2564
- total: z24.number()
2946
+ total: z25.number()
2565
2947
  });
2566
- var UserPageResponseSchema = z24.object({
2948
+ var UserPageResponseSchema = z25.object({
2567
2949
  user: UserPublicSchema,
2568
2950
  // Page statistics
2569
- createdPagesCount: z24.number(),
2570
- bookmarksCount: z24.number(),
2951
+ createdPagesCount: z25.number(),
2952
+ bookmarksCount: z25.number(),
2953
+ // feature-profile-stats-and-page-total — the target user's OWN actions:
2954
+ // pages they liked (`Page.liker` contains their id) and comments they
2955
+ // wrote (`Comment.creator` is their id). NOT activity their own pages
2956
+ // received from others, and not re-filtered by the viewer's grants —
2957
+ // see the spec's "プロフィール統計の主語と API 契約" section.
2958
+ likesCount: z25.number(),
2959
+ commentsCount: z25.number(),
2571
2960
  // Optionally include recent items for initial display
2572
- recentPages: z24.array(PageSchema).optional(),
2573
- recentBookmarks: z24.array(BookmarkSchema).optional()
2961
+ recentPages: z25.array(PageSchema).optional(),
2962
+ recentBookmarks: z25.array(BookmarkSchema).optional()
2574
2963
  });
2575
- var UserBookmarksResponseSchema = z24.object({
2576
- bookmarks: z24.array(BookmarkSchema),
2964
+ var UserBookmarksResponseSchema = z25.object({
2965
+ bookmarks: z25.array(BookmarkSchema),
2577
2966
  pager: PagerSchema,
2578
- total: z24.number()
2967
+ total: z25.number()
2579
2968
  });
2580
- var UserPagesResponseSchema = z24.object({
2581
- pages: z24.array(PageSchema),
2969
+ var UserPagesResponseSchema = z25.object({
2970
+ pages: z25.array(PageSchema),
2582
2971
  pager: PagerSchema,
2583
- total: z24.number()
2972
+ total: z25.number()
2584
2973
  });
2585
- var UserNotFoundErrorSchema = z24.object({
2586
- error: z24.object({
2587
- code: z24.literal("USER_NOT_FOUND"),
2588
- message: z24.literal("User not found")
2974
+ var UserNotFoundErrorSchema = z25.object({
2975
+ error: z25.object({
2976
+ code: z25.literal("USER_NOT_FOUND"),
2977
+ message: z25.literal("User not found")
2589
2978
  })
2590
2979
  });
2591
2980
 
@@ -2713,51 +3102,51 @@ var bookmarkRoutes = {
2713
3102
  import { createRoute as createRoute14 } from "@hono/zod-openapi";
2714
3103
 
2715
3104
  // 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(),
3105
+ import { z as z26 } from "@hono/zod-openapi";
3106
+ var CommentSchema = z26.object({
3107
+ _id: z26.string(),
3108
+ page: z26.string(),
2720
3109
  // 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({
3110
+ creator: z26.union([z26.string(), PageUserSchema]).nullable(),
3111
+ revision: z26.string(),
3112
+ comment: z26.string(),
3113
+ commentPosition: z26.number().default(-1),
3114
+ createdAt: z26.string()
3115
+ });
3116
+ var ListCommentsRequestSchema = z26.object({
3117
+ page_id: z26.string().optional(),
3118
+ revision_id: z26.string().optional()
3119
+ });
3120
+ var ListCommentsResponseSchema = z26.object({
3121
+ comments: z26.array(CommentSchema)
3122
+ });
3123
+ var AddCommentRequestSchema = z26.object({
3124
+ page_id: z26.string().min(1, "page_id is required"),
3125
+ revision_id: z26.string().min(1, "revision_id is required"),
3126
+ comment: z26.string().min(1, "comment is required"),
3127
+ comment_position: z26.number().int().optional()
3128
+ });
3129
+ var AddCommentResponseSchema = z26.object({
2741
3130
  comment: CommentSchema,
2742
- newlyWatching: z25.boolean()
3131
+ newlyWatching: z26.boolean()
2743
3132
  });
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")
3133
+ var DeleteCommentRequestSchema = z26.object({
3134
+ comment_id: z26.string().min(1, "comment_id is required"),
3135
+ page_id: z26.string().min(1, "page_id is required")
2747
3136
  });
2748
- var DeleteCommentResponseSchema = z25.object({
2749
- ok: z25.literal(true)
3137
+ var DeleteCommentResponseSchema = z26.object({
3138
+ ok: z26.literal(true)
2750
3139
  });
2751
- var CommentNotFoundErrorSchema = z25.object({
2752
- error: z25.object({
2753
- code: z25.literal("COMMENT_NOT_FOUND"),
2754
- message: z25.literal("Comment not found")
3140
+ var CommentNotFoundErrorSchema = z26.object({
3141
+ error: z26.object({
3142
+ code: z26.literal("COMMENT_NOT_FOUND"),
3143
+ message: z26.literal("Comment not found")
2755
3144
  })
2756
3145
  });
2757
- var CommentInvalidRequestErrorSchema = z25.object({
2758
- error: z25.object({
2759
- code: z25.literal("INVALID_REQUEST"),
2760
- message: z25.string()
3146
+ var CommentInvalidRequestErrorSchema = z26.object({
3147
+ error: z26.object({
3148
+ code: z26.literal("INVALID_REQUEST"),
3149
+ message: z26.string()
2761
3150
  })
2762
3151
  });
2763
3152
 
@@ -2861,48 +3250,48 @@ var commentRoutes = {
2861
3250
  };
2862
3251
 
2863
3252
  // src/contracts/draft.ts
2864
- import { createRoute as createRoute15, z as z27 } from "@hono/zod-openapi";
3253
+ import { createRoute as createRoute15, z as z28 } from "@hono/zod-openapi";
2865
3254
 
2866
3255
  // 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()
3256
+ import { z as z27 } from "@hono/zod-openapi";
3257
+ var CreateDraftRequestSchema = z27.object({
3258
+ path: z27.string().min(1),
3259
+ initialBody: z27.string().optional()
2871
3260
  });
2872
- var CreateDraftResponseSchema = z26.object({
2873
- pageId: z26.string()
3261
+ var CreateDraftResponseSchema = z27.object({
3262
+ pageId: z27.string()
2874
3263
  });
2875
- var DraftConflictOwnerSchema = z26.object({
2876
- id: z26.string(),
2877
- username: z26.string(),
2878
- displayName: z26.string()
3264
+ var DraftConflictOwnerSchema = z27.object({
3265
+ id: z27.string(),
3266
+ username: z27.string(),
3267
+ displayName: z27.string()
2879
3268
  });
2880
- var DraftPathConflictErrorSchema = z26.object({
2881
- error: z26.literal("path_taken_by_draft"),
3269
+ var DraftPathConflictErrorSchema = z27.object({
3270
+ error: z27.literal("path_taken_by_draft"),
2882
3271
  owner: DraftConflictOwnerSchema,
2883
- message: z26.string()
3272
+ message: z27.string()
2884
3273
  });
2885
- var DraftBadRequestErrorSchema = z26.object({
2886
- error: z26.enum(["invalid_path", "path_taken"]),
2887
- message: z26.string()
3274
+ var DraftBadRequestErrorSchema = z27.object({
3275
+ error: z27.enum(["invalid_path", "path_taken"]),
3276
+ message: z27.string()
2888
3277
  });
2889
- var DraftNotFoundErrorSchema = z26.object({
2890
- error: z26.literal("draft_not_found"),
2891
- message: z26.string()
3278
+ var DraftNotFoundErrorSchema = z27.object({
3279
+ error: z27.literal("draft_not_found"),
3280
+ message: z27.string()
2892
3281
  });
2893
- var DraftSummarySchema = z26.object({
2894
- pageId: z26.string(),
2895
- path: z26.string(),
2896
- createdAt: z26.string(),
2897
- updatedAt: z26.string()
3282
+ var DraftSummarySchema = z27.object({
3283
+ pageId: z27.string(),
3284
+ path: z27.string(),
3285
+ createdAt: z27.string(),
3286
+ updatedAt: z27.string()
2898
3287
  });
2899
- var ListDraftsResponseSchema = z26.object({
2900
- drafts: z26.array(DraftSummarySchema)
3288
+ var ListDraftsResponseSchema = z27.object({
3289
+ drafts: z27.array(DraftSummarySchema)
2901
3290
  });
2902
3291
 
2903
3292
  // src/contracts/draft.ts
2904
- var DraftIdPathParamsSchema = z27.object({
2905
- id: z27.string().openapi({ description: "Draft page id (24-char hex ObjectId)", example: "507f1f77bcf86cd799439011" })
3293
+ var DraftIdPathParamsSchema = z28.object({
3294
+ id: z28.string().openapi({ description: "Draft page id (24-char hex ObjectId)", example: "507f1f77bcf86cd799439011" })
2906
3295
  });
2907
3296
  var createDraftRoute = createRoute15({
2908
3297
  method: "post",
@@ -2985,22 +3374,22 @@ var draftRoutes = {
2985
3374
  import { createRoute as createRoute16 } from "@hono/zod-openapi";
2986
3375
 
2987
3376
  // 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")
3377
+ import { z as z29 } from "@hono/zod-openapi";
3378
+ var InstallerStatusResponseSchema = z29.object({
3379
+ status: z29.enum(["installer_required", "already_installed"])
3380
+ });
3381
+ var CreateAdminRequestSchema = z29.object({
3382
+ registerForm: z29.object({
3383
+ username: z29.string().min(1).regex(/^[\da-zA-Z\-_.]+$/, "username may only contain letters, digits, hyphens, underscores, and dots"),
3384
+ name: z29.string().min(1),
3385
+ email: z29.string().email(),
3386
+ password: z29.string().min(6).regex(/^[\x20-\x7F]{6,}$/, "password must be 6+ printable ASCII characters")
2998
3387
  })
2999
3388
  });
3000
- var CreateAdminResponseSchema = z28.object({
3001
- status: z28.enum(["ok", "error"]),
3002
- message: z28.string().optional(),
3003
- errors: z28.array(z28.string()).optional()
3389
+ var CreateAdminResponseSchema = z29.object({
3390
+ status: z29.enum(["ok", "error"]),
3391
+ message: z29.string().optional(),
3392
+ errors: z29.array(z29.string()).optional()
3004
3393
  });
3005
3394
 
3006
3395
  // src/contracts/installer.ts
@@ -3072,84 +3461,84 @@ var createAdminRoute = createRoute16({
3072
3461
  var installerRoutes = { getInstallerStatusRoute, createAdminRoute };
3073
3462
 
3074
3463
  // src/contracts/me.ts
3075
- import { createRoute as createRoute17, z as z30 } from "@hono/zod-openapi";
3464
+ import { createRoute as createRoute17, z as z31 } from "@hono/zod-openapi";
3076
3465
 
3077
3466
  // 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(),
3467
+ import { z as z30 } from "@hono/zod-openapi";
3468
+ var LanguageSchema = z30.enum(["en", "ja"]);
3469
+ var ThemeSchema = z30.enum(["system", "light", "dark"]);
3470
+ var UserProfileResponseSchema = z30.object({
3471
+ id: z30.string(),
3472
+ username: z30.string(),
3473
+ name: z30.string(),
3474
+ email: z30.string().email(),
3086
3475
  lang: LanguageSchema,
3087
3476
  theme: ThemeSchema,
3088
- image: z29.string().nullable(),
3089
- introduction: z29.string().optional(),
3090
- hasPassword: z29.boolean(),
3091
- createdAt: z29.string(),
3477
+ image: z30.string().nullable(),
3478
+ introduction: z30.string().optional(),
3479
+ hasPassword: z30.boolean(),
3480
+ createdAt: z30.string(),
3092
3481
  /**
3093
3482
  * True when the profile update requested a new email that is awaiting
3094
3483
  * confirmation: the stored `email` is unchanged and a confirmation
3095
3484
  * link was sent to the new address.
3096
3485
  */
3097
- emailChangePending: z29.boolean().optional()
3486
+ emailChangePending: z30.boolean().optional()
3098
3487
  });
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"),
3488
+ var UpdateProfileRequestSchema = z30.object({
3489
+ userForm: z30.object({
3490
+ name: z30.string().min(1, "Name is required"),
3491
+ email: z30.string().email("Invalid email format"),
3103
3492
  lang: LanguageSchema
3104
3493
  })
3105
3494
  });
3106
- var UpdateThemeRequestSchema = z29.object({
3495
+ var UpdateThemeRequestSchema = z30.object({
3107
3496
  theme: ThemeSchema
3108
3497
  });
3109
- var ThemeUpdateResponseSchema = z29.object({
3110
- status: z29.literal("ok"),
3498
+ var ThemeUpdateResponseSchema = z30.object({
3499
+ status: z30.literal("ok"),
3111
3500
  theme: ThemeSchema
3112
3501
  });
3113
- var PictureUploadResponseSchema = z29.object({
3114
- status: z29.boolean(),
3115
- url: z29.string().optional(),
3116
- message: z29.string().optional()
3502
+ var PictureUploadResponseSchema = z30.object({
3503
+ status: z30.boolean(),
3504
+ url: z30.string().optional(),
3505
+ message: z30.string().optional()
3117
3506
  });
3118
- var SuccessResponseSchema = z29.object({
3119
- status: z29.literal("ok"),
3120
- message: z29.string().optional()
3507
+ var SuccessResponseSchema = z30.object({
3508
+ status: z30.literal("ok"),
3509
+ message: z30.string().optional()
3121
3510
  });
3122
- var ProfileErrorResponseSchema = z29.object({
3123
- status: z29.literal("error"),
3511
+ var ProfileErrorResponseSchema = z30.object({
3512
+ status: z30.literal("error"),
3124
3513
  /** 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()
3514
+ code: z30.string().optional(),
3515
+ message: z30.string().optional(),
3516
+ errors: z30.array(z30.string()).optional()
3128
3517
  });
3129
3518
  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()
3519
+ var UpdatePasswordRequestSchema = z30.object({
3520
+ oldPassword: z30.string().optional(),
3521
+ newPassword: z30.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"),
3522
+ newPasswordConfirm: z30.string()
3134
3523
  }).refine((data) => data.newPassword === data.newPasswordConfirm, {
3135
3524
  message: "Passwords do not match",
3136
3525
  path: ["newPasswordConfirm"]
3137
3526
  });
3138
- var PasswordUpdateSuccessSchema = z29.object({
3139
- status: z29.literal("ok"),
3140
- message: z29.string(),
3141
- accessToken: z29.string(),
3142
- refreshToken: z29.string(),
3527
+ var PasswordUpdateSuccessSchema = z30.object({
3528
+ status: z30.literal("ok"),
3529
+ message: z30.string(),
3530
+ accessToken: z30.string(),
3531
+ refreshToken: z30.string(),
3143
3532
  /** Access-token lifetime in seconds. */
3144
- expiresIn: z29.number()
3533
+ expiresIn: z30.number()
3145
3534
  });
3146
- var PasswordErrorResponseSchema = z29.object({
3147
- status: z29.literal("error"),
3148
- message: z29.string(),
3149
- errors: z29.array(z29.string()).optional()
3535
+ var PasswordErrorResponseSchema = z30.object({
3536
+ status: z30.literal("error"),
3537
+ message: z30.string(),
3538
+ errors: z30.array(z30.string()).optional()
3150
3539
  });
3151
- var RecentlyViewedPagesResponseSchema = z29.object({
3152
- pages: z29.array(PageSchema)
3540
+ var RecentlyViewedPagesResponseSchema = z30.object({
3541
+ pages: z30.array(PageSchema)
3153
3542
  });
3154
3543
 
3155
3544
  // src/contracts/me.ts
@@ -3232,8 +3621,8 @@ var uploadPictureRoute = createRoute17({
3232
3621
  body: {
3233
3622
  content: {
3234
3623
  "multipart/form-data": {
3235
- schema: z30.object({
3236
- file: z30.any().optional().describe("Profile picture file")
3624
+ schema: z31.object({
3625
+ file: z31.any().optional().describe("Profile picture file")
3237
3626
  })
3238
3627
  }
3239
3628
  }
@@ -3333,37 +3722,37 @@ var meRoutes = {
3333
3722
  };
3334
3723
 
3335
3724
  // src/contracts/access-token.ts
3336
- import { createRoute as createRoute18, z as z32 } from "@hono/zod-openapi";
3725
+ import { createRoute as createRoute18, z as z33 } from "@hono/zod-openapi";
3337
3726
 
3338
3727
  // 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()),
3728
+ import { z as z32 } from "@hono/zod-openapi";
3729
+ var AccessTokenSchema = z32.object({
3730
+ id: z32.string(),
3731
+ name: z32.string(),
3732
+ scopes: z32.array(z32.string()),
3344
3733
  /** ISO-8601 expiry, or `null` for a non-expiring token. */
3345
- expiresAt: z31.string().nullable(),
3734
+ expiresAt: z32.string().nullable(),
3346
3735
  /** ISO-8601 of last successful use, or `null` if never used. */
3347
- lastUsedAt: z31.string().nullable(),
3348
- createdAt: z31.string()
3736
+ lastUsedAt: z32.string().nullable(),
3737
+ createdAt: z32.string()
3349
3738
  });
3350
- var ListAccessTokensResponseSchema = z31.object({
3351
- accessTokens: z31.array(AccessTokenSchema)
3739
+ var ListAccessTokensResponseSchema = z32.object({
3740
+ accessTokens: z32.array(AccessTokenSchema)
3352
3741
  });
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()
3742
+ var CreateAccessTokenRequestSchema = z32.object({
3743
+ name: z32.string().min(1, "Name is required").max(200),
3744
+ scopes: z32.array(z32.string()).min(1, "At least one scope is required"),
3745
+ expiresAt: z32.string().datetime().nullable().optional()
3357
3746
  });
3358
3747
  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())
3748
+ token: z32.string()
3749
+ });
3750
+ var InvalidScopeErrorSchema = z32.object({
3751
+ error: z32.object({
3752
+ code: z32.literal("INVALID_SCOPE"),
3753
+ message: z32.string(),
3754
+ details: z32.object({
3755
+ invalidScopes: z32.array(z32.string())
3367
3756
  }).optional()
3368
3757
  })
3369
3758
  });
@@ -3435,7 +3824,7 @@ var deleteAccessTokenRoute = createRoute18({
3435
3824
  security: [{ bearerAuth: [] }],
3436
3825
  summary: "Revoke a personal access token",
3437
3826
  request: {
3438
- params: z32.object({ id: z32.string() })
3827
+ params: z33.object({ id: z33.string() })
3439
3828
  },
3440
3829
  responses: {
3441
3830
  200: {
@@ -3467,13 +3856,13 @@ var accessTokenRoutes = {
3467
3856
  };
3468
3857
 
3469
3858
  // src/contracts/oauth.ts
3470
- import { createRoute as createRoute19, z as z35 } from "@hono/zod-openapi";
3859
+ import { createRoute as createRoute19, z as z36 } from "@hono/zod-openapi";
3471
3860
 
3472
3861
  // src/schemas/oauth-endpoints.ts
3473
- import { z as z34 } from "@hono/zod-openapi";
3862
+ import { z as z35 } from "@hono/zod-openapi";
3474
3863
 
3475
3864
  // src/schemas/oauth.ts
3476
- import { z as z33 } from "@hono/zod-openapi";
3865
+ import { z as z34 } from "@hono/zod-openapi";
3477
3866
  var SCOPES = [
3478
3867
  // umbrella
3479
3868
  "read",
@@ -3541,11 +3930,11 @@ function scopeSatisfies(required, granted) {
3541
3930
  return false;
3542
3931
  }
3543
3932
  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()
3933
+ error: z34.object({
3934
+ code: z34.literal("INSUFFICIENT_SCOPE"),
3935
+ message: z34.string(),
3936
+ details: z34.object({
3937
+ requiredScope: z34.string()
3549
3938
  }).optional()
3550
3939
  })
3551
3940
  });
@@ -3564,97 +3953,97 @@ var OAUTH_ERROR_CODES = [
3564
3953
  "slow_down",
3565
3954
  "expired_token"
3566
3955
  ];
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)
3956
+ var OAuthErrorSchema = z35.object({
3957
+ error: z35.enum(OAUTH_ERROR_CODES),
3958
+ error_description: z35.string().optional()
3959
+ });
3960
+ var AuthorizeRequestSchema = z35.object({
3961
+ client_id: z35.string().min(1),
3962
+ redirect_uri: z35.string().min(1),
3963
+ scope: z35.string().min(1),
3964
+ code_challenge: z35.string().min(1),
3965
+ code_challenge_method: z35.literal("S256"),
3966
+ state: z35.string().optional()
3967
+ });
3968
+ var AuthorizeResponseSchema = z35.object({
3969
+ redirectUri: z35.string()
3970
+ });
3971
+ var TokenRequestSchema = z35.discriminatedUnion("grant_type", [
3972
+ z35.object({
3973
+ grant_type: z35.literal("authorization_code"),
3974
+ code: z35.string().min(1),
3975
+ code_verifier: z35.string().min(1),
3976
+ redirect_uri: z35.string().min(1),
3977
+ client_id: z35.string().min(1)
3589
3978
  }),
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()
3979
+ z35.object({
3980
+ grant_type: z35.literal("refresh_token"),
3981
+ refresh_token: z35.string().min(1),
3982
+ client_id: z35.string().min(1),
3983
+ scope: z35.string().optional()
3595
3984
  }),
3596
3985
  // RFC 8628 §3.4 — device authorization grant. The client polls with the
3597
3986
  // 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)
3987
+ z35.object({
3988
+ grant_type: z35.literal("urn:ietf:params:oauth:grant-type:device_code"),
3989
+ device_code: z35.string().min(1),
3990
+ client_id: z35.string().min(1)
3602
3991
  })
3603
3992
  ]);
3604
3993
  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()
3994
+ var TokenResponseSchema = z35.object({
3995
+ access_token: z35.string(),
3996
+ token_type: z35.literal("Bearer"),
3997
+ expires_in: z35.number(),
3998
+ refresh_token: z35.string(),
3999
+ scope: z35.string()
4000
+ });
4001
+ var RevokeRequestSchema = z35.object({
4002
+ token: z35.string().min(1),
4003
+ token_type_hint: z35.string().optional()
4004
+ });
4005
+ var RevokeResponseSchema = z35.object({});
4006
+ var DeviceAuthorizeRequestSchema = z35.object({
4007
+ client_id: z35.string().min(1),
4008
+ scope: z35.string().min(1)
4009
+ });
4010
+ var DeviceAuthorizeResponseSchema = z35.object({
4011
+ device_code: z35.string(),
4012
+ user_code: z35.string(),
4013
+ verification_uri: z35.string(),
4014
+ verification_uri_complete: z35.string(),
4015
+ expires_in: z35.number(),
4016
+ interval: z35.number()
4017
+ });
4018
+ var DeviceVerifyRequestSchema = z35.object({
4019
+ user_code: z35.string().min(1),
4020
+ action: z35.enum(["approve", "deny"])
4021
+ });
4022
+ var DeviceVerifyResponseSchema = z35.object({
4023
+ status: z35.enum(["approved", "denied"])
4024
+ });
4025
+ var DeviceInfoResponseSchema = z35.object({
4026
+ client_id: z35.string(),
4027
+ scopes: z35.array(z35.string())
4028
+ });
4029
+ var ClientInfoResponseSchema = z35.object({
4030
+ clientId: z35.string(),
4031
+ name: z35.string(),
4032
+ firstParty: z35.boolean(),
4033
+ trusted: z35.boolean()
3645
4034
  });
3646
4035
  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())
4036
+ var DiscoveryResponseSchema = z35.object({
4037
+ issuer: z35.string(),
4038
+ authorization_endpoint: z35.string(),
4039
+ token_endpoint: z35.string(),
4040
+ revocation_endpoint: z35.string(),
4041
+ device_authorization_endpoint: z35.string().optional(),
4042
+ scopes_supported: z35.array(z35.string()),
4043
+ response_types_supported: z35.array(z35.string()),
4044
+ grant_types_supported: z35.array(z35.string()),
4045
+ code_challenge_methods_supported: z35.array(z35.string()),
4046
+ token_endpoint_auth_methods_supported: z35.array(z35.string())
3658
4047
  });
3659
4048
  var DISCOVERY_SCOPES_SUPPORTED = ISSUABLE_SCOPES;
3660
4049
 
@@ -3790,7 +4179,7 @@ var deviceInfoRoute = createRoute19({
3790
4179
  // scopes so the web consent screen can show them before approval. Reveals
3791
4180
  // no secret. Unknown / expired / non-pending → 404 (PHASE4-Q9 option A).
3792
4181
  request: {
3793
- query: z35.object({ user_code: z35.string().min(1) })
4182
+ query: z36.object({ user_code: z36.string().min(1) })
3794
4183
  },
3795
4184
  responses: {
3796
4185
  200: {
@@ -3844,7 +4233,7 @@ var clientInfoRoute = createRoute19({
3844
4233
  // no redirectUris/allowedScopes — mirroring deviceInfoRoute's own
3845
4234
  // non-secret-lookup shape. Unknown client_id → 404.
3846
4235
  request: {
3847
- query: z35.object({ client_id: z35.string().min(1) })
4236
+ query: z36.object({ client_id: z36.string().min(1) })
3848
4237
  },
3849
4238
  responses: {
3850
4239
  200: {
@@ -3869,24 +4258,24 @@ var oauthRoutes = {
3869
4258
  };
3870
4259
 
3871
4260
  // src/contracts/notification.ts
3872
- import { createRoute as createRoute20, z as z37 } from "@hono/zod-openapi";
4261
+ import { createRoute as createRoute20, z as z38 } from "@hono/zod-openapi";
3873
4262
 
3874
4263
  // src/schemas/notification.ts
3875
- import { z as z36 } from "@hono/zod-openapi";
3876
- var NotificationStatusSchema = z36.enum(["UNREAD", "UNOPENED", "OPENED"]);
4264
+ import { z as z37 } from "@hono/zod-openapi";
4265
+ var NotificationStatusSchema = z37.enum(["UNREAD", "UNOPENED", "OPENED"]);
3877
4266
  var NotificationStatusEnum = {
3878
4267
  UNREAD: "UNREAD",
3879
4268
  UNOPENED: "UNOPENED",
3880
4269
  OPENED: "OPENED"
3881
4270
  };
3882
- var NotificationActionSchema = z36.enum(["COMMENT", "LIKE", "MENTION", "UPDATE"]);
4271
+ var NotificationActionSchema = z37.enum(["COMMENT", "LIKE", "MENTION", "UPDATE"]);
3883
4272
  var NotificationActionEnum = {
3884
4273
  COMMENT: "COMMENT",
3885
4274
  LIKE: "LIKE",
3886
4275
  MENTION: "MENTION",
3887
4276
  UPDATE: "UPDATE"
3888
4277
  };
3889
- var NotificationTargetModelSchema = z36.enum(["Page"]);
4278
+ var NotificationTargetModelSchema = z37.enum(["Page"]);
3890
4279
  var NotificationTargetModelEnum = {
3891
4280
  PAGE: "Page"
3892
4281
  };
@@ -3895,68 +4284,68 @@ var PageRefSchema = PageSchema.pick({
3895
4284
  path: true,
3896
4285
  status: true
3897
4286
  });
3898
- var NotificationSchema = z36.object({
3899
- _id: z36.string(),
3900
- user: z36.string(),
4287
+ var NotificationSchema = z37.object({
4288
+ _id: z37.string(),
4289
+ user: z37.string(),
3901
4290
  targetModel: NotificationTargetModelSchema,
3902
4291
  target: PageRefSchema,
3903
4292
  action: NotificationActionSchema,
3904
4293
  status: NotificationStatusSchema,
3905
- actionUsers: z36.array(UserPublicSchema),
3906
- createdAt: z36.string()
4294
+ actionUsers: z37.array(UserPublicSchema),
4295
+ createdAt: z37.string()
3907
4296
  });
3908
- var ListNotificationsRequestSchema = z36.object({
3909
- limit: z36.coerce.number().optional().default(10),
3910
- offset: z36.coerce.number().optional().default(0)
4297
+ var ListNotificationsRequestSchema = z37.object({
4298
+ limit: z37.coerce.number().optional().default(10),
4299
+ offset: z37.coerce.number().optional().default(0)
3911
4300
  });
3912
- var ListNotificationsResponseSchema = z36.object({
3913
- notifications: z36.array(NotificationSchema),
4301
+ var ListNotificationsResponseSchema = z37.object({
4302
+ notifications: z37.array(NotificationSchema),
3914
4303
  pager: PagerSchema
3915
4304
  });
3916
- var MarkAllAsReadResponseSchema = z36.object({
3917
- ok: z36.literal(true)
4305
+ var MarkAllAsReadResponseSchema = z37.object({
4306
+ ok: z37.literal(true)
3918
4307
  });
3919
- var OpenNotificationParamSchema = z36.object({
3920
- id: z36.string()
4308
+ var OpenNotificationParamSchema = z37.object({
4309
+ id: z37.string()
3921
4310
  });
3922
- var OpenNotificationResponseSchema = z36.object({
4311
+ var OpenNotificationResponseSchema = z37.object({
3923
4312
  notification: NotificationSchema
3924
4313
  });
3925
- var NotificationStatusResponseSchema = z36.object({
3926
- count: z36.number()
4314
+ var NotificationStatusResponseSchema = z37.object({
4315
+ count: z37.number()
3927
4316
  });
3928
- var NotificationNotFoundErrorSchema = z36.object({
3929
- error: z36.object({
3930
- code: z36.literal("NOTIFICATION_NOT_FOUND"),
3931
- message: z36.literal("Notification not found")
4317
+ var NotificationNotFoundErrorSchema = z37.object({
4318
+ error: z37.object({
4319
+ code: z37.literal("NOTIFICATION_NOT_FOUND"),
4320
+ message: z37.literal("Notification not found")
3932
4321
  })
3933
4322
  });
3934
- var NotificationsTokenResponseSchema = z36.object({
3935
- token: z36.string(),
3936
- selfUserId: z36.string(),
3937
- expiresAt: z36.string()
4323
+ var NotificationsTokenResponseSchema = z37.object({
4324
+ token: z37.string(),
4325
+ selfUserId: z37.string(),
4326
+ expiresAt: z37.string()
3938
4327
  });
3939
- var NotificationsTokenPayloadSchema = z36.object({
3940
- selfUserId: z36.string(),
4328
+ var NotificationsTokenPayloadSchema = z37.object({
4329
+ selfUserId: z37.string(),
3941
4330
  // Random UUID mixed into every signed token so two tokens minted
3942
4331
  // within the same second still produce byte-different JWT strings.
3943
4332
  // The browser uses the token as a React effect dependency to drive
3944
4333
  // the WebSocket reconnect — without `jti`, the iat/exp pair is
3945
4334
  // identical at second granularity and the dep stays stable.
3946
- jti: z36.string().uuid(),
3947
- iat: z36.number().int(),
3948
- exp: z36.number().int()
4335
+ jti: z37.string().uuid(),
4336
+ iat: z37.number().int(),
4337
+ exp: z37.number().int()
3949
4338
  });
3950
- var NotificationsChangedMessageSchema = z36.object({
3951
- type: z36.literal("changed")
4339
+ var NotificationsChangedMessageSchema = z37.object({
4340
+ type: z37.literal("changed")
3952
4341
  });
3953
4342
  var NotificationsServerMessageSchema = NotificationsChangedMessageSchema;
3954
4343
 
3955
4344
  // src/contracts/notification.ts
3956
- var NotificationInvalidRequestErrorSchema = z37.object({
3957
- error: z37.object({
3958
- code: z37.literal("INVALID_REQUEST"),
3959
- message: z37.string()
4345
+ var NotificationInvalidRequestErrorSchema = z38.object({
4346
+ error: z38.object({
4347
+ code: z38.literal("INVALID_REQUEST"),
4348
+ message: z38.string()
3960
4349
  })
3961
4350
  });
3962
4351
  var listNotificationsRoute = createRoute20({
@@ -4092,9 +4481,9 @@ var notificationRoutes = {
4092
4481
  };
4093
4482
 
4094
4483
  // 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" })
4484
+ import { createRoute as createRoute21, z as z39 } from "@hono/zod-openapi";
4485
+ var PageIdPathParamsSchema2 = z39.object({
4486
+ id: z39.string().openapi({ description: "Page id (24-char hex ObjectId)", example: "507f1f77bcf86cd799439011" })
4098
4487
  });
4099
4488
  var getYjsTokenRoute = createRoute21({
4100
4489
  method: "get",
@@ -4133,25 +4522,25 @@ var pageCollabRoutes = {
4133
4522
  };
4134
4523
 
4135
4524
  // 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()
4525
+ import { createRoute as createRoute22, z as z40 } from "@hono/zod-openapi";
4526
+ var PageBadRequestErrorSchema = z40.object({
4527
+ error: z40.object({
4528
+ code: z40.string(),
4529
+ message: z40.string()
4141
4530
  })
4142
4531
  });
4143
- var DeletePageRequestSchema = z39.object({
4144
- page_id: z39.string(),
4145
- revision_id: z39.string().optional(),
4146
- completely: z39.boolean().optional()
4532
+ var DeletePageRequestSchema = z40.object({
4533
+ page_id: z40.string(),
4534
+ revision_id: z40.string().optional(),
4535
+ completely: z40.boolean().optional()
4147
4536
  });
4148
- var RevertDeletedPageRequestSchema = z39.object({
4149
- page_id: z39.string()
4537
+ var RevertDeletedPageRequestSchema = z40.object({
4538
+ page_id: z40.string()
4150
4539
  });
4151
- var PageIdBodySchema = z39.object({
4152
- page_id: z39.string()
4540
+ var PageIdBodySchema = z40.object({
4541
+ page_id: z40.string()
4153
4542
  });
4154
- var PageResponseSchema = z39.object({ page: PageSchema });
4543
+ var PageResponseSchema = z40.object({ page: PageSchema });
4155
4544
  var getPageRoute = createRoute22({
4156
4545
  method: "get",
4157
4546
  path: "/pages",
@@ -4163,7 +4552,7 @@ var getPageRoute = createRoute22({
4163
4552
  },
4164
4553
  responses: {
4165
4554
  200: {
4166
- description: "The requested page with populated revision",
4555
+ 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
4556
  content: { "application/json": { schema: GetPageResponseSchema } }
4168
4557
  },
4169
4558
  401: {
@@ -4200,7 +4589,7 @@ var listPagesRoute = createRoute22({
4200
4589
  },
4201
4590
  responses: {
4202
4591
  200: {
4203
- description: "Page list (newest first) with optional portal page",
4592
+ 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
4593
  content: { "application/json": { schema: ListPagesResponseSchema } }
4205
4594
  },
4206
4595
  401: {
@@ -4465,7 +4854,7 @@ var claimPageLinkAccessRoute = createRoute22({
4465
4854
  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
4855
  content: {
4467
4856
  "application/json": {
4468
- schema: z39.union([PageNotGrantedErrorSchema, InsufficientScopeErrorSchema])
4857
+ schema: z40.union([PageNotGrantedErrorSchema, InsufficientScopeErrorSchema])
4469
4858
  }
4470
4859
  }
4471
4860
  },
@@ -4655,7 +5044,7 @@ var renamePageRoute = createRoute22({
4655
5044
  description: "PAGE_INVALID_NAME / PAGE_EXISTS / PAGE_RENAME_FAILED / PAGE_RENAME_TREE_FAILED",
4656
5045
  content: {
4657
5046
  "application/json": {
4658
- schema: z39.union([PageBadRequestErrorSchema, RenameTreeErrorSchema])
5047
+ schema: z40.union([PageBadRequestErrorSchema, RenameTreeErrorSchema])
4659
5048
  }
4660
5049
  }
4661
5050
  },
@@ -4693,7 +5082,7 @@ var renameSubtreeRoute = createRoute22({
4693
5082
  description: "PAGE_INVALID_NAME / PAGE_RENAME_TREE_FAILED (collisions, nothing to move, or partial failure)",
4694
5083
  content: {
4695
5084
  "application/json": {
4696
- schema: z39.union([PageBadRequestErrorSchema, RenameTreeErrorSchema])
5085
+ schema: z40.union([PageBadRequestErrorSchema, RenameTreeErrorSchema])
4697
5086
  }
4698
5087
  }
4699
5088
  },
@@ -4746,12 +5135,13 @@ var pageRoutes = {
4746
5135
  import { createRoute as createRoute23 } from "@hono/zod-openapi";
4747
5136
 
4748
5137
  // src/schemas/page-preview.ts
4749
- import { z as z40 } from "@hono/zod-openapi";
4750
- var PreviewPageRequestSchema = z40.object({
4751
- body: z40.string()
5138
+ import { z as z41 } from "@hono/zod-openapi";
5139
+ var PreviewPageRequestSchema = z41.object({
5140
+ body: z41.string()
4752
5141
  });
4753
- var PreviewPageResponseSchema = z40.object({
4754
- renderedAst: z40.unknown()
5142
+ var PreviewPageResponseSchema = z41.object({
5143
+ renderedAst: RenderedAstValueSchema.optional(),
5144
+ renderedAstArtifactKey: RenderedAstArtifactKeySchema.optional()
4755
5145
  });
4756
5146
 
4757
5147
  // src/contracts/page-preview.ts
@@ -4768,7 +5158,7 @@ var previewPageRoute = createRoute23({
4768
5158
  },
4769
5159
  responses: {
4770
5160
  200: {
4771
- description: "Rendered mdast tree (serialised \u2014 same shape as a persisted revision.renderedAst)",
5161
+ 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
5162
  content: { "application/json": { schema: PreviewPageResponseSchema } }
4773
5163
  },
4774
5164
  401: {
@@ -4793,78 +5183,78 @@ var pagePreviewRoutes = {
4793
5183
  };
4794
5184
 
4795
5185
  // src/contracts/presence.ts
4796
- import { createRoute as createRoute24, z as z42 } from "@hono/zod-openapi";
5186
+ import { createRoute as createRoute24, z as z43 } from "@hono/zod-openapi";
4797
5187
 
4798
5188
  // 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")
5189
+ import { z as z42 } from "@hono/zod-openapi";
5190
+ var PresenceTokenResponseSchema = z42.object({
5191
+ token: z42.string(),
5192
+ pageId: z42.string(),
5193
+ selfUserId: z42.string(),
5194
+ expiresAt: z42.string()
5195
+ });
5196
+ var PresenceTokenPayloadSchema = z42.object({
5197
+ userId: z42.string(),
5198
+ pageId: z42.string(),
5199
+ iat: z42.number().int(),
5200
+ exp: z42.number().int()
5201
+ });
5202
+ var PresenceViewerSchema = z42.object({
5203
+ userId: z42.string(),
5204
+ username: z42.string(),
5205
+ displayName: z42.string(),
5206
+ avatarUrl: z42.string().nullable(),
5207
+ isEditing: z42.boolean(),
5208
+ joinedAt: z42.number().int()
5209
+ });
5210
+ var PresenceHeartbeatMessageSchema = z42.object({
5211
+ type: z42.literal("heartbeat")
4822
5212
  });
4823
5213
  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", [
5214
+ var PresenceViewersMessageSchema = z42.object({
5215
+ type: z42.literal("viewers"),
5216
+ viewers: z42.array(PresenceViewerSchema),
5217
+ generation: z42.number().int()
5218
+ });
5219
+ var PresencePageUpdatedMessageSchema = z42.object({
5220
+ type: z42.literal("page-updated"),
5221
+ pageId: z42.string(),
5222
+ revisionId: z42.string(),
5223
+ editorUserId: z42.string(),
5224
+ editorDisplayName: z42.string()
5225
+ });
5226
+ var PresenceCommentChangedMessageSchema = z42.object({
5227
+ type: z42.literal("comment-changed"),
5228
+ pageId: z42.string(),
5229
+ changeType: z42.enum(["added", "removed"]),
5230
+ commentId: z42.string(),
5231
+ actorUserId: z42.string().optional()
5232
+ });
5233
+ var PresenceServerMessageSchema = z42.discriminatedUnion("type", [
4844
5234
  PresenceViewersMessageSchema,
4845
5235
  PresencePageUpdatedMessageSchema,
4846
5236
  PresenceCommentChangedMessageSchema
4847
5237
  ]);
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({
5238
+ var LikerSchema = z42.object({
5239
+ id: z42.string(),
5240
+ username: z42.string(),
5241
+ displayName: z42.string(),
5242
+ avatarUrl: z42.string().nullable(),
5243
+ likedAt: z42.string().nullable()
5244
+ });
5245
+ var LikersResponseSchema = z42.object({
5246
+ users: z42.array(LikerSchema),
5247
+ totalCount: z42.number().int().nonnegative()
5248
+ });
5249
+ var GetLikersRequestSchema = z42.object({
4860
5250
  // Optional cap on returned `users`. `totalCount` always reflects the
4861
5251
  // full count regardless of `limit`. Omit for the full list.
4862
- limit: z41.coerce.number().int().positive().optional()
5252
+ limit: z42.coerce.number().int().positive().optional()
4863
5253
  });
4864
5254
 
4865
5255
  // src/contracts/presence.ts
4866
- var PageIdPathParamsSchema3 = z42.object({
4867
- id: z42.string().openapi({ description: "Page id (24-char hex ObjectId)", example: "507f1f77bcf86cd799439011" })
5256
+ var PageIdPathParamsSchema3 = z43.object({
5257
+ id: z43.string().openapi({ description: "Page id (24-char hex ObjectId)", example: "507f1f77bcf86cd799439011" })
4868
5258
  });
4869
5259
  var getPresenceTokenRoute = createRoute24({
4870
5260
  method: "get",
@@ -4937,49 +5327,49 @@ var presenceRoutes = {
4937
5327
  };
4938
5328
 
4939
5329
  // src/contracts/revision.ts
4940
- import { createRoute as createRoute25, z as z44 } from "@hono/zod-openapi";
5330
+ import { createRoute as createRoute25, z as z45 } from "@hono/zod-openapi";
4941
5331
 
4942
5332
  // 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(),
5333
+ import { z as z44 } from "@hono/zod-openapi";
5334
+ var RevisionMetaSchema = z44.object({
5335
+ _id: z44.string(),
5336
+ path: z44.string(),
4947
5337
  author: PageUserSchema.nullable().optional(),
4948
5338
  savedBy: PageUserSchema.nullable().optional(),
4949
- contributors: z43.array(PageUserSchema).optional(),
5339
+ contributors: z44.array(PageUserSchema).optional(),
4950
5340
  // RFC-0010 — edit channel. `web` (browser / collab editor) vs the API
4951
5341
  // token paths (`oauth` / `pat`). Absent on pre-RFC-0010 revisions. The
4952
5342
  // history UI shows an "app" chip for the token paths.
4953
- editVia: z43.enum(["web", "oauth", "pat"]).optional(),
4954
- createdAt: z43.string()
5343
+ editVia: z44.enum(["web", "oauth", "pat"]).optional(),
5344
+ createdAt: z44.string()
4955
5345
  });
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)
5346
+ var ListRevisionsRequestSchema = z44.object({
5347
+ limit: z44.coerce.number().int().positive().max(200).optional().default(50),
5348
+ offset: z44.coerce.number().int().min(0).optional().default(0)
4959
5349
  });
4960
- var ListRevisionsResponseSchema = z43.object({
4961
- revisions: z43.array(RevisionMetaSchema),
5350
+ var ListRevisionsResponseSchema = z44.object({
5351
+ revisions: z44.array(RevisionMetaSchema),
4962
5352
  pager: PagerSchema
4963
5353
  });
4964
- var GetRevisionResponseSchema = z43.object({
5354
+ var GetRevisionResponseSchema = z44.object({
4965
5355
  revision: RevisionSchema
4966
5356
  });
4967
- var GetRevisionsRequestSchema = z43.object({
4968
- ids: z43.string().min(1, "ids is required")
5357
+ var GetRevisionsRequestSchema = z44.object({
5358
+ ids: z44.string().min(1, "ids is required")
4969
5359
  });
4970
- var GetRevisionsResponseSchema = z43.object({
4971
- revisions: z43.array(RevisionSchema)
5360
+ var GetRevisionsResponseSchema = z44.object({
5361
+ revisions: z44.array(RevisionSchema)
4972
5362
  });
4973
- var RevisionInvalidRequestErrorSchema = z43.object({
4974
- error: z43.object({
4975
- code: z43.literal("INVALID_REQUEST"),
4976
- message: z43.string()
5363
+ var RevisionInvalidRequestErrorSchema = z44.object({
5364
+ error: z44.object({
5365
+ code: z44.literal("INVALID_REQUEST"),
5366
+ message: z44.string()
4977
5367
  })
4978
5368
  });
4979
5369
 
4980
5370
  // src/contracts/revision.ts
4981
- var PageIdParamSchema = z44.object({ page_id: z44.string() });
4982
- var RevisionIdParamSchema = z44.object({ id: z44.string() });
5371
+ var PageIdParamSchema = z45.object({ page_id: z45.string() });
5372
+ var RevisionIdParamSchema = z45.object({ id: z45.string() });
4983
5373
  var listRevisionsRoute = createRoute25({
4984
5374
  method: "get",
4985
5375
  path: "/pages/{page_id}/revisions",
@@ -5048,7 +5438,7 @@ var getRevisionRoute = createRoute25({
5048
5438
  },
5049
5439
  responses: {
5050
5440
  200: {
5051
- description: "Full revision document",
5441
+ 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
5442
  content: { "application/json": { schema: GetRevisionResponseSchema } }
5053
5443
  },
5054
5444
  400: {
@@ -5078,31 +5468,31 @@ var revisionRoutes = {
5078
5468
  import { createRoute as createRoute26 } from "@hono/zod-openapi";
5079
5469
 
5080
5470
  // 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()
5087
- });
5088
- var CryptoStatusResponseSchema = z45.object({
5471
+ import { z as z46 } from "@hono/zod-openapi";
5472
+ var SensitiveConfigEntrySchema = z46.object({
5473
+ ns: z46.string(),
5474
+ key: z46.string(),
5475
+ present: z46.boolean(),
5476
+ encrypted: z46.boolean()
5477
+ });
5478
+ var CryptoStatusResponseSchema = z46.object({
5089
5479
  /** 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)
5480
+ encryptionConfigured: z46.boolean(),
5481
+ unencryptedCount: z46.number().int().min(0),
5482
+ encryptedCount: z46.number().int().min(0),
5483
+ entries: z46.array(SensitiveConfigEntrySchema)
5094
5484
  });
5095
- var ReencryptResponseSchema = z45.object({
5096
- rewritten: z45.number().int().min(0),
5485
+ var ReencryptResponseSchema = z46.object({
5486
+ rewritten: z46.number().int().min(0),
5097
5487
  /** Already encrypted, skipped on this run. */
5098
- alreadyEncrypted: z45.number().int().min(0),
5488
+ alreadyEncrypted: z46.number().int().min(0),
5099
5489
  /** Sensitive registry entries that had no row in the DB at all. */
5100
- missing: z45.number().int().min(0)
5490
+ missing: z46.number().int().min(0)
5101
5491
  });
5102
- var EncryptionNotConfiguredErrorSchema = z45.object({
5103
- error: z45.object({
5104
- code: z45.literal("ENCRYPTION_NOT_CONFIGURED"),
5105
- message: z45.string()
5492
+ var EncryptionNotConfiguredErrorSchema = z46.object({
5493
+ error: z46.object({
5494
+ code: z46.literal("ENCRYPTION_NOT_CONFIGURED"),
5495
+ message: z46.string()
5106
5496
  })
5107
5497
  });
5108
5498
 
@@ -5170,30 +5560,30 @@ var adminCryptoRoutes = {
5170
5560
  import { createRoute as createRoute27 } from "@hono/zod-openapi";
5171
5561
 
5172
5562
  // 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(),
5563
+ import { z as z48 } from "@hono/zod-openapi";
5564
+ var SearchPageTypeSchema = z48.enum(["portal", "public", "user"]);
5565
+ var SearchPagesRequestSchema = z48.object({
5566
+ q: z48.string().min(1),
5567
+ tree: z48.string().optional(),
5178
5568
  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(),
5569
+ page: z48.coerce.number().int().min(1).default(1),
5570
+ limit: z48.coerce.number().int().min(1).max(100).default(50)
5571
+ });
5572
+ var SearchHitSchema = z48.object({
5573
+ pageId: z48.string(),
5574
+ path: z48.string(),
5575
+ score: z48.number().optional(),
5576
+ snippet: z48.string().optional(),
5577
+ bookmarkCount: z48.number(),
5188
5578
  page: PageSchema
5189
5579
  });
5190
- var SearchPagesResponseSchema = z47.object({
5191
- meta: z47.object({
5192
- took: z47.number().optional(),
5193
- total: z47.number(),
5194
- results: z47.number()
5580
+ var SearchPagesResponseSchema = z48.object({
5581
+ meta: z48.object({
5582
+ took: z48.number().optional(),
5583
+ total: z48.number(),
5584
+ results: z48.number()
5195
5585
  }),
5196
- data: z47.array(SearchHitSchema)
5586
+ data: z48.array(SearchHitSchema)
5197
5587
  });
5198
5588
 
5199
5589
  // src/contracts/search.ts
@@ -5234,53 +5624,53 @@ var searchRoutes = {
5234
5624
  };
5235
5625
 
5236
5626
  // src/contracts/token-auth.ts
5237
- import { createRoute as createRoute28, z as z49 } from "@hono/zod-openapi";
5627
+ import { createRoute as createRoute28, z as z50 } from "@hono/zod-openapi";
5238
5628
 
5239
5629
  // 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(),
5630
+ import { z as z49 } from "@hono/zod-openapi";
5631
+ var TokenAuthLoginRequestSchema = z49.object({
5632
+ email: z49.string().email(),
5633
+ password: z49.string().min(6)
5634
+ });
5635
+ var TokenAuthResponseSchema = z49.object({
5636
+ accessToken: z49.string(),
5637
+ refreshToken: z49.string(),
5638
+ expiresIn: z49.number(),
5249
5639
  // 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()
5640
+ user: z49.object({
5641
+ id: z49.string(),
5642
+ username: z49.string(),
5643
+ email: z49.string().email(),
5644
+ name: z49.string(),
5645
+ image: z49.string().optional(),
5646
+ admin: z49.boolean().optional()
5257
5647
  })
5258
5648
  });
5259
- var RefreshTokenRequestSchema = z48.object({
5260
- refreshToken: z48.string()
5649
+ var RefreshTokenRequestSchema = z49.object({
5650
+ refreshToken: z49.string()
5261
5651
  });
5262
- var TokenAuthRegisterRequestSchema = z48.object({
5263
- username: z48.string(),
5264
- name: z48.string(),
5265
- email: z48.string().email(),
5266
- password: z48.string().min(6)
5652
+ var TokenAuthRegisterRequestSchema = z49.object({
5653
+ username: z49.string(),
5654
+ name: z49.string(),
5655
+ email: z49.string().email(),
5656
+ password: z49.string().min(6)
5267
5657
  });
5268
- var RegisterPendingResponseSchema = z48.object({
5269
- status: z48.enum(["confirmation_required", "approval_required"])
5658
+ var RegisterPendingResponseSchema = z49.object({
5659
+ status: z49.enum(["confirmation_required", "approval_required"])
5270
5660
  });
5271
5661
 
5272
5662
  // 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()
5663
+ var TokenLogoutResponseSchema = z50.object({ message: z50.string() });
5664
+ var TokenMeResponseSchema = z50.object({
5665
+ user: z50.object({
5666
+ id: z50.string(),
5667
+ username: z50.string(),
5668
+ email: z50.string().email(),
5669
+ name: z50.string(),
5670
+ image: z50.string().optional(),
5671
+ status: z50.number(),
5672
+ admin: z50.boolean().optional(),
5673
+ createdAt: z50.string()
5284
5674
  })
5285
5675
  });
5286
5676
  var tokenLoginRoute = createRoute28({
@@ -5408,7 +5798,7 @@ var tokenLogoutRoute = createRoute28({
5408
5798
  body: {
5409
5799
  content: {
5410
5800
  "application/json": {
5411
- schema: z49.object({ refreshToken: z49.string().optional() })
5801
+ schema: z50.object({ refreshToken: z50.string().optional() })
5412
5802
  }
5413
5803
  }
5414
5804
  }
@@ -5461,15 +5851,15 @@ var tokenAuthRoutes = {
5461
5851
  import { createRoute as createRoute29 } from "@hono/zod-openapi";
5462
5852
 
5463
5853
  // 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)
5854
+ import { z as z51 } from "@hono/zod-openapi";
5855
+ var InviteAcceptRequestSchema = z51.object({
5856
+ token: z51.string(),
5857
+ username: z51.string().min(1),
5858
+ name: z51.string().min(1),
5859
+ password: z51.string().min(6)
5470
5860
  });
5471
- var InvitePreviewResponseSchema = z50.object({
5472
- email: z50.string().email()
5861
+ var InvitePreviewResponseSchema = z51.object({
5862
+ email: z51.string().email()
5473
5863
  });
5474
5864
 
5475
5865
  // src/contracts/invite-accept.ts
@@ -5546,16 +5936,16 @@ var inviteAcceptRoutes = {
5546
5936
  import { createRoute as createRoute30 } from "@hono/zod-openapi";
5547
5937
 
5548
5938
  // src/schemas/password-reset.ts
5549
- import { z as z51 } from "@hono/zod-openapi";
5550
- var ForgotPasswordRequestSchema = z51.object({
5551
- email: z51.string().email()
5939
+ import { z as z52 } from "@hono/zod-openapi";
5940
+ var ForgotPasswordRequestSchema = z52.object({
5941
+ email: z52.string().email()
5552
5942
  });
5553
- var ForgotPasswordResponseSchema = z51.object({
5554
- ok: z51.literal(true)
5943
+ var ForgotPasswordResponseSchema = z52.object({
5944
+ ok: z52.literal(true)
5555
5945
  });
5556
- var ResetPasswordRequestSchema = z51.object({
5557
- token: z51.string(),
5558
- password: z51.string().min(6)
5946
+ var ResetPasswordRequestSchema = z52.object({
5947
+ token: z52.string(),
5948
+ password: z52.string().min(6)
5559
5949
  });
5560
5950
 
5561
5951
  // src/contracts/password-reset.ts
@@ -5650,12 +6040,12 @@ var passwordResetRoutes = {
5650
6040
  import { createRoute as createRoute31 } from "@hono/zod-openapi";
5651
6041
 
5652
6042
  // src/schemas/activation.ts
5653
- import { z as z52 } from "@hono/zod-openapi";
5654
- var ActivateRequestSchema = z52.object({
5655
- token: z52.string()
6043
+ import { z as z53 } from "@hono/zod-openapi";
6044
+ var ActivateRequestSchema = z53.object({
6045
+ token: z53.string()
5656
6046
  });
5657
- var ActivateValidationResponseSchema = z52.object({
5658
- ok: z52.literal(true)
6047
+ var ActivateValidationResponseSchema = z53.object({
6048
+ ok: z53.literal(true)
5659
6049
  });
5660
6050
 
5661
6051
  // src/contracts/activation.ts
@@ -5720,14 +6110,14 @@ var activationRoutes = {
5720
6110
  import { createRoute as createRoute32 } from "@hono/zod-openapi";
5721
6111
 
5722
6112
  // src/schemas/email-change.ts
5723
- import { z as z53 } from "@hono/zod-openapi";
5724
- var ConfirmEmailChangeRequestSchema = z53.object({
5725
- token: z53.string()
6113
+ import { z as z54 } from "@hono/zod-openapi";
6114
+ var ConfirmEmailChangeRequestSchema = z54.object({
6115
+ token: z54.string()
5726
6116
  });
5727
- var ConfirmEmailChangeResponseSchema = z53.object({
5728
- ok: z53.literal(true),
6117
+ var ConfirmEmailChangeResponseSchema = z54.object({
6118
+ ok: z54.literal(true),
5729
6119
  /** The newly-confirmed email address. */
5730
- email: z53.string().email()
6120
+ email: z54.string().email()
5731
6121
  });
5732
6122
 
5733
6123
  // src/contracts/email-change.ts
@@ -5793,8 +6183,8 @@ var emailChangeRoutes = {
5793
6183
  };
5794
6184
 
5795
6185
  // src/contracts/user.ts
5796
- import { createRoute as createRoute33, z as z54 } from "@hono/zod-openapi";
5797
- var UsernameParamSchema = z54.object({ username: z54.string() });
6186
+ import { createRoute as createRoute33, z as z55 } from "@hono/zod-openapi";
6187
+ var UsernameParamSchema = z55.object({ username: z55.string() });
5798
6188
  var getUserPageRoute = createRoute33({
5799
6189
  method: "get",
5800
6190
  path: "/user/{username}",
@@ -5806,7 +6196,7 @@ var getUserPageRoute = createRoute33({
5806
6196
  },
5807
6197
  responses: {
5808
6198
  200: {
5809
- description: "User profile with statistics + recent activity",
6199
+ 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
6200
  content: { "application/json": { schema: UserPageResponseSchema } }
5811
6201
  },
5812
6202
  401: {
@@ -6029,7 +6419,9 @@ var stubUserPublic = {
6029
6419
  var stubUserPage = {
6030
6420
  user: stubUserPublic,
6031
6421
  createdPagesCount: 0,
6032
- bookmarksCount: 0
6422
+ bookmarksCount: 0,
6423
+ likesCount: 0,
6424
+ commentsCount: 0
6033
6425
  };
6034
6426
  var stubPager = { prev: null, next: null, offset: 0 };
6035
6427
  var stubUserBookmarks = {
@@ -6116,11 +6508,11 @@ var stubPageWithRevision = {
6116
6508
  }
6117
6509
  };
6118
6510
  var stubPageResponse = { page: stubPage };
6119
- var stubListPages = { pages: [], pager: stubPager, portalPage: null };
6511
+ var stubListPages = { pages: [], pager: stubPager, portalPage: null, total: 0 };
6120
6512
  var stubListPageChildren = { children: [] };
6121
6513
  var stubSeenUsers = { seenUsers: [], seenUsersCount: 0 };
6122
6514
  var stubWatchStatus = { watching: false };
6123
- var stubPreview = { renderedAst: null };
6515
+ var stubPreview = {};
6124
6516
  var stubWsToken = {
6125
6517
  wsToken: "",
6126
6518
  pageId: "",
@@ -6257,19 +6649,19 @@ var createClient = (baseUrl, options = {}) => hc(baseUrl, {
6257
6649
  });
6258
6650
 
6259
6651
  // 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({
6652
+ import { z as z56 } from "@hono/zod-openapi";
6653
+ var MailTokenPurposeSchema = z56.enum(["invite", "activate", "reset", "email-change"]);
6654
+ var MailTokenPayloadSchema = z56.object({
6263
6655
  purpose: MailTokenPurposeSchema,
6264
- userId: z55.string(),
6656
+ userId: z56.string(),
6265
6657
  /** Target address. For `email-change` this is the NEW address. */
6266
- email: z55.string().email(),
6658
+ email: z56.string().email(),
6267
6659
  /**
6268
6660
  * For `email-change`: the account's email at issue time. The confirm
6269
6661
  * endpoint rejects the token unless it still matches, making the token
6270
6662
  * single-use (a stale token cannot revert a later change).
6271
6663
  */
6272
- fromEmail: z55.string().email().optional(),
6664
+ fromEmail: z56.string().email().optional(),
6273
6665
  /**
6274
6666
  * For `reset`: the account's `passwordResetGeneration` at issue time.
6275
6667
  * Consuming the link increments that counter, so the token only matches
@@ -6278,7 +6670,7 @@ var MailTokenPayloadSchema = z55.object({
6278
6670
  * schema because the other purposes don't carry it (and links minted
6279
6671
  * before the claim existed simply no longer match).
6280
6672
  */
6281
- resetGeneration: z55.number().int().nonnegative().optional(),
6673
+ resetGeneration: z56.number().int().nonnegative().optional(),
6282
6674
  /**
6283
6675
  * For `email-change`: the account's `authVersion` at issue time. The
6284
6676
  * confirm endpoint requires it to still match, so a pending address change
@@ -6290,10 +6682,10 @@ var MailTokenPayloadSchema = z55.object({
6290
6682
  * semantics wanted are exactly "the session that asked for this is gone",
6291
6683
  * and that is what every bump of it already means.
6292
6684
  */
6293
- authVersion: z55.number().int().nonnegative().optional(),
6685
+ authVersion: z56.number().int().nonnegative().optional(),
6294
6686
  // iat / exp are injected and verified by the JWT layer.
6295
- iat: z55.number().optional(),
6296
- exp: z55.number().optional()
6687
+ iat: z56.number().optional(),
6688
+ exp: z56.number().optional()
6297
6689
  });
6298
6690
 
6299
6691
  // src/util/html-elements.ts
@@ -6453,6 +6845,13 @@ export {
6453
6845
  ALL_CAPABILITIES,
6454
6846
  ALL_SCOPES,
6455
6847
  API_SURFACE_VERSION,
6848
+ AST_INPUT_LIMIT_BYTES,
6849
+ AST_MAX_HAST_DEPTH,
6850
+ AST_MAX_IMAGE_BASE64_CHARS,
6851
+ AST_MAX_TREE_DEPTH,
6852
+ AST_MAX_VALUE_CHARS,
6853
+ AST_OUTPUT_BUDGET_BYTES,
6854
+ AST_OUTPUT_WARN_BYTES,
6456
6855
  AccessTokenSchema,
6457
6856
  ActivateRequestSchema,
6458
6857
  ActivateValidationResponseSchema,
@@ -6489,6 +6888,7 @@ export {
6489
6888
  BacklinkSchema,
6490
6889
  BookmarkResponseSchema,
6491
6890
  BookmarkSchema,
6891
+ CURRENT_AST_VERSION,
6492
6892
  CapabilitySchema,
6493
6893
  ClaimPageLinkAccessResponseSchema,
6494
6894
  ClearRenderCacheResponseSchema,
@@ -6511,10 +6911,21 @@ export {
6511
6911
  CreateDraftRequestSchema,
6512
6912
  CreateDraftResponseSchema,
6513
6913
  CreatePageRequestSchema,
6914
+ CrowiCodeSidecarSchema,
6915
+ CrowiDiagramNodeSchema,
6916
+ CrowiDiagramSidecarSchema,
6917
+ CrowiDimensionSchema,
6918
+ CrowiImagePayloadSchema,
6919
+ CrowiLinkCardNodeSchema,
6920
+ CrowiLinkCardSidecarSchema,
6921
+ CrowiMathSidecarSchema,
6922
+ CrowiOpaqueNodeSchema,
6923
+ CrowiPlaceholderKindSchema,
6924
+ CrowiPlaceholderNodeSchema,
6925
+ CrowiPlaceholderSidecarSchema,
6514
6926
  CryptoStatusResponseSchema,
6515
6927
  DEVICE_CODE_GRANT_TYPE,
6516
6928
  DISCOVERY_SCOPES_SUPPORTED,
6517
- DND_EXTRA_UPLOAD_MIME,
6518
6929
  DYNAMIC_CAPABILITIES,
6519
6930
  DeleteAdminUserResponseSchema,
6520
6931
  DeleteCommentRequestSchema,
@@ -6555,7 +6966,11 @@ export {
6555
6966
  GetSeenUsersRequestSchema,
6556
6967
  GetStorageStatusResponseSchema,
6557
6968
  GetWatchStatusRequestSchema,
6558
- IMAGE_UPLOAD_MIME,
6969
+ HChildSchema,
6970
+ HChildrenSchema,
6971
+ HNameSchema,
6972
+ HPropertiesSchema,
6973
+ HastHintDataSchema,
6559
6974
  ISSUABLE_SCOPES,
6560
6975
  InstallerStatusResponseSchema,
6561
6976
  InsufficientScopeErrorSchema,
@@ -6590,6 +7005,7 @@ export {
6590
7005
  ListRevisionsResponseSchema,
6591
7006
  ListUsersRequestSchema,
6592
7007
  ListUsersResponseSchema,
7008
+ LooseRenderedAstRootSchema,
6593
7009
  MailSettingsValidationErrorSchema,
6594
7010
  MailTokenPayloadSchema,
6595
7011
  MailTokenPurposeSchema,
@@ -6653,6 +7069,7 @@ export {
6653
7069
  PreviewPageRequestSchema,
6654
7070
  PreviewPageResponseSchema,
6655
7071
  ProfileErrorResponseSchema,
7072
+ RENDERED_AST_NODE_DEFS,
6656
7073
  RecentlyViewedPagesResponseSchema,
6657
7074
  ReencryptResponseSchema,
6658
7075
  RefreshTokenRequestSchema,
@@ -6666,6 +7083,13 @@ export {
6666
7083
  RenameSubtreeRequestSchema,
6667
7084
  RenameSubtreeResponseSchema,
6668
7085
  RenameTreeErrorSchema,
7086
+ RenderedAstArtifactKeySchema,
7087
+ RenderedAstEnvelopeOpenApiSchema,
7088
+ RenderedAstEnvelopeSchema,
7089
+ RenderedAstNodeSchema,
7090
+ RenderedAstRootSchema,
7091
+ RenderedAstValueSchema,
7092
+ ReservationSchema,
6669
7093
  ResetPasswordRequestSchema,
6670
7094
  ResetPasswordResponseSchema,
6671
7095
  RevertToRevisionRequestSchema,
@@ -6677,6 +7101,7 @@ export {
6677
7101
  RevokeRequestSchema,
6678
7102
  RevokeResponseSchema,
6679
7103
  SCOPES,
7104
+ SIDECAR_KEYS,
6680
7105
  STATIC_CAPABILITIES,
6681
7106
  STRIP_KNOWN_HTML_TAGS_MAX_LENGTH,
6682
7107
  SearchAdminUsersByEmailRequestSchema,
@@ -6696,6 +7121,9 @@ export {
6696
7121
  ServiceUnavailableErrorSchema,
6697
7122
  SetPageGrantRequestSchema,
6698
7123
  SetWatchStatusRequestSchema,
7124
+ ShikiTokenLinesSchema,
7125
+ ShikiTokenSchema,
7126
+ ShikiTokenStyleSchema,
6699
7127
  StorageDriverEntrySchema,
6700
7128
  SuccessResponseSchema,
6701
7129
  ThemeSchema,
@@ -6708,6 +7136,7 @@ export {
6708
7136
  TokenAuthResponseSchema,
6709
7137
  TokenRequestSchema,
6710
7138
  TokenResponseSchema,
7139
+ UPLOAD_ALLOWED_MIME,
6711
7140
  UpdateAdminUserEmailRequestSchema,
6712
7141
  UpdateAppSettingsRequestSchema,
6713
7142
  UpdateAppSettingsResponseSchema,
@@ -6889,6 +7318,7 @@ export {
6889
7318
  tokenRegisterRoute,
6890
7319
  tokenRoute,
6891
7320
  unlikePageRoute,
7321
+ unwrapRenderedAst,
6892
7322
  updateAppSettingsRoute,
6893
7323
  updateAuthSettingsRoute,
6894
7324
  updateMailSettingsRoute,