specra 0.1.13 → 0.2.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.
Files changed (276) hide show
  1. package/LICENSE.MD +25 -4
  2. package/README.md +67 -58
  3. package/config/specra.config.schema.json +16 -0
  4. package/config/svelte-config.js +63 -0
  5. package/dist/api-parser.types.d.ts +59 -0
  6. package/dist/api-parser.types.js +5 -0
  7. package/dist/api.types.d.ts +137 -0
  8. package/dist/api.types.js +5 -0
  9. package/dist/category.d.ts +21 -0
  10. package/dist/category.js +48 -0
  11. package/dist/components/ConfigProvider.svelte +13 -0
  12. package/dist/components/ConfigProvider.svelte.d.ts +31 -0
  13. package/dist/components/docs/Accordion.svelte +18 -0
  14. package/dist/components/docs/Accordion.svelte.d.ts +10 -0
  15. package/dist/components/docs/AccordionItem.svelte +41 -0
  16. package/dist/components/docs/AccordionItem.svelte.d.ts +10 -0
  17. package/dist/components/docs/Badge.svelte +28 -0
  18. package/dist/components/docs/Badge.svelte.d.ts +9 -0
  19. package/dist/components/docs/Breadcrumb.svelte +80 -0
  20. package/dist/components/docs/Breadcrumb.svelte.d.ts +8 -0
  21. package/dist/components/docs/Callout.svelte +96 -0
  22. package/dist/components/docs/Callout.svelte.d.ts +10 -0
  23. package/dist/components/docs/Card.svelte +63 -0
  24. package/dist/components/docs/Card.svelte.d.ts +12 -0
  25. package/dist/components/docs/CardGrid.svelte +24 -0
  26. package/dist/components/docs/CardGrid.svelte.d.ts +8 -0
  27. package/dist/components/docs/CategoryIndex.svelte +110 -0
  28. package/dist/components/docs/CategoryIndex.svelte.d.ts +29 -0
  29. package/dist/components/docs/CodeBlock.svelte +172 -0
  30. package/dist/components/docs/CodeBlock.svelte.d.ts +8 -0
  31. package/dist/components/docs/Column.svelte +25 -0
  32. package/dist/components/docs/Column.svelte.d.ts +8 -0
  33. package/dist/components/docs/Columns.svelte +38 -0
  34. package/dist/components/docs/Columns.svelte.d.ts +13 -0
  35. package/dist/components/docs/DevModeBadge.svelte +15 -0
  36. package/dist/components/docs/DevModeBadge.svelte.d.ts +18 -0
  37. package/dist/components/docs/DocBadge.svelte +28 -0
  38. package/dist/components/docs/DocBadge.svelte.d.ts +9 -0
  39. package/dist/components/docs/DocLayout.svelte +107 -0
  40. package/dist/components/docs/DocLayout.svelte.d.ts +32 -0
  41. package/dist/components/docs/DocLoading.svelte +53 -0
  42. package/dist/components/docs/DocLoading.svelte.d.ts +18 -0
  43. package/dist/components/docs/DocMetadata.svelte +106 -0
  44. package/dist/components/docs/DocMetadata.svelte.d.ts +18 -0
  45. package/dist/components/docs/DocNavigation.svelte +56 -0
  46. package/dist/components/docs/DocNavigation.svelte.d.ts +12 -0
  47. package/dist/components/docs/DocTags.svelte +22 -0
  48. package/dist/components/docs/DocTags.svelte.d.ts +6 -0
  49. package/dist/components/docs/DraftBadge.svelte +10 -0
  50. package/dist/components/docs/DraftBadge.svelte.d.ts +18 -0
  51. package/dist/components/docs/Footer.svelte +72 -0
  52. package/dist/components/docs/Footer.svelte.d.ts +7 -0
  53. package/dist/components/docs/Frame.svelte +27 -0
  54. package/dist/components/docs/Frame.svelte.d.ts +9 -0
  55. package/dist/components/docs/Header.svelte +123 -0
  56. package/dist/components/docs/Header.svelte.d.ts +9 -0
  57. package/dist/components/docs/HeaderWithMenu.svelte +34 -0
  58. package/dist/components/docs/HeaderWithMenu.svelte.d.ts +17 -0
  59. package/dist/components/docs/HotReloadIndicator.svelte +44 -0
  60. package/dist/components/docs/HotReloadIndicator.svelte.d.ts +3 -0
  61. package/dist/components/docs/Icon.svelte +103 -0
  62. package/dist/components/docs/Icon.svelte.d.ts +11 -0
  63. package/dist/components/docs/Image.svelte +88 -0
  64. package/dist/components/docs/Image.svelte.d.ts +11 -0
  65. package/dist/components/docs/ImageCard.svelte +91 -0
  66. package/dist/components/docs/ImageCard.svelte.d.ts +12 -0
  67. package/dist/components/docs/ImageCardGrid.svelte +25 -0
  68. package/dist/components/docs/ImageCardGrid.svelte.d.ts +8 -0
  69. package/dist/components/docs/LayoutProviders.svelte +57 -0
  70. package/dist/components/docs/LayoutProviders.svelte.d.ts +9 -0
  71. package/dist/components/docs/Logo.svelte +25 -0
  72. package/dist/components/docs/Logo.svelte.d.ts +11 -0
  73. package/dist/components/docs/Math.svelte +54 -0
  74. package/dist/components/docs/Math.svelte.d.ts +7 -0
  75. package/dist/components/docs/MdxContent.svelte +41 -0
  76. package/dist/components/docs/MdxHotReload.svelte +78 -0
  77. package/dist/components/docs/MdxHotReload.svelte.d.ts +9 -0
  78. package/dist/components/docs/MdxLayout.svelte +16 -0
  79. package/dist/components/docs/MdxLayout.svelte.d.ts +6 -0
  80. package/dist/components/docs/Mermaid.svelte +88 -0
  81. package/dist/components/docs/Mermaid.svelte.d.ts +7 -0
  82. package/dist/components/docs/MobileDocLayout.svelte +211 -0
  83. package/dist/components/docs/MobileDocLayout.svelte.d.ts +35 -0
  84. package/dist/components/docs/MobileSidebar.svelte +122 -0
  85. package/dist/components/docs/MobileSidebar.svelte.d.ts +31 -0
  86. package/dist/components/docs/MobileSidebarWrapper.svelte +122 -0
  87. package/dist/components/docs/MobileSidebarWrapper.svelte.d.ts +32 -0
  88. package/dist/components/docs/NotFoundContent.svelte +40 -0
  89. package/dist/components/docs/NotFoundContent.svelte.d.ts +6 -0
  90. package/dist/components/docs/SearchHighlight.svelte +116 -0
  91. package/dist/components/docs/SearchHighlight.svelte.d.ts +3 -0
  92. package/dist/components/docs/SearchModal.svelte +239 -0
  93. package/dist/components/docs/SearchModal.svelte.d.ts +9 -0
  94. package/dist/components/docs/Sidebar.svelte +69 -0
  95. package/dist/components/docs/Sidebar.svelte.d.ts +31 -0
  96. package/dist/components/docs/SidebarMenuItems.svelte +344 -0
  97. package/dist/components/docs/SidebarMenuItems.svelte.d.ts +33 -0
  98. package/dist/components/docs/SidebarSkeleton.svelte +50 -0
  99. package/dist/components/docs/SidebarSkeleton.svelte.d.ts +18 -0
  100. package/dist/components/docs/SiteBanner.svelte +92 -0
  101. package/dist/components/docs/SiteBanner.svelte.d.ts +7 -0
  102. package/dist/components/docs/Step.svelte +44 -0
  103. package/dist/components/docs/Step.svelte.d.ts +8 -0
  104. package/dist/components/docs/Steps.svelte +15 -0
  105. package/dist/components/docs/Steps.svelte.d.ts +7 -0
  106. package/dist/components/docs/Tab.svelte +40 -0
  107. package/dist/components/docs/Tab.svelte.d.ts +8 -0
  108. package/dist/components/docs/TabGroups.svelte +183 -0
  109. package/dist/components/docs/TabGroups.svelte.d.ts +25 -0
  110. package/dist/components/docs/TableOfContents.svelte +100 -0
  111. package/dist/components/docs/TableOfContents.svelte.d.ts +9 -0
  112. package/dist/components/docs/Tabs.svelte +69 -0
  113. package/dist/components/docs/Tabs.svelte.d.ts +8 -0
  114. package/dist/components/docs/ThemeToggle.svelte +16 -0
  115. package/dist/components/docs/ThemeToggle.svelte.d.ts +18 -0
  116. package/dist/components/docs/Tooltip.svelte +44 -0
  117. package/dist/components/docs/Tooltip.svelte.d.ts +10 -0
  118. package/dist/components/docs/VersionSwitcher.svelte +95 -0
  119. package/dist/components/docs/VersionSwitcher.svelte.d.ts +7 -0
  120. package/dist/components/docs/Video.svelte +84 -0
  121. package/dist/components/docs/Video.svelte.d.ts +12 -0
  122. package/dist/components/docs/api/ApiEndpoint.svelte +61 -0
  123. package/dist/components/docs/api/ApiEndpoint.svelte.d.ts +11 -0
  124. package/dist/components/docs/api/ApiParams.svelte +80 -0
  125. package/dist/components/docs/api/ApiParams.svelte.d.ts +14 -0
  126. package/dist/components/docs/api/ApiPlayground.svelte +259 -0
  127. package/dist/components/docs/api/ApiPlayground.svelte.d.ts +16 -0
  128. package/dist/components/docs/api/ApiReference.svelte +278 -0
  129. package/dist/components/docs/api/ApiReference.svelte.d.ts +23 -0
  130. package/dist/components/docs/api/ApiResponse.svelte +66 -0
  131. package/dist/components/docs/api/ApiResponse.svelte.d.ts +9 -0
  132. package/dist/components/docs/api/index.d.ts +5 -0
  133. package/dist/components/docs/api/index.js +5 -0
  134. package/dist/components/docs/componentTextProps.d.ts +3 -0
  135. package/dist/components/docs/componentTextProps.js +61 -0
  136. package/dist/components/docs/index.d.ts +54 -0
  137. package/dist/components/docs/index.js +56 -0
  138. package/dist/components/global/VersionNotFound.svelte +48 -0
  139. package/dist/components/global/VersionNotFound.svelte.d.ts +7 -0
  140. package/dist/components/global/index.d.ts +1 -0
  141. package/dist/components/global/index.js +1 -0
  142. package/dist/components/index.d.ts +6 -822
  143. package/dist/components/index.js +11 -3854
  144. package/dist/components/ui/Badge.svelte +48 -0
  145. package/dist/components/ui/Badge.svelte.d.ts +15 -0
  146. package/dist/components/ui/Button.svelte +58 -0
  147. package/dist/components/ui/Button.svelte.d.ts +17 -0
  148. package/dist/components/ui/Dialog.svelte +16 -0
  149. package/dist/components/ui/Dialog.svelte.d.ts +9 -0
  150. package/dist/components/ui/DialogClose.svelte +16 -0
  151. package/dist/components/ui/DialogClose.svelte.d.ts +9 -0
  152. package/dist/components/ui/DialogContent.svelte +43 -0
  153. package/dist/components/ui/DialogContent.svelte.d.ts +10 -0
  154. package/dist/components/ui/DialogDescription.svelte +21 -0
  155. package/dist/components/ui/DialogDescription.svelte.d.ts +9 -0
  156. package/dist/components/ui/DialogFooter.svelte +20 -0
  157. package/dist/components/ui/DialogFooter.svelte.d.ts +9 -0
  158. package/dist/components/ui/DialogHeader.svelte +20 -0
  159. package/dist/components/ui/DialogHeader.svelte.d.ts +9 -0
  160. package/dist/components/ui/DialogTitle.svelte +21 -0
  161. package/dist/components/ui/DialogTitle.svelte.d.ts +9 -0
  162. package/dist/components/ui/Input.svelte +23 -0
  163. package/dist/components/ui/Input.svelte.d.ts +8 -0
  164. package/dist/components/ui/Textarea.svelte +19 -0
  165. package/dist/components/ui/Textarea.svelte.d.ts +7 -0
  166. package/dist/components/ui/index.d.ts +11 -0
  167. package/dist/components/ui/index.js +11 -0
  168. package/dist/config.d.ts +8 -0
  169. package/dist/config.js +9 -0
  170. package/dist/config.schema.json +471 -0
  171. package/dist/config.server.d.ts +46 -0
  172. package/dist/config.server.js +149 -0
  173. package/dist/{mdx-ColN3Cyg.d.mts → config.types.d.ts} +22 -75
  174. package/dist/config.types.js +39 -0
  175. package/dist/dev-utils.d.ts +29 -0
  176. package/dist/dev-utils.js +63 -0
  177. package/dist/index.d.ts +19 -4
  178. package/dist/index.js +25 -4861
  179. package/dist/mdx-cache.d.ts +41 -0
  180. package/dist/mdx-cache.js +160 -0
  181. package/dist/mdx-components.js +50 -1931
  182. package/dist/mdx-security.d.ts +76 -0
  183. package/dist/mdx-security.js +217 -0
  184. package/dist/mdx.d.ts +73 -0
  185. package/dist/mdx.js +1099 -0
  186. package/dist/middleware/index.d.ts +1 -0
  187. package/dist/middleware/index.js +2 -0
  188. package/dist/middleware/security.d.ts +22 -47
  189. package/dist/middleware/security.js +111 -137
  190. package/dist/parsers/base-parser.d.ts +14 -0
  191. package/dist/parsers/base-parser.js +1 -0
  192. package/dist/parsers/index.d.ts +16 -0
  193. package/dist/parsers/index.js +51 -0
  194. package/dist/parsers/openapi-parser.d.ts +18 -0
  195. package/dist/parsers/openapi-parser.js +209 -0
  196. package/dist/parsers/postman-parser.d.ts +20 -0
  197. package/dist/parsers/postman-parser.js +260 -0
  198. package/dist/parsers/specra-parser.d.ts +10 -0
  199. package/dist/parsers/specra-parser.js +18 -0
  200. package/dist/redirects.d.ts +12 -0
  201. package/dist/redirects.js +30 -0
  202. package/dist/remark-code-meta.d.ts +6 -0
  203. package/dist/remark-code-meta.js +21 -0
  204. package/dist/sidebar-utils.d.ts +59 -0
  205. package/dist/sidebar-utils.js +144 -0
  206. package/dist/stores/config.d.ts +20 -0
  207. package/dist/stores/config.js +45 -0
  208. package/dist/stores/index.d.ts +4 -0
  209. package/dist/stores/index.js +4 -0
  210. package/dist/stores/sidebar.d.ts +7 -0
  211. package/dist/stores/sidebar.js +12 -0
  212. package/dist/stores/tabs.d.ts +6 -0
  213. package/dist/stores/tabs.js +41 -0
  214. package/dist/stores/theme.d.ts +7 -0
  215. package/dist/stores/theme.js +75 -0
  216. package/dist/{styles.css → styles/globals.css} +136 -6
  217. package/dist/toc.d.ts +9 -0
  218. package/dist/toc.js +15 -0
  219. package/dist/utils.d.ts +13 -0
  220. package/dist/utils.js +30 -0
  221. package/package.json +47 -90
  222. package/dist/app/api/mdx-watch/route.d.mts +0 -10
  223. package/dist/app/api/mdx-watch/route.d.ts +0 -10
  224. package/dist/app/api/mdx-watch/route.js +0 -118
  225. package/dist/app/api/mdx-watch/route.js.map +0 -1
  226. package/dist/app/api/mdx-watch/route.mjs +0 -91
  227. package/dist/app/api/mdx-watch/route.mjs.map +0 -1
  228. package/dist/chunk-6S3EJVEO.mjs +0 -259
  229. package/dist/chunk-6S3EJVEO.mjs.map +0 -1
  230. package/dist/chunk-BE7EROIW.mjs +0 -212
  231. package/dist/chunk-BE7EROIW.mjs.map +0 -1
  232. package/dist/chunk-CWHRZHZO.mjs +0 -168
  233. package/dist/chunk-CWHRZHZO.mjs.map +0 -1
  234. package/dist/chunk-D5VDVYFY.mjs +0 -1325
  235. package/dist/chunk-D5VDVYFY.mjs.map +0 -1
  236. package/dist/chunk-WMCO2UX5.mjs +0 -585
  237. package/dist/chunk-WMCO2UX5.mjs.map +0 -1
  238. package/dist/chunk-XEMGCPZZ.mjs +0 -475
  239. package/dist/chunk-XEMGCPZZ.mjs.map +0 -1
  240. package/dist/components/index.d.mts +0 -822
  241. package/dist/components/index.js.map +0 -1
  242. package/dist/components/index.mjs +0 -3741
  243. package/dist/components/index.mjs.map +0 -1
  244. package/dist/index.d.mts +0 -4
  245. package/dist/index.js.map +0 -1
  246. package/dist/index.mjs +0 -1897
  247. package/dist/index.mjs.map +0 -1
  248. package/dist/layouts/index.d.mts +0 -34
  249. package/dist/layouts/index.d.ts +0 -34
  250. package/dist/layouts/index.js +0 -453
  251. package/dist/layouts/index.js.map +0 -1
  252. package/dist/layouts/index.mjs +0 -173
  253. package/dist/layouts/index.mjs.map +0 -1
  254. package/dist/lib/index.d.mts +0 -583
  255. package/dist/lib/index.d.ts +0 -583
  256. package/dist/lib/index.js +0 -1595
  257. package/dist/lib/index.js.map +0 -1
  258. package/dist/lib/index.mjs +0 -111
  259. package/dist/lib/index.mjs.map +0 -1
  260. package/dist/mdx-ColN3Cyg.d.ts +0 -352
  261. package/dist/mdx-components.d.mts +0 -86
  262. package/dist/mdx-components.d.ts +0 -86
  263. package/dist/mdx-components.js.map +0 -1
  264. package/dist/mdx-components.mjs +0 -206
  265. package/dist/mdx-components.mjs.map +0 -1
  266. package/dist/middleware/security.d.mts +0 -82
  267. package/dist/middleware/security.js.map +0 -1
  268. package/dist/middleware/security.mjs +0 -84
  269. package/dist/middleware/security.mjs.map +0 -1
  270. package/dist/styles.css.map +0 -1
  271. package/dist/styles.d.mts +0 -2
  272. package/dist/styles.d.ts +0 -2
  273. package/dist/styles.js +0 -2
  274. package/dist/styles.js.map +0 -1
  275. package/dist/styles.mjs +0 -1
  276. package/dist/styles.mjs.map +0 -1
