@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 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{builtInMarkdocFunctions as e}from"./builtin-functions.js";import{builtInMarkdocNodes as t,builtInMarkdocTags as n}from"./builtin-tags.js";import{isSchemaLike as r}from"./tag-sets.js";import{getAttributeBuildTimeResolver as i}from"../resolve/attribute-resolver-key.js";import a from"@redocly/markdoc";const o=/* @__PURE__ */ new Set([`codeSnippetFile`,`svgContent`,`tagRawContent`,`codeWalkthroughFilesets`,`partialFile`,`jsonSchemaRef`,`sampleFromJsonSchema`,`jsonExampleRef`,`openapiCodeSamples`,`openapiCodeSamplePanel`,`openapiReplay`,`openapiResponseSamples`,`openapiResponsePanel`,`openapiExample`]),s=/* @__PURE__ */ new Set([`diagram`]);function c(e){return Object.values(e.attributes??{}).some(e=>i(e)!==null)}function l(e,t){return s.has(e)||Object.values(t.attributes??{}).some(e=>{let t=i(e);return t!==null&&o.has(t)})}function u(e){return{transform:()=>new a.Tag(`Admonition`,{type:`danger`},[`The "${e}" tag is not available in inline markdown.`])}}function d(i){let o={};for(let[e,t]of Object.entries(n))o[e]=l(e,t)?u(e):t;let s={...t};for(let[e,t]of[[`tags`,o],[`nodes`,s]])for(let[n,a]of Object.entries(i?.[e]??{}))r(a)&&!c(a)&&(t[n]=a);return o[`ai-citation`]={render:`AiCitation`,selfClosing:!0,attributes:{number:{type:Number,required:!0},url:{type:String,required:!0}}},s.document={...a.nodes.document,render:`div`},{tags:o,nodes:s,functions:{...i?.functions,...e}}}export{d as buildMarkdownTextTagSet};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{builtInMarkdocFunctions as e}from"./builtin-functions.js";import{builtInMarkdocNodes as t,builtInMarkdocTags as n}from"./builtin-tags.js";const r=`@theme/markdoc/schema.ts`;let i,a,o=!1;function s(e,t,n){globalThis.__REALM_MARKDOC_USER_SCHEMA__=e,i=t,a=n,o=!1}function c(e){s(void 0,void 0,e),o=!0}function l(){return a}function u(){return Object.keys(globalThis.__REALM_MARKDOC_USER_SCHEMA__?.tags??{})}function d(){return a!==void 0&&!o}function f(){return i}const p=`builtin`,m=`api-docs`,h={[m]:async()=>{let{apiDocsMarkdocNodes:e,apiDocsMarkdocTags:t}=await import(`@redocly/api-docs/markdoc`);return{tags:t,nodes:e}}},g=/* @__PURE__ */ new Map;let _;const v=/* @__PURE__ */ new Set,y=e=>!!e&&typeof e==`object`;function b(t,n){let r={tags:{...t.tags},nodes:{...t.nodes},functions:{...e,...t.functions}};for(let e of[`tags`,`nodes`,`functions`])for(let[t,i]of Object.entries(n[e]??{}))if(y(i)){if(e===`functions`&&t in r.functions){v.has(t)||(v.add(t),console.warn(`[markdoc] The user schema defines the "${t}" function, but the engine already defines it. The engine function is used.`));continue}r[e][t]=i}return r}async function x(r){let i=globalThis.__REALM_MARKDOC_USER_SCHEMA__;i!==_&&(_=i,g.clear(),v.clear());let a=r??`builtin`,o=g.get(a);if(o)return o;let s={tags:n,nodes:t,functions:e};if(i&&(s=b(s,i)),a!==`builtin`){let e=await h[a]?.();if(!e)throw Error(`Unknown markdoc tag set "${a}".`);s={tags:{...s.tags,...e.tags},nodes:{...s.nodes,...e.nodes},functions:{...s.functions,...e.functions}}}return g.set(a,s),s}const S=`page-validation`;async function C(){let e=await x(),t=await x(m),n=g.get(S);if(n)return n;let r={...t,tags:{...t.tags,...e.tags},nodes:{...t.nodes,...e.nodes}};return g.set(S,r),r}export{m as API_DOCS_MARKDOC_TAG_SET,p as BUILTIN_MARKDOC_TAG_SET,r as USER_MARKDOC_SCHEMA_FILE,d as isMarkdocValidationEnabled,y as isSchemaLike,s as registerUserMarkdocSchema,c as registerUserMarkdocSchemaFailure,x as resolveMarkdocTagSet,C as resolveMarkdownPageValidationSet,f as userMarkdocSchemaDigest,l as userMarkdocSchemaFiles,u as userMarkdocTagNames};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{getInnerText as e}from"../utils/get-inner-text.js";import{headingSlugger as t}from"../utils/heading-slugger.js";import n from"@redocly/markdoc";const r={children:[`inline`],attributes:{id:{type:String},level:{type:Number,required:!0,default:1}},transform(r,i){let a=r.transformAttributes(i),o=r.transformChildren(i),s=typeof a.id==`string`?t.explicit(a.id):t.slug(e(o));return new n.Tag(`Heading`,{...a,id:s,level:r.attributes.level},o)}};export{r as heading};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AssetAudienceDescriptor } from '../../../
|
|
1
|
+
import { type AssetAudienceDescriptor } from '../../../shared/rbac/engine.js';
|
|
2
2
|
export type AudienceTagResolver = (path: string) => Promise<string | null>;
|
|
3
3
|
/**
|
|
4
4
|
* Builds a per-invocation resolver from a raw `access.rbac` config value —
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{compileAssetAudiences as e,compileRbacMatcher as t,deriveAssetTag as n,parseRbacConfigData as r,resolveAssetTagInputs as i}from"../../../
|
|
1
|
+
import{compileAssetAudiences as e,compileRbacMatcher as t,deriveAssetTag as n,parseRbacConfigData as r,resolveAssetTagInputs as i}from"../../../shared/rbac/engine.js";function a(e,a){let o=r(e);if(!o)return async()=>null;let s=t(o);return async e=>{let t=i(s,e);return t===null?null:(t.pattern===``&&a?.(`rbac config: "${e}" matches no content rule — it will be unreachable by any viewer. Add a catch-all "**" rule if this asset should be public.`),n(t))}}async function o(n,i){let a=r(n);return a?e(t(a),i):null}export{o as compileAssetAudienceTable,a as createAudienceTagResolver};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isObject as e}from"../../../../shared/utils/is-object.js";import{
|
|
1
|
+
import{isObject as e}from"../../../../shared/utils/is-object.js";import{markdocNodeProblem as t}from"../../utils/node-source-range.js";import{toContainedContentPath as n}from"../../../ingest/scan.js";import{resolveResolverTarget as r}from"./context-paths.js";import{join as i}from"node:path";async function a(e,t){let{bundle:n,createConfig:r,Source:a}=await import(`@redocly/openapi-core`),s=JSON.parse(JSON.stringify({openapi:`3.1.0`,components:{schemas:{__root:t}}})),c=i(e.contentDir,e.sourceFilePath),l=await n({config:await r({}),doc:{source:new a(c,``),parsed:s}}),u=l.bundle.parsed,d=u.components?.schemas,f=d?.__root?.$ref,p=typeof f==`string`?f.split(`/`).at(-1):void 0;return{oas:u,schema:p?d?.[p]:d?.__root,errors:(l.problems??[]).slice(0,1).map(e=>e.message),fileDeps:o(l.fileDependencies,e.contentDir,c)}}function o(e,t,r){if(e===void 0)return[];let i=/* @__PURE__ */ new Set;for(let a of e){let e=n(t,a);a!==r&&e!==null&&i.add(e)}return[...i].sort()}function s(e,t=[]){return e.length>0||t.length>0?{entityDeps:e.map(e=>({kind:`file`,path:e})),problems:t}:null}function c(e,n){let{node:r,attributeName:i}=e;return r.attributes[`${i}ResolvedErrors`]=n,e.logger?.warn(`${r.tag} in ${e.sourceFilePath}: ${n[0]}`),t(r,n[0],e.sourceFilePath)}async function l(t){let{node:n,attributeName:r}=t,i=n.attributes[r];if(!e(i))return null;let{oas:o,errors:l,fileDeps:u}=await a(t,i);return n.attributes[`${r}Resolved`]=o,l.length>0?s(u,[c(t,l)]):s(u)}async function u(t){let{node:n,attributeName:r}=t,i=n.attributes[r];if(!e(i)||n.attributes.value!==void 0)return null;let{oas:o,schema:l,errors:u,fileDeps:d}=await a(t,i);if(u.length>0)return s(d,[c(t,u)]);let f=n.attributes.mode,p=await import(`openapi-sampler`);try{n.attributes[`${r}Resolved`]=p.sample(l,{...f===`read`?{skipWriteOnly:!0}:void 0,...f===`write`?{skipReadOnly:!0}:void 0},o)}catch(e){return s(d,[c(t,[`Failed to generate a sample from the schema: ${e?.message??e}`])])}return s(d)}async function d(t){let{node:n,attributeName:i}=t,a=n.attributes[i],o=e=>({problems:[c(t,[e])]});if(a!==void 0&&n.attributes.schema!==void 0)return o(`The "schema" and "value" attributes are mutually exclusive, use only one.`);if(a===void 0)return n.attributes.schema===void 0?o(`The tag requires a "schema" or "value" attribute.`):null;let s=e(a)?a.$ref:void 0;if(typeof s!=`string`)return n.attributes[`${i}Resolved`]=a,null;let[l,u]=s.split(`#`),d=l?r(t,l):null;if(d===null||t.io===void 0)return o(`Invalid $ref "${s}": the path must stay inside the content directory.`);if(!await t.io.exists(d.absolutePath))return o(`Invalid $ref: no such file ${d.contentPath}`);let p=await t.io.readFile(d.absolutePath),m=[{kind:`file`,path:d.contentPath}],h;try{h=(await import(`js-yaml`)).load(p)}catch(e){return{entityDeps:m,...o(`File ${d.contentPath} must be valid JSON or YAML: ${e.message}`)}}let g=u?f(h,u):h;return u&&g===void 0?{entityDeps:m,...o(`Invalid $ref: ${d.contentPath} has no value at #${u}`)}:(n.attributes[`${i}Resolved`]=g,{entityDeps:m})}function f(t,n){let r=t;for(let t of n.split(`/`).slice(+!!n.startsWith(`/`))){let n=t.replaceAll(`~1`,`/`).replaceAll(`~0`,`~`);if(Array.isArray(r))r=r[Number(n)];else if(e(r))r=r[n];else return}return r}export{d as resolveJsonExampleRefAttribute,l as resolveJsonSchemaRefAttribute,u as resolveSampleFromJsonSchemaAttribute};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ApiStore, CodeSamplePanelItem, CodeSampleSource, OpenAPIDefinition, ResponseCodeItem, findExampleEncoding } from '@redocly/api-docs';
|
|
2
2
|
import { REDOCLY_TEAMS_RBAC } from '@redocly/config';
|
|
3
3
|
import type { MarkdocAttributeResolverContext, MarkdocAttributeResolverResult } from '../../../plugins/types/markdoc.js';
|
|
4
|
-
import type { RbacScope } from '../../../../
|
|
4
|
+
import type { RbacScope } from '../../../../shared/rbac/types.js';
|
|
5
5
|
export type ResolvedSampleBlock = {
|
|
6
6
|
lang: string;
|
|
7
7
|
title: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{isObject as e}from"../../../../shared/utils/is-object.js";import{markdocNodeProblem as t}from"../../utils/node-source-range.js";import{compileRouteAccessMatcher as n,matchContentScope as r}from"../../../../shared/rbac/engine.js";import{SPEC_KIND_OPENAPI as i}from"../../../../shared/constants/api-spec-kinds.js";import{createLruCache as a}from"../../../../shared/utils/lru-cache.js";import{parseMarkdownCached as o}from"../../utils/parse-cache.js";import{resolveResolverTarget as s}from"./context-paths.js";import{createApiEntityKey as c}from"../../../plugins/utils/api-entity-key.js";import{withMockServerOption as l}from"../../../plugins/internal/api-docs/server/options.js";import{annotateApiDocsRbac as u}from"../../../../shared/rbac/api-docs.js";import{posix as d}from"node:path";import{REDOCLY_TEAMS_RBAC as f}from"@redocly/config";const p={curl:`shell`,JavaScript:`javascript`,"Node.js":`javascript`,Python:`python`,Java:`java`,"Java8+Apache":`java`,"C#":`csharp`,"C#+Newtonsoft":`csharp`,PHP:`php`,Go:`go`,Ruby:`ruby`,R:`r`},m=/* @__PURE__ */ new WeakMap;async function h(e){let t=m.get(e.node);t===void 0&&(t=g(e),m.set(e.node,t));let n=await t;return{definition:n.definition,problems:n.problems.splice(0)}}async function g(e){let t=e.node.attributes.descriptionFile;if(typeof t!=`string`||t===``||e.entities===void 0)return{definition:null,problems:[]};let n=s(e,t);if(n===null)return _(e,`descriptionFile "${t}" must stay inside the content directory`);let r=c(n.contentPath),i=await e.entities.get(r);return i===null||i.type!==`api`?_(e,`no API description found at ${n.contentPath}`):i.metadata?.specType===`openapi`?{definition:{contentPath:n.contentPath,document:await e.entities.load(r),metadata:i.metadata??{},dataHash:i.status===`ready`?i.dataHash??null:null},problems:[]}:_(e,`${n.contentPath} is not an OpenAPI description`)}function _(e,n){return e.logger?.warn(`${e.node.tag} in ${e.sourceFilePath}: ${n}`),e.node.attributes.descriptionFileInvalid=!0,{definition:null,problems:[t(e.node,n,e.sourceFilePath)]}}const v=(e,t)=>e.node.attributes[t]??void 0;function y(t){let n=e(t.options)?t.options:{};return e(n.mockServer)?{...n,mockServer:{...n.mockServer,position:`off`}}:n}function b(t,n){let r=v(t,`language`),i=v(t,`options`);return{...n,...i,codeSamples:{...e(n.codeSamples)?n.codeSamples:{},...i?.codeSamples,...r&&{languages:[{lang:r}]}}}}async function x(e){let{definition:t,problems:n}=await h(e);if(t===null)return{problems:n};let{buildCodeSamples:r,getRequestBodySamples:i,normalizeOptions:a,resolveOperationSampleContext:s}=await import(`@redocly/api-docs/server`),c=a({specType:`openapi`,...b(e,y(t.metadata)),markdownParser:o}),l=s(t.document,c,{operationId:v(e,`operationId`),pointer:v(e,`pointer`)});if(!l)return null;let u={exampleKey:v(e,`exampleKey`),mimeType:v(e,`mimeType`),parameters:v(e,`parameters`),requestBody:v(e,`requestBody`),environments:v(e,`environments`),environment:v(e,`environment`)},d=r(l,u).map(e=>({lang:p[e.lang]??e.lang.toLowerCase(),title:e.label??e.lang,source:e.source})),f=c.codeSamples?.languages??[],m=f.findIndex(({lang:e})=>e===`Payload`);if(m!==-1){let e=i(l,{exampleKey:u.exampleKey,mimeType:u.mimeType,titlePrefix:f[m].label});d.splice(m,0,...e)}return d.length>0&&(e.node.attributes[e.attributeName]=d),null}async function S(e){let{definition:t,problems:n}=await h(e);if(t===null)return{problems:n};let{getResponseSamples:r,normalizeOptions:i,resolveOperationSampleContext:a}=await import(`@redocly/api-docs/server`),s=a(t.document,i({specType:`openapi`,...y(t.metadata),markdownParser:o}),{operationId:v(e,`operationId`),pointer:v(e,`pointer`)});if(!s)return null;let c=r(s,{exampleKey:v(e,`exampleKey`)});return c.length>0&&(e.node.attributes[e.attributeName]=c),null}const C=a({budget:4});function w(e,t,n){let r=async()=>{let{buildItems:r}=await import(`@redocly/api-docs/server`),a=u(t.document,i,{warn:t=>e.logger?.warn(t)}),{items:s,store:c}=await r({type:i,document:a,options:{...n,specType:i,markdownParser:o},basePath:`/`,markdownParser:o});return{items:s,store:c}};if(t.dataHash===null)return r();let a=JSON.stringify([t.contentPath,t.dataHash,n]),s=C.get(a);return s===void 0&&(s=r(),C.set(a,s)),s}function T(e){return e.startsWith(`#`)?e.slice(1):e}function E(e,t){let n=v(t,`pointer`),r=v(t,`operationId`);if(n!==void 0||r!==void 0)for(let i of e){let e=i.content?.meta;if(n!==void 0&&e?.pointer!==void 0&&T(e.pointer)===T(n)||r!==void 0&&e?.sourceId===r)return i;let a=E(i.items??[],t);if(a!==void 0)return a}}function D(e){return e[f]}function O(e,t,n){for(let r of e){if(r.nodeType!==`container`)continue;let e=D(r)??n;for(let n of r.panels??[]){let r=`children`in n?n.children.find(t):void 0;if(r!==void 0){let t=D(n)??e;return{entry:r,scope:t===void 0?{}:{[f]:t}}}}let i=O(r.children,t,e);if(i!==void 0)return i}}async function k(e,t){return F(e,t,await P(e,t))}async function A(e){let{definition:t,problems:n}=await h(e);if(t===null)return{problems:n};let r=y(t.metadata),{items:i,store:a}=await w(e,t,r),o=E(i,e),s=o?.content?O(o.content.children,e=>e.kind===`code-sample`,D(o)):void 0;if(s===void 0)return null;let c=s.entry,{appendUndeclaredConfigureParameters:l}=await import(`@redocly/api-docs/server`),u=v(e,`parameters`),d={apiStore:a,options:b(e,r),panel:{...c,source:l(c.source,{...u?.path&&{path:u.path},...u?.query&&{query:u.query},...u?.header&&{headers:u.header},...u?.cookie&&{cookie:u.cookie}}),...s.scope},...await k(e,t.contentPath)};return e.node.attributes[e.attributeName]=d,null}async function j(e){let{definition:t,problems:n}=await h(e);if(t===null)return{problems:n};let r=y(t.metadata),{items:i,store:a}=await w(e,t,r),o=E(i,e),s=o?.content?O(o.content.children,e=>e.kind===`response`&&!!e.responseCodes?.length,D(o)):void 0;if(s?.entry.responseCodes===void 0)return null;let c={apiStore:a,options:r,panel:{responseCodes:s.entry.responseCodes,...s.entry.schemaId!==void 0&&{schemaId:s.entry.schemaId},...s.scope},...await k(e,t.contentPath)};return e.node.attributes[e.attributeName]=c,null}async function M(e){let t=v(e,`pointer`);if(t===void 0)return null;let{definition:n,problems:r}=await h(e);if(n===null)return{problems:r};let i=y(n.metadata),{items:a,store:o}=await w(e,n,i),s=T(t).replace(/^\//,``),c=Object.fromEntries([s,s.replace(/\/value$/,``)].filter(e=>o.exampleStore[e]!==void 0).map(e=>[e,o.exampleStore[e]]));if(Object.keys(c).length===0)return null;let l=(await import(`@redocly/api-docs/server`)).findExampleEncoding(a,t),u={apiStore:{schemaStore:{},exampleStore:c,securitySchemeStore:{}},options:{...i,...v(e,`options`)},...l!==void 0&&{encoding:l},...await k(e,n.contentPath)};return e.node.attributes[e.attributeName]=u,null}function N(e,t,n,r,i){if(!e.requestBody||!t&&!n)return e;let a={...e.requestBody};if(t&&(a=a[t]?{[t]:a[t]}:{}),n)for(let[e,t]of Object.entries(a)){let o=t.exampleIds?.filter(e=>r[e]?.key!==void 0);if(!o?.length)continue;let s=i(o,n,e=>r[e]);a[e]={...t,exampleIds:s?[s]:[]}}return{...e,requestBody:a}}async function P(e,t){let n=d.relative(d.dirname(e.sourceFilePath),t),{result:r}=await e.markdown.resolveLocalReference(n,e.sourceFilePath);return r.kind===`pageUrl`?r.url:void 0}function F(e,t,i){let a=n(e.config);if(a===null)return{};let o=r(a,{filePath:t,slug:i??null});return{[f]:o??{}}}async function I(t){let{definition:n,problems:r}=await h(t);if(n===null)return{problems:r};let{findExampleIdByKey:a,JsonPointer:s,normalizeOptions:c,resolveOperationSampleContext:d}=await import(`@redocly/api-docs/server`),f=n.metadata,p=e(f.options)?f.options:{},m=await P(t,n.contentPath),g=l(p,t.config,m),_=v(t,`options`),y={...g,..._??{}},b=c({specType:`openapi`,...y,markdownParser:o}),x=u(n.document,i,{warn:e=>t.logger?.warn(e)}),S=d(x,b,{operationId:v(t,`operationId`),pointer:v(t,`pointer`)});if(!S)return null;let C=N(S.source,v(t,`mimeType`),v(t,`exampleKey`),S.storeCtx.exampleStore,a),w={apiStore:{schemaStore:S.storeCtx.schemaStore,exampleStore:S.storeCtx.exampleStore,securitySchemeStore:S.storeCtx.securitySchemeStore,specVersion:x.openapi},definition:x,operationId:S.operation.operationId??``,operationSource:C,options:y,pointer:s.compile([`paths`,S.pathName,S.method.toLowerCase()]),...F(t,n.contentPath,m)};return t.node.attributes[t.attributeName]=w,null}export{A as resolveOpenapiCodeSamplePanelAttribute,x as resolveOpenapiCodeSamplesAttribute,M as resolveOpenapiExampleAttribute,I as resolveOpenapiReplayAttribute,j as resolveOpenapiResponsePanelAttribute,S as resolveOpenapiResponseSamplesAttribute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{L10N_DIR as e}from"../../../../shared/constants/l10n/defaults.js";import{delocalizeL10nPath as t,l10nDirOf as n}from"../../../../shared/utils/l10n.js";import{markdocErrorResult as r,replaceWithMarkdocError as i}from"../../tags/markdoc-error.js";import{PARTIAL_L10N_ATTRIBUTE as a}from"../../tags/partial.js";import{shiftRange as o}from"../../../../shared/utils/shift-range.js";import{inlinedLinkRefs as s}from"../../../link-checker/node-ref.js";import{resolveResolverTarget as c}from"./context-paths.js";import{getPartialsFolders as l,isPartialPath as u}from"../../utils/partials.js";import{FRONTMATTER_BLOCK_RE as d,computeFrontmatterLineOffset as f}from"../../utils/frontmatter-offset.js";import{substituteStaticVariables as p}from"../../utils/substitute-variables.js";import{resolveMarkdocBuildTimeAttributes as m}from"../markdoc.js";import{join as h}from"node:path";async function g(o){let{node:s,attributeName:d}=o,f=s.attributes[d];if(typeof f!=`string`||f===``||o.io===void 0)return null;let p=c(o,f);if(p===null)return null;if(!u(p.contentPath,o.config)){let e=`Partial ${p.contentPath} must live in a partials folder (markdown.partialsFolders: ${l(o.config).join(`, `)})`;return r(s,e,o.sourceFilePath)}let m=n(o.sourceFilePath),g=[],v=m!==void 0&&n(p.contentPath)===void 0?`${e}/${m}/${p.contentPath}`:p.contentPath;if(!await o.io.exists(h(o.contentDir,v))){g.push({kind:`file`,path:v});let e=t(v);if(e!==void 0&&g.push({kind:`file`,path:e}),e===void 0||!await o.io.exists(h(o.contentDir,e))){let e=`Partial file ${p.contentPath} does not exist`;return r(s,e,o.sourceFilePath,g)}v=e}let y=o.partialChain??[o.sourceFilePath];if(y.includes(v))return i(s,`Circular partial inclusion: ${[...y,v].join(` -> `)}`),{entityDeps:[{kind:`file`,path:v}]};let b=await o.io.readFile(h(o.contentDir,v)),x=await _(o,v,b,y);s.children=x.ast.children;let S=[{entityDeps:g},x.result];if(m===void 0&&n(p.contentPath)===void 0){let t={};for(let n of o.markdown.contentLocales){let r=`${e}/${n}/${p.contentPath}`,
|
|
1
|
+
import{L10N_DIR as e}from"../../../../shared/constants/l10n/defaults.js";import{delocalizeL10nPath as t,l10nDirOf as n}from"../../../../shared/utils/l10n.js";import{markdocErrorResult as r,replaceWithMarkdocError as i}from"../../tags/markdoc-error.js";import{PARTIAL_L10N_ATTRIBUTE as a}from"../../tags/partial.js";import{shiftRange as o}from"../../../../shared/utils/shift-range.js";import{inlinedLinkRefs as s}from"../../../link-checker/node-ref.js";import{resolveResolverTarget as c}from"./context-paths.js";import{getPartialsFolders as l,isPartialPath as u}from"../../utils/partials.js";import{FRONTMATTER_BLOCK_RE as d,computeFrontmatterLineOffset as f}from"../../utils/frontmatter-offset.js";import{substituteStaticVariables as p}from"../../utils/substitute-variables.js";import{resolveMarkdocBuildTimeAttributes as m}from"../markdoc.js";import{join as h}from"node:path";async function g(o){let{node:s,attributeName:d}=o,f=s.attributes[d];if(typeof f!=`string`||f===``||o.io===void 0)return null;let p=c(o,f);if(p===null)return null;if(!u(p.contentPath,o.config)){let e=`Partial ${p.contentPath} must live in a partials folder (markdown.partialsFolders: ${l(o.config).join(`, `)})`;return r(s,e,o.sourceFilePath)}let m=n(o.sourceFilePath),g=[],v=m!==void 0&&n(p.contentPath)===void 0?`${e}/${m}/${p.contentPath}`:p.contentPath;if(!await o.io.exists(h(o.contentDir,v))){g.push({kind:`file`,path:v});let e=t(v);if(e!==void 0&&g.push({kind:`file`,path:e}),e===void 0||!await o.io.exists(h(o.contentDir,e))){let e=`Partial file ${p.contentPath} does not exist`;return r(s,e,o.sourceFilePath,g)}v=e}let y=o.partialChain??[o.sourceFilePath];if(y.includes(v))return i(s,`Circular partial inclusion: ${[...y,v].join(` -> `)}`),{entityDeps:[{kind:`file`,path:v}]};let b=await o.io.readFile(h(o.contentDir,v)),x=await _(o,v,b,y);s.children=x.ast.children;let S=[{entityDeps:g},x.result];if(m===void 0&&n(p.contentPath)===void 0){let t={},r=n(o.file.path);for(let n of o.markdown.contentLocales){let i=`${e}/${n}/${o.file.path}`;if(r===void 0&&S.push({entityDeps:[{kind:`file`,path:i}]}),r===void 0?o.markdown.hasPageRoute(i):n!==r)continue;let a=`${e}/${n}/${p.contentPath}`,s=h(o.contentDir,a);if(!await o.io.exists(s)){S.push({entityDeps:[{kind:`file`,path:a}]});continue}let c=await _(o,a,await o.io.readFile(s),y);t[n]=c.ast,S.push(c.result)}Object.keys(t).length>0&&(s.attributes[a]=t)}return{entityDeps:S.flatMap(e=>e.entityDeps??[]),assetUsages:S.flatMap(e=>e.assetUsages??[]),linkRefs:S.flatMap(e=>e.linkRefs??[]),problems:S.flatMap(e=>e.problems??[])}}async function _(e,t,n,r){let i=n.replace(d,``),a=structuredClone(e.markdown.parseCached(i)),o=await m(a,{tags:e.tags,sourceFilePath:t,resolverContext:{config:e.config,contentDir:e.contentDir,entities:e.entities,file:e.file,io:e.io,logger:e.logger,markdown:e.markdown,plugin:e.plugin},partialChain:[...r,t],source:i}),c=e.node.attributes.variables;typeof c==`object`&&c&&!Array.isArray(c)&&p(a,c);let l=f(n);return{ast:a,result:{entityDeps:[{kind:`file`,path:t},...o.entityDeps],assetUsages:o.assetUsages,linkRefs:s(o.linkRefs,t,l),problems:o.problems.map(e=>v(e,l))}}}function v(e,t){if(t===0||e.location?.range===void 0)return e;let n={...e.location,range:o(e.location.range,t)};return{...e,location:n}}export{g as resolvePartialFileAttribute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{markdocErrorResult as e,replaceWithMarkdocError as t}from"../tags/markdoc-error.js";import{
|
|
1
|
+
import{markdocErrorResult as e,replaceWithMarkdocError as t}from"../tags/markdoc-error.js";import{getAttributeBuildTimeResolver as n}from"./attribute-resolver-key.js";import{walkMarkdocAst as r}from"../utils/walk-markdoc-ast.js";import{getExampleContent as i,walkWithExampleContent as a}from"../utils/reparse-example-fences.js";import{isLocalReference as o}from"./references.js";import{resolveLinkAttribute as s}from"./markdoc-resolvers/link.js";import{resolveIconAttribute as c,resolveImageAttribute as l,resolveImageSrcSetAttribute as u}from"./markdoc-resolvers/image.js";import{resolveCodeSnippetFileAttribute as d}from"./markdoc-resolvers/code-snippet.js";import{resolveSvgContentAttribute as f}from"./markdoc-resolvers/svg-content.js";import{resolveTagRawContentAttribute as p}from"./markdoc-resolvers/tag-raw-content.js";import{resolveHtmlAttrsAttribute as m}from"./markdoc-resolvers/html-attrs.js";import{resolveImageGalleryAttribute as h}from"./markdoc-resolvers/image-gallery.js";import{resolveCodeWalkthroughFilesetsAttribute as g}from"./markdoc-resolvers/code-walkthrough/filesets.js";import{resolvePartialFileAttribute as _}from"./markdoc-resolvers/partial.js";import{resolveDiagramFileAttribute as v}from"./markdoc-resolvers/diagram-file.js";import{resolveParsedYamlAttribute as y,resolveRawContentAttribute as b,resolveRelativePathAttribute as x}from"./markdoc-resolvers/file-reference.js";import{resolveJsonExampleRefAttribute as S,resolveJsonSchemaRefAttribute as C,resolveSampleFromJsonSchemaAttribute as w}from"./markdoc-resolvers/json-schema.js";import{resolveOpenapiCodeSamplePanelAttribute as T,resolveOpenapiCodeSamplesAttribute as E,resolveOpenapiExampleAttribute as D,resolveOpenapiReplayAttribute as O,resolveOpenapiResponsePanelAttribute as k,resolveOpenapiResponseSamplesAttribute as A}from"./markdoc-resolvers/operation-samples.js";import{PROMPT_TAG as j}from"@redocly/theme/core/constants";import{convertGithubAlertToAdmonition as M}from"@redocly/theme/markdoc/tags/admonition";async function N(e,o){let s=o.tags??{},c=F,l={entityDeps:[],assetUsages:[],linkRefs:[],problems:[]},u=o.resolverContext?.markdown?.disabledTags,d=R(o.source),f=[...r(e,{skipChildren:z})],p=f.flatMap(e=>{let t=i(e);return t?[...a(t,z)]:[]});for(let e of[...f,...p])M(e);let m=p.filter(e=>e.type===`tag`);for(let e of[...f,...m])if(e.type===`link`)await L(c.nativeMdLink,e,`href`,o,l,d);else if(e.type===`image`)await L(c.imageSrc,e,`src`,o,l,d);else if(e.type===`tag`){if(typeof e.tag==`string`&&u?.has(e.tag)){t(e,`The "${e.tag}" tag is not available here.`);continue}let r=typeof e.tag==`string`?s[e.tag]:void 0;for(let[t,i]of Object.entries(r?.attributes??{})){let r=n(i);if(!r)continue;let a=c[r];a&&await L(a,e,t,o,l,d)}}return l}const P=({attributeName:e,markdown:t,node:n,partialChain:r,sourceFilePath:i})=>s(n,e,i,t,r?.[0]),F={imageSrc({attributeName:e,markdown:t,node:n,sourceFilePath:r}){return l(n,e,r,t)},imageSrcSet({attributeName:e,markdown:t,node:n,sourceFilePath:r}){return u(n,e,r,t)},link:P,nativeMdLink:P,async relativeOrCdnIcon(e){let{attributeName:t,markdown:n,node:r,sourceFilePath:i}=e,a=r.attributes[t];return typeof a==`string`&&B(a)&&await f(e,{optional:!0}),c(r,t,i,n)},codeSnippetFile:d,diagramFile:v,svgContent:f,tagRawContent:p,htmlAttrs:m,imageGallery:h,codeWalkthroughFilesets:g,partialFile:_,jsonSchemaRef:C,sampleFromJsonSchema:w,jsonExampleRef:S,openapiCodeSamples:E,openapiCodeSamplePanel:T,openapiReplay:O,openapiResponseSamples:A,openapiResponsePanel:k,openapiExample:D,rawContent:b,parsedYaml:y,relativePath:x};function I(e){let t=/* @__PURE__ */ new Set;for(let n of a(e))n.type===`tag`&&typeof n.tag==`string`&&t.add(n.tag);return[...t].sort()}async function L(t,n,r,i,a,o){let s;try{s=await t({...i.resolverContext,attributeName:r,node:n,sourceFilePath:i.sourceFilePath,tags:i.tags,partialChain:i.partialChain,readSourceLines:o})}catch(t){let r=t instanceof Error?t.message:String(t);s=e(n,r,i.sourceFilePath)}s&&(s.entityDeps&&a.entityDeps.push(...s.entityDeps),s.assetUsages&&a.assetUsages.push(...s.assetUsages),s.linkRefs&&a.linkRefs.push(...s.linkRefs),s.problems&&a.problems.push(...s.problems))}function R(e){let t;return()=>(t??=e.split(/\r?\n/),t)}function z(e){return e.type===`tag`&&e.tag===j}function B(e){let t=(e.split(`#`,1)[0]??e).split(`?`,1)[0]??e;return/\.svg$/i.test(t)&&o(e)}export{F as builtInMarkdocAttributeResolvers,I as collectMarkdocTagNames,z as isPromptTag,N as resolveMarkdocBuildTimeAttributes};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{L10N_DIR as e}from"../../../shared/constants/l10n/defaults.js";import{delocalizeL10nPath as t,l10nDirOf as n,toLocaleSlug as r}from"../../../shared/utils/l10n.js";import{buildContentAssetUrl as i}from"../../plugins/internal/assets/url.js";import{resolveContentPath as a}from"../../../shared/utils/resolve-content-path.js";import{computePathPrefixes as o}from"../../../shared/utils/routes/compute-path-prefixes.js";import{IMAGE_EXTENSIONS as s}from"../../plugins/internal/assets/extensions.js";import{isRouteSlugTarget as c}from"../../../shared/utils/routes/is-route-slug-target.js";import{safeDecodeURI as l}from"../../../shared/utils/safe-decode-uri.js";import{joinSrcSet as u,parseSrcSet as d}from"../../plugins/internal/assets/srcset.js";import{isIndexPagePath as f,resolveRelativeSlug as p}from"../../../shared/utils/routes/resolve-relative-slug.js";import{posix as m}from"node:path";const h=/[[\]()*_`#!|<>~]|\{%|^\s{0,3}([-+*]\s|\d+\.\s|>|-{3,}|={2,})/m;function g(e){return h.test(e)}function _(e){return e.startsWith(`#`)||e.startsWith(`//`)||/^[a-z][a-z0-9+.-]*:/i.test(e)?!1:!e.startsWith(`/`)||!c(y(e).path)}function v(e){let t=e.indexOf(`?`);return t===-1?[e,``]:[e.slice(0,t),e.slice(t)]}function y(e){let t=e.indexOf(`#`);return t===-1?{path:e,hash:``}:{path:e.slice(0,t),hash:e.slice(t)}}async function b(e,n){let r=await n(e);if(r)return r;let i=t(e);if(i!==void 0){let t=await n(i);if(t){let n=e.slice(0,e.length-i.length),r=t.entityDeps.filter(e=>e.kind===`file`).map(e=>({kind:`file`,path:`${n}${e.path}`}));return{...t,entityDeps:[...r,...t.entityDeps]}}}return{result:{kind:`passthrough`},entityDeps:[],assetUsages:[]}}async function x(e,r){let i=t(e),a=n(e);if(i===void 0||a===void 0)return null;let o=await r(i,a);return o===null?null:{...o,entityDeps:[{kind:`file`,path:e},...o.entityDeps]}}async function S(t,n,r,a,o){let[s]=t.assetUsages;if(!s||!a?.length||t.result.kind!==`assetRef`||n.startsWith(`@l10n/`))return t;let c=i(s.path,s.hash,s.tag),l=[];for(let t of a){let n=`${e}/${t}/${s.path}`,i=r.filesByPath.get(n);if(!i)continue;let a=await o?.(n)??null;l.push({path:n,hash:i.hash,kind:s.kind,tag:a,l10n:{locale:t,canonicalUrl:c}})}return l.length===0?t:{...t,assetUsages:[s,...l]}}function C(e,t){let n=e.routeBySlug.get(t);return n===void 0?o(t).reverse().map(t=>e.routeBySlug.get(t)).find(e=>e?.wildcardPrefix===!0):n}async function w(e,t,n,o,c,u){if(!_(e))return{result:{kind:`passthrough`},entityDeps:[],assetUsages:[]};let{path:d,hash:h}=y(e),g=async(e,t)=>{let a=n.primaryRouteByFilePath.get(e);if(a!==void 0)return{result:{kind:`pageUrl`,url:`${t===void 0?a:r(a,t)}${h}`},entityDeps:[{kind:`file`,path:e}],assetUsages:[]};let c=n.filesByPath.get(e);if(c){let t=m.extname(e).toLowerCase(),n=s.has(t)?`image`:`file`,r=await o?.(e)??null;return{result:{kind:`assetRef`,url:`${i(e,c.hash,r)}${h}`,path:e,hash:c.hash},entityDeps:[{kind:`file`,path:e}],assetUsages:[{path:e,hash:c.hash,kind:n,tag:r}]}}return null};return S(await b(t,async e=>{let t=a(l(d),e);if(t===null)return null;let r=await g(t)??await x(t,g);if(r!==null)return r;let[i=``,o=``]=v(d);if(!d.startsWith(`/`)&&m.extname(i)===``){let t=u??e,r=n.primaryRouteByFilePath.get(t),a=r===void 0?void 0:p(i,r,f(t)),s=a===void 0?void 0:C(n,a);if(a!==void 0&&s!==void 0)return{result:{kind:`pageUrl`,url:`${a}${o}${h}`},entityDeps:s.originFilePath===null?[]:[{kind:`file`,path:s.originFilePath}],assetUsages:[]}}return null}),t,n,c,o)}async function T(e,t,n,r,o){if(!_(e))return{result:{kind:`passthrough`},entityDeps:[],assetUsages:[]};let{path:s}=y(e),c=async e=>{let t=n.filesByPath.get(e);if(!t)return null;let a=await r?.(e)??null;return{result:{kind:`assetRef`,url:i(e,t.hash,a),path:e,hash:t.hash},entityDeps:[{kind:`file`,path:e}],assetUsages:[{path:e,hash:t.hash,kind:`image`,tag:a}]}};return S(await b(t,async e=>{let t=a(l(s),e);return t===null?null:await c(t)??await x(t,c)}),t,n,o,r)}async function E(e,t,n,r,i){let a=[],o=[],s=d(e);if(!s||s.length===0)return{value:e,entityDeps:a,assetUsages:o};let c=await Promise.all(s.map(async e=>{let s=await T(e.src,t,n,r,i);return s.result.kind===`assetRef`&&(a.push(...s.entityDeps),o.push(...s.assetUsages),e.src=s.result.url),e}));return{value:u(c),entityDeps:a,assetUsages:o}}export{_ as isLocalReference,g as looksLikeMarkdown,T as resolveImageReference,E as resolveImageSrcSet,w as resolveLocalReference,y as splitHash};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{getInnerText as e}from"../utils/get-inner-text.js";import{headingSlugger as t}from"../utils/heading-slugger.js";import{builtInMarkdocNodes as n,builtInMarkdocTags as r}from"../constants/builtin-tags.js";import{PROMPT_TAG as i}from"@redocly/theme/core/constants";import a from"@redocly/markdoc";const o=/* @__PURE__ */ new Set([`if`,`else`,i]),s=[`title`,`name`,`label`],c=((e,t)=>typeof t==`string`?t:e??``);function l(e,t={}){return f(e).map(e=>p({type:`document`,children:e},t)).filter(e=>e!==``)}function u(e,n={}){t.reset();let r=[],i=[];for(let t of f(e)){let e=p({type:`document`,children:t},n);e!==``&&(r.push(e),i.push(d(t[0],n.variables)))}return{chunks:r,headings:i}}function d(t,i){if(!v(t)||t.type!==`heading`)return null;let o=a.transform(a.Ast.fromJSON(JSON.stringify(t)),{nodes:n,tags:r,variables:i});if(!a.Tag.isTag(o))return null;let s=typeof o.attributes.id==`string`?o.attributes.id:``;return{heading:e(o.children),anchor:s}}function f(e){let t=v(e)&&Array.isArray(e.children)?e.children:[e],n=[],r=[];for(let e of t)(v(e)&&e.type===`heading`||n.length===0)&&(r=[],n.push(r)),r.push(e);return n}function p(e,t){let n=[];return g(e,n,{listDepth:0,ordered:!1,index:0,options:t}),n.join(``).replace(/(?<![ \t])[ \t]+\n/g,`
|
|
2
2
|
`).replace(/\n{3,}/g,`
|
|
3
3
|
|
|
4
4
|
`).trim()}function m(e,t={}){if(a.Ast.isVariable(e))return Object.hasOwn(t,String(e.path[0]))?new a.Ast.Variable(e.path).resolve({variables:t}):e;if(Array.isArray(e)){let n;for(let r=0;r<e.length;r++){let i=m(e[r],t);i!==e[r]&&((n??=e.slice())[r]=i)}return n??e}if(!v(e)||a.Ast.isAst(e))return e;let n;for(let[r,i]of Object.entries(e)){let a=m(i,t);a!==i&&((n??={...e})[r]=a)}return n??e}function h(e,t){let n=[];for(let r of e??[])g(r,n,t);return n.join(``).trim()}function g(e,t,n){if(!v(e)||e.type===`tag`&&e.tag!==void 0&&o.has(e.tag))return;let r=e.attributes??{},i=r.content;switch(e.type){case`text`:{let e=a.Ast.isVariable(i)?new a.Ast.Variable(i.path).resolve({variables:n.options.variables}):i;typeof e==`string`&&t.push(e);return}case`code`:typeof i==`string`&&t.push(`\`${i}\``);return;case`fence`:{let a=typeof r.language==`string`?r.language:``,o=[];for(let t of e.children??[])g(t,o,n);let s=e.children?.length?o.join(``):i,c=typeof s==`string`?s.replace(/\n$/,``):``;t.push(`\n\`\`\`${a}\n${c}\n\`\`\`\n\n`);return}case`softbreak`:t.push(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{HeadingSlugger as e}from"../utils/heading-slugger.js";import{hidesBodyFromSearch as t,markdocAstToText as n}from"./to-text.js";import{renderedHeadingText as r}from"../utils/heading-text.js";import{isNonControlVariant as i}from"@redocly/theme/markdoc/tags/variant";import{isForAgentsOnly as a}from"@redocly/theme/markdoc/tags/visibility";const o=/^(page|section-\d+)-team-\d+$/;function s(e){return o.exec(e)?.[1]??e}function c(t,i,a={}){let o=g(t)&&Array.isArray(t.children)?t.children:[],s=new e,c={title:i,body:[]},u=[],d=c,f=!1,p=[],_=e=>{let t=e.attributes?.id;return typeof t==`string`?t:s.slug(r(e,a))};for(let e of o){if(!g(e)||e.type!==`heading`){d.body.push(e);for(let t of h(e))_(t);continue}let t=r(e,a),n=_(e),o=m(e);if(o===1){!f&&t!==``&&(c.title=t,f=!0),d=c,p.length=0;continue}let s=t||i,l=p.slice(0,o).filter(e=>e!==void 0);p.length=o,p[o]=s;let v={anchor:n,title:s,ancestors:l,body:[]};u.push(v),d=v}let v=e=>n({type:`document`,children:e}),y=(e,t)=>[e,...l(t).map(({teams:t,children:n},r)=>({...e,docKey:`${e.docKey}-team-${r+1}`,text:v(n),rbacTeams:t})).filter(e=>e.text!==``)];return[...y({docKey:`page`,title:c.title,text:v(c.body)},c.body),...u.flatMap((e,t)=>y({docKey:`section-${t+1}`,anchor:e.anchor,title:e.title,text:v(e.body),path:[c.title,...e.ancestors,e.title]},e.body))]}function l(e){let n=[],r=(e,i)=>{if(g(e)&&!t(e)){if(e.type===`tag`&&e.tag===`if`){let t=u(e.attributes?.primary);if(t===void 0)return;let a=i===void 0?t:t.filter(e=>i.includes(e));if(a.length===0)return;let o=e.children??[],s=o.findIndex(e=>g(e)&&e.type===`tag`&&e.tag===`else`),c=s===-1?o:o.slice(0,s);n.push({teams:a,children:c});for(let e of c)r(e,a);return}for(let t of Object.values(e.slots??{}))r(t,i);for(let t of e.children??[])r(t,i)}};for(let t of e)r(t,void 0);return n}function u(e){if(!f(e))return;let t=Object.values(e.parameters??{});if(e.name===`includes`){let e=d(t);return e===void 0?void 0:[e]}if(e.name!==`or`)return;let n=t.map(e=>f(e)&&e.name===`includes`?d(Object.values(e.parameters??{})):void 0).filter(e=>e!==void 0);return n.length===0?void 0:n}function d([e,t]){let n=p(e,`Variable`)?e.path:void 0;return Array.isArray(n)&&n.length===2&&n[0]===`rbac`&&n[1]===`teams`&&typeof t==`string`&&t!==`*`?t:void 0}function f(e){return p(e,`Function`)}function p(e,t){return typeof e==`object`&&!!e&&e.$$mdtype===t}function m(e){let t=e.attributes?.level;return typeof t==`number`?t:2}function*h(e){if(!(!g(e)||a(e)||i(e))){for(let t of e.children??[])g(t)&&t.type===`heading`&&(yield t),yield*h(t);for(let t of Object.values(e.slots??{}))yield*h(t)}}function g(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}export{c as markdocAstToSearchSections,s as teamBlockSectionKey};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{isObject as e}from"../../../shared/utils/is-object.js";import"../../../shared/constants/content-assets.js";import{stampHeadingIndexes as t}from"../utils/collect-headings.js";import{builtInMarkdocFunctions as n,rbacTeamList as r}from"../constants/builtin-functions.js";import{headingSlugger as i}from"../utils/heading-slugger.js";import{resolveMarkdocTagSet as a}from"../constants/tag-sets.js";import{getPublicEnv as o}from"../../../shared/public-env.js";import{isPackedMarkdocAst as s,unpackMarkdocAst as c}from"../../../shared/utils/packed-ast.js";import{joinSrcSet as l,parseSrcSet as u}from"../../plugins/internal/assets/srcset.js";import{frontmatterVariable as d}from"../utils/frontmatter-variable.js";import f from"@redocly/markdoc";function p(e){let t=e.viewer,n=t?.isAuthenticated===!0;return{userAgent:n?e.userAgent:null,userIp:n?e.ip:null,remoteAddr:{ipAddress:n?e.ip:null},rbac:{teams:r(e.teams)},user:t?.isAuthenticated?{isAuthenticated:!0,name:t.name??null,email:t.email??null,teams:t.teams}:{isAuthenticated:!1,name:null,email:null,teams:[]}}}function m(e){let t=e=>{Array.isArray(e)?e.forEach(t):f.Tag.isTag(e)&&(e.children=e.children.map(e=>typeof e==`object`&&e&&!f.Tag.isTag(e)?JSON.stringify(e,null,2):(t(e),e)))};return t(e),e}function h(e){return!!e&&typeof e==`object`&&e.$$mdtype===`Node`}function g(e){return f.Ast.fromJSON(e)}function _(e){return e.includes(`"$$mdtype":"Node"`)||e.includes(`"$$mdpack":`)?{}:null}async function v(r,i,s,c){let{tags:l,nodes:u,functions:d}=await a(i.tagSet),f=x(r,{functions:d??n,tags:l,nodes:u,variables:{...p(s),env:o(),frontmatter:b(r),lang:c}});e(f)&&f.ast&&t(f.ast);let m=i.l10nAssets?.[c];return m?y(f,m):f}function y(e,t){let n=e=>{if(!e.includes(`/content-assets`))return e;let n=u(e);if(!n||n.length===0)return e;let r=!1,i=n.map(e=>{let n=e.src.search(/[?#]/),i=t[n===-1?e.src:e.src.slice(0,n)];return i===void 0?e:(r=!0,e.src=n===-1?i:`${i}${e.src.slice(n)}`,e)});return r?l(i):e},r=e=>{if(typeof e==`string`)return n(e);if(Array.isArray(e)){let t=!1,n=e.map(e=>{let n=r(e);return t||=n!==e,n});return t?n:e}if(e&&typeof e==`object`){let t=!1,n=Object.entries(e).map(([e,n])=>{let i=r(n);return t||=i!==n,[e,i]});return t?Object.fromEntries(n):e}return e},i=e=>{f.Tag.isTag(e)?(e.attributes=r(e.attributes),e.children.forEach(i)):Array.isArray(e)?e.forEach(i):e&&typeof e==`object`&&Object.values(e).forEach(i)};return i(e),e}function b(t){return e(t)?d(e(t.frontmatter)?t.frontmatter:{},t.title):{}}function x(e,t){i.reset();let n=e=>e instanceof f.Ast.Node,r=e=>{if(n(e))return m(f.transform(e,t));if(s(e)){let n=c(e);return m(f.transform(n,t))}if(h(e))return m(f.transform(f.Ast.fromJSON(JSON.stringify(e)),t));if(Array.isArray(e))return e.length>0&&e.every(n)?m(f.transform(e,t)):e.length>0&&e.every(h)?m(f.transform(f.Ast.fromJSON(JSON.stringify(e)),t)):e.map(r);if(e&&typeof e==`object`){let t={};for(let[n,i]of Object.entries(e))t[n]=r(i);return t}return e};return r(e)}export{p as buildMarkdownRuntimeVariables,_ as detectMarkdocPayloadFlag,h as isMarkdocAstNode,y as localizeMarkdocAssetUrls,g as parseMarkdocPayloadDeep,x as transformMarkdocDeep,v as transformMarkdocPayload};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{parseMarkdownCached as e}from"./utils/parse-cache.js";import{looksLikeMarkdown as t,resolveImageReference as n,resolveImageSrcSet as r,resolveLocalReference as i}from"./resolve/references.js";function a(a){return{disabledTags:a.disabledTags??/* @__PURE__ */ new Set,contentLocales:a.contentLocales??[],looksLikeMarkdown:t,parseCached:e,resolveLocalReference:(e,t,n)=>i(e,t,a.state,a.resolveAudienceTag,a.contentLocales,n),resolveImageReference:(e,t)=>n(e,t,a.state,a.resolveAudienceTag,a.contentLocales),resolveImageSrcSet:(e,t)=>r(e,t,a.state,a.resolveAudienceTag,a.contentLocales)}}export{a as createMarkdownService};
|
|
1
|
+
import{parseMarkdownCached as e}from"./utils/parse-cache.js";import{looksLikeMarkdown as t,resolveImageReference as n,resolveImageSrcSet as r,resolveLocalReference as i}from"./resolve/references.js";function a(a){return{disabledTags:a.disabledTags??/* @__PURE__ */ new Set,contentLocales:a.contentLocales??[],hasPageRoute:e=>a.state.primaryRouteByFilePath.has(e),looksLikeMarkdown:t,parseCached:e,resolveLocalReference:(e,t,n)=>i(e,t,a.state,a.resolveAudienceTag,a.contentLocales,n),resolveImageReference:(e,t)=>n(e,t,a.state,a.resolveAudienceTag,a.contentLocales),resolveImageSrcSet:(e,t)=>r(e,t,a.state,a.resolveAudienceTag,a.contentLocales)}}export{a as createMarkdownService};
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import { type Schema } from '@redocly/markdoc';
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* Render vehicle for raw HTML in markdown: the parser's `htmlTags()` turns HTML into this tag.
|
|
4
|
+
* An `<html>`, `<head>` or `<body>` element is a validation error and renders as its content.
|
|
5
|
+
*/
|
|
3
6
|
export declare const html: Schema;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"@redocly/markdoc";const t={a:`Link`,img:`Image`,script:`HtmlScript`},n={attributes:{name:{type:String,required:!0},attrs:{type:Object,buildTimeResolver:`htmlAttrs`}},
|
|
1
|
+
import e from"@redocly/markdoc";const t={a:`Link`,img:`Image`,script:`HtmlScript`},n=/* @__PURE__ */ new Set([`html`,`head`,`body`]),r={attributes:{name:{type:String,required:!0},attrs:{type:Object,buildTimeResolver:`htmlAttrs`}},validate(e){let t=String(e.attributes.name??``).toLowerCase();return n.has(t)?[{id:`html-document-element`,level:`error`,message:`HTML element <${t}> is not allowed in page content`}]:[]},transform(r,i){let a=String(r.attributes.name??``),o=r.attributes.attrs??{},s=r.transformChildren(i);return n.has(a.toLowerCase())?s:new e.Tag(t[a.toLowerCase()]??a,o,s)}};export{r as html};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{headingSlugger as e}from"../utils/heading-slugger.js";import t
|
|
1
|
+
import{headingSlugger as e}from"../utils/heading-slugger.js";import{variant as t}from"@redocly/theme/markdoc/tags/variant";import n from"@redocly/markdoc";import{CONTROL as r}from"@redocly/theme/core/constants/experiments";const i={...t.schema,transform(i,a){let o=()=>new n.Tag(t.schema.render,i.transformAttributes(a),i.transformChildren(a)),{name:s}=i.attributes;return typeof s==`string`&&s!==r?e.withScope(s,o):o()}};export{i as variant};
|
|
@@ -5,6 +5,8 @@ export type MarkdownService = {
|
|
|
5
5
|
disabledTags: ReadonlySet<string>;
|
|
6
6
|
/** Content locales whose `@l10n/<locale>/` twins a root source reports. */
|
|
7
7
|
contentLocales: readonly string[];
|
|
8
|
+
/** Whether the content file at `path` has a page route. */
|
|
9
|
+
hasPageRoute(path: string): boolean;
|
|
8
10
|
looksLikeMarkdown(value: string): boolean;
|
|
9
11
|
parseCached(rawSource: string): ParsedMarkdown;
|
|
10
12
|
/** `includingPagePath`: the page a partial source is inlined into. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{MARKDOC_ERROR_TAG as e}from"../tags/markdoc-error.js";import{hashBlobContent as t}from"../../materialization/data-ref.js";import{createLruCache as n}from"../../../shared/utils/lru-cache.js";import{reparseExampleFences as r}from"./reparse-example-fences.js";import i from"@redocly/markdoc";import{htmlTags as a}from"@redocly/markdoc/html";const o={html:a({errorTag:e}),allowIndentation:!0,allowComments:!0,slots:!0};function s(e){return i.parse(e,o)}function c(e){let t=s(e);return r(t,e,s),t}function l(e){let r=n(e);return e=>{let n=t(e),i=r.get(n);if(i!==void 0)return i;let a=c(e);return r.set(n,a),a}}function u(e,t){return i.parseFirstHeading(e,{...o,skip:t})}const d=l({budget:100});export{l as createCachedMarkdownParser,s as parseMarkdown,d as parseMarkdownCached,c as parseMarkdownDocument,u as parseMarkdownFirstHeading};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{hashJsonValue as e}from"../database/utils/json.js";import{entities as t,entityDeps as n,files as r,loaderConfigDeps as i}from"../database/schema.js";import{collectDataRefMarkers as a}from"./data-ref.js";import{replaceBlobRefsForEntityTx as o}from"../database/blobs.js";import{dedupeRouteQueryDependencies as s}from"../plugins/utils/route-index.js";import{MaterializationError as c,ProblemError as l}from"../problems/problem-error.js";import{replaceAssetRefsForEntityTx as u,upsertAssetsTx as d}from"../database/assets.js";import{createProblem as f}from"../problems/codes.js";import{problemRow as p,replaceEntityProblemsExceptCodesTx as m}from"../database/problems.js";import{replaceLinkRefsForEntityTx as h,upsertTargetInventoryTx as g}from"../database/link-refs.js";import{detectMarkdocPayloadFlag as _}from"../markdown/server/render.js";import{buildL10nAssetMap as v,dedupeAssetUsages as y,reconcileAsset as b,removeReplacedAssetFiles as x}from"./asset-reconcile.js";import{cutEntityRevisionTx as S}from"../revisions/cut.js";import{replaceRouteQueryDepsTx as C}from"../database/route-query-deps.js";import{replaceEntityRuntimeDeps as w}from"../database/origins.js";import{SEARCH_PROBLEM_CODES as T}from"../problems/producers.js";import{and as E,eq as D}from"drizzle-orm";const O=/* @__PURE__ */ new WeakMap;async function k(e){let t=await A(e.database,e.key);if(!t)throw Error(`Entity "${e.key}" is not registered.`);if(t.kind===`inline`){if(t.data===null)throw Error(`Inline entity "${e.key}" is missing its stored data.`);return t.data}if(t.status===`ready`&&t.data!==null)return t.data;let n=O.get(e.database);n===void 0&&(n=/* @__PURE__ */ new Map,O.set(e.database,n));let r=n.get(e.key);if(r!==void 0)return r;let i=j(e,t);n.set(e.key,i);try{return await i}finally{n.delete(e.key)}}async function A(e,n){let[r]=await e.db.select({id:t.id,key:t.key,kind:t.kind,pluginId:t.pluginId,loaderId:t.loaderId,loaderArgs:t.loaderArgs,type:t.type,metadata:t.metadata,status:t.status,data:t.data,markdoc:t.markdoc,dataHash:t.dataHash,version:t.version,revisionCreatedAt:t.revisionCreatedAt,isSystem:t.isSystem,invalidationSeq:t.invalidationSeq}).from(t).where(E(D(t.key,n),D(t.isCurrent,1))).limit(1);return r}async function j(i,l){if(!l.loaderId)throw Error(`Entity "${i.key}" is missing its loader id.`);let O=i.loaderRegistry.getEntityLoaderById(l.loaderId);if(!O)throw Error(`Entity loader "${l.loaderId}" is not registered.`);let[k]=await i.database.db.select({path:r.path,fileId:r.id}).from(n).leftJoin(r,D(n.originFileId,r.id)).where(D(n.entityId,l.id)).limit(1);if(!k&&!l.isSystem)throw Error(`Entity "${i.key}" has no origin dependency.`);let A=i.loaderContextFactory(O,l.loaderArgs,k?.path??``),j;try{j=await O.definition.handler(A)}catch(e){throw await M(i,l.id,e),new c(`Entity "${i.key}" failed to load.`,{cause:e})}let P=JSON.stringify(j.value??null),F=JSON.parse(P),I=j.markdoc??_(P),L=I?v(j.assetUsages??[]):void 0,R=L?{...I,l10nAssets:L}:I,z=a(F),B=Array.from(new Set(z.map(e=>e.blobKey))),V=y(j.assetUsages??[]),{contentDir:H}=i,U=H?(await Promise.all(V.map(e=>b(A.io,{contentDir:H,usage:e})))).filter(e=>e!==null):[],W=[];return await i.database.db.transaction(async n=>{let r=Date.now(),a=e(F),c=(l.dataHash??null)!==a,_=l.revisionCreatedAt;if(c&&(_=Math.max(r,l.revisionCreatedAt+1)),(await n.update(t).set({status:`ready`,data:F,markdoc:R,type:j.type??l.type,metadata:j.metadata??l.metadata,dataHash:a,revisionCreatedAt:_}).where(E(D(t.id,l.id),D(t.invalidationSeq,l.invalidationSeq))).returning({id:t.id})).length===0)return;c&&l.data!==null&&i.revisions?.
|
|
1
|
+
import{hashJsonValue as e}from"../database/utils/json.js";import{entities as t,entityDeps as n,files as r,loaderConfigDeps as i}from"../database/schema.js";import{collectDataRefMarkers as a}from"./data-ref.js";import{replaceBlobRefsForEntityTx as o}from"../database/blobs.js";import{dedupeRouteQueryDependencies as s}from"../plugins/utils/route-index.js";import{MaterializationError as c,ProblemError as l}from"../problems/problem-error.js";import{replaceAssetRefsForEntityTx as u,upsertAssetsTx as d}from"../database/assets.js";import{createProblem as f}from"../problems/codes.js";import{problemRow as p,replaceEntityProblemsExceptCodesTx as m}from"../database/problems.js";import{replaceLinkRefsForEntityTx as h,upsertTargetInventoryTx as g}from"../database/link-refs.js";import{detectMarkdocPayloadFlag as _}from"../markdown/server/render.js";import{buildL10nAssetMap as v,dedupeAssetUsages as y,reconcileAsset as b,removeReplacedAssetFiles as x}from"./asset-reconcile.js";import{cutEntityRevisionTx as S}from"../revisions/cut.js";import{replaceRouteQueryDepsTx as C}from"../database/route-query-deps.js";import{replaceEntityRuntimeDeps as w}from"../database/origins.js";import{SEARCH_PROBLEM_CODES as T}from"../problems/producers.js";import{and as E,eq as D}from"drizzle-orm";const O=/* @__PURE__ */ new WeakMap;async function k(e){let t=await A(e.database,e.key);if(!t)throw Error(`Entity "${e.key}" is not registered.`);if(t.kind===`inline`){if(t.data===null)throw Error(`Inline entity "${e.key}" is missing its stored data.`);return t.data}if(t.status===`ready`&&t.data!==null)return t.data;let n=O.get(e.database);n===void 0&&(n=/* @__PURE__ */ new Map,O.set(e.database,n));let r=n.get(e.key);if(r!==void 0)return r;let i=j(e,t);n.set(e.key,i);try{return await i}finally{n.delete(e.key)}}async function A(e,n){let[r]=await e.db.select({id:t.id,key:t.key,kind:t.kind,pluginId:t.pluginId,loaderId:t.loaderId,loaderArgs:t.loaderArgs,type:t.type,metadata:t.metadata,status:t.status,data:t.data,markdoc:t.markdoc,dataHash:t.dataHash,version:t.version,revisionCreatedAt:t.revisionCreatedAt,isSystem:t.isSystem,invalidationSeq:t.invalidationSeq}).from(t).where(E(D(t.key,n),D(t.isCurrent,1))).limit(1);return r}async function j(i,l){if(!l.loaderId)throw Error(`Entity "${i.key}" is missing its loader id.`);let O=i.loaderRegistry.getEntityLoaderById(l.loaderId);if(!O)throw Error(`Entity loader "${l.loaderId}" is not registered.`);let[k]=await i.database.db.select({path:r.path,fileId:r.id}).from(n).leftJoin(r,D(n.originFileId,r.id)).where(D(n.entityId,l.id)).limit(1);if(!k&&!l.isSystem)throw Error(`Entity "${i.key}" has no origin dependency.`);let A=i.loaderContextFactory(O,l.loaderArgs,k?.path??``),j;try{j=await O.definition.handler(A)}catch(e){throw await M(i,l.id,e),new c(`Entity "${i.key}" failed to load.`,{cause:e})}let P=JSON.stringify(j.value??null),F=JSON.parse(P),I=j.markdoc??_(P),L=I?v(j.assetUsages??[]):void 0,R=L?{...I,l10nAssets:L}:I,z=a(F),B=Array.from(new Set(z.map(e=>e.blobKey))),V=y(j.assetUsages??[]),{contentDir:H}=i,U=H?(await Promise.all(V.map(e=>b(A.io,{contentDir:H,usage:e})))).filter(e=>e!==null):[],W=[];return await i.database.db.transaction(async n=>{let r=Date.now(),a=e(F),c=(l.dataHash??null)!==a,_=l.revisionCreatedAt;if(c&&(_=Math.max(r,l.revisionCreatedAt+1)),(await n.update(t).set({status:`ready`,data:F,markdoc:R,type:j.type??l.type,metadata:j.metadata??l.metadata,dataHash:a,revisionCreatedAt:_}).where(E(D(t.id,l.id),D(t.invalidationSeq,l.invalidationSeq))).returning({id:t.id})).length===0)return;c&&l.data!==null&&i.revisions?.isTracked(k?.path??``)&&await S(n,{current:l,max:i.revisions.max});let v=A._trackedConfig;await N(n,l.id,v?.collectDependencies()??[]);let y=A._loadedEntityKeys,b=A._globPatterns;if((j.entityDeps!==void 0||y.length>0||b.length>0)&&await w(n,{entityId:l.id,originPluginId:O.pluginId,isSystem:!!l.isSystem,deps:[...j.entityDeps??[],...y.map(e=>({kind:`entity`,key:e})),...b.map(e=>({kind:`glob`,pattern:e}))]}),await C(n,{originPluginId:O.pluginId,hook:`loader`,entityId:l.id,dependencies:s(A._routeQueries)}),await m(n,l.id,T,(j.problems??[]).map(e=>p(f(e),{scope:`entity`,entityId:l.id}))),await o(n,{entityId:l.id,blobKeys:B}),W=await d(n,U),await u(n,{entityId:l.id,refs:V.map(({path:e,hash:t})=>({path:e,hash:t}))}),(j.linkRefs!==void 0||j.targetInventories!==void 0)&&k?.path&&(await h(n,{entityId:l.id,originFileId:k.fileId,originPluginId:O.pluginId,filePath:k.path,drafts:j.linkRefs??[]}),k.fileId!==null))for(let e of j.targetInventories??[])await g(n,{fileId:k.fileId,originPluginId:O.pluginId,draft:e})}),H&&W.length>0&&await x(A.io,{contentDir:H,filenames:W,logger:i.logger}),F}async function M(e,t,n){let r=n instanceof l?n.draft:{code:`plugin/loader-failed`,message:`Loader failed for entity "${e.key}": ${n instanceof Error?n.message:String(n)}`,data:{entityKey:e.key}};try{let n=p(f(r),{scope:`entity`,entityId:t});await e.database.db.transaction(async e=>{await m(e,t,T,[n])})}catch{}}async function N(e,t,n){await e.delete(i).where(D(i.entityId,t)),n.length!==0&&await e.insert(i).values(n.map(e=>({...e,entityId:t})))}export{k as materializeEntityByKey};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{loadContentLayerConfig as e}from"../config.js";import{refreshStateEntity as t}from"../database/entity-store.js";import{loadContentLayerState as n}from"../context-state.js";import{createBuildTimeEntityLoaderContextFactory as r}from"../loaders/context.js";import{resolveRevisionCapture as i}from"../revisions/config.js";import{materializeEntityByKey as a}from"./entity.js";function o(e){let{deps:n,database:i,revisions:o}=e,s=async e=>{let r=await a({database:i,key:e,loaderRegistry:n.pluginRegistry,loaderContextFactory:c,contentDir:n.contentDir,revisions:o,logger:n.logger});return await t(i,n.state,e),r},c=r(n,i,s);return{state:n.state,materialize:s}}async function s(t){let{context:r,database:a}=t;await e({context:r});let s=await n({context:r,database:a});return o({deps:{...r,state:s},database:a,revisions:i(r.config,t.captureRevisions)})}export{o as createEntityMaterializer,s as loadEntityMaterializer};
|
|
@@ -3,8 +3,9 @@ import type { RealmConfig } from '../shared/types/config.js';
|
|
|
3
3
|
import type { ProblemDraft } from './problems/types.js';
|
|
4
4
|
/**
|
|
5
5
|
* The config with the features that the plan in `PLAN_GATES` lacks turned off, as classic Realm
|
|
6
|
-
* does,
|
|
7
|
-
*
|
|
6
|
+
* does, the decisions under `planGates` for `isPlanFeatureGranted`, and the token's claims under
|
|
7
|
+
* `planClaims` for `isPlanClaimGranted`. A plan claim the token does not have denies its
|
|
8
|
+
* feature; a product gate claim it does not have is granted.
|
|
8
9
|
* Without a token the config is returned unchanged. Reports each configured feature it turns
|
|
9
10
|
* off to `warn`.
|
|
10
11
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isAdvancedSearchEnabled as e}from"../shared/search/facets.js";import{isObject as t}from"../shared/utils/is-object.js";import{isAiHidden as n}from"../shared/ask-ai/config-gate.js";const r=[[`products`,`products`],[`catalogClassic`,`catalog`],[`catalogClassic`,`catalogClassic`],[`l10n`,`l10n`],[`apiFunctions`,`apiFunctions`],[`redirects`,`redirects`],[`banner`,`banner`]];function i(i,a,u){if(!a.PLAN_GATES)return i;let d=o(a.PLAN_GATES);d||u(`PLAN_GATES is not a token, so the features of the plan are off.`);let f=e=>!!d?.[e],p=e=>d?.[e]!==!1,m=d!==void 0&&!(`cookieConsent`in d),h={rbac:f(`rbac`),sso:f(`sso`),analytics:f(`analytics`),advancedSearch:f(`advancedSearch`),aiSearch:f(`aiSearchLimit`),mcp:f(`mcp`),mcpGateway:f(`mcpGateway`),cookieConsent:m||f(`cookieConsent`),removeAttribution:!d?.pricingTier||f(`removeAttribution`),products:p(`products`),catalogClassic:p(`catalogClassic`),l10n:p(`l10n`),apiFunctions:p(`apiFunctions`),mockServer:p(`mockServer`),seo:p(`seo`),redirects:p(`redirects`),breadcrumbs:p(`breadcrumbs`),banner:p(`banner`),codeWalkthrough:p(`codeWalkthrough`),customPlugins:p(`customPlugins`),markdown:p(`markdown`),openapi:p(`openapi`),asyncapi:p(`asyncapi`),graphql:p(`graphql`),reactPages:p(`reactPages`),soap:p(`soap`),customPackages:p(`customPackages`),customMarkdocTags:p(`customMarkdocTags`),customMcpTools:p(`customMcpTools`)},g=e=>u(`\`${e}\` is not in this project's plan and is ignored.`),_={...i,planGates:h};h.customPackages||(_.allowedPackages=l(d?.allowedPackages));for(let e of[`rbac`,`sso`]){if(h[e]||!t(_.access)||_.access[e]===void 0)continue;g(`access.${e}`);let{[e]:n,...r}=_.access;_.access=r}!h.analytics&&_.analytics!==void 0&&(g(`analytics`),delete _.analytics),!f(`removeAttribution`)&&_.removeAttribution!==void 0&&(_.removeAttribution===!0&&g(`removeAttribution`),delete _.removeAttribution);for(let[e,t]of r)h[e]||_[t]===void 0||(c(_[t])&&g(t),delete _[t]);if(!h.advancedSearch){let t=s(_.search);t.filters!==void 0&&e(i)&&g(`search.filters`),_.search={...t,filters:{...s(t.filters),hide:!0}}}if(h.aiSearch||((_.aiAssistant!==void 0||s(_.search).ai!==void 0)&&!n(i)&&g(`aiAssistant`),_.aiAssistant={...s(_.aiAssistant),hide:!0}),!h.mcp){let e=s(_.mcp);_.mcp!==void 0&&e.hide!==!0&&g(`mcp`),_.mcp={...e,hide:!0}}if(!h.mockServer){let e=s(_.mockServer);_.mockServer!==void 0&&e.off!==!0&&g(`mockServer`),_.mockServer={...e,off:!0}}if(!h.breadcrumbs){let e=s(_.breadcrumbs);_.breadcrumbs!==void 0&&e.hide!==!0&&g(`breadcrumbs`),_.breadcrumbs={...e,hide:!0}}return h.seo||(_.seo!==void 0&&g(`seo`),_.seo={llmstxt:{hide:!0}}),_.consent!==void 0&&m?u("The PLAN_GATES token has no cookieConsent claim, so `consent` stays on."):_.consent!==void 0&&!h.cookieConsent&&(u("`consent` is not in this project's plan and is ignored: analytics loads without consent."),delete _.consent),_}function a(e){return{code:`configuration/ignored`,message:`${e} are not in this project's plan, so this file is ignored.`}}function o(e){try{let n=(e.split(`.`)[1]??``).replace(/-/g,`+`).replace(/_/g,`/`),r=JSON.parse(atob(n));return t(r)?r:void 0}catch{return}}function s(e){return t(e)?e:{}}function c(e){return Array.isArray(e)?e.length>0:t(e)?Object.keys(e).length>0:e!==void 0}function l(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)?e:[]}export{i as applyPlanGates,a as notInPlanProblem};
|
|
1
|
+
import{isAdvancedSearchEnabled as e}from"../shared/search/facets.js";import{isObject as t}from"../shared/utils/is-object.js";import{isAiHidden as n}from"../shared/ask-ai/config-gate.js";const r=[[`products`,`products`],[`catalogClassic`,`catalog`],[`catalogClassic`,`catalogClassic`],[`l10n`,`l10n`],[`apiFunctions`,`apiFunctions`],[`redirects`,`redirects`],[`banner`,`banner`],[`devOnboarding`,`developerOnboarding`]];function i(i,a,u){if(!a.PLAN_GATES)return i;let d=o(a.PLAN_GATES);d||u(`PLAN_GATES is not a token, so the features of the plan are off.`);let f=e=>!!d?.[e],p=e=>d?.[e]!==!1,m=d!==void 0&&!(`cookieConsent`in d),h={rbac:f(`rbac`),sso:f(`sso`),analytics:f(`analytics`),advancedSearch:f(`advancedSearch`),aiSearch:f(`aiSearchLimit`),mcp:f(`mcp`),mcpGateway:f(`mcpGateway`),cookieConsent:m||f(`cookieConsent`),removeAttribution:!d?.pricingTier||f(`removeAttribution`),products:p(`products`),catalogClassic:p(`catalogClassic`),l10n:p(`l10n`),apiFunctions:p(`apiFunctions`),mockServer:p(`mockServer`),seo:p(`seo`),redirects:p(`redirects`),breadcrumbs:p(`breadcrumbs`),banner:p(`banner`),codeWalkthrough:p(`codeWalkthrough`),customPlugins:p(`customPlugins`),markdown:p(`markdown`),openapi:p(`openapi`),asyncapi:p(`asyncapi`),graphql:p(`graphql`),reactPages:p(`reactPages`),soap:p(`soap`),devOnboarding:p(`devOnboarding`),customPackages:p(`customPackages`),customMarkdocTags:p(`customMarkdocTags`),customMcpTools:p(`customMcpTools`)},g=e=>u(`\`${e}\` is not in this project's plan and is ignored.`),_={...i,planGates:h,planClaims:d??{}};h.customPackages||(_.allowedPackages=l(d?.allowedPackages));for(let e of[`rbac`,`sso`]){if(h[e]||!t(_.access)||_.access[e]===void 0)continue;g(`access.${e}`);let{[e]:n,...r}=_.access;_.access=r}!h.analytics&&_.analytics!==void 0&&(g(`analytics`),delete _.analytics),!f(`removeAttribution`)&&_.removeAttribution!==void 0&&(_.removeAttribution===!0&&g(`removeAttribution`),delete _.removeAttribution);for(let[e,t]of r)h[e]||_[t]===void 0||(c(_[t])&&g(t),delete _[t]);if(!h.advancedSearch){let t=s(_.search);t.filters!==void 0&&e(i)&&g(`search.filters`),_.search={...t,filters:{...s(t.filters),hide:!0}}}if(h.aiSearch||((_.aiAssistant!==void 0||s(_.search).ai!==void 0)&&!n(i)&&g(`aiAssistant`),_.aiAssistant={...s(_.aiAssistant),hide:!0}),!h.mcp){let e=s(_.mcp);_.mcp!==void 0&&e.hide!==!0&&g(`mcp`),_.mcp={...e,hide:!0}}if(!h.mockServer){let e=s(_.mockServer);_.mockServer!==void 0&&e.off!==!0&&g(`mockServer`),_.mockServer={...e,off:!0}}if(!h.breadcrumbs){let e=s(_.breadcrumbs);_.breadcrumbs!==void 0&&e.hide!==!0&&g(`breadcrumbs`),_.breadcrumbs={...e,hide:!0}}return h.seo||(_.seo!==void 0&&g(`seo`),_.seo={llmstxt:{hide:!0}}),_.consent!==void 0&&m?u("The PLAN_GATES token has no cookieConsent claim, so `consent` stays on."):_.consent!==void 0&&!h.cookieConsent&&(u("`consent` is not in this project's plan and is ignored: analytics loads without consent."),delete _.consent),_}function a(e){return{code:`configuration/ignored`,message:`${e} are not in this project's plan, so this file is ignored.`}}function o(e){try{let n=(e.split(`.`)[1]??``).replace(/-/g,`+`).replace(/_/g,`/`),r=JSON.parse(atob(n));return t(r)?r:void 0}catch{return}}function s(e){return t(e)?e:{}}function c(e){return Array.isArray(e)?e.length>0:t(e)?Object.keys(e).length>0:e!==void 0}function l(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)?e:[]}export{i as applyPlanGates,a as notInPlanProblem};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineContentPlugin as e}from"./define.js";import{ENTITY_LOADER_REFERENCE_KIND as t,INLINE_ENTITY_REFERENCE_KIND as n,createEntityLoader as r,createInlineEntity as i,createInlineEntityReference as a,isEntityLoaderReference as o,isInlineEntityReference as s,isRawEntityReference as c}from"../loaders/define.js";import{resolveRuntimeFilePath as l,runtimeFile as u}from"./utils/runtime-file.js";import{SERVER_FN_REFERENCE_KIND as d,STORED_ENTITY_REFERENCE_KIND as f,createServerFn as p,createStoredEntityReference as m,getRegisteredServerFnLoader as h,isServerFnReference as g,normalizeServerFnId as _,resolveServerModuleReference as v}from"./server-fn.js";import{createPluginScopedId as y}from"./utils/scoped-id.js";import{runtimeTemplate as b}from"./templates.js";import{createContentPluginIO as
|
|
1
|
+
import{defineContentPlugin as e}from"./define.js";import{ENTITY_LOADER_REFERENCE_KIND as t,INLINE_ENTITY_REFERENCE_KIND as n,createEntityLoader as r,createInlineEntity as i,createInlineEntityReference as a,isEntityLoaderReference as o,isInlineEntityReference as s,isRawEntityReference as c}from"../loaders/define.js";import{resolveRuntimeFilePath as l,runtimeFile as u}from"./utils/runtime-file.js";import{SERVER_FN_REFERENCE_KIND as d,STORED_ENTITY_REFERENCE_KIND as f,createServerFn as p,createStoredEntityReference as m,getRegisteredServerFnLoader as h,isServerFnReference as g,normalizeServerFnId as _,resolveServerModuleReference as v}from"./server-fn.js";import{createPluginScopedId as y}from"./utils/scoped-id.js";import{runtimeTemplate as b}from"./templates.js";import{APP_DATA_STATIC_DATA_SLUG as x}from"../../shared/constants/app-data.js";import{SIDEBAR_ROUTE_DEP_KEY as S}from"../../shared/constants/route-deps.js";import"./internal/api-functions/constants.js";import{createContentPluginIO as C,createPluginIO as w,createRecordingPluginIO as T}from"./io.js";import{STATIC_FOLDER_PLUGIN_ID as E,STATIC_FOLDER_PREFIX as D,isStaticFolderPath as O,staticFolderContentPlugin as k}from"./internal/static-folder/index.js";import{MCP_TOOL_NAME_PATTERN as A,createContentPluginRegistry as j,matchesContentPluginFilter as M,resolveContentPluginsForFile as N}from"./registry.js";import{dedupeFileDependencies as P,extractFileContributions as F,runContentPluginFinalize as I}from"./execute.js";import{createSourceFile as L}from"./source-file.js";import{createRouteIndex as R,createRouteQueryEvaluator as z,dedupeRouteQueryDependencies as B,isRouteQueryStale as V}from"./utils/route-index.js";import{SPEC_KIND_ARAZZO as H,SPEC_KIND_ASYNCAPI as U,SPEC_KIND_GRAPHQL as W,SPEC_KIND_OPENAPI as G}from"../../shared/constants/api-spec-kinds.js";import{MOCK_SERVER_ROUTE_PREFIX as K,mockPathPrefix as q}from"./types/api-entity.js";import{createContentOriginKey as J}from"./utils/origin-key.js";import{ASSETS_PLUGIN_ID as Y,ASSET_ENTITY_KEY_PREFIX as X,assetsContentPlugin as Z}from"./internal/assets/index.js";import{FOLDER_SIDEBAR_FILENAME_REGEX as Q,SIDEBAR_AGGREGATOR_LOADER_ID as $,SIDEBAR_FILENAME_REGEX as ee,SIDEBAR_PLUGIN_ID as te,isTabbedSidebar as ne,resolveAutoSidebar as re,sidebarContentPlugin as ie}from"./internal/sidebar/index.js";import{APP_DATA_PLUGIN_ID as ae,APP_DATA_PLUGIN_VERSION as oe,APP_DATA_STATIC_DATA_LOADER_ID as se,appDataContentPlugin as ce,appDataSystemEntityDescriptor as le,buildConfigAppData as ue,isAppDataFragment as de}from"./internal/app-data/index.js";import{BUILT_IN_CLASSIC_PLUGINS as fe,DEFAULT_PROJECT_PLUGIN_FILES as pe,INTERNAL_PLUGIN_ID_PREFIX as me,PLAN_GATED_PLUGINS as he}from"./project/constants.js";import{getLoadedProjectPlugins as ge,setLoadedProjectPlugins as _e,warnWhenProjectPluginsAreNotLoaded as ve}from"./project/loaded-set.js";import{apiDocsContentPlugin as ye}from"./internal/api-docs/index.js";import{API_FUNCTIONS_PLUGIN_ID as be,apiFunctionsContentPlugin as xe}from"./internal/api-functions/index.js";import{CATALOG_CLASSIC_LOADER_ID as Se,CATALOG_CLASSIC_PLUGIN_ID as Ce,CATALOG_CLASSIC_SERVER_FN_ID as we,CATALOG_CLASSIC_SIDEBARS_LOADER_ID as Te,CATALOG_CLASSIC_TEMPLATE_ID as Ee,catalogClassicContentPlugin as De}from"./internal/catalog-classic/index.js";import{L10N_PLUGIN_ID as Oe}from"./internal/l10n/translations-loader.js";import{L10N_PLUGIN_VERSION as ke,l10nContentPlugin as Ae}from"./internal/l10n/index.js";import{MARKDOC_DOCUMENT_LOADER_ID as je,MARKDOC_SEARCH_GROUP as Me,MARKDOC_SIDEBAR_ITEM_LOADER_ID as Ne,MARKDOC_TEMPLATE_ID as Pe,markdocContentPlugin as Fe}from"./internal/markdoc/index.js";import{mcpContentPlugin as Ie}from"./internal/mcp/index.js";import{MOCK_SERVER_PLUGIN_ID as Le,MOCK_SERVER_ROUTE_PATH as Re,mockServerContentPlugin as ze}from"./internal/mock/index.js";import{REACT_PAGE_SEARCH_LOADER_KEY as Be,reactPageContentPlugin as Ve}from"./internal/react-page/index.js";import{REVISIONS_PLUGIN_ID as He,revisionsContentPlugin as Ue}from"./internal/revisions/index.js";import{SCORECARD_CLASSIC_PLUGIN_ID as We,SCORECARD_CLASSIC_TEMPLATE_ID as Ge,scorecardClassicContentPlugin as Ke}from"./internal/scorecard-classic/index.js";import{SKILLS_PLUGIN_ID as qe,SKILL_MARKDOWN_ROUTE_PATH as Je,skillsContentPlugin as Ye}from"./internal/skills/index.js";import{VERSIONS_PLUGIN_ID as Xe,versionsContentPlugin as Ze}from"./internal/versions/index.js";import{createInternalContentPlugins as Qe}from"./internal/index.js";import{createContentPlugins as $e}from"./create-content-plugins.js";import{createProjectPluginLoadError as et,formatProjectPluginDiagnostics as tt,loadAndRegisterProjectPlugins as nt,loadProjectPlugins as rt,readPluginEntries as it,resolveProjectPluginPath as at}from"./project/load.js";import{reloadProjectPluginsIfChanged as ot}from"./project/reload.js";export{be as API_FUNCTIONS_PLUGIN_ID,ae as APP_DATA_PLUGIN_ID,oe as APP_DATA_PLUGIN_VERSION,se as APP_DATA_STATIC_DATA_LOADER_ID,x as APP_DATA_STATIC_DATA_SLUG,Y as ASSETS_PLUGIN_ID,X as ASSET_ENTITY_KEY_PREFIX,fe as BUILT_IN_CLASSIC_PLUGINS,Se as CATALOG_CLASSIC_LOADER_ID,Ce as CATALOG_CLASSIC_PLUGIN_ID,we as CATALOG_CLASSIC_SERVER_FN_ID,Te as CATALOG_CLASSIC_SIDEBARS_LOADER_ID,Ee as CATALOG_CLASSIC_TEMPLATE_ID,pe as DEFAULT_PROJECT_PLUGIN_FILES,t as ENTITY_LOADER_REFERENCE_KIND,Q as FOLDER_SIDEBAR_FILENAME_REGEX,n as INLINE_ENTITY_REFERENCE_KIND,me as INTERNAL_PLUGIN_ID_PREFIX,Oe as L10N_PLUGIN_ID,ke as L10N_PLUGIN_VERSION,je as MARKDOC_DOCUMENT_LOADER_ID,Me as MARKDOC_SEARCH_GROUP,Ne as MARKDOC_SIDEBAR_ITEM_LOADER_ID,Pe as MARKDOC_TEMPLATE_ID,A as MCP_TOOL_NAME_PATTERN,Le as MOCK_SERVER_PLUGIN_ID,Re as MOCK_SERVER_ROUTE_PATH,K as MOCK_SERVER_ROUTE_PREFIX,he as PLAN_GATED_PLUGINS,Be as REACT_PAGE_SEARCH_LOADER_KEY,He as REVISIONS_PLUGIN_ID,We as SCORECARD_CLASSIC_PLUGIN_ID,Ge as SCORECARD_CLASSIC_TEMPLATE_ID,d as SERVER_FN_REFERENCE_KIND,$ as SIDEBAR_AGGREGATOR_LOADER_ID,ee as SIDEBAR_FILENAME_REGEX,te as SIDEBAR_PLUGIN_ID,S as SIDEBAR_ROUTE_DEP_KEY,qe as SKILLS_PLUGIN_ID,Je as SKILL_MARKDOWN_ROUTE_PATH,H as SPEC_KIND_ARAZZO,U as SPEC_KIND_ASYNCAPI,W as SPEC_KIND_GRAPHQL,G as SPEC_KIND_OPENAPI,E as STATIC_FOLDER_PLUGIN_ID,D as STATIC_FOLDER_PREFIX,f as STORED_ENTITY_REFERENCE_KIND,Xe as VERSIONS_PLUGIN_ID,ye as apiDocsContentPlugin,xe as apiFunctionsContentPlugin,ce as appDataContentPlugin,le as appDataSystemEntityDescriptor,Z as assetsContentPlugin,ue as buildConfigAppData,De as catalogClassicContentPlugin,J as createContentOriginKey,C as createContentPluginIO,j as createContentPluginRegistry,$e as createContentPlugins,r as createEntityLoader,i as createInlineEntity,a as createInlineEntityReference,Qe as createInternalContentPlugins,w as createPluginIO,y as createPluginScopedId,et as createProjectPluginLoadError,T as createRecordingPluginIO,R as createRouteIndex,z as createRouteQueryEvaluator,p as createServerFn,L as createSourceFile,m as createStoredEntityReference,P as dedupeFileDependencies,B as dedupeRouteQueryDependencies,e as defineContentPlugin,F as extractFileContributions,tt as formatProjectPluginDiagnostics,ge as getLoadedProjectPlugins,h as getRegisteredServerFnLoader,de as isAppDataFragment,o as isEntityLoaderReference,s as isInlineEntityReference,c as isRawEntityReference,V as isRouteQueryStale,g as isServerFnReference,O as isStaticFolderPath,ne as isTabbedSidebar,Ae as l10nContentPlugin,nt as loadAndRegisterProjectPlugins,rt as loadProjectPlugins,Fe as markdocContentPlugin,M as matchesContentPluginFilter,Ie as mcpContentPlugin,q as mockPathPrefix,ze as mockServerContentPlugin,_ as normalizeServerFnId,Ve as reactPageContentPlugin,it as readPluginEntries,ot as reloadProjectPluginsIfChanged,re as resolveAutoSidebar,N as resolveContentPluginsForFile,at as resolveProjectPluginPath,l as resolveRuntimeFilePath,v as resolveServerModuleReference,Ue as revisionsContentPlugin,I as runContentPluginFinalize,u as runtimeFile,b as runtimeTemplate,Ke as scorecardClassicContentPlugin,_e as setLoadedProjectPlugins,ie as sidebarContentPlugin,Ye as skillsContentPlugin,k as staticFolderContentPlugin,Ze as versionsContentPlugin,ve as warnWhenProjectPluginsAreNotLoaded};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{withPathPrefix as e}from"../../../../../shared/path-prefix.js";import{ApiDocsLayoutContext as t,PageContext as n}from"../../../../../client/contexts.js";import{expandSecurityRequestValues as r,useDynamicRequestValues as i}from"../../../../../client/ApiAccess.js";import{MarkdocRenderer as a,markdocComponents as o}from"../../../../markdown/client/markdoc-components.js";import{API_DOCS_INFO_BLOCK_DEP_KEY as s,API_DOCS_RENDER_DEP_KEY as c,apiPageTitle as l}from"../server/shared.js";import{rebaseItemLinks as u}from"./rebase-item-links.js";import{apiDocsTelemetryConfig as d}from"../../../../../client/telemetry/config.js";import{withReplayOptions as f}from"../../../../../client/replay-options.js";import{REPLAY_OAUTH2_ROUTE_PATH as p}from"../../../../../shared/constants/replay.js";import{JsonSchemaTag as m}from"../../../../markdown/client/JsonSchemaTag.js";import{JsonExample as h}from"../../../../markdown/client/OpenapiTagComponents.js";import{withEventHandlers as g}from"./event-handlers.js";import{useContext as _,useEffect as v,useMemo as y}from"react";import b from"styled-components";import{useLocation as x}from"react-router";import{Fragment as S,jsx as C,jsxs as w}from"react/jsx-runtime";import{useThemeConfig as T}from"@redocly/theme/core/hooks";import{LayoutVariant as E}from"@redocly/theme/components/SidebarActions/SidebarActions";import{useLoaderData as D}from"virtual:realm-runtime";import{userMarkdocComponents as O}from"virtual:realm-markdoc-components";import{RedoclyApiDocs as k,apiDocsMarkdocComponents as A}from"@redocly/api-docs";import{Breadcrumbs as j}from"@redocly/theme/components/Breadcrumbs/Breadcrumbs";import{CatalogClassicInfoBlock as M}from"@redocly/theme/components/CatalogClassic/CatalogClassicInfoBlock";import{MissingTranslationNotice as N}from"@redocly/theme/components/MissingTranslationNotice/MissingTranslationNotice";import{ThreePanelLayout as P}from"@redocly/theme/layouts/ThreePanelLayout";const F={...o,JsonSchema:O.JsonSchema??m,JsonExample:O.JsonExample??h,...A},I={parse:e=>e,render:e=>/* @__PURE__ */ C(a,{ast:e,components:F})},L={MiddlePanelHeader:R};function R(){return/* @__PURE__ */ w(S,{children:[/* @__PURE__ */ C(j,{}),/* @__PURE__ */ C(U,{})]})}function z(e){return(e.length>1&&e.endsWith(`/`)?e.slice(0,-1):e).toLowerCase()}function B({page:e}){let n=D(c),a=D(s),{layout:o}=_(t),l=V(),p=i(),m=y(()=>{if(!n)return n;let e=r(p,Object.values(n.store.securitySchemeStore??{}));return{...g(f(n.options)),oAuth2RedirectURI:H(),userClaims:l,unstable_hooks:L,dynamicRequestValues:e}},[n,l,p]),h=e.slug.toLowerCase(),v=y(()=>n&&n.basePath!==h?u(n.items,n.basePath,h):n?.items,[n,h]);if(G(e.metadata,v,n?.title),!n)return null;let b=d();return/* @__PURE__ */ w(S,{children:[a&&/* @__PURE__ */ C(W,{layout:o,children:/* @__PURE__ */ C(M,{metadata:a})}),/* @__PURE__ */ C(k,{items:v,store:n.store,options:m,basePath:h,layout:o,markdownAdapter:I,telemetryConfig:b})]})}function V(){let e=_(n)?.auth?.userInfo,t=e?.isAuthenticated?e.email:void 0,r=e?.isAuthenticated?e.name:void 0;return y(()=>({email:t,name:r}),[t,r])}function H(){if(typeof window<`u`)return new URL(e(p),window.location.origin).toString()}const U=b(N)`
|
|
2
2
|
width: 100%;
|
|
3
|
-
`,
|
|
3
|
+
`,W=b(P)`
|
|
4
4
|
&& {
|
|
5
|
-
padding-right: ${({layout:e})=>e===
|
|
5
|
+
padding-right: ${({layout:e})=>e===E.THREE_PANEL?`calc(var(--panel-gap-horizontal) * 2)`:`var(--panel-gap-horizontal)`};
|
|
6
6
|
}
|
|
7
|
-
`;function
|
|
7
|
+
`;function G(e,t,n){let{pathname:r}=x(),{seo:i}=T(),a=i?.projectTitle,o=t?l(e,t,z(r),n):void 0;v(()=>{o&&(document.title=a?`${o} | ${a}`:o)},[o,a])}export{B as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineContentPlugin as e}from"../../define.js";import{createEntityLoader as t}from"../../../loaders/define.js";import{runtimeFile as n}from"../../utils/runtime-file.js";import{runtimeTemplate as r}from"../../templates.js";import{SEARCH_API_TITLE_FACET_FIELD as i,SEARCH_API_VERSION_FACET_FIELD as a,SEARCH_GROUP_FACET_FIELD as o}from"../../../../shared/search/facets.js";import{configuredFacetFields as s,extractFacetsFromFrontmatter as c,invalidFacetValueProblems as l,searchCategoryOf as u}from"../../../search/facet-values.js";import{toPosixPath as d}from"../../../../shared/utils/to-posix-path.js";import{TRANSLATIONS_FILE_PATTERN as f}from"../../../../shared/constants/l10n/defaults.js";import{isObject as p}from"../../../../shared/utils/is-object.js";import{notInPlanProblem as m}from"../../../plan-gates.js";import{filePathToRouteSlug as h}from"../../../../shared/utils/routes/file-path-to-route-slug.js";import{SPEC_KIND_ARAZZO as g,SPEC_KIND_ASYNCAPI as _,SPEC_KIND_GRAPHQL as v,SPEC_KIND_OPENAPI as y}from"../../types/api-entity.js";import{isPlanFeatureGranted as b}from"../../../../shared/plan-gates.js";import{packMarkdocAstsDeep as x,unpackMarkdocAstsDeep as S}from"../../../markdown/utils/packed-ast.js";import{parseMarkdownCached as C}from"../../../markdown/utils/parse-cache.js";import{createApiEntityKey as w}from"../../utils/api-entity-key.js";import{API_DOCS_API_LOADER_ID as T,API_DOCS_PLUGIN_ID as ee,API_DOCS_RENDER_DEP_KEY as E,API_DOCS_RENDER_LOADER_ID as D,API_DOCS_SIDEBAR_LOADER_ID as te,API_DOCS_TEMPLATE_ID as O,SPEC_DOWNLOAD_ROUTE_PATHS as k,SPEC_PATH_PARAM as ne}from"./server/shared.js";import{resolveApiBundleConfig as re,resolveApiOptions as ie,resolveNestedFeedback as ae,schemaCatalogLink as oe,withDownloadUrls as se,withFeedbackOption as ce,withMockServerOption as le}from"./server/options.js";import{annotateApiDocsRbac as ue}from"../../../../server/rbac/api-docs.js";import{SERVER_ONLY_VALUE_KEY as A}from"../../../loaders/server-only-value.js";import{getLoadedProjectPlugins as de}from"../../project/loaded-set.js";import{API_OUTPUT_MANIFEST_KEY as j}from"../../../api-outputs.js";import{API_DOCS_MARKDOC_TAG_SET as M,resolveMarkdocTagSet as N}from"../../../markdown/constants/tag-sets.js";import{pageLocale as P}from"../../utils/page-locale.js";import{buildBundledApiDefinition as F,resolveLlmsDescriptions as I}from"./server/build-definition.js";import{collectSidebarSubpathTargets as L,toSidebarSubtree as R,toSubpathTarget as z}from"./server/build-sidebar.js";import{buildApiDocsMarkdownDocs as B}from"./server/markdown-docs.js";import{join as V,relative as H}from"node:path";import fe from"@redocly/markdoc";const pe=[`.yaml`,`.yml`,`.json`,`.gql`,`.graphql`],me={[y]:`OpenAPI`,[_]:`AsyncAPI`,[v]:`GraphQL`,[g]:`Arazzo`},U=t(D,async e=>{let{buildItems:t}=await import(`@redocly/api-docs`),n=K(e),r=await e.io.readFile(n.absolutePath),i=e.routes.byFilePath(e.file.path)?.slug,a=se(e.args.options,e.file.path,e.args.kind),o=e.args.kind===`openapi`?le(a,e.config,i):a,s={entityDeps:[],assetUsages:[],linkRefs:[],problems:[],pending:[]},c=G(e.contentDir),l={markdown:e.markdown,loader:{config:e.config,entities:e.entities,file:e.file,io:e.io,logger:e.logger,plugin:e.plugin},sink:s},u=await F({kind:e.args.kind,source:r,relativePath:n.relativePath,contentDir:e.contentDir,pagePath:e.file.path,options:o,bundle:q(e.args,c),metadata:X(e.args.options),markdownResolution:l,rbac:{warn:t=>e.logger?.warn(t)}}),d={...p(u.document)&&p(u.document.info)?{infoDescription:u.document.info.description}:{},...await I(u.document,l,{contentDir:e.contentDir,specPath:n.relativePath,pagePath:e.file.path})};e.args.kind===`openapi`&&o.showSchemaCatalogLinks&&p(u.document)&&(u.document[`x-schema-catalog-link`]=oe(e.file.path)),u.options=ce(u.options,u.document,e.args.feedback??e.config.feedback);let f=i?.toLowerCase()??`/`,{items:m,store:h,specType:g}=await t({...u,basePath:f,markdownParser:e=>fe.compact(C(e))}),_=JSON.stringify({items:x(m),store:x(h),options:u.options,specType:g,basePath:f,title:be(u.document,e.args.kind,m),metadata:ye(u.document),[A]:{llms:d}});return{value:await e.createBlobRef(_,{format:`json`}),entityDeps:[...Y(e.file.path,[...u.fileDependencies,...c.paths]),...s.entityDeps],assetUsages:s.assetUsages,markdoc:{tagSet:M},linkRefs:s.linkRefs,problems:s.problems}},{async searchable(e,t){if(t.route===void 0||t.route.metadata.excludeFromSearch===!0)return{docs:[]};let n=S(e),r=await Ee(t.entities,t.route.originFilePath),d={...t.route.metadata,...p(n.metadata)?n.metadata:{}},{category:f,isInvalid:m}=u(d),{facets:h,invalidFields:g}=c({[i]:t.route.metadata.title,[a]:t.route.metadata.version,...d},s(t.config)),{buildApiDocsSearchDocuments:_}=await import(`./server/search-documents.js`);return{..._(n,r,{groupKey:f,facets:h,warn:e=>t.logger?.warn(e)}),problems:l([...g,...m?[o]:[]],t.route.originFilePath)}},async markdown(e,t){if(t.route===void 0)return null;let n=S(e),r=t.route.originFilePath??void 0,i=r?await t.entities.load(w(r)).catch(()=>void 0):void 0,{tags:a}=await N(M);return B(n,ve(i,n[A]?.llms),r,{tags:a,locale:P(t)})},usesProjectMarkdocSchema:!0}),W=t(T,async e=>{let t=K(e),n=await e.io.readFile(t.absolutePath),r=G(e.contentDir),i=await F({kind:e.args.kind,source:n,relativePath:t.relativePath,contentDir:e.contentDir,bundle:q(e.args,r),metadata:X(e.args.options)}),a=e.args.kind===v,o=a?n:JSON.stringify(i.document);return{value:o.length>65536?await e.createBlobRef(o,{format:a?`text`:`json`}):a?n:i.document,metadata:{...Z(e.file.path,e.args.kind,e.args.options,e.args.rbac),...ge(i.document,e.routes.byFilePath(e.file.path)?.slug)},entityDeps:Y(e.file.path,[...i.fileDependencies,...r.paths])}});function G(e){let t=de(e)?.lintPlugins??[];return{plugins:t,paths:t.map(t=>d(H(e,t.path))).filter(e=>e!==``&&!e.startsWith(`../`))}}function K(e){let t=e.args.source?.path??e.file.path;return{relativePath:t,absolutePath:V(e.contentDir,t)}}function he(e){let t=e[j];return p(t)&&typeof t.root==`string`?t.root:void 0}function q(e,t){let{config:n,configDir:r}=e.bundleConfig??{config:{},configDir:``};return{config:n,configDir:r,plugins:t.plugins}}function ge(e,t){let n=p(e)&&p(e.info)?e.info:{},r=p(n[`x-metadata`])?n[`x-metadata`]:{},i=typeof n.description==`string`?n.description.trim():``;return{...t===void 0?{}:{routeSlug:t},...Q(n.version)?{version:String(n.version)}:{},...typeof r.apiId==`string`?{apiId:r.apiId}:{},description:i||void 0}}const J=t(te,async e=>{let{buildNavItems:t,collectPreviousRouteSlugs:n}=await import(`@redocly/api-docs`),r=await e.entities.load(w(e.file.path)),i=e.args.kind===`graphql`?(await import(`graphql`)).parse(r):r,a=ue(i,e.args.kind,{warn:t=>e.logger?.warn(t)}),{items:o}=await t({type:e.args.kind,document:a,options:e.args.options,basePath:`/`,markdownParser:C}),s=R(o),c=n(o).map(({from:e})=>z(e));return{value:s,targetInventories:[{kind:`subpath`,exhaustive:!0,targets:[...L(s),...c]}]}});function Y(e,t){return[{kind:`file`,path:e},...t.map(e=>({kind:`file`,path:e}))]}const _e={arazzo:`Arazzo Docs`,asyncapi:`AsyncAPI Docs`,graphql:`GraphQL Docs`,openapi:`OpenAPI Docs`};function ve(e,t){if(t===void 0||!p(e))return e;let n=p(e.info)?e.info:{},r=p(e.components)?e.components:{};return{...e,...t.infoDescription===void 0?{}:{info:{...n,description:t.infoDescription}},...t.servers===void 0?{}:{servers:t.servers},...t.securitySchemes===void 0?{}:{components:{...r,securitySchemes:t.securitySchemes}}}}function ye(e){let t=p(e)&&p(e.info)?e.info:{};return p(t[`x-metadata`])?t[`x-metadata`]:{}}function be(e,t,n){let r=p(e)&&p(e.info)?e.info:{};if(typeof r.title==`string`&&r.title!==``)return r.title;let i=p(n[0])?n[0].label:void 0;return typeof i==`string`&&i!==``?i:_e[t]}const xe=[`rbac`,`sidebar`,`excludeFromSearch`,`template`];function Se(e,t){let n=p(e.manifest.info)?e.manifest.info:{},r={};typeof n.title==`string`&&(r.title=n.title),Q(n.version)&&(r.version=String(n.version)),typeof n.summary==`string`&&(r.summary=n.summary),p(n[`x-metadata`])&&Object.assign(r,n[`x-metadata`]),p(t.metadata)&&Object.assign(r,t.metadata);for(let e of xe)delete r[e];return r}function X(e){return p(e.metadata)?e.metadata:void 0}function Ce(e){let t=X(e)?.title;return typeof t==`string`&&t.length>0?t:void 0}function Z(e,t,n,r){let i=Ce(n);return{specType:t,sourcePath:e,...i===void 0?{}:{title:i},...r===void 0?{}:{rbac:r},...Object.keys(n).length>0?{options:n}:{},...p(n.mockServer)?{mockServer:n.mockServer}:{}}}function Q(e){return typeof e==`string`||typeof e==`number`}function we(e){if(e.ext===`.gql`||e.ext===`.graphql`)return v;let{openapi:t,swagger:n,asyncapi:r,arazzo:i}=e.manifest;return Q(t)||Q(n)?y:Q(r)?_:Q(i)?g:null}const Te=e({id:ee,version:`0.44.0`,content:{filter:{extensions:pe},async extractFile(e,t){if(f.test(e.path))return null;let n=we(e);if(n===null)return null;if(n!==`arazzo`&&!b(t.config,n))return{routes:[],problems:[m(`${me[n]} documents`)]};let r=e.path,i=he(e.manifest),a=i??r,{rbac:o,...s}=await ie(t.io,t.config,r,n,a),c={filePath:r,kind:n,options:s,...o===void 0||!b(t.config,`rbac`)?{}:{rbac:o}};i!==void 0&&(c.source={path:i});let l=await ae(t.io,t.config,a);if(l!==void 0&&(c.feedback=l),n!==`graphql`){let e=await re(t.io,t.config,r,a);Object.keys(e.config).length>0&&(c.bundleConfig=e)}let u=W.withArgs(c,{stableKey:w(r),type:`api`,metadata:Z(r,n,s,c.rbac)});if(n===`arazzo`)return{routes:[],entities:[u]};let d=Se(e,s);s.excludeFromSearch===!0&&(d.excludeFromSearch=!0),d.type=n,c.rbac!==void 0&&(d.rbac=c.rbac);let p=U.withArgs(c,{stableKey:`api-docs:render:${r}`}),g=J.withArgs(c,{stableKey:`api-docs:sidebar:${r}`}),_=h(r);return{routes:[{deps:{[E]:p},metadata:d,routeId:`page`,sidebarSubtree:g,slug:null,slugHint:_,template:O,wildcardPrefix:!0}],entities:[u,p,g]}}},loaders:[W,U,J],templates:{[O]:r(n(`./client/template.tsx`,import.meta.url))},server:{routes:[$(k.bundle,`bundle`),$(k.deprecatedBundle,`bundle`),$(k.graphql,`graphql`)]}});function $(e,t){return{method:`GET`,path:e+ne,handler:{filePath:`./server/spec-download.ts`,importer:import.meta.url,exportName:t}}}async function Ee(e,t){if(t)try{return await e.load(w(t))}catch{return}}export{Te as apiDocsContentPlugin};
|
|
1
|
+
import{defineContentPlugin as e}from"../../define.js";import{createEntityLoader as t}from"../../../loaders/define.js";import{runtimeFile as n}from"../../utils/runtime-file.js";import{runtimeTemplate as r}from"../../templates.js";import{SEARCH_API_TITLE_FACET_FIELD as i,SEARCH_API_VERSION_FACET_FIELD as a,SEARCH_GROUP_FACET_FIELD as o}from"../../../../shared/search/facets.js";import{configuredFacetFields as s,extractFacetsFromFrontmatter as c,invalidFacetValueProblems as l,searchCategoryOf as u}from"../../../search/facet-values.js";import{isPlanFeatureGranted as d}from"../../../../shared/plan-gates.js";import{TRANSLATIONS_FILE_PATTERN as f}from"../../../../shared/constants/l10n/defaults.js";import{isObject as p}from"../../../../shared/utils/is-object.js";import{API_DOCS_API_LOADER_ID as m,API_DOCS_PLUGIN_ID as h,API_DOCS_RENDER_DEP_KEY as g,API_DOCS_RENDER_LOADER_ID as _,API_DOCS_SIDEBAR_LOADER_ID as ee,API_DOCS_TEMPLATE_ID as v,SPEC_DOWNLOAD_ROUTE_PATHS as y,SPEC_PATH_PARAM as te}from"./server/shared.js";import{API_DOCS_MARKDOC_TAG_SET as b,resolveMarkdocTagSet as ne}from"../../../markdown/constants/tag-sets.js";import{toPosixPath as x}from"../../../../shared/utils/to-posix-path.js";import{notInPlanProblem as re}from"../../../plan-gates.js";import{filePathToRouteSlug as ie}from"../../../../shared/utils/routes/file-path-to-route-slug.js";import{SPEC_KIND_ARAZZO as S,SPEC_KIND_ASYNCAPI as C,SPEC_KIND_GRAPHQL as w,SPEC_KIND_OPENAPI as T}from"../../../../shared/constants/api-spec-kinds.js";import{packMarkdocAstsDeep as E,unpackMarkdocAstsDeep as D}from"../../../../shared/utils/packed-ast.js";import{parseMarkdownCached as O}from"../../../markdown/utils/parse-cache.js";import{createApiEntityKey as k}from"../../utils/api-entity-key.js";import{resolveApiBundleConfig as ae,resolveApiOptions as oe,resolveNestedFeedback as se,schemaCatalogLink as ce,withDownloadUrls as le,withFeedbackOption as ue,withMockServerOption as de}from"./server/options.js";import{annotateApiDocsRbac as fe}from"../../../../shared/rbac/api-docs.js";import{SERVER_ONLY_VALUE_KEY as A}from"../../../loaders/server-only-value.js";import{getLoadedProjectPlugins as j}from"../../project/loaded-set.js";import{API_OUTPUT_MANIFEST_KEY as M}from"../../../api-outputs.js";import{pageLocale as N}from"../../utils/page-locale.js";import{buildBundledApiDefinition as P,resolveLlmsDescriptions as F}from"./server/build-definition.js";import{collectSidebarSubpathTargets as I,toSidebarSubtree as L,toSubpathTarget as R}from"./server/build-sidebar.js";import{buildApiDocsMarkdownDocs as z}from"./server/markdown-docs.js";import{join as B,relative as V}from"node:path";import pe from"@redocly/markdoc";const me=[`.yaml`,`.yml`,`.json`,`.gql`,`.graphql`],he={[T]:`OpenAPI`,[C]:`AsyncAPI`,[w]:`GraphQL`,[S]:`Arazzo`},H=t(_,async e=>{let{buildItems:t}=await import(`@redocly/api-docs/server`),n=G(e),r=await e.io.readFile(n.absolutePath),i=e.routes.byFilePath(e.file.path)?.slug,a=le(e.args.options,e.file.path,e.args.kind),o=e.args.kind===`openapi`?de(a,e.config,i):a,s={entityDeps:[],assetUsages:[],linkRefs:[],problems:[],pending:[]},c=W(e.contentDir),l={markdown:e.markdown,loader:{config:e.config,entities:e.entities,file:e.file,io:e.io,logger:e.logger,plugin:e.plugin},sink:s},u=await P({kind:e.args.kind,source:r,relativePath:n.relativePath,contentDir:e.contentDir,pagePath:e.file.path,options:o,bundle:K(e.args,c),metadata:Y(e.args.options),markdownResolution:l,rbac:{warn:t=>e.logger?.warn(t)}}),d={...p(u.document)&&p(u.document.info)?{infoDescription:u.document.info.description}:{},...await F(u.document,l,{contentDir:e.contentDir,specPath:n.relativePath,pagePath:e.file.path})};e.args.kind===`openapi`&&o.showSchemaCatalogLinks&&p(u.document)&&(u.document[`x-schema-catalog-link`]=ce(e.file.path)),u.options=ue(u.options,u.document,e.args.feedback??e.config.feedback);let f=i?.toLowerCase()??`/`,{items:m,store:h,specType:g}=await t({...u,basePath:f,markdownParser:e=>pe.compact(O(e))}),_=JSON.stringify({items:E(m),store:E(h),options:u.options,specType:g,basePath:f,title:xe(u.document,e.args.kind,m),metadata:be(u.document),[A]:{llms:d}});return{value:await e.createBlobRef(_,{format:`json`}),entityDeps:[...J(e.file.path,[...u.fileDependencies,...c.paths]),...s.entityDeps],assetUsages:s.assetUsages,markdoc:{tagSet:b},linkRefs:s.linkRefs,problems:s.problems}},{async searchable(e,t){if(t.route===void 0||t.route.metadata.excludeFromSearch===!0)return{docs:[]};let n=D(e),r=await Ee(t.entities,t.route.originFilePath),d={...t.route.metadata,...p(n.metadata)?n.metadata:{}},{category:f,isInvalid:m}=u(d),{facets:h,invalidFields:g}=c({[i]:t.route.metadata.title,[a]:t.route.metadata.version,...d},s(t.config)),{buildApiDocsSearchDocuments:_}=await import(`./server/search-documents.js`);return{..._(n,r,{groupKey:f,facets:h,warn:e=>t.logger?.warn(e)}),problems:l([...g,...m?[o]:[]],t.route.originFilePath)}},async markdown(e,t){if(t.route===void 0)return null;let n=D(e),r=t.route.originFilePath??void 0,i=r?await t.entities.load(k(r)).catch(()=>void 0):void 0,{tags:a}=await ne(b);return z(n,ye(i,n[A]?.llms),r,{tags:a,locale:N(t)})},usesProjectMarkdocSchema:!0}),U=t(m,async e=>{let t=G(e),n=await e.io.readFile(t.absolutePath),r=W(e.contentDir),i=await P({kind:e.args.kind,source:n,relativePath:t.relativePath,contentDir:e.contentDir,bundle:K(e.args,r),metadata:Y(e.args.options)}),a=e.args.kind===w,o=a?n:JSON.stringify(i.document);return{value:o.length>65536?await e.createBlobRef(o,{format:a?`text`:`json`}):a?n:i.document,metadata:{...Z(e.file.path,e.args.kind,e.args.options,e.args.rbac),..._e(i.document,e.routes.byFilePath(e.file.path)?.slug)},entityDeps:J(e.file.path,[...i.fileDependencies,...r.paths])}});function W(e){let t=j(e)?.lintPlugins??[];return{plugins:t,paths:t.map(t=>x(V(e,t.path))).filter(e=>e!==``&&!e.startsWith(`../`))}}function G(e){let t=e.args.source?.path??e.file.path;return{relativePath:t,absolutePath:B(e.contentDir,t)}}function ge(e){let t=e[M];return p(t)&&typeof t.root==`string`?t.root:void 0}function K(e,t){let{config:n,configDir:r}=e.bundleConfig??{config:{},configDir:``};return{config:n,configDir:r,plugins:t.plugins}}function _e(e,t){let n=p(e)&&p(e.info)?e.info:{},r=p(n[`x-metadata`])?n[`x-metadata`]:{},i=typeof n.description==`string`?n.description.trim():``;return{...t===void 0?{}:{routeSlug:t},...Q(n.version)?{version:String(n.version)}:{},...typeof r.apiId==`string`?{apiId:r.apiId}:{},description:i||void 0}}const q=t(ee,async e=>{let{buildNavItems:t,collectPreviousRouteSlugs:n}=await import(`@redocly/api-docs/server`),r=await e.entities.load(k(e.file.path)),i=e.args.kind===`graphql`?(await import(`graphql`)).parse(r):r,a=fe(i,e.args.kind,{warn:t=>e.logger?.warn(t)}),{items:o}=await t({type:e.args.kind,document:a,options:e.args.options,basePath:`/`,markdownParser:O}),s=L(o),c=n(o).map(({from:e})=>R(e));return{value:s,targetInventories:[{kind:`subpath`,exhaustive:!0,targets:[...I(s),...c]}]}});function J(e,t){return[{kind:`file`,path:e},...t.map(e=>({kind:`file`,path:e}))]}const ve={arazzo:`Arazzo Docs`,asyncapi:`AsyncAPI Docs`,graphql:`GraphQL Docs`,openapi:`OpenAPI Docs`};function ye(e,t){if(t===void 0||!p(e))return e;let n=p(e.info)?e.info:{},r=p(e.components)?e.components:{};return{...e,...t.infoDescription===void 0?{}:{info:{...n,description:t.infoDescription}},...t.servers===void 0?{}:{servers:t.servers},...t.securitySchemes===void 0?{}:{components:{...r,securitySchemes:t.securitySchemes}}}}function be(e){let t=p(e)&&p(e.info)?e.info:{};return p(t[`x-metadata`])?t[`x-metadata`]:{}}function xe(e,t,n){let r=p(e)&&p(e.info)?e.info:{};if(typeof r.title==`string`&&r.title!==``)return r.title;let i=p(n[0])?n[0].label:void 0;return typeof i==`string`&&i!==``?i:ve[t]}const Se=[`rbac`,`sidebar`,`excludeFromSearch`,`template`];function Ce(e,t){let n=p(e.manifest.info)?e.manifest.info:{},r={};typeof n.title==`string`&&(r.title=n.title),Q(n.version)&&(r.version=String(n.version)),typeof n.summary==`string`&&(r.summary=n.summary),p(n[`x-metadata`])&&Object.assign(r,n[`x-metadata`]),p(t.metadata)&&Object.assign(r,t.metadata);for(let e of Se)delete r[e];return r}function Y(e){return p(e.metadata)?e.metadata:void 0}function X(e){let t=Y(e)?.title;return typeof t==`string`&&t.length>0?t:void 0}function Z(e,t,n,r){let i=X(n);return{specType:t,sourcePath:e,...i===void 0?{}:{title:i},...r===void 0?{}:{rbac:r},...Object.keys(n).length>0?{options:n}:{},...p(n.mockServer)?{mockServer:n.mockServer}:{}}}function Q(e){return typeof e==`string`||typeof e==`number`}function we(e){if(e.ext===`.gql`||e.ext===`.graphql`)return w;let{openapi:t,swagger:n,asyncapi:r,arazzo:i}=e.manifest;return Q(t)||Q(n)?T:Q(r)?C:Q(i)?S:null}const Te=e({id:h,version:`0.45.0`,content:{filter:{extensions:me},async extractFile(e,t){if(f.test(e.path))return null;let n=we(e);if(n===null)return null;if(n!==`arazzo`&&!d(t.config,n))return{routes:[],problems:[re(`${he[n]} documents`)]};let r=e.path,i=ge(e.manifest),a=i??r,{rbac:o,...s}=await oe(t.io,t.config,r,n,a),c={filePath:r,kind:n,options:s,...o===void 0||!d(t.config,`rbac`)?{}:{rbac:o}};i!==void 0&&(c.source={path:i});let l=await se(t.io,t.config,a);if(l!==void 0&&(c.feedback=l),n!==`graphql`){let e=await ae(t.io,t.config,r,a);Object.keys(e.config).length>0&&(c.bundleConfig=e)}let u=U.withArgs(c,{stableKey:k(r),type:`api`,metadata:Z(r,n,s,c.rbac)});if(n===`arazzo`)return{routes:[],entities:[u]};let p=Ce(e,s);s.excludeFromSearch===!0&&(p.excludeFromSearch=!0),p.type=n,c.rbac!==void 0&&(p.rbac=c.rbac);let m=H.withArgs(c,{stableKey:`api-docs:render:${r}`}),h=q.withArgs(c,{stableKey:`api-docs:sidebar:${r}`}),_=ie(r);return{routes:[{deps:{[g]:m},metadata:p,routeId:`page`,sidebarSubtree:h,slug:null,slugHint:_,template:v,wildcardPrefix:!0}],entities:[u,m,h]}}},loaders:[U,H,q],templates:{[v]:r(n(`./client/template.tsx`,import.meta.url))},server:{routes:[$(y.bundle,`bundle`),$(y.deprecatedBundle,`bundle`),$(y.graphql,`graphql`)]}});function $(e,t){return{method:`GET`,path:e+te,handler:{filePath:`./server/spec-download.ts`,importer:import.meta.url,exportName:t}}}async function Ee(e,t){if(t)try{return await e.load(k(t))}catch{return}}export{Te as apiDocsContentPlugin};
|
|
@@ -3,7 +3,7 @@ import type { MarkdownService } from '../../../../markdown/types/service.js';
|
|
|
3
3
|
import type { MarkdocResolverContextBase } from '../../../../markdown/resolve/markdoc.js';
|
|
4
4
|
import { type ApiSpecType } from '../../../types/api-entity.js';
|
|
5
5
|
import type { JsonObject } from '../../../../database/schema.js';
|
|
6
|
-
import { type RbacAnnotationOptions } from '../../../../../
|
|
6
|
+
import { type RbacAnnotationOptions } from '../../../../../shared/rbac/api-docs.js';
|
|
7
7
|
/**
|
|
8
8
|
* Context for resolving markdown descriptions in an OpenAPI/AsyncAPI bundle. `markdown`
|
|
9
9
|
* carries state + slug resolution; `loader` is the render loader's context, without which
|
|
@@ -63,7 +63,7 @@ export declare function buildBundledApiDefinition(input: {
|
|
|
63
63
|
pagePath?: string;
|
|
64
64
|
/**
|
|
65
65
|
* When present, copies each node's `x-rbac` onto the upstream `REDOCLY_TEAMS_RBAC` key
|
|
66
|
-
* (see `src/
|
|
66
|
+
* (see `src/shared/rbac/api-docs.ts`) so `buildItems`/`buildNavItems` apply tag-to-operation
|
|
67
67
|
* inheritance and `$ref` propagation. GraphQL does not use `x-rbac`.
|
|
68
68
|
*/
|
|
69
69
|
rbac?: RbacAnnotationOptions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isObject as e}from"../../../../../shared/utils/is-object.js";import{toContainedContentPath as t}from"../../../../ingest/scan.js";import{SPEC_KIND_ARAZZO as n}from"
|
|
1
|
+
import{isObject as e}from"../../../../../shared/utils/is-object.js";import{toContainedContentPath as t}from"../../../../ingest/scan.js";import{SPEC_KIND_ARAZZO as n}from"../../../../../shared/constants/api-spec-kinds.js";import{annotateApiDocsRbac as r}from"../../../../../shared/rbac/api-docs.js";import{resolveMarkdownAst as i}from"../../../../markdown/resolve/ast.js";import{PLAIN_DESCRIPTION_SOURCE as a,REALM_MARKDOWN_DECORATOR_KEY as o,REALM_MARKDOWN_DECORATOR_NAME as s,createMarkdownDecoratorPlugin as c}from"./markdown-decorator.js";import{ProblemError as l}from"../../../../problems/problem-error.js";import{join as u}from"node:path";async function d(e){if(e.kind===`graphql`){let{parse:t}=await import(`graphql`),n;try{n=t(e.source)}catch(t){throw m(e.relativePath,t)}return{type:`graphql`,document:n,relativePath:e.relativePath,options:e.options??{},fileDependencies:[]}}let{bundleFromString:t,createConfig:i}=await import(`@redocly/openapi-core`),a=await h(i,{bundle:e.bundle??{config:{},configDir:``,plugins:[]},specRelativePath:e.relativePath,rootDir:e.contentDir,resolution:e.markdownResolution}),o;try{o=await t({source:e.source,absoluteRef:u(e.contentDir,e.relativePath),config:a,dereference:e.kind===n})}catch(t){throw m(e.relativePath,t)}let s=o.bundle.parsed,c=y(o.fileDependencies,e.contentDir);e.markdownResolution&&await _(e.markdownResolution,e.markdownResolution.sink.pending,e.contentDir,e.pagePath??e.relativePath);let l;try{l=await f(e.kind,s)}catch(t){throw m(e.relativePath,t)}let d=p(l,e.metadata);return{type:e.kind,document:e.rbac?r(d,e.kind,e.rbac):d,relativePath:e.relativePath,options:e.options??{},fileDependencies:c}}async function f(e,t){if(typeof t!=`object`||!t||Array.isArray(t))return t;let n=t;if(e===`openapi`&&n.swagger!==void 0){let{convertSwaggerToOpenApi:e}=await import(`@redocly/api-docs/server`);return e(n)}if(e===`asyncapi`){let{normalizeAsyncApiDefinition:e}=await import(`@redocly/api-docs/server`);return e(n)}return t}function p(t,n){if(n===void 0||!e(t))return t;let r=e(t.info)?t.info:{},i=e(r[`x-metadata`])?r[`x-metadata`]:{};return{...t,info:{...r,"x-metadata":{...i,...n}}}}function m(e,t){let n=t instanceof Error?t.message:String(t);return new l({code:`spec/parse-failed`,message:n,location:{filePath:e}})}function h(e,n){let{bundle:r,resolution:i}=n,a={configPath:u(n.rootDir,r.configDir,`redocly.yaml`)},l=r.plugins.map(({plugin:e,path:t})=>({...e,absolutePath:t}));if(i===void 0)return e({...r.config,plugins:l},a);let{sink:d}=i,f=c({specSourcePath:n.specRelativePath,sink:d,toContentRelative:e=>t(n.rootDir,e)});return e({...r.config,plugins:[...l,f],decorators:{...r.config.decorators,[o]:`on`,[s]:`on`}},a)}async function g(t,n,r){if(!e(t))return{};let i=[],o=(t,n)=>{if(!e(t)||!e(n))return;let o=n[a];i.push({read:()=>t.description,sourceFilePath:typeof o==`string`?o:r.specPath,writeBack:e=>{t.description=e}})},s={},c=t.servers;if(Array.isArray(c)||e(c)){s.servers=structuredClone(c);for(let[t,n]of Object.entries(c)){let r=s.servers[t];if(o(r,n),e(n)&&e(n.variables)&&e(r)){let e=r.variables;for(let[t,r]of Object.entries(n.variables))o(e[t],r)}}}let l=e(t.components)?t.components:void 0;if(e(l?.securitySchemes)){let e=l.securitySchemes;s.securitySchemes=structuredClone(e);for(let[t,n]of Object.entries(e))o(s.securitySchemes[t],n)}return await _(n,i,r.contentDir,r.pagePath),s}async function _(e,t,n,r){let{markdown:a,sink:o}=e,s={...e.loader,contentDir:n,markdown:a};await Promise.all(t.map(async e=>{let t=e.read();if(typeof t!=`string`||!a.looksLikeMarkdown(t))return;let{ast:n,entityDeps:c,assetUsages:l,linkRefs:u,problems:d}=await i(t,e.sourceFilePath,{resolverContext:s});o.entityDeps.push(...c),o.assetUsages.push(...l),o.linkRefs.push(...u.map(e=>v(e.raw.trim().startsWith(`#`)?{...e,target:r}:e)));for(let e of d)o.problems.push({...e,location:{filePath:r}});e.writeBack(n)}))}function v(e){if(e.range===void 0)return e;let t={...e};return delete t.range,t}function y(e,n){let r=/* @__PURE__ */ new Set;for(let i of e){let e=t(n,i);e!==null&&r.add(e)}return[...r].sort()}export{d as buildBundledApiDefinition,g as resolveLlmsDescriptions};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isRbacScope as e}from"../../../../../
|
|
1
|
+
import{isRbacScope as e}from"../../../../../shared/rbac/engine.js";import{REDOCLY_TEAMS_RBAC as t}from"@redocly/config";function n(e){return e.map(o)}function r(e){let t=/* @__PURE__ */ new Set,n=e=>{for(let r of e){let e=i(r.slugSuffix??``);e!==``&&t.add(e),r.items&&r.items.length>0&&n(r.items)}};return n(e),[...t]}function i(e){return e.replace(/^\/+/,``)}function a(e){return e===``||e.startsWith(`/`)?e:`/${e}`}function o(n){let r={};n.label!==void 0&&(r.label=n.label),n.link!==void 0&&(r.slugSuffix=a(n.link)),n.httpVerb!==void 0&&(r.httpVerb=n.httpVerb),n.deprecated!==void 0&&(r.deprecated=n.deprecated),n.badges!==void 0&&(r.badges=n.badges),n.external!==void 0&&(r.external=n.external),n.separatorLine!==void 0&&(r.separatorLine=n.separatorLine),n.icon!==void 0&&(r.icon=n.icon),n.variant!==void 0&&(r.variant=n.variant);let i=n[t];return e(i)&&(r[t]=i),(n.type===`link`||n.type===`group`||n.type===`separator`)&&(r.type=n.type),r.type===`separator`&&(r.separatorLine=!0),n.items&&n.items.length>0&&(r.items=n.items.map(o)),r}export{r as collectSidebarSubpathTargets,n as toSidebarSubtree,i as toSubpathTarget};
|