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.
- package/LICENSE.MD +25 -4
- package/README.md +67 -58
- package/config/specra.config.schema.json +16 -0
- package/config/svelte-config.js +63 -0
- package/dist/api-parser.types.d.ts +59 -0
- package/dist/api-parser.types.js +5 -0
- package/dist/api.types.d.ts +137 -0
- package/dist/api.types.js +5 -0
- package/dist/category.d.ts +21 -0
- package/dist/category.js +48 -0
- package/dist/components/ConfigProvider.svelte +13 -0
- package/dist/components/ConfigProvider.svelte.d.ts +31 -0
- package/dist/components/docs/Accordion.svelte +18 -0
- package/dist/components/docs/Accordion.svelte.d.ts +10 -0
- package/dist/components/docs/AccordionItem.svelte +41 -0
- package/dist/components/docs/AccordionItem.svelte.d.ts +10 -0
- package/dist/components/docs/Badge.svelte +28 -0
- package/dist/components/docs/Badge.svelte.d.ts +9 -0
- package/dist/components/docs/Breadcrumb.svelte +80 -0
- package/dist/components/docs/Breadcrumb.svelte.d.ts +8 -0
- package/dist/components/docs/Callout.svelte +96 -0
- package/dist/components/docs/Callout.svelte.d.ts +10 -0
- package/dist/components/docs/Card.svelte +63 -0
- package/dist/components/docs/Card.svelte.d.ts +12 -0
- package/dist/components/docs/CardGrid.svelte +24 -0
- package/dist/components/docs/CardGrid.svelte.d.ts +8 -0
- package/dist/components/docs/CategoryIndex.svelte +110 -0
- package/dist/components/docs/CategoryIndex.svelte.d.ts +29 -0
- package/dist/components/docs/CodeBlock.svelte +172 -0
- package/dist/components/docs/CodeBlock.svelte.d.ts +8 -0
- package/dist/components/docs/Column.svelte +25 -0
- package/dist/components/docs/Column.svelte.d.ts +8 -0
- package/dist/components/docs/Columns.svelte +38 -0
- package/dist/components/docs/Columns.svelte.d.ts +13 -0
- package/dist/components/docs/DevModeBadge.svelte +15 -0
- package/dist/components/docs/DevModeBadge.svelte.d.ts +18 -0
- package/dist/components/docs/DocBadge.svelte +28 -0
- package/dist/components/docs/DocBadge.svelte.d.ts +9 -0
- package/dist/components/docs/DocLayout.svelte +107 -0
- package/dist/components/docs/DocLayout.svelte.d.ts +32 -0
- package/dist/components/docs/DocLoading.svelte +53 -0
- package/dist/components/docs/DocLoading.svelte.d.ts +18 -0
- package/dist/components/docs/DocMetadata.svelte +106 -0
- package/dist/components/docs/DocMetadata.svelte.d.ts +18 -0
- package/dist/components/docs/DocNavigation.svelte +56 -0
- package/dist/components/docs/DocNavigation.svelte.d.ts +12 -0
- package/dist/components/docs/DocTags.svelte +22 -0
- package/dist/components/docs/DocTags.svelte.d.ts +6 -0
- package/dist/components/docs/DraftBadge.svelte +10 -0
- package/dist/components/docs/DraftBadge.svelte.d.ts +18 -0
- package/dist/components/docs/Footer.svelte +72 -0
- package/dist/components/docs/Footer.svelte.d.ts +7 -0
- package/dist/components/docs/Frame.svelte +27 -0
- package/dist/components/docs/Frame.svelte.d.ts +9 -0
- package/dist/components/docs/Header.svelte +123 -0
- package/dist/components/docs/Header.svelte.d.ts +9 -0
- package/dist/components/docs/HeaderWithMenu.svelte +34 -0
- package/dist/components/docs/HeaderWithMenu.svelte.d.ts +17 -0
- package/dist/components/docs/HotReloadIndicator.svelte +44 -0
- package/dist/components/docs/HotReloadIndicator.svelte.d.ts +3 -0
- package/dist/components/docs/Icon.svelte +103 -0
- package/dist/components/docs/Icon.svelte.d.ts +11 -0
- package/dist/components/docs/Image.svelte +88 -0
- package/dist/components/docs/Image.svelte.d.ts +11 -0
- package/dist/components/docs/ImageCard.svelte +91 -0
- package/dist/components/docs/ImageCard.svelte.d.ts +12 -0
- package/dist/components/docs/ImageCardGrid.svelte +25 -0
- package/dist/components/docs/ImageCardGrid.svelte.d.ts +8 -0
- package/dist/components/docs/LayoutProviders.svelte +57 -0
- package/dist/components/docs/LayoutProviders.svelte.d.ts +9 -0
- package/dist/components/docs/Logo.svelte +25 -0
- package/dist/components/docs/Logo.svelte.d.ts +11 -0
- package/dist/components/docs/Math.svelte +54 -0
- package/dist/components/docs/Math.svelte.d.ts +7 -0
- package/dist/components/docs/MdxContent.svelte +41 -0
- package/dist/components/docs/MdxHotReload.svelte +78 -0
- package/dist/components/docs/MdxHotReload.svelte.d.ts +9 -0
- package/dist/components/docs/MdxLayout.svelte +16 -0
- package/dist/components/docs/MdxLayout.svelte.d.ts +6 -0
- package/dist/components/docs/Mermaid.svelte +88 -0
- package/dist/components/docs/Mermaid.svelte.d.ts +7 -0
- package/dist/components/docs/MobileDocLayout.svelte +211 -0
- package/dist/components/docs/MobileDocLayout.svelte.d.ts +35 -0
- package/dist/components/docs/MobileSidebar.svelte +122 -0
- package/dist/components/docs/MobileSidebar.svelte.d.ts +31 -0
- package/dist/components/docs/MobileSidebarWrapper.svelte +122 -0
- package/dist/components/docs/MobileSidebarWrapper.svelte.d.ts +32 -0
- package/dist/components/docs/NotFoundContent.svelte +40 -0
- package/dist/components/docs/NotFoundContent.svelte.d.ts +6 -0
- package/dist/components/docs/SearchHighlight.svelte +116 -0
- package/dist/components/docs/SearchHighlight.svelte.d.ts +3 -0
- package/dist/components/docs/SearchModal.svelte +239 -0
- package/dist/components/docs/SearchModal.svelte.d.ts +9 -0
- package/dist/components/docs/Sidebar.svelte +69 -0
- package/dist/components/docs/Sidebar.svelte.d.ts +31 -0
- package/dist/components/docs/SidebarMenuItems.svelte +344 -0
- package/dist/components/docs/SidebarMenuItems.svelte.d.ts +33 -0
- package/dist/components/docs/SidebarSkeleton.svelte +50 -0
- package/dist/components/docs/SidebarSkeleton.svelte.d.ts +18 -0
- package/dist/components/docs/SiteBanner.svelte +92 -0
- package/dist/components/docs/SiteBanner.svelte.d.ts +7 -0
- package/dist/components/docs/Step.svelte +44 -0
- package/dist/components/docs/Step.svelte.d.ts +8 -0
- package/dist/components/docs/Steps.svelte +15 -0
- package/dist/components/docs/Steps.svelte.d.ts +7 -0
- package/dist/components/docs/Tab.svelte +40 -0
- package/dist/components/docs/Tab.svelte.d.ts +8 -0
- package/dist/components/docs/TabGroups.svelte +183 -0
- package/dist/components/docs/TabGroups.svelte.d.ts +25 -0
- package/dist/components/docs/TableOfContents.svelte +100 -0
- package/dist/components/docs/TableOfContents.svelte.d.ts +9 -0
- package/dist/components/docs/Tabs.svelte +69 -0
- package/dist/components/docs/Tabs.svelte.d.ts +8 -0
- package/dist/components/docs/ThemeToggle.svelte +16 -0
- package/dist/components/docs/ThemeToggle.svelte.d.ts +18 -0
- package/dist/components/docs/Tooltip.svelte +44 -0
- package/dist/components/docs/Tooltip.svelte.d.ts +10 -0
- package/dist/components/docs/VersionSwitcher.svelte +95 -0
- package/dist/components/docs/VersionSwitcher.svelte.d.ts +7 -0
- package/dist/components/docs/Video.svelte +84 -0
- package/dist/components/docs/Video.svelte.d.ts +12 -0
- package/dist/components/docs/api/ApiEndpoint.svelte +61 -0
- package/dist/components/docs/api/ApiEndpoint.svelte.d.ts +11 -0
- package/dist/components/docs/api/ApiParams.svelte +80 -0
- package/dist/components/docs/api/ApiParams.svelte.d.ts +14 -0
- package/dist/components/docs/api/ApiPlayground.svelte +259 -0
- package/dist/components/docs/api/ApiPlayground.svelte.d.ts +16 -0
- package/dist/components/docs/api/ApiReference.svelte +278 -0
- package/dist/components/docs/api/ApiReference.svelte.d.ts +23 -0
- package/dist/components/docs/api/ApiResponse.svelte +66 -0
- package/dist/components/docs/api/ApiResponse.svelte.d.ts +9 -0
- package/dist/components/docs/api/index.d.ts +5 -0
- package/dist/components/docs/api/index.js +5 -0
- package/dist/components/docs/componentTextProps.d.ts +3 -0
- package/dist/components/docs/componentTextProps.js +61 -0
- package/dist/components/docs/index.d.ts +54 -0
- package/dist/components/docs/index.js +56 -0
- package/dist/components/global/VersionNotFound.svelte +48 -0
- package/dist/components/global/VersionNotFound.svelte.d.ts +7 -0
- package/dist/components/global/index.d.ts +1 -0
- package/dist/components/global/index.js +1 -0
- package/dist/components/index.d.ts +6 -822
- package/dist/components/index.js +11 -3854
- package/dist/components/ui/Badge.svelte +48 -0
- package/dist/components/ui/Badge.svelte.d.ts +15 -0
- package/dist/components/ui/Button.svelte +58 -0
- package/dist/components/ui/Button.svelte.d.ts +17 -0
- package/dist/components/ui/Dialog.svelte +16 -0
- package/dist/components/ui/Dialog.svelte.d.ts +9 -0
- package/dist/components/ui/DialogClose.svelte +16 -0
- package/dist/components/ui/DialogClose.svelte.d.ts +9 -0
- package/dist/components/ui/DialogContent.svelte +43 -0
- package/dist/components/ui/DialogContent.svelte.d.ts +10 -0
- package/dist/components/ui/DialogDescription.svelte +21 -0
- package/dist/components/ui/DialogDescription.svelte.d.ts +9 -0
- package/dist/components/ui/DialogFooter.svelte +20 -0
- package/dist/components/ui/DialogFooter.svelte.d.ts +9 -0
- package/dist/components/ui/DialogHeader.svelte +20 -0
- package/dist/components/ui/DialogHeader.svelte.d.ts +9 -0
- package/dist/components/ui/DialogTitle.svelte +21 -0
- package/dist/components/ui/DialogTitle.svelte.d.ts +9 -0
- package/dist/components/ui/Input.svelte +23 -0
- package/dist/components/ui/Input.svelte.d.ts +8 -0
- package/dist/components/ui/Textarea.svelte +19 -0
- package/dist/components/ui/Textarea.svelte.d.ts +7 -0
- package/dist/components/ui/index.d.ts +11 -0
- package/dist/components/ui/index.js +11 -0
- package/dist/config.d.ts +8 -0
- package/dist/config.js +9 -0
- package/dist/config.schema.json +471 -0
- package/dist/config.server.d.ts +46 -0
- package/dist/config.server.js +149 -0
- package/dist/{mdx-ColN3Cyg.d.mts → config.types.d.ts} +22 -75
- package/dist/config.types.js +39 -0
- package/dist/dev-utils.d.ts +29 -0
- package/dist/dev-utils.js +63 -0
- package/dist/index.d.ts +19 -4
- package/dist/index.js +25 -4861
- package/dist/mdx-cache.d.ts +41 -0
- package/dist/mdx-cache.js +160 -0
- package/dist/mdx-components.js +50 -1931
- package/dist/mdx-security.d.ts +76 -0
- package/dist/mdx-security.js +217 -0
- package/dist/mdx.d.ts +73 -0
- package/dist/mdx.js +1099 -0
- package/dist/middleware/index.d.ts +1 -0
- package/dist/middleware/index.js +2 -0
- package/dist/middleware/security.d.ts +22 -47
- package/dist/middleware/security.js +111 -137
- package/dist/parsers/base-parser.d.ts +14 -0
- package/dist/parsers/base-parser.js +1 -0
- package/dist/parsers/index.d.ts +16 -0
- package/dist/parsers/index.js +51 -0
- package/dist/parsers/openapi-parser.d.ts +18 -0
- package/dist/parsers/openapi-parser.js +209 -0
- package/dist/parsers/postman-parser.d.ts +20 -0
- package/dist/parsers/postman-parser.js +260 -0
- package/dist/parsers/specra-parser.d.ts +10 -0
- package/dist/parsers/specra-parser.js +18 -0
- package/dist/redirects.d.ts +12 -0
- package/dist/redirects.js +30 -0
- package/dist/remark-code-meta.d.ts +6 -0
- package/dist/remark-code-meta.js +21 -0
- package/dist/sidebar-utils.d.ts +59 -0
- package/dist/sidebar-utils.js +144 -0
- package/dist/stores/config.d.ts +20 -0
- package/dist/stores/config.js +45 -0
- package/dist/stores/index.d.ts +4 -0
- package/dist/stores/index.js +4 -0
- package/dist/stores/sidebar.d.ts +7 -0
- package/dist/stores/sidebar.js +12 -0
- package/dist/stores/tabs.d.ts +6 -0
- package/dist/stores/tabs.js +41 -0
- package/dist/stores/theme.d.ts +7 -0
- package/dist/stores/theme.js +75 -0
- package/dist/{styles.css → styles/globals.css} +136 -6
- package/dist/toc.d.ts +9 -0
- package/dist/toc.js +15 -0
- package/dist/utils.d.ts +13 -0
- package/dist/utils.js +30 -0
- package/package.json +47 -90
- package/dist/app/api/mdx-watch/route.d.mts +0 -10
- package/dist/app/api/mdx-watch/route.d.ts +0 -10
- package/dist/app/api/mdx-watch/route.js +0 -118
- package/dist/app/api/mdx-watch/route.js.map +0 -1
- package/dist/app/api/mdx-watch/route.mjs +0 -91
- package/dist/app/api/mdx-watch/route.mjs.map +0 -1
- package/dist/chunk-6S3EJVEO.mjs +0 -259
- package/dist/chunk-6S3EJVEO.mjs.map +0 -1
- package/dist/chunk-BE7EROIW.mjs +0 -212
- package/dist/chunk-BE7EROIW.mjs.map +0 -1
- package/dist/chunk-CWHRZHZO.mjs +0 -168
- package/dist/chunk-CWHRZHZO.mjs.map +0 -1
- package/dist/chunk-D5VDVYFY.mjs +0 -1325
- package/dist/chunk-D5VDVYFY.mjs.map +0 -1
- package/dist/chunk-WMCO2UX5.mjs +0 -585
- package/dist/chunk-WMCO2UX5.mjs.map +0 -1
- package/dist/chunk-XEMGCPZZ.mjs +0 -475
- package/dist/chunk-XEMGCPZZ.mjs.map +0 -1
- package/dist/components/index.d.mts +0 -822
- package/dist/components/index.js.map +0 -1
- package/dist/components/index.mjs +0 -3741
- package/dist/components/index.mjs.map +0 -1
- package/dist/index.d.mts +0 -4
- package/dist/index.js.map +0 -1
- package/dist/index.mjs +0 -1897
- package/dist/index.mjs.map +0 -1
- package/dist/layouts/index.d.mts +0 -34
- package/dist/layouts/index.d.ts +0 -34
- package/dist/layouts/index.js +0 -453
- package/dist/layouts/index.js.map +0 -1
- package/dist/layouts/index.mjs +0 -173
- package/dist/layouts/index.mjs.map +0 -1
- package/dist/lib/index.d.mts +0 -583
- package/dist/lib/index.d.ts +0 -583
- package/dist/lib/index.js +0 -1595
- package/dist/lib/index.js.map +0 -1
- package/dist/lib/index.mjs +0 -111
- package/dist/lib/index.mjs.map +0 -1
- package/dist/mdx-ColN3Cyg.d.ts +0 -352
- package/dist/mdx-components.d.mts +0 -86
- package/dist/mdx-components.d.ts +0 -86
- package/dist/mdx-components.js.map +0 -1
- package/dist/mdx-components.mjs +0 -206
- package/dist/mdx-components.mjs.map +0 -1
- package/dist/middleware/security.d.mts +0 -82
- package/dist/middleware/security.js.map +0 -1
- package/dist/middleware/security.mjs +0 -84
- package/dist/middleware/security.mjs.map +0 -1
- package/dist/styles.css.map +0 -1
- package/dist/styles.d.mts +0 -2
- package/dist/styles.d.ts +0 -2
- package/dist/styles.js +0 -2
- package/dist/styles.js.map +0 -1
- package/dist/styles.mjs +0 -1
- package/dist/styles.mjs.map +0 -1
package/dist/lib/index.d.ts
DELETED
|
@@ -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 };
|