@redocly/realm 0.130.0-custom.2 → 0.130.0-custom.21
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/CHANGELOG.md +116 -0
- package/dist/bin.js +1 -1
- package/dist/cli/develop.js +1 -1
- package/dist/cli/eject/resolveTheme.d.ts +1 -1
- package/dist/cli/eject/resolveTheme.js +1 -1
- package/dist/cli/prepare/copy-env-files.js +1 -1
- package/dist/cli/prepare/index.js +1 -1
- package/dist/cli/stats/collectors/openapi.js +1 -1
- package/dist/cli/telemetry/index.js +1 -1
- package/dist/client/App.js +1 -1
- package/dist/client/ErrorBoundary.js +1 -1
- package/dist/client/app/DevModeFloatingBar/index.d.ts +3 -0
- package/dist/client/app/DevModeFloatingBar/index.js +43 -0
- package/dist/client/app/Feedback/useSubmitFeedback.js +1 -1
- package/dist/client/app/Sidebar/InstancePicker.d.ts +10 -0
- package/dist/client/app/Sidebar/InstancePicker.js +48 -0
- package/dist/client/app/Sidebar/Sidebar.js +11 -3
- package/dist/client/app/Sidebar/useBreadcrumbs.js +1 -1
- package/dist/client/app/Sidebar/useSidebarItems.js +1 -1
- package/dist/client/app/hooks/catalog/useCatalogClassic.js +1 -1
- package/dist/client/app/hooks/useAutoScroll.js +1 -1
- package/dist/client/app/hooks/useRouteChangeTracker.js +1 -1
- package/dist/client/app/hooks/utils/pathname-matches-active-section.d.ts +6 -0
- package/dist/client/app/hooks/utils/pathname-matches-active-section.js +1 -0
- package/dist/client/app/markdoc/custom-components/html-script.js +1 -0
- package/dist/client/app/markdoc/custom-components/openapi/openapi-code-sample.js +1 -0
- package/dist/client/app/markdoc/custom-components/openapi/openapi-response-sample.js +1 -0
- package/dist/client/app/markdoc/custom-components/openapi/replay-openapi.js +1 -0
- package/dist/client/app/markdoc/hooks/use-store.js +1 -0
- package/dist/client/browser-entry.js +5 -5
- package/dist/client/constants/common.d.ts +2 -0
- package/dist/client/constants/common.js +1 -0
- package/dist/client/providers/hooks.js +1 -1
- package/dist/client/runtime/loader.js +1 -1
- package/dist/client/runtime/useSocketMessages.js +1 -1
- package/dist/{server/plugins/asyncapi-docs/template → client/templates/asyncapi-docs}/helpers.d.ts +3 -3
- package/dist/client/templates/asyncapi-docs/helpers.js +1 -0
- package/dist/{server/plugins/asyncapi-docs/template/AsyncApiDocs.d.ts → client/templates/asyncapi-docs/template.d.ts} +1 -1
- package/dist/{server/plugins/asyncapi-docs/template/AsyncApiDocs.js → client/templates/asyncapi-docs/template.js} +1 -1
- package/dist/{server/plugins/openapi-docs/template → client/templates/openapi-docs}/helpers.d.ts +14 -1
- package/dist/client/templates/openapi-docs/helpers.js +5 -0
- package/dist/{server/plugins/openapi-docs/template/OpenAPIDocs.d.ts → client/templates/openapi-docs/template.d.ts} +1 -1
- package/dist/{server/plugins/openapi-docs/template/OpenAPIDocs.js → client/templates/openapi-docs/template.js} +1 -1
- package/dist/client/utils/catalog/inject-catalog-items.d.ts +1 -1
- package/dist/client/utils/catalog/inject-catalog-items.js +1 -1
- package/dist/constants/catalog-entities.d.ts +12 -0
- package/dist/constants/catalog-entities.js +1 -0
- package/dist/constants/common.d.ts +2 -2
- package/dist/constants/common.js +1 -1
- package/dist/constants/l10n/langs/ar.js +1 -1
- package/dist/constants/l10n/langs/de.js +1 -1
- package/dist/constants/l10n/langs/en.js +1 -1
- package/dist/constants/l10n/langs/es.js +1 -1
- package/dist/constants/l10n/langs/fr.js +1 -1
- package/dist/constants/l10n/langs/hi.js +1 -1
- package/dist/constants/l10n/langs/it.js +1 -1
- package/dist/constants/l10n/langs/ja.js +1 -1
- package/dist/constants/l10n/langs/ko.js +1 -1
- package/dist/constants/l10n/langs/pl.js +1 -1
- package/dist/constants/l10n/langs/pt-BR.js +1 -1
- package/dist/constants/l10n/langs/pt.js +1 -1
- package/dist/constants/l10n/langs/ru.js +1 -1
- package/dist/constants/l10n/langs/uk.js +1 -1
- package/dist/constants/l10n/langs/zh.js +1 -1
- package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/get-inner-text.d.ts +1 -1
- package/dist/markdoc/helpers/get-inner-text.js +2 -0
- package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/get-variable.d.ts +2 -2
- package/dist/markdoc/helpers/get-variable.js +1 -0
- package/dist/markdoc/nodes/fence/index.js +1 -0
- package/dist/markdoc/nodes/heading.js +1 -0
- package/dist/{server/plugins/markdown/markdoc → markdoc}/tags/index.d.ts +6 -6
- package/dist/markdoc/tags/json-example.d.ts +3 -0
- package/dist/markdoc/tags/json-schema.d.ts +3 -0
- package/dist/markdoc/tags/openapi-code-sample.d.ts +3 -0
- package/dist/markdoc/tags/openapi-example.d.ts +3 -0
- package/dist/markdoc/tags/openapi-response-sample.d.ts +3 -0
- package/dist/markdoc/tags/replay-openapi.d.ts +3 -0
- package/dist/markdoc/types.d.ts +8 -0
- package/dist/markdoc/types.js +0 -0
- package/dist/server/api-routes/import-api-routes-handlers.js +1 -1
- package/dist/server/api-routes/run-api-routes-worker.js +1 -1
- package/dist/server/config/env-config.js +1 -0
- package/dist/{config → server/config}/env-schema.d.ts +6 -3
- package/dist/{config → server/config}/env-schemas/database.d.ts +1 -1
- package/dist/server/config/env-schemas/database.js +1 -0
- package/dist/{config → server/config}/env-schemas/organization-project.d.ts +3 -0
- package/dist/{config → server/config}/env-schemas/organization-project.js +1 -1
- package/dist/server/constants/common.d.ts +3 -0
- package/dist/server/constants/common.js +1 -1
- package/dist/server/constants/feedback.d.ts +6 -0
- package/dist/server/constants/feedback.js +1 -0
- package/dist/server/constants/plugins/catalog-entities.d.ts +0 -11
- package/dist/server/constants/plugins/catalog-entities.js +1 -1
- package/dist/server/entitlements/entitlements-provider.js +1 -1
- package/dist/server/esbuild/esbuild-logger.js +1 -1
- package/dist/server/esbuild/esbuild.js +1 -1
- package/dist/server/esbuild/plugins/assets-resolver.js +1 -1
- package/dist/server/esbuild/plugins/esbuild-compile-resolver.js +1 -1
- package/dist/server/esbuild/plugins/styled-components-ssr.js +1 -1
- package/dist/server/esbuild/plugins/themes-resolver.js +2 -2
- package/dist/server/{config/external-plugins.d.ts → external-plugins/resolve-external-plugins.d.ts} +2 -2
- package/dist/server/external-plugins/resolve-external-plugins.js +1 -0
- package/dist/server/fs/cache.js +1 -1
- package/dist/server/fs/fast-mtime.js +3 -3
- package/dist/server/fs/last-modified-tracker.js +1 -1
- package/dist/server/fs/utils/is-loader-cache-enabled.js +1 -1
- package/dist/server/node-bundle-entry.js +1 -1
- package/dist/server/plugins/analytics/adobe/index.js +1 -1
- package/dist/server/plugins/analytics/amplitude/index.js +1 -1
- package/dist/server/plugins/analytics/fullstory/index.js +1 -1
- package/dist/server/plugins/analytics/ga/index.js +1 -1
- package/dist/server/plugins/analytics/gtm/browser-hooks.js +1 -1
- package/dist/server/plugins/analytics/gtm/index.js +1 -1
- package/dist/server/plugins/analytics/heap/index.js +1 -1
- package/dist/server/plugins/analytics/rudderstack/index.js +1 -1
- package/dist/server/plugins/analytics/segment/index.js +1 -1
- package/dist/server/plugins/asyncapi-docs/index.js +1 -1
- package/dist/server/plugins/asyncapi-docs/search/get-ai-search-documents.js +27 -27
- package/dist/server/plugins/catalog-classic/get-server-props.js +1 -1
- package/dist/server/plugins/catalog-entities/database/catalog-entities-service.js +1 -1
- package/dist/server/plugins/catalog-entities/database/repositories/local/catalog-entities-local-repository.d.ts +2 -2
- package/dist/server/plugins/catalog-entities/database/repositories/local/catalog-entities-local-write-repository.js +1 -1
- package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/arazzo-entities-extractor.js +1 -1
- package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/asyncapi-entities-extractor.js +1 -1
- package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/base.js +1 -1
- package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/graphql-entities-extractor.js +1 -1
- package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/openapi-entities-extractor.js +1 -1
- package/dist/server/plugins/catalog-entities/extensions/extractors/fs-entities-extractor.js +1 -1
- package/dist/server/plugins/catalog-entities/plugin.js +1 -1
- package/dist/server/plugins/config-parser/loaders/redocly-config-loader.js +1 -1
- package/dist/server/plugins/config-parser/loaders/utils/read-and-validate-config.js +1 -1
- package/dist/server/plugins/default-theme/index.js +1 -1
- package/dist/server/plugins/entitlements/index.js +1 -1
- package/dist/server/plugins/graphql-docs/index.js +1 -1
- package/dist/server/plugins/lifecycle.js +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/code-walkthrough/filesets-resolver.js +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-code-snippet-from-file.js +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-html-href.js +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-html-source-attribute.js +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-image-src-set.js +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-image-src.js +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-json-example-ref.js +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-json-schema-ref.js +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-link.js +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-native-md-link.js +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-nav-links.js +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-open-api-ref.js +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-parsed-yaml.js +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-raw-content.js +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-relative-or-cdn-icon.js +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-relative-path.js +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-sample-from-json-schema.js +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-svg-content.js +1 -1
- package/dist/server/plugins/markdown/markdoc/import-user-tags.js +1 -1
- package/dist/server/plugins/markdown/markdoc/markdoc-options.js +1 -1
- package/dist/server/plugins/markdown/markdoc/partials.js +1 -1
- package/dist/server/plugins/markdown/markdoc/plugins/headings.js +1 -1
- package/dist/server/plugins/markdown/markdoc/plugins/render-mermaid.js +1 -1
- package/dist/server/plugins/markdown/markdoc/plugins/utils.js +1 -1
- package/dist/server/plugins/markdown/runtime-transform.js +1 -1
- package/dist/server/plugins/markdown/search/get-ai-search-documents.js +1 -1
- package/dist/server/plugins/markdown/search/get-search-documents.js +2 -2
- package/dist/server/plugins/markdown/search/nodes/section-node.js +1 -1
- package/dist/server/plugins/markdown/search/search-resolver.js +1 -1
- package/dist/server/plugins/markdown/search/to-markdown.js +17 -13
- package/dist/server/plugins/markdown/search/walk-sections.js +1 -1
- package/dist/server/plugins/markdown/utils/stringify-tag-children-objects.js +1 -1
- package/dist/server/plugins/mcp/docs-mcp/tools/docs-mcp-tool.d.ts +5 -1
- package/dist/server/plugins/mcp/docs-mcp/tools/docs-mcp-tool.js +1 -1
- package/dist/server/plugins/mcp/docs-mcp/tools/index.js +1 -1
- package/dist/server/plugins/mcp/docs-mcp/tools/search.d.ts +3 -2
- package/dist/server/plugins/mcp/docs-mcp/tools/search.js +6 -1
- package/dist/server/plugins/mcp/handlers/docs-mcp-handler.js +1 -1
- package/dist/server/plugins/mcp/handlers/handle-mcp-request.js +1 -1
- package/dist/server/plugins/mcp/servers/docs-server.d.ts +9 -2
- package/dist/server/plugins/mcp/servers/docs-server.js +1 -1
- package/dist/server/plugins/mcp/types.d.ts +20 -1
- package/dist/server/plugins/openapi-docs/decorators.js +1 -1
- package/dist/server/plugins/openapi-docs/get-server-props-custom-fields.js +1 -1
- package/dist/server/plugins/openapi-docs/index.js +1 -1
- package/dist/server/plugins/openapi-docs/instances.d.ts +33 -0
- package/dist/server/plugins/openapi-docs/instances.js +1 -0
- package/dist/server/plugins/openapi-docs/search/get-ai-search-documents.js +20 -20
- package/dist/server/plugins/openapi-docs/search-indexer.js +1 -1
- package/dist/server/plugins/scorecard-classic/compute-scorecard.js +4 -4
- package/dist/server/plugins/scorecard-classic/index.js +1 -1
- package/dist/server/plugins/scorecard-classic/lint.js +1 -1
- package/dist/server/plugins/scorecard-classic/template/Grid/Grid.d.ts +2 -1
- package/dist/server/plugins/scorecard-classic/template/Grid/Grid.js +3 -3
- package/dist/server/plugins/scorecard-classic/template/Grid/GridHeader.js +15 -9
- package/dist/server/plugins/scorecard-classic/template/Grid/GridRow.js +1 -1
- package/dist/server/plugins/scorecard-classic/template/index.styles.js +5 -6
- package/dist/server/plugins/scorecard-classic/template/views.js +1 -1
- package/dist/server/plugins/scorecards/database/scorecards-config-service.js +1 -1
- package/dist/server/plugins/scorecards/plugin.js +1 -1
- package/dist/server/plugins/scorecards/workers/run-scorecards-worker.js +1 -1
- package/dist/server/plugins/search/ai-indexer/prepare-semantic-documents.d.ts +11 -0
- package/dist/server/plugins/search/ai-indexer/prepare-semantic-documents.js +1 -0
- package/dist/server/plugins/search/documents/search-documents.js +1 -1
- package/dist/server/plugins/search/engines/flexsearch/index.js +1 -1
- package/dist/server/plugins/search/engines/typesense/index.js +1 -1
- package/dist/server/plugins/search/index.js +1 -1
- package/dist/server/plugins/search/llmstxt/index.js +1 -1
- package/dist/server/plugins/search/utils.d.ts +2 -0
- package/dist/server/plugins/search/utils.js +2 -2
- package/dist/server/plugins/sidebars/index.js +2 -2
- package/dist/server/plugins/sso/index.js +1 -1
- package/dist/server/providers/database/base-repository.js +1 -1
- package/dist/server/providers/database/database-connection-factory.js +1 -1
- package/dist/server/providers/database/database-preconnect-service.js +1 -1
- package/dist/server/providers/database/databases/sqld-sqlite/drizzle.config.js +1 -1
- package/dist/server/ssr/render.js +1 -1
- package/dist/server/ssr/server-side-props/get-server-props-from-user-handler.js +1 -1
- package/dist/server/ssr/utils.js +1 -1
- package/dist/server/store.d.ts +3 -1
- package/dist/server/store.js +1 -1
- package/dist/server/telemetry/index.js +1 -1
- package/dist/server/tools/notifiers/formatter.js +1 -1
- package/dist/server/tools/notifiers/helpers/colors.js +1 -1
- package/dist/server/tools/notifiers/logger.js +1 -1
- package/dist/server/tools/notifiers/reporter.js +1 -1
- package/dist/server/tools/notifiers/terminal-manager.js +1 -1
- package/dist/server/types/plugins/common.d.ts +1 -0
- package/dist/server/types/plugins/markdown.d.ts +0 -7
- package/dist/server/utils/ai-agent-detection.d.ts +16 -0
- package/dist/server/utils/ai-agent-detection.js +1 -0
- package/dist/server/utils/envs/load-env-variables.js +1 -1
- package/dist/server/utils/fs.js +1 -1
- package/dist/server/utils/index.d.ts +2 -2
- package/dist/server/utils/index.js +1 -1
- package/dist/server/utils/is-catalog-entities-enabled.js +1 -1
- package/dist/server/utils/is-scorecards-enabled.js +1 -1
- package/dist/server/utils/report-all-errors.js +1 -1
- package/dist/server/version.js +1 -1
- package/dist/server/web-server/auth.d.ts +2 -0
- package/dist/server/web-server/auth.js +4 -4
- package/dist/server/web-server/handle-api-route-request.js +1 -1
- package/dist/server/web-server/http.js +2 -2
- package/dist/server/web-server/middleware/apiKeyMiddleware.js +1 -1
- package/dist/server/web-server/middleware/catalogAuthMiddleware.js +1 -1
- package/dist/server/web-server/middleware/corsMiddleware.js +1 -1
- package/dist/server/web-server/middleware/dynamic-middleware/dynamic-middleware.js +1 -1
- package/dist/server/web-server/middleware/idleTimeoutMiddleware.js +1 -1
- package/dist/server/web-server/middleware/responseHeadersMiddleware.js +1 -1
- package/dist/server/web-server/mime-types.js +1 -1
- package/dist/server/web-server/routes/auth.js +1 -1
- package/dist/server/web-server/routes/cors-proxy.d.ts +5 -0
- package/dist/server/web-server/routes/cors-proxy.js +2 -0
- package/dist/server/web-server/routes/dynamic-route.js +1 -1
- package/dist/server/web-server/routes/error.js +1 -1
- package/dist/server/web-server/routes/feedback.js +1 -1
- package/dist/server/web-server/routes/helpers/get-md-asset-pathname.d.ts +2 -0
- package/dist/server/web-server/routes/helpers/get-md-asset-pathname.js +1 -0
- package/dist/server/web-server/routes/index.js +1 -1
- package/dist/server/web-server/routes/info.js +1 -1
- package/dist/server/web-server/routes/mcp-oauth.js +1 -1
- package/dist/server/web-server/routes/otel/otel.js +1 -1
- package/dist/server/web-server/routes/page-data.js +1 -1
- package/dist/server/web-server/routes/path-prefix-redirect.js +1 -1
- package/dist/server/web-server/routes/resolve-route.js +1 -1
- package/dist/server/web-server/routes/semantic-search.d.ts +4 -0
- package/dist/server/web-server/routes/semantic-search.js +1 -0
- package/dist/server/workers/worker-pool.js +1 -1
- package/dist/{server/utils → utils}/slugger.d.ts +13 -0
- package/package.json +11 -11
- package/dist/client/app/ErrorBubble/index.d.ts +0 -3
- package/dist/client/app/ErrorBubble/index.js +0 -59
- package/dist/client/app/PageCounter/index.d.ts +0 -3
- package/dist/client/app/PageCounter/index.js +0 -64
- package/dist/config/env-config.js +0 -1
- package/dist/config/env-schemas/database.js +0 -1
- package/dist/server/config/external-plugins.js +0 -1
- package/dist/server/plugins/asyncapi-docs/template/helpers.js +0 -1
- package/dist/server/plugins/markdown/markdoc/custom-components/html-script.js +0 -1
- package/dist/server/plugins/markdown/markdoc/custom-components/openapi/openapi-code-sample.js +0 -1
- package/dist/server/plugins/markdown/markdoc/custom-components/openapi/openapi-response-sample.js +0 -1
- package/dist/server/plugins/markdown/markdoc/custom-components/openapi/replay-openapi.js +0 -1
- package/dist/server/plugins/markdown/markdoc/helpers/get-inner-text.js +0 -2
- package/dist/server/plugins/markdown/markdoc/helpers/get-variable.js +0 -1
- package/dist/server/plugins/markdown/markdoc/hooks/use-store.js +0 -1
- package/dist/server/plugins/markdown/markdoc/nodes/fence/index.js +0 -1
- package/dist/server/plugins/markdown/markdoc/nodes/heading.js +0 -1
- package/dist/server/plugins/markdown/markdoc/tags/json-example.d.ts +0 -3
- package/dist/server/plugins/markdown/markdoc/tags/json-schema.d.ts +0 -3
- package/dist/server/plugins/markdown/markdoc/tags/openapi-code-sample.d.ts +0 -3
- package/dist/server/plugins/markdown/markdoc/tags/openapi-example.d.ts +0 -3
- package/dist/server/plugins/markdown/markdoc/tags/openapi-response-sample.d.ts +0 -3
- package/dist/server/plugins/markdown/markdoc/tags/replay-openapi.d.ts +0 -3
- package/dist/server/plugins/openapi-docs/template/helpers.js +0 -5
- package/dist/server/plugins/search/ai-indexer/prepare-ai-search-documents.d.ts +0 -6
- package/dist/server/plugins/search/ai-indexer/prepare-ai-search-documents.js +0 -1
- /package/dist/client/app/{ErrorBubble → DevModeFloatingBar}/DetailedErrors.d.ts +0 -0
- /package/dist/client/app/{ErrorBubble → DevModeFloatingBar}/DetailedErrors.js +0 -0
- /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/html-script.d.ts +0 -0
- /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/index.d.ts +0 -0
- /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/index.js +0 -0
- /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/explain-step.d.ts +0 -0
- /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/explain-step.js +0 -0
- /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/get-operation-info-by-id.d.ts +0 -0
- /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/get-operation-info-by-id.js +0 -0
- /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/get-operation-info-by-pointer.d.ts +0 -0
- /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/get-operation-info-by-pointer.js +0 -0
- /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/get-operation.d.ts +0 -0
- /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/get-operation.js +0 -0
- /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/index.d.ts +0 -0
- /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/index.js +0 -0
- /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/types/index.d.ts +0 -0
- /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/types/index.js +0 -0
- /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/types/operation-identifier.d.ts +0 -0
- /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/types/operation-identifier.js +0 -0
- /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/types/operation-info.d.ts +0 -0
- /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/types/operation-info.js +0 -0
- /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/types/operation-parameters.d.ts +0 -0
- /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/types/operation-parameters.js +0 -0
- /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/index.d.ts +0 -0
- /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/index.js +0 -0
- /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/json-example.d.ts +0 -0
- /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/json-example.js +0 -0
- /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/json-schema.d.ts +0 -0
- /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/json-schema.js +0 -0
- /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/openapi-code-sample.d.ts +0 -0
- /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/openapi-example.d.ts +0 -0
- /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/openapi-example.js +0 -0
- /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/openapi-response-sample.d.ts +0 -0
- /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/replay-openapi.d.ts +0 -0
- /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/step-by-step-wrapper.d.ts +0 -0
- /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/step-by-step-wrapper.js +0 -0
- /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/styled.elements.d.ts +0 -0
- /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/styled.elements.js +0 -0
- /package/dist/{server/plugins/markdown → client/app}/markdoc/hooks/use-store.d.ts +0 -0
- /package/dist/{server/plugins/openapi-docs/template → client/templates/openapi-docs}/mock-server-config.d.ts +0 -0
- /package/dist/{server/plugins/openapi-docs/template → client/templates/openapi-docs}/mock-server-config.js +0 -0
- /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/definition-path.d.ts +0 -0
- /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/definition-path.js +0 -0
- /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/index.d.ts +0 -0
- /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/index.js +0 -0
- /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/json-example-ref.d.ts +0 -0
- /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/json-example-ref.js +0 -0
- /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/json-schema-ref.d.ts +0 -0
- /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/json-schema-ref.js +0 -0
- /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/parsed-yaml.d.ts +0 -0
- /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/parsed-yaml.js +0 -0
- /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/raw-content.d.ts +0 -0
- /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/raw-content.js +0 -0
- /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/sample-from-json-schema.d.ts +0 -0
- /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/sample-from-json-schema.js +0 -0
- /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/extract-rbac-from-condition-node.d.ts +0 -0
- /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/extract-rbac-from-condition-node.js +0 -0
- /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/get-node-attribute.d.ts +0 -0
- /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/get-node-attribute.js +0 -0
- /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-code-node.d.ts +0 -0
- /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-code-node.js +0 -0
- /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-conditional-node.d.ts +0 -0
- /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-conditional-node.js +0 -0
- /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-content-node.d.ts +0 -0
- /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-content-node.js +0 -0
- /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-example-node.d.ts +0 -0
- /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-example-node.js +0 -0
- /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-fence-node.d.ts +0 -0
- /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-fence-node.js +0 -0
- /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-function.d.ts +0 -0
- /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-function.js +0 -0
- /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-list-node.d.ts +0 -0
- /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-list-node.js +0 -0
- /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-node.d.ts +0 -0
- /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-node.js +0 -0
- /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-string-node.d.ts +0 -0
- /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-string-node.js +0 -0
- /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-tag.d.ts +0 -0
- /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-tag.js +0 -0
- /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-text-node.d.ts +0 -0
- /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-text-node.js +0 -0
- /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-variable.d.ts +0 -0
- /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-variable.js +0 -0
- /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/remove-markdoc-tags.d.ts +0 -0
- /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/remove-markdoc-tags.js +0 -0
- /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/set-node-attribute-value.d.ts +0 -0
- /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/set-node-attribute-value.js +0 -0
- /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/fence/escape-html.d.ts +0 -0
- /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/fence/escape-html.js +0 -0
- /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/fence/index.d.ts +0 -0
- /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/gfm-list-item.d.ts +0 -0
- /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/gfm-list-item.js +0 -0
- /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/heading.d.ts +0 -0
- /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/index.d.ts +0 -0
- /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/index.js +0 -0
- /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/table.d.ts +0 -0
- /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/table.js +0 -0
- /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/text.d.ts +0 -0
- /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/text.js +0 -0
- /package/dist/{server/plugins/markdown/markdoc → markdoc}/tags/index.js +0 -0
- /package/dist/{server/plugins/markdown/markdoc → markdoc}/tags/json-example.js +0 -0
- /package/dist/{server/plugins/markdown/markdoc → markdoc}/tags/json-schema.js +0 -0
- /package/dist/{server/plugins/markdown/markdoc → markdoc}/tags/openapi-code-sample.js +0 -0
- /package/dist/{server/plugins/markdown/markdoc → markdoc}/tags/openapi-example.js +0 -0
- /package/dist/{server/plugins/markdown/markdoc → markdoc}/tags/openapi-response-sample.js +0 -0
- /package/dist/{server/plugins/markdown/markdoc → markdoc}/tags/replay-openapi.js +0 -0
- /package/dist/{config → server/config}/env-config.d.ts +0 -0
- /package/dist/{config → server/config}/env-schema.js +0 -0
- /package/dist/{config → server/config}/env-schemas/api-urls.d.ts +0 -0
- /package/dist/{config → server/config}/env-schemas/api-urls.js +0 -0
- /package/dist/{config → server/config}/env-schemas/auth.d.ts +0 -0
- /package/dist/{config → server/config}/env-schemas/auth.js +0 -0
- /package/dist/{config → server/config}/env-schemas/catalog.d.ts +0 -0
- /package/dist/{config → server/config}/env-schemas/catalog.js +0 -0
- /package/dist/{config → server/config}/env-schemas/environment-detection.d.ts +0 -0
- /package/dist/{config → server/config}/env-schemas/environment-detection.js +0 -0
- /package/dist/{config → server/config}/env-schemas/feature-flags.d.ts +0 -0
- /package/dist/{config → server/config}/env-schemas/feature-flags.js +0 -0
- /package/dist/{config → server/config}/env-schemas/scorecards.d.ts +0 -0
- /package/dist/{config → server/config}/env-schemas/scorecards.js +0 -0
- /package/dist/{config → server/config}/env-schemas/search.d.ts +0 -0
- /package/dist/{config → server/config}/env-schemas/search.js +0 -0
- /package/dist/{config → server/config}/env-schemas/server-config.d.ts +0 -0
- /package/dist/{config → server/config}/env-schemas/server-config.js +0 -0
- /package/dist/{config → server/config}/env-schemas/site.d.ts +0 -0
- /package/dist/{config → server/config}/env-schemas/site.js +0 -0
- /package/dist/{config → server/config}/env-schemas/ssr.d.ts +0 -0
- /package/dist/{config → server/config}/env-schemas/ssr.js +0 -0
- /package/dist/{config → server/config}/env-schemas/telemetry.d.ts +0 -0
- /package/dist/{config → server/config}/env-schemas/telemetry.js +0 -0
- /package/dist/{config → server/config}/env-schemas/test.d.ts +0 -0
- /package/dist/{config → server/config}/env-schemas/test.js +0 -0
- /package/dist/server/{config → external-plugins}/resolve-module.d.ts +0 -0
- /package/dist/server/{config → external-plugins}/resolve-module.js +0 -0
- /package/dist/{server/utils → utils}/conflict-resolvers.d.ts +0 -0
- /package/dist/{server/utils → utils}/conflict-resolvers.js +0 -0
- /package/dist/{server/utils → utils}/slugger.js +0 -0
|
@@ -1,17 +1,21 @@
|
|
|
1
|
-
import{isPrimitive as
|
|
2
|
-
`);break;case"fence":const t
|
|
3
|
-
`);break;case"item":
|
|
4
|
-
`).join(""));break;case"thead":const
|
|
5
|
-
`);break;case"tr":const
|
|
6
|
-
`);break;case"em":
|
|
7
|
-
`);break;case"hr":
|
|
1
|
+
import{isPrimitive as w}from"../../../../utils/guards/is-primitive.js";import{getNodeAttribute as t}from"../../../../markdoc/helpers/get-node-attribute.js";import{getVariable as C}from"../../../../markdoc/helpers/get-variable.js";import{isTag as E}from"../../../../markdoc/helpers/guards/is-tag.js";import{isNode as N}from"../../../../markdoc/helpers/guards/is-node.js";import{isConditionalNode as v}from"../../../../markdoc/helpers/guards/is-conditional-node.js";import{isVariable as A}from"../../../../markdoc/helpers/guards/is-variable.js";import{isExampleNode as S}from"../../../../markdoc/helpers/guards/is-example-node.js";import{isFenceNode as x}from"../../../../markdoc/helpers/guards/is-fence-node.js";function a(s,r={}){const n=[];for(const e of s){if(w(e)){const i=r.isTrim?u(String(e)):String(e);i&&n.push(i)}else if(N(e))switch(e.type){case"text":n.push(a([t(e,"content")],r));break;case"code":n.push(`\`${a([t(e,"content")],r)}\``);break;case"blockquote":n.push(`> ${a(e.children,r)}
|
|
2
|
+
`);break;case"fence":const i=t(e,"process")===!1;n.push(o(e,r,i));break;case"list":const h=t(e,"ordered")||!1,d=t(e,"marker"),f=e.children.map((c,l)=>`${" ".repeat((r?.indent??0)*2)}${h?l+1:""}${d} ${a([c],{...r??{},indent:(r?.indent??0)+1})}`);n.push(`${f.join("")}
|
|
3
|
+
`);break;case"item":n.push(e.children.map(c=>`${a([c],r).trimEnd()}
|
|
4
|
+
`).join(""));break;case"thead":const $=e.children.map(c=>a([c],r));n.push(`${$}| ${" --- |".repeat(e.children?.[0]?.children.length)}
|
|
5
|
+
`);break;case"tr":const p=e.children.map(c=>a([c],r));n.push(`| ${p.join(" | ")} |
|
|
6
|
+
`);break;case"em":n.push(`*${a(e.children,r)}*`);break;case"strong":n.push(`**${a(e.children,r)}**`);break;case"softbreak":case"hardbreak":n.push(`
|
|
7
|
+
`);break;case"hr":n.push(`
|
|
8
8
|
|
|
9
9
|
---
|
|
10
10
|
|
|
11
|
-
`);break;case"heading":const
|
|
12
|
-
`);break;case"image":const
|
|
13
|
-
`);break;case"tag":if(
|
|
14
|
-
\`\`\`${
|
|
15
|
-
${
|
|
11
|
+
`);break;case"heading":const k=t(e,"level")??0;n.push(`${"#".repeat(k)} ${a(e.children,r)}
|
|
12
|
+
`);break;case"image":const b=t(e,"alt")||"",g=t(e,"src")||"";n.push(``);break;case"link":const T=t(e,"href")||"";n.push(`[${a(e.children,r)}](${T})`);break;case"paragraph":case"table":n.push(`${a(e.children,r)}
|
|
13
|
+
`);break;case"tag":if(v(e)&&r.skipConditionals)continue;if(S(e)){n.push(...e.children.map(c=>{if(x(c)){const l=t(c,"process")!==!0;return o(c,r,l)}return a([c],r)}));continue}if(e.tag==="code-snippet"){const c=t(e,"rawContent");if(c){const l=t(e,"language"),m=t(e,"title"),j=`
|
|
14
|
+
\`\`\`${`${l||""}${m?`${l?" ":""}${m}`:""}`}
|
|
15
|
+
${c.trimEnd()}
|
|
16
16
|
\`\`\`
|
|
17
|
-
`}
|
|
17
|
+
`;n.push(j)}continue}n.push(`${a(e.children,r)}`);break;default:n.push(a(e.children,r));break}else E(e)&&n.push(a(e.children,r));A(e)&&n.push(a([C(e,r.variables)],r))}return r.isTrim?u(n.map(e=>u(e)).join("")):n.join("")}function u(s){return s.replace(/^[ \t\r\f]+|[ \t\r\f]+$/g,"")}function o(s,r={},n=!1){const e=t(s,"title"),i=t(s,"language"),h=`${i||""}${e?`${i?" ":""}${e}`:""}`,d=n?(t(s,"content")||"").trimEnd():a(s.children,r).trimEnd();return`
|
|
18
|
+
\`\`\`${h}
|
|
19
|
+
${d}
|
|
20
|
+
\`\`\`
|
|
21
|
+
`}export{a as toMarkdown};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{logger as a}from"../../../tools/notifiers/logger.js";import{
|
|
1
|
+
import{logger as a}from"../../../tools/notifiers/logger.js";import{isNode as f}from"../../../../markdoc/helpers/guards/is-node.js";import{isConditionalNode as u}from"../../../../markdoc/helpers/guards/is-conditional-node.js";import{isContentNode as y}from"../../../../markdoc/helpers/guards/is-content-node.js";import{getNodeAttribute as h}from"../../../../markdoc/helpers/get-node-attribute.js";import{extractRbacFromCondition as N}from"../../../../markdoc/helpers/extract-rbac-from-condition-node.js";import{TextNode as e}from"./nodes/text-node.js";import{TAG_TITLE_ATTRIBUTES as T,TagNode as n}from"./nodes/tag-node.js";import{HeadingNode as p}from"./nodes/heading-node.js";class C{#t;#o;#i;#s;constructor({ast:i,partials:t,skipConditionals:r=!1,getInnerContent:s}){if(this.#t=i,this.#o=t,this.#i=r,this.#s=s,!this.#t||!f(this.#t))throw new Error("ast is not a valid Markdoc Node.")}*transform(){yield*this.#l(this.#t,{parentNode:null})}*#l(i,t,r=this.#s){if(!(!i||!f(i))){if(u(i)){if(this.#i)return;const s=N(i);s!==null&&(yield*this.#r(i,{...t,rbacTeam:s},r));return}if(y(i)){yield new e({node:i,content:r([i],{skipConditionals:this.#i}),...t});return}if(i.type==="heading"){yield new p({node:i,content:r([i],{skipConditionals:this.#i}),rbacTeam:t?.rbacTeam});return}if(i.type==="tag"){yield*this.#c(i,t,r);return}yield*this.#r(i,t,r)}}*#c(i,t,r=this.#s){switch(i.tag){case"partial":{const s=i.attributes.file,o=i.attributes.variables??{};if(s&&this.#o[s]){yield*this.#l(this.#o[s],t,(l,c)=>r(l,{...c,variables:o}));return}a.warn(`Could not create search indexes for partial \u201C${s}\u201D: file not found`);return}case"cards":case"tabs":case"code-walkthrough":{yield*this.#r(i,t,r);return}case"markdoc-example":{const s=r([i],{skipConditionals:this.#i});yield new e({node:i,content:s,...t});return}case"code-snippet":{const s=h(i,"title"),o=r([i],{skipConditionals:this.#i});if(s){const l=new n({node:i,content:s,...t});t={...t,parentNode:l},yield l}o&&(yield new e({node:i,content:o,...t}));return}default:{const s=T.find(c=>c in i.attributes),o=(s&&h(i,s))??"",l=typeof o=="string"?o:r([o]);if(l){const c=new n({node:i,content:l,...t});t={...t,parentNode:c},yield c}yield*this.#r(i,t,r);return}}}*#r(i,t,r=this.#s){for(const s of[...Object.values(i.slots),...i.children])for(const o of this.#l(s,t,r))o instanceof p&&(t={...t,parentNode:o}),yield o}}export{C as AstToSearchNodeTransformer};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isTag as e}from"
|
|
1
|
+
import{isTag as e}from"../../../../markdoc/helpers/guards/is-tag.js";function f(n){!n||!Array.isArray(n?.children)||n.children.forEach((r,i)=>{if(!(typeof r!="object"||r===null)){if(e(r)){f(r);return}n.children[i]=JSON.stringify(r,null,2)}})}export{f as stringifyTagChildrenObjects};
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import type { JSONSchemaType } from '@redocly/ajv';
|
|
2
|
+
import type { ApiFunctionsContext } from '@redocly/config';
|
|
2
3
|
import type { McpServer } from '@redocly/mcp-typescript-sdk/server/mcp.js';
|
|
3
4
|
import type { OpenAPIDefinition } from '@redocly/openapi-docs';
|
|
4
|
-
import type { AccessInfo, ApiDescriptionInfo, McpToolWorkerParams, McpToolWorkerResponse, ToolArgsMap } from '../../types.js';
|
|
5
|
+
import type { AccessInfo, ApiDescriptionInfo, McpToolWorkerParams, McpToolWorkerResponse, RealmMcpTool, ToolArgsMap } from '../../types.js';
|
|
5
6
|
export type DocsMcpToolRegistrationOptions = {
|
|
6
7
|
server: McpServer;
|
|
8
|
+
apiContext: ApiFunctionsContext;
|
|
7
9
|
baseUrl: string;
|
|
8
10
|
outdir: string;
|
|
9
11
|
apiDescriptionsMap: Record<string, ApiDescriptionInfo>;
|
|
10
12
|
headers?: Record<string, string | string[] | undefined>;
|
|
11
13
|
accessInfo: AccessInfo;
|
|
14
|
+
products?: string[];
|
|
15
|
+
customTools?: RealmMcpTool[];
|
|
12
16
|
};
|
|
13
17
|
/** Keys that can be passed to the tool context (excludes 'server' which is not serializable) */
|
|
14
18
|
export type ContextKey = Exclude<keyof DocsMcpToolRegistrationOptions, 'server'>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{telemetry as
|
|
1
|
+
import{telemetry as o}from"../../../../telemetry/index.js";import{mcpToolWorkers as n,MCP_TOOL_WORKER_KEY as a}from"../../../../workers/mcp-tool-worker-pool.js";import{findApiDescriptionByName as p}from"../utils.js";import{getApiDescriptionFromFs as m}from"./utils.js";function u(i,t,s){return{toolName:i,args:t,context:s}}class g{schema;constructor(t){this.schema=t}getContext(t){const s={};for(const e of this.requiredContext)s[e]=t[e];return{...s,apiDescriptionsMap:t.apiDescriptionsMap}}register(t){const s=async(e,r)=>{const c=u(this.name,e,this.getContext(t));return await n.exec(a,[c],{timeout:6e4})};t.server.tool(this.name,this.description,this.schema,s)}async execute(t,s){try{const e=await this.executeAction(t,s);return e.isError?o.sendMcpErrorMessage([{object:"mcp_server",server_type:"docs",tool:this.name,message:`${e.content.map(({text:r})=>r).join(" ")}`,stack:""}]):o.sendMcpToolCalledMessage([{object:"mcp_server",server_type:"docs",tool:this.name}]),e}catch(e){throw o.sendMcpErrorMessage([{object:"mcp_server",server_type:"docs",tool:this.name,message:e instanceof Error?e.message:String(e),stack:e instanceof Error&&e.stack||""}]),e}}async getApiDefinition(t,s){if(!s.outdir||!s.accessInfo)throw new Error("Missing required context: outdir and accessInfo");const e=p(s.apiDescriptionsMap,t);if(!e)return{success:!1,response:{content:[{type:"text",text:`No API found matching "${t}".`}]}};const r=await m({relativePath:e.relativePath||"",outdir:s.outdir,accessInfo:s.accessInfo});return r?{success:!0,definition:r}:{success:!1,response:{content:[{type:"text",text:`Spec not found from the file system with "${t}".`}]}}}}export{g as DocsMcpTool};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{GetEndpointInfoTool as
|
|
1
|
+
import{GetEndpointInfoTool as s}from"./get-endpoint-info.js";import{GetEndpointsTool as a}from"./get-endpoints.js";import{GetFullApiDescriptionTool as c}from"./get-full-api-description.js";import{GetSecuritySchemesTool as f}from"./get-security-schemes.js";import{ListApisTool as p}from"./list-apis.js";import{SearchTool as l}from"./search.js";import{WhoAmITool as d}from"./whoami.js";import{shouldHandleMcpAuth as u}from"../../auth/auth-handlers.js";const t=[new p,new a,new s,new f,new c,new l,new d],h=t.reduce((e,o)=>(e[o.name]=o,e),{});function G(e){const o=new Set;t.forEach(r=>{r.name==="whoami"&&!u(e.accessInfo.requiresLogin,e.accessInfo.rbac)||(o.add(r.name),r.register(e))}),e.customTools?.forEach(r=>{w(r,e,o)})}function w(e,o,r){if(r.has(e.name))throw new Error(`MCP tool "${e.name}" is already registered`);r.add(e.name);const n=e;o.server.tool(n.name,n.description,n.inputSchema,async(i,m)=>await n.handler(i,o.apiContext,m))}function I(e){return h[e]}import{DocsMcpTool as L}from"./docs-mcp-tool.js";export{L as DocsMcpTool,t as docsTools,I as getDocsTool,G as registerDocsTools};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { McpToolWorkerParams, McpToolWorkerResponse, ToolArgsMap } from '../../types.js';
|
|
2
|
-
import { DocsMcpTool, type ContextKey } from './docs-mcp-tool.js';
|
|
2
|
+
import { DocsMcpTool, type DocsMcpToolRegistrationOptions, type ContextKey } from './docs-mcp-tool.js';
|
|
3
3
|
export declare class SearchTool extends DocsMcpTool<'search'> {
|
|
4
4
|
readonly name = "search";
|
|
5
5
|
readonly description = "Search across the documentation to fetch relevant content for a given query";
|
|
6
6
|
readonly requiredContext: readonly ContextKey[];
|
|
7
|
-
constructor();
|
|
7
|
+
constructor(products?: string[]);
|
|
8
|
+
register(options: DocsMcpToolRegistrationOptions): void;
|
|
8
9
|
protected executeAction(args: ToolArgsMap['search'], context: McpToolWorkerParams['context']): Promise<McpToolWorkerResponse>;
|
|
9
10
|
}
|
|
10
11
|
//# sourceMappingURL=search.d.ts.map
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
import{withPathPrefix as
|
|
1
|
+
import{withPathPrefix as f}from"@redocly/theme/core/utils";import{ServerRoutes as y}from"../../../../../constants/common.js";import{DocsMcpTool as m}from"./docs-mcp-tool.js";class b extends m{name="search";description="Search across the documentation to fetch relevant content for a given query";requiredContext=["baseUrl","headers","products"];constructor(t){super(h(t))}register(t){this.schema=h(t.products),super.register(t)}async executeAction(t,r){const{query:p,product:l}=t;if(!r.baseUrl)throw new Error("Missing required context: baseUrl");const d=JSON.stringify({query:p,product:l});let n=`${r.baseUrl}${f(y.SEMANTIC_SEARCH)}`;n.startsWith("http://")&&(n=n.replace(/^http:\/\//,"https://"));const i=r.headers?.authorization,a=i?`authorization=${String(i).replace(/^Bearer /,"")}`:"";try{const c=await fetch(n,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json",...a?{Cookie:a}:{}},body:d});if(!c.ok)return{content:[{type:"text",text:"Error retrieving search results."}],isError:!0};const o=await c.json();if(!o||o.length===0)return{content:[{type:"text",text:"No results found."}]};const u=o.map(s=>`### [${s.title}](${new URL(s.url,r.baseUrl).toString()})
|
|
2
|
+
|
|
3
|
+
${s.content}
|
|
4
|
+
`).join(`
|
|
5
|
+
|
|
6
|
+
`).trim();return{content:[{type:"text",text:u.length?u:"No results found."}]}}catch{return{content:[{type:"text",text:"Error retrieving search results."}],isError:!0}}}}function h(e){const t=e&&e.length>0;return{type:"object",required:["query"],additionalProperties:!1,properties:{query:{type:"string",description:"Search query. Should be a single word or that phrase that is presented in a documentation.",minLength:1},...t?{product:{type:"string",description:"Optional product name to filter search results by specific product.",enum:e,nullable:!0}}:{}}}}export{b as SearchTool};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{telemetry as m}from"../../../telemetry/index.js";import{constructInvalidTokenResponse as y,constructUnauthorizedResponse as b,handleMcpAuth as A,shouldHandleMcpAuth as L}from"../auth/auth-handlers.js";import{McpServerType as u}from"../constants.js";import{createDocsMcpServer as S}from"../servers/docs-server.js";import{filterApiDescriptionsByRbac as T}from"../utils.js";import{createInternalServerError as I}from"./errors.js";import{createMcpRequestHandler as R}from"./mcp-request-handler.js";async function w(e,s,i,n){try{m.initialize();const r=s,t=r?.props?.config?.apiDescriptionsMap||{},a=r?.props?.customTools||[],o=r?.props?.outdir||"",f=r?.props?.config?.mcpDocsServerName||"Docs MCP server",l=new URL(n.url).origin,{user:c,config:{rbac:p={},mcp:d={}}}=e,g=T(t,c,p,e.config.requiresLogin||!1),v=d.docs?.name||f,M=e.config.products?Object.values(e.config.products).map(h=>h?.name):[],D={rbac:p,email:c?.email,teams:c?.teams,isAuthenticated:!!c?.isAuthenticated,requiresLogin:e.config.requiresLogin||!1};return await S({name:v,baseUrl:l,headers:i,apiDescriptionsMap:g,outdir:o,accessInfo:D,apiContext:e,customTools:a,products:M})}catch(r){throw m.sendMcpErrorMessage([{object:"mcp_server",server_type:u.Docs,message:r?.message||"",stack:r?.stack||""}]),I(r?.message||"Internal server error mcp docs")}}const U=R({createServerInstance:w,serverType:u.Docs}),k=async(e,s,i)=>{const n=!!s?.config?.requiresLogin,r=s?.config?.rbac;if(L(n,r)){const{isAuthenticated:t,isTokenValid:a,currentUser:o}=await A(e,s);if(!t)return b(new URL(e.url).origin);if(!a)return y();o&&(s.user=o)}return U(e,s,i)};var _=k;export{_ as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{withPathPrefix as
|
|
1
|
+
import{withPathPrefix as T}from"@redocly/theme/core/utils";import{importApiRoutesHandler as h}from"../../../api-routes/import-api-routes-handlers.js";import{enhanceContext as y}from"../../../api-routes/helpers/enhance-context.js";import{telemetry as A}from"../../../telemetry/index.js";import{KvService as g}from"../../../persistence/kv/services/kv-service.js";import{envConfig as d}from"../../../config/env-config.js";import{logger as u}from"../../../tools/notifiers/logger.js";async function I(t,s,o){const e=s.get("auth"),r=await o.resolveRouteStaticData(t)||{},a=T(t.slug),{requestHandlers:n}=await h(o.serverOutDir),l=n[t.requestHandlerId],c=(await l()).default,p=await w(o,n),m=async()=>await g.getInstance({baseDbDir:o.serverOutDir,sqldRemoteDatabaseUrl:d.SQLD_REMOTE_DATABASE_URL,sqldRemoteDatabaseAuthToken:d.SQLD_REMOTE_DATABASE_AUTH_TOKEN}),f=y({honoCtx:s,ctx:{user:{teams:e.teams,email:e.claims.email,claims:e.claims,idpAccessToken:e.idpAccessToken,idpId:e.claims.idpId,isAuthenticated:e.isAuthenticated},config:o.config},telemetry:A,getKv:m}),i=await c(s.req.raw,f,{...r,props:{...r.props,routeSlug:a,outdir:o.outdir,customTools:p}});return i instanceof Response?i:typeof i=="string"?new Response(i,{headers:{"Content-Type":"text/plain"}}):new Response(JSON.stringify(i),{headers:{"Content-Type":"application/json"}})}async function w(t,s){const o=[];for(const e of t.mcpToolRequestHandlerIds.keys()){const r=s[e];if(!r){u.warn(`MCP tool module "${e}" was not found`);continue}const a=await r(),n=a.default??a.tools,l=Array.isArray(n)?n:[n];for(const c of l){if(!R(c)){u.warn(`Invalid MCP tool export in module "${e}"`);continue}o.push(c)}}return o}function R(t){return t!==null&&typeof t=="object"&&typeof t.name=="string"&&typeof t.description=="string"&&typeof t.handler=="function"&&t.inputSchema!==void 0}export{I as handleMcpRequest};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { AccessInfo, ApiDescriptionInfo, DocsServerDependencies, McpServerType } from '../types.js';
|
|
1
|
+
import type { AccessInfo, ApiDescriptionInfo, DocsServerDependencies, McpServerType, RealmMcpTool } from '../types.js';
|
|
2
|
+
import type { ApiFunctionsContext } from '@redocly/config';
|
|
2
3
|
import { BaseMcpServer } from './base-server.js';
|
|
3
4
|
export declare class DocsMcpServer extends BaseMcpServer {
|
|
4
5
|
private readonly dependencies;
|
|
@@ -7,16 +8,22 @@ export declare class DocsMcpServer extends BaseMcpServer {
|
|
|
7
8
|
headers: Record<string, string | string[] | undefined>;
|
|
8
9
|
outdir: string;
|
|
9
10
|
accessInfo: AccessInfo;
|
|
11
|
+
apiContext: ApiFunctionsContext;
|
|
12
|
+
customTools?: RealmMcpTool[];
|
|
13
|
+
products?: string[];
|
|
10
14
|
});
|
|
11
15
|
protected registerTools(): void;
|
|
12
16
|
protected getServerType(): McpServerType;
|
|
13
17
|
}
|
|
14
|
-
export declare function createDocsMcpServer({ name, baseUrl, headers, apiDescriptionsMap, outdir, accessInfo, }: {
|
|
18
|
+
export declare function createDocsMcpServer({ name, baseUrl, headers, apiDescriptionsMap, outdir, accessInfo, apiContext, customTools, products, }: {
|
|
15
19
|
name: string;
|
|
16
20
|
baseUrl: string;
|
|
17
21
|
headers: Record<string, string | string[] | undefined>;
|
|
18
22
|
apiDescriptionsMap: Record<string, ApiDescriptionInfo>;
|
|
19
23
|
outdir: string;
|
|
20
24
|
accessInfo: AccessInfo;
|
|
25
|
+
apiContext: ApiFunctionsContext;
|
|
26
|
+
customTools?: RealmMcpTool[];
|
|
27
|
+
products: string[];
|
|
21
28
|
}): Promise<import("../types.js").McpServerInstance>;
|
|
22
29
|
//# sourceMappingURL=docs-server.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{BaseMcpServer as
|
|
1
|
+
import{BaseMcpServer as d}from"./base-server.js";import{registerDocsTools as a}from"../docs-mcp/tools/index.js";import{McpServerType as h}from"../constants.js";class u extends d{dependencies;constructor(e){super({name:e.name,version:new Date().toISOString().slice(0,10)}),this.dependencies=e}registerTools(){a({server:this.server,apiDescriptionsMap:this.dependencies.apiDescriptionsMap,baseUrl:this.dependencies.baseUrl,outdir:this.dependencies.outdir,headers:this.dependencies.headers,accessInfo:this.dependencies.accessInfo,apiContext:this.dependencies.apiContext,customTools:this.dependencies.customTools,products:this.dependencies.products})}getServerType(){return h.Docs}}async function D({name:s,baseUrl:e,headers:r,apiDescriptionsMap:t,outdir:i,accessInfo:n,apiContext:o,customTools:c,products:p}){return await new u({name:s,baseUrl:e,headers:r,apiDescriptionsMap:t,outdir:i,accessInfo:n,apiContext:o,customTools:c,products:p}).initialize()}export{u as DocsMcpServer,D as createDocsMcpServer};
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import type { OpenAPIPath } from '@redocly/openapi-docs/src/types';
|
|
2
|
+
import type { JSONSchemaType } from '@redocly/ajv';
|
|
3
|
+
import type { ApiFunctionsContext } from '@redocly/config';
|
|
2
4
|
import type { McpServer } from '@redocly/mcp-typescript-sdk/server/mcp.js';
|
|
3
5
|
import type { StreamableHTTPServerTransport } from '@redocly/mcp-typescript-sdk/server/streamableHttp.js';
|
|
4
|
-
import type {
|
|
6
|
+
import type { RequestHandlerExtra } from '@redocly/mcp-typescript-sdk/shared/protocol.js';
|
|
7
|
+
import type { CallToolResult, ServerNotification, ServerRequest } from '@redocly/mcp-typescript-sdk/types.js';
|
|
5
8
|
import type { OpenAPIServer } from '@redocly/openapi-docs/lib/types/open-api.js';
|
|
6
9
|
import type { McpErrorCodes, McpServerType } from './constants';
|
|
7
10
|
import type { RbacConfig, PageStaticData } from '@redocly/config';
|
|
@@ -71,6 +74,15 @@ export type McpUserInfo = {
|
|
|
71
74
|
exp?: number;
|
|
72
75
|
[key: string]: any;
|
|
73
76
|
};
|
|
77
|
+
export type RealmMcpToolContext = ApiFunctionsContext;
|
|
78
|
+
export type RealmMcpToolHandler<TArgs extends Record<string, unknown>> = (args: TArgs, context: RealmMcpToolContext, extra: RequestHandlerExtra<ServerRequest, ServerNotification>) => Promise<CallToolResult> | CallToolResult;
|
|
79
|
+
export type RealmMcpTool<TArgs extends Record<string, unknown> = Record<string, unknown>> = {
|
|
80
|
+
name: string;
|
|
81
|
+
description: string;
|
|
82
|
+
inputSchema: JSONSchemaType<TArgs>;
|
|
83
|
+
handler: RealmMcpToolHandler<TArgs>;
|
|
84
|
+
};
|
|
85
|
+
export type RealmMcpToolsModule = RealmMcpTool | RealmMcpTool[];
|
|
74
86
|
export type ToolArgsMap = {
|
|
75
87
|
'list-apis': {
|
|
76
88
|
filter?: string;
|
|
@@ -93,6 +105,7 @@ export type ToolArgsMap = {
|
|
|
93
105
|
};
|
|
94
106
|
search: {
|
|
95
107
|
query: string;
|
|
108
|
+
product?: string;
|
|
96
109
|
};
|
|
97
110
|
whoami: Record<string, never>;
|
|
98
111
|
};
|
|
@@ -106,9 +119,15 @@ export type McpToolWorkerParams = {
|
|
|
106
119
|
accessInfo?: AccessInfo;
|
|
107
120
|
baseUrl?: string;
|
|
108
121
|
headers?: Record<string, string | string[] | undefined>;
|
|
122
|
+
products?: string[];
|
|
109
123
|
};
|
|
110
124
|
};
|
|
111
125
|
}[keyof ToolArgsMap];
|
|
126
|
+
export type SemanticSearchResult = {
|
|
127
|
+
title: string;
|
|
128
|
+
url: string;
|
|
129
|
+
content: string;
|
|
130
|
+
};
|
|
112
131
|
export type McpToolWorkerResponse = CallToolResult;
|
|
113
132
|
export {};
|
|
114
133
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import b from"node:path";import{REDOCLY_TEAMS_RBAC as m}from"@redocly/config";import{slash as k}from"../../../utils/path/slash.js";function p(a,r,t){if(!r)throw new Error("Visitor required");if(a){a.description&&r(a,"description",t.location.absolutePointer+"/description",t);for(const o in a["x-enumDescriptions"])r(a["x-enumDescriptions"],o,t.location.absolutePointer+"/x-enumDescriptions/"+o,t)}}const g=/^[
|
|
1
|
+
import b from"node:path";import{REDOCLY_TEAMS_RBAC as m}from"@redocly/config";import{slash as k}from"../../../utils/path/slash.js";function p(a,r,t){if(!r)throw new Error("Visitor required");if(a){a.description&&r(a,"description",t.location.absolutePointer+"/description",t);for(const o in a["x-enumDescriptions"])r(a["x-enumDescriptions"],o,t.location.absolutePointer+"/x-enumDescriptions/"+o,t)}}const g=/^[\w\s\-,.!\?:;'"()/]+$/,u=({outputRelativePath:a,cwd:r})=>{const t=function(e,s,l,c){const{node:n}=c.resolve(e[s]);if(!n||typeof n!="string"||n.match(g))return;const i=c.getVisitorData();i.markdocChunks=i.markdocChunks||[],i.markdocChunks.push({node:e,pointer:k(b.relative(r,l)),markdown:n,relativePath:a,key:s})};return{any:{leave(o,e){p(o,t,e)}},ref:{leave(o,e){p(o,t,e)}}}},f=()=>{const a={};return{Tag:{enter(r){r?.["x-rbac"]&&(a[String(r.name)]=r["x-rbac"])}},any:{leave(r,t){if((t.type.name==="Operation"||t.type.name==="Webhook")&&"tags"in r&&Array.isArray(r.tags))for(const o of r.tags)a[o]&&(r["x-rbac"]=r["x-rbac"]||a[o]);r?.["x-rbac"]&&(r[m]=r["x-rbac"],delete r["x-rbac"])}},ref:{leave(r){r?.["x-rbac"]&&(r[m]=r["x-rbac"],delete r["x-rbac"])}}}};function h(a,r,t){const o={id:"markdown",decorators:{oas3:{markdown:u,rbac:f},async3:{markdown:u,rbac:f}}};return{...a,decorators:{"markdown/rbac":"on","markdown/markdown":{outputRelativePath:r,cwd:t},...a.decorators||{}},plugins:[...a.plugins||[],o]}}export{u as MarkdownParserDecorator,f as RbacDecorator,h as injectDecoratorIntoConfig};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import m from"path";import{REGISTRY_APIS_PATHS_API_URL as a}from"../../constants/common.js";import{logger as i}from"../../tools/notifiers/logger.js";async function l(n,d,{variables:f}){const p=m.posix.dirname(n.fsPath);let r={},c={};const t=process.env.REDOCLY_LOCAL_DEV_TOKEN||f.idpAccessToken;if(t&&a)try{const s=a+"/"+encodeURIComponent(p);let e=await fetch(s,{headers:{Cookie:`accessToken=${t}`}});if(e.ok||(e=await fetch(a+"/"+encodeURIComponent(n.fsPath),{headers:{Cookie:`accessToken=${t}`}})),e.status!==200)i.warnProd(`Failed to fetch custom fields. API response status: ${e.status}. Request URL: ${s}`);else{const o=await e.json();r={apiId:o.id,...o.customFields},c=o.metadata||{}}}catch(s){i.warnProd("Failed to fetch custom fields: "+s.message)}return{customFields:r,metadata:c,...d.props}}export{l as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{REDOCLY_TEAMS_RBAC as
|
|
1
|
+
import{REDOCLY_TEAMS_RBAC as O}from"@redocly/config";import{combineUrls as Y}from"@redocly/theme/core/utils";import{OPENAPI_DOCS_TEMPLATE_ID as Z,PUBLIC_RBAC_SCOPE_ITEM as ee}from"../../../constants/common.js";import{DEPRECATED_PUBLIC_API_DEFINITIONS_FOLDER as ge,PUBLIC_API_DEFINITIONS_FOLDER as Ie}from"../../constants/common.js";import{OPENAPI_CUSTOM_FIELDS_SERVER_PROPS_GETTER_ID as Pe,OPENAPI_SHARED_DATA_PREFIX as Se}from"../../constants/plugins/openapi-docs.js";import{envConfig as te}from"../../config/env-config.js";import{logger as w}from"../../tools/notifiers/logger.js";import{searchResolver as De}from"./search/search-resolver.js";import{convertOpenAPIDocs2Sidebar as ye,shouldAddRoute as Ae}from"./utils.js";import{getTemplatePath as U}from"./get-template-path.js";import{storeDefinitionBundles as Re}from"./store-definition-bundles.js";import{definitionLoader as ve,definitionsLoader as ke}from"./load-definition.js";import{getAiDocumentsStore as _e}from"./search/get-ai-search-documents.js";import{buildInstanceMetadata as be,fetchRegistryApiIdByPath as Ee,filterInstancesForApiVersion as Te,getResolvedApiVersion as Fe,hasTemplateVariables as xe,loadLinkedInstancesByApiId as Ce,patchOpenApiDefinitionWithVariables as Oe,resolveApiIdForDefinition as we}from"./instances.js";import{fromCurrentDir as Be}from"../../utils/paths.js";import{telemetryTraceStep as Me}from"../../../cli/telemetry/helpers/trace-step.js";const j="openapi-spec-download";async function at(){let a=[],r={},i={},f=new Set;return{id:"openapi",requiredEntitlements:["openapi"],loaders:{"load-oas-docs":ke,"load-oas":ve},processContent:async(e,c)=>{await Me("build.plugin.openapi_docs",async l=>{e.createRequestHandler(j,Be(import.meta.url,"./spec-download.api.js")),e.addApiRoute({slug:Ie+"/*",requestHandlerId:j,httpMethod:"all",[O]:ee,getStaticData:async()=>({props:{}})}),e.addApiRoute({slug:ge+"/*",requestHandlerId:j,httpMethod:"all",[O]:ee,getStaticData:async()=>({props:{}})});const u=e.createTemplate(Z,U("../../../client/templates/openapi-docs/template.js")),m=e.registerServerPropsGetter(Z,U("./get-server-props.js")),p=e.registerServerPropsGetter(Pe,U("./get-server-props-custom-fields.js")),n=await c.getConfig();l?.setAttribute("config",JSON.stringify(n.openapi||{}));const P=n.rules?.["custom-fields-schema"];r={},i={};const v=w.startTiming("Loading openapi definitions..."),h=await e.loadOpenApiDefinitions(c);w.infoTime(v,"Loading openapi definitions...");const B=await Ee(),E=await Ce(c);a=h.map(({markdocChunks:S,relativePath:y,customOutputRelativeFile:g,isVirtual:d,realRelativePath:M})=>({chunks:S,relativePath:y,realRelativePath:M,isVirtual:g!=null||d})),Re(h,e.outdir);const T={};for(const S of h||[]){const{definition:y,config:g,relativePath:d,customOutputRelativeFile:M,contentItems:oe,flatItems:L,parser:$,options:q,rawOptions:ne,hash:ae}=S,F=M||d,{definition:ie}=$||{},{info:A}=ie||{},I=we(S,B),se={...A?.["x-metadata"]||{}},N=!!g.openapi?.excludeFromSearch||!!g.theme?.openapi?.excludeFromSearch||!!n.openapi?.excludeFromSearch||!!n.theme?.openapi?.excludeFromSearch,z={title:A?.title,description:A?.description,summary:A?.summary,...g.metadata,...se},re=Fe(S),x=I?Te(E.get(I)||[],re):[],K=Le(y,x),W=K.map(t=>({key:t.key,title:t.title,summary:t.summary,tags:t.tags,routePrefix:t.routePrefix,routeSuffixesByItemId:{}})),ce=new Map(W.map(t=>[t.key,t])),k={untagged:[],tagged:new Map};for(const t of L){const{operationDefinition:o}=t;if(o){const{tags:_}=o;if(_)for(const R of _)k.tagged.has(R)||k.tagged.set(R,[]),k.tagged.get(R)?.push(t);else k.untagged.push(t)}}for(const t of K){const o=[],_={},R=ce.get(t.key);if(!R)continue;const pe=t.routePrefix?`${F.replace(/\.[^.]+$/,"")}/${t.routePrefix}`:F;for(const s of L){const{id:b,href:D,operationDefinition:Q}=s;if(te.isDevelopMode){const C=Q?.pointer;C&&(_[`#${C}`]=Ne(s.href,t.routePrefix))}if(!Ae({item:s}))continue;const H=s,me=H.type==="section"&&!!H.infoDefinition,X=$e(D,"");R.routeSuffixesByItemId[b]=X;const he=Q?.[O];o.push({excludeFromSearch:N,slugSuffix:X,fsPath:pe,metadata:{subType:"openapi-operation"},httpVerb:s?.httpVerb||"",path:d,templateId:u,[O]:he||g.rbac,getAiDocumentsStore:_e({parser:$,options:q,info:A,tagOperations:k,openapiContentItem:H,metadata:z,relativePath:d,getSearchFacets:e.getSearchFacets,includeInLLMsTxt:me,excludeFromSearch:N}),getStaticData:async C=>({props:{dynamicMarkdocComponents:["openapi"],baseSlug:C.baseSlug,seo:s["x-metadata"]?.seo||{title:s.name,description:s.description},itemId:b,disableAutoScroll:!0}})})}if(!o.length)continue;const J=t.key!==""&&!!t.sourceInstance,de=J&&I&&t.sourceInstance?be(t.sourceInstance,I):{},le=J?{}:{...x.length>0?{instanceCount:x.length}:{},...x.length===0&&xe(y)?{isTemplate:!0}:{}},V=t.definition?.info?.title;o[0]={...o[0],metadata:{type:"openapi",...z,...de,...le,...I?{apiId:I}:{}},hasClientRoutes:!0,getSidebar:(s,b)=>{const D=[];return ye({contentItems:oe,sidebarItems:D,routeSlug:s.slug,navItem:b}),V&&D.length>0&&D[0]&&!b?.label&&(D[0].label=V),D},getNavText:()=>V||A?.title,getSearchDocuments:De($,q,L,e.getSearchFacets,e.setSearchFacets,N)},I&&t.key===""&&(T[I]={slug:o[0]?.slug||""});const fe=o[0];o[0]=o[o.length-1],o[o.length-1]=fe;const ue=te.isDevelopMode?d:void 0,G=`${Se}${F}::${t.id}`;i[d]=[...i[d]||[],G],r[G]={fsPath:F,definition:t.definition,options:ne,instances:W,currentInstanceKey:t.key,sourcePath:ue,routesMapping:_,hash:ae};for(const s of o)e.addRoute({...s,sharedData:[{id:G,key:"openAPIDocsStore"}],serverPropsGetterIds:P?[m,p]:[m]})}}e.setGlobalData({apiProducts:T})})},afterRoutesCreated:async(e,c)=>{const l=w.startTiming("Parsing openapi markdoc chunks..."),u=new Set;for(const{chunks:p,relativePath:n,isVirtual:P,realRelativePath:v}of a){const h=(await c.cache.load(v,"load-oas")).compoundHash,B=i[n]||[];await c.cache.load(n,{loader:async function(){for(const{node:T,markdown:S,key:y,relativePath:g}of p){const{ast:d}=await e.parseMarkdoc({content:S,relativePath:g,isVirtual:P},c,{sharedDataIds:B});T[`x-parsed-md-${y}`]={result:d}}},name:"openapi-markdoc-inline-parser"},[h]);for(const{pointer:E}of p)u.add(E)}w.infoTime(l,"Parsing openapi markdoc chunks...");const m=f.difference(u);for(const p of m)c.cache.delete(p);f=u;for(const[p,n]of Object.entries(r)){for(const P of n.instances||[]){const v=P.routePrefix?`${n.fsPath.replace(/\.[^.]+$/,"")}/${P.routePrefix}`:n.fsPath,h=e.getRouteByFsPath(v);h&&(P.baseSlug=h.baseSlug)}await e.createSharedData(p,{...n,baseSlug:e.getRouteByFsPath(n.fsPath)?.baseSlug},n.hash)}}}}function Le(a,r){const i=[{id:"default",key:"",title:"Default",routePrefix:"",definition:a}],f=new Set;for(const e of r){const c=Ve(e.key)||"instance";let l=`instances/${c}`,u=2;for(;f.has(l);)l=`instances/${c}-${u}`,u++;f.add(l);const m=Oe(a,e.variables),p=e.title?{...m,info:{...m.info||{},title:e.title}}:m;i.push({id:`instance-${l.replace(/[\/:]/g,"-")}`,key:e.key,title:e.title,summary:e.summary,tags:e.tags,routePrefix:l,definition:p,sourceInstance:e})}return i}function $e(a,r){const i=a.split("#")[0]+"/";return r?Y("/",r,i):i}function Ne(a,r){if(!r)return a;const[i="",f]=a.split("#"),e=Y("/",r,i||"/");return f?`${e}#${f}`:e}function Ve(a){return a.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+/,"").replace(/-+$/,"")}export{at as openAPIDocsPlugin};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { LifecycleContext } from '../../types';
|
|
2
|
+
import type { BundledDefinition } from './load-definition.js';
|
|
3
|
+
export type OpenApiLinkedInstance = {
|
|
4
|
+
key: string;
|
|
5
|
+
title?: string;
|
|
6
|
+
summary?: string;
|
|
7
|
+
tags?: string[];
|
|
8
|
+
version: string;
|
|
9
|
+
variables: Record<string, unknown>;
|
|
10
|
+
};
|
|
11
|
+
export type OpenApiInstanceMetadata = {
|
|
12
|
+
isInstance: true;
|
|
13
|
+
parentApiId: string;
|
|
14
|
+
entityKey: string;
|
|
15
|
+
entityTitle?: string;
|
|
16
|
+
entitySummary?: string;
|
|
17
|
+
entityTags?: string[];
|
|
18
|
+
instanceVariables: Record<string, unknown>;
|
|
19
|
+
};
|
|
20
|
+
export declare function fetchRegistryApiIdByPath(): Promise<Map<string, string>>;
|
|
21
|
+
export declare function resolveApiIdForDefinition(definition: Pick<BundledDefinition, 'relativePath' | 'realRelativePath' | 'definition'>, registryApiIdByPath: Map<string, string>): string | undefined;
|
|
22
|
+
export declare function loadLinkedInstancesByApiId(context: Pick<LifecycleContext, 'fs' | 'cache' | 'logger'>): Promise<Map<string, OpenApiLinkedInstance[]>>;
|
|
23
|
+
export declare function getResolvedApiVersion(definition: Pick<BundledDefinition, 'definition' | 'realRelativePath'>): string;
|
|
24
|
+
export declare function filterInstancesForApiVersion(instances: OpenApiLinkedInstance[], apiVersion: string): OpenApiLinkedInstance[];
|
|
25
|
+
export declare function patchOpenApiDefinitionWithVariables<T = unknown>(definition: T, variables: Record<string, unknown>): T;
|
|
26
|
+
/**
|
|
27
|
+
* Recursive walk with early termination — stops on the first `${` match.
|
|
28
|
+
* Checks both string values and object keys (template vars can appear in keys).
|
|
29
|
+
*/
|
|
30
|
+
export declare function hasTemplateVariables(value: unknown): boolean;
|
|
31
|
+
export declare function buildInstanceMetadata(instance: OpenApiLinkedInstance, parentApiId: string): OpenApiInstanceMetadata;
|
|
32
|
+
export declare function applyInstanceToDefinition<T = unknown>(definition: T, instance: OpenApiLinkedInstance): T;
|
|
33
|
+
//# sourceMappingURL=instances.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import A from"path";import{VERSION_NOT_SPECIFIED as d}from"@redocly/theme/core/constants";import{CATALOG_ENTITIES_FILES_REGEX as w,ENTITY_SCHEMA_EXCLUDED_FOLDERS as C}from"../../constants/plugins/catalog-entities.js";import{REGISTRY_APIS_API_URL as I}from"../../constants/common.js";import{logger as y}from"../../tools/notifiers/logger.js";import{readEnvVariable as h}from"../../utils/envs/read-env-variable.js";import{resolveEntityVersion as E}from"../catalog-entities/utils/resolve-entity-version.js";import{parsePathVersions as S}from"../../../utils/path/parse-path-versions.js";const O=/\$\{([^}|]+)(?:\|([^}]*))?\}/g,D=/^\$\{([^}|]+)(?:\|([^}]*))?\}$/,P="${";async function H(){const e=new Map;if(!I)return e;const t=h("REGISTRY_API_KEY")||"",n=h("REDOCLY_LOCAL_DEV_TOKEN")||"";if(!t&&!n)return y.warnProd("Cannot fetch API registry entries for OpenAPI instances: authentication token is missing"),e;try{const r=`${I}?limit=6000&fields=id,contentPath`,i=t?{Authorization:`Bearer ${t}`}:{Cookie:`accessToken=${n}`},o=await fetch(r,{headers:i});if(o.status!==200)return y.warnProd(`Failed to fetch API registry entries for OpenAPI instances. API response status: ${o.status}. Request URL: ${r}`),e;const s=await o.json();for(const a of s.items||[]){if(!a?.id)continue;const c=a.contentPath;if(!c||typeof c!="string")continue;const f=u(c);f&&e.set(f,a.id)}}catch(r){const i=r instanceof Error?r.message:String(r);y.warnProd(`Failed to fetch API registry entries for OpenAPI instances: ${i}`)}return e}function W(e,t){const n=e.definition.info?.["x-metadata"]?.apiId;if(typeof n=="string"&&n.trim())return n.trim();const r=new Set;for(const i of[e.relativePath,e.realRelativePath])for(const o of F(i))r.add(o);for(const i of r){const o=t.get(i);if(o)return o}}async function Q(e){const t=new Map,n=e.fs.scan(w).filter(({relativePath:r})=>N(r));for(const{relativePath:r}of n){let i;try{i=(await e.cache.load(r,"yaml")).data}catch(s){const a=s instanceof Error?s.message:String(s);e.logger.warn(`Failed to parse entity file ${r}: ${a}`);continue}const o=Array.isArray(i)?i:[i];for(const s of o){const a=s;if(!a||typeof a!="object")continue;const c=M(a);if(!c)continue;const f=typeof a.key=="string"?a.key.trim():"";if(!f)continue;const p=E(a.version,r);if(!p.success){e.logger.warn(`Skipping entity ${f} in ${r}: version "${p.fileVersion}" conflicts with folder version "${p.folderVersion}"`);continue}const T=p.version??d,g=z(a.relations);if(!g.length)continue;const $={key:f,title:typeof a.title=="string"?a.title:void 0,summary:typeof a.summary=="string"?a.summary:void 0,tags:Array.isArray(a.tags)?a.tags.filter(l=>typeof l=="string"):void 0,version:T,variables:c};for(const l of g){const k=t.get(l)||[],L=K([...k,$]);t.set(l,L)}}}return t}function ee(e){const t=e.definition.info?.version,n=E(t,e.realRelativePath);return n.success?n.version??d:d}function te(e,t){return e.filter(n=>B(n.version,t)).sort((n,r)=>{const i=n.title||n.key,o=r.title||r.key;return i.localeCompare(o)})}function j(e,t){return m(e,t)}function V(e){if(typeof e=="string")return e.includes(P);if(Array.isArray(e))return e.some(t=>V(t));if(e&&typeof e=="object"){for(const t of Object.keys(e))if(t.includes(P)||V(e[t]))return!0}return!1}function m(e,t){return typeof e=="string"?b(e,t):Array.isArray(e)?e.map(n=>m(n,t)):e&&typeof e=="object"?Object.entries(e).reduce((n,[r,i])=>{const o=b(r,t),s=typeof o=="string"?o:R(o);return n[s]=m(i,t),n},{}):e}function b(e,t){const n=e.match(D);if(n){const r=_(n[1]||"",t,n[2]);return r.found?r.value:e}return e.replace(O,(r,i,o)=>{const s=_(i,t,o);return s.found?R(s.value):r})}function _(e,t,n){const r=x(e);for(const s of r)if(Object.prototype.hasOwnProperty.call(t,s))return{found:!0,value:t[s]};const i=e.trim().toLowerCase(),o=Object.keys(t).find(s=>s.trim().toLowerCase()===i);return o?{found:!0,value:t[o]}:n!==void 0?{found:!0,value:n}:{found:!1,value:void 0}}function x(e){const t=e.trim(),n=t.replace(/_/g,"-").replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),r=t.replace(/-/g,"_").replace(/([a-z0-9])([A-Z])/g,"$1_$2").toLowerCase(),i=t.replace(/[-_]+([a-zA-Z0-9])/g,(o,s)=>s.toUpperCase());return Array.from(new Set([t,n,r,i]))}function R(e){if(e==null)return"";if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean"||typeof e=="bigint")return String(e);try{return JSON.stringify(e)}catch{return String(e)}}function F(e){const t=u(e),n=new Set;if(t){n.add(t);const i=u(A.posix.dirname(t));i&&n.add(i)}const r=S(e);if(r?.filePathInVersion){const i=u(r.filePathInVersion);if(i){n.add(i);const o=u(A.posix.dirname(i));o&&n.add(o)}}return Array.from(n)}function u(e){return e?e.replace(/^\/+/,"").replace(/\/+$/,"").trim():""}function M(e){if(!e.metadata||typeof e.metadata!="object")return;const t=e.metadata;if(!(!t.variables||typeof t.variables!="object"||Array.isArray(t.variables)))return t.variables}function z(e){return Array.isArray(e)?e.map(t=>t).filter(t=>t?.type==="implements"&&typeof t.key=="string").map(t=>t.key):[]}function B(e,t){return e===d||t===d?!0:e===t}function K(e){const t=new Map;for(const n of e)t.set(`${n.key}:${n.version}`,n);return Array.from(t.values())}function N(e){return!C.some(t=>e.includes(t))}function ne(e,t){return{isInstance:!0,parentApiId:t,entityKey:e.key,entityTitle:e.title,entitySummary:e.summary,entityTags:e.tags,instanceVariables:e.variables}}function re(e,t){const n=j(e,t.variables);return t.title&&n&&typeof n=="object"?{...n,info:{...n.info,title:t.title}}:n}export{re as applyInstanceToDefinition,ne as buildInstanceMetadata,H as fetchRegistryApiIdByPath,te as filterInstancesForApiVersion,ee as getResolvedApiVersion,V as hasTemplateVariables,Q as loadLinkedInstancesByApiId,j as patchOpenApiDefinitionWithVariables,W as resolveApiIdForDefinition};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{REDOCLY_TEAMS_RBAC as k}from"@redocly/config";import{basename as R,join as _}from"node:path";import{toMarkdown as L}from"../../../plugins/markdown/search/to-markdown.js";import{canDownloadApiDefinition as G,isResourcePubliclyAccessible as E}from"../../../utils/rbac.js";import{PUBLIC_API_DEFINITIONS_FOLDER as J}from"../../../constants/common.js";import{DEFAULT_ANONYMOUS_VISITOR_TEAM as z}from"../../../../constants/common.js";import{SearchIndexer as V}from"../search-indexer.js";import{getLocaleFromRelativePath as q}from"../../../fs/utils/get-locale-from-relative-path.js";import{extractDocumentSearchFacets as B}from"./search-facets.js";import{formatDocumentMetadata as C}from"../../search/utils.js";import{getLLMsTxtMdSlug as Y,llmsTxtLink as M}from"../../search/llmstxt/index.js";import{replaceFileExtension as H}from"../store-definition-bundles.js";const x=new Map,me=({parser:
|
|
2
|
-
`;for(const[T,w]of $?.publiclyAccessibleTaggedSearchDocuments?.entries()||[]){if(!w.length)return;const U=
|
|
1
|
+
import{REDOCLY_TEAMS_RBAC as k}from"@redocly/config";import{basename as R,join as _}from"node:path";import{toMarkdown as L}from"../../../plugins/markdown/search/to-markdown.js";import{canDownloadApiDefinition as G,isResourcePubliclyAccessible as E}from"../../../utils/rbac.js";import{PUBLIC_API_DEFINITIONS_FOLDER as J}from"../../../constants/common.js";import{DEFAULT_ANONYMOUS_VISITOR_TEAM as z}from"../../../../constants/common.js";import{SearchIndexer as V}from"../search-indexer.js";import{getLocaleFromRelativePath as q}from"../../../fs/utils/get-locale-from-relative-path.js";import{extractDocumentSearchFacets as B}from"./search-facets.js";import{formatDocumentMetadata as C}from"../../search/utils.js";import{getLLMsTxtMdSlug as Y,llmsTxtLink as M}from"../../search/llmstxt/index.js";import{replaceFileExtension as H}from"../store-definition-bundles.js";const x=new Map,me=({parser:i,options:c,info:t,tagOperations:s,relativePath:n,openapiContentItem:e,metadata:r,getSearchFacets:o,includeInLLMsTxt:a,excludeFromSearch:m})=>async(u,f,l)=>{if(m)return;const D=await u.getNavText?.()||R(u.fsPath),A=new V(i,c,u.baseSlug||u.slug),p=A.addItem(e);if(!p)return;const O=await l.getConfig(),S=Array.isArray(p.title)?p.title.join(" "):p.title;let g,d,$=x.get(n);if((e.type==="tag"||e.type==="section"&&e.infoDefinition)&&!$){const{all:b,publiclyAccessible:y}=ee(s.tagged,A,O),{all:T,publiclyAccessible:w}=ne(s.untagged,A,O);x.set(n,{taggedSearchDocuments:new Map(b),untaggedSearchDocuments:T,publiclyAccessibleTaggedSearchDocuments:new Map(y),publiclyAccessibleUntaggedSearchDocuments:w})}$=x.get(n);const h="#";switch(e.type){case"operation":const b=A.getOperation(e);g=d=X({title:S,security:i.definition.security,document:p,version:p.version||t.version,headingLevel:h,operation:b});break;case"section":if(e.infoDefinition){$=x.get(n),d=await P({parser:i,info:t,staticData:f,relativePath:n,headingLevel:h,pageName:D,config:O}),d+=`
|
|
2
|
+
`;for(const[T,w]of $?.publiclyAccessibleTaggedSearchDocuments?.entries()||[]){if(!w.length)return;const U=i.definition.tags?.find(F=>F.name===T);d+=j({title:U?.["x-displayName"]||T,description:U?.description,operationSearchDocuments:w,headingLevel:`${h}#`})}const y=$?.publiclyAccessibleUntaggedSearchDocuments||[];y.length&&(d+=j({title:"Other",description:void 0,operationSearchDocuments:y,headingLevel:`${h}#`})),g=await P({parser:i,info:t,staticData:f,relativePath:n,headingLevel:h,pageName:D,config:O})}else e.ast&&(d=g=L(e.ast));break;case"tag":d=j({title:S,description:e.description,operationSearchDocuments:$?.publiclyAccessibleTaggedSearchDocuments.get(e.name)||[],headingLevel:h}),g=j({title:S,description:e.description,operationSearchDocuments:[],headingLevel:h});break;case"rsrc":case"prompt":case"tool":d=Z({title:S,description:e.description,name:e.name,xMcpConfig:i.definition["x-mcp"],headingLevel:h}),g=d;break}return{async getLLMsTxts(){return[{title:e.name,description:e.type==="tag"?e.description:void 0,content:d||"",slug:u.slug,fsPath:u.fsPath,includeInLLMsTxt:a}]},async getSearchDocuments(){if(e.type==="operation"||e.type==="section"&&(e.infoDefinition||e.ast)||e.type==="tag"){const b=q(u.fsPath),y=B({...p,...r},t,o);return[{title:S,description:Array.isArray(p.text)?p.text.join(" "):p.text,content:g||"",url:p.url??u.slug,fsPath:u.fsPath,locale:b,product:u.product?.name,rbacTeams:p.rbacTeams,facets:y}]}return[]}}};async function P({parser:i,info:c,staticData:t,relativePath:s,pageName:n,headingLevel:e,config:r}){const o=C(c["x-metadata"]);let a=c.title?`${e} ${c.title}
|
|
3
3
|
|
|
4
4
|
`:`${e} ${n}
|
|
5
5
|
|
|
@@ -12,14 +12,14 @@ import{REDOCLY_TEAMS_RBAC as k}from"@redocly/config";import{basename as R,join a
|
|
|
12
12
|
`:"",e=`${e}#`,a+=o.length?`Metadata:
|
|
13
13
|
${o}
|
|
14
14
|
`:"",a+=`
|
|
15
|
-
`,a+=K({parser:
|
|
15
|
+
`,a+=K({parser:i,headingLevel:e}),a+=W({parser:i,headingLevel:e}),a+=await Q({info:c,staticData:t,relativePath:s,pageName:n,headingLevel:e,config:r}),a}function j({title:i="",description:c,operationSearchDocuments:t,headingLevel:s}){let n=`${s} ${i}
|
|
16
16
|
|
|
17
17
|
`;return c&&(n+=`${c}
|
|
18
18
|
|
|
19
|
-
`),t.length&&t.forEach(e=>{const
|
|
19
|
+
`),t.length&&t.forEach(e=>{const r=Array.isArray(e.title)?e.title.join(" "):e.title;n+=`${s}# ${r}${e.deprecated?" (deprecated)":""}
|
|
20
20
|
|
|
21
21
|
`,n+=` - ${M({title:`${e.httpMethod?.toUpperCase()} ${e.httpPath}`,description:Array.isArray(e.text)?e.text.join(" "):e.text,slug:Y(e.url)})}`,n+=`
|
|
22
|
-
`}),n}function K({parser:
|
|
22
|
+
`}),n}function K({parser:i,headingLevel:c}){const{servers:t}=i.definition;if(t&&t.length){let s=`${c} Servers
|
|
23
23
|
|
|
24
24
|
`;return t.forEach(n=>{s+=n.description?`${n.description}
|
|
25
25
|
`:"",s+=`\`\`\`
|
|
@@ -27,15 +27,15 @@ ${n.url}
|
|
|
27
27
|
\`\`\`
|
|
28
28
|
|
|
29
29
|
`,n.variables&&(s+=`Variables:
|
|
30
|
-
`,Object.entries(n.variables).forEach(([e,
|
|
31
|
-
`,s+=
|
|
32
|
-
`:"",s+=
|
|
30
|
+
`,Object.entries(n.variables).forEach(([e,r])=>{s+=`- \`${e}\`${r.description?`: ${r.description}`:""}
|
|
31
|
+
`,s+=r.default?`Default: ${JSON.stringify(r.default)}
|
|
32
|
+
`:"",s+=r.enum?`Enum: ${r.enum.map(o=>JSON.stringify(o)).join(", ")}
|
|
33
33
|
`:""}),s+=`
|
|
34
|
-
`)}),s}return""}async function Q({info:
|
|
34
|
+
`)}),s}return""}async function Q({info:i,staticData:c,relativePath:t,pageName:s,headingLevel:n,config:e}){const r=_(c.props?.outdir||"",J,H(t,".yaml"));if(G(r,e.rbac||{},e.requiresLogin||!1,{isAuthenticated:!1,teams:[z]})){let o=`${n} Download OpenAPI description
|
|
35
35
|
|
|
36
|
-
`;return o+=M({title:
|
|
36
|
+
`;return o+=M({title:i.title||s||"OpenAPI definition",description:void 0,slug:r}),o}return""}function W({parser:i,headingLevel:c}){if(!i.definition.components?.securitySchemes)return"";let t=`${c} Security
|
|
37
37
|
|
|
38
|
-
`;const{securitySchemes:s}=
|
|
38
|
+
`;const{securitySchemes:s}=i.definition.components;return Object.keys(s).forEach(n=>{const e=s[n];e&&(t+=`${c}# ${n}
|
|
39
39
|
|
|
40
40
|
`,t+=e.description?`${e.description}
|
|
41
41
|
|
|
@@ -47,14 +47,14 @@ ${n.url}
|
|
|
47
47
|
`),e.bearerFormat&&(t+=`Bearer Format: ${e.bearerFormat}
|
|
48
48
|
`),e.flows?.implicit?.authorizationUrl&&(t+=`Authorization URL: ${e.flows.implicit?.authorizationUrl}
|
|
49
49
|
`),e.flows?.implicit?.scopes&&(t+=`Scopes:
|
|
50
|
-
`,Object.entries(e.flows?.implicit?.scopes||{}).forEach(([
|
|
50
|
+
`,Object.entries(e.flows?.implicit?.scopes||{}).forEach(([r,o])=>{t+=`- \`${r}\`: ${o}
|
|
51
51
|
`})),e.flows?.password?.tokenUrl&&(t+=`Token URL: ${e.flows.password?.tokenUrl}
|
|
52
52
|
`),e.flows?.password?.scopes&&(t+=`Scopes:
|
|
53
|
-
`,Object.entries(e.flows?.password?.scopes||{}).forEach(([
|
|
53
|
+
`,Object.entries(e.flows?.password?.scopes||{}).forEach(([r,o])=>{t+=`- \`${r}\`: ${o}
|
|
54
54
|
`})),t+=`
|
|
55
|
-
`)}),t}function X({title:
|
|
55
|
+
`)}),t}function X({title:i,security:c,document:t,version:s,headingLevel:n,operation:e}){const{text:r,httpMethod:o,httpPath:a,deprecated:m}=t,u=v(t.parameters||[],`${n}#`),f=I(`${n}#`,t.parameters,e);let l=i?`${n} ${i}${m?" (deprecated)":""}
|
|
56
56
|
|
|
57
|
-
`:"";return l+=
|
|
57
|
+
`:"";return l+=r?`${r}
|
|
58
58
|
|
|
59
59
|
`:"",l+=`Endpoint: ${o?.toUpperCase()} ${a}
|
|
60
60
|
`,l+=s?`Version: ${s}
|
|
@@ -64,7 +64,7 @@ ${n.url}
|
|
|
64
64
|
`,l+=u?`${u}
|
|
65
65
|
`:"",l+=`
|
|
66
66
|
`,l+=`${f.join(`
|
|
67
|
-
`)}`,l}function Z({title:
|
|
67
|
+
`)}`,l}function Z({title:i,name:c,xMcpConfig:t,headingLevel:s}){const n=t?.tools.find(r=>r.name===c);if(!n)return"";let e=`${s} ${i}
|
|
68
68
|
|
|
69
69
|
`;return e+=n.description?`${n.description}
|
|
70
70
|
|
|
@@ -80,13 +80,13 @@ ${JSON.stringify(n.inputSchema,null,2)}
|
|
|
80
80
|
${JSON.stringify(n.outputSchema,null,2)}
|
|
81
81
|
\`\`\`
|
|
82
82
|
|
|
83
|
-
`),e}function I(
|
|
84
|
-
`)}function v(
|
|
83
|
+
`),e}function I(i,c,t){return!c&&!t||!t?.responses?[]:t?.responses.filter(n=>!n.content?.mediaTypes[0]?.schema).map(n=>`${i} ${N(`response ${n.code} fields`)}
|
|
84
|
+
`)}function v(i,c){const t={};for(const n of i){const e=`${n.place}${n.mediaType?` (${n.mediaType})`:""}`;t[e]=[...t[e]||[],n]}return Object.entries(t).map(([n,e])=>{const r=e.map(o=>{const a=" ",m=[...o.path||[],o.name],u=Array.isArray(o.description)?o.description.join(" "):o.description;let f=` - \`${m.join(".")}\` (${o.type}${o.required?", required":""})
|
|
85
85
|
`;return f+=u?`${a}${u.trim()}
|
|
86
86
|
`:"",o.enum?f+=`${a}Enum: ${o.enum.map(l=>JSON.stringify(l)).join(", ")}
|
|
87
87
|
`:o.example&&(f+=`${a}Example: ${o.example}
|
|
88
88
|
`),f});return`${c} ${N(n)}:
|
|
89
89
|
|
|
90
|
-
${
|
|
90
|
+
${r.join(`
|
|
91
91
|
`)}`}).join(`
|
|
92
|
-
`)}function ee(
|
|
92
|
+
`)}function ee(i,c,t){const s=[],n=[];return i.forEach((e,r)=>{const o=[],a=[];e.forEach(m=>{const u=c.addItem(m);u&&(o.push(u),E({[k]:m[k],slug:u.url},t)&&a.push(u))}),s.push([r,o]),n.push([r,a])}),{all:s,publiclyAccessible:n}}function ne(i,c,t){const s=[],n=[];return i.forEach(e=>{const r=c.addItem(e);r&&(s.push(r),E({[k]:e[k],slug:r.url},t)&&n.push(r))}),{all:s,publiclyAccessible:n}}function N(i){return i.charAt(0).toUpperCase()+i.slice(1)}export{me as getAiDocumentsStore};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as g from"@redocly/openapi-docs";import{REDOCLY_TEAMS_RBAC as d}from"@redocly/config";import{combineUrls as u}from"@redocly/theme/core/utils";import{SEARCH_DOCUMENT_METADATA_KEY as y}from"../../constants/plugins/search.js";import{removeMarkdownLinks as c,stripFormatting as a}from"./utils.js";import{normalizeFrontmatterKeywords as x}from"../helpers/normalize-frontmatter-keywords.js";const l=g.default||g;class T{#n=[];#r;#s;#e;#i;constructor(e,t,n){this.#r=e,this.#s=t,this.#e=n}addItem(e){const{result:t}=x(e.keywords||e.operationDefinition?.keywords);t?.excludes&&e.type==="section"&&e.id===""&&(this.#i=t.excludes);try{let n;switch(e.type){case"tag":n=this.#c(e);break;case"operation":const o=this.getOperation(e);n=this.#d(o,e[d]);break;case"section":n=this.#p(e);break;case"rsrc":case"prompt":case"tool":n=this.#o(e);break}if(!n)return;const s=[...new Set([...t?.excludes?t.excludes:[],...this.#i?this.#i:[]])];return(t||s.length)&&(n[y]={curated:!0,...t,excludes:s}),this.#n.push(n),n}catch(n){console.error("Cannot add item to search indexer",n.message)}}addInfo(e,t){const n=this.#e,s={id:n,url:n,text:a(c(e.description||"")),title:a(`${e.title} (${e.version})`),metadata:t};return this.#n.push(s),s}#o(e){const t=u(this.#e,e.href);return{id:t,url:t,text:a(c(e.description||"")),title:e.name}}getResult(){return this.#n}getOperation(e){return l.getOperation(this.#r,e.operationDefinition,e.parent,{...this.#s,unstable_skipSamples:!0},e.href)}#a(e){return
|
|
1
|
+
import*as g from"@redocly/openapi-docs";import{REDOCLY_TEAMS_RBAC as d}from"@redocly/config";import{combineUrls as u}from"@redocly/theme/core/utils";import{SEARCH_DOCUMENT_METADATA_KEY as y}from"../../constants/plugins/search.js";import{removeMarkdownLinks as c,stripFormatting as a}from"./utils.js";import{normalizeFrontmatterKeywords as x}from"../helpers/normalize-frontmatter-keywords.js";const l=g.default||g;class T{#n=[];#r;#s;#e;#i;constructor(e,t,n){this.#r=e,this.#s=t,this.#e=n}addItem(e){const{result:t}=x(e.keywords||e.operationDefinition?.keywords);t?.excludes&&e.type==="section"&&e.id===""&&(this.#i=t.excludes);try{let n;switch(e.type){case"tag":n=this.#c(e);break;case"operation":const o=this.getOperation(e);n=this.#d(o,e[d]);break;case"section":n=this.#p(e);break;case"rsrc":case"prompt":case"tool":n=this.#o(e);break}if(!n)return;const s=[...new Set([...t?.excludes?t.excludes:[],...this.#i?this.#i:[]])];return(t||s.length)&&(n[y]={curated:!0,...t,excludes:s}),this.#n.push(n),n}catch(n){console.error("Cannot add item to search indexer",n.message)}}addInfo(e,t){const n=this.#e,s={id:n,url:n,text:a(c(e.description||"")),title:a(`${e.title} (${e.version})`),metadata:t};return this.#n.push(s),s}#o(e){const t=u(this.#e,e.href);return{id:t,url:t,text:a(c(e.description||"")),title:e.name}}getResult(){return this.#n}getOperation(e){return l.getOperation(this.#r,e.operationDefinition,e.parent,{...this.#s,unstable_skipSamples:!0},e.href)}#a(e){return[...e.path||[],e.name.toString()].join(".")+e.description+e.place}#d(e,t){if(e.type!=="operation")return;let n={};for(let i of e.parameters){if(i[d]||!i.name)continue;const r=i.schema?.example||i.example,p={name:i.name,description:a(c(i.description)),place:i.in+" parameters",mediaType:void 0,type:i.schema?.type.toString()||"unknown",deepLink:l.generateDeepLink(i),[d]:i[d],required:i.required,example:r?JSON.stringify(r):void 0,enum:i.schema?.enum?.length?i.schema.enum:void 0};n[this.#a(p)]=p}this.#t(n,e.requestBody?.content?.mediaTypes[0]?.schema,e.requestBody?.content?.mediaTypes[0]?.name,"request fields",!1);for(let i of e.responses){const r=`response ${i.code} fields`;this.#t(n,i.content?.mediaTypes[0]?.schema,i.content?.mediaTypes[0]?.name,r,!0)}let s=u(this.#e,e.href);return{id:s,url:s,title:a(e.name),text:a(c(e.description||"")),httpMethod:e.httpVerb,httpPath:e.path,deprecated:e.deprecated,isAdditionalOperation:e.isAdditionalOperation,security:e.security.map(i=>i.schemes.map(r=>r.id)).flat().filter(Boolean),parameters:Object.values(n),badges:e.badges.length?e.badges:void 0,[d]:t}}#t(e,t,n,s,o,i=[]){if(!(i.length>3)&&!(!t||t.isCircular)){if(t?.fields)for(let r of t.fields){if(t[d]||r.kind==="additionalProperties"||r.schema?.readOnly&&!o||r.schema?.writeOnly&&o)continue;const p=r.schema?.example||r.example,h=r.schema?.enum,m={name:r.name,description:a(r.description),place:s,mediaType:n,path:i,deepLink:l.generateDeepLink(r),type:r.schema?.type.toString()||"unknown",required:r.required||t.schema.required?.includes(r.name)||!1,example:p?JSON.stringify(p):void 0,enum:h?.length?h:void 0},f=this.#a(m);e[f]==null&&(e[f]=m,this.#t(e,r.schema,n,s,o,i.concat([r.name])))}t?.items&&this.#t(e,t.items,n,s,o,i)}}#c(e){const t=u(this.#e,e.href);return{id:t,url:t,text:a(c(e.description||"")),title:a(e.name)}}#p(e){const t=u(this.#e,e.href);return{id:t,url:t,text:a(c(e.description||"")),title:a(e.name)}}}export{T as SearchIndexer};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import u from"node:path";import{existsSync as
|
|
2
|
-
- ${i.slice(0,
|
|
3
|
-
- `)}`;i.length>
|
|
4
|
-
... and ${i.length-
|
|
1
|
+
import u from"node:path";import{existsSync as J,readFileSync as M}from"node:fs";import V from"picomatch";import{removeLeadingSlash as $}from"@redocly/theme/core/utils";import{parsePathVersions as b}from"../../../utils/path/parse-path-versions.js";import{logger as a}from"../../tools/notifiers/logger.js";import{envConfig as h}from"../../config/env-config.js";import{ScorecardStatus as m}from"./types.js";import{getTarget as k}from"./loaders/scorecard.js";import{sha1 as z}from"../../utils/crypto/sha1.js";const p=15;async function ie({actions:n,context:s,scorecardConfig:r,reuniteConfig:l,configHash:i}){a.info("Computing scorecard...");const o=r.levels||[],v=o[0];let t=await n.loadOpenApiDefinitions(s);const N=r.ignore||[],_=V(N),D=new Set,x=a.startTiming(),c={};let g={};J(u.resolve(n.outdir,"_scorecard","meta.json"))&&(g=JSON.parse(M(u.resolve(n.outdir,"_scorecard","meta.json"),"utf-8")));let P=0;h.isDevelopMode&&!h.DEV_FULL_SCORECARD&&(t=t.slice(0,50));for(const e of t){if(e.definition?.["x-redocly-openrpc"]||e.isVirtual||!e.definition)continue;const S=e.definition.info?.["x-metadata"]||{},y=$(e.realRelativePath);if(c[e.realRelativePath])continue;const T=e.customOutputRelativeFile||e.realRelativePath;D.add(T);const A=k(r.targets,S),{minimumLevel:O=v.name,ignore:B}=A||{};if(B||_(y)){a.info(`Skipping scorecard calculation for ignored file: ${e.realRelativePath}`);continue}let d;const f=g[e.realRelativePath],R=z(e.hash+i+JSON.stringify(S));f&&f.hash===R?(P++,d=JSON.parse(M(u.resolve(n.outdir,f.filename),"utf-8"))):{data:d}=await s.cache.load(e.realRelativePath,"scorecard");const{levels:C,scorecardLevelIdx:w,scorecardLevel:I}=d,L=o.findIndex(H=>H.name===O),j=w-1<L?m.BelowMinimum:L<o.length-1?m.Minimum:m.Highest,F=b(e.realRelativePath)?.versionName,E={levels:C,status:j,targetLevel:O,scorecardLevel:I,scorecardLevelIdx:w,relativePath:e.realRelativePath,title:e.definition.info?.title,version:F,hash:R};c[e.realRelativePath]=E}return a.infoTime(x,"Scorecard processed, reused: %s/%s",P,t.length),h.isProductionEnv&&U(c,l,r),c}function U(n,s,r){const l=Object.values(n).filter(t=>t.status===m.BelowMinimum);if(l.length===0)return;const i=l.map(t=>t.relativePath);let o=`Detected OpenAPI definitions with score below minimum level:
|
|
2
|
+
- ${i.slice(0,p).map(()=>"%rp").join(`
|
|
3
|
+
- `)}`;i.length>p&&(o+=`
|
|
4
|
+
... and ${i.length-p} more`),s?.ignoreLint??r.ignoreNonCompliant?a.warn(o,...i):a.error(o,...i)}export{ie as computeScorecard};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{writeFileSync as I}from"node:fs";import v from"path";import{SCORECARD_OUTPUT_FILE_NAME as N}from"../../constants/common.js";import{mapObject as P}from"../../../utils/object/map-object.js";import{envConfig as F}from"
|
|
1
|
+
import{writeFileSync as I}from"node:fs";import v from"path";import{SCORECARD_OUTPUT_FILE_NAME as N}from"../../constants/common.js";import{mapObject as P}from"../../../utils/object/map-object.js";import{envConfig as F}from"../../config/env-config.js";import{removeLeadingSlash as U}from"../../../utils/url/remove-leading-slash.js";import{combineUrls as D}from"@redocly/theme/core/utils";import{logger as O}from"../../tools/notifiers/logger.js";import{getRouteSlugToCatalogSlugMap as k}from"../../utils/catalog-classic/get-route-slug-to-catalog-slug-map.js";import{deepEqual as j}from"../../../utils/object/deep-equal.js";import{ensureDir as q}from"../../utils/index.js";import{getTemplatePath as M}from"./get-template-path.js";import{getAllRuleNames as J}from"./lint.js";import{getScorecardConfig as b}from"./get-scorecard-config.js";import{CUSTOM_FIELDS_SERVER_PROPS_GETTER_ID as W}from"../catalog-classic/index.js";import{getScorecardSlug as $}from"./shared-utils.js";import{scorecardConfigLoader as G}from"./loaders/scorecard-config.js";import{scorecardLoader as H}from"./loaders/scorecard.js";import{computeScorecard as x}from"./compute-scorecard.js";import{telemetryTraceStep as B}from"../../../cli/telemetry/helpers/trace-step.js";const V="scorecardClassic";let n={},L={};async function fe({id:w,requiredEntitlements:A,loadersPrefix:y=""}){let g=null,E=null,R=!1;return{id:w??"scorecardClassic",requiredEntitlements:A??["scorecard"],loaders:{[`${y}scorecard-config`]:G,[`${y}scorecard`]:H},async processContent(t,c){await B("build.plugin.scorecard_classic",async m=>{const a=t.createTemplate(V,M("./template/index.js")),s=await c.getConfig(),l=b(s),f=s?.reunite??{},d=[()=>g===null,()=>!j(n,l),()=>!j(L,f)].some(e=>e());n=l,m?.setAttribute("config",JSON.stringify(n||{})),L=f;const p=s.catalogClassic??{},u=n.levels||[];if(u.length<1)throw Error("Invalid configuration of levels config");d&&(g=await x({actions:t,context:c,scorecardConfig:n,reuniteConfig:L,configHash:s.hash||""}));const{data:{configs:S}}=await c.cache.load("",`${y}scorecard-config`),{perLevel:r,all:i}=J(S);E={levelNames:u.map(e=>e.name),rules:i,rulesPerLevel:r};for(const[e,o]of Object.entries(p)){const T=D(o.slug,"scorecard/");t.addRoute({duplicateInAllLocales:!0,slug:T,fsPath:D(o.slug,"scorecard/"),templateId:a,hasClientRoutes:!0,excludeFromSidebar:!0,serverPropsGetterIds:[W],sharedData:[{id:"scorecard",key:"scorecard"},{key:"catalog",id:"catalog-"+e}],getNavText:()=>Promise.resolve(o.title||"API design scorecard"),getStaticData:async()=>({props:{catalogId:e,catalogConfig:{...o,items:void 0},scorecardConfig:n,scorecardInfo:E}})})}})},afterRoutesCreated:async(t,c)=>{const m=await c.getConfig(),a=m.catalogClassic??{},s=b(m),l={},f=O.startTiming("Injecting scorecard data into routes..."),d={};if(Object.keys(a).length){const u=Object.keys(a).length>1?await k(t,c,a):null;for(const[S,r]of Object.entries(g||{})){const i=t.getRouteByFsPath(S),e=i?.slug;if(!e)continue;if(i&&!s.ignoreMetadata){const C=u?u.get(e)??Object.values(a)[0].slug:Object.values(a)[0].slug,h=D(C,"scorecard/");i.metadata={...i.metadata,scorecardStatus:r.status,scorecardLevel:r.scorecardLevel,scorecardLevelIdx:r.scorecardLevelIdx,scorecardLevels:P(r.levels,_=>({uniqueErrors:_.uniqueErrors,uniqueWarnings:_.uniqueWarnings})),scoreCardSlug:h+"apis/"+encodeURIComponent(U(e))}}const o=v.join("_scorecard",$(e)),T=v.resolve(t.outdir,o);d[e]={detailsChunkPath:o,...r,levels:P(r.levels,C=>({...C,problems:C.problems.map(h=>({ruleId:h.ruleId,severity:h.severity}))}))},R||(I(q(T),JSON.stringify(r)),l[S]={hash:r.hash,filename:o})}I(v.resolve(t.outdir,"_scorecard","meta.json"),JSON.stringify(l)),await t.createSharedData("scorecard",d)}O.infoTime(f,"Injecting scorecard data into routes...");const p=F.REDOCLY_METADATA_OUTPUT_FOLDER;!R&&p&&(O.info("Writing scorecard data..."),I(v.join(p,N),JSON.stringify({scorecardData:d,...E})),g=null,O.info("Scorecard data written...")),R=!0}}}export{fe as scorecardClassicPlugin};
|