@@ -1,583 +0,0 @@
1
- import { a as Doc, S as SpecraConfig } from '../mdx-ColN3Cyg.js';
2
- export { A as AnalyticsConfig, B as BannerConfig, q as DeploymentConfig, D as DocMeta, E as EnvironmentVariables, p as FeaturesConfig, F as FooterBranding, o as FooterConfig, I as I18nConfig, N as NavigationConfig, n as SearchConfig, j as SiteConfig, m as SocialLinks, l as TabGroup, k as ThemeConfig, T as TocItem, h as defaultConfig, f as extractTableOfContents, e as getAdjacentDocs, d as getAllDocs, c as getDocBySlug, b as getI18nConfig, g as getVersions, i as isCategoryPage } from '../mdx-ColN3Cyg.js';
3
- import { ClassValue } from 'clsx';
4
- import '../components/index.ts';
5
-
6
- /**
7
- * Caching layer for MDX operations to improve development performance
8
- *
9
- * This module provides in-memory caching for expensive file system operations
10
- * that occur during static generation. In development mode, caches are
11
- * invalidated automatically when files change.
12
- */
13
-
14
- /**
15
- * Cached version of getVersions()
16
- */
17
- declare function getCachedVersions(): string[];
18
- /**
19
- * Cached version of getAllDocs()
20
- */
21
- declare function getCachedAllDocs(version?: string, locale?: string): Promise<Doc[]>;
22
- /**
23
- * Cached version of getDocBySlug()
24
- */
25
- declare function getCachedDocBySlug(slug: string, version?: string): Promise<Doc | null>;
26
- /**
27
- * Manually clear all caches
28
- * Useful for testing or when you want to force a refresh
29
- */
30
- declare function clearAllCaches(): void;
31
- /**
32
- * Get cache statistics for debugging
33
- */
34
- declare function getCacheStats(): {
35
- versions: {
36
- cached: boolean;
37
- age: number;
38
- };
39
- allDocs: {
40
- entries: number;
41
- versions: string[];
42
- };
43
- docBySlug: {
44
- entries: number;
45
- };
46
- };
47
-
48
- interface TOCItem {
49
- id: string;
50
- title: string;
51
- level: number;
52
- }
53
- /**
54
- * Extract headings from HTML string for table of contents
55
- */
56
- declare function extractHeadings(html: string): TOCItem[];
57
-
58
- /**
59
- * Load and parse the Specra configuration file
60
- * Falls back to default configuration if file doesn't exist or is invalid
61
- */
62
- declare function loadConfig(userConfig: Partial<SpecraConfig>): SpecraConfig;
63
- /**
64
- * Get a specific configuration value by path (SERVER ONLY)
65
- * Example: getConfigValue('site.title') or getConfigValue('theme.defaultMode')
66
- */
67
- declare function getConfigValue<T = any>(path: string, config?: SpecraConfig): T | undefined;
68
- /**
69
- * Replace environment variables in a string (SERVER ONLY)
70
- * Supports ${ENV_VAR} and {{ENV_VAR}} syntax
71
- */
72
- declare function replaceEnvVariables(text: string, config?: SpecraConfig): string;
73
- /**
74
- * Process content and replace all environment variables (SERVER ONLY)
75
- */
76
- declare function processContentWithEnv(content: string, config?: SpecraConfig): string;
77
- /**
78
- * Validate configuration (basic validation) (SERVER ONLY)
79
- */
80
- declare function validateConfig(config: SpecraConfig): {
81
- valid: boolean;
82
- errors: string[];
83
- };
84
- /**
85
- * Initialize the Specra configuration
86
- * Can be called multiple times - subsequent calls will update the config
87
- * @param userConfig - Partial configuration to merge with defaults
88
- * @returns The initialized configuration
89
- */
90
- declare function initConfig(userConfig: Partial<SpecraConfig>): SpecraConfig;
91
- /**
92
- * Get the configuration instance (cached) (SERVER ONLY)
93
- * If not initialized, returns default config
94
- */
95
- declare function getConfig(): SpecraConfig;
96
- /**
97
- * Reload the configuration (useful for development) (SERVER ONLY)
98
- */
99
- declare function reloadConfig(userConfig: Partial<SpecraConfig>): SpecraConfig;
100
-
101
- /**
102
- * Simple API Documentation Format for Specra
103
- * Easy to write, easy to parse
104
- */
105
- interface ApiParam {
106
- name: string;
107
- type: string;
108
- required?: boolean;
109
- description?: string;
110
- default?: any;
111
- example?: any;
112
- }
113
- interface ApiHeader {
114
- name: string;
115
- value: string;
116
- description?: string;
117
- }
118
- interface ApiResponse$1 {
119
- status: number;
120
- description?: string;
121
- example?: any;
122
- schema?: any;
123
- }
124
- interface ApiEndpointSpec {
125
- title: string;
126
- method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
127
- path: string;
128
- description?: string;
129
- pathParams?: ApiParam[];
130
- queryParams?: ApiParam[];
131
- headers?: ApiHeader[];
132
- body?: {
133
- description?: string;
134
- example?: any;
135
- schema?: any;
136
- };
137
- successResponse?: ApiResponse$1;
138
- errorResponses?: ApiResponse$1[];
139
- examples?: {
140
- title: string;
141
- language: string;
142
- code: string;
143
- }[];
144
- }
145
- interface SpecraApiSpec {
146
- version?: string;
147
- title?: string;
148
- description?: string;
149
- baseUrl: string;
150
- env?: Record<string, string>;
151
- globalHeaders?: ApiHeader[];
152
- auth?: {
153
- type: "bearer" | "apiKey" | "basic";
154
- description?: string;
155
- headerName?: string;
156
- tokenPrefix?: string;
157
- };
158
- endpoints: ApiEndpointSpec[];
159
- }
160
-
161
- /**
162
- * Base interface for all API spec parsers
163
- */
164
- interface ApiSpecParser {
165
- /**
166
- * Parse the input spec and convert to Specra format
167
- */
168
- parse(input: any): SpecraApiSpec;
169
- /**
170
- * Validate if the input is in the expected format
171
- */
172
- validate(input: any): boolean;
173
- }
174
-
175
- /**
176
- * Parser for native Specra API format
177
- * This is a pass-through parser since the input is already in the correct format
178
- */
179
- declare class SpecraParser implements ApiSpecParser {
180
- validate(input: any): boolean;
181
- parse(input: any): SpecraApiSpec;
182
- }
183
-
184
- /**
185
- * Parser for OpenAPI 3.0/3.1 specifications
186
- */
187
- declare class OpenApiParser implements ApiSpecParser {
188
- validate(input: any): boolean;
189
- parse(input: any): SpecraApiSpec;
190
- private extractBaseUrl;
191
- private extractAuth;
192
- private parseOperation;
193
- private convertPathParams;
194
- private parseParameters;
195
- private parseRequestBody;
196
- private parseResponses;
197
- private generateExample;
198
- private resolveRef;
199
- }
200
-
201
- /**
202
- * Parser for Postman Collection v2.0/v2.1
203
- */
204
- declare class PostmanParser implements ApiSpecParser {
205
- validate(input: any): boolean;
206
- parse(input: any): SpecraApiSpec;
207
- private extractBaseUrl;
208
- private findFirstRequest;
209
- private extractAuth;
210
- private extractGlobalHeaders;
211
- private parseItems;
212
- private parseRequest;
213
- private parseUrl;
214
- private buildPath;
215
- private parseUrlParams;
216
- private parseBody;
217
- private parseResponses;
218
- }
219
-
220
- type ParserType = "auto" | "specra" | "openapi" | "postman";
221
- /**
222
- * Auto-detect the parser type based on the input structure
223
- */
224
- declare function detectParserType(input: any): ParserType;
225
- /**
226
- * Parse an API spec using the specified or auto-detected parser
227
- */
228
- declare function parseApiSpec(input: any, parserType?: ParserType): SpecraApiSpec;
229
-
230
- /**
231
- * Specra API Documentation Schema
232
- * Supports REST, GraphQL, and WebSocket APIs
233
- */
234
- type HttpMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS";
235
- interface ApiParameter {
236
- name: string;
237
- type: string;
238
- required?: boolean;
239
- description?: string;
240
- default?: any;
241
- example?: any;
242
- enum?: string[];
243
- }
244
- interface ApiResponse {
245
- status: number;
246
- description: string;
247
- schema?: any;
248
- example?: any;
249
- headers?: Record<string, string>;
250
- }
251
- interface ApiExample {
252
- title: string;
253
- language: string;
254
- code: string;
255
- }
256
- interface ApiAuthentication {
257
- type: "apiKey" | "bearer" | "basic" | "oauth2" | "none";
258
- description?: string;
259
- location?: "header" | "query" | "cookie";
260
- name?: string;
261
- scheme?: string;
262
- }
263
- interface RestEndpoint {
264
- type: "rest";
265
- method: HttpMethod;
266
- path: string;
267
- summary: string;
268
- description?: string;
269
- operationId?: string;
270
- tags?: string[];
271
- deprecated?: boolean;
272
- authentication?: ApiAuthentication;
273
- pathParams?: ApiParameter[];
274
- queryParams?: ApiParameter[];
275
- headers?: ApiParameter[];
276
- body?: {
277
- contentType: string;
278
- schema?: any;
279
- example?: any;
280
- description?: string;
281
- };
282
- responses: ApiResponse[];
283
- examples?: ApiExample[];
284
- }
285
- interface GraphQLField {
286
- name: string;
287
- type: string;
288
- description?: string;
289
- args?: ApiParameter[];
290
- deprecated?: boolean;
291
- deprecationReason?: string;
292
- }
293
- interface GraphQLType {
294
- name: string;
295
- kind: "OBJECT" | "INPUT_OBJECT" | "ENUM" | "SCALAR" | "INTERFACE" | "UNION";
296
- description?: string;
297
- fields?: GraphQLField[];
298
- enumValues?: {
299
- name: string;
300
- description?: string;
301
- }[];
302
- }
303
- interface GraphQLQuery {
304
- type: "graphql";
305
- operationType: "query" | "mutation" | "subscription";
306
- name: string;
307
- description?: string;
308
- args?: ApiParameter[];
309
- returnType: string;
310
- example?: string;
311
- response?: any;
312
- }
313
- interface GraphQLSchema {
314
- queries?: GraphQLQuery[];
315
- mutations?: GraphQLQuery[];
316
- subscriptions?: GraphQLQuery[];
317
- types?: GraphQLType[];
318
- }
319
- interface WebSocketEvent {
320
- type: "websocket";
321
- event: string;
322
- direction: "client-to-server" | "server-to-client" | "bidirectional";
323
- description?: string;
324
- payload?: {
325
- schema?: any;
326
- example?: any;
327
- };
328
- response?: {
329
- schema?: any;
330
- example?: any;
331
- };
332
- }
333
- interface WebSocketConnection {
334
- url: string;
335
- authentication?: ApiAuthentication;
336
- description?: string;
337
- events: WebSocketEvent[];
338
- }
339
- interface ApiDocumentation {
340
- version: string;
341
- title: string;
342
- description?: string;
343
- baseUrl?: string;
344
- servers?: Array<{
345
- url: string;
346
- description?: string;
347
- }>;
348
- rest?: {
349
- endpoints: RestEndpoint[];
350
- };
351
- graphql?: GraphQLSchema;
352
- websocket?: WebSocketConnection[];
353
- authentication?: ApiAuthentication[];
354
- headers?: Record<string, string>;
355
- }
356
- interface ApiSpecConfig {
357
- source: "openapi" | "postman" | "insomnia" | "specra" | "manual";
358
- path?: string;
359
- spec?: ApiDocumentation;
360
- autoGenerate?: boolean;
361
- outputDir?: string;
362
- }
363
- interface ParsedApiSpec {
364
- source: ApiSpecConfig["source"];
365
- documentation: ApiDocumentation;
366
- }
367
-
368
- declare function cn(...inputs: ClassValue[]): string;
369
- /**
370
- * Get the correct asset path based on deployment configuration
371
- * Handles different deployment scenarios:
372
- * - Vercel/Node.js hosting (standalone build): No basePath needed
373
- * - GitHub Pages without custom domain: Uses basePath from config
374
- * - Static hosting with custom domain: No basePath needed
375
- *
376
- * @param path - The asset path (can start with or without '/')
377
- * @returns The properly formatted asset path
378
- */
379
- declare function getAssetPath(path: string): string;
380
-
381
- /**
382
- * Unified sidebar sorting and structure building utilities
383
- * This module provides consistent sidebar logic across the application
384
- * to ensure ordering is handled the same way everywhere.
385
- */
386
- interface SidebarGroup {
387
- label: string;
388
- path: string;
389
- icon?: string;
390
- items: any[];
391
- position: number;
392
- collapsible: boolean;
393
- defaultCollapsed: boolean;
394
- children: Record<string, SidebarGroup>;
395
- }
396
- /**
397
- * Sort sidebar items by their position.
398
- * Items with explicit sidebar_position come first (sorted numerically),
399
- * followed by items without position (sorted by their original order).
400
- *
401
- * @param items - Array of items with optional sidebar_position
402
- * @returns Sorted array of items
403
- */
404
- declare function sortSidebarItems<T extends {
405
- sidebar_position?: number;
406
- meta?: any;
407
- }>(items: T[]): T[];
408
- /**
409
- * Sort sidebar groups by their position.
410
- * Groups with explicit position come first (sorted numerically),
411
- * followed by groups without position at the end (sorted by their original order).
412
- *
413
- * @param groups - Record of group key to group object with position
414
- * @returns Sorted array of [key, group] tuples
415
- */
416
- declare function sortSidebarGroups<T extends {
417
- position: number;
418
- }>(groups: Record<string, T>): [string, T][];
419
- /**
420
- * Build hierarchical sidebar structure from flat list of documents
421
- * This is the single source of truth for sidebar structure used by both
422
- * the sidebar component and navigation (prev/next) links.
423
- *
424
- * @param docs - Array of documents with metadata
425
- * @returns Object containing root groups and standalone items
426
- */
427
- declare function buildSidebarStructure<T extends {
428
- filePath: string;
429
- slug: string;
430
- categoryLabel?: string;
431
- categoryPosition?: number;
432
- categoryIcon?: string;
433
- categoryCollapsible?: boolean;
434
- categoryCollapsed?: boolean;
435
- meta: any;
436
- }>(docs: T[]): {
437
- rootGroups: Record<string, SidebarGroup>;
438
- standalone: T[];
439
- };
440
-
441
- interface CategoryConfig {
442
- label?: string;
443
- position?: number;
444
- sidebar_position?: number;
445
- link?: {
446
- type: "generated-index" | "doc";
447
- slug?: string;
448
- };
449
- collapsed?: boolean;
450
- collapsible?: boolean;
451
- icon?: string;
452
- tab_group?: string;
453
- }
454
- /**
455
- * Read category.json from a folder
456
- */
457
- declare function getCategoryConfig(folderPath: string): CategoryConfig | null;
458
- /**
459
- * Get all category configs for a version
460
- */
461
- declare function getAllCategoryConfigs(version: string): Map<string, CategoryConfig>;
462
-
463
- interface RedirectMapping {
464
- from: string;
465
- to: string;
466
- }
467
- /**
468
- * Build redirect mappings from all docs' redirect_from frontmatter
469
- */
470
- declare function buildRedirectMappings(): Promise<RedirectMapping[]>;
471
- /**
472
- * Find redirect destination for a given path
473
- */
474
- declare function findRedirect(path: string): Promise<string | null>;
475
-
476
- /**
477
- * Development utilities for debugging and performance monitoring
478
- * Only active in development mode
479
- */
480
- /**
481
- * Performance timer for measuring operation duration
482
- */
483
- declare class PerfTimer {
484
- private startTime;
485
- private label;
486
- constructor(label: string);
487
- end(): void;
488
- }
489
- /**
490
- * Log file system operations
491
- */
492
- declare function logFsOperation(operation: string, path: string, details?: any): void;
493
- /**
494
- * Log cache operations
495
- */
496
- declare function logCacheOperation(operation: 'hit' | 'miss' | 'invalidate', key: string): void;
497
- /**
498
- * Memory usage reporter
499
- */
500
- declare function logMemoryUsage(label?: string): void;
501
- /**
502
- * Pretty print object for debugging
503
- */
504
- declare function debugLog(label: string, data: any): void;
505
-
506
- /**
507
- * MDX Security Layer
508
- *
509
- * Protects against:
510
- * - XSS via malicious MDX expressions
511
- * - Path traversal attacks
512
- * - Dangerous component usage
513
- * - Cross-domain vulnerabilities
514
- */
515
- /**
516
- * Sanitize file paths to prevent path traversal attacks
517
- * Blocks: ../, ..\, absolute paths, encoded traversal attempts
518
- */
519
- declare function sanitizePath(userPath: string): string;
520
- /**
521
- * Validate that a file path is within allowed directory
522
- */
523
- declare function validatePathWithinDirectory(filePath: string, allowedDir: string): boolean;
524
- /**
525
- * Scan MDX content for dangerous patterns
526
- * Returns array of detected issues
527
- * Note: Skips content inside code blocks to avoid false positives
528
- */
529
- declare function scanMDXForDangerousPatterns(content: string): string[];
530
- /**
531
- * Sanitize MDX content by removing/escaping dangerous patterns
532
- * This is a defensive measure - ideally content should be rejected if dangerous
533
- */
534
- declare function sanitizeMDXContent(content: string, strict?: boolean): string;
535
- /**
536
- * Content Security Policy configuration
537
- * Use this in your Next.js middleware or headers config
538
- */
539
- declare const CSP_DIRECTIVES: {
540
- readonly "default-src": readonly ["'self'"];
541
- readonly "script-src": readonly ["'self'", "'unsafe-inline'", "'unsafe-eval'"];
542
- readonly "style-src": readonly ["'self'", "'unsafe-inline'"];
543
- readonly "img-src": readonly ["'self'", "data:", "https:"];
544
- readonly "font-src": readonly ["'self'", "data:"];
545
- readonly "connect-src": readonly ["'self'"];
546
- readonly "frame-src": readonly ["'self'"];
547
- readonly "object-src": readonly ["'none'"];
548
- readonly "base-uri": readonly ["'self'"];
549
- readonly "form-action": readonly ["'self'"];
550
- readonly "frame-ancestors": readonly ["'self'"];
551
- readonly "upgrade-insecure-requests": readonly [];
552
- };
553
- /**
554
- * Generate CSP header value from directives
555
- */
556
- declare function generateCSPHeader(customDirectives?: Partial<typeof CSP_DIRECTIVES>, production?: boolean): string;
557
- /**
558
- * Allowlist of safe MDX components
559
- * Only these components can be used in MDX files
560
- */
561
- declare const SAFE_MDX_COMPONENTS: Set<string>;
562
- /**
563
- * Validate component usage in MDX
564
- */
565
- declare function validateMDXComponents(content: string): {
566
- valid: boolean;
567
- issues: string[];
568
- };
569
- /**
570
- * Comprehensive MDX security check
571
- * Use this before processing MDX content
572
- */
573
- declare function validateMDXSecurity(content: string, options?: {
574
- strictMode?: boolean;
575
- allowCustomComponents?: boolean;
576
- blockDangerousPatterns?: boolean;
577
- }): {
578
- valid: boolean;
579
- issues: string[];
580
- sanitized?: string;
581
- };
582
-
583
- export { type ApiAuthentication, type ApiDocumentation, type ApiEndpointSpec, type ApiExample, type ApiHeader, type ApiParam, type ApiParameter, type ApiResponse, type ApiSpecConfig, type ApiSpecParser, CSP_DIRECTIVES, type CategoryConfig, Doc, type GraphQLField, type GraphQLQuery, type GraphQLSchema, type GraphQLType, type HttpMethod, OpenApiParser, type ParsedApiSpec, type ParserType, PerfTimer, PostmanParser, type RedirectMapping, type RestEndpoint, SAFE_MDX_COMPONENTS, type SidebarGroup, type ApiResponse$1 as SpecraApiResponse, type SpecraApiSpec, SpecraConfig, SpecraParser, type TOCItem, type WebSocketConnection, type WebSocketEvent, buildRedirectMappings, buildSidebarStructure, clearAllCaches, cn, debugLog, detectParserType, extractHeadings, findRedirect, generateCSPHeader, getAllCategoryConfigs, getAssetPath, getCacheStats, getCachedAllDocs, getCachedDocBySlug, getCachedVersions, getCategoryConfig, getConfig, getConfigValue, initConfig, loadConfig, logCacheOperation, logFsOperation, logMemoryUsage, parseApiSpec, processContentWithEnv, reloadConfig, replaceEnvVariables, sanitizeMDXContent, sanitizePath, scanMDXForDangerousPatterns, sortSidebarGroups, sortSidebarItems, validateConfig, validateMDXComponents, validateMDXSecurity, validatePathWithinDirectory };