@crowi/api-contract 2.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/generated/openapi.d.mts +14310 -0
- package/dist/generated/openapi.d.ts +14310 -0
- package/dist/generated/openapi.js +19 -0
- package/dist/generated/openapi.js.map +1 -0
- package/dist/generated/openapi.mjs +1 -0
- package/dist/generated/openapi.mjs.map +1 -0
- package/dist/index.d.mts +42235 -0
- package/dist/index.d.ts +42235 -0
- package/dist/index.js +6829 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +6368 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +51 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/errors/codes.ts","../src/contracts/app.ts","../src/schemas/common.ts","../src/schemas/app.ts","../src/contracts/installer.ts","../src/schemas/installer.ts","../src/contracts/tokenAuth.ts","../src/schemas/auth.ts","../src/contracts/inviteAccept.ts","../src/schemas/inviteAccept.ts","../src/contracts/passwordReset.ts","../src/schemas/passwordReset.ts","../src/contracts/activation.ts","../src/schemas/activation.ts","../src/contracts/emailChange.ts","../src/schemas/emailChange.ts","../src/contracts/me.ts","../src/schemas/me.ts","../src/schemas/page.ts","../src/schemas/collab.ts","../src/schemas/userPublic.ts","../src/contracts/access-token.ts","../src/schemas/access-token.ts","../src/contracts/oauth.ts","../src/schemas/oauth-endpoints.ts","../src/schemas/oauth.ts","../src/contracts/user.ts","../src/schemas/user.ts","../src/schemas/bookmark.ts","../src/contracts/bookmark.ts","../src/contracts/backlink.ts","../src/schemas/backlink.ts","../src/contracts/comment.ts","../src/schemas/comment.ts","../src/contracts/revision.ts","../src/schemas/revision.ts","../src/contracts/notification.ts","../src/schemas/notification.ts","../src/contracts/page.ts","../src/contracts/page-preview.ts","../src/schemas/page-preview.ts","../src/contracts/page-collab.ts","../src/contracts/presence.ts","../src/schemas/presence.ts","../src/contracts/draft.ts","../src/schemas/draft.ts","../src/contracts/autocomplete.ts","../src/schemas/autocomplete.ts","../src/contracts/attachment.ts","../src/schemas/attachment.ts","../src/contracts/search.ts","../src/schemas/search.ts","../src/contracts/adminCrypto.ts","../src/schemas/adminCrypto.ts","../src/contracts/admin/app.ts","../src/schemas/admin/app.ts","../src/contracts/admin/auth.ts","../src/schemas/admin/auth.ts","../src/contracts/admin/mail.ts","../src/schemas/admin/mail.ts","../src/contracts/admin/plugins.ts","../src/schemas/admin/plugins.ts","../src/contracts/admin/search.ts","../src/schemas/admin/search.ts","../src/contracts/admin/security.ts","../src/schemas/admin/security.ts","../src/contracts/admin/storage.ts","../src/schemas/admin/storage.ts","../src/contracts/admin/users.ts","../src/schemas/admin/users.ts","../src/schemas/admin/_pager.ts","../src/client.ts","../src/schemas/mail-token.ts"],"sourcesContent":["export * from './errors/codes';\nexport * from './contracts';\nexport * from './client';\nexport * from './schemas/app';\nexport * from './schemas/auth';\nexport * from './schemas/mail-token';\nexport * from './schemas/inviteAccept';\nexport * from './schemas/passwordReset';\nexport * from './schemas/activation';\nexport * from './schemas/emailChange';\nexport * from './schemas/installer';\nexport * from './schemas/common';\nexport * from './schemas/oauth';\nexport * from './schemas/oauth-endpoints';\nexport * from './schemas/me';\nexport * from './schemas/access-token';\nexport * from './schemas/page';\nexport * from './schemas/page-preview';\nexport * from './schemas/userPublic';\nexport * from './schemas/bookmark';\nexport * from './schemas/user';\nexport * from './schemas/comment';\nexport * from './schemas/revision';\nexport * from './schemas/notification';\nexport * from './schemas/backlink';\nexport * from './schemas/draft';\nexport * from './schemas/autocomplete';\nexport * from './schemas/collab';\nexport * from './schemas/presence';\nexport * from './schemas/attachment';\nexport * from './schemas/adminCrypto';\nexport * from './schemas/search';\nexport * from './schemas/admin/app';\nexport * from './schemas/admin/auth';\nexport * from './schemas/admin/security';\nexport * from './schemas/admin/mail';\nexport * from './schemas/admin/users';\nexport * from './schemas/admin/storage';\nexport * from './schemas/admin/search';\nexport * from './schemas/admin/plugins';\n","import { z } from '@hono/zod-openapi';\n\n/**\n * Canonical machine-readable error codes shared between the API and web.\n *\n * This is the single source of truth: every modern Hono handler / middleware\n * returns one of these in `{ error: { code, message } }`, and the web client\n * maps each code to a localized message (`ERROR_MESSAGE_KEYS` in\n * `packages/web/src/lib/error-message.ts`, type-checked against `ErrorCode`).\n *\n * Adding a code here forces:\n * - api handlers to satisfy `ApiErrorSchema.error.code` (typed below), and\n * - the web map to add a localized entry (or fail `pnpm type-check`).\n *\n * Out of scope: legacy `{ status: 'error', message, errors[] }` envelopes\n * (installer, some `me` blocks) and mail i18n (recipient `User.lang`).\n *\n * Keep this list alphabetised within each group for easy scanning.\n */\nexport const ERROR_CODES = [\n // --- auth / permission / user status ---\n 'AUTHENTICATION_REQUIRED',\n 'ADMIN_REQUIRED',\n 'THIRD_PARTY_AUTH_REQUIRED',\n 'USER_REGISTERED',\n 'USER_SUSPENDED',\n 'USER_INVITED',\n 'USER_NOT_ACTIVE',\n 'EMAIL_NOT_CONFIRMED',\n // --- generic / transport ---\n 'INTERNAL_ERROR',\n 'VALIDATION_ERROR',\n 'INVALID_REQUEST',\n 'NOT_FOUND',\n 'CONFLICT',\n 'SERVICE_UNAVAILABLE',\n 'APPLICATION_NOT_INSTALLED',\n // --- page domain ---\n 'INVALID_PAGE_ID',\n 'PAGE_NOT_FOUND',\n 'PAGE_NOT_GRANTED',\n 'PAGE_REVISION_ERROR',\n 'INVALID_GRANT',\n // --- comment / notification domain ---\n 'COMMENT_NOT_FOUND',\n 'NOTIFICATION_NOT_FOUND',\n // --- user / account domain ---\n 'USER_NOT_FOUND',\n 'USER_EXISTS',\n 'USERNAME_TAKEN',\n 'EMAIL_TAKEN',\n 'EMAIL_NOT_ALLOWED',\n // --- token-based flows (activation / invite / reset / email change) ---\n 'INVALID_ACTIVATION_TOKEN',\n 'INVALID_INVITE_TOKEN',\n 'INVITE_ALREADY_ACCEPTED',\n 'INVALID_RESET_TOKEN',\n 'INVALID_EMAIL_CHANGE_TOKEN',\n // --- login / registration ---\n 'INVALID_CREDENTIALS',\n 'REFRESH_TOKEN_REQUIRED',\n 'REGISTRATION_CLOSED',\n // --- admin subsystems ---\n 'ENCRYPTION_NOT_CONFIGURED',\n 'MAIL_TEST_FAILED',\n 'PLUGIN_NOT_FOUND',\n 'PLUGIN_CONFIG_VALIDATION_FAILED',\n] as const;\n\nexport const ErrorCodeSchema = z.enum(ERROR_CODES).openapi('ErrorCode');\n\nexport type ErrorCode = (typeof ERROR_CODES)[number];\n","/**\n * RFC-0006 Phase 3 — `app` resource ported to `@hono/zod-openapi` route\n * definitions. The previous `c.router(...)` form (ts-rest) is gone; the\n * single `GET /app/info` route now lives as a `createRoute(...)` object\n * that the Hono handler in `packages/api/src/hono/handlers/app.ts`\n * consumes via `app.openapi(getAppInfoRoute, handler)`.\n *\n * Wire-format parity with the ts-rest era is preserved: the response is\n * still `AppInfoResponseSchema` (the schema file itself was untouched in\n * Phase 2's `import { z } from '@hono/zod-openapi'` swap).\n */\nimport { createRoute } from '@hono/zod-openapi';\n\nimport { InternalServerErrorSchema } from '../schemas/common';\nimport { AppInfoResponseSchema } from '../schemas/app';\n\nexport const getAppInfoRoute = createRoute({\n method: 'get',\n path: '/app/info',\n tags: ['app'],\n summary: 'Get public application info (site title etc.)',\n responses: {\n 200: {\n description: 'Public application info',\n content: {\n 'application/json': {\n schema: AppInfoResponseSchema,\n },\n },\n },\n 500: {\n description: 'Internal server error',\n content: {\n 'application/json': {\n schema: InternalServerErrorSchema,\n },\n },\n },\n },\n});\n\nexport const appRoutes = { getAppInfoRoute };\n","import { z } from '@hono/zod-openapi';\nimport { ErrorCodeSchema } from '../errors/codes';\n\nexport const ApiErrorSchema = z.object({\n error: z.object({\n code: ErrorCodeSchema,\n message: z.string(),\n details: z.any().optional(),\n }),\n});\n\nexport const ApplicationNotInstalledErrorSchema = ApiErrorSchema.extend({\n error: z.object({\n code: z.literal('APPLICATION_NOT_INSTALLED'),\n message: z.literal('Application is not installed'),\n redirectTo: z.literal('/installer'),\n }),\n});\n\nexport const AuthenticationRequiredErrorSchema = ApiErrorSchema.extend({\n error: z.object({\n code: z.literal('AUTHENTICATION_REQUIRED'),\n message: z.literal('Authentication is required'),\n redirectTo: z.string().optional(),\n }),\n});\n\nexport const AdminRequiredErrorSchema = ApiErrorSchema.extend({\n error: z.object({\n code: z.literal('ADMIN_REQUIRED'),\n message: z.literal('Admin permission required'),\n redirectTo: z.string().optional(),\n }),\n});\n\nexport const UserStatusErrorSchema = ApiErrorSchema.extend({\n error: z.object({\n code: z.enum(['USER_REGISTERED', 'USER_SUSPENDED', 'USER_INVITED']),\n message: z.string(),\n redirectTo: z.string(),\n }),\n});\n\nexport const ThirdPartyAuthRequiredErrorSchema = ApiErrorSchema.extend({\n error: z.object({\n code: z.literal('THIRD_PARTY_AUTH_REQUIRED'),\n message: z.literal('Third party authentication is required'),\n redirectTo: z.string(),\n }),\n});\n\nexport const InternalServerErrorSchema = ApiErrorSchema.extend({\n error: z.object({\n code: z.literal('INTERNAL_ERROR'),\n message: z.literal('Internal server error'),\n }),\n});\n\nexport const InvalidPageIdErrorSchema = z.object({\n error: z.object({\n code: z.literal('INVALID_PAGE_ID'),\n message: z.string(),\n }),\n});\n\n/**\n * Generic 400 returned by endpoints that perform request-level validation\n * beyond what Zod can express (e.g. missing body fields when the schema is\n * intentionally permissive, or business-rule guards). The `code` is\n * `VALIDATION_ERROR` and `message` is a human-readable summary; UIs should\n * surface it as a toast, not parse it for branching logic.\n */\nexport const ValidationErrorSchema = ApiErrorSchema.extend({\n error: z.object({\n code: z.literal('VALIDATION_ERROR'),\n message: z.string(),\n details: z\n .object({\n fieldErrors: z.record(z.string(), z.array(z.string())),\n formErrors: z.array(z.string()),\n })\n .optional(),\n }),\n});\n\n/**\n * Generic 404 for \"the resource you addressed does not exist\". Currently used\n * by admin user mutating endpoints (PATCH /admin/users/:id, etc.) where the\n * id resolves to no document; distinct from page-scoped 404s which carry\n * domain-specific codes.\n */\nexport const NotFoundErrorSchema = ApiErrorSchema.extend({\n error: z.object({\n code: z.literal('NOT_FOUND'),\n message: z.string(),\n }),\n});\n\n/**\n * 409 Conflict, used for \"a resource with this unique key already exists\".\n * Admin user endpoints raise it when an email change collides with another\n * user's address; the legacy controller surfaced this as `ApiResponse.error`\n * (HTTP 200 with `{ ok: false }`) but the new contract correctly expresses\n * the conflict at the HTTP layer.\n */\nexport const ConflictErrorSchema = ApiErrorSchema.extend({\n error: z.object({\n code: z.literal('CONFLICT'),\n message: z.string(),\n }),\n});\n\n/**\n * 503 returned when a feature requires a runtime-pluggable driver/service\n * that is not currently registered. The shape is deliberately generic so\n * it can be reused for any pluggable subsystem; the `feature` field lets\n * clients branch on which subsystem is missing without parsing `message`.\n *\n * Examples of `feature` values the API surfaces:\n * - `'search'` — `GET /api/v2/search` when no `@crowi/plugin-search-*`\n * is installed in the runner project.\n * - `'notifier'` (future) — when no slack / chat notifier driver is registered.\n * - `'mailer'` (future) — when SMTP transport is not configured.\n */\nexport const ServiceUnavailableErrorSchema = ApiErrorSchema.extend({\n error: z.object({\n code: z.literal('SERVICE_UNAVAILABLE'),\n feature: z.string(),\n message: z.string(),\n }),\n});\n\n/**\n * Generic 403 returned when an authenticated principal is recognised but\n * not permitted to perform the action for a reason other than scope\n * shortfall. RFC-0010 §Security uses it for PAT management endpoints\n * (`/me/access-tokens`), which are **web-session only** — issuing a new\n * PAT from a PAT/OAuth token would be a privilege escalation, so those\n * requests are rejected with `FORBIDDEN` even though they are otherwise\n * authenticated.\n */\nexport const ForbiddenErrorSchema = ApiErrorSchema.extend({\n error: z.object({\n code: z.literal('FORBIDDEN'),\n message: z.string(),\n }),\n});\n\nexport type ApiError = z.infer<typeof ApiErrorSchema>;\nexport type ApplicationNotInstalledError = z.infer<typeof ApplicationNotInstalledErrorSchema>;\nexport type AuthenticationRequiredError = z.infer<typeof AuthenticationRequiredErrorSchema>;\nexport type AdminRequiredError = z.infer<typeof AdminRequiredErrorSchema>;\nexport type UserStatusError = z.infer<typeof UserStatusErrorSchema>;\nexport type ThirdPartyAuthRequiredError = z.infer<typeof ThirdPartyAuthRequiredErrorSchema>;\nexport type InternalServerError = z.infer<typeof InternalServerErrorSchema>;\nexport type InvalidPageIdError = z.infer<typeof InvalidPageIdErrorSchema>;\nexport type ValidationError = z.infer<typeof ValidationErrorSchema>;\nexport type NotFoundError = z.infer<typeof NotFoundErrorSchema>;\nexport type ConflictError = z.infer<typeof ConflictErrorSchema>;\nexport type ServiceUnavailableError = z.infer<typeof ServiceUnavailableErrorSchema>;\nexport type ForbiddenError = z.infer<typeof ForbiddenErrorSchema>;\n","import { z } from '@hono/zod-openapi';\n\n/**\n * Public application info shared with every authenticated page (header,\n * page title, etc.). Sensitive config never appears here.\n *\n * `title` is `null` when the operator has not set a custom site title\n * (i.e. the value still matches the seed default). Clients can use this\n * to switch between the full Crowi lockup and a `[icon] + custom title`\n * presentation.\n *\n * `confidential` is the optional confidentiality notice text the operator\n * sets in admin (`app:confidential`). It is `null` when unset/empty; when\n * present the web shell renders it as an always-on header banner so the\n * notice shows on screenshots / printouts (corporate IT requirement).\n */\nexport const AppInfoResponseSchema = z.object({\n title: z.string().nullable(),\n confidential: z.string().nullable(),\n});\nexport type AppInfoResponse = z.infer<typeof AppInfoResponseSchema>;\n","/**\n * RFC-0006 Phase 4 (Batch 1) — `installer` resource ported to\n * `@hono/zod-openapi` route definitions. Wire-format is preserved from\n * the ts-rest era: `GET /installer` returns `{ status: 'installer_required'\n * | 'already_installed' }`, and `POST /installer/createAdmin` returns\n * `{ status: 'ok' | 'error', message?, errors? }` (HTTP 200 for both arms\n * because the legacy controller chose HTTP 200 even on creation failure;\n * the dedicated 400 branch is reserved for the \"already installed\" guard).\n */\nimport { createRoute } from '@hono/zod-openapi';\n\nimport { CreateAdminRequestSchema, CreateAdminResponseSchema, InstallerStatusResponseSchema } from '../schemas/installer';\nimport { InternalServerErrorSchema } from '../schemas/common';\n\nexport const getInstallerStatusRoute = createRoute({\n method: 'get',\n path: '/installer',\n tags: ['installer'],\n summary: 'Get installer status',\n responses: {\n 200: {\n description: 'Installer status',\n content: {\n 'application/json': {\n schema: InstallerStatusResponseSchema,\n },\n },\n },\n 500: {\n description: 'Internal server error',\n content: {\n 'application/json': {\n schema: InternalServerErrorSchema,\n },\n },\n },\n },\n});\n\nexport const createAdminRoute = createRoute({\n method: 'post',\n path: '/installer/createAdmin',\n tags: ['installer'],\n summary: 'Create initial admin user',\n request: {\n body: {\n content: {\n 'application/json': {\n schema: CreateAdminRequestSchema,\n },\n },\n },\n },\n responses: {\n 200: {\n description: 'Admin creation result (status=ok on success, status=error on validation failure)',\n content: {\n 'application/json': {\n schema: CreateAdminResponseSchema,\n },\n },\n },\n 400: {\n description: 'Application is already installed',\n content: {\n 'application/json': {\n schema: CreateAdminResponseSchema,\n },\n },\n },\n 500: {\n description: 'Internal server error',\n content: {\n 'application/json': {\n schema: InternalServerErrorSchema,\n },\n },\n },\n },\n});\n\nexport const installerRoutes = { getInstallerStatusRoute, createAdminRoute };\n","import { z } from '@hono/zod-openapi';\n\nexport const InstallerStatusResponseSchema = z.object({\n status: z.enum(['installer_required', 'already_installed']),\n});\n\nexport const CreateAdminRequestSchema = z.object({\n registerForm: z.object({\n username: z\n .string()\n .min(1)\n .regex(/^[\\da-zA-Z\\-_.]+$/, 'username may only contain letters, digits, hyphens, underscores, and dots'),\n name: z.string().min(1),\n email: z.string().email(),\n password: z\n .string()\n .min(6)\n .regex(/^[\\x20-\\x7F]{6,}$/, 'password must be 6+ printable ASCII characters'),\n }),\n});\n\nexport const CreateAdminResponseSchema = z.object({\n status: z.enum(['ok', 'error']),\n message: z.string().optional(),\n errors: z.array(z.string()).optional(),\n});\n","/**\n * RFC-0006 Phase 4 (Batch 1) — `tokenAuth` resource ported to\n * `@hono/zod-openapi` route definitions. Five endpoints:\n *\n * POST /auth/login — public, returns access/refresh tokens\n * POST /auth/register — public, creates a pending account and returns\n * `{ status }` (email confirmation / admin approval);\n * no auth tokens until activated\n * POST /auth/refresh — public, exchanges a refresh token for new tokens\n * POST /auth/logout — auth required (server-side is stateless; the\n * client discards tokens — this is just an ACK)\n * GET /auth/me — auth required, returns the current user\n *\n * The legacy ts-rest contract declared `authorization` as a required\n * request header on `tokenLogout` / `tokenMe`. We drop that here: the\n * `createJwtAuth` middleware reads `Authorization: Bearer ...` (or the\n * `crowi.accessToken` cookie fallback) before the handler runs, so the\n * header is not a route-level input.\n */\nimport { createRoute, z } from '@hono/zod-openapi';\n\nimport {\n RefreshTokenRequestSchema,\n RegisterPendingResponseSchema,\n TokenAuthLoginRequestSchema,\n TokenAuthRegisterRequestSchema,\n TokenAuthResponseSchema,\n} from '../schemas/auth';\nimport { ApiErrorSchema, ApplicationNotInstalledErrorSchema, AuthenticationRequiredErrorSchema, InternalServerErrorSchema } from '../schemas/common';\n\nconst TokenLogoutResponseSchema = z.object({ message: z.string() });\n\nconst TokenMeResponseSchema = z.object({\n user: z.object({\n id: z.string(),\n username: z.string(),\n email: z.string().email(),\n name: z.string(),\n image: z.string().optional(),\n status: z.number(),\n admin: z.boolean().optional(),\n createdAt: z.string(),\n }),\n});\n\nexport const tokenLoginRoute = createRoute({\n method: 'post',\n path: '/auth/login',\n tags: ['tokenAuth'],\n summary: 'Authenticate user and receive tokens',\n request: {\n body: {\n content: {\n 'application/json': {\n schema: TokenAuthLoginRequestSchema,\n },\n },\n },\n },\n responses: {\n 200: {\n description: 'Successful login',\n content: { 'application/json': { schema: TokenAuthResponseSchema } },\n },\n 401: {\n description: 'Invalid email or password',\n content: { 'application/json': { schema: ApiErrorSchema } },\n },\n 403: {\n description: 'User account is not active',\n content: { 'application/json': { schema: ApiErrorSchema } },\n },\n 500: {\n description: 'Internal server error',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n 503: {\n description: 'Application is not installed',\n content: { 'application/json': { schema: ApplicationNotInstalledErrorSchema } },\n },\n },\n});\n\nexport const tokenRegisterRoute = createRoute({\n method: 'post',\n path: '/auth/register',\n tags: ['tokenAuth'],\n summary: 'Register a new user; sends an activation email or queues for admin approval',\n request: {\n body: {\n content: {\n 'application/json': {\n schema: TokenAuthRegisterRequestSchema,\n },\n },\n },\n },\n responses: {\n 200: {\n description: 'Registration accepted; activation pending (email confirmation or admin approval)',\n content: { 'application/json': { schema: RegisterPendingResponseSchema } },\n },\n 400: {\n description: 'Registration failed (validation)',\n content: { 'application/json': { schema: ApiErrorSchema } },\n },\n 403: {\n description: 'Registration is closed by the admin',\n content: { 'application/json': { schema: ApiErrorSchema } },\n },\n 409: {\n description: 'User with the same email or username already exists',\n content: { 'application/json': { schema: ApiErrorSchema } },\n },\n 500: {\n description: 'Internal server error',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n 503: {\n description: 'Application is not installed',\n content: { 'application/json': { schema: ApplicationNotInstalledErrorSchema } },\n },\n },\n});\n\nexport const tokenRefreshRoute = createRoute({\n method: 'post',\n path: '/auth/refresh',\n tags: ['tokenAuth'],\n summary: 'Refresh access token using refresh token',\n request: {\n body: {\n content: {\n 'application/json': {\n schema: RefreshTokenRequestSchema,\n },\n },\n },\n },\n responses: {\n 200: {\n description: 'Refreshed tokens',\n content: { 'application/json': { schema: TokenAuthResponseSchema } },\n },\n 400: {\n description: 'Missing refresh token',\n content: { 'application/json': { schema: ApiErrorSchema } },\n },\n 401: {\n description: 'Invalid or expired refresh token',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 404: {\n description: 'Associated user no longer exists',\n content: { 'application/json': { schema: ApiErrorSchema } },\n },\n 500: {\n description: 'Internal server error',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n },\n});\n\nexport const tokenLogoutRoute = createRoute({\n method: 'post',\n path: '/auth/logout',\n tags: ['tokenAuth'],\n security: [{ bearerAuth: [] }],\n summary: 'Logout user and invalidate tokens',\n request: {\n body: {\n content: {\n 'application/json': {\n schema: z.object({ refreshToken: z.string().optional() }),\n },\n },\n },\n },\n responses: {\n 200: {\n description: 'Logged out successfully',\n content: { 'application/json': { schema: TokenLogoutResponseSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 500: {\n description: 'Internal server error',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n },\n});\n\nexport const tokenMeRoute = createRoute({\n method: 'get',\n path: '/auth/me',\n tags: ['tokenAuth'],\n security: [{ bearerAuth: [] }],\n summary: 'Get current user information',\n responses: {\n 200: {\n description: 'Current user',\n content: { 'application/json': { schema: TokenMeResponseSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 500: {\n description: 'Internal server error',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n },\n});\n\nexport const tokenAuthRoutes = {\n tokenLoginRoute,\n tokenRegisterRoute,\n tokenRefreshRoute,\n tokenLogoutRoute,\n tokenMeRoute,\n};\n","/**\n * Token-based authentication schemas, shared by the `tokenAuth` Hono\n * contract (`packages/api-contract/src/contracts/tokenAuth.ts`).\n *\n * The legacy SSR-style schemas (`LoginRequestSchema`, `LoginResponseSchema`,\n * `RegisterRequestSchema`, `RegisterResponseSchema`, `ErrorResponseSchema`)\n * that backed the deleted `auth` contract were removed in RFC-0006 Phase 4\n * Batch 1 — the corresponding `/api/v2/login` / `/api/v2/register` paths\n * had no production frontend consumer and were dropped wholesale.\n */\nimport { z } from '@hono/zod-openapi';\n\nexport const TokenAuthLoginRequestSchema = z.object({\n email: z.string().email(),\n password: z.string().min(6),\n});\n\nexport const TokenAuthResponseSchema = z.object({\n accessToken: z.string(),\n refreshToken: z.string(),\n expiresIn: z.number(), // seconds until expiration\n user: z.object({\n id: z.string(),\n username: z.string(),\n email: z.string().email(),\n name: z.string(),\n image: z.string().optional(),\n admin: z.boolean().optional(),\n }),\n});\n\nexport const RefreshTokenRequestSchema = z.object({\n refreshToken: z.string(),\n});\n\nexport const TokenAuthRegisterRequestSchema = z.object({\n username: z.string(),\n name: z.string(),\n email: z.string().email(),\n password: z.string().min(6),\n});\n\n/**\n * Self-registration no longer auto-signs-in: the account must clear a\n * gate first. `confirmation_required` = an activation email was sent\n * (open registration with email confirmation); `approval_required` = an\n * admin must approve (restricted registration).\n */\nexport const RegisterPendingResponseSchema = z.object({\n status: z.enum(['confirmation_required', 'approval_required']),\n});\nexport type RegisterPendingResponse = z.infer<typeof RegisterPendingResponseSchema>;\n","/**\n * Public invite-acceptance routes.\n *\n * GET /invite/accept?token= — preview the invited email (page header)\n * POST /invite/accept — set username/name/password, activate,\n * and return login tokens\n *\n * Both are public (no JWT): the signed invite token is the credential.\n */\nimport { createRoute } from '@hono/zod-openapi';\n\nimport { TokenAuthResponseSchema } from '../schemas/auth';\nimport { ApiErrorSchema, InternalServerErrorSchema } from '../schemas/common';\nimport { InviteAcceptRequestSchema, InvitePreviewResponseSchema } from '../schemas/inviteAccept';\n\nexport const invitePreviewRoute = createRoute({\n method: 'get',\n path: '/invite/accept',\n tags: ['inviteAccept'],\n summary: 'Preview an invite (returns the invited email) for the acceptance page',\n request: {\n query: InviteAcceptRequestSchema.pick({ token: true }),\n },\n responses: {\n 200: {\n description: 'Invite is valid',\n content: { 'application/json': { schema: InvitePreviewResponseSchema } },\n },\n 401: {\n description: 'Invite token is invalid or expired',\n content: { 'application/json': { schema: ApiErrorSchema } },\n },\n 409: {\n description: 'Invite already accepted',\n content: { 'application/json': { schema: ApiErrorSchema } },\n },\n 500: {\n description: 'Internal server error',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n },\n});\n\nexport const acceptInviteRoute = createRoute({\n method: 'post',\n path: '/invite/accept',\n tags: ['inviteAccept'],\n summary: 'Accept an invite: set credentials, activate the account, sign in',\n request: {\n body: {\n content: { 'application/json': { schema: InviteAcceptRequestSchema } },\n },\n },\n responses: {\n 200: {\n description: 'Invite accepted; account activated and signed in',\n content: { 'application/json': { schema: TokenAuthResponseSchema } },\n },\n 400: {\n description: 'Validation failed',\n content: { 'application/json': { schema: ApiErrorSchema } },\n },\n 401: {\n description: 'Invite token is invalid or expired',\n content: { 'application/json': { schema: ApiErrorSchema } },\n },\n 404: {\n description: 'Invited user no longer exists',\n content: { 'application/json': { schema: ApiErrorSchema } },\n },\n 409: {\n description: 'Invite already accepted, or username already taken',\n content: { 'application/json': { schema: ApiErrorSchema } },\n },\n 500: {\n description: 'Internal server error',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n },\n});\n\nexport const inviteAcceptRoutes = {\n invitePreviewRoute,\n acceptInviteRoute,\n};\n","/**\n * Schemas for the public invite-acceptance flow. An admin invites a user\n * by email; the invitee receives a signed invite-token link and lands on\n * `(public)/invite/accept`, where they choose their own username / name /\n * password. On success the account flips from STATUS_INVITED to\n * STATUS_ACTIVE and the response carries login tokens (same shape as\n * `tokenAuth`), so the invitee is signed in immediately.\n */\nimport { z } from '@hono/zod-openapi';\n\nexport const InviteAcceptRequestSchema = z.object({\n token: z.string(),\n username: z.string().min(1),\n name: z.string().min(1),\n password: z.string().min(6),\n});\nexport type InviteAcceptRequest = z.infer<typeof InviteAcceptRequestSchema>;\n\n/** GET /invite/accept?token= — preview the invited email for the page header. */\nexport const InvitePreviewResponseSchema = z.object({\n email: z.string().email(),\n});\nexport type InvitePreviewResponse = z.infer<typeof InvitePreviewResponseSchema>;\n","/**\n * Public self-service password-reset routes.\n *\n * POST /auth/forgot-password — email a reset link (always 200)\n * GET /auth/reset-password?token= — validate token for the page\n * POST /auth/reset-password — set new password; returns login tokens\n *\n * All public: the signed reset token is the credential.\n */\nimport { createRoute } from '@hono/zod-openapi';\n\nimport { TokenAuthResponseSchema } from '../schemas/auth';\nimport { ApiErrorSchema, InternalServerErrorSchema } from '../schemas/common';\nimport { ForgotPasswordRequestSchema, ForgotPasswordResponseSchema, ResetPasswordRequestSchema } from '../schemas/passwordReset';\n\nexport const forgotPasswordRoute = createRoute({\n method: 'post',\n path: '/auth/forgot-password',\n tags: ['passwordReset'],\n summary: 'Request a password-reset link by email (always succeeds)',\n request: {\n body: {\n content: { 'application/json': { schema: ForgotPasswordRequestSchema } },\n },\n },\n responses: {\n 200: {\n description: 'Accepted (a link is sent if the email maps to an active account)',\n content: { 'application/json': { schema: ForgotPasswordResponseSchema } },\n },\n 400: {\n description: 'Validation failed',\n content: { 'application/json': { schema: ApiErrorSchema } },\n },\n 500: {\n description: 'Internal server error',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n },\n});\n\nexport const validateResetTokenRoute = createRoute({\n method: 'get',\n path: '/auth/reset-password',\n tags: ['passwordReset'],\n summary: 'Validate a password-reset token (page preflight)',\n request: {\n query: ResetPasswordRequestSchema.pick({ token: true }),\n },\n responses: {\n 200: {\n description: 'Token is valid',\n content: { 'application/json': { schema: ForgotPasswordResponseSchema } },\n },\n 401: {\n description: 'Token is invalid or expired',\n content: { 'application/json': { schema: ApiErrorSchema } },\n },\n 500: {\n description: 'Internal server error',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n },\n});\n\nexport const selfResetPasswordRoute = createRoute({\n method: 'post',\n path: '/auth/reset-password',\n tags: ['passwordReset'],\n summary: 'Set a new password with a reset token; signs the user in',\n request: {\n body: {\n content: { 'application/json': { schema: ResetPasswordRequestSchema } },\n },\n },\n responses: {\n 200: {\n description: 'Password updated; signed in',\n content: { 'application/json': { schema: TokenAuthResponseSchema } },\n },\n 400: {\n description: 'Validation failed',\n content: { 'application/json': { schema: ApiErrorSchema } },\n },\n 401: {\n description: 'Token is invalid or expired',\n content: { 'application/json': { schema: ApiErrorSchema } },\n },\n 404: {\n description: 'Associated user no longer exists',\n content: { 'application/json': { schema: ApiErrorSchema } },\n },\n 500: {\n description: 'Internal server error',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n },\n});\n\nexport const passwordResetRoutes = {\n forgotPasswordRoute,\n validateResetTokenRoute,\n selfResetPasswordRoute,\n};\n","/**\n * Schemas for the public self-service password-reset flow.\n *\n * POST /auth/forgot-password — request a reset link by email\n * GET /auth/reset-password — validate a reset token (page preflight)\n * POST /auth/reset-password — set a new password with the token\n *\n * The reset token is a signed mail token (purpose `'reset'`); see\n * `packages/api/src/util/mail-token.ts`.\n */\nimport { z } from '@hono/zod-openapi';\n\nexport const ForgotPasswordRequestSchema = z.object({\n email: z.string().email(),\n});\nexport type ForgotPasswordRequest = z.infer<typeof ForgotPasswordRequestSchema>;\n\n/**\n * Always-OK response. We never reveal whether the email maps to an\n * account (anti-enumeration), so success and \"no such user\" look\n * identical to the caller.\n */\nexport const ForgotPasswordResponseSchema = z.object({\n ok: z.literal(true),\n});\nexport type ForgotPasswordResponse = z.infer<typeof ForgotPasswordResponseSchema>;\n\nexport const ResetPasswordRequestSchema = z.object({\n token: z.string(),\n password: z.string().min(6),\n});\nexport type ResetPasswordRequest = z.infer<typeof ResetPasswordRequestSchema>;\n","/**\n * Public account-activation (email confirmation) routes.\n *\n * GET /auth/activate?token= — validate token for the page preflight\n * POST /auth/activate — confirm email, activate, sign in\n *\n * Public: the signed activation token is the credential.\n */\nimport { createRoute } from '@hono/zod-openapi';\n\nimport { ActivateRequestSchema, ActivateValidationResponseSchema } from '../schemas/activation';\nimport { TokenAuthResponseSchema } from '../schemas/auth';\nimport { ApiErrorSchema, InternalServerErrorSchema } from '../schemas/common';\n\nexport const validateActivationTokenRoute = createRoute({\n method: 'get',\n path: '/auth/activate',\n tags: ['activation'],\n summary: 'Validate an activation token (page preflight)',\n request: {\n query: ActivateRequestSchema.pick({ token: true }),\n },\n responses: {\n 200: {\n description: 'Token is valid',\n content: { 'application/json': { schema: ActivateValidationResponseSchema } },\n },\n 401: {\n description: 'Token is invalid or expired',\n content: { 'application/json': { schema: ApiErrorSchema } },\n },\n 500: {\n description: 'Internal server error',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n },\n});\n\nexport const activateAccountRoute = createRoute({\n method: 'post',\n path: '/auth/activate',\n tags: ['activation'],\n summary: 'Confirm email with an activation token; activates and signs in',\n request: {\n body: {\n content: { 'application/json': { schema: ActivateRequestSchema } },\n },\n },\n responses: {\n 200: {\n description: 'Email confirmed; account activated and signed in',\n content: { 'application/json': { schema: TokenAuthResponseSchema } },\n },\n 401: {\n description: 'Token is invalid or expired',\n content: { 'application/json': { schema: ApiErrorSchema } },\n },\n 404: {\n description: 'Associated user no longer exists',\n content: { 'application/json': { schema: ApiErrorSchema } },\n },\n 500: {\n description: 'Internal server error',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n },\n});\n\nexport const activationRoutes = {\n validateActivationTokenRoute,\n activateAccountRoute,\n};\n","/**\n * Schemas for the public account-activation (email confirmation) flow.\n *\n * GET /auth/activate?token= — validate an activation token (preflight)\n * POST /auth/activate — confirm email, activate, and sign in\n *\n * The activation token is a signed mail token (purpose `'activate'`);\n * see `packages/api/src/util/mail-token.ts`.\n */\nimport { z } from '@hono/zod-openapi';\n\nexport const ActivateRequestSchema = z.object({\n token: z.string(),\n});\nexport type ActivateRequest = z.infer<typeof ActivateRequestSchema>;\n\n/** GET preflight result. */\nexport const ActivateValidationResponseSchema = z.object({\n ok: z.literal(true),\n});\nexport type ActivateValidationResponse = z.infer<typeof ActivateValidationResponseSchema>;\n","/**\n * Public email-change confirmation routes.\n *\n * GET /auth/confirm-email-change?token= — preflight (token valid?)\n * POST /auth/confirm-email-change — apply the new email address\n *\n * Public: the signed (purpose='email-change') token is the credential.\n */\nimport { createRoute } from '@hono/zod-openapi';\n\nimport { ApiErrorSchema, InternalServerErrorSchema } from '../schemas/common';\nimport { ConfirmEmailChangeRequestSchema, ConfirmEmailChangeResponseSchema } from '../schemas/emailChange';\n\nexport const validateEmailChangeTokenRoute = createRoute({\n method: 'get',\n path: '/auth/confirm-email-change',\n tags: ['emailChange'],\n summary: 'Validate an email-change token (page preflight)',\n request: {\n query: ConfirmEmailChangeRequestSchema.pick({ token: true }),\n },\n responses: {\n 200: {\n description: 'Token is valid',\n content: { 'application/json': { schema: ConfirmEmailChangeResponseSchema } },\n },\n 401: {\n description: 'Token is invalid or expired',\n content: { 'application/json': { schema: ApiErrorSchema } },\n },\n 500: {\n description: 'Internal server error',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n },\n});\n\nexport const confirmEmailChangeRoute = createRoute({\n method: 'post',\n path: '/auth/confirm-email-change',\n tags: ['emailChange'],\n summary: 'Apply a confirmed email-address change',\n request: {\n body: {\n content: { 'application/json': { schema: ConfirmEmailChangeRequestSchema } },\n },\n },\n responses: {\n 200: {\n description: 'Email address updated',\n content: { 'application/json': { schema: ConfirmEmailChangeResponseSchema } },\n },\n 401: {\n description: 'Token is invalid or expired',\n content: { 'application/json': { schema: ApiErrorSchema } },\n },\n 404: {\n description: 'Associated user no longer exists',\n content: { 'application/json': { schema: ApiErrorSchema } },\n },\n 409: {\n description: 'The new email address is already in use',\n content: { 'application/json': { schema: ApiErrorSchema } },\n },\n 500: {\n description: 'Internal server error',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n },\n});\n\nexport const emailChangeRoutes = {\n validateEmailChangeTokenRoute,\n confirmEmailChangeRoute,\n};\n","/**\n * Schemas for confirming a requested email-address change. The user\n * requests the change via `PUT /me` (which does NOT apply it); a\n * confirmation link is sent to the *new* address, and clicking it hits\n * these public endpoints. The signed token (purpose `'email-change'`,\n * payload `email` = the new address) is the credential.\n */\nimport { z } from '@hono/zod-openapi';\n\nexport const ConfirmEmailChangeRequestSchema = z.object({\n token: z.string(),\n});\nexport type ConfirmEmailChangeRequest = z.infer<typeof ConfirmEmailChangeRequestSchema>;\n\nexport const ConfirmEmailChangeResponseSchema = z.object({\n ok: z.literal(true),\n /** The newly-confirmed email address. */\n email: z.string().email(),\n});\nexport type ConfirmEmailChangeResponse = z.infer<typeof ConfirmEmailChangeResponseSchema>;\n","/**\n * RFC-0006 Phase 4 Batch 2 — `me` resource ported to `@hono/zod-openapi`\n * route definitions. Eight endpoints:\n *\n * GET /me — current user's profile\n * PUT /me — update profile (name/email/lang)\n * POST /me/picture — upload profile picture (multipart)\n * DELETE /me/picture — clear profile picture\n * PUT /me/password — change password (or set initial)\n * GET /me/recently-viewed-pages — recently viewed page list\n *\n * Personal access token management (RFC-0010, replacing the legacy\n * `GET/POST /me/apiToken`) lives in `./access-token.ts`.\n *\n * All endpoints require JWT authentication. The handler applies the\n * shared `createJwtAuth(crowi)` middleware to `/me/*` (broad apply) so\n * every route below sees `c.get('user')` populated with a `UserDocument`.\n *\n * Multipart picture upload uses Hono-native `c.req.parseBody()` rather\n * than `multer` (discovery doc §5 decision); the legacy form-field name\n * `file` is preserved so existing clients (web `<input name=\"file\">`)\n * keep working.\n */\nimport { createRoute, z } from '@hono/zod-openapi';\n\nimport {\n PasswordErrorResponseSchema,\n PasswordUpdateSuccessSchema,\n PictureUploadResponseSchema,\n ProfileErrorResponseSchema,\n RecentlyViewedPagesResponseSchema,\n SuccessResponseSchema,\n ThemeUpdateResponseSchema,\n UpdatePasswordRequestSchema,\n UpdateProfileRequestSchema,\n UpdateThemeRequestSchema,\n UserProfileResponseSchema,\n} from '../schemas/me';\nimport { AuthenticationRequiredErrorSchema, InternalServerErrorSchema } from '../schemas/common';\n\nexport const getProfileRoute = createRoute({\n method: 'get',\n path: '/me',\n tags: ['me'],\n security: [{ bearerAuth: [] }],\n summary: 'Get current user profile',\n responses: {\n 200: {\n description: 'Current user profile',\n content: { 'application/json': { schema: UserProfileResponseSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n },\n});\n\nexport const updateProfileRoute = createRoute({\n method: 'put',\n path: '/me',\n tags: ['me'],\n security: [{ bearerAuth: [] }],\n summary: 'Update profile',\n request: {\n body: {\n content: { 'application/json': { schema: UpdateProfileRequestSchema } },\n },\n },\n responses: {\n 200: {\n description: 'Updated profile',\n content: { 'application/json': { schema: UserProfileResponseSchema } },\n },\n 400: {\n description: 'Profile update failed',\n content: { 'application/json': { schema: ProfileErrorResponseSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n },\n});\n\nexport const updateThemeRoute = createRoute({\n method: 'patch',\n path: '/me/theme',\n tags: ['me'],\n security: [{ bearerAuth: [] }],\n summary: 'Update preferred UI theme',\n request: {\n body: {\n content: { 'application/json': { schema: UpdateThemeRequestSchema } },\n },\n },\n responses: {\n 200: {\n description: 'Theme updated',\n content: { 'application/json': { schema: ThemeUpdateResponseSchema } },\n },\n 400: {\n description: 'Theme update failed',\n content: { 'application/json': { schema: ProfileErrorResponseSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n },\n});\n\nexport const uploadPictureRoute = createRoute({\n method: 'post',\n path: '/me/picture',\n tags: ['me'],\n security: [{ bearerAuth: [] }],\n summary: 'Upload profile picture',\n request: {\n body: {\n content: {\n 'multipart/form-data': {\n schema: z.object({\n file: z.any().optional().describe('Profile picture file'),\n }),\n },\n },\n },\n },\n responses: {\n 200: {\n description: 'Picture uploaded',\n content: { 'application/json': { schema: PictureUploadResponseSchema } },\n },\n 400: {\n description: 'Upload failed',\n content: { 'application/json': { schema: ProfileErrorResponseSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n },\n});\n\nexport const deletePictureRoute = createRoute({\n method: 'delete',\n path: '/me/picture',\n tags: ['me'],\n security: [{ bearerAuth: [] }],\n summary: 'Delete profile picture',\n responses: {\n 200: {\n description: 'Picture deleted',\n content: { 'application/json': { schema: SuccessResponseSchema } },\n },\n 400: {\n description: 'Delete failed',\n content: { 'application/json': { schema: ProfileErrorResponseSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n },\n});\n\nexport const updatePasswordRoute = createRoute({\n method: 'put',\n path: '/me/password',\n tags: ['me'],\n security: [{ bearerAuth: [] }],\n summary: 'Update password',\n request: {\n body: {\n content: { 'application/json': { schema: UpdatePasswordRequestSchema } },\n },\n },\n responses: {\n 200: {\n description: 'Password updated',\n content: { 'application/json': { schema: PasswordUpdateSuccessSchema } },\n },\n 400: {\n description: 'Password update failed',\n content: { 'application/json': { schema: PasswordErrorResponseSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n },\n});\n\nexport const recentlyViewedPagesRoute = createRoute({\n method: 'get',\n path: '/me/recently-viewed-pages',\n tags: ['me'],\n security: [{ bearerAuth: [] }],\n summary: \"Get the current user's recently-viewed pages\",\n responses: {\n 200: {\n description: 'Recently-viewed pages list (up to 5)',\n content: { 'application/json': { schema: RecentlyViewedPagesResponseSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 500: {\n description: 'Internal server error',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n },\n});\n\nexport const meRoutes = {\n getProfileRoute,\n updateProfileRoute,\n updateThemeRoute,\n uploadPictureRoute,\n deletePictureRoute,\n updatePasswordRoute,\n recentlyViewedPagesRoute,\n};\n","import { z } from '@hono/zod-openapi';\nimport { PageSchema } from './page';\n\n// Language enum - matches User model. Only `en` / `ja` are live UI locales\n// (paraglide `locales`); the legacy regional variants (`en-US` / `en-GB`) were\n// retired. Existing rows carrying them are normalised to `en` on read (see\n// `userToProfileResponse`) and coerced on write (User `pre('validate')` hook).\nexport const LanguageSchema = z.enum(['en', 'ja']);\nexport type Language = z.infer<typeof LanguageSchema>;\n\n// Theme enum - matches User model. `system` follows the OS setting.\nexport const ThemeSchema = z.enum(['system', 'light', 'dark']);\nexport type Theme = z.infer<typeof ThemeSchema>;\n\n// User profile response schema\nexport const UserProfileResponseSchema = z.object({\n id: z.string(),\n username: z.string(),\n name: z.string(),\n email: z.string().email(),\n lang: LanguageSchema,\n theme: ThemeSchema,\n image: z.string().nullable(),\n introduction: z.string().optional(),\n hasPassword: z.boolean(),\n createdAt: z.string(),\n /**\n * True when the profile update requested a new email that is awaiting\n * confirmation: the stored `email` is unchanged and a confirmation\n * link was sent to the new address.\n */\n emailChangePending: z.boolean().optional(),\n});\nexport type UserProfileResponse = z.infer<typeof UserProfileResponseSchema>;\n\n// Update profile request schema\nexport const UpdateProfileRequestSchema = z.object({\n userForm: z.object({\n name: z.string().min(1, 'Name is required'),\n email: z.string().email('Invalid email format'),\n lang: LanguageSchema,\n }),\n});\nexport type UpdateProfileRequest = z.infer<typeof UpdateProfileRequestSchema>;\n\n// Update theme request schema. Theme is synced on its own lightweight\n// endpoint (driven by the header / sign-in toggle) rather than via the full\n// profile form, so the `next-themes` change can persist without resubmitting\n// name / email.\nexport const UpdateThemeRequestSchema = z.object({\n theme: ThemeSchema,\n});\nexport type UpdateThemeRequest = z.infer<typeof UpdateThemeRequestSchema>;\n\n// Theme update response schema.\nexport const ThemeUpdateResponseSchema = z.object({\n status: z.literal('ok'),\n theme: ThemeSchema,\n});\nexport type ThemeUpdateResponse = z.infer<typeof ThemeUpdateResponseSchema>;\n\n// Picture upload response schema\nexport const PictureUploadResponseSchema = z.object({\n status: z.boolean(),\n url: z.string().optional(),\n message: z.string().optional(),\n});\nexport type PictureUploadResponse = z.infer<typeof PictureUploadResponseSchema>;\n\n// Generic success response schema\nexport const SuccessResponseSchema = z.object({\n status: z.literal('ok'),\n message: z.string().optional(),\n});\nexport type SuccessResponse = z.infer<typeof SuccessResponseSchema>;\n\n// Error response schema for profile operations\nexport const ProfileErrorResponseSchema = z.object({\n status: z.literal('error'),\n /** Stable code so the web can localize the message (e.g. EMAIL_TAKEN). */\n code: z.string().optional(),\n message: z.string().optional(),\n errors: z.array(z.string()).optional(),\n});\nexport type ProfileErrorResponse = z.infer<typeof ProfileErrorResponseSchema>;\n\n// Password validation regex\n// New password must contain at least one letter, one digit, and one special character\n// Allowed special characters: !@#$%^&*()_+-=[]{};\\:'\"|,.<>/?`~\nconst PASSWORD_REGEX = /^(?=.*[a-zA-Z])(?=.*\\d)(?=.*[!@#$%^&*()_+\\-=\\[\\]{};':\"\\\\|,.<>\\/?`~])[a-zA-Z\\d!@#$%^&*()_+\\-=\\[\\]{};':\"\\\\|,.<>\\/?`~]+$/;\n\n// Password update request schema\nexport const UpdatePasswordRequestSchema = z\n .object({\n oldPassword: z.string().optional(),\n newPassword: z\n .string()\n .min(8, 'Password must be at least 8 characters')\n .max(100, 'Password must be at most 100 characters')\n .regex(PASSWORD_REGEX, 'Password must contain at least one letter, one digit, and one special character'),\n newPasswordConfirm: z.string(),\n })\n .refine((data) => data.newPassword === data.newPasswordConfirm, {\n message: 'Passwords do not match',\n path: ['newPasswordConfirm'],\n });\nexport type UpdatePasswordRequest = z.infer<typeof UpdatePasswordRequestSchema>;\n\n// Password update success response schema\nexport const PasswordUpdateSuccessSchema = z.object({\n status: z.literal('ok'),\n message: z.string(),\n});\nexport type PasswordUpdateSuccess = z.infer<typeof PasswordUpdateSuccessSchema>;\n\n// Password error response schema\nexport const PasswordErrorResponseSchema = z.object({\n status: z.literal('error'),\n message: z.string(),\n errors: z.array(z.string()).optional(),\n});\nexport type PasswordErrorResponse = z.infer<typeof PasswordErrorResponseSchema>;\n\nexport const RecentlyViewedPagesResponseSchema = z.object({\n pages: z.array(PageSchema),\n});\nexport type RecentlyViewedPagesResponse = z.infer<typeof RecentlyViewedPagesResponseSchema>;\n","import { z } from '@hono/zod-openapi';\nimport { RevisionTypeSchema } from './collab';\nimport { UserPublicSchema } from './userPublic';\n\n// Page grant enum - matches Page model constants\nexport const PageGrantSchema = z.enum(['1', '2', '3', '4']).transform((val) => Number(val));\nexport const PageGrantEnum = {\n PUBLIC: 1,\n RESTRICTED: 2,\n SPECIFIED: 3,\n OWNER: 4,\n} as const;\n\n// Page status enum - matches Page model constants. `'draft'` (RFC-0004)\n// surfaces on the listing when the viewer reads their own unpublished\n// drafts, so the schema must accept it or the row's `status` would be\n// elided client-side and the UI couldn't render a \"draft\" indicator.\nexport const PageStatusSchema = z.enum(['wip', 'published', 'deleted', 'deprecated', 'draft']);\nexport const PageStatusEnum = {\n WIP: 'wip',\n PUBLISHED: 'published',\n DELETED: 'deleted',\n DEPRECATED: 'deprecated',\n DRAFT: 'draft',\n} as const;\n\n// Page type enum\nexport const PageTypeSchema = z.enum(['portal', 'user', 'public']);\nexport const PageTypeEnum = {\n PORTAL: 'portal',\n USER: 'user',\n PUBLIC: 'public',\n} as const;\n\n// User schema - minimal user information for page responses\nexport const PageUserSchema = z.object({\n _id: z.string(),\n id: z.string().optional(), // for compatibility\n username: z.string(),\n name: z.string(),\n email: z.string().email(),\n image: z.string().nullable().optional(),\n createdAt: z.string(),\n});\nexport type PageUser = z.infer<typeof PageUserSchema>;\n\n// TOC entry — derived from a revision body's headings, populated on\n// save and (for older revisions) computed on the fly during read.\nexport const TocEntrySchema = z.object({\n level: z.number().int().min(1).max(6),\n text: z.string(),\n anchorId: z.string(),\n});\nexport type TocEntryResponse = z.infer<typeof TocEntrySchema>;\n\n// `[[Page]]` / `[[/path]]` / `[[Page|Display]]` / `[[Page#section]]`\n// references extracted from the body. RFC-0002 Phase 2.\nexport const WikiLinkSchema = z.object({\n /** Verbatim source between the `[[` `]]` (no surrounding brackets). */\n raw: z.string(),\n /** Normalised target (left of the `|`, fragment trimmed for resolution). */\n target: z.string(),\n /** Optional pipe-aliased display text (right of the `|`). */\n displayText: z.string().optional(),\n});\nexport type WikiLinkResponse = z.infer<typeof WikiLinkSchema>;\n\n// `@username` references extracted from the body. Username is\n// pre-validated to `[A-Za-z0-9_-]{1,64}` by the extractor.\nexport const MentionSchema = z.object({\n username: z.string(),\n});\nexport type MentionResponse = z.infer<typeof MentionSchema>;\n\n// Revision-bound metadata derived from the body. RFC-0002 Phase 2\n// adds wikiLinks / mentions / codeBlockLanguages alongside `toc`.\nexport const RevisionMetaSchemaShape = z.object({\n toc: z.array(TocEntrySchema).optional(),\n wikiLinks: z.array(WikiLinkSchema).optional(),\n mentions: z.array(MentionSchema).optional(),\n codeBlockLanguages: z.array(z.string()).optional(),\n});\nexport type RevisionMetaShape = z.infer<typeof RevisionMetaSchemaShape>;\n\n// Revision schema - matches RevisionDocument\nexport const RevisionSchema = z.object({\n _id: z.string(),\n path: z.string(),\n body: z.string(),\n format: z.string().default('markdown'),\n author: PageUserSchema.nullable().optional(),\n createdAt: z.string(),\n meta: RevisionMetaSchemaShape.optional(),\n // RFC-0002 Phase 3: transformed mdast (parse + core plugins +\n // shiki) for the web client to render without re-parsing the body.\n // Typed as opaque `unknown` because mdast is too deep / external-\n // spec to maintain a strict Zod schema for. Only single-page detail\n // (`getPage`) and single-revision detail (`getRevision`) emit it;\n // list endpoints skip it for payload weight.\n renderedAst: z.unknown().optional(),\n // RFC-0002 round 3.1: semver of the renderer pipeline that produced\n // `renderedAst`. The read path uses this to detect stale entries\n // (rebuilt by `renderer:rebuild` once RFC-0008 lands). Absent on\n // revisions saved before this field was introduced.\n rendererVersion: z.string().optional(),\n // RFC-0003 collaborative-save fields. All optional; v1.x revisions\n // emit none of them. See `packages/api/src/models/revision.ts` for\n // semantics. The list-page endpoint currently does not surface\n // these — they only appear on the Phase 5+ checkpoint Revisions\n // produced by Hocuspocus and on the single-revision detail route.\n parentRevisionId: z.string().nullable().optional(),\n type: RevisionTypeSchema.optional(),\n savedBy: z.union([z.string(), PageUserSchema]).nullable().optional(),\n contributors: z.array(z.union([z.string(), PageUserSchema])).optional(),\n message: z.string().optional(),\n // RFC-0010 — edit channel ('web' | 'oauth' | 'pat'); absent on\n // pre-RFC-0010 / collaborative / browser revisions.\n editVia: z.enum(['web', 'oauth', 'pat']).optional(),\n});\nexport type Revision = z.infer<typeof RevisionSchema>;\n\n// Page extended data schema\nexport const PageExtendedSchema = z.record(z.string(), z.any()).optional();\n\n// Base page schema - matches PageDocument\nexport const PageSchema = z.object({\n _id: z.string(),\n path: z.string(),\n revision: z.union([z.string(), RevisionSchema]).optional(),\n redirectTo: z.string().nullable().optional(),\n status: PageStatusSchema.nullable().optional(),\n grant: z.number().optional(),\n grantedUsers: z.array(z.string()).optional(),\n creator: z.union([z.string(), PageUserSchema]).nullable().optional(),\n lastUpdateUser: z.union([z.string(), PageUserSchema]).nullable().optional(),\n liker: z.array(z.string()).optional(),\n commentCount: z.number().default(0),\n extended: PageExtendedSchema,\n createdAt: z.string(),\n updatedAt: z.string().optional(),\n // RFC-0003 collaborative-edit fields. All optional; `null` is the\n // \"no live state yet\" value. Existing read endpoints (list /\n // detail) do not currently emit these — the contract is widened\n // here so Phase 5+ endpoints can return them without a contract\n // bump. `yjsState` is intentionally omitted from the contract:\n // the binary blob lives only inside Hocuspocus and never crosses\n // the HTTP API.\n currentRevision: z.string().nullable().optional(),\n yjsCheckpointAt: z.string().nullable().optional(),\n // dynamic fields\n latestRevision: z.string().optional(),\n likerCount: z.number().optional(),\n seenUsersCount: z.number().optional(),\n});\nexport type Page = z.infer<typeof PageSchema>;\n\n// Page with populated revision - for detailed page responses\nexport const PageWithRevisionSchema = PageSchema.extend({\n revision: RevisionSchema,\n creator: PageUserSchema.nullable().optional(),\n lastUpdateUser: PageUserSchema.nullable().optional(),\n});\nexport type PageWithRevision = z.infer<typeof PageWithRevisionSchema>;\n\n// Get page request schema - using query parameters\nexport const GetPageRequestSchema = z.object({\n path: z.string().optional(),\n page_id: z.string().optional(),\n revision_id: z.string().optional(),\n});\nexport type GetPageRequest = z.infer<typeof GetPageRequestSchema>;\n\n// Get page response schema\nexport const GetPageResponseSchema = z.object({\n page: PageWithRevisionSchema,\n});\nexport type GetPageResponse = z.infer<typeof GetPageResponseSchema>;\n\n// List pages request schema\nexport const ListPagesRequestSchema = z.object({\n path: z.string().optional(),\n user: z.string().optional(),\n limit: z.coerce.number().optional().default(50),\n offset: z.coerce.number().optional().default(0),\n // NOT `z.coerce.boolean()`: that uses JS `Boolean(v)`, so the string\n // `\"false\"` (which is how the web client serialises `false` on the\n // query string) coerces to `true`. That silently flipped\n // `include_deleted` on, which made the listing skip the draft/status\n // filter and leak other users' drafts. Parse the string explicitly so\n // only `\"true\"` / `true` is truthy; anything else (incl. `\"false\"`,\n // absent) is `false`.\n include_deleted: z\n .preprocess((v) => v === true || v === 'true' || v === '1', z.boolean())\n .optional()\n .default(false),\n // Sort field + direction for the listing. Defaults preserve the legacy\n // \"newest-updated first\" order so existing callers are unaffected.\n // `path` sorts alphabetically by full page path (≈ name order).\n sort: z.enum(['updatedAt', 'createdAt', 'path']).optional().default('updatedAt'),\n order: z.enum(['asc', 'desc']).optional().default('desc'),\n});\nexport type ListPagesRequest = z.infer<typeof ListPagesRequestSchema>;\nexport type ListPagesSort = ListPagesRequest['sort'];\n\n// Pager schema\nexport const PagerSchema = z.object({\n prev: z.number().nullable(),\n next: z.number().nullable(),\n offset: z.number(),\n});\nexport type Pager = z.infer<typeof PagerSchema>;\n\n// List pages response schema\nexport const ListPagesResponseSchema = z.object({\n pages: z.array(PageSchema),\n pager: PagerSchema,\n portalPage: PageSchema.nullable().optional(),\n});\nexport type ListPagesResponse = z.infer<typeof ListPagesResponseSchema>;\n\n// Sidebar hierarchy — the immediate child \"directories\" (next path\n// segment) directly under a portal path, aggregated server-side. Backs\n// the list-page / single-page sidebar tree. Unpaginated: a single\n// portal's direct children are bounded enough to return whole, and the\n// sidebar needs the *complete* set of first-level segments (a paginated\n// /pages/list slice would drop segments past the page boundary).\nexport const PageChildSegmentSchema = z.object({\n // The bare segment name immediately under the queried path\n // (e.g. 'rfc' for /crowi/rfc/... when querying /crowi/).\n segment: z.string(),\n // Portal-style path for this segment (always trailing-slashed),\n // e.g. '/crowi/rfc/'. Drop the trailing slash for the page path when\n // the segment is a leaf page (see `isPage`).\n path: z.string(),\n // True when a real page is saved at the segment path itself\n // (e.g. `/crowi/rfc`, no trailing slash) — i.e. the segment is a\n // navigable page, not only an inferred directory.\n isPage: z.boolean(),\n // True when a real portal page is saved at `path` (→ compass icon).\n hasPortal: z.boolean(),\n // Number of descendant content pages strictly under this segment\n // (excludes the segment's own page / portal docs). A rough \"how much\n // lives here\" hint; > 0 means the segment is an expandable directory.\n count: z.number(),\n});\nexport type PageChildSegment = z.infer<typeof PageChildSegmentSchema>;\n\n// List page children request schema\nexport const ListPageChildrenRequestSchema = z.object({\n // Portal path to list children of. Trailing slash optional — the\n // handler normalises it. '/' lists the top-level segments.\n path: z.string(),\n});\nexport type ListPageChildrenRequest = z.infer<typeof ListPageChildrenRequestSchema>;\n\n// List page children response schema\nexport const ListPageChildrenResponseSchema = z.object({\n // Sorted alphabetically by segment.\n children: z.array(PageChildSegmentSchema),\n});\nexport type ListPageChildrenResponse = z.infer<typeof ListPageChildrenResponseSchema>;\n\n// Create page request schema\nexport const CreatePageRequestSchema = z.object({\n path: z.string(),\n body: z.string(),\n grant: z.number().optional(),\n});\nexport type CreatePageRequest = z.infer<typeof CreatePageRequestSchema>;\n\n// Update page request schema\nexport const UpdatePageRequestSchema = z.object({\n page_id: z.string(),\n body: z.string(),\n revision_id: z.string().optional(),\n grant: z.number().optional(),\n});\nexport type UpdatePageRequest = z.infer<typeof UpdatePageRequestSchema>;\n\n// Set page grant request schema\n//\n// A lightweight grant-only update. Unlike `updatePage` this does NOT\n// push a new revision — it only mutates `page.grant` / `grantedUsers`\n// (see Page.updateGrant). Used by the editor's grant (visibility)\n// selector so changing a page's visibility never produces a no-op\n// revision in the history.\nexport const SetPageGrantRequestSchema = z.object({\n page_id: z.string(),\n grant: z.number().int(),\n});\nexport type SetPageGrantRequest = z.infer<typeof SetPageGrantRequestSchema>;\n\n// Rename page request schema\nexport const RenamePageRequestSchema = z.object({\n page_id: z.string(),\n new_path: z.string(),\n revision_id: z.string().optional(),\n create_redirect: z.boolean().optional(),\n // When true, rename the page together with its whole (grant-visible)\n // descendant subtree (renameTree) instead of just the single page.\n // Defaults to false — the single-page rename behaviour.\n include_descendants: z.boolean().optional(),\n});\nexport type RenamePageRequest = z.infer<typeof RenamePageRequestSchema>;\n\n// Rename page response schema\n//\n// Shared by single-page and subtree renames. `renamed_count` is the number\n// of pages whose path was rewritten (1 for a single rename, root + descendants\n// for a subtree). `partial` is set when a subtree rename failed midway —\n// best-effort / non-transactional, so some pages may already have moved.\nexport const RenamePageResponseSchema = z.object({\n page: PageSchema,\n renamed_count: z.number(),\n});\nexport type RenamePageResponse = z.infer<typeof RenamePageResponseSchema>;\n\n// Structured 400 returned when a subtree rename (include_descendants:true)\n// cannot proceed because one or more destination paths collide or are not a\n// creatable name. `conflicts` tells the client which path failed and why\n// (i18n keys from Page.checkPagesRenamable, e.g.\n// 'rename_tree.error.already_exists' / 'rename_tree.error.can_not_use_this_name').\nexport const RenameTreeErrorSchema = z.object({\n error: z.object({\n code: z.literal('PAGE_RENAME_TREE_FAILED'),\n message: z.string(),\n conflicts: z.array(\n z.object({\n path: z.string(),\n reasons: z.array(z.string()),\n }),\n ),\n // True when the failure happened after some pages were already moved\n // (non-transactional best-effort). When omitted/false the failure was\n // detected up-front and nothing was moved.\n partial: z.boolean().optional(),\n }),\n});\nexport type RenameTreeError = z.infer<typeof RenameTreeErrorSchema>;\n\n// Rename-subtree request schema\n//\n// Moves a whole subtree by *path* rather than by page_id — used to rename a\n// portal-less list page (a folder like `/foo/bar/` that has descendants but no\n// page document of its own, so there is no page_id / revision to key on).\n// Always a subtree move: every grant-visible page under `old_path` is rewritten\n// to sit under `new_path`.\nexport const RenameSubtreeRequestSchema = z.object({\n old_path: z.string(),\n new_path: z.string(),\n create_redirect: z.boolean().optional(),\n});\nexport type RenameSubtreeRequest = z.infer<typeof RenameSubtreeRequestSchema>;\n\n// Rename-subtree response — how many pages were rewritten. There is no root\n// page to return (the folder had none), so the client navigates to the new\n// folder path itself.\nexport const RenameSubtreeResponseSchema = z.object({\n renamed_count: z.number(),\n});\nexport type RenameSubtreeResponse = z.infer<typeof RenameSubtreeResponseSchema>;\n\n// Error response schemas\nexport const PageNotFoundErrorSchema = z.object({\n error: z.object({\n code: z.literal('PAGE_NOT_FOUND'),\n message: z.literal('Page not found'),\n }),\n});\n\nexport const PageNotGrantedErrorSchema = z.object({\n error: z.object({\n code: z.literal('PAGE_NOT_GRANTED'),\n message: z.literal('Page is not granted for the user'),\n }),\n});\n\nexport const PageRevisionErrorSchema = z.object({\n error: z.object({\n code: z.literal('PAGE_REVISION_ERROR'),\n message: z.string(),\n }),\n});\n\nexport type PageNotFoundError = z.infer<typeof PageNotFoundErrorSchema>;\nexport type PageNotGrantedError = z.infer<typeof PageNotGrantedErrorSchema>;\nexport type PageRevisionError = z.infer<typeof PageRevisionErrorSchema>;\n\nexport const SeenPageRequestSchema = z.object({\n page_id: z.string(),\n});\nexport type SeenPageRequest = z.infer<typeof SeenPageRequestSchema>;\n\nexport const SeenUsersResponseSchema = z.object({\n seenUsers: z.array(UserPublicSchema),\n seenUsersCount: z.number(),\n});\nexport type SeenUsersResponse = z.infer<typeof SeenUsersResponseSchema>;\n\nexport const GetSeenUsersRequestSchema = z.object({\n page_id: z.string(),\n // Optional cap on returned `seenUsers`. `seenUsersCount` always reflects\n // the full count regardless of `limit`. Omit for the full list.\n limit: z.coerce.number().int().positive().optional(),\n});\nexport type GetSeenUsersRequest = z.infer<typeof GetSeenUsersRequestSchema>;\n\n// Watch (notification subscription) schemas\nexport const GetWatchStatusRequestSchema = z.object({\n page_id: z.string(),\n});\nexport type GetWatchStatusRequest = z.infer<typeof GetWatchStatusRequestSchema>;\n\nexport const WatchStatusResponseSchema = z.object({\n watching: z.boolean(),\n});\nexport type WatchStatusResponse = z.infer<typeof WatchStatusResponseSchema>;\n\nexport const SetWatchStatusRequestSchema = z.object({\n page_id: z.string(),\n watching: z.boolean(),\n});\nexport type SetWatchStatusRequest = z.infer<typeof SetWatchStatusRequestSchema>;\n","import { z } from '@hono/zod-openapi';\nimport { UserPublicSchema } from './userPublic';\n\n/**\n * RFC-0003 shared schemas for the realtime collaborative editing\n * feature. Phase 1 introduces only the types — they are wired into\n * the actual ts-rest contracts and Hocuspocus message handlers in\n * later phases:\n *\n * - Phase 2 (`GET /api/v2/pages/:id/yjs-token`) consumes\n * `WsTokenResponseSchema`.\n * - Phase 5 (Hocuspocus custom message handler) consumes\n * `CollabSaveMessageSchema` and `CollabSaveErrorSchema`.\n * - Phase 7 (Revision list view) and the page-detail flow consume\n * `ContributorRefSchema`.\n *\n * Keeping the types here (and not in `page.ts`) keeps the\n * collaborative additions discoverable as one bundle and avoids\n * polluting the legacy page contract with v2.1-only fields.\n */\n\n/**\n * Public user shape surfaced for collaboration UI (Save author /\n * contributors / awareness presence). Re-export of `UserPublicSchema`\n * under a more intent-revealing alias.\n */\nexport const ContributorRefSchema = UserPublicSchema;\nexport type ContributorRef = z.infer<typeof ContributorRefSchema>;\n\n/**\n * `Revision.type` discriminator: every 10th checkpoint stores the\n * full Y.Doc state (`'snapshot'`), the 9 in between only the binary\n * delta from the previous revision (`'incremental'`). Undefined on\n * pre-RFC-0003 revisions and treated as `'snapshot'` by callers.\n *\n * Defined once here so the Mongoose model (`packages/api/src/models/\n * revision.ts`) and the wire-format `RevisionSchema` (`./page.ts`)\n * never drift — without this anchor the enum had two literal\n * declarations and Phase 5 risked widening one without the other.\n */\nexport const RevisionTypeSchema = z.enum(['snapshot', 'incremental']);\nexport type RevisionType = z.infer<typeof RevisionTypeSchema>;\n\n/**\n * Response body of the Phase 2 wsToken endpoint\n * (`GET /api/v2/pages/:id/yjs-token`). The Hocuspocus client\n * (`HocuspocusProvider`) takes the `wsToken` and presents it on\n * connect; the server validates it via `onAuthenticate`.\n *\n * - `wsToken` — short-lived JWT (5 min)\n * - `pageId` — the page id this token is scoped to (mirrors\n * the request param; clients use this to detect\n * misroute)\n * - `expiresAt` — ISO 8601 timestamp; clients use this to\n * proactively refresh before WebSocket close\n * - `readonly` — `true` once the 20-user editor cap is reached;\n * readonly clients still subscribe to live\n * updates but their writes are rejected by\n * Hocuspocus.\n */\nexport const WsTokenResponseSchema = z.object({\n wsToken: z.string(),\n pageId: z.string(),\n expiresAt: z.string(),\n readonly: z.boolean(),\n});\nexport type WsTokenResponse = z.infer<typeof WsTokenResponseSchema>;\n\n/**\n * Decoded payload of the short-lived wsToken JWT. The server signs\n * this with `WS_TOKEN_SECRET` (Phase 2) and Hocuspocus verifies it on\n * `onAuthenticate` (Phase 3). Phase 1 exports the schema so both\n * ends can validate the payload shape with the same source of truth.\n *\n * - `userId` — JWT subject = the connecting user's `_id`\n * - `pageId` — scoping the token to a single page; Hocuspocus\n * rejects mismatches in `onAuthenticate`\n * - `readonly` — sticky readonly bit set when the editor cap is\n * exhausted at issue time\n * - `iat`/`exp` — standard JWT claims (seconds since epoch);\n * `exp - iat` is 5 minutes\n */\nexport const WsTokenPayloadSchema = z.object({\n userId: z.string(),\n pageId: z.string(),\n readonly: z.boolean(),\n iat: z.number().int(),\n exp: z.number().int(),\n});\nexport type WsTokenPayload = z.infer<typeof WsTokenPayloadSchema>;\n\n/**\n * Client → server custom message that triggers a checkpoint Revision\n * inside Hocuspocus. Phase 5 wires this into the Hocuspocus message\n * dispatcher; Phase 8 wires it to the Save button.\n *\n * `message` is the optional checkpoint message (currently unused in\n * the v2.1 UI per spec open question 1, but reserved on the wire so\n * we can light it up without a wire-format break).\n */\nexport const CollabSaveMessageSchema = z.object({\n kind: z.literal('crowi:save'),\n message: z.string().optional(),\n});\nexport type CollabSaveMessage = z.infer<typeof CollabSaveMessageSchema>;\n\n/**\n * Server → client success message after a checkpoint Revision lands.\n * Phase 5 emits this via Hocuspocus's stateless channel; Phase 8 will\n * surface `revisionId` in the Save button's success toast so users can\n * link straight to the new revision.\n */\nexport const CollabSaveOkSchema = z.object({\n kind: z.literal('crowi:save-ok'),\n revisionId: z.string(),\n});\nexport type CollabSaveOk = z.infer<typeof CollabSaveOkSchema>;\n\n/**\n * Server → client error message emitted when a Hocuspocus-side save\n * fails. The Phase 8 Save UI surfaces `message` in a toast. `code`\n * lets the client branch on retry vs surface-and-stop (e.g.\n * `'RENDERER_FAILED'` is a hard error from the RFC-0002 renderer; the\n * client should not retry).\n */\nexport const CollabSaveErrorSchema = z.object({\n kind: z.literal('crowi:save-error'),\n code: z.string(),\n message: z.string(),\n});\nexport type CollabSaveError = z.infer<typeof CollabSaveErrorSchema>;\n\n/**\n * Server → client force-reload message. Emitted when the latest\n * revision's body is mutated outside the Yjs flow (admin tool,\n * legacy `/_api`, manual MongoDB edit) — Phase 6 detects this via\n * `Page.yjsState === null` in `onLoadDocument` and broadcasts the\n * message before terminating the connection.\n */\nexport const CollabForceReloadMessageSchema = z.object({\n kind: z.literal('crowi:force-reload'),\n reason: z.string().optional(),\n});\nexport type CollabForceReloadMessage = z.infer<typeof CollabForceReloadMessageSchema>;\n","import { z } from '@hono/zod-openapi';\n\n/**\n * Mirror of the User model's status constants (`packages/api/src/models/user.ts`):\n * 1 REGISTERED, 2 ACTIVE, 3 SUSPENDED, 4 DELETED, 5 INVITED.\n *\n * Lives here (not in `./user`) to avoid a circular import with bookmark.ts.\n */\nexport const UserPublicStatus = {\n REGISTERED: 1,\n ACTIVE: 2,\n SUSPENDED: 3,\n DELETED: 4,\n INVITED: 5,\n} as const;\n\nconst UserPublicStatusSchema = z.nativeEnum(UserPublicStatus);\n\n// Public user schema - minimal user information for public display\n// Based on UserDocument fields that are safe to expose publicly\n// Extracted into its own file to avoid circular imports between\n// user.ts and bookmark.ts (BookmarkSchema needs UserPublicSchema, and\n// some user-scoped responses need BookmarkSchema).\nexport const UserPublicSchema = z.object({\n _id: z.string(),\n id: z.string().optional(), // for compatibility (virtual field)\n username: z.string(),\n name: z.string(),\n email: z.string().email(),\n image: z.string().nullable().optional(),\n introduction: z.string().optional(),\n createdAt: z.string(),\n admin: z.boolean().optional(),\n status: UserPublicStatusSchema.optional(),\n});\nexport type UserPublic = z.infer<typeof UserPublicSchema>;\n","/**\n * RFC-0010 §Endpoints — Personal Access Token (PAT) management contracts.\n *\n * Replaces the legacy `GET/POST /me/apiToken` pair. Three endpoints under\n * the `/me/*` prefix (so they ride the existing broad `createJwtAuth`):\n *\n * GET /me/access-tokens — list metadata (never the secret)\n * POST /me/access-tokens — issue a PAT; returns plaintext once\n * DELETE /me/access-tokens/:id — revoke a PAT\n *\n * RFC-0010 §Security: these endpoints are **web-session only**. A PAT or\n * OAuth token presenting itself here is rejected with 403 `FORBIDDEN` to\n * prevent a leaked token from minting fresh, longer-lived tokens.\n */\nimport { createRoute, z } from '@hono/zod-openapi';\n\nimport {\n AccessTokenSchema,\n CreateAccessTokenRequestSchema,\n CreateAccessTokenResponseSchema,\n InvalidScopeErrorSchema,\n ListAccessTokensResponseSchema,\n} from '../schemas/access-token';\nimport { AuthenticationRequiredErrorSchema, ForbiddenErrorSchema, InternalServerErrorSchema, NotFoundErrorSchema } from '../schemas/common';\n\nexport const listAccessTokensRoute = createRoute({\n method: 'get',\n path: '/me/access-tokens',\n tags: ['me'],\n security: [{ bearerAuth: [] }],\n summary: \"List the current user's personal access tokens (metadata only)\",\n responses: {\n 200: {\n description: 'Personal access token list (no secrets)',\n content: { 'application/json': { schema: ListAccessTokensResponseSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 403: {\n description: 'Personal access tokens can only be managed from a web session',\n content: { 'application/json': { schema: ForbiddenErrorSchema } },\n },\n 500: {\n description: 'Internal server error',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n },\n});\n\nexport const createAccessTokenRoute = createRoute({\n method: 'post',\n path: '/me/access-tokens',\n tags: ['me'],\n security: [{ bearerAuth: [] }],\n summary: 'Issue a personal access token (plaintext returned once)',\n request: {\n body: {\n content: { 'application/json': { schema: CreateAccessTokenRequestSchema } },\n },\n },\n responses: {\n 201: {\n description: 'Token issued; `token` holds the one-time plaintext secret',\n content: { 'application/json': { schema: CreateAccessTokenResponseSchema } },\n },\n 400: {\n description: 'One or more requested scopes are not issuable',\n content: { 'application/json': { schema: InvalidScopeErrorSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 403: {\n description: 'Personal access tokens can only be managed from a web session',\n content: { 'application/json': { schema: ForbiddenErrorSchema } },\n },\n 500: {\n description: 'Internal server error',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n },\n});\n\nexport const deleteAccessTokenRoute = createRoute({\n method: 'delete',\n path: '/me/access-tokens/{id}',\n tags: ['me'],\n security: [{ bearerAuth: [] }],\n summary: 'Revoke a personal access token',\n request: {\n params: z.object({ id: z.string() }),\n },\n responses: {\n 200: {\n description: 'Token revoked',\n content: { 'application/json': { schema: AccessTokenSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 403: {\n description: 'Personal access tokens can only be managed from a web session',\n content: { 'application/json': { schema: ForbiddenErrorSchema } },\n },\n 404: {\n description: 'No such token belonging to the current user',\n content: { 'application/json': { schema: NotFoundErrorSchema } },\n },\n 500: {\n description: 'Internal server error',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n },\n});\n\nexport const accessTokenRoutes = {\n listAccessTokensRoute,\n createAccessTokenRoute,\n deleteAccessTokenRoute,\n};\n","import { z } from '@hono/zod-openapi';\n\n/**\n * RFC-0010 §Token model — Personal Access Token (PAT) wire schemas.\n *\n * A PAT's secret is an opaque `crowi_pat_…` string. The server stores only\n * its SHA-256 hash, so the plaintext is returned **once**, by `POST\n * /me/access-tokens`, and never again. Every other shape here exposes\n * metadata only (`id` / `name` / `scopes` / timestamps) — no `tokenHash`,\n * no plaintext.\n */\n\n/** PAT metadata as returned by list / create (minus the one-time plaintext). */\nexport const AccessTokenSchema = z.object({\n id: z.string(),\n name: z.string(),\n scopes: z.array(z.string()),\n /** ISO-8601 expiry, or `null` for a non-expiring token. */\n expiresAt: z.string().nullable(),\n /** ISO-8601 of last successful use, or `null` if never used. */\n lastUsedAt: z.string().nullable(),\n createdAt: z.string(),\n});\nexport type AccessToken = z.infer<typeof AccessTokenSchema>;\n\nexport const ListAccessTokensResponseSchema = z.object({\n accessTokens: z.array(AccessTokenSchema),\n});\nexport type ListAccessTokensResponse = z.infer<typeof ListAccessTokensResponseSchema>;\n\n/**\n * Create-PAT request. `scopes` is validated against `ISSUABLE_SCOPES`\n * (catalog scopes minus `admin:*`) in the handler — kept loose as\n * `z.string()` here so an out-of-catalog value yields the handler's\n * domain 400 rather than a Zod parse error. `expiresAt` is an ISO-8601\n * string or `null` (= non-expiring, RFC-0010 allows it; the web UI\n * additionally offers presets so \"never expires\" is an explicit choice).\n */\nexport const CreateAccessTokenRequestSchema = z.object({\n name: z.string().min(1, 'Name is required').max(200),\n scopes: z.array(z.string()).min(1, 'At least one scope is required'),\n expiresAt: z.string().datetime().nullable().optional(),\n});\nexport type CreateAccessTokenRequest = z.infer<typeof CreateAccessTokenRequestSchema>;\n\n/**\n * Create-PAT response: the new token's metadata plus the one-time\n * plaintext `token` (`crowi_pat_…`). The client must surface `token`\n * immediately — it is not recoverable afterwards.\n */\nexport const CreateAccessTokenResponseSchema = AccessTokenSchema.extend({\n token: z.string(),\n});\nexport type CreateAccessTokenResponse = z.infer<typeof CreateAccessTokenResponseSchema>;\n\n/** 400 returned when a requested scope is outside `ISSUABLE_SCOPES`. */\nexport const InvalidScopeErrorSchema = z.object({\n error: z.object({\n code: z.literal('INVALID_SCOPE'),\n message: z.string(),\n details: z\n .object({\n invalidScopes: z.array(z.string()),\n })\n .optional(),\n }),\n});\nexport type InvalidScopeError = z.infer<typeof InvalidScopeErrorSchema>;\n","/**\n * RFC-0010 Phase 3 — OAuth 2.0 authorization-server endpoint contracts.\n *\n * POST /oauth/authorize — JWT (web session only)\n * POST /oauth/token — public (RFC 6749)\n * POST /oauth/revoke — public (RFC 7009)\n * GET /.well-known/oauth-authorization-server — public (RFC 8414)\n *\n * Only `/oauth/authorize` carries `security: [{ bearerAuth: [] }]`; the\n * other three are public (no auth) — the matching handler registers them\n * without an `app.use(jwtAuth)`, exactly like `/auth/login` etc.\n *\n * `/oauth/token` accepts `application/x-www-form-urlencoded` (RFC 6749) as\n * well as JSON. The contract declares JSON as the canonical body shape;\n * the handler additionally parses form bodies into the same shape before\n * validating (so the OpenAPI doc stays single-shape while the runtime is\n * spec-compliant).\n */\nimport { createRoute, z } from '@hono/zod-openapi';\n\nimport { ForbiddenErrorSchema, InternalServerErrorSchema, NotFoundErrorSchema } from '../schemas/common';\nimport {\n AuthorizeRequestSchema,\n AuthorizeResponseSchema,\n DeviceAuthorizeRequestSchema,\n DeviceAuthorizeResponseSchema,\n DeviceInfoResponseSchema,\n DeviceVerifyRequestSchema,\n DeviceVerifyResponseSchema,\n DiscoveryResponseSchema,\n OAuthErrorSchema,\n RevokeResponseSchema,\n TokenResponseSchema,\n} from '../schemas/oauth-endpoints';\n\nexport const authorizeRoute = createRoute({\n method: 'post',\n path: '/oauth/authorize',\n tags: ['oauth'],\n security: [{ bearerAuth: [] }],\n summary: 'Issue an authorization code for the consenting web user (PKCE)',\n request: {\n body: {\n content: { 'application/json': { schema: AuthorizeRequestSchema } },\n },\n },\n responses: {\n 200: {\n description: 'Authorization code issued; `redirectUri` carries `code` + `state`',\n content: { 'application/json': { schema: AuthorizeResponseSchema } },\n },\n 400: {\n description: 'Invalid request / scope / client (RFC 6749 §4.1.2.1)',\n content: { 'application/json': { schema: OAuthErrorSchema } },\n },\n 403: {\n description: 'Authorization codes can only be issued from a web session',\n content: { 'application/json': { schema: ForbiddenErrorSchema } },\n },\n 500: {\n description: 'Internal server error',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n },\n});\n\nexport const tokenRoute = createRoute({\n method: 'post',\n path: '/oauth/token',\n tags: ['oauth'],\n summary: 'Exchange an authorization code or refresh token for an access token',\n // The request body is intentionally NOT declared as a validated schema:\n // RFC 6749 mandates `application/x-www-form-urlencoded`, which the\n // zod-openapi `json` validator would reject (and the resulting\n // VALIDATION_ERROR envelope is not the RFC 6749 §5.2 OAuth shape). The\n // handler parses both form and JSON bodies itself and validates with\n // `TokenRequestSchema`, emitting `{ error, error_description }`. The\n // request schema is still published under `components.schemas`\n // (`TokenRequest`) for documentation by `generate-openapi.ts`.\n responses: {\n 200: {\n description: 'Access + refresh token issued (RFC 6749 §5.1)',\n content: { 'application/json': { schema: TokenResponseSchema } },\n },\n 400: {\n description: 'invalid_grant / invalid_request / unsupported_grant_type (RFC 6749 §5.2)',\n content: { 'application/json': { schema: OAuthErrorSchema } },\n },\n 401: {\n description: 'invalid_client (RFC 6749 §5.2)',\n content: { 'application/json': { schema: OAuthErrorSchema } },\n },\n 500: {\n description: 'Internal server error',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n },\n});\n\nexport const revokeRoute = createRoute({\n method: 'post',\n path: '/oauth/revoke',\n tags: ['oauth'],\n summary: 'Revoke a refresh token or personal access token (RFC 7009)',\n // Body not declared for the same reason as `/oauth/token`: RFC 7009 uses\n // `application/x-www-form-urlencoded`. The handler parses form + JSON and\n // validates with `RevokeRequestSchema`. (`RevokeRequest` is published in\n // `components.schemas` for documentation.)\n responses: {\n 200: {\n description: 'Revocation processed (200 even for unknown tokens, RFC 7009)',\n content: { 'application/json': { schema: RevokeResponseSchema } },\n },\n 500: {\n description: 'Internal server error',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n },\n});\n\nexport const discoveryRoute = createRoute({\n method: 'get',\n path: '/.well-known/oauth-authorization-server',\n tags: ['oauth'],\n summary: 'OAuth 2.0 authorization-server metadata (RFC 8414)',\n responses: {\n 200: {\n description: 'Authorization-server metadata',\n content: { 'application/json': { schema: DiscoveryResponseSchema } },\n },\n },\n});\n\nexport const deviceAuthorizeRoute = createRoute({\n method: 'post',\n path: '/oauth/device/authorize',\n tags: ['oauth'],\n summary: 'Start a device authorization grant — issue device_code + user_code (RFC 8628)',\n // Public, no PKCE / redirect_uri. JSON body is validated (CLIs post JSON,\n // mirroring PHASE3-Q3); the device grant on /oauth/token still parses form\n // bodies itself.\n request: {\n body: {\n content: { 'application/json': { schema: DeviceAuthorizeRequestSchema } },\n },\n },\n responses: {\n 200: {\n description: 'Device + user code issued (RFC 8628 §3.2)',\n content: { 'application/json': { schema: DeviceAuthorizeResponseSchema } },\n },\n 400: {\n description: 'invalid_client / invalid_scope (RFC 6749 §5.2)',\n content: { 'application/json': { schema: OAuthErrorSchema } },\n },\n 500: {\n description: 'Internal server error',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n },\n});\n\nexport const deviceInfoRoute = createRoute({\n method: 'get',\n path: '/oauth/device',\n tags: ['oauth'],\n summary: 'Look up a pending device authorization by user_code (consent screen)',\n // Public + lightweight: returns only the requesting client + requested\n // scopes so the web consent screen can show them before approval. Reveals\n // no secret. Unknown / expired / non-pending → 404 (PHASE4-Q9 option A).\n request: {\n query: z.object({ user_code: z.string().min(1) }),\n },\n responses: {\n 200: {\n description: 'Pending device authorization metadata',\n content: { 'application/json': { schema: DeviceInfoResponseSchema } },\n },\n 404: {\n description: 'No pending device authorization for this user_code',\n content: { 'application/json': { schema: NotFoundErrorSchema } },\n },\n },\n});\n\nexport const deviceVerifyRoute = createRoute({\n method: 'post',\n path: '/oauth/device/verify',\n tags: ['oauth'],\n security: [{ bearerAuth: [] }],\n summary: 'Approve or deny a device authorization by user_code (web session only)',\n request: {\n body: {\n content: { 'application/json': { schema: DeviceVerifyRequestSchema } },\n },\n },\n responses: {\n 200: {\n description: 'Device authorization approved or denied',\n content: { 'application/json': { schema: DeviceVerifyResponseSchema } },\n },\n 403: {\n description: 'Device approvals can only come from a web session',\n content: { 'application/json': { schema: ForbiddenErrorSchema } },\n },\n 404: {\n description: 'No pending device authorization for this user_code',\n content: { 'application/json': { schema: NotFoundErrorSchema } },\n },\n 500: {\n description: 'Internal server error',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n },\n});\n\nexport const oauthRoutes = {\n authorizeRoute,\n tokenRoute,\n revokeRoute,\n discoveryRoute,\n deviceAuthorizeRoute,\n deviceInfoRoute,\n deviceVerifyRoute,\n};\n","import { z } from '@hono/zod-openapi';\n\nimport { ISSUABLE_SCOPES } from './oauth';\n\n/**\n * RFC-0010 Phase 3 — OAuth 2.0 authorization-server endpoint wire schemas\n * (`/oauth/authorize`, `/oauth/token`, `/oauth/revoke`,\n * `/.well-known/oauth-authorization-server`).\n *\n * These are intentionally separate from `schemas/oauth.ts`, which owns the\n * scope **catalog** (a single-responsibility module shared by API / web /\n * consent screen). The endpoint request/response shapes here follow the\n * relevant RFCs (6749 / 7009 / 8414) verbatim — in particular the error\n * envelope is RFC 6749 §5.2's `{ error, error_description? }`, NOT Crowi's\n * usual `{ error: { code, message } }`, so CLIs / SDKs can parse it with a\n * standard OAuth client.\n */\n\n/**\n * RFC 6749 §5.2 OAuth error codes the token / authorize endpoints emit, plus\n * the RFC 8628 §3.5 device-grant polling codes (`authorization_pending`,\n * `slow_down`, `expired_token`; `access_denied` is shared with §5.2). Kept as\n * a const tuple so the same values drive both the Zod enum and any exhaustive\n * handler-side switch.\n */\nexport const OAUTH_ERROR_CODES = [\n 'invalid_request',\n 'invalid_client',\n 'invalid_grant',\n 'unauthorized_client',\n 'unsupported_grant_type',\n 'invalid_scope',\n 'access_denied',\n // RFC 8628 §3.5 — device authorization grant polling errors (all 400).\n 'authorization_pending',\n 'slow_down',\n 'expired_token',\n] as const;\nexport type OAuthErrorCode = (typeof OAUTH_ERROR_CODES)[number];\n\n/**\n * RFC 6749 §5.2 error envelope. `error` is the machine code; the optional\n * `error_description` is a human-readable hint. HTTP status is 401 for\n * `invalid_client`, 400 for the rest (set per-response by the handler).\n */\nexport const OAuthErrorSchema = z.object({\n error: z.enum(OAUTH_ERROR_CODES),\n error_description: z.string().optional(),\n});\nexport type OAuthError = z.infer<typeof OAuthErrorSchema>;\n\n/**\n * `POST /oauth/authorize` request body (sent by the Next.js consent\n * screen after the user approves). PKCE is mandatory: `code_challenge` is\n * required and `code_challenge_method` must be `S256` (RFC-0010 §Security).\n * `scope` is a space-delimited list (RFC 6749 §3.3). `state` is echoed back\n * untouched onto the redirect URI.\n */\nexport const AuthorizeRequestSchema = z.object({\n client_id: z.string().min(1),\n redirect_uri: z.string().min(1),\n scope: z.string().min(1),\n code_challenge: z.string().min(1),\n code_challenge_method: z.literal('S256'),\n state: z.string().optional(),\n});\nexport type AuthorizeRequest = z.infer<typeof AuthorizeRequestSchema>;\n\n/**\n * `POST /oauth/authorize` response. The server returns the fully-formed\n * redirect URI (callback + `?code=…&state=…`) as JSON rather than a 303 so\n * the consent screen (which calls this with `fetch`) can navigate to it via\n * `window.location.href` — a real 303 followed by `fetch` would hit\n * CORS/credential issues against the loopback callback (RFC-0010,\n * PHASE3-Q3).\n */\nexport const AuthorizeResponseSchema = z.object({\n redirectUri: z.string(),\n});\nexport type AuthorizeResponse = z.infer<typeof AuthorizeResponseSchema>;\n\n/**\n * `POST /oauth/token` request. The grant_type discriminates the body:\n *\n * - `authorization_code`: `code` + PKCE `code_verifier` + the same\n * `redirect_uri` used at authorize time + `client_id`.\n * - `refresh_token`: the opaque `refresh_token` + `client_id`, optionally\n * a narrower `scope` to down-scope the rotated token.\n *\n * Accepted as `application/x-www-form-urlencoded` (RFC 6749) **or** JSON.\n * The schema models the JSON/object shape; the handler normalises form\n * bodies into the same shape before validating.\n */\nexport const TokenRequestSchema = z.discriminatedUnion('grant_type', [\n z.object({\n grant_type: z.literal('authorization_code'),\n code: z.string().min(1),\n code_verifier: z.string().min(1),\n redirect_uri: z.string().min(1),\n client_id: z.string().min(1),\n }),\n z.object({\n grant_type: z.literal('refresh_token'),\n refresh_token: z.string().min(1),\n client_id: z.string().min(1),\n scope: z.string().optional(),\n }),\n // RFC 8628 §3.4 — device authorization grant. The client polls with the\n // opaque `device_code` returned by `/oauth/device/authorize`.\n z.object({\n grant_type: z.literal('urn:ietf:params:oauth:grant-type:device_code'),\n device_code: z.string().min(1),\n client_id: z.string().min(1),\n }),\n]);\nexport type TokenRequest = z.infer<typeof TokenRequestSchema>;\n\n/** RFC 8628 §3.4 device-code grant_type URN (shared by schema + handler). */\nexport const DEVICE_CODE_GRANT_TYPE = 'urn:ietf:params:oauth:grant-type:device_code';\n\n/**\n * `POST /oauth/token` success response (RFC 6749 §5.1). `access_token` is a\n * short-lived scope-bearing JWT; `refresh_token` is the rotated opaque\n * secret; `scope` is the space-delimited granted set.\n */\nexport const TokenResponseSchema = z.object({\n access_token: z.string(),\n token_type: z.literal('Bearer'),\n expires_in: z.number(),\n refresh_token: z.string(),\n scope: z.string(),\n});\nexport type TokenResponse = z.infer<typeof TokenResponseSchema>;\n\n/**\n * `POST /oauth/revoke` request (RFC 7009). `token` is the secret to revoke\n * (a `crowi_rt_…` refresh token or a `crowi_pat_…` PAT). `token_type_hint`\n * is advisory and ignored — the prefix already identifies the type.\n */\nexport const RevokeRequestSchema = z.object({\n token: z.string().min(1),\n token_type_hint: z.string().optional(),\n});\nexport type RevokeRequest = z.infer<typeof RevokeRequestSchema>;\n\n/** `POST /oauth/revoke` always returns 200 with an empty object (RFC 7009). */\nexport const RevokeResponseSchema = z.object({});\nexport type RevokeResponse = z.infer<typeof RevokeResponseSchema>;\n\n/**\n * `POST /oauth/device/authorize` request (RFC 8628 §3.1). A headless client\n * (no browser) starts the device flow with its `client_id` and the\n * space-delimited `scope` it wants. Public endpoint — no PKCE, no\n * redirect_uri (the user verifies out-of-band at `verification_uri`).\n */\nexport const DeviceAuthorizeRequestSchema = z.object({\n client_id: z.string().min(1),\n scope: z.string().min(1),\n});\nexport type DeviceAuthorizeRequest = z.infer<typeof DeviceAuthorizeRequestSchema>;\n\n/**\n * `POST /oauth/device/authorize` response (RFC 8628 §3.2). `device_code` is\n * the opaque secret the client polls with; `user_code` is the human-typed\n * handle; `verification_uri(_complete)` is where the user approves; `interval`\n * is the minimum poll spacing in seconds; `expires_in` is the code lifetime.\n */\nexport const DeviceAuthorizeResponseSchema = z.object({\n device_code: z.string(),\n user_code: z.string(),\n verification_uri: z.string(),\n verification_uri_complete: z.string(),\n expires_in: z.number(),\n interval: z.number(),\n});\nexport type DeviceAuthorizeResponse = z.infer<typeof DeviceAuthorizeResponseSchema>;\n\n/**\n * `POST /oauth/device/verify` request — the web consent screen approves or\n * denies a `user_code`. `user_code` is normalised (case / dash insensitive)\n * server-side before lookup.\n */\nexport const DeviceVerifyRequestSchema = z.object({\n user_code: z.string().min(1),\n action: z.enum(['approve', 'deny']),\n});\nexport type DeviceVerifyRequest = z.infer<typeof DeviceVerifyRequestSchema>;\n\n/** `POST /oauth/device/verify` response — the resulting device-code status. */\nexport const DeviceVerifyResponseSchema = z.object({\n status: z.enum(['approved', 'denied']),\n});\nexport type DeviceVerifyResponse = z.infer<typeof DeviceVerifyResponseSchema>;\n\n/**\n * `GET /oauth/device` lookup response (PHASE4-Q9 option A). The web consent\n * screen reads this *before* approving to show the requesting client + the\n * scopes it asked for — the same transparency the authorize-code consent\n * screen gives. Carries only non-secret metadata.\n */\nexport const DeviceInfoResponseSchema = z.object({\n client_id: z.string(),\n scopes: z.array(z.string()),\n});\nexport type DeviceInfoResponse = z.infer<typeof DeviceInfoResponseSchema>;\n\n/**\n * Grant types the server advertises in discovery — `authorization_code` +\n * `refresh_token` (Phase 3) and the device-code grant URN (Phase 4, RFC 8628).\n */\nexport const GRANT_TYPES_SUPPORTED = ['authorization_code', 'refresh_token', DEVICE_CODE_GRANT_TYPE] as const;\n\n/**\n * `GET /.well-known/oauth-authorization-server` response (RFC 8414). Lets\n * CLIs / SDKs auto-discover endpoints. `authorization_endpoint` is the\n * **web** consent screen origin; `token_endpoint` / `revocation_endpoint`\n * are the `/api/v2/oauth/*` API (the two live on different base URLs —\n * RFC-0010, PHASE3-Q6). `device_authorization_endpoint` is optional so\n * Phase 4 can add it without a schema break.\n */\nexport const DiscoveryResponseSchema = z.object({\n issuer: z.string(),\n authorization_endpoint: z.string(),\n token_endpoint: z.string(),\n revocation_endpoint: z.string(),\n device_authorization_endpoint: z.string().optional(),\n scopes_supported: z.array(z.string()),\n response_types_supported: z.array(z.string()),\n grant_types_supported: z.array(z.string()),\n code_challenge_methods_supported: z.array(z.string()),\n token_endpoint_auth_methods_supported: z.array(z.string()),\n});\nexport type DiscoveryResponse = z.infer<typeof DiscoveryResponseSchema>;\n\n/** Scopes advertised in discovery — issuable catalog (admin:* excluded). */\nexport const DISCOVERY_SCOPES_SUPPORTED: readonly string[] = ISSUABLE_SCOPES;\n","import { z } from '@hono/zod-openapi';\n\nimport { ApiErrorSchema } from './common';\n\n/**\n * RFC-0010 — OAuth 2.0 scope catalog (single source of truth).\n *\n * Scopes are resource-category × `read` / `write`, plus two umbrella\n * scopes (`read` / `write`) and two reserved admin scopes. The reserved\n * `admin:read` / `admin:write` are listed here for catalog completeness\n * (discovery `scopes_supported`, consent-screen rendering, and a single\n * canonical `Scope` union) even though Phase 1 has **no issuing path**\n * for them — admin API stays web-session-only in v1 (RFC-0010 §Design\n * decisions, OQ-C resolved: reserved only).\n *\n * `write` implies the same resource's `read`; umbrella `read` implies\n * every `*:read` and umbrella `write` implies every `*:write` (+ read).\n * The implication semantics live in `scopeSatisfies` below.\n */\nexport const SCOPES = [\n // umbrella\n 'read',\n 'write',\n // pages — page, revision, draft, backlink, search, autocomplete\n 'pages:read',\n 'pages:write',\n // comments\n 'comments:read',\n 'comments:write',\n // bookmarks\n 'bookmarks:read',\n 'bookmarks:write',\n // attachments\n 'attachments:read',\n 'attachments:write',\n // notifications\n 'notifications:read',\n 'notifications:write',\n // profile — me, user\n 'profile:read',\n 'profile:write',\n // reserved — admin API is web-session-only in v1 (no issuing path)\n 'admin:read',\n 'admin:write',\n] as const;\n\nexport type Scope = (typeof SCOPES)[number];\n\n/** Every catalog scope as a `Set`, used to grant web sessions all scopes. */\nexport const ALL_SCOPES: ReadonlySet<Scope> = new Set(SCOPES);\n\n/**\n * RFC-0010 §Security — scopes a Personal Access Token may be issued with.\n *\n * Every catalog scope **except** the reserved `admin:*` (OQ-C resolved:\n * admin API is web-session-only in v1, so an `admin:*` PAT must never be\n * mintable). The umbrella `read` / `write` are issuable (PHASE2-Q1): a CLI\n * legitimately wants an \"all read\" token, and `scopeSatisfies` already\n * models umbrella implication. `POST /me/access-tokens` validates the\n * requested scopes against this set; anything outside it (including\n * catalog-unknown strings) is a 400.\n */\nexport const ISSUABLE_SCOPES: readonly Scope[] = SCOPES.filter((s) => !s.startsWith('admin:'));\n\nconst ISSUABLE_SCOPE_SET: ReadonlySet<string> = new Set(ISSUABLE_SCOPES);\n\n/** Type guard: may `value` be issued to a PAT? (catalog scope, non-`admin:*`) */\nexport function isIssuableScope(value: string): value is Scope {\n return ISSUABLE_SCOPE_SET.has(value);\n}\n\nconst SCOPE_SET: ReadonlySet<string> = new Set(SCOPES);\n\n/** Type guard: is `value` a known catalog scope? */\nexport function isScope(value: string): value is Scope {\n return SCOPE_SET.has(value);\n}\n\n/**\n * Parse a space-delimited scope claim (RFC 6749 §3.3) into a `Set` of\n * recognised scopes. Unknown tokens are dropped silently — a token that\n * is not in the catalog cannot satisfy any `requireScope` check anyway,\n * so keeping it would only bloat the set.\n */\nexport function parseScopeClaim(claim: string | undefined | null): Set<Scope> {\n const out = new Set<Scope>();\n if (!claim) return out;\n for (const raw of claim.split(/\\s+/)) {\n const token = raw.trim();\n if (token && isScope(token)) {\n out.add(token);\n }\n }\n return out;\n}\n\n/**\n * RFC-0010 §含意ルール — is the required scope `required` satisfied by the\n * granted set `granted`?\n *\n * - `required ∈ granted`, or\n * - `required = \"x:read\"` and `\"x:write\" ∈ granted`, or\n * - `required = \"x:read\"` and (`\"read\" ∈ granted` or `\"write\" ∈ granted`), or\n * - `required = \"x:write\"` and `\"write\" ∈ granted`\n *\n * `granted` is a `Set<string>` (not `Set<Scope>`) so callers can pass the\n * raw parsed claim without re-narrowing; unknown entries simply never\n * match.\n */\nexport function scopeSatisfies(required: string, granted: ReadonlySet<string>): boolean {\n // Direct grant.\n if (granted.has(required)) {\n return true;\n }\n\n const [resource, action] = required.split(':');\n // Umbrella requirements (`read` / `write` with no resource) are only\n // satisfiable by a direct grant, handled above.\n if (action === undefined) {\n return false;\n }\n\n if (action === 'read') {\n // write on the same resource implies read.\n if (granted.has(`${resource}:write`)) return true;\n // umbrella read or write implies any resource read.\n if (granted.has('read') || granted.has('write')) return true;\n return false;\n }\n\n if (action === 'write') {\n // umbrella write implies any resource write.\n if (granted.has('write')) return true;\n return false;\n }\n\n return false;\n}\n\n/**\n * 403 returned by `requireScope` when the authenticated principal's token\n * lacks the scope a route requires. Mirrors RFC 6750 `insufficient_scope`\n * (also surfaced via the `WWW-Authenticate` response header). `details`\n * carries the missing scope so clients / SDKs can prompt for re-consent.\n */\nexport const InsufficientScopeErrorSchema = ApiErrorSchema.extend({\n error: z.object({\n code: z.literal('INSUFFICIENT_SCOPE'),\n message: z.string(),\n details: z\n .object({\n requiredScope: z.string(),\n })\n .optional(),\n }),\n});\n\nexport type InsufficientScopeError = z.infer<typeof InsufficientScopeErrorSchema>;\n","/**\n * RFC-0006 Phase 4 Batch 2 — `user` resource ported to\n * `@hono/zod-openapi` route definitions. Three endpoints:\n *\n * GET /user/:username — public profile + recent activity\n * GET /user/:username/bookmarks — paginated bookmark list\n * GET /user/:username/pages — paginated created-page list\n *\n * All three require JWT authentication and 404 on inactive / unknown\n * users; the Hono handler applies the shared `createJwtAuth` middleware\n * to `/user/*` so `c.get('user')` always resolves to the current user.\n *\n * Query parameters (`limit`, `offset`) reuse `PaginationRequestSchema`\n * with `z.coerce.number()` so callers can pass them as URL string params\n * — the contract surface stays byte-identical with the ts-rest era.\n */\nimport { createRoute, z } from '@hono/zod-openapi';\n\nimport { AuthenticationRequiredErrorSchema, InternalServerErrorSchema } from '../schemas/common';\nimport {\n ListUsersRequestSchema,\n ListUsersResponseSchema,\n PaginationRequestSchema,\n UserBookmarksResponseSchema,\n UserNotFoundErrorSchema,\n UserPageResponseSchema,\n UserPagesResponseSchema,\n} from '../schemas/user';\n\nconst UsernameParamSchema = z.object({ username: z.string() });\n\nexport const getUserPageRoute = createRoute({\n method: 'get',\n path: '/user/{username}',\n tags: ['user'],\n security: [{ bearerAuth: [] }],\n summary: 'Get user page information',\n request: {\n params: UsernameParamSchema,\n },\n responses: {\n 200: {\n description: 'User profile with statistics + recent activity',\n content: { 'application/json': { schema: UserPageResponseSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 404: {\n description: 'User not found',\n content: { 'application/json': { schema: UserNotFoundErrorSchema } },\n },\n 500: {\n description: 'Internal server error',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n },\n});\n\nexport const getUserBookmarksRoute = createRoute({\n method: 'get',\n path: '/user/{username}/bookmarks',\n tags: ['user'],\n security: [{ bearerAuth: [] }],\n summary: 'Get user bookmarks (paginated)',\n request: {\n params: UsernameParamSchema,\n query: PaginationRequestSchema,\n },\n responses: {\n 200: {\n description: 'Paginated bookmarks',\n content: { 'application/json': { schema: UserBookmarksResponseSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 404: {\n description: 'User not found',\n content: { 'application/json': { schema: UserNotFoundErrorSchema } },\n },\n 500: {\n description: 'Internal server error',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n },\n});\n\nexport const getUserPagesRoute = createRoute({\n method: 'get',\n path: '/user/{username}/pages',\n tags: ['user'],\n security: [{ bearerAuth: [] }],\n summary: 'Get pages created by the user (paginated)',\n request: {\n params: UsernameParamSchema,\n query: PaginationRequestSchema,\n },\n responses: {\n 200: {\n description: 'Paginated created pages',\n content: { 'application/json': { schema: UserPagesResponseSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 404: {\n description: 'User not found',\n content: { 'application/json': { schema: UserNotFoundErrorSchema } },\n },\n 500: {\n description: 'Internal server error',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n },\n});\n\n// Member directory — list active users (avatar + name + @username) for the\n// special `/user/` portal. Plural `/users` so it never collides with the\n// `/user/{username}` profile routes. Authenticated, non-admin.\nexport const listMembersRoute = createRoute({\n method: 'get',\n path: '/users',\n tags: ['user'],\n security: [{ bearerAuth: [] }],\n summary: 'List active users for the member directory (paginated, searchable)',\n request: {\n query: ListUsersRequestSchema,\n },\n responses: {\n 200: {\n description: 'Paginated active users, name-ascending',\n content: { 'application/json': { schema: ListUsersResponseSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 500: {\n description: 'Internal server error',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n },\n});\n\nexport const userRoutes = {\n getUserPageRoute,\n getUserBookmarksRoute,\n getUserPagesRoute,\n listMembersRoute,\n};\n","import { z } from '@hono/zod-openapi';\nimport { PageSchema, PagerSchema } from './page';\nimport { BookmarkSchema } from './bookmark';\nimport { UserPublicSchema } from './userPublic';\n\n// NOTE: BookmarkSchema and UserPublicSchema are exported from their own\n// dedicated files (./bookmark, ./userPublic). They are intentionally NOT\n// re-exported here to avoid duplicate-name conflicts in index.ts and to\n// break a circular dependency between user.ts and bookmark.ts.\n\nimport { UserPublicStatus } from './userPublic';\n\n// User status enum - matches User model constants\nexport const UserStatusSchema = z.enum(['1', '2', '3', '4', '5']).transform((val) => Number(val));\n// Backwards-compatible alias for the canonical enum in userPublic. Declared\n// as a value-level const (rather than `export {as} from`) so tsup emits a\n// straight reference instead of a renamed re-export — which v8 was\n// surfacing as a stale shorthand-property in the bundled output.\nexport const UserStatusEnum = UserPublicStatus;\n\n// Language enum - matches User model. Only `en` / `ja` are live UI locales;\n// legacy regional variants (`en-US` / `en-GB`) were retired.\nexport const UserLanguageSchema = z.enum(['en', 'ja']);\nexport type UserLanguage = z.infer<typeof UserLanguageSchema>;\n\n// Pagination request schema\nexport const PaginationRequestSchema = z.object({\n limit: z.coerce.number().optional().default(50),\n offset: z.coerce.number().optional().default(0),\n});\nexport type PaginationRequest = z.infer<typeof PaginationRequestSchema>;\n\n// Member-directory list item — the minimal public shape rendered on the\n// `/user/` member directory (avatar + display name + @username + link).\n// Intentionally narrower than UserPublicSchema: email and other PII are\n// never surfaced in the directory.\nexport const UserListItemSchema = z.object({\n _id: z.string(),\n username: z.string(),\n name: z.string(),\n image: z.string().nullable().optional(),\n});\nexport type UserListItem = z.infer<typeof UserListItemSchema>;\n\n// Member-directory list request. `q` matches username/name (case-insensitive);\n// pagination is offset-based to reuse the shared `Pager` envelope.\nexport const ListUsersRequestSchema = z.object({\n q: z.string().optional(),\n // Cap the page size so a client can't request the whole user table in one\n // unbounded find+sort (mirrors the page-list `limit` guard).\n limit: z.coerce.number().int().min(1).max(100).optional().default(24),\n offset: z.coerce.number().int().min(0).optional().default(0),\n});\nexport type ListUsersRequest = z.infer<typeof ListUsersRequestSchema>;\n\n// Member-directory list response — active users only, name-ascending.\nexport const ListUsersResponseSchema = z.object({\n users: z.array(UserListItemSchema),\n pager: PagerSchema,\n total: z.number(),\n});\nexport type ListUsersResponse = z.infer<typeof ListUsersResponseSchema>;\n\n// User page response schema - combines profile, bookmarks, and created pages\nexport const UserPageResponseSchema = z.object({\n user: UserPublicSchema,\n // Page statistics\n createdPagesCount: z.number(),\n bookmarksCount: z.number(),\n // Optionally include recent items for initial display\n recentPages: z.array(PageSchema).optional(),\n recentBookmarks: z.array(BookmarkSchema).optional(),\n});\nexport type UserPageResponse = z.infer<typeof UserPageResponseSchema>;\n\n// User bookmarks response schema - paginated bookmarks list\nexport const UserBookmarksResponseSchema = z.object({\n bookmarks: z.array(BookmarkSchema),\n pager: PagerSchema,\n total: z.number(),\n});\nexport type UserBookmarksResponse = z.infer<typeof UserBookmarksResponseSchema>;\n\n// User pages response schema - paginated pages list\nexport const UserPagesResponseSchema = z.object({\n pages: z.array(PageSchema),\n pager: PagerSchema,\n total: z.number(),\n});\nexport type UserPagesResponse = z.infer<typeof UserPagesResponseSchema>;\n\n// User not found error schema\nexport const UserNotFoundErrorSchema = z.object({\n error: z.object({\n code: z.literal('USER_NOT_FOUND'),\n message: z.literal('User not found'),\n }),\n});\nexport type UserNotFoundError = z.infer<typeof UserNotFoundErrorSchema>;\n","import { z } from '@hono/zod-openapi';\nimport { PageSchema, PagerSchema } from './page';\nimport { UserPublicSchema } from './userPublic';\n\n// Bookmark schema with populated page\n// (Originally lived in schemas/user.ts; relocated for reuse across contracts)\nexport const BookmarkSchema = z.object({\n _id: z.string(),\n page: PageSchema,\n user: z.union([z.string(), UserPublicSchema]),\n createdAt: z.string(),\n});\nexport type Bookmark = z.infer<typeof BookmarkSchema>;\n\n// GET /bookmarks?page_id=xxx\nexport const GetBookmarkRequestSchema = z.object({\n page_id: z.string(),\n});\nexport type GetBookmarkRequest = z.infer<typeof GetBookmarkRequestSchema>;\n\n// GET /bookmarks → { bookmark: Bookmark | null }\n// POST /bookmarks → { bookmark: Bookmark | null }\nexport const BookmarkResponseSchema = z.object({\n bookmark: BookmarkSchema.nullable(),\n});\nexport type BookmarkResponse = z.infer<typeof BookmarkResponseSchema>;\n\n// GET /bookmarks/me?limit&offset\nexport const ListMyBookmarksResponseSchema = z.object({\n bookmarks: z.array(BookmarkSchema),\n pager: PagerSchema,\n total: z.number(),\n});\nexport type ListMyBookmarksResponse = z.infer<typeof ListMyBookmarksResponseSchema>;\n\n// POST /bookmarks { page_id }\nexport const AddBookmarkRequestSchema = z.object({\n page_id: z.string(),\n});\nexport type AddBookmarkRequest = z.infer<typeof AddBookmarkRequestSchema>;\n\n// DELETE /bookmarks { page_id }\nexport const RemoveBookmarkRequestSchema = z.object({\n page_id: z.string(),\n});\nexport type RemoveBookmarkRequest = z.infer<typeof RemoveBookmarkRequestSchema>;\n\nexport const RemoveBookmarkResponseSchema = z.object({\n ok: z.literal(true),\n});\nexport type RemoveBookmarkResponse = z.infer<typeof RemoveBookmarkResponseSchema>;\n","/**\n * RFC-0006 Phase 4 Batch 3 — `bookmark` resource ported to\n * `@hono/zod-openapi` route definitions. Four endpoints:\n *\n * GET /bookmarks — fetch bookmark for a page (or null)\n * GET /bookmarks/me — paginated current-user bookmarks\n * POST /bookmarks — add a bookmark\n * DELETE /bookmarks — remove a bookmark\n *\n * All endpoints require JWT authentication; the Hono handler applies\n * `createJwtAuth(crowi)` broadly to `/bookmarks/*` so `c.get('user')`\n * is always populated. The legacy semantics are preserved: `addBookmark`\n * returns `{ bookmark: null }` instead of 404 when the page is missing\n * or not granted, and `removeBookmark` returns `{ ok: true }` even when\n * no bookmark existed.\n */\nimport { createRoute } from '@hono/zod-openapi';\n\nimport { AuthenticationRequiredErrorSchema, InternalServerErrorSchema, InvalidPageIdErrorSchema } from '../schemas/common';\nimport {\n AddBookmarkRequestSchema,\n BookmarkResponseSchema,\n GetBookmarkRequestSchema,\n ListMyBookmarksResponseSchema,\n RemoveBookmarkRequestSchema,\n RemoveBookmarkResponseSchema,\n} from '../schemas/bookmark';\nimport { PaginationRequestSchema } from '../schemas/user';\n\nexport const getBookmarkRoute = createRoute({\n method: 'get',\n path: '/bookmarks',\n tags: ['bookmark'],\n security: [{ bearerAuth: [] }],\n summary: 'Get bookmark of a page for the current user',\n request: {\n query: GetBookmarkRequestSchema,\n },\n responses: {\n 200: {\n description: 'Bookmark for the page (or null when not bookmarked)',\n content: { 'application/json': { schema: BookmarkResponseSchema } },\n },\n 400: {\n description: 'Invalid page_id',\n content: { 'application/json': { schema: InvalidPageIdErrorSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 500: {\n description: 'Internal server error',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n },\n});\n\nexport const listMyBookmarksRoute = createRoute({\n method: 'get',\n path: '/bookmarks/me',\n tags: ['bookmark'],\n security: [{ bearerAuth: [] }],\n summary: \"List the current user's bookmarks (paginated)\",\n request: {\n query: PaginationRequestSchema,\n },\n responses: {\n 200: {\n description: 'Paginated bookmark list',\n content: { 'application/json': { schema: ListMyBookmarksResponseSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 500: {\n description: 'Internal server error',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n },\n});\n\nexport const addBookmarkRoute = createRoute({\n method: 'post',\n path: '/bookmarks',\n tags: ['bookmark'],\n security: [{ bearerAuth: [] }],\n summary: 'Add a bookmark for the current user',\n request: {\n body: {\n content: { 'application/json': { schema: AddBookmarkRequestSchema } },\n },\n },\n responses: {\n 200: {\n description: 'Bookmark created (or null when the page is not accessible)',\n content: { 'application/json': { schema: BookmarkResponseSchema } },\n },\n 400: {\n description: 'Invalid page_id',\n content: { 'application/json': { schema: InvalidPageIdErrorSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 500: {\n description: 'Internal server error',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n },\n});\n\nexport const removeBookmarkRoute = createRoute({\n method: 'delete',\n path: '/bookmarks',\n tags: ['bookmark'],\n security: [{ bearerAuth: [] }],\n summary: 'Remove a bookmark for the current user',\n request: {\n body: {\n content: { 'application/json': { schema: RemoveBookmarkRequestSchema } },\n },\n },\n responses: {\n 200: {\n description: 'Bookmark removed (or already absent)',\n content: { 'application/json': { schema: RemoveBookmarkResponseSchema } },\n },\n 400: {\n description: 'Invalid page_id',\n content: { 'application/json': { schema: InvalidPageIdErrorSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 500: {\n description: 'Internal server error',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n },\n});\n\nexport const bookmarkRoutes = {\n getBookmarkRoute,\n listMyBookmarksRoute,\n addBookmarkRoute,\n removeBookmarkRoute,\n};\n","/**\n * RFC-0006 Phase 4 Batch 3 — `backlink` resource ported to\n * `@hono/zod-openapi` route definitions. Single endpoint:\n *\n * GET /backlinks — list backlinks targeting a page\n *\n * Requires JWT authentication. The Hono handler applies\n * `createJwtAuth(crowi)` broadly to `/backlinks/*` so `c.get('user')`\n * is always populated. Query parameters keep their ts-rest-era shape\n * (`page_id` is the 24-hex target page id; `limit` / `offset` are\n * coerced from URL strings and bounds-checked).\n */\nimport { createRoute } from '@hono/zod-openapi';\n\nimport { GetBacklinksRequestSchema, GetBacklinksResponseSchema } from '../schemas/backlink';\nimport { AuthenticationRequiredErrorSchema, InvalidPageIdErrorSchema } from '../schemas/common';\n\nexport const getBacklinksRoute = createRoute({\n method: 'get',\n path: '/backlinks',\n tags: ['backlink'],\n security: [{ bearerAuth: [] }],\n summary: 'List backlinks targeting a page',\n request: {\n query: GetBacklinksRequestSchema,\n },\n responses: {\n 200: {\n description: 'Backlinks targeting the page (trimmed to `limit`; `hasNext` flags whether more exist)',\n content: { 'application/json': { schema: GetBacklinksResponseSchema } },\n },\n 400: {\n description: 'Invalid page_id',\n content: { 'application/json': { schema: InvalidPageIdErrorSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n },\n});\n\nexport const backlinkRoutes = {\n getBacklinksRoute,\n};\n","import { z } from '@hono/zod-openapi';\nimport { UserPublicSchema } from './userPublic';\n\n// 24-character hex ObjectId string. Mirrors isValidObjectId in\n// packages/api/src/util/ts-rest-helpers.ts so request validation rejects\n// non-ObjectId strings at the contract boundary.\nconst ObjectIdString = z.string().regex(/^[0-9a-f]{24}$/, 'Invalid ObjectId');\n\n// `fromPage` is populated by Backlink.findByPageId; only the `path` is used\n// by the legacy UI. Keep the shape minimal so we don't lock in fields the\n// API may stop populating later.\nexport const BacklinkFromPageSchema = z.object({\n _id: z.string(),\n path: z.string(),\n});\nexport type BacklinkFromPage = z.infer<typeof BacklinkFromPageSchema>;\n\n// `fromRevision` is populated alongside its `author` (a UserPublic). The\n// legacy UI rendered the author's avatar next to the source page link.\nexport const BacklinkFromRevisionSchema = z.object({\n _id: z.string(),\n author: UserPublicSchema.nullable().optional(),\n});\nexport type BacklinkFromRevision = z.infer<typeof BacklinkFromRevisionSchema>;\n\nexport const BacklinkSchema = z.object({\n _id: z.string(),\n // The destination page's id (the page being linked TO). Always the\n // page passed in the request, but echoed for cache-key parity with the\n // legacy response.\n page: z.string(),\n fromPage: BacklinkFromPageSchema,\n fromRevision: BacklinkFromRevisionSchema,\n updatedAt: z.string(),\n});\nexport type Backlink = z.infer<typeof BacklinkSchema>;\n\nexport const GetBacklinksRequestSchema = z.object({\n page_id: ObjectIdString,\n limit: z.coerce.number().int().min(1).max(100).optional().default(20),\n offset: z.coerce.number().int().min(0).optional().default(0),\n});\nexport type GetBacklinksRequest = z.infer<typeof GetBacklinksRequestSchema>;\n\n// `hasNext` lets the UI render a \"Read More\" affordance without the legacy\n// limit+1 over-fetch trick. The server fetches limit+1 internally and trims\n// to `limit` before returning.\nexport const GetBacklinksResponseSchema = z.object({\n backlinks: z.array(BacklinkSchema),\n hasNext: z.boolean(),\n});\nexport type GetBacklinksResponse = z.infer<typeof GetBacklinksResponseSchema>;\n","/**\n * RFC-0006 Phase 4 Batch 3 — `comment` resource ported to\n * `@hono/zod-openapi` route definitions. Three endpoints:\n *\n * GET /comments — list comments by page_id or revision_id\n * POST /comments — add a comment to a page revision\n * DELETE /comments — delete a comment by id (requires page grant)\n *\n * All endpoints require JWT authentication. The Hono handler applies\n * `createJwtAuth(crowi)` broadly to `/comments/*` so `c.get('user')`\n * is populated for every handler. Error envelopes are preserved from\n * the ts-rest era so the web client sees identical bodies.\n */\nimport { createRoute } from '@hono/zod-openapi';\n\nimport {\n AddCommentRequestSchema,\n AddCommentResponseSchema,\n CommentInvalidRequestErrorSchema,\n CommentNotFoundErrorSchema,\n DeleteCommentRequestSchema,\n DeleteCommentResponseSchema,\n ListCommentsRequestSchema,\n ListCommentsResponseSchema,\n} from '../schemas/comment';\nimport { AuthenticationRequiredErrorSchema } from '../schemas/common';\nimport { PageNotFoundErrorSchema, PageNotGrantedErrorSchema } from '../schemas/page';\n\nexport const listCommentsRoute = createRoute({\n method: 'get',\n path: '/comments',\n tags: ['comment'],\n security: [{ bearerAuth: [] }],\n summary: 'List comments by page or revision',\n request: {\n query: ListCommentsRequestSchema,\n },\n responses: {\n 200: {\n description: 'Comments matching the requested page or revision',\n content: { 'application/json': { schema: ListCommentsResponseSchema } },\n },\n 400: {\n description: 'Invalid request (page_id / revision_id required or malformed)',\n content: { 'application/json': { schema: CommentInvalidRequestErrorSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n },\n});\n\nexport const addCommentRoute = createRoute({\n method: 'post',\n path: '/comments',\n tags: ['comment'],\n security: [{ bearerAuth: [] }],\n summary: 'Add a comment to a page',\n request: {\n body: {\n content: { 'application/json': { schema: AddCommentRequestSchema } },\n },\n },\n responses: {\n 200: {\n description: 'The created comment with populated creator',\n content: { 'application/json': { schema: AddCommentResponseSchema } },\n },\n 400: {\n description: 'Invalid request body',\n content: { 'application/json': { schema: CommentInvalidRequestErrorSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 404: {\n description: 'Page not found (also covers grant-denied to avoid leaking existence)',\n content: { 'application/json': { schema: PageNotFoundErrorSchema } },\n },\n },\n});\n\nexport const deleteCommentRoute = createRoute({\n method: 'delete',\n path: '/comments',\n tags: ['comment'],\n security: [{ bearerAuth: [] }],\n summary: 'Delete a comment',\n request: {\n body: {\n content: { 'application/json': { schema: DeleteCommentRequestSchema } },\n },\n },\n responses: {\n 200: {\n description: 'Comment removed',\n content: { 'application/json': { schema: DeleteCommentResponseSchema } },\n },\n 400: {\n description: 'Invalid request body',\n content: { 'application/json': { schema: CommentInvalidRequestErrorSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 403: {\n description: 'Caller cannot access the parent page',\n content: { 'application/json': { schema: PageNotGrantedErrorSchema } },\n },\n 404: {\n description: 'Comment not found',\n content: { 'application/json': { schema: CommentNotFoundErrorSchema } },\n },\n },\n});\n\nexport const commentRoutes = {\n listCommentsRoute,\n addCommentRoute,\n deleteCommentRoute,\n};\n","import { z } from '@hono/zod-openapi';\nimport { PageUserSchema } from './page';\n\n// Comment schema - matches CommentDocument shape, with creator populated\nexport const CommentSchema = z.object({\n _id: z.string(),\n page: z.string(),\n // creator is populated to a user object on the API side; allow string fallback for safety\n creator: z.union([z.string(), PageUserSchema]).nullable(),\n revision: z.string(),\n comment: z.string(),\n commentPosition: z.number().default(-1),\n createdAt: z.string(),\n});\nexport type Comment = z.infer<typeof CommentSchema>;\n\n// List comments request schema\n// Either page_id or revision_id must be provided.\nexport const ListCommentsRequestSchema = z.object({\n page_id: z.string().optional(),\n revision_id: z.string().optional(),\n});\nexport type ListCommentsRequest = z.infer<typeof ListCommentsRequestSchema>;\n\n// List comments response schema\nexport const ListCommentsResponseSchema = z.object({\n comments: z.array(CommentSchema),\n});\nexport type ListCommentsResponse = z.infer<typeof ListCommentsResponseSchema>;\n\n// Add comment request schema\nexport const AddCommentRequestSchema = z.object({\n page_id: z.string().min(1, 'page_id is required'),\n revision_id: z.string().min(1, 'revision_id is required'),\n comment: z.string().min(1, 'comment is required'),\n comment_position: z.number().int().optional(),\n});\nexport type AddCommentRequest = z.infer<typeof AddCommentRequestSchema>;\n\n// Add comment response schema\n//\n// feature-watch-autosubscribe — `newlyWatching` is true only when this\n// comment auto-created a brand-new WATCH watcher row for the commenter\n// (they were not already watching / ignoring). The web client uses it to\n// show a one-shot \"now watching this page\" hint with an unwatch action.\nexport const AddCommentResponseSchema = z.object({\n comment: CommentSchema,\n newlyWatching: z.boolean(),\n});\nexport type AddCommentResponse = z.infer<typeof AddCommentResponseSchema>;\n\n// Delete comment request schema\nexport const DeleteCommentRequestSchema = z.object({\n comment_id: z.string().min(1, 'comment_id is required'),\n page_id: z.string().min(1, 'page_id is required'),\n});\nexport type DeleteCommentRequest = z.infer<typeof DeleteCommentRequestSchema>;\n\n// Delete comment response schema\nexport const DeleteCommentResponseSchema = z.object({\n ok: z.literal(true),\n});\nexport type DeleteCommentResponse = z.infer<typeof DeleteCommentResponseSchema>;\n\n// Error response schemas\nexport const CommentNotFoundErrorSchema = z.object({\n error: z.object({\n code: z.literal('COMMENT_NOT_FOUND'),\n message: z.literal('Comment not found'),\n }),\n});\n\nexport const CommentInvalidRequestErrorSchema = z.object({\n error: z.object({\n code: z.literal('INVALID_REQUEST'),\n message: z.string(),\n }),\n});\n\nexport type CommentNotFoundError = z.infer<typeof CommentNotFoundErrorSchema>;\nexport type CommentInvalidRequestError = z.infer<typeof CommentInvalidRequestErrorSchema>;\n","/**\n * RFC-0006 Phase 4 Batch 3 — `revision` resource ported to\n * `@hono/zod-openapi` route definitions. Three endpoints:\n *\n * GET /pages/{page_id}/revisions — list revisions of a page (meta only)\n * GET /pages/revisions — fetch multiple revisions by ids\n * GET /pages/revisions/{id} — fetch a single revision (with body)\n *\n * All endpoints require JWT authentication. The Hono handler applies\n * `createJwtAuth(crowi)` broadly to `/pages/*` so `c.get('user')` is\n * populated; the broad apply intentionally overlaps with the future\n * `page` resource (Batch 4) — both handlers share the same middleware\n * instance via Hono's deduping (`app.use(path, mw)` is idempotent on\n * the same middleware reference within a single chain).\n *\n * `getRevisionsRoute` (`/pages/revisions`) must register BEFORE\n * `getRevisionRoute` (`/pages/revisions/{id}`) so Hono's pattern\n * matcher resolves `?ids=...` to the list-by-ids route rather than\n * treating `revisions` as the path param `id` value. The runtime\n * handler chain in `packages/api/src/hono/handlers/revision.ts` and\n * the stub chain in `client.ts` follow the same order.\n */\nimport { createRoute, z } from '@hono/zod-openapi';\n\nimport { AuthenticationRequiredErrorSchema } from '../schemas/common';\nimport { PageNotFoundErrorSchema } from '../schemas/page';\nimport {\n GetRevisionResponseSchema,\n GetRevisionsRequestSchema,\n GetRevisionsResponseSchema,\n ListRevisionsRequestSchema,\n ListRevisionsResponseSchema,\n RevisionInvalidRequestErrorSchema,\n} from '../schemas/revision';\n\nconst PageIdParamSchema = z.object({ page_id: z.string() });\nconst RevisionIdParamSchema = z.object({ id: z.string() });\n\nexport const listRevisionsRoute = createRoute({\n method: 'get',\n path: '/pages/{page_id}/revisions',\n tags: ['revision'],\n security: [{ bearerAuth: [] }],\n summary: 'List revisions of a page (meta only)',\n request: {\n params: PageIdParamSchema,\n query: ListRevisionsRequestSchema,\n },\n responses: {\n 200: {\n description: 'Revision metadata (no body), newest first',\n content: { 'application/json': { schema: ListRevisionsResponseSchema } },\n },\n 400: {\n description: 'Invalid request',\n content: { 'application/json': { schema: RevisionInvalidRequestErrorSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 404: {\n description: 'Page not found (also covers grant-denied to avoid leaking existence)',\n content: { 'application/json': { schema: PageNotFoundErrorSchema } },\n },\n },\n});\n\nexport const getRevisionsRoute = createRoute({\n method: 'get',\n path: '/pages/revisions',\n tags: ['revision'],\n security: [{ bearerAuth: [] }],\n summary: 'Get multiple revisions by ids (comma-separated)',\n request: {\n query: GetRevisionsRequestSchema,\n },\n responses: {\n 200: {\n description: 'Requested revisions (all must share the same path)',\n content: { 'application/json': { schema: GetRevisionsResponseSchema } },\n },\n 400: {\n description: 'Invalid request',\n content: { 'application/json': { schema: RevisionInvalidRequestErrorSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 404: {\n description: 'No matching revisions or page not found (also covers grant-denied)',\n content: { 'application/json': { schema: PageNotFoundErrorSchema } },\n },\n },\n});\n\nexport const getRevisionRoute = createRoute({\n method: 'get',\n path: '/pages/revisions/{id}',\n tags: ['revision'],\n security: [{ bearerAuth: [] }],\n summary: 'Get a single revision (with body)',\n request: {\n params: RevisionIdParamSchema,\n },\n responses: {\n 200: {\n description: 'Full revision document',\n content: { 'application/json': { schema: GetRevisionResponseSchema } },\n },\n 400: {\n description: 'Invalid revision id',\n content: { 'application/json': { schema: RevisionInvalidRequestErrorSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 404: {\n description: 'Revision or page not found (also covers grant-denied)',\n content: { 'application/json': { schema: PageNotFoundErrorSchema } },\n },\n },\n});\n\nexport const revisionRoutes = {\n listRevisionsRoute,\n // `getRevisionsRoute` (list-by-ids) must come before `getRevisionRoute`\n // (single by id) so Hono matches `/pages/revisions?ids=a,b` before\n // falling through to the `{id}` template. See the file header.\n getRevisionsRoute,\n getRevisionRoute,\n};\n","import { z } from '@hono/zod-openapi';\nimport { PagerSchema, PageUserSchema, RevisionSchema } from './page';\n\n/**\n * Revision meta schema - lightweight (no body) for list endpoints.\n *\n * Phase 8 (RFC-0003) added `savedBy` and `contributors`:\n * - `savedBy` is the user who pressed the Save button (i.e. fired\n * the `crowi:save` stateless message). In the legacy / v1.x\n * single-author flow this is the same as `author`; in the\n * collaborative flow it can differ from any single contributor.\n * - `contributors` is the set of awareness-confirmed peers who had\n * a live cursor on the page between the previous Save and this\n * one. The list excludes `savedBy` itself (the save initiator is\n * already surfaced separately) and is `undefined` for pre-RFC-0003\n * revisions to keep wire-format back-compat.\n *\n * Both fields are optional + nullable so v1.x revisions can be served\n * without churn — clients that consume the new fields fall back to\n * `author` when `savedBy` is missing.\n */\nexport const RevisionMetaSchema = z.object({\n _id: z.string(),\n path: z.string(),\n author: PageUserSchema.nullable().optional(),\n savedBy: PageUserSchema.nullable().optional(),\n contributors: z.array(PageUserSchema).optional(),\n // RFC-0010 — edit channel. `web` (browser / collab editor) vs the API\n // token paths (`oauth` / `pat`). Absent on pre-RFC-0010 revisions. The\n // history UI shows an \"app\" chip for the token paths.\n editVia: z.enum(['web', 'oauth', 'pat']).optional(),\n createdAt: z.string(),\n});\nexport type RevisionMeta = z.infer<typeof RevisionMetaSchema>;\n\n// List revisions request schema (path param: page_id, query: limit/offset)\nexport const ListRevisionsRequestSchema = z.object({\n limit: z.coerce.number().int().positive().max(200).optional().default(50),\n offset: z.coerce.number().int().min(0).optional().default(0),\n});\nexport type ListRevisionsRequest = z.infer<typeof ListRevisionsRequestSchema>;\n\n// List revisions response schema\nexport const ListRevisionsResponseSchema = z.object({\n revisions: z.array(RevisionMetaSchema),\n pager: PagerSchema,\n});\nexport type ListRevisionsResponse = z.infer<typeof ListRevisionsResponseSchema>;\n\n// Get single revision response schema\nexport const GetRevisionResponseSchema = z.object({\n revision: RevisionSchema,\n});\nexport type GetRevisionResponse = z.infer<typeof GetRevisionResponseSchema>;\n\n// Get multiple revisions request schema (query: ids comma-separated)\nexport const GetRevisionsRequestSchema = z.object({\n ids: z.string().min(1, 'ids is required'),\n});\nexport type GetRevisionsRequest = z.infer<typeof GetRevisionsRequestSchema>;\n\n// Get multiple revisions response schema\nexport const GetRevisionsResponseSchema = z.object({\n revisions: z.array(RevisionSchema),\n});\nexport type GetRevisionsResponse = z.infer<typeof GetRevisionsResponseSchema>;\n\n// Error schema for invalid request inputs (matches comment.ts shape)\nexport const RevisionInvalidRequestErrorSchema = z.object({\n error: z.object({\n code: z.literal('INVALID_REQUEST'),\n message: z.string(),\n }),\n});\nexport type RevisionInvalidRequestError = z.infer<typeof RevisionInvalidRequestErrorSchema>;\n","/**\n * RFC-0006 Phase 4 Batch 3 — `notification` resource ported to\n * `@hono/zod-openapi` route definitions. Four endpoints:\n *\n * GET /notifications — paginated list for the current user\n * POST /notifications/read — mark all UNREAD as UNOPENED\n * POST /notifications/{id}/open — open one notification (set OPENED)\n * GET /notifications/status — unread count for the current user\n *\n * All endpoints require JWT authentication. The Hono handler applies\n * `createJwtAuth(crowi)` broadly to `/notifications/*` so `c.get('user')`\n * is populated. `markAllAsRead` and `openNotification` accept an empty\n * body — we declare the schema as `z.unknown()` so Express body-parser's\n * `{}`-on-empty-POST hydration validates cleanly (legacy parity).\n *\n * `/notifications/status` is registered BEFORE `/notifications/{id}/open`\n * in the runtime handler chain so the literal `status` path wins over\n * the `{id}` template — same idiom as the revision routes.\n */\nimport { createRoute, z } from '@hono/zod-openapi';\n\nimport { AuthenticationRequiredErrorSchema, InternalServerErrorSchema } from '../schemas/common';\nimport {\n ListNotificationsRequestSchema,\n ListNotificationsResponseSchema,\n MarkAllAsReadResponseSchema,\n NotificationNotFoundErrorSchema,\n NotificationStatusResponseSchema,\n NotificationsTokenResponseSchema,\n OpenNotificationParamSchema,\n OpenNotificationResponseSchema,\n} from '../schemas/notification';\n\n// 400 envelope for malformed notification id (parity with the ts-rest\n// handler which returned `INVALID_REQUEST`). Declared inline because no\n// other notification endpoint reuses this shape.\nconst NotificationInvalidRequestErrorSchema = z.object({\n error: z.object({\n code: z.literal('INVALID_REQUEST'),\n message: z.string(),\n }),\n});\n\nexport const listNotificationsRoute = createRoute({\n method: 'get',\n path: '/notifications',\n tags: ['notification'],\n security: [{ bearerAuth: [] }],\n summary: 'List notifications for the current user (paginated)',\n request: {\n query: ListNotificationsRequestSchema,\n },\n responses: {\n 200: {\n description: 'Paginated notification list (newest first)',\n content: { 'application/json': { schema: ListNotificationsResponseSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 500: {\n description: 'Internal server error',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n },\n});\n\nexport const markAllAsReadRoute = createRoute({\n method: 'post',\n path: '/notifications/read',\n tags: ['notification'],\n security: [{ bearerAuth: [] }],\n summary: 'Mark all unread notifications of the current user as read',\n responses: {\n 200: {\n description: 'All UNREAD notifications transitioned to UNOPENED',\n content: { 'application/json': { schema: MarkAllAsReadResponseSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 500: {\n description: 'Internal server error',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n },\n});\n\nexport const getUnreadCountRoute = createRoute({\n method: 'get',\n path: '/notifications/status',\n tags: ['notification'],\n security: [{ bearerAuth: [] }],\n summary: 'Get the unread notification count for the current user',\n responses: {\n 200: {\n description: 'Unread notification count',\n content: { 'application/json': { schema: NotificationStatusResponseSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 500: {\n description: 'Internal server error',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n },\n});\n\nexport const openNotificationRoute = createRoute({\n method: 'post',\n path: '/notifications/{id}/open',\n tags: ['notification'],\n security: [{ bearerAuth: [] }],\n summary: 'Open a notification (set its status to OPENED)',\n request: {\n params: OpenNotificationParamSchema,\n },\n responses: {\n 200: {\n description: 'The opened notification (status=OPENED)',\n content: { 'application/json': { schema: OpenNotificationResponseSchema } },\n },\n 400: {\n description: 'Invalid notification id (malformed ObjectId)',\n content: { 'application/json': { schema: NotificationInvalidRequestErrorSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 404: {\n description: 'Notification not found or owned by another user',\n content: { 'application/json': { schema: NotificationNotFoundErrorSchema } },\n },\n 500: {\n description: 'Internal server error',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n },\n});\n\n/**\n * GET /api/v2/notifications/token\n *\n * Mints the short-lived JWT a browser presents on the\n * `/notifications/<userId>` WebSocket handshake. The notifications\n * WebSocket fans out per-user invalidation signals from\n * Redis-published `Notification.upsert` / `mark*Read*` events so the\n * web client can drop its 30-second `useUnreadCount` polling loop.\n *\n * Authorisation:\n * - 401 if the caller is unauthenticated.\n * - 500 on signing exception.\n *\n * Distinct from `getPresenceTokenRoute` because the notifications\n * channel is scoped to a single user (not a page) and the WebSocket\n * carries no read-permission re-check — invalidation signals never\n * contain notification content, just a \"your notifications changed\"\n * tick the client uses to invalidate its react-query cache.\n */\nexport const getNotificationsTokenRoute = createRoute({\n method: 'get',\n path: '/notifications/token',\n tags: ['notification'],\n security: [{ bearerAuth: [] }],\n summary: 'Issue a short-lived notifications token (JWT) for the realtime-invalidation WebSocket',\n responses: {\n 200: {\n description: 'Signed notifications token + selfUserId + expiresAt',\n content: { 'application/json': { schema: NotificationsTokenResponseSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 500: {\n description: 'Token signing exception',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n },\n});\n\nexport const notificationRoutes = {\n listNotificationsRoute,\n markAllAsReadRoute,\n // `/notifications/token` is a literal path — register before\n // `/notifications/{id}/open` so the template never shadows it. Same\n // first-match-wins ordering reason as `/notifications/status`.\n getNotificationsTokenRoute,\n // `/notifications/status` MUST be registered before `/notifications/{id}/open`\n // so the literal-path route matches first; see the file header.\n getUnreadCountRoute,\n openNotificationRoute,\n};\n","import { z } from '@hono/zod-openapi';\nimport { PageSchema, PagerSchema } from './page';\nimport { UserPublicSchema } from './userPublic';\n\n// Notification status enum - matches Notification model constants\n// (packages/api/src/models/notification.ts)\nexport const NotificationStatusSchema = z.enum(['UNREAD', 'UNOPENED', 'OPENED']);\nexport const NotificationStatusEnum = {\n UNREAD: 'UNREAD',\n UNOPENED: 'UNOPENED',\n OPENED: 'OPENED',\n} as const;\nexport type NotificationStatus = z.infer<typeof NotificationStatusSchema>;\n\n// Notification action enum - matches activityDefine.ts\n// COMMENT / LIKE / MENTION / UPDATE are wired on the server side\n// (CREATE / MODIFY / DELETE are reserved but not yet emitted).\n// MENTION is dispatched by RFC-0002 Phase 8 mention-dispatch listener.\n// UPDATE is fanned out to watchers on a page body revision\n// (feature-page-update-notification).\nexport const NotificationActionSchema = z.enum(['COMMENT', 'LIKE', 'MENTION', 'UPDATE']);\nexport const NotificationActionEnum = {\n COMMENT: 'COMMENT',\n LIKE: 'LIKE',\n MENTION: 'MENTION',\n UPDATE: 'UPDATE',\n} as const;\nexport type NotificationAction = z.infer<typeof NotificationActionSchema>;\n\n// Notification target model enum - currently only Page is supported\nexport const NotificationTargetModelSchema = z.enum(['Page']);\nexport const NotificationTargetModelEnum = {\n PAGE: 'Page',\n} as const;\nexport type NotificationTargetModel = z.infer<typeof NotificationTargetModelSchema>;\n\n// Lightweight Page reference for notification payloads.\n// The legacy controller populates the full Page document, but the UI only needs\n// _id / path / status to render the link. Sending the full Page schema would\n// bloat list responses considerably, so we derive a minimal projection here.\nexport const PageRefSchema = PageSchema.pick({\n _id: true,\n path: true,\n status: true,\n});\nexport type PageRef = z.infer<typeof PageRefSchema>;\n\n// Notification schema - matches NotificationDocument shape with target populated\n// to a lightweight PageRef and actionUsers virtual resolved to UserPublicSchema[].\nexport const NotificationSchema = z.object({\n _id: z.string(),\n user: z.string(),\n targetModel: NotificationTargetModelSchema,\n target: PageRefSchema,\n action: NotificationActionSchema,\n status: NotificationStatusSchema,\n actionUsers: z.array(UserPublicSchema),\n createdAt: z.string(),\n});\nexport type Notification = z.infer<typeof NotificationSchema>;\n\n// GET /notifications?limit&offset\nexport const ListNotificationsRequestSchema = z.object({\n limit: z.coerce.number().optional().default(10),\n offset: z.coerce.number().optional().default(0),\n});\nexport type ListNotificationsRequest = z.infer<typeof ListNotificationsRequestSchema>;\n\n// GET /notifications response - paginated list with bookmark-style pager\nexport const ListNotificationsResponseSchema = z.object({\n notifications: z.array(NotificationSchema),\n pager: PagerSchema,\n});\nexport type ListNotificationsResponse = z.infer<typeof ListNotificationsResponseSchema>;\n\n// POST /notifications/read\nexport const MarkAllAsReadResponseSchema = z.object({\n ok: z.literal(true),\n});\nexport type MarkAllAsReadResponse = z.infer<typeof MarkAllAsReadResponseSchema>;\n\n// POST /notifications/:id/open\nexport const OpenNotificationParamSchema = z.object({\n id: z.string(),\n});\nexport type OpenNotificationParam = z.infer<typeof OpenNotificationParamSchema>;\n\nexport const OpenNotificationResponseSchema = z.object({\n notification: NotificationSchema,\n});\nexport type OpenNotificationResponse = z.infer<typeof OpenNotificationResponseSchema>;\n\n// GET /notifications/status\nexport const NotificationStatusResponseSchema = z.object({\n count: z.number(),\n});\nexport type NotificationStatusResponse = z.infer<typeof NotificationStatusResponseSchema>;\n\n// Errors specific to notification\nexport const NotificationNotFoundErrorSchema = z.object({\n error: z.object({\n code: z.literal('NOTIFICATION_NOT_FOUND'),\n message: z.literal('Notification not found'),\n }),\n});\nexport type NotificationNotFoundError = z.infer<typeof NotificationNotFoundErrorSchema>;\n\n/**\n * Response body of `GET /api/v2/notifications/token`.\n *\n * Used by the browser to authenticate the `/notifications/<userId>` WebSocket\n * handshake that fans out per-user notification invalidation signals\n * (the spec's \"data is still fetched via REST, only the *invalidation\n * signal* is pushed\" design). Same shape as `PresenceTokenResponse`\n * minus the page scoping — notifications are scoped to the requesting\n * user instead.\n *\n * - `token` — short-lived JWT (60s) the browser presents on the\n * WebSocket connect (`?token=<jwt>`).\n * - `selfUserId` — the requesting user's `_id`. The handshake rejects\n * a token whose `selfUserId` does not match the\n * `/notifications/<userId>` path segment.\n * - `expiresAt` — ISO 8601 timestamp; clients refresh proactively\n * before the WebSocket would otherwise be torn down.\n */\nexport const NotificationsTokenResponseSchema = z.object({\n token: z.string(),\n selfUserId: z.string(),\n expiresAt: z.string(),\n});\nexport type NotificationsTokenResponse = z.infer<typeof NotificationsTokenResponseSchema>;\n\n/**\n * Decoded payload of the short-lived notifications token JWT. The api\n * signs this with `WS_TOKEN_SECRET` (shared with collab + presence) but\n * uses a distinct `iss` claim (`crowi-notifications`) so a leaked\n * collab/presence token can never be replayed against the notifications\n * channel and vice versa.\n */\nexport const NotificationsTokenPayloadSchema = z.object({\n selfUserId: z.string(),\n // Random UUID mixed into every signed token so two tokens minted\n // within the same second still produce byte-different JWT strings.\n // The browser uses the token as a React effect dependency to drive\n // the WebSocket reconnect — without `jti`, the iat/exp pair is\n // identical at second granularity and the dep stays stable.\n jti: z.string().uuid(),\n iat: z.number().int(),\n exp: z.number().int(),\n});\nexport type NotificationsTokenPayload = z.infer<typeof NotificationsTokenPayloadSchema>;\n\n/**\n * Server → client message on `/notifications/<userId>`. The only\n * message kind is a `changed` signal — the browser uses it to invalidate\n * its `notificationKeys.all` react-query cache, then re-fetches via the\n * existing REST endpoints. The payload itself carries no notification\n * data, keeping the message size constant regardless of unread count.\n */\nexport const NotificationsChangedMessageSchema = z.object({\n type: z.literal('changed'),\n});\nexport type NotificationsChangedMessage = z.infer<typeof NotificationsChangedMessageSchema>;\n\nexport const NotificationsServerMessageSchema = NotificationsChangedMessageSchema;\nexport type NotificationsServerMessage = z.infer<typeof NotificationsServerMessageSchema>;\n","/**\n * RFC-0006 Phase 4 Batch 4 — `page` resource ported to\n * `@hono/zod-openapi` route definitions. 14 endpoints — the largest\n * single resource in the API. Wire-format parity with the ts-rest era\n * is preserved.\n *\n * Auth: every endpoint requires JWT auth, but the Hono handler does\n * NOT install `createJwtAuth(crowi)` itself — the `revision` handler\n * already applies `app.use('/pages/*', createJwtAuth(crowi))` on the\n * shared chain (see `packages/api/src/hono/handlers/revision.ts`).\n * Hono does **not** dedupe middleware by reference, so re-installing\n * the same factory output on `/pages/*` would run JWT verify and\n * `User.findById` twice per request. The runtime contract is \"register\n * `registerRevisionRoutes` before `registerPageRoutes` in `buildHonoApp`\".\n *\n * Route-order considerations:\n *\n * - `/pages/list`, `/pages/grant`, `/pages/seen`, `/pages/seen-users`,\n * `/pages/like`, `/pages/unlike`, `/pages/watch`, `/pages/revert`,\n * `/pages/rename`, `/pages/preview` are all literal sub-paths of\n * `/pages`. They share the prefix `/pages/` with the revision\n * routes (`/pages/{page_id}/revisions`, `/pages/revisions`,\n * `/pages/revisions/{id}`) but Hono's pattern matcher dispatches\n * by `method + full path` so there's no ambiguity:\n * - GET /pages (this contract — `getPage`)\n * - GET /pages/list (this contract — `listPages`)\n * - GET /pages/revisions (revision contract — list-by-ids)\n * - GET /pages/{page_id}/revisions (revision — list-by-page)\n * - `getPage` (`GET /pages`) and `createPage` (`POST /pages`) share\n * the same path with different methods — Hono routes by `method+path`\n * so this is fine.\n * - `previewPage` (`POST /pages/preview`) lives in the `pagePreview`\n * contract (separate file) but is also on `/pages/*` so it goes\n * through the same `createJwtAuth` apply installed by `revision`.\n */\nimport { createRoute, z } from '@hono/zod-openapi';\n\nimport { AuthenticationRequiredErrorSchema, InvalidPageIdErrorSchema } from '../schemas/common';\nimport {\n CreatePageRequestSchema,\n GetPageRequestSchema,\n GetPageResponseSchema,\n GetSeenUsersRequestSchema,\n GetWatchStatusRequestSchema,\n ListPageChildrenRequestSchema,\n ListPageChildrenResponseSchema,\n ListPagesRequestSchema,\n ListPagesResponseSchema,\n PageNotFoundErrorSchema,\n PageNotGrantedErrorSchema,\n PageRevisionErrorSchema,\n PageSchema,\n RenamePageRequestSchema,\n RenamePageResponseSchema,\n RenameSubtreeRequestSchema,\n RenameSubtreeResponseSchema,\n RenameTreeErrorSchema,\n SeenPageRequestSchema,\n SeenUsersResponseSchema,\n SetPageGrantRequestSchema,\n SetWatchStatusRequestSchema,\n UpdatePageRequestSchema,\n WatchStatusResponseSchema,\n} from '../schemas/page';\n\n// Generic 400 envelope shared by createPage / updatePage / deletePage /\n// renamePage / revertDeletedPage / setPageGrant. The error `code` is a\n// resource-specific literal (PAGE_EXISTS, PAGE_INVALID_NAME,\n// PAGE_NOT_GRANTED — actually 403 not 400 — PAGE_CREATE_FAILED, etc.),\n// so we leave both fields as free strings rather than enumerating them.\nconst PageBadRequestErrorSchema = z.object({\n error: z.object({\n code: z.string(),\n message: z.string(),\n }),\n});\n\n// Delete body — mirrors the ts-rest contract one-shot inline schema.\nconst DeletePageRequestSchema = z.object({\n page_id: z.string(),\n revision_id: z.string().optional(),\n completely: z.boolean().optional(),\n});\n\nconst RevertDeletedPageRequestSchema = z.object({\n page_id: z.string(),\n});\n\nconst PageIdBodySchema = z.object({\n page_id: z.string(),\n});\n\nconst PageResponseSchema = z.object({ page: PageSchema });\n\nexport const getPageRoute = createRoute({\n method: 'get',\n path: '/pages',\n tags: ['page'],\n security: [{ bearerAuth: [] }],\n summary: 'Get page data by path or page_id',\n request: {\n query: GetPageRequestSchema,\n },\n responses: {\n 200: {\n description: 'The requested page with populated revision',\n content: { 'application/json': { schema: GetPageResponseSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 403: {\n description: 'Caller cannot access the page',\n content: { 'application/json': { schema: PageNotGrantedErrorSchema } },\n },\n 404: {\n description: 'Page not found',\n content: { 'application/json': { schema: PageNotFoundErrorSchema } },\n },\n },\n});\n\nexport const listPagesRoute = createRoute({\n method: 'get',\n path: '/pages/list',\n tags: ['page'],\n security: [{ bearerAuth: [] }],\n summary: 'List pages by path or creator (paginated)',\n request: {\n query: ListPagesRequestSchema,\n },\n responses: {\n 200: {\n description: 'Page list (newest first) with optional portal page',\n content: { 'application/json': { schema: ListPagesResponseSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n },\n});\n\nexport const listPageChildrenRoute = createRoute({\n method: 'get',\n path: '/pages/children',\n tags: ['page'],\n security: [{ bearerAuth: [] }],\n summary: 'List immediate child segments under a portal path (sidebar tree)',\n request: {\n query: ListPageChildrenRequestSchema,\n },\n responses: {\n 200: {\n description: 'First-level child segments (alphabetical) under the path',\n content: { 'application/json': { schema: ListPageChildrenResponseSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n },\n});\n\nexport const createPageRoute = createRoute({\n method: 'post',\n path: '/pages',\n tags: ['page'],\n security: [{ bearerAuth: [] }],\n summary: 'Create a new page',\n request: {\n body: {\n content: { 'application/json': { schema: CreatePageRequestSchema } },\n },\n },\n responses: {\n 200: {\n description: 'The created page with populated revision',\n content: { 'application/json': { schema: PageResponseSchema } },\n },\n 400: {\n description: 'Invalid request (PAGE_EXISTS / NON_EXISTENT_USER_PAGE / PAGE_CREATE_FAILED / INVALID_GRANT)',\n content: { 'application/json': { schema: PageBadRequestErrorSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n },\n});\n\nexport const updatePageRoute = createRoute({\n method: 'put',\n path: '/pages',\n tags: ['page'],\n security: [{ bearerAuth: [] }],\n summary: 'Update existing page',\n request: {\n body: {\n content: { 'application/json': { schema: UpdatePageRequestSchema } },\n },\n },\n responses: {\n 200: {\n description: 'The updated page with new revision',\n content: { 'application/json': { schema: PageResponseSchema } },\n },\n 400: {\n description: 'Invalid request (PAGE_UPDATE_FAILED / INVALID_GRANT)',\n content: { 'application/json': { schema: PageBadRequestErrorSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 404: {\n description: 'Page not found (also covers grant-denied)',\n content: { 'application/json': { schema: PageNotFoundErrorSchema } },\n },\n 409: {\n description: 'Stale revision_id (someone else updated the page)',\n content: { 'application/json': { schema: PageRevisionErrorSchema } },\n },\n },\n});\n\nexport const setPageGrantRoute = createRoute({\n method: 'put',\n path: '/pages/grant',\n tags: ['page'],\n security: [{ bearerAuth: [] }],\n summary: 'Update page grant (visibility) only — no revision pushed',\n request: {\n body: {\n content: { 'application/json': { schema: SetPageGrantRequestSchema } },\n },\n },\n responses: {\n 200: {\n description: 'The page with the updated grant',\n content: { 'application/json': { schema: PageResponseSchema } },\n },\n 400: {\n description: 'Invalid request (INVALID_GRANT / PAGE_GRANT_UPDATE_FAILED)',\n content: { 'application/json': { schema: PageBadRequestErrorSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 404: {\n description: 'Page not found (also covers grant-denied)',\n content: { 'application/json': { schema: PageNotFoundErrorSchema } },\n },\n },\n});\n\nexport const seenPageRoute = createRoute({\n method: 'post',\n path: '/pages/seen',\n tags: ['page'],\n security: [{ bearerAuth: [] }],\n summary: 'Mark a page as seen by the current user (idempotent)',\n request: {\n body: {\n content: { 'application/json': { schema: SeenPageRequestSchema } },\n },\n },\n responses: {\n 200: {\n description: 'The current seen-users list and count',\n content: { 'application/json': { schema: SeenUsersResponseSchema } },\n },\n 400: {\n description: 'Invalid page_id',\n content: { 'application/json': { schema: InvalidPageIdErrorSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 404: {\n description: 'Page not found (also covers grant-denied)',\n content: { 'application/json': { schema: PageNotFoundErrorSchema } },\n },\n },\n});\n\nexport const getSeenUsersRoute = createRoute({\n method: 'get',\n path: '/pages/seen-users',\n tags: ['page'],\n security: [{ bearerAuth: [] }],\n summary: 'List users who have seen a page',\n request: {\n query: GetSeenUsersRequestSchema,\n },\n responses: {\n 200: {\n description: 'Seen-users list (optionally capped by `limit`) and full count',\n content: { 'application/json': { schema: SeenUsersResponseSchema } },\n },\n 400: {\n description: 'Invalid page_id',\n content: { 'application/json': { schema: InvalidPageIdErrorSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 404: {\n description: 'Page not found (also covers grant-denied)',\n content: { 'application/json': { schema: PageNotFoundErrorSchema } },\n },\n },\n});\n\nexport const likePageRoute = createRoute({\n method: 'post',\n path: '/pages/like',\n tags: ['page'],\n security: [{ bearerAuth: [] }],\n summary: 'Add the current user to the page liker list',\n request: {\n body: {\n content: { 'application/json': { schema: PageIdBodySchema } },\n },\n },\n responses: {\n 200: {\n description: 'The page with the updated liker list',\n content: { 'application/json': { schema: PageResponseSchema } },\n },\n 400: {\n description: 'Invalid page_id',\n content: { 'application/json': { schema: InvalidPageIdErrorSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 404: {\n description: 'Page not found (also covers grant-denied)',\n content: { 'application/json': { schema: PageNotFoundErrorSchema } },\n },\n },\n});\n\nexport const unlikePageRoute = createRoute({\n method: 'post',\n path: '/pages/unlike',\n tags: ['page'],\n security: [{ bearerAuth: [] }],\n summary: 'Remove the current user from the page liker list',\n request: {\n body: {\n content: { 'application/json': { schema: PageIdBodySchema } },\n },\n },\n responses: {\n 200: {\n description: 'The page with the updated liker list',\n content: { 'application/json': { schema: PageResponseSchema } },\n },\n 400: {\n description: 'Invalid page_id',\n content: { 'application/json': { schema: InvalidPageIdErrorSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 404: {\n description: 'Page not found (also covers grant-denied)',\n content: { 'application/json': { schema: PageNotFoundErrorSchema } },\n },\n },\n});\n\nexport const getWatchStatusRoute = createRoute({\n method: 'get',\n path: '/pages/watch',\n tags: ['page'],\n security: [{ bearerAuth: [] }],\n summary: 'Get watch (notification subscription) status for a page',\n request: {\n query: GetWatchStatusRequestSchema,\n },\n responses: {\n 200: {\n description: 'Watching status (true / false)',\n content: { 'application/json': { schema: WatchStatusResponseSchema } },\n },\n 400: {\n description: 'Invalid page_id',\n content: { 'application/json': { schema: InvalidPageIdErrorSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 404: {\n description: 'Page not found (also covers grant-denied)',\n content: { 'application/json': { schema: PageNotFoundErrorSchema } },\n },\n },\n});\n\nexport const setWatchStatusRoute = createRoute({\n method: 'put',\n path: '/pages/watch',\n tags: ['page'],\n security: [{ bearerAuth: [] }],\n summary: 'Set watch (notification subscription) status for a page',\n request: {\n body: {\n content: { 'application/json': { schema: SetWatchStatusRequestSchema } },\n },\n },\n responses: {\n 200: {\n description: 'Updated watching status',\n content: { 'application/json': { schema: WatchStatusResponseSchema } },\n },\n 400: {\n description: 'Invalid page_id',\n content: { 'application/json': { schema: InvalidPageIdErrorSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 404: {\n description: 'Page not found (also covers grant-denied)',\n content: { 'application/json': { schema: PageNotFoundErrorSchema } },\n },\n },\n});\n\nexport const deletePageRoute = createRoute({\n method: 'delete',\n path: '/pages',\n tags: ['page'],\n security: [{ bearerAuth: [] }],\n summary: 'Soft-delete (or hard-delete with completely=true) a page',\n request: {\n body: {\n content: { 'application/json': { schema: DeletePageRequestSchema } },\n },\n },\n responses: {\n 200: {\n description: 'The deleted page (soft-delete: trashed path; hard-delete: original snapshot)',\n content: { 'application/json': { schema: PageResponseSchema } },\n },\n 400: {\n description: 'PAGE_DELETE_FAILED',\n content: { 'application/json': { schema: PageBadRequestErrorSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 404: {\n description: 'Page not found (also covers grant-denied)',\n content: { 'application/json': { schema: PageNotFoundErrorSchema } },\n },\n 409: {\n description: 'Stale revision_id',\n content: { 'application/json': { schema: PageRevisionErrorSchema } },\n },\n },\n});\n\nexport const revertDeletedPageRoute = createRoute({\n method: 'post',\n path: '/pages/revert',\n tags: ['page'],\n security: [{ bearerAuth: [] }],\n summary: 'Revert a soft-deleted page (restore from /trash/...)',\n request: {\n body: {\n content: { 'application/json': { schema: RevertDeletedPageRequestSchema } },\n },\n },\n responses: {\n 200: {\n description: 'The restored page',\n content: { 'application/json': { schema: PageResponseSchema } },\n },\n 400: {\n description: 'PAGE_REVERT_FAILED',\n content: { 'application/json': { schema: PageBadRequestErrorSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 404: {\n description: 'Page not found (also covers grant-denied)',\n content: { 'application/json': { schema: PageNotFoundErrorSchema } },\n },\n },\n});\n\nexport const renamePageRoute = createRoute({\n method: 'post',\n path: '/pages/rename',\n tags: ['page'],\n security: [{ bearerAuth: [] }],\n summary: 'Rename (move) a page — optionally together with its subtree',\n request: {\n body: {\n content: { 'application/json': { schema: RenamePageRequestSchema } },\n },\n },\n responses: {\n 200: {\n description: 'The renamed (root) page plus how many pages were moved',\n content: { 'application/json': { schema: RenamePageResponseSchema } },\n },\n 400: {\n description: 'PAGE_INVALID_NAME / PAGE_EXISTS / PAGE_RENAME_FAILED / PAGE_RENAME_TREE_FAILED',\n content: {\n 'application/json': {\n schema: z.union([PageBadRequestErrorSchema, RenameTreeErrorSchema]),\n },\n },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 404: {\n description: 'Page not found (also covers grant-denied)',\n content: { 'application/json': { schema: PageNotFoundErrorSchema } },\n },\n 409: {\n description: 'Stale revision_id',\n content: { 'application/json': { schema: PageRevisionErrorSchema } },\n },\n },\n});\n\nexport const renameSubtreeRoute = createRoute({\n method: 'post',\n path: '/pages/rename-subtree',\n tags: ['page'],\n security: [{ bearerAuth: [] }],\n summary: 'Rename (move) a whole subtree by path (for portal-less folders)',\n request: {\n body: {\n content: { 'application/json': { schema: RenameSubtreeRequestSchema } },\n },\n },\n responses: {\n 200: {\n description: 'How many pages were moved',\n content: { 'application/json': { schema: RenameSubtreeResponseSchema } },\n },\n 400: {\n description: 'PAGE_INVALID_NAME / PAGE_RENAME_TREE_FAILED (collisions, nothing to move, or partial failure)',\n content: {\n 'application/json': {\n schema: z.union([PageBadRequestErrorSchema, RenameTreeErrorSchema]),\n },\n },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n },\n});\n\n/**\n * Ordered export for the runtime handler chain and the stub chain in\n * `client.ts`. Order is chosen so literal sub-paths register before\n * any route that could collide on the matcher tree, even though Hono\n * dispatches by `method + path` (paranoid + future-proof).\n *\n * Cross-resource ordering note: revision routes register BEFORE these\n * (in `buildHonoApp`) so the `/pages/*` `createJwtAuth` apply happens\n * once and is shared with page handlers — see the file header.\n */\nexport const pageRoutes = {\n // GET /pages — getPage (path-or-id query)\n getPageRoute,\n // GET /pages/list — listPages (paginated)\n listPagesRoute,\n // GET /pages/children — listPageChildren (sidebar tree)\n listPageChildrenRoute,\n // POST /pages — createPage\n createPageRoute,\n // PUT /pages — updatePage\n updatePageRoute,\n // PUT /pages/grant — setPageGrant\n setPageGrantRoute,\n // POST /pages/seen — seenPage\n seenPageRoute,\n // GET /pages/seen-users — getSeenUsers\n getSeenUsersRoute,\n // POST /pages/like — likePage\n likePageRoute,\n // POST /pages/unlike — unlikePage\n unlikePageRoute,\n // GET /pages/watch — getWatchStatus\n getWatchStatusRoute,\n // PUT /pages/watch — setWatchStatus\n setWatchStatusRoute,\n // DELETE /pages — deletePage\n deletePageRoute,\n // POST /pages/revert — revertDeletedPage\n revertDeletedPageRoute,\n // POST /pages/rename — renamePage\n renamePageRoute,\n // POST /pages/rename-subtree — renameSubtree (portal-less folder)\n renameSubtreeRoute,\n};\n","/**\n * RFC-0006 Phase 4 Batch 4 — `pagePreview` resource ported to\n * `@hono/zod-openapi`. Single endpoint:\n *\n * POST /pages/preview — render arbitrary markdown to mdast\n *\n * Authentication is required (same as the rest of `/pages/*`); the\n * page handler chain reuses the `createJwtAuth(crowi)` apply installed\n * by the revision handler so this contract does not declare auth\n * middleware itself.\n *\n * Standalone contract (separate from `pageContract`) because preview\n * is a read-only render operation: no revision is created, no page\n * is fetched, and the contract has no permission scope tied to a\n * specific page — the input is raw markdown that may belong to no\n * persisted page at all.\n */\nimport { createRoute } from '@hono/zod-openapi';\n\nimport { AuthenticationRequiredErrorSchema, InternalServerErrorSchema } from '../schemas/common';\nimport { PreviewPageRequestSchema, PreviewPageResponseSchema } from '../schemas/page-preview';\n\nexport const previewPageRoute = createRoute({\n method: 'post',\n path: '/pages/preview',\n tags: ['page-preview'],\n security: [{ bearerAuth: [] }],\n summary: 'Render markdown to mdast for the editor preview pane',\n request: {\n body: {\n content: { 'application/json': { schema: PreviewPageRequestSchema } },\n },\n },\n responses: {\n 200: {\n description: 'Rendered mdast tree (serialised — same shape as a persisted revision.renderedAst)',\n content: { 'application/json': { schema: PreviewPageResponseSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 500: {\n description: 'Renderer pipeline failure',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n },\n});\n\nexport const pagePreviewRoutes = {\n previewPageRoute,\n};\n","import { z } from '@hono/zod-openapi';\n\n/**\n * Request body for POST /pages/preview. Just the raw markdown body —\n * we deliberately do NOT take a page id / revision id here, because\n * the editor preview pane needs to render arbitrary in-flight text\n * that may not (yet) belong to a persisted revision.\n */\nexport const PreviewPageRequestSchema = z.object({\n body: z.string(),\n});\nexport type PreviewPageRequest = z.infer<typeof PreviewPageRequestSchema>;\n\n/**\n * Response shape mirrors the `renderedAst` carried on a populated\n * revision. We keep it as `z.unknown()` (same temperature as\n * `RevisionSchema.renderedAst`) because the persisted mdast shape is\n * external-spec / too deep to maintain a strict Zod schema for; the\n * client casts to `mdast.Root` at the boundary.\n */\nexport const PreviewPageResponseSchema = z.object({\n renderedAst: z.unknown(),\n});\nexport type PreviewPageResponse = z.infer<typeof PreviewPageResponseSchema>;\n","/**\n * RFC-0006 Phase 4 Batch 5 — `pageCollab` resource ported to\n * `@hono/zod-openapi` route definitions. Single endpoint:\n *\n * GET /pages/:id/yjs-token — Hocuspocus connection wsToken (RFC-0003)\n *\n * Auth: JWT required. The page handler chain shares `createJwtAuth(crowi)`\n * via the broad `/pages/*` apply installed by the `revision` handler\n * (see `packages/api/src/hono/handlers/revision.ts`). Hono does NOT\n * dedupe middleware by reference, so the pageCollab handler does NOT\n * install jwtAuth itself — the runtime contract is \"register\n * `registerRevisionRoutes` before `registerPageCollabRoutes` in\n * `buildHonoApp`\" (same rationale as `page` / `page-preview`).\n *\n * Route-order considerations:\n *\n * - `/pages/:id/yjs-token` shares the `/pages/{page_id}/...` prefix\n * with revision's `/pages/{page_id}/revisions` (24-hex regex gates\n * the param). Hono dispatches by `method + full path` so the literal\n * `/yjs-token` suffix wins; there is no matcher ambiguity.\n * - The literal page sub-paths (`/pages/list`, `/pages/grant`, etc.)\n * use a fixed segment in position 2 of the URL whereas\n * `/yjs-token` uses a hex id, so no collision is possible.\n *\n * Standalone contract (separate from `pageContract`) because the\n * WebSocket-handshake surface is its own discoverable bundle (the Phase\n * 6 cleanup that deletes Crowi 1.x's legacy page contract should leave\n * collab routing untouched).\n */\nimport { createRoute, z } from '@hono/zod-openapi';\n\nimport { WsTokenResponseSchema } from '../schemas/collab';\nimport { AuthenticationRequiredErrorSchema, InternalServerErrorSchema, InvalidPageIdErrorSchema } from '../schemas/common';\nimport { PageNotFoundErrorSchema } from '../schemas/page';\n\nconst PageIdPathParamsSchema = z.object({\n id: z.string().openapi({ description: 'Page id (24-char hex ObjectId)', example: '507f1f77bcf86cd799439011' }),\n});\n\n/**\n * GET /api/v2/pages/:id/yjs-token (RFC-0003 Phase 2)\n *\n * Mints the short-lived JWT (`wsToken`) the Hocuspocus client\n * (`HocuspocusProvider`) presents on connect. Phase 3 wires\n * `onAuthenticate` to the matching verify helper so a leaked token is\n * reduced to a 5-minute exposure window scoped to a single page id.\n *\n * Authorisation:\n * - 401 if the caller is unauthenticated (router-level `jwtAuth`).\n * - 400 if `:id` is not a 24-char hex ObjectId.\n * - 404 if the page does not exist *or* the caller is not granted\n * access. The same 404 covers both cases by design (matches\n * `loadGrantedPage` behaviour) so we never leak page existence to\n * callers without grant. Draft pages (RFC-0004) collapse \"draft\n * owned by someone else\" into the same 404.\n * - 500 on signing / DB exception.\n *\n * The `readonly` flag in the response will become `true` once the\n * 20-user editor cap is exhausted (Phase 6 Redis counter); pre-cap\n * deployments always observe `readonly: false`.\n */\nexport const getYjsTokenRoute = createRoute({\n method: 'get',\n path: '/pages/{id}/yjs-token',\n tags: ['page-collab'],\n security: [{ bearerAuth: [] }],\n summary: 'Issue a short-lived wsToken (JWT) for the Hocuspocus realtime session',\n request: {\n params: PageIdPathParamsSchema,\n },\n responses: {\n 200: {\n description: 'Signed wsToken (JWT) + scope metadata',\n content: { 'application/json': { schema: WsTokenResponseSchema } },\n },\n 400: {\n description: 'Invalid page id',\n content: { 'application/json': { schema: InvalidPageIdErrorSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 404: {\n description: 'Page not found (also covers grant-denied)',\n content: { 'application/json': { schema: PageNotFoundErrorSchema } },\n },\n 500: {\n description: 'wsToken signing or DB exception',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n },\n});\n\nexport const pageCollabRoutes = {\n getYjsTokenRoute,\n};\n","/**\n * RFC-0006 Phase 4 Batch 5 — `presence` resource ported to\n * `@hono/zod-openapi` route definitions. Two endpoints:\n *\n * GET /pages/:id/presence-token — RFC-0005 viewer presence wsToken\n * GET /pages/:id/likers — RFC-0005 Phase 3 liker list\n *\n * Auth: JWT required. Like `pageCollab` / `page` / `page-preview`, this\n * handler does NOT install `createJwtAuth(crowi)` itself — the\n * `revision` handler's broad apply on `/pages/*` is reused (Hono does\n * not dedupe middleware by reference; re-installing would cost a second\n * JWT verify + `User.findById` per request). Register order in\n * `buildHonoApp` is `revision -> page -> page-preview -> pageCollab ->\n * presence -> notification`.\n *\n * Distinct from `pageCollabContract` because presence is a separate,\n * lighter WebSocket channel: page *viewers* connect to `/presence`\n * without ever loading Yjs, and the presence token is signed by a\n * distinct issuer (`crowi-presence`) so a leaked wsToken can never be\n * replayed against the presence channel and vice versa.\n *\n * Route-order considerations:\n *\n * - `/pages/:id/presence-token` + `/pages/:id/likers` share the\n * `/pages/{page_id}/...` prefix with revision's\n * `/pages/{page_id}/revisions` (24-hex regex gates the param) and\n * pageCollab's `/pages/:id/yjs-token`. Hono dispatches by\n * `method + full path` so the literal suffix wins; no matcher\n * ambiguity. The literal page sub-paths (`/pages/list` etc.) use\n * a fixed segment in position 2 vs. our hex id, so no collision.\n */\nimport { createRoute, z } from '@hono/zod-openapi';\n\nimport { AuthenticationRequiredErrorSchema, InternalServerErrorSchema, InvalidPageIdErrorSchema } from '../schemas/common';\nimport { PageNotFoundErrorSchema } from '../schemas/page';\nimport { GetLikersRequestSchema, LikersResponseSchema, PresenceTokenResponseSchema } from '../schemas/presence';\n\nconst PageIdPathParamsSchema = z.object({\n id: z.string().openapi({ description: 'Page id (24-char hex ObjectId)', example: '507f1f77bcf86cd799439011' }),\n});\n\n/**\n * GET /api/v2/pages/:id/presence-token (RFC-0005 Phase 1)\n *\n * Mints the short-lived JWT a page viewer presents on the\n * `/presence/:pageId` WebSocket handshake. The presence handler\n * verifies this token (signature + pageId match) and re-checks read\n * permission before registering the viewer in the Redis viewer hash.\n *\n * Authorisation:\n * - 401 if the caller is unauthenticated.\n * - 400 if `:id` is not a 24-char hex ObjectId.\n * - 404 if the page does not exist *or* the caller is not granted\n * access — same 404 covers both so page existence is never leaked.\n * - 500 on signing / DB exception.\n *\n * Unlike the collab wsToken route, there is no draft-author gate here:\n * presence is read-only viewer tracking, so any user with read access\n * can appear in the viewer list. A non-author already gets the 404\n * from `loadGrantedPage`.\n */\nexport const getPresenceTokenRoute = createRoute({\n method: 'get',\n path: '/pages/{id}/presence-token',\n tags: ['presence'],\n security: [{ bearerAuth: [] }],\n summary: 'Issue a short-lived presence token (JWT) for the live-presence WebSocket session',\n request: {\n params: PageIdPathParamsSchema,\n },\n responses: {\n 200: {\n description: 'Signed presence token + scope metadata',\n content: { 'application/json': { schema: PresenceTokenResponseSchema } },\n },\n 400: {\n description: 'Invalid page id',\n content: { 'application/json': { schema: InvalidPageIdErrorSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 404: {\n description: 'Page not found (also covers grant-denied)',\n content: { 'application/json': { schema: PageNotFoundErrorSchema } },\n },\n 500: {\n description: 'Token signing or DB exception',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n },\n});\n\n/**\n * GET /api/v2/pages/:id/likers (RFC-0005 Phase 3)\n *\n * Returns the users who have liked the page, backing the \"Liked by\"\n * modal opened from the meta-chip row. Read access to the page is\n * sufficient — the like list is not private.\n *\n * Data source: the page's `liker` ObjectId array (authoritative). Each\n * entry's `likedAt` is a best-effort join with the `ACTION_LIKE`\n * Activity record and may be `null`.\n *\n * Authorisation: same fail-closed pipeline as `getPresenceToken`.\n */\nexport const getLikersRoute = createRoute({\n method: 'get',\n path: '/pages/{id}/likers',\n tags: ['presence'],\n security: [{ bearerAuth: [] }],\n summary: 'List the users who have liked a page',\n request: {\n params: PageIdPathParamsSchema,\n query: GetLikersRequestSchema,\n },\n responses: {\n 200: {\n description: 'Liker list (newest-liked first when known) with full totalCount',\n content: { 'application/json': { schema: LikersResponseSchema } },\n },\n 400: {\n description: 'Invalid page id',\n content: { 'application/json': { schema: InvalidPageIdErrorSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 404: {\n description: 'Page not found (also covers grant-denied)',\n content: { 'application/json': { schema: PageNotFoundErrorSchema } },\n },\n 500: {\n description: 'DB exception',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n },\n});\n\nexport const presenceRoutes = {\n getPresenceTokenRoute,\n getLikersRoute,\n};\n","import { z } from '@hono/zod-openapi';\n\n/**\n * RFC-0005 shared schemas for the page-presence feature (\"who is\n * viewing this page right now\").\n *\n * Two surfaces are described here:\n *\n * - the HTTP `GET /api/v2/pages/:id/presence-token` response\n * (`PresenceTokenResponseSchema` / `PresenceTokenPayloadSchema`),\n * - the WebSocket `/presence/:pageId` message envelope\n * (`PresenceClientMessageSchema` / `PresenceServerMessageSchema`).\n *\n * Kept disjoint from `collab.ts` because presence is its own\n * lightweight WebSocket channel — page viewers connect to `/presence`\n * without ever loading Yjs. The presence token is signed by a\n * *separate* issuer (`crowi-presence`) so a leaked collab wsToken can\n * never be replayed against the presence channel and vice versa.\n */\n\n/**\n * Response body of `GET /api/v2/pages/:id/presence-token`.\n *\n * - `token` — short-lived JWT (5 min) the browser presents on\n * the `/presence/:pageId?token=` WebSocket connect.\n * - `pageId` — the page id this token is scoped to (mirrors the\n * request param; clients use it to detect misroute).\n * - `selfUserId` — the requesting user's `_id`, so the client can\n * identify itself (\"(you)\") in the viewer list.\n * - `expiresAt` — ISO 8601 timestamp; clients refresh proactively\n * before the WebSocket would otherwise be torn down.\n */\nexport const PresenceTokenResponseSchema = z.object({\n token: z.string(),\n pageId: z.string(),\n selfUserId: z.string(),\n expiresAt: z.string(),\n});\nexport type PresenceTokenResponse = z.infer<typeof PresenceTokenResponseSchema>;\n\n/**\n * Decoded payload of the short-lived presence token JWT. The api signs\n * this with `WS_TOKEN_SECRET` (same secret as the collab wsToken, but a\n * distinct `iss` claim) and the `/presence` WebSocket handler verifies\n * it on connect.\n */\nexport const PresenceTokenPayloadSchema = z.object({\n userId: z.string(),\n pageId: z.string(),\n iat: z.number().int(),\n exp: z.number().int(),\n});\nexport type PresenceTokenPayload = z.infer<typeof PresenceTokenPayloadSchema>;\n\n/**\n * A single viewer entry in the server → client viewer-list broadcast.\n *\n * - `isEditing` is NOT stored in the presence Redis hash — it is\n * derived at broadcast time by joining the viewer set with the\n * RFC-0003 editor-cap Set (`crowi:collab:editors:<pageId>`).\n * - `joinedAt` is an epoch-millis timestamp; the client uses it for\n * stable ordering of avatars.\n */\nexport const PresenceViewerSchema = z.object({\n userId: z.string(),\n username: z.string(),\n displayName: z.string(),\n avatarUrl: z.string().nullable(),\n isEditing: z.boolean(),\n joinedAt: z.number().int(),\n});\nexport type PresenceViewer = z.infer<typeof PresenceViewerSchema>;\n\n/**\n * Client → server message. The only message a presence client sends is\n * a periodic heartbeat (every 15s) that refreshes the Redis TTL for\n * its viewer entry.\n */\nexport const PresenceHeartbeatMessageSchema = z.object({\n type: z.literal('heartbeat'),\n});\nexport type PresenceHeartbeatMessage = z.infer<typeof PresenceHeartbeatMessageSchema>;\n\nexport const PresenceClientMessageSchema = PresenceHeartbeatMessageSchema;\nexport type PresenceClientMessage = z.infer<typeof PresenceClientMessageSchema>;\n\n/**\n * Server → client message: the full viewer list for the page. The\n * server pushes the complete list on every change (join / leave /\n * isEditing toggle); for typical sizes (< 50 viewers) full broadcasts\n * are cheaper than diffs and avoid state-sync bugs.\n */\nexport const PresenceViewersMessageSchema = z.object({\n type: z.literal('viewers'),\n viewers: z.array(PresenceViewerSchema),\n});\nexport type PresenceViewersMessage = z.infer<typeof PresenceViewersMessageSchema>;\n\nexport const PresenceServerMessageSchema = PresenceViewersMessageSchema;\nexport type PresenceServerMessage = z.infer<typeof PresenceServerMessageSchema>;\n\n/**\n * RFC-0005 Phase 3 — `GET /api/v2/pages/:id/likers`.\n *\n * A single entry in the \"liked by\" list. Sourced from the page's\n * `liker` ObjectId array (the authoritative set of who liked the\n * page); the per-user `likedAt` is a best-effort enrichment from the\n * `ACTION_LIKE` Activity record and is `null` when no Activity row\n * exists (e.g. likes recorded before activity logging, or a stale\n * Activity row that was pruned).\n */\nexport const LikerSchema = z.object({\n id: z.string(),\n username: z.string(),\n displayName: z.string(),\n avatarUrl: z.string().nullable(),\n likedAt: z.string().nullable(),\n});\nexport type Liker = z.infer<typeof LikerSchema>;\n\n/**\n * Response body of `GET /api/v2/pages/:id/likers`.\n *\n * - `users` — the liker list, newest-liked first when `likedAt`\n * is known (entries without a timestamp sort last).\n * - `totalCount` — the full size of `page.liker`, independent of the\n * `limit` cap so the chip count stays accurate.\n */\nexport const LikersResponseSchema = z.object({\n users: z.array(LikerSchema),\n totalCount: z.number().int().nonnegative(),\n});\nexport type LikersResponse = z.infer<typeof LikersResponseSchema>;\n\n/** Query schema of `GET /api/v2/pages/:id/likers`. */\nexport const GetLikersRequestSchema = z.object({\n // Optional cap on returned `users`. `totalCount` always reflects the\n // full count regardless of `limit`. Omit for the full list.\n limit: z.coerce.number().int().positive().optional(),\n});\nexport type GetLikersRequest = z.infer<typeof GetLikersRequestSchema>;\n","/**\n * RFC-0006 Phase 4 Batch 6 — `draft` resource ported to\n * `@hono/zod-openapi` route definitions. Three endpoints (RFC-0004\n * Phase 3 — drafts):\n *\n * POST /pages/drafts — create a draft at a path\n * GET /pages/drafts — list the caller's own drafts\n * DELETE /pages/drafts/{id} — cancel a draft\n *\n * All endpoints require JWT auth. The Hono handler does NOT install\n * `createJwtAuth(crowi)` itself — the `revision` handler's broad apply\n * on `/pages/*` (registered first in `buildHonoApp`) covers the\n * `/pages/drafts*` literals. Same dedupe-avoidance rationale as\n * `page` / `page-preview` / `pageCollab` / `presence`.\n *\n * The literal `/pages/drafts` sub-path wins over a `/pages/{id}`\n * template in Hono's method+path dispatch, so order between this\n * handler and the page handler is purely organisational.\n */\nimport { createRoute, z } from '@hono/zod-openapi';\n\nimport { AuthenticationRequiredErrorSchema } from '../schemas/common';\nimport {\n CreateDraftRequestSchema,\n CreateDraftResponseSchema,\n DraftBadRequestErrorSchema,\n DraftNotFoundErrorSchema,\n DraftPathConflictErrorSchema,\n ListDraftsResponseSchema,\n} from '../schemas/draft';\n\nconst DraftIdPathParamsSchema = z.object({\n id: z.string().openapi({ description: 'Draft page id (24-char hex ObjectId)', example: '507f1f77bcf86cd799439011' }),\n});\n\nexport const createDraftRoute = createRoute({\n method: 'post',\n path: '/pages/drafts',\n tags: ['draft'],\n security: [{ bearerAuth: [] }],\n summary: 'Create a new draft page at a path',\n request: {\n body: {\n content: { 'application/json': { schema: CreateDraftRequestSchema } },\n },\n },\n responses: {\n 201: {\n description: 'Draft created (or the caller already holds a draft at this path — idempotent)',\n content: { 'application/json': { schema: CreateDraftResponseSchema } },\n },\n 400: {\n description: 'Uncreatable path, or path already held by a published page',\n content: { 'application/json': { schema: DraftBadRequestErrorSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 409: {\n description: \"Another user's draft already occupies the path\",\n content: { 'application/json': { schema: DraftPathConflictErrorSchema } },\n },\n },\n});\n\nexport const listDraftsRoute = createRoute({\n method: 'get',\n path: '/pages/drafts',\n tags: ['draft'],\n security: [{ bearerAuth: [] }],\n summary: \"List the current user's draft pages\",\n responses: {\n 200: {\n description: 'Caller-scoped draft list (newest first)',\n content: { 'application/json': { schema: ListDraftsResponseSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n },\n});\n\nexport const cancelDraftRoute = createRoute({\n method: 'delete',\n path: '/pages/drafts/{id}',\n tags: ['draft'],\n security: [{ bearerAuth: [] }],\n summary: 'Cancel (delete) a draft page',\n request: {\n params: DraftIdPathParamsSchema,\n },\n responses: {\n 200: {\n description: 'Draft cancelled; the path is released',\n content: { 'application/json': { schema: CreateDraftResponseSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 404: {\n description: 'Draft not found, or owned by a different user (existence leak guard)',\n content: { 'application/json': { schema: DraftNotFoundErrorSchema } },\n },\n },\n});\n\nexport const draftRoutes = {\n createDraftRoute,\n listDraftsRoute,\n cancelDraftRoute,\n};\n","import { z } from '@hono/zod-openapi';\n\n/**\n * RFC-0004 Phase 3 — schemas for the drafts endpoints\n * (`POST` / `GET` / `DELETE` under `/api/v2/pages/drafts`).\n *\n * A *draft* is a `Page` with `status === 'draft'`: a brand-new page in\n * progress, visible only to its author until the first save promotes it\n * to `published`. These schemas describe the create / list / cancel\n * wire format and the same-path conflict (409) body.\n */\n\n/**\n * Request body for `POST /api/v2/pages/drafts`.\n * `path` is the canonical wiki path the new page will occupy.\n * `initialBody` seeds the draft's first revision; defaults to empty.\n */\nexport const CreateDraftRequestSchema = z.object({\n path: z.string().min(1),\n initialBody: z.string().optional(),\n});\nexport type CreateDraftRequest = z.infer<typeof CreateDraftRequestSchema>;\n\n/**\n * Success body for `POST /api/v2/pages/drafts` (201). Only the new\n * `pageId` is returned — the client navigates to `/pages/<id>/edit`\n * and the collab session loads the rest.\n */\nexport const CreateDraftResponseSchema = z.object({\n pageId: z.string(),\n});\nexport type CreateDraftResponse = z.infer<typeof CreateDraftResponseSchema>;\n\n/**\n * Owner identity surfaced in a same-path conflict. Deliberately minimal\n * (the `Creating pages` conflict UI only renders \"being created by\n * <displayName> (@<username>)\") so a conflict never leaks more of the\n * other user's profile than necessary.\n */\nexport const DraftConflictOwnerSchema = z.object({\n id: z.string(),\n username: z.string(),\n displayName: z.string(),\n});\nexport type DraftConflictOwner = z.infer<typeof DraftConflictOwnerSchema>;\n\n/**\n * 409 body for `POST /api/v2/pages/drafts` when another user already\n * holds a draft at the requested path. `error` is a stable machine\n * code; `owner` lets the UI show the contact-the-owner message;\n * `message` is a human-readable fallback.\n */\nexport const DraftPathConflictErrorSchema = z.object({\n error: z.literal('path_taken_by_draft'),\n owner: DraftConflictOwnerSchema,\n message: z.string(),\n});\nexport type DraftPathConflictError = z.infer<typeof DraftPathConflictErrorSchema>;\n\n/**\n * Generic 400 for `POST /api/v2/pages/drafts` — an uncreatable path,\n * or a path already occupied by a *published* page (not another\n * user's draft, which is the 409 case above).\n */\nexport const DraftBadRequestErrorSchema = z.object({\n error: z.enum(['invalid_path', 'path_taken']),\n message: z.string(),\n});\nexport type DraftBadRequestError = z.infer<typeof DraftBadRequestErrorSchema>;\n\n/**\n * 403 / 404 body for `DELETE /api/v2/pages/drafts/:id` — the id is not\n * a draft the caller owns. The same generic shape covers both \"no such\n * draft\" and \"not your draft\" so draft existence is never leaked.\n */\nexport const DraftNotFoundErrorSchema = z.object({\n error: z.literal('draft_not_found'),\n message: z.string(),\n});\nexport type DraftNotFoundError = z.infer<typeof DraftNotFoundErrorSchema>;\n\n/**\n * A single row in `GET /api/v2/pages/drafts` — enough for the\n * `Creating pages` view: identifiers (`pageId`, `path`), and the two\n * timestamps that frame \"did I make progress recently or is this stale\"\n * (`createdAt`, `updatedAt`).\n *\n * A body preview / character count was intentionally NOT included:\n * draft body lives in the Hocuspocus Y.Doc / `Page.yjsState` and only\n * lands in `Page.revision.body` on explicit save, so any field derived\n * from the revision would lag the live editor enough to mislead users\n * (an actively-edited draft would report \"0 chars\" until they pressed\n * save). Surfacing a body summary correctly requires Y.Doc\n * reconstruction per draft, which is heavier than the listing should\n * absorb.\n */\nexport const DraftSummarySchema = z.object({\n pageId: z.string(),\n path: z.string(),\n createdAt: z.string(),\n updatedAt: z.string(),\n});\nexport type DraftSummary = z.infer<typeof DraftSummarySchema>;\n\n/**\n * Success body for `GET /api/v2/pages/drafts`. Lists only the calling\n * user's own drafts, newest first.\n */\nexport const ListDraftsResponseSchema = z.object({\n drafts: z.array(DraftSummarySchema),\n});\nexport type ListDraftsResponse = z.infer<typeof ListDraftsResponseSchema>;\n","/**\n * RFC-0006 Phase 4 Batch 6 — `autocomplete` resource ported to\n * `@hono/zod-openapi` route definitions. Two endpoints (RFC-0004\n * Phase 5):\n *\n * GET /users/autocomplete — suggest users for an @mention\n * GET /pages/autocomplete — suggest pages for a [[wikilink]]\n *\n * Auth + rate limiting:\n * - `/pages/autocomplete` reuses the `revision` handler's broad\n * `/pages/*` `createJwtAuth(crowi)` apply (registered first in\n * `buildHonoApp` — same dedupe-avoidance rationale as the rest\n * of the `/pages/*` family).\n * - `/users/autocomplete` is OUTSIDE that prefix, so the autocomplete\n * handler installs `createJwtAuth(crowi)` on `/users/autocomplete`\n * itself (a single-route install, no other resource owns that path\n * today).\n * - Both endpoints additionally apply `withRateLimit({ name:\n * 'autocomplete', limit: 60, windowMs: 60_000 })` AFTER jwtAuth so\n * the limiter has `c.get('user')`.\n *\n * The 429 wire shape is preserved verbatim — `Retry-After` header +\n * `{ error: 'rate_limited', message, retryAfterSeconds }` body.\n */\nimport { createRoute } from '@hono/zod-openapi';\n\nimport { AuthenticationRequiredErrorSchema, ValidationErrorSchema } from '../schemas/common';\nimport { AutocompleteRateLimitErrorSchema, AutocompleteRequestSchema, AutocompleteResponseSchema } from '../schemas/autocomplete';\n\nexport const autocompleteUsersRoute = createRoute({\n method: 'get',\n path: '/users/autocomplete',\n tags: ['autocomplete'],\n security: [{ bearerAuth: [] }],\n summary: 'Autocomplete users for an @mention',\n request: {\n query: AutocompleteRequestSchema,\n },\n responses: {\n 200: {\n description: 'Ranked user candidates',\n content: { 'application/json': { schema: AutocompleteResponseSchema } },\n },\n 400: {\n description: 'Validation error',\n content: { 'application/json': { schema: ValidationErrorSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 429: {\n description: 'Per-user rate limit exceeded',\n content: { 'application/json': { schema: AutocompleteRateLimitErrorSchema } },\n },\n },\n});\n\nexport const autocompletePagesRoute = createRoute({\n method: 'get',\n path: '/pages/autocomplete',\n tags: ['autocomplete'],\n security: [{ bearerAuth: [] }],\n summary: 'Autocomplete pages for a [[wikilink]]',\n request: {\n query: AutocompleteRequestSchema,\n },\n responses: {\n 200: {\n description: 'Ranked page candidates (permission-filtered)',\n content: { 'application/json': { schema: AutocompleteResponseSchema } },\n },\n 400: {\n description: 'Validation error',\n content: { 'application/json': { schema: ValidationErrorSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 429: {\n description: 'Per-user rate limit exceeded',\n content: { 'application/json': { schema: AutocompleteRateLimitErrorSchema } },\n },\n },\n});\n\nexport const autocompleteRoutes = {\n autocompleteUsersRoute,\n autocompletePagesRoute,\n};\n","import { z } from '@hono/zod-openapi';\n\n/**\n * RFC-0004 Phase 5 — schemas for the autocomplete endpoints\n * (`GET /api/v2/users/autocomplete`, `GET /api/v2/pages/autocomplete`).\n *\n * Autocomplete powers the editor's `@username` / `[[page]]` dropdowns.\n * Both endpoints share one query shape and one result shape so the\n * CodeMirror extension can drive them through a single code path; the\n * `kind`-specific fields (`avatar` for users, `modifiedAt` for pages)\n * are optional. See `docs/rfcs/0004-editor-ux-enhancement.md`\n * §\"Autocomplete\".\n */\n\n/**\n * Query for both autocomplete endpoints. `q` is the prefix the user has\n * typed after the trigger (`@` / `[[`); `limit` caps the candidate\n * count (the client requests 10, the server hard-caps at 25 so a\n * crafted request cannot fan out an unbounded scan).\n */\nexport const AutocompleteRequestSchema = z.object({\n q: z.string().min(1).max(128),\n limit: z.coerce.number().int().min(1).max(25).optional().default(10),\n /**\n * How `q` is matched against the candidate text. `'substring'` (the\n * default, used by the editor's `@mention` / `[[wikilink]]` pickers)\n * keeps the historical anywhere-in-string match. `'prefix'` anchors\n * the match at the start — used by the \"create page\" modal, where the\n * user is building a `/`-rooted path and only true prefixes are valid\n * completions of what they have typed so far.\n */\n anchor: z.enum(['substring', 'prefix']).optional().default('substring'),\n});\nexport type AutocompleteRequest = z.infer<typeof AutocompleteRequestSchema>;\n\n/**\n * A single autocomplete candidate. The three text fields realise the\n * RFC's \"display in dropdown / insert as Markdown / render at view\n * time\" separation:\n * - `label` — canonical text inserted into the document\n * (`username` for users, full page `path` for pages).\n * - `display` — human-readable label shown in the dropdown row.\n * - `avatar` — user only: avatar image URL (may be absent).\n * - `modifiedAt` — page only: ISO timestamp shown as \"2 days ago\".\n * - `score` — server-computed rank (higher = better match); the\n * client keeps the server order but exposes it for\n * future tie-breaking.\n */\nexport const AutocompleteResultSchema = z.object({\n id: z.string(),\n label: z.string(),\n display: z.string(),\n avatar: z.string().nullable().optional(),\n modifiedAt: z.string().nullable().optional(),\n score: z.number(),\n});\nexport type AutocompleteResult = z.infer<typeof AutocompleteResultSchema>;\n\n/**\n * Success body for both autocomplete endpoints. `results` is already\n * permission-filtered and ranked (prefix > substring > fuzzy); the\n * client renders it verbatim.\n */\nexport const AutocompleteResponseSchema = z.object({\n results: z.array(AutocompleteResultSchema),\n});\nexport type AutocompleteResponse = z.infer<typeof AutocompleteResponseSchema>;\n\n/**\n * 429 body for either autocomplete endpoint when the per-user rate\n * limit (60 req/min) is exceeded. The client closes the dropdown\n * silently on 429, so the body is informational only; a `Retry-After`\n * header carries the machine-readable cooldown.\n */\nexport const AutocompleteRateLimitErrorSchema = z.object({\n error: z.literal('rate_limited'),\n message: z.string(),\n retryAfterSeconds: z.number(),\n});\nexport type AutocompleteRateLimitError = z.infer<typeof AutocompleteRateLimitErrorSchema>;\n","/**\n * RFC-0006 Phase 4 Batch 6 — `attachment` resource ported to\n * `@hono/zod-openapi` route definitions. Six endpoints:\n *\n * GET /pages/{pageId}/attachments — list (page-scoped)\n * POST /pages/{pageId}/attachments — add (multipart)\n * GET /pages/{pageId}/attachments/usage — usage breakdown\n * GET /attachments/{id}/meta — single attachment meta\n * POST /attachments/upload — editor paste / D&D upload (multipart)\n * DELETE /attachments/{id} — remove\n *\n * Note: the raw streaming routes (`GET /attachments/{id}` /\n * `GET /attachments/by-key/{key}`) remain Express-mounted in the\n * bridge for now — they pipe Readable bytes and Hono's typed\n * response API does not express streaming-without-buffer cleanly.\n * Phase 6 cleanup converts them to native Hono `Response`-stream\n * handlers.\n *\n * Auth split:\n * - `/pages/*` (list / add / usage) reuses the `revision` handler's\n * broad `createJwtAuth(crowi)` apply — same shared-middleware\n * pattern as page / page-preview / pageCollab / presence / draft.\n * - `/attachments/*` (meta / upload / remove) is OUTSIDE that prefix\n * so the attachment handler installs `createJwtAuth(crowi)` on\n * `/attachments/*` itself.\n *\n * Multipart: `addAttachment` + `uploadAttachment` are implemented\n * Hono-native via `c.req.parseBody()`. multer is gone from this\n * resource (legacy `/_api/me/picture/upload` still uses it, so the\n * package dependency is removed in Phase 6 cleanup, not here).\n * `uploadAttachment` runs a `Content-Length` precheck BEFORE\n * `parseBody()` so a 50 MB+ body is 413'd without being buffered.\n */\nimport { createRoute, z } from '@hono/zod-openapi';\n\nimport { AuthenticationRequiredErrorSchema, InternalServerErrorSchema } from '../schemas/common';\nimport {\n AddAttachmentResponseSchema,\n AttachmentErrorSchema,\n AttachmentMetaSchema,\n AttachmentUsageResponseSchema,\n ListAttachmentsResponseSchema,\n RemoveAttachmentResponseSchema,\n UploadAttachmentErrorSchema,\n UploadAttachmentResponseSchema,\n} from '../schemas/attachment';\n\nconst PageIdPathParamsSchema = z.object({\n pageId: z.string().openapi({ description: 'Page id (24-char hex ObjectId)', example: '507f1f77bcf86cd799439011' }),\n});\n\nconst AttachmentIdPathParamsSchema = z.object({\n id: z.string().openapi({ description: 'Attachment id (24-char hex ObjectId)', example: '507f1f77bcf86cd799439011' }),\n});\n\n/**\n * Multipart body schema for the `addAttachment` / `uploadAttachment`\n * endpoints. The file field is declared as `z.any()` because the actual\n * payload is a Web `File` (Hono `c.req.parseBody()` surfaces it) — we\n * only need to describe the field name + format for the OpenAPI spec\n * and let the handler narrow at runtime.\n */\nconst AddAttachmentBodySchema = z.object({\n file: z.any().openapi({ type: 'string', format: 'binary' }).optional(),\n});\n\n// `intent` is declared as `z.string().optional()` rather than\n// `z.enum(['paste','dnd'])` because the handler returns the legacy\n// `{ error: 'disallowed_type', ... }` envelope for a bad intent value,\n// and a strict enum here would short-circuit that path via the\n// `defaultHook` ValidationError envelope before the handler runs.\nconst UploadAttachmentBodySchema = z.object({\n file: z.any().openapi({ type: 'string', format: 'binary' }).optional(),\n pageId: z.string().optional(),\n intent: z\n .string()\n .optional()\n .openapi({ enum: ['paste', 'dnd'] }),\n});\n\nexport const listAttachmentsRoute = createRoute({\n method: 'get',\n path: '/pages/{pageId}/attachments',\n tags: ['attachment'],\n security: [{ bearerAuth: [] }],\n summary: 'List attachments for a page',\n request: {\n params: PageIdPathParamsSchema,\n },\n responses: {\n 200: {\n description: 'Attachment list (with `inUse` derived from the latest revision body)',\n content: { 'application/json': { schema: ListAttachmentsResponseSchema } },\n },\n 400: {\n description: 'Invalid page id',\n content: { 'application/json': { schema: AttachmentErrorSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 404: {\n description: 'Page not found or not granted',\n content: { 'application/json': { schema: AttachmentErrorSchema } },\n },\n 500: {\n description: 'Internal server error',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n },\n});\n\nexport const addAttachmentRoute = createRoute({\n method: 'post',\n path: '/pages/{pageId}/attachments',\n tags: ['attachment'],\n security: [{ bearerAuth: [] }],\n summary: 'Add an attachment to a page (multipart/form-data)',\n request: {\n params: PageIdPathParamsSchema,\n body: {\n content: { 'multipart/form-data': { schema: AddAttachmentBodySchema } },\n },\n },\n responses: {\n 200: {\n description: 'Attachment created',\n content: { 'application/json': { schema: AddAttachmentResponseSchema } },\n },\n 400: {\n description: 'Missing file / invalid page id',\n content: { 'application/json': { schema: AttachmentErrorSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 404: {\n description: 'Page not found or not granted',\n content: { 'application/json': { schema: AttachmentErrorSchema } },\n },\n 413: {\n description: 'Request body exceeds the multipart envelope ceiling',\n content: { 'application/json': { schema: AttachmentErrorSchema } },\n },\n 500: {\n description: 'Upload / storage failure',\n content: { 'application/json': { schema: AttachmentErrorSchema } },\n },\n },\n});\n\nexport const getAttachmentUsageRoute = createRoute({\n method: 'get',\n path: '/pages/{pageId}/attachments/usage',\n tags: ['attachment'],\n security: [{ bearerAuth: [] }],\n summary: 'Get the full attachment usage breakdown for a page (latest vs past)',\n request: {\n params: PageIdPathParamsSchema,\n },\n responses: {\n 200: {\n description: 'Usage breakdown (latest / past split, with referencing revisions)',\n content: { 'application/json': { schema: AttachmentUsageResponseSchema } },\n },\n 400: {\n description: 'Invalid page id',\n content: { 'application/json': { schema: AttachmentErrorSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 404: {\n description: 'Page not found or not granted',\n content: { 'application/json': { schema: AttachmentErrorSchema } },\n },\n 500: {\n description: 'Internal server error',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n },\n});\n\nexport const getAttachmentMetaRoute = createRoute({\n method: 'get',\n path: '/attachments/{id}/meta',\n tags: ['attachment'],\n security: [{ bearerAuth: [] }],\n summary: 'Get metadata for a single attachment by id',\n request: {\n params: AttachmentIdPathParamsSchema,\n },\n responses: {\n 200: {\n description: 'Attachment metadata (no `inUse` — that flag is page-scoped)',\n content: { 'application/json': { schema: AttachmentMetaSchema } },\n },\n 400: {\n description: 'Invalid attachment id',\n content: { 'application/json': { schema: AttachmentErrorSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 404: {\n description: 'Attachment not found / not granted',\n content: { 'application/json': { schema: AttachmentErrorSchema } },\n },\n 500: {\n description: 'Internal server error',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n },\n});\n\nexport const uploadAttachmentRoute = createRoute({\n method: 'post',\n path: '/attachments/upload',\n tags: ['attachment'],\n security: [{ bearerAuth: [] }],\n summary: 'Upload an attachment from the editor (paste / drag-and-drop)',\n request: {\n body: {\n content: { 'multipart/form-data': { schema: UploadAttachmentBodySchema } },\n },\n },\n responses: {\n 200: {\n description: 'Upload accepted; returns the lean { url, filename, mimeType, sizeBytes } shape the editor splices into the source',\n content: { 'application/json': { schema: UploadAttachmentResponseSchema } },\n },\n 400: {\n description: 'Missing / malformed fields',\n content: { 'application/json': { schema: UploadAttachmentErrorSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 403: {\n description: 'No permission for the target page',\n content: { 'application/json': { schema: UploadAttachmentErrorSchema } },\n },\n 413: {\n description: 'Body exceeds the per-intent size cap',\n content: { 'application/json': { schema: UploadAttachmentErrorSchema } },\n },\n 415: {\n description: 'MIME type not in the per-intent allow-list',\n content: { 'application/json': { schema: UploadAttachmentErrorSchema } },\n },\n 429: {\n description: 'Per-user rate limit exceeded',\n content: { 'application/json': { schema: UploadAttachmentErrorSchema } },\n },\n 500: {\n description: 'Internal server error',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n },\n});\n\nexport const removeAttachmentRoute = createRoute({\n method: 'delete',\n path: '/attachments/{id}',\n tags: ['attachment'],\n security: [{ bearerAuth: [] }],\n summary: 'Remove an attachment',\n request: {\n params: AttachmentIdPathParamsSchema,\n },\n responses: {\n 200: {\n description: 'Attachment removed',\n content: { 'application/json': { schema: RemoveAttachmentResponseSchema } },\n },\n 400: {\n description: 'Invalid attachment id',\n content: { 'application/json': { schema: AttachmentErrorSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 403: {\n description: 'Forbidden (kept for legacy parity; current policy only requires view-grant)',\n content: { 'application/json': { schema: AttachmentErrorSchema } },\n },\n 404: {\n description: 'Attachment not found / page not granted',\n content: { 'application/json': { schema: AttachmentErrorSchema } },\n },\n 500: {\n description: 'Internal server error',\n content: { 'application/json': { schema: AttachmentErrorSchema } },\n },\n },\n});\n\nexport const attachmentRoutes = {\n // `/pages/{pageId}/attachments/usage` MUST register before\n // `/pages/{pageId}/attachments` so the literal `/usage` suffix wins;\n // Hono is method+path based but the no-op stub chain mirrored on the\n // client side benefits from the same ordering convention used by\n // revision / notification / page.\n getAttachmentUsageRoute,\n listAttachmentsRoute,\n addAttachmentRoute,\n uploadAttachmentRoute,\n getAttachmentMetaRoute,\n removeAttachmentRoute,\n};\n","import { z } from '@hono/zod-openapi';\nimport { UserPublicSchema } from './userPublic';\n\n/**\n * Attachment as returned by the ts-rest endpoints.\n *\n * - `creator` is populated server-side via `Attachment.getListByPageId`\n * (or after `Attachment.create()` on the add path) so consumers always\n * see the public user shape and never bare ObjectId strings.\n * - `url` is a relative URL (`/api/v2/attachments/:id`) computed by the\n * handler from the document's `fileUrl` virtual. Browsers fetch the\n * stream endpoint via the same origin, so absolute URLs are not needed.\n * - `inUse` (Phase 7) is `true` when the attachment is referenced by the\n * page's latest revision body (a `/api/v2/attachments/<id>` or legacy\n * `/files/<id>` URI). `listAttachments` computes it by scanning the\n * latest revision body once; when the revision is missing or empty it\n * falls back to `true` for every attachment so files are not hidden\n * while the reference state is undetermined. The `addAttachment`\n * (upload) response sets `inUse: false` — a freshly uploaded file is\n * not yet spliced into the body.\n */\nexport const AttachmentSchema = z.object({\n _id: z.string(),\n page: z.string(),\n creator: UserPublicSchema,\n filePath: z.string(),\n fileName: z.string(),\n originalName: z.string(),\n fileFormat: z.string(),\n fileSize: z.number(),\n createdAt: z.string(),\n url: z.string(),\n inUse: z.boolean(),\n});\nexport type Attachment = z.infer<typeof AttachmentSchema>;\n\n/**\n * Attachment metadata as returned by `GET /api/v2/attachments/:id/meta`.\n *\n * Identical to `AttachmentSchema` minus `inUse`: the meta endpoint resolves\n * a bare attachment id (a body reference carries no page context) and\n * `inUse` is a page-scoped derivation computed by scanning a page's latest\n * revision body. `listAttachments` / `getAttachmentUsage` are the right\n * place for that flag; surfacing a meaningless value here would be a lie,\n * so the field is omitted instead.\n */\nexport const AttachmentMetaSchema = AttachmentSchema.omit({ inUse: true });\nexport type AttachmentMeta = z.infer<typeof AttachmentMetaSchema>;\n\n// GET /pages/:pageId/attachments\nexport const ListAttachmentsResponseSchema = z.object({\n attachments: z.array(AttachmentSchema),\n});\nexport type ListAttachmentsResponse = z.infer<typeof ListAttachmentsResponseSchema>;\n\n/**\n * Phase 8 — one past-revision usage entry for an attachment that is NOT\n * referenced by the page's latest revision. `referencingRevisions` lists\n * every past revision whose body embeds the attachment (newest-first);\n * each entry links to the revision view (`/<path>?revision_id=<id>`).\n * An empty `referencingRevisions` array means the attachment is an\n * orphan — referenced by no revision at all.\n */\nexport const PastAttachmentUsageSchema = z.object({\n attachment: AttachmentSchema,\n referencingRevisions: z.array(\n z.object({\n revisionId: z.string(),\n createdAt: z.string(),\n author: UserPublicSchema,\n }),\n ),\n});\nexport type PastAttachmentUsage = z.infer<typeof PastAttachmentUsageSchema>;\n\n/**\n * Phase 8 — `GET /pages/:pageId/attachments/usage`.\n *\n * Splits every attachment on a page into two groups by scanning all of\n * the page's revision bodies for embed URIs:\n * - `latest`: attachments referenced by the page's current (latest)\n * revision body.\n * - `past`: attachments referenced only by past revisions (plus\n * orphans referenced by none), each carrying the revisions that\n * used it so the `/_attachments` page can link back to them.\n *\n * `pagePath` is included so the web client can build the\n * `/<pagePath>?revision_id=<id>` revision links without a second\n * page lookup.\n */\nexport const AttachmentUsageResponseSchema = z.object({\n pagePath: z.string(),\n latest: z.array(AttachmentSchema),\n past: z.array(PastAttachmentUsageSchema),\n});\nexport type AttachmentUsageResponse = z.infer<typeof AttachmentUsageResponseSchema>;\n\n// POST /pages/:pageId/attachments (multipart) → response\nexport const AddAttachmentResponseSchema = z.object({\n attachment: AttachmentSchema,\n url: z.string(),\n});\nexport type AddAttachmentResponse = z.infer<typeof AddAttachmentResponseSchema>;\n\n// DELETE /attachments/:id\nexport const RemoveAttachmentResponseSchema = z.object({\n success: z.literal(true),\n});\nexport type RemoveAttachmentResponse = z.infer<typeof RemoveAttachmentResponseSchema>;\n\n/**\n * Typed error envelope for the attachment endpoints. We do not lift these\n * codes to `common.ts` because they are scoped to a single contract and\n * each carries semantics the standard `ApiErrorSchema` does not capture\n * (e.g. `FORBIDDEN_FOR_DELETE`).\n */\nexport const AttachmentErrorCodeSchema = z.enum([\n 'INVALID_PAGE_ID',\n 'PAGE_NOT_FOUND',\n 'FILE_MISSING',\n 'FILE_TOO_LARGE',\n 'DISALLOWED_MIME',\n 'INVALID_ATTACHMENT_ID',\n 'ATTACHMENT_NOT_FOUND',\n 'FORBIDDEN_FOR_DELETE',\n 'UPLOAD_FAILED',\n 'REMOVE_FAILED',\n]);\n\nexport const AttachmentErrorSchema = z.object({\n error: z.object({\n code: AttachmentErrorCodeSchema,\n message: z.string(),\n }),\n});\nexport type AttachmentError = z.infer<typeof AttachmentErrorSchema>;\n\n/**\n * RFC-0004 Phase 6 — `POST /api/v2/attachments/upload`.\n *\n * The editor's paste / drag-and-drop handlers upload a file directly\n * (multipart) and immediately splice the returned `url` into the\n * Markdown source. Unlike `addAttachment`, this endpoint is keyed by\n * the editor `intent` (`paste` / `dnd`) for telemetry and applies a\n * per-user upload rate limit; it shares the same `FileUploader` storage\n * path. See `docs/rfcs/0004-editor-ux-enhancement.md`\n * §\"Attachment upload endpoint\".\n */\nexport const UploadAttachmentResponseSchema = z.object({\n url: z.string(),\n filename: z.string(),\n mimeType: z.string(),\n sizeBytes: z.number(),\n});\nexport type UploadAttachmentResponse = z.infer<typeof UploadAttachmentResponseSchema>;\n\n/**\n * Error envelope for `POST /api/v2/attachments/upload`. The `error`\n * codes are lowercase + RFC-specified (distinct from the uppercase\n * `AttachmentErrorCodeSchema` used by the list / add / delete endpoints)\n * because the editor maps each code to a specific user-facing toast:\n * - `too_large` — file exceeds the size cap (413).\n * - `disallowed_type`— MIME type not in the allow-list (415).\n * - `rate_limited` — per-user upload budget exhausted (429); a\n * `Retry-After` header carries the cooldown.\n * - `no_permission` — caller cannot write attachments to `pageId` (403).\n * `details` is an open bag for code-specific context (e.g. the\n * offending MIME, the size limit) the client may surface verbatim.\n */\nexport const UploadAttachmentErrorCodeSchema = z.enum(['too_large', 'disallowed_type', 'rate_limited', 'no_permission']);\nexport type UploadAttachmentErrorCode = z.infer<typeof UploadAttachmentErrorCodeSchema>;\n\nexport const UploadAttachmentErrorSchema = z.object({\n error: UploadAttachmentErrorCodeSchema,\n message: z.string(),\n details: z.record(z.string(), z.unknown()).optional(),\n});\nexport type UploadAttachmentError = z.infer<typeof UploadAttachmentErrorSchema>;\n\n/**\n * MIME allow-lists for `POST /api/v2/attachments/upload`, shared by the\n * api handler (authoritative enforcement) and the web editor's paste /\n * drag-and-drop handlers (early client-side rejection). Kept here so the\n * two sides cannot drift — see `docs/rfcs/0004-editor-ux-enhancement.md`\n * §\"Image paste limits\" / §\"D&D limits\".\n *\n * `paste` accepts images only (a clipboard blob is always an image);\n * `dnd` additionally accepts documents + archives.\n */\nexport const IMAGE_UPLOAD_MIME = ['image/png', 'image/jpeg', 'image/gif', 'image/webp', 'image/svg+xml'] as const;\nexport const DND_EXTRA_UPLOAD_MIME = ['application/pdf', 'text/plain', 'text/markdown', 'text/csv', 'application/zip'] as const;\n","/**\n * RFC-0006 Phase 4 Batch 7 — `search` resource ported to\n * `@hono/zod-openapi` route definitions. Single endpoint:\n *\n * GET /search — full-text search over indexed pages\n *\n * Auth + install:\n * - `/search` is a singleton literal path, OUTSIDE the revision-owned\n * `/pages/*` jwtAuth apply. The search handler installs\n * `createJwtAuth(crowi)` on this exact path itself — same single-route\n * install pattern as `autocomplete`'s `/users/autocomplete`.\n * - No rate limit. The legacy `/api/v2/search` had no `withRateLimit`\n * wrapping (search backend latency naturally throttles bursts) and the\n * RFC does not require one for this resource.\n *\n * Service-availability semantics:\n * - `crowi.getSearcher()` returns `null` when no\n * `@crowi/plugin-search-*` is installed in the runner project. The\n * handler returns 503 `SERVICE_UNAVAILABLE` with `feature: 'search'`\n * so clients can branch on the missing-subsystem case (the web app\n * surfaces a \"search is disabled\" panel).\n * - The driver itself runs grant-aware filtering (viewer id / username\n * / isAdmin are forwarded) so unauthorised hits never leak.\n * - `data[].snippet` carries the driver-supplied highlight string\n * verbatim (typically with `<mark>` tokens). The handler does NOT\n * escape it; web clients must sanitise before HTML render.\n *\n * The legacy `GET /_api/search` Express endpoint stays mounted in\n * parallel until Phase 6 cleanup.\n */\nimport { createRoute } from '@hono/zod-openapi';\n\nimport { AuthenticationRequiredErrorSchema, InternalServerErrorSchema, ServiceUnavailableErrorSchema, ValidationErrorSchema } from '../schemas/common';\nimport { SearchPagesRequestSchema, SearchPagesResponseSchema } from '../schemas/search';\n\nexport const searchPagesRoute = createRoute({\n method: 'get',\n path: '/search',\n tags: ['search'],\n security: [{ bearerAuth: [] }],\n summary: 'Full-text search over pages',\n request: {\n query: SearchPagesRequestSchema,\n },\n responses: {\n 200: {\n description: 'Ranked search hits joined with page + bookmark count metadata',\n content: { 'application/json': { schema: SearchPagesResponseSchema } },\n },\n 400: {\n description: 'Validation error (e.g. empty `q`, invalid `type` enum)',\n content: { 'application/json': { schema: ValidationErrorSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 500: {\n description: 'Search driver raised an unexpected error',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n 503: {\n description: 'No search driver registered (install `@crowi/plugin-search-*`)',\n content: { 'application/json': { schema: ServiceUnavailableErrorSchema } },\n },\n },\n});\n\nexport const searchRoutes = {\n searchPagesRoute,\n};\n","import { z } from '@hono/zod-openapi';\nimport { PageSchema } from './page';\n\n/**\n * Page-type filter for search. Mirrors `SearchPageType` in\n * `@crowi/plugin-api` (`portal` / `public` / `user`):\n * - `portal`: directory-style pages (path ends with `/`), excluding `/user/*`\n * - `public`: leaf pages (path does not end with `/`), excluding `/user/*`\n * - `user`: `/user/*` pages\n *\n * Single value only in v0.1; the driver-side `SearchQuery.grants.types` is\n * an array, but the contract receives one value and the handler wraps it\n * as `[type]`. Multiple values may be supported in a future contract version.\n */\nexport const SearchPageTypeSchema = z.enum(['portal', 'public', 'user']);\nexport type SearchPageType = z.infer<typeof SearchPageTypeSchema>;\n\n/**\n * Request schema for `GET /api/v2/search`.\n *\n * - `q` is required and must be non-empty (legacy parity with\n * `controllers/search.ts:!keyword`).\n * - `tree` is an optional path-prefix filter (e.g. `/team/eng/`); the legacy\n * parameter name is preserved.\n * - `type` is an optional page-type filter (single value).\n * - `page` defaults to 1 (1-based), `limit` defaults to 50 and is capped at 100.\n */\nexport const SearchPagesRequestSchema = z.object({\n q: z.string().min(1),\n tree: z.string().optional(),\n type: SearchPageTypeSchema.optional(),\n page: z.coerce.number().int().min(1).default(1),\n limit: z.coerce.number().int().min(1).max(100).default(50),\n});\nexport type SearchPagesRequest = z.infer<typeof SearchPagesRequestSchema>;\n\n/**\n * One hit returned by the search backend, joined with Crowi page data.\n *\n * `snippet` carries the driver-supplied highlight string (typically with\n * `<mark>` tokens around matched terms). The handler does NOT escape it;\n * the web client is responsible for sanitising it (allow-list of tags)\n * before rendering. Driver-specific tag sets stay opaque to the API layer.\n */\nexport const SearchHitSchema = z.object({\n pageId: z.string(),\n path: z.string(),\n score: z.number().optional(),\n snippet: z.string().optional(),\n bookmarkCount: z.number(),\n page: PageSchema,\n});\nexport type SearchHit = z.infer<typeof SearchHitSchema>;\n\n/**\n * Response schema for `GET /api/v2/search`.\n *\n * - `meta.total` is the total number of matches across all pages (driver-reported).\n * - `meta.results` is the count in this response page (= `data.length`).\n * - `meta.took` is optional ms; not all drivers report it (mongo regex omits it).\n */\nexport const SearchPagesResponseSchema = z.object({\n meta: z.object({\n took: z.number().optional(),\n total: z.number(),\n results: z.number(),\n }),\n data: z.array(SearchHitSchema),\n});\nexport type SearchPagesResponse = z.infer<typeof SearchPagesResponseSchema>;\n","/**\n * RFC-0006 Phase 4 Batch 8 — `adminCrypto` resource ported to\n * `@hono/zod-openapi` route definitions. Two endpoints:\n *\n * GET /admin/crypto/status — sensitive Config row status report\n * POST /admin/crypto/reencrypt — re-encrypt every plaintext sensitive\n * Config row with the current key\n *\n * Auth + install:\n * - Both endpoints sit under `/admin/crypto/*` and are admin-only\n * (JWT + `user.admin === true`). The Hono handler installs\n * `createJwtAdminRequired(crowi)` on the two literal paths so any\n * non-admin caller short-circuits with a 403 `AdminRequiredError`\n * envelope before the handler runs. Same install pattern as\n * `search` / `/users/autocomplete` (per-path) but with the\n * admin-required factory (Batch 8 is the first time\n * `jwtAdminRequired` lands on Hono).\n * - Other admin sub-resources (Batch 9: `/admin/app`, `/admin/auth`,\n * `/admin/security` etc.) own their own path prefix and install\n * `createJwtAdminRequired(crowi)` independently — this contract does\n * NOT broaden the apply to `/admin/*`.\n *\n * The `reencryptAll` request body is empty in practice; declared as\n * `z.unknown()` so Express body-parser's `{}`-on-empty-POST hydration\n * validates cleanly (same idiom as `notification.markAllAsRead` /\n * `openNotification`).\n *\n * 503 `EncryptionNotConfiguredError` is returned by `reencryptAll` when\n * `CROWI_ENCRYPTION_KEY` is not set — `getCryptoStatus` reports the same\n * fact via the `encryptionConfigured: false` flag (no 503 there).\n */\nimport { createRoute, z } from '@hono/zod-openapi';\n\nimport { AdminRequiredErrorSchema, AuthenticationRequiredErrorSchema, InternalServerErrorSchema } from '../schemas/common';\nimport { CryptoStatusResponseSchema, EncryptionNotConfiguredErrorSchema, ReencryptResponseSchema } from '../schemas/adminCrypto';\n\nexport const getCryptoStatusRoute = createRoute({\n method: 'get',\n path: '/admin/crypto/status',\n tags: ['adminCrypto'],\n security: [{ bearerAuth: [] }],\n summary: 'Report which sensitive Config values are still plaintext',\n responses: {\n 200: {\n description: 'Per-(ns, key) status for every sensitive Config row',\n content: { 'application/json': { schema: CryptoStatusResponseSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 403: {\n description: 'Admin permission required',\n content: { 'application/json': { schema: AdminRequiredErrorSchema } },\n },\n 500: {\n description: 'Internal server error',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n },\n});\n\nexport const reencryptAllRoute = createRoute({\n method: 'post',\n path: '/admin/crypto/reencrypt',\n tags: ['adminCrypto'],\n security: [{ bearerAuth: [] }],\n summary: 'Re-encrypt every plaintext sensitive Config value with the current key',\n responses: {\n 200: {\n description: 'Migration completed (counts reported)',\n content: { 'application/json': { schema: ReencryptResponseSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 403: {\n description: 'Admin permission required',\n content: { 'application/json': { schema: AdminRequiredErrorSchema } },\n },\n 500: {\n description: 'Internal server error',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n 503: {\n description: 'CROWI_ENCRYPTION_KEY is not configured on the server',\n content: { 'application/json': { schema: EncryptionNotConfiguredErrorSchema } },\n },\n },\n});\n\nexport const adminCryptoRoutes = {\n getCryptoStatusRoute,\n reencryptAllRoute,\n};\n","import { z } from '@hono/zod-openapi';\n\n/**\n * Per-(ns, key) status for a sensitive Config entry.\n *\n * - `present` : whether the row exists in the DB\n * - `encrypted`: when present, whether the stored value is in `enc:v1:` form\n *\n * `(present, encrypted)` of `(true, false)` is exactly the migration target —\n * the value exists but predates encryption.\n */\nexport const SensitiveConfigEntrySchema = z.object({\n ns: z.string(),\n key: z.string(),\n present: z.boolean(),\n encrypted: z.boolean(),\n});\nexport type SensitiveConfigEntry = z.infer<typeof SensitiveConfigEntrySchema>;\n\nexport const CryptoStatusResponseSchema = z.object({\n /** False when CROWI_ENCRYPTION_KEY is not configured — UI shows a setup hint. */\n encryptionConfigured: z.boolean(),\n unencryptedCount: z.number().int().min(0),\n encryptedCount: z.number().int().min(0),\n entries: z.array(SensitiveConfigEntrySchema),\n});\nexport type CryptoStatusResponse = z.infer<typeof CryptoStatusResponseSchema>;\n\nexport const ReencryptResponseSchema = z.object({\n rewritten: z.number().int().min(0),\n /** Already encrypted, skipped on this run. */\n alreadyEncrypted: z.number().int().min(0),\n /** Sensitive registry entries that had no row in the DB at all. */\n missing: z.number().int().min(0),\n});\nexport type ReencryptResponse = z.infer<typeof ReencryptResponseSchema>;\n\nexport const EncryptionNotConfiguredErrorSchema = z.object({\n error: z.object({\n code: z.literal('ENCRYPTION_NOT_CONFIGURED'),\n message: z.string(),\n }),\n});\nexport type EncryptionNotConfiguredError = z.infer<typeof EncryptionNotConfiguredErrorSchema>;\n","/**\n * RFC-0006 Phase 4 Batch 9 — `admin.app` sub-contract ported to\n * `@hono/zod-openapi` route definitions.\n *\n * GET /admin/app — read the current `app:*` slice (plus derived fields)\n * PUT /admin/app — partial update of the `app:*` slice\n *\n * Auth + install:\n * - Both endpoints sit under `/admin/app` and are admin-only. The\n * handler installs `createJwtAdminRequired(crowi)` on the path itself\n * (broad apply with `/admin/app/*` covers any future nested route\n * and a literal `/admin/app` apply covers the bare path).\n *\n * Validation envelope:\n * - The PUT route emits the custom `AppSettingsValidationErrorSchema`\n * `{ bodyResult: { issues, name } }` shape on body validation\n * failure instead of the global `ValidationErrorSchema`. The route\n * declares an inline `hook` that overrides the OpenAPIHono\n * `defaultHook` for this single route (RFC open question 5).\n */\nimport { createRoute } from '@hono/zod-openapi';\nimport type { Context } from 'hono';\nimport type { ZodError } from 'zod';\n\nimport {\n AppSettingsValidationErrorSchema,\n GetAppSettingsResponseSchema,\n UpdateAppSettingsRequestSchema,\n UpdateAppSettingsResponseSchema,\n} from '../../schemas/admin/app';\nimport { AdminRequiredErrorSchema, AuthenticationRequiredErrorSchema } from '../../schemas/common';\n\n/**\n * Per-route validation hook: emit the `AppSettingsValidationErrorSchema`\n * `{ bodyResult: { issues, name } }` envelope on body parse failure\n * (legacy wire-shape preserved).\n */\nconst appSettingsValidationHook = (result: { success: boolean; error?: ZodError }, c: Context): Response | undefined => {\n if (result.success) return;\n const issues = (result.error?.issues ?? []).map((i) => ({\n path: i.path.map((p): string | number => (typeof p === 'symbol' ? String(p) : p)),\n message: i.message,\n }));\n return c.json(\n {\n bodyResult: {\n issues,\n name: 'ZodError',\n },\n },\n 400,\n );\n};\n\nexport const getAppSettingsRoute = createRoute({\n method: 'get',\n path: '/admin/app',\n tags: ['admin.app'],\n security: [{ bearerAuth: [] }],\n summary: 'Read the current App settings (incl. AWS upload section)',\n responses: {\n 200: {\n description: 'Current `app:*` slice plus derived read-only fields',\n content: { 'application/json': { schema: GetAppSettingsResponseSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 403: {\n description: 'Admin permission required',\n content: { 'application/json': { schema: AdminRequiredErrorSchema } },\n },\n },\n});\n\nexport const updateAppSettingsRoute = createRoute({\n method: 'put',\n path: '/admin/app',\n tags: ['admin.app'],\n security: [{ bearerAuth: [] }],\n summary: 'Update App settings — partial updates per section',\n hook: appSettingsValidationHook,\n request: {\n body: {\n content: { 'application/json': { schema: UpdateAppSettingsRequestSchema } },\n },\n },\n responses: {\n 200: {\n description: 'Update succeeded',\n content: { 'application/json': { schema: UpdateAppSettingsResponseSchema } },\n },\n 400: {\n description: 'Body validation failed (legacy `{ bodyResult }` envelope)',\n content: { 'application/json': { schema: AppSettingsValidationErrorSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 403: {\n description: 'Admin permission required',\n content: { 'application/json': { schema: AdminRequiredErrorSchema } },\n },\n },\n});\n\nexport const adminAppRoutes = {\n getAppSettingsRoute,\n updateAppSettingsRoute,\n};\n\n// Re-export types so existing consumers keep compiling.\nexport type {\n AppSettingsValidationError,\n GetAppSettingsResponse,\n UpdateAppSettingsRequest,\n UpdateAppSettingsResponse,\n} from '../../schemas/admin/app';\n","import { z } from '@hono/zod-openapi';\n\n/**\n * GET response: the current `app:*` config slice (plus a few read-only\n * derived values used by the admin App page header).\n *\n * AWS S3 credentials used to live here under an `upload.aws` block.\n * Storage credentials are now managed exclusively through the per-plugin\n * settings page (`/admin/plugins?name=@crowi/plugin-aws`); the App\n * settings endpoint no longer surfaces them. Boot-time migration copies\n * the legacy `upload:aws:*` keys into the new `plugin:@crowi/plugin-aws:*`\n * namespace — see `packages/api/src/util/aws-config-migration.ts`.\n */\nexport const GetAppSettingsResponseSchema = z.object({\n app: z.object({\n title: z.string(),\n confidential: z.string(),\n }),\n /**\n * Whether a storage driver is registered (i.e. uploads are wired up).\n * Sourced from `Config.isUploadable()` which now consults PluginManager.\n */\n isUploadable: z.boolean(),\n /**\n * The Open / Restricted / Closed → open / restricted / closed mapping the\n * legacy admin controller exposed. Useful for the UI to render the current\n * registration mode label without knowing the internal capitalisation.\n */\n registrationMode: z.record(z.string(), z.string()),\n /**\n * Whether the admin has dismissed the initial-setup checklist on the\n * dashboard. Persisted server-side (`app:setupChecklistDismissed`) so the\n * dismissal holds across browsers and devices, not just one localStorage.\n */\n setupChecklistDismissed: z.boolean(),\n});\nexport type GetAppSettingsResponse = z.infer<typeof GetAppSettingsResponseSchema>;\n\n/**\n * PUT request body. All fields are optional so partial updates are supported,\n * but when present they must satisfy the per-field validation. The `app`\n * section itself is also optional.\n *\n * Strict on the top-level so unknown keys (e.g. a stray `upload` from a\n * stale client) are rejected with a per-field 400 — this is the contract's\n * way of advertising that storage credentials moved to the plugin settings\n * page.\n */\nexport const UpdateAppSettingsRequestSchema = z\n .object({\n app: z\n .object({\n title: z.string().trim().min(1).max(100).optional(),\n confidential: z.string().max(500).optional(),\n })\n .optional(),\n /**\n * Toggle the dashboard initial-setup checklist's dismissed state. Sent on\n * its own (without the `app` block) when the admin clicks \"mark as done\".\n */\n setupChecklistDismissed: z.boolean().optional(),\n })\n .strict();\nexport type UpdateAppSettingsRequest = z.infer<typeof UpdateAppSettingsRequestSchema>;\n\nexport const UpdateAppSettingsResponseSchema = z.object({\n ok: z.literal(true),\n});\nexport type UpdateAppSettingsResponse = z.infer<typeof UpdateAppSettingsResponseSchema>;\n\n/**\n * Surfaced when the body fails Zod validation. ts-rest emits this shape on\n * `body` parse failure with a 400 status; the UI uses it to map per-field\n * messages back onto the form.\n */\nexport const AppSettingsValidationErrorSchema = z.object({\n bodyResult: z.object({\n issues: z.array(\n z.object({\n path: z.array(z.union([z.string(), z.number()])),\n message: z.string(),\n }),\n ),\n name: z.string().optional(),\n }),\n});\nexport type AppSettingsValidationError = z.infer<typeof AppSettingsValidationErrorSchema>;\n","/**\n * RFC-0006 Phase 4 Batch 9 — `admin.auth` sub-contract ported to\n * `@hono/zod-openapi` route definitions.\n *\n * GET /admin/auth — read the two inert `auth:*` settings\n * PUT /admin/auth — persist them (both toggles are always rejected)\n *\n * Auth + install:\n * - The handler installs `createJwtAdminRequired(crowi)` broadly on\n * `/admin/auth/*` plus the bare `/admin/auth` path.\n *\n * 400 wire shape:\n * - Third-party sign-in was removed from core in the 2.0.0-alpha line, so\n * enabling either `requireThirdPartyAuth` or `disablePasswordAuth` is hard-\n * rejected with a 400 `THIRD_PARTY_AUTH_UNAVAILABLE` envelope. The toggles\n * and config keys are kept (inert) for a future auth provider plugin.\n */\nimport { createRoute } from '@hono/zod-openapi';\n\nimport {\n GetAuthSettingsResponseSchema,\n ThirdPartyAuthUnavailableErrorSchema,\n UpdateAuthSettingsRequestSchema,\n UpdateAuthSettingsResponseSchema,\n} from '../../schemas/admin/auth';\nimport { AdminRequiredErrorSchema, AuthenticationRequiredErrorSchema, InternalServerErrorSchema } from '../../schemas/common';\n\nexport const getAuthSettingsRoute = createRoute({\n method: 'get',\n path: '/admin/auth',\n tags: ['admin.auth'],\n security: [{ bearerAuth: [] }],\n summary: 'Get the current auth:* settings',\n responses: {\n 200: {\n description: 'Current authentication settings',\n content: { 'application/json': { schema: GetAuthSettingsResponseSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 403: {\n description: 'Admin permission required',\n content: { 'application/json': { schema: AdminRequiredErrorSchema } },\n },\n 500: {\n description: 'Internal server error',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n },\n});\n\nexport const updateAuthSettingsRoute = createRoute({\n method: 'put',\n path: '/admin/auth',\n tags: ['admin.auth'],\n security: [{ bearerAuth: [] }],\n summary: 'Update auth:* settings (requireThirdPartyAuth / disablePasswordAuth)',\n request: {\n body: {\n content: { 'application/json': { schema: UpdateAuthSettingsRequestSchema } },\n },\n },\n responses: {\n 200: {\n description: 'Updated settings (re-read from in-memory cache)',\n content: { 'application/json': { schema: UpdateAuthSettingsResponseSchema } },\n },\n 400: {\n description:\n 'Enabling a third-party-dependent setting (requireThirdPartyAuth / disablePasswordAuth) is rejected because third-party sign-in was removed from core',\n content: { 'application/json': { schema: ThirdPartyAuthUnavailableErrorSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 403: {\n description: 'Admin permission required',\n content: { 'application/json': { schema: AdminRequiredErrorSchema } },\n },\n 500: {\n description: 'Internal server error',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n },\n});\n\nexport const adminAuthRoutes = {\n getAuthSettingsRoute,\n updateAuthSettingsRoute,\n};\n\nexport type {\n AuthSettings,\n GetAuthSettingsResponse,\n ThirdPartyAuthUnavailableError,\n UpdateAuthSettingsRequest,\n UpdateAuthSettingsResponse,\n} from '../../schemas/admin/auth';\n","import { z } from '@hono/zod-openapi';\n\n/**\n * Canonical shape of the authentication settings on the wire.\n *\n * Mirrors the two `auth:*` keys in the legacy `crowi` config namespace:\n * - auth:requireThirdPartyAuth -> requireThirdPartyAuth\n * - auth:disablePasswordAuth -> disablePasswordAuth\n *\n * Both are simple booleans. The legacy form (`form/admin/auth.ts`) used\n * express-form `.toBoolean()` to coerce 'on' / 'true' style values; the new\n * API consumes JSON so callers must send proper booleans (z.boolean()).\n */\nexport const AuthSettingsSchema = z.object({\n requireThirdPartyAuth: z.boolean(),\n disablePasswordAuth: z.boolean(),\n});\nexport type AuthSettings = z.infer<typeof AuthSettingsSchema>;\n\n/**\n * Request body for PUT /admin/auth.\n *\n * Strict booleans only — UIs that drive the toggles from a checkbox should\n * send `e.target.checked` directly. The server hard-rejects enabling either\n * toggle (see ThirdPartyAuthUnavailableErrorSchema) but the wire shape itself\n * is identical to the GET response.\n */\nexport const UpdateAuthSettingsRequestSchema = AuthSettingsSchema;\nexport type UpdateAuthSettingsRequest = z.infer<typeof UpdateAuthSettingsRequestSchema>;\n\n/**\n * Response shape for both GET /admin/auth and PUT /admin/auth.\n *\n * PUT returns the post-update settings (rather than `{ ok: true }`) so the UI\n * can avoid an extra round-trip after saving — matches the admin/security\n * contract.\n */\nexport const GetAuthSettingsResponseSchema = AuthSettingsSchema;\nexport type GetAuthSettingsResponse = z.infer<typeof GetAuthSettingsResponseSchema>;\n\nexport const UpdateAuthSettingsResponseSchema = AuthSettingsSchema;\nexport type UpdateAuthSettingsResponse = z.infer<typeof UpdateAuthSettingsResponseSchema>;\n\n/**\n * Returned (400) when the request tries to enable `requireThirdPartyAuth` or\n * `disablePasswordAuth`.\n *\n * Both settings depend on third-party (Google / GitHub) sign-in, which was\n * removed from core in the 2.0.0-alpha line — `User.hasValidThirdPartyId()` is\n * now permanently false, so enabling either would lock every account out of\n * password login with no third-party path to recover. The config keys and\n * schema are retained (inert) for a future auth plugin, but the endpoint hard-\n * rejects turning them on. The admin UI hides the toggles, so this guards the\n * API against direct callers.\n */\nexport const ThirdPartyAuthUnavailableErrorSchema = z.object({\n error: z.object({\n code: z.literal('THIRD_PARTY_AUTH_UNAVAILABLE'),\n message: z.string(),\n }),\n});\nexport type ThirdPartyAuthUnavailableError = z.infer<typeof ThirdPartyAuthUnavailableErrorSchema>;\n","/**\n * RFC-0006 Phase 4 Batch 9 — `admin.mail` sub-contract ported to\n * `@hono/zod-openapi` route definitions.\n *\n * GET /admin/mail — read the current SMTP + AWS SES settings\n * PUT /admin/mail — partial-update (secret masking on input)\n * POST /admin/mail/test — send a test mail to the calling admin\n *\n * Auth + install:\n * - The handler installs `createJwtAdminRequired(crowi)` broadly on\n * `/admin/mail/*` plus the bare `/admin/mail` path.\n *\n * Validation envelope:\n * - Both PUT and POST routes emit the custom\n * `MailSettingsValidationErrorSchema` `{ bodyResult }` shape on body\n * validation failure (legacy parity — same idiom as admin.app).\n */\nimport { createRoute } from '@hono/zod-openapi';\nimport type { Context } from 'hono';\nimport type { ZodError } from 'zod';\n\nimport {\n GetMailSettingsResponseSchema,\n MailSettingsValidationErrorSchema,\n SendTestMailErrorSchema,\n SendTestMailRequestSchema,\n SendTestMailResponseSchema,\n UpdateMailSettingsRequestSchema,\n UpdateMailSettingsResponseSchema,\n} from '../../schemas/admin/mail';\nimport { AdminRequiredErrorSchema, AuthenticationRequiredErrorSchema } from '../../schemas/common';\n\nconst mailSettingsValidationHook = (result: { success: boolean; error?: ZodError }, c: Context): Response | undefined => {\n if (result.success) return;\n const issues = (result.error?.issues ?? []).map((i) => ({\n path: i.path.map((p): string | number => (typeof p === 'symbol' ? String(p) : p)),\n message: i.message,\n }));\n return c.json(\n {\n bodyResult: {\n issues,\n name: 'ZodError',\n },\n },\n 400,\n );\n};\n\nexport const getMailSettingsRoute = createRoute({\n method: 'get',\n path: '/admin/mail',\n tags: ['admin.mail'],\n security: [{ bearerAuth: [] }],\n summary: 'Read the sender-independent mail settings (from + active sender driver)',\n responses: {\n 200: {\n description: 'Current mail settings',\n content: { 'application/json': { schema: GetMailSettingsResponseSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 403: {\n description: 'Admin permission required',\n content: { 'application/json': { schema: AdminRequiredErrorSchema } },\n },\n },\n});\n\nexport const updateMailSettingsRoute = createRoute({\n method: 'put',\n path: '/admin/mail',\n tags: ['admin.mail'],\n security: [{ bearerAuth: [] }],\n summary: 'Update the sender-independent mail settings (from address)',\n hook: mailSettingsValidationHook,\n request: {\n body: {\n content: { 'application/json': { schema: UpdateMailSettingsRequestSchema } },\n },\n },\n responses: {\n 200: {\n description: 'Update succeeded',\n content: { 'application/json': { schema: UpdateMailSettingsResponseSchema } },\n },\n 400: {\n description: 'Body validation failed (legacy `{ bodyResult }` envelope)',\n content: { 'application/json': { schema: MailSettingsValidationErrorSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 403: {\n description: 'Admin permission required',\n content: { 'application/json': { schema: AdminRequiredErrorSchema } },\n },\n },\n});\n\nexport const sendTestMailRoute = createRoute({\n method: 'post',\n path: '/admin/mail/test',\n tags: ['admin.mail'],\n security: [{ bearerAuth: [] }],\n summary: 'Send a test mail to the calling admin (req.user.email) via the active sender',\n hook: mailSettingsValidationHook,\n request: {\n body: {\n content: { 'application/json': { schema: SendTestMailRequestSchema } },\n },\n },\n responses: {\n 200: {\n description: 'Test mail sent successfully',\n content: { 'application/json': { schema: SendTestMailResponseSchema } },\n },\n 400: {\n description: 'Body validation failed',\n content: { 'application/json': { schema: MailSettingsValidationErrorSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 403: {\n description: 'Admin permission required',\n content: { 'application/json': { schema: AdminRequiredErrorSchema } },\n },\n 502: {\n description: 'Test mail dispatch failed (SMTP error)',\n content: { 'application/json': { schema: SendTestMailErrorSchema } },\n },\n },\n});\n\nexport const adminMailRoutes = {\n getMailSettingsRoute,\n updateMailSettingsRoute,\n sendTestMailRoute,\n};\n\nexport type {\n GetMailSettingsResponse,\n MailSettingsValidationError,\n SendTestMailError,\n SendTestMailRequest,\n SendTestMailResponse,\n UpdateMailSettingsRequest,\n UpdateMailSettingsResponse,\n} from '../../schemas/admin/mail';\n","import { z } from '@hono/zod-openapi';\n\n/**\n * GET response: the sender-independent mail settings.\n *\n * Only `from` lives in core config now; each sender's transport\n * credentials (SMTP host/auth, Resend API key, SES via @crowi/plugin-aws)\n * are edited under `/admin/plugins`. `activeDriver` is the registered\n * name of the currently-active mail sender (e.g. `'smtp'`), shown\n * read-only so the operator knows which plugin's settings to edit.\n */\nexport const GetMailSettingsResponseSchema = z.object({\n from: z.string(),\n activeDriver: z.string(),\n /** npm name of the plugin that registered the active driver, for\n * linking to its config page. Empty when no sender is active. */\n activePlugin: z.string(),\n});\nexport type GetMailSettingsResponse = z.infer<typeof GetMailSettingsResponseSchema>;\n\n/**\n * PUT request body. `from` is the only editable core mail setting; it is\n * optional so an empty PUT is a no-op.\n */\nexport const UpdateMailSettingsRequestSchema = z.object({\n from: z.string().trim().max(254).optional(),\n});\nexport type UpdateMailSettingsRequest = z.infer<typeof UpdateMailSettingsRequestSchema>;\n\nexport const UpdateMailSettingsResponseSchema = z.object({\n ok: z.literal(true),\n});\nexport type UpdateMailSettingsResponse = z.infer<typeof UpdateMailSettingsResponseSchema>;\n\n/**\n * POST /admin/mail/test request body. No fields — the test mail is sent\n * to the calling admin through the currently-active sender, so there is\n * nothing to override. Kept as an (optional, empty) object so the route\n * still declares a JSON body.\n */\nexport const SendTestMailRequestSchema = z.object({}).optional();\nexport type SendTestMailRequest = z.infer<typeof SendTestMailRequestSchema>;\n\nexport const SendTestMailResponseSchema = z.object({\n ok: z.literal(true),\n /** Address the test mail was dispatched to (= the calling admin's email). */\n to: z.string(),\n});\nexport type SendTestMailResponse = z.infer<typeof SendTestMailResponseSchema>;\n\nexport const SendTestMailErrorSchema = z.object({\n error: z.object({\n code: z.literal('MAIL_TEST_FAILED'),\n message: z.string(),\n }),\n});\nexport type SendTestMailError = z.infer<typeof SendTestMailErrorSchema>;\n\n/**\n * Surfaced when the body fails Zod validation.\n */\nexport const MailSettingsValidationErrorSchema = z.object({\n bodyResult: z.object({\n issues: z.array(\n z.object({\n path: z.array(z.union([z.string(), z.number()])),\n message: z.string(),\n }),\n ),\n name: z.string().optional(),\n }),\n});\nexport type MailSettingsValidationError = z.infer<typeof MailSettingsValidationErrorSchema>;\n","/**\n * RFC-0006 Phase 4 Batch 9 — `admin.plugins` sub-contract ported to\n * `@hono/zod-openapi` route definitions.\n *\n * 5 endpoints:\n * GET /admin/plugins (listPlugins)\n * GET /admin/plugins/config?name=… (getPluginConfig)\n * PUT /admin/plugins/config?name=… (updatePluginConfig)\n * POST /admin/plugins/render-cache/clear-all (clearRenderCacheAll)\n * POST /admin/plugins/render-cache/clear-plugin?name=… (clearRenderCachePlugin)\n *\n * Auth + install:\n * - The handler installs `createJwtAdminRequired(crowi)` broadly on\n * `/admin/plugins/*` plus the bare `/admin/plugins` path.\n *\n * Plugin npm names contain a `/` (e.g. `@crowi/plugin-storage-local`)\n * which collides with the Hono router's path-segment matching, so the\n * name is passed as a query string rather than a path parameter.\n */\nimport { createRoute, z } from '@hono/zod-openapi';\n\nimport {\n ClearRenderCacheResponseSchema,\n ListPluginsResponseSchema,\n PluginConfigResponseSchema,\n PluginConfigValidationErrorSchema,\n PluginNotFoundErrorSchema,\n UpdatePluginConfigRequestSchema,\n UpdatePluginConfigResponseSchema,\n} from '../../schemas/admin/plugins';\nimport { AdminRequiredErrorSchema, AuthenticationRequiredErrorSchema, InternalServerErrorSchema } from '../../schemas/common';\n\nconst PluginNameQuerySchema = z.object({ name: z.string() });\n// getPluginConfig also accepts an optional `locale` so the API can overlay\n// the plugin's `configI18n[locale]` field label/description translations.\nconst PluginConfigQuerySchema = z.object({ name: z.string(), locale: z.string().optional() });\n\nexport const listPluginsRoute = createRoute({\n method: 'get',\n path: '/admin/plugins',\n tags: ['admin.plugins'],\n security: [{ bearerAuth: [] }],\n summary: 'List every plugin currently loaded',\n responses: {\n 200: {\n description: 'Plugin list with declared registry slots',\n content: { 'application/json': { schema: ListPluginsResponseSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 403: {\n description: 'Admin permission required',\n content: { 'application/json': { schema: AdminRequiredErrorSchema } },\n },\n 500: {\n description: 'Internal server error',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n },\n});\n\nexport const getPluginConfigRoute = createRoute({\n method: 'get',\n path: '/admin/plugins/config',\n tags: ['admin.plugins'],\n security: [{ bearerAuth: [] }],\n summary: 'Get a plugin config form schema + current values',\n request: {\n query: PluginConfigQuerySchema,\n },\n responses: {\n 200: {\n description: 'Plugin config + values (secrets masked)',\n content: { 'application/json': { schema: PluginConfigResponseSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 403: {\n description: 'Admin permission required',\n content: { 'application/json': { schema: AdminRequiredErrorSchema } },\n },\n 404: {\n description: 'Plugin not loaded',\n content: { 'application/json': { schema: PluginNotFoundErrorSchema } },\n },\n 500: {\n description: 'Internal server error',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n },\n});\n\nexport const updatePluginConfigRoute = createRoute({\n method: 'put',\n path: '/admin/plugins/config',\n tags: ['admin.plugins'],\n security: [{ bearerAuth: [] }],\n summary: 'Update a plugin config (per-field validation via plugin Zod schema)',\n request: {\n query: PluginNameQuerySchema,\n body: {\n content: { 'application/json': { schema: UpdatePluginConfigRequestSchema } },\n },\n },\n responses: {\n 200: {\n description: 'Save succeeded; hotReloaded flag indicates live apply',\n content: { 'application/json': { schema: UpdatePluginConfigResponseSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 403: {\n description: 'Admin permission required',\n content: { 'application/json': { schema: AdminRequiredErrorSchema } },\n },\n 404: {\n description: 'Plugin not loaded',\n content: { 'application/json': { schema: PluginNotFoundErrorSchema } },\n },\n 422: {\n description: 'Plugin config failed plugin-defined validation',\n content: { 'application/json': { schema: PluginConfigValidationErrorSchema } },\n },\n 500: {\n description: 'Internal server error',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n },\n});\n\nconst ClearRenderCacheBodySchema = z.object({}).optional();\n\nexport const clearRenderCacheAllRoute = createRoute({\n method: 'post',\n path: '/admin/plugins/render-cache/clear-all',\n tags: ['admin.plugins'],\n security: [{ bearerAuth: [] }],\n summary: 'Clear every renderer plugin cache entry',\n request: {\n body: {\n content: { 'application/json': { schema: ClearRenderCacheBodySchema } },\n },\n },\n responses: {\n 200: {\n description: 'Cleared (count reported)',\n content: { 'application/json': { schema: ClearRenderCacheResponseSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 403: {\n description: 'Admin permission required',\n content: { 'application/json': { schema: AdminRequiredErrorSchema } },\n },\n 500: {\n description: 'Internal server error',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n },\n});\n\nexport const clearRenderCachePluginRoute = createRoute({\n method: 'post',\n path: '/admin/plugins/render-cache/clear-plugin',\n tags: ['admin.plugins'],\n security: [{ bearerAuth: [] }],\n summary: 'Clear renderer plugin cache entries scoped to a single plugin',\n request: {\n query: PluginNameQuerySchema,\n body: {\n content: { 'application/json': { schema: ClearRenderCacheBodySchema } },\n },\n },\n responses: {\n 200: {\n description: 'Cleared (count reported)',\n content: { 'application/json': { schema: ClearRenderCacheResponseSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 403: {\n description: 'Admin permission required',\n content: { 'application/json': { schema: AdminRequiredErrorSchema } },\n },\n 404: {\n description: 'Plugin not loaded',\n content: { 'application/json': { schema: PluginNotFoundErrorSchema } },\n },\n 500: {\n description: 'Internal server error',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n },\n});\n\nexport const adminPluginsRoutes = {\n listPluginsRoute,\n getPluginConfigRoute,\n updatePluginConfigRoute,\n clearRenderCacheAllRoute,\n clearRenderCachePluginRoute,\n};\n\nexport type {\n ClearRenderCacheResponse,\n ListPluginsResponse,\n PluginAdminPlacement,\n PluginConfigResponse,\n PluginConfigValidationError,\n PluginField,\n PluginInfo,\n PluginNotFoundError,\n UpdatePluginConfigRequest,\n UpdatePluginConfigResponse,\n} from '../../schemas/admin/plugins';\n","import { z } from '@hono/zod-openapi';\n\n/**\n * Wire-shape of a single plugin config field. Mirrors the runtime\n * `SerializedPluginField` produced by `schema-serializer.ts`. The\n * admin form picks an input control based on `kind`.\n */\nexport const PluginFieldSchema = z.object({\n name: z.string(),\n /**\n * Localized display label. Falls back to `name` in the form when absent.\n * Filled from the plugin's `configI18n[locale]` overlay by the admin API.\n */\n label: z.string().optional(),\n kind: z.enum(['string', 'secret', 'number', 'boolean', 'enum', 'string-array']),\n description: z.string().optional(),\n defaultValue: z.unknown().optional(),\n options: z.array(z.string()).optional(),\n action: z\n .object({\n label: z.string(),\n method: z.string(),\n path: z.string(),\n })\n .optional(),\n optional: z.boolean(),\n});\nexport type PluginField = z.infer<typeof PluginFieldSchema>;\n\nexport const AdminSidebarSection = z.enum(['settings', 'shared', 'storage', 'mail', 'notification', 'auth', 'search', 'renderer']);\nexport type AdminSidebarSectionValue = z.infer<typeof AdminSidebarSection>;\n\nexport const PluginAdminPlacementSchema = z.object({\n /**\n * Sidebar section to surface this plugin under. The runtime fills\n * this in — it's either declared by the plugin via `adminPlacement`\n * or derived from its `register*` hooks. Plugins that fall through\n * with no inferable section default to `'settings'`.\n */\n section: AdminSidebarSection,\n /** Display label (defaults to the plugin's npm name). */\n label: z.string(),\n /** Lucide icon name from a fixed allow-list. */\n icon: z.string().optional(),\n});\nexport type PluginAdminPlacement = z.infer<typeof PluginAdminPlacementSchema>;\n\nexport const PluginInfoSchema = z.object({\n name: z.string(),\n version: z.string(),\n requires: z.array(z.string()).optional(),\n /** Has a configSchema (= showable config form). */\n hasConfig: z.boolean(),\n /**\n * Driver-registry slots this plugin currently fills. Useful for the\n * admin \"this plugin is the active storage driver\" badge.\n */\n registers: z.array(z.string()),\n /**\n * Where the plugin appears in the admin sidebar. The server always\n * populates this even when the plugin didn't declare its own\n * `adminPlacement`.\n */\n adminPlacement: PluginAdminPlacementSchema,\n /**\n * Whether this plugin (or — transitively — any plugin that requires\n * it) implements the `reconfigure` SDK hook. Plugins without it\n * still apply their config on the next server restart; plugins with\n * it apply config changes live.\n */\n supportsHotReload: z.boolean(),\n});\nexport type PluginInfo = z.infer<typeof PluginInfoSchema>;\n\nexport const ListPluginsResponseSchema = z.object({\n plugins: z.array(PluginInfoSchema),\n});\nexport type ListPluginsResponse = z.infer<typeof ListPluginsResponseSchema>;\n\n/**\n * Per-plugin config + form schema. Sensitive fields appear in\n * `values` as `{ hasValue: boolean }` — the plaintext is never\n * echoed back from the server.\n */\nexport const PluginConfigResponseSchema = z.object({\n name: z.string(),\n fields: z.array(PluginFieldSchema),\n values: z.record(z.string(), z.unknown()),\n});\nexport type PluginConfigResponse = z.infer<typeof PluginConfigResponseSchema>;\n\n/**\n * Body for PUT plugin config. Each key in `values` must exist in the\n * plugin's schema; unknown keys are rejected. For sensitive fields:\n * - undefined / missing → leave existing value untouched\n * - empty string → clear the saved value\n * - non-empty string → replace and re-encrypt\n */\nexport const UpdatePluginConfigRequestSchema = z.object({\n values: z.record(z.string(), z.unknown()),\n});\nexport type UpdatePluginConfigRequest = z.infer<typeof UpdatePluginConfigRequestSchema>;\n\nexport const UpdatePluginConfigResponseSchema = z.object({\n ok: z.literal(true),\n /**\n * Whether at least one plugin's `reconfigure` hook ran successfully\n * for this save. `true` means the new values are already live on\n * this instance (and propagated via Redis pub/sub to peers); `false`\n * means a server restart is required to apply the change. False\n * also when reconfigure threw — admin UI surfaces a separate\n * \"saved, but apply failed\" warning in that case via the response\n * `reconfigureFailed` flag.\n */\n hotReloaded: z.boolean(),\n /**\n * True when at least one plugin's `reconfigure` was attempted and\n * threw. The save itself succeeded (Mongo + cache are updated) so\n * the next process boot will see the new values, but the *running*\n * process couldn't apply them. UI surfaces a warning toast.\n */\n reconfigureFailed: z.boolean(),\n});\nexport type UpdatePluginConfigResponse = z.infer<typeof UpdatePluginConfigResponseSchema>;\n\nexport const PluginNotFoundErrorSchema = z.object({\n error: z.object({\n code: z.literal('PLUGIN_NOT_FOUND'),\n message: z.string(),\n }),\n});\nexport type PluginNotFoundError = z.infer<typeof PluginNotFoundErrorSchema>;\n\nexport const PluginConfigValidationErrorSchema = z.object({\n error: z.object({\n code: z.literal('PLUGIN_CONFIG_VALIDATION_FAILED'),\n message: z.string(),\n issues: z.array(\n z.object({\n path: z.array(z.union([z.string(), z.number()])),\n message: z.string(),\n }),\n ),\n }),\n});\nexport type PluginConfigValidationError = z.infer<typeof PluginConfigValidationErrorSchema>;\n\n/**\n * Response shape for the Phase 4 \"clear render cache\" endpoints. The\n * count is best-effort (mongo `deleteMany.deletedCount`) — admin UI\n * surfaces it for confidence but the toast is success/fail-only.\n */\nexport const ClearRenderCacheResponseSchema = z.object({\n ok: z.literal(true),\n clearedAt: z.string(),\n /** Number of cache rows removed. */\n removedCount: z.number().int().min(0),\n});\nexport type ClearRenderCacheResponse = z.infer<typeof ClearRenderCacheResponseSchema>;\n","/**\n * RFC-0006 Phase 4 Batch 9 — `admin.search` sub-contract ported to\n * `@hono/zod-openapi` route definitions.\n *\n * GET /admin/search — read-only: active search driver + installed list\n *\n * Auth + install:\n * - The handler installs `createJwtAdminRequired(crowi)` broadly on\n * `/admin/search/*` plus the bare `/admin/search` path.\n *\n * Note: This is the admin status endpoint. The user-facing `/search`\n * endpoint (Batch 7) is unrelated — it sits under `/search` (no `/admin`\n * prefix) and is handled by `hono/handlers/search.ts`.\n */\nimport { createRoute } from '@hono/zod-openapi';\n\nimport { GetSearchStatusResponseSchema } from '../../schemas/admin/search';\nimport { AdminRequiredErrorSchema, AuthenticationRequiredErrorSchema, InternalServerErrorSchema } from '../../schemas/common';\n\nexport const getSearchStatusRoute = createRoute({\n method: 'get',\n path: '/admin/search',\n tags: ['admin.search'],\n security: [{ bearerAuth: [] }],\n summary: 'Get the active search driver and the list of installed drivers',\n responses: {\n 200: {\n description: 'Active driver pointer + every registered driver',\n content: { 'application/json': { schema: GetSearchStatusResponseSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 403: {\n description: 'Admin permission required',\n content: { 'application/json': { schema: AdminRequiredErrorSchema } },\n },\n 500: {\n description: 'Internal server error',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n },\n});\n\nexport const adminSearchRoutes = {\n getSearchStatusRoute,\n};\n\nexport type {\n ActiveSearchDriver,\n GetSearchStatusResponse,\n SearchDriverEntry,\n} from '../../schemas/admin/search';\n","import { z } from '@hono/zod-openapi';\n\n/**\n * One row in the \"installed search drivers\" list. A driver is registered\n * by exactly one plugin (`pluginName`) under a stable `driverName`\n * (e.g. `'elasticsearch'`). `isActive` is true for the single driver named\n * by `crowi.config.json:search.driver`.\n *\n * `supportsRebuild` is true when the driver implements the optional\n * `SearchDriver.rebuild?()` method — drivers without a persistent index\n * (e.g. Mongo regex) omit it. The admin UI uses this to decide whether\n * to surface the `crowi-admin search rebuild` hint.\n */\nexport const SearchDriverEntrySchema = z.object({\n driverName: z.string(),\n pluginName: z.string(),\n isActive: z.boolean(),\n supportsRebuild: z.boolean(),\n});\nexport type SearchDriverEntry = z.infer<typeof SearchDriverEntrySchema>;\n\n/**\n * Active driver pointer. Null when `crowi.config.json` names a driver that\n * no loaded plugin registered, or when no `search.driver` is configured at\n * all (search becomes unavailable and the API returns 503 — see\n * `routes/ts-rest/search.ts`).\n */\nexport const ActiveSearchDriverSchema = z.object({\n driverName: z.string(),\n pluginName: z.string(),\n supportsRebuild: z.boolean(),\n});\nexport type ActiveSearchDriver = z.infer<typeof ActiveSearchDriverSchema>;\n\n/**\n * Response for GET /admin/search. Returns the active driver pointer plus\n * every search driver registered by a loaded plugin so the admin can see\n * what's installed (and link to each plugin's settings page).\n */\nexport const GetSearchStatusResponseSchema = z.object({\n active: ActiveSearchDriverSchema.nullable(),\n drivers: z.array(SearchDriverEntrySchema),\n});\nexport type GetSearchStatusResponse = z.infer<typeof GetSearchStatusResponseSchema>;\n","/**\n * RFC-0006 Phase 4 Batch 9 — `admin.security` sub-contract ported to\n * `@hono/zod-openapi` route definitions.\n *\n * GET /admin/security — read the four `security:*` keys\n * PUT /admin/security — persist them\n *\n * Auth + install:\n * - The handler installs `createJwtAdminRequired(crowi)` broadly on\n * `/admin/security/*` plus the bare `/admin/security` path.\n */\nimport { createRoute } from '@hono/zod-openapi';\n\nimport { GetSecuritySettingsResponseSchema, UpdateSecuritySettingsRequestSchema, UpdateSecuritySettingsResponseSchema } from '../../schemas/admin/security';\nimport { AdminRequiredErrorSchema, AuthenticationRequiredErrorSchema, InternalServerErrorSchema } from '../../schemas/common';\n\nexport const getSecuritySettingsRoute = createRoute({\n method: 'get',\n path: '/admin/security',\n tags: ['admin.security'],\n security: [{ bearerAuth: [] }],\n summary: 'Get the current security:* settings',\n responses: {\n 200: {\n description: 'Current security settings',\n content: { 'application/json': { schema: GetSecuritySettingsResponseSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 403: {\n description: 'Admin permission required',\n content: { 'application/json': { schema: AdminRequiredErrorSchema } },\n },\n 500: {\n description: 'Internal server error',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n },\n});\n\nexport const updateSecuritySettingsRoute = createRoute({\n method: 'put',\n path: '/admin/security',\n tags: ['admin.security'],\n security: [{ bearerAuth: [] }],\n summary: 'Update security:* settings (registrationMode / registrationWhiteList)',\n request: {\n body: {\n content: { 'application/json': { schema: UpdateSecuritySettingsRequestSchema } },\n },\n },\n responses: {\n 200: {\n description: 'Updated settings (re-read from in-memory cache)',\n content: { 'application/json': { schema: UpdateSecuritySettingsResponseSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 403: {\n description: 'Admin permission required',\n content: { 'application/json': { schema: AdminRequiredErrorSchema } },\n },\n 500: {\n description: 'Internal server error',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n },\n});\n\nexport const adminSecurityRoutes = {\n getSecuritySettingsRoute,\n updateSecuritySettingsRoute,\n};\n\nexport type {\n GetSecuritySettingsResponse,\n RegistrationMode,\n SecuritySettings,\n UpdateSecuritySettingsRequest,\n UpdateSecuritySettingsResponse,\n} from '../../schemas/admin/security';\n","import { z } from '@hono/zod-openapi';\n\n/**\n * Registration mode enum.\n *\n * NOTE: 'Resricted' is intentionally a typo (sic) — it matches the historical\n * value persisted in the `crowi.security:registrationMode` config key. Renaming\n * to 'Restricted' would require a separate data migration task. For now we\n * preserve backward compatibility and accept the misspelled value at the API\n * boundary. UIs can present 'Restricted' to users while sending 'Resricted'\n * over the wire.\n *\n * See: packages/api/src/models/config.ts (SECURITY_REGISTRATION_MODE_RESTRICTED)\n */\nexport const RegistrationModeSchema = z.enum(['Open', 'Resricted', 'Closed']);\nexport type RegistrationMode = z.infer<typeof RegistrationModeSchema>;\n\n/**\n * Canonical shape of the security settings on the wire.\n *\n * Mirrors the registration-related `security:*` keys in the `crowi` config\n * namespace:\n * - security:registrationMode -> registrationMode\n * - security:registrationWhiteList -> registrationWhiteList\n *\n * NOTE: the legacy site-wide HTTP Basic auth (`security:basicName` /\n * `security:basicSecret`) was removed (breaking change). In the split\n * Next.js + Hono architecture, gate the site at a reverse proxy instead.\n * The old config keys, if present in the DB, are simply ignored.\n */\nexport const SecuritySettingsSchema = z.object({\n registrationMode: RegistrationModeSchema,\n registrationWhiteList: z.array(z.string()),\n});\nexport type SecuritySettings = z.infer<typeof SecuritySettingsSchema>;\n\n/**\n * Request body for PUT /admin/security.\n *\n * The contract accepts `registrationWhiteList` strictly as `string[]`. UIs that\n * present the list as a textarea should split on newlines and trim/filter\n * empty lines before sending. The server still defensively trims and drops\n * empty entries to mirror the legacy `stringToArrayFilter` behavior.\n */\nexport const UpdateSecuritySettingsRequestSchema = SecuritySettingsSchema;\nexport type UpdateSecuritySettingsRequest = z.infer<typeof UpdateSecuritySettingsRequestSchema>;\n\n/**\n * Response shape for both GET /admin/security and PUT /admin/security.\n *\n * PUT returns the post-update settings (rather than `{ ok: true }`) so the UI\n * can avoid an extra round-trip after saving.\n */\nexport const GetSecuritySettingsResponseSchema = SecuritySettingsSchema;\nexport type GetSecuritySettingsResponse = z.infer<typeof GetSecuritySettingsResponseSchema>;\n\nexport const UpdateSecuritySettingsResponseSchema = SecuritySettingsSchema;\nexport type UpdateSecuritySettingsResponse = z.infer<typeof UpdateSecuritySettingsResponseSchema>;\n","/**\n * RFC-0006 Phase 4 Batch 9 — `admin.storage` sub-contract ported to\n * `@hono/zod-openapi` route definitions.\n *\n * GET /admin/storage — read-only: active storage driver + installed list\n *\n * Auth + install:\n * - The handler installs `createJwtAdminRequired(crowi)` broadly on\n * `/admin/storage/*` plus the bare `/admin/storage` path.\n */\nimport { createRoute } from '@hono/zod-openapi';\n\nimport { GetStorageStatusResponseSchema } from '../../schemas/admin/storage';\nimport { AdminRequiredErrorSchema, AuthenticationRequiredErrorSchema, InternalServerErrorSchema } from '../../schemas/common';\n\nexport const getStorageStatusRoute = createRoute({\n method: 'get',\n path: '/admin/storage',\n tags: ['admin.storage'],\n security: [{ bearerAuth: [] }],\n summary: 'Get the active storage driver and the list of installed drivers',\n responses: {\n 200: {\n description: 'Active driver pointer + every registered driver',\n content: { 'application/json': { schema: GetStorageStatusResponseSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 403: {\n description: 'Admin permission required',\n content: { 'application/json': { schema: AdminRequiredErrorSchema } },\n },\n 500: {\n description: 'Internal server error',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n },\n});\n\nexport const adminStorageRoutes = {\n getStorageStatusRoute,\n};\n\nexport type {\n ActiveStorageDriver,\n GetStorageStatusResponse,\n StorageDriverEntry,\n} from '../../schemas/admin/storage';\n","import { z } from '@hono/zod-openapi';\n\n/**\n * One row in the \"installed storage drivers\" list. A driver is registered\n * by exactly one plugin (`pluginName`) under a stable `driverName`\n * (e.g. `'local'`, `'s3'`). `isActive` is true for the single driver named\n * by `crowi.config.json:storage.driver`.\n */\nexport const StorageDriverEntrySchema = z.object({\n driverName: z.string(),\n pluginName: z.string(),\n isActive: z.boolean(),\n});\nexport type StorageDriverEntry = z.infer<typeof StorageDriverEntrySchema>;\n\n/**\n * Active driver pointer. Null when `crowi.config.json` names a driver that\n * no loaded plugin registered — the boot sequence logs a warning and falls\n * back to legacy in-core handling, and the admin UI surfaces this as\n * \"no active driver\".\n */\nexport const ActiveStorageDriverSchema = z.object({\n driverName: z.string(),\n pluginName: z.string(),\n});\nexport type ActiveStorageDriver = z.infer<typeof ActiveStorageDriverSchema>;\n\n/**\n * Response for GET /admin/storage. Returns the active driver pointer plus\n * every storage driver registered by a loaded plugin so the admin can see\n * what's installed (and link to each plugin's settings page).\n */\nexport const GetStorageStatusResponseSchema = z.object({\n active: ActiveStorageDriverSchema.nullable(),\n drivers: z.array(StorageDriverEntrySchema),\n});\nexport type GetStorageStatusResponse = z.infer<typeof GetStorageStatusResponseSchema>;\n","/**\n * RFC-0006 Phase 4 Batch 9 — `admin.users` sub-contract ported to\n * `@hono/zod-openapi` route definitions.\n *\n * 10 endpoints:\n * GET /admin/users (listUsers)\n * GET /admin/users/search (searchUsersByEmail)\n * POST /admin/users/invite (inviteUsers)\n * PATCH /admin/users/{id} (editUser)\n * PUT /admin/users/{id}/admin (makeAdmin)\n * DELETE /admin/users/{id}/admin (removeFromAdmin)\n * PUT /admin/users/{id}/status/active (activateUser)\n * PUT /admin/users/{id}/status/suspended (suspendUser)\n * POST /admin/users/{id}/reset-password (resetPassword)\n * PUT /admin/users/{id}/email (updateUserEmail)\n *\n * Auth + install:\n * - The handler installs `createJwtAdminRequired(crowi)` broadly on\n * `/admin/users/*` plus the bare `/admin/users` path.\n */\nimport { createRoute, z } from '@hono/zod-openapi';\n\nimport {\n AdminUserIdParamSchema,\n AdminUserMutationResponseSchema,\n DeleteAdminUserResponseSchema,\n EditAdminUserRequestSchema,\n InviteUsersRequestSchema,\n InviteUsersResponseSchema,\n ListAdminUsersRequestSchema,\n ListAdminUsersResponseSchema,\n PendingUsersCountResponseSchema,\n ResetPasswordResponseSchema,\n SearchAdminUsersByEmailRequestSchema,\n SearchAdminUsersByEmailResponseSchema,\n UpdateAdminUserEmailRequestSchema,\n} from '../../schemas/admin/users';\nimport {\n AdminRequiredErrorSchema,\n AuthenticationRequiredErrorSchema,\n ConflictErrorSchema,\n InternalServerErrorSchema,\n NotFoundErrorSchema,\n ValidationErrorSchema,\n} from '../../schemas/common';\n\nexport const listUsersRoute = createRoute({\n method: 'get',\n path: '/admin/users',\n tags: ['admin.users'],\n security: [{ bearerAuth: [] }],\n summary: 'List users with optional search (q) and pagination (page, limit)',\n request: {\n query: ListAdminUsersRequestSchema,\n },\n responses: {\n 200: {\n description: 'Paginated user list',\n content: { 'application/json': { schema: ListAdminUsersResponseSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 403: {\n description: 'Admin permission required',\n content: { 'application/json': { schema: AdminRequiredErrorSchema } },\n },\n 500: {\n description: 'Internal server error',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n },\n});\n\nexport const searchUsersByEmailRoute = createRoute({\n method: 'get',\n path: '/admin/users/search',\n tags: ['admin.users'],\n security: [{ bearerAuth: [] }],\n summary: 'Email substring search for autocomplete-style UIs (max 51 results)',\n request: {\n query: SearchAdminUsersByEmailRequestSchema,\n },\n responses: {\n 200: {\n description: 'Matching users (capped at 51)',\n content: { 'application/json': { schema: SearchAdminUsersByEmailResponseSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 403: {\n description: 'Admin permission required',\n content: { 'application/json': { schema: AdminRequiredErrorSchema } },\n },\n 500: {\n description: 'Internal server error',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n },\n});\n\nexport const inviteUsersRoute = createRoute({\n method: 'post',\n path: '/admin/users/invite',\n tags: ['admin.users'],\n security: [{ bearerAuth: [] }],\n summary: 'Invite a batch of users by email; returns per-email status',\n request: {\n body: {\n content: { 'application/json': { schema: InviteUsersRequestSchema } },\n },\n },\n responses: {\n 200: {\n description: 'Per-email status (created / exists / failed)',\n content: { 'application/json': { schema: InviteUsersResponseSchema } },\n },\n 400: {\n description: 'Validation error',\n content: { 'application/json': { schema: ValidationErrorSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 403: {\n description: 'Admin permission required',\n content: { 'application/json': { schema: AdminRequiredErrorSchema } },\n },\n 500: {\n description: 'Internal server error',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n },\n});\n\nexport const editUserRoute = createRoute({\n method: 'patch',\n path: '/admin/users/{id}',\n tags: ['admin.users'],\n security: [{ bearerAuth: [] }],\n summary: \"Update a user's name and email\",\n request: {\n params: AdminUserIdParamSchema,\n body: {\n content: { 'application/json': { schema: EditAdminUserRequestSchema } },\n },\n },\n responses: {\n 200: {\n description: 'Updated user',\n content: { 'application/json': { schema: AdminUserMutationResponseSchema } },\n },\n 400: {\n description: 'Validation error',\n content: { 'application/json': { schema: ValidationErrorSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 403: {\n description: 'Admin permission required',\n content: { 'application/json': { schema: AdminRequiredErrorSchema } },\n },\n 404: {\n description: 'User not found',\n content: { 'application/json': { schema: NotFoundErrorSchema } },\n },\n 409: {\n description: 'Email already in use by another user',\n content: { 'application/json': { schema: ConflictErrorSchema } },\n },\n 500: {\n description: 'Internal server error',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n },\n});\n\nexport const makeAdminRoute = createRoute({\n method: 'put',\n path: '/admin/users/{id}/admin',\n tags: ['admin.users'],\n security: [{ bearerAuth: [] }],\n summary: 'Grant admin permission to a user',\n request: {\n params: AdminUserIdParamSchema,\n },\n responses: {\n 200: {\n description: 'Updated user',\n content: { 'application/json': { schema: AdminUserMutationResponseSchema } },\n },\n 400: {\n description: 'Invalid id',\n content: { 'application/json': { schema: ValidationErrorSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 403: {\n description: 'Admin permission required',\n content: { 'application/json': { schema: AdminRequiredErrorSchema } },\n },\n 404: {\n description: 'User not found',\n content: { 'application/json': { schema: NotFoundErrorSchema } },\n },\n 500: {\n description: 'Internal server error',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n },\n});\n\nexport const removeFromAdminRoute = createRoute({\n method: 'delete',\n path: '/admin/users/{id}/admin',\n tags: ['admin.users'],\n security: [{ bearerAuth: [] }],\n summary: 'Revoke admin permission from a user',\n request: {\n params: AdminUserIdParamSchema,\n },\n responses: {\n 200: {\n description: 'Updated user',\n content: { 'application/json': { schema: AdminUserMutationResponseSchema } },\n },\n 400: {\n description: 'Invalid id',\n content: { 'application/json': { schema: ValidationErrorSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 403: {\n description: 'Admin permission required',\n content: { 'application/json': { schema: AdminRequiredErrorSchema } },\n },\n 404: {\n description: 'User not found',\n content: { 'application/json': { schema: NotFoundErrorSchema } },\n },\n 500: {\n description: 'Internal server error',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n },\n});\n\nexport const activateUserRoute = createRoute({\n method: 'put',\n path: '/admin/users/{id}/status/active',\n tags: ['admin.users'],\n security: [{ bearerAuth: [] }],\n summary: 'Activate a user (status -> ACTIVE)',\n request: {\n params: AdminUserIdParamSchema,\n },\n responses: {\n 200: {\n description: 'Updated user',\n content: { 'application/json': { schema: AdminUserMutationResponseSchema } },\n },\n 400: {\n description: 'Invalid id',\n content: { 'application/json': { schema: ValidationErrorSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 403: {\n description: 'Admin permission required',\n content: { 'application/json': { schema: AdminRequiredErrorSchema } },\n },\n 404: {\n description: 'User not found',\n content: { 'application/json': { schema: NotFoundErrorSchema } },\n },\n 500: {\n description: 'Internal server error',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n },\n});\n\nexport const suspendUserRoute = createRoute({\n method: 'put',\n path: '/admin/users/{id}/status/suspended',\n tags: ['admin.users'],\n security: [{ bearerAuth: [] }],\n summary: 'Suspend a user (status -> SUSPENDED)',\n request: {\n params: AdminUserIdParamSchema,\n },\n responses: {\n 200: {\n description: 'Updated user',\n content: { 'application/json': { schema: AdminUserMutationResponseSchema } },\n },\n 400: {\n description: 'Invalid id',\n content: { 'application/json': { schema: ValidationErrorSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 403: {\n description: 'Admin permission required',\n content: { 'application/json': { schema: AdminRequiredErrorSchema } },\n },\n 404: {\n description: 'User not found',\n content: { 'application/json': { schema: NotFoundErrorSchema } },\n },\n 500: {\n description: 'Internal server error',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n },\n});\n\nexport const resetPasswordRoute = createRoute({\n method: 'post',\n path: '/admin/users/{id}/reset-password',\n tags: ['admin.users'],\n security: [{ bearerAuth: [] }],\n summary: \"Reset a user's password to a random value (returns plaintext)\",\n request: {\n params: AdminUserIdParamSchema,\n },\n responses: {\n 200: {\n description: 'Updated user + new plaintext password',\n content: { 'application/json': { schema: ResetPasswordResponseSchema } },\n },\n 400: {\n description: 'Invalid id',\n content: { 'application/json': { schema: ValidationErrorSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 403: {\n description: 'Admin permission required',\n content: { 'application/json': { schema: AdminRequiredErrorSchema } },\n },\n 404: {\n description: 'User not found',\n content: { 'application/json': { schema: NotFoundErrorSchema } },\n },\n 500: {\n description: 'Internal server error',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n },\n});\n\nexport const updateUserEmailRoute = createRoute({\n method: 'put',\n path: '/admin/users/{id}/email',\n tags: ['admin.users'],\n security: [{ bearerAuth: [] }],\n summary: \"Update a user's email address\",\n request: {\n params: AdminUserIdParamSchema,\n body: {\n content: { 'application/json': { schema: UpdateAdminUserEmailRequestSchema } },\n },\n },\n responses: {\n 200: {\n description: 'Updated user',\n content: { 'application/json': { schema: AdminUserMutationResponseSchema } },\n },\n 400: {\n description: 'Validation error',\n content: { 'application/json': { schema: ValidationErrorSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 403: {\n description: 'Admin permission required',\n content: { 'application/json': { schema: AdminRequiredErrorSchema } },\n },\n 404: {\n description: 'User not found',\n content: { 'application/json': { schema: NotFoundErrorSchema } },\n },\n 409: {\n description: 'Email already in use by another user',\n content: { 'application/json': { schema: ConflictErrorSchema } },\n },\n 500: {\n description: 'Internal server error',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n },\n});\n\nexport const pendingUsersCountRoute = createRoute({\n method: 'get',\n path: '/admin/users/pending-count',\n tags: ['admin.users'],\n security: [{ bearerAuth: [] }],\n summary: 'Count users awaiting admin approval (status REGISTERED)',\n responses: {\n 200: {\n description: 'Pending-approval user count',\n content: { 'application/json': { schema: PendingUsersCountResponseSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 403: {\n description: 'Admin permission required',\n content: { 'application/json': { schema: AdminRequiredErrorSchema } },\n },\n 500: {\n description: 'Internal server error',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n },\n});\n\nexport const deleteUserRoute = createRoute({\n method: 'delete',\n path: '/admin/users/{id}',\n tags: ['admin.users'],\n security: [{ bearerAuth: [] }],\n summary: 'Physically remove a user (INVITED status only)',\n request: {\n params: AdminUserIdParamSchema,\n },\n responses: {\n 200: {\n description: 'User removed',\n content: { 'application/json': { schema: DeleteAdminUserResponseSchema } },\n },\n 400: {\n description: 'Invalid id',\n content: { 'application/json': { schema: ValidationErrorSchema } },\n },\n 401: {\n description: 'Authentication required',\n content: { 'application/json': { schema: AuthenticationRequiredErrorSchema } },\n },\n 403: {\n description: 'Admin permission required',\n content: { 'application/json': { schema: AdminRequiredErrorSchema } },\n },\n 404: {\n description: 'User not found',\n content: { 'application/json': { schema: NotFoundErrorSchema } },\n },\n 409: {\n description: 'User is not in the INVITED status and cannot be physically removed',\n content: { 'application/json': { schema: ConflictErrorSchema } },\n },\n 500: {\n description: 'Internal server error',\n content: { 'application/json': { schema: InternalServerErrorSchema } },\n },\n },\n});\n\nexport const adminUsersRoutes = {\n listUsersRoute,\n searchUsersByEmailRoute,\n inviteUsersRoute,\n editUserRoute,\n makeAdminRoute,\n removeFromAdminRoute,\n activateUserRoute,\n suspendUserRoute,\n resetPasswordRoute,\n updateUserEmailRoute,\n pendingUsersCountRoute,\n deleteUserRoute,\n};\n\nexport type {\n AdminPager,\n AdminUserIdParam,\n AdminUserMutationResponse,\n EditAdminUserRequest,\n InvitedUserResult,\n InviteUsersRequest,\n InviteUsersResponse,\n ListAdminUsersRequest,\n ListAdminUsersResponse,\n ResetPasswordResponse,\n SearchAdminUsersByEmailRequest,\n SearchAdminUsersByEmailResponse,\n UpdateAdminUserEmailRequest,\n} from '../../schemas/admin/users';\n","import { z } from '@hono/zod-openapi';\nimport { UserPublicSchema } from '../userPublic';\nimport { AdminPagerSchema } from './_pager';\n\nexport { AdminPagerSchema, type AdminPager } from './_pager';\n\n/**\n * Query parameters accepted by GET /admin/users.\n *\n * - `q` is the free-text search; legacy controller used `uq` but we adopt the\n * shorter `q` for the new endpoint. See architecturalNotes in the migration\n * task. The server side splits on whitespace and joins with `|` to build a\n * single regex (case-insensitive) matched against username / name / email.\n * - `page` defaults to 1.\n * - `limit` defaults to 50 (== legacy User.PAGE_ITEMS) and is capped at 100.\n *\n * `z.coerce.number()` accepts the string-form values that arrive from\n * `req.query` while remaining typed as `number` downstream.\n */\nexport const ListAdminUsersRequestSchema = z.object({\n q: z.string().optional(),\n /**\n * Optional numeric user-status filter (see `UserStatusEnum`). When set, only\n * users in that status are returned — used by the \"user approval\" queue\n * screen to list `REGISTERED` (= awaiting admin approval) users.\n */\n status: z.coerce.number().int().optional(),\n page: z.coerce.number().int().min(1).optional().default(1),\n limit: z.coerce.number().int().min(1).max(100).optional().default(50),\n});\nexport type ListAdminUsersRequest = z.infer<typeof ListAdminUsersRequestSchema>;\n\n/**\n * Response body for GET /admin/users.\n *\n * Note: even though the legacy endpoint also returned the original `uq` echo,\n * we drop it from the new contract — the client owns the search input state\n * and does not need the server to round-trip the query back.\n */\nexport const ListAdminUsersResponseSchema = z.object({\n users: z.array(UserPublicSchema),\n pager: AdminPagerSchema,\n});\nexport type ListAdminUsersResponse = z.infer<typeof ListAdminUsersResponseSchema>;\n\n/**\n * Query parameters for GET /admin/users/search (email autocomplete).\n *\n * The legacy endpoint accepted `email` and matched as a regex (with the\n * special characters escaped server-side). We preserve the same shape so\n * pre-existing autocomplete callers can switch to the new endpoint with\n * minimal change.\n */\nexport const SearchAdminUsersByEmailRequestSchema = z.object({\n email: z.string().min(1),\n});\nexport type SearchAdminUsersByEmailRequest = z.infer<typeof SearchAdminUsersByEmailRequestSchema>;\n\n/**\n * Response body for GET /admin/users/search.\n *\n * The legacy endpoint wrapped users in `{ data: [...] }`; the new shape uses\n * the more conventional `{ users: [...] }` for parity with the list endpoint.\n * Up to PAGE_ITEMS+1 (= 51) results are returned so a UI can detect \"more\n * results than shown\" without an extra count query.\n */\nexport const SearchAdminUsersByEmailResponseSchema = z.object({\n users: z.array(UserPublicSchema),\n});\nexport type SearchAdminUsersByEmailResponse = z.infer<typeof SearchAdminUsersByEmailResponseSchema>;\n\n/**\n * Path-param schema reused by every per-user mutating endpoint\n * (edit / makeAdmin / removeFromAdmin / activate / suspend / resetPassword /\n * updateEmail). Strict 24-char hex validation lives in the handler so we can\n * surface a consistent 400 ValidationError; here we just declare the shape.\n */\nexport const AdminUserIdParamSchema = z.object({\n id: z.string(),\n});\nexport type AdminUserIdParam = z.infer<typeof AdminUserIdParamSchema>;\n\n/**\n * Request body for POST /admin/users/invite.\n *\n * The legacy form accepted a single newline-separated `emailList` string; the\n * new contract takes a clean `string[]` so the client owns the splitting and\n * trimming. `sendEmail` toggles the post-invite mailer (template\n * `admin/userInvitation.txt`); defaults to false to keep the side-effect\n * opt-in.\n */\nexport const InviteUsersRequestSchema = z.object({\n emailList: z.array(z.string().email()).min(1),\n sendEmail: z.boolean().optional().default(false),\n});\nexport type InviteUsersRequest = z.infer<typeof InviteUsersRequestSchema>;\n\n/**\n * Per-email outcome produced by `User.createUsersByInvitation`. Normalized to\n * a discriminator so clients can render success/duplicate/failure rows with a\n * simple switch.\n *\n * - 'created' -> a new user was inserted; userId is the new ObjectId\n * - 'exists' -> an active or invited user already had this email; no insert\n * - 'failed' -> save() rejected (rare; e.g. invalid email after coercion).\n * We surface it instead of swallowing so admins notice partial\n * success.\n */\nexport const InvitedUserResultSchema = z.discriminatedUnion('status', [\n z.object({\n email: z.string(),\n status: z.literal('created'),\n userId: z.string(),\n }),\n z.object({\n email: z.string(),\n status: z.literal('exists'),\n }),\n z.object({\n email: z.string(),\n status: z.literal('failed'),\n }),\n]);\nexport type InvitedUserResult = z.infer<typeof InvitedUserResultSchema>;\n\nexport const InviteUsersResponseSchema = z.object({\n results: z.array(InvitedUserResultSchema),\n});\nexport type InviteUsersResponse = z.infer<typeof InviteUsersResponseSchema>;\n\n/**\n * Request body for PATCH /admin/users/:id.\n *\n * Both `name` and `email` are required by the legacy form (userEditForm),\n * so we keep them required here too. The dedicated PUT /admin/users/:id/email\n * endpoint exists for partial email-only updates that come from a different\n * UI affordance (the table row \"change email\" action).\n */\nexport const EditAdminUserRequestSchema = z.object({\n name: z.string().min(1),\n email: z.string().email(),\n});\nexport type EditAdminUserRequest = z.infer<typeof EditAdminUserRequestSchema>;\n\n/**\n * Response body for the user-mutating endpoints that return the updated user\n * (edit / makeAdmin / removeFromAdmin / activate / suspend / updateEmail).\n *\n * We always shape it as `{ user: UserPublic }` (rather than returning the bare\n * UserPublic) so future fields like `message` or `previousEmail` can be added\n * without a breaking response change.\n */\nexport const AdminUserMutationResponseSchema = z.object({\n user: UserPublicSchema,\n});\nexport type AdminUserMutationResponse = z.infer<typeof AdminUserMutationResponseSchema>;\n\n/**\n * Response body for POST /admin/users/:id/reset-password.\n *\n * Mirrors the legacy `User.resetPasswordByRandomString` contract: returns the\n * generated plaintext password alongside the updated user. The plaintext\n * disclosure is preserved for parity with the legacy admin UI; switching to\n * an email-delivered reset is tracked in the task openQuestions.\n */\nexport const ResetPasswordResponseSchema = z.object({\n user: UserPublicSchema,\n newPassword: z.string(),\n});\nexport type ResetPasswordResponse = z.infer<typeof ResetPasswordResponseSchema>;\n\n/**\n * Request body for PUT /admin/users/:id/email.\n *\n * Email-only update. The legacy endpoint took `{ user_id, email }` in the\n * body; with the user id now in the path, only `email` remains.\n */\nexport const UpdateAdminUserEmailRequestSchema = z.object({\n email: z.string().email(),\n});\nexport type UpdateAdminUserEmailRequest = z.infer<typeof UpdateAdminUserEmailRequestSchema>;\n\n/**\n * Response body for DELETE /admin/users/:id.\n *\n * Only users still in the INVITED status can be physically removed\n * (`User.removeCompletelyById`); activated users are logically deleted via the\n * suspend/delete status flow instead. Returns the removed id so the client can\n * drop the row optimistically.\n */\nexport const DeleteAdminUserResponseSchema = z.object({\n deletedId: z.string(),\n});\nexport type DeleteAdminUserResponse = z.infer<typeof DeleteAdminUserResponseSchema>;\n\n/**\n * Response body for GET /admin/users/pending-count.\n *\n * `count` is the number of users awaiting admin approval (status REGISTERED).\n * Drives the \"user approval\" sidebar badge so admins notice pending sign-ups.\n */\nexport const PendingUsersCountResponseSchema = z.object({\n count: z.number().int().nonnegative(),\n});\nexport type PendingUsersCountResponse = z.infer<typeof PendingUsersCountResponseSchema>;\n","import { z } from '@hono/zod-openapi';\n\n/**\n * Numbered pager shape for admin list views. Mirrors the legacy\n * `createPager` helper (packages/api/src/controllers/admin.ts:22-93)\n * so the wire format is forward-compatible across the migration.\n *\n * Distinct from `PagerSchema` (schemas/page.ts), which is the\n * offset/prev/next bundle used by infinite-scroll lists. This one is\n * the windowed numeric pager (1..N + \"...\" dots) suited to a tabular\n * admin list.\n *\n * Fields:\n * - page : 1-based current page index.\n * - pagesCount : Total number of pages (= ceil(total / limit), or 0\n * when total is 0 — mongoose-paginate emits 0).\n * - pages : Page numbers to render as buttons (windowed around\n * `page`, max length = MAX_PAGE_LIST in the helper).\n * - total : Total number of matching documents.\n * - previous : Previous page number, or null on the first page.\n * - previousDots : Whether to render a \"...\" between the first page\n * button and the windowed range.\n * - next : Next page number, or null on the last page.\n * - nextDots : Symmetric to `previousDots` on the right side.\n */\nexport const AdminPagerSchema = z.object({\n page: z.number(),\n pagesCount: z.number(),\n pages: z.array(z.number()),\n total: z.number(),\n previous: z.number().nullable(),\n previousDots: z.boolean(),\n next: z.number().nullable(),\n nextDots: z.boolean(),\n});\nexport type AdminPager = z.infer<typeof AdminPagerSchema>;\n","/// <reference lib=\"dom\" />\n/**\n * RFC-0006 — typed Hono client factory.\n *\n * Wraps the runtime `hc<AppType>(baseUrl)` call from `hono/client` with\n * the request-init plumbing the web app needs (auth header / pluggable\n * fetch). Exports an `AppType` that describes the Hono route surface\n * declared by every `createRoute(...)` in `@crowi/api-contract/contracts`.\n *\n * **AppType placement decision (Phase 3 build-order smoke test, see\n * `docs/migrations/0006-hono-context.md` §11 & §14)**:\n *\n * - **Option 1** (`@crowi/api-contract` imports `AppType` from\n * `@crowi/api/hono`) **failed** the smoke test — `pnpm --filter\n * @crowi/api-contract build` runs before `@crowi/api`'s `dist/` is\n * emitted (workspace dep graph: `@crowi/api -> @crowi/api-contract`,\n * not the reverse), so the dts compile cannot resolve\n * `@crowi/api/hono`.\n *\n * - **Option 2 adopted**: `@crowi/api-contract` is the single source of\n * truth for `AppType`. It builds a no-op Hono chain that mirrors the\n * real route surface (every `createRoute(...)` exported by the\n * contracts) and exports `AppType` as an intersection of every\n * sub-chain's `typeof`. The real `@crowi/api` handler chain produces\n * the same shape because both sides consume the same `createRoute`\n * definitions, so the `hc<AppType>` client is type-safe against the\n * real server.\n *\n * If the route-definition <-> handler-implementation match ever drifts\n * (e.g. a contract is registered here but never wired in `@crowi/api`),\n * runtime requests will 404 — covered by integration tests in\n * `packages/api/src/hono/handlers/*.test.ts`.\n *\n * **Phase 6 — TS2589 escape hatch removal**:\n *\n * Phase 4 Batch 9 hit TypeScript error 2589 (\"type instantiation\n * excessively deep\") when the contract chain reached 90+ chained\n * `.openapi(...)` calls; the previous workaround flattened the four\n * sub-chains into one via `.route('/', sub)` calls and surfaced\n * `AppType = typeof contractApp`, which still tripped 2589 in\n * downstream `hc<AppType>` consumers. That commit reached\n * for `@ts-expect-error` on the `hc<AppType>(baseUrl)` call and\n * exported `CrowiApiClient = any`, which forced four frontend hooks to\n * cast `response.json() as <Schema>`.\n *\n * The fix in this file:\n *\n * 1. The route surface is partitioned into six independent\n * `OpenAPIHono` chains, each holding ≤ ~22 `.openapi(...)` calls so\n * no single chain exceeds TS's instantiation-depth ceiling on its\n * own.\n * 2. `AppType` is declared as the **intersection** of every chain's\n * `typeof`. `hc<T>` from `hono/client` constrains `T` to `Hono<any,\n * any, any>`, which an intersection of multiple `OpenAPIHono`\n * chains satisfies (each summand is a Hono), and the inferred\n * `Client<T, Prefix>` propagates each chain's routes through\n * `UnionToIntersection<Client<...>>` in the upstream hc declaration.\n * 3. The chains are **not** merged via `.route('/', sub)`; that call\n * is what caused the type to flatten and explode in the previous\n * layout. Merging is only useful when the runtime needs a single\n * `app.fetch` entry-point, which is not the case here (the runtime\n * is `@crowi/api`'s real handler chain — these stubs never execute).\n */\nimport { OpenAPIHono } from '@hono/zod-openapi';\nimport { hc } from 'hono/client';\nimport type { z } from 'zod';\n\nimport { adminAppRoutes } from './contracts/admin/app';\nimport { adminAuthRoutes } from './contracts/admin/auth';\nimport { adminMailRoutes } from './contracts/admin/mail';\nimport { adminPluginsRoutes } from './contracts/admin/plugins';\nimport { adminSearchRoutes } from './contracts/admin/search';\nimport { adminSecurityRoutes } from './contracts/admin/security';\nimport { adminStorageRoutes } from './contracts/admin/storage';\nimport { adminUsersRoutes } from './contracts/admin/users';\nimport { appRoutes } from './contracts/app';\nimport { attachmentRoutes } from './contracts/attachment';\nimport { autocompleteRoutes } from './contracts/autocomplete';\nimport { backlinkRoutes } from './contracts/backlink';\nimport { bookmarkRoutes } from './contracts/bookmark';\nimport { commentRoutes } from './contracts/comment';\nimport { draftRoutes } from './contracts/draft';\nimport { installerRoutes } from './contracts/installer';\nimport { meRoutes } from './contracts/me';\nimport { accessTokenRoutes } from './contracts/access-token';\nimport { oauthRoutes } from './contracts/oauth';\nimport { notificationRoutes } from './contracts/notification';\nimport { pageCollabRoutes } from './contracts/page-collab';\nimport { pageRoutes } from './contracts/page';\nimport { pagePreviewRoutes } from './contracts/page-preview';\nimport { presenceRoutes } from './contracts/presence';\nimport { revisionRoutes } from './contracts/revision';\nimport { adminCryptoRoutes } from './contracts/adminCrypto';\nimport { searchRoutes } from './contracts/search';\nimport { tokenAuthRoutes } from './contracts/tokenAuth';\nimport { inviteAcceptRoutes } from './contracts/inviteAccept';\nimport { passwordResetRoutes } from './contracts/passwordReset';\nimport { activationRoutes } from './contracts/activation';\nimport { emailChangeRoutes } from './contracts/emailChange';\nimport { userRoutes } from './contracts/user';\nimport type { AppInfoResponseSchema } from './schemas/app';\nimport type { GetBacklinksResponseSchema } from './schemas/backlink';\nimport type { BookmarkResponseSchema, ListMyBookmarksResponseSchema, RemoveBookmarkResponseSchema } from './schemas/bookmark';\nimport type { AddCommentResponseSchema, DeleteCommentResponseSchema, ListCommentsResponseSchema } from './schemas/comment';\nimport type { CreateAdminResponseSchema, InstallerStatusResponseSchema } from './schemas/installer';\nimport type {\n PasswordUpdateSuccessSchema,\n PictureUploadResponseSchema,\n RecentlyViewedPagesResponseSchema,\n SuccessResponseSchema,\n UserProfileResponseSchema,\n} from './schemas/me';\nimport type { AccessTokenSchema, CreateAccessTokenResponseSchema, ListAccessTokensResponseSchema } from './schemas/access-token';\nimport type {\n AuthorizeResponseSchema,\n DeviceAuthorizeResponseSchema,\n DeviceInfoResponseSchema,\n DeviceVerifyResponseSchema,\n DiscoveryResponseSchema,\n RevokeResponseSchema,\n TokenResponseSchema,\n} from './schemas/oauth-endpoints';\nimport type {\n ListNotificationsResponseSchema,\n MarkAllAsReadResponseSchema,\n NotificationStatusResponseSchema,\n NotificationsTokenResponseSchema,\n OpenNotificationResponseSchema,\n} from './schemas/notification';\nimport type { WsTokenResponseSchema } from './schemas/collab';\nimport type {\n GetPageResponseSchema,\n ListPageChildrenResponseSchema,\n ListPagesResponseSchema,\n PageSchema,\n SeenUsersResponseSchema,\n WatchStatusResponseSchema,\n} from './schemas/page';\nimport type { PreviewPageResponseSchema } from './schemas/page-preview';\nimport type { LikersResponseSchema, PresenceTokenResponseSchema } from './schemas/presence';\nimport type { GetRevisionResponseSchema, GetRevisionsResponseSchema, ListRevisionsResponseSchema } from './schemas/revision';\nimport type { SearchPagesResponseSchema } from './schemas/search';\nimport type { CryptoStatusResponseSchema, ReencryptResponseSchema } from './schemas/adminCrypto';\nimport type { TokenAuthResponseSchema } from './schemas/auth';\nimport type { ListUsersResponseSchema, UserBookmarksResponseSchema, UserPageResponseSchema, UserPagesResponseSchema } from './schemas/user';\nimport type { CreateDraftResponseSchema, ListDraftsResponseSchema } from './schemas/draft';\nimport type { AutocompleteResponseSchema } from './schemas/autocomplete';\nimport type {\n AddAttachmentResponseSchema,\n AttachmentMetaSchema,\n AttachmentUsageResponseSchema,\n ListAttachmentsResponseSchema,\n RemoveAttachmentResponseSchema,\n UploadAttachmentResponseSchema,\n} from './schemas/attachment';\nimport type { GetAppSettingsResponseSchema, UpdateAppSettingsResponseSchema } from './schemas/admin/app';\nimport type { GetAuthSettingsResponseSchema, UpdateAuthSettingsResponseSchema } from './schemas/admin/auth';\nimport type { GetMailSettingsResponseSchema, SendTestMailResponseSchema, UpdateMailSettingsResponseSchema } from './schemas/admin/mail';\nimport type {\n ClearRenderCacheResponseSchema,\n ListPluginsResponseSchema,\n PluginConfigResponseSchema,\n UpdatePluginConfigResponseSchema,\n} from './schemas/admin/plugins';\nimport type { GetSearchStatusResponseSchema } from './schemas/admin/search';\nimport type { GetSecuritySettingsResponseSchema, UpdateSecuritySettingsResponseSchema } from './schemas/admin/security';\nimport type { GetStorageStatusResponseSchema } from './schemas/admin/storage';\nimport type {\n AdminUserMutationResponseSchema,\n DeleteAdminUserResponseSchema,\n InviteUsersResponseSchema,\n ListAdminUsersResponseSchema,\n PendingUsersCountResponseSchema,\n ResetPasswordResponseSchema,\n SearchAdminUsersByEmailResponseSchema,\n} from './schemas/admin/users';\n\ntype AppInfoResponse = z.infer<typeof AppInfoResponseSchema>;\ntype InstallerStatusResponse = z.infer<typeof InstallerStatusResponseSchema>;\ntype CreateAdminResponse = z.infer<typeof CreateAdminResponseSchema>;\ntype TokenAuthResponse = z.infer<typeof TokenAuthResponseSchema>;\ntype UserProfileResponse = z.infer<typeof UserProfileResponseSchema>;\ntype PictureUploadResponse = z.infer<typeof PictureUploadResponseSchema>;\ntype SuccessResponse = z.infer<typeof SuccessResponseSchema>;\ntype PasswordUpdateSuccess = z.infer<typeof PasswordUpdateSuccessSchema>;\ntype AccessToken = z.infer<typeof AccessTokenSchema>;\ntype ListAccessTokensResponse = z.infer<typeof ListAccessTokensResponseSchema>;\ntype CreateAccessTokenResponse = z.infer<typeof CreateAccessTokenResponseSchema>;\ntype AuthorizeResponse = z.infer<typeof AuthorizeResponseSchema>;\ntype TokenResponse = z.infer<typeof TokenResponseSchema>;\ntype RevokeResponse = z.infer<typeof RevokeResponseSchema>;\ntype DiscoveryResponse = z.infer<typeof DiscoveryResponseSchema>;\ntype DeviceAuthorizeResponse = z.infer<typeof DeviceAuthorizeResponseSchema>;\ntype DeviceInfoResponse = z.infer<typeof DeviceInfoResponseSchema>;\ntype DeviceVerifyResponse = z.infer<typeof DeviceVerifyResponseSchema>;\ntype RecentlyViewedPagesResponse = z.infer<typeof RecentlyViewedPagesResponseSchema>;\ntype UserPageResponse = z.infer<typeof UserPageResponseSchema>;\ntype UserBookmarksResponse = z.infer<typeof UserBookmarksResponseSchema>;\ntype UserPagesResponse = z.infer<typeof UserPagesResponseSchema>;\ntype ListUsersResponse = z.infer<typeof ListUsersResponseSchema>;\ntype BookmarkResponse = z.infer<typeof BookmarkResponseSchema>;\ntype ListMyBookmarksResponse = z.infer<typeof ListMyBookmarksResponseSchema>;\ntype RemoveBookmarkResponse = z.infer<typeof RemoveBookmarkResponseSchema>;\ntype GetBacklinksResponse = z.infer<typeof GetBacklinksResponseSchema>;\ntype ListCommentsResponse = z.infer<typeof ListCommentsResponseSchema>;\ntype AddCommentResponse = z.infer<typeof AddCommentResponseSchema>;\ntype DeleteCommentResponse = z.infer<typeof DeleteCommentResponseSchema>;\ntype ListRevisionsResponse = z.infer<typeof ListRevisionsResponseSchema>;\ntype GetRevisionResponse = z.infer<typeof GetRevisionResponseSchema>;\ntype GetRevisionsResponse = z.infer<typeof GetRevisionsResponseSchema>;\ntype SearchPagesResponse = z.infer<typeof SearchPagesResponseSchema>;\ntype CryptoStatusResponse = z.infer<typeof CryptoStatusResponseSchema>;\ntype ReencryptResponse = z.infer<typeof ReencryptResponseSchema>;\ntype ListNotificationsResponse = z.infer<typeof ListNotificationsResponseSchema>;\ntype MarkAllAsReadResponse = z.infer<typeof MarkAllAsReadResponseSchema>;\ntype NotificationStatusResponse = z.infer<typeof NotificationStatusResponseSchema>;\ntype NotificationsTokenResponse = z.infer<typeof NotificationsTokenResponseSchema>;\ntype OpenNotificationResponse = z.infer<typeof OpenNotificationResponseSchema>;\ntype Page = z.infer<typeof PageSchema>;\ntype GetPageResponse = z.infer<typeof GetPageResponseSchema>;\ntype ListPagesResponse = z.infer<typeof ListPagesResponseSchema>;\ntype ListPageChildrenResponse = z.infer<typeof ListPageChildrenResponseSchema>;\ntype SeenUsersResponse = z.infer<typeof SeenUsersResponseSchema>;\ntype WatchStatusResponse = z.infer<typeof WatchStatusResponseSchema>;\ntype PreviewPageResponse = z.infer<typeof PreviewPageResponseSchema>;\ntype WsTokenResponse = z.infer<typeof WsTokenResponseSchema>;\ntype PresenceTokenResponse = z.infer<typeof PresenceTokenResponseSchema>;\ntype LikersResponse = z.infer<typeof LikersResponseSchema>;\ntype CreateDraftResponse = z.infer<typeof CreateDraftResponseSchema>;\ntype ListDraftsResponse = z.infer<typeof ListDraftsResponseSchema>;\ntype AutocompleteResponse = z.infer<typeof AutocompleteResponseSchema>;\ntype ListAttachmentsResponse = z.infer<typeof ListAttachmentsResponseSchema>;\ntype AddAttachmentResponse = z.infer<typeof AddAttachmentResponseSchema>;\ntype AttachmentUsageResponse = z.infer<typeof AttachmentUsageResponseSchema>;\ntype AttachmentMeta = z.infer<typeof AttachmentMetaSchema>;\ntype UploadAttachmentResponse = z.infer<typeof UploadAttachmentResponseSchema>;\ntype RemoveAttachmentResponse = z.infer<typeof RemoveAttachmentResponseSchema>;\n// admin sub-contract response types\ntype GetAppSettingsResponse = z.infer<typeof GetAppSettingsResponseSchema>;\ntype UpdateAppSettingsResponse = z.infer<typeof UpdateAppSettingsResponseSchema>;\ntype GetAuthSettingsResponse = z.infer<typeof GetAuthSettingsResponseSchema>;\ntype UpdateAuthSettingsResponse = z.infer<typeof UpdateAuthSettingsResponseSchema>;\ntype GetSecuritySettingsResponse = z.infer<typeof GetSecuritySettingsResponseSchema>;\ntype UpdateSecuritySettingsResponse = z.infer<typeof UpdateSecuritySettingsResponseSchema>;\ntype GetMailSettingsResponse = z.infer<typeof GetMailSettingsResponseSchema>;\ntype UpdateMailSettingsResponse = z.infer<typeof UpdateMailSettingsResponseSchema>;\ntype SendTestMailResponse = z.infer<typeof SendTestMailResponseSchema>;\ntype GetStorageStatusResponse = z.infer<typeof GetStorageStatusResponseSchema>;\ntype GetSearchStatusResponse = z.infer<typeof GetSearchStatusResponseSchema>;\ntype ListAdminUsersResponse = z.infer<typeof ListAdminUsersResponseSchema>;\ntype SearchAdminUsersByEmailResponse = z.infer<typeof SearchAdminUsersByEmailResponseSchema>;\ntype InviteUsersResponse = z.infer<typeof InviteUsersResponseSchema>;\ntype AdminUserMutationResponse = z.infer<typeof AdminUserMutationResponseSchema>;\ntype ResetPasswordResponse = z.infer<typeof ResetPasswordResponseSchema>;\ntype DeleteAdminUserResponse = z.infer<typeof DeleteAdminUserResponseSchema>;\ntype PendingUsersCountResponse = z.infer<typeof PendingUsersCountResponseSchema>;\ntype ListPluginsResponse = z.infer<typeof ListPluginsResponseSchema>;\ntype PluginConfigResponse = z.infer<typeof PluginConfigResponseSchema>;\ntype UpdatePluginConfigResponse = z.infer<typeof UpdatePluginConfigResponseSchema>;\ntype ClearRenderCacheResponse = z.infer<typeof ClearRenderCacheResponseSchema>;\n\n/**\n * Spec-only Hono chain mirroring the route surface every consumer must\n * be able to talk to. The handlers below never execute at runtime —\n * `@crowi/api` registers the real handlers — so they return schema-\n * conforming stub bodies purely to thread the response type through\n * `OpenAPIHono`'s per-route type accumulator. Phase 4 commits extend\n * this chain one resource at a time so `AppType` stays in lock-step\n * with the real `@crowi/api` chain.\n *\n * Stub bodies use the success status only (200 / 201); the error arms\n * are part of the route's `responses` map and `hc`'s type inference\n * picks them up automatically.\n */\nconst stubUser = {\n id: '',\n username: '',\n email: '',\n name: '',\n admin: false,\n} as const;\n\nconst stubTokens: TokenAuthResponse = {\n accessToken: '',\n refreshToken: '',\n expiresIn: 0,\n user: stubUser,\n};\n\nconst stubProfile: UserProfileResponse = {\n id: '',\n username: '',\n name: '',\n email: 'stub@example.com',\n lang: 'en',\n theme: 'system',\n image: null,\n hasPassword: false,\n createdAt: '',\n};\n\nconst stubAccessToken: AccessToken = {\n id: '',\n name: '',\n scopes: [],\n expiresAt: null,\n lastUsedAt: null,\n createdAt: '',\n};\n\nconst stubCreateAccessToken: CreateAccessTokenResponse = { ...stubAccessToken, token: '' };\n\n// OAuth endpoint stubs (RFC-0010 Phase 3).\nconst stubAuthorize: AuthorizeResponse = { redirectUri: '' };\nconst stubToken: TokenResponse = {\n access_token: '',\n token_type: 'Bearer',\n expires_in: 0,\n refresh_token: '',\n scope: '',\n};\nconst stubRevoke: RevokeResponse = {};\nconst stubDiscovery: DiscoveryResponse = {\n issuer: '',\n authorization_endpoint: '',\n token_endpoint: '',\n revocation_endpoint: '',\n scopes_supported: [],\n response_types_supported: [],\n grant_types_supported: [],\n code_challenge_methods_supported: [],\n token_endpoint_auth_methods_supported: [],\n};\n// OAuth device-grant stubs (RFC-0010 Phase 4 / RFC 8628).\nconst stubDeviceAuthorize: DeviceAuthorizeResponse = {\n device_code: '',\n user_code: '',\n verification_uri: '',\n verification_uri_complete: '',\n expires_in: 0,\n interval: 0,\n};\nconst stubDeviceInfo: DeviceInfoResponse = { client_id: '', scopes: [] };\nconst stubDeviceVerify: DeviceVerifyResponse = { status: 'approved' };\n\nconst stubUserPublic = {\n _id: '',\n id: '',\n username: '',\n name: '',\n email: 'stub@example.com',\n image: null,\n introduction: '',\n createdAt: '',\n admin: false,\n} as const;\n\nconst stubUserPage: UserPageResponse = {\n user: stubUserPublic,\n createdPagesCount: 0,\n bookmarksCount: 0,\n};\n\nconst stubPager = { prev: null, next: null, offset: 0 } as const;\n\nconst stubUserBookmarks: UserBookmarksResponse = {\n bookmarks: [],\n pager: stubPager,\n total: 0,\n};\n\nconst stubUserPages: UserPagesResponse = {\n pages: [],\n pager: stubPager,\n total: 0,\n};\n\nconst stubListUsers: ListUsersResponse = {\n users: [],\n pager: stubPager,\n total: 0,\n};\n\nconst stubBookmarkResponse: BookmarkResponse = { bookmark: null };\nconst stubListMyBookmarks: ListMyBookmarksResponse = { bookmarks: [], pager: stubPager, total: 0 };\nconst stubRemoveBookmark: RemoveBookmarkResponse = { ok: true };\nconst stubBacklinks: GetBacklinksResponse = { backlinks: [], hasNext: false };\nconst stubListComments: ListCommentsResponse = { comments: [] };\nconst stubComment = {\n _id: '',\n page: '',\n creator: null,\n revision: '',\n comment: '',\n commentPosition: -1,\n createdAt: '',\n};\nconst stubAddComment: AddCommentResponse = { comment: stubComment, newlyWatching: false };\nconst stubDeleteComment: DeleteCommentResponse = { ok: true };\nconst stubListRevisions: ListRevisionsResponse = { revisions: [], pager: stubPager };\nconst stubRevision = {\n _id: '',\n path: '',\n body: '',\n format: 'markdown',\n author: null,\n createdAt: '',\n};\nconst stubGetRevision: GetRevisionResponse = { revision: stubRevision };\nconst stubGetRevisions: GetRevisionsResponse = { revisions: [] };\nconst stubListNotifications: ListNotificationsResponse = { notifications: [], pager: stubPager };\nconst stubMarkAllAsRead: MarkAllAsReadResponse = { ok: true };\nconst stubNotificationStatus: NotificationStatusResponse = { count: 0 };\nconst stubNotificationsToken: NotificationsTokenResponse = {\n token: '',\n selfUserId: '',\n expiresAt: '',\n};\nconst stubOpenNotification: OpenNotificationResponse = {\n notification: {\n _id: '',\n user: '',\n targetModel: 'Page',\n target: { _id: '', path: '', status: null },\n action: 'COMMENT',\n status: 'OPENED',\n actionUsers: [],\n createdAt: '',\n },\n};\n\n// Page stub — every optional field omitted so the schema's defaults\n// kick in (commentCount default 0, etc.).\nconst stubPage: Page = {\n _id: '',\n path: '',\n commentCount: 0,\n createdAt: '',\n};\n\nconst stubPageWithRevision: GetPageResponse = {\n page: {\n _id: '',\n path: '',\n revision: {\n _id: '',\n path: '',\n body: '',\n format: 'markdown',\n createdAt: '',\n },\n commentCount: 0,\n createdAt: '',\n },\n};\n\nconst stubPageResponse = { page: stubPage };\nconst stubListPages: ListPagesResponse = { pages: [], pager: stubPager, portalPage: null };\nconst stubListPageChildren: ListPageChildrenResponse = { children: [] };\nconst stubSeenUsers: SeenUsersResponse = { seenUsers: [], seenUsersCount: 0 };\nconst stubWatchStatus: WatchStatusResponse = { watching: false };\nconst stubPreview: PreviewPageResponse = { renderedAst: null };\nconst stubWsToken: WsTokenResponse = {\n wsToken: '',\n pageId: '',\n expiresAt: '',\n readonly: false,\n};\nconst stubPresenceToken: PresenceTokenResponse = {\n token: '',\n pageId: '',\n selfUserId: '',\n expiresAt: '',\n};\nconst stubLikers: LikersResponse = { users: [], totalCount: 0 };\n\nconst stubCreateDraft: CreateDraftResponse = { pageId: '' };\nconst stubListDrafts: ListDraftsResponse = { drafts: [] };\nconst stubAutocomplete: AutocompleteResponse = { results: [] };\nconst stubAttachment = {\n _id: '',\n page: '',\n creator: stubUserPublic,\n filePath: '',\n fileName: '',\n originalName: '',\n fileFormat: '',\n fileSize: 0,\n createdAt: '',\n url: '',\n inUse: false,\n} as const;\nconst stubListAttachments: ListAttachmentsResponse = { attachments: [] };\nconst stubAddAttachment: AddAttachmentResponse = { attachment: stubAttachment, url: '' };\nconst stubAttachmentUsage: AttachmentUsageResponse = { pagePath: '', latest: [], past: [] };\nconst stubAttachmentMeta: AttachmentMeta = (() => {\n const { inUse: _inUse, ...rest } = stubAttachment;\n return rest;\n})();\nconst stubUploadAttachment: UploadAttachmentResponse = { url: '', filename: '', mimeType: '', sizeBytes: 0 };\nconst stubRemoveAttachment: RemoveAttachmentResponse = { success: true };\nconst stubSearchPages: SearchPagesResponse = { meta: { total: 0, results: 0 }, data: [] };\nconst stubCryptoStatus: CryptoStatusResponse = {\n encryptionConfigured: false,\n unencryptedCount: 0,\n encryptedCount: 0,\n entries: [],\n};\nconst stubReencrypt: ReencryptResponse = { rewritten: 0, alreadyEncrypted: 0, missing: 0 };\n\n// Batch 9 — admin sub-contract stubs.\nconst stubGetAppSettings: GetAppSettingsResponse = {\n app: { title: '', confidential: '' },\n isUploadable: false,\n registrationMode: {},\n setupChecklistDismissed: false,\n};\nconst stubUpdateAppSettings: UpdateAppSettingsResponse = { ok: true };\nconst stubAuthSettings: GetAuthSettingsResponse = { requireThirdPartyAuth: false, disablePasswordAuth: false };\nconst stubSecuritySettings: GetSecuritySettingsResponse = {\n registrationMode: 'Open',\n registrationWhiteList: [],\n};\nconst stubMailSettings: GetMailSettingsResponse = {\n from: '',\n activeDriver: '',\n activePlugin: '',\n};\nconst stubUpdateMailSettings: UpdateMailSettingsResponse = { ok: true };\nconst stubSendTestMail: SendTestMailResponse = { ok: true, to: '' };\nconst stubStorageStatus: GetStorageStatusResponse = { active: null, drivers: [] };\nconst stubSearchStatus: GetSearchStatusResponse = { active: null, drivers: [] };\nconst stubAdminPager = {\n page: 1,\n pagesCount: 0,\n pages: [] as number[],\n total: 0,\n previous: null,\n previousDots: false,\n next: null,\n nextDots: false,\n};\nconst stubListAdminUsers: ListAdminUsersResponse = { users: [], pager: stubAdminPager };\nconst stubSearchAdminUsersByEmail: SearchAdminUsersByEmailResponse = { users: [] };\nconst stubInviteUsers: InviteUsersResponse = { results: [] };\nconst stubAdminUserMutation: AdminUserMutationResponse = { user: stubUserPublic };\nconst stubResetPassword: ResetPasswordResponse = { user: stubUserPublic, newPassword: '' };\nconst stubDeleteAdminUser: DeleteAdminUserResponse = { deletedId: '' };\nconst stubPendingUsersCount: PendingUsersCountResponse = { count: 0 };\nconst stubListPlugins: ListPluginsResponse = { plugins: [] };\nconst stubPluginConfig: PluginConfigResponse = { name: '', fields: [], values: {} };\nconst stubUpdatePluginConfig: UpdatePluginConfigResponse = { ok: true, hotReloaded: false, reconfigureFailed: false };\nconst stubClearRenderCache: ClearRenderCacheResponse = { ok: true, clearedAt: '', removedCount: 0 };\n\n// app boot / token-auth / me / user — 20 routes. The `_id` user is\n// freshly spelt out in `tokenMeRoute` because the user shape returned\n// by `/auth/me` (legacy JWT verify endpoint) embeds `status` and is\n// nominally different from `stubUser` (no `status` field).\nconst appAuthMeUserChain = new OpenAPIHono()\n .openapi(appRoutes.getAppInfoRoute, (c) => c.json({ title: null, confidential: null } satisfies AppInfoResponse, 200))\n .openapi(installerRoutes.getInstallerStatusRoute, (c) => c.json({ status: 'installer_required' } satisfies InstallerStatusResponse, 200))\n .openapi(installerRoutes.createAdminRoute, (c) => c.json({ status: 'ok' } satisfies CreateAdminResponse, 200))\n .openapi(tokenAuthRoutes.tokenLoginRoute, (c) => c.json(stubTokens, 200))\n .openapi(tokenAuthRoutes.tokenRegisterRoute, (c) => c.json({ status: 'confirmation_required' as const }, 200))\n .openapi(inviteAcceptRoutes.invitePreviewRoute, (c) => c.json({ email: 'stub@example.com' }, 200))\n .openapi(inviteAcceptRoutes.acceptInviteRoute, (c) => c.json(stubTokens, 200))\n .openapi(passwordResetRoutes.forgotPasswordRoute, (c) => c.json({ ok: true as const }, 200))\n .openapi(passwordResetRoutes.validateResetTokenRoute, (c) => c.json({ ok: true as const }, 200))\n .openapi(passwordResetRoutes.selfResetPasswordRoute, (c) => c.json(stubTokens, 200))\n .openapi(activationRoutes.validateActivationTokenRoute, (c) => c.json({ ok: true as const }, 200))\n .openapi(activationRoutes.activateAccountRoute, (c) => c.json(stubTokens, 200))\n .openapi(emailChangeRoutes.validateEmailChangeTokenRoute, (c) => c.json({ ok: true as const, email: 'stub@example.com' }, 200))\n .openapi(emailChangeRoutes.confirmEmailChangeRoute, (c) => c.json({ ok: true as const, email: 'stub@example.com' }, 200))\n .openapi(tokenAuthRoutes.tokenRefreshRoute, (c) => c.json(stubTokens, 200))\n .openapi(tokenAuthRoutes.tokenLogoutRoute, (c) => c.json({ message: '' }, 200))\n .openapi(tokenAuthRoutes.tokenMeRoute, (c) =>\n c.json(\n {\n user: {\n id: '',\n username: '',\n email: 'stub@example.com',\n name: '',\n status: 0,\n admin: false,\n createdAt: '',\n },\n },\n 200,\n ),\n )\n .openapi(meRoutes.getProfileRoute, (c) => c.json(stubProfile, 200))\n .openapi(meRoutes.updateProfileRoute, (c) => c.json(stubProfile, 200))\n .openapi(meRoutes.updateThemeRoute, (c) => c.json({ status: 'ok' as const, theme: 'system' as const }, 200))\n .openapi(meRoutes.uploadPictureRoute, (c) => c.json({ status: true } satisfies PictureUploadResponse, 200))\n .openapi(meRoutes.deletePictureRoute, (c) => c.json({ status: 'ok' } satisfies SuccessResponse, 200))\n .openapi(meRoutes.updatePasswordRoute, (c) => c.json({ status: 'ok', message: '' } satisfies PasswordUpdateSuccess, 200))\n .openapi(meRoutes.recentlyViewedPagesRoute, (c) => c.json({ pages: [] } satisfies RecentlyViewedPagesResponse, 200))\n .openapi(accessTokenRoutes.listAccessTokensRoute, (c) => c.json({ accessTokens: [] } satisfies ListAccessTokensResponse, 200))\n .openapi(accessTokenRoutes.createAccessTokenRoute, (c) => c.json(stubCreateAccessToken, 201))\n .openapi(accessTokenRoutes.deleteAccessTokenRoute, (c) => c.json(stubAccessToken, 200))\n .openapi(userRoutes.getUserPageRoute, (c) => c.json(stubUserPage, 200))\n .openapi(userRoutes.getUserBookmarksRoute, (c) => c.json(stubUserBookmarks, 200))\n .openapi(userRoutes.getUserPagesRoute, (c) => c.json(stubUserPages, 200))\n .openapi(userRoutes.listMembersRoute, (c) => c.json(stubListUsers, 200));\n\n// bookmark / backlink / comment / revision — 11 routes. Revision's\n// list-by-ids endpoint registers before the by-id endpoint to mirror\n// the runtime chain (first-match-wins on the Hono router).\nconst bookmarkBacklinkCommentRevisionChain = new OpenAPIHono()\n .openapi(bookmarkRoutes.getBookmarkRoute, (c) => c.json(stubBookmarkResponse, 200))\n .openapi(bookmarkRoutes.listMyBookmarksRoute, (c) => c.json(stubListMyBookmarks, 200))\n .openapi(bookmarkRoutes.addBookmarkRoute, (c) => c.json(stubBookmarkResponse, 200))\n .openapi(bookmarkRoutes.removeBookmarkRoute, (c) => c.json(stubRemoveBookmark, 200))\n .openapi(backlinkRoutes.getBacklinksRoute, (c) => c.json(stubBacklinks, 200))\n .openapi(commentRoutes.listCommentsRoute, (c) => c.json(stubListComments, 200))\n .openapi(commentRoutes.addCommentRoute, (c) => c.json(stubAddComment, 200))\n .openapi(commentRoutes.deleteCommentRoute, (c) => c.json(stubDeleteComment, 200))\n .openapi(revisionRoutes.listRevisionsRoute, (c) => c.json(stubListRevisions, 200))\n // `/pages/revisions` (list-by-ids) registers before `/pages/revisions/{id}`\n // to match the runtime chain — see the contract file header for why\n // ordering matters.\n .openapi(revisionRoutes.getRevisionsRoute, (c) => c.json(stubGetRevisions, 200))\n .openapi(revisionRoutes.getRevisionRoute, (c) => c.json(stubGetRevision, 200));\n\n// page / page-preview / pageCollab / presence — 18 routes. Page CRUD\n// registers AFTER revision in the runtime chain so the shared\n// `/pages/*` `createJwtAuth` apply in revision is reused. Inside this\n// block, literal sub-paths (`/pages/list`, `/pages/grant`, `/pages/seen`,\n// `/pages/seen-users`, `/pages/like`, `/pages/unlike`, `/pages/watch`,\n// `/pages/revert`, `/pages/rename`) come before the bare `/pages` CRUD\n// endpoints — same first-match-wins ordering used by the revision /\n// notification chains.\nconst pageChain = new OpenAPIHono()\n .openapi(pageRoutes.getPageRoute, (c) => c.json(stubPageWithRevision, 200))\n .openapi(pageRoutes.listPagesRoute, (c) => c.json(stubListPages, 200))\n .openapi(pageRoutes.listPageChildrenRoute, (c) => c.json(stubListPageChildren, 200))\n .openapi(pageRoutes.createPageRoute, (c) => c.json(stubPageResponse, 200))\n .openapi(pageRoutes.updatePageRoute, (c) => c.json(stubPageResponse, 200))\n .openapi(pageRoutes.setPageGrantRoute, (c) => c.json(stubPageResponse, 200))\n .openapi(pageRoutes.seenPageRoute, (c) => c.json(stubSeenUsers, 200))\n .openapi(pageRoutes.getSeenUsersRoute, (c) => c.json(stubSeenUsers, 200))\n .openapi(pageRoutes.likePageRoute, (c) => c.json(stubPageResponse, 200))\n .openapi(pageRoutes.unlikePageRoute, (c) => c.json(stubPageResponse, 200))\n .openapi(pageRoutes.getWatchStatusRoute, (c) => c.json(stubWatchStatus, 200))\n .openapi(pageRoutes.setWatchStatusRoute, (c) => c.json(stubWatchStatus, 200))\n .openapi(pageRoutes.deletePageRoute, (c) => c.json(stubPageResponse, 200))\n .openapi(pageRoutes.revertDeletedPageRoute, (c) => c.json(stubPageResponse, 200))\n .openapi(pageRoutes.renamePageRoute, (c) => c.json({ ...stubPageResponse, renamed_count: 1 }, 200))\n .openapi(pageRoutes.renameSubtreeRoute, (c) => c.json({ renamed_count: 0 }, 200))\n // page-preview — single endpoint, `/pages/preview` (literal under\n // `/pages/*`). Method is POST so it does not collide with GET /pages\n // (getPage) or POST /pages (createPage) — Hono dispatches by\n // method+path so this is purely organisational.\n .openapi(pagePreviewRoutes.previewPageRoute, (c) => c.json(stubPreview, 200))\n // pageCollab + presence — `/pages/{id}/<suffix>` routes that share\n // the revision handler's `/pages/*` jwtAuth apply. RFC-0003 wsToken\n // and RFC-0005 presence token / likers list. The path uses a 24-hex\n // ObjectId in position 2 vs. the literal `/pages/list` etc., so no\n // matcher collision is possible.\n .openapi(pageCollabRoutes.getYjsTokenRoute, (c) => c.json(stubWsToken, 200))\n .openapi(presenceRoutes.getPresenceTokenRoute, (c) => c.json(stubPresenceToken, 200))\n .openapi(presenceRoutes.getLikersRoute, (c) => c.json(stubLikers, 200));\n\nconst lateContractApp = new OpenAPIHono()\n // Batch 6 — draft / autocomplete / attachment (RFC-0004). The\n // literal sub-paths (`/pages/drafts`, `/pages/autocomplete`,\n // `/pages/{pageId}/attachments[/usage]`) all sit under `/pages/*`\n // but use distinct method+path tuples, so they do not collide with\n // the page / revision routes above (Hono dispatches by full\n // method+path). The attachment usage route registers before the\n // bare list route to match the runtime chain.\n .openapi(draftRoutes.createDraftRoute, (c) => c.json(stubCreateDraft, 201))\n .openapi(draftRoutes.listDraftsRoute, (c) => c.json(stubListDrafts, 200))\n .openapi(draftRoutes.cancelDraftRoute, (c) => c.json(stubCreateDraft, 200))\n .openapi(autocompleteRoutes.autocompleteUsersRoute, (c) => c.json(stubAutocomplete, 200))\n .openapi(autocompleteRoutes.autocompletePagesRoute, (c) => c.json(stubAutocomplete, 200))\n .openapi(attachmentRoutes.getAttachmentUsageRoute, (c) => c.json(stubAttachmentUsage, 200))\n .openapi(attachmentRoutes.listAttachmentsRoute, (c) => c.json(stubListAttachments, 200))\n .openapi(attachmentRoutes.addAttachmentRoute, (c) => c.json(stubAddAttachment, 200))\n .openapi(attachmentRoutes.uploadAttachmentRoute, (c) => c.json(stubUploadAttachment, 200))\n .openapi(attachmentRoutes.getAttachmentMetaRoute, (c) => c.json(stubAttachmentMeta, 200))\n .openapi(attachmentRoutes.removeAttachmentRoute, (c) => c.json(stubRemoveAttachment, 200))\n // Batch 7 — search. Singleton literal path `/search`, installs jwtAuth\n // on the path itself (no other handler owns `/search`). Registered\n // before notification to mirror the buildHonoApp chain.\n .openapi(searchRoutes.searchPagesRoute, (c) => c.json(stubSearchPages, 200))\n // Batch 8 — adminCrypto. Two literal paths under `/admin/crypto/*`,\n // admin-only (first time `createJwtAdminRequired(crowi)` lands on\n // Hono). Registered between search and notification to mirror the\n // buildHonoApp chain.\n .openapi(adminCryptoRoutes.getCryptoStatusRoute, (c) => c.json(stubCryptoStatus, 200))\n .openapi(adminCryptoRoutes.reencryptAllRoute, (c) => c.json(stubReencrypt, 200))\n .openapi(notificationRoutes.listNotificationsRoute, (c) => c.json(stubListNotifications, 200))\n .openapi(notificationRoutes.markAllAsReadRoute, (c) => c.json(stubMarkAllAsRead, 200))\n // `/notifications/token` + `/notifications/status` are literal paths\n // and MUST register before `/notifications/{id}/open` so the template\n // route never shadows them (same first-match-wins reason as the\n // revision chain).\n .openapi(notificationRoutes.getNotificationsTokenRoute, (c) => c.json(stubNotificationsToken, 200))\n .openapi(notificationRoutes.getUnreadCountRoute, (c) => c.json(stubNotificationStatus, 200))\n .openapi(notificationRoutes.openNotificationRoute, (c) => c.json(stubOpenNotification, 200));\n\n/**\n * Batch 9 — admin sub-contracts (26 endpoints across two chains):\n *\n * - `adminSettingsContractApp`: the 6 read+write settings sub-contracts\n * (app / auth / security / mail / storage / search) = 11 routes.\n * - `adminUsersPluginsContractApp`: the larger users (10) + plugins (5)\n * sub-contracts = 15 routes.\n *\n * Phase 6 (TS2589 escape hatch removal) — these chains are no longer\n * concatenated onto a single `contractApp` via `.route('/', sub)`.\n * Instead, every chain stands alone and `AppType` below is an\n * intersection of their `typeof`s, which `hc<T>` happily collapses via\n * its built-in `UnionToIntersection<Client<T, Prefix>>` plumbing.\n */\nconst adminSettingsContractApp = new OpenAPIHono()\n .openapi(adminAppRoutes.getAppSettingsRoute, (c) => c.json(stubGetAppSettings, 200))\n .openapi(adminAppRoutes.updateAppSettingsRoute, (c) => c.json(stubUpdateAppSettings, 200))\n .openapi(adminAuthRoutes.getAuthSettingsRoute, (c) => c.json(stubAuthSettings, 200))\n .openapi(adminAuthRoutes.updateAuthSettingsRoute, (c) => c.json(stubAuthSettings, 200))\n .openapi(adminSecurityRoutes.getSecuritySettingsRoute, (c) => c.json(stubSecuritySettings, 200))\n .openapi(adminSecurityRoutes.updateSecuritySettingsRoute, (c) => c.json(stubSecuritySettings, 200))\n .openapi(adminMailRoutes.getMailSettingsRoute, (c) => c.json(stubMailSettings, 200))\n .openapi(adminMailRoutes.updateMailSettingsRoute, (c) => c.json(stubUpdateMailSettings, 200))\n .openapi(adminMailRoutes.sendTestMailRoute, (c) => c.json(stubSendTestMail, 200))\n .openapi(adminStorageRoutes.getStorageStatusRoute, (c) => c.json(stubStorageStatus, 200))\n .openapi(adminSearchRoutes.getSearchStatusRoute, (c) => c.json(stubSearchStatus, 200));\n\nconst adminUsersPluginsContractApp = new OpenAPIHono()\n // admin.users — 12 endpoints. Literal `/admin/users/search` and\n // `/admin/users/pending-count` register before `/admin/users/{id}`\n // paths so they do not collide with the id-template routes (Hono\n // matches first-defined).\n .openapi(adminUsersRoutes.listUsersRoute, (c) => c.json(stubListAdminUsers, 200))\n .openapi(adminUsersRoutes.searchUsersByEmailRoute, (c) => c.json(stubSearchAdminUsersByEmail, 200))\n .openapi(adminUsersRoutes.pendingUsersCountRoute, (c) => c.json(stubPendingUsersCount, 200))\n .openapi(adminUsersRoutes.inviteUsersRoute, (c) => c.json(stubInviteUsers, 200))\n .openapi(adminUsersRoutes.editUserRoute, (c) => c.json(stubAdminUserMutation, 200))\n .openapi(adminUsersRoutes.makeAdminRoute, (c) => c.json(stubAdminUserMutation, 200))\n .openapi(adminUsersRoutes.removeFromAdminRoute, (c) => c.json(stubAdminUserMutation, 200))\n .openapi(adminUsersRoutes.activateUserRoute, (c) => c.json(stubAdminUserMutation, 200))\n .openapi(adminUsersRoutes.suspendUserRoute, (c) => c.json(stubAdminUserMutation, 200))\n .openapi(adminUsersRoutes.resetPasswordRoute, (c) => c.json(stubResetPassword, 200))\n .openapi(adminUsersRoutes.updateUserEmailRoute, (c) => c.json(stubAdminUserMutation, 200))\n .openapi(adminUsersRoutes.deleteUserRoute, (c) => c.json(stubDeleteAdminUser, 200))\n // admin.plugins — 5 endpoints. `clear-all` and `clear-plugin` use\n // different literal paths so no collision risk.\n .openapi(adminPluginsRoutes.listPluginsRoute, (c) => c.json(stubListPlugins, 200))\n .openapi(adminPluginsRoutes.getPluginConfigRoute, (c) => c.json(stubPluginConfig, 200))\n .openapi(adminPluginsRoutes.updatePluginConfigRoute, (c) => c.json(stubUpdatePluginConfig, 200))\n .openapi(adminPluginsRoutes.clearRenderCacheAllRoute, (c) => c.json(stubClearRenderCache, 200))\n .openapi(adminPluginsRoutes.clearRenderCachePluginRoute, (c) => c.json(stubClearRenderCache, 200));\n\n/**\n * OAuth 2.0 authorization-server endpoints (RFC-0010 Phase 3) — 4 routes.\n * Kept on its own chain (rather than extended onto the near-full\n * `appAuthMeUserChain`) to stay well under TS's instantiation-depth\n * ceiling, per the TS2589 mitigation documented in this file's header.\n */\nconst oauthContractApp = new OpenAPIHono()\n .openapi(oauthRoutes.authorizeRoute, (c) => c.json(stubAuthorize, 200))\n .openapi(oauthRoutes.tokenRoute, (c) => c.json(stubToken, 200))\n .openapi(oauthRoutes.revokeRoute, (c) => c.json(stubRevoke, 200))\n .openapi(oauthRoutes.discoveryRoute, (c) => c.json(stubDiscovery, 200))\n .openapi(oauthRoutes.deviceAuthorizeRoute, (c) => c.json(stubDeviceAuthorize, 200))\n .openapi(oauthRoutes.deviceInfoRoute, (c) => c.json(stubDeviceInfo, 200))\n .openapi(oauthRoutes.deviceVerifyRoute, (c) => c.json(stubDeviceVerify, 200));\n\n/**\n * Per-chain type aliases. These are **exported** so the dts bundler\n * (tsup) keeps them as named declarations in `dist/index.d.ts`; if we\n * referenced the `const` chain variables via `typeof` from inside\n * `CrowiApiClient` without exporting them, tsup would inline the\n * declarations and skip emitting `bookmarkBacklinkCommentRevisionChain`\n * etc., causing downstream consumers to see `any` for those summands\n * of the intersection.\n *\n * Each alias resolves to an `OpenAPIHono<Env, RoutesSchema>` shape\n * carrying every route in that chain's `.openapi(...)` calls.\n */\nexport type AppAuthMeUserChain = typeof appAuthMeUserChain;\nexport type BookmarkBacklinkCommentRevisionChain = typeof bookmarkBacklinkCommentRevisionChain;\nexport type PageChain = typeof pageChain;\nexport type LateContractApp = typeof lateContractApp;\nexport type AdminSettingsContractApp = typeof adminSettingsContractApp;\nexport type AdminUsersPluginsContractApp = typeof adminUsersPluginsContractApp;\nexport type OAuthContractApp = typeof oauthContractApp;\n\n/**\n * `AppType` is exposed as an alias of one representative sub-chain so\n * legacy consumers that `import type { AppType }` keep building. The\n * accurate client surface is `CrowiApiClient` below, which intersects\n * the per-chain `hc` instantiations one at a time so TypeScript never\n * has to fold every chain's schema into a single `Client<T, Prefix>`\n * type expression. (Folding-via-intersection was the layout we tried\n * first and it tripped TS2589 in `Client<T, Prefix>`'s\n * `T extends HonoBase<any, infer S, any>` arm — `infer S` only sees\n * the first summand, so only one chain's routes showed up on the\n * proxy.)\n */\nexport type AppType = AppAuthMeUserChain;\n\n/**\n * Default request init applied to every call unless the caller overrides\n * it. The `headers` shape matches Hono's `hc` (a plain record / async\n * supplier of one); `fetch` matches the fetch spec exactly.\n */\nexport interface ClientOptions {\n /** Extra default headers (e.g. `Authorization: Bearer ...`). */\n headers?: Record<string, string> | (() => Record<string, string> | Promise<Record<string, string>>);\n /**\n * Pluggable fetch implementation (used by the web app to inject the\n * refresh-token loop). Defaults to the global `fetch`.\n */\n fetch?: typeof fetch;\n}\n\n/**\n * Inferred proxy type for the typed Hono client. Built as an\n * intersection of one `hc<ChainType>` return type per sub-chain so\n * TypeScript evaluates `Client<T, Prefix>` separately for each summand\n * — avoiding the TS2589 instantiation-depth blow-up that the previous\n * single-chain layout triggered at 90+ chained `.openapi(...)` calls.\n *\n * The runtime needs only **one** `hc(...)` call because the Hono client\n * is a path-traversal `Proxy`: it lazily reflects whatever property\n * chain the caller dots into. The actual route dispatch happens on the\n * server, so the proxy's runtime behaviour is identical regardless of\n * which `AppType` we hand `hc`. We hand it one chain (`AppType`) and\n * then assert the returned proxy as the full intersection below.\n */\nexport type CrowiApiClient = ReturnType<typeof hc<AppAuthMeUserChain>> &\n ReturnType<typeof hc<BookmarkBacklinkCommentRevisionChain>> &\n ReturnType<typeof hc<PageChain>> &\n ReturnType<typeof hc<LateContractApp>> &\n ReturnType<typeof hc<AdminSettingsContractApp>> &\n ReturnType<typeof hc<AdminUsersPluginsContractApp>> &\n ReturnType<typeof hc<OAuthContractApp>>;\n\n/**\n * Build a typed Hono client against the contract chain. Constructs a\n * single Hono `hc(...)` proxy and re-types it as the multi-chain\n * intersection `CrowiApiClient` (see above for the runtime/type\n * disconnect rationale).\n */\nexport const createClient = (baseUrl: string, options: ClientOptions = {}): CrowiApiClient =>\n hc<AppType>(baseUrl, {\n headers: options.headers,\n fetch: options.fetch,\n }) as unknown as CrowiApiClient;\n","/**\n * Schema for the stateless, signed tokens embedded in transactional\n * email links (invite acceptance, account activation, password reset).\n *\n * The token is a JWT signed with `WS_TOKEN_SECRET` under the\n * `crowi-mail-token` issuer (see `packages/api/src/util/mail-token.ts`),\n * so `exp` and signature are enforced by the JWT layer; the `purpose`\n * claim scopes a token to a single flow (an invite token can never be\n * replayed against the password-reset endpoint).\n */\nimport { z } from '@hono/zod-openapi';\n\nexport const MailTokenPurposeSchema = z.enum(['invite', 'activate', 'reset', 'email-change']);\nexport type MailTokenPurpose = z.infer<typeof MailTokenPurposeSchema>;\n\nexport const MailTokenPayloadSchema = z.object({\n purpose: MailTokenPurposeSchema,\n userId: z.string(),\n /** Target address. For `email-change` this is the NEW address. */\n email: z.string().email(),\n /**\n * For `email-change`: the account's email at issue time. The confirm\n * endpoint rejects the token unless it still matches, making the token\n * single-use (a stale token cannot revert a later change).\n */\n fromEmail: z.string().email().optional(),\n // iat / exp are injected and verified by the JWT layer.\n iat: z.number().optional(),\n exp: z.number().optional(),\n});\nexport type MailTokenPayload = z.infer<typeof MailTokenPayloadSchema>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;A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i","import_zod_openapi","import_zod_openapi","import_zod_openapi","import_zod_openapi","import_zod_openapi","import_zod_openapi","import_zod_openapi","import_zod_openapi","import_zod_openapi","import_zod_openapi","import_zod_openapi","import_zod_openapi","import_zod_openapi","import_zod_openapi","import_zod_openapi","import_zod_openapi","import_zod_openapi","import_zod_openapi","import_zod_openapi","import_zod_openapi","import_zod_openapi","import_zod_openapi","import_zod_openapi","import_zod_openapi","import_zod_openapi","import_zod_openapi","import_zod_openapi","import_zod_openapi","import_zod_openapi","import_zod_openapi","import_zod_openapi","import_zod_openapi","import_zod_openapi","import_zod_openapi","import_zod_openapi","import_zod_openapi","import_zod_openapi","import_zod_openapi","import_zod_openapi","import_zod_openapi","PageIdPathParamsSchema","import_zod_openapi","import_zod_openapi","import_zod_openapi","import_zod_openapi","import_zod_openapi","import_zod_openapi","PageIdPathParamsSchema","import_zod_openapi","import_zod_openapi","import_zod_openapi","import_zod_openapi","import_zod_openapi","import_zod_openapi","import_zod_openapi","import_zod_openapi","import_zod_openapi","import_zod_openapi","import_zod_openapi","import_zod_openapi","import_zod_openapi","import_zod_openapi","import_zod_openapi","import_zod_openapi","import_zod_openapi","import_zod_openapi","import_zod_openapi","import_zod_openapi","import_zod_openapi","import_zod_openapi","import_zod_openapi"]}
|