1 import {
2 apiRefIntroSections as rawIntroSections,
3 apiRefPaths as rawPaths,
4 apiRefRedirects as rawRedirects,
5 } from "@/generated/api-ref-paths.mjs"
6 import { OpenAPI } from "types"
7
8 export type ApiRefIntroSection = {
9 slug: string
10 title: string
11 }
12
13 export type ApiRefOperationEntry = {
14 slug: string
15 path: string
16 oldHash: string
17 title: string
18 method: string
19 }
20
21 export type ApiRefTagEntry = {
22 name: string
23 path: string
24 schemaPath: string | null
25 operations: Record<string, ApiRefOperationEntry>
26 }
27
28 export type ApiRefAreaPaths = {
29 intro: Record<string, string>
30 tags: Record<string, ApiRefTagEntry>
31 }
32
33 /**
34 * Typed accessors for the generated API-reference path/redirect maps. The
35 * underlying `.mjs` is emitted with literal (non-indexable) types, so the
36 * whole app reads these maps through this module instead.
37 */
38 export const apiRefIntroSections = rawIntroSections as Record<
39 OpenAPI.Area,
40 ApiRefIntroSection[]
41 >
42
43 export const apiRefPaths = rawPaths as Record<OpenAPI.Area, ApiRefAreaPaths>
44
45 export const apiRefRedirects = rawRedirects as Record<
46 OpenAPI.Area,
47 Record<string, string>
48 >