@redocly/framework 1.0.0-next.1 → 1.0.0-next.11
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/dist/bundler/build/output-metadata.js +1 -1
- package/dist/bundler/build/run.js +1 -1
- package/dist/bundler/build/theme-global-style-compiler.js +1 -0
- package/dist/bundler/build/theme-global-stylesheets.js +1 -0
- package/dist/bundler/build/vite-config.js +2 -2
- package/dist/bundler/dev/dev-content-build.js +1 -0
- package/dist/bundler/dev/dev-problems.js +1 -1
- package/dist/bundler/dev/dev-reporter.js +1 -1
- package/dist/bundler/dev/routes/dev-content-build-route.js +1 -0
- package/dist/bundler/dev/routes/dev-problems-route.js +1 -1
- package/dist/bundler/dev/run.js +1 -1
- package/dist/bundler/dev/runtime-app.js +1 -1
- package/dist/bundler/dev/vite-config.js +1 -1
- package/dist/bundler/node-bundle.js +1 -0
- package/dist/bundler/runtime-files.js +1 -1
- package/dist/bundler/user-markdoc-schema.js +1 -1
- package/dist/bundler/vite-config.base.js +12 -12
- package/dist/cli/api-docs-build-event.js +1 -0
- package/dist/cli/commands/build.js +1 -1
- package/dist/cli/commands/ingest.js +1 -1
- package/dist/cli/commands/translate.js +1 -1
- package/dist/cli/dev-console/{sweep.js → content-build.js} +1 -1
- package/dist/cli/dev-console/index.js +1 -1
- package/dist/cli/dev-console/lines.js +2 -2
- package/dist/cli/dev-console/plain.js +1 -1
- package/dist/cli/dev-console/tui.js +2 -2
- package/dist/cli/output.js +12 -12
- package/dist/cli/validate-react-pages.js +1 -1
- package/dist/client/ApiAccess.js +3 -0
- package/dist/client/NavigationProgress.js +1 -1
- package/dist/client/ProductsProvider.js +1 -1
- package/dist/client/RouteErrorBoundary.js +1 -1
- package/dist/client/RuntimeLink.js +1 -0
- package/dist/client/ThemeGlobalStyle.js +1 -0
- package/dist/client/UnversionedVersionButton.js +1 -1
- package/dist/client/app.js +2 -7
- package/dist/client/client-entry.js +1 -1
- package/dist/client/dev-problems/ProblemsBar.js +75 -15
- package/dist/client/dev-problems/ProblemsModal.js +15 -15
- package/dist/client/dev-problems/build-segment.js +1 -0
- package/dist/client/dev-problems/index.js +1 -1
- package/dist/client/dev-problems/use-dev-problems.js +1 -1
- package/dist/client/experiments/runtime.js +1 -1
- package/dist/client/history-mount.js +1 -0
- package/dist/client/l10n/use-l10n-config.js +1 -1
- package/dist/client/l10n/use-l10n-href.js +1 -1
- package/dist/client/l10n/use-translate.js +1 -1
- package/dist/client/products.js +1 -1
- package/dist/client/review/ReviewBar.js +163 -69
- package/dist/client/review/login-url.js +1 -0
- package/dist/client/revisions-history.js +1 -1
- package/dist/client/sidebar/PoweredByRedocly.js +2 -2
- package/dist/client/ssr.js +1 -1
- package/dist/client/telemetry/report-preload-failure.js +1 -0
- package/dist/client/templates/dev-login.js +4 -4
- package/dist/client/templates/unauthorized.js +5 -5
- package/dist/client/theme-global-css.js +1 -0
- package/dist/client/use-banner.js +1 -1
- package/dist/client/use-bar-position.js +1 -0
- package/dist/client/use-page-versions.js +1 -1
- package/dist/client/use-router-for-local-links.js +1 -1
- package/dist/client/use-search.js +1 -1
- package/dist/client/utils/routes/is-router-path.js +1 -0
- package/dist/client/webmcp/tools/shared.js +1 -1
- package/dist/content-layer/allowed-packages.js +1 -1
- package/dist/content-layer/api-outputs.js +1 -1
- package/dist/content-layer/config-schema.d.ts +12 -3
- package/dist/content-layer/config-schema.js +1 -1
- package/dist/content-layer/config.d.ts +30 -12
- package/dist/content-layer/config.js +1 -1
- package/dist/content-layer/context.d.ts +2 -0
- package/dist/content-layer/context.js +1 -1
- package/dist/content-layer/database/adapters/node-sqlite-client.js +1 -1
- package/dist/content-layer/database/assets.js +1 -1
- package/dist/content-layer/database/blobs.js +1 -1
- package/dist/content-layer/database/connection.js +1 -1
- package/dist/content-layer/database/entity-store.d.ts +24 -3
- package/dist/content-layer/database/entity-store.js +1 -1
- package/dist/content-layer/database/files.js +1 -1
- package/dist/content-layer/database/finalize.js +1 -1
- package/dist/content-layer/database/invalidation.d.ts +6 -0
- package/dist/content-layer/database/invalidation.js +26 -26
- package/dist/content-layer/database/link-refs.js +1 -1
- package/dist/content-layer/database/origins.d.ts +2 -4
- package/dist/content-layer/database/origins.js +1 -1
- package/dist/content-layer/database/problems.d.ts +2 -0
- package/dist/content-layer/database/problems.js +1 -1
- package/dist/content-layer/database/reset.js +1 -1
- package/dist/content-layer/database/route-query-deps.js +1 -1
- package/dist/content-layer/database/schema.d.ts +50 -0
- package/dist/content-layer/database/schema.js +1 -1
- package/dist/content-layer/database/search-vocab.js +2 -2
- package/dist/content-layer/database/site-config.d.ts +23 -0
- package/dist/content-layer/database/site-config.js +1 -1
- package/dist/content-layer/database/static-files.js +1 -1
- package/dist/content-layer/ingest/extract-all-phase.js +1 -1
- package/dist/content-layer/ingest/finalize-phase.js +1 -1
- package/dist/content-layer/ingest/git-last-modified.js +3 -3
- package/dist/content-layer/ingest/hash.js +1 -1
- package/dist/content-layer/ingest/hook-inputs.js +1 -1
- package/dist/content-layer/ingest/l10n-warnings.js +1 -1
- package/dist/content-layer/ingest/markdoc-schema-problem.js +1 -0
- package/dist/content-layer/ingest/rbac-teams.js +1 -1
- package/dist/content-layer/ingest/run.js +1 -1
- package/dist/content-layer/ingest/scan.d.ts +1 -1
- package/dist/content-layer/ingest/scan.js +1 -1
- package/dist/content-layer/ingest/search-sync.js +1 -1
- package/dist/content-layer/ingest/slugger/resolve-final-slugs.js +1 -1
- package/dist/content-layer/ingest/sync.js +1 -1
- package/dist/content-layer/link-checker/delta.js +1 -1
- package/dist/content-layer/link-checker/fingerprint.js +1 -1
- package/dist/content-layer/link-checker/load-view.js +1 -1
- package/dist/content-layer/link-checker/run-build.js +1 -1
- package/dist/content-layer/link-checker/validate.js +1 -1
- package/dist/content-layer/link-checker/view.js +1 -1
- package/dist/content-layer/loaders/context.js +1 -1
- package/dist/content-layer/loaders/define.d.ts +3 -0
- package/dist/content-layer/markdown/client/JsonSchemaTag.js +1 -1
- package/dist/content-layer/markdown/client/OpenapiTagComponents.js +2 -2
- package/dist/content-layer/markdown/client/code-highlight-notation.js +3 -3
- package/dist/content-layer/markdown/client/dynamic-components.js +1 -1
- package/dist/content-layer/markdown/client/markdoc-components.js +2 -2
- package/dist/content-layer/markdown/constants/builtin-tags.js +1 -1
- package/dist/content-layer/markdown/constants/markdown-text-tag-set.js +1 -1
- package/dist/content-layer/markdown/constants/tag-sets.d.ts +20 -5
- package/dist/content-layer/markdown/constants/tag-sets.js +1 -1
- package/dist/content-layer/markdown/nodes/fence.js +1 -1
- package/dist/content-layer/markdown/nodes/heading.js +1 -1
- package/dist/content-layer/markdown/nodes/table.js +1 -1
- package/dist/content-layer/markdown/resolve/ast.js +1 -1
- package/dist/content-layer/markdown/resolve/attribute-resolver-key.d.ts +8 -1
- package/dist/content-layer/markdown/resolve/attribute-resolver-key.js +1 -1
- package/dist/content-layer/markdown/resolve/audience-tag.d.ts +2 -6
- package/dist/content-layer/markdown/resolve/audience-tag.js +1 -1
- package/dist/content-layer/markdown/resolve/markdoc-resolvers/code-snippet.js +5 -4
- package/dist/content-layer/markdown/resolve/markdoc-resolvers/code-walkthrough/filesets.js +1 -1
- package/dist/content-layer/markdown/resolve/markdoc-resolvers/diagram-file.js +1 -1
- package/dist/content-layer/markdown/resolve/markdoc-resolvers/file-reference.js +1 -1
- package/dist/content-layer/markdown/resolve/markdoc-resolvers/json-schema.d.ts +2 -1
- package/dist/content-layer/markdown/resolve/markdoc-resolvers/json-schema.js +1 -1
- package/dist/content-layer/markdown/resolve/markdoc-resolvers/operation-samples.d.ts +1 -1
- package/dist/content-layer/markdown/resolve/markdoc-resolvers/operation-samples.js +1 -1
- package/dist/content-layer/markdown/resolve/markdoc-resolvers/partial.js +1 -1
- package/dist/content-layer/markdown/resolve/markdoc-resolvers/svg-content.js +1 -1
- package/dist/content-layer/markdown/resolve/markdoc.d.ts +2 -1
- package/dist/content-layer/markdown/resolve/markdoc.js +1 -1
- package/dist/content-layer/markdown/resolve/raw-partials.d.ts +2 -1
- package/dist/content-layer/markdown/resolve/raw-partials.js +1 -1
- package/dist/content-layer/markdown/resolve/references.d.ts +3 -1
- package/dist/content-layer/markdown/resolve/references.js +1 -1
- package/dist/content-layer/markdown/resolve/render-diagrams.d.ts +8 -1
- package/dist/content-layer/markdown/resolve/render-diagrams.js +1 -1
- package/dist/content-layer/markdown/search/to-markdown.js +2 -2
- package/dist/content-layer/markdown/search/to-sections.d.ts +8 -3
- package/dist/content-layer/markdown/search/to-sections.js +1 -1
- package/dist/content-layer/markdown/search/to-text.d.ts +4 -1
- package/dist/content-layer/markdown/search/to-text.js +5 -5
- package/dist/content-layer/markdown/server/render.d.ts +4 -2
- package/dist/content-layer/markdown/server/render.js +1 -1
- package/dist/content-layer/markdown/service.js +1 -1
- package/dist/content-layer/markdown/tags/html.d.ts +5 -2
- package/dist/content-layer/markdown/tags/html.js +1 -1
- package/dist/content-layer/markdown/tags/markdoc-error.d.ts +8 -0
- package/dist/content-layer/markdown/tags/markdoc-error.js +1 -1
- package/dist/content-layer/markdown/tags/openapi.d.ts +1 -1
- package/dist/content-layer/markdown/tags/openapi.js +1 -1
- package/dist/content-layer/markdown/tags/partial.d.ts +9 -3
- package/dist/content-layer/markdown/tags/partial.js +1 -1
- package/dist/content-layer/markdown/tags/variant.d.ts +6 -0
- package/dist/content-layer/markdown/tags/variant.js +1 -0
- package/dist/content-layer/markdown/types/service.d.ts +6 -0
- package/dist/content-layer/markdown/utils/collect-anchors.js +1 -1
- package/dist/content-layer/markdown/utils/collect-headings.d.ts +3 -1
- package/dist/content-layer/markdown/utils/collect-headings.js +1 -1
- package/dist/content-layer/markdown/utils/first-heading.js +1 -1
- package/dist/content-layer/markdown/utils/heading-slugger.d.ts +8 -0
- package/dist/content-layer/markdown/utils/heading-slugger.js +1 -1
- package/dist/content-layer/markdown/utils/node-source-range.d.ts +3 -3
- package/dist/content-layer/markdown/utils/node-source-range.js +1 -1
- package/dist/content-layer/markdown/utils/parse-cache.js +1 -1
- package/dist/content-layer/markdown/utils/reparse-example-fences.d.ts +4 -1
- package/dist/content-layer/markdown/utils/reparse-example-fences.js +1 -1
- package/dist/content-layer/markdown/utils/substitute-variables.js +1 -1
- package/dist/content-layer/markdown/utils/walk-markdoc-ast.d.ts +2 -2
- package/dist/content-layer/markdown/utils/walk-markdoc-ast.js +1 -1
- package/dist/content-layer/materialization/asset-reconcile.js +1 -1
- package/dist/content-layer/materialization/entity.js +1 -1
- package/dist/content-layer/materialization/materializer.js +1 -0
- package/dist/content-layer/materialization/static-files.js +1 -1
- package/dist/content-layer/plan-gates.d.ts +3 -2
- package/dist/content-layer/plan-gates.js +1 -1
- package/dist/content-layer/plugins/execute.js +1 -1
- package/dist/content-layer/plugins/index.js +1 -1
- package/dist/content-layer/plugins/internal/api-docs/client/event-handlers.js +1 -1
- package/dist/content-layer/plugins/internal/api-docs/client/rebase-item-links.js +1 -1
- package/dist/content-layer/plugins/internal/api-docs/client/template.js +12 -4
- package/dist/content-layer/plugins/internal/api-docs/index.js +1 -1
- package/dist/content-layer/plugins/internal/api-docs/server/build-definition.d.ts +28 -13
- package/dist/content-layer/plugins/internal/api-docs/server/build-definition.js +1 -1
- package/dist/content-layer/plugins/internal/api-docs/server/build-sidebar.js +1 -1
- package/dist/content-layer/plugins/internal/api-docs/server/declares-proto-service.d.ts +2 -0
- package/dist/content-layer/plugins/internal/api-docs/server/declares-proto-service.js +3 -0
- package/dist/content-layer/plugins/internal/api-docs/server/markdown-copy.d.ts +14 -0
- package/dist/content-layer/plugins/internal/api-docs/server/markdown-copy.js +23 -0
- package/dist/content-layer/plugins/internal/api-docs/server/markdown-decorator.d.ts +1 -4
- package/dist/content-layer/plugins/internal/api-docs/server/markdown-decorator.js +1 -1
- package/dist/content-layer/plugins/internal/api-docs/server/options.d.ts +4 -2
- package/dist/content-layer/plugins/internal/api-docs/server/options.js +1 -1
- package/dist/content-layer/plugins/internal/api-docs/server/search-documents.d.ts +1 -1
- package/dist/content-layer/plugins/internal/api-docs/server/search-documents.js +1 -1
- package/dist/content-layer/plugins/internal/api-docs/server/spec-download.js +1 -1
- package/dist/content-layer/plugins/internal/api-functions/index.js +1 -1
- package/dist/content-layer/plugins/internal/api-functions/server/access.js +1 -1
- package/dist/content-layer/plugins/internal/api-functions/server/api-function-telemetry.js +1 -0
- package/dist/content-layer/plugins/internal/api-functions/server/dispatch.js +1 -1
- package/dist/content-layer/plugins/internal/app-data/banner.js +1 -1
- package/dist/content-layer/plugins/internal/app-data/index.d.ts +1 -1
- package/dist/content-layer/plugins/internal/app-data/index.js +1 -1
- package/dist/content-layer/plugins/internal/app-data/products.d.ts +2 -0
- package/dist/content-layer/plugins/internal/app-data/products.js +1 -1
- package/dist/content-layer/plugins/internal/catalog-classic/client/catalog-filtering.js +1 -1
- package/dist/content-layer/plugins/internal/catalog-classic/index.js +1 -1
- package/dist/content-layer/plugins/internal/catalog-classic/resolve-items.d.ts +1 -1
- package/dist/content-layer/plugins/internal/catalog-classic/resolve-items.js +1 -1
- package/dist/content-layer/plugins/internal/catalog-classic/sidebars.d.ts +1 -1
- package/dist/content-layer/plugins/internal/index.js +1 -1
- package/dist/content-layer/plugins/internal/l10n/index.js +1 -1
- package/dist/content-layer/plugins/internal/l10n/translations-loader.js +1 -1
- package/dist/content-layer/plugins/internal/markdoc/client/template.js +1 -1
- package/dist/content-layer/plugins/internal/markdoc/index.js +1 -1
- package/dist/content-layer/plugins/internal/markdoc/server/shared.d.ts +1 -1
- package/dist/content-layer/plugins/internal/mcp/constants.d.ts +20 -0
- package/dist/content-layer/plugins/internal/mcp/constants.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/content-tools.d.ts +4 -1
- package/dist/content-layer/plugins/internal/mcp/content-tools.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/index.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/agent-card.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/audit.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/auth.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/code-credentials.js +2 -2
- package/dist/content-layer/plugins/internal/mcp/server/codemode/capabilities.js +6 -6
- package/dist/content-layer/plugins/internal/mcp/server/codemode/constants.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/codemode/discover.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/codemode/execute-schema.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/codemode/index.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/codemode/prompts.js +8 -8
- package/dist/content-layer/plugins/internal/mcp/server/config-gate.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/custom-tools.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/gateway/allowed-http-methods.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/gateway/api-call-operations.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/gateway/call-api.js +2 -0
- package/dist/content-layer/plugins/internal/mcp/server/gateway/credentials-page/form-page.js +10 -10
- package/dist/content-layer/plugins/internal/mcp/server/gateway/credentials-page/outcome-pages.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/gateway/credentials.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/gateway/elicitation.js +7 -6
- package/dist/content-layer/plugins/internal/mcp/server/gateway/fetch/allowed-hosts.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/gateway/fetch/fetch-bridge.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/gateway/fetch/fetch-errors.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/gateway/fetch/ssrf-guard.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/gateway/fetch/upstream-detail.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/gateway/index.js +3 -3
- package/dist/content-layer/plugins/internal/mcp/server/gateway/secret-store.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/gateway/tool-list.js +1 -0
- package/dist/content-layer/plugins/internal/mcp/server/gateway/tools.js +4 -4
- package/dist/content-layer/plugins/internal/mcp/server/gateway/upstream-auth-scheme.js +2 -2
- package/dist/content-layer/plugins/internal/mcp/server/handler.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/mcp-server.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/mcp-telemetry.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/oauth/authorize.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/oauth/discovery.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/rate-limit.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/server-card.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/skills-resources.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/tools/graphql-catalog.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/tools/openapi-catalog.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/tools/openapi-document.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/tools/openapi-refs.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/tools/openapi.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/tools/pages-navigation.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/tools/pages.js +2 -2
- package/dist/content-layer/plugins/internal/mcp/server/tools/schemas.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/workflows/catalog.js +1 -0
- package/dist/content-layer/plugins/internal/mcp/server/workflows/document-resolver.js +1 -0
- package/dist/content-layer/plugins/internal/mcp/server/workflows/operations-subset.js +1 -0
- package/dist/content-layer/plugins/internal/mcp/server/workflows/resolve-workflows.js +1 -0
- package/dist/content-layer/plugins/internal/mcp/server/workflows/run-workflow.js +1 -0
- package/dist/content-layer/plugins/internal/mcp/server/workflows/schemas.js +1 -0
- package/dist/content-layer/plugins/internal/mcp/server/workflows/tools.js +1 -0
- package/dist/content-layer/plugins/internal/mcp/server/workflows/types.js +1 -0
- package/dist/content-layer/plugins/internal/mcp/server/workflows/workflow-references.js +1 -0
- package/dist/content-layer/plugins/internal/mock/server/handler.js +1 -1
- package/dist/content-layer/plugins/internal/react-page/index.d.ts +3 -2
- package/dist/content-layer/plugins/internal/react-page/index.js +1 -1
- package/dist/content-layer/plugins/internal/scorecard-classic/client/Grid.js +11 -11
- package/dist/content-layer/plugins/internal/scorecard-classic/client/ScorecardViews.js +1 -1
- package/dist/content-layer/plugins/internal/scorecard-classic/client/ScorecardWidgets.js +7 -7
- package/dist/content-layer/plugins/internal/scorecard-classic/client/template.js +2 -2
- package/dist/content-layer/plugins/internal/sidebar/bundle.d.ts +18 -17
- package/dist/content-layer/plugins/internal/sidebar/bundle.js +1 -1
- package/dist/content-layer/plugins/internal/sidebar/index.d.ts +5 -3
- package/dist/content-layer/plugins/internal/sidebar/index.js +2 -2
- package/dist/content-layer/plugins/internal/sidebar/subtree.js +1 -1
- package/dist/content-layer/plugins/internal/skills/index.js +1 -1
- package/dist/content-layer/plugins/internal/skills/server/routes.js +1 -1
- package/dist/content-layer/plugins/internal/versions/index.js +1 -1
- package/dist/content-layer/plugins/project/load.js +2 -2
- package/dist/content-layer/plugins/registry.js +1 -1
- package/dist/content-layer/plugins/request-context.d.ts +5 -0
- package/dist/content-layer/plugins/types/api-entity.d.ts +2 -6
- package/dist/content-layer/plugins/types/api-entity.js +1 -1
- package/dist/content-layer/plugins/types/markdoc.d.ts +2 -0
- package/dist/content-layer/plugins/types/plugin.d.ts +13 -0
- package/dist/content-layer/plugins/types/search.d.ts +14 -3
- package/dist/content-layer/plugins/utils/link-access.d.ts +2 -0
- package/dist/content-layer/plugins/utils/link-access.js +1 -1
- package/dist/content-layer/plugins/utils/route-index.d.ts +1 -1
- package/dist/content-layer/plugins/utils/route-index.js +1 -1
- package/dist/content-layer/plugins/utils/sidebar-label.d.ts +4 -1
- package/dist/content-layer/plugins/utils/sidebar-label.js +1 -1
- package/dist/content-layer/plugins/utils/version-path.js +1 -1
- package/dist/content-layer/plugins/work-time.js +1 -0
- package/dist/content-layer/problems/codes.d.ts +10 -0
- package/dist/content-layer/problems/codes.js +1 -1
- package/dist/content-layer/revisions/config.js +1 -1
- package/dist/content-layer/revisions/delete.js +1 -1
- package/dist/content-layer/search/engine/core/content-parser.js +1 -1
- package/dist/content-layer/search/engine/core/search-engine.js +1 -1
- package/dist/content-layer/search/facet-rows.js +1 -1
- package/dist/content-layer/search/keywords.d.ts +18 -0
- package/dist/content-layer/search/keywords.js +1 -0
- package/dist/content-layer/search/postings/fragment-field.d.ts +2 -0
- package/dist/content-layer/search/postings/fragment-field.js +1 -1
- package/dist/content-layer/search/postings/postings-store.d.ts +14 -0
- package/dist/content-layer/search/postings/postings-store.js +1 -1
- package/dist/content-layer/search/store.d.ts +14 -1
- package/dist/content-layer/server/context.js +1 -1
- package/dist/content-layer/server/database.js +1 -1
- package/dist/content-layer/server/materialize.js +1 -1
- package/dist/content-layer/static/audience.js +1 -1
- package/dist/content-layer/static/registry.js +1 -1
- package/dist/content-layer/templates/template-set.js +1 -1
- package/dist/content-layer/versions/group-info.d.ts +21 -0
- package/dist/content-layer/versions/group-info.js +1 -0
- package/dist/content-layer/versions/redirect.d.ts +24 -17
- package/dist/content-layer/versions/redirect.js +1 -1
- package/dist/content-layer/versions/resolve.d.ts +1 -21
- package/dist/content-layer/versions/resolve.js +1 -1
- package/dist/content-layer/versions/version-groups.d.ts +5 -1
- package/dist/content-layer/versions/version-groups.js +1 -1
- package/dist/plugin-api.d.ts +3 -0
- package/dist/plugin-api.js +1 -1
- package/dist/server/analytics-tags.js +1 -1
- package/dist/server/app.js +3 -3
- package/dist/server/ask-ai/feature-gate.js +1 -1
- package/dist/server/ask-ai/route.js +1 -1
- package/dist/server/auth/access-config.js +1 -1
- package/dist/server/auth/gate.js +1 -1
- package/dist/server/auth/middleware.js +1 -1
- package/dist/server/auth/oidc.js +1 -1
- package/dist/server/auth/request.js +1 -1
- package/dist/server/auth/routes.js +1 -1
- package/dist/server/auth/runtime.js +1 -1
- package/dist/server/content-assets/access.js +1 -1
- package/dist/server/content.js +14 -13
- package/dist/server/feedback/route.js +1 -1
- package/dist/server/html-tags.js +2 -1
- package/dist/server/lambda-entry.js +1 -1
- package/dist/server/llms-txt.js +1 -1
- package/dist/server/manifest-assets.js +2 -2
- package/dist/server/metrics/request-metrics.js +1 -1
- package/dist/server/node-entry.js +1 -1
- package/dist/server/page-handlers.js +1 -1
- package/dist/server/plugin-context.js +1 -1
- package/dist/server/plugin-routes.js +1 -1
- package/dist/server/public-url.js +1 -0
- package/dist/server/rbac/content-asset-access.js +1 -1
- package/dist/server/redirects.js +1 -1
- package/dist/server/replay-oauth2/route.js +1 -1
- package/dist/server/review/route.js +1 -1
- package/dist/server/runtime-config.js +1 -1
- package/dist/server/search/cache.js +1 -0
- package/dist/server/search/route.js +1 -1
- package/dist/server/search/search-telemetry.js +1 -0
- package/dist/server/seo-tags.js +2 -2
- package/dist/server/ssrf/ssrf-blocklist.js +1 -1
- package/dist/server/static-files/serve.js +1 -1
- package/dist/server/subprocess/runner.js +1 -1
- package/dist/server/telemetry/mock-server-events.js +1 -0
- package/dist/server/telemetry/redirect-event.js +1 -0
- package/dist/server/telemetry/route.js +1 -1
- package/dist/server/telemetry/sender.js +1 -1
- package/dist/server/telemetry/server-events.js +1 -1
- package/dist/server/template-ids.js +1 -1
- package/dist/shared/constants/api-spec-kinds.d.ts +7 -0
- package/dist/shared/constants/api-spec-kinds.js +1 -0
- package/dist/shared/constants/content-update.js +1 -1
- package/dist/shared/constants/dependency-pack.js +1 -1
- package/dist/shared/constants/dev-content-build.js +1 -0
- package/dist/shared/constants/dev-problems.js +1 -1
- package/dist/shared/constants/dev-source-sync.js +1 -1
- package/dist/shared/constants/l10n/langs/ar.js +1 -1
- package/dist/shared/constants/l10n/langs/de.js +1 -1
- package/dist/shared/constants/l10n/langs/en.js +1 -1
- package/dist/shared/constants/l10n/langs/es.js +1 -1
- package/dist/shared/constants/l10n/langs/fr.js +1 -1
- package/dist/shared/constants/l10n/langs/hi.js +1 -1
- package/dist/shared/constants/l10n/langs/it.js +1 -1
- package/dist/shared/constants/l10n/langs/ja.js +1 -1
- package/dist/shared/constants/l10n/langs/ko.js +1 -1
- package/dist/shared/constants/l10n/langs/pl.js +1 -1
- package/dist/shared/constants/l10n/langs/pt-br.js +1 -1
- package/dist/shared/constants/l10n/langs/pt.js +1 -1
- package/dist/shared/constants/l10n/langs/ru.js +1 -1
- package/dist/shared/constants/l10n/langs/uk.js +1 -1
- package/dist/shared/constants/l10n/langs/zh.js +1 -1
- package/dist/shared/constants/manifest-version.d.ts +3 -1
- package/dist/shared/constants/openapi-operation-methods.d.ts +2 -0
- package/dist/shared/constants/openapi-operation-methods.js +1 -0
- package/dist/shared/constants/review.d.ts +5 -0
- package/dist/shared/constants/review.js +1 -1
- package/dist/{server → shared}/constants/system-routes.d.ts +1 -1
- package/dist/shared/constants/system-routes.js +1 -0
- package/dist/shared/constants/versions.d.ts +2 -0
- package/dist/shared/constants/versions.js +1 -1
- package/dist/shared/experiments.js +1 -1
- package/dist/shared/load-dot-env.js +1 -1
- package/dist/shared/plan-gates.d.ts +9 -3
- package/dist/shared/plan-gates.js +1 -1
- package/dist/shared/products.js +1 -1
- package/dist/shared/project-env.d.ts +12 -0
- package/dist/shared/project-env.js +1 -0
- package/dist/shared/public-env.d.ts +9 -0
- package/dist/shared/public-env.js +1 -1
- package/dist/{server → shared}/rbac/api-docs.d.ts +3 -2
- package/dist/shared/rbac/api-docs.js +1 -0
- package/dist/{server → shared}/rbac/engine.d.ts +13 -10
- package/dist/shared/rbac/engine.js +0 -0
- package/dist/{server → shared}/rbac/filter.d.ts +2 -0
- package/dist/shared/rbac/filter.js +1 -0
- package/dist/{server → shared}/rbac/l10n-rules.d.ts +1 -1
- package/dist/shared/rbac/l10n-rules.js +1 -0
- package/dist/{server → shared}/rbac/route-scope.d.ts +1 -1
- package/dist/shared/rbac/route-scope.js +1 -0
- package/dist/{server → shared}/rbac/team-templates.d.ts +6 -2
- package/dist/shared/rbac/team-templates.js +1 -0
- package/dist/{server → shared}/rbac/teams.d.ts +1 -1
- package/dist/shared/rbac/types.js +1 -0
- package/dist/shared/search/facets.d.ts +5 -0
- package/dist/shared/search/facets.js +1 -1
- package/dist/shared/types/auth.d.ts +1 -0
- package/dist/shared/types/config.d.ts +5 -0
- package/dist/shared/types/search.d.ts +8 -2
- package/dist/shared/types/sidebar.d.ts +1 -0
- package/dist/shared/utils/l10n.js +1 -1
- package/dist/shared/utils/redirect-match.js +1 -0
- package/dist/shared/utils/routes/markdown-copy-url.js +1 -0
- package/drizzle/20261103061150_site_config_effective_hash/migration.sql +1 -0
- package/drizzle/20261105151816_search_http_path_tokens/migration.sql +1 -0
- package/drizzle/20261111152552_page_markdown_rbac_scope/migration.sql +1 -0
- package/package.json +37 -13
- package/dist/bundler/dev/__tests__/reset-content-update-state.js +0 -1
- package/dist/bundler/dev/materialization-sweeper.js +0 -1
- package/dist/client/dev-problems/sweep-segment.js +0 -1
- package/dist/client/review/use-bar-position.js +0 -1
- package/dist/content-layer/plugins/internal/api-docs/server/markdown-docs.d.ts +0 -5
- package/dist/content-layer/plugins/internal/api-docs/server/markdown-docs.js +0 -26
- package/dist/content-layer/plugins/internal/mcp/server/gateway/__tests__/fake-kv.js +0 -1
- package/dist/content-layer/server/config.js +0 -1
- package/dist/server/__tests__/rbac-fixture.js +0 -1
- package/dist/server/__tests__/test-session.js +0 -1
- package/dist/server/constants/system-routes.js +0 -1
- package/dist/server/rbac/api-docs.js +0 -1
- package/dist/server/rbac/engine.js +0 -0
- package/dist/server/rbac/filter.js +0 -1
- package/dist/server/rbac/l10n-rules.js +0 -1
- package/dist/server/rbac/route-scope.js +0 -1
- package/dist/server/rbac/team-templates.js +0 -1
- package/dist/server/rbac/types.js +0 -1
- package/dist/shared/utils/routes/markdown-path.js +0 -1
- /package/dist/{server → shared}/rbac/entity-scope.js +0 -0
- /package/dist/{server → shared}/rbac/teams.js +0 -0
- /package/dist/{server → shared}/rbac/types.d.ts +0 -0
- /package/dist/{content-layer/markdown → shared}/utils/packed-ast.d.ts +0 -0
- /package/dist/{content-layer/markdown → shared}/utils/packed-ast.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{compareStrings as e}from"../../shared/utils/compare-strings.js";import{
|
|
1
|
+
import{compareStrings as e}from"../../shared/utils/compare-strings.js";import{getStaticFilesOutputDir as t,getStaticManifestPath as n}from"../../shared/constants/runtime-layout.js";import{isObject as r}from"../../shared/utils/is-object.js";import{isDataRefMarker as i}from"./data-ref.js";import{MaterializationError as a}from"../problems/problem-error.js";import{resolveDataRef as o}from"../database/blobs.js";import{loadEntityRecordByKey as s}from"../database/entities.js";import{updateStaticFileBodies as c}from"../database/static-files.js";import{producerContentType as l,toStaticBodyBytes as u}from"../static/producer-value.js";import{writeFileAtomically as d}from"./asset-reconcile.js";import{join as f}from"node:path";function p(e){return new Set(e.flatMap(e=>e.kind===`producer`&&e.entityKey?[e.entityKey]:[]))}async function m(e){let t=/* @__PURE__ */ new Set;for(let n of e.staleProducers)try{await e.materializeEntity(n)}catch(r){if(!(r instanceof a))throw r;t.add(n.key),e.logger.debug(`Could not materialize the static producer ${n.key}; recorded the problem and moved on`)}let n=[];for(let r of e.rows){let i=e.resolveAudience(r);if(r.kind===`copy`){n.push(h(e.io,e.contentDir,r,i));continue}let a=await g(e.io,e.database,r,i,r.entityKey!==null&&t.has(r.entityKey));a&&n.push(a)}let r=await _(e.io,{contentDir:e.contentDir,entries:n}),i=new Map(e.rows.map(e=>[e.path,e]));return await c(e.database,r.manifest.files.filter(e=>{let t=i.get(e.path);return t?.hash!==e.hash||t.size!==e.size}).map(e=>({path:e.path,hash:e.hash,size:e.size}))),e.logger.info(`Static files: ${r.manifest.files.length} registered, ${r.written.length} written, ${r.removed.length} removed`),r.manifest}function h(e,t,n,r){if(!n.sourcePath||!n.hash)throw Error(`Static file "${n.path}" has no copy source.`);let i=f(t,n.sourcePath);return{path:n.path,hash:n.hash,contentType:n.contentType,audience:r,write:t=>e.copyFile(i,t)}}async function g(e,t,n,a,c){let d=n.entityKey?await s(t,n.entityKey):null;if(!d||d.status!==`ready`&&!c)throw Error(`Static file "${n.path}": producer entity "${n.entityKey}" is not ready.`);let f=d.data;if(!r(f)||!i(f.body)){if(c)return null;throw Error(`Static file "${n.path}": producer "${n.entityKey}" must return { body: BlobReference }.`)}let p=f.body;return{path:n.path,hash:p.blobKey,contentType:l(f,n),audience:a,write:async n=>e.writeFile(n,u(await o(t,p)))}}async function _(r,i){let a=t(i.contentDir),o=n(i.contentDir),s=new Map((await v(r,o))?.files.map(e=>[e.path,e])??[]),c=new Set(await y(r,a)),l=[],u=[];for(let e=0;e<i.entries.length;e+=16)await Promise.all(i.entries.slice(e,e+16).map(async e=>{let t=f(a,...e.path.split(`/`)),n=s.get(e.path),i=n?.hash===e.hash&&c.has(e.path)?n.size:null;i===null&&(await d(r,t,e.write),i=(await r.stat(t))?.size??0,l.push(e.path)),u.push({path:e.path,hash:e.hash,contentType:e.contentType,size:i,audience:e.audience})}));let p=new Set(i.entries.map(e=>e.path)),m=[...c].filter(e=>!p.has(e));await Promise.all(m.map(e=>r.unlink(f(a,...e.split(`/`))))),u.sort((t,n)=>e(t.path,n.path));let h={formatVersion:1,files:u};return await r.writeFile(o,JSON.stringify(h,null,2),{recursive:!0}),{manifest:h,written:l,removed:m}}async function v(e,t){try{let n=JSON.parse(await e.readFile(t));return Array.isArray(n.files)?n:null}catch{return null}}async function y(e,t,n=``){let r=[],i;try{i=await e.readdir(t)}catch{return r}for(let a of i){let i=`${n}${a.name}`;a.type===`directory`?r.push(...await y(e,f(t,a.name),`${i}/`)):a.type===`file`&&r.push(i)}return r}export{p as collectStaticProducerKeys,m as materializeStaticProducers,_ as reconcileStaticFiles};
|
|
@@ -3,8 +3,9 @@ import type { RealmConfig } from '../shared/types/config.js';
|
|
|
3
3
|
import type { ProblemDraft } from './problems/types.js';
|
|
4
4
|
/**
|
|
5
5
|
* The config with the features that the plan in `PLAN_GATES` lacks turned off, as classic Realm
|
|
6
|
-
* does,
|
|
7
|
-
*
|
|
6
|
+
* does, the decisions under `planGates` for `isPlanFeatureGranted`, and the token's claims under
|
|
7
|
+
* `planClaims` for `isPlanClaimGranted`. A plan claim the token does not have denies its
|
|
8
|
+
* feature; a product gate claim it does not have is granted.
|
|
8
9
|
* Without a token the config is returned unchanged. Reports each configured feature it turns
|
|
9
10
|
* off to `warn`.
|
|
10
11
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isAdvancedSearchEnabled as e}from"../shared/search/facets.js";import{isObject as t}from"../shared/utils/is-object.js";import{isAiHidden as n}from"../shared/ask-ai/config-gate.js";const r=[[`products`,`products`],[`catalogClassic`,`catalog`],[`catalogClassic`,`catalogClassic`],[`l10n`,`l10n`],[`apiFunctions`,`apiFunctions`],[`redirects`,`redirects`],[`banner`,`banner`]];function i(i,a,u){if(!a.PLAN_GATES)return i;let d=o(a.PLAN_GATES);d||u(`PLAN_GATES is not a token, so the features of the plan are off.`);let f=e=>!!d?.[e],p=e=>d?.[e]!==!1,m=d!==void 0&&!(`cookieConsent`in d),h={rbac:f(`rbac`),sso:f(`sso`),analytics:f(`analytics`),advancedSearch:f(`advancedSearch`),aiSearch:f(`aiSearchLimit`),mcp:f(`mcp`),mcpGateway:f(`mcpGateway`),cookieConsent:m||f(`cookieConsent`),removeAttribution:!d?.pricingTier||f(`removeAttribution`),products:p(`products`),catalogClassic:p(`catalogClassic`),l10n:p(`l10n`),apiFunctions:p(`apiFunctions`),mockServer:p(`mockServer`),seo:p(`seo`),redirects:p(`redirects`),breadcrumbs:p(`breadcrumbs`),banner:p(`banner`),codeWalkthrough:p(`codeWalkthrough`),customPlugins:p(`customPlugins`),markdown:p(`markdown`),openapi:p(`openapi`),asyncapi:p(`asyncapi`),graphql:p(`graphql`),reactPages:p(`reactPages`),soap:p(`soap`),customPackages:p(`customPackages`)},g=e=>u(`\`${e}\` is not in this project's plan and is ignored.`),_={...i,planGates:h};h.customPackages||(_.allowedPackages=l(d?.allowedPackages));for(let e of[`rbac`,`sso`]){if(h[e]||!t(_.access)||_.access[e]===void 0)continue;g(`access.${e}`);let{[e]:n,...r}=_.access;_.access=r}!h.analytics&&_.analytics!==void 0&&(g(`analytics`),delete _.analytics),!f(`removeAttribution`)&&_.removeAttribution!==void 0&&(_.removeAttribution===!0&&g(`removeAttribution`),delete _.removeAttribution);for(let[e,t]of r)h[e]||_[t]===void 0||(c(_[t])&&g(t),delete _[t]);if(!h.advancedSearch){let t=s(_.search);t.filters!==void 0&&e(i)&&g(`search.filters`),_.search={...t,filters:{...s(t.filters),hide:!0}}}if(h.aiSearch||((_.aiAssistant!==void 0||s(_.search).ai!==void 0)&&!n(i)&&g(`aiAssistant`),_.aiAssistant={...s(_.aiAssistant),hide:!0}),!h.mcp){let e=s(_.mcp);_.mcp!==void 0&&e.hide!==!0&&g(`mcp`),_.mcp={...e,hide:!0}}if(!h.mockServer){let e=s(_.mockServer);_.mockServer!==void 0&&e.off!==!0&&g(`mockServer`),_.mockServer={...e,off:!0}}if(!h.breadcrumbs){let e=s(_.breadcrumbs);_.breadcrumbs!==void 0&&e.hide!==!0&&g(`breadcrumbs`),_.breadcrumbs={...e,hide:!0}}return h.seo||(_.seo!==void 0&&g(`seo`),_.seo={llmstxt:{hide:!0}}),_.consent!==void 0&&m?u("The PLAN_GATES token has no cookieConsent claim, so `consent` stays on."):_.consent!==void 0&&!h.cookieConsent&&(u("`consent` is not in this project's plan and is ignored: analytics loads without consent."),delete _.consent),_}function a(e){return{code:`configuration/ignored`,message:`${e} are not in this project's plan, so this file is ignored.`}}function o(e){try{let n=(e.split(`.`)[1]??``).replace(/-/g,`+`).replace(/_/g,`/`),r=JSON.parse(atob(n));return t(r)?r:void 0}catch{return}}function s(e){return t(e)?e:{}}function c(e){return Array.isArray(e)?e.length>0:t(e)?Object.keys(e).length>0:e!==void 0}function l(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)?e:[]}export{i as applyPlanGates,a as notInPlanProblem};
|
|
1
|
+
import{isAdvancedSearchEnabled as e}from"../shared/search/facets.js";import{isObject as t}from"../shared/utils/is-object.js";import{isAiHidden as n}from"../shared/ask-ai/config-gate.js";const r=[[`products`,`products`],[`catalogClassic`,`catalog`],[`catalogClassic`,`catalogClassic`],[`l10n`,`l10n`],[`apiFunctions`,`apiFunctions`],[`redirects`,`redirects`],[`banner`,`banner`],[`devOnboarding`,`developerOnboarding`]];function i(i,a,u){if(!a.PLAN_GATES)return i;let d=o(a.PLAN_GATES);d||u(`PLAN_GATES is not a token, so the features of the plan are off.`);let f=e=>!!d?.[e],p=e=>d?.[e]!==!1,m=d!==void 0&&!(`cookieConsent`in d),h={rbac:f(`rbac`),sso:f(`sso`),analytics:f(`analytics`),advancedSearch:f(`advancedSearch`),aiSearch:f(`aiSearchLimit`),mcp:f(`mcp`),mcpGateway:f(`mcpGateway`),mcpWorkflows:f(`mcpWorkflows`),cookieConsent:m||f(`cookieConsent`),removeAttribution:!d?.pricingTier||f(`removeAttribution`),products:p(`products`),catalogClassic:p(`catalogClassic`),l10n:p(`l10n`),apiFunctions:p(`apiFunctions`),mockServer:p(`mockServer`),seo:p(`seo`),redirects:p(`redirects`),breadcrumbs:p(`breadcrumbs`),banner:p(`banner`),codeWalkthrough:p(`codeWalkthrough`),customPlugins:p(`customPlugins`),markdown:p(`markdown`),openapi:p(`openapi`),asyncapi:p(`asyncapi`),graphql:p(`graphql`),reactPages:p(`reactPages`),soap:p(`soap`),devOnboarding:p(`devOnboarding`),customPackages:p(`customPackages`),customMarkdocTags:p(`customMarkdocTags`),customMcpTools:p(`customMcpTools`)},g=e=>u(`\`${e}\` is not in this project's plan and is ignored.`),_={...i,planGates:h,planClaims:d??{}};h.customPackages||(_.allowedPackages=l(d?.allowedPackages));for(let e of[`rbac`,`sso`]){if(h[e]||!t(_.access)||_.access[e]===void 0)continue;g(`access.${e}`);let{[e]:n,...r}=_.access;_.access=r}!h.analytics&&_.analytics!==void 0&&(g(`analytics`),delete _.analytics),!f(`removeAttribution`)&&_.removeAttribution!==void 0&&(_.removeAttribution===!0&&g(`removeAttribution`),delete _.removeAttribution);for(let[e,t]of r)h[e]||_[t]===void 0||(c(_[t])&&g(t),delete _[t]);if(!h.advancedSearch){let t=s(_.search);t.filters!==void 0&&e(i)&&g(`search.filters`),_.search={...t,filters:{...s(t.filters),hide:!0}}}if(h.aiSearch||((_.aiAssistant!==void 0||s(_.search).ai!==void 0)&&!n(i)&&g(`aiAssistant`),_.aiAssistant={...s(_.aiAssistant),hide:!0}),!h.mcp){let e=s(_.mcp);_.mcp!==void 0&&e.hide!==!0&&g(`mcp`),_.mcp={...e,hide:!0}}if(!h.mockServer){let e=s(_.mockServer);_.mockServer!==void 0&&e.off!==!0&&g(`mockServer`),_.mockServer={...e,off:!0}}if(!h.breadcrumbs){let e=s(_.breadcrumbs);_.breadcrumbs!==void 0&&e.hide!==!0&&g(`breadcrumbs`),_.breadcrumbs={...e,hide:!0}}return h.seo||(_.seo!==void 0&&g(`seo`),_.seo={llmstxt:{hide:!0}}),_.consent!==void 0&&m?u("The PLAN_GATES token has no cookieConsent claim, so `consent` stays on."):_.consent!==void 0&&!h.cookieConsent&&(u("`consent` is not in this project's plan and is ignored: analytics loads without consent."),delete _.consent),_}function a(e){return{code:`configuration/ignored`,message:`${e} are not in this project's plan, so this file is ignored.`}}function o(e){try{let n=(e.split(`.`)[1]??``).replace(/-/g,`+`).replace(/_/g,`/`),r=JSON.parse(atob(n));return t(r)?r:void 0}catch{return}}function s(e){return t(e)?e:{}}function c(e){return Array.isArray(e)?e.length>0:t(e)?Object.keys(e).length>0:e!==void 0}function l(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)?e:[]}export{i as applyPlanGates,a as notInPlanProblem};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{compareStrings as e}from"../../shared/utils/compare-strings.js";import{createRecordingPluginIO as t}from"./io.js";import{createTrackedRedoclyConfig as n}from"../config-deps.js";async function
|
|
1
|
+
import{compareStrings as e}from"../../shared/utils/compare-strings.js";import{createRecordingPluginIO as t}from"./io.js";import{createTrackedRedoclyConfig as n}from"../config-deps.js";import{timePluginWork as r}from"./work-time.js";async function i(e,i,o){let s=[];for(let c of e){let e=c.content?.extractFile;if(!e)continue;let l=o.logger.child(`content-layer:plugin:${c.id}`),u=n(o.config),d=[],f=t(o.fs,o.contentDir,o.scannedPaths,e=>d.push(e),i.path),p;try{p={ok:!0,value:await r(c.id,`extract`,async()=>e(i,{io:f,config:u.config,contentDir:o.contentDir,logger:l}))}}catch(e){let t=e instanceof Error?e:Error(String(e));l.warn(`Content plugin extract failed`,{plugin:c.id,path:i.path,error:t.message}),p={ok:!1,error:t}}s.push({plugin:c,result:p,configDependencies:u.collectDependencies(),fileDependencies:a(d)})}return s}function a(t){let n=/* @__PURE__ */ new Map;for(let e of t)n.set(`${e.source}:${e.accessType}:${e.path}`,e);return[...n.values()].sort((t,n)=>e(t.source,n.source)||e(t.path,n.path)||e(t.accessType,n.accessType))}async function o(e,t){let n=e.finalize;if(!n)return{ok:!0,value:null};try{return{ok:!0,value:await n(t)??{}}}catch(n){let r=n instanceof Error?n:Error(String(n));return t.logger.warn(`Content plugin finalize failed`,{plugin:e.id,error:r.message}),{ok:!1,error:r}}}export{a as dedupeFileDependencies,i as extractFileContributions,o as runContentPluginFinalize};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineContentPlugin as e}from"./define.js";import{ENTITY_LOADER_REFERENCE_KIND as t,INLINE_ENTITY_REFERENCE_KIND as n,createEntityLoader as r,createInlineEntity as i,createInlineEntityReference as a,isEntityLoaderReference as o,isInlineEntityReference as s,isRawEntityReference as c}from"../loaders/define.js";import{resolveRuntimeFilePath as l,runtimeFile as u}from"./utils/runtime-file.js";import{SERVER_FN_REFERENCE_KIND as d,STORED_ENTITY_REFERENCE_KIND as f,createServerFn as p,createStoredEntityReference as m,getRegisteredServerFnLoader as h,isServerFnReference as g,normalizeServerFnId as _,resolveServerModuleReference as v}from"./server-fn.js";import{createPluginScopedId as y}from"./utils/scoped-id.js";import{runtimeTemplate as b}from"./templates.js";import{createContentPluginIO as x,createPluginIO as S,createRecordingPluginIO as C}from"./io.js";import{STATIC_FOLDER_PLUGIN_ID as w,STATIC_FOLDER_PREFIX as T,isStaticFolderPath as E,staticFolderContentPlugin as D}from"./internal/static-folder/index.js";import{MCP_TOOL_NAME_PATTERN as O,createContentPluginRegistry as k,matchesContentPluginFilter as A,resolveContentPluginsForFile as j}from"./registry.js";import{dedupeFileDependencies as M,extractFileContributions as N,runContentPluginFinalize as P}from"./execute.js";import{createSourceFile as F}from"./source-file.js";import{createRouteIndex as I,createRouteQueryEvaluator as L,dedupeRouteQueryDependencies as R,isRouteQueryStale as z}from"./utils/route-index.js";import{
|
|
1
|
+
import{defineContentPlugin as e}from"./define.js";import{ENTITY_LOADER_REFERENCE_KIND as t,INLINE_ENTITY_REFERENCE_KIND as n,createEntityLoader as r,createInlineEntity as i,createInlineEntityReference as a,isEntityLoaderReference as o,isInlineEntityReference as s,isRawEntityReference as c}from"../loaders/define.js";import{resolveRuntimeFilePath as l,runtimeFile as u}from"./utils/runtime-file.js";import{SERVER_FN_REFERENCE_KIND as d,STORED_ENTITY_REFERENCE_KIND as f,createServerFn as p,createStoredEntityReference as m,getRegisteredServerFnLoader as h,isServerFnReference as g,normalizeServerFnId as _,resolveServerModuleReference as v}from"./server-fn.js";import{createPluginScopedId as y}from"./utils/scoped-id.js";import{runtimeTemplate as b}from"./templates.js";import"./internal/api-functions/constants.js";import{createContentPluginIO as x,createPluginIO as S,createRecordingPluginIO as C}from"./io.js";import{STATIC_FOLDER_PLUGIN_ID as w,STATIC_FOLDER_PREFIX as T,isStaticFolderPath as E,staticFolderContentPlugin as D}from"./internal/static-folder/index.js";import{MCP_TOOL_NAME_PATTERN as O,createContentPluginRegistry as k,matchesContentPluginFilter as A,resolveContentPluginsForFile as j}from"./registry.js";import{dedupeFileDependencies as M,extractFileContributions as N,runContentPluginFinalize as P}from"./execute.js";import{createSourceFile as F}from"./source-file.js";import{createRouteIndex as I,createRouteQueryEvaluator as L,dedupeRouteQueryDependencies as R,isRouteQueryStale as z}from"./utils/route-index.js";import{SPEC_KIND_ARAZZO as B,SPEC_KIND_ASYNCAPI as V,SPEC_KIND_GRAPHQL as H,SPEC_KIND_GRPC as U,SPEC_KIND_OPENAPI as W}from"../../shared/constants/api-spec-kinds.js";import{MOCK_SERVER_ROUTE_PREFIX as G,mockPathPrefix as K}from"./types/api-entity.js";import{createContentOriginKey as q}from"./utils/origin-key.js";import{ASSETS_PLUGIN_ID as J,ASSET_ENTITY_KEY_PREFIX as Y,assetsContentPlugin as X}from"./internal/assets/index.js";import{APP_DATA_STATIC_DATA_SLUG as Z}from"../../shared/constants/app-data.js";import{SIDEBAR_ROUTE_DEP_KEY as Q}from"../../shared/constants/route-deps.js";import{FOLDER_SIDEBAR_FILENAME_REGEX as $,SIDEBAR_AGGREGATOR_LOADER_ID as ee,SIDEBAR_FILENAME_REGEX as te,SIDEBAR_PLUGIN_ID as ne,isTabbedSidebar as re,resolveAutoSidebar as ie,sidebarContentPlugin as ae}from"./internal/sidebar/index.js";import{APP_DATA_PLUGIN_ID as oe,APP_DATA_PLUGIN_VERSION as se,APP_DATA_STATIC_DATA_LOADER_ID as ce,appDataContentPlugin as le,appDataSystemEntityDescriptor as ue,buildConfigAppData as de,isAppDataFragment as fe}from"./internal/app-data/index.js";import{BUILT_IN_CLASSIC_PLUGINS as pe,DEFAULT_PROJECT_PLUGIN_FILES as me,INTERNAL_PLUGIN_ID_PREFIX as he,PLAN_GATED_PLUGINS as ge}from"./project/constants.js";import{getLoadedProjectPlugins as _e,setLoadedProjectPlugins as ve,warnWhenProjectPluginsAreNotLoaded as ye}from"./project/loaded-set.js";import{apiDocsContentPlugin as be}from"./internal/api-docs/index.js";import{API_FUNCTIONS_PLUGIN_ID as xe,apiFunctionsContentPlugin as Se}from"./internal/api-functions/index.js";import{CATALOG_CLASSIC_LOADER_ID as Ce,CATALOG_CLASSIC_PLUGIN_ID as we,CATALOG_CLASSIC_SERVER_FN_ID as Te,CATALOG_CLASSIC_SIDEBARS_LOADER_ID as Ee,CATALOG_CLASSIC_TEMPLATE_ID as De,catalogClassicContentPlugin as Oe}from"./internal/catalog-classic/index.js";import{L10N_PLUGIN_ID as ke}from"./internal/l10n/translations-loader.js";import{L10N_PLUGIN_VERSION as Ae,l10nContentPlugin as je}from"./internal/l10n/index.js";import{MARKDOC_DOCUMENT_LOADER_ID as Me,MARKDOC_SEARCH_GROUP as Ne,MARKDOC_SIDEBAR_ITEM_LOADER_ID as Pe,MARKDOC_TEMPLATE_ID as Fe,markdocContentPlugin as Ie}from"./internal/markdoc/index.js";import{mcpContentPlugin as Le}from"./internal/mcp/index.js";import{MOCK_SERVER_PLUGIN_ID as Re,MOCK_SERVER_ROUTE_PATH as ze,mockServerContentPlugin as Be}from"./internal/mock/index.js";import{REACT_PAGE_SEARCH_LOADER_KEY as Ve,reactPageContentPlugin as He}from"./internal/react-page/index.js";import{REVISIONS_PLUGIN_ID as Ue,revisionsContentPlugin as We}from"./internal/revisions/index.js";import{SCORECARD_CLASSIC_PLUGIN_ID as Ge,SCORECARD_CLASSIC_TEMPLATE_ID as Ke,scorecardClassicContentPlugin as qe}from"./internal/scorecard-classic/index.js";import{SKILLS_PLUGIN_ID as Je,SKILL_MARKDOWN_ROUTE_PATH as Ye,skillsContentPlugin as Xe}from"./internal/skills/index.js";import{VERSIONS_PLUGIN_ID as Ze,versionsContentPlugin as Qe}from"./internal/versions/index.js";import{createInternalContentPlugins as $e}from"./internal/index.js";import{createContentPlugins as et}from"./create-content-plugins.js";import{createProjectPluginLoadError as tt,formatProjectPluginDiagnostics as nt,loadAndRegisterProjectPlugins as rt,loadProjectPlugins as it,readPluginEntries as at,resolveProjectPluginPath as ot}from"./project/load.js";import{reloadProjectPluginsIfChanged as st}from"./project/reload.js";export{xe as API_FUNCTIONS_PLUGIN_ID,oe as APP_DATA_PLUGIN_ID,se as APP_DATA_PLUGIN_VERSION,ce as APP_DATA_STATIC_DATA_LOADER_ID,Z as APP_DATA_STATIC_DATA_SLUG,J as ASSETS_PLUGIN_ID,Y as ASSET_ENTITY_KEY_PREFIX,pe as BUILT_IN_CLASSIC_PLUGINS,Ce as CATALOG_CLASSIC_LOADER_ID,we as CATALOG_CLASSIC_PLUGIN_ID,Te as CATALOG_CLASSIC_SERVER_FN_ID,Ee as CATALOG_CLASSIC_SIDEBARS_LOADER_ID,De as CATALOG_CLASSIC_TEMPLATE_ID,me as DEFAULT_PROJECT_PLUGIN_FILES,t as ENTITY_LOADER_REFERENCE_KIND,$ as FOLDER_SIDEBAR_FILENAME_REGEX,n as INLINE_ENTITY_REFERENCE_KIND,he as INTERNAL_PLUGIN_ID_PREFIX,ke as L10N_PLUGIN_ID,Ae as L10N_PLUGIN_VERSION,Me as MARKDOC_DOCUMENT_LOADER_ID,Ne as MARKDOC_SEARCH_GROUP,Pe as MARKDOC_SIDEBAR_ITEM_LOADER_ID,Fe as MARKDOC_TEMPLATE_ID,O as MCP_TOOL_NAME_PATTERN,Re as MOCK_SERVER_PLUGIN_ID,ze as MOCK_SERVER_ROUTE_PATH,G as MOCK_SERVER_ROUTE_PREFIX,ge as PLAN_GATED_PLUGINS,Ve as REACT_PAGE_SEARCH_LOADER_KEY,Ue as REVISIONS_PLUGIN_ID,Ge as SCORECARD_CLASSIC_PLUGIN_ID,Ke as SCORECARD_CLASSIC_TEMPLATE_ID,d as SERVER_FN_REFERENCE_KIND,ee as SIDEBAR_AGGREGATOR_LOADER_ID,te as SIDEBAR_FILENAME_REGEX,ne as SIDEBAR_PLUGIN_ID,Q as SIDEBAR_ROUTE_DEP_KEY,Je as SKILLS_PLUGIN_ID,Ye as SKILL_MARKDOWN_ROUTE_PATH,B as SPEC_KIND_ARAZZO,V as SPEC_KIND_ASYNCAPI,H as SPEC_KIND_GRAPHQL,U as SPEC_KIND_GRPC,W as SPEC_KIND_OPENAPI,w as STATIC_FOLDER_PLUGIN_ID,T as STATIC_FOLDER_PREFIX,f as STORED_ENTITY_REFERENCE_KIND,Ze as VERSIONS_PLUGIN_ID,be as apiDocsContentPlugin,Se as apiFunctionsContentPlugin,le as appDataContentPlugin,ue as appDataSystemEntityDescriptor,X as assetsContentPlugin,de as buildConfigAppData,Oe as catalogClassicContentPlugin,q as createContentOriginKey,x as createContentPluginIO,k as createContentPluginRegistry,et as createContentPlugins,r as createEntityLoader,i as createInlineEntity,a as createInlineEntityReference,$e as createInternalContentPlugins,S as createPluginIO,y as createPluginScopedId,tt as createProjectPluginLoadError,C as createRecordingPluginIO,I as createRouteIndex,L as createRouteQueryEvaluator,p as createServerFn,F as createSourceFile,m as createStoredEntityReference,M as dedupeFileDependencies,R as dedupeRouteQueryDependencies,e as defineContentPlugin,N as extractFileContributions,nt as formatProjectPluginDiagnostics,_e as getLoadedProjectPlugins,h as getRegisteredServerFnLoader,fe as isAppDataFragment,o as isEntityLoaderReference,s as isInlineEntityReference,c as isRawEntityReference,z as isRouteQueryStale,g as isServerFnReference,E as isStaticFolderPath,re as isTabbedSidebar,je as l10nContentPlugin,rt as loadAndRegisterProjectPlugins,it as loadProjectPlugins,Ie as markdocContentPlugin,A as matchesContentPluginFilter,Le as mcpContentPlugin,K as mockPathPrefix,Be as mockServerContentPlugin,_ as normalizeServerFnId,He as reactPageContentPlugin,at as readPluginEntries,st as reloadProjectPluginsIfChanged,ie as resolveAutoSidebar,j as resolveContentPluginsForFile,ot as resolveProjectPluginPath,l as resolveRuntimeFilePath,v as resolveServerModuleReference,We as revisionsContentPlugin,P as runContentPluginFinalize,u as runtimeFile,b as runtimeTemplate,qe as scorecardClassicContentPlugin,ve as setLoadedProjectPlugins,ae as sidebarContentPlugin,Xe as skillsContentPlugin,D as staticFolderContentPlugin,Qe as versionsContentPlugin,ye as warnWhenProjectPluginsAreNotLoaded};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isObject as e}from"../../../../../shared/utils/is-object.js";function t(t){if(!e(t.events))return t;let r={};if(typeof window<`u`)for(let[e,i]of Object.entries(t.events)){let t=n(i);t===void 0?console.error(`The openapi.events.${e} handler is not a function and is not used.`):r[e]=t}return{...t,events:r}}function n(e){if(typeof e==`string`)try{let t=Function(`
|
|
1
|
+
import{isObject as e}from"../../../../../shared/utils/is-object.js";function t(t){if(!e(t.events))return t;let r={};if(typeof window<`u`)for(let[e,i]of Object.entries(t.events)){let t=n(i);t===void 0?console.error(`The openapi.events.${e} handler is not a function and is not used.`):r[e]=t}return{...t,events:r}}function n(e){if(typeof e==`string`)try{let t=Function(`const __redoclyEventHandler = ${e}\nreturn __redoclyEventHandler;`)();return typeof t==`function`?t:void 0}catch{return}}export{t as withEventHandlers};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ITEM_ROUTE_PATH_KEYS as e}from"@redocly/api-docs/lib/utils/previous-route-slug.js";
|
|
1
|
+
import{ITEM_ROUTE_PATH_KEYS as e}from"@redocly/api-docs/lib/utils/previous-route-slug.js";function t(t,n,r){let i=n===`/`?`/`:`${n}/`,a=r===`/`?``:r,o=e=>e===n?r:e.startsWith(i)?`${a}/${e.slice(i.length)}`:e,s=t=>{if(typeof t!=`object`||!t)return t;let n={...t};for(let t of e){let e=n[t];typeof e==`string`&&(n[t]=o(e))}return Array.isArray(n.items)&&(n.items=n.items.map(s)),n};return t.map(s)}export{t as rebaseItemLinks};
|
|
@@ -1,7 +1,15 @@
|
|
|
1
|
-
import{REPLAY_OAUTH2_ROUTE_PATH as e}from"../../../../../shared/constants/replay.js";import{withPathPrefix as t}from"../../../../../shared/path-prefix.js";import{API_DOCS_INFO_BLOCK_DEP_KEY as n,API_DOCS_RENDER_DEP_KEY as r,apiPageTitle as i}from"../server/shared.js";import{ApiDocsLayoutContext as a,PageContext as o}from"../../../../../client/contexts.js";import{
|
|
1
|
+
import{REPLAY_OAUTH2_ROUTE_PATH as e}from"../../../../../shared/constants/replay.js";import{withPathPrefix as t}from"../../../../../shared/path-prefix.js";import{API_DOCS_INFO_BLOCK_DEP_KEY as n,API_DOCS_RENDER_DEP_KEY as r,apiPageTitle as i}from"../server/shared.js";import{ApiDocsLayoutContext as a,PageContext as o}from"../../../../../client/contexts.js";import{expandSecurityRequestValues as s,useDynamicRequestValues as c}from"../../../../../client/ApiAccess.js";import{MarkdocBlocks as l,markdocComponents as u}from"../../../../markdown/client/markdoc-components.js";import{rebaseItemLinks as d}from"./rebase-item-links.js";import{apiDocsTelemetryConfig as f}from"../../../../../client/telemetry/config.js";import{withReplayOptions as p}from"../../../../../client/replay-options.js";import{JsonSchemaTag as m}from"../../../../markdown/client/JsonSchemaTag.js";import{JsonExample as h}from"../../../../markdown/client/OpenapiTagComponents.js";import{withEventHandlers as g}from"./event-handlers.js";import{useContext as _,useEffect as v,useMemo as y}from"react";import b from"styled-components";import{useLocation as x}from"react-router";import{Fragment as S,jsx as C,jsxs as w}from"react/jsx-runtime";import{useThemeConfig as T}from"@redocly/theme/core/hooks";import{LayoutVariant as E}from"@redocly/theme/components/SidebarActions/SidebarActions";import{useLoaderData as D}from"virtual:realm-runtime";import{userMarkdocComponents as O}from"virtual:realm-markdoc-components";import{RedoclyApiDocs as k,apiDocsMarkdocComponents as A}from"@redocly/api-docs";import{Breadcrumbs as j}from"@redocly/theme/components/Breadcrumbs/Breadcrumbs";import{CatalogClassicInfoBlock as M}from"@redocly/theme/components/CatalogClassic/CatalogClassicInfoBlock";import{MissingTranslationNotice as N}from"@redocly/theme/components/MissingTranslationNotice/MissingTranslationNotice";import{ThreePanelLayout as P}from"@redocly/theme/layouts/ThreePanelLayout";const F={...u,JsonSchema:O.JsonSchema??m,JsonExample:O.JsonExample??h,...A},I={parse:e=>e,render:e=>/* @__PURE__ */ C(l,{ast:e,components:F})},L={MiddlePanelHeader:R};function R(){return/* @__PURE__ */ w(S,{children:[/* @__PURE__ */ C(j,{}),/* @__PURE__ */ C(W,{})]})}function z(e){return(e.length>1&&e.endsWith(`/`)?e.slice(0,-1):e).toLowerCase()}function B({page:e}){let t=D(r),i=D(n),{layout:o}=_(a),l=V(),u=c(),m=y(()=>{if(!t)return t;let e=s(u,Object.values(t.store.securitySchemeStore??{}));return{...g(p(t.options)),oAuth2RedirectURI:H(),userClaims:l,unstable_hooks:L,dynamicRequestValues:e}},[t,l,u]),h=e.slug.toLowerCase(),v=y(()=>t&&t.basePath!==h?d(t.items,t.basePath,h):t?.items,[t,h]);if(K(e.metadata,v,t?.title),!t)return null;let b=f();return/* @__PURE__ */ w(U,{children:[i&&/* @__PURE__ */ C(G,{layout:o,children:/* @__PURE__ */ C(M,{metadata:i})}),/* @__PURE__ */ C(k,{items:v,store:t.store,options:m,basePath:h,layout:o,markdownAdapter:I,telemetryConfig:b})]})}function V(){let e=_(o)?.auth?.userInfo,t=e?.isAuthenticated?e.email:void 0,n=e?.isAuthenticated?e.name:void 0;return y(()=>({email:t,name:n}),[t,n])}function H(){if(typeof window<`u`)return new URL(t(e),window.location.origin).toString()}const U=b.main`
|
|
2
|
+
[data-section-id] {
|
|
3
|
+
scroll-margin-top: var(--navbar-offset);
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
[id]:not([data-section-id]):has([data-deep-link-anchor]) {
|
|
7
|
+
scroll-margin-top: calc(var(--navbar-offset) + var(--deep-link-scroll-gap, var(--spacing-xl)));
|
|
8
|
+
}
|
|
9
|
+
`,W=b(N)`
|
|
2
10
|
width: 100%;
|
|
3
|
-
`,
|
|
11
|
+
`,G=b(P)`
|
|
4
12
|
&& {
|
|
5
|
-
padding-right: ${({layout:e})=>e===
|
|
13
|
+
padding-right: ${({layout:e})=>e===E.THREE_PANEL?`calc(var(--panel-gap-horizontal) * 2)`:`var(--panel-gap-horizontal)`};
|
|
6
14
|
}
|
|
7
|
-
`;function
|
|
15
|
+
`;function K(e,t,n){let{pathname:r}=x(),{seo:a}=T(),o=a?.projectTitle,s=t?i(e,t,z(r),n):void 0;v(()=>{s&&(document.title=o?`${s} | ${o}`:s)},[s,o])}export{B as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineContentPlugin as e}from"../../define.js";import{createEntityLoader as t}from"../../../loaders/define.js";import{runtimeFile as n}from"../../utils/runtime-file.js";import{runtimeTemplate as r}from"../../templates.js";import{SEARCH_GROUP_FACET_FIELD as i}from"../../../../shared/search/facets.js";import{configuredFacetFields as a,extractFacetsFromFrontmatter as o,invalidFacetValueProblems as s,searchCategoryOf as c}from"../../../search/facet-values.js";import{toPosixPath as l}from"../../../../shared/utils/to-posix-path.js";import{TRANSLATIONS_FILE_PATTERN as u}from"../../../../shared/constants/l10n/defaults.js";import{isObject as d}from"../../../../shared/utils/is-object.js";import{notInPlanProblem as f}from"../../../plan-gates.js";import{filePathToRouteSlug as p}from"../../../../shared/utils/routes/file-path-to-route-slug.js";import{SPEC_KIND_ARAZZO as m,SPEC_KIND_ASYNCAPI as h,SPEC_KIND_GRAPHQL as g,SPEC_KIND_OPENAPI as _}from"../../types/api-entity.js";import{isPlanFeatureGranted as v}from"../../../../shared/plan-gates.js";import{packMarkdocAstsDeep as y,unpackMarkdocAstsDeep as b}from"../../../markdown/utils/packed-ast.js";import{parseMarkdownCached as x}from"../../../markdown/utils/parse-cache.js";import{createApiEntityKey as S}from"../../utils/api-entity-key.js";import{API_DOCS_API_LOADER_ID as ee,API_DOCS_PLUGIN_ID as te,API_DOCS_RENDER_DEP_KEY as ne,API_DOCS_RENDER_LOADER_ID as C,API_DOCS_SIDEBAR_LOADER_ID as w,API_DOCS_TEMPLATE_ID as T,SPEC_DOWNLOAD_ROUTE_PATHS as E,SPEC_PATH_PARAM as re}from"./server/shared.js";import{resolveApiBundleConfig as ie,resolveApiOptions as ae,resolveNestedFeedback as oe,schemaCatalogLink as se,withDownloadUrls as ce,withFeedbackOption as le,withMockServerOption as ue}from"./server/options.js";import{annotateApiDocsRbac as de}from"../../../../server/rbac/api-docs.js";import{SERVER_ONLY_VALUE_KEY as D}from"../../../loaders/server-only-value.js";import{getLoadedProjectPlugins as fe}from"../../project/loaded-set.js";import{API_OUTPUT_MANIFEST_KEY as O}from"../../../api-outputs.js";import{API_DOCS_MARKDOC_TAG_SET as k,resolveMarkdocTagSet as A}from"../../../markdown/constants/tag-sets.js";import{pageLocale as j}from"../../utils/page-locale.js";import{buildBundledApiDefinition as M,resolveLlmsDescriptions as N}from"./server/build-definition.js";import{collectSidebarSubpathTargets as P,toSidebarSubtree as F,toSubpathTarget as I}from"./server/build-sidebar.js";import{buildApiDocsMarkdownDocs as L}from"./server/markdown-docs.js";import{join as R,relative as z}from"node:path";import B from"@redocly/markdoc";const V=[`.yaml`,`.yml`,`.json`,`.gql`,`.graphql`],pe={[_]:`OpenAPI`,[h]:`AsyncAPI`,[g]:`GraphQL`,[m]:`Arazzo`},H=t(C,async e=>{let{buildItems:t}=await import(`@redocly/api-docs`),n=G(e),r=await e.io.readFile(n.absolutePath),i=e.routes.byFilePath(e.file.path)?.slug,a=ce(e.args.options,e.file.path,e.args.kind),o=e.args.kind===`openapi`?ue(a,e.config,i):a,s={entityDeps:[],assetUsages:[],linkRefs:[],problems:[],pending:[]},c=W(e.contentDir),l={markdown:e.markdown,loader:{config:e.config,entities:e.entities,file:e.file,io:e.io,logger:e.logger,plugin:e.plugin},sink:s},u=await M({kind:e.args.kind,source:r,relativePath:n.relativePath,contentDir:e.contentDir,pagePath:e.file.path,options:o,bundle:K(e.args,c),metadata:X(e.args.options),markdownResolution:l,rbac:{warn:t=>e.logger?.warn(t)}}),f={...d(u.document)&&d(u.document.info)?{infoDescription:u.document.info.description}:{},...await N(u.document,l,{contentDir:e.contentDir,specPath:n.relativePath,pagePath:e.file.path})};e.args.kind===`openapi`&&o.showSchemaCatalogLinks&&d(u.document)&&(u.document[`x-schema-catalog-link`]=se(e.file.path)),u.options=le(u.options,u.document,e.args.feedback??e.config.feedback);let p=i?.toLowerCase()??`/`,{items:m,store:h,specType:g}=await t({...u,basePath:p,markdownParser:e=>B.compact(x(e))}),_=JSON.stringify({items:y(m),store:y(h),options:u.options,specType:g,basePath:p,title:ye(u.document,e.args.kind,m),metadata:ve(u.document),[D]:{llms:f}});return{value:await e.createBlobRef(_,{format:`json`}),entityDeps:[...J(e.file.path,[...u.fileDependencies,...c.paths]),...s.entityDeps],assetUsages:s.assetUsages,markdoc:{tagSet:k},linkRefs:s.linkRefs,problems:s.problems}},{async searchable(e,t){if(t.route===void 0||t.route.metadata.excludeFromSearch===!0)return{docs:[]};let n=b(e),r=await we(t.entities,t.route.originFilePath),l={...t.route.metadata,...d(n.metadata)?n.metadata:{}},{category:u,isInvalid:f}=c(l),{facets:p,invalidFields:m}=o(l,a(t.config)),{buildApiDocsSearchDocuments:h}=await import(`./server/search-documents.js`);return{...h(n,r,{groupKey:u,facets:p,warn:e=>t.logger?.warn(e)}),problems:s([...m,...f?[i]:[]],t.route.originFilePath)}},async markdown(e,t){if(t.route===void 0)return null;let n=b(e),r=t.route.originFilePath??void 0,i=r?await t.entities.load(S(r)).catch(()=>void 0):void 0,{tags:a}=await A(k);return L(n,_e(i,n[D]?.llms),r,{tags:a,locale:j(t)})},usesProjectMarkdocSchema:!0}),U=t(ee,async e=>{let t=G(e),n=await e.io.readFile(t.absolutePath),r=W(e.contentDir),i=await M({kind:e.args.kind,source:n,relativePath:t.relativePath,contentDir:e.contentDir,bundle:K(e.args,r),metadata:X(e.args.options)}),a=e.args.kind===g,o=a?n:JSON.stringify(i.document);return{value:o.length>65536?await e.createBlobRef(o,{format:a?`text`:`json`}):a?n:i.document,metadata:{...Z(e.file.path,e.args.kind,e.args.options,e.args.rbac),...he(i.document,e.routes.byFilePath(e.file.path)?.slug)},entityDeps:J(e.file.path,[...i.fileDependencies,...r.paths])}});function W(e){let t=fe(e)?.lintPlugins??[];return{plugins:t,paths:t.map(t=>l(z(e,t.path))).filter(e=>e!==``&&!e.startsWith(`../`))}}function G(e){let t=e.args.source?.path??e.file.path;return{relativePath:t,absolutePath:R(e.contentDir,t)}}function me(e){let t=e[O];return d(t)&&typeof t.root==`string`?t.root:void 0}function K(e,t){let{config:n,configDir:r}=e.bundleConfig??{config:{},configDir:``};return{config:n,configDir:r,plugins:t.plugins}}function he(e,t){let n=d(e)&&d(e.info)?e.info:{},r=d(n[`x-metadata`])?n[`x-metadata`]:{},i=typeof n.description==`string`?n.description.trim():``;return{...t===void 0?{}:{routeSlug:t},...Q(n.version)?{version:String(n.version)}:{},...typeof r.apiId==`string`?{apiId:r.apiId}:{},description:i||void 0}}const q=t(w,async e=>{let{buildNavItems:t,collectPreviousRouteSlugs:n}=await import(`@redocly/api-docs`),r=await e.entities.load(S(e.file.path)),i=e.args.kind===`graphql`?(await import(`graphql`)).parse(r):r,a=de(i,e.args.kind,{warn:t=>e.logger?.warn(t)}),{items:o}=await t({type:e.args.kind,document:a,options:e.args.options,basePath:`/`,markdownParser:x}),s=F(o),c=n(o).map(({from:e})=>I(e));return{value:s,targetInventories:[{kind:`subpath`,exhaustive:!0,targets:[...P(s),...c]}]}});function J(e,t){return[{kind:`file`,path:e},...t.map(e=>({kind:`file`,path:e}))]}const ge={arazzo:`Arazzo Docs`,asyncapi:`AsyncAPI Docs`,graphql:`GraphQL Docs`,openapi:`OpenAPI Docs`};function _e(e,t){if(t===void 0||!d(e))return e;let n=d(e.info)?e.info:{},r=d(e.components)?e.components:{};return{...e,...t.infoDescription===void 0?{}:{info:{...n,description:t.infoDescription}},...t.servers===void 0?{}:{servers:t.servers},...t.securitySchemes===void 0?{}:{components:{...r,securitySchemes:t.securitySchemes}}}}function ve(e){let t=d(e)&&d(e.info)?e.info:{};return d(t[`x-metadata`])?t[`x-metadata`]:{}}function ye(e,t,n){let r=d(e)&&d(e.info)?e.info:{};if(typeof r.title==`string`&&r.title!==``)return r.title;let i=d(n[0])?n[0].label:void 0;return typeof i==`string`&&i!==``?i:ge[t]}const be=[`rbac`,`sidebar`,`excludeFromSearch`,`template`];function Y(e,t){let n=d(e.manifest.info)?e.manifest.info:{},r={};typeof n.title==`string`&&(r.title=n.title),Q(n.version)&&(r.version=String(n.version)),typeof n.summary==`string`&&(r.summary=n.summary),d(n[`x-metadata`])&&Object.assign(r,n[`x-metadata`]),d(t.metadata)&&Object.assign(r,t.metadata);for(let e of be)delete r[e];return r}function X(e){return d(e.metadata)?e.metadata:void 0}function xe(e){let t=X(e)?.title;return typeof t==`string`&&t.length>0?t:void 0}function Z(e,t,n,r){let i=xe(n);return{specType:t,sourcePath:e,...i===void 0?{}:{title:i},...r===void 0?{}:{rbac:r},...Object.keys(n).length>0?{options:n}:{},...d(n.mockServer)?{mockServer:n.mockServer}:{}}}function Q(e){return typeof e==`string`||typeof e==`number`}function Se(e){if(e.ext===`.gql`||e.ext===`.graphql`)return g;let{openapi:t,swagger:n,asyncapi:r,arazzo:i}=e.manifest;return Q(t)||Q(n)?_:Q(r)?h:Q(i)?m:null}const Ce=e({id:te,version:`0.41.0`,content:{filter:{extensions:V},async extractFile(e,t){if(u.test(e.path))return null;let n=Se(e);if(n===null)return null;if(n!==`arazzo`&&!v(t.config,n))return{routes:[],problems:[f(`${pe[n]} documents`)]};let r=e.path,i=me(e.manifest),a=i??r,{rbac:o,...s}=await ae(t.io,t.config,r,n,a),c={filePath:r,kind:n,options:s,...o===void 0||!v(t.config,`rbac`)?{}:{rbac:o}};i!==void 0&&(c.source={path:i});let l=await oe(t.io,t.config,a);if(l!==void 0&&(c.feedback=l),n!==`graphql`){let e=await ie(t.io,t.config,r,a);Object.keys(e.config).length>0&&(c.bundleConfig=e)}let d=U.withArgs(c,{stableKey:S(r),type:`api`,metadata:Z(r,n,s,c.rbac)});if(n===`arazzo`)return{routes:[],entities:[d]};let m=Y(e,s);s.excludeFromSearch===!0&&(m.excludeFromSearch=!0),m.type=n,c.rbac!==void 0&&(m.rbac=c.rbac);let h=H.withArgs(c,{stableKey:`api-docs:render:${r}`}),g=q.withArgs(c,{stableKey:`api-docs:sidebar:${r}`}),_=p(r);return{routes:[{deps:{[ne]:h},metadata:m,routeId:`page`,sidebarSubtree:g,slug:null,slugHint:_,template:T,wildcardPrefix:!0}],entities:[d,h,g]}}},loaders:[U,H,q],templates:{[T]:r(n(`./client/template.tsx`,import.meta.url))},server:{routes:[$(E.bundle,`bundle`),$(E.deprecatedBundle,`bundle`),$(E.graphql,`graphql`)]}});function $(e,t){return{method:`GET`,path:e+re,handler:{filePath:`./server/spec-download.ts`,importer:import.meta.url,exportName:t}}}async function we(e,t){if(t)try{return await e.load(S(t))}catch{return}}export{Ce as apiDocsContentPlugin};
|
|
1
|
+
import{defineContentPlugin as e}from"../../define.js";import{createEntityLoader as t}from"../../../loaders/define.js";import{runtimeFile as n}from"../../utils/runtime-file.js";import{runtimeTemplate as r}from"../../templates.js";import{SEARCH_API_TITLE_FACET_FIELD as i,SEARCH_API_VERSION_FACET_FIELD as a,SEARCH_GROUP_FACET_FIELD as o}from"../../../../shared/search/facets.js";import{configuredFacetFields as s,extractFacetsFromFrontmatter as c,invalidFacetValueProblems as l,searchCategoryOf as u}from"../../../search/facet-values.js";import{isPlanFeatureGranted as d}from"../../../../shared/plan-gates.js";import{toPosixPath as f}from"../../../../shared/utils/to-posix-path.js";import{isObject as p}from"../../../../shared/utils/is-object.js";import{API_DOCS_MARKDOC_TAG_SET as m,resolveMarkdocTagSet as h}from"../../../markdown/constants/tag-sets.js";import{TRANSLATIONS_FILE_PATTERN as g}from"../../../../shared/constants/l10n/defaults.js";import{notInPlanProblem as _}from"../../../plan-gates.js";import{filePathToRouteSlug as v}from"../../../../shared/utils/routes/file-path-to-route-slug.js";import{SPEC_KIND_ARAZZO as y,SPEC_KIND_ASYNCAPI as b,SPEC_KIND_GRAPHQL as x,SPEC_KIND_GRPC as S,SPEC_KIND_OPENAPI as C}from"../../../../shared/constants/api-spec-kinds.js";import{packMarkdocAstsDeep as w,unpackMarkdocAstsDeep as T}from"../../../../shared/utils/packed-ast.js";import{findVersionFolder as E}from"../../utils/version-path.js";import{toPublicVersionedSlug as D}from"../../../../shared/constants/versions.js";import{readVersionsYaml as ee,versionsYamlPath as te}from"../../../versions/version-groups.js";import{parseMarkdownCached as O}from"../../../markdown/utils/parse-cache.js";import{createApiEntityKey as k}from"../../utils/api-entity-key.js";import{API_DOCS_API_LOADER_ID as ne,API_DOCS_PLUGIN_ID as re,API_DOCS_RENDER_DEP_KEY as ie,API_DOCS_RENDER_LOADER_ID as ae,API_DOCS_SIDEBAR_LOADER_ID as oe,API_DOCS_TEMPLATE_ID as A,SPEC_DOWNLOAD_ROUTE_PATHS as j,SPEC_PATH_PARAM as se}from"./server/shared.js";import{resolveApiBundleConfig as ce,resolveApiOptions as le,resolveNestedFeedback as ue,schemaCatalogLink as de,withDownloadUrls as fe,withFeedbackOption as pe,withMockServerOption as me}from"./server/options.js";import{annotateApiDocsRbac as M}from"../../../../shared/rbac/api-docs.js";import{SERVER_ONLY_VALUE_KEY as N}from"../../../loaders/server-only-value.js";import{getLoadedProjectPlugins as P}from"../../project/loaded-set.js";import{API_OUTPUT_MANIFEST_KEY as F}from"../../../api-outputs.js";import{pageLocale as I}from"../../utils/page-locale.js";import{buildBundledApiDefinition as L,resolveLlmsDescriptions as R}from"./server/build-definition.js";import{collectSidebarSubpathTargets as z,toSidebarSubtree as he,toSubpathTarget as ge}from"./server/build-sidebar.js";import{declaresProtoService as _e}from"./server/declares-proto-service.js";import{join as ve,relative as ye,resolve as B}from"node:path";import be from"@redocly/markdoc";async function xe(e,t){let n=t.originFilePath===null?null:E(t.originFilePath);if(n===null||t.version===null||t.versionGroup===null)return{slug:t.slug,entityDeps:[]};let r=(await ee({io:{exists:t=>e.io.exists(B(e.contentDir,t)),readFile:t=>e.io.readFile(B(e.contentDir,t))},directory:n.parent}))?.default===t.version;return{slug:D(t.slug,t.versionGroup,t.version,r),entityDeps:[{kind:`file`,path:te(n.parent)}]}}const Se=[`.yaml`,`.yml`,`.json`,`.gql`,`.graphql`,`.proto`],Ce={[C]:`OpenAPI`,[b]:`AsyncAPI`,[x]:`GraphQL`,[y]:`Arazzo`,[S]:`gRPC`},V=t(ae,async e=>{let{buildItems:t,descriptionOptions:n}=await import(`@redocly/api-docs/server`),r=W(e),i=await e.io.readFile(r.absolutePath),a=e.routes.byFilePath(e.file.path),o=a?.slug,s=a&&e.args.kind===`openapi`?await xe(e,a):{slug:void 0,entityDeps:[]},c=fe(e.args.options,e.file.path,e.args.kind),l=e.args.kind===`openapi`?me(c,e.config,s.slug):c,u={entityDeps:[],assetUsages:[],linkRefs:[],problems:[],pending:[]},d=U(e.contentDir),f={markdown:e.markdown,loader:{config:e.config,entities:e.entities,file:e.file,io:e.io,logger:e.logger,plugin:e.plugin},sink:u},h=await L({kind:e.args.kind,source:i,relativePath:r.relativePath,contentDir:e.contentDir,pagePath:e.file.path,options:l,bundle:G(e.args,d),metadata:J(e.args.options),io:e.io,markdownResolution:f,rbac:{warn:t=>e.logger?.warn(t)}}),g={...p(h.document)&&p(h.document.info)?{infoDescription:h.document.info.description}:{},...await R(h.document,f,{contentDir:e.contentDir,specPath:r.relativePath,pagePath:e.file.path})};e.args.kind===`openapi`&&l.showSchemaCatalogLinks&&p(h.document)&&(h.document[`x-schema-catalog-link`]=de(e.file.path)),h.options={...pe(h.options,h.document,e.args.feedback??e.config.feedback),...n(e.args.kind,h.document,J(e.args.options))};let _=o?.toLowerCase()??`/`,{items:v,store:y,specType:b}=await t({...h,basePath:_,markdownParser:e=>be.compact(O(e))}),x=JSON.stringify({items:w(v),store:w(y),options:h.options,specType:b,basePath:_,title:ke(h.document,e.args.kind,v),metadata:Oe(h.document),[N]:{llms:g}});return{value:await e.createBlobRef(x,{format:`json`}),entityDeps:[...q(e.file.path,[...h.fileDependencies,...d.paths]),...u.entityDeps,...s.entityDeps],assetUsages:u.assetUsages,markdoc:{tagSet:m},linkRefs:u.linkRefs,problems:u.problems}},{async searchable(e,t){if(t.route===void 0||t.route.metadata.excludeFromSearch===!0)return{docs:[]};let n=T(e);if(n.specType===`grpc`)return{docs:[]};let r=await $(t.entities,t.route.originFilePath),d={...t.route.metadata,...p(n.metadata)?n.metadata:{}},{category:f,isInvalid:m}=u(d),{facets:h,invalidFields:g}=c({[i]:t.route.metadata.title,[a]:t.route.metadata.version,...d},s(t.config)),{buildApiDocsSearchDocuments:_}=await import(`./server/search-documents.js`);return{..._(n,r,{groupKey:f,facets:h,warn:e=>t.logger?.warn(e)}),problems:l([...g,...m?[o]:[]],t.route.originFilePath)}},async markdown(e,t){if(t.route===void 0)return null;let n=T(e);if(n.specType===`grpc`)return null;let r=t.route.originFilePath??void 0,i=await $(t.entities,r),{tags:a}=await h(m,t.config),{buildApiDocsMarkdownCopies:o}=await import(`./server/markdown-copy.js`);return o(n,De(i,n[N]?.llms),{originFilePath:r,markdown:{tags:a,locale:I(t)},warn:e=>t.logger?.warn(e)})},usesProjectMarkdocSchema:!0}),H=t(ne,async e=>{let t=W(e),n=await e.io.readFile(t.absolutePath),r=U(e.contentDir),i=await L({kind:e.args.kind,source:n,relativePath:t.relativePath,contentDir:e.contentDir,bundle:G(e.args,r),metadata:J(e.args.options),io:e.io}),a=e.args.kind===x,o=a?n:JSON.stringify(i.document);return{value:o.length>65536?await e.createBlobRef(o,{format:a?`text`:`json`}):a?n:i.document,metadata:{...X(e.file.path,e.args.kind,e.args.options,e.args.rbac),...Te(i.document,e.routes.byFilePath(e.file.path)?.slug)},entityDeps:q(e.file.path,[...i.fileDependencies,...r.paths]),problems:i.problems}});function U(e){let t=P(e)?.lintPlugins??[];return{plugins:t,paths:t.map(t=>f(ye(e,t.path))).filter(e=>e!==``&&!e.startsWith(`../`))}}function W(e){let t=e.args.source?.path??e.file.path;return{relativePath:t,absolutePath:ve(e.contentDir,t)}}function we(e){let t=e[F];return p(t)&&typeof t.root==`string`?t.root:void 0}function G(e,t){let{config:n,configDir:r}=e.bundleConfig??{config:{},configDir:``};return{config:n,configDir:r,plugins:t.plugins}}function Te(e,t){let n=p(e)&&p(e.info)?e.info:{},r=p(n[`x-metadata`])?n[`x-metadata`]:{},i=typeof n.description==`string`?n.description.trim():``;return{...t===void 0?{}:{routeSlug:t},...Z(n.version)?{version:String(n.version)}:{},...typeof r.apiId==`string`?{apiId:r.apiId}:{},description:i||void 0}}const K=t(oe,async e=>{let{buildNavItems:t,collectPreviousRouteSlugs:n}=await import(`@redocly/api-docs/server`),r=await e.entities.load(k(e.file.path)),i=e.args.kind===`graphql`?(await import(`graphql`)).parse(r):r,a=M(i,e.args.kind,{warn:t=>e.logger?.warn(t)}),{items:o}=await t({type:e.args.kind,document:a,options:e.args.options,basePath:`/`,markdownParser:O}),s=he(o),c=n(o).map(({from:e})=>ge(e));return{value:s,targetInventories:[{kind:`subpath`,exhaustive:!0,targets:[...z(s),...c]}]}});function q(e,t){return[{kind:`file`,path:e},...t.map(e=>({kind:`file`,path:e}))]}const Ee={arazzo:`Arazzo Docs`,asyncapi:`AsyncAPI Docs`,graphql:`GraphQL Docs`,grpc:`gRPC Docs`,openapi:`OpenAPI Docs`};function De(e,t){if(t===void 0||!p(e))return e;let n=p(e.info)?e.info:{},r=p(e.components)?e.components:{};return{...e,...t.infoDescription===void 0?{}:{info:{...n,description:t.infoDescription}},...t.servers===void 0?{}:{servers:t.servers},...t.securitySchemes===void 0?{}:{components:{...r,securitySchemes:t.securitySchemes}}}}function Oe(e){let t=p(e)&&p(e.info)?e.info:{};return p(t[`x-metadata`])?t[`x-metadata`]:{}}function ke(e,t,n){let r=p(e)&&p(e.info)?e.info:{};if(typeof r.title==`string`&&r.title!==``)return r.title;let i=p(n[0])?n[0].label:void 0;return typeof i==`string`&&i!==``?i:Ee[t]}const Ae=[`rbac`,`sidebar`,`excludeFromSearch`,`template`];function je(e,t){let n=p(e.manifest.info)?e.manifest.info:{},r={};typeof n.title==`string`&&(r.title=n.title),Z(n.version)&&(r.version=String(n.version)),typeof n.summary==`string`&&(r.summary=n.summary),p(n[`x-metadata`])&&Object.assign(r,n[`x-metadata`]),p(t.metadata)&&Object.assign(r,t.metadata);for(let e of Ae)delete r[e];return r}function J(e){return p(e.metadata)?e.metadata:void 0}function Y(e){let t=J(e)?.title;return typeof t==`string`&&t.length>0?t:void 0}function X(e,t,n,r){let i=Y(n);return{specType:t,sourcePath:e,...i===void 0?{}:{title:i},...r===void 0?{}:{rbac:r},...Object.keys(n).length>0?{options:n}:{},...p(n.mockServer)?{mockServer:n.mockServer}:{}}}function Z(e){return typeof e==`string`||typeof e==`number`}function Me(e){if(e.ext===`.gql`||e.ext===`.graphql`)return x;let{openapi:t,swagger:n,asyncapi:r,arazzo:i}=e.manifest;return Z(t)||Z(n)?C:Z(r)?b:Z(i)?y:null}async function Ne(e,t){return t.config.grpcDocsEnabled===!0&&_e(await t.io.readFile(e.path))?S:null}const Pe=e({id:re,version:`0.51.0`,content:{filter:{extensions:Se},async extractFile(e,t){if(g.test(e.path))return null;let n=e.ext===`.proto`?await Ne(e,t):Me(e);if(n===null)return null;if(n!==`arazzo`&&n!==`grpc`&&!d(t.config,n))return{routes:[],problems:[_(`${Ce[n]} documents`)]};let r=e.path,i=we(e.manifest),a=i??r,{rbac:o,...s}=await le(t.io,t.config,r,n,a),c={filePath:r,kind:n,options:s,...o===void 0||!d(t.config,`rbac`)?{}:{rbac:o}};i!==void 0&&(c.source={path:i});let l=await ue(t.io,t.config,a);if(l!==void 0&&(c.feedback=l),n!==`graphql`&&n!==`grpc`){let e=await ce(t.io,t.config,r,a);Object.keys(e.config).length>0&&(c.bundleConfig=e)}let u=H.withArgs(c,{stableKey:k(r),type:`api`,metadata:X(r,n,s,c.rbac)});if(n===`arazzo`)return{routes:[],entities:[u]};let f=je(e,s);s.excludeFromSearch===!0&&(f.excludeFromSearch=!0),f.type=n,c.rbac!==void 0&&(f.rbac=c.rbac);let p=V.withArgs(c,{stableKey:`api-docs:render:${r}`}),m=K.withArgs(c,{stableKey:`api-docs:sidebar:${r}`}),h=v(r);return{routes:[{deps:{[ie]:p},metadata:f,routeId:`page`,sidebarSubtree:m,slug:null,slugHint:h,template:A,wildcardPrefix:!0}],entities:[u,p,m]}}},loaders:[H,V,K],templates:{[A]:r(n(`./client/template.tsx`,import.meta.url))},server:{routes:[Q(j.bundle,`bundle`),Q(j.deprecatedBundle,`bundle`),Q(j.graphql,`graphql`)]}});function Q(e,t){return{method:`GET`,path:e+se,handler:{filePath:`./server/spec-download.ts`,importer:import.meta.url,exportName:t}}}async function $(e,t){if(t)try{return await e.load(k(t))}catch{return}}export{Pe as apiDocsContentPlugin};
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { createConfig as CreateConfigFn } from '@redocly/openapi-core';
|
|
2
|
+
import { type MarkdownUsageSink, type PendingMarkdownResolution } from './markdown-decorator.js';
|
|
2
3
|
import type { MarkdownService } from '../../../../markdown/types/service.js';
|
|
3
4
|
import type { MarkdocResolverContextBase } from '../../../../markdown/resolve/markdoc.js';
|
|
4
5
|
import { type ApiSpecType } from '../../../types/api-entity.js';
|
|
5
6
|
import type { JsonObject } from '../../../../database/schema.js';
|
|
6
|
-
import {
|
|
7
|
+
import type { ProblemDraft } from '../../../../problems/types.js';
|
|
8
|
+
import type { ContentPluginIO } from '../../../types/io.js';
|
|
9
|
+
import { type RbacAnnotationOptions } from '../../../../../shared/rbac/api-docs.js';
|
|
7
10
|
/**
|
|
8
11
|
* Context for resolving markdown descriptions in an OpenAPI/AsyncAPI bundle. `markdown`
|
|
9
12
|
* carries state + slug resolution; `loader` is the render loader's context, without which
|
|
@@ -35,12 +38,20 @@ export type BundledApiDefinition = {
|
|
|
35
38
|
relativePath: string;
|
|
36
39
|
options: Record<string, unknown>;
|
|
37
40
|
/**
|
|
38
|
-
* Content-relative paths of external `$ref` files (transitively)
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
* `[]` for graphql (no
|
|
41
|
+
* Content-relative paths of external `$ref` files (transitively), and of the file each
|
|
42
|
+
* schema catalog link names, also when that file does not exist. Registered as `file`
|
|
43
|
+
* invalidation deps so edits re-materialize the spec. Excludes the root spec (tracked as
|
|
44
|
+
* the origin dep) and any ref outside the content root. Always `[]` for graphql (no
|
|
45
|
+
* external ref resolution). For grpc: every path the parser read or looked for an import
|
|
46
|
+
* at, so a file that appears there rebuilds the API.
|
|
42
47
|
*/
|
|
43
48
|
fileDependencies: string[];
|
|
49
|
+
/**
|
|
50
|
+
* The errors of the bundle, such as a `$ref` that does not resolve, at the referencing file
|
|
51
|
+
* and line when it is in the content root, else at the spec. Always `[]` for graphql. For grpc:
|
|
52
|
+
* each missing import, at the importing file.
|
|
53
|
+
*/
|
|
54
|
+
problems: ProblemDraft[];
|
|
44
55
|
};
|
|
45
56
|
export declare function buildBundledApiDefinition(input: {
|
|
46
57
|
/** An Arazzo bundle has every `$ref` resolved inline. */
|
|
@@ -63,7 +74,7 @@ export declare function buildBundledApiDefinition(input: {
|
|
|
63
74
|
pagePath?: string;
|
|
64
75
|
/**
|
|
65
76
|
* When present, copies each node's `x-rbac` onto the upstream `REDOCLY_TEAMS_RBAC` key
|
|
66
|
-
* (see `src/
|
|
77
|
+
* (see `src/shared/rbac/api-docs.ts`) so `buildItems`/`buildNavItems` apply tag-to-operation
|
|
67
78
|
* inheritance and `$ref` propagation. GraphQL does not use `x-rbac`.
|
|
68
79
|
*/
|
|
69
80
|
rbac?: RbacAnnotationOptions;
|
|
@@ -74,13 +85,16 @@ export declare function buildBundledApiDefinition(input: {
|
|
|
74
85
|
* description. Ignored for graphql.
|
|
75
86
|
*/
|
|
76
87
|
metadata?: Record<string, unknown>;
|
|
88
|
+
/** The loader's file access, with absolute paths; required for grpc, which reads imports through it. */
|
|
89
|
+
io?: Pick<ContentPluginIO, 'exists' | 'readFile'>;
|
|
77
90
|
}): Promise<BundledApiDefinition>;
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
91
|
+
export declare function createBundleConfig(createConfig: typeof CreateConfigFn, options: {
|
|
92
|
+
bundle: ApiBundleInput;
|
|
93
|
+
specRelativePath: string;
|
|
94
|
+
rootDir: string;
|
|
95
|
+
resolution: ApiDocsMarkdownResolution | undefined;
|
|
96
|
+
}): Promise<import("@redocly/openapi-core").Config>;
|
|
97
|
+
/** Copies of the root servers and security schemes with their descriptions resolved to Markdoc ASTs. */
|
|
84
98
|
export type LlmsDescriptions = {
|
|
85
99
|
servers?: unknown[] | Record<string, unknown>;
|
|
86
100
|
securitySchemes?: Record<string, unknown>;
|
|
@@ -90,3 +104,4 @@ export declare function resolveLlmsDescriptions(document: unknown, resolution: A
|
|
|
90
104
|
specPath: string;
|
|
91
105
|
pagePath: string;
|
|
92
106
|
}): Promise<LlmsDescriptions>;
|
|
107
|
+
export declare function resolvePendingMarkdown(resolution: ApiDocsMarkdownResolution, pendingList: readonly PendingMarkdownResolution[], contentDir: string, pagePath: string): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isObject as e}from"../../../../../shared/utils/is-object.js";import{toContainedContentPath as t}from"../../../../ingest/scan.js";import{
|
|
1
|
+
import{isObject as e}from"../../../../../shared/utils/is-object.js";import{toContainedContentPath as t}from"../../../../ingest/scan.js";import{ProblemError as n}from"../../../../problems/problem-error.js";import{SPEC_KIND_ARAZZO as r,SPEC_KIND_GRPC as i}from"../../../../../shared/constants/api-spec-kinds.js";import{annotateApiDocsRbac as a}from"../../../../../shared/rbac/api-docs.js";import{resolveMarkdownAst as o}from"../../../../markdown/resolve/ast.js";import{PLAIN_DESCRIPTION_SOURCE as s,REALM_MARKDOWN_DECORATOR_KEY as c,REALM_MARKDOWN_DECORATOR_NAME as l,createMarkdownDecoratorPlugin as u}from"./markdown-decorator.js";import{captureSnippet as d,splitSourceLines as f}from"../../../../../shared/utils/capture-snippet.js";import{existsSync as p}from"node:fs";import{join as m}from"node:path";async function h(e){if(e.kind===`grpc`){let{io:t}=e;if(t===void 0)throw Error(`A gRPC definition reads its imports through the loader io.`);return x({...e,io:t})}if(e.kind===`graphql`){let{parse:t}=await import(`graphql`),n;try{n=t(e.source)}catch(t){throw C(e.relativePath,t)}return{type:`graphql`,document:n,relativePath:e.relativePath,options:e.options??{},fileDependencies:[],problems:[]}}let{BaseResolver:t,bundleFromString:n,createConfig:i,getLineColLocation:o}=await import(`@redocly/openapi-core`),s=await w(i,{bundle:e.bundle??{config:{},configDir:``,plugins:[]},specRelativePath:e.relativePath,rootDir:e.contentDir,resolution:e.markdownResolution}),c=y(t,s.resolve,e.contentDir),l;try{l=await n({source:e.source,absoluteRef:m(e.contentDir,e.relativePath),config:s,externalRefResolver:c,dereference:e.kind===r})}catch(t){throw C(e.relativePath,t)}let u=l.bundle.parsed,d=O([...l.fileDependencies,...c.catalogLinkPaths],e.contentDir),f=b(l.problems,o,{contentDir:e.contentDir,specRelativePath:e.relativePath});e.markdownResolution&&await E(e.markdownResolution,e.markdownResolution.sink.pending,e.contentDir,e.pagePath??e.relativePath);let p;try{p=await g(e.kind,u)}catch(t){throw C(e.relativePath,t)}let h=_(p,e.metadata);return{type:e.kind,document:e.rbac?a(h,e.kind,e.rbac):h,relativePath:e.relativePath,options:e.options??{},fileDependencies:d,problems:f}}async function g(e,t){if(typeof t!=`object`||!t||Array.isArray(t))return t;let n=t;if(e===`openapi`&&n.swagger!==void 0){let{convertSwaggerToOpenApi:e}=await import(`@redocly/api-docs/server`);return e(n)}if(e===`asyncapi`){let{normalizeAsyncApiDefinition:e}=await import(`@redocly/api-docs/server`);return e(n)}return t}function _(t,n){if(n===void 0||!e(t))return t;let r=e(t.info)?t.info:{},i=e(r[`x-metadata`])?r[`x-metadata`]:{};return{...t,info:{...r,"x-metadata":{...i,...n}}}}const v=/^https?:\/\/.*\/_bundle\/(.*\.(?:ya?ml|json))$/u;function y(e,n,r){class i extends e{catalogLinkPaths=/* @__PURE__ */ new Set;resolveExternalRef(e,n){let i=super.resolveExternalRef(e,n),a=v.exec(i)?.[1];if(a===void 0)return i;let o=m(r,a);return t(r,o)===null?i:(this.catalogLinkPaths.add(o),p(o)?o:i)}}return new i(n)}function b(e,n,r){return e.filter(e=>e.severity===`error`&&e.ignored!==!0).map(e=>{let i=e.message.replaceAll(`${r.contentDir}/`,``),a=e.location[0],o=a?.source?t(r.contentDir,a.source.absoluteRef):null;if(a===void 0||o===null)return{code:`spec/bundle-error`,message:i,location:{filePath:r.specRelativePath}};let{start:s,end:c}=n(a),l={start:{line:s.line,character:s.col},...c?{end:{line:c.line,character:c.col}}:{}};return{code:`spec/bundle-error`,message:i,location:{filePath:o,range:l,snippet:d(f(a.source.body),l)}}})}async function x(e){let{parseProto:t}=await import(`@redocly/api-docs/server`),r=/* @__PURE__ */ new Set,a=[],o;try{o=await t({entry:e.relativePath,importPaths:[``],read:async t=>{if(t===e.relativePath)return e.source;r.add(t);let n=m(e.contentDir,t);return await e.io.exists(n)?e.io.readFile(n):void 0},onMissingImport:({file:e,message:t})=>{a.push({code:`spec/bundle-error`,message:t,location:{filePath:e}})}})}catch(t){let r=t instanceof Error&&`file`in t?t.file:void 0,i=typeof r==`string`?r:e.relativePath;throw a.length===0?C(i,t):new n({code:`spec/bundle-error`,message:`${a.map(e=>e.message).join(` `)} ${S(t)}`,location:{filePath:i}})}return{type:i,document:o,relativePath:e.relativePath,options:e.options??{},fileDependencies:[...r].sort(),problems:a}}function S(e){return e instanceof Error?e.message:String(e)}function C(e,t){let r=S(t);return new n({code:`spec/parse-failed`,message:r,location:{filePath:e}})}function w(e,n){let{bundle:r,resolution:i}=n,a=m(n.rootDir,r.configDir,`redocly.yaml`),o={configPath:m(a,`redocly.yaml`)},s=async(t,n)=>{let r=await e(t,n);return r.configPath=a,r},d=r.plugins.map(({plugin:e,path:t})=>({...e,absolutePath:t}));if(i===void 0)return s({...r.config,plugins:d},o);let{sink:f}=i,p=u({specSourcePath:n.specRelativePath,sink:f,toContentRelative:e=>t(n.rootDir,e)});return s({...r.config,plugins:[...d,p],decorators:{...r.config.decorators,[c]:`on`,[l]:`on`}},o)}async function T(t,n,r){if(!e(t))return{};let i=[],a=(t,n)=>{if(!e(t)||!e(n))return;let a=n[s];i.push({read:()=>t.description,sourceFilePath:typeof a==`string`?a:r.specPath,writeBack:e=>{t.description=e}})},o={},c=t.servers;if(Array.isArray(c)||e(c)){o.servers=structuredClone(c);for(let[e,t]of Object.entries(c))a(o.servers[e],t)}let l=e(t.components)?t.components:void 0;if(e(l?.securitySchemes)){let e=l.securitySchemes;o.securitySchemes=structuredClone(e);for(let[t,n]of Object.entries(e))a(o.securitySchemes[t],n)}return await E(n,i,r.contentDir,r.pagePath),o}async function E(e,t,n,r){let{markdown:i,sink:a}=e,s={...e.loader,contentDir:n,markdown:i};await Promise.all(t.map(async e=>{let t=e.read();if(typeof t!=`string`||!i.looksLikeMarkdown(t))return;let{ast:n,entityDeps:c,assetUsages:l,linkRefs:u,problems:d}=await o(t,e.sourceFilePath,{resolverContext:s});a.entityDeps.push(...c),a.assetUsages.push(...l);for(let t of u)t.raw.trim().startsWith(`#`)?a.linkRefs.push(D({...t,target:r})):e.sourceFilePath===r||t.filePath!==void 0?a.linkRefs.push(D(t)):a.linkRefs.push({...D(t),filePath:e.sourceFilePath});for(let e of d)a.problems.push({...e,location:{filePath:r}});e.writeBack(n)}))}function D(e){if(e.range===void 0)return e;let t={...e};return delete t.range,t}function O(e,n){let r=/* @__PURE__ */ new Set;for(let i of e){let e=t(n,i);e!==null&&r.add(e)}return[...r].sort()}export{h as buildBundledApiDefinition,w as createBundleConfig,T as resolveLlmsDescriptions,E as resolvePendingMarkdown};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isRbacScope as e}from"../../../../../
|
|
1
|
+
import{isRbacScope as e}from"../../../../../shared/rbac/engine.js";import{REDOCLY_TEAMS_RBAC as t}from"@redocly/config";function n(e){return e.map(o)}function r(e){let t=/* @__PURE__ */ new Set,n=e=>{for(let r of e){let e=i(r.slugSuffix??``);e!==``&&t.add(e),r.items&&r.items.length>0&&n(r.items)}};return n(e),[...t]}function i(e){return e.replace(/^\/+/,``)}function a(e){return e===``||e.startsWith(`/`)?e:`/${e}`}function o(n){let r={};n.label!==void 0&&(r.label=n.label),n.link!==void 0&&(r.slugSuffix=a(n.link)),n.httpVerb!==void 0&&(r.httpVerb=n.httpVerb),n.deprecated!==void 0&&(r.deprecated=n.deprecated),n.badges!==void 0&&(r.badges=n.badges),n.external!==void 0&&(r.external=n.external),n.separatorLine!==void 0&&(r.separatorLine=n.separatorLine),n.icon!==void 0&&(r.icon=n.icon),n.variant!==void 0&&(r.variant=n.variant);let i=n[t];return e(i)&&(r[t]=i),(n.type===`link`||n.type===`group`||n.type===`separator`)&&(r.type=n.type),n.items&&n.items.length>0&&(r.items=n.items.map(o)),r}export{r as collectSidebarSubpathTargets,n as toSidebarSubtree,i as toSubpathTarget};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
const e=/\bservice\s+[A-Za-z_]\w*\s*\{/u;function t(t){return e.test(n(t))}function n(e){let t=``,n=0;for(;n<e.length;){let i=e[n],a=e[n+1];if(i===`/`&&a===`/`){let t=e.indexOf(`
|
|
2
|
+
`,n);n=t===-1?e.length:t}else if(i===`/`&&a===`*`){let r=e.indexOf(`*/`,n+2);n=r===-1?e.length:r+2,t+=` `}else i===`"`||i===`'`?(n=r(e,n),t+=` `):(t+=i,n+=1)}return t}function r(e,t){let n=e[t],r=t+1;for(;r<e.length&&e[r]!==n&&e[r]!==`
|
|
3
|
+
`;)r+=e[r]===`\\`?2:1;return r+1}export{t as declaresProtoService};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { MarkdownDoc } from '../../../../loaders/define.js';
|
|
2
|
+
import { type MarkdownRenderOptions } from '../../../../markdown/search/to-markdown.js';
|
|
3
|
+
import { type ApiDocsRenderPayload } from './shared.js';
|
|
4
|
+
/** A page's slice longer than this many characters is left out; the copy still links the download. */
|
|
5
|
+
export declare const MAX_MARKDOWN_SLICE_LENGTH = 1000000;
|
|
6
|
+
export type ApiDocsMarkdownCopyOptions = {
|
|
7
|
+
/** The content-relative path of the API description, which the download route serves. */
|
|
8
|
+
originFilePath: string | undefined;
|
|
9
|
+
/** The tag set the descriptions were parsed with, and the page locale. */
|
|
10
|
+
markdown: MarkdownRenderOptions;
|
|
11
|
+
warn: (message: string) => void;
|
|
12
|
+
};
|
|
13
|
+
/** One Markdown doc per page. Built once for all viewers: anything anonymous can't read is left out, and the page's `x-rbac` goes to `rbacScope`. */
|
|
14
|
+
export declare function buildApiDocsMarkdownCopies(payload: ApiDocsRenderPayload, document: unknown, options: ApiDocsMarkdownCopyOptions): Promise<MarkdownDoc[]>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import{isObject as e}from"../../../../../shared/utils/is-object.js";import{headingSlugger as t}from"../../../../markdown/utils/heading-slugger.js";import{RBAC_TEAM_ANONYMOUS as n}from"../../../../../shared/rbac/types.js";import{canView as r,isRbacScope as i,resolveRole as a}from"../../../../../shared/rbac/engine.js";import{filterRbacAnnotatedDocument as o,withoutRemovedRequired as s}from"../../../../../shared/rbac/filter.js";import{parseMarkdownCached as c}from"../../../../markdown/utils/parse-cache.js";import{SPEC_DOWNLOAD_ROUTE_PATHS as l}from"./shared.js";import{annotateApiDocsRbac as u}from"../../../../../shared/rbac/api-docs.js";import{markdocAstToMarkdownChunks as d}from"../../../../markdown/search/to-markdown.js";import{isMarkdocAstNode as f}from"../../../../markdown/server/render.js";import{REDOCLY_TEAMS_RBAC as p}from"@redocly/config";import{JsonPointer as m,buildSpecSlice as h,describeSliceTarget as g,resolveSpecSliceScope as _,sliceCopyIntro as v,wrapSliceForCopy as y}from"@redocly/api-docs/server";const b=1e6;async function x(t,n,r){let i=S(r.markdown),{slice:a,readable:o}=await C(t,n,i,r.warn),s=e(n)&&e(n.info)?n.info:{},c=e(s[`x-metadata`])?s[`x-metadata`]:{},l=typeof s.title==`string`&&s.title!==``?s.title:t.title,u=i(typeof c.description==`string`?c.description:s.description).join(`
|
|
2
|
+
|
|
3
|
+
`),d=T(t.specType,r.originFilePath),f=t.items,p=/* @__PURE__ */ new Map,m=e=>{typeof e.link==`string`&&!p.has(e.link)&&H(e)&&p.set(e.link,U(e));for(let t of e.items??[])m(t)};for(let e of f)m(e);let h=/* @__PURE__ */ new Map,v=e=>{let n=_(t.specType,e.content,e.label);n?.kind===`graphql-type`&&typeof e.link==`string`&&h.set(n.name,e.link);for(let t of e.items??[])v(t)};if(t.specType===`graphql`)for(let e of f)v(e);let y=[],b=/* @__PURE__ */ new Set,x=async e=>{let r=e.content?.contentType,c=e.link;if(typeof c==`string`&&r!==void 0&&!b.has(c)){b.add(c);let m=r===`overview`,v=p.has(c)?p.get(c):U(e),x=m?l:e.label??``,S={specType:t.specType,document:n,renderMarkdown:i},C=r===`item`?_(t.specType,e.content,e.label):void 0,T=C===void 0?void 0:await a(C,p.has(c)),O;if(m)O=D({...S,title:x,description:u,info:s,readable:o,download:d,items:f});else if(C!==void 0&&T!==void 0){let e=w(T,{scope:C,title:x,target:g(C,n),specUrl:d,contentKind:t.specType===`graphql`?`graphql`:`yaml`}),r=t.specType===`graphql`?await E(T,h):``;O=[r===``?e:`${e}\n\n${r}`]}else O=[x===``?``:`# ${x}`,...V(e.content?.children??[],i),M(e.items??[],`##`,S)].filter(e=>e!==``);y.push({routeSlug:c,chunks:O,headings:G(O),title:x,description:m?u:void 0,rbacScope:v})}for(let t of e.items??[])await x(t)};for(let e of f)await x(e);return y}function S(e){let t=t=>{let n=W(t)?t:{type:`document`,children:Array.isArray(t)?t:[t]};return d(n,e)};return e=>{if(e==null)return[];if(typeof e!=`string`)return t(e);if(!e.includes(`{%`)){let t=e.trim();return t===``?[]:[t]}return t(c(e))}}async function C(e,t,n,r){let i=e.specType,a=e=>n(e).join(`
|
|
4
|
+
|
|
5
|
+
`);if(i===`graphql`){let e=typeof t==`string`?await B(t,a):void 0;return{slice:t=>h(i,e,t,{maxRefDepth:0}),readable:void 0}}let o=(e,t)=>h(i,e,t,{maxRefDepth:3}),s=z(t,a),c=u(s,e.specType,{warn:r});if(c===s)return{slice:e=>o(s,e),readable:s};let l=N(c);return{slice:(e,t)=>o(t?l:N(R(c,L(e,c))),e),readable:l}}function w(e,t){return e.length<=1e6?y(e,t).trimEnd():`${v(t)}\n\nThe subset is longer than ${b} characters, so it is not included.`}function T(e,t){if(t!==void 0)return`${e===`graphql`?l.graphql:l.bundle}/${t}`}async function E(e,t){let{parse:n,visit:r}=await import(`graphql`),i=n(e,{noLocation:!0}),a=new Set(i.definitions.map(e=>`name`in e?e.name?.value:``)),o=/* @__PURE__ */ new Set;r(i,{NamedType(e){o.add(e.name.value)}});let s=[...o].filter(e=>!a.has(e)&&t.has(e)).map(e=>`- [${e}](${t.get(e)}.md)`);return s.length===0?``:`Types:\n\n${s.join(`
|
|
6
|
+
`)}`}function D(t){let{info:n}=t,r=[`# ${t.title}`,t.description];typeof n.summary==`string`&&r.push(n.summary);let i=[];n.version!==void 0&&n.version!==``&&i.push(`Version: ${String(n.version)}`);let a=e(n.license)?n.license:void 0;typeof a?.name==`string`&&i.push(`License: ${a.name}`);let o=e(n[`x-metadata`])?n[`x-metadata`]:{},s=Object.entries(o).filter(([,e])=>typeof e==`string`||typeof e==`number`).filter(([e,t])=>e!==`description`||typeof t!=`string`).map(([e,t])=>`- ${e}: ${String(t)}`);s.length>0&&i.push(`Metadata:\n${s.join(`
|
|
7
|
+
`)}`),r.push(i.join(`
|
|
8
|
+
`));let c=e(t.readable)?t.readable:{},l=O[t.specType]??`API description`;return[r.filter(e=>e!==``).join(`
|
|
9
|
+
|
|
10
|
+
`),k(c.servers,t.renderMarkdown),A(c.components,t.renderMarkdown),t.download===void 0?``:`## Download ${l}\n\n[${t.title}](${t.download})`,M(t.items,`##`,t)].filter(e=>e!==``)}const O={openapi:`OpenAPI description`,asyncapi:`AsyncAPI description`,graphql:`GraphQL schema`};function k(t,n){if(!Array.isArray(t)||t.length===0)return``;let r=`## Servers
|
|
11
|
+
|
|
12
|
+
`;for(let i of t){if(!e(i))continue;let t=n(i.description).join(`
|
|
13
|
+
|
|
14
|
+
`);if(t&&(r+=`${t}\n`),r+=`\`\`\`\n${String(i.url??``)}\n\`\`\`\n\n`,e(i.variables)){r+=`Variables:
|
|
15
|
+
`;for(let[t,a]of Object.entries(i.variables)){if(!e(a))continue;let i=n(a.description).join(` `).replace(/\s+/g,` `);r+=`- \`${t}\`${i?`: ${i}`:``}\n`,a.default!==void 0&&(r+=` Default: ${JSON.stringify(a.default)}\n`),Array.isArray(a.enum)&&(r+=` Enum: ${a.enum.map(e=>JSON.stringify(e)).join(`, `)}\n`)}r+=`
|
|
16
|
+
`}}return r.trim()}function A(t,n){let r=e(t)&&e(t.securitySchemes)?t.securitySchemes:void 0;if(r===void 0)return``;let i=`## Security
|
|
17
|
+
|
|
18
|
+
`;for(let[t,a]of Object.entries(r)){if(!e(a)||`$ref`in a)continue;i+=`### ${t}\n\n`;let r=n(a.description).join(`
|
|
19
|
+
|
|
20
|
+
`);r&&(i+=`${r}\n\n`);for(let[e,t]of j)typeof a[t]==`string`&&a[t]&&(i+=`${e}: ${a[t]}\n`);let o=e(a.flows)?a.flows:{},s=[o.implicit,o.password,o.clientCredentials,o.authorizationCode].find(e);if(s!==void 0&&(typeof s.authorizationUrl==`string`&&(i+=`Authorization URL: ${s.authorizationUrl}\n`),typeof s.tokenUrl==`string`&&(i+=`Token URL: ${s.tokenUrl}\n`),e(s.scopes))){i+=`Scopes:
|
|
21
|
+
`;for(let[e,t]of Object.entries(s.scopes))i+=`- \`${e}\`: ${String(t)}\n`}i+=`
|
|
22
|
+
`}return i.trim()}const j=[[`Type`,`type`],[`In`,`in`],[`Name`,`name`],[`Scheme`,`scheme`],[`Bearer Format`,`bearerFormat`],[`OpenID Connect URL`,`openIdConnectUrl`]];function M(e,t,n){let r=``;for(let i of e)if(H(i)){if(i.content?.contentType===`group`){r+=`${t} ${i.label??``}\n\n`;let e=M(i.items??[],`${t}#`,n);e!==``&&(r+=`${e}\n\n`)}else if(i.content?.contentType===`item`&&typeof i.link==`string`){let e=_(n.specType,i.content,i.label),t=(e===void 0?void 0:g(e,n.document))??i.label??``,a=V(i.content.children??[],n.renderMarkdown).join(` `).replace(/\s+/g,` `).trim();r+=`- [${t}](${i.link}.md)${a?`: ${a.slice(0,200)}`:``}\n`}}return r.trim()}function N(e){return F(o(e,[n]),e)}const P=Symbol(`removed`);function F(t,n){let r=/* @__PURE__ */ new Map,i=a=>{let o=r.get(a);if(o!==void 0)return o;let s=I(t,a),c=s===void 0?I(n,a)!==void 0:e(s)&&typeof s.$ref==`string`&&i(s.$ref);return r.set(a,c),c},a=t=>{if(Array.isArray(t))return t.map(a).filter(e=>e!==P);if(!e(t))return t;if(typeof t.$ref==`string`&&i(t.$ref))return P;let n={};for(let[e,r]of Object.entries(t)){let t=a(r);t!==P&&(n[e]=t)}return s(t,n)},o=a(t);return o===P?void 0:o}function I(t,n){if(!n.startsWith(`#/`))return;let r=t;for(let t of m.parse(n)){if(!(e(r)||Array.isArray(r))||!Object.hasOwn(r,t))return;r=r[t]}return r}function L(t,n){switch(t.kind){case`operation`:{let r=e(n)&&n[`x-webhooks`]?`x-webhooks`:`webhooks`;return[t.source===`webhooks`?r:`paths`,t.pathName,t.httpVerb]}case`schema`:return[`components`,`schemas`,t.name];case`channel`:return[`channels`,t.channelId];case`async-operation`:return[`operations`,t.operationId];default:return[]}}function R(t,n){let[r,...i]=n;if(r===void 0){if(!e(t))return t;let n={...t};return delete n[p],n}return!e(t)||!Object.hasOwn(t,r)?t:{...t,[r]:R(t[r],i)}}function z(t,n,r=!1){if(Array.isArray(t)){let e=t.map(e=>z(e,n));return e.some((e,n)=>e!==t[n])?e:t}if(!e(t))return t;let i;for(let[e,a]of Object.entries(t)){let o=(r||e===`description`||e===`summary`||e===`x-summary`)&&(typeof a==`string`?a.includes(`{%`):f(a))?n(a):z(a,n,e===`x-enumDescriptions`);o!==a&&((i??={...t})[e]=o)}return i??t}async function B(e,t){if(!e.includes(`{%`))return e;let{parse:n,print:r,visit:i}=await import(`graphql`);return r(i(n(e,{noLocation:!0}),{enter(e){let n=`description`in e?e.description:void 0;if(n?.value.includes(`{%`))return{...e,description:{...n,value:t(n.value)}}}}))}function V(e,t){let n=[],r=e=>{if(H(e)){if(e.nodeType===`markdoc`){n.push(...t(e.content));return}if(e.nodeType===`container`)for(let t of e.children??[])r(t)}};for(let t of e)r(t);return n}function H(e){let t=U(e);return t===void 0||r(a(t,[`anonymous`]))}function U(e){let t=e[p];if(t!==void 0)return i(t)?t:{}}function W(t){return e(t)&&t.type===`document`}function G(e){return t.reset(),e.map(e=>{let n=/^#{1,6} +(?! )(.+)$/.exec(e.split(`
|
|
23
|
+
`,1)[0]??``);if(!n)return null;let r=n[1].trim();return{heading:r,anchor:t.slug(r)}})}export{b as MAX_MARKDOWN_SLICE_LENGTH,x as buildApiDocsMarkdownCopies};
|
|
@@ -25,10 +25,7 @@ export type MarkdownUsageSink = {
|
|
|
25
25
|
/** Filled during the sync bundle walk; drained by the async post-bundle pass. */
|
|
26
26
|
pending: PendingMarkdownResolution[];
|
|
27
27
|
};
|
|
28
|
-
/**
|
|
29
|
-
* Key of the content-relative source file on each bundled server, server variable and security
|
|
30
|
-
* scheme node, whose `description` stays a plain string. Spread copies keep it; JSON drops it.
|
|
31
|
-
*/
|
|
28
|
+
/** Key of the content-relative source file on each bundled server and security scheme node. */
|
|
32
29
|
export declare const PLAIN_DESCRIPTION_SOURCE: unique symbol;
|
|
33
30
|
/** The unprefixed decorator name as registered on the plugin. openapi-core namespaces
|
|
34
31
|
* plugin decorators as `<pluginId>/<name>` when it normalizes plugins (`resolvePlugins`),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=Symbol(`plainDescriptionSource`),t=`realm-internal`,n=`resolve-markdown`,r=`${t}/${n}`,i=[`description`];function
|
|
1
|
+
const e=Symbol(`plainDescriptionSource`),t=`realm-internal`,n=`resolve-markdown`,r=`${t}/${n}`,i=[`description`],a=/* @__PURE__ */ new Set([`Server`,`SecurityScheme`]);function o(r){let o=e=>{let t=s(e);return(t===void 0?null:r.toContentRelative(t))??r.specSourcePath},c=(e,t)=>{if(typeof e!=`object`||!e)return;let n=e,a=o(t);for(let e of i)r.sink.pending.push({read:()=>n[e],sourceFilePath:a,writeBack:t=>{n[e]=t}});let s=n[`x-enumDescriptions`];if(s&&typeof s==`object`){let e=s;for(let t of Object.keys(e))r.sink.pending.push({read:()=>e[t],sourceFilePath:a,writeBack:n=>{e[t]=n}})}},l=(t,n)=>{typeof t==`object`&&t&&(t[e]=o(n))},u=(e,t)=>{let n=t.type?.name;typeof e.description==`string`&&(n!==void 0&&a.has(n)||c(e,t))},d=()=>({ref:{enter:u},Server:{enter:l},SecurityScheme:{enter:l},ServerVariable:{enter:c},Example:{enter:c},Info:{enter:c},Tag:{enter:c},Operation:{enter:c},Parameter:{enter:c},Schema:{enter:c},Response:{enter:c},Header:{enter:c},RequestBody:{enter:c}});return{id:t,decorators:{oas3:{[n]:d},oas2:{[n]:d},async2:{[n]:d},async3:{[n]:d}}}}function s(e){let t=(e?.location)?.source?.absoluteRef;return typeof t==`string`?t:void 0}export{e as PLAIN_DESCRIPTION_SOURCE,r as REALM_MARKDOWN_DECORATOR_KEY,n as REALM_MARKDOWN_DECORATOR_NAME,o as createMarkdownDecoratorPlugin};
|
|
@@ -39,8 +39,10 @@ export declare function resolveNestedFeedback(io: Pick<PluginIO, 'readFile'>, co
|
|
|
39
39
|
*/
|
|
40
40
|
export declare function withMockServerOption(options: Record<string, unknown>, config: Pick<RealmConfig, 'mockServer' | 'planGates'>, routeSlug: string | undefined): Record<string, unknown>;
|
|
41
41
|
/**
|
|
42
|
-
* The api-docs `downloadUrls`
|
|
43
|
-
* `sourcePath`, path-prefixed, unless the per-API
|
|
42
|
+
* The api-docs `downloadUrls` and `replayDefinitionUrl` options. `downloadUrls` is the spec
|
|
43
|
+
* download routes (`server/spec-download.ts`) for `sourcePath`, path-prefixed, unless the per-API
|
|
44
|
+
* config sets its own list. `replayDefinitionUrl` is always the first of those routes, so Try it
|
|
45
|
+
* loads the description from this site even when the configured list points to another origin.
|
|
44
46
|
*/
|
|
45
47
|
export declare function withDownloadUrls(options: Record<string, unknown>, sourcePath: string, kind: ApiSpecType): Record<string, unknown>;
|
|
46
48
|
/** The `x-schema-catalog-link` value: the bundle route for `sourcePath` (`showSchemaCatalogLinks`). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{isPlanFeatureGranted as e}from"../../../../../shared/plan-gates.js";import{toPosixPath as t}from"../../../../../shared/utils/to-posix-path.js";import{isObject as n}from"../../../../../shared/utils/is-object.js";import{isMissingError as r}from"../../../../../shared/utils/is-missing-error.js";import{NESTED_CONFIG_FILENAME as i,deepMergeConfig as a,parseNestedConfig as o}from"../../../../config.js";import{contentIgnoreMatcherOf as s}from"../../../../ingest/scan.js";import{SPEC_KIND_GRAPHQL as c}from"../../../../../shared/constants/api-spec-kinds.js";import{MOCK_SERVER_ROUTE_PREFIX as l,mockPathPrefix as u}from"../../../types/api-entity.js";import{withPathPrefix as d}from"../../../../../shared/path-prefix.js";import{SPEC_DOWNLOAD_ROUTE_PATHS as f}from"./shared.js";import{posix as p}from"node:path";import{FEEDBACK_TYPES as m}from"@redocly/theme/core/constants";import{decoratorTypes as h,preprocessorTypes as g}from"@redocly/config";const _=[`openapi`,`asyncapi`,`graphql`];function v(e,t,n){let r=O(t),i=Object.values(e.apis??{}),a=e=>O(p.join(n,e))===r;return i.find(e=>e.output!==void 0&&a(e.output))??i.find(e=>e.output===void 0&&a(e.root))}function y(e,t,n=``){let r=v(e,t,n);if(!r)return{};let i={};r.metadata&&(i.metadata=r.metadata);for(let e of _)r[e]&&typeof r[e]==`object`&&Object.assign(i,r[e]);return r.rbac!==void 0&&(i.rbac=r.rbac),i}async function b(e,t,n,r,i=n){let o=T(t,r),c=await w(e,i,s(t));return c===null?a(o,y(t,n)):a(a(o,E(c.config,r)),y(c.config,n,c.dir))}const x=[...h,...g];async function S(e,t,r,i=r){let o=await w(e,i,s(t)),c=o===null?[t,v(t,r,``)]:[t,o.config,v(o.config,r,o.dir)],l={};for(let e of c){if(!n(e))continue;let t={};for(let r of x)n(e[r])&&(t[r]=e[r]);l=a(l,t)}return{config:l,configDir:o?.dir??``}}async function C(e,t,n){return(await w(e,n,s(t)))?.config.feedback}async function w(e,t,n){for(let r=p.dirname(t);r!==`.`&&r!==`/`;r=p.dirname(r)){let t=p.join(r,i);if(n(t))continue;let a=await D(e,t);if(a!==null)return{config:a,dir:r}}return null}function T(e,t){return t===`arazzo`||t===`grpc`?{}:e[t]??{}}function E(e,t){let n={...T(e,t)};return e.mockServer&&(n.mockServer=e.mockServer),n}async function D(e,t){let n;try{n=await e.readFile(t)}catch(e){if(r(e))return null;throw e}return o(n,t).config}function O(e){return p.normalize(t(e)).replace(/^\.\/+/,``).replace(/^\/+/,``)}function k(t,r,i){let a=n(t.mockServer)?t.mockServer:{},o={...r.mockServer,...a};if(i===void 0||o.off===!0||!e(r,`mockServer`))return t;let s=d(l+u(i));return{...t,mockServer:{url:s,position:`first`,description:`Mock server`,...o}}}function A(e,t,n){if(n===`grpc`)return e;let r=e=>e.split(`/`).map(encodeURIComponent).join(`/`),i=n===c,a=i?f.graphql:f.bundle,o=(i?[t]:[`.json`,`.yaml`].map(e=>t.replace(/\.[^./]+$/u,e))).map(e=>({url:d(`${a}/${r(e)}?download`),title:p.basename(e)}));return{...e,downloadUrls:Array.isArray(e.downloadUrls)?e.downloadUrls:o,replayDefinitionUrl:o[0]?.url}}function j(e){return d(`${f.bundle}/${e}`)}const M={[m.RATING]:`Rate this section`,[m.SENTIMENT]:`Was this section helpful?`,[m.MOOD]:`Was this section helpful?`,[m.COMMENT]:`Share your feedback about this section`,[m.SCALE]:`How would you rate this section?`};function N(e,t,r){let i=[n(t)?t[`x-feedback`]:void 0,e.feedback,r].find(n);if(i===void 0)return e;let a=n(i.settings)?i.settings:{},o=typeof i.type==`string`?M[i.type]:void 0,s=a.label||o||``;return{...e,feedback:{...i,settings:{...a,label:s}}}}export{y as readApiOptionsFromConfig,S as resolveApiBundleConfig,b as resolveApiOptions,C as resolveNestedFeedback,j as schemaCatalogLink,A as withDownloadUrls,N as withFeedbackOption,k as withMockServerOption};
|
|
@@ -4,7 +4,7 @@ export declare const API_DOCS_SEARCH_GROUP = "API Reference";
|
|
|
4
4
|
export type ApiDocsSearchDocumentOptions = {
|
|
5
5
|
/** The category of every document; `API Reference` by default. */
|
|
6
6
|
groupKey?: string;
|
|
7
|
-
/** Facet values every document carries. */
|
|
7
|
+
/** Facet values every document carries; an HTTP operation also carries its method and path. */
|
|
8
8
|
facets?: SearchDocumentFacets;
|
|
9
9
|
/** Receives the warnings of the `x-rbac` annotation; the render loader reported the same ones. */
|
|
10
10
|
warn?: (message: string) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{SEARCH_HTTP_METHOD_FACET_FIELD as e,SEARCH_HTTP_PATH_FACET_FIELD as t}from"../../../../../shared/search/facets.js";import{isRbacScope as n}from"../../../../../shared/rbac/engine.js";import{parseMarkdownCached as r}from"../../../../markdown/utils/parse-cache.js";import{markdocAstToText as i}from"../../../../markdown/search/to-text.js";import{annotateApiDocsRbac as a}from"../../../../../shared/rbac/api-docs.js";import{withImpliedDiscriminatorMappings as o}from"./implied-discriminators.js";import{createHash as s}from"node:crypto";import{REDOCLY_TEAMS_RBAC as c}from"@redocly/config";import{ApiDocsSearchIndexer as l,extractFullText as u,isOperationName as d}from"@redocly/api-docs/server";const f=`API Reference`;function p(e,t,n={}){let r=b(e.store)?e.store:{},i=a(t,e.specType,{warn:n.warn??(()=>{})}),s=o(i),c=new l(e.basePath,r.schemaStore,b(s)?s:void 0,{exampleStore:r.exampleStore,graphqlMeta:r.graphqlMeta,formatDescription:m}),u=e=>{for(let t of e)c.addItem(t),b(t)&&Array.isArray(t.items)&&u(t.items)};u(e.items);let d=[],f=/* @__PURE__ */ new Set,p=[],y=h(t),x=/* @__PURE__ */ new Map;return{docs:c.getResult().map(t=>{let r=(x.get(t.id)??0)+1;x.set(t.id,r);let i=r===1?t.id:`${t.id}#${r}`;for(let e of t.parameters??[]){let t=_(e),n=t.fragmentKey;f.has(n)||(f.add(n),d.push(t));let r={docKey:i,fragmentKey:n,place:e.place,anchor:v(e.deepLink)};e.path&&e.path.length>0&&(r.path=e.path),p.push(r)}let a=g(t,i,n);return y&&t.url===e.basePath&&(a.title=y),a}),fragments:d,uses:p}}const m=e=>typeof e==`string`&&e.includes(`{%`)?i(r(e)).replace(/\s+/g,` `):u(e);function h(e){let t=b(e)&&b(e.info)?e.info:{};if(typeof t.title!=`string`||t.title===``)return;let n=t.version;return typeof n==`string`&&n!==``||typeof n==`number`?`${t.title} (${n})`:t.title}function g(r,i,a){let o=r.httpPath?y(r.httpPath):void 0,s={...a.facets},l=r.isAdditionalOperation?r.httpMethod:r.httpMethod&&d(r.httpMethod)?r.httpMethod.toLowerCase():void 0;l&&(s[e]=l,o&&(s[t]=o));let u={docKey:i,routeSlug:r.url,title:y(r.title),text:y(r.text),groupKey:a.groupKey??`API Reference`,facets:s},f=r[c];return n(f)&&(u.rbacScope=f),r.httpMethod&&(u.httpMethod=r.httpMethod),o&&(u.httpPath=o),r.deprecated&&(u.deprecated=!0),r.isAdditionalOperation&&(u.isAdditionalOperation=!0),r.badges&&r.badges.length>0&&(u.badges=r.badges),u}function _(e){let t={name:y(e.name),description:y(e.description)};return e.example&&(t.example=e.example),e.enum&&e.enum.length>0&&(t.enum=e.enum),{fragmentKey:s(`sha1`).update(JSON.stringify([t.name,t.description,t.example??null,t.enum??null])).digest(`hex`),...t}}function v(e){if(!e)return``;let t=e.indexOf(`#`);return t>=0?e.slice(t+1):e}function y(e){return Array.isArray(e)?e.join(` `):e}function b(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}export{f as API_DOCS_SEARCH_GROUP,p as buildApiDocsSearchDocuments};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{filePathToRouteSlug as e}from"../../../../../shared/utils/routes/file-path-to-route-slug.js";import"
|
|
1
|
+
import{filePathToRouteSlug as e}from"../../../../../shared/utils/routes/file-path-to-route-slug.js";import"../../../../../shared/constants/api-spec-kinds.js";import{createApiEntityKey as t}from"../../../utils/api-entity-key.js";import{filterApiDocsByRbac as n}from"../../../../../shared/rbac/api-docs.js";import{EntityAccessDeniedError as r,notFoundResponse as i}from"../../../../../server/plugin-context.js";import{attachmentDisposition as a}from"../../../../../shared/utils/attachment-disposition.js";import{SPEC_DOWNLOAD_HANDLER_ID as o,withMockServerEvent as s}from"../../../../../server/telemetry/mock-server-events.js";import{posix as c}from"node:path";import l from"js-yaml";const u={"Cache-Control":`no-store`};function d(e){return e.replace(/\.[^./]+$/u,``)}async function f(e,t,n){let r=d(t);return(await e.entities.list({type:`api`})).find(({metadata:e})=>{let{sourcePath:t,specType:i}=e??{};return typeof t==`string`&&d(t)===r&&i!==`grpc`&&i===`graphql`===n})??null}async function p(n,a){let o=e(a);return await n.hasRoute(o)&&!n.isSlugVisible(o)?new r(t(a),n.request.teams).getResponse():i()}function m(e,t,n,r,i){let o=new URL(t.request.url).searchParams.has(`download`);return e.body(n,200,{...u,"Content-Type":r,...o?{"Content-Disposition":a(i)}:{}})}function h(e,t,n){return s({handler:o,request:e.req.raw,logger:t.logger},n)}function g(e,t){return h(e,t,()=>v(e,t))}function _(e,t){return h(e,t,()=>y(e,t))}async function v(e,t){let r=e.req.param(`api`)??``,i=await f(t,r,!1);if(!i)return p(t,r);let a=n(await t.entities.load(i.key),i.metadata?.specType,t.request.teams,{warn:e=>t.logger?.warn(e)}),o=/\.ya?ml$/u.test(r),s=d(c.basename(String(i.metadata?.sourcePath)))+(o?`.yaml`:`.json`);return o?m(e,t,l.dump(a,{noRefs:!0}),`application/yaml`,s):m(e,t,JSON.stringify(a,null,2),`application/json`,s)}async function y(e,t){let n=e.req.param(`api`)??``,r=await f(t,n,!0);if(!r)return p(t,n);let i=await t.entities.load(r.key),a=String(r.metadata?.sourcePath);return m(e,t,i,`application/graphql`,c.basename(a))}export{g as bundle,_ as graphql};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineContentPlugin as e}from"../../define.js";import{createInlineEntity as t}from"../../../loaders/define.js";import{
|
|
1
|
+
import{defineContentPlugin as e}from"../../define.js";import{createInlineEntity as t}from"../../../loaders/define.js";import{isPlanFeatureGranted as n}from"../../../../shared/plan-gates.js";import{API_FUNCTION_ENTITY_TYPE as r,apiFunctionEntityKey as i}from"./constants.js";import{notInPlanProblem as a}from"../../../plan-gates.js";import{parseApiFunctionRoute as o}from"./route-path.js";const s=`internal.api-functions`,c=/\.(ts|js)$/u,l=e({id:s,version:`1.1.0`,content:{filter:{match:e=>c.test(e)},extractFile(e,s){let c=o(e.path,s.config.apiFunctions?.folders??[]);if(!c)return null;if(!n(s.config,`apiFunctions`))return{routes:[],problems:[a(`API functions`)]};let l={...c,sourcePath:e.path};return{routes:[],entities:[t(l,{stableKey:i(e.path),type:r,metadata:l})]}}},server:{routes:[{path:`/*`,handler:{filePath:`./server/dispatch.ts`,importer:import.meta.url,exportName:`dispatch`}}]}});export{s as API_FUNCTIONS_PLUGIN_ID,l as apiFunctionsContentPlugin};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{canView as e,compileRouteAccessMatcher as t,
|
|
1
|
+
import{canView as e,compileRouteAccessMatcher as t,matchContentScope as n,resolveRbacDenialStatus as r,resolveRole as i}from"../../../../../shared/rbac/engine.js";const a=/* @__PURE__ */ new WeakMap;function o(e){let n=a.get(e);return n===void 0&&(n=t(e),a.set(e,n)),n}function s(t,a){let o=n(t,{filePath:a.sourcePath,slug:a.pathname});return e(i(o,a.teams))?{allow:!0}:{allow:!1,status:r(a.teams)}}export{s as resolveApiFunctionAccess,o as resolveRbacMatcher};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{sendServerEvent as e}from"../../../../../server/telemetry/sender.js";function t({sourcePath:t,status:n,failure:r},i){let a=r!==void 0,o={id:`apiFunctionId`,object:`apiFunction`,uri:`urn:redocly:realm:api:apiFunction:apiFunctionId`,handler:`api-functions:${t}`,status:n,message:a?r:null};return e({type:a?`com.redocly.apiFunction.error`:`com.redocly.apiFunction.called`,data:[o]},i)}export{t as sendApiFunctionEvent};
|