jamdesk 1.0.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/README.md +323 -0
- package/bin/jamdesk.js +76 -0
- package/dist/__tests__/integration/deprecated-components.integration.test.d.ts +8 -0
- package/dist/__tests__/integration/deprecated-components.integration.test.d.ts.map +1 -0
- package/dist/__tests__/integration/deprecated-components.integration.test.js +165 -0
- package/dist/__tests__/integration/deprecated-components.integration.test.js.map +1 -0
- package/dist/__tests__/integration/migrate.integration.test.d.ts +2 -0
- package/dist/__tests__/integration/migrate.integration.test.d.ts.map +1 -0
- package/dist/__tests__/integration/migrate.integration.test.js +64 -0
- package/dist/__tests__/integration/migrate.integration.test.js.map +1 -0
- package/dist/__tests__/integration/prepublish.integration.test.d.ts +2 -0
- package/dist/__tests__/integration/prepublish.integration.test.d.ts.map +1 -0
- package/dist/__tests__/integration/prepublish.integration.test.js +27 -0
- package/dist/__tests__/integration/prepublish.integration.test.js.map +1 -0
- package/dist/__tests__/integration/validate.integration.test.d.ts +2 -0
- package/dist/__tests__/integration/validate.integration.test.d.ts.map +1 -0
- package/dist/__tests__/integration/validate.integration.test.js +56 -0
- package/dist/__tests__/integration/validate.integration.test.js.map +1 -0
- package/dist/__tests__/unit/deploy-templates.test.d.ts +2 -0
- package/dist/__tests__/unit/deploy-templates.test.d.ts.map +1 -0
- package/dist/__tests__/unit/deploy-templates.test.js +124 -0
- package/dist/__tests__/unit/deploy-templates.test.js.map +1 -0
- package/dist/__tests__/unit/deprecated-components-sync.test.d.ts +2 -0
- package/dist/__tests__/unit/deprecated-components-sync.test.d.ts.map +1 -0
- package/dist/__tests__/unit/deprecated-components-sync.test.js +69 -0
- package/dist/__tests__/unit/deprecated-components-sync.test.js.map +1 -0
- package/dist/__tests__/unit/deps-sync.test.d.ts +14 -0
- package/dist/__tests__/unit/deps-sync.test.d.ts.map +1 -0
- package/dist/__tests__/unit/deps-sync.test.js +166 -0
- package/dist/__tests__/unit/deps-sync.test.js.map +1 -0
- package/dist/__tests__/unit/docs-config.test.d.ts +2 -0
- package/dist/__tests__/unit/docs-config.test.d.ts.map +1 -0
- package/dist/__tests__/unit/docs-config.test.js +288 -0
- package/dist/__tests__/unit/docs-config.test.js.map +1 -0
- package/dist/__tests__/unit/errors.test.d.ts +2 -0
- package/dist/__tests__/unit/errors.test.d.ts.map +1 -0
- package/dist/__tests__/unit/errors.test.js +27 -0
- package/dist/__tests__/unit/errors.test.js.map +1 -0
- package/dist/__tests__/unit/extract-hooks.test.d.ts +5 -0
- package/dist/__tests__/unit/extract-hooks.test.d.ts.map +1 -0
- package/dist/__tests__/unit/extract-hooks.test.js +205 -0
- package/dist/__tests__/unit/extract-hooks.test.js.map +1 -0
- package/dist/__tests__/unit/frontmatter-sync.test.d.ts +8 -0
- package/dist/__tests__/unit/frontmatter-sync.test.d.ts.map +1 -0
- package/dist/__tests__/unit/frontmatter-sync.test.js +26 -0
- package/dist/__tests__/unit/frontmatter-sync.test.js.map +1 -0
- package/dist/__tests__/unit/mdx-validator.test.d.ts +2 -0
- package/dist/__tests__/unit/mdx-validator.test.d.ts.map +1 -0
- package/dist/__tests__/unit/mdx-validator.test.js +264 -0
- package/dist/__tests__/unit/mdx-validator.test.js.map +1 -0
- package/dist/__tests__/unit/migrate-convert.test.d.ts +2 -0
- package/dist/__tests__/unit/migrate-convert.test.d.ts.map +1 -0
- package/dist/__tests__/unit/migrate-convert.test.js +297 -0
- package/dist/__tests__/unit/migrate-convert.test.js.map +1 -0
- package/dist/__tests__/unit/migrate-detect.test.d.ts +2 -0
- package/dist/__tests__/unit/migrate-detect.test.d.ts.map +1 -0
- package/dist/__tests__/unit/migrate-detect.test.js +35 -0
- package/dist/__tests__/unit/migrate-detect.test.js.map +1 -0
- package/dist/__tests__/unit/migrate-mdx.test.d.ts +2 -0
- package/dist/__tests__/unit/migrate-mdx.test.d.ts.map +1 -0
- package/dist/__tests__/unit/migrate-mdx.test.js +158 -0
- package/dist/__tests__/unit/migrate-mdx.test.js.map +1 -0
- package/dist/__tests__/unit/openapi.test.d.ts +2 -0
- package/dist/__tests__/unit/openapi.test.d.ts.map +1 -0
- package/dist/__tests__/unit/openapi.test.js +52 -0
- package/dist/__tests__/unit/openapi.test.js.map +1 -0
- package/dist/__tests__/unit/package-config.test.d.ts +2 -0
- package/dist/__tests__/unit/package-config.test.d.ts.map +1 -0
- package/dist/__tests__/unit/package-config.test.js +63 -0
- package/dist/__tests__/unit/package-config.test.js.map +1 -0
- package/dist/__tests__/unit/port.test.d.ts +2 -0
- package/dist/__tests__/unit/port.test.d.ts.map +1 -0
- package/dist/__tests__/unit/port.test.js +20 -0
- package/dist/__tests__/unit/port.test.js.map +1 -0
- package/dist/__tests__/unit/vendored-sync.test.d.ts +14 -0
- package/dist/__tests__/unit/vendored-sync.test.d.ts.map +1 -0
- package/dist/__tests__/unit/vendored-sync.test.js +90 -0
- package/dist/__tests__/unit/vendored-sync.test.js.map +1 -0
- package/dist/commands/broken-links.d.ts +11 -0
- package/dist/commands/broken-links.d.ts.map +1 -0
- package/dist/commands/broken-links.js +95 -0
- package/dist/commands/broken-links.js.map +1 -0
- package/dist/commands/clean.d.ts +7 -0
- package/dist/commands/clean.d.ts.map +1 -0
- package/dist/commands/clean.js +59 -0
- package/dist/commands/clean.js.map +1 -0
- package/dist/commands/deploy/cloudflare.d.ts +12 -0
- package/dist/commands/deploy/cloudflare.d.ts.map +1 -0
- package/dist/commands/deploy/cloudflare.js +409 -0
- package/dist/commands/deploy/cloudflare.js.map +1 -0
- package/dist/commands/deploy/templates.d.ts +23 -0
- package/dist/commands/deploy/templates.d.ts.map +1 -0
- package/dist/commands/deploy/templates.js +179 -0
- package/dist/commands/deploy/templates.js.map +1 -0
- package/dist/commands/deploy/types.d.ts +19 -0
- package/dist/commands/deploy/types.d.ts.map +1 -0
- package/dist/commands/deploy/types.js +5 -0
- package/dist/commands/deploy/types.js.map +1 -0
- package/dist/commands/dev.d.ts +14 -0
- package/dist/commands/dev.d.ts.map +1 -0
- package/dist/commands/dev.js +817 -0
- package/dist/commands/dev.js.map +1 -0
- package/dist/commands/doctor.d.ts +7 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +159 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/init.d.ts +7 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +96 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/migrate/convert-mdx.d.ts +50 -0
- package/dist/commands/migrate/convert-mdx.d.ts.map +1 -0
- package/dist/commands/migrate/convert-mdx.js +108 -0
- package/dist/commands/migrate/convert-mdx.js.map +1 -0
- package/dist/commands/migrate/convert.d.ts +80 -0
- package/dist/commands/migrate/convert.d.ts.map +1 -0
- package/dist/commands/migrate/convert.js +158 -0
- package/dist/commands/migrate/convert.js.map +1 -0
- package/dist/commands/migrate/detect.d.ts +31 -0
- package/dist/commands/migrate/detect.d.ts.map +1 -0
- package/dist/commands/migrate/detect.js +62 -0
- package/dist/commands/migrate/detect.js.map +1 -0
- package/dist/commands/migrate/extract-hooks.d.ts +71 -0
- package/dist/commands/migrate/extract-hooks.d.ts.map +1 -0
- package/dist/commands/migrate/extract-hooks.js +473 -0
- package/dist/commands/migrate/extract-hooks.js.map +1 -0
- package/dist/commands/migrate/index.d.ts +17 -0
- package/dist/commands/migrate/index.d.ts.map +1 -0
- package/dist/commands/migrate/index.js +282 -0
- package/dist/commands/migrate/index.js.map +1 -0
- package/dist/commands/migrate/prompts.d.ts +22 -0
- package/dist/commands/migrate/prompts.d.ts.map +1 -0
- package/dist/commands/migrate/prompts.js +67 -0
- package/dist/commands/migrate/prompts.js.map +1 -0
- package/dist/commands/migrate/types.d.ts +22 -0
- package/dist/commands/migrate/types.d.ts.map +1 -0
- package/dist/commands/migrate/types.js +26 -0
- package/dist/commands/migrate/types.js.map +1 -0
- package/dist/commands/openapi-check.d.ts +11 -0
- package/dist/commands/openapi-check.d.ts.map +1 -0
- package/dist/commands/openapi-check.js +88 -0
- package/dist/commands/openapi-check.js.map +1 -0
- package/dist/commands/rename.d.ts +10 -0
- package/dist/commands/rename.d.ts.map +1 -0
- package/dist/commands/rename.js +125 -0
- package/dist/commands/rename.js.map +1 -0
- package/dist/commands/update.d.ts +10 -0
- package/dist/commands/update.d.ts.map +1 -0
- package/dist/commands/update.js +57 -0
- package/dist/commands/update.js.map +1 -0
- package/dist/commands/validate.d.ts +12 -0
- package/dist/commands/validate.d.ts.map +1 -0
- package/dist/commands/validate.js +163 -0
- package/dist/commands/validate.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +334 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/config.d.ts +7 -0
- package/dist/lib/config.d.ts.map +1 -0
- package/dist/lib/config.js +18 -0
- package/dist/lib/config.js.map +1 -0
- package/dist/lib/deprecated-components.d.ts +72 -0
- package/dist/lib/deprecated-components.d.ts.map +1 -0
- package/dist/lib/deprecated-components.js +138 -0
- package/dist/lib/deprecated-components.js.map +1 -0
- package/dist/lib/deps.d.ts +17 -0
- package/dist/lib/deps.d.ts.map +1 -0
- package/dist/lib/deps.js +186 -0
- package/dist/lib/deps.js.map +1 -0
- package/dist/lib/docs-config.d.ts +67 -0
- package/dist/lib/docs-config.d.ts.map +1 -0
- package/dist/lib/docs-config.js +294 -0
- package/dist/lib/docs-config.js.map +1 -0
- package/dist/lib/errors.d.ts +23 -0
- package/dist/lib/errors.d.ts.map +1 -0
- package/dist/lib/errors.js +32 -0
- package/dist/lib/errors.js.map +1 -0
- package/dist/lib/frontmatter-utils.d.ts +25 -0
- package/dist/lib/frontmatter-utils.d.ts.map +1 -0
- package/dist/lib/frontmatter-utils.js +64 -0
- package/dist/lib/frontmatter-utils.js.map +1 -0
- package/dist/lib/mdx-validator.d.ts +27 -0
- package/dist/lib/mdx-validator.d.ts.map +1 -0
- package/dist/lib/mdx-validator.js +148 -0
- package/dist/lib/mdx-validator.js.map +1 -0
- package/dist/lib/navigation-validator.d.ts +31 -0
- package/dist/lib/navigation-validator.d.ts.map +1 -0
- package/dist/lib/navigation-validator.js +75 -0
- package/dist/lib/navigation-validator.js.map +1 -0
- package/dist/lib/normalize-config.d.ts +57 -0
- package/dist/lib/normalize-config.d.ts.map +1 -0
- package/dist/lib/normalize-config.js +63 -0
- package/dist/lib/normalize-config.js.map +1 -0
- package/dist/lib/openapi/cache.d.ts +40 -0
- package/dist/lib/openapi/cache.d.ts.map +1 -0
- package/dist/lib/openapi/cache.js +76 -0
- package/dist/lib/openapi/cache.js.map +1 -0
- package/dist/lib/openapi/errors.d.ts +36 -0
- package/dist/lib/openapi/errors.d.ts.map +1 -0
- package/dist/lib/openapi/errors.js +162 -0
- package/dist/lib/openapi/errors.js.map +1 -0
- package/dist/lib/openapi/index.d.ts +10 -0
- package/dist/lib/openapi/index.d.ts.map +1 -0
- package/dist/lib/openapi/index.js +12 -0
- package/dist/lib/openapi/index.js.map +1 -0
- package/dist/lib/openapi/types.d.ts +198 -0
- package/dist/lib/openapi/types.d.ts.map +1 -0
- package/dist/lib/openapi/types.js +8 -0
- package/dist/lib/openapi/types.js.map +1 -0
- package/dist/lib/openapi/validator.d.ts +45 -0
- package/dist/lib/openapi/validator.d.ts.map +1 -0
- package/dist/lib/openapi/validator.js +128 -0
- package/dist/lib/openapi/validator.js.map +1 -0
- package/dist/lib/openapi.d.ts +7 -0
- package/dist/lib/openapi.d.ts.map +1 -0
- package/dist/lib/openapi.js +7 -0
- package/dist/lib/openapi.js.map +1 -0
- package/dist/lib/output.d.ts +14 -0
- package/dist/lib/output.d.ts.map +1 -0
- package/dist/lib/output.js +19 -0
- package/dist/lib/output.js.map +1 -0
- package/dist/lib/path-security.d.ts +23 -0
- package/dist/lib/path-security.d.ts.map +1 -0
- package/dist/lib/path-security.js +35 -0
- package/dist/lib/path-security.js.map +1 -0
- package/dist/lib/port.d.ts +18 -0
- package/dist/lib/port.d.ts.map +1 -0
- package/dist/lib/port.js +65 -0
- package/dist/lib/port.js.map +1 -0
- package/dist/lib/spinner.d.ts +4 -0
- package/dist/lib/spinner.d.ts.map +1 -0
- package/dist/lib/spinner.js +16 -0
- package/dist/lib/spinner.js.map +1 -0
- package/dist/lib/version.d.ts +2 -0
- package/dist/lib/version.d.ts.map +1 -0
- package/dist/lib/version.js +49 -0
- package/dist/lib/version.js.map +1 -0
- package/dist/utils/update-checker.d.ts +34 -0
- package/dist/utils/update-checker.d.ts.map +1 -0
- package/dist/utils/update-checker.js +142 -0
- package/dist/utils/update-checker.js.map +1 -0
- package/package.json +125 -0
- package/templates/docs.json +11 -0
- package/templates/introduction.mdx +19 -0
- package/templates/quickstart.mdx +20 -0
- package/vendored/app/[[...slug]]/error.tsx +103 -0
- package/vendored/app/[[...slug]]/page.tsx +690 -0
- package/vendored/app/api/assets/[...path]/route.ts +78 -0
- package/vendored/app/api/ev/route.ts +61 -0
- package/vendored/app/api/isr-health/route.ts +66 -0
- package/vendored/app/api/mcp/[project]/route.ts +435 -0
- package/vendored/app/api/og/route.tsx +167 -0
- package/vendored/app/api/r2/[project]/[...path]/route.ts +214 -0
- package/vendored/app/api/revalidate/route.ts +76 -0
- package/vendored/app/globals.css +37 -0
- package/vendored/app/layout.tsx +571 -0
- package/vendored/app/not-found.tsx +47 -0
- package/vendored/components/CodeBlockCopyButton.tsx +146 -0
- package/vendored/components/HeaderLinkCopy.tsx +135 -0
- package/vendored/components/errors/NotFoundContent.tsx +147 -0
- package/vendored/components/layout/LayoutWrapper.tsx +128 -0
- package/vendored/components/mdx/Accordion.tsx +91 -0
- package/vendored/components/mdx/ApiCodePanel.tsx +51 -0
- package/vendored/components/mdx/ApiEndpoint.tsx +104 -0
- package/vendored/components/mdx/ApiPage.tsx +379 -0
- package/vendored/components/mdx/Badge.tsx +169 -0
- package/vendored/components/mdx/Callouts.tsx +140 -0
- package/vendored/components/mdx/Card.tsx +214 -0
- package/vendored/components/mdx/CodeGroup.tsx +136 -0
- package/vendored/components/mdx/Color.tsx +244 -0
- package/vendored/components/mdx/Columns.tsx +37 -0
- package/vendored/components/mdx/Expandable.tsx +37 -0
- package/vendored/components/mdx/Frame.tsx +51 -0
- package/vendored/components/mdx/Icon.tsx +132 -0
- package/vendored/components/mdx/Latex.tsx +75 -0
- package/vendored/components/mdx/MDXComponents.tsx +414 -0
- package/vendored/components/mdx/Mermaid.tsx +35 -0
- package/vendored/components/mdx/MermaidInner.tsx +342 -0
- package/vendored/components/mdx/OpenApiEndpoint.tsx +971 -0
- package/vendored/components/mdx/Panel.tsx +26 -0
- package/vendored/components/mdx/PanelWrapper.tsx +100 -0
- package/vendored/components/mdx/ParamField.tsx +75 -0
- package/vendored/components/mdx/RequestExample.tsx +91 -0
- package/vendored/components/mdx/ResponseExample.tsx +145 -0
- package/vendored/components/mdx/ResponseField.tsx +109 -0
- package/vendored/components/mdx/Steps.tsx +173 -0
- package/vendored/components/mdx/Table.tsx +352 -0
- package/vendored/components/mdx/Tabs.tsx +147 -0
- package/vendored/components/mdx/Tile.tsx +127 -0
- package/vendored/components/mdx/Tooltip.tsx +111 -0
- package/vendored/components/mdx/Tree.tsx +484 -0
- package/vendored/components/mdx/Update.tsx +90 -0
- package/vendored/components/mdx/View.tsx +354 -0
- package/vendored/components/mdx/YouTube.tsx +35 -0
- package/vendored/components/mdx/ZoomableImage.tsx +83 -0
- package/vendored/components/navigation/Breadcrumb.tsx +241 -0
- package/vendored/components/navigation/DefaultLogo.tsx +81 -0
- package/vendored/components/navigation/Header.tsx +512 -0
- package/vendored/components/navigation/LanguageSelector.tsx +249 -0
- package/vendored/components/navigation/PageNavigation.tsx +174 -0
- package/vendored/components/navigation/Sidebar.tsx +713 -0
- package/vendored/components/navigation/SocialFooter.tsx +186 -0
- package/vendored/components/navigation/TableOfContents.tsx +435 -0
- package/vendored/components/navigation/TabsNav.tsx +182 -0
- package/vendored/components/search/LazySearchModal.tsx +19 -0
- package/vendored/components/search/SearchModal.tsx +573 -0
- package/vendored/components/snippets/ProjectSnippets.tsx +4 -0
- package/vendored/components/theme/ThemeProvider.tsx +31 -0
- package/vendored/components/theme/ThemeToggle.tsx +134 -0
- package/vendored/components/ui/CodePanel.tsx +517 -0
- package/vendored/components/ui/CodePanelModal.tsx +342 -0
- package/vendored/contexts/TabSyncContext.tsx +30 -0
- package/vendored/hooks/useFocusTrap.ts +42 -0
- package/vendored/hooks/useHashNavigation.ts +39 -0
- package/vendored/hooks/useShikiHighlight.ts +101 -0
- package/vendored/lib/analytics-client.ts +77 -0
- package/vendored/lib/build/cache.ts +138 -0
- package/vendored/lib/build/error-parser.ts +690 -0
- package/vendored/lib/build/estimation.ts +113 -0
- package/vendored/lib/build/index.ts +17 -0
- package/vendored/lib/build/page-file-map.ts +48 -0
- package/vendored/lib/build/r2-upload.ts +179 -0
- package/vendored/lib/cache-keys.ts +117 -0
- package/vendored/lib/code-utils.ts +42 -0
- package/vendored/lib/content-loader.ts +176 -0
- package/vendored/lib/deprecated-components.ts +185 -0
- package/vendored/lib/docs-isr.ts +180 -0
- package/vendored/lib/docs-types.ts +874 -0
- package/vendored/lib/docs.ts +203 -0
- package/vendored/lib/domain-helpers.ts +107 -0
- package/vendored/lib/email-notifier.ts +102 -0
- package/vendored/lib/email-templates/build-failure.tsx +193 -0
- package/vendored/lib/email-templates/components/base-layout.tsx +150 -0
- package/vendored/lib/email-templates/components/error-box.tsx +88 -0
- package/vendored/lib/email-templates/components/info-row.tsx +63 -0
- package/vendored/lib/email-templates/index.ts +13 -0
- package/vendored/lib/empty-polyfill.js +3 -0
- package/vendored/lib/extract-highlights.ts +124 -0
- package/vendored/lib/fonts.ts +227 -0
- package/vendored/lib/frontmatter-utils.ts +77 -0
- package/vendored/lib/fs-utils.ts +20 -0
- package/vendored/lib/git-utils.ts +87 -0
- package/vendored/lib/health-checks.ts +224 -0
- package/vendored/lib/icon-utils.ts +492 -0
- package/vendored/lib/infer-page-type.ts +14 -0
- package/vendored/lib/isr-build-executor.ts +185 -0
- package/vendored/lib/language-icons.ts +152 -0
- package/vendored/lib/language-utils.ts +338 -0
- package/vendored/lib/latex-config.ts +64 -0
- package/vendored/lib/link-prefix-context.tsx +32 -0
- package/vendored/lib/logger.ts +63 -0
- package/vendored/lib/mcp-search.ts +255 -0
- package/vendored/lib/mdx-inline-components.ts +155 -0
- package/vendored/lib/mdx.ts +100 -0
- package/vendored/lib/middleware-helpers.ts +519 -0
- package/vendored/lib/navigation-resolver.ts +621 -0
- package/vendored/lib/navigation-utils.ts +103 -0
- package/vendored/lib/normalize-config.ts +94 -0
- package/vendored/lib/openapi/cache.ts +92 -0
- package/vendored/lib/openapi/code-examples.ts +389 -0
- package/vendored/lib/openapi/errors.ts +253 -0
- package/vendored/lib/openapi/generator.ts +230 -0
- package/vendored/lib/openapi/index.ts +84 -0
- package/vendored/lib/openapi/parser.ts +474 -0
- package/vendored/lib/openapi/types.ts +232 -0
- package/vendored/lib/openapi/validator.ts +156 -0
- package/vendored/lib/openapi-isr.ts +121 -0
- package/vendored/lib/page-isr-helpers.ts +137 -0
- package/vendored/lib/path-safety.ts +130 -0
- package/vendored/lib/paths.ts +35 -0
- package/vendored/lib/preprocess-mdx.ts +951 -0
- package/vendored/lib/process-mdx-with-exports.ts +75 -0
- package/vendored/lib/project-resolver.ts +165 -0
- package/vendored/lib/r2-content.ts +60 -0
- package/vendored/lib/r2-manifest.ts +84 -0
- package/vendored/lib/recent-searches.ts +41 -0
- package/vendored/lib/recma-compound-components.ts +84 -0
- package/vendored/lib/redirect-compiler.ts +160 -0
- package/vendored/lib/redirect-matcher.ts +296 -0
- package/vendored/lib/redis.ts +23 -0
- package/vendored/lib/rehype-class-to-classname.ts +31 -0
- package/vendored/lib/rehype-code-meta.ts +275 -0
- package/vendored/lib/rehype-nozoom-to-data.ts +45 -0
- package/vendored/lib/remark-extract-exports.ts +104 -0
- package/vendored/lib/resilience.ts +260 -0
- package/vendored/lib/revalidation-helpers.ts +200 -0
- package/vendored/lib/revalidation-trigger.ts +150 -0
- package/vendored/lib/screenshot-capture.ts +229 -0
- package/vendored/lib/search-client.ts +91 -0
- package/vendored/lib/search-suggestions.ts +38 -0
- package/vendored/lib/search.ts +158 -0
- package/vendored/lib/seo.ts +264 -0
- package/vendored/lib/shiki-client.ts +131 -0
- package/vendored/lib/shiki-config.ts +289 -0
- package/vendored/lib/shiki-css-theme.ts +46 -0
- package/vendored/lib/shiki-highlighter.ts +62 -0
- package/vendored/lib/shiki-transformers.ts +337 -0
- package/vendored/lib/slack-notifier.ts +248 -0
- package/vendored/lib/snippet-compiler-isr.ts +114 -0
- package/vendored/lib/snippet-loader-isr.ts +276 -0
- package/vendored/lib/static-artifacts.ts +375 -0
- package/vendored/lib/static-file-route.ts +72 -0
- package/vendored/lib/tracking-script.ts +19 -0
- package/vendored/lib/typography-config.ts +42 -0
- package/vendored/lib/validate-config.ts +268 -0
- package/vendored/next.config.js +45 -0
- package/vendored/postcss.config.js +6 -0
- package/vendored/schema/README.md +28 -0
- package/vendored/schema/docs-schema.json +4631 -0
- package/vendored/scripts/build-project.cjs +174 -0
- package/vendored/scripts/build-search-index.cjs +347 -0
- package/vendored/scripts/compile-snippets.cjs +488 -0
- package/vendored/scripts/copy-files.cjs +295 -0
- package/vendored/scripts/dev-project.cjs +534 -0
- package/vendored/scripts/enhance-navigation.cjs +354 -0
- package/vendored/scripts/validate-links.cjs +423 -0
- package/vendored/shared/constants.ts +6 -0
- package/vendored/shared/index.ts +19 -0
- package/vendored/shared/logger.ts +62 -0
- package/vendored/shared/memory-monitor.ts +190 -0
- package/vendored/shared/navigation-validator.ts +101 -0
- package/vendored/shared/path-security.ts +39 -0
- package/vendored/shared/status-reporter.ts +199 -0
- package/vendored/shared/timer.ts +51 -0
- package/vendored/shared/types.ts +102 -0
- package/vendored/tailwind.config.ts +39 -0
- package/vendored/themes/base.css +1311 -0
- package/vendored/themes/index.ts +119 -0
- package/vendored/themes/jam/variables.css +835 -0
- package/vendored/themes/nebula/variables.css +282 -0
- package/vendored/themes/pulsar/variables.css +1009 -0
- package/vendored/themes/types.ts +89 -0
- package/vendored/tsconfig.json +48 -0
|
@@ -0,0 +1,474 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenAPI Parser
|
|
3
|
+
*
|
|
4
|
+
* Parses endpoint data from validated OpenAPI specifications.
|
|
5
|
+
* Extracts parameters, request bodies, responses, and security info.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { OpenAPI, OpenAPIV3, OpenAPIV3_1 } from 'openapi-types';
|
|
9
|
+
import type {
|
|
10
|
+
HttpMethod,
|
|
11
|
+
ParsedOpenApiFrontmatter,
|
|
12
|
+
OpenApiEndpointData,
|
|
13
|
+
ParsedParameter,
|
|
14
|
+
ParsedRequestBody,
|
|
15
|
+
ParsedResponse,
|
|
16
|
+
ServerInfo,
|
|
17
|
+
SecurityRequirement,
|
|
18
|
+
JsonSchema,
|
|
19
|
+
} from './types';
|
|
20
|
+
import { createFrontmatterError, createEndpointNotFoundError } from './errors';
|
|
21
|
+
|
|
22
|
+
// Valid HTTP methods
|
|
23
|
+
const VALID_METHODS: HttpMethod[] = ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'HEAD', 'OPTIONS'];
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Parse the openapi frontmatter string
|
|
27
|
+
* Full format: "/path/to/spec.yaml METHOD /endpoint/path"
|
|
28
|
+
* Short format (with defaultSpecPath): "METHOD /endpoint/path"
|
|
29
|
+
*/
|
|
30
|
+
export function parseOpenApiFrontmatter(value: string, defaultSpecPath?: string): ParsedOpenApiFrontmatter {
|
|
31
|
+
const trimmed = value.trim();
|
|
32
|
+
const parts = trimmed.split(/\s+/);
|
|
33
|
+
|
|
34
|
+
// Check if this is the short format (METHOD /path) when a default spec is configured
|
|
35
|
+
if (parts.length >= 2) {
|
|
36
|
+
const firstPart = parts[0].toUpperCase();
|
|
37
|
+
const isMethodFirst = VALID_METHODS.includes(firstPart as HttpMethod);
|
|
38
|
+
|
|
39
|
+
if (isMethodFirst) {
|
|
40
|
+
// Short format: "METHOD /endpoint/path"
|
|
41
|
+
if (!defaultSpecPath) {
|
|
42
|
+
throw createFrontmatterError(
|
|
43
|
+
value,
|
|
44
|
+
'Short format (e.g., "GET /users") requires api.openapi to be configured in docs.json.\n' +
|
|
45
|
+
'Either add api.openapi to docs.json or use the full format: "/path/to/spec.yaml METHOD /endpoint/path"'
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const [method, ...pathParts] = parts;
|
|
50
|
+
const endpointPath = pathParts.join(' ');
|
|
51
|
+
|
|
52
|
+
// Validate endpoint path
|
|
53
|
+
if (!endpointPath.startsWith('/')) {
|
|
54
|
+
throw createFrontmatterError(
|
|
55
|
+
value,
|
|
56
|
+
'Endpoint path must start with "/"'
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return {
|
|
61
|
+
specPath: defaultSpecPath.startsWith('/') ? defaultSpecPath : `/${defaultSpecPath}`,
|
|
62
|
+
method: method.toUpperCase() as HttpMethod,
|
|
63
|
+
path: endpointPath,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Full format: "/path/to/spec.yaml METHOD /endpoint/path"
|
|
69
|
+
if (parts.length < 3) {
|
|
70
|
+
throw createFrontmatterError(
|
|
71
|
+
value,
|
|
72
|
+
'Expected format: "/path/to/spec.yaml METHOD /endpoint/path"\n' +
|
|
73
|
+
'Example: "/openapi/api.yaml GET /users/{id}"'
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const [specPath, method, ...pathParts] = parts;
|
|
78
|
+
const endpointPath = pathParts.join(' '); // Handle paths with spaces (unlikely but safe)
|
|
79
|
+
|
|
80
|
+
// Validate spec path
|
|
81
|
+
if (!specPath.match(/\.(ya?ml|json)$/i)) {
|
|
82
|
+
throw createFrontmatterError(
|
|
83
|
+
value,
|
|
84
|
+
'OpenAPI spec must be a .yaml, .yml, or .json file'
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Validate method
|
|
89
|
+
const upperMethod = method.toUpperCase() as HttpMethod;
|
|
90
|
+
if (!VALID_METHODS.includes(upperMethod)) {
|
|
91
|
+
throw createFrontmatterError(
|
|
92
|
+
value,
|
|
93
|
+
`Invalid HTTP method "${method}". Must be one of: ${VALID_METHODS.join(', ')}`
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// Validate endpoint path
|
|
98
|
+
if (!endpointPath.startsWith('/')) {
|
|
99
|
+
throw createFrontmatterError(
|
|
100
|
+
value,
|
|
101
|
+
'Endpoint path must start with "/"'
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return {
|
|
106
|
+
specPath,
|
|
107
|
+
method: upperMethod,
|
|
108
|
+
path: endpointPath,
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Convert OpenAPI schema to our JsonSchema type
|
|
114
|
+
*/
|
|
115
|
+
function toJsonSchema(schema: unknown): JsonSchema {
|
|
116
|
+
if (!schema || typeof schema !== 'object') {
|
|
117
|
+
return {};
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const s = schema as Record<string, unknown>;
|
|
121
|
+
const result: JsonSchema = {};
|
|
122
|
+
|
|
123
|
+
// Copy relevant properties
|
|
124
|
+
if (s.type) result.type = s.type as string | string[];
|
|
125
|
+
if (s.format) result.format = s.format as string;
|
|
126
|
+
if (s.description) result.description = s.description as string;
|
|
127
|
+
if (s.enum) result.enum = s.enum as unknown[];
|
|
128
|
+
if (s.default !== undefined) result.default = s.default;
|
|
129
|
+
if (s.example !== undefined) result.example = s.example;
|
|
130
|
+
if (s.nullable) result.nullable = s.nullable as boolean;
|
|
131
|
+
if (s.deprecated) result.deprecated = s.deprecated as boolean;
|
|
132
|
+
if (s.readOnly) result.readOnly = s.readOnly as boolean;
|
|
133
|
+
if (s.writeOnly) result.writeOnly = s.writeOnly as boolean;
|
|
134
|
+
if (s.minimum !== undefined) result.minimum = s.minimum as number;
|
|
135
|
+
if (s.maximum !== undefined) result.maximum = s.maximum as number;
|
|
136
|
+
if (s.minLength !== undefined) result.minLength = s.minLength as number;
|
|
137
|
+
if (s.maxLength !== undefined) result.maxLength = s.maxLength as number;
|
|
138
|
+
if (s.minItems !== undefined) result.minItems = s.minItems as number;
|
|
139
|
+
if (s.maxItems !== undefined) result.maxItems = s.maxItems as number;
|
|
140
|
+
if (s.pattern) result.pattern = s.pattern as string;
|
|
141
|
+
if (s.required) result.required = s.required as string[];
|
|
142
|
+
|
|
143
|
+
// Handle nested schemas
|
|
144
|
+
if (s.items) {
|
|
145
|
+
result.items = toJsonSchema(s.items);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
if (s.properties && typeof s.properties === 'object') {
|
|
149
|
+
result.properties = {};
|
|
150
|
+
for (const [key, value] of Object.entries(s.properties)) {
|
|
151
|
+
result.properties[key] = toJsonSchema(value);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
if (s.additionalProperties !== undefined) {
|
|
156
|
+
if (typeof s.additionalProperties === 'boolean') {
|
|
157
|
+
result.additionalProperties = s.additionalProperties;
|
|
158
|
+
} else {
|
|
159
|
+
result.additionalProperties = toJsonSchema(s.additionalProperties);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// Handle composition
|
|
164
|
+
if (Array.isArray(s.oneOf)) {
|
|
165
|
+
result.oneOf = s.oneOf.map(toJsonSchema);
|
|
166
|
+
}
|
|
167
|
+
if (Array.isArray(s.anyOf)) {
|
|
168
|
+
result.anyOf = s.anyOf.map(toJsonSchema);
|
|
169
|
+
}
|
|
170
|
+
if (Array.isArray(s.allOf)) {
|
|
171
|
+
result.allOf = s.allOf.map(toJsonSchema);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
return result;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Parse server info from OpenAPI spec
|
|
179
|
+
*/
|
|
180
|
+
function parseServers(api: OpenAPI.Document): ServerInfo[] {
|
|
181
|
+
// OpenAPI 3.x
|
|
182
|
+
if ('servers' in api && Array.isArray(api.servers)) {
|
|
183
|
+
return api.servers.map((server) => ({
|
|
184
|
+
url: server.url,
|
|
185
|
+
description: server.description,
|
|
186
|
+
variables: server.variables as ServerInfo['variables'],
|
|
187
|
+
}));
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// Swagger 2.0
|
|
191
|
+
if ('host' in api && typeof api.host === 'string') {
|
|
192
|
+
const scheme = (api as any).schemes?.[0] || 'https';
|
|
193
|
+
const basePath = (api as any).basePath || '';
|
|
194
|
+
return [{
|
|
195
|
+
url: `${scheme}://${api.host}${basePath}`,
|
|
196
|
+
}];
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
return [];
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Parse security schemes from OpenAPI spec
|
|
204
|
+
*/
|
|
205
|
+
function parseSecuritySchemes(api: OpenAPI.Document): Map<string, SecurityRequirement> {
|
|
206
|
+
const schemes = new Map<string, SecurityRequirement>();
|
|
207
|
+
|
|
208
|
+
// OpenAPI 3.x
|
|
209
|
+
if ('components' in api && api.components?.securitySchemes) {
|
|
210
|
+
for (const [name, scheme] of Object.entries(api.components.securitySchemes)) {
|
|
211
|
+
const s = scheme as OpenAPIV3.SecuritySchemeObject;
|
|
212
|
+
schemes.set(name, {
|
|
213
|
+
name,
|
|
214
|
+
type: s.type as SecurityRequirement['type'],
|
|
215
|
+
scheme: 'scheme' in s ? s.scheme : undefined,
|
|
216
|
+
in: 'in' in s ? s.in as SecurityRequirement['in'] : undefined,
|
|
217
|
+
bearerFormat: 'bearerFormat' in s ? s.bearerFormat : undefined,
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// Swagger 2.0
|
|
223
|
+
if ('securityDefinitions' in api) {
|
|
224
|
+
const defs = (api as any).securityDefinitions;
|
|
225
|
+
for (const [name, scheme] of Object.entries(defs || {})) {
|
|
226
|
+
const s = scheme as any;
|
|
227
|
+
schemes.set(name, {
|
|
228
|
+
name,
|
|
229
|
+
type: s.type,
|
|
230
|
+
scheme: s.scheme,
|
|
231
|
+
in: s.in,
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
return schemes;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Parse security requirements for an operation
|
|
241
|
+
*/
|
|
242
|
+
function parseSecurity(
|
|
243
|
+
operationSecurity: OpenAPIV3.SecurityRequirementObject[] | undefined,
|
|
244
|
+
globalSecurity: OpenAPIV3.SecurityRequirementObject[] | undefined,
|
|
245
|
+
schemes: Map<string, SecurityRequirement>
|
|
246
|
+
): SecurityRequirement[] {
|
|
247
|
+
const securityReqs = operationSecurity ?? globalSecurity ?? [];
|
|
248
|
+
const result: SecurityRequirement[] = [];
|
|
249
|
+
|
|
250
|
+
for (const req of securityReqs) {
|
|
251
|
+
for (const name of Object.keys(req)) {
|
|
252
|
+
const scheme = schemes.get(name);
|
|
253
|
+
if (scheme) {
|
|
254
|
+
result.push(scheme);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
return result;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Parse parameters from operation and path item
|
|
264
|
+
*/
|
|
265
|
+
function parseParameters(
|
|
266
|
+
operationParams: unknown[] | undefined,
|
|
267
|
+
pathParams: unknown[] | undefined
|
|
268
|
+
): ParsedParameter[] {
|
|
269
|
+
const params: ParsedParameter[] = [];
|
|
270
|
+
const seen = new Set<string>();
|
|
271
|
+
|
|
272
|
+
// Operation parameters override path parameters
|
|
273
|
+
const allParams = [...(operationParams || []), ...(pathParams || [])];
|
|
274
|
+
|
|
275
|
+
for (const param of allParams) {
|
|
276
|
+
const p = param as OpenAPIV3.ParameterObject;
|
|
277
|
+
|
|
278
|
+
// Skip if we've already seen this parameter (operation overrides path)
|
|
279
|
+
const key = `${p.in}:${p.name}`;
|
|
280
|
+
if (seen.has(key)) continue;
|
|
281
|
+
seen.add(key);
|
|
282
|
+
|
|
283
|
+
params.push({
|
|
284
|
+
name: p.name,
|
|
285
|
+
in: p.in as ParsedParameter['in'],
|
|
286
|
+
required: p.required || p.in === 'path', // Path params are always required
|
|
287
|
+
description: p.description,
|
|
288
|
+
schema: toJsonSchema(p.schema),
|
|
289
|
+
example: p.example,
|
|
290
|
+
deprecated: p.deprecated,
|
|
291
|
+
style: p.style,
|
|
292
|
+
explode: p.explode,
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
return params;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Parse request body
|
|
301
|
+
*/
|
|
302
|
+
function parseRequestBody(
|
|
303
|
+
requestBody: OpenAPIV3.RequestBodyObject | undefined
|
|
304
|
+
): ParsedRequestBody | undefined {
|
|
305
|
+
if (!requestBody) return undefined;
|
|
306
|
+
|
|
307
|
+
const content: ParsedRequestBody['content'] = {};
|
|
308
|
+
|
|
309
|
+
for (const [mediaType, mediaObj] of Object.entries(requestBody.content || {})) {
|
|
310
|
+
content[mediaType] = {
|
|
311
|
+
schema: toJsonSchema(mediaObj.schema),
|
|
312
|
+
example: mediaObj.example,
|
|
313
|
+
examples: mediaObj.examples as any,
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
return {
|
|
318
|
+
required: requestBody.required || false,
|
|
319
|
+
description: requestBody.description,
|
|
320
|
+
content,
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* Parse responses
|
|
326
|
+
*/
|
|
327
|
+
function parseResponses(
|
|
328
|
+
responses: OpenAPIV3.ResponsesObject | undefined
|
|
329
|
+
): Record<string, ParsedResponse> {
|
|
330
|
+
const result: Record<string, ParsedResponse> = {};
|
|
331
|
+
|
|
332
|
+
for (const [code, response] of Object.entries(responses || {})) {
|
|
333
|
+
const r = response as OpenAPIV3.ResponseObject;
|
|
334
|
+
|
|
335
|
+
const content: ParsedResponse['content'] = {};
|
|
336
|
+
for (const [mediaType, mediaObj] of Object.entries(r.content || {})) {
|
|
337
|
+
content[mediaType] = {
|
|
338
|
+
schema: toJsonSchema(mediaObj.schema),
|
|
339
|
+
example: mediaObj.example,
|
|
340
|
+
examples: mediaObj.examples as any,
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
const headers: ParsedResponse['headers'] = {};
|
|
345
|
+
for (const [headerName, header] of Object.entries(r.headers || {})) {
|
|
346
|
+
const h = header as OpenAPIV3.HeaderObject;
|
|
347
|
+
headers[headerName] = {
|
|
348
|
+
description: h.description,
|
|
349
|
+
schema: toJsonSchema(h.schema),
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
result[code] = {
|
|
354
|
+
description: r.description,
|
|
355
|
+
content: Object.keys(content).length > 0 ? content : undefined,
|
|
356
|
+
headers: Object.keys(headers).length > 0 ? headers : undefined,
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
return result;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
/**
|
|
364
|
+
* Parse a single endpoint from an OpenAPI spec
|
|
365
|
+
*/
|
|
366
|
+
export function parseEndpoint(
|
|
367
|
+
api: OpenAPI.Document,
|
|
368
|
+
method: HttpMethod,
|
|
369
|
+
endpointPath: string,
|
|
370
|
+
specPath: string
|
|
371
|
+
): OpenApiEndpointData {
|
|
372
|
+
const paths = (api as OpenAPIV3.Document).paths || {};
|
|
373
|
+
const pathItem = paths[endpointPath] as OpenAPIV3.PathItemObject | undefined;
|
|
374
|
+
|
|
375
|
+
// Collect available endpoints for helpful error messages
|
|
376
|
+
const availableEndpoints = Object.entries(paths).flatMap(([path, methods]) => {
|
|
377
|
+
if (!methods || typeof methods !== 'object') return [];
|
|
378
|
+
return Object.keys(methods)
|
|
379
|
+
.filter(m => ['get', 'post', 'put', 'patch', 'delete', 'head', 'options'].includes(m.toLowerCase()))
|
|
380
|
+
.map(m => `${m.toUpperCase()} ${path}`);
|
|
381
|
+
});
|
|
382
|
+
|
|
383
|
+
if (!pathItem) {
|
|
384
|
+
throw createEndpointNotFoundError(specPath, method, endpointPath, availableEndpoints);
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
const operation = pathItem[method.toLowerCase() as keyof OpenAPIV3.PathItemObject] as
|
|
388
|
+
| OpenAPIV3.OperationObject
|
|
389
|
+
| undefined;
|
|
390
|
+
|
|
391
|
+
if (!operation) {
|
|
392
|
+
throw createEndpointNotFoundError(specPath, method, endpointPath, availableEndpoints);
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
const securitySchemes = parseSecuritySchemes(api);
|
|
396
|
+
|
|
397
|
+
return {
|
|
398
|
+
method,
|
|
399
|
+
path: endpointPath,
|
|
400
|
+
summary: operation.summary,
|
|
401
|
+
description: operation.description,
|
|
402
|
+
operationId: operation.operationId,
|
|
403
|
+
deprecated: operation.deprecated,
|
|
404
|
+
tags: operation.tags,
|
|
405
|
+
servers: parseServers(api),
|
|
406
|
+
security: parseSecurity(
|
|
407
|
+
operation.security,
|
|
408
|
+
(api as OpenAPIV3.Document).security,
|
|
409
|
+
securitySchemes
|
|
410
|
+
),
|
|
411
|
+
parameters: parseParameters(
|
|
412
|
+
operation.parameters as unknown[],
|
|
413
|
+
pathItem.parameters as unknown[]
|
|
414
|
+
),
|
|
415
|
+
requestBody: parseRequestBody(operation.requestBody as OpenAPIV3.RequestBodyObject),
|
|
416
|
+
responses: parseResponses(operation.responses),
|
|
417
|
+
externalDocs: operation.externalDocs,
|
|
418
|
+
};
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
/**
|
|
422
|
+
* Get all endpoints from an OpenAPI spec
|
|
423
|
+
*/
|
|
424
|
+
export function getAllEndpoints(api: OpenAPI.Document): Array<{
|
|
425
|
+
method: HttpMethod;
|
|
426
|
+
path: string;
|
|
427
|
+
operation: OpenAPIV3.OperationObject;
|
|
428
|
+
tags: string[];
|
|
429
|
+
}> {
|
|
430
|
+
const paths = (api as OpenAPIV3.Document).paths || {};
|
|
431
|
+
const endpoints: Array<{
|
|
432
|
+
method: HttpMethod;
|
|
433
|
+
path: string;
|
|
434
|
+
operation: OpenAPIV3.OperationObject;
|
|
435
|
+
tags: string[];
|
|
436
|
+
}> = [];
|
|
437
|
+
|
|
438
|
+
for (const [path, pathItem] of Object.entries(paths)) {
|
|
439
|
+
const item = pathItem as OpenAPIV3.PathItemObject;
|
|
440
|
+
|
|
441
|
+
for (const method of VALID_METHODS) {
|
|
442
|
+
const operation = item[method.toLowerCase() as keyof OpenAPIV3.PathItemObject] as
|
|
443
|
+
| OpenAPIV3.OperationObject
|
|
444
|
+
| undefined;
|
|
445
|
+
|
|
446
|
+
if (operation) {
|
|
447
|
+
endpoints.push({
|
|
448
|
+
method,
|
|
449
|
+
path,
|
|
450
|
+
operation,
|
|
451
|
+
tags: operation.tags || [],
|
|
452
|
+
});
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
return endpoints;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
/**
|
|
461
|
+
* Get spec info (title, version, description)
|
|
462
|
+
*/
|
|
463
|
+
export function getSpecInfo(api: OpenAPI.Document): {
|
|
464
|
+
title: string;
|
|
465
|
+
version: string;
|
|
466
|
+
description?: string;
|
|
467
|
+
} {
|
|
468
|
+
const info = (api as OpenAPIV3.Document).info;
|
|
469
|
+
return {
|
|
470
|
+
title: info?.title || 'API',
|
|
471
|
+
version: info?.version || '1.0.0',
|
|
472
|
+
description: info?.description,
|
|
473
|
+
};
|
|
474
|
+
}
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenAPI Types
|
|
3
|
+
*
|
|
4
|
+
* TypeScript interfaces for OpenAPI parsing and endpoint data.
|
|
5
|
+
* Designed to be playground-ready for future interactive API testing.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { OpenAPI, OpenAPIV3, OpenAPIV3_1 } from 'openapi-types';
|
|
9
|
+
|
|
10
|
+
// Re-export for convenience
|
|
11
|
+
export type { OpenAPI, OpenAPIV3, OpenAPIV3_1 };
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* JSON Schema type (simplified for our use case)
|
|
15
|
+
*/
|
|
16
|
+
export interface JsonSchema {
|
|
17
|
+
type?: string | string[];
|
|
18
|
+
format?: string;
|
|
19
|
+
title?: string;
|
|
20
|
+
description?: string;
|
|
21
|
+
enum?: unknown[];
|
|
22
|
+
default?: unknown;
|
|
23
|
+
example?: unknown;
|
|
24
|
+
items?: JsonSchema;
|
|
25
|
+
properties?: Record<string, JsonSchema>;
|
|
26
|
+
additionalProperties?: boolean | JsonSchema;
|
|
27
|
+
required?: string[];
|
|
28
|
+
oneOf?: JsonSchema[];
|
|
29
|
+
anyOf?: JsonSchema[];
|
|
30
|
+
allOf?: JsonSchema[];
|
|
31
|
+
nullable?: boolean;
|
|
32
|
+
deprecated?: boolean;
|
|
33
|
+
readOnly?: boolean;
|
|
34
|
+
writeOnly?: boolean;
|
|
35
|
+
minimum?: number;
|
|
36
|
+
maximum?: number;
|
|
37
|
+
minLength?: number;
|
|
38
|
+
maxLength?: number;
|
|
39
|
+
minItems?: number;
|
|
40
|
+
maxItems?: number;
|
|
41
|
+
pattern?: string;
|
|
42
|
+
$ref?: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* HTTP methods supported
|
|
47
|
+
*/
|
|
48
|
+
export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS';
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Parameter location in the request
|
|
52
|
+
*/
|
|
53
|
+
export type ParameterLocation = 'query' | 'path' | 'header' | 'cookie';
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Parsed parameter from OpenAPI spec
|
|
57
|
+
*/
|
|
58
|
+
export interface ParsedParameter {
|
|
59
|
+
name: string;
|
|
60
|
+
in: ParameterLocation;
|
|
61
|
+
required: boolean;
|
|
62
|
+
description?: string;
|
|
63
|
+
schema: JsonSchema;
|
|
64
|
+
example?: unknown;
|
|
65
|
+
deprecated?: boolean;
|
|
66
|
+
style?: string;
|
|
67
|
+
explode?: boolean;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Parsed request body from OpenAPI spec
|
|
72
|
+
*/
|
|
73
|
+
export interface ParsedRequestBody {
|
|
74
|
+
required: boolean;
|
|
75
|
+
description?: string;
|
|
76
|
+
content: Record<string, {
|
|
77
|
+
schema: JsonSchema;
|
|
78
|
+
example?: unknown;
|
|
79
|
+
examples?: Record<string, { value: unknown; summary?: string }>;
|
|
80
|
+
}>;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Parsed response from OpenAPI spec
|
|
85
|
+
*/
|
|
86
|
+
export interface ParsedResponse {
|
|
87
|
+
description: string;
|
|
88
|
+
content?: Record<string, {
|
|
89
|
+
schema: JsonSchema;
|
|
90
|
+
example?: unknown;
|
|
91
|
+
examples?: Record<string, { value: unknown; summary?: string }>;
|
|
92
|
+
}>;
|
|
93
|
+
headers?: Record<string, {
|
|
94
|
+
description?: string;
|
|
95
|
+
schema: JsonSchema;
|
|
96
|
+
}>;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Server info from OpenAPI spec
|
|
101
|
+
*/
|
|
102
|
+
export interface ServerInfo {
|
|
103
|
+
url: string;
|
|
104
|
+
description?: string;
|
|
105
|
+
variables?: Record<string, {
|
|
106
|
+
default: string;
|
|
107
|
+
enum?: string[];
|
|
108
|
+
description?: string;
|
|
109
|
+
}>;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Security requirement from OpenAPI spec
|
|
114
|
+
*/
|
|
115
|
+
export interface SecurityRequirement {
|
|
116
|
+
name: string;
|
|
117
|
+
type: 'apiKey' | 'http' | 'oauth2' | 'openIdConnect';
|
|
118
|
+
scheme?: string; // For http type: 'bearer', 'basic'
|
|
119
|
+
in?: 'query' | 'header' | 'cookie'; // For apiKey type
|
|
120
|
+
bearerFormat?: string;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Full endpoint data structure (playground-ready)
|
|
125
|
+
*/
|
|
126
|
+
export interface OpenApiEndpointData {
|
|
127
|
+
// Basic info
|
|
128
|
+
method: HttpMethod;
|
|
129
|
+
path: string;
|
|
130
|
+
summary?: string;
|
|
131
|
+
description?: string;
|
|
132
|
+
operationId?: string;
|
|
133
|
+
deprecated?: boolean;
|
|
134
|
+
tags?: string[];
|
|
135
|
+
|
|
136
|
+
// Server info (for future playground)
|
|
137
|
+
servers: ServerInfo[];
|
|
138
|
+
|
|
139
|
+
// Authentication (for future playground)
|
|
140
|
+
security: SecurityRequirement[];
|
|
141
|
+
|
|
142
|
+
// Parameters
|
|
143
|
+
parameters: ParsedParameter[];
|
|
144
|
+
|
|
145
|
+
// Request body
|
|
146
|
+
requestBody?: ParsedRequestBody;
|
|
147
|
+
|
|
148
|
+
// Responses
|
|
149
|
+
responses: Record<string, ParsedResponse>;
|
|
150
|
+
|
|
151
|
+
// External docs
|
|
152
|
+
externalDocs?: {
|
|
153
|
+
url: string;
|
|
154
|
+
description?: string;
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Parsed frontmatter from MDX openapi field
|
|
160
|
+
*/
|
|
161
|
+
export interface ParsedOpenApiFrontmatter {
|
|
162
|
+
specPath: string;
|
|
163
|
+
method: HttpMethod;
|
|
164
|
+
path: string;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Validation error types
|
|
169
|
+
*/
|
|
170
|
+
export type OpenApiErrorType =
|
|
171
|
+
| 'file_not_found'
|
|
172
|
+
| 'parse_error'
|
|
173
|
+
| 'validation_error'
|
|
174
|
+
| 'ref_error'
|
|
175
|
+
| 'endpoint_not_found'
|
|
176
|
+
| 'frontmatter_error';
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Validation error structure
|
|
180
|
+
*/
|
|
181
|
+
export interface OpenApiValidationError {
|
|
182
|
+
type: OpenApiErrorType;
|
|
183
|
+
specPath: string;
|
|
184
|
+
message: string;
|
|
185
|
+
suggestion: string;
|
|
186
|
+
details?: string;
|
|
187
|
+
location?: {
|
|
188
|
+
path: string;
|
|
189
|
+
line?: number;
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Validation result
|
|
195
|
+
*/
|
|
196
|
+
export interface ValidationResult {
|
|
197
|
+
valid: boolean;
|
|
198
|
+
api?: OpenAPI.Document;
|
|
199
|
+
version?: '2.0' | '3.0' | '3.1';
|
|
200
|
+
error?: OpenApiValidationError;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Generated code examples
|
|
205
|
+
*/
|
|
206
|
+
export interface CodeExamples {
|
|
207
|
+
curl: string;
|
|
208
|
+
python: string;
|
|
209
|
+
javascript: string;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Generated page from auto-generation
|
|
214
|
+
*/
|
|
215
|
+
export interface GeneratedPage {
|
|
216
|
+
slug: string;
|
|
217
|
+
title: string;
|
|
218
|
+
description?: string;
|
|
219
|
+
group: string;
|
|
220
|
+
method: HttpMethod;
|
|
221
|
+
path: string;
|
|
222
|
+
endpointData: OpenApiEndpointData;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Spec cache entry
|
|
227
|
+
*/
|
|
228
|
+
export interface CachedSpec {
|
|
229
|
+
api: OpenAPI.Document;
|
|
230
|
+
version: '2.0' | '3.0' | '3.1';
|
|
231
|
+
timestamp: number;
|
|
232
|
+
}
|