@redocly/framework 1.0.0-next.1 → 1.0.0-next.12
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/dependency-pack.js +1 -1
- 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/routes/source-sync-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-chunk-url.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/args.js +1 -1
- package/dist/cli/commands/build.js +1 -1
- package/dist/cli/commands/dev.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/problems-output.js +3 -3
- 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/ai-search/citations.js +3 -3
- package/dist/client/ai-search/use-ai-search.js +1 -1
- package/dist/client/analytics-page-view.js +1 -1
- package/dist/client/app.js +2 -7
- package/dist/client/classic-webview-sync.js +1 -0
- package/dist/client/client-entry.js +1 -1
- package/dist/client/contexts.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/feedback.js +1 -1
- package/dist/client/history-mount.js +1 -0
- package/dist/client/l10n/ssr-l10n.js +1 -1
- 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/page-sync.js +1 -0
- 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/review/use-review.js +1 -1
- package/dist/client/revisions-history.js +1 -1
- package/dist/client/sidebar/PoweredByRedocly.js +2 -2
- package/dist/client/sidebar/SidebarDataProvider.js +1 -1
- package/dist/client/sidebar/drilldown.js +1 -1
- package/dist/client/ssr.js +1 -1
- package/dist/client/telemetry/config.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/theme-logo.js +1 -1
- package/dist/client/use-banner.js +1 -1
- package/dist/client/use-bar-position.js +1 -0
- package/dist/client/use-entity-revisions.js +1 -1
- 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/client/webmcp/tools/site-tools.js +1 -1
- package/dist/client/webmcp/use-webmcp-tools.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-state.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/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/invalidation.d.ts +6 -0
- package/dist/content-layer/database/invalidation.js +26 -26
- 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/schema.d.ts +50 -0
- package/dist/content-layer/database/schema.js +1 -1
- 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/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/markdoc-schema-problem.js +1 -0
- package/dist/content-layer/ingest/normalize-artifacts.js +1 -1
- 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/config-links.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/node-ref.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/client/markdown-text.js +1 -1
- 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/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-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/logo.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/assets/index.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/client/use-catalog-classic.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/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/app-data.js +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/ignored-routes.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-handler.js +1 -1
- 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-page/site-branding.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 +6 -5
- 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/callback.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/oauth/discovery.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/oauth/error-reporting.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/oauth/register.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/oauth/token.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/server-info.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/tools/search.js +2 -2
- 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/mcp/setup-page.js +1 -1
- 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/scorecard-classic/index.js +1 -1
- 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/io.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/source-file.js +1 -1
- 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/read.js +1 -1
- package/dist/content-layer/search/engine/core/content-parser.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/versions/group-info.d.ts +22 -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 +15 -14
- package/dist/server/cors-proxy/handler.js +1 -1
- 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 +5 -5
- 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/sitemap.js +1 -1
- package/dist/server/ssrf/ssrf-blocklist.js +1 -1
- package/dist/server/static-files/serve.js +1 -1
- package/dist/server/subprocess/child-entry.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/server/wait-until.js +1 -0
- 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 +7 -0
- package/dist/shared/constants/review.js +1 -1
- package/dist/{server → shared}/constants/system-routes.d.ts +2 -2
- 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/redirect-match.js +1 -0
- package/dist/shared/utils/routes/file-path-to-route-slug.js +1 -1
- 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{hashJsonValue as e,toJsonObject as t,toJsonValue as n}from"../database/utils/json.js";import{isEntityLoaderReference as r,isInlineEntityReference as i,isRawEntityReference as a}from"../loaders/define.js";import{createStoredEntityReference as o,isServerFnReference as s}from"../plugins/server-fn.js";import{compareStrings as c}from"../../shared/utils/compare-strings.js";import{isObject as l}from"../../shared/utils/is-object.js";import{
|
|
1
|
+
import{hashJsonValue as e,toJsonObject as t,toJsonValue as n}from"../database/utils/json.js";import{isEntityLoaderReference as r,isInlineEntityReference as i,isRawEntityReference as a}from"../loaders/define.js";import{createStoredEntityReference as o,isServerFnReference as s}from"../plugins/server-fn.js";import{compareStrings as c}from"../../shared/utils/compare-strings.js";import{isObject as l}from"../../shared/utils/is-object.js";import{isCoreRouteDepKey as u}from"../../shared/constants/route-deps.js";import{LIST_REVISIONS_SERVER_FN_ID as d,REVISIONS_ROUTE_DEP_KEY as f}from"../../shared/constants/revisions.js";import{matchContentPathMap as p}from"../plugins/utils/glob.js";import{parseContentVersion as m}from"../plugins/utils/version-path.js";import{deriveLocalizedRequestedSlug as h,deriveRequestedSlug as g}from"./slugger/derive-requested-slug.js";function _(e){let n=v(e);if(n===`skip`)return{routeDependencies:[],routes:[],entities:[]};let r=e.filePath===null?null:m(e.filePath),i=b(e.context,e.pluginId,r?.version??null),a=/* @__PURE__ */ new Map,o=[],s=[];for(let t of e.standaloneEntities){let e=i(t);a.set(e.key,e)}let _=/* @__PURE__ */ new Set,x=e.filePath===null?void 0:p(e.filePath,e.context.config.metadataGlobs);for(let c of e.routeDrafts){let{requestedSlug:p,slugType:m,canonicalSlug:v}=n?h({route:c,locale:n.locale,canonicalPath:n.canonicalPath,localeContext:n.localeContext,resolveCanonicalRoute:e.resolveCanonicalRoute}):{...g(c,e.filePath??``),canonicalSlug:``},b=`${c.routeId}\u0000${p}`;if(_.has(b))continue;_.add(b);let{rbac:S,excludeFromSearch:C,...w}=l(c.metadata?.metadata)?c.metadata.metadata:{},T=t({...x,...c.metadata,...w}),E=null;if(c.sidebarSubtree){let e=i(c.sidebarSubtree);a.set(e.key,e),E=e.key}for(let[t,n]of Object.entries(c.deps??{})){let r=y({dependency:n,describeEntity:i,key:t,registerEntity:e=>{a.set(e.key,e)},routeSlug:p,sourcePath:e.filePath??void 0});o.push({...r,routeId:c.routeId})}if(e.filePath!==null&&e.revisions?.isTracked(e.filePath)||r){let e=[...new Set(o.filter(e=>e.routeSlug===p&&e.dependencyType===`entity`&&!u(e.key)).map(e=>e.target))];o.push({args:{entityKeys:e,routeSlug:p},dependencyType:`serverFn`,key:f,routeId:c.routeId,routeSlug:p,target:d}),T.revisionsEnabled=!0}s.push({metadata:T,pluginId:e.pluginId,routeId:c.routeId,sidebarSubtreeEntityKey:E,wildcardPrefix:c.wildcardPrefix===!0,slug:p,requestedSlug:p,slugType:m,template:c.template?.trim()||``,versionGroup:r?.versionGroup??null,version:r?.version??null,locale:n?n.locale:``,isFallback:!1,canonicalSlug:v})}return{routeDependencies:o,routes:s,entities:[...a.values()].sort((e,t)=>c(e.key,t.key))}}function v(e){let{filePath:t,localeContext:n}=e;if(t===null||n===void 0||!n.isL10nPath(t))return null;if(!n.enabled)return`skip`;let{locale:r,canonicalPath:i}=n.splitLocaleFromPath(t);return i===``||!n.isLocale(r)?`skip`:{locale:r,canonicalPath:i,localeContext:n}}function y(e){let{dependency:t,key:n,routeSlug:r}=e;if(s(t))return{args:S(t.args,t=>{let n=e.describeEntity(t);return e.registerEntity(n),n.key}),dependencyType:`serverFn`,key:n,routeSlug:r,target:t.id};if(!a(t)){let t=e.sourcePath?` on "${e.sourcePath}"`:``;throw Error(`Unsupported route dependency "${n}"${t}.`)}let i=e.describeEntity(t);return e.registerEntity(i),{args:null,dependencyType:`entity`,key:n,routeSlug:r,target:i.key}}function b(e,t,n=null){let r=/* @__PURE__ */ new Map;return i=>{let a=r.get(i);return a===void 0&&(a=x(e,t,i,n),r.set(i,a)),a}}function x(t,n,a,s=null){if(i(a)){let t=a.key?.trim()||null;return{loaderArgs:null,kind:`inline`,type:a.type??null,metadata:a.metadata??null,loaderId:null,pluginId:n,shouldInvalidateValue:!1,key:t??`inline:${e(a.value)}`,value:a.value,isSystem:!1,version:s,searchable:a.searchable}}if(!r(a))throw Error(`Unsupported entity reference.`);let c=a.key?.trim()||null,l=S(a.args,e=>o(x(t,n,e,s).key)),u=t.pluginRegistry.getEntityLoaderById(a.id);if(!u)throw Error(`Entity loader "${a.id}" is not registered.`);return{loaderArgs:l,kind:`loader`,type:a.type??null,metadata:a.metadata??null,loaderId:a.id,pluginId:u.pluginId,shouldInvalidateValue:!0,key:c??`${a.id}:${e(l)}`,value:null,isSystem:!1,version:s}}function S(e,t){if(a(e))return t(e);if(Array.isArray(e))return e.map(e=>S(e,t));if(e&&typeof e==`object`){let r=Object.entries(e).map(([e,n])=>[e,S(n,t)]);return n(Object.fromEntries(r))}return n(e)}export{b as createEntityDescriber,x as createEntityDescriptor,_ as normalizePluginArtifacts,y as normalizeRouteDependency};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{RBAC_TEAM_ANONYMOUS as e,RBAC_TEAM_AUTHENTICATED as t}from"../../
|
|
1
|
+
import{RBAC_TEAM_ANONYMOUS as e,RBAC_TEAM_AUTHENTICATED as t}from"../../shared/rbac/types.js";function n(n){if(n===null)return[e,t];if(n===void 0)return[];let r=n[`*`],i=r===void 0?{...n}:{[e]:r,[t]:r,...n},a=/* @__PURE__ */ new Set;for(let[e,t]of Object.entries(i))e!==`*`&&t!==`none`&&a.add(e.toLowerCase());return[...a].sort()}function r(e,t){let r=n(e);if(t===void 0)return r;let i=n(t),a=(e,t)=>e.includes(t)||e.includes(`authenticated`),o=/* @__PURE__ */ new Set;for(let e of[...r,...i])e===`anonymous`||e===`authenticated`?r.includes(e)&&i.includes(e)&&o.add(e):a(r,e)&&a(i,e)&&o.add(e);return[...o].sort()}export{n as toRbacTeams,r as toRbacTeamsWithinRoute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{formatCount as e}from"../../shared/log-format.js";import{createLogger as t,stopwatch as n}from"../../shared/logger.js";import{L10N_DIR as r}from"../../shared/constants/l10n/defaults.js";import{collectL10nDirLocales as i,l10nDirOf as a,resolveLocaleContext as o}from"../../shared/utils/l10n.js";import{isConfigChanged as s,isNestedConfigPath as c,loadContentLayerConfig as l,readNestedConfigProblems as ee}from"../config.js";import{contentIgnoreMatcherOf as te,normalizeHintPaths as ne,scanContentFiles as u}from"./scan.js";import{resolveContentPluginsForFile as d}from"../plugins/registry.js";import{resolveContentLayerContext as re}from"../context.js";import{openContentLayerDatabase as f}from"../database/connection.js";import{garbageCollectOrphanBlobs as ie}from"../database/blobs.js";import"../../shared/constants/app-data.js";import{isPlanFeatureGranted as p}from"../../shared/plan-gates.js";import{listConfiguredProducts as ae,productFolderProblems as oe}from"../products.js";import{appDataSystemEntityDescriptor as se}from"../plugins/internal/app-data/index.js";import{warnWhenProjectPluginsAreNotLoaded as ce}from"../plugins/project/loaded-set.js";import{apiOutputFiles as le,readApiOutputs as ue,withApiOutputHints as de}from"../api-outputs.js";import{createContentPlugins as m}from"../plugins/create-content-plugins.js";import"../plugins/index.js";import{assembleTemplateSet as fe}from"../templates/template-set.js";import{assembleServerModuleSet as pe}from"../server-modules/module-set.js";import{listRegisteredAssets as me}from"../database/assets.js";import{computeDirtyConfigOrigins as he,computeDirtyFileOrigins as ge,garbageCollectOrphanedEntities as _e,loadOriginDependencyRows as ve,propagateConfigDependencyInvalidation as ye,propagateEntityInvalidation as be}from"../database/invalidation.js";import{hasGlobalProblemsForSource as h,listGlobalProblems as xe,listProblems as Se,problemRow as g,replaceGlobalProblemsForKeysTx as Ce,replaceGlobalProblemsForSourceTx as _}from"../database/problems.js";import{persistContentFileState as we,refreshFileLastModified as Te}from"../database/files.js";import{loadSiteConfig as Ee,writeSiteConfig as De}from"../database/site-config.js";import{loadContentLayerState as v,partitionIgnoredFiles as Oe}from"../context-state.js";import{garbageCollectOrphanAssetFiles as ke,restoreMissingAssetFiles as Ae}from"../materialization/asset-reconcile.js";import{loadPluginHookState as je}from"../database/plugin-hook-state.js";import{loadRouteQueryDependencyRows as Me}from"../database/route-query-deps.js";import{createProblem as y}from"../problems/codes.js";import{runSearchSync as Ne}from"./search-sync.js";import{hashContentFiles as b}from"./hash.js";import{selectCurrentContentFiles as x}from"./current-files.js";import{collectL10nWarnings as Pe,l10nLayoutProblems as Fe,validateL10nConfig as Ie}from"./l10n-warnings.js";import{collectAppDataFragmentOwnerIds as Le,reconcilePluginScopedRows as Re,registerSystemEntities as ze}from"../database/finalize.js";import{hasStaleManifestVersion as Be,resetContentDatabase as Ve}from"../database/reset.js";import{readGitLastModified as He}from"./git-last-modified.js";import{createContentScanPlan as Ue}from"./scan-plan.js";import{collectPageRedirects as S}from"../page-redirects.js";import{syncContentFiles as We}from"./sync.js";import{checkAllowedPackages as Ge}from"../allowed-packages.js";import{syncConfigLinkRefs as Ke}from"../link-checker/config-links.js";import{collectCollisionPeerOrigins as qe}from"./slugger/collision-peers.js";async function C(r){let a=re({contentDir:r.contentDir,context:r.context,currentFileIndex:r.currentFileIndex,logger:r.logger??t(),plugins:m(r.contentDir)}),u=a.contentDir,d=a.logger.child(`content-layer`),p=d.child(`content-layer:scan`),b=d.child(`content-layer:hash`),x=d.child(`content-layer:db`),S=d.child(`content-layer:plan`),C=d.child(`content-layer:diff`),w=d.child(`content-layer:sync`),T=n();d.debug(`Starting content ingest`,{contentDir:u,hints:r.hints??[]});let E=r.database===void 0,D=r.database??await f({contentDir:u,databaseUrl:r.databaseUrl,migrationsDir:r.migrationsDir,runMigrations:r.runMigrations,platform:a.platform,logger:x});try{if(await Be(D)){x.warn(`manifest version changed — resetting content database`);let e=n();await Ve(D,{logger:x}),x.info(`Reset content database`,{durationMs:e()}),a.state=void 0}let t=ne(u,r.hints??[]),re=n(),f=n(),m=await v({context:a,database:D}),E=[...m.filesByPath.values(),...m.ignoredFilesByPath.values()].sort((e,t)=>e.path.localeCompare(t.path));x.debug(`Loaded previous content state`,{loadedCount:E.length,totalCount:E.length,durationMs:f()});let k=await l({context:a,force:!0});await ce({contentDir:u,config:k.config,fs:a.platform.fs,logger:d});let A=s(Xe(k.config,m.routeBySlug.values()),await Ee(D)),j=Ie(a.config.l10n);for(let e of j)d.debug(e.message);(A||j.length>0||await h(D,`l10n-config`))&&await D.db.transaction(e=>_(e,`l10n-config`,j.map(e=>g(e,{scope:`global`,source:`l10n-config`})))),(A||k.problems.length>0||await h(D,`config`))&&await D.db.transaction(e=>_(e,`config`,k.problems.map(e=>g(y(e),{scope:`global`,source:`config`}))));let M=await Ge(k.config,u,a.platform.fs);(M.length>0||await h(D,`allowed-packages`))&&await D.db.transaction(e=>_(e,`allowed-packages`,M.map(e=>g(y(e),{scope:`global`,source:`allowed-packages`}))));let N=te(a.config);Oe(m,N);let P=e=>ue({config:a.config,contentDir:u,fs:a.platform.fs,nestedConfigPaths:e,isIgnored:N}),F=A||t.some(c),I=await P([...m.filesByPath.keys()].filter(c)),Ze=n(),L=await Ue({contentDir:u,fs:a.platform.fs,previousFiles:E,hints:de(t,I),ignoredDirectories:r.ignoredDirectories,configChanged:F,logger:S});S.debug(`Resolved ingest scan plan`,{hints:L.hintedPaths.length,configChanged:F,scanTargets:L.scanTargets.length,affectedPreviousFiles:L.affectedPreviousFiles.length,durationMs:Ze()});let Qe=new Map(E.map(e=>[e.path,e.hash])),R=await Ye({contentDir:u,currentFileIndex:a.currentFileIndex,fs:a.platform.fs,scanPlan:L,ignoredDirectories:r.ignoredDirectories,scanLogger:p,hashLogger:b,previous:a.currentFileIndex?void 0:Qe,onProgress:r.onProgress});(L.hintedPaths.length===0||L.hintedPaths.includes(``))&&(I=await P(R.map(e=>e.path).filter(e=>c(e)&&!N(e))));let $e=await le({outputs:I,files:R,contentDir:u,fs:a.platform.fs,previous:Qe}),z=[...R.filter(e=>!I.has(e.path)),...$e],B=new Map(await He(u,p));for(let[e,t]of I){let n=B.get(t);n!==void 0&&B.set(e,n)}d.info(`Scanned ${e(z.length)} files`,{durationMs:re()});let et=n(),V=O(z,L.affectedPreviousFiles,{hintScopes:L.hintScopes,totalPrevious:E.length});C.debug(`Computed content diff`,{...V.summary,durationMs:et()}),d.info(`Compared with the previous state: ${V.summary.added} added, ${V.summary.changed} changed, ${V.summary.removed} removed, ${V.summary.unchanged} unchanged`);let tt=n(),nt=n(),rt=await we(D,{upserts:[...V.added.map(e=>({path:e.path,hash:e.hash,lastModifiedAt:B.get(e.path)??null,manifest:JSON.stringify(e.manifest??{}),manifestVersion:e.manifestVersion})),...V.changed.map(e=>({path:e.path,hash:e.nextHash,lastModifiedAt:B.get(e.path)??null,manifest:JSON.stringify(e.file.manifest??{}),manifestVersion:e.file.manifestVersion}))],removedPaths:V.removed.map(e=>e.path),logger:x});x.debug(`Persisted content file state`,{upserts:V.added.length+V.changed.length,removed:V.removed.length,durationMs:nt()});for(let e of V.removed)m.filesByPath.delete(e.path),m.ignoredFilesByPath.delete(e.path);for(let e of rt)(N(e.path)?m.ignoredFilesByPath:m.filesByPath).set(e.path,e);let H=o(a.config.l10n,i(m.filesByPath.keys())),U=a.currentFileIndex!==void 0||F||L.hintedPaths.length===0||L.hintedPaths.includes(``);if(U){let e=Fe(Pe({l10n:a.config.l10n,localeContext:H,filePaths:m.filesByPath.keys()})),t=oe(ae(a.config),m.filesByPath.keys());for(let t of e)d.debug(t.message);for(let e of t)d.debug(e.message);await D.db.transaction(async n=>{await _(n,`l10n-layout`,e.map(e=>g(e,{scope:`global`,source:`l10n-layout`}))),await _(n,`products`,t.map(e=>g(y(e),{scope:`global`,source:`products`})))})}let W=U?[...m.filesByPath.keys()].filter(c):[...V.added,...V.changed].map(e=>e.path).filter(e=>c(e)&&!N(e)),G=V.removed.map(e=>e.path).filter(c);if(U||W.length>0||G.length>0){let e=(await ee({contentDir:u,fs:a.platform.fs,paths:W})).map(e=>g(y(e),{scope:`global`,source:`nested-config`,key:e.location?.filePath}));await D.db.transaction(t=>U?_(t,`nested-config`,e):Ce(t,`nested-config`,[...W,...G],e))}let K=z.flatMap(e=>{let t=m.filesByPath.get(e.path),n=B.get(e.path)??null;return!t||t.lastModifiedAt===n?[]:(m.filesByPath.set(e.path,{...t,lastModifiedAt:n}),[{path:e.path,lastModifiedAt:n}])});await Te(D,K,x),await be(D,{changedFilePaths:[...V.added.map(e=>e.path),...V.changed.map(e=>e.path),...V.removed.map(e=>e.path),...K.map(e=>e.path)],membershipChangedPaths:[...V.added,...V.removed].map(e=>e.path).filter(e=>!N(e)),logger:x});let it=a.pluginRegistry.listExtractAllPlugins(),q=a.pluginRegistry.listFinalizePlugins(),at=new Set(q.map(e=>e.id)),J=[...Le(m.entitiesByKey.get(`app-data`)?.loaderArgs??null)].filter(e=>!at.has(e)),ot=await Re(D,[...it.map(e=>({pluginId:e.id,hook:`extractAll`})),...q.map(e=>({pluginId:e.id,hook:`finalize`}))],{logger:x});J.length>0&&await ze(D,[se({fragmentUpdates:new Map(J.map(e=>[e,null]))})],{logger:x});let[Y,st,ct]=await Promise.all([ve(D),Me(D),je(D)]),X=he(Y,a.config),lt=ge(Y,m);await ye(D,{config:a.config,logger:x}),await _e(D,x),(ot||J.length>0)&&(a.state=void 0,m=await v({context:a,database:D}));let ut=await xe(D,`slugger`),dt=qe(ut,{touchedPaths:[...V.added.map(e=>e.path),...V.changed.map(e=>e.path),...V.removed.map(e=>e.path),...X.map(e=>e.originFilePath),...lt.map(e=>e.originFilePath)],storedFilesByPath:m.filesByPath}),Z=Je({context:a,diff:V,currentFiles:z,dirtyOrigins:[...X,...lt,...dt],hintedPaths:L.hintedPaths,storedFilesByPath:m.filesByPath,storedPluginsByPath:m.filePluginsByPath}),ft=n(),Q=await We({context:a,database:D,localeContext:H,files:Z,removedPaths:new Set(V.removed.map(e=>e.path)),pluginScopedOriginRows:Y,routeQueryRows:st,hookState:ct,storedSluggerProblems:ut,captureRevisions:r.captureRevisions,onFileSynced:(e,t)=>r.onProgress?.({stage:`sync`,done:e,total:t})});w.debug(`Synchronized content routes`,{files:Z.length,durationMs:ft()}),await Ke({database:D,config:a.config,configChanged:A,logger:x}),d.info(`Updated content state: ${V.added.length+V.changed.length} upserted, ${V.removed.length} removed, ${Z.length} synced`,{durationMs:tt()}),r.searchSync!==!1&&await Ne({context:a,database:D,inlineSearchables:Q.inlineSearchables});let pt=await ie(D,{logger:x});pt.removed>0&&x.debug(`blob GC removed orphan blobs`,{count:pt.removed});let $=await ke(a.pluginIO,{contentDir:u,database:D,logger:x});if($.removedRows>0&&x.debug(`asset GC removed orphan assets`,{count:$.removedRows,swept:$.sweptFilenames.length}),r.reconcileAssetFiles??!0){let e=await Ae(a.pluginIO,{contentDir:u,registered:await me(D)});e.restored.length>0&&d.info(`Restored ${e.restored.length} missing content ${e.restored.length===1?`asset`:`assets`}`),e.missingSources.length>0&&x.warn(`registered assets are missing their source file`,{paths:e.missingSources}),e.failed.length>0&&x.warn(`could not restore missing content assets; /content-assets/* will 404`,{paths:e.failed})}let{routeBySlug:mt}=await v({context:a,database:D});a.config=Xe(k.config,mt.values()),await De(D,a.config);try{await D.db.transaction(e=>_(e,`system`,[]))}catch(e){x.warn(`could not clear the stored run failure`,{error:e instanceof Error?e.message:String(e)})}let ht=r.collectProblems===!1?[]:await Se(D);d.debug(`Content ingest complete`,{durationMs:T()});let gt=a.state??m,_t=fe({registry:a.pluginRegistry,routes:gt.routeBySlug.values()}),vt=pe({registry:a.pluginRegistry,entities:gt.entitiesByKey.values()});return{contentDir:u,diff:V,currentFiles:R,previousFiles:L.affectedPreviousFiles,problems:ht,templateSet:_t,serverModuleSet:vt,inlineSearchables:Q.inlineSearchables,routeChanges:{...Q.routeChanges,unbounded:Q.routeChanges.unbounded||A}}}finally{E&&await D.close()}}function Je(e){let t=/* @__PURE__ */ new Map;for(let n of e.diff.added)t.set(n.path,n);for(let n of e.diff.changed)t.set(n.path,n.file);let n=new Map(e.currentFiles.map(e=>[e.path,e]));for(let n of e.currentFiles)t.has(n.path)||T(e.context,n,e.storedPluginsByPath.get(n.path))&&t.set(n.path,n);for(let r of e.dirtyOrigins){let i=n.get(r.originFilePath)??D(e.context.contentDir,e.storedFilesByPath.get(r.originFilePath));i&&t.set(i.path,i)}let r=[...t.keys(),...e.diff.removed.map(e=>e.path)];for(let i of w(r,e.storedFilesByPath.keys())){if(t.has(i))continue;let r=n.get(i)??D(e.context.contentDir,e.storedFilesByPath.get(i));r&&t.set(i,r)}return Array.from(t.values())}function w(e,t){let n=new Set([...e].filter(e=>!e.startsWith(`${r}/`))),i=[];for(let e of t){let t=a(e);t!==void 0&&n.has(e.slice(`@l10n/${t}/`.length))&&i.push(e)}return i}function T(e,t,n){let r=d(e,t.path).map(e=>({id:e.id,version:e.version})).sort((e,t)=>e.id.localeCompare(t.id)),i=[...n??[]].sort((e,t)=>e.pluginId.localeCompare(t.pluginId));return r.length!==i.length||r.some((e,t)=>{let n=i[t];return n===void 0||n.pluginId!==e.id||n.pluginVersion!==e.version})}function E(e,t){return`${e.replace(/\/$/,``)}/${t}`}function D(e,t){if(t)return{absolutePath:E(e,t.path),hash:t.hash,manifestVersion:t.manifestVersion,path:t.path}}function O(e,t,n={}){let r=new Map(e.map(e=>[e.path,e])),i=new Map(t.map(e=>[e.path,e])),a=n.hintScopes??[],o=[],s=[],c=[],l=[];for(let t of e){let e=i.get(t.path);if(!e){o.push(t);continue}if(e.hash!==t.hash){s.push({path:t.path,previousHash:e.hash,nextHash:t.hash,file:t});continue}c.push(t)}for(let e of t)r.has(e.path)||l.push(e);return{added:o,changed:s,removed:l,unchanged:c,hintScopes:a,summary:{added:o.length,changed:s.length,removed:l.length,unchanged:c.length,totalCurrent:n.totalPrevious===void 0?e.length:n.totalPrevious-l.length+o.length,totalPrevious:n.totalPrevious??t.length}}}async function Ye(e){if(e.currentFileIndex){let t=x({currentFileIndex:e.currentFileIndex,hintScopes:e.scanPlan.hintScopes,hintedPaths:e.scanPlan.hintedPaths});return e.scanLogger.debug(`Using provided current file snapshot`,{count:t.length,totalCount:e.currentFileIndex.size}),t}let t=n(),r=await u({fs:e.fs,rootDir:e.contentDir,targets:e.scanPlan.scanTargets,ignoredDirectories:e.ignoredDirectories,logger:e.scanLogger});e.scanLogger.debug(`Scanned content files`,{count:r.length,durationMs:t()});let i=n(),a=await b(r,{fs:e.fs,logger:e.hashLogger,previous:e.previous,onFileHashed:(t,n)=>e.onProgress?.({stage:`scan`,done:t,total:n})});return e.hashLogger.debug(`Computed content hashes`,{count:a.length,durationMs:i()}),a}function Xe(e,t){let n=p(e,`redirects`)?S(t):{};return{...e,redirects:{...n,...e.redirects}}}export{O as diffContentFiles,C as runContentIngest};
|
|
1
|
+
import{isPlanFeatureGranted as e}from"../../shared/plan-gates.js";import"../../shared/constants/app-data.js";import{L10N_DIR as t}from"../../shared/constants/l10n/defaults.js";import{collectL10nDirLocales as n,l10nDirOf as r,resolveLocaleContext as i}from"../../shared/utils/l10n.js";import{formatCount as a}from"../../shared/log-format.js";import{createLogger as o,stopwatch as s}from"../../shared/logger.js";import{openContentLayerDatabase as c}from"../database/connection.js";import{garbageCollectOrphanBlobs as l}from"../database/blobs.js";import{listRegisteredAssets as ee}from"../database/assets.js";import{createProblem as u}from"../problems/codes.js";import{computeDirtyConfigOrigins as te,computeDirtyFileOrigins as ne,garbageCollectOrphanedEntities as re,loadOriginDependencyRows as ie,propagateConfigDependencyInvalidation as ae,propagateEntityInvalidation as oe,propagateRetryableProblemInvalidation as se}from"../database/invalidation.js";import{hasGlobalProblemsForSource as d,listGlobalProblems as ce,listProblems as le,problemRow as f,replaceGlobalProblemsForKeysTx as ue,replaceGlobalProblemsForSourceTx as p}from"../database/problems.js";import{persistContentFileState as de,refreshFileLastModified as fe}from"../database/files.js";import{loadEffectiveConfigHash as pe,writeSiteConfig as me}from"../database/site-config.js";import{isConfigChanged as he,isNestedConfigPath as m,loadContentLayerConfig as ge,readNestedConfigProblems as _e}from"../config.js";import{contentIgnoreMatcherOf as ve,normalizeHintPaths as ye,scanContentFiles as h}from"./scan.js";import{resolveContentPluginsForFile as g}from"../plugins/registry.js";import{resolveContentLayerContext as _}from"../context.js";import{assembleTemplateSet as be}from"../templates/template-set.js";import{listConfiguredProducts as xe,productFolderProblems as Se}from"../products.js";import{appDataSystemEntityDescriptor as Ce}from"../plugins/internal/app-data/index.js";import{warnWhenProjectPluginsAreNotLoaded as we}from"../plugins/project/loaded-set.js";import{apiOutputFiles as Te,readApiOutputs as Ee,withApiOutputHints as De}from"../api-outputs.js";import{createContentPlugins as v}from"../plugins/create-content-plugins.js";import{assembleServerModuleSet as Oe}from"../server-modules/module-set.js";import"../plugins/index.js";import{loadContentLayerState as y,partitionIgnoredFiles as ke,reloadContentLayerEntities as Ae}from"../context-state.js";import{resolveRevisionCapture as je}from"../revisions/config.js";import{loadPluginHookState as Me}from"../database/plugin-hook-state.js";import{loadRouteQueryDependencyRows as Ne}from"../database/route-query-deps.js";import{garbageCollectOrphanAssetFiles as Pe,restoreMissingAssetFiles as Fe}from"../materialization/asset-reconcile.js";import{createEntityMaterializer as Ie}from"../materialization/materializer.js";import{runSearchSync as Le}from"./search-sync.js";import{hashContentFiles as b}from"./hash.js";import{selectCurrentContentFiles as x}from"./current-files.js";import{collectL10nWarnings as Re,l10nLayoutProblems as ze,validateL10nConfig as Be}from"./l10n-warnings.js";import{collectAppDataFragmentOwnerIds as Ve,reconcilePluginScopedRows as He,registerSystemEntities as Ue}from"../database/finalize.js";import{hasStaleManifestVersion as We,resetContentDatabase as Ge}from"../database/reset.js";import{readGitLastModified as Ke}from"./git-last-modified.js";import{createContentScanPlan as qe}from"./scan-plan.js";import{collectPageRedirects as S}from"../page-redirects.js";import{syncContentFiles as Je}from"./sync.js";import{checkAllowedPackages as Ye}from"../allowed-packages.js";import{syncUserMarkdocSchemaProblem as Xe}from"./markdoc-schema-problem.js";import{syncConfigLinkRefs as Ze}from"../link-checker/config-links.js";import{collectCollisionPeerOrigins as Qe}from"./slugger/collision-peers.js";async function C(e){let t=_({contentDir:e.contentDir,context:e.context,currentFileIndex:e.currentFileIndex,logger:e.logger??o(),plugins:v(e.contentDir)}),r=t.contentDir,h=t.logger.child(`content-layer`),g=h.child(`content-layer:scan`),b=h.child(`content-layer:hash`),x=h.child(`content-layer:db`),S=h.child(`content-layer:plan`),C=h.child(`content-layer:diff`),w=h.child(`content-layer:sync`),T=e.captureRevisions===!0,E=s();h.debug(`Starting content ingest`,{contentDir:r,hints:e.hints??[]});let k=e.database===void 0,A=e.database??await c({contentDir:r,databaseUrl:e.databaseUrl,migrationsDir:e.migrationsDir,runMigrations:e.runMigrations,platform:t.platform,logger:x});try{if(await We(A)){x.warn(`manifest version changed — resetting content database`);let e=s();await Ge(A,{logger:x}),x.info(`Reset content database`,{durationMs:e()}),t.state=void 0}let o=ye(r,e.hints??[]),c=s(),_=s(),v=await y({context:t,database:A}),k=[...v.filesByPath.values(),...v.ignoredFilesByPath.values()].sort((e,t)=>e.path.localeCompare(t.path));x.debug(`Loaded previous content state`,{loadedCount:k.length,totalCount:k.length,durationMs:_()});let j=await ge({context:t,force:!0});await we({contentDir:r,config:j.config,fs:t.platform.fs,logger:h});let M=he(O(j.config,v.routeBySlug.values()),await pe(A)),N=Be(t.config.l10n);for(let e of N)h.debug(e.message);(M||N.length>0||await d(A,`l10n-config`))&&await A.db.transaction(e=>p(e,`l10n-config`,N.map(e=>f(e,{scope:`global`,source:`l10n-config`})))),(M||j.problems.length>0||await d(A,`config`))&&await A.db.transaction(e=>p(e,`config`,j.problems.map(e=>f(u(e),{scope:`global`,source:`config`}))));let P=await Ye(j.config,r,t.platform.fs);(P.length>0||await d(A,`allowed-packages`))&&await A.db.transaction(e=>p(e,`allowed-packages`,P.map(e=>f(u(e),{scope:`global`,source:`allowed-packages`})))),await Xe(A);let F=ve(t.config);ke(v,F);let I=e=>Ee({config:t.config,contentDir:r,fs:t.platform.fs,nestedConfigPaths:e,isIgnored:F}),L=M||o.some(m),R=await I([...v.filesByPath.keys()].filter(m)),nt=s(),z=await qe({contentDir:r,fs:t.platform.fs,previousFiles:k,hints:De(o,R),ignoredDirectories:e.ignoredDirectories,configChanged:L,logger:S});S.debug(`Resolved ingest scan plan`,{hints:z.hintedPaths.length,configChanged:L,scanTargets:z.scanTargets.length,affectedPreviousFiles:z.affectedPreviousFiles.length,durationMs:nt()});let B=new Map(k.map(e=>[e.path,e.hash])),V=await tt({contentDir:r,currentFileIndex:t.currentFileIndex,fs:t.platform.fs,scanPlan:z,ignoredDirectories:e.ignoredDirectories,scanLogger:g,hashLogger:b,previous:t.currentFileIndex?void 0:B,onProgress:e.onProgress});(z.hintedPaths.length===0||z.hintedPaths.includes(``))&&(R=await I(V.map(e=>e.path).filter(e=>m(e)&&!F(e))));let rt=await Te({outputs:R,files:V,contentDir:r,fs:t.platform.fs,previous:B}),H=[...V.filter(e=>!R.has(e.path)),...rt],U=new Map(await Ke(r,g));for(let[e,t]of R){let n=U.get(t);n!==void 0&&U.set(e,n)}h.info(`Scanned ${a(H.length)} files`,{durationMs:c()});let it=s(),W=D(H,z.affectedPreviousFiles,{hintScopes:z.hintScopes,totalPrevious:k.length});C.debug(`Computed content diff`,{...W.summary,durationMs:it()}),h.info(`Compared with the previous state: ${W.summary.added} added, ${W.summary.changed} changed, ${W.summary.removed} removed, ${W.summary.unchanged} unchanged`);let at=s(),ot=s(),st=await de(A,{upserts:[...W.added.map(e=>({path:e.path,hash:e.hash,lastModifiedAt:U.get(e.path)??null,manifest:JSON.stringify(e.manifest??{}),manifestVersion:e.manifestVersion})),...W.changed.map(e=>({path:e.path,hash:e.nextHash,lastModifiedAt:U.get(e.path)??null,manifest:JSON.stringify(e.file.manifest??{}),manifestVersion:e.file.manifestVersion}))],removedPaths:W.removed.map(e=>e.path),logger:x});x.debug(`Persisted content file state`,{upserts:W.added.length+W.changed.length,removed:W.removed.length,durationMs:ot()});for(let e of W.removed)v.filesByPath.delete(e.path),v.ignoredFilesByPath.delete(e.path);for(let e of st)(F(e.path)?v.ignoredFilesByPath:v.filesByPath).set(e.path,e);let G=i(t.config.l10n,n(v.filesByPath.keys())),K=t.currentFileIndex!==void 0||L||z.hintedPaths.length===0||z.hintedPaths.includes(``);if(K){let e=ze(Re({l10n:t.config.l10n,localeContext:G,filePaths:v.filesByPath.keys()})),n=Se(xe(t.config),v.filesByPath.keys());for(let t of e)h.debug(t.message);for(let e of n)h.debug(e.message);await A.db.transaction(async t=>{await p(t,`l10n-layout`,e.map(e=>f(e,{scope:`global`,source:`l10n-layout`}))),await p(t,`products`,n.map(e=>f(u(e),{scope:`global`,source:`products`})))})}let q=K?[...v.filesByPath.keys()].filter(m):[...W.added,...W.changed].map(e=>e.path).filter(e=>m(e)&&!F(e)),ct=W.removed.map(e=>e.path).filter(m);if(K||q.length>0||ct.length>0){let e=(await _e({contentDir:r,fs:t.platform.fs,paths:q})).map(e=>f(u(e),{scope:`global`,source:`nested-config`,key:e.location?.filePath}));await A.db.transaction(t=>K?p(t,`nested-config`,e):ue(t,`nested-config`,[...q,...ct],e))}let lt=H.flatMap(e=>{let t=v.filesByPath.get(e.path),n=U.get(e.path)??null;return!t||t.lastModifiedAt===n?[]:(v.filesByPath.set(e.path,{...t,lastModifiedAt:n}),[{path:e.path,lastModifiedAt:n}])});await fe(A,lt,x);let ut=new Set(H.filter(e=>et(t,e,v.filePluginsByPath.get(e.path))).map(e=>e.path)),dt=await oe(A,{changedFilePaths:[...W.added.map(e=>e.path),...W.changed.map(e=>e.path),...W.removed.map(e=>e.path),...lt.map(e=>e.path),...ut],membershipChangedPaths:[...W.added,...W.removed].map(e=>e.path).filter(e=>!F(e)),logger:x}),ft=t.pluginRegistry.listExtractAllPlugins(),pt=t.pluginRegistry.listFinalizePlugins(),mt=new Set(pt.map(e=>e.id)),J=[...Ve(v.entitiesByKey.get(`app-data`)?.loaderArgs??null)].filter(e=>!mt.has(e)),ht=await He(A,[...ft.map(e=>({pluginId:e.id,hook:`extractAll`})),...pt.map(e=>({pluginId:e.id,hook:`finalize`}))],{logger:x});J.length>0&&await Ue(A,[Ce({fragmentUpdates:new Map(J.map(e=>[e,null]))})],{logger:x});let[Y,gt,_t]=await Promise.all([ie(A),Ne(A),Me(A)]),vt=te(Y,t.config),yt=ne(Y,v),bt=await ae(A,{config:t.config,logger:x}),xt=await se(A,{logger:x});if((await re(A,x)).removedOrphans)await Ae({state:v,database:A});else for(let e of[...dt.invalidatedKeys,...bt.invalidatedKeys,...xt.invalidatedKeys]){let t=v.entitiesByKey.get(e);t&&(t.status=`stale`)}(ht||J.length>0)&&(t.state=void 0,v=await y({context:t,database:A}));let St=await ce(A,`slugger`),Ct=Qe(St,{touchedPaths:[...W.added.map(e=>e.path),...W.changed.map(e=>e.path),...W.removed.map(e=>e.path),...vt.map(e=>e.originFilePath),...yt.map(e=>e.originFilePath)],storedFilesByPath:v.filesByPath}),X=$e({context:t,diff:W,currentFiles:H,dirtyOrigins:[...vt,...yt,...Ct],hintedPaths:z.hintedPaths,storedFilesByPath:v.filesByPath,pluginSetChangedPaths:ut}),wt=s(),Tt=je(t.config,T),Z=await Je({context:t,database:A,localeContext:G,files:X,removedPaths:new Set(W.removed.map(e=>e.path)),pluginScopedOriginRows:Y,routeQueryRows:gt,hookState:_t,storedSluggerProblems:St,revisions:Tt,onFileSynced:(t,n)=>e.onProgress?.({stage:`sync`,done:t,total:n})});t.state=Z.state,w.debug(`Synchronized content routes`,{files:X.length,durationMs:wt()}),await Ze({database:A,config:t.config,configChanged:M,logger:x}),h.info(`Updated content state: ${W.added.length+W.changed.length} upserted, ${W.removed.length} removed, ${X.length} synced`,{durationMs:at()}),e.searchSync!==!1&&await Le({context:t,database:A,inlineSearchables:Z.inlineSearchables,materializer:Ie({deps:{...t,state:Z.state},database:A,revisions:Tt})});let Et=await l(A,{logger:x});Et.removed>0&&x.debug(`blob GC removed orphan blobs`,{count:Et.removed});let Q=await Pe(t.pluginIO,{contentDir:r,database:A,logger:x});if(Q.removedRows>0&&x.debug(`asset GC removed orphan assets`,{count:Q.removedRows,swept:Q.sweptFilenames.length}),e.reconcileAssetFiles??!0){let e=await Fe(t.pluginIO,{contentDir:r,registered:await ee(A)});e.restored.length>0&&h.info(`Restored ${e.restored.length} missing content ${e.restored.length===1?`asset`:`assets`}`),e.missingSources.length>0&&x.warn(`registered assets are missing their source file`,{paths:e.missingSources}),e.failed.length>0&&x.warn(`could not restore missing content assets; /content-assets/* will 404`,{paths:e.failed})}let{routeBySlug:Dt}=Z.state;t.config=O(j.config,Dt.values()),await me(A,O(j.siteConfig,Dt.values()),t.config);try{await A.db.transaction(e=>p(e,`system`,[]))}catch(e){x.warn(`could not clear the stored run failure`,{error:e instanceof Error?e.message:String(e)})}let Ot=e.collectProblems===!1?[]:await le(A);h.debug(`Content ingest complete`,{durationMs:E()});let $=Z.state,kt=be({registry:t.pluginRegistry,routes:$.routeBySlug.values()}),At=Oe({registry:t.pluginRegistry,entities:$.entitiesByKey.values()});return{contentDir:r,diff:W,currentFiles:V,previousFiles:z.affectedPreviousFiles,problems:Ot,templateSet:kt,serverModuleSet:At,inlineSearchables:Z.inlineSearchables,routeChanges:{...Z.routeChanges,unbounded:Z.routeChanges.unbounded||M}}}finally{k&&await A.close()}}function $e(e){let t=/* @__PURE__ */ new Map;for(let n of e.diff.added)t.set(n.path,n);for(let n of e.diff.changed)t.set(n.path,n.file);let n=new Map(e.currentFiles.map(e=>[e.path,e]));for(let n of e.currentFiles)t.has(n.path)||e.pluginSetChangedPaths.has(n.path)&&t.set(n.path,n);for(let r of e.dirtyOrigins){let i=n.get(r.originFilePath)??E(e.context.contentDir,e.storedFilesByPath.get(r.originFilePath));i&&t.set(i.path,i)}let r=[...t.keys(),...e.diff.removed.map(e=>e.path)];for(let i of w(r,e.storedFilesByPath.keys())){if(t.has(i))continue;let r=n.get(i)??E(e.context.contentDir,e.storedFilesByPath.get(i));r&&t.set(i,r)}return Array.from(t.values())}function w(e,n){let i=new Set([...e].filter(e=>!e.startsWith(`${t}/`))),a=[];for(let e of n){let t=r(e);t!==void 0&&i.has(e.slice(`@l10n/${t}/`.length))&&a.push(e)}return a}function et(e,t,n){let r=g(e,t.path).map(e=>({id:e.id,version:e.version})).sort((e,t)=>e.id.localeCompare(t.id)),i=[...n??[]].sort((e,t)=>e.pluginId.localeCompare(t.pluginId));return r.length!==i.length||r.some((e,t)=>{let n=i[t];return n===void 0||n.pluginId!==e.id||n.pluginVersion!==e.version})}function T(e,t){return`${e.replace(/\/$/,``)}/${t}`}function E(e,t){if(t)return{absolutePath:T(e,t.path),hash:t.hash,manifestVersion:t.manifestVersion,path:t.path}}function D(e,t,n={}){let r=new Map(e.map(e=>[e.path,e])),i=new Map(t.map(e=>[e.path,e])),a=n.hintScopes??[],o=[],s=[],c=[],l=[];for(let t of e){let e=i.get(t.path);if(!e){o.push(t);continue}if(e.hash!==t.hash){s.push({path:t.path,previousHash:e.hash,nextHash:t.hash,file:t});continue}c.push(t)}for(let e of t)r.has(e.path)||l.push(e);return{added:o,changed:s,removed:l,unchanged:c,hintScopes:a,summary:{added:o.length,changed:s.length,removed:l.length,unchanged:c.length,totalCurrent:n.totalPrevious===void 0?e.length:n.totalPrevious-l.length+o.length,totalPrevious:n.totalPrevious??t.length}}}async function tt(e){if(e.currentFileIndex){let t=x({currentFileIndex:e.currentFileIndex,hintScopes:e.scanPlan.hintScopes,hintedPaths:e.scanPlan.hintedPaths});return e.scanLogger.debug(`Using provided current file snapshot`,{count:t.length,totalCount:e.currentFileIndex.size}),t}let t=s(),n=await h({fs:e.fs,rootDir:e.contentDir,targets:e.scanPlan.scanTargets,ignoredDirectories:e.ignoredDirectories,logger:e.scanLogger});e.scanLogger.debug(`Scanned content files`,{count:n.length,durationMs:t()});let r=s(),i=await b(n,{fs:e.fs,logger:e.hashLogger,previous:e.previous,onFileHashed:(t,n)=>e.onProgress?.({stage:`scan`,done:t,total:n})});return e.hashLogger.debug(`Computed content hashes`,{count:i.length,durationMs:r()}),i}function O(t,n){let r=e(t,`redirects`)?S(n):{};return{...t,redirects:{...r,...t.redirects}}}export{D as diffContentFiles,C as runContentIngest};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PlatformFs } from '../../platform/types/fs.js';
|
|
2
2
|
import type { Logger } from '../../shared/logger.js';
|
|
3
|
-
export declare const DEFAULT_IGNORED_DIRECTORIES: readonly ['.git', '.realm', '.realm-lazy', '.realm-sahpool', 'dist', 'node_modules'];
|
|
3
|
+
export declare const DEFAULT_IGNORED_DIRECTORIES: readonly ['.git', '.realm', '.realm-lazy', '.realm-sahpool', '@sdk', 'dist', 'node_modules'];
|
|
4
4
|
export type ContentHint = string;
|
|
5
5
|
export type ContentPathScope = {
|
|
6
6
|
path: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{compileContentGlob as e}from"../plugins/utils/glob.js";import{toPosixPath as t}from"../../shared/utils/to-posix-path.js";import{REDOCLY_CONFIG_FILENAMES as n}from"../config.js";import{isAbsolute as r,join as i,posix as a,relative as o,resolve as s}from"node:path";const c=[`.git`,`.realm`,`.realm-lazy`,`.realm-sahpool`,`@sdk`,`dist`,`node_modules`];async function l(e){let t=s(e.rootDir),n=new Set(e.ignoredDirectories??c),r=e.targets===void 0?[{path:``,absolutePath:t,recursive:!0}]:d(e.targets),a=[],o=/* @__PURE__ */ new Set,l=e.logger,u=e=>{let r=v(t,e);if(!(r===``||o.has(r))){if(_(r,n)){l?.debug(`Skipping ignored file`,{path:r});return}o.add(r),a.push({path:r,absolutePath:e})}},f=async r=>{let a=await e.fs.readdir(r);for(let e of a){let a=i(r,e.name),o=v(t,a);if(e.type===`symlink`){l?.debug(`Skipping symbolic link`,{path:o});continue}if(e.type===`directory`){if(_(o,n)){l?.debug(`Skipping ignored directory`,{name:e.name,path:o});continue}await f(a);continue}if(e.type!==`file`){l?.debug(`Skipping non-file entry`,{path:o});continue}u(a)}};for(let e of r){if(e.recursive){if(e.path!==``&&_(e.path,n)){l?.debug(`Skipping ignored scan target`,{path:e.path});continue}await f(e.absolutePath);continue}u(e.absolutePath)}return a.sort((e,t)=>e.path.localeCompare(t.path)),a}function u(e,t){let n=/* @__PURE__ */ new Set,r=s(e);for(let e of t){let t=b(r,e);t!==null&&n.add(t)}return[...n].sort((e,t)=>e.localeCompare(t))}function d(e){let t=[];for(let n of[...e].sort(x))t.some(e=>p(e,n.path))||t.push(n);return t}function f(e,t){return t.some(t=>p(t,e))}function p(e,t){return e.path===``?e.recursive:e.path===t||e.recursive&&t.startsWith(`${e.path}/`)}const m=/* @__PURE__ */ new WeakMap;function h(e){let t=m.get(e);return t===void 0&&(t=g(e.ignore),m.set(e,t)),t}function g(t){let r=typeof t==`string`?[t]:Array.isArray(t)?t:[],i=[];for(let t of r){if(typeof t!=`string`)continue;let n=t.startsWith(`!`),r=(n?t.slice(1):t).replace(/^\.?\/+/,``).replace(/(?<!\/)\/+$/,``);r!==``&&i.push({negated:n,matches:e([r,`${r}/**`])})}return e=>{if(n.includes(e))return!1;let t=!1;for(let n of i)n.matches(e)&&(t=!n.negated);return t}}function _(e,n){let r=n instanceof Set?n:new Set(n);return t(e).split(`/`).filter(Boolean).some(e=>r.has(e))}function v(e,t){return w(o(s(e),t))}function y(e,t){if(/^[a-z][a-z\d+.-]*:\/\//i.test(t))return null;let n=v(e,t);return n===``||n===`..`||n.startsWith(`../`)||r(n)||/^[a-z]:/i.test(n)?null:n}function b(e,t){if(t.trim()===``)return null;if(r(t)){let n=o(e,t);return n===``||C(n)?w(n):null}return w(t)}function x(e,t){let n=S(e.path),r=S(t.path);return n===r?e.recursive===t.recursive?e.path.localeCompare(t.path):e.recursive?-1:1:n-r}function S(e){return e===``?0:e.split(`/`).filter(Boolean).length}function C(e){return e!==`..`&&!e.startsWith(`..${a.sep}`)&&!e.startsWith(`..\\`)}function w(e){let n=a.normalize(t(e)).replace(/^\.\//,``);return n===`.`?``:n}export{c as DEFAULT_IGNORED_DIRECTORIES,d as compactScopes,h as contentIgnoreMatcherOf,g as createContentIgnoreMatcher,_ as isIgnoredContentPath,f as isPathCoveredByScopes,u as normalizeHintPaths,l as scanContentFiles,p as scopeCoversPath,y as toContainedContentPath,v as toContentPath};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{hashJsonValue as e}from"../database/utils/json.js";import{SEARCH_GROUP_FACET_FIELD as t,resolveSearchFacets as n}from"../../shared/search/facets.js";import{hashContentBytes as r}from"../../shared/utils/content-hash.js";import{formatDuration as i}from"../../shared/log-format.js";import{isRbacScope as a}from"../../server/rbac/engine.js";import{normalizeRouteSlug as o}from"../../shared/utils/routes/normalize-route-slug.js";import{computePathPrefixes as s}from"../../shared/utils/routes/compute-path-prefixes.js";import{replaceDataRefMarkers as c}from"../materialization/data-ref.js";import{batchValues as l,normalizeBatchSize as u}from"../database/connection.js";import{entities as d,pageMarkdown as f,routeQueryDeps as p,searchDocuments as m}from"../database/schema.js";import{resolveDataRef as h}from"../database/blobs.js";import{createRouteQueryEvaluator as g,dedupeRouteQueryDependencies as _,isRouteQueryStale as v}from"../plugins/utils/route-index.js";import{listConfiguredProducts as y}from"../products.js";import{userMarkdocSchemaDigest as b}from"../markdown/constants/tag-sets.js";import{findProductForSlug as x}from"../../shared/products.js";import{createMarkdownCopyRule as S}from"../markdown-copy-rule.js";import{problemRow as C,replaceEntityProblemsForCodesBatchTx as w}from"../database/problems.js";import{createSearchStore as T}from"../search/store.js";import{loadContentLayerState as E}from"../context-state.js";import{replaceEntityRouteQueryDepsTx as D}from"../database/route-query-deps.js";import{createProblem as O}from"../problems/codes.js";import{SEARCH_PROBLEM_CODES as k,searchFacetInvalidProblem as A,searchableFailedProblem as j}from"../problems/producers.js";import{loadAttachedRouteSlugs as M}from"../database/route-deps.js";import{toRbacTeams as N,toRbacTeamsWithinRoute as P}from"./rbac-teams.js";import{buildDocumentFacets as F}from"../search/facet-rows.js";import{createHookEntityStore as I}from"./hook-inputs.js";import{and as L,eq as R,inArray as z}from"drizzle-orm";function B(t,n,r,i){let a=[...t].sort(),o=n.map(e=>[e.name,e.slug]);return(t,n)=>{let s=[t,a,o,r];return n&&i!==void 0&&s.push(i),e(s)}}async function V(e){let{context:t,database:n}=e,r=t.logger.child(`content-layer:search`),a=[],o=/* @__PURE__ */ new Map,s=new Map(t.pluginRegistry.listEntityLoaders().filter(e=>e.definition.searchable!==void 0||e.definition.markdown!==void 0).map(e=>[e.definition.id,e])),c=e.inlineSearchables??/* @__PURE__ */ new Map,u=e.entityKeys===void 0?void 0:[...e.entityKeys,...c.keys()],d=await re(n,u);if(s.size===0&&c.size===0&&d.size===0)return{synced:0,problems:a};let f=await E({context:t,database:n}),p=T(n),m=g(f,t.config),h=y(t.config),_=ee(f,m,h),v=_(),x=te(t),w=S(t.config),D=B(x,h,w.settings,b()),O=ne(r,{configuredFields:x}),A=0,N=(e,t)=>{a.push(...t),o.set(e,t.map(t=>C(t,{scope:`entity`,entityId:e})))},P=(e,t,n,i)=>{let s=i instanceof Error?i.message:String(i);r.warn(`searchable failed for "${t}"; keeping its last documents: ${s}`);let c=j({entityKey:t,pluginId:n,message:s});a.push(c),o.set(e,[C(c,{scope:`entity`,entityId:e})])},F=async()=>(await H(n,o,k,r),{synced:A,problems:a});u===void 0&&await G({context:t,database:n,state:f,store:p,stored:d,searchableLoaders:s});let I=[];for(let[e,n]of c){let i=f.entitiesByKey.get(e);if(i&&i.kind===`inline`){if(n===void 0){d.has(e)&&await p.removeSource(e);continue}try{let a=await O.prepare(e,n.docs,v);I.push({entityKey:e,docs:a.docs,...Y(e,n,a.docs),sourceHash:D(i.dataHash??``,!1),pluginVersion:t.pluginRegistry.getById(i.pluginId)?.version??``}),N(i.id,[...W(e,n.problems,r),...a.problems])}catch(t){P(i.id,e,i.pluginId,t)}}}if(await p.replaceSourceDocuments(I),A+=I.length,s.size===0)return F();let L=await ie(n,[...s.keys()],e.entityKeys),R=await ae(n,m,L.map(e=>e.id)),z=L.filter(e=>{let n=s.get(e.loaderId),r=n?t.pluginRegistry.getById(n.pluginId)?.version:void 0,i=d.get(e.key);return i===void 0||i.sourceHash!==D(e.dataHash??``,n?.definition.usesProjectMarkdocSchema===!0)||i.pluginVersion!==r||R.has(e.id)});if(z.length===0)return F();let V=await M(n,z.map(e=>e.key)),q=0,X=0,Z=0,Q=0,$=0;for(let r of l(z,50)){q+=1;let i=Date.now(),a=await J(n,r);Z+=Date.now()-i,i=Date.now();let o=[];for(let i of r){let r=s.get(i.loaderId);if(r){try{let e=await K({row:i,entry:r,value:a.get(i.id),attachedSlug:V.get(i.key),context:t,database:n,state:f,evaluator:m,resolveAccess:_,prepare:O.prepare,stampOf:D,allowsMarkdownCopy:w.allows});o.push(e),N(i.id,e.problems)}catch(e){P(i.id,i.key,r.pluginId,e)}X+=1,e.onProgress?.(X,z.length)}}Q+=Date.now()-i,i=Date.now(),await U({context:t,database:n,store:p,outputs:o}),$+=Date.now()-i,A+=o.length}return u===void 0&&r.info(`Synced ${z.length} content ${z.length===1?`item`:`items`} for search in ${q} ${q===1?`chunk`:`chunks`} (load ${i(Z)}, producers ${i(Q)}, writes ${i($)})`),F()}async function H(e,t,n,r){if(t.size!==0)try{await e.db.transaction(e=>w(e,t,n))}catch(e){r.warn(`could not store the search problems of this pass`,{error:e instanceof Error?e.message:String(e)})}}async function U(e){let{context:t,outputs:n}=e;n.length!==0&&await e.database.db.transaction(async i=>{await e.store.replaceSourceDocuments(n.map(e=>({entityKey:e.row.key,docs:e.docs,fragments:e.fragments,uses:e.uses,sourceHash:e.sourceHash,pluginVersion:t.pluginRegistry.getById(e.entry.pluginId)?.version??``})),i),await D(i,{hook:`searchable`,scopes:n.map(e=>({originPluginId:e.entry.pluginId,entityId:e.row.id,dependencies:_(e.reads)}))});for(let e of n){if(await i.delete(f).where(R(f.entityKey,e.row.key)),e.markdownDocs.length===0)continue;let n=t.pluginRegistry.getById(e.entry.pluginId)?.version??``;for(let t of e.markdownDocs){let a=await Promise.all(t.chunks.map(async(i,a)=>{let o=t.headings?.[a]??null;return{entityKey:e.row.key,chunkIndex:a,routeSlug:t.routeSlug,text:i,heading:o?.heading??null,anchor:o?.anchor??null,title:t.title??null,description:t.description??null,rbacTeams:t.rbacTeams,hash:await r(new TextEncoder().encode(i)),sourceHash:e.sourceHash,pluginVersion:n}}));await i.insert(f).values(a)}}})}function W(e,t,n){let r=[],i=/* @__PURE__ */ new Set;for(let e of t??[])k.includes(e.code)?r.push(O(e)):i.add(e.code);for(let t of i)n.warn(`searchable for "${e}" reported problem code "${t}", which the search sync does not own; use one of ${k.join(`, `)}`);return r}async function G(e){for(let t of e.stored.keys()){let n=e.state.entitiesByKey.get(t);n&&(e.context.pluginRegistry.getById(n.pluginId)===void 0||n.kind!==`inline`&&(n.loaderId===null||!e.searchableLoaders.has(n.loaderId)))&&(await e.store.removeSource(t),await e.database.db.delete(f).where(R(f.entityKey,t)))}}async function K(e){let{row:t,entry:n,database:r}=e,i=n.definition.searchable,a=n.definition.markdown,o=e.value;if(!o||o.data===null||o.dataHash===null)throw Error(`Entity "${t.key}" has no stored value.`);let s=e.stampOf(o.dataHash,n.definition.usesProjectMarkdocSchema),l=await c(o.data,e=>h(r,e)),u=[],d=e=>u.push(e),f=e.evaluator.index(d),p=e.attachedSlug===void 0?void 0:f.get(e.attachedSlug),m=e.resolveAccess(d),g={config:e.context.config,entities:I(e.context,r,e.state,d),logger:e.context.logger.child(`content-layer:searchable:${n.definition.id}`),routes:f,route:p},_=i?await i(l,g):{docs:[]},v=a&&e.allowsMarkdownCopy(p)?await a(l,g):null,y=q(t.key,v,e.attachedSlug).map(e=>Object.assign(e,{rbacTeams:m.rbacTeamsForSlug(e.routeSlug)})),b=await e.prepare(t.key,_.docs??[],m);return{row:t,entry:n,docs:b.docs,...Y(t.key,_,b.docs),markdownDocs:y,sourceHash:s,reads:u,problems:[...W(t.key,_.problems,e.context.logger),...b.problems]}}function q(e,t,n){if(t===null)return[];if(!Array.isArray(t))throw Error(`markdown for "${e}" must return an array or null.`);let r=t.length>0&&typeof t[0]==`string`?[{chunks:t}]:t,i=/* @__PURE__ */ new Set,a=[];for(let t of r){let r=t.routeSlug??n;if(r!==void 0){if(!Array.isArray(t.chunks)||t.chunks.some(e=>typeof e!=`string`))throw Error(`markdown for "${e}" returned a document without string chunks.`);if(t.chunks.length!==0){if(i.has(r))throw Error(`markdown for "${e}" returned "${r}" twice.`);i.add(r),a.push({routeSlug:r,chunks:t.chunks,headings:t.headings,...typeof t.title==`string`&&t.title!==``?{title:t.title}:{},...typeof t.description==`string`&&t.description!==``?{description:t.description}:{}})}}}return a}async function J(e,t){let n=await e.db.select({id:d.id,data:d.data,dataHash:d.dataHash}).from(d).where(z(d.id,t.map(e=>e.id)));return new Map(n.map(e=>[e.id,e]))}function ee(e,t,n){let r=[...e.routeBySlug.values()].filter(e=>e.wildcardPrefix),i=t=>{if(e.routeBySlug.has(t))return t;let n=new Set(s(t)),i;for(let e of r)n.has(e.slug)&&(i===void 0||e.slug.length>i.length)&&(i=e.slug);return i};return r=>{let a=t.index(r),o=e=>a.getAccess(i(e)??e),s=t=>e.routeBySlug.get(i(t)??t);return{accessForSlug:o,rbacTeamsForSlug:e=>N(o(e)),localeForSlug:e=>s(e)?.locale??``,originFilePathForSlug:e=>s(e)?.originFilePath??null,versionForSlug:e=>{let t=s(e);return t?.versionGroup!=null&&t.version!=null?{group:t.versionGroup,version:t.version}:null},productForSlug:e=>{let t=s(e),r=t?t.canonicalSlug||t.slug:e;return x(n,r)}}}}function te(e){return new Set(n(e.config).map(e=>e.field).filter(e=>e!==t))}function Y(e,t,n){let r=t.fragments??[],i=t.uses??[];if(!Array.isArray(r)||!Array.isArray(i))throw Error(`searchable for "${e}" must return fragments and uses as arrays.`);for(let t of r)if(typeof t.fragmentKey!=`string`||typeof t.name!=`string`)throw Error(`searchable for "${e}" returned a fragment without a key or name.`);let a=new Set(n.map(e=>e.docKey));return{fragments:r,uses:i.filter(e=>a.has(e.docKey))}}function ne(e,t){return{async prepare(n,r,i){if(!Array.isArray(r))throw Error(`searchable for "${n}" must return { docs: SearchDocument[] }.`);let a=/* @__PURE__ */ new Set,s=/* @__PURE__ */ new Set,c=[],l=[];for(let u of r){if(Z(n,u),a.has(u.docKey))throw Error(`searchable for "${n}" returned docKey "${u.docKey}" twice.`);a.add(u.docKey);let r=o(u.routeSlug),d=i.accessForSlug(r);if(d===void 0){e.warn(`search document "${u.docKey}" of "${n}" dropped: no route "${r}"`);continue}let{facets:f,rbacScope:p,...m}=u,h=i.productForSlug(r),g=i.versionForSlug(r),_=F({facets:f,configuredFields:t.configuredFields,groupKey:u.groupKey,teams:P(d,p),version:g,product:h?.name??null,onDropped:(e,t)=>{let a=`${e}\u0000${t}`;s.has(a)||(s.add(a),c.push(A({entityKey:n,field:e,reason:X[t],filePath:i.originFilePathForSlug(r)})))}}),v={...m,routeSlug:r,locale:i.localeForSlug(r),facets:_};h&&(v.product={name:h.name,folder:h.folder}),g&&(v.version=g),l.push(v)}return{docs:l,problems:c}}}}const X={"not-an-object":`facets must be an object of field to string or string list`,reserved:`fields starting with "redocly_" are derived by the engine`,invalid:`a value must be a string, number, boolean, or a list of those`,"too-long":`a value must be at most 500 characters`};function Z(e,t){let n=t;if(!(typeof n==`object`&&n&&typeof n.docKey==`string`&&n.docKey!==``&&typeof n.routeSlug==`string`&&typeof n.title==`string`&&typeof n.text==`string`))throw Error(`searchable for "${e}" returned an invalid document (docKey, routeSlug, title, text are required strings).`);if(n.rbacScope!==void 0&&!a(n.rbacScope))throw Error(`searchable for "${e}" returned document "${n.docKey}" with an invalid rbacScope.`)}async function re(e,t){let n=/* @__PURE__ */ new Map;for(let r of t===void 0?[void 0]:l(t,u(void 0))){let t=await e.db.selectDistinct({entityKey:m.entityKey,sourceHash:m.sourceHash,pluginVersion:m.pluginVersion}).from(m).where(r===void 0?void 0:z(m.entityKey,[...r]));for(let{entityKey:e,...r}of t)n.set(e,r);let i=await e.db.selectDistinct({entityKey:f.entityKey,sourceHash:f.sourceHash,pluginVersion:f.pluginVersion}).from(f).where(r===void 0?void 0:z(f.entityKey,[...r]));for(let{entityKey:e,...t}of i)n.has(e)||n.set(e,t)}return n}async function ie(e,t,n){return n!==void 0&&n.length===0?[]:(await e.db.select({id:d.id,key:d.key,loaderId:d.loaderId,dataHash:d.dataHash}).from(d).where(L(R(d.status,`ready`),R(d.isCurrent,1),z(d.loaderId,[...t]),n===void 0?void 0:z(d.key,[...n]))).orderBy(d.key)).filter(e=>e.loaderId!==null)}async function ae(e,t,n){let r=/* @__PURE__ */ new Set;if(n.length===0)return r;let i=new Set(n),a=n.length<=u(void 0),o=await e.db.select({entityId:p.entityId,kind:p.kind,argument:p.argument,resultHash:p.resultHash}).from(p).where(L(R(p.hook,`searchable`),a?z(p.entityId,[...n]):void 0));for(let e of o)e.entityId!==null&&i.has(e.entityId)&&!r.has(e.entityId)&&v(t,e)&&r.add(e.entityId);return r}function Q(e,t){for(let n of e)n.kind===`inline`&&t.set(n.key,n.searchable)}export{Q as collectInlineSearchables,V as runSearchSync};
|
|
1
|
+
import{hashJsonValue as e}from"../database/utils/json.js";import{SEARCH_GROUP_FACET_FIELD as t,resolveSearchFacets as n}from"../../shared/search/facets.js";import{normalizeRouteSlug as r}from"../../shared/utils/routes/normalize-route-slug.js";import{findProductForSlug as i}from"../../shared/products.js";import{userMarkdocSchemaDigest as a}from"../markdown/constants/tag-sets.js";import{formatDuration as o}from"../../shared/log-format.js";import{computePathPrefixes as s}from"../../shared/utils/routes/compute-path-prefixes.js";import{createMarkdownCopyRule as c}from"../markdown-copy-rule.js";import{batchValues as l,normalizeBatchSize as u}from"../database/connection.js";import{entities as d,pageMarkdown as f,routeQueryDeps as p,searchDocuments as m}from"../database/schema.js";import{resolveDataRef as h}from"../database/blobs.js";import{createProblem as g}from"../problems/codes.js";import{isRbacScope as _}from"../../shared/rbac/engine.js";import{replaceDataRefMarkers as v}from"../materialization/data-ref.js";import{createRouteQueryEvaluator as y,dedupeRouteQueryDependencies as b,isRouteQueryStale as x}from"../plugins/utils/route-index.js";import{problemRow as S,replaceEntityProblemsForCodesBatchTx as C}from"../database/problems.js";import{curationKeywordsOf as w}from"../search/keywords.js";import"../search/postings/postings-store.js";import{createSearchStore as T}from"../search/store.js";import{hashContentBytes as E}from"../../shared/utils/content-hash.js";import{listConfiguredProducts as D}from"../products.js";import{replaceEntityRouteQueryDepsTx as O}from"../database/route-query-deps.js";import{SEARCH_PROBLEM_CODES as k,searchFacetInvalidProblem as A,searchableFailedProblem as j}from"../problems/producers.js";import{loadAttachedRouteSlugs as M}from"../database/route-deps.js";import{toRbacTeamsWithinRoute as N}from"./rbac-teams.js";import{buildDocumentFacets as P}from"../search/facet-rows.js";import{createHookEntityStore as F}from"./hook-inputs.js";import{and as I,eq as L,inArray as R}from"drizzle-orm";function z(t,n,r,i){let a=[...t].sort(),o=n.map(e=>[e.name,e.slug]);return(t,n)=>{let s=[3,t,a,o,r];return n&&i!==void 0&&s.push(i),e(s)}}async function B(e){let{context:t,database:n}=e,r=t.logger.child(`content-layer:search`),i=[],s=/* @__PURE__ */ new Map,u=new Map(t.pluginRegistry.listEntityLoaders().filter(e=>e.definition.searchable!==void 0||e.definition.markdown!==void 0).map(e=>[e.definition.id,e])),d=e.inlineSearchables??/* @__PURE__ */ new Map,f=e.entityKeys===void 0?void 0:[...e.entityKeys,...d.keys()],p=await re(n,f);if(u.size===0&&d.size===0&&p.size===0)return{synced:0,problems:i};let{materializer:m}=e,{state:h}=m,g=T(n),_=y(h,t.config),v=D(t.config),b=ee(h,_,v),x=b(),C=te(t),w=c(t.config),E=z(C,v,w.settings,a()),O=ne(r,{configuredFields:C}),A=0,N=(e,t)=>{i.push(...t),s.set(e,t.map(t=>S(t,{scope:`entity`,entityId:e})))},P=(e,t,n,a)=>{let o=a instanceof Error?a.message:String(a);r.warn(`searchable failed for "${t}"; keeping its last documents: ${o}`);let c=j({entityKey:t,pluginId:n,message:o});i.push(c),s.set(e,[S(c,{scope:`entity`,entityId:e})])},F=async()=>(await V(n,s,k,r),{synced:A,problems:i});f===void 0&&await W({context:t,database:n,state:h,store:g,stored:p,searchableLoaders:u});let I=[];for(let[e,n]of d){let i=h.entitiesByKey.get(e);if(i&&i.kind===`inline`){if(n===void 0){p.has(e)&&await g.removeSource(e);continue}try{let a=await O.prepare(e,n.docs,x);I.push({entityKey:e,docs:a.docs,...J(e,n,a.docs),sourceHash:E(i.dataHash??``,!1),pluginVersion:t.pluginRegistry.getById(i.pluginId)?.version??``}),N(i.id,[...U(e,n.problems,r),...a.problems])}catch(t){P(i.id,e,i.pluginId,t)}}}if(await g.replaceSourceDocuments(I),A+=I.length,u.size===0)return F();let L=await ie(n,[...u.keys()],e.entityKeys),R=await ae(n,_,L.map(e=>e.id)),B=L.filter(e=>{let n=u.get(e.loaderId),r=n?t.pluginRegistry.getById(n.pluginId)?.version:void 0,i=p.get(e.key);return i===void 0||i.sourceHash!==E(e.dataHash??``,n?.definition.usesProjectMarkdocSchema===!0)||i.pluginVersion!==r||R.has(e.id)});if(B.length===0)return F();let K=await M(n,B.map(e=>e.key)),Y=0,X=0,Z=0,Q=0,$=0;for(let r of l(B,50)){Y+=1;let i=Date.now(),a=await q(n,r);Z+=Date.now()-i,i=Date.now();let o=[];for(let i of r){let r=u.get(i.loaderId);if(r){try{let e=await G({row:i,entry:r,value:a.get(i.id),attachedSlug:K.get(i.key),context:t,database:n,materializer:m,evaluator:_,resolveAccess:b,prepare:O.prepare,stampOf:E,allowsMarkdownCopy:w.allows});o.push(e),N(i.id,e.problems)}catch(e){P(i.id,i.key,r.pluginId,e)}X+=1,e.onProgress?.(X,B.length)}}Q+=Date.now()-i,i=Date.now(),await H({context:t,database:n,store:g,outputs:o}),$+=Date.now()-i,A+=o.length}return f===void 0&&r.info(`Synced ${B.length} content ${B.length===1?`item`:`items`} for search in ${Y} ${Y===1?`chunk`:`chunks`} (load ${o(Z)}, producers ${o(Q)}, writes ${o($)})`),F()}async function V(e,t,n,r){if(t.size!==0)try{await e.db.transaction(e=>C(e,t,n))}catch(e){r.warn(`could not store the search problems of this pass`,{error:e instanceof Error?e.message:String(e)})}}async function H(e){let{context:t,outputs:n}=e;n.length!==0&&await e.database.db.transaction(async r=>{await e.store.replaceSourceDocuments(n.map(e=>({entityKey:e.row.key,docs:e.docs,fragments:e.fragments,uses:e.uses,sourceHash:e.sourceHash,pluginVersion:t.pluginRegistry.getById(e.entry.pluginId)?.version??``})),r),await O(r,{hook:`searchable`,scopes:n.map(e=>({originPluginId:e.entry.pluginId,entityId:e.row.id,dependencies:b(e.reads)}))});for(let e of n){if(await r.delete(f).where(L(f.entityKey,e.row.key)),e.markdownDocs.length===0)continue;let n=t.pluginRegistry.getById(e.entry.pluginId)?.version??``;for(let t of e.markdownDocs){let i=await Promise.all(t.chunks.map(async(r,i)=>{let a=t.headings?.[i]??null;return{entityKey:e.row.key,chunkIndex:i,routeSlug:t.routeSlug,text:r,heading:a?.heading??null,anchor:a?.anchor??null,title:t.title??null,description:t.description??null,rbacTeams:t.rbacTeams,rbacScope:t.rbacScope??null,hash:await E(new TextEncoder().encode(r)),sourceHash:e.sourceHash,pluginVersion:n}}));await r.insert(f).values(i)}}})}function U(e,t,n){let r=[],i=/* @__PURE__ */ new Set;for(let e of t??[])k.includes(e.code)?r.push(g(e)):i.add(e.code);for(let t of i)n.warn(`searchable for "${e}" reported problem code "${t}", which the search sync does not own; use one of ${k.join(`, `)}`);return r}async function W(e){for(let t of e.stored.keys()){let n=e.state.entitiesByKey.get(t);n&&(e.context.pluginRegistry.getById(n.pluginId)===void 0||n.kind!==`inline`&&(n.loaderId===null||!e.searchableLoaders.has(n.loaderId)))&&(await e.store.removeSource(t),await e.database.db.delete(f).where(L(f.entityKey,t)))}}async function G(e){let{row:t,entry:n,database:r}=e,i=n.definition.searchable,a=n.definition.markdown,o=e.value;if(!o||o.data===null||o.dataHash===null)throw Error(`Entity "${t.key}" has no stored value.`);let s=e.stampOf(o.dataHash,n.definition.usesProjectMarkdocSchema),c=await v(o.data,e=>h(r,e)),l=[],u=e=>l.push(e),d=e.evaluator.index(u),f=e.attachedSlug===void 0?void 0:d.get(e.attachedSlug),p=e.resolveAccess(u),m={config:e.context.config,entities:F(r,e.materializer,u),logger:e.context.logger.child(`content-layer:searchable:${n.definition.id}`),routes:d,route:f},g=i?await i(c,m):{docs:[]},_=a&&e.allowsMarkdownCopy(f)?await a(c,m):null,y=K(t.key,_,e.attachedSlug).map(e=>Object.assign(e,{rbacTeams:N(p.accessForSlug(e.routeSlug),e.rbacScope)})),b=await e.prepare(t.key,g.docs??[],p);return{row:t,entry:n,docs:b.docs,...J(t.key,g,b.docs),markdownDocs:y,sourceHash:s,reads:l,problems:[...U(t.key,g.problems,e.context.logger),...b.problems]}}function K(e,t,n){if(t===null)return[];if(!Array.isArray(t))throw Error(`markdown for "${e}" must return an array or null.`);let r=t.length>0&&typeof t[0]==`string`?[{chunks:t}]:t,i=/* @__PURE__ */ new Set,a=[];for(let t of r){let r=t.routeSlug??n;if(r!==void 0){if(!Array.isArray(t.chunks)||t.chunks.some(e=>typeof e!=`string`))throw Error(`markdown for "${e}" returned a document without string chunks.`);if(t.chunks.length!==0){if(i.has(r))throw Error(`markdown for "${e}" returned "${r}" twice.`);if(t.rbacScope!==void 0&&!_(t.rbacScope))throw Error(`markdown for "${e}" returned "${r}" with an invalid rbacScope.`);i.add(r),a.push({routeSlug:r,chunks:t.chunks,headings:t.headings,...typeof t.title==`string`&&t.title!==``?{title:t.title}:{},...typeof t.description==`string`&&t.description!==``?{description:t.description}:{},...t.rbacScope===void 0?{}:{rbacScope:t.rbacScope}})}}}return a}async function q(e,t){let n=await e.db.select({id:d.id,data:d.data,dataHash:d.dataHash}).from(d).where(R(d.id,t.map(e=>e.id)));return new Map(n.map(e=>[e.id,e]))}function ee(e,t,n){let r=[...e.routeBySlug.values()].filter(e=>e.wildcardPrefix),a=t=>{if(e.routeBySlug.has(t))return t;let n=new Set(s(t)),i;for(let e of r)n.has(e.slug)&&(i===void 0||e.slug.length>i.length)&&(i=e.slug);return i};return r=>{let o=t.index(r),s=e=>o.getAccess(a(e)??e),c=t=>e.routeBySlug.get(a(t)??t);return{accessForSlug:s,localeForSlug:e=>c(e)?.locale??``,originFilePathForSlug:e=>c(e)?.originFilePath??null,versionForSlug:e=>{let t=c(e);return t?.versionGroup!=null&&t.version!=null?{group:t.versionGroup,version:t.version}:null},productForSlug:e=>{let t=c(e),r=t?t.canonicalSlug||t.slug:e;return i(n,r)}}}}function te(e){return new Set(n(e.config).map(e=>e.field).filter(e=>e!==t))}function J(e,t,n){let r=t.fragments??[],i=t.uses??[];if(!Array.isArray(r)||!Array.isArray(i))throw Error(`searchable for "${e}" must return fragments and uses as arrays.`);for(let t of r)if(typeof t.fragmentKey!=`string`||typeof t.name!=`string`)throw Error(`searchable for "${e}" returned a fragment without a key or name.`);let a=new Set(n.map(e=>e.docKey));return{fragments:r,uses:i.filter(e=>a.has(e.docKey))}}function ne(e,t){return{async prepare(n,i,a){if(!Array.isArray(i))throw Error(`searchable for "${n}" must return { docs: SearchDocument[] }.`);let o=/* @__PURE__ */ new Set,s=/* @__PURE__ */ new Set,c=[],l=[];for(let u of i){if(X(n,u),o.has(u.docKey))throw Error(`searchable for "${n}" returned docKey "${u.docKey}" twice.`);o.add(u.docKey);let i=r(u.routeSlug),d=a.accessForSlug(i);if(d===void 0){e.warn(`search document "${u.docKey}" of "${n}" dropped: no route "${i}"`);continue}let{facets:f,rbacScope:p,keywords:m,...h}=u,g=a.productForSlug(i),_=a.versionForSlug(i),v=P({facets:f,configuredFields:t.configuredFields,groupKey:u.groupKey,teams:N(d,p),version:_,product:g?.name??null,keywords:w(m),onDropped:(e,t)=>{let r=`${e}\u0000${t}`;s.has(r)||(s.add(r),c.push(A({entityKey:n,field:e,reason:Y[t],filePath:a.originFilePathForSlug(i)})))}}),y={...h,routeSlug:i,locale:a.localeForSlug(i),facets:v};g&&(y.product={name:g.name,folder:g.folder}),_&&(y.version=_),l.push(y)}return{docs:l,problems:c}}}}const Y={"not-an-object":`facets must be an object of field to string or string list`,reserved:`fields starting with "redocly_" are derived by the engine`,invalid:`a value must be a string, number, boolean, or a list of those`,"too-long":`a value must be at most 500 characters`,"too-many-words":`a keyword must have at most 10 words`};function X(e,t){let n=t;if(!(typeof n==`object`&&n&&typeof n.docKey==`string`&&n.docKey!==``&&typeof n.routeSlug==`string`&&typeof n.title==`string`&&typeof n.text==`string`))throw Error(`searchable for "${e}" returned an invalid document (docKey, routeSlug, title, text are required strings).`);if(n.rbacScope!==void 0&&!_(n.rbacScope))throw Error(`searchable for "${e}" returned document "${n.docKey}" with an invalid rbacScope.`)}async function re(e,t){let n=/* @__PURE__ */ new Map;for(let r of t===void 0?[void 0]:l(t,u(void 0))){let t=await e.db.selectDistinct({entityKey:m.entityKey,sourceHash:m.sourceHash,pluginVersion:m.pluginVersion}).from(m).where(r===void 0?void 0:R(m.entityKey,[...r]));for(let{entityKey:e,...r}of t)n.set(e,r);let i=await e.db.selectDistinct({entityKey:f.entityKey,sourceHash:f.sourceHash,pluginVersion:f.pluginVersion}).from(f).where(r===void 0?void 0:R(f.entityKey,[...r]));for(let{entityKey:e,...t}of i)n.has(e)||n.set(e,t)}return n}async function ie(e,t,n){return n!==void 0&&n.length===0?[]:(await e.db.select({id:d.id,key:d.key,loaderId:d.loaderId,dataHash:d.dataHash}).from(d).where(I(L(d.status,`ready`),L(d.isCurrent,1),R(d.loaderId,[...t]),n===void 0?void 0:R(d.key,[...n]))).orderBy(d.key)).filter(e=>e.loaderId!==null)}async function ae(e,t,n){let r=/* @__PURE__ */ new Set;if(n.length===0)return r;let i=new Set(n),a=n.length<=u(void 0),o=await e.db.select({entityId:p.entityId,kind:p.kind,argument:p.argument,resultHash:p.resultHash}).from(p).where(I(L(p.hook,`searchable`),a?R(p.entityId,[...n]):void 0));for(let e of o)e.entityId!==null&&i.has(e.entityId)&&!r.has(e.entityId)&&x(t,e)&&r.add(e.entityId);return r}function Z(e,t){for(let n of e)n.kind===`inline`&&t.set(n.key,n.searchable)}export{Z as collectInlineSearchables,B as runSearchSync};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{normalizeRouteSlug as e}from"../../../shared/utils/routes/normalize-route-slug.js";import{SYSTEM_ROUTES as t}from"../../../
|
|
1
|
+
import{normalizeRouteSlug as e}from"../../../shared/utils/routes/normalize-route-slug.js";import{SYSTEM_ROUTES as t}from"../../../shared/constants/system-routes.js";import{toSlugCollisionProblems as n,toWildcardShadowProblems as r}from"../../problems/producers.js";import{resolveSlugsAndHandleCollisions as i}from"./resolve-slugs-and-handle-collisions.js";const a=new Set(t.map(e));function o(e){return/* @__PURE__ */ new Set([...a,...e?.keys()??[]])}function s(e){let t=[...e.state.routesByOriginKey.values()].flat(),o=new Map([...a].map(e=>[e,null]));for(let[t,n]of e.reservedSlugs??[])o.has(t)||o.set(t,n);let{collisions:s,resolved:u,warnings:d}=i(t,o);for(let t of s)e.logger.debug(`Route slug collision — dev serves the first processed member`,{slug:t.slug,kind:t.kind,members:t.members.map(e=>`${e.originFilePath} (${e.originPluginId})`)});let f=new Set(d.map(c));l({warnings:d,previousShadowKeys:e.previousWildcardShadows,logger:e.logger});let p=new Map(s.map(e=>[e.slug,e]));return{collisions:p,routeBySlug:new Map(u.map(e=>[e.slug,e.candidate])),wildcardShadows:f,problems:[...n(p),...r(d)]}}function c(e){return`${e.slug} ${e.paths[1]??``}`}function l(e){for(let t of e.warnings)e.previousShadowKeys.has(c(t))||e.logger.debug(`Route slug conflict`,t)}export{a as SYSTEM_SLUGS,o as allReservedSlugs,s as resolveFinalSlugs};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{L10N_DIR as e}from"../../shared/constants/l10n/defaults.js";import{
|
|
1
|
+
import{L10N_DIR as e}from"../../shared/constants/l10n/defaults.js";import{hashContentConfigDependency as t}from"../config-deps.js";import{createProblem as n}from"../problems/codes.js";import{garbageCollectOrphanedEntities as r,propagateRouteQueryInvalidation as i}from"../database/invalidation.js";import{problemRow as a}from"../database/problems.js";import{loadFileManifestsByPaths as o}from"../database/files.js";import{resolveContentPluginsForFile as s}from"../plugins/registry.js";import{L10N_PLUGIN_ID as c}from"../plugins/internal/l10n/translations-loader.js";import"../plugins/internal/l10n/index.js";import{extractFileContributions as l}from"../plugins/execute.js";import{createSourceFile as u}from"../plugins/source-file.js";import{createContentOriginKey as d}from"../plugins/utils/origin-key.js";import"../plugins/index.js";import{loadContentLayerState as f,reloadContentLayerEntities as p}from"../context-state.js";import{resolveRevisionsConfig as m}from"../revisions/config.js";import{bulkSyncOrigins as ee}from"../database/origins.js";import{extractFailedProblem as h,sluggerProblemSources as g}from"../problems/producers.js";import{createEntityMaterializer as _}from"../materialization/materializer.js";import{finalizeHookInputs as te,hasAnyPluginHookTrigger as ne}from"./hook-inputs.js";import{collectInlineSearchables as v}from"./search-sync.js";import{dropCollidingRoutes as y}from"./slugger/drop-colliding-routes.js";import{allReservedSlugs as b,resolveFinalSlugs as x}from"./slugger/resolve-final-slugs.js";import{normalizePluginArtifacts as S}from"./normalize-artifacts.js";import{runFinalizePhase as C}from"./finalize-phase.js";import{applyOriginRoutesToWorkingState as w,cloneContentLayerState as T,removeFileFromWorkingState as E,removeOriginFromWorkingState as D}from"./working-state.js";import{dropCollidingExtractAllRoutes as O,runExtractAllPhase as k}from"./extract-all-phase.js";import{diffFallbackRoutes as re,generateFallbackRoutes as ie}from"./generate-fallback-routes.js";async function A(t){let n=await f({context:t.context,database:t.database}),i=T(n);for(let e of t.removedPaths)E(i,e);if(t.files.length===0&&t.removedPaths.size===0&&![`extractAll`,`finalize`].some(e=>ne(e,t.context,n,t.pluginScopedOriginRows,t.routeQueryRows,t.hookState,e===`finalize`?te(t.localeContext):void 0)))return await N(t,i),{state:i,inlineSearchables:/* @__PURE__ */ new Map,routeChanges:{changedSlugs:[],unbounded:!1}};let h=t.context.logger.child(`content-layer:sync`),{localeContext:S}=t,A=F(t.context.config,`/l10n`),j=F(t.context.config,`/metadataGlobs`),M=m(t.context.config),P=t.revisions,L=()=>_({deps:{...t.context,state:i},database:t.database,revisions:P}),R=await k({context:t.context,database:t.database,materializer:L(),files:t.files,originRows:t.pluginScopedOriginRows,routeQueryRows:t.routeQueryRows,hookState:t.hookState,logger:t.context.logger.child(`content-layer:extractAll`)}),z=t.context.logger.child(`content-layer:plugin`),B=t.files.filter(e=>e.manifest===void 0).map(e=>e.path),V=await o(t.database,B),H=t.context.pluginRegistry.list().map(e=>e.id);D(i,H,c,null);let U=[],W=`${e}/`,G=t.files.map(e=>({file:e,localized:Number(e.path.startsWith(W))})).sort((e,t)=>e.localized-t.localized).map(e=>e.file);for(let[e,n]of G.entries()){let r=i.filesByPath.get(n.path)??i.ignoredFilesByPath.get(n.path);if(!r)throw Error(`Missing stored file state for "${n.path}".`);let a=s(t.context,n.path),o=(i.filePluginsByPath.get(n.path)??[]).map(e=>e.pluginId).filter(e=>!a.some(t=>t.id===e)),c=[];for(let e of o)D(i,H,e,n.path),c.push({hook:`extract`,originDependencies:[],originFileId:r.id,originFilePath:n.path,originPluginId:e,routeDependencies:[],routes:[],entities:[],problems:[]});for(let e of a)D(i,H,e.id,n.path);let d=u({path:n.path,hash:n.hash,manifest:n.manifest??V.get(n.path)??{}}),f=await l(a,d,{config:t.context.config,fs:t.context.platform.fs,contentDir:t.context.contentDir,scannedPaths:()=>i.filesByPath.keys(),logger:z});for(let e of f)I({context:t.context,workingState:i,allPluginIds:H,filePath:n.path,fileRecord:r,attempt:e,origins:c,revisions:M,localeContext:S,l10nConfigDependency:A,metadataGlobsConfigDependency:j,pluginLogger:z});let p=a.map(e=>({id:e.id,version:e.version}));U.push({fileId:r.id,filePath:n.path,plugins:p,origins:c}),i.filePluginsByPath.set(n.path,p.map(e=>({fileId:r.id,pluginId:e.id,pluginVersion:e.version}))),t.onFileSynced?.(e+1,G.length)}let K=t.context.pluginRegistry.listReservedSlugs(),{collisions:q,routeBySlug:oe,wildcardShadows:se,problems:J}=x({state:i,previousWildcardShadows:n.wildcardShadows,reservedSlugs:K,logger:h});i.wildcardShadows=se,i.routeBySlug=oe;let ce=/* @__PURE__ */ new Set([...t.files.map(e=>e.path),...t.removedPaths,...R.pending.map(e=>e.pluginId),...R.failures.map(e=>e.pluginId)]),Y=new Set(J.map(e=>e.key));for(let e of t.storedSluggerProblems){if(e.key===null)continue;let t=g(e.data);t.length>0&&t.every(e=>ce.has(e))&&Y.add(e.key)}y({state:i,bulkItems:U,collisions:q,allPluginIds:H}),O(R.pending,q);let X=ie({state:i,localeContext:S,reservedSlugs:b(K)}),le=re(n.routesByOriginKey.get(d(`internal.l10n`,null))??[],X);w(i,H,c,null,X);let Z=/* @__PURE__ */ new Map;for(let e of U)for(let t of e.origins)v(t.entities,Z);for(let e of R.pending)v(e.entities,Z);let Q=/* @__PURE__ */ new Set;if(P){for(let e of U)if(P.isTracked(e.filePath))for(let t of e.origins)for(let e of t.entities)Q.add(e.key)}await ee(t.database,U,{logger:z,revisions:P?{max:P.max,trackedKeys:Q}:void 0,extractAllOrigins:R.pending.map(e=>({hook:`extractAll`,originFileId:null,originFilePath:null,originPluginId:e.pluginId,originDependencies:e.originDependencies,routeDependencies:e.routeDependencies,routes:e.routes,entities:e.entities,problems:[],fingerprint:e.inputsHash,routeQueries:e.routeQueries})),extractAllFailures:R.failures,globalProblems:{source:`slugger`,keys:[...Y],newProblems:J.map(e=>a(e.problem,{scope:`global`,source:`slugger`,key:e.key}))},fallbackRoutes:{pluginId:c,...le}}),await p({state:i,database:t.database}),await N(t,i);let $=await C({context:t.context,database:t.database,localeContext:S,materializer:L(),files:t.files,pluginScopedOriginRows:t.pluginScopedOriginRows,routeQueryRows:t.routeQueryRows,hookState:t.hookState,logger:t.context.logger.child(`content-layer:finalize`),collectEntities:e=>v(e,Z)}),ue=await r(t.database);return($.ranPluginIds.length>0||ue.removedOrphans)&&await p({state:i,database:t.database}),{state:i,inlineSearchables:Z,routeChanges:ae(n.routeBySlug,i.routeBySlug)}}function ae(e,t){let n=[];for(let[r,i]of e){let e=t.get(r);(e===void 0||e.originFilePath!==i.originFilePath)&&n.push(r)}for(let r of t.keys())e.has(r)||n.push(r);return{changedSlugs:n,unbounded:!j(e,t)}}function j(e,t){let n=M(e),r=M(t);return n.size===r.size&&[...n].every(e=>r.has(e))}function M(e){let t=/* @__PURE__ */ new Set;for(let[n,r]of e)r.wildcardPrefix&&t.add(n);return t}async function N(e,t){let{invalidatedKeys:n}=await i(e.database,{rows:e.routeQueryRows,state:t,config:e.context.config,logger:e.context.logger.child(`content-layer:db`)});for(let e of n){let n=t.entitiesByKey.get(e);n&&(n.status=`stale`)}}function P(e){return[...e.configDependencies.map(e=>({...e,source:`config`})),...e.fileDependencies]}function F(e,n){return{source:`config`,accessType:`value`,path:n,valueHash:t(e,{accessType:`value`,path:n})}}function I(e){let{context:t,workingState:r,allPluginIds:i,filePath:a,fileRecord:o,attempt:s}=e,c=s.result.ok?s.result.value:null,l=e.localeContext.isL10nPath(a)?[...P(s),e.l10nConfigDependency]:P(s);if(!c){e.origins.push({hook:`extract`,originDependencies:l,originFileId:o.id,originFilePath:a,originPluginId:s.plugin.id,routeDependencies:[],routes:[],entities:[],problems:s.result.ok?[]:[h({filePath:a,pluginId:s.plugin.id,message:s.result.error.message})]});return}let u=S({context:t,filePath:a,pluginId:s.plugin.id,revisions:e.revisions,routeDrafts:c.routes,standaloneEntities:c.entities??[],localeContext:e.localeContext,resolveCanonicalRoute:(e,t)=>r.routesByOriginKey.get(d(s.plugin.id,e))?.find(e=>e.routeId===t)});w(r,i,s.plugin.id,a,u.routes),e.origins.push({hook:`extract`,originDependencies:u.routes.length>0?[...l,e.metadataGlobsConfigDependency]:l,originFileId:o.id,originFilePath:a,originPluginId:s.plugin.id,routeDependencies:u.routeDependencies,routes:u.routes,entities:u.entities,problems:(c.problems??[]).map(e=>n({...e,location:e.location??{filePath:a}})),linkRefs:c.linkRefs})}export{A as syncContentFiles};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{hasPluginLinkRefs as e,replacePluginLinkRefsTx as t}from"../database/link-refs.js";import{classifyLinkTarget as n}from"./classify.js";const r=`internal.config-links`,i=`redocly.yaml`,a=[{pick:e=>c(e.navbar?.items,`navbar.items`)},{pick:e=>c(e.footer?.items,`footer.items`)},{pick:l}];function o(e){let t=[];for(let r of a)for(let{raw:a,configPath:o}of r.pick(e)){let e=n(a,i);e!==null&&t.push({kind:`link`,raw:a,filePath:i,data:{configPath:o},...e})}return t}async function s(n){try{if(!n.configChanged&&await e(n.database,`internal.config-links`))return;let a=o(n.config);await n.database.db.transaction(e=>t(e,{originPluginId:r,filePath:i,drafts:a}))}catch(e){n.logger?.warn(`Config link sync failed; stored config link refs were left unchanged.`,{error:e instanceof Error?e.message:String(e)})}}function c(e,t){let n=[];return e?.forEach((e,r)=>{let i=`${t}[${r}]`;typeof e.page==`string`&&n.push({raw:e.page,configPath:`${i}.page`}),typeof e.href==`string`&&n.push({raw:e.href,configPath:`${i}.href`}),n.push(...c(e.items,`${i}.items`))}),n}function l(e){let t=[];for(let[n,r]of Object.entries(e.redirects??{})){let e=r?.to;typeof e!=`string`||e.endsWith(`*`)||t.push({raw:e,configPath:`redirects['${n}'].to`})}return t}export{r as CONFIG_LINKS_PLUGIN_ID,o as collectConfigLinkRefs,s as syncConfigLinkRefs};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{batchValues as e}from"../database/connection.js";import{entities as t,entityDeps as n,files as r,linkRefs as i}from"../database/schema.js";import{
|
|
1
|
+
import{batchValues as e}from"../database/connection.js";import{entities as t,entityDeps as n,files as r,linkRefs as i}from"../database/schema.js";import{createProblem as a}from"../problems/codes.js";import{deleteProblemsForLinkRefsTx as o,insertProblemsTx as s,problemRow as c,replaceAllLinkProblemsTx as l}from"../database/problems.js";import{clearLinkCheckCheckpointTx as u}from"../database/link-check-checkpoint.js";import{loadLinkCheckView as d}from"./load-view.js";import{unresolvedFilePathRefReads as f,validateLinkRefs as p}from"./validate.js";import{and as m,eq as h,getTableColumns as g,gte as _,inArray as v,lt as y,notInArray as b,or as x}from"drizzle-orm";function S(e){return{run:t=>w(e.logger,()=>T(e,t))}}async function C(e){await w(e.logger,async()=>{let i=await e.database.db.select({entityId:t.id,path:r.path}).from(t).leftJoin(n,h(n.entityId,t.id)).leftJoin(r,h(n.originFileId,r.id)).where(m(h(t.key,e.entityKey),h(t.isCurrent,1))),a=i[0]?.entityId;if(a===void 0)return;let o=i.map(e=>e.path).filter(e=>e!==null),s=[...new Set(o)],c=e.viewCache?await e.viewCache.refreshInventories(s):void 0;await T(e,{entityIds:[a],originFilePaths:[],changedSlugs:[],changedFilePaths:s,unbounded:!1},c)})}async function w(e,t){try{await t()}catch(t){e?.warn(`Incremental link check failed; stored link problems were left unchanged.`,{error:t instanceof Error?t.message:String(t)})}}async function T(e,t,n){if(t.unbounded){await E(e);return}if(!D(t))return;let r=n??await d(e),i=await O(e.database,t,r);if(i.length===0)return;let a=p(i,r).map(j),c=i.map(e=>e.id);await e.database.db.transaction(async e=>{await o(e,c),await s(e,a),await u(e)}),e.logger?.debug(`Incremental link check complete`,{refs:i.length,broken:a.length})}async function E(e){let[t,n]=await Promise.all([e.database.db.select().from(i),d(e)]),r=p(t,n).map(j);await e.database.db.transaction(async e=>{await l(e,r),await u(e)}),e.logger?.debug(`Full link check complete`,{refs:t.length,broken:r.length})}function D(e){return e.entityIds.length>0||e.originFilePaths.length>0||e.changedSlugs.length>0||e.changedFilePaths.length>0}async function O(t,n,a){let o=/* @__PURE__ */ new Map,s=e=>{for(let t of e)o.set(t.id,t)};for(let r of e(n.entityIds,500))s(await t.db.select().from(i).where(v(i.entityId,r)));for(let a of e(n.originFilePaths,500))s(await t.db.select(g(i)).from(i).innerJoin(r,h(i.originFileId,r.id)).where(v(r.path,a)));let c=new Set(n.changedSlugs);for(let e of n.changedFilePaths)for(let t of a.routeSlugsBySourcePath.get(e)??[])c.add(t);for(let n of e([...c],500))s(await t.db.select().from(i).where(m(h(i.targetKind,`slug`),v(i.target,n))));let l=[...c].filter(e=>a.routeBySlug.get(e)?.wildcardPrefix===!0);for(let n of e(l,20)){let e=n.map(e=>{let t=k(e);return m(_(i.target,t),y(i.target,A(t)))});s(await t.db.select().from(i).where(m(h(i.targetKind,`slug`),x(...e))))}for(let r of e(n.changedFilePaths,500))s(await t.db.select().from(i).where(m(h(i.targetKind,`file-path`),v(i.target,r))));if(c.size>0||n.changedFilePaths.length>0){let e=new Set(n.changedFilePaths);s((await t.db.select().from(i).where(m(h(i.targetKind,`file-path`),b(i.target,t.db.select({path:r.path}).from(r))))).filter(t=>{let n=f(t,a);return n.filePaths.some(t=>e.has(t))||n.slugs.some(e=>c.has(e)||l.some(t=>e.startsWith(k(t))))}))}return[...o.values()]}function k(e){return e===`/`?`/`:`${e}/`}function A(e){return`${e.slice(0,-1)}0`}function j(e){return c(a(e.problem),{scope:`link`,linkRefId:e.ref.id})}export{S as createDevLinkCheckSession,O as loadAffectedRefs,C as runMaterializationLinkCheck};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{hashContentBytes as e}from"../../shared/utils/content-hash.js";import{inventoryKey as t}from"./view.js";import"./validate.js";const n=`route:`,r=`file:`,i=new TextEncoder;async function a(e,i){let a={};for(let[t,r]of e.routeBySlug)a[`${n}${t}`]=JSON.stringify([r.wildcardPrefix,r.sourcePath]);for(let t of e.servedStaticPaths)a[`static:${t}`]=``;for(let n of e.filePaths)a[`${r}${n}`]=JSON.stringify([i.get(n)??null,e.primaryRouteByFilePath.get(n)??null,await s(e.inventories.get(t(n,`anchor`))),await s(e.inventories.get(t(n,`subpath`)))]);return{unboundedInputs:JSON.stringify([
|
|
1
|
+
import{hashContentBytes as e}from"../../shared/utils/content-hash.js";import{inventoryKey as t}from"./view.js";import"./validate.js";const n=`route:`,r=`file:`,i=new TextEncoder;async function a(e,i){let a={};for(let[t,r]of e.routeBySlug)a[`${n}${t}`]=JSON.stringify([r.wildcardPrefix,r.sourcePath]);for(let t of e.servedStaticPaths)a[`static:${t}`]=``;for(let n of e.filePaths)a[`${r}${n}`]=JSON.stringify([i.get(n)??null,e.primaryRouteByFilePath.get(n)??null,await s(e.inventories.get(t(n,`anchor`))),await s(e.inventories.get(t(n,`subpath`)))]);return{unboundedInputs:JSON.stringify([6,e.localeContext.defaultLocale,e.localeContext.locales,Object.keys(e.redirects).sort().map(t=>[t,e.redirects[t]?.to]),[...e.wildcardSlugs].sort(),e.checkAnchors,e.anchorSeverity]),targets:a}}function o(e,t){let i=[],a=[],o=e=>{e.startsWith(r)?a.push(e.slice(5)):i.push(e.slice(e.startsWith(n)?6:7))};for(let[n,r]of Object.entries(t))e[n]!==r&&o(n);for(let n of Object.keys(e))Object.hasOwn(t,n)||o(n);return{changedSlugs:i,changedFilePaths:a}}async function s(t){if(t===void 0)return null;let n=`${t.exhaustive}\0${[...t.targets].join(`\0`)}`;return e(i.encode(n))}export{o as diffLinkCheckTargets,a as fingerprintLinkCheckView};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{collectL10nDirLocales as e,resolveLocaleContext as t}from"../../shared/utils/l10n.js";import{files as
|
|
1
|
+
import{collectL10nDirLocales as e,resolveLocaleContext as t}from"../../shared/utils/l10n.js";import{toPublicVersionedSlug as n}from"../../shared/constants/versions.js";import{files as r,routes as i,staticFiles as a,targetInventories as o}from"../database/schema.js";import{getVersionCatalog as s}from"../versions/resolve.js";import{buildLinkCheckView as c}from"./view.js";import{asc as l,eq as u}from"drizzle-orm";async function d(n){let{database:s}=n,[d,m,h,g]=await Promise.all([s.db.select({slug:i.slug,wildcardPrefix:i.wildcardPrefix,sourcePath:r.path,version:i.version,versionGroup:i.versionGroup}).from(i).leftJoin(r,u(i.sourceId,r.id)).orderBy(l(i.id)),s.db.select({filePath:r.path,kind:o.kind,exhaustive:o.exhaustive,targets:o.targets}).from(o).innerJoin(r,u(o.fileId,r.id)),s.db.select({path:r.path}).from(r),s.db.select({path:a.path}).from(a)]),_=h.map(e=>e.path),v=t(n.config.l10n,e(_));return c({routes:await p(s,d),filePaths:_,inventories:m,redirects:f(n.config),servedStaticPaths:g.map(e=>`/${e.path}`),localeContext:v,checkAnchors:n.config.linkChecker?.anchors?.hide!==!0,anchorSeverity:n.config.linkChecker?.anchors?.severity??`warning`})}function f(e){return Object.fromEntries(Object.entries(e.redirects??{}).map(([e,t])=>[e,t.to]))}async function p(e,t){let r=await s(e.db),i=new Set(t.map(e=>e.slug)),a=[];for(let e of t){if(!e.versionGroup||!e.version||(await r.groupInfo(e.versionGroup)).defaultVersion!==e.version)continue;let t=n(e.slug,e.versionGroup,e.version,!0);t!==e.slug&&!i.has(t)&&a.push({...e,slug:t})}return[...t,...a]}export{d as loadLinkCheckView};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{markdocNodeRange as e}from"../markdown/utils/node-source-range.js";import{markdocAstToText as t}from"../markdown/search/to-text.js";import{safeDecodeURI as n}from"../../shared/utils/safe-decode-uri.js";import{
|
|
1
|
+
import{markdocNodeRange as e}from"../markdown/utils/node-source-range.js";import{markdocAstToText as t}from"../markdown/search/to-text.js";import{safeDecodeURI as n}from"../../shared/utils/safe-decode-uri.js";import{classifyLinkTarget as r}from"./classify.js";import{shiftRange as i}from"../../shared/utils/shift-range.js";function a(t){let i=r(n(t.raw),t.sourceFilePath);if(i===null)return null;let a=l(t.node,t.kind);return{kind:t.kind,raw:t.raw,...i,...a===``?{}:{title:a},range:e(t.node)}}function o(e,t){return e.map(e=>e.filePath===void 0?c(e,t):e)}function s(e,t,n){return e.map(e=>e.filePath===void 0?{...c(e,n),filePath:t}:e)}function c(e,t){return t===0||e.range===void 0?e:{...e,range:i(e.range,t)}}function l(e,n){if(n===`image`){let t=e.attributes.alt;return typeof t==`string`?t:``}return e.type===`link`?t(e):``}export{s as inlinedLinkRefs,a as linkRefDraftFromNode,o as onDiskLinkRefs};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{entities as e,files as t,linkRefs as n,problems as r}from"../database/schema.js";import{
|
|
1
|
+
import{entities as e,files as t,linkRefs as n,problems as r}from"../database/schema.js";import{createProblem as i}from"../problems/codes.js";import{deleteOrphanedLinkProblemsTx as a,deleteProblemsForLinkRefsTx as o,insertProblemsTx as s,problemRow as c,replaceAllLinkProblemsTx as l}from"../database/problems.js";import{captureSnippet as u,splitSourceLines as d}from"../../shared/utils/capture-snippet.js";import{loadLinkCheckCheckpoint as f,writeLinkCheckCheckpointTx as p}from"../database/link-check-checkpoint.js";import{loadLinkCheckView as m}from"./load-view.js";import{validateLinkRefs as h}from"./validate.js";import{loadAffectedRefs as g}from"./delta.js";import{narrowRangeToTarget as _}from"../../shared/utils/narrow-range-to-target.js";import{diffLinkCheckTargets as v,fingerprintLinkCheckView as y}from"./fingerprint.js";import{and as b,asc as x,count as S,eq as C,gt as w}from"drizzle-orm";async function T(e){try{return await E(e)}catch(t){return e.logger?.warn(`Link check failed; stored link problems were left unchanged.`,{error:t instanceof Error?t.message:String(t)}),{ok:!1}}}async function E(e){let[t,n,r]=await Promise.all([m(e),A(e.database),f(e.database)]),i=await y(t,n);return r===null||r.unboundedInputs!==i.unboundedInputs?D(e,t,i):O(e,t,i,r)}async function D(e,t,n){let r=[],{judged:i,judgedThroughRefId:a}=await k(e.database,t,0,r),o=await M(r,e.readSourceFile);return await e.database.db.transaction(async e=>{await l(e,o),await p(e,{...n,judgedThroughRefId:a})}),{ok:!0,checked:i,broken:o.length,judged:i}}async function O(e,t,i,c){let{database:l}=e,u=v(c.targets,i.targets),d=await j(l),f=(await g(l,{entityIds:d,originFilePaths:u.changedFilePaths,changedSlugs:u.changedSlugs,changedFilePaths:u.changedFilePaths},t)).filter(e=>e.id<=c.judgedThroughRefId),m=h(f,t),_=await k(l,t,c.judgedThroughRefId,m),y=f.length+_.judged,b=u.changedSlugs.length>0||u.changedFilePaths.length>0;if(y>0||b){let t=await M(m,e.readSourceFile);await l.db.transaction(async e=>{await o(e,f.map(e=>e.id)),await s(e,t),await a(e),await p(e,{...i,judgedThroughRefId:_.judgedThroughRefId})})}let[[x],[w]]=await Promise.all([l.db.select({value:S()}).from(n),l.db.select({value:S()}).from(r).where(C(r.scope,`link`))]);return{ok:!0,checked:x?.value??0,broken:w?.value??0,judged:y}}async function k(e,t,r,i){let a=0,o=r;for(;;){let r=await e.db.select().from(n).where(w(n.id,o)).orderBy(x(n.id)).limit(1e4),s=r.at(-1);if(s===void 0)break;for(let e of h(r,t))i.push(e);a+=r.length,o=s.id}return{judged:a,judgedThroughRefId:o}}async function A(e){let n=await e.db.select({path:t.path,hash:t.hash}).from(t);return new Map(n.map(e=>[e.path,e.hash]))}async function j(t){return(await t.db.select({id:e.id}).from(e).where(b(C(e.status,`stale`),C(e.isCurrent,1)))).map(e=>e.id)}async function M(e,t){let n=/* @__PURE__ */ new Map;e.forEach(({ref:e,problem:t},r)=>{let i=t.location;if(i?.range===void 0)return;let a={index:r,raw:e.raw,location:i,range:i.range},o=n.get(e.filePath);o===void 0?n.set(e.filePath,[a]):o.push(a)});let r=/* @__PURE__ */ new Map;for(let[e,i]of n){let n=await t(e);if(n===null)continue;let a=d(n);for(let{index:e,raw:t,location:n,range:o}of i){let i=_(a,o,t);r.set(e,{...n,range:i,snippet:u(a,i)})}}return e.map(({ref:e,problem:t},n)=>{let a=r.get(n),o=a===void 0?t:{...t,location:a};return c(i(o),{scope:`link`,linkRefId:e.id})})}export{T as runBuildLinkCheck};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{delocalizeL10nPath as e}from"../../shared/utils/l10n.js";import{
|
|
1
|
+
import{delocalizeL10nPath as e}from"../../shared/utils/l10n.js";import"../plugins/internal/api-docs/server/shared.js";import{matchRedirect as t}from"../../shared/utils/redirect-match.js";import{computePathPrefixes as n}from"../../shared/utils/routes/compute-path-prefixes.js";import{isIndexPagePath as r,resolveRelativeSlug as i}from"../../shared/utils/routes/resolve-relative-slug.js";import{splitHash as a}from"../markdown/resolve/references.js";import{filePathToRouteSlug as o}from"../../shared/utils/routes/file-path-to-route-slug.js";import{inventoryKey as s}from"./view.js";import{posix as c}from"node:path";function l(e,t){let n=[];for(let r of e){let e=r.targetKind===`slug`?d(r,t):p(r,t);e!==null&&n.push({ref:r,problem:e})}return n}function u(t,n){let r=[t.target,t.filePath],i=[],a=e=>{t.raw.startsWith(`/`)?i.push(`/${e}`):c.extname(e)===``&&i.push(h(t,e,n))};a(t.target);let o=e(t.target);return o!==void 0&&(r.push(o),a(o)),{filePaths:r,slugs:i}}function d(e,t){let n=f(e,e.target,t);return n===void 0?S(e,e.target):n}function f(e,n,r){let i=r.routeBySlug.get(n);if(i!==void 0)return _(e,i.sourcePath,r,n);if(t(n.toLowerCase(),r.redirects)!==null||r.servedStaticPaths.has(n))return null;let a=y(n,r);if(a===null)return;let o=b(r,a.sourcePath,`subpath`);return x(o,a.remainder)&&x(o,a.remainder.toLowerCase())?S(e,n):null}function p(t,n){let r=m(t,t.target,n);if(r!==void 0)return r;let i=e(t.target);if(i!==void 0){let{locale:e}=n.localeContext.splitLocaleFromPath(t.target),r=m(t,i,n,e);if(r!==void 0)return r}return S(t,g(t.target,n))}function m(e,t,n,r){let i=n.primaryRouteByFilePath.get(t);if(i!==void 0)return _(e,t,n,r===void 0?i:n.localeContext.toL10nSlug(i,r));if(n.filePaths.has(t))return null;if(e.raw.startsWith(`/`))return f(e,`/${t}`,n);if(c.extname(t)===``)return e.originPluginId===`internal.api-docs`?null:f(e,h(e,t,n),n)}function h(e,t,n){let s=n.primaryRouteByFilePath.get(e.filePath);if(s===void 0)return o(t);let c=a(e.raw).path.split(`?`,1)[0]??``;return i(c,s,r(e.filePath))}function g(t,n){let r=e(t);if(r===void 0)return o(t);let{locale:i}=n.localeContext.splitLocaleFromPath(t);return n.localeContext.toL10nSlug(o(r),i)}function _(e,t,n,r){if(!n.checkAnchors||e.kind===`image`||e.fragment===null||e.fragment===``||t===null)return null;let i=v(e.fragment);if(i.toLowerCase()===`top`)return null;let a=b(n,t,`anchor`);return x(a,e.fragment)&&x(a,i)?C(e,r,n.anchorSeverity):null}function v(e){try{return decodeURIComponent(e)}catch{return e}}function y(e,t){let r=new Set(n(e));for(let n of t.wildcardSlugs){if(!r.has(n))continue;let i=t.routeBySlug.get(n),a=n===`/`?e:e.slice(n.length);return{sourcePath:i?.sourcePath??null,remainder:a.replace(/^\/+/,``)}}return null}function b(e,t,n){return t===null?void 0:e.inventories.get(s(t,n))}function x(e,t){return e!==void 0&&e.exhaustive&&!e.targets.has(t)}function S(e,t){return w(e,`link/missing-target`,e.targetKind===`slug`?`Route "${e.target}" does not exist.`:`"${E(e)}" does not exist.`,T(t,e.fragment))}function C(e,t,n){return w(e,`link/missing-anchor`,`"#${e.fragment}" does not exist on "${E(e)}".`,T(t,e.fragment),n)}function w(e,t,n,r,i){return{code:t,message:n,...i===void 0?{}:{severity:i},location:{filePath:e.filePath,...e.range===null?{}:{range:e.range}},data:{raw:e.raw,target:e.target,fragment:e.fragment,kind:e.kind,title:e.title,url:r,...e.data??{}}}}function T(e,t){return t===null||t===``?e:`${e}#${t}`}function E(e){let t=a(e.raw).path;return t===``?e.target:t}export{u as unresolvedFilePathRefReads,l as validateLinkRefs};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{DEFAULT_LOCALE_PLACEHOLDER as e}from"../../shared/constants/l10n/defaults.js";import{LocaleContext as t}from"../../shared/utils/l10n.js";const
|
|
1
|
+
import{DEFAULT_LOCALE_PLACEHOLDER as e}from"../../shared/constants/l10n/defaults.js";import{LocaleContext as t}from"../../shared/utils/l10n.js";import{normalizeRedirects as n}from"../config-redirects.js";const r=new t(e,[]);function i(e){let t=/* @__PURE__ */ new Map,i=/* @__PURE__ */ new Map,a=/* @__PURE__ */ new Map,s=[];for(let n of e.routes)if(t.set(n.slug,{wildcardPrefix:n.wildcardPrefix,sourcePath:n.sourcePath}),n.wildcardPrefix&&s.push(n.slug),n.sourcePath!==null&&!i.has(n.sourcePath)&&i.set(n.sourcePath,n.slug),n.sourcePath!==null){let e=a.get(n.sourcePath);e===void 0?a.set(n.sourcePath,[n.slug]):e.push(n.slug)}s.sort((e,t)=>t.length-e.length);let c=/* @__PURE__ */ new Map;o(c,e.inventories);let l=n(Object.fromEntries(Object.entries(e.redirects??{}).map(([e,t])=>[e,{to:t}])))??{};return{localeContext:e.localeContext??r,routeBySlug:t,wildcardSlugs:s,primaryRouteByFilePath:i,routeSlugsBySourcePath:a,filePaths:new Set(e.filePaths),inventories:c,redirects:l,servedStaticPaths:new Set(e.servedStaticPaths??[]),checkAnchors:e.checkAnchors??!0,anchorSeverity:e.anchorSeverity??`warning`}}function a(e,t){return`${e}\n${t}`}function o(e,t){for(let n of t){let t=a(n.filePath,n.kind),r=e.get(t);if(r===void 0){e.set(t,{exhaustive:n.exhaustive,targets:new Set(n.targets)});continue}r.exhaustive=r.exhaustive&&n.exhaustive;for(let e of n.targets)r.targets.add(e)}}export{i as buildLinkCheckView,a as inventoryKey,o as mergeInventoryRows};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{collectL10nDirLocales as e,resolveLocaleContext as t}from"../../shared/utils/l10n.js";import{
|
|
1
|
+
import{collectL10nDirLocales as e,resolveLocaleContext as t}from"../../shared/utils/l10n.js";import{versionDefaultEntityKey as n}from"../../shared/constants/versions.js";import{resolveDataRef as r,upsertBlob as i}from"../database/blobs.js";import{createTrackedRedoclyConfig as a}from"../config-deps.js";import{buildDataRefMarker as o,hashBlobContent as s}from"../materialization/data-ref.js";import{createEntityStore as c}from"../database/entity-store.js";import{createRouteQueryEvaluator as l}from"../plugins/utils/route-index.js";import{matchGlob as u}from"../plugins/utils/glob.js";import{createSearchHandle as d}from"../search/store.js";import{createMarkdownService as f}from"../markdown/service.js";import{createAudienceTagResolver as p}from"../markdown/resolve/audience-tag.js";import{resolve as m}from"node:path";function h(h,g,_){let v,y,b,x,S;return function(C,w,T){let E=h.pluginRegistry.getById(C.pluginId);if(!E)throw Error(`Entity loader "${C.definition.id}" references missing plugin "${C.pluginId}".`);let{state:D}=h,O=a(h.config),k=O.config.access?.rbac,A=h.config.access?.rbac;(A!==v||y===void 0)&&(v=A,y=p(k));let j=y,M=O.config.l10n?.defaultLocale;(S===void 0||S.defaultLocale!==M)&&(x??=e(D.filesByPath.keys()),S={defaultLocale:M,locales:t({defaultLocale:M},x).locales});let N=S.locales,P=[],F=[],I=[];(b?.state!==D||b.config!==h.config)&&(b={state:D,config:h.config,evaluator:l(D,h.config)});let L=c({database:g,state:D,materialize:_,onEntityRead:e=>P.push(e),record:e=>F.push(e)}),R=/* @__PURE__ */ new Map,z=e=>{let t=R.get(e);if(t===void 0){let r=n(e);t=L.get(r).then(e=>e===null?null:L.load(r)),R.set(e,t)}return t};return{args:w??{},config:O.config,contentDir:h.contentDir,file:{absolutePath:m(h.contentDir,T),path:T,lastModifiedAt:D.filesByPath.get(T)?.lastModifiedAt??null},io:{...h.pluginIO,async glob(e){return I.push(e),u(D.filesByPath.keys(),e)}},entities:L,search:d(g),logger:h.logger.child(`content-layer:entity:${C.definition.id}`),plugin:{id:E.id,version:E.version},pluginRegistry:h.pluginRegistry,resolveAudienceTag:j,routes:b.evaluator.index(e=>F.push(e)),markdown:f({state:D,resolveAudienceTag:j,contentLocales:N,defaultVersion:z}),createBlobRef:async(e,t)=>{let n=t?.format??`json`,r=typeof e==`string`?e:Buffer.from(e).toString(`base64`),a=s(r);return await i(g,{key:a,content:r,size:r.length}),o(a,n)},resolveDataRef:e=>r(g,e),_trackedConfig:O,_loadedEntityKeys:P,_globPatterns:I,_routeQueries:F}}}export{h as createBuildTimeEntityLoaderContextFactory};
|
|
@@ -15,6 +15,7 @@ import type { SearchableResult } from '../plugins/types/search.js';
|
|
|
15
15
|
import type { SearchHandle } from '../search/store.js';
|
|
16
16
|
import type { EntityStore } from '../database/entity-store.js';
|
|
17
17
|
import type { Logger } from '../../shared/logger.js';
|
|
18
|
+
import type { RbacScope } from '../../shared/rbac/types.js';
|
|
18
19
|
export declare const ENTITY_LOADER_REFERENCE_KIND = "runtime.entity.loader";
|
|
19
20
|
export declare const INLINE_ENTITY_REFERENCE_KIND = "runtime.entity.inline";
|
|
20
21
|
export type EntityLoaderReference<TArgs = unknown> = {
|
|
@@ -88,6 +89,8 @@ export type MarkdownDoc = {
|
|
|
88
89
|
title?: string;
|
|
89
90
|
/** The page's one-line summary in `/llms.txt`, already in its LLM form. */
|
|
90
91
|
description?: string;
|
|
92
|
+
/** Narrows the route's audience to the viewers it also admits (an operation's `x-rbac`). */
|
|
93
|
+
rbacScope?: RbacScope;
|
|
91
94
|
};
|
|
92
95
|
export type EntityMarkdownHandler<TResult = JsonValue> = (value: TResult, context: EntitySearchableContext) => Promise<string[] | MarkdownDoc[] | null> | string[] | MarkdownDoc[] | null;
|
|
93
96
|
export type EntityLoaderOptions<TResult = JsonValue> = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{markdocComponents as e}from"./markdoc-components.js";import{OpenApiComponentWrap as t}from"./OpenApiComponentWrap.js";import*as n from"react";import{jsx as r,jsxs as i}from"react/jsx-runtime";import{Admonition as a}from"@redocly/theme/markdoc/components/Admonition/Admonition";import o from"@redocly/markdoc";import{MarkdownAdapterProvider as s,RedocSchema as c,StoreProvider as l,createMarkdocAdapter as u,markdocParser as d}from"@redocly/api-docs";function f(f){let{options:p,title:m,schemaResolved:h,schemaResolvedErrors:g,schema:_}=f,v=n.useMemo(()=>u({nodes:{link:{...o.nodes.link,render:`MarkdownLink`}},components:{MarkdownLink:e.MarkdownLink}}),[]);if(!_&&!h)return null;let y={openapi:`3.0.0`,info:{version:`1`,title:`json-schema`,description:``},paths:{},"x-root":h?.components?.schemas?.__root??_,components:{schemas:{...h?.components?.schemas}}};return/* @__PURE__ */ i(t,{"data-testid":`json-schema`,children:[m?/* @__PURE__ */ r(`h3`,{children:m}):null,/* @__PURE__ */ r(l,{options:{...p,specType:`openapi`,markdownParser:d},definition:y,children:/* @__PURE__ */ i(s,{value:v,children:[g?.length?/* @__PURE__ */ r(a,{name:`Problem in json-schema tag`,type:`danger`,children:g.map((e,t)=>/* @__PURE__ */ r(`div`,{children:e},t))}):null,/* @__PURE__ */ r(c,{pointer:`#/x-root`,disableDeepLinks:!0})]})})]})}export{f as JsonSchemaTag};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e from"styled-components";import{ClipboardService as t}from"@redocly/theme/core/utils";import{jsx as n,jsxs as r}from"react/jsx-runtime";import{JsonViewer as i}from"@redocly/theme/components/JsonViewer/JsonViewer";function a({json:e,title:a,errors:c}){let l=!!c?.length,u=l?c:e,d=/* @__PURE__ */ n(i,{data:u,expandLevel:3,onCopyClick:()=>{t.copyCustom(JSON.stringify(u))},title:a});return l?/* @__PURE__ */ r(o,{children:[/* @__PURE__ */ n(s,{children:`error`}),d]}):d}const o=e.div`
|
|
2
2
|
background-color: var(--code-block-bg-color);
|
|
3
3
|
border: 2px solid var(--color-error-border);
|
|
4
|
-
`,s=
|
|
4
|
+
`,s=e.p`
|
|
5
5
|
color: var(--color-error-text);
|
|
6
6
|
padding-left: var(--spacing-xs);
|
|
7
7
|
`;export{a as JsonExample};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
`)){let
|
|
3
|
-
`),codeClassNames:[...
|
|
1
|
+
import{parseCodeHighlightNotationLine as e}from"@redocly/theme/core/utils";const t={"++":[`diff add`,`has-diff`],"--":[`diff remove`,`has-diff`],error:[`highlighted error`,`has-highlighted`],focus:[`focused`,`has-focused`],highlight:[`highlighted`,`has-highlighted`],hl:[`highlighted`,`has-highlighted`],warning:[`highlighted warning`,`has-highlighted`]},n=`highlighted-word`;function r(e,t){let r=[],i=0;for(let t of e)r.push(i),i+=t.length+1;let a=[];for(let{word:i,from:o,count:s}of t)for(let t=o;t<Math.min(o+s,e.length+1);t++){let o=e[t-1],s=o.indexOf(i);for(;s!==-1;){let e=r[t-1]+s;a.push({className:n,range:[e,e+i.length]}),s=o.indexOf(i,s+i.length)}}return a}function i(n){let i=[],a=[],o=/* @__PURE__ */ new Set,s=[];for(let r of n.split(`
|
|
2
|
+
`)){let{text:n,notations:c}=e(r),l=i.length+1;for(let{kind:e,word:n,count:r}of c){if(n!==void 0){s.push({word:n,from:l,count:r??1/0});continue}let[i,c]=t[e],u=r??1;a.push({className:i,lines:u===1?l:[l,l+u-1]}),o.add(c)}n!==void 0&&i.push(n)}return{code:i.join(`
|
|
3
|
+
`),codeClassNames:[...o],decorations:[...a,...r(i,s)]}}function a(e){let t=[];for(let n of e.split(`,`)){let e=n.trim().match(/^(\d+)(?:-(\d+))?$/);if(!e)continue;let r=Number(e[1]),i=e[2]?Number(e[2]):r;t.push({className:`highlighted`,lines:r===i?r:[r,i]})}return t}function o(e,t){let r=[],i=/* @__PURE__ */ new Set,o=e.match(/\{([\d,\s-]+)\}/)?.[1]??(/^[\d,\s-]+$/.test(e)?e:``);o&&r.push(...a(o));for(let[,i]of e.matchAll(/\/((?:\\.|[^/])+)\//g)){let e=i.replace(/\\(.)/g,`$1`),a=t.indexOf(e);for(;a!==-1;)r.push({className:n,range:[a,a+e.length]}),a=t.indexOf(e,a+e.length)}return r.length&&i.add(`has-highlighted`),{codeClassNames:[...i],decorations:r}}export{o as parseHighlightMeta,i as parseNotation};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{markdocComponents as e}from"./markdoc-components.js";const t=e=>typeof e==`object`&&!!e&&e.$$mdtype===`Tag`,n=e=>typeof e?.preload==`function`;function r(e,n){if(Array.isArray(e)){for(let t of e)r(t,n);return}if(t(e)&&(typeof e.name==`string`&&n.add(e.name),r(e.children,n),typeof e.attributes==`object`&&e.attributes!==null))for(let t of Object.values(e.attributes))r(t,n)}async function i(t){let
|
|
1
|
+
import{markdocComponents as e}from"./markdoc-components.js";const t=e=>typeof e==`object`&&!!e&&e.$$mdtype===`Tag`,n=e=>typeof e?.preload==`function`;function r(e,n){if(Array.isArray(e)){for(let t of e)r(t,n);return}if(t(e)&&(typeof e.name==`string`&&n.add(e.name),r(e.children,n),typeof e.attributes==`object`&&e.attributes!==null))for(let t of Object.values(e.attributes))r(t,n)}async function i(t,i){let a=/* @__PURE__ */ new Set;for(let e of Object.values(t))typeof e==`object`&&e&&`ast`in e&&r(e.ast,a);await Promise.all([...a].map(async t=>{let r=Object.hasOwn(e,t)?e[t]:null;if(n(r))try{await r.preload()}catch(e){console.error(`Realm: failed to preload the ${t} component.`,e),i(e)}}))}export{i as preloadDynamicMarkdocComponents};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{withPathPrefix as e,withPathPrefixForSrcSet as t}from"../../../shared/path-prefix.js";import{isRouterPath as n}from"../../../client/utils/routes/is-router-path.js";import{resolveRelativeHref as r}from"../../../client/utils/routes/resolve-relative-href.js";import*as i from"react";import a from"styled-components";import{Link as o,useLocation as s}from"react-router";import{dynamic as c}from"@redocly/theme/core/utils";import{jsx as l}from"react/jsx-runtime";import{CodeSnippetProvider as u,PageActionsContext as ee}from"@redocly/theme/core/contexts";import{Accordion as te}from"@redocly/theme/markdoc/components/Accordion/Accordion";import{AccordionGroup as d}from"@redocly/theme/markdoc/components/Accordion/AccordionGroup";import{Admonition as f}from"@redocly/theme/markdoc/components/Admonition/Admonition";import{Card as p}from"@redocly/theme/markdoc/components/Cards/Card";import{Cards as m}from"@redocly/theme/markdoc/components/Cards/Cards";import{CodeBlock as h}from"@redocly/theme/markdoc/components/CodeBlock/CodeBlock";import{CodeGroup as g}from"@redocly/theme/markdoc/components/CodeGroup/CodeGroup";import{CodeStep as _}from"@redocly/theme/markdoc/components/CodeWalkthrough/CodeStep";import{CodeToggle as v}from"@redocly/theme/markdoc/components/CodeWalkthrough/CodeToggle";import{CodeWalkthrough as y}from"@redocly/theme/markdoc/components/CodeWalkthrough/CodeWalkthrough";import{ConnectMCP as ne}from"@redocly/theme/markdoc/components/ConnectMCP/ConnectMCP";import{Diagram as re}from"@redocly/theme/markdoc/components/Diagram/Diagram";import{Experiment as ie}from"@redocly/theme/components/Experiment/Experiment";import{Variant as b}from"@redocly/theme/components/Experiment/Variant";import{Heading as x}from"@redocly/theme/markdoc/components/Heading/Heading";import{Input as S}from"@redocly/theme/markdoc/components/CodeWalkthrough/Input";import{Icon as C}from"@redocly/theme/markdoc/components/Icon/Icon";import{Image as w}from"@redocly/theme/markdoc/components/Image/Image";import{InlineSvg as T}from"@redocly/theme/markdoc/components/InlineSvg/InlineSvg";import{LoginButton as E}from"@redocly/theme/markdoc/components/LoginButton/LoginButton";import{MarkdocExample as D}from"@redocly/theme/markdoc/components/MarkdocExample/MarkdocExample";import{NumberedItem as O}from"@redocly/theme/markdoc/components/NumberedList/NumberedItem";import{NumberedList as k}from"@redocly/theme/markdoc/components/NumberedList/NumberedList";import{Prompt as A}from"@redocly/theme/markdoc/components/Prompt/Prompt";import{Tabs as j}from"@redocly/theme/markdoc/components/Tabs/Tabs";import{TabItemFragment as M}from"@redocly/theme/markdoc/components/Tabs/TabItemFragment";import{Markdown as N}from"@redocly/theme/components/Markdown/Markdown";import{SearchAiCitation as P}from"@redocly/theme/components/Search/SearchAiCitation";import F from"@redocly/markdoc/dist/react.js";import{useL10nHref as I}from"virtual:realm-runtime";import{userMarkdocComponents as L}from"virtual:realm-markdoc-components";const R=t=>typeof t==`string`?e(t):void 0,ae=e=>typeof e==`string`?t(e):void 0,z=e=>/^(https?:|\/\/)/.test(e);function B(e){let t=I(),{pathname:i}=s();if(!e||z(e)||e.startsWith(`mailto:`))return{kind:`external`,href:e};let a=r(e,i);return n(a)?{kind:`page`,href:t(a)}:{kind:`file`,href:a}}function V({href:t,children:n,...r}){let i=B(t);if(i.kind===`external`){let e=t&&z(t)?`_blank`:void 0;return/* @__PURE__ */ l(`a`,{href:t,target:e,...r,rel:typeof r.rel==`string`?r.rel:`noreferrer`,children:n})}return i.kind===`file`?/* @__PURE__ */ l(`a`,{href:e(i.href),...r,children:n}):/* @__PURE__ */ l(o,{to:i.href,...r,children:n})}function H(e){return function({href:t,...n}){return/* @__PURE__ */ l(e,{...n,href:B(t).href})}}const{MarkdownLink:U,...W}=L;function G({src:e,srcSet:t,...n}){return/* @__PURE__ */ l(w,{...n,src:R(e),srcSet:ae(t)})}let K=Promise.resolve();function q(){return K}function J(e,t){return new Promise(n=>{t&&(e.addEventListener(`load`,()=>n()),e.addEventListener(`error`,()=>n())),document.body.appendChild(e),t||n()})}function Y({src:e,children:t,...n}){return i.useEffect(()=>{let r=typeof e==`string`?e:void 0;if(r&&document.querySelector(`script[src="${CSS.escape(r)}"]`))return;let a=document.createElement(`script`);r?a.src=r:t!=null&&(a.textContent=i.Children.toArray(t).join(``));for(let[e,t]of Object.entries(n))(typeof t==`string`||typeof t==`boolean`)&&a.setAttribute(e,String(t));r&&n.async?J(a,!0):K=K.then(()=>J(a,!!r))},[e]),null}function X({image:e,icon:t,...n}){return/* @__PURE__ */ l(p,{...n,image:R(e),icon:R(t)})}const oe=a.span.attrs({role:`alert`,"data-component-name":`MarkdocInlineError`})`
|
|
2
2
|
display: inline;
|
|
3
3
|
padding: 0 var(--spacing-xs);
|
|
4
4
|
border: var(--admonition-danger-border);
|
|
@@ -6,4 +6,4 @@ import"../../../shared/constants/content-assets.js";import{withPathPrefix as e,w
|
|
|
6
6
|
background-color: var(--admonition-danger-bg-color);
|
|
7
7
|
color: var(--admonition-danger-text-color);
|
|
8
8
|
font-size: var(--font-size-sm);
|
|
9
|
-
`,
|
|
9
|
+
`,Z={Accordion:te,AccordionGroup:d,Admonition:f,AiCitation:P,Card:X,Cards:m,CodeBlock:h,CodeGroup:g,CodeStep:_,CodeToggle:v,CodeWalkthrough:y,ConnectMCP:ne,Diagram:re,Experiment:ie,ExperimentVariant:b,Heading:x,HtmlScript:Y,Icon:C,Image:G,InlineSvg:T,Input:S,JsonExample:c(()=>import(`./OpenapiTagComponents.js`).then(e=>e.JsonExample)),JsonSchema:c(()=>import(`./JsonSchemaTag.js`).then(e=>e.JsonSchemaTag)),LoginButton:E,MarkdocExample:D,MarkdocInlineError:oe,NumberedItem:O,NumberedList:k,OpenApiCodeSample:c(()=>import(`./OpenApiEmbedTags.js`).then(e=>e.OpenApiCodeSample)),OpenApiExample:c(()=>import(`./OpenApiEmbedTags.js`).then(e=>e.OpenApiExample)),OpenApiResponseSample:c(()=>import(`./OpenApiEmbedTags.js`).then(e=>e.OpenApiResponseSample)),Prompt:A,ReplayOpenApi:c(()=>import(`./ReplayOpenApiTag.js`).then(e=>e.ReplayOpenApiTag)),Tabs:j,TabItemFragment:M,Link:V,...W,MarkdownLink:U===void 0?V:H(U)},Q=F;function $(e,t=Z){return/* @__PURE__ */ l(u,{children:Q(e,i,{components:t})})}function se({ast:e,components:t=Z,withPageActions:n}){let r=i.useMemo(()=>$(e,t),[e,t]);return/* @__PURE__ */ l(ee.Provider,{value:n??null,children:/* @__PURE__ */ l(N,{children:r})})}function ce({ast:e,components:t}){return i.useMemo(()=>/* @__PURE__ */ l(u,{children:le(e).map((e,n)=>/* @__PURE__ */ l(N,{as:`div`,children:typeof e==`string`?/* @__PURE__ */ l(`p`,{children:e}):Q(e,i,{components:t})},n))}),[e,t])}function le(e){return(Array.isArray(e)?e:[e]).flatMap(e=>e===null||e===``?[]:ue(e)?e.children:[e])}function ue(e){let t=e;return typeof e==`object`&&t?.$$mdtype===`Tag`&&t.name===`article`}export{Y as HtmlScript,ce as MarkdocBlocks,X as MarkdocCard,G as MarkdocImage,V as MarkdocLink,se as MarkdocRenderer,Z as markdocComponents,$ as renderMarkdocAst,q as waitForMarkdownScripts};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{renderMarkdocAst as e}from"./markdoc-components.js";import{headingSlugger as t}from"../utils/heading-slugger.js";import{buildMarkdownTextTagSet as n}from"../constants/markdown-text-tag-set.js";import r from"@redocly/markdoc";import{userMarkdocFunctions as i,userMarkdocNodes as a,userMarkdocTags as o}from"virtual:realm-markdoc-schema";let s;function c(c){return c?(s??=n({tags:o,nodes:a,functions:i}),t.reset(),e(r.transform(r.parse(c,{linkify:!0}),s))):null}export{c as renderMarkdownText};
|