@redocly/framework 1.0.0-next.5 → 1.0.0-next.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundler/build/output-metadata.js +1 -1
- package/dist/bundler/build/run.js +1 -1
- package/dist/bundler/build/theme-global-style-compiler.js +1 -0
- package/dist/bundler/build/theme-global-stylesheets.js +1 -0
- package/dist/bundler/build/vite-config.js +2 -2
- package/dist/bundler/dev/dev-content-build.js +1 -0
- package/dist/bundler/dev/dev-problems.js +1 -1
- package/dist/bundler/dev/dev-reporter.js +1 -1
- package/dist/bundler/dev/routes/dev-content-build-route.js +1 -0
- package/dist/bundler/dev/routes/dev-problems-route.js +1 -1
- package/dist/bundler/dev/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/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/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 +2 -2
- 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/log-output/index.js +1 -1
- 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/ThemeGlobalStyle.js +1 -0
- package/dist/client/UnversionedVersionButton.js +1 -1
- 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 +3 -3
- package/dist/client/client-entry.js +1 -1
- package/dist/client/contexts.js +1 -1
- package/dist/client/dev-problems/ProblemsBar.js +61 -11
- 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/feedback.js +1 -1
- 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/products.js +1 -1
- package/dist/client/review/ReviewBar.js +61 -61
- package/dist/client/review/use-review.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-entity-revisions.js +1 -1
- package/dist/client/use-page-versions.js +1 -1
- package/dist/client/use-search.js +1 -1
- 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/config-schema.d.ts +5 -1
- package/dist/content-layer/config-schema.js +1 -1
- package/dist/content-layer/config.d.ts +8 -3
- package/dist/content-layer/config.js +1 -1
- package/dist/content-layer/database/adapters/node-sqlite-client.js +1 -1
- package/dist/content-layer/database/connection.js +1 -1
- package/dist/content-layer/database/entity-store.d.ts +9 -1
- package/dist/content-layer/database/entity-store.js +1 -1
- 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/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/hook-inputs.js +1 -1
- 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/load-view.js +1 -1
- package/dist/content-layer/link-checker/validate.js +1 -1
- package/dist/content-layer/loaders/context.js +1 -1
- package/dist/content-layer/markdown/client/OpenapiTagComponents.js +2 -2
- 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.js +1 -1
- package/dist/content-layer/markdown/nodes/heading.js +1 -1
- package/dist/content-layer/markdown/resolve/audience-tag.d.ts +1 -1
- package/dist/content-layer/markdown/resolve/audience-tag.js +1 -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.js +1 -1
- package/dist/content-layer/markdown/resolve/references.js +1 -1
- package/dist/content-layer/markdown/search/to-markdown.js +1 -1
- package/dist/content-layer/markdown/search/to-sections.js +1 -1
- 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 +4 -1
- package/dist/content-layer/markdown/tags/html.js +1 -1
- package/dist/content-layer/markdown/tags/variant.js +1 -1
- package/dist/content-layer/markdown/types/service.d.ts +2 -0
- package/dist/content-layer/markdown/utils/parse-cache.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/plan-gates.d.ts +3 -2
- package/dist/content-layer/plan-gates.js +1 -1
- package/dist/content-layer/plugins/index.js +1 -1
- package/dist/content-layer/plugins/internal/api-docs/client/template.js +4 -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 +2 -2
- 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/markdown-docs.js +13 -13
- 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.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/app-data/banner.js +1 -1
- package/dist/content-layer/plugins/internal/app-data/index.js +1 -1
- package/dist/content-layer/plugins/internal/app-data/products.d.ts +2 -0
- package/dist/content-layer/plugins/internal/app-data/products.js +1 -1
- package/dist/content-layer/plugins/internal/catalog-classic/client/use-catalog-classic.js +1 -1
- package/dist/content-layer/plugins/internal/catalog-classic/index.js +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/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/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/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 -6
- package/dist/content-layer/plugins/internal/mcp/server/gateway/fetch/fetch-bridge.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/gateway/index.js +2 -2
- package/dist/content-layer/plugins/internal/mcp/server/gateway/secret-store.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/gateway/tools.js +3 -3
- package/dist/content-layer/plugins/internal/mcp/server/handler.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/oauth/authorize.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/search.js +2 -2
- package/dist/content-layer/plugins/internal/mock/server/handler.js +1 -1
- 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 +1 -1
- package/dist/content-layer/plugins/internal/sidebar/bundle.js +1 -1
- package/dist/content-layer/plugins/internal/sidebar/index.d.ts +1 -1
- package/dist/content-layer/plugins/internal/sidebar/index.js +2 -2
- 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/project/load.js +2 -2
- package/dist/content-layer/plugins/registry.js +1 -1
- package/dist/content-layer/plugins/request-context.d.ts +5 -0
- package/dist/content-layer/plugins/types/api-entity.d.ts +2 -6
- package/dist/content-layer/plugins/types/api-entity.js +1 -1
- package/dist/content-layer/plugins/types/plugin.d.ts +8 -0
- package/dist/content-layer/plugins/types/search.d.ts +1 -1
- 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/version-path.js +1 -1
- package/dist/content-layer/revisions/config.js +1 -1
- package/dist/content-layer/server/context.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/redirect.d.ts +11 -6
- package/dist/content-layer/versions/redirect.js +1 -1
- package/dist/content-layer/versions/resolve.js +1 -1
- package/dist/plugin-api.d.ts +3 -0
- package/dist/plugin-api.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/gate.js +1 -1
- package/dist/server/auth/middleware.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 +13 -13
- package/dist/server/cors-proxy/handler.js +1 -1
- package/dist/server/feedback/route.js +1 -1
- package/dist/server/lambda-entry.js +1 -1
- package/dist/server/manifest-assets.js +4 -4
- 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/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/route.js +1 -1
- package/dist/server/seo-tags.js +2 -2
- package/dist/server/sitemap.js +1 -1
- package/dist/server/static-files/serve.js +1 -1
- package/dist/server/subprocess/runner.js +1 -1
- package/dist/server/telemetry/mock-server-events.js +1 -0
- package/dist/server/telemetry/redirect-event.js +1 -0
- package/dist/server/telemetry/route.js +1 -1
- package/dist/server/telemetry/sender.js +1 -1
- package/dist/server/template-ids.js +1 -1
- package/dist/shared/constants/api-spec-kinds.d.ts +6 -0
- package/dist/shared/constants/api-spec-kinds.js +1 -0
- package/dist/shared/constants/content-update.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/{server → shared}/constants/system-routes.d.ts +1 -1
- package/dist/shared/constants/system-routes.js +1 -0
- package/dist/shared/plan-gates.d.ts +6 -1
- package/dist/shared/plan-gates.js +1 -1
- package/dist/shared/products.js +1 -1
- package/dist/{server → shared}/project-env.d.ts +1 -1
- package/dist/{server → shared}/rbac/api-docs.d.ts +1 -1
- package/dist/{server → shared}/rbac/engine.d.ts +1 -1
- package/dist/shared/rbac/engine.js +0 -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/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/types/config.d.ts +2 -0
- package/dist/shared/types/search.d.ts +7 -2
- package/dist/shared/utils/routes/file-path-to-route-slug.js +1 -1
- package/package.json +28 -8
- 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/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/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/{server → shared}/project-env.js +0 -0
- /package/dist/{server → shared}/rbac/api-docs.js +0 -0
- /package/dist/{server → shared}/rbac/entity-scope.js +0 -0
- /package/dist/{server → shared}/rbac/filter.d.ts +0 -0
- /package/dist/{server → shared}/rbac/route-scope.d.ts +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,26 +1,26 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{isObject as e}from"../../../../../shared/utils/is-object.js";import{SPEC_DOWNLOAD_ROUTE_PATHS as t}from"./shared.js";import{headingSlugger as n}from"../../../../markdown/utils/heading-slugger.js";import{RBAC_TEAM_ANONYMOUS as r}from"../../../../../shared/rbac/types.js";import{canView as i,isRbacScope as a,resolveRole as o}from"../../../../../shared/rbac/engine.js";import{parseMarkdown as s}from"../../../../markdown/utils/parse-cache.js";import{markdocAstToMarkdownChunks as c}from"../../../../markdown/search/to-markdown.js";import{REDOCLY_TEAMS_RBAC as l}from"@redocly/config";const u=e=>{let t=e[l];return t!==void 0&&!i(o(a(t)?t:{},[r]))};function d(t,n,r,i={}){let a=/* @__PURE__ */ new Map,o=e=>{let t=y(e)?e:{type:`document`,children:Array.isArray(e)?e:[e]};return c(t,i)},l=e=>{if(typeof e!=`string`)return o(e);if(!e.includes(`{%`)){let t=e.trim();return t===``?[]:[t]}let t=a.get(e);return t===void 0&&(t=o(s(e)),a.set(e,t)),t},d=[],m=/* @__PURE__ */ new Set,h=t.items,g=e(t.store)?t.store.schemaStore:{},x=e(n)?n:void 0,S=x?.security,C=e(x?.info)?x.info:{},w=(e,t,n,r)=>{d.push({routeSlug:e,chunks:t,headings:f(t),...typeof n==`string`&&n!==``?{title:n}:{},...r?{description:r}:{}})},T=e(C[`x-metadata`])?C[`x-metadata`]:{},E=l((typeof T.description==`string`?T.description:void 0)??C.description).join(`
|
|
2
2
|
|
|
3
|
-
`),D=
|
|
4
|
-
`,1)[0]??``);if(!t)return null;let
|
|
3
|
+
`),D=e=>{let n=e.content,i=n?.contentType??(e.items?.length&&e.link?`group`:void 0);if(!u(e)&&typeof e.link==`string`&&i!==void 0){let a=i===`overview`,o=e.link;if(!m.has(o)){if(a&&n)m.add(o),w(o,p({doc:x,info:C,description:E,specType:t.specType,items:h,originFilePath:r,renderMarkdown:l}),C.title,E);else if(i===`item`&&n)m.add(o),w(o,v(e,{info:C,schemaStore:g,document:x,globalSecurity:S,specType:t.specType,renderMarkdown:l}),e.label);else if(i===`group`){m.add(o);let t=e.deprecated===!0||n?.meta?.deprecated===!0,r=_(e.items??[],l);w(o,[`# ${e.label??``}${t?` (deprecated)`:``}`.trim(),...b(n?.children??[],l),...r?[r]:[]].filter(e=>e!==``),e.label)}}}for(let t of e.items??[])D(t)};for(let e of h)D(e);return d}function f(e){return n.reset(),e.map(e=>{let t=/^#{1,6} +(?! )(.+)$/.exec(e.split(`
|
|
4
|
+
`,1)[0]??``);if(!t)return null;let r=t[1].trim();return{heading:r,anchor:n.slug(r)}})}function p(t){let{doc:n,info:r}=t,i=[],a=[];typeof r.title==`string`&&r.title&&a.push(`# ${r.title}`),t.description&&a.push(t.description),typeof r.summary==`string`&&r.summary&&a.push(r.summary);let o=[];r.version!==void 0&&r.version!==``&&o.push(`Version: ${String(r.version)}`);let s=e(r.license)?r.license:void 0;typeof s?.name==`string`&&o.push(`License: ${s.name}`);let c=e(r[`x-metadata`])?r[`x-metadata`]:void 0;if(c){let e=Object.entries(c).filter(([,e])=>typeof e==`string`||typeof e==`number`).filter(([e,t])=>e!==`description`||typeof t!=`string`).map(([e,t])=>`- ${e}: ${String(t)}`);e.length>0&&o.push(`Metadata:\n${e.join(`
|
|
5
5
|
`)}`)}o.length>0&&a.push(o.join(`
|
|
6
|
-
`)),a.length>0&&
|
|
6
|
+
`)),a.length>0&&i.push(a.join(`
|
|
7
7
|
|
|
8
|
-
`));let l=m(t
|
|
8
|
+
`));let l=m(n,t.renderMarkdown);l&&i.push(l);let u=h(n,t.renderMarkdown);u&&i.push(u);let d=g(t.specType,r,t.originFilePath);d&&i.push(d);let f=_(t.items,t.renderMarkdown);return f&&i.push(f),i}function m(t,n){let r=t?.servers;if(!Array.isArray(r)||r.length===0)return;let i=`## Servers
|
|
9
9
|
|
|
10
|
-
`;for(let
|
|
10
|
+
`;for(let t of r){if(!e(t))continue;let r=n(t.description).join(`
|
|
11
11
|
|
|
12
|
-
`);if(
|
|
13
|
-
`;for(let[
|
|
14
|
-
`}}return
|
|
12
|
+
`);if(r&&(i+=`${r}\n`),i+=`\`\`\`\n${String(t.url??``)}\n\`\`\`\n\n`,e(t.variables)){i+=`Variables:
|
|
13
|
+
`;for(let[r,a]of Object.entries(t.variables)){if(!e(a))continue;let t=n(a.description).join(` `).replace(/\s+/g,` `);i+=`- \`${r}\`${t?`: ${t}`:``}\n`,a.default!==void 0&&(i+=` Default: ${JSON.stringify(a.default)}\n`),Array.isArray(a.enum)&&(i+=` Enum: ${a.enum.map(e=>JSON.stringify(e)).join(`, `)}\n`)}i+=`
|
|
14
|
+
`}}return i.trim()}function h(t,n){let r=e(t?.components)?t.components:void 0,i=e(r?.securitySchemes)?r.securitySchemes:void 0;if(!i)return;let a=`## Security
|
|
15
15
|
|
|
16
|
-
`;for(let[
|
|
16
|
+
`;for(let[t,r]of Object.entries(i)){if(!e(r)||`$ref`in r)continue;a+=`### ${t}\n\n`;let i=n(r.description).join(`
|
|
17
17
|
|
|
18
|
-
`);
|
|
18
|
+
`);i&&(a+=`${i}\n\n`);for(let[e,t]of[[`Type`,`type`],[`In`,`in`],[`Name`,`name`],[`Scheme`,`scheme`],[`Bearer Format`,`bearerFormat`],[`OpenID Connect URL`,`openIdConnectUrl`]])typeof r[t]==`string`&&r[t]&&(a+=`${e}: ${r[t]}\n`);let o=e(r.flows)?r.flows:void 0,s=[o?.implicit,o?.password,o?.clientCredentials,o?.authorizationCode].find(e);if(s&&(typeof s.authorizationUrl==`string`&&(a+=`Authorization URL: ${s.authorizationUrl}\n`),typeof s.tokenUrl==`string`&&(a+=`Token URL: ${s.tokenUrl}\n`),e(s.scopes))){a+=`Scopes:
|
|
19
19
|
`;for(let[e,t]of Object.entries(s.scopes))a+=`- \`${e}\`: ${String(t)}\n`}a+=`
|
|
20
|
-
`}return a.trim()}function g(e,
|
|
20
|
+
`}return a.trim()}function g(e,n,r){if(!r)return;let i=typeof n.title==`string`&&n.title?n.title:void 0;if(e===`openapi`||e===`asyncapi`){let n=e===`openapi`?`OpenAPI`:`AsyncAPI`;return`## Download ${n} description\n\n[${i??`${n} definition`}](${t.bundle}/${r})`}if(e===`graphql`)return`## Download GraphQL schema\n\n[${i??`GraphQL schema`}](${t.graphql}/${r})`}function _(e,t){let n=``,r=(e,i)=>{for(let a of e)if(!(u(a)||typeof a.link!=`string`)){if(a.content?.contentType===`group`)n+=`${i} ${a.label??``}\n\n`,a.items?.length&&r(a.items,`${i}#`);else if(a.content?.contentType===`item`){let e=a.httpVerb&&a.httpPath?`${a.httpVerb.toUpperCase()} ${a.httpPath}`:a.label??``,r=x(a.content.children??[],t),i=r?`: ${r.slice(0,200)}`:``;n+=`- [${e}](${a.link}.md)${i}\n`}}};return r(e,`##`),n.trim()===``?void 0:n.trim()}function v(e,t){let n=e.content,r=n?.children??[],i=e.deprecated===!0||n?.meta?.deprecated===!0,a=[`# ${e.label??``}${i?` (deprecated)`:``}`.trim()];a.push(...b(r,t.renderMarkdown));let o=[];if(t.specType===`openapi`||t.specType===`asyncapi`){e.httpVerb&&e.httpPath?o.push(`Endpoint: ${e.httpVerb.toUpperCase()} ${e.httpPath}`):e.httpVerb&&o.push(`Method: ${e.httpVerb.toUpperCase()}`),t.info.version!==void 0&&t.info.version!==``&&o.push(`Version: ${String(t.info.version)}`);let n=S(r,t.globalSecurity);n&&o.push(`Security: ${n}`)}if(o.length>0&&a.push(o.join(`
|
|
21
21
|
`)),t.specType!==`graphql`){let e=C(r,{schemaStore:t.schemaStore,document:t.document,renderMarkdown:t.renderMarkdown});e.length>0&&a.push(P(e))}return a.filter(e=>e!==``)}function y(e){return typeof e==`object`&&!!e&&e.type===`document`}function b(e,t){let n=[],r=e=>{if(!u(e)){if(e.nodeType===`markdoc`){n.push(...t(e.content));return}if(e.nodeType===`container`||e.nodeType===`overview-section-wrapper`)for(let t of e.children??[])r(t)}};for(let t of e)r(t);return n}function x(e,t){return b(e,t).join(` `).replace(/\s+/g,` `).trim()}function S(e,t){let n=[],r=e=>{for(let t of e)if(t.nodeType===`security`){let e=t.requirements;for(let t of e??[])for(let e of t.schemes??[])u(e)||e.name&&!n.includes(e.name)&&n.push(e.name)}else(t.nodeType===`container`||t.nodeType===`overview-section-wrapper`)&&r(t.children??[])};if(r(e),n.length>0)return n.join(`, `);if(t?.length){let e=[...new Set(t.flatMap(e=>Object.keys(e)))];if(e.length>0)return e.join(`, `)}}function C(e,t){let n=/* @__PURE__ */ new Map,r=/* @__PURE__ */ new Set,i=e=>{for(let a of e)if(a.nodeType===`item-content`){if(u(a))continue;for(let e of a.parameters??[])!u(e)&&e.name&&w(n,{name:e.name,path:[],place:E(a.variant),type:O(e.schemaId,t),required:e.required??!1,description:T(e.description,t.renderMarkdown)});D(a,n,r,t)}else if(a.nodeType===`container`||a.nodeType===`overview-section-wrapper`){if(u(a))continue;i(a.children??[])}};return i(e),[...n.values()]}function w(e,t){e.set([...t.path,t.name].join(`.`)+t.description+t.place,t)}function T(e,t){return e==null?``:t(e).join(`
|
|
22
22
|
|
|
23
|
-
`)}function E(e){switch(e){case`query`:return`query parameters`;case`path`:return`path parameters`;case`headers`:return`header parameters`;case`cookies`:return`cookie parameters`;case`parameters`:return`channel parameters`;case`body`:return`request fields`;case`responses`:return`response fields`;default:return e?`${e} parameters`:`parameters`}}function D(e,t,n,r){let i=E(e.variant),a=i.startsWith(`response`);if(e.mediaTypeSchemas){let o=Object.values(e.mediaTypeSchemas).find(e=>!u(e));o?.schemaId&&k(o.schemaId,i,a,t,n,r)}else e.schemaId&&k(e.schemaId,i,a,t,n,r);for(let n of e.responses??[]){if(u(n))continue;let e=`response ${n.code??``} fields`.replace(` `,` `),i=/* @__PURE__ */ new Set,a=(n.mediaTypeContent?Object.values(n.mediaTypeContent).find(e=>!u(e)):void 0)?.schemaId??n.schemaId;a&&k(a,e,!0,t,i,r)}for(let n of e.messages??[])!u(n)&&n.name&&w(t,{name:n.name,path:[],place:`message`,type:`unknown`,required:!1,description:`${T(n.description,r.renderMarkdown)} ${n.summary??``}`.trim()})}function O(
|
|
23
|
+
`)}function E(e){switch(e){case`query`:return`query parameters`;case`path`:return`path parameters`;case`headers`:return`header parameters`;case`cookies`:return`cookie parameters`;case`parameters`:return`channel parameters`;case`body`:return`request fields`;case`responses`:return`response fields`;default:return e?`${e} parameters`:`parameters`}}function D(e,t,n,r){let i=E(e.variant),a=i.startsWith(`response`);if(e.mediaTypeSchemas){let o=Object.values(e.mediaTypeSchemas).find(e=>!u(e));o?.schemaId&&k(o.schemaId,i,a,t,n,r)}else e.schemaId&&k(e.schemaId,i,a,t,n,r);for(let n of e.responses??[]){if(u(n))continue;let e=`response ${n.code??``} fields`.replace(` `,` `),i=/* @__PURE__ */ new Set,a=(n.mediaTypeContent?Object.values(n.mediaTypeContent).find(e=>!u(e)):void 0)?.schemaId??n.schemaId;a&&k(a,e,!0,t,i,r)}for(let n of e.messages??[])!u(n)&&n.name&&w(t,{name:n.name,path:[],place:`message`,type:`unknown`,required:!1,description:`${T(n.description,r.renderMarkdown)} ${n.summary??``}`.trim()})}function O(t,n){if(!t)return`unknown`;let r=n.schemaStore[t];return!e(r)||r.kind!==`json-schema`?`unknown`:M(j(r.data,n))}function k(t,n,r,i,a,o){let s=o.schemaStore[t];e(s)&&s.kind===`json-schema`&&!u(s)&&N(s.data,n,r,i,[],a,0,o)}function A(t,n){if(!t.startsWith(`#/`)||!n.document)return;let r=n.document;for(let e of t.slice(2).split(`/`)){if(typeof r!=`object`||!r)return;r=r[e]}return e(r)?r:void 0}function j(e,t){if(e.allOf){let n={};for(let r of e.allOf){let e=r.$ref?A(r.$ref,t):r;if(e){let t=n.properties,r=n.required;Object.assign(n,e),(t||e.properties)&&(n.properties={...t??{},...e.properties??{}}),(r||e.required)&&(n.required=[...r??[],...e.required??[]])}}return delete n.allOf,e.description&&(n.description=e.description),n}if(e.$ref){let n=A(e.$ref,t);if(n){let t={...n};return e.description&&(t.description=e.description),t}}return e}function M(e){return Array.isArray(e.type)?e.type.join(` | `):e.type?e.type:e.properties||e.additionalProperties?`object`:e.items?`array`:e.enum?`string`:`any`}function N(t,n,r,i,a,o,s,c){if(!(s>10||u(t))){if(t.$ref){if(o.has(t.$ref))return;o.add(t.$ref);let e=A(t.$ref,c);e&&N(e,n,r,i,a,o,s,c);return}if(t.allOf){N(j(t,c),n,r,i,a,o,s,c);return}if(t.discriminator&&t.properties&&t.oneOf){N({...t,oneOf:void 0,discriminator:void 0},n,r,i,a,o,s,c);return}if(t.oneOf||t.anyOf){for(let e of t.oneOf??t.anyOf??[]){if(e.$ref){if(o.has(e.$ref))continue;o.add(e.$ref)}let t=e.$ref?A(e.$ref,c):e;t&&N(t,n,r,i,a,o,s+1,c)}return}if(t.properties){let e=t.required??[];for(let[l,d]of Object.entries(t.properties)){if(u(d))continue;if(d.$ref){if(o.has(d.$ref))continue;o.add(d.$ref)}let t=d.$ref?A(d.$ref,c):d;if(!t)continue;let f=j(t,c);if(u(t)||u(f)||f.readOnly&&!r||f.writeOnly&&r||t.additionalProperties!==void 0&&!t.properties)continue;let p=t.example??f.example;w(i,{name:l,path:a,place:n,type:M(f),required:e.includes(l),description:T(t.description??f.description,c.renderMarkdown),enumValues:Array.isArray(f.enum)&&f.enum.length>0?f.enum:void 0,example:p===void 0?void 0:(typeof p==`string`?p:JSON.stringify(p)).slice(0,200)}),(f.properties||f.items)&&N(f,n,r,i,[...a,l],o,s+1,c)}}if(t.items&&e(t.items)&&!Array.isArray(t.items)){let e=t.items;if(e.$ref){if(o.has(e.$ref))return;o.add(e.$ref)}let l=e.$ref?A(e.$ref,c):e;l&&N(l,n,r,i,a,o,s+1,c)}}}function P(e){let t=/* @__PURE__ */ new Map;for(let n of e){let e=t.get(n.place);e?e.push(n):t.set(n.place,[n])}let n=[];for(let[e,r]of t){let t=r.map(e=>{let t=`- \`${[...e.path,e.name].join(`.`)}\` (${e.type}${e.required?`, required`:``})`,n=e.description.replace(/\s+/g,` `).trim();return n&&(t+=`\n ${n}`),e.enumValues?t+=`\n Enum: ${e.enumValues.map(e=>JSON.stringify(e)).join(`, `)}`:e.example&&(t+=`\n Example: ${e.example}`),t});n.push(`## ${e.charAt(0).toUpperCase()}${e.slice(1)}\n\n${t.join(`
|
|
24
24
|
`)}`)}return n.join(`
|
|
25
25
|
|
|
26
26
|
`)}export{d as buildApiDocsMarkdownDocs};
|
|
@@ -39,8 +39,10 @@ export declare function resolveNestedFeedback(io: Pick<PluginIO, 'readFile'>, co
|
|
|
39
39
|
*/
|
|
40
40
|
export declare function withMockServerOption(options: Record<string, unknown>, config: Pick<RealmConfig, 'mockServer' | 'planGates'>, routeSlug: string | undefined): Record<string, unknown>;
|
|
41
41
|
/**
|
|
42
|
-
* The api-docs `downloadUrls`
|
|
43
|
-
* `sourcePath`, path-prefixed, unless the per-API
|
|
42
|
+
* The api-docs `downloadUrls` and `replayDefinitionUrl` options. `downloadUrls` is the spec
|
|
43
|
+
* download routes (`server/spec-download.ts`) for `sourcePath`, path-prefixed, unless the per-API
|
|
44
|
+
* config sets its own list. `replayDefinitionUrl` is always the first of those routes, so Try it
|
|
45
|
+
* loads the description from this site even when the configured list points to another origin.
|
|
44
46
|
*/
|
|
45
47
|
export declare function withDownloadUrls(options: Record<string, unknown>, sourcePath: string, kind: ApiSpecType): Record<string, unknown>;
|
|
46
48
|
/** The `x-schema-catalog-link` value: the bundle route for `sourcePath` (`showSchemaCatalogLinks`). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{isPlanFeatureGranted as e}from"../../../../../shared/plan-gates.js";import{withPathPrefix as t}from"../../../../../shared/path-prefix.js";import{isObject as n}from"../../../../../shared/utils/is-object.js";import{SPEC_DOWNLOAD_ROUTE_PATHS as r}from"./shared.js";import{toPosixPath as i}from"../../../../../shared/utils/to-posix-path.js";import{isMissingError as a}from"../../../../../shared/utils/is-missing-error.js";import{NESTED_CONFIG_FILENAME as o,deepMergeConfig as s,parseNestedConfig as c}from"../../../../config.js";import{contentIgnoreMatcherOf as l}from"../../../../ingest/scan.js";import{SPEC_KIND_GRAPHQL as u}from"../../../../../shared/constants/api-spec-kinds.js";import{MOCK_SERVER_ROUTE_PREFIX as d,mockPathPrefix as f}from"../../../types/api-entity.js";import{posix as p}from"node:path";import{decoratorTypes as m,preprocessorTypes as h}from"@redocly/config";import{FEEDBACK_TYPES as g}from"@redocly/theme/core/constants";const _=[`openapi`,`asyncapi`,`graphql`];function v(e,t,n){let r=O(t),i=Object.values(e.apis??{}),a=e=>O(p.join(n,e))===r;return i.find(e=>e.output!==void 0&&a(e.output))??i.find(e=>e.output===void 0&&a(e.root))}function y(e,t,n=``){let r=v(e,t,n);if(!r)return{};let i={};r.metadata&&(i.metadata=r.metadata);for(let e of _)r[e]&&typeof r[e]==`object`&&Object.assign(i,r[e]);return r.rbac!==void 0&&(i.rbac=r.rbac),i}async function b(e,t,n,r,i=n){let a=T(t,r),o=await w(e,i,l(t));return o===null?s(a,y(t,n)):s(s(a,E(o.config,r)),y(o.config,n,o.dir))}const x=[...m,...h];async function S(e,t,r,i=r){let a=await w(e,i,l(t)),o=a===null?[t,v(t,r,``)]:[t,a.config,v(a.config,r,a.dir)],c={};for(let e of o){if(!n(e))continue;let t={};for(let r of x)n(e[r])&&(t[r]=e[r]);c=s(c,t)}return{config:c,configDir:a?.dir??``}}async function C(e,t,n){return(await w(e,n,l(t)))?.config.feedback}async function w(e,t,n){for(let r=p.dirname(t);r!==`.`&&r!==`/`;r=p.dirname(r)){let t=p.join(r,o);if(n(t))continue;let i=await D(e,t);if(i!==null)return{config:i,dir:r}}return null}function T(e,t){return t===`arazzo`?{}:e[t]??{}}function E(e,t){let n={...T(e,t)};return e.mockServer&&(n.mockServer=e.mockServer),n}async function D(e,t){let n;try{n=await e.readFile(t)}catch(e){if(a(e))return null;throw e}return c(n,t).config}function O(e){return p.normalize(i(e)).replace(/^\.\/+/,``).replace(/^\/+/,``)}function k(r,i,a){let o=n(r.mockServer)?r.mockServer:{},s={...i.mockServer,...o};if(a===void 0||s.off===!0||!e(i,`mockServer`))return r;let c=t(d+f(a));return{...r,mockServer:{url:c,position:`first`,description:`Mock server`,...s}}}function A(e,n,i){let a=e=>e.split(`/`).map(encodeURIComponent).join(`/`),o=i===u,s=o?r.graphql:r.bundle,c=(o?[n]:[`.json`,`.yaml`].map(e=>n.replace(/\.[^./]+$/u,e))).map(e=>({url:t(`${s}/${a(e)}?download`),title:p.basename(e)}));return{...e,downloadUrls:Array.isArray(e.downloadUrls)?e.downloadUrls:c,replayDefinitionUrl:c[0]?.url}}function j(e){return t(`${r.bundle}/${e}`)}const M={[g.RATING]:`Rate this section`,[g.SENTIMENT]:`Was this section helpful?`,[g.MOOD]:`Was this section helpful?`,[g.COMMENT]:`Share your feedback about this section`,[g.SCALE]:`How would you rate this section?`};function N(e,t,r){let i=[n(t)?t[`x-feedback`]:void 0,e.feedback,r].find(n);if(i===void 0)return e;let a=n(i.settings)?i.settings:{},o=typeof i.type==`string`?M[i.type]:void 0,s=a.label||o||``;return{...e,feedback:{...i,settings:{...a,label:s}}}}export{y as readApiOptionsFromConfig,S as resolveApiBundleConfig,b as resolveApiOptions,C as resolveNestedFeedback,j as schemaCatalogLink,A as withDownloadUrls,N as withFeedbackOption,k as withMockServerOption};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{SEARCH_HTTP_METHOD_FACET_FIELD as e,SEARCH_HTTP_PATH_FACET_FIELD as t}from"../../../../../shared/search/facets.js";import{isRbacScope as n}from"../../../../../
|
|
1
|
+
import{SEARCH_HTTP_METHOD_FACET_FIELD as e,SEARCH_HTTP_PATH_FACET_FIELD as t}from"../../../../../shared/search/facets.js";import{isRbacScope as n}from"../../../../../shared/rbac/engine.js";import{annotateApiDocsRbac as r}from"../../../../../shared/rbac/api-docs.js";import{withImpliedDiscriminatorMappings as i}from"./implied-discriminators.js";import{createHash as a}from"node:crypto";import{REDOCLY_TEAMS_RBAC as o}from"@redocly/config";import{ApiDocsSearchIndexer as s,isOperationName as c}from"@redocly/api-docs/server";const l=`API Reference`;function u(e,t,n={}){let a=h(e.store)?e.store:{},o=r(t,e.specType,{warn:n.warn??(()=>{})}),c=i(o),l=new s(e.basePath,a.schemaStore,h(c)?c:void 0,{exampleStore:a.exampleStore}),u=e=>{for(let t of e)l.addItem(t),h(t)&&Array.isArray(t.items)&&u(t.items)};u(e.items);let m=[],g=/* @__PURE__ */ new Set,_=[];return{docs:l.getResult().map(e=>{for(let t of e.parameters??[]){let n=f(t),r=n.fragmentKey;g.has(r)||(g.add(r),m.push(n));let i={docKey:e.id,fragmentKey:r,place:t.place,anchor:p(t.deepLink)};t.path&&t.path.length>0&&(i.path=t.path),_.push(i)}return d(e,n)}),fragments:m,uses:_}}function d(r,i){let a=r.httpPath?m(r.httpPath):void 0,s={...i.facets},l=r.isAdditionalOperation?r.httpMethod:r.httpMethod&&c(r.httpMethod)?r.httpMethod.toLowerCase():void 0;l&&(s[e]=l,a&&(s[t]=a));let u={docKey:r.id,routeSlug:r.url,title:m(r.title),text:m(r.text),groupKey:i.groupKey??`API Reference`,facets:s},d=r[o];return n(d)&&(u.rbacScope=d),r.httpMethod&&(u.httpMethod=r.httpMethod),a&&(u.httpPath=a),r.deprecated&&(u.deprecated=!0),r.isAdditionalOperation&&(u.isAdditionalOperation=!0),r.badges&&r.badges.length>0&&(u.badges=r.badges),u}function f(e){let t={name:m(e.name),description:m(e.description)};return e.example&&(t.example=e.example),e.enum&&e.enum.length>0&&(t.enum=e.enum),{fragmentKey:a(`sha1`).update(JSON.stringify([t.name,t.description,t.example??null,t.enum??null])).digest(`hex`),...t}}function p(e){if(!e)return``;let t=e.indexOf(`#`);return t>=0?e.slice(t+1):e}function m(e){return Array.isArray(e)?e.join(` `):e}function h(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}export{l as API_DOCS_SEARCH_GROUP,u as buildApiDocsSearchDocuments};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{filePathToRouteSlug as e}from"../../../../../shared/utils/routes/file-path-to-route-slug.js";import"
|
|
1
|
+
import{filePathToRouteSlug as e}from"../../../../../shared/utils/routes/file-path-to-route-slug.js";import"../../../../../shared/constants/api-spec-kinds.js";import{createApiEntityKey as t}from"../../../utils/api-entity-key.js";import{filterApiDocsByRbac as n}from"../../../../../shared/rbac/api-docs.js";import{EntityAccessDeniedError as r,notFoundResponse as i}from"../../../../../server/plugin-context.js";import{attachmentDisposition as a}from"../../../../../shared/utils/attachment-disposition.js";import{SPEC_DOWNLOAD_HANDLER_ID as o,withMockServerEvent as s}from"../../../../../server/telemetry/mock-server-events.js";import{posix as c}from"node:path";import l from"js-yaml";const u={"Cache-Control":`no-store`};function d(e){return e.replace(/\.[^./]+$/u,``)}async function f(e,t,n){let r=d(t);return(await e.entities.list({type:`api`})).find(({metadata:e})=>{let{sourcePath:t,specType:i}=e??{};return typeof t==`string`&&d(t)===r&&i===`graphql`===n})??null}async function p(n,a){let o=e(a);return await n.hasRoute(o)&&!n.isSlugVisible(o)?new r(t(a),n.request.teams).getResponse():i()}function m(e,t,n,r,i){let o=new URL(t.request.url).searchParams.has(`download`);return e.body(n,200,{...u,"Content-Type":r,...o?{"Content-Disposition":a(i)}:{}})}function h(e,t,n){return s({handler:o,request:e.req.raw,logger:t.logger},n)}function g(e,t){return h(e,t,()=>v(e,t))}function _(e,t){return h(e,t,()=>y(e,t))}async function v(e,t){let r=e.req.param(`api`)??``,i=await f(t,r,!1);if(!i)return p(t,r);let a=n(await t.entities.load(i.key),i.metadata?.specType,t.request.teams,{warn:e=>t.logger?.warn(e)}),o=/\.ya?ml$/u.test(r),s=d(c.basename(String(i.metadata?.sourcePath)))+(o?`.yaml`:`.json`);return o?m(e,t,l.dump(a,{noRefs:!0}),`application/yaml`,s):m(e,t,JSON.stringify(a,null,2),`application/json`,s)}async function y(e,t){let n=e.req.param(`api`)??``,r=await f(t,n,!0);if(!r)return p(t,n);let i=await t.entities.load(r.key),a=String(r.metadata?.sourcePath);return m(e,t,i,`application/graphql`,c.basename(a))}export{g as bundle,_ as graphql};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineContentPlugin as e}from"../../define.js";import{createInlineEntity as t}from"../../../loaders/define.js";import{
|
|
1
|
+
import{defineContentPlugin as e}from"../../define.js";import{createInlineEntity as t}from"../../../loaders/define.js";import{isPlanFeatureGranted as n}from"../../../../shared/plan-gates.js";import{API_FUNCTION_ENTITY_TYPE as r,apiFunctionEntityKey as i}from"./constants.js";import{notInPlanProblem as a}from"../../../plan-gates.js";import{parseApiFunctionRoute as o}from"./route-path.js";const s=`internal.api-functions`,c=/\.(ts|js)$/u,l=e({id:s,version:`1.1.0`,content:{filter:{match:e=>c.test(e)},extractFile(e,s){let c=o(e.path,s.config.apiFunctions?.folders??[]);if(!c)return null;if(!n(s.config,`apiFunctions`))return{routes:[],problems:[a(`API functions`)]};let l={...c,sourcePath:e.path};return{routes:[],entities:[t(l,{stableKey:i(e.path),type:r,metadata:l})]}}},server:{routes:[{path:`/*`,handler:{filePath:`./server/dispatch.ts`,importer:import.meta.url,exportName:`dispatch`}}]}});export{s as API_FUNCTIONS_PLUGIN_ID,l as apiFunctionsContentPlugin};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{canView as e,compileRouteAccessMatcher as t,matchContentRule as n,resolveRbacDenialStatus as r,resolveRole as i}from"../../../../../
|
|
1
|
+
import{canView as e,compileRouteAccessMatcher as t,matchContentRule as n,resolveRbacDenialStatus as r,resolveRole as i}from"../../../../../shared/rbac/engine.js";const a=/* @__PURE__ */ new WeakMap;function o(e){let n=a.get(e);return n===void 0&&(n=t(e),a.set(e,n)),n}function s(t,a){let o=n(t,{filePath:a.sourcePath,slug:a.pathname})?.scope;return e(i(o,a.teams))?{allow:!0}:{allow:!1,status:r(a.teams)}}export{s as resolveApiFunctionAccess,o as resolveRbacMatcher};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{toJsonValue as e}from"../../../database/utils/json.js";import{
|
|
1
|
+
import{toJsonValue as e}from"../../../database/utils/json.js";import{builtInMarkdocTags as t}from"../../../markdown/constants/builtin-tags.js";import{isRbacScope as n}from"../../../../shared/rbac/engine.js";import{hashBlobContent as r}from"../../../materialization/data-ref.js";import{resolveMarkdownAst as i}from"../../../markdown/resolve/ast.js";import{REDOCLY_TEAMS_RBAC as a}from"@redocly/config";async function o(o,s){if(!o||o.length===0)return null;let c=[],l=[],u=[];for(let[d,f]of o.entries()){if(!f.content){s.logger?.warn(`${s.file.path}: banner[${d}] has no content — the item is not shown`);continue}let{content:o,rbac:p,...m}=f,{ast:h,entityDeps:g,assetUsages:_}=await i(f.content,s.file.path,{resolverContext:s,tags:t}),v=p===void 0?{}:{[a]:n(p)?p:(s.logger?.warn(`${s.file.path}: banner[${d}] has an invalid "rbac" value — the item is hidden from everyone`),{})};c.push(e({...m,...v,ast:h,hash:r(f.content)})),l.push(...g),u.push(..._)}return c.length>0?{banner:c,deps:l,assetUsages:u}:null}export{o as resolveBannerForAppData};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineContentPlugin as e}from"../../define.js";import{toJsonObject as t,toJsonValue as n}from"../../../database/utils/json.js";import{createEntityLoader as r}from"../../../loaders/define.js";import{createPluginScopedId as i}from"../../utils/scoped-id.js";import{buildSearchAppData as a}from"../../../../shared/search/facets.js";import{
|
|
1
|
+
import{defineContentPlugin as e}from"../../define.js";import{toJsonObject as t,toJsonValue as n}from"../../../database/utils/json.js";import{createEntityLoader as r}from"../../../loaders/define.js";import{createPluginScopedId as i}from"../../utils/scoped-id.js";import{buildSearchAppData as a}from"../../../../shared/search/facets.js";import{isAttributionRemoved as o,isPlanFeatureGranted as s}from"../../../../shared/plan-gates.js";import{APP_DATA_STATIC_DATA_SLUG as c}from"../../../../shared/constants/app-data.js";import{isObject as l}from"../../../../shared/utils/is-object.js";import{splitUrlSuffix as u}from"../../../../shared/utils/routes/split-url-suffix.js";import{isAiHidden as d}from"../../../../shared/ask-ai/config-gate.js";import{toNavItemRbacAnnotation as f}from"../../../../shared/rbac/filter.js";import{resolvePageTarget as p}from"../../../../shared/utils/routes/resolve-page-target.js";import{listConfiguredProducts as m}from"../../../products.js";import{collectVersionGroups as h,findVersionedDirectories as g}from"../../../versions/version-groups.js";import{publicLink as _}from"../../../versions/public-link.js";import{linkedPageAccess as v}from"../../utils/link-access.js";import{loadSidebarSubtreeLabel as ee}from"../../utils/sidebar-label.js";import{resolveBannerForAppData as te}from"./banner.js";import{resolveLogoForAppData as ne}from"./logo.js";import{resolveNavbarIconsForAppData as y}from"./navbar-icons.js";import{resolveHtmlForAppData as b}from"./html.js";import{resolveSeoForAppData as x}from"./seo.js";import{productConfigPath as S,productLandingLink as C,readProductConfig as w,resolveProductAssetsForAppData as T}from"./products.js";import{dirname as E,resolve as D}from"node:path";import{REDOCLY_TEAMS_RBAC as O}from"@redocly/config";const k=`internal.app-data`,A=`1.32.0`,j=i(k,`app-data`);function M(e){return l(e)&&typeof e.owner==`string`&&`value`in e}const N=r(j,async e=>{let n=new Set(e.pluginRegistry.listFinalizePlugins().map(e=>e.id)),r={};for(let[t,i]of Object.entries(e.args.fragments??{}))M(i)&&n.has(i.owner)&&(r[t]=i.value);let i=await ne(e.config.logo,e.markdown,e.file.path);if(Object.keys(i.logo).length>0){let e=l(r.theme)?r.theme:{};r.theme=t({...e,logo:i.logo})}let a=await te(e.config.banner,e);if(a){let e=l(r.theme)?r.theme:{};r.theme=t({...e,banner:a.banner})}let o=await y(l(r.theme)?r.theme.navbar:void 0,e.markdown,e.file.path);if(o){let e=l(r.theme)?r.theme:{};r.theme=t({...e,navbar:o.navbar})}let s=await y(l(r.theme)?r.theme.footer:void 0,e.markdown,e.file.path);if(s){let e=l(r.theme)?r.theme:{};r.theme=t({...e,footer:s.navbar})}let c=await T(l(r.theme)?r.theme.products:void 0,e.markdown,e.file.path);if(c){let e=l(r.theme)?r.theme:{};r.theme=t({...e,products:c.products})}let u=await b(e.config,e.markdown,e.file.path,t=>e.io.readFile(D(E(e.file.absolutePath),t)),e.logger);u&&(r.html=t(u.html));let d=await x(r.seo,e.markdown,e.file.path);d&&(r.seo=d.seo);let f=[i,a,o,s,c,u,d];return{value:r,entityDeps:f.flatMap(e=>e?.deps??[]),assetUsages:f.flatMap(e=>e?.assetUsages??[])}});function P(e){return{isSystem:!0,key:c,kind:`loader`,type:null,metadata:null,loaderArgs:{pluginVersion:A},loaderId:j,pluginId:k,shouldInvalidateValue:!1,value:null,version:null,fragmentUpdates:e.fragmentUpdates}}const F=e({id:k,version:A,async finalize(e){let r=await h({io:e.io,routes:e.routes,versionedDirectories:g(e.routes.all())}),i=e=>e&&_(e,r),a=t=>t&&{slug:_(t,r),loadLabel:()=>ee(e.entities,t)},o=t=>a(e.routes.byFilePath(t)),s=t=>a(e.routes.bySlug(t)),c=t=>v(t,e.routes,r),u=await B(e.config,o,s,e.logger,c),d=await L(e,o,s,i,c);if(Object.keys(d).length>0){let e=l(u.theme)?u.theme:{};u.theme=t({...e,products:d}),u.pageProducts=n(Object.values(d).map(I))}return{appData:u}},loaders:[N]});function I(e){let{name:t,slug:n,configOverride:r}=e,i={name:t,slug:n},a=r?.analytics?.ga;return a&&(i.ga=a),i}async function L(e,n,r,i,o){let s={};for(let t of m(e.config)){let c=await C(t,e.routes,e.io,i);if(c===void 0){e.logger.warn(`Product "${t.id}" is left out of the product picker: "${t.folder}" has no page.`);continue}let l={name:t.name,folder:t.folder,slug:t.slug,link:c,[O]:o(c)??void 0};t.icon!==void 0&&(l.icon=t.icon);let u=S(t.folder),d=await e.io.exists(u)?await R(w(await e.io.readFile(u),u),{page:Q(n,r,u,e.logger),access:o},a(e.config),e.config):{};Object.keys(d).length>0&&(l.configOverride=d),s[t.id]=l}return t(s)}async function R(e,t,n,r){let i={},a=await G(e.navbar,t),o=await W(e.footer,t),c=U(e.breadcrumbs,t);return e.logo&&(i.logo=e.logo),a&&(i.navbar=a),o&&(i.footer=o),c&&s(r,`breadcrumbs`)&&(i.breadcrumbs=c),e.feedback&&(i.feedback=e.feedback),e.sidebar&&(i.sidebar=e.sidebar),e.codeSnippet&&(i.codeSnippet=e.codeSnippet),e.palette&&(i.palette=e.palette),e.search&&(i.search=await z(e.search,n,t)),e.analytics?.ga&&s(r,`analytics`)&&(i.analytics={ga:e.analytics.ga}),i}async function z(e,n,r){let i={...n},a=await K(e?.suggestedPages,r);return e?.hide!==void 0&&(i.hide=e.hide),e?.placement!==void 0&&(i.placement=e.placement),e?.shortcuts!==void 0&&(i.shortcuts=e.shortcuts),a.length>0&&(i.suggestedPages=a),t(i)}async function B(e,n,r,i,s=()=>void 0){let c={},l={page:Q(n,r,Z,i),access:s},u=await G(e.navbar,l),d=await W(e.footer,l),f=e.seo?.projectTitle,p=U(e.breadcrumbs,l),m={...u?{navbar:u}:{},...d?{footer:d}:{},...p?{breadcrumbs:p}:{},markdown:e.markdown,navigation:e.navigation,userMenu:await Y(e.userMenu,l),feedback:e.feedback,consent:e.consent,...f?{seo:{projectTitle:f}}:{},aiAssistant:V(e),mcp:H(e),search:await z(e.search,a(e),l),sidebar:e.sidebar,versionPicker:e.versionPicker,codeSnippet:e.codeSnippet,palette:e.palette};if(e.colorMode&&(m.colorMode=e.colorMode),Object.keys(m).length>0&&(c.theme=m),e.analytics&&(c.analytics=e.analytics),e.planGates&&(c.removeAttribution=o(e)),e.removeAttribution===!0&&(c.removeConsoleAttribution=!0),e.seo){let{projectTitle:t,llmstxt:n,...r}=e.seo;Object.keys(r).length>0&&(c.seo=r)}return t(c)}function V(e){let t=d(e),n=e.aiAssistant?.trigger;return{...e.aiAssistant,hide:t,trigger:{...n,hide:n?.hide??t}}}function H(e){let t=e.mcp?.hide===!0;return{hide:t,docs:{hide:t}}}function U(e,n){if(!e)return null;let r={};e.hide!==void 0&&(r.hide=e.hide);let i=(e.prefixItems??[]).map(e=>{let t=e.page?n.page(e.page)?.link:void 0;return{icon:$(e.icon),label:$(e.label)??``,labelTranslationKey:$(e.labelTranslationKey),link:t,[O]:J(n,t)}});return i.length>0&&(r.prefixItems=i),Object.keys(r).length>0?t(r):null}async function W(e,n){if(!e)return null;let r={hide:e.hide===!0},i=await K(e.items,n);return e.copyrightText!==void 0&&(r.copyrightText=e.copyrightText),e.logo&&(r.logo=e.logo),i.length>0&&(r.items=i),t(r)}async function G(e,n){if(!e)return null;let r={},i=await K(e.items,n);return e.hide!==void 0&&(r.hide=e.hide),i.length>0&&(r.items=i),Object.keys(r).length>0?t(r):null}async function K(e,t){return Array.isArray(e)?(await Promise.all(e.map(e=>q(e,t)))).filter(e=>e!==null):[]}async function q(e,n){if(typeof e==`string`)return q({page:e},n);if(!l(e))return null;if(typeof e.separator==`string`)return t({...X(e),label:e.separator,type:`separator`});let r=await K(e.items,n),i=ie(e,n.page),a=i?.link,o=e.rbac===void 0?J(n,a):void 0,s=$(e.label)??$(e.group)??(i?i.anchor??await i.loadLabel?.()??i.link:``);return typeof e.group==`string`||r.length>0?t({...X(e),...a?{link:a}:{},...r.length>0?{items:r}:{},label:s,labelTranslationKey:$(e.groupTranslationKey)??$(e.labelTranslationKey),type:`group`,[O]:o}):a?t({...X(e),...se(e.external)??ae(a)?{external:!0}:{},label:s,link:a,type:`link`,[O]:o}):null}function J(e,t){return t===void 0?void 0:e.access(t)??void 0}async function Y(e,n){if(!e)return;let r=[];for(let t of e.items??[])r.push({...t,href:t.link});let i=await K(r,n);return t({...e,menu:i.length>0?i:void 0})}function X(e){let t=oe(e,[`additionalProps`,`expanded`,`labelTranslationKey`,`languageInsensitive`,`linePosition`,`linkedSidebars`,`menuStyle`,`selectFirstItemOnExpand`,`separatorLine`,`target`,`version`]),n=re(e.icon);return n.icon&&(t.icon=n.icon),n.srcSet&&(t.srcSet=n.srcSet),{...t,...f(e.rbac)}}function re(e){return typeof e==`string`?{icon:e}:l(e)&&typeof e.srcSet==`string`?{srcSet:e.srcSet}:{}}function ie(e,t){return typeof e.href==`string`&&e.href.trim()!==``?{link:e.href.trim()}:typeof e.page==`string`&&e.page.trim()!==``?t(e.page):null}const Z=`redocly.yaml`;function Q(e,t,n,r){let i={bySlug:e=>t?.(e),byFilePath:t=>e?.(t)};return e=>{let{path:t,suffix:a,anchor:o}=u(e.trim()),s=p(t,n,i);return s.kind===`escaped`?(r?.warn(`Config page reference escapes the content root`,{page:e}),null):s.kind===`missing`?(r?.warn(`Config page has no matching route`,{page:e}),{link:e.trim()}):{link:`${s.value.slug}${a}`,anchor:o,loadLabel:s.value.loadLabel}}}function ae(e){return/^(?:[a-z][a-z\d+.-]*:)?\/\//i.test(e)||/^(?:mailto|tel):/i.test(e)}function oe(e,t){let n={};for(let r of t)e[r]!==void 0&&(n[r]=e[r]);return n}function $(e){return typeof e==`string`&&e.trim()!==``?e:void 0}function se(e){return typeof e==`boolean`?e:void 0}export{k as APP_DATA_PLUGIN_ID,A as APP_DATA_PLUGIN_VERSION,j as APP_DATA_STATIC_DATA_LOADER_ID,c as APP_DATA_STATIC_DATA_SLUG,F as appDataContentPlugin,P as appDataSystemEntityDescriptor,B as buildConfigAppData,M as isAppDataFragment};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { NestedConfig } from '../../../../shared/types/config.js';
|
|
1
2
|
import type { JsonObject } from '../../../database/schema.js';
|
|
2
3
|
import type { AssetUsage } from '../../../markdown/types/asset-usage.js';
|
|
3
4
|
import type { MarkdownService } from '../../../markdown/types/service.js';
|
|
@@ -7,6 +8,7 @@ import type { EntityInvalidationDep } from '../../types/plugin.js';
|
|
|
7
8
|
import type { RouteIndex, RouteRow } from '../../utils/route-index.js';
|
|
8
9
|
/** The content path of a product's own config file. */
|
|
9
10
|
export declare function productConfigPath(folder: string): string;
|
|
11
|
+
export declare function readProductConfig(source: string, path: string): NestedConfig;
|
|
10
12
|
/**
|
|
11
13
|
* The link a product's picker entry opens: the folder's index page, else the first link of
|
|
12
14
|
* the shallowest sidebar file in the folder, else the folder's first page by slug.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{toJsonObject as e}from"../../../database/utils/json.js";import{isObject as t}from"../../../../shared/utils/is-object.js";import{resolveContentPath as n}from"../../../../shared/utils/resolve-content-path.js";import{PRODUCT_CONFIG_FILENAME as
|
|
1
|
+
import{toJsonObject as e}from"../../../database/utils/json.js";import{isObject as t}from"../../../../shared/utils/is-object.js";import{resolveContentPath as n}from"../../../../shared/utils/resolve-content-path.js";import{parseNestedConfig as r}from"../../../config.js";import{PRODUCT_CONFIG_FILENAME as i,isInFolder as a}from"../../../products.js";import{resolveConfigImagePath as o,resolveConfigImageSrcSet as s}from"./logo.js";import{resolveNavbarIconsForAppData as c}from"./navbar-icons.js";import{SIDEBAR_FILENAME_REGEX as l}from"../sidebar/index.js";import u from"js-yaml";function d(e){return e===``?i:`${e}/${i}`}function f(e,t){try{return r(e,t).config}catch{return{}}}async function p(e,r,i,o){let s=r.bySlug(e.slug===`/`?`/`:e.slug.slice(0,-1));if(s?.originFilePath&&a(s.originFilePath,e.folder))return o(s);let[c]=(await i.glob(e.folder===``?`**`:`${e.folder}/**`)).filter(e=>l.test(e)).sort((e,t)=>e.split(`/`).length-t.split(`/`).length||e.localeCompare(t));if(c){let e=d(m(await i.readFile(c)),c);if(e!==void 0)return e}let[u]=r.inDirectory(e.folder);return u?o(u):void 0;function d(e,n){if(Array.isArray(e))for(let r of e){if(!t(r))continue;let e=f(r,n),i=e?o(e):void 0;if(i!==void 0)return i;if(typeof r.href==`string`&&r.href.trim()!==``)return r.href.trim();let a=d(r.items,n);if(a!==void 0)return a}}function f(e,t){if(typeof e.page==`string`){let i=n(e.page,t);return i===null?void 0:r.byFilePath(i)}if(typeof e.directory==`string`){let i=n(e.directory,t);return i===null?void 0:r.inDirectory(i)[0]}}}function m(e){try{return u.load(e)}catch{return}}async function h(n,r,i){if(!t(n))return null;let a=[],l=[],u={};for(let[e,f]of Object.entries(n)){if(!t(f)||typeof f.folder!=`string`)continue;let n={...f};if(typeof f.icon==`string`){let[e,t,s]=await o(f.icon,r,i);n.icon=e,a.push(...t),l.push(...s)}if(t(f.configOverride)){let e={...f.configOverride},i=d(f.folder);if(t(e.logo)){let{favicon:t,...n}=e.logo;if(typeof n.image==`string`){let[e,t,s]=await o(n.image,r,i);n.image=e,a.push(...t),l.push(...s)}if(typeof n.srcSet==`string`){let[e,t,o]=await s(n.srcSet,r,i);n.srcSet=e,a.push(...t),l.push(...o)}Object.keys(n).length>0?e.logo=n:delete e.logo}for(let t of[`navbar`,`footer`]){let n=await c(e[t],r,i);n&&(e[t]=n.navbar,a.push(...n.deps),l.push(...n.assetUsages))}n.configOverride=e}u[e]=n}return{products:e(u),deps:a,assetUsages:l}}export{d as productConfigPath,p as productLandingLink,f as readProductConfig,h as resolveProductAssetsForAppData};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{LoaderDataContext as e}from"../../../../../client/contexts.js";import{telemetry as t}from"../../../../../client/telemetry/telemetry.js";import{CATALOG_CLASSIC_DEP_KEY as n}from"./contract.js";import{readSelectionsFromSearch as r,readTermFromSearch as i,resolveCatalog as a,selectFilterOption as o,toCatalogItems as s,toggleFilterOption as c,writeSelectionsToSearch as l}from"./catalog-filtering.js";import*as u from"react";import{useLocation as d,useNavigate as f}from"react-router";import{getBaseDataAttributes as p}from"@redocly/theme/core/utils";const m=[];function h(e){t.sendCatalogFilterChangedMessage([{...p(`catalogFilter`,`field`),type:e}])}function g(t){let p=d(),g=f(),_=u.useContext(e)[n],v=t.filters??m,[y,b]=u.useState(()=>r(p.search,v)),[x,S]=u.useState(()=>i(p.search)),C=u.useCallback(e=>{S(e),h(`term`)},[]),w=u.useMemo(()=>s(_?.items??[]),[_]);u.useEffect(()=>{let e=l(p.search,v,y,x);e!==p.search.replace(/^\?/,``)&&g({search:e},{replace:!0})},[v,x,p.search,g,y]);let T=u.useMemo(()=>a({filters:v,groupByFirstFilter:t.groupByFirstFilter,items:w,selections:y,term:x}),[t.groupByFirstFilter,v,x,w,y]);return u.useMemo(()=>({groups:T.groups,filters:T.filters.map((e,t)=>({...e,toggleOption:e=>{b(n=>c(n,t,e)),h(`toggle`),window.scrollTo(0,0)},selectOption:e=>{b(n=>o(n,v,t,e)),h(`select`),window.scrollTo(0,0)}})),filterTerm:x,setFilterTerm:C}),[C,v,x,T])}export{g as useCatalogClassic};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineContentPlugin as e}from"../../define.js";import{createEntityLoader as t}from"../../../loaders/define.js";import{runtimeFile as n}from"../../utils/runtime-file.js";import{createServerFn as r}from"../../server-fn.js";import{createPluginScopedId as i}from"../../utils/scoped-id.js";import{runtimeTemplate as a}from"../../templates.js";import{normalizeRouteSlug as o}from"../../../../shared/utils/routes/normalize-route-slug.js";import{
|
|
1
|
+
import{defineContentPlugin as e}from"../../define.js";import{createEntityLoader as t}from"../../../loaders/define.js";import{runtimeFile as n}from"../../utils/runtime-file.js";import{createServerFn as r}from"../../server-fn.js";import{createPluginScopedId as i}from"../../utils/scoped-id.js";import{runtimeTemplate as a}from"../../templates.js";import{normalizeRouteSlug as o}from"../../../../shared/utils/routes/normalize-route-slug.js";import{CATALOG_CLASSIC_DEP_KEY as s}from"./client/contract.js";import{SIDEBAR_CONTRIBUTIONS_ENTITY_TYPE as c}from"../sidebar/contributions.js";import{catalogEntityKey as l}from"./entity-key.js";import{buildCatalogCards as u,loadVersionGroups as d,pickDefaultVersions as f,resolveCatalogMembers as p}from"./resolve-items.js";import{catalogSidebarContributions as m}from"./sidebars.js";const h=`internal.catalog-classic`,g=`catalog-classic`,_=i(h,`catalog`),v=i(h,`sidebars`),y=i(h,`deliver`),b=t(_,async e=>{let t=p(e.args.items,e),{versionGroups:n,entityDeps:r}=await d(t,e),i=e.args.config.separateVersions?t:f(t,n),a=await u(i,n,e);return{value:{catalogId:e.args.catalogId,config:e.args.config,items:a},entityDeps:r}}),x=t(v,async e=>{let t=p(e.args.items,{routes:e.routes}),{versionGroups:n,entityDeps:r}=await d(t,e);return{value:await m(t,n,{label:e.args.title,link:e.args.slug},e),entityDeps:r}}),S=r(y,{filePath:`./server/deliver.ts`,importer:import.meta.url,exportName:`deliver`,cacheable:!0});function C(e){return Object.entries(e.catalogClassic??e.catalog??{})}const w=e({id:h,version:`1.7.0`,content:{extractAll(e){let t=[],n=[];for(let[r,i]of C(e.config)){let{items:e,...a}=i,u=o(String(i.slug)),d=typeof i.title==`string`?i.title:`API Catalog`;t.push(b.withArgs({catalogId:r,config:a,items:e},{stableKey:l(r),metadata:{sourcePath:u}}),x.withArgs({items:e,slug:u,title:d},{stableKey:`${l(r)}:sidebars`,type:c})),n.push({deps:{[s]:S.withArgs({catalogId:r})},metadata:{title:d},routeId:r,slug:u,template:g})}return{entities:t,routes:n}}},loaders:[b,x],server:{functions:[S]},templates:{[g]:a(n(`./client/template.tsx`,import.meta.url))}});export{_ as CATALOG_CLASSIC_LOADER_ID,h as CATALOG_CLASSIC_PLUGIN_ID,y as CATALOG_CLASSIC_SERVER_FN_ID,v as CATALOG_CLASSIC_SIDEBARS_LOADER_ID,g as CATALOG_CLASSIC_TEMPLATE_ID,w as catalogClassicContentPlugin};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{STATIC_FOLDER_PLUGIN_ID as
|
|
1
|
+
import{APP_DATA_STATIC_DATA_SLUG as e}from"../../../shared/constants/app-data.js";import{SIDEBAR_ROUTE_DEP_KEY as t}from"../../../shared/constants/route-deps.js";import"./api-functions/constants.js";import{STATIC_FOLDER_PLUGIN_ID as n,STATIC_FOLDER_PREFIX as r,isStaticFolderPath as i,staticFolderContentPlugin as a}from"./static-folder/index.js";import{ASSETS_PLUGIN_ID as o,ASSET_ENTITY_KEY_PREFIX as s,assetsContentPlugin as c}from"./assets/index.js";import{FOLDER_SIDEBAR_FILENAME_REGEX as l,SIDEBAR_AGGREGATOR_LOADER_ID as u,SIDEBAR_FILENAME_REGEX as d,SIDEBAR_PLUGIN_ID as f,isTabbedSidebar as p,resolveAutoSidebar as m,sidebarContentPlugin as h}from"./sidebar/index.js";import{APP_DATA_PLUGIN_ID as g,APP_DATA_PLUGIN_VERSION as ee,APP_DATA_STATIC_DATA_LOADER_ID as _,appDataContentPlugin as v,appDataSystemEntityDescriptor as y,buildConfigAppData as b,isAppDataFragment as x}from"./app-data/index.js";import{apiDocsContentPlugin as S}from"./api-docs/index.js";import{API_FUNCTIONS_PLUGIN_ID as C,apiFunctionsContentPlugin as w}from"./api-functions/index.js";import{CATALOG_CLASSIC_LOADER_ID as T,CATALOG_CLASSIC_PLUGIN_ID as E,CATALOG_CLASSIC_SERVER_FN_ID as D,CATALOG_CLASSIC_SIDEBARS_LOADER_ID as O,CATALOG_CLASSIC_TEMPLATE_ID as k,catalogClassicContentPlugin as A}from"./catalog-classic/index.js";import{L10N_PLUGIN_ID as j}from"./l10n/translations-loader.js";import{L10N_PLUGIN_VERSION as M,l10nContentPlugin as N}from"./l10n/index.js";import{MARKDOC_DOCUMENT_LOADER_ID as P,MARKDOC_SEARCH_GROUP as F,MARKDOC_SIDEBAR_ITEM_LOADER_ID as te,MARKDOC_TEMPLATE_ID as I,markdocContentPlugin as L}from"./markdoc/index.js";import{mcpContentPlugin as R}from"./mcp/index.js";import{MOCK_SERVER_PLUGIN_ID as z,MOCK_SERVER_ROUTE_PATH as B,mockServerContentPlugin as V}from"./mock/index.js";import{REACT_PAGE_SEARCH_LOADER_KEY as H,reactPageContentPlugin as U}from"./react-page/index.js";import{REVISIONS_PLUGIN_ID as W,revisionsContentPlugin as G}from"./revisions/index.js";import{SCORECARD_CLASSIC_PLUGIN_ID as K,SCORECARD_CLASSIC_TEMPLATE_ID as q,scorecardClassicContentPlugin as J}from"./scorecard-classic/index.js";import{SKILLS_PLUGIN_ID as Y,SKILL_MARKDOWN_ROUTE_PATH as X,skillsContentPlugin as Z}from"./skills/index.js";import{VERSIONS_PLUGIN_ID as Q,versionsContentPlugin as $}from"./versions/index.js";function ne(){return[v,N,a,c,L,h,$,G,A,S,J,w,V,R,U,Z]}export{C as API_FUNCTIONS_PLUGIN_ID,g as APP_DATA_PLUGIN_ID,ee as APP_DATA_PLUGIN_VERSION,_ as APP_DATA_STATIC_DATA_LOADER_ID,e as APP_DATA_STATIC_DATA_SLUG,o as ASSETS_PLUGIN_ID,s as ASSET_ENTITY_KEY_PREFIX,T as CATALOG_CLASSIC_LOADER_ID,E as CATALOG_CLASSIC_PLUGIN_ID,D as CATALOG_CLASSIC_SERVER_FN_ID,O as CATALOG_CLASSIC_SIDEBARS_LOADER_ID,k as CATALOG_CLASSIC_TEMPLATE_ID,l as FOLDER_SIDEBAR_FILENAME_REGEX,j as L10N_PLUGIN_ID,M as L10N_PLUGIN_VERSION,P as MARKDOC_DOCUMENT_LOADER_ID,F as MARKDOC_SEARCH_GROUP,te as MARKDOC_SIDEBAR_ITEM_LOADER_ID,I as MARKDOC_TEMPLATE_ID,z as MOCK_SERVER_PLUGIN_ID,B as MOCK_SERVER_ROUTE_PATH,H as REACT_PAGE_SEARCH_LOADER_KEY,W as REVISIONS_PLUGIN_ID,K as SCORECARD_CLASSIC_PLUGIN_ID,q as SCORECARD_CLASSIC_TEMPLATE_ID,u as SIDEBAR_AGGREGATOR_LOADER_ID,d as SIDEBAR_FILENAME_REGEX,f as SIDEBAR_PLUGIN_ID,t as SIDEBAR_ROUTE_DEP_KEY,Y as SKILLS_PLUGIN_ID,X as SKILL_MARKDOWN_ROUTE_PATH,n as STATIC_FOLDER_PLUGIN_ID,r as STATIC_FOLDER_PREFIX,Q as VERSIONS_PLUGIN_ID,S as apiDocsContentPlugin,w as apiFunctionsContentPlugin,v as appDataContentPlugin,y as appDataSystemEntityDescriptor,c as assetsContentPlugin,b as buildConfigAppData,A as catalogClassicContentPlugin,ne as createInternalContentPlugins,x as isAppDataFragment,i as isStaticFolderPath,p as isTabbedSidebar,N as l10nContentPlugin,L as markdocContentPlugin,R as mcpContentPlugin,V as mockServerContentPlugin,U as reactPageContentPlugin,m as resolveAutoSidebar,G as revisionsContentPlugin,J as scorecardClassicContentPlugin,h as sidebarContentPlugin,Z as skillsContentPlugin,a as staticFolderContentPlugin,$ as versionsContentPlugin};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineContentPlugin as e}from"../../define.js";import{toJsonObject as t}from"../../../database/utils/json.js";import{
|
|
1
|
+
import{defineContentPlugin as e}from"../../define.js";import{toJsonObject as t}from"../../../database/utils/json.js";import{isPlanFeatureGranted as n}from"../../../../shared/plan-gates.js";import{TRANSLATIONS_FILE_PATTERN as r}from"../../../../shared/constants/l10n/defaults.js";import{compareStrings as i}from"../../../../shared/utils/compare-strings.js";import{normalizeL10nConfig as a}from"../../../../shared/utils/l10n.js";import{collectSlugOverrides as o}from"../../utils/slug-overrides.js";import{L10N_PLUGIN_ID as s,L10N_TRANSLATIONS_ENTITY_TYPE as c,l10nTranslationsLoader as l}from"./translations-loader.js";const u=`0.2.0`,d=e({id:s,version:u,loaders:[l],content:{filter:{match:e=>r.test(e)},extractFile(e){return{routes:[],entities:[l.withArgs({path:e.path},{stableKey:`${c}:${e.path}`,type:c})]}}},async finalize(e){let r=a(e.config.l10n).locales,{localeContext:i}=e,{defaultLocale:s,locales:c}=i,l={},u=n(e.config,`l10n`)?await f(e,i):/* @__PURE__ */ new Map;for(let[e,t]of u)l[e]={translation:t};l[s]??={translation:{}};let d={defaultLocale:s,locales:r??[s,...c].map(e=>({code:e,name:e})),contentLocales:[...c],slugOverrides:o(e.routes.all(),i),translations:l};return{appData:t({l10n:d})}}});async function f(e,t){let n=await e.entities.list({type:c}),r=/* @__PURE__ */ new Map;for(let a of[...n].sort((e,t)=>i(e.key,t.key))){let n=await e.entities.load(a.key),i=n?.dir;if(i==null)continue;let o=i===``?t.defaultLocale:i;(i===``||t.isLocale(i))&&(r.has(o)||r.set(o,n.translation))}return r}export{s as L10N_PLUGIN_ID,u as L10N_PLUGIN_VERSION,d as l10nContentPlugin};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{MARKDOC_DOCUMENT_LOADER_KEY as e}from"../../../../../shared/constants/route-deps.js";import{collectHeadings as t}from"../../../../markdown/utils/collect-headings.js";import{MarkdocRenderer as n}from"../../../../markdown/client/markdoc-components.js";import{
|
|
1
|
+
import{MARKDOC_DOCUMENT_LOADER_KEY as e}from"../../../../../shared/constants/route-deps.js";import{collectHeadings as t}from"../../../../markdown/utils/collect-headings.js";import{MarkdocRenderer as n}from"../../../../markdown/client/markdoc-components.js";import*as r from"react";import{extendDetailsBehaviour as i}from"@redocly/theme/core/utils";import{DEFAULT_FEEDBACK_TYPE as a}from"@redocly/theme/core/constants";import{jsx as o}from"react/jsx-runtime";import{useThemeConfig as s,useThemeHooks as c}from"@redocly/theme/core/hooks";import{useLoaderData as l}from"virtual:realm-runtime";import{Feedback as u}from"@redocly/theme/components/Feedback/Feedback";import{TableOfContent as d}from"@redocly/theme/components/TableOfContent/TableOfContent";import{CodeWalkthroughLayout as f}from"@redocly/theme/layouts/CodeWalkthroughLayout";import{DocumentationLayout as p}from"@redocly/theme/layouts/DocumentationLayout";function m(m){let h=l(e),{useSidebarSiblingsData:g}=c(),{markdown:_,feedback:v}=s(),{nextPage:y,prevPage:b}=g()??{},[x,S]=r.useState(null),C=r.useMemo(()=>h?t(h.ast):[],[h]);if(r.useEffect(()=>i(),[h]),!h)return null;let w=/* @__PURE__ */ o(n,{ast:h.ast,withPageActions:!0});return h.tagList?.includes(`code-walkthrough`)?/* @__PURE__ */ o(f,{children:w}):/* @__PURE__ */ o(p,{config:_,editPage:h.editPage,lastModified:h.lastModified,feedback:/* @__PURE__ */ o(u,{...v,type:v?.type??a,settings:v?.settings??{},path:m.page.slug??m.page.path}),nextPage:y,prevPage:b,tableOfContent:/* @__PURE__ */ o(d,{contentWrapper:x,headings:C}),children:/* @__PURE__ */ o(`div`,{ref:S,children:w})})}export{m as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineContentPlugin as e}from"../../define.js";import{createEntityLoader as t}from"../../../loaders/define.js";import{runtimeFile as n}from"../../utils/runtime-file.js";import{createPluginScopedId as r}from"../../utils/scoped-id.js";import{runtimeTemplate as i}from"../../templates.js";import{SEARCH_GROUP_FACET_FIELD as a}from"../../../../shared/search/facets.js";import{configuredFacetFields as o,extractFacetsFromFrontmatter as s,invalidFacetValueProblems as c,searchCategoryOf as l}from"../../../search/facet-values.js";import{isObject as u}from"../../../../shared/utils/is-object.js";import{normalizeRouteSlug as d}from"../../../../shared/utils/routes/normalize-route-slug.js";import{resolveContentPath as f}from"../../../../shared/utils/resolve-content-path.js";import{PAGE_BANNER_SCHEMA as p,sanitizeConfig as m}from"../../../config-schema.js";import{notInPlanProblem as h}from"../../../plan-gates.js";import{matchPathMap as g}from"../../utils/glob.js";import{filePathToRouteSlug as _}from"../../../../shared/utils/routes/file-path-to-route-slug.js";import{isPlanFeatureGranted as v}from"../../../../shared/plan-gates.js";import{splitUrlSuffix as y}from"../../../../shared/utils/routes/split-url-suffix.js";import{packMarkdocAst as ee,unpackMarkdocAst as b}from"../../../markdown/utils/packed-ast.js";import{isRouteSlugTarget as x}from"../../../../shared/utils/routes/is-route-slug-target.js";import{loadSidebarSubtreeLabel as S}from"../../utils/sidebar-label.js";import{markdocNodeRange as C}from"../../../markdown/utils/node-source-range.js";import{replaceWithMarkdocError as te}from"../../../markdown/tags/markdoc-error.js";import{getPartialTwins as ne}from"../../../markdown/tags/partial.js";import{CODE_WALKTHROUGH_TAG_NAMES as re,builtInMarkdocTags as ie}from"../../../markdown/constants/builtin-tags.js";import{walkMarkdocAst as w}from"../../../markdown/utils/walk-markdoc-ast.js";import{markdocFirstHeading as ae}from"../../../markdown/search/to-text.js";import{safeDecodeURI as oe}from"../../../../shared/utils/safe-decode-uri.js";import{shiftRange as se}from"../../../../shared/utils/shift-range.js";import{classifyLinkTarget as ce}from"../../../link-checker/classify.js";import{onDiskLinkRefs as le}from"../../../link-checker/node-ref.js";import{isPartialPath as ue}from"../../../markdown/utils/partials.js";import{FRONTMATTER_BLOCK_RE as de,computeFrontmatterLineOffset as fe}from"../../../markdown/utils/frontmatter-offset.js";import{inlineRawPartials as T}from"../../../markdown/resolve/raw-partials.js";import{resolveMarkdownAst as E}from"../../../markdown/resolve/ast.js";import{resolveBannerForAppData as D}from"../app-data/banner.js";import{MARKDOC_DOCUMENT_LOADER_KEY as O}from"../../../../shared/constants/route-deps.js";import{isMarkdocValidationEnabled as k,resolveMarkdocTagSet as A,resolveMarkdownPageValidationSet as j,userMarkdocSchemaFiles as M,userMarkdocTagNames as N}from"../../../markdown/constants/tag-sets.js";import{pageLocale as P}from"../../utils/page-locale.js";import{markdocAstToMarkdownDoc as F}from"../../../markdown/search/to-markdown.js";import{collectAnchors as I}from"../../../markdown/utils/collect-anchors.js";import{frontmatterVariable as L}from"../../../markdown/utils/frontmatter-variable.js";import{markdownFirstHeading as R}from"../../../markdown/utils/first-heading.js";import{markdocAstToSearchSections as z}from"../../../markdown/search/to-sections.js";import{isInternalPagePath as B}from"../../utils/internal-page-path.js";import{parseExplicitSlugs as V}from"../../utils/explicit-slugs.js";import{isSkillContentPath as pe}from"../../utils/skill-paths.js";import{SOURCE_TEMPLATE_PREFIX as me}from"../../../../shared/constants/template-ids.js";import{captureSnippet as H,splitSourceLines as he}from"../../../../shared/utils/capture-snippet.js";import{curationKeywordsOf as ge}from"../../../search/keywords.js";import _e from"js-yaml";const U=`markdoc-page`,W=r(`internal.markdoc`,`document`),G=r(`internal.markdoc`,`sidebar-item`),ve=`Documentation`,K=t(W,async e=>{let t=await e.io.readFile(e.file.absolutePath),{content:n,frontmatter:r,frontmatterError:i}=Y(t),a=J(e),{ast:o,entityDeps:s,assetUsages:c,tagList:l,problems:u,linkRefs:d}=await E(n,e.file.path,{resolverContext:a,tags:(await A()).tags,variables:{get env(){return e.config.publicEnv??{}}},transform:t=>De(t,e.file.path,Ee(e.config)),validation:k()?await j():void 0}),f=fe(t);Me(o);let p=await Te(r.seo,e),m=v(e.config,`banner`)?await D(Ne(r,e.file.path,e.logger),a):void 0,h=await ke(r,e),g=await Ae(r.navigation,e),_={...h.frontmatter,navigation:g.value,seo:p.seo,banner:m?.banner},y=Pe(r,o);return{value:{ast:ee(o),frontmatter:_,tagList:l,title:y,editPage:we(e.config,r,e.file.path),lastModified:e.file.lastModifiedAt},entityDeps:[...s,...be(),...p.entityDeps,...m?.deps??[],...h.entityDeps,...g.entityDeps],assetUsages:[...c,...p.assetUsages,...m?.assetUsages??[],...h.assetUsages],problems:xe(t,e.file.path,f,u,i),linkRefs:[...le(d,f),...g.linkRefs],targetInventories:[Se(o,{frontmatter:L(_,y)})]}},{usesProjectMarkdocSchema:!0,async markdown(e,t){let{tags:n}=await A(),{chunks:r,headings:i}=F(b(e.ast),{tags:n,locale:P(t),variables:{frontmatter:L(e.frontmatter,e.title),env:t.config.publicEnv??{}}});return[{chunks:r,headings:i,...e.title?{title:e.title}:{}}]},searchable(e,t){if(t.route===void 0||t.route.metadata.excludeFromSearch===!0)return{docs:[]};let n=t.route.slug,r=e.title??Q(t.route.originFilePath??n),{category:i,isInvalid:u}=l(t.route.metadata),{facets:d,invalidFields:f}=s(t.route.metadata,o(t.config)),p=ge(e.frontmatter.keywords);return{docs:z(b(e.ast),r,{frontmatter:L(e.frontmatter,e.title)}).map((e,t)=>{let r={docKey:e.docKey,routeSlug:n,title:e.title,text:e.text,groupKey:i??`Documentation`,facets:d};e.anchor!==void 0&&(r.anchor=e.anchor),e.path!==void 0&&(r.path=e.path);let a=t===0?p:{excludes:p?.excludes};return(a?.includes||a?.excludes)&&(r.keywords=a),e.rbacTeams!==void 0&&(r.rbacScope=Object.fromEntries(e.rbacTeams.map(e=>[e,`read`]))),r}),problems:c([...f,...u?[a]:[]],t.route.originFilePath)}}}),q=t(G,async e=>{let{content:t,frontmatter:n}=Y(await e.io.readFile(e.file.absolutePath)),r=await T(t,e.file.path,J(e));return{value:{label:Z(n)??R(r.source)??Q(e.args.filePath)},entityDeps:r.entityDeps}});function J(e){return{config:e.config,contentDir:e.contentDir,entities:e.entities,file:e.file,io:e.io,logger:e.logger,markdown:e.markdown,plugin:e.plugin}}const ye=e({id:`internal.markdoc`,version:`3.45.0`,content:{filter:{match:e=>e.toLowerCase().endsWith(`.md`)&&!pe(e)},extractFile(e,t){if(B(e.path)||ue(e.path,t.config))return{routes:[]};if(!v(t.config,`markdown`))return{routes:[],problems:[h(`Markdown pages`)]};let{banner:n,...r}=e.manifest,i=Fe(e,t),a=V(r.slug),o=K.withArgs({filePath:e.path}),s=q.withArgs({filePath:e.path});return{routes:a.length>0?a.map(e=>({deps:{[O]:o},metadata:r,routeId:`page`,sidebarSubtree:s,slug:e,slugHint:null,template:i})):[{deps:{[O]:o},metadata:r,routeId:`page`,sidebarSubtree:s,slug:null,slugHint:_(e.path),template:i}],entities:[o]}}},loaders:[K,q],templates:{[U]:i(n(`./client/template.tsx`,import.meta.url))}});function Y(e){let t=e.match(de);if(!t)return{content:e,frontmatter:{}};let n=t[1]??``;try{let r=_e.load(n);return{content:e.slice(t[0].length),frontmatter:u(r)?r:{}}}catch(n){let r=n instanceof Error?n.message:String(n);return{content:e.slice(t[0].length),frontmatter:{},frontmatterError:r}}}function be(){return(M()??[]).map(e=>({kind:`file`,path:e}))}function xe(e,t,n,r,i){if(r.length===0&&i===void 0)return[];let a=he(e),o=r.map(e=>Ce(e,a,n,t));if(i!==void 0){let e={start:{line:1},end:{line:n}};o.push({code:`markdown/frontmatter-parse`,message:i,location:{filePath:t,range:e,snippet:H(a,e)}})}return o}function Se(e,t){let{ids:n,exhaustive:r}=I(e,t);return{kind:`anchor`,exhaustive:r,targets:n}}function Ce(e,t,n,r){let i=e.location?.range;if(!i)return e;let a=se(i,n);return{...e,location:{filePath:r,range:a,snippet:H(t,a)}}}function we(e,t,n){let r=u(t.markdown)?t.markdown:{},i={...e.markdown?.editPage,...u(r.editPage)?r.editPage:{}};if(i.hide!==!0&&typeof i.baseUrl==`string`&&i.baseUrl!==``)return{to:`${i.baseUrl.replace(/(?<!\/)\/+$/,``)}/${n}`}}async function Te(e,t){if(!u(e)||typeof e.image!=`string`)return{seo:e,entityDeps:[],assetUsages:[]};let n=await t.markdown.resolveImageReference(e.image,t.file.path);return n.result.kind===`assetRef`?{seo:{...e,image:n.result.url},entityDeps:n.entityDeps,assetUsages:n.assetUsages}:{seo:e,entityDeps:n.entityDeps,assetUsages:[]}}function Ee(e){let t=/* @__PURE__ */ new Map;if(!v(e,`customMarkdocTags`))for(let e of N())t.set(e,`Custom Markdoc tags are not in this project's plan, so \`${e}\` is ignored.`);if(!v(e,`codeWalkthrough`))for(let e of re)t.set(e,`\`${e}\` is not in this project's plan and is ignored.`);return t}function De(e,t,n){let r=[];if(n.size===0)return r;for(let i of w(e,{getExtraNodes:ne})){let e=i.type===`tag`&&i.tag!==void 0?n.get(i.tag):void 0;e!==void 0&&(r.push({code:`configuration/ignored`,message:e,location:{filePath:t,range:C(i)??{start:{line:1},end:{line:1}}}}),te(i,e))}return r}const Oe=[`image`,`links`];async function ke(e,t){let n=t.config.markdown?.frontMatterKeysToResolve??Oe,r={...e},i=[],a=[];for(let o of n){let n=e[o];if(typeof n!=`string`)continue;let s=await t.markdown.resolveLocalReference(n,t.file.path);i.push(...s.entityDeps),a.push(...s.assetUsages),s.result.kind!==`passthrough`&&(r[o]=s.result.url)}return{frontmatter:r,entityDeps:i,assetUsages:a}}async function Ae(e,t){let n=[],r=[];if(!u(e))return{value:e,entityDeps:n,linkRefs:r};let i={...e};for(let a of[`nextButton`,`previousButton`]){let o=e[a];if(!u(o)||typeof o.page!=`string`)continue;let{page:s,...c}=o,l=ce(oe(s),t.file.path);l!==null&&r.push({kind:`link`,raw:s,...l});let d=await je(s,t);n.push(...d.entityDeps),i[a]={...c,label:typeof c.label==`string`?c.label:d.route&&await X(d.route,t),link:d.link}}return{value:i,entityDeps:n,linkRefs:r}}async function X(e,t){let n=await S(t.entities,e);if(n!==void 0)return n;let r=t.routes.get(e.slug)?.metadata.seo;return u(r)&&typeof r.title==`string`&&r.title.trim()!==``?r.title:e.slug}async function je(e,t){let n=e.trim(),{path:r,suffix:i}=y(n);if(x(r)){let e=t.routes.bySlug(d(r));return{link:e&&`${e.slug}${i}`,route:e,entityDeps:[]}}let a=await t.markdown.resolveLocalReference(n,t.file.path);if(a.result.kind!==`pageUrl`)return{entityDeps:a.entityDeps};let o=a.result.url;return{link:o,route:t.routes.bySlug(y(o).path)??a.entityDeps.map(e=>e.kind===`file`?t.routes.byFilePath(e.path):void 0).reverse().find(e=>e!==void 0),entityDeps:a.entityDeps}}function Me(e){let t=/* @__PURE__ */ new Map;for(let n of w(e)){if(n.type!==`tag`||n.tag===void 0||ie[n.tag]?.attributes?.__idx===void 0)continue;let e=(t.get(n.tag)??0)+1;t.set(n.tag,e),n.attributes.__idx=e}}function Ne(e,t,n){if(e.banner===void 0)return;let{value:r,problems:i}=m(p,{banner:e.banner});for(let e of i)n?.warn(`${t}: ${e.message}`);return r.banner}function Pe(e,t){return Z(e)??ae(t)??void 0}function Z(e){let t=u(e.seo)?e.seo.title:void 0;return typeof t==`string`&&t.trim()!==``?t:void 0}function Q(e){let t=(e.split(`/`).pop()??e).replace(/\.[^.]+$/,``);return t===``?e:t}function Fe(e,t){let n=e.manifest.template;if(typeof n==`string`&&n.trim()!==``)return $(n,e.path,t.logger);let r=g(e.path,t.config.markdown?.template);return typeof r==`string`&&r.trim()!==``?$(r,`redocly.yaml`,t.logger):U}function $(e,t,n){if(!e.startsWith(`./`)&&!e.startsWith(`../`)&&!e.startsWith(`/`))return e;let r=f(e,t);return r===null?(n.warn(`Template reference "${e}" in ${t} escapes the content root; falling back to ${U}.`),U):`${me}${r}`}export{W as MARKDOC_DOCUMENT_LOADER_ID,ve as MARKDOC_SEARCH_GROUP,G as MARKDOC_SIDEBAR_ITEM_LOADER_ID,U as MARKDOC_TEMPLATE_ID,ye as markdocContentPlugin};
|
|
1
|
+
import{defineContentPlugin as e}from"../../define.js";import{createEntityLoader as t}from"../../../loaders/define.js";import{runtimeFile as n}from"../../utils/runtime-file.js";import{createPluginScopedId as r}from"../../utils/scoped-id.js";import{runtimeTemplate as i}from"../../templates.js";import{SEARCH_GROUP_FACET_FIELD as a}from"../../../../shared/search/facets.js";import{configuredFacetFields as o,extractFacetsFromFrontmatter as s,invalidFacetValueProblems as c,searchCategoryOf as l}from"../../../search/facet-values.js";import{isPlanFeatureGranted as u}from"../../../../shared/plan-gates.js";import{isObject as d}from"../../../../shared/utils/is-object.js";import{normalizeRouteSlug as f}from"../../../../shared/utils/routes/normalize-route-slug.js";import{MARKDOC_DOCUMENT_LOADER_KEY as p}from"../../../../shared/constants/route-deps.js";import{markdocNodeRange as m}from"../../../markdown/utils/node-source-range.js";import{replaceWithMarkdocError as h}from"../../../markdown/tags/markdoc-error.js";import{getPartialTwins as g}from"../../../markdown/tags/partial.js";import{CODE_WALKTHROUGH_TAG_NAMES as _,builtInMarkdocTags as v}from"../../../markdown/constants/builtin-tags.js";import{isMarkdocValidationEnabled as ee,resolveMarkdocTagSet as y,resolveMarkdownPageValidationSet as b,userMarkdocSchemaFiles as x,userMarkdocTagNames as te}from"../../../markdown/constants/tag-sets.js";import{splitUrlSuffix as S}from"../../../../shared/utils/routes/split-url-suffix.js";import{isSkillContentPath as ne}from"../../utils/skill-paths.js";import{SOURCE_TEMPLATE_PREFIX as re}from"../../../../shared/constants/template-ids.js";import{resolveContentPath as ie}from"../../../../shared/utils/resolve-content-path.js";import{PAGE_BANNER_SCHEMA as ae,sanitizeConfig as oe}from"../../../config-schema.js";import{notInPlanProblem as se}from"../../../plan-gates.js";import{matchPathMap as ce}from"../../utils/glob.js";import{filePathToRouteSlug as le}from"../../../../shared/utils/routes/file-path-to-route-slug.js";import{packMarkdocAst as ue,unpackMarkdocAst as C}from"../../../../shared/utils/packed-ast.js";import{isRouteSlugTarget as de}from"../../../../shared/utils/routes/is-route-slug-target.js";import{loadSidebarSubtreeLabel as fe}from"../../utils/sidebar-label.js";import{walkMarkdocAst as w}from"../../../markdown/utils/walk-markdoc-ast.js";import{markdocFirstHeading as T}from"../../../markdown/search/to-text.js";import{safeDecodeURI as E}from"../../../../shared/utils/safe-decode-uri.js";import{shiftRange as D}from"../../../../shared/utils/shift-range.js";import{classifyLinkTarget as O}from"../../../link-checker/classify.js";import{onDiskLinkRefs as k}from"../../../link-checker/node-ref.js";import{isPartialPath as A}from"../../../markdown/utils/partials.js";import{FRONTMATTER_BLOCK_RE as j,computeFrontmatterLineOffset as M}from"../../../markdown/utils/frontmatter-offset.js";import{inlineRawPartials as N}from"../../../markdown/resolve/raw-partials.js";import{resolveMarkdownAst as P}from"../../../markdown/resolve/ast.js";import{resolveBannerForAppData as F}from"../app-data/banner.js";import{pageLocale as I}from"../../utils/page-locale.js";import{markdocAstToMarkdownDoc as L}from"../../../markdown/search/to-markdown.js";import{collectAnchors as R}from"../../../markdown/utils/collect-anchors.js";import{frontmatterVariable as z}from"../../../markdown/utils/frontmatter-variable.js";import{markdownFirstHeading as B}from"../../../markdown/utils/first-heading.js";import{markdocAstToSearchSections as V}from"../../../markdown/search/to-sections.js";import{isInternalPagePath as pe}from"../../utils/internal-page-path.js";import{parseExplicitSlugs as me}from"../../utils/explicit-slugs.js";import{captureSnippet as H,splitSourceLines as he}from"../../../../shared/utils/capture-snippet.js";import{curationKeywordsOf as ge}from"../../../search/keywords.js";import _e from"js-yaml";const U=`markdoc-page`,W=r(`internal.markdoc`,`document`),G=r(`internal.markdoc`,`sidebar-item`),ve=`Documentation`,K=t(W,async e=>{let t=await e.io.readFile(e.file.absolutePath),{content:n,frontmatter:r,frontmatterError:i}=Y(t),a=J(e),{ast:o,entityDeps:s,assetUsages:c,tagList:l,problems:d,linkRefs:f}=await P(n,e.file.path,{resolverContext:a,tags:(await y()).tags,variables:{get env(){return e.config.publicEnv??{}}},transform:t=>De(t,e.file.path,Ee(e.config)),validation:ee()?await b():void 0}),p=M(t);Me(o);let m=await Te(r.seo,e),h=u(e.config,`banner`)?await F(Ne(r,e.file.path,e.logger),a):void 0,g=await ke(r,e),_=await Ae(r.navigation,e),v={...g.frontmatter,navigation:_.value,seo:m.seo,banner:h?.banner},x=Pe(r,o);return{value:{ast:ue(o),frontmatter:v,tagList:l,title:x,editPage:we(e.config,r,e.file.path),lastModified:e.file.lastModifiedAt},entityDeps:[...s,...be(),...m.entityDeps,...h?.deps??[],...g.entityDeps,..._.entityDeps],assetUsages:[...c,...m.assetUsages,...h?.assetUsages??[],...g.assetUsages],problems:xe(t,e.file.path,p,d,i),linkRefs:[...k(f,p),..._.linkRefs],targetInventories:[Se(o,{frontmatter:z(v,x)})]}},{usesProjectMarkdocSchema:!0,async markdown(e,t){let{tags:n}=await y(),{chunks:r,headings:i}=L(C(e.ast),{tags:n,locale:I(t),variables:{frontmatter:z(e.frontmatter,e.title),env:t.config.publicEnv??{}}});return[{chunks:r,headings:i,...e.title?{title:e.title}:{}}]},searchable(e,t){if(t.route===void 0||t.route.metadata.excludeFromSearch===!0)return{docs:[]};let n=t.route.slug,r=e.title??Q(t.route.originFilePath??n),{category:i,isInvalid:u}=l(t.route.metadata),{facets:d,invalidFields:f}=s(t.route.metadata,o(t.config)),p=ge(e.frontmatter.keywords);return{docs:V(C(e.ast),r,{frontmatter:z(e.frontmatter,e.title)}).map((e,t)=>{let r={docKey:e.docKey,routeSlug:n,title:e.title,text:e.text,groupKey:i??`Documentation`,facets:d};e.anchor!==void 0&&(r.anchor=e.anchor),e.path!==void 0&&(r.path=e.path);let a=t===0?p:{excludes:p?.excludes};return(a?.includes||a?.excludes)&&(r.keywords=a),e.rbacTeams!==void 0&&(r.rbacScope=Object.fromEntries(e.rbacTeams.map(e=>[e,`read`]))),r}),problems:c([...f,...u?[a]:[]],t.route.originFilePath)}}}),q=t(G,async e=>{let{content:t,frontmatter:n}=Y(await e.io.readFile(e.file.absolutePath)),r=await N(t,e.file.path,J(e));return{value:{label:Z(n)??B(r.source)??Q(e.args.filePath)},entityDeps:r.entityDeps}});function J(e){return{config:e.config,contentDir:e.contentDir,entities:e.entities,file:e.file,io:e.io,logger:e.logger,markdown:e.markdown,plugin:e.plugin}}const ye=e({id:`internal.markdoc`,version:`3.46.0`,content:{filter:{match:e=>e.toLowerCase().endsWith(`.md`)&&!ne(e)},extractFile(e,t){if(pe(e.path)||A(e.path,t.config))return{routes:[]};if(!u(t.config,`markdown`))return{routes:[],problems:[se(`Markdown pages`)]};let{banner:n,...r}=e.manifest,i=Fe(e,t),a=me(r.slug),o=K.withArgs({filePath:e.path}),s=q.withArgs({filePath:e.path});return{routes:a.length>0?a.map(e=>({deps:{[p]:o},metadata:r,routeId:`page`,sidebarSubtree:s,slug:e,slugHint:null,template:i})):[{deps:{[p]:o},metadata:r,routeId:`page`,sidebarSubtree:s,slug:null,slugHint:le(e.path),template:i}],entities:[o]}}},loaders:[K,q],templates:{[U]:i(n(`./client/template.tsx`,import.meta.url))}});function Y(e){let t=e.match(j);if(!t)return{content:e,frontmatter:{}};let n=t[1]??``;try{let r=_e.load(n);return{content:e.slice(t[0].length),frontmatter:d(r)?r:{}}}catch(n){let r=n instanceof Error?n.message:String(n);return{content:e.slice(t[0].length),frontmatter:{},frontmatterError:r}}}function be(){return(x()??[]).map(e=>({kind:`file`,path:e}))}function xe(e,t,n,r,i){if(r.length===0&&i===void 0)return[];let a=he(e),o=r.map(e=>Ce(e,a,n,t));if(i!==void 0){let e={start:{line:1},end:{line:n}};o.push({code:`markdown/frontmatter-parse`,message:i,location:{filePath:t,range:e,snippet:H(a,e)}})}return o}function Se(e,t){let{ids:n,exhaustive:r}=R(e,t);return{kind:`anchor`,exhaustive:r,targets:n}}function Ce(e,t,n,r){let i=e.location?.range;if(!i)return e;let a=D(i,n);return{...e,location:{filePath:r,range:a,snippet:H(t,a)}}}function we(e,t,n){let r=d(t.markdown)?t.markdown:{},i={...e.markdown?.editPage,...d(r.editPage)?r.editPage:{}};if(i.hide!==!0&&typeof i.baseUrl==`string`&&i.baseUrl!==``)return{to:`${i.baseUrl.replace(/(?<!\/)\/+$/,``)}/${n}`}}async function Te(e,t){if(!d(e)||typeof e.image!=`string`)return{seo:e,entityDeps:[],assetUsages:[]};let n=await t.markdown.resolveImageReference(e.image,t.file.path);return n.result.kind===`assetRef`?{seo:{...e,image:n.result.url},entityDeps:n.entityDeps,assetUsages:n.assetUsages}:{seo:e,entityDeps:n.entityDeps,assetUsages:[]}}function Ee(e){let t=/* @__PURE__ */ new Map;if(!u(e,`customMarkdocTags`))for(let e of te())t.set(e,`Custom Markdoc tags are not in this project's plan, so \`${e}\` is ignored.`);if(!u(e,`codeWalkthrough`))for(let e of _)t.set(e,`\`${e}\` is not in this project's plan and is ignored.`);return t}function De(e,t,n){let r=[];if(n.size===0)return r;for(let i of w(e,{getExtraNodes:g})){let e=i.type===`tag`&&i.tag!==void 0?n.get(i.tag):void 0;e!==void 0&&(r.push({code:`configuration/ignored`,message:e,location:{filePath:t,range:m(i)??{start:{line:1},end:{line:1}}}}),h(i,e))}return r}const Oe=[`image`,`links`];async function ke(e,t){let n=t.config.markdown?.frontMatterKeysToResolve??Oe,r={...e},i=[],a=[];for(let o of n){let n=e[o];if(typeof n!=`string`)continue;let s=await t.markdown.resolveLocalReference(n,t.file.path);i.push(...s.entityDeps),a.push(...s.assetUsages),s.result.kind!==`passthrough`&&(r[o]=s.result.url)}return{frontmatter:r,entityDeps:i,assetUsages:a}}async function Ae(e,t){let n=[],r=[];if(!d(e))return{value:e,entityDeps:n,linkRefs:r};let i={...e};for(let a of[`nextButton`,`previousButton`]){let o=e[a];if(!d(o)||typeof o.page!=`string`)continue;let{page:s,...c}=o,l=O(E(s),t.file.path);l!==null&&r.push({kind:`link`,raw:s,...l});let u=await je(s,t);n.push(...u.entityDeps),i[a]={...c,label:typeof c.label==`string`?c.label:u.route&&await X(u.route,t),link:u.link}}return{value:i,entityDeps:n,linkRefs:r}}async function X(e,t){let n=await fe(t.entities,e);if(n!==void 0)return n;let r=t.routes.get(e.slug)?.metadata.seo;return d(r)&&typeof r.title==`string`&&r.title.trim()!==``?r.title:e.slug}async function je(e,t){let n=e.trim(),{path:r,suffix:i}=S(n);if(de(r)){let e=t.routes.bySlug(f(r));return{link:e&&`${e.slug}${i}`,route:e,entityDeps:[]}}let a=await t.markdown.resolveLocalReference(n,t.file.path);if(a.result.kind!==`pageUrl`)return{entityDeps:a.entityDeps};let o=a.result.url;return{link:o,route:t.routes.bySlug(S(o).path)??a.entityDeps.map(e=>e.kind===`file`?t.routes.byFilePath(e.path):void 0).reverse().find(e=>e!==void 0),entityDeps:a.entityDeps}}function Me(e){let t=/* @__PURE__ */ new Map;for(let n of w(e)){if(n.type!==`tag`||n.tag===void 0||v[n.tag]?.attributes?.__idx===void 0)continue;let e=(t.get(n.tag)??0)+1;t.set(n.tag,e),n.attributes.__idx=e}}function Ne(e,t,n){if(e.banner===void 0)return;let{value:r,problems:i}=oe(ae,{banner:e.banner});for(let e of i)n?.warn(`${t}: ${e.message}`);return r.banner}function Pe(e,t){return Z(e)??T(t)??void 0}function Z(e){let t=d(e.seo)?e.seo.title:void 0;return typeof t==`string`&&t.trim()!==``?t:void 0}function Q(e){let t=(e.split(`/`).pop()??e).replace(/\.[^.]+$/,``);return t===``?e:t}function Fe(e,t){let n=e.manifest.template;if(typeof n==`string`&&n.trim()!==``)return $(n,e.path,t.logger);let r=ce(e.path,t.config.markdown?.template);return typeof r==`string`&&r.trim()!==``?$(r,`redocly.yaml`,t.logger):U}function $(e,t,n){if(!e.startsWith(`./`)&&!e.startsWith(`../`)&&!e.startsWith(`/`))return e;let r=ie(e,t);return r===null?(n.warn(`Template reference "${e}" in ${t} escapes the content root; falling back to ${U}.`),U):`${re}${r}`}export{W as MARKDOC_DOCUMENT_LOADER_ID,ve as MARKDOC_SEARCH_GROUP,G as MARKDOC_SIDEBAR_ITEM_LOADER_ID,U as MARKDOC_TEMPLATE_ID,ye as markdocContentPlugin};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PackedMarkdocAst } from '
|
|
1
|
+
import type { PackedMarkdocAst } from '../../../../../shared/utils/packed-ast.js';
|
|
2
2
|
export type MarkdocDocumentStaticData = {
|
|
3
3
|
ast: PackedMarkdocAst;
|
|
4
4
|
frontmatter: Record<string, unknown>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createInlineEntity as e}from"../../../loaders/define.js";import{
|
|
1
|
+
import{createInlineEntity as e}from"../../../loaders/define.js";import{isPlanFeatureGranted as t}from"../../../../shared/plan-gates.js";import{CREATE_ANONYMOUS_SESSION_TOOL_NAME as n,DISCOVER_TOOL_NAME as r,EXECUTE_TOOL_NAME as i,MANAGE_API_CREDENTIALS_TOOL_NAME as a,MCP_TOOLS_ENTITY_TYPE as o,REMOVE_API_CREDENTIALS_TOOL_NAME as s,SUBMIT_FEEDBACK_TOOL_NAME as c}from"./constants.js";import{notInPlanProblem as l}from"../../../plan-gates.js";import{MCP_TOOL_NAME_PATTERN as u}from"../../registry.js";import{isMcpHidden as d}from"./server/config-gate.js";import{buildMcpSetupPageRoutes as f}from"./setup-page.js";const p=`@mcp`,m=`mcp/invalid-tool`,h=/\.(ts|js)$/u,g=/\.d\.ts$/u,_=/* @__PURE__ */ new Set([`search`,`list-apis`,`get-endpoints`,`get-endpoint-info`,`get-security-schemes`,`get-full-api-description`,`list-graphql-apis`,`get-graphql-type-list`,`get-graphql-type`,`get-graphql-schema`,`list-pages`,`get-page`,`grep-pages`,`whoami`,c,i,r,`describe-tools`,n,a,s]);function v(e){return`mcp-tool-file:${e}`}function y(e){if(g.test(e)||!h.test(e))return!1;let t=e.split(`/`),n=t.indexOf(p);return n!==-1&&n<t.length-1}function b(e,t,n){if(!u.test(e))return`Invalid MCP tool file "${t}": the tool name "${e}" is derived from the file name and may only contain letters, numbers, hyphens, and underscores (max 64 characters). Rename the file.`;if(n!==void 0)return`Duplicate MCP tool name "${e}": defined by both "${n}" and "${t}". Tool names are file names, so each file name must be unique across @mcp folders.`;if(_.has(e))return`Invalid MCP tool file "${t}": the tool name "${e}" is already used by a built-in MCP tool. Rename the file.`}function x(n){let r=[],i=[];if(d(n.config))return{entities:r,problems:i};if(!t(n.config,`customMcpTools`)){for(let{path:e}of n.files)i.push({...l(`Custom MCP tools`),location:{filePath:e}});return{entities:r,problems:i}}let a=/* @__PURE__ */ new Map;for(let{path:t}of n.files){let n=t.slice(t.lastIndexOf(`/`)+1).replace(h,``),s=b(n,t,a.get(n));if(s!==void 0){i.push({code:m,message:s,location:{filePath:t}});continue}a.set(n,t);let c={name:n,sourcePath:t};r.push(e(c,{stableKey:v(t),type:o,metadata:c}))}return{entities:r,problems:i}}const S={filter:{match:y},extractAll(e){return{routes:f(e.config),entities:[]}}};export{p as MCP_DIR_SEGMENT,m as MCP_TOOL_PROBLEM_CODE,_ as RESERVED_MCP_TOOL_NAMES,y as isMcpToolFile,S as mcpContent,v as mcpToolFileEntityKey,x as scanMcpToolFiles};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{compareStrings as e}from"../../../../shared/utils/compare-strings.js";import{delocalizeRouteSlug as t,l10nDirOf as n}from"../../../../shared/utils/l10n.js";import{
|
|
1
|
+
import{compareStrings as e}from"../../../../shared/utils/compare-strings.js";import{delocalizeRouteSlug as t,l10nDirOf as n}from"../../../../shared/utils/l10n.js";import{toPublicVersionedSlug as r}from"../../../../shared/constants/versions.js";import{compileContentGlob as i}from"../../utils/glob.js";import{MCP_IGNORED_ROUTES_ENTITY_KEY as a}from"../../../../shared/constants/mcp.js";const o=/* @__PURE__ */ new Set;function s(e,r){let i=n(r);return(i===void 0?e:t(e,i)??e).replace(/^\/+/,``)}function c(t,n,r,a){if(n.length===0)return[];let o=i(n),c=/* @__PURE__ */ new Set,u=new Set(t.map(e=>e.slug)),d=e=>{let t=l(e,r),n=t!==void 0&&!u.has(t);for(let r of n?[e.slug,t]:[e.slug])if(c.add(r),e.locale===``&&a!==void 0)for(let e of a.locales)c.add(a.toL10nSlug(r,e))};for(let e of t){let t=s(e.slug,e.originFilePath??``);(e.originFilePath!==null&&o(e.originFilePath)||o(t))&&d(e)}return[...c].sort(e)}function l(e,t){if(e.versionGroup&&e.version&&t.get(e.versionGroup)?.defaultVersion===e.version)return r(e.slug,e.versionGroup,e.version,!0)}async function u(e){if(!await e.get(`mcp:ignored-routes`))return o;let t=await e.load(a);return Array.isArray(t)?new Set(t.filter(e=>typeof e==`string`)):o}export{a as MCP_IGNORED_ROUTES_ENTITY_KEY,s as canonicalSlugPath,c as collectIgnoredRouteSlugs,u as readIgnoredRouteSlugs};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineContentPlugin as e}from"../../define.js";import{createInlineEntity as t}from"../../../loaders/define.js";import{runtimeFile as n}from"../../utils/runtime-file.js";import{runtimeTemplate as r}from"../../templates.js";import{
|
|
1
|
+
import{defineContentPlugin as e}from"../../define.js";import{createInlineEntity as t}from"../../../loaders/define.js";import{runtimeFile as n}from"../../utils/runtime-file.js";import{runtimeTemplate as r}from"../../templates.js";import{A2A_ROUTE as i,AGENT_CARD_ROUTE as a,MCP_AUTHORIZATION_SERVER_ROUTE as o,MCP_AUTHORIZE_ROUTE as s,MCP_CALLBACK_ROUTE as c,MCP_CREDENTIALS_ROUTE as l,MCP_PROTECTED_RESOURCE_ROUTE as u,MCP_REGISTER_ROUTE as d,MCP_ROUTE as f,MCP_SERVER_CARD_ROUTE as p,MCP_SETUP_TEMPLATE_ID as m,MCP_TOKEN_ROUTE as h,PUBLIC_MCP_ROUTE as g}from"./constants.js";import{collectVersionGroups as _,findVersionedDirectories as v}from"../../../versions/version-groups.js";import{MCP_CREDENTIALS_THEME_ENTITY_KEY as y,MCP_IGNORED_ROUTES_ENTITY_KEY as b}from"../../../../shared/constants/mcp.js";import{buildMcpAppData as x}from"./app-data.js";import{readCredentialsTheme as S}from"./credentials-theme.js";import{mcpContent as C,scanMcpToolFiles as w}from"./content-tools.js";import{collectIgnoredRouteSlugs as T}from"./ignored-routes.js";import{findMcpRedirectConflict as E}from"./redirects.js";function D(e,t,n,r){return{path:e,auth:`manual`,...r?{method:r}:{},handler:{filePath:t,importer:import.meta.url,exportName:n}}}const O=[D(f,`./server/handler.ts`,`mcp`),D(g,`./server/handler.ts`,`mcpPublic`),D(p,`./server/server-card.ts`,`mcpServerCard`,`GET`),D(u,`./server/oauth/discovery.ts`,`oauthProtectedResource`,`GET`),D(o,`./server/oauth/discovery.ts`,`oauthAuthorizationServer`,`GET`),D(d,`./server/oauth/register.ts`,`mcpRegister`,`POST`),D(s,`./server/oauth/authorize.ts`,`mcpAuthorize`,`GET`),D(h,`./server/oauth/token.ts`,`mcpToken`,`POST`),D(c,`./server/oauth/callback.ts`,`mcpCallback`,`GET`),D(`${c}/*`,`./server/oauth/callback.ts`,`mcpCallback`,`GET`),D(c,`./server/oauth/callback.ts`,`mcpConsent`,`POST`),D(`${c}/*`,`./server/oauth/callback.ts`,`mcpConsent`,`POST`),D(l,`./server/gateway/credentials-handler.ts`,`mcpCredentials`,`ALL`),D(a,`./server/agent-card.ts`,`agentCard`,`GET`),D(i,`./server/agent-card.ts`,`a2a`,`POST`)],k=e({id:`internal.mcp`,version:`1.10.0`,content:C,server:{routes:O},templates:{[m]:r(n(`./client/template.tsx`,import.meta.url))},async finalize(e){let n=E(e.config.redirects);if(n)throw Error(`Redirect "${n.from}" references the reserved MCP route "${n.route}". Remove it: the MCP endpoints are served by the internal.mcp plugin and a redirect would shadow them.`);let r={mcp:x(e.config)},{entities:i,problems:a}=w(e),o=await S(e.io,e.config.palette,t=>e.logger.debug(t));i.push(t(o,{stableKey:y}));let s=e.config.mcp?.ignore??[];if(s.length===0)return{appData:r,problems:a,entities:i};let c=await _({io:e.io,routes:e.routes,versionedDirectories:v(e.routes.all())}),l=T(e.routes.all(),s,c,e.localeContext);return l.length===0?{appData:r,problems:a,entities:i}:(e.logger.debug(`mcp.ignore: hiding ${l.length} routes from the MCP tools`),i.push(t(l,{stableKey:b})),{appData:r,problems:a,entities:i})}});export{k as mcpContentPlugin};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{withPathPrefix as e}from"../../../../../shared/path-prefix.js";import{SKILLS_INDEX_SLUG as t,skillMarkdownPath as n}from"../../../utils/skill-paths.js";import{A2A_ROUTE as r,MCP_ROUTE as i,MCP_SERVER_CARD_ROUTE as a}from"../constants.js";import{isMcpContentProtected as o,isMcpHidden as s,resolveMcpAccess as c}from"./config-gate.js";import{SKILL_ENTITY_TYPE as l}from"../../../types/skill-entity.js";import{isEntityScopeVisible as u}from"../../../../../
|
|
1
|
+
import{withPathPrefix as e}from"../../../../../shared/path-prefix.js";import{SKILLS_INDEX_SLUG as t,skillMarkdownPath as n}from"../../../utils/skill-paths.js";import{A2A_ROUTE as r,MCP_ROUTE as i,MCP_SERVER_CARD_ROUTE as a}from"../constants.js";import{isMcpContentProtected as o,isMcpHidden as s,resolveMcpAccess as c}from"./config-gate.js";import{SKILL_ENTITY_TYPE as l}from"../../../types/skill-entity.js";import{isEntityScopeVisible as u}from"../../../../../shared/rbac/entity-scope.js";import{notFoundResponse as d}from"../../../../../server/plugin-context.js";import{publicBaseUrl as f}from"../../../utils/request-origin.js";import{CORS_ANY_ORIGIN as p,MCP_AUTH_SCHEMES as m}from"./oauth/constants.js";import"./auth.js";const h=[`text/plain`],g=[`text/plain`],_={streaming:!1,pushNotifications:!1},v={"Cache-Control":`no-store`};async function y(t,r){let i=!!t.request.viewer?.isAuthenticated;return o(c(t.config))&&!i?[]:(await t.entities.list({type:l})).flatMap(i=>{let{slug:a,title:o,description:s}=i.metadata??{};return typeof a!=`string`||!u(i,t.request.teams,e=>t.logger?.warn(e))?[]:[{id:a,name:o??a,description:s??``,tags:[],url:`${r}${e(n(a))}`}]})}async function b(t,n){if(s(n.config)||n.config.skills?.hide===!0)return d();t.set(`realmCacheControlOwned`,!0);let a=f(n.config,n.request),l=o(c(n.config)),u=n.config.seo;return t.json({name:u?.title||u?.projectTitle||`Developer Documentation`,description:u?.description||`Documentation agent card announcing this site's agent skills and MCP server.`,url:`${a}${e(r)}`,documentationUrl:`${a}${e(`/`)}`,version:`0.0.1`,protocolVersion:`0.3.0`,preferredTransport:`HTTP+JSON`,capabilities:{..._,extensions:[{uri:`https://modelcontextprotocol.io`,description:`Model Context Protocol server exposing the documentation tools and skills.`,params:{url:`${a}${e(i)}`,...l?{authentication:{required:!0,schemes:[...m]}}:{}}}]},defaultInputModes:h,defaultOutputModes:g,skills:await y(n,a)},200,{...v,...p})}function x(n,r){if(s(r.config))return d();let i=[`<${e(a)}>; rel="mcp-server-card"`];return r.config.skills?.hide!==!0&&i.push(`<${e(t)}>; rel="agent-skills"`),n.json({error:{code:`405`,message:`Method not allowed`}},405,{Link:i.join(`, `),...p,"Access-Control-Expose-Headers":`Link`})}export{x as a2a,b as agentCard};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{RBAC_TEAM_ANONYMOUS as e}from"../../../../../
|
|
1
|
+
import{RBAC_TEAM_ANONYMOUS as e}from"../../../../../shared/rbac/types.js";import{canView as t,parseRbacScope as n,resolveRole as r}from"../../../../../shared/rbac/engine.js";import{resolveViewerTeams as i}from"../../../../../shared/rbac/teams.js";import{ANONYMOUS_VIEWER as a}from"../../../../../shared/types/auth.js";function o(e){return!!e.mcp?.hide}function s(e){return e!==void 0&&(Object.keys(e),!0)}function c(i){if(!i||typeof i!=`object`||Object.keys(i).length===0)return!1;let a=n(i,`rbac`,()=>{});return!t(r(a,[e]))}function l(e){let t=e.access?.rbac;return{requiresLogin:e.access?.requiresLogin===!0,rbacConfigured:s(t),rbacDeniesAnonymous:Object.values(t?.content??{}).some(c)||c(t?.features?.mcp),featureScope:t?.features?.mcp}}function u(e){return e.requiresLogin||e.rbacDeniesAnonymous}function d(e,t){return!!e.mcp?.publicEndpoint&&u(t)&&p(t,i(a),!1)}function f(e){return d(e,l(e))}function p(e,i,a,o=()=>{}){return e.rbacConfigured?e.featureScope===void 0||t(r(n(e.featureScope,`features.mcp`,o),i)):!e.requiresLogin||a}export{p as canAccessMcpFeature,u as isMcpContentProtected,o as isMcpHidden,d as isPublicEndpointServed,f as isPublicEndpointServedFromConfig,l as resolveMcpAccess};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{MCP_TOOLS_ENTITY_TYPE as e}from"../constants.js";import{publicOrigin as t}from"../../../utils/request-origin.js";import{errorMessage as n}from"../../../../../shared/utils/error-message.js";import{isSubprocessError as r}from"../../../../../server/subprocess/runner.js";import{ToolHandlerError as i}from"./tool-errors.js";import{fileURLToPath as a}from"node:url";import{parse as o}from"hono/utils/cookie";const s=a(import.meta.url);function c(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function l(e){return`MCP tool "${e}" is not registered or its module does not export a handler for "${e}". Expected \`export default { '${e}': handler }\` or a single tool definition with \`description\` and \`execute\` as the default export.`}function u(e,t){if(c(e))return typeof e.execute==`function`&&typeof e.description==`string`?e:e[t]}const d=/* @__PURE__ */ new Set([`text`,`image`,`audio`,`resource`,`resource_link`]);function f(e){return c(e)&&Array.isArray(e.content)&&e.content.every(e=>c(e)&&d.has(e.type))}function p(e,t){if(f(t))return t;if(typeof t==`string`)return{content:[{type:`text`,text:t}]};let n;try{n=JSON.stringify(t)}catch(t){throw Error(`MCP tool "${e}" returned a value that cannot be serialized to JSON: ${S(t)}`)}if(n===void 0)throw Error(`MCP tool "${e}" returned an invalid result.`);return{content:[{type:`text`,text:n}]}}const m={readFile:async()=>{throw Error(`Project files are not available in this environment.`)}};async function h(e,t){let r=u((await t.loadModule(e.handlerModulePath)).default,e.toolName),i=typeof r==`function`?r:r?.execute;if(typeof i!=`function`)return{ok:!1,code:`no-handler-export`,message:l(e.toolName)};let a={...e.context,fs:m};try{if(e.mode===`isAvailable`){let e=typeof r==`function`?void 0:r?.isAvailable;return{ok:!0,output:!e||await e(a)}}let t=await i(e.args,a,e.extra);return{ok:!0,output:p(e.toolName,t)}}catch(e){return{ok:!1,code:`handler-error`,message:n(e),stack:e instanceof Error?e.stack:void 0}}}function g(e){let n=e.request.viewer;return{user:{teams:e.request.teams,claims:e.claims??{...n},email:n?.email,idpAccessToken:void 0,idpId:void 0,isAuthenticated:n?.isAuthenticated??!1},config:e.config,baseUrl:t(e.request),params:{},query:Object.fromEntries(new URL(e.request.url).searchParams),cookies:o(e.request.headers.cookie??``),products:Object.values(e.config.products??{}).map(e=>e.name),accessToken:e.accessToken,metadata:e.metadata}}function _(e,t,n){if(!c(e)||e.type!==`object`)return null;let r=`Invalid arguments for tool "${n}":`;if(!c(t))return`${r} expected an object.`;let i=Array.isArray(e.required)?e.required:[];for(let e of i)if(typeof e==`string`&&!(e in t))return`${r} missing required field "${e}".`;let a=c(e.properties)?e.properties:{};for(let[e,n]of Object.entries(t)){let t=a[e];if(c(t)){if(typeof t.type==`string`&&!v(n,t.type))return`${r} field "${e}" must be ${t.type}.`;if(Array.isArray(t.enum)&&!t.enum.includes(n))return`${r} field "${e}" must be one of ${JSON.stringify(t.enum)}.`}}return null}function v(e,t){switch(t){case`string`:return typeof e==`string`;case`number`:return typeof e==`number`&&Number.isFinite(e);case`integer`:return typeof e==`number`&&Number.isInteger(e);case`boolean`:return typeof e==`boolean`;case`object`:return c(e);case`array`:return Array.isArray(e);case`null`:return e===null;default:return!0}}function y(e,t,n,r,i){if(!t.subprocess)throw Error(`MCP tool "${e.toolName}" cannot run on this host: no subprocess.`);return t.subprocess.run({modulePath:s,exportName:`invokeCustomTool`,input:{handlerModulePath:t.subprocess.resolveContentModule(e.handlerFilePath),toolName:e.toolName,mode:n,args:r,context:g(t),extra:{sessionId:i?.sessionId,requestId:i?.mcpReq.id??t.requestId,_meta:i?.mcpReq._meta}},timeoutMs:3e4})}function b(e,t){return{schema:e,isAvailable:t.hasAvailabilityGate?async n=>{if(!n.subprocess)return!1;let r=n.isAvailableMemo?.get(e.name);if(r)return r;let i=(async()=>{try{let e=await y(t,n,`isAvailable`);return e.ok&&e.output===!0}catch(t){return n.logger?.warn(`MCP tool "${e.name}" isAvailable failed: ${S(t)}`),!1}})();return n.isAvailableMemo?.set(e.name,i),i}:void 0,async execute(n,r,a){let o=_(t.argsSchema,n,e.name);if(o)throw Error(o);let s=await y(t,r,`execute`,n,a);if(!s.ok){let e=new i(s.message);throw e.stack=s.stack??e.stack,e}return s.output}}}function x(e){let{declaration:t}=e;return b({name:t.name,title:t.title,description:t.description,schema:t.schema,outputSchema:t.outputSchema,annotations:t.annotations},{toolName:t.name,handlerFilePath:e.handler.filePath,argsSchema:t.schema,hasAvailabilityGate:!0})}function S(e){return r(e)?`${e.code}: ${e.message}`:n(e)}function C(e,t){if(!c(t))return{ok:!1,errors:["the default export must be an object with `description` and `execute` properties. Move shared helper code outside the `@mcp` folder."]};let{description:n,inputSchema:r,outputSchema:i,annotations:a,isAvailable:o,execute:s}=t,l=[];return(typeof n!=`string`||n.trim()===``)&&l.push("`description` must be a non-empty string."),typeof s!=`function`&&l.push("`execute` must be a function."),r!==void 0&&(c(r)?r.type!==void 0&&r.type!==`object`&&l.push('`inputSchema.type` must be "object" because MCP tool arguments are named.'):l.push("`inputSchema` must be a JSON Schema object.")),i!==void 0&&!c(i)&&l.push("`outputSchema` must be a JSON Schema object."),a!==void 0&&!c(a)&&l.push("`annotations` must be an object."),o!==void 0&&typeof o!=`function`&&l.push("`isAvailable` must be a function."),l.length>0||typeof n!=`string`?{ok:!1,errors:l}:{ok:!0,schema:{name:e,description:n,schema:Object.assign({type:`object`},r??{properties:{}}),outputSchema:i,annotations:a},hasAvailabilityGate:typeof o==`function`}}async function w(t){let n=[],r=[];for(let i of await t.entities.list({type:e})){let{name:e,sourcePath:a}=i.metadata,o=e=>r.push(`Invalid MCP tool file "${a}": ${e}`);if(t.reservedNames.has(e)){o(`the tool name "${e}" is already used by a built-in MCP tool. Rename the file.`);continue}let s;try{s=(await t.loadContentModule(a)).default}catch(e){o(`the file failed to load: ${S(e)}. Tool files must not have module-level side effects.`);continue}let c=C(e,s);if(!c.ok){o(c.errors.join(` `));continue}n.push({schema:c.schema,sourcePath:a,hasAvailabilityGate:c.hasAvailabilityGate})}return{tools:n,errors:r}}function T(e){return`MCP tool "${e.schema.name}" in ${e.sourcePath} declares no \`outputSchema\`. Add one that describes the returned value.`}const E=/* @__PURE__ */ new Set;function D(e,t){e&&!E.has(t)&&(E.add(t),e.warn(t))}async function O(e){let{loadContentModule:t,logger:n}=e;if(!t)return[];let{tools:r,errors:i}=await w({entities:e.entities,loadContentModule:t,reservedNames:e.reservedNames});for(let e of i)D(n,e);for(let e of r)e.schema.outputSchema===void 0&&D(n,T(e));return r.map(e=>b(e.schema,{toolName:e.schema.name,handlerFilePath:e.sourcePath,argsSchema:e.schema.schema,hasAvailabilityGate:e.hasAvailabilityGate}))}export{O as buildMcpFileTools,x as createCustomTool,h as invokeCustomTool,w as loadMcpFileTools,T as missingOutputSchemaWarning,C as validateToolDefinition};
|
|
1
|
+
import{MCP_TOOLS_ENTITY_TYPE as e}from"../constants.js";import{publicOrigin as t}from"../../../utils/request-origin.js";import{errorMessage as n}from"../../../../../shared/utils/error-message.js";import{isSubprocessError as r}from"../../../../../server/subprocess/runner.js";import{ToolHandlerError as i}from"./tool-errors.js";import{fileURLToPath as a}from"node:url";import{parse as o}from"hono/utils/cookie";const s=a(import.meta.url);function c(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function l(e){return`MCP tool "${e}" is not registered or its module does not export a handler for "${e}". Expected \`export default { '${e}': handler }\` or a single tool definition with \`description\` and \`execute\` as the default export.`}function u(e,t){if(c(e))return typeof e.execute==`function`&&typeof e.description==`string`?e:e[t]}const d=/* @__PURE__ */ new Set([`text`,`image`,`audio`,`resource`,`resource_link`]);function f(e){return c(e)&&Array.isArray(e.content)&&e.content.every(e=>c(e)&&d.has(e.type))}function p(e,t){if(f(t))return t;if(typeof t==`string`)return{content:[{type:`text`,text:t}]};let n;try{n=JSON.stringify(t)}catch(t){throw Error(`MCP tool "${e}" returned a value that cannot be serialized to JSON: ${S(t)}`)}if(n===void 0)throw Error(`MCP tool "${e}" returned an invalid result.`);return{content:[{type:`text`,text:n}]}}const m={readFile:async()=>{throw Error(`Project files are not available in this environment.`)}};async function h(e,t){let r=u((await t.loadModule(e.handlerModulePath)).default,e.toolName),i=typeof r==`function`?r:r?.execute;if(typeof i!=`function`)return{ok:!1,code:`no-handler-export`,message:l(e.toolName)};let a={...e.context,fs:m};try{if(e.mode===`isAvailable`){let e=typeof r==`function`?void 0:r?.isAvailable;return{ok:!0,output:!e||await e(a)}}let t=await i(e.args,a,e.extra);return{ok:!0,output:p(e.toolName,t)}}catch(e){return{ok:!1,code:`handler-error`,message:n(e),stack:e instanceof Error?e.stack:void 0}}}function g(e){let n=e.request.viewer;return{user:{teams:e.request.teams,claims:e.claims??{...n},email:n?.email,idpAccessToken:void 0,idpId:void 0,isAuthenticated:n?.isAuthenticated??!1},config:e.config,baseUrl:t(e.request),params:{},query:Object.fromEntries(new URL(e.request.url).searchParams),cookies:o(e.request.headers.cookie??``),products:Object.values(e.config.products??{}).map(e=>e.name),accessToken:e.accessToken,metadata:e.metadata}}function _(e,t,n){if(!c(e)||e.type!==`object`)return null;let r=`Invalid arguments for tool "${n}":`;if(!c(t))return`${r} expected an object.`;let i=Array.isArray(e.required)?e.required:[];for(let e of i)if(typeof e==`string`&&!(e in t))return`${r} missing required field "${e}".`;let a=c(e.properties)?e.properties:{};for(let[e,n]of Object.entries(t)){let t=a[e];if(c(t)){if(typeof t.type==`string`&&!v(n,t.type))return`${r} field "${e}" must be ${t.type}.`;if(Array.isArray(t.enum)&&!t.enum.includes(n))return`${r} field "${e}" must be one of ${JSON.stringify(t.enum)}.`}}return null}function v(e,t){switch(t){case`string`:return typeof e==`string`;case`number`:return typeof e==`number`&&Number.isFinite(e);case`integer`:return typeof e==`number`&&Number.isInteger(e);case`boolean`:return typeof e==`boolean`;case`object`:return c(e);case`array`:return Array.isArray(e);case`null`:return e===null;default:return!0}}function y(e,t,n,r,i){if(!t.subprocess)throw Error(`MCP tool "${e.toolName}" cannot run on this host: no subprocess.`);return t.subprocess.run({modulePath:s,exportName:`invokeCustomTool`,input:{handlerModulePath:t.subprocess.resolveContentModule(e.handlerFilePath),toolName:e.toolName,mode:n,args:r,context:g(t),extra:{sessionId:i?.sessionId,requestId:i?.mcpReq.id??t.requestId,_meta:i?.mcpReq._meta}},reuse:!import.meta.env.DEV,timeoutMs:3e4})}function b(e,t){return{schema:e,isAvailable:t.hasAvailabilityGate?async n=>{if(!n.subprocess)return!1;let r=n.isAvailableMemo?.get(e.name);if(r)return r;let i=(async()=>{try{let e=await y(t,n,`isAvailable`);return e.ok&&e.output===!0}catch(t){return n.logger?.warn(`MCP tool "${e.name}" isAvailable failed: ${S(t)}`),!1}})();return n.isAvailableMemo?.set(e.name,i),i}:void 0,async execute(n,r,a){let o=_(t.argsSchema,n,e.name);if(o)throw Error(o);let s=await y(t,r,`execute`,n,a);if(!s.ok){let e=new i(s.message);throw e.stack=s.stack??e.stack,e}return s.output}}}function x(e){let{declaration:t}=e;return b({name:t.name,title:t.title,description:t.description,schema:t.schema,outputSchema:t.outputSchema,annotations:t.annotations},{toolName:t.name,handlerFilePath:e.handler.filePath,argsSchema:t.schema,hasAvailabilityGate:!0})}function S(e){return r(e)?`${e.code}: ${e.message}`:n(e)}function C(e,t){if(!c(t))return{ok:!1,errors:["the default export must be an object with `description` and `execute` properties. Move shared helper code outside the `@mcp` folder."]};let{description:n,inputSchema:r,outputSchema:i,annotations:a,isAvailable:o,execute:s}=t,l=[];return(typeof n!=`string`||n.trim()===``)&&l.push("`description` must be a non-empty string."),typeof s!=`function`&&l.push("`execute` must be a function."),r!==void 0&&(c(r)?r.type!==void 0&&r.type!==`object`&&l.push('`inputSchema.type` must be "object" because MCP tool arguments are named.'):l.push("`inputSchema` must be a JSON Schema object.")),i!==void 0&&!c(i)&&l.push("`outputSchema` must be a JSON Schema object."),a!==void 0&&!c(a)&&l.push("`annotations` must be an object."),o!==void 0&&typeof o!=`function`&&l.push("`isAvailable` must be a function."),l.length>0||typeof n!=`string`?{ok:!1,errors:l}:{ok:!0,schema:{name:e,description:n,schema:Object.assign({type:`object`},r??{properties:{}}),outputSchema:i,annotations:a},hasAvailabilityGate:typeof o==`function`}}async function w(t){let n=[],r=[];for(let i of await t.entities.list({type:e})){let{name:e,sourcePath:a}=i.metadata,o=e=>r.push(`Invalid MCP tool file "${a}": ${e}`);if(t.reservedNames.has(e)){o(`the tool name "${e}" is already used by a built-in MCP tool. Rename the file.`);continue}let s;try{s=(await t.loadContentModule(a)).default}catch(e){o(`the file failed to load: ${S(e)}. Tool files must not have module-level side effects.`);continue}let c=C(e,s);if(!c.ok){o(c.errors.join(` `));continue}n.push({schema:c.schema,sourcePath:a,hasAvailabilityGate:c.hasAvailabilityGate})}return{tools:n,errors:r}}function T(e){return`MCP tool "${e.schema.name}" in ${e.sourcePath} declares no \`outputSchema\`. Add one that describes the returned value.`}const E=/* @__PURE__ */ new Set;function D(e,t){e&&!E.has(t)&&(E.add(t),e.warn(t))}async function O(e){let{loadContentModule:t,logger:n}=e;if(!t)return[];let{tools:r,errors:i}=await w({entities:e.entities,loadContentModule:t,reservedNames:e.reservedNames});for(let e of i)D(n,e);for(let e of r)e.schema.outputSchema===void 0&&D(n,T(e));return r.map(e=>b(e.schema,{toolName:e.schema.name,handlerFilePath:e.sourcePath,argsSchema:e.schema.schema,hasAvailabilityGate:e.hasAvailabilityGate}))}export{O as buildMcpFileTools,x as createCustomTool,h as invokeCustomTool,w as loadMcpFileTools,T as missingOutputSchemaWarning,C as validateToolDefinition};
|
package/dist/content-layer/plugins/internal/mcp/server/gateway/credentials-page/site-branding.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{APP_DATA_ENTITY_KEY as e}from"../../../../../../../shared/constants/app-data.js";import{
|
|
1
|
+
import{APP_DATA_ENTITY_KEY as e}from"../../../../../../../shared/constants/app-data.js";import{toAppData as t}from"../../../../../../../shared/utils/app-data.js";import{parseSrcSet as n}from"../../../../assets/srcset.js";import{MCP_CREDENTIALS_THEME_ENTITY_KEY as r}from"../../../../../../../shared/constants/mcp.js";import{publicOrigin as i}from"../../../../../utils/request-origin.js";async function a(n){let a=t(await n.entities.load(e)),s=o({seo:n.config.seo,logo:a.theme?.logo,colorMode:n.config.colorMode}),c=await n.entities.get(`mcp:credentials-theme`)?await n.entities.load(r):void 0;return{...s,...c?{theme:c}:{},host:new URL(i(n.request)).host}}function o({seo:e,logo:t,colorMode:r}){let i={},a=e?.title||e?.projectTitle||t?.altText;a&&(i.name=a);let o=new Map((t?.srcSet?n(t.srcSet)??[]:[]).map(({src:e,descriptor:t})=>[t.trim(),e])),l=c(o.get(`light`)??t?.image),u=c(o.get(`dark`));l&&(i.logo=u?{light:l,dark:u}:{light:l});let d=s(r);return d&&(i.colorScheme=d),i}function s(e){if(e?.hide)return`light`;if(e?.ignoreDetection)return e.modes?.[0]===`dark`?`dark`:`light`}function c(e){return e?.startsWith(`/`)&&!e.startsWith(`//`)?e:void 0}export{a as loadPageSite,o as resolveSiteBranding};
|