@redocly/reef 0.131.0-next.0 → 0.131.0-next.10
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 +189 -0
- package/dist/bin.d.ts +1 -0
- package/dist/bin.js +1 -1
- package/dist/cli/build/copy-env-files.js +1 -0
- package/dist/cli/{prepare → build}/index.d.ts +2 -2
- package/dist/cli/build/index.js +1 -0
- 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/stats/collectors/{openapi.d.ts → openapi/index.d.ts} +2 -2
- package/dist/cli/stats/collectors/openapi/index.js +1 -0
- package/dist/cli/stats/collectors/openapi/oas32.d.ts +15 -0
- package/dist/cli/stats/collectors/openapi/oas32.js +1 -0
- package/dist/cli/stats/index.js +1 -1
- package/dist/cli/telemetry/index.js +1 -1
- package/dist/cli/utils/listen-stdin.d.ts +10 -0
- package/dist/cli/utils/listen-stdin.js +2 -0
- package/dist/client/App.js +1 -1
- package/dist/client/ErrorBoundary.js +1 -1
- package/dist/client/TestProvider.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/useSidebarItems.js +1 -1
- package/dist/client/app/hooks/index.d.ts +1 -0
- package/dist/client/app/hooks/index.js +1 -1
- package/dist/client/app/hooks/useAnchorPositioning.d.ts +6 -0
- package/dist/client/app/hooks/useAnchorPositioning.js +1 -0
- 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/app/search/useAiSearch.js +1 -1
- package/dist/client/app/search/useSearch.js +1 -1
- 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/providers/theme/ThemeDataProvider.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/client/templates/asyncapi-docs/template.js +11 -0
- 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 +9 -6
- 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/environment-detection.d.ts +2 -2
- 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/{config → server/config}/env-schemas/search.d.ts +2 -2
- package/dist/server/config/env-schemas/search.js +1 -0
- 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/constants/plugins/search.d.ts +0 -4
- package/dist/server/constants/plugins/search.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/{config/external-plugins.js → external-plugins/resolve-external-plugins.js} +1 -1
- package/dist/server/fs/cache.js +1 -1
- 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/browser-hooks.js +1 -1
- package/dist/server/plugins/analytics/segment/build-script.js +5 -2
- 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 +37 -37
- 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/lifecycle.js +2 -2
- 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 +1 -0
- package/dist/server/plugins/mcp/docs-mcp/tools/docs-mcp-tool.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 +3 -1
- package/dist/server/plugins/mcp/servers/docs-server.js +1 -1
- package/dist/server/plugins/mcp/types.d.ts +7 -0
- package/dist/server/plugins/openapi-docs/index.js +1 -1
- package/dist/server/plugins/openapi-docs/search/get-ai-search-documents.js +29 -29
- package/dist/server/plugins/openapi-docs/search-indexer.js +1 -1
- package/dist/server/plugins/scorecard-classic/get-scorecard-config.d.ts +1 -1
- package/dist/server/plugins/scorecard-classic/index.js +1 -1
- package/dist/server/plugins/scorecard-classic/lint.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 +1 -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.d.ts +0 -1
- package/dist/server/tools/notifiers/reporter.js +6 -7
- package/dist/server/tools/notifiers/terminal-manager.js +5 -4
- 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/lifecycle-hooks.d.ts +2 -2
- package/dist/server/utils/lifecycle-hooks.js +1 -1
- package/dist/server/utils/rbac.js +1 -1
- package/dist/server/utils/report-all-errors.js +1 -1
- package/dist/server/utils/set-execution-mode.d.ts +5 -0
- package/dist/server/utils/set-execution-mode.js +1 -0
- 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 +13 -13
- package/dist/cli/prepare/copy-env-files.js +0 -1
- package/dist/cli/prepare/index.js +0 -1
- package/dist/cli/stats/collectors/openapi.js +0 -1
- 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/config/env-schemas/search.js +0 -1
- package/dist/server/plugins/asyncapi-docs/template/AsyncApiDocs.js +0 -11
- 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/cli/{prepare → build}/analytics/collect-analytics.d.ts +0 -0
- /package/dist/cli/{prepare → build}/analytics/collect-analytics.js +0 -0
- /package/dist/cli/{prepare → build}/analytics/collectors/get-api-functions-usage.d.ts +0 -0
- /package/dist/cli/{prepare → build}/analytics/collectors/get-api-functions-usage.js +0 -0
- /package/dist/cli/{prepare → build}/analytics/collectors/get-async-api-usage.d.ts +0 -0
- /package/dist/cli/{prepare → build}/analytics/collectors/get-async-api-usage.js +0 -0
- /package/dist/cli/{prepare → build}/analytics/collectors/get-config-stats-usage.d.ts +0 -0
- /package/dist/cli/{prepare → build}/analytics/collectors/get-config-stats-usage.js +0 -0
- /package/dist/cli/{prepare → build}/analytics/collectors/get-file-extensions-usage.d.ts +0 -0
- /package/dist/cli/{prepare → build}/analytics/collectors/get-file-extensions-usage.js +0 -0
- /package/dist/cli/{prepare → build}/analytics/collectors/get-frontmatter-usage.d.ts +0 -0
- /package/dist/cli/{prepare → build}/analytics/collectors/get-frontmatter-usage.js +0 -0
- /package/dist/cli/{prepare → build}/analytics/collectors/get-markdoc-usage.d.ts +0 -0
- /package/dist/cli/{prepare → build}/analytics/collectors/get-markdoc-usage.js +0 -0
- /package/dist/cli/{prepare → build}/analytics/collectors/get-nested-configs-usage.d.ts +0 -0
- /package/dist/cli/{prepare → build}/analytics/collectors/get-nested-configs-usage.js +0 -0
- /package/dist/cli/{prepare → build}/analytics/collectors/get-processed-config-stats-usage.d.ts +0 -0
- /package/dist/cli/{prepare → build}/analytics/collectors/get-processed-config-stats-usage.js +0 -0
- /package/dist/cli/{prepare → build}/analytics/collectors/get-refs-usage.d.ts +0 -0
- /package/dist/cli/{prepare → build}/analytics/collectors/get-refs-usage.js +0 -0
- /package/dist/cli/{prepare → build}/analytics/collectors/get-theme-folder-usage.d.ts +0 -0
- /package/dist/cli/{prepare → build}/analytics/collectors/get-theme-folder-usage.js +0 -0
- /package/dist/cli/{prepare → build}/copy-env-files.d.ts +0 -0
- /package/dist/cli/{prepare → build}/libsql/copy-prebuilt-binary.d.ts +0 -0
- /package/dist/cli/{prepare → build}/libsql/copy-prebuilt-binary.js +0 -0
- /package/dist/cli/{prepare → build}/libsql/get-current-platform.d.ts +0 -0
- /package/dist/cli/{prepare → build}/libsql/get-current-platform.js +0 -0
- /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}/helpers.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.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/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 +1 @@
|
|
|
1
|
-
import{getInnerText as o}from"
|
|
1
|
+
import{getInnerText as o}from"../../../../../markdoc/helpers/get-inner-text.js";import{slugger as c}from"../../../../../utils/slugger.js";class a{#t;#e;#r;#n;constructor(t){const{node:r,content:n,rbacTeam:s,parentNode:i}=t;this.#t=r,this.#e=n,this.#r=i,this.#n=s}get attributes(){return this.#t.attributes}get content(){return this.#e}get node(){return this.#t}get id(){throw new Error("SectionNode needs an id mixin applied")}get parentNode(){return this.#r}get rbacTeam(){return this.#n}}function h(e){let t=0;return class extends e{#t=++t;get id(){return this.#t}}}function g(e){return class extends e{#t;constructor(...t){super(...t);const r=this;this.#t=c.slug(o(r.node.children),{replaceDots:!0,replaceSlashes:!0})}get id(){return this.#t}}}export{a as SectionNode,h as WithCounterId,g as WithSlugId};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import p from"@markdoc/markdoc";import{REDOCLY_ROUTE_RBAC as l,REDOCLY_TEAMS_RBAC as A}from"@redocly/config";import{
|
|
1
|
+
import p from"@markdoc/markdoc";import{REDOCLY_ROUTE_RBAC as l,REDOCLY_TEAMS_RBAC as A}from"@redocly/config";import{getInnerText as h}from"../../../../markdoc/helpers/get-inner-text.js";import{getSearchDocuments as T}from"./get-search-documents.js";import{AstToSearchNodeTransformer as R}from"./walk-sections.js";import{setDocumentSearchFacets as S,extractDocumentSearchFacets as C}from"./search-facets.js";import{MARKDOC_PARTIALS_DATA_KEY as D}from"../../../store.js";import{normalizeFrontmatterKeywords as _}from"../../helpers/normalize-frontmatter-keywords.js";function K(e,m,o,c){return async(t,r,a)=>{if(e?.excludeFromSearch)return[];const i=p.Ast.fromJSON(r.ast),f=new R({ast:i,getInnerContent:h,partials:a.getGlobalConfig(D)||{}}),u=t.metadata||{},n=C(u,o);S(n,o,c);const d=e?.seo?.title||m,{result:s}=_(e?.keywords);return T(f,t.slug,d,r[A],r[l],n,s||void 0)}}export{K as searchResolver};
|
|
@@ -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};
|
|
@@ -9,6 +9,7 @@ export type DocsMcpToolRegistrationOptions = {
|
|
|
9
9
|
apiDescriptionsMap: Record<string, ApiDescriptionInfo>;
|
|
10
10
|
headers?: Record<string, string | string[] | undefined>;
|
|
11
11
|
accessInfo: AccessInfo;
|
|
12
|
+
products?: string[];
|
|
12
13
|
};
|
|
13
14
|
/** Keys that can be passed to the tool context (excludes 'server' which is not serializable) */
|
|
14
15
|
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,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{createMcpRequestHandler as
|
|
1
|
+
import{createMcpRequestHandler as h}from"./mcp-request-handler.js";import{createDocsMcpServer as y}from"../servers/docs-server.js";import{filterApiDescriptionsByRbac as b}from"../utils.js";import{createInternalServerError as A}from"./errors.js";import{McpServerType as m}from"../constants.js";import{telemetry as u}from"../../../telemetry/index.js";import{constructInvalidTokenResponse as L,constructUnauthorizedResponse as S,handleMcpAuth as I,shouldHandleMcpAuth as R}from"../auth/auth-handlers.js";async function w(e,s,i,n){try{u.initialize();const r=s,t=r?.props?.config?.apiDescriptionsMap||{},a=r?.props?.outdir||"",o=r?.props?.config?.mcpDocsServerName||"Docs MCP server",f=new URL(n.url).origin,{user:c,config:{rbac:p={},mcp:l={}}}=e,d=b(t,c,p,e.config.requiresLogin||!1),g=l.docs?.name||o,v=e.config.products?Object.values(e.config.products).map(D=>D?.name):[],M={rbac:p,email:c?.email,teams:c?.teams,isAuthenticated:!!c?.isAuthenticated,requiresLogin:e.config.requiresLogin||!1};return await y({name:g,baseUrl:f,headers:i,apiDescriptionsMap:d,outdir:a,accessInfo:M,products:v})}catch(r){throw u.sendMcpErrorMessage([{object:"mcp_server",server_type:m.Docs,message:r?.message||"",stack:r?.stack||""}]),A(r?.message||"Internal server error mcp docs")}}const T=h({createServerInstance:w,serverType:m.Docs}),U=async(e,s,i)=>{const n=!!s?.config?.requiresLogin,r=s?.config?.rbac;if(R(n,r)){const{isAuthenticated:t,isTokenValid:a,currentUser:o}=await I(e,s);if(!t)return S(new URL(e.url).origin);if(!a)return L();o&&(s.user=o)}return T(e,s,i)};var N=U;export{N as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{withPathPrefix as d}from"@redocly/theme/core/utils";import{importApiRoutesHandler as f}from"../../../api-routes/import-api-routes-handlers.js";import{enhanceContext as h}from"../../../api-routes/helpers/enhance-context.js";import{telemetry as A}from"../../../telemetry/index.js";import{KvService as D}from"../../../persistence/kv/services/kv-service.js";import{envConfig as o}from"
|
|
1
|
+
import{withPathPrefix as d}from"@redocly/theme/core/utils";import{importApiRoutesHandler as f}from"../../../api-routes/import-api-routes-handlers.js";import{enhanceContext as h}from"../../../api-routes/helpers/enhance-context.js";import{telemetry as A}from"../../../telemetry/index.js";import{KvService as D}from"../../../persistence/kv/services/kv-service.js";import{envConfig as o}from"../../../config/env-config.js";async function y(a,s,t){const e=s.get("auth"),i=await t.resolveRouteStaticData(a)||{},r=d(a.slug),{requestHandlers:c}=await f(t.serverOutDir),p=c[a.requestHandlerId],m=(await p()).default,u=async()=>await D.getInstance({baseDbDir:t.serverOutDir,sqldRemoteDatabaseUrl:o.SQLD_REMOTE_DATABASE_URL,sqldRemoteDatabaseAuthToken:o.SQLD_REMOTE_DATABASE_AUTH_TOKEN}),l=h({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:t.config},telemetry:A,getKv:u}),n=await m(s.req.raw,l,{...i,props:{...i.props,routeSlug:r,outdir:t.outdir}});return n instanceof Response?n:typeof n=="string"?new Response(n,{headers:{"Content-Type":"text/plain"}}):new Response(JSON.stringify(n),{headers:{"Content-Type":"application/json"}})}export{y as handleMcpRequest};
|
|
@@ -7,16 +7,18 @@ export declare class DocsMcpServer extends BaseMcpServer {
|
|
|
7
7
|
headers: Record<string, string | string[] | undefined>;
|
|
8
8
|
outdir: string;
|
|
9
9
|
accessInfo: AccessInfo;
|
|
10
|
+
products?: string[];
|
|
10
11
|
});
|
|
11
12
|
protected registerTools(): void;
|
|
12
13
|
protected getServerType(): McpServerType;
|
|
13
14
|
}
|
|
14
|
-
export declare function createDocsMcpServer({ name, baseUrl, headers, apiDescriptionsMap, outdir, accessInfo, }: {
|
|
15
|
+
export declare function createDocsMcpServer({ name, baseUrl, headers, apiDescriptionsMap, outdir, accessInfo, products, }: {
|
|
15
16
|
name: string;
|
|
16
17
|
baseUrl: string;
|
|
17
18
|
headers: Record<string, string | string[] | undefined>;
|
|
18
19
|
apiDescriptionsMap: Record<string, ApiDescriptionInfo>;
|
|
19
20
|
outdir: string;
|
|
20
21
|
accessInfo: AccessInfo;
|
|
22
|
+
products: string[];
|
|
21
23
|
}): Promise<import("../types.js").McpServerInstance>;
|
|
22
24
|
//# sourceMappingURL=docs-server.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{BaseMcpServer as
|
|
1
|
+
import{BaseMcpServer as o}from"./base-server.js";import{registerDocsTools as p}from"../docs-mcp/tools/index.js";import{McpServerType as a}from"../constants.js";class d extends o{dependencies;constructor(e){super({name:e.name,version:new Date().toISOString().slice(0,10)}),this.dependencies=e}registerTools(){p({server:this.server,apiDescriptionsMap:this.dependencies.apiDescriptionsMap,baseUrl:this.dependencies.baseUrl,outdir:this.dependencies.outdir,headers:this.dependencies.headers,accessInfo:this.dependencies.accessInfo,products:this.dependencies.products})}getServerType(){return a.Docs}}async function S({name:s,baseUrl:e,headers:r,apiDescriptionsMap:i,outdir:t,accessInfo:n,products:c}){return await new d({name:s,baseUrl:e,headers:r,apiDescriptionsMap:i,outdir:t,accessInfo:n,products:c}).initialize()}export{d as DocsMcpServer,S as createDocsMcpServer};
|
|
@@ -93,6 +93,7 @@ export type ToolArgsMap = {
|
|
|
93
93
|
};
|
|
94
94
|
search: {
|
|
95
95
|
query: string;
|
|
96
|
+
product?: string;
|
|
96
97
|
};
|
|
97
98
|
whoami: Record<string, never>;
|
|
98
99
|
};
|
|
@@ -106,9 +107,15 @@ export type McpToolWorkerParams = {
|
|
|
106
107
|
accessInfo?: AccessInfo;
|
|
107
108
|
baseUrl?: string;
|
|
108
109
|
headers?: Record<string, string | string[] | undefined>;
|
|
110
|
+
products?: string[];
|
|
109
111
|
};
|
|
110
112
|
};
|
|
111
113
|
}[keyof ToolArgsMap];
|
|
114
|
+
export type SemanticSearchResult = {
|
|
115
|
+
title: string;
|
|
116
|
+
url: string;
|
|
117
|
+
content: string;
|
|
118
|
+
};
|
|
112
119
|
export type McpToolWorkerResponse = CallToolResult;
|
|
113
120
|
export {};
|
|
114
121
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{simplifyAstStructure as Z}from"@redocly/openapi-docs";import{REDOCLY_TEAMS_RBAC as D}from"@redocly/config";import{OPENAPI_DOCS_TEMPLATE_ID as $,PUBLIC_RBAC_SCOPE_ITEM as j}from"../../../constants/common.js";import{DEPRECATED_PUBLIC_API_DEFINITIONS_FOLDER as ee,PUBLIC_API_DEFINITIONS_FOLDER as te}from"../../constants/common.js";import{OPENAPI_CUSTOM_FIELDS_SERVER_PROPS_GETTER_ID as oe,OPENAPI_SHARED_DATA_PREFIX as U}from"../../constants/plugins/openapi-docs.js";import{envConfig as V}from"
|
|
1
|
+
import{simplifyAstStructure as Z}from"@redocly/openapi-docs";import{REDOCLY_TEAMS_RBAC as D}from"@redocly/config";import{OPENAPI_DOCS_TEMPLATE_ID as $,PUBLIC_RBAC_SCOPE_ITEM as j}from"../../../constants/common.js";import{DEPRECATED_PUBLIC_API_DEFINITIONS_FOLDER as ee,PUBLIC_API_DEFINITIONS_FOLDER as te}from"../../constants/common.js";import{OPENAPI_CUSTOM_FIELDS_SERVER_PROPS_GETTER_ID as oe,OPENAPI_SHARED_DATA_PREFIX as U}from"../../constants/plugins/openapi-docs.js";import{envConfig as V}from"../../config/env-config.js";import{searchResolver as ae}from"./search/search-resolver.js";import{convertOpenAPIDocs2Sidebar as re,shouldAddRoute as se}from"./utils.js";import{getTemplatePath as b}from"./get-template-path.js";import{storeDefinitionBundles as ne}from"./store-definition-bundles.js";import{definitionLoader as ie,definitionsLoader as pe}from"./load-definition.js";import{getAiDocumentsStore as de}from"./search/get-ai-search-documents.js";import{fromCurrentDir as ce}from"../../utils/paths.js";import{telemetryTraceStep as le}from"../../../cli/telemetry/helpers/trace-step.js";const w="openapi-spec-download";async function Ce(){let M=[],R={},L=new Set;return{id:"openapi",requiredEntitlements:["openapi"],loaders:{"load-oas-docs":pe,"load-oas":ie},processContent:async(e,p)=>{await le("build.plugin.openapi_docs",async u=>{e.createRequestHandler(w,ce(import.meta.url,"./spec-download.api.js")),e.addApiRoute({slug:te+"/*",requestHandlerId:w,httpMethod:"all",[D]:j,getStaticData:async()=>({props:{}})}),e.addApiRoute({slug:ee+"/*",requestHandlerId:w,httpMethod:"all",[D]:j,getStaticData:async()=>({props:{}})});const A=e.createTemplate($,b("../../../client/templates/openapi-docs/template.js")),a=e.registerServerPropsGetter($,b("./get-server-props.js")),s=e.registerServerPropsGetter(oe,b("./get-server-props-custom-fields.js")),d=await p.getConfig();u?.setAttribute("config",JSON.stringify(d.openapi||{}));const g=d.rules?.["custom-fields-schema"];R={};const m=await e.loadOpenApiDefinitions(p);M=m.map(({markdocChunks:r,relativePath:f,customOutputRelativeFile:i,isVirtual:n,realRelativePath:c})=>({chunks:r,relativePath:f,realRelativePath:c,isVirtual:i!=null||n})),ne(m,e.outdir);const S={};for(const r of m||[]){const{definition:f,config:i,relativePath:n,customOutputRelativeFile:c,contentItems:_,flatItems:k,parser:E,options:B,rawOptions:q,hash:J}=r,N=c||n,o=[],x={},{definition:Q}=E||{},{info:l}=Q||{},v=l?.["x-metadata"],C=!!i.openapi?.excludeFromSearch||!!i.theme?.openapi?.excludeFromSearch||!!d.openapi?.excludeFromSearch||!!d.theme?.openapi?.excludeFromSearch,G={title:l?.title,description:l?.description,summary:l?.summary,...i.metadata,...v},h={untagged:[],tagged:new Map};for(const t of k){const{id:O,href:I,operationDefinition:y}=t;if(y){const{tags:P}=y;if(P)for(const T of P)h.tagged.has(T)||h.tagged.set(T,[]),h.tagged.get(T)?.push(t);else h.untagged.push(t);V.isDevelopMode&&(x[`#${y.pointer}`]=t.href)}if(!se({item:t}))continue;const F=t,Y=F.type==="section"&&!!F.infoDefinition,z=I.split("#")[0]+"/",K=t?.operationDefinition?.[D];o.push({excludeFromSearch:C,slugSuffix:z,fsPath:N,metadata:{subType:"openapi-operation"},httpVerb:t?.httpVerb||"",path:n,templateId:A,[D]:K||i.rbac,getAiDocumentsStore:de({parser:E,options:B,info:l,tagOperations:h,openapiContentItem:F,metadata:G,relativePath:n,getSearchFacets:e.getSearchFacets,includeInLLMsTxt:Y,excludeFromSearch:C}),getStaticData:async P=>({props:{dynamicMarkdocComponents:["openapi"],baseSlug:P.baseSlug,seo:t["x-metadata"]?.seo||{title:t.name,description:t.description},itemId:O,disableAutoScroll:!0}})})}o[0]={...o[0],metadata:{type:"openapi",...G},hasClientRoutes:!0,getSidebar:(t,O)=>{const I=[];return re({contentItems:_,sidebarItems:I,routeSlug:t.slug,navItem:O}),I},getNavText:()=>l?.title,getSearchDocuments:ae(E,B,k,e.getSearchFacets,e.setSearchFacets,C)},v?.apiId&&(S[v.apiId]={slug:o[0]?.slug||""});const W=o[0];o[0]=o[o.length-1],o[o.length-1]=W;for(const t of o)e.addRoute({...t,serverPropsGetterIds:g?[a,s]:[a]});const X=V.isDevelopMode?n:void 0,H=`${U}${n}`;R[H]={fsPath:N,definition:f,options:q,sourcePath:X,routesMapping:x,hash:J};for(const t of o)e.addRoute({...t,sharedData:[{id:H,key:"openAPIDocsStore"}],serverPropsGetterIds:g?[a,s]:[a]})}e.setGlobalData({apiProducts:S})})},afterRoutesCreated:async(e,p)=>{const u=new Set;for(const{chunks:a,relativePath:s,isVirtual:d,realRelativePath:g}of M){const m=e.getAllRoutes().filter(r=>r.fsPath===s).map(r=>r.slug),S=(await p.cache.load(g,"load-oas")).compoundHash;await p.cache.load(s,{loader:async function(){for(const{node:f,markdown:i,key:n,relativePath:c}of a){const{ast:_}=await e.parseMarkdoc({content:i,relativePath:c,isVirtual:d},p,{sharedDataIds:[`${U}${c}`],routeSlugs:m});f[`x-parsed-md-${n}`]={result:Z(_)}}},name:"openapi-markdoc-inline-parser"},[S]);for(const{pointer:r}of a)u.add(r)}const A=L.difference(u);for(const a of A)p.cache.delete(a);L=u;for(const[a,s]of Object.entries(R))await e.createSharedData(a,{...s,baseSlug:e.getRouteByFsPath(s.fsPath)?.baseSlug},s.hash)}}}export{Ce as openAPIDocsPlugin};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{REDOCLY_TEAMS_RBAC as k}from"@redocly/config";import{basename as
|
|
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 F,join as L}from"node:path";import{toMarkdown as _}from"../../../plugins/markdown/search/to-markdown.js";import{canDownloadApiDefinition as G,isResourcePubliclyAccessible as J}from"../../../utils/rbac.js";import{PUBLIC_API_DEFINITIONS_FOLDER as q}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 B}from"../../../fs/utils/get-locale-from-relative-path.js";import{extractDocumentSearchFacets as C}from"./search-facets.js";import{formatDocumentMetadata as Y}from"../../search/utils.js";import{getLLMsTxtMdSlug as H,llmsTxtLink as E}from"../../search/llmstxt/index.js";import{replaceFileExtension as K}from"../store-definition-bundles.js";const x=new Map,he=({parser:s,options:c,info:t,tagOperations:i,relativePath:n,openapiContentItem:e,metadata:r,getSearchFacets:o,includeInLLMsTxt:a,excludeFromSearch:m})=>async(u,f,l)=>{if(m)return;const D=await u.getNavText?.()||F(u.fsPath),A=new V(s,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}=ne(i.tagged,A,O),{all:T,publiclyAccessible:w}=te(i.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=Z({title:S,security:s.definition.security,document:p,version:p.version||t.version,headingLevel:h,operation:b});break;case"section":if(e.infoDefinition){$=x.get(n),d=await M({parser:s,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=s.definition.tags?.find(N=>N.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 M({parser:s,info:t,staticData:f,relativePath:n,headingLevel:h,pageName:D,config:O})}else e.ast&&(d=g=_(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=I({title:S,description:e.description,name:e.name,xMcpConfig:s.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=B(u.fsPath),y=C({...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 M({parser:s,info:c,staticData:t,relativePath:i,pageName:n,headingLevel:e,config:r}){const o=Y(c["x-metadata"]);let a=c.title?`${e} ${c.title}
|
|
3
3
|
|
|
4
4
|
`:`${e} ${n}
|
|
5
5
|
|
|
@@ -12,30 +12,30 @@ 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+=
|
|
15
|
+
`,a+=Q({parser:s,headingLevel:e}),a+=X({parser:s,headingLevel:e}),a+=await W({info:c,staticData:t,relativePath:i,pageName:n,headingLevel:e,config:r}),a}function j({title:s="",description:c,operationSearchDocuments:t,headingLevel:i}){let n=`${i} ${s}
|
|
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+=`${i}# ${r}${e.deprecated?" (deprecated)":""}
|
|
20
20
|
|
|
21
|
-
`,n+=` - ${
|
|
22
|
-
`}),n}function
|
|
21
|
+
`,n+=` - ${E({title:`${e.httpMethod?.toUpperCase()} ${e.httpPath}`,description:Array.isArray(e.text)?e.text.join(" "):e.text,slug:H(e.url)})}`,n+=`
|
|
22
|
+
`}),n}function Q({parser:s,headingLevel:c}){const{servers:t}=s.definition;if(t&&t.length){let i=`${c} Servers
|
|
23
23
|
|
|
24
|
-
`;return t.forEach(n=>{
|
|
25
|
-
`:"",
|
|
24
|
+
`;return t.forEach(n=>{i+=n.description?`${n.description}
|
|
25
|
+
`:"",i+=`\`\`\`
|
|
26
26
|
${n.url}
|
|
27
27
|
\`\`\`
|
|
28
28
|
|
|
29
|
-
`,n.variables&&(
|
|
30
|
-
`,Object.entries(n.variables).forEach(([e,
|
|
31
|
-
`,
|
|
32
|
-
`:"",
|
|
33
|
-
`:""}),
|
|
34
|
-
`)}),
|
|
29
|
+
`,n.variables&&(i+=`Variables:
|
|
30
|
+
`,Object.entries(n.variables).forEach(([e,r])=>{i+=`- \`${e}\`${r.description?`: ${r.description}`:""}
|
|
31
|
+
`,i+=r.default?`Default: ${JSON.stringify(r.default)}
|
|
32
|
+
`:"",i+=r.enum?`Enum: ${r.enum.map(o=>JSON.stringify(o)).join(", ")}
|
|
33
|
+
`:""}),i+=`
|
|
34
|
+
`)}),i}return""}async function W({info:s,staticData:c,relativePath:t,pageName:i,headingLevel:n,config:e}){const r=L(c.props?.outdir||"",q,K(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+=
|
|
36
|
+
`;return o+=E({title:s.title||i||"OpenAPI definition",description:void 0,slug:r}),o}return""}function X({parser:s,headingLevel:c}){if(!s.definition.components?.securitySchemes)return"";let t=`${c} Security
|
|
37
37
|
|
|
38
|
-
`;const{securitySchemes:
|
|
38
|
+
`;const{securitySchemes:i}=s.definition.components;return Object.keys(i).forEach(n=>{const e=i[n];e&&(t+=`${c}# ${n}
|
|
39
39
|
|
|
40
40
|
`,t+=e.description?`${e.description}
|
|
41
41
|
|
|
@@ -47,46 +47,46 @@ ${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
|
|
55
|
+
`)}),t}function Z({title:s,security:c,document:t,version:i,headingLevel:n,operation:e}){const{text:r,httpMethod:o,httpPath:a,deprecated:m}=t,u=ee(t.parameters||[],`${n}#`),f=v(`${n}#`,t.parameters,e);let l=s?`${n} ${s}${m?" (deprecated)":""}
|
|
56
56
|
|
|
57
|
-
`:"";return l+=
|
|
57
|
+
`:"";return l+=r?`${r}
|
|
58
58
|
|
|
59
59
|
`:"",l+=`Endpoint: ${o?.toUpperCase()} ${a}
|
|
60
|
-
`,l+=
|
|
60
|
+
`,l+=i?`Version: ${i}
|
|
61
61
|
`:"",l+=t.security?.length?`Security: ${t.security.join(", ")}
|
|
62
62
|
`:c?.length?`Security: ${c.map(D=>D.id).join(", ")}
|
|
63
63
|
`:"",l+=`
|
|
64
64
|
`,l+=u?`${u}
|
|
65
65
|
`:"",l+=`
|
|
66
66
|
`,l+=`${f.join(`
|
|
67
|
-
`)}`,l}function
|
|
67
|
+
`)}`,l}function I({title:s,name:c,xMcpConfig:t,headingLevel:i}){const n=t?.tools.find(r=>r.name===c);if(!n)return"";let e=`${i} ${s}
|
|
68
68
|
|
|
69
69
|
`;return e+=n.description?`${n.description}
|
|
70
70
|
|
|
71
|
-
`:"",e+=`${
|
|
71
|
+
`:"",e+=`${i}# Input schema:
|
|
72
72
|
|
|
73
73
|
`,e+=`\`\`\`json
|
|
74
74
|
${JSON.stringify(n.inputSchema,null,2)}
|
|
75
75
|
\`\`\`
|
|
76
76
|
|
|
77
|
-
`,n.outputSchema&&(e+=`${
|
|
77
|
+
`,n.outputSchema&&(e+=`${i}# Output schema:
|
|
78
78
|
|
|
79
79
|
`,e+=`\`\`\`json
|
|
80
80
|
${JSON.stringify(n.outputSchema,null,2)}
|
|
81
81
|
\`\`\`
|
|
82
82
|
|
|
83
|
-
`),e}function
|
|
84
|
-
`)}function
|
|
83
|
+
`),e}function v(s,c,t){return!c&&!t||!t?.responses?[]:t?.responses.filter(n=>!n.content?.mediaTypes[0]?.schema).map(n=>`${s} ${P(`response ${n.code} fields`)}
|
|
84
|
+
`)}function ee(s,c){const t={};for(const n of s){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
|
-
`),f});return`${c} ${
|
|
88
|
+
`),f});return`${c} ${P(n)}:
|
|
89
89
|
|
|
90
|
-
${
|
|
90
|
+
${r.join(`
|
|
91
91
|
`)}`}).join(`
|
|
92
|
-
`)}function
|
|
92
|
+
`)}function ne(s,c,t){const i=[],n=[];return s.forEach((e,r)=>{const o=[],a=[];e.forEach(m=>{const u=c.addItem(m);u&&(o.push(u),R({[k]:m[k],slug:u.url},t)&&a.push(u))}),i.push([r,o]),n.push([r,a])}),{all:i,publiclyAccessible:n}}function te(s,c,t){const i=[],n=[];return s.forEach(e=>{const r=c.addItem(e);r&&(i.push(r),R({[k]:e[k],slug:r.url},t)&&n.push(r))}),{all:i,publiclyAccessible:n}}function P(s){return s.charAt(0).toUpperCase()+s.slice(1)}function R(s,c){return c.requiresLogin?!0:J(s,c)}export{he as getAiDocumentsStore};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as g from"@redocly/openapi-docs";import{REDOCLY_TEAMS_RBAC as d}from"@redocly/config";import{combineUrls as l}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 u=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=l(this.#e,e.href);return{id:t,url:t,text:a(c(e.description||"")),title:e.name}}getResult(){return this.#n}getOperation(e){return u.getOperation(this.#r,e.operationDefinition,e.parent,{...this.#s,internal_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 l}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 u=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=l(this.#e,e.href);return{id:t,url:t,text:a(c(e.description||"")),title:e.name}}getResult(){return this.#n}getOperation(e){return u.getOperation(this.#r,e.operationDefinition,e.parent,{...this.#s,internal_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])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:u.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=l(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(!(!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:u.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=l(this.#e,e.href);return{id:t,url:t,text:a(c(e.description||"")),title:a(e.name)}}#p(e){const t=l(this.#e,e.href);return{id:t,url:t,text:a(c(e.description||"")),title:a(e.name)}}}export{T as SearchIndexer};
|
|
@@ -2,6 +2,7 @@ import type { RedoclyConfig } from '@redocly/config';
|
|
|
2
2
|
export declare const getScorecardConfig: (config: Partial<RedoclyConfig>) => {
|
|
3
3
|
ignore?: string[] | undefined;
|
|
4
4
|
levels: {
|
|
5
|
+
extends?: string[] | undefined;
|
|
5
6
|
preprocessors?: {
|
|
6
7
|
[x: string]: unknown;
|
|
7
8
|
} | undefined;
|
|
@@ -112,7 +113,6 @@ export declare const getScorecardConfig: (config: Partial<RedoclyConfig>) => {
|
|
|
112
113
|
[x: string]: unknown;
|
|
113
114
|
};
|
|
114
115
|
} | undefined;
|
|
115
|
-
extends?: string[] | undefined;
|
|
116
116
|
color?: string | undefined;
|
|
117
117
|
name: string;
|
|
118
118
|
}[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{writeFileSync as E}from"node:fs";import D from"path";import{SCORECARD_OUTPUT_FILE_NAME as b}from"../../constants/common.js";import{mapObject as T}from"../../../utils/object/map-object.js";import{envConfig as w}from"
|
|
1
|
+
import{writeFileSync as E}from"node:fs";import D from"path";import{SCORECARD_OUTPUT_FILE_NAME as b}from"../../constants/common.js";import{mapObject as T}from"../../../utils/object/map-object.js";import{envConfig as w}from"../../config/env-config.js";import{removeLeadingSlash as A}from"../../../utils/url/remove-leading-slash.js";import{combineUrls as R}from"@redocly/theme/core/utils";import{logger as j}from"../../tools/notifiers/logger.js";import{getRouteSlugToCatalogSlugMap as F}from"../../utils/catalog-classic/get-route-slug-to-catalog-slug-map.js";import{deepEqual as I}from"../../../utils/object/deep-equal.js";import{ensureDir as N}from"../../utils/index.js";import{getTemplatePath as U}from"./get-template-path.js";import{getAllRuleNames as q}from"./lint.js";import{getScorecardConfig as L}from"./get-scorecard-config.js";import{CUSTOM_FIELDS_SERVER_PROPS_GETTER_ID as M}from"../catalog-classic/index.js";import{getScorecardSlug as k}from"./shared-utils.js";import{scorecardConfigLoader as W}from"./loaders/scorecard-config.js";import{scorecardLoader as B}from"./loaders/scorecard.js";import{computeScorecard as J}from"./compute-scorecard.js";import{telemetryTraceStep as $}from"../../../cli/telemetry/helpers/trace-step.js";const G="scorecardClassic";let u={},h={};async function ue({id:P,requiredEntitlements:_,loadersPrefix:v=""}){let p=null,y=null,O=!1;return{id:P??"scorecardClassic",requiredEntitlements:_??["scorecard"],loaders:{[`${v}scorecard-config`]:W,[`${v}scorecard`]:B},async processContent(r,l){await $("build.plugin.scorecard_classic",async S=>{const a=r.createTemplate(G,U("./template/index.js")),g=await l.getConfig(),m=L(g),f=g?.reunite??{},i=[()=>p===null,()=>!I(u,m),()=>!I(h,f)].some(e=>e());u=m,S?.setAttribute("config",JSON.stringify(u||{})),h=f;const n=g.catalogClassic??{},c=u.levels||[];if(c.length<1)throw Error("Invalid configuration of levels config");i&&(p=await J({actions:r,context:l,scorecardConfig:u,reuniteConfig:h}));const{data:{configs:t}}=await l.cache.load("",`${v}scorecard-config`),{perLevel:d,all:s}=q(t);y={levelNames:c.map(e=>e.name),rules:s,rulesPerLevel:d};for(const[e,o]of Object.entries(n)){const C=R(o.slug,"scorecard/");r.addRoute({duplicateInAllLocales:!0,slug:C,fsPath:R(o.slug,"scorecard/"),templateId:a,hasClientRoutes:!0,excludeFromSidebar:!0,serverPropsGetterIds:[M],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:u,scorecardInfo:y}})})}})},afterRoutesCreated:async(r,l)=>{const S=await l.getConfig(),a=S.catalogClassic??{},g=L(S);if(Object.keys(a).length){const i=Object.keys(a).length>1?await F(r,l,a):null,n={};for(const[c,t]of Object.entries(p||{})){const d=r.getRouteByFsPath(c),s=d?.slug;if(s){if(d&&!g.ignoreMetadata){const e=i?i.get(s)??Object.values(a)[0].slug:Object.values(a)[0].slug,o=R(e,"scorecard/");d.metadata={...d.metadata,scorecardStatus:t.status,scorecardLevel:t.scorecardLevel,scorecardLevelIdx:t.scorecardLevelIdx,scorecardLevels:T(t.levels,C=>({uniqueErrors:C.uniqueErrors,uniqueWarnings:C.uniqueWarnings})),scoreCardSlug:o+"apis/"+encodeURIComponent(A(s))}}if(n[s]={...t,levels:T(t.levels,e=>({...e,problems:e.problems.map(o=>({ruleId:o.ruleId,severity:o.severity}))}))},!O){const e=D.resolve(r.outdir,"_scorecard",k(s));E(N(e),JSON.stringify(t))}}}await r.createSharedData("scorecard",n)}const m={};for(const[i,n]of Object.entries(p||{})){const c=r.getRouteByFsPath(i)?.slug;c&&(m[c]=n)}const f=w.REDOCLY_METADATA_OUTPUT_FOLDER;!O&&f&&(j.info("Writing scorecard data..."),E(D.join(f,b),JSON.stringify({scorecardData:m,...y}))),O=!0}}}export{ue as scorecardClassicPlugin};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as
|
|
1
|
+
import*as c from"path";import{lintDocument as g,getTotals as v,getLineColLocation as h,Source as y,getCodeframe as C}from"@redocly/openapi-core";import{slash as p}from"../../../utils/path/slash.js";import{getUniqueProblemsCount as P}from"./shared-utils.js";const b=20;async function j(a,r,t,o){const e=c.resolve(t.fs.cwd,a.relativePath),s=r.resolvedConfig.apis??{},l=Object.keys(s).find(n=>c.resolve(r.configPath?c.dirname(r.configPath):t.fs.cwd,s[n].root)===e),m={config:r.forAlias(l),base:c.dirname(e),document:{source:new y(e,a.content),parsed:a.parsed},externalRefResolver:o},f=await g(m),i=P(f);return{...v(f),uniqueErrors:i.errors,uniqueWarnings:i.warnings,problems:O(f,t.fs.cwd).filter(n=>!n.ignored)}}function E(a){const r=new Set,t={};for(const[o,e]of Object.entries(a)){const s=t[o]=t[o]||new Set,l=[e],m=e.resolvedConfig?.apis??{};for(const f of Object.keys(m)){const i=e.forAlias(f);i&&i!==e&&l.push(i)}for(const f of l){const i=Object.values(f.rules).flatMap(n=>Object.entries(n));for(const[n,u]of i)if(!(u==="off"||u?.severity==="off"))if(n==="assertions"){if(!Array.isArray(u))continue;for(const d of u)!d||d.severity==="off"||(s.add(d.assertionId),r.add(d.assertionId))}else r.add(n),s.add(n)}}return{perLevel:Object.fromEntries(Object.entries(t).map(([o,e])=>[o,Array.from(e)])),all:Array.from(r)}}function O(a,r){const t={};return a.map(o=>{const e=t[o.ruleId]||0;t[o.ruleId]=e+1;const s=o.location[0];if(e>b)return{...o,codeframe:`Code frame skipped due to too many errors of this type. Only first ${b} errors are shown.`,location:{...s,source:{absoluteRef:p(c.relative(r,s.source.absoluteRef))}},from:void 0};const l=h(s);return{...o,codeframe:C(l,!1),location:{...s,source:{absoluteRef:p(c.relative(r,s.source.absoluteRef))}},from:void 0}})}export{E as getAllRuleNames,j as lintDefinition};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ulid as g}from"ulid";import{logger as r}from"../../../tools/notifiers/logger.js";import{DatabaseConnectionFactory as l}from"../../../providers/database/database-connection-factory.js";import{BaseRepository as d}from"../../../providers/database/base-repository.js";import{shaHex as h}from"../../../utils/crypto/sha-hex.js";import{hasOptionsChanged as m}from"../../../plugins/catalog-entities/utils/has-options-changed.js";import{slug as y}from"
|
|
1
|
+
import{ulid as g}from"ulid";import{logger as r}from"../../../tools/notifiers/logger.js";import{DatabaseConnectionFactory as l}from"../../../providers/database/database-connection-factory.js";import{BaseRepository as d}from"../../../providers/database/base-repository.js";import{shaHex as h}from"../../../utils/crypto/sha-hex.js";import{hasOptionsChanged as m}from"../../../plugins/catalog-entities/utils/has-options-changed.js";import{slug as y}from"../../../../utils/slugger.js";import{withTimestamp as f}from"../../../utils/time/with-timestamp.js";import{ScorecardsConfigLocalRepository as p}from"./repositories/local/scorecards-config-local-repository.js";class o extends d{static#i;static#e;#t;constructor(t){if(!t)throw new Error("Database connection is required for ScorecardsConfigService");super(t),this.#t=new p(this.databaseClient)}static async getInstance(t){const i=m(o.#e,t);if(!o.#i||i){const n=await l.create("main-local",t);if(!n)throw new Error("Failed to create db connection for scorecards config service");o.#i=new o(n),o.#e=t}return o.#i}async syncConfig(t,i){const n=new Set;(!Array.isArray(t)||t.length===0)&&r.verbose("No scorecard configs to sync"),r.verbose(`Starting scorecard config sync for ${t.length} config(s)`);for(const s of t)try{const e=s.key;if(!/^[a-z0-9-]+$/i.test(e)){r.error(`Skipping invalid scorecard config item: key "${e}" does not match kebab-case format (letters, numbers, and dashes only)`,{scorecard:s});continue}n.add(e);const a=this.#s(s),c=await this.#t.findActiveConfigByKey(e);if(c){if(c.configHash===a){r.verbose(`Config "${e}" unchanged, skipping update`);continue}r.verbose(`Updating config "${e}"`),await this.#r(c.id,s,a)}else r.verbose(`Inserting new config "${e}"`),await this.#n(e,s,a);i&&await i(e)}catch(e){r.error("Error processing scorecard config item:",{error:e.message??e,scorecard:s})}await this.#o(n),r.verbose("Sync scorecard configuration: success")}#s(t){const i=JSON.stringify({entities:t.entities,levels:t.levels});return h(i)}async#n(t,i,n){await this.#t.insertConfig(f({id:`sc_${g()}`,key:t,slug:y(t),name:i.name,description:i.description??null,entitiesFilter:JSON.stringify(i.entities),levels:JSON.stringify(i.levels),configHash:n,archivedAt:null}))}async#r(t,i,n){const s=f({entitiesFilter:JSON.stringify(i.entities),levels:JSON.stringify(i.levels),configHash:n,archivedAt:null},{fields:["updatedAt"]});await this.#t.updateConfigById(t,s)}async#o(t){const i=await this.#t.findAllActiveConfigs(),n=new Date().toISOString();for(const s of i)if(!t.has(s.key)){r.verbose(`Archiving removed config "${s.key}"`);try{await this.#t.archiveConfigById(s.id,n)}catch(e){r.error(`Error archiving config item "${s.key}":`,e.message??e)}}}}export{o as ScorecardsConfigService};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{envConfig as c}from"
|
|
1
|
+
import{envConfig as c}from"../../config/env-config.js";import{SCORECARDS_BASE_SLUG as i,SCORECARDS_TEMPLATE_ID as n}from"../../constants/plugins/scorecards.js";import{getTemplatePath as d}from"./utils/get-template-path.js";import{telemetryTraceStep as l}from"../../../cli/telemetry/helpers/trace-step.js";async function u(){return{id:"Scorecards",requiredEntitlements:["scorecards"],async processContent(e,r){await l("build.plugin.scorecards",async s=>{if(c.NEW_SCORECARDS_ENABLED!=="true")return;const t=(await r.getConfig()).scorecards;s?.setAttribute("config",JSON.stringify(t));const{logger:o}=r;o.info("Scorecards plugin started");const a=e.createTemplate(n,d("../template/index.js"));e.addRoute({duplicateInAllLocales:!0,slug:i,fsPath:"",templateId:a,excludeFromSidebar:!0,hasClientRoutes:!0,getNavText:()=>Promise.resolve("Scorecards"),getStaticData:async()=>({props:{scorecardsConfig:t}})}),o.info("Scorecards plugin finished")})}}}var C=u;export{C as default,u as scorecardsPlugin};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{SCORECARDS_WORKER_KEY as f,scorecardsWorker as m}from"../../../workers/scorecards-worker-pool.js";import{logger as e}from"../../../tools/notifiers/logger.js";import{envConfig as u}from"
|
|
1
|
+
import{SCORECARDS_WORKER_KEY as f,scorecardsWorker as m}from"../../../workers/scorecards-worker-pool.js";import{logger as e}from"../../../tools/notifiers/logger.js";import{envConfig as u}from"../../../config/env-config.js";const o=5;async function n(s){const{baseDbDir:c,scorecardsConfig:a,attempt:t}=s;try{const r=await m.exec(f,[{baseDbDir:c,scorecardsConfig:a,pollingIntervalMs:parseInt(u.SCORECARDS_POLLING_INTERVAL_MS||"3000",10)}]);if(r.success)return e.info(`${r.message}`),Promise.resolve();e.error(`Execute Scorecards Worker: failed (attempt ${t}/${o}): ${r.error}`)}catch(r){const i=r instanceof Error?r.message:String(r);e.error(`Execute Scorecards Worker: failed (attempt ${t}/${o}): ${i}`)}return t<o?(e.info(`Execute Scorecards Worker: retrying... (attempt ${t+1}/${o})`),n({baseDbDir:c,scorecardsConfig:a,attempt:t+1})):(e.error(`Execute Scorecards Worker: failed. Scorecards Worker could not be started after all ${o} attempts`),Promise.resolve())}async function p(s,c){return e.info("Start Scorecards Worker: executing..."),n({baseDbDir:s,scorecardsConfig:c,attempt:1})}export{p as runScorecardsWorker};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { AfterRoutesCreatedActions, AfterRoutesCreatedLifecycleContext } from '../../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Prepares chunked documents for semantic search, llms.txt, and Docs MCP.
|
|
4
|
+
* Chunking runs when any of these is enabled: AI search, llms.txt, or Docs MCP.
|
|
5
|
+
* embeddingsEnabled is true when AI search or Docs MCP is enabled (shared embedding index).
|
|
6
|
+
*/
|
|
7
|
+
export declare function prepareSemanticDocuments(actions: AfterRoutesCreatedActions, context: AfterRoutesCreatedLifecycleContext, { embeddingsEnabled, llmstxtEnabled, }: {
|
|
8
|
+
embeddingsEnabled: boolean;
|
|
9
|
+
llmstxtEnabled: boolean;
|
|
10
|
+
}): Promise<void>;
|
|
11
|
+
//# sourceMappingURL=prepare-semantic-documents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import p from"node:path";import{existsSync as v}from"node:fs";import{writeFile as R,access as N,rm as X,constants as $}from"fs/promises";import{REDOCLY_ROUTE_RBAC as A,REDOCLY_TEAMS_RBAC as S}from"@redocly/config";import b from"picomatch";import{DEFAULT_LOCALE_PLACEHOLDER as _}from"../../../../constants/common.js";import{AI_INDEX_EXPORT_FOLDER as j}from"../../../constants/plugins/search.js";import{LLMS_TXT_FILE_NAME as k}from"../../../constants/common.js";import{envConfig as B}from"../../../config/env-config.js";import{logger as a}from"../../../tools/notifiers/logger.js";import{shaHexShort as G}from"../../../utils/crypto/sha-hex-short.js";import{promiseMapLimit as C}from"../../../utils/async/promise-map-limit.js";import{validateLLMsTxtConfig as H,generateLLMsTxt as U,getLLMsTxtMdSlug as Y}from"../llmstxt/index.js";import{ensureDir as h}from"../../../utils/fs.js";import{isResourcePubliclyAccessible as J,extractTeamsFromScopeItems as K,getRbacTeamsListForResource as V}from"../../../utils/rbac.js";const M=20,d="llms.txt:";async function pt(t,i,{embeddingsEnabled:e,llmstxtEnabled:r}){const n=p.join(t.outdir,k);if(!r){try{await N(n,$.W_OK),await X(n)}catch{}if(!e)return}e&&a.info("Preparing semantic documents..."),r&&a.info(`${d} Generating llms.txt files...`);const L=a.startTiming(),c=a.startTiming(),f=t.getGlobalConfig("seo"),m=f?.llmstxt,T=p.resolve(t.outdir,j),u=t.getConfig(),P=u.rbac??{},w=t.getAllRoutes(),F=u?.l10n?.defaultLocale||u?.i18n?.defaultLocale||_,O=(m?.excludeFiles||[]).map(o=>b(o)),x=[];if(await C(w,M,async o=>{if(o.excludeFromSearch)return;const y=await W(o,t),D=await q(o,y,i,t);if(D){if(r)for(const s of await D.getLLMsTxts()){if(O.some(l=>l(s.fsPath)))continue;const g=p.join(t.outdir,Y(s.slug));h(g),await R(g,s.content),s.includeInLLMsTxt&&J(o,u)&&x.push(s)}if(e&&B.isBuildMode){const s=await D.getSearchDocuments();if(!s.length)return;const g=z(o,P),l=o.versions?.find(({active:I})=>I),E=l&&{folder:l.folderId,label:l.label,default:l.default};await Q(s,o.fsPath,g,T,F,E)}}}),e&&a.infoTime(c,"Semantic search documents prepared"),x.length)try{H(m);const o=await U(x,m,{title:f?.title,description:f?.description},i);h(n),await R(n,o),a.infoTime(L,`${d} files generated`)}catch(o){a.error(`${d} Failed to generate llms.txt file. ${o.message}`)}}async function W(t,i){return t.getStaticData?t.getStaticData(t,{...i,contentDir:i.contentDir,parseMarkdoc:(e,r,n)=>i.parseMarkdoc(e,r,n)}):{}}async function q(t,i,e,r){if(t.getAiDocumentsStore)return t.getAiDocumentsStore(t,{...i,[S]:t[S],[A]:t[A]},e,r)}function z(t,i){const e=K(t?.[S]);return e?.length?e:V(t,i)}async function Q(t,i,e,r,n,L){await C(t,M,async c=>{const f=`${G(i+c.content)}.json`,m=h(p.join(r,f)),T=c.locale===_?n:c.locale;v(m)||await R(m,JSON.stringify({...c,rbacTeams:e||[],version:L,locale:T}),"utf-8")})}export{pt as prepareSemanticDocuments};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{REDOCLY_ROUTE_RBAC as
|
|
1
|
+
import{REDOCLY_ROUTE_RBAC as E,REDOCLY_TEAMS_RBAC as g}from"@redocly/config";import{existsSync as B}from"fs";import{rm as M}from"node:fs/promises";import $ from"node:path";import{DEFAULT_LOCALE_PLACEHOLDER as y}from"../../../../constants/common.js";import{SEARCH_DATA_EXPORT_FOLDER as S}from"../../../constants/plugins/search.js";import{envConfig as m}from"../../../config/env-config.js";import{logger as n}from"../../../tools/notifiers/logger.js";import{extractTeamsFromScopeItems as H,getRbacTeamsListForResource as P}from"../../../utils/index.js";import{getSearchDocumentGroup as U}from"../utils.js";import{telemetry as V}from"../../../../cli/telemetry/index.js";import{telemetryTraceStep as A}from"../../../../cli/telemetry/helpers/trace-step.js";async function Q(R,r,d){await A("build.plugin.search.prepare_search_documents",async()=>{n.info("Preparing search documents and create indexes...");const u=m.SEARCH_DEV_DEBUG?$.join(r.contentDir,"..","public","client"):r.outdir;(m.SEARCH_DEV_DEBUG||m.isBuildMode)&&B(`${u}/${S}`)&&await M(`${u}/${S}`,{recursive:!0});const C=n.startTiming(),b=r.getConfig().rbac,v=[y,...R.localeFolders.map(a=>a.toLowerCase())];for(const a of v)await A("build.plugin.search.prepare_search_documents.locale",async c=>{const F=r.getAllRoutesForLocale(a);let h=0,T=0;for(const t of F){if(h++,t.excludeFromSearch)continue;const p=new Map,{product:l}=t,L=await t.getStaticData?.(t,{...r,contentDir:r.contentDir,parseMarkdoc:(s,e,f)=>r.parseMarkdoc(s,e,f)})||{},i=await t.getSearchDocuments?.(t,{...L,[g]:t[g],[E]:t[E]},r),o=t.versions?.find(s=>s.active),w=P(t,b??{});if(i){if(i&&i.length){T+=i.length;for(const s in i){let e=i[s];const f=H(e?.[g]),_=f?.length?f:w,x=e.tags||[];e={...e,...o&&{version:o.version,isDefaultVersion:o.default,versionFolderId:o.folderId},...l&&{product:l},rbacTeams:_,tags:[...x,..._,...o?o.default?["v:default"]:[`v:${o.folderId}:${o.version}`]:["v:default"],...l?[`p:${l.name}`]:[]],url:e.url&&(e.path&&e.path.length>1?e.url:e.url.split("#")[0])};const D=U(e.facets);if(D){const O=p.get(D)??[];p.set(D,[...O,e])}}}for(const[s,e]of p)await d.addDocuments(e,{locale:a,group:s,outDir:u})}}c?.setAttribute("locale",a),c?.setAttribute("totalDocuments",h),c?.setAttribute("totalSearchDocuments",T)});if(d.cleanupFacetValues(r),n.infoTime(C,"Search indexes created"),m.SEARCH_DEV_DEBUG||m.isBuildMode){n.info("Writing out search data...");const a=n.startTiming();await d.export(u);const c=n.infoTime(a,"Search data written");c&&V.sendTimingPerformedMessage(c)}})}export{Q as prepareSearchDocuments};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{readFile as R,readdir as y,appendFile as E}from"node:fs/promises";import m from"node:path";import{existsSync as w}from"node:fs";import{SEARCH_GROUP_FACET_FIELD as F,SEARCH_PRODUCT_FIELD as C,SEARCH_VERSION_FIELD as $}from"../../../../../constants/common.js";import{SEARCH_INDEX_FIELDS as A,SEARCH_DATA_EXPORT_FOLDER as _,SEARCH_MAX_INMEMORY_DOCUMENTS_COUNT as O}from"../../../../constants/plugins/search.js";import{telemetryTraceStep as v}from"../../../../telemetry/helpers/trace-step.js";import{envConfig as N}from"
|
|
1
|
+
import{readFile as R,readdir as y,appendFile as E}from"node:fs/promises";import m from"node:path";import{existsSync as w}from"node:fs";import{SEARCH_GROUP_FACET_FIELD as F,SEARCH_PRODUCT_FIELD as C,SEARCH_VERSION_FIELD as $}from"../../../../../constants/common.js";import{SEARCH_INDEX_FIELDS as A,SEARCH_DATA_EXPORT_FOLDER as _,SEARCH_MAX_INMEMORY_DOCUMENTS_COUNT as O}from"../../../../constants/plugins/search.js";import{telemetryTraceStep as v}from"../../../../telemetry/helpers/trace-step.js";import{envConfig as N}from"../../../../config/env-config.js";import{ensureDir as h}from"../../../../utils/index.js";import{FlexSearchIndex as j}from"./search-index.js";class J{#e=new Map;#s;#t=0;async initIndexSchema(t){this.#s={document:{id:"id",tag:"tags",index:A},worker:!1,tokenize:"forward",context:{depth:2,resolution:9}}}#o(t,o){const e=this.#e.get(t);if(e)return e.find(n=>n.id===o)}#n(t,o){let e=this.#o(t,o);return e||(e=new j(o,this.#s),this.#e.set(t,[...this.#e.get(t)??[],e])),e}async addDocuments(t,o){if(t.length){const{group:e,locale:n,outDir:c}=o,i=this.#n(n,e);for(const a of t)i.add(a),N.isBuildMode&&(this.#t++,this.#t>=O&&await this.exportDocuments(c))}}getIndexesSize(){return this.#e.size}async search(t,o){return await v("search",async e=>{const{query:n,locale:c,filter:i,loadMore:a,auth:f}=t,l=this.#e.get(c)??[];let r=[],d="",x=["v:default"];if(e?.setAttribute("locale",c),i)for(const s of i)s.field===F?r=[...r,...s.values]:s.field===C?d=`p:${s.values[0]}`:s.field===$&&s.values.length&&s.values.length===2&&(x=[...x,`v:${s.values[0]}:${s.values[1]}`]);const g={auth:f,query:n,offset:0,SEARCH_GROUP_FACET_FIELD:F,product:d,versions:x},p=[];let u={facets:{},documents:{}};if(a){const s=this.#o(c,a.groupKey);s&&p.push(s.search({...g,offset:a.offset}))}else for(const s of l)r&&r.length?r.includes(s.id)&&p.push(s.search(g)):p.push(s.search(g));const I=await Promise.all(p);for(const s of I){u.documents={...u.documents,...s.documents};for(const[D,S]of Object.entries(s.facets))u.facets[D]?u.facets[D]=[...u.facets[D],...S]:u.facets[D]=S}return u})}async exportDocuments(t){const o='{"documents":[',e=h(m.join(t,_));for(const[n,c]of this.#e){const i=h(m.join(e,n));for(const a of c){const f=Array.from(a.documents);if(f.length===0)continue;const l=h(m.join(i,`${a.id}.json`)),r=!w(l),d=JSON.stringify(f).substring(1).slice(0,-1),x=r?o+d:","+d;await E(l,x,{encoding:"utf8"}),a.clearDocuments()}}this.#t=0}async exportIndexes(t){const o=h(m.join(t,_));for(const[e,n]of this.#e){const c=h(m.join(o,e));for(const i of n){const a=h(m.join(c,`${i.id}.json`)),f={};await i.export((r,d)=>{f[r]=d});const l=`],"index":${JSON.stringify(f)}}`;await E(a,l,{encoding:"utf8"})}}this.#e.clear()}async import(t){const o=`${t}/${_}`,e=await y(o);for(const n of e){const c=await y(`${o}/${n}`);for(const i of c){const a=`${o}/${n}/${i}`,f=JSON.parse(await R(a,"utf-8")),l=m.parse(i).name;await this.#n(n,l).import(f)}}}countFacets(t,o){const e={};for(const[n,c]of o)e[n]=c.values.map(i=>({value:i,count:0,isCounterVisible:!1}));return e}cleanupFacetValues(t){}}export{J as FlexSearch};
|