@redocly/framework 1.0.0-next.11 → 1.0.0-next.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundler/build/dependency-pack.js +1 -1
- package/dist/bundler/build/output-metadata.js +1 -1
- package/dist/bundler/build/run.js +1 -1
- package/dist/bundler/build/theme-global-stylesheets.js +1 -1
- package/dist/bundler/build/vite-config.js +2 -2
- package/dist/bundler/dev/dev-content-build.js +1 -1
- package/dist/bundler/dev/routes/dev-problems-route.js +1 -1
- package/dist/bundler/dev/routes/source-sync-route.js +1 -1
- package/dist/bundler/dev/run.js +1 -1
- package/dist/bundler/dev/runtime-app.js +1 -1
- package/dist/bundler/dev/vite-chunk-url.js +1 -1
- package/dist/bundler/dev/vite-config.js +1 -1
- package/dist/bundler/user-markdoc-schema.js +1 -1
- package/dist/bundler/vite-config.base.js +5 -5
- package/dist/cli/api-docs-build-event.js +1 -1
- package/dist/cli/args.js +1 -1
- package/dist/cli/commands/build.js +1 -1
- package/dist/cli/commands/dev.js +1 -1
- package/dist/cli/commands/ingest.js +1 -1
- package/dist/cli/commands/translate.js +1 -1
- package/dist/cli/problems-output.js +3 -3
- package/dist/cli/validate-react-pages.js +1 -1
- package/dist/client/ai-search/citations.js +3 -3
- package/dist/client/ai-search/use-ai-search.js +1 -1
- package/dist/client/analytics-page-view.js +1 -1
- package/dist/client/app.js +2 -2
- package/dist/client/classic-webview-sync.js +1 -0
- package/dist/client/client-entry.js +1 -1
- package/dist/client/contexts.js +1 -1
- package/dist/client/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/page-sync.js +1 -0
- package/dist/client/products.js +1 -1
- package/dist/client/review/ReviewBar.js +3 -3
- package/dist/client/review/login-url.js +1 -1
- package/dist/client/review/use-review.js +1 -1
- package/dist/client/revisions-history.js +1 -1
- 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/theme-logo.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/config.js +1 -1
- package/dist/content-layer/context-state.js +1 -1
- package/dist/content-layer/context.js +1 -1
- package/dist/content-layer/database/assets.js +1 -1
- package/dist/content-layer/database/blobs.js +1 -1
- package/dist/content-layer/database/entity-store.js +1 -1
- package/dist/content-layer/database/files.js +1 -1
- package/dist/content-layer/database/finalize.js +1 -1
- package/dist/content-layer/database/invalidation.js +26 -26
- package/dist/content-layer/database/link-refs.js +1 -1
- package/dist/content-layer/database/origins.js +1 -1
- package/dist/content-layer/database/problems.js +1 -1
- package/dist/content-layer/database/reset.js +1 -1
- package/dist/content-layer/database/route-query-deps.js +1 -1
- package/dist/content-layer/database/search-vocab.js +2 -2
- package/dist/content-layer/database/static-files.js +1 -1
- package/dist/content-layer/ingest/extract-all-phase.js +1 -1
- package/dist/content-layer/ingest/finalize-phase.js +1 -1
- package/dist/content-layer/ingest/hash.js +1 -1
- package/dist/content-layer/ingest/hook-inputs.js +1 -1
- package/dist/content-layer/ingest/l10n-warnings.js +1 -1
- package/dist/content-layer/ingest/normalize-artifacts.js +1 -1
- package/dist/content-layer/ingest/run.js +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/sync.js +1 -1
- package/dist/content-layer/link-checker/config-links.js +1 -1
- package/dist/content-layer/link-checker/delta.js +1 -1
- package/dist/content-layer/link-checker/fingerprint.js +1 -1
- package/dist/content-layer/link-checker/load-view.js +1 -1
- package/dist/content-layer/link-checker/node-ref.js +1 -1
- package/dist/content-layer/link-checker/run-build.js +1 -1
- package/dist/content-layer/link-checker/validate.js +1 -1
- package/dist/content-layer/loaders/context.js +1 -1
- package/dist/content-layer/markdown/client/JsonSchemaTag.js +1 -1
- 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/nodes/fence.js +1 -1
- package/dist/content-layer/markdown/nodes/heading.js +1 -1
- package/dist/content-layer/markdown/nodes/table.js +1 -1
- package/dist/content-layer/markdown/resolve/markdoc-resolvers/file-reference.js +1 -1
- package/dist/content-layer/markdown/resolve/markdoc-resolvers/operation-samples.js +1 -1
- package/dist/content-layer/markdown/resolve/markdoc-resolvers/partial.js +1 -1
- package/dist/content-layer/markdown/resolve/markdoc-resolvers/svg-content.js +1 -1
- package/dist/content-layer/markdown/resolve/markdoc.js +1 -1
- package/dist/content-layer/markdown/resolve/references.js +1 -1
- package/dist/content-layer/markdown/search/to-markdown.js +2 -2
- package/dist/content-layer/markdown/search/to-sections.js +1 -1
- package/dist/content-layer/markdown/search/to-text.js +5 -5
- 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/variant.js +1 -1
- package/dist/content-layer/markdown/utils/collect-anchors.js +1 -1
- package/dist/content-layer/markdown/utils/first-heading.js +1 -1
- package/dist/content-layer/markdown/utils/parse-cache.js +1 -1
- package/dist/content-layer/materialization/asset-reconcile.js +1 -1
- package/dist/content-layer/materialization/entity.js +1 -1
- package/dist/content-layer/materialization/materializer.js +1 -1
- package/dist/content-layer/materialization/static-files.js +1 -1
- package/dist/content-layer/plugins/execute.js +1 -1
- package/dist/content-layer/plugins/index.js +1 -1
- package/dist/content-layer/plugins/internal/api-docs/client/template.js +2 -2
- package/dist/content-layer/plugins/internal/api-docs/index.js +1 -1
- package/dist/content-layer/plugins/internal/api-docs/server/build-definition.js +1 -1
- package/dist/content-layer/plugins/internal/api-docs/server/markdown-copy.js +5 -5
- 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/server/dispatch.js +1 -1
- package/dist/content-layer/plugins/internal/app-data/index.d.ts +1 -1
- package/dist/content-layer/plugins/internal/app-data/index.js +1 -1
- package/dist/content-layer/plugins/internal/app-data/logo.js +1 -1
- package/dist/content-layer/plugins/internal/app-data/products.js +1 -1
- package/dist/content-layer/plugins/internal/assets/index.js +1 -1
- package/dist/content-layer/plugins/internal/catalog-classic/client/use-catalog-classic.js +1 -1
- package/dist/content-layer/plugins/internal/catalog-classic/index.js +1 -1
- package/dist/content-layer/plugins/internal/catalog-classic/resolve-items.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/l10n/translations-loader.js +1 -1
- package/dist/content-layer/plugins/internal/markdoc/client/template.js +1 -1
- package/dist/content-layer/plugins/internal/markdoc/index.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/app-data.js +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/audit.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/auth.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/call-api.js +2 -2
- package/dist/content-layer/plugins/internal/mcp/server/gateway/credentials-handler.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/gateway/credentials-page/form-page.js +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/index.js +3 -3
- package/dist/content-layer/plugins/internal/mcp/server/gateway/tools.js +4 -4
- package/dist/content-layer/plugins/internal/mcp/server/handler.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/mcp-server.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/mcp-telemetry.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/oauth/authorize.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/oauth/callback.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/oauth/discovery.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/oauth/error-reporting.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/oauth/register.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/oauth/token.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/rate-limit.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/server-card.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/server-info.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/skills-resources.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/tools/pages-navigation.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/tools/pages.js +2 -2
- package/dist/content-layer/plugins/internal/mcp/server/tools/schemas.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/tools/search.js +2 -2
- package/dist/content-layer/plugins/internal/mcp/setup-page.js +1 -1
- package/dist/content-layer/plugins/internal/mock/server/handler.js +1 -1
- package/dist/content-layer/plugins/internal/react-page/index.js +1 -1
- package/dist/content-layer/plugins/internal/scorecard-classic/index.js +1 -1
- package/dist/content-layer/plugins/internal/sidebar/bundle.js +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/internal/versions/index.js +1 -1
- package/dist/content-layer/plugins/io.js +1 -1
- package/dist/content-layer/plugins/project/load.js +2 -2
- package/dist/content-layer/plugins/source-file.js +1 -1
- package/dist/content-layer/plugins/utils/link-access.js +1 -1
- package/dist/content-layer/plugins/utils/route-index.js +1 -1
- package/dist/content-layer/revisions/delete.js +1 -1
- package/dist/content-layer/revisions/read.js +1 -1
- package/dist/content-layer/search/engine/core/search-engine.js +1 -1
- package/dist/content-layer/search/postings/postings-store.js +1 -1
- package/dist/content-layer/server/database.js +1 -1
- package/dist/content-layer/static/registry.js +1 -1
- package/dist/content-layer/templates/template-set.js +1 -1
- package/dist/content-layer/versions/group-info.d.ts +2 -1
- package/dist/content-layer/versions/group-info.js +1 -1
- package/dist/content-layer/versions/redirect.js +1 -1
- package/dist/content-layer/versions/resolve.js +1 -1
- package/dist/server/app.js +3 -3
- package/dist/server/ask-ai/route.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.js +12 -12
- 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/node-entry.js +1 -1
- package/dist/server/plugin-context.js +1 -1
- package/dist/server/rbac/content-asset-access.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/child-entry.js +1 -1
- package/dist/server/telemetry/mock-server-events.js +1 -1
- package/dist/server/telemetry/sender.js +1 -1
- package/dist/server/template-ids.js +1 -1
- package/dist/server/wait-until.js +1 -0
- package/dist/shared/constants/review.d.ts +2 -0
- package/dist/shared/constants/review.js +1 -1
- package/dist/shared/constants/system-routes.d.ts +1 -1
- package/dist/shared/constants/system-routes.js +1 -1
- package/dist/shared/rbac/engine.js +0 -0
- package/dist/shared/rbac/l10n-rules.js +1 -1
- package/dist/shared/rbac/route-scope.js +1 -1
- package/dist/shared/rbac/team-templates.js +1 -1
- package/dist/shared/utils/l10n.js +1 -1
- package/dist/shared/utils/routes/file-path-to-route-slug.js +1 -1
- package/package.json +4 -4
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{isObject as e}from"../../../../../shared/utils/is-object.js";import{
|
|
1
|
+
import{isObject as e}from"../../../../../shared/utils/is-object.js";import{SPEC_DOWNLOAD_ROUTE_PATHS as t}from"./shared.js";import{headingSlugger as n}from"../../../../markdown/utils/heading-slugger.js";import{RBAC_TEAM_ANONYMOUS as r}from"../../../../../shared/rbac/types.js";import{canView as i,isRbacScope as a,resolveRole as o}from"../../../../../shared/rbac/engine.js";import{filterRbacAnnotatedDocument as s,withoutRemovedRequired as c}from"../../../../../shared/rbac/filter.js";import{isMarkdocAstNode as l}from"../../../../markdown/server/render.js";import{parseMarkdownCached as u}from"../../../../markdown/utils/parse-cache.js";import{annotateApiDocsRbac as d}from"../../../../../shared/rbac/api-docs.js";import{markdocAstToMarkdownChunks as f}from"../../../../markdown/search/to-markdown.js";import{REDOCLY_TEAMS_RBAC as p}from"@redocly/config";import{JsonPointer as m,buildSpecSlice as h,describeSliceTarget as g,resolveSpecSliceScope as _,sliceCopyIntro as v,wrapSliceForCopy as y}from"@redocly/api-docs/server";const b=1e6;async function x(t,n,r){let i=S(r.markdown),{slice:a,readable:o}=await C(t,n,i,r.warn),s=e(n)&&e(n.info)?n.info:{},c=e(s[`x-metadata`])?s[`x-metadata`]:{},l=typeof s.title==`string`&&s.title!==``?s.title:t.title,u=i(typeof c.description==`string`?c.description:s.description).join(`
|
|
2
2
|
|
|
3
|
-
`),d=T(t.specType,r.originFilePath),f=t.items,p=/* @__PURE__ */ new Map,m=e=>{typeof e.link==`string`&&!p.has(e.link)&&H(e)&&p.set(e.link,U(e));for(let t of e.items??[])m(t)};for(let e of f)m(e);let h=/* @__PURE__ */ new Map,v=e=>{let n=_(t.specType,e.content,e.label);n?.kind===`graphql-type`&&typeof e.link==`string`&&h.set(n.name,e.link);for(let t of e.items??[])v(t)};if(t.specType===`graphql`)for(let e of f)v(e);let y=[],b=/* @__PURE__ */ new Set,x=async e=>{let r=e.content?.contentType,c=e.link;if(typeof c==`string`&&r!==void 0&&!b.has(c)){b.add(c);let m=r===`overview`,v=p.has(c)?p.get(c):U(e),x=m?l:e.label??``,S={specType:t.specType,document:n,renderMarkdown:i},C=r===`item`?_(t.specType,e.content,e.label):void 0,T=C===void 0?void 0:await a(C,p.has(c)),O;if(m)O=D({...S,title:x,description:u,info:s,readable:o,download:d,items:f});else if(C!==void 0&&T!==void 0){let e=w(T,{scope:C,title:x,target:g(C,n),specUrl:d,contentKind:t.specType===`graphql`?`graphql`:`yaml`}),r=t.specType===`graphql`?await E(T,h):``;O=[r===``?e:`${e}\n\n${r}`]}else O=[x===``?``:`# ${x}`,...V(e.content?.children??[],i),M(e.items??[],`##`,S)].filter(e=>e!==``);y.push({routeSlug:c,chunks:O,headings:G(O),title:x,description:m?u:void 0,rbacScope:v})}for(let t of e.items??[])await x(t)};for(let e of f)await x(e);return y}function S(e){let t=t=>{let n=W(t)?t:{type:`document`,children:Array.isArray(t)?t:[t]};return
|
|
3
|
+
`),d=T(t.specType,r.originFilePath),f=t.items,p=/* @__PURE__ */ new Map,m=e=>{typeof e.link==`string`&&!p.has(e.link)&&H(e)&&p.set(e.link,U(e));for(let t of e.items??[])m(t)};for(let e of f)m(e);let h=/* @__PURE__ */ new Map,v=e=>{let n=_(t.specType,e.content,e.label);n?.kind===`graphql-type`&&typeof e.link==`string`&&h.set(n.name,e.link);for(let t of e.items??[])v(t)};if(t.specType===`graphql`)for(let e of f)v(e);let y=[],b=/* @__PURE__ */ new Set,x=async e=>{let r=e.content?.contentType,c=e.link;if(typeof c==`string`&&r!==void 0&&!b.has(c)){b.add(c);let m=r===`overview`,v=p.has(c)?p.get(c):U(e),x=m?l:e.label??``,S={specType:t.specType,document:n,renderMarkdown:i},C=r===`item`?_(t.specType,e.content,e.label):void 0,T=C===void 0?void 0:await a(C,p.has(c)),O;if(m)O=D({...S,title:x,description:u,info:s,readable:o,download:d,items:f});else if(C!==void 0&&T!==void 0){let e=w(T,{scope:C,title:x,target:g(C,n),specUrl:d,contentKind:t.specType===`graphql`?`graphql`:`yaml`}),r=t.specType===`graphql`?await E(T,h):``;O=[r===``?e:`${e}\n\n${r}`]}else O=[x===``?``:`# ${x}`,...V(e.content?.children??[],i),M(e.items??[],`##`,S)].filter(e=>e!==``);y.push({routeSlug:c,chunks:O,headings:G(O),title:x,description:m?u:void 0,rbacScope:v})}for(let t of e.items??[])await x(t)};for(let e of f)await x(e);return y}function S(e){let t=t=>{let n=W(t)?t:{type:`document`,children:Array.isArray(t)?t:[t]};return f(n,e)};return e=>{if(e==null)return[];if(typeof e!=`string`)return t(e);if(!e.includes(`{%`)){let t=e.trim();return t===``?[]:[t]}return t(u(e))}}async function C(e,t,n,r){let i=e.specType,a=e=>n(e).join(`
|
|
4
4
|
|
|
5
|
-
`);if(i===`graphql`){let e=typeof t==`string`?await B(t,a):void 0;return{slice:t=>h(i,e,t,{maxRefDepth:0}),readable:void 0}}let o=(e,t)=>h(i,e,t,{maxRefDepth:3}),s=z(t,a),c=
|
|
5
|
+
`);if(i===`graphql`){let e=typeof t==`string`?await B(t,a):void 0;return{slice:t=>h(i,e,t,{maxRefDepth:0}),readable:void 0}}let o=(e,t)=>h(i,e,t,{maxRefDepth:3}),s=z(t,a),c=d(s,e.specType,{warn:r});if(c===s)return{slice:e=>o(s,e),readable:s};let l=N(c);return{slice:(e,t)=>o(t?l:N(R(c,L(e,c))),e),readable:l}}function w(e,t){return e.length<=1e6?y(e,t).trimEnd():`${v(t)}\n\nThe subset is longer than ${b} characters, so it is not included.`}function T(e,n){if(n!==void 0)return`${e===`graphql`?t.graphql:t.bundle}/${n}`}async function E(e,t){let{parse:n,visit:r}=await import(`graphql`),i=n(e,{noLocation:!0}),a=new Set(i.definitions.map(e=>`name`in e?e.name?.value:``)),o=/* @__PURE__ */ new Set;r(i,{NamedType(e){o.add(e.name.value)}});let s=[...o].filter(e=>!a.has(e)&&t.has(e)).map(e=>`- [${e}](${t.get(e)}.md)`);return s.length===0?``:`Types:\n\n${s.join(`
|
|
6
6
|
`)}`}function D(t){let{info:n}=t,r=[`# ${t.title}`,t.description];typeof n.summary==`string`&&r.push(n.summary);let i=[];n.version!==void 0&&n.version!==``&&i.push(`Version: ${String(n.version)}`);let a=e(n.license)?n.license:void 0;typeof a?.name==`string`&&i.push(`License: ${a.name}`);let o=e(n[`x-metadata`])?n[`x-metadata`]:{},s=Object.entries(o).filter(([,e])=>typeof e==`string`||typeof e==`number`).filter(([e,t])=>e!==`description`||typeof t!=`string`).map(([e,t])=>`- ${e}: ${String(t)}`);s.length>0&&i.push(`Metadata:\n${s.join(`
|
|
7
7
|
`)}`),r.push(i.join(`
|
|
8
8
|
`));let c=e(t.readable)?t.readable:{},l=O[t.specType]??`API description`;return[r.filter(e=>e!==``).join(`
|
|
@@ -19,5 +19,5 @@ import{isObject as e}from"../../../../../shared/utils/is-object.js";import{headi
|
|
|
19
19
|
|
|
20
20
|
`);r&&(i+=`${r}\n\n`);for(let[e,t]of j)typeof a[t]==`string`&&a[t]&&(i+=`${e}: ${a[t]}\n`);let o=e(a.flows)?a.flows:{},s=[o.implicit,o.password,o.clientCredentials,o.authorizationCode].find(e);if(s!==void 0&&(typeof s.authorizationUrl==`string`&&(i+=`Authorization URL: ${s.authorizationUrl}\n`),typeof s.tokenUrl==`string`&&(i+=`Token URL: ${s.tokenUrl}\n`),e(s.scopes))){i+=`Scopes:
|
|
21
21
|
`;for(let[e,t]of Object.entries(s.scopes))i+=`- \`${e}\`: ${String(t)}\n`}i+=`
|
|
22
|
-
`}return i.trim()}const j=[[`Type`,`type`],[`In`,`in`],[`Name`,`name`],[`Scheme`,`scheme`],[`Bearer Format`,`bearerFormat`],[`OpenID Connect URL`,`openIdConnectUrl`]];function M(e,t,n){let r=``;for(let i of e)if(H(i)){if(i.content?.contentType===`group`){r+=`${t} ${i.label??``}\n\n`;let e=M(i.items??[],`${t}#`,n);e!==``&&(r+=`${e}\n\n`)}else if(i.content?.contentType===`item`&&typeof i.link==`string`){let e=_(n.specType,i.content,i.label),t=(e===void 0?void 0:g(e,n.document))??i.label??``,a=V(i.content.children??[],n.renderMarkdown).join(` `).replace(/\s+/g,` `).trim();r+=`- [${t}](${i.link}.md)${a?`: ${a.slice(0,200)}`:``}\n`}}return r.trim()}function N(e){return F(
|
|
23
|
-
`,1)[0]??``);if(!
|
|
22
|
+
`}return i.trim()}const j=[[`Type`,`type`],[`In`,`in`],[`Name`,`name`],[`Scheme`,`scheme`],[`Bearer Format`,`bearerFormat`],[`OpenID Connect URL`,`openIdConnectUrl`]];function M(e,t,n){let r=``;for(let i of e)if(H(i)){if(i.content?.contentType===`group`){r+=`${t} ${i.label??``}\n\n`;let e=M(i.items??[],`${t}#`,n);e!==``&&(r+=`${e}\n\n`)}else if(i.content?.contentType===`item`&&typeof i.link==`string`){let e=_(n.specType,i.content,i.label),t=(e===void 0?void 0:g(e,n.document))??i.label??``,a=V(i.content.children??[],n.renderMarkdown).join(` `).replace(/\s+/g,` `).trim();r+=`- [${t}](${i.link}.md)${a?`: ${a.slice(0,200)}`:``}\n`}}return r.trim()}function N(e){return F(s(e,[r]),e)}const P=Symbol(`removed`);function F(t,n){let r=/* @__PURE__ */ new Map,i=a=>{let o=r.get(a);if(o!==void 0)return o;let s=I(t,a),c=s===void 0?I(n,a)!==void 0:e(s)&&typeof s.$ref==`string`&&i(s.$ref);return r.set(a,c),c},a=t=>{if(Array.isArray(t))return t.map(a).filter(e=>e!==P);if(!e(t))return t;if(typeof t.$ref==`string`&&i(t.$ref))return P;let n={};for(let[e,r]of Object.entries(t)){let t=a(r);t!==P&&(n[e]=t)}return c(t,n)},o=a(t);return o===P?void 0:o}function I(t,n){if(!n.startsWith(`#/`))return;let r=t;for(let t of m.parse(n)){if(!(e(r)||Array.isArray(r))||!Object.hasOwn(r,t))return;r=r[t]}return r}function L(t,n){switch(t.kind){case`operation`:{let r=e(n)&&n[`x-webhooks`]?`x-webhooks`:`webhooks`;return[t.source===`webhooks`?r:`paths`,t.pathName,t.httpVerb]}case`schema`:return[`components`,`schemas`,t.name];case`channel`:return[`channels`,t.channelId];case`async-operation`:return[`operations`,t.operationId];default:return[]}}function R(t,n){let[r,...i]=n;if(r===void 0){if(!e(t))return t;let n={...t};return delete n[p],n}return!e(t)||!Object.hasOwn(t,r)?t:{...t,[r]:R(t[r],i)}}function z(t,n,r=!1){if(Array.isArray(t)){let e=t.map(e=>z(e,n));return e.some((e,n)=>e!==t[n])?e:t}if(!e(t))return t;let i;for(let[e,a]of Object.entries(t)){let o=(r||e===`description`||e===`summary`||e===`x-summary`)&&(typeof a==`string`?a.includes(`{%`):l(a))?n(a):z(a,n,e===`x-enumDescriptions`);o!==a&&((i??={...t})[e]=o)}return i??t}async function B(e,t){if(!e.includes(`{%`))return e;let{parse:n,print:r,visit:i}=await import(`graphql`);return r(i(n(e,{noLocation:!0}),{enter(e){let n=`description`in e?e.description:void 0;if(n?.value.includes(`{%`))return{...e,description:{...n,value:t(n.value)}}}}))}function V(e,t){let n=[],r=e=>{if(H(e)){if(e.nodeType===`markdoc`){n.push(...t(e.content));return}if(e.nodeType===`container`)for(let t of e.children??[])r(t)}};for(let t of e)r(t);return n}function H(e){let t=U(e);return t===void 0||i(o(t,[`anonymous`]))}function U(e){let t=e[p];if(t!==void 0)return a(t)?t:{}}function W(t){return e(t)&&t.type===`document`}function G(e){return n.reset(),e.map(e=>{let t=/^#{1,6} +(?! )(.+)$/.exec(e.split(`
|
|
23
|
+
`,1)[0]??``);if(!t)return null;let r=t[1].trim();return{heading:r,anchor:n.slug(r)}})}export{b as MAX_MARKDOWN_SLICE_LENGTH,x as buildApiDocsMarkdownCopies};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isPlanFeatureGranted as e}from"../../../../../shared/plan-gates.js";import{
|
|
1
|
+
import{isPlanFeatureGranted as e}from"../../../../../shared/plan-gates.js";import{withPathPrefix as t}from"../../../../../shared/path-prefix.js";import{isObject as n}from"../../../../../shared/utils/is-object.js";import{SPEC_DOWNLOAD_ROUTE_PATHS as r}from"./shared.js";import{isMissingError as i}from"../../../../../shared/utils/is-missing-error.js";import{toPosixPath as a}from"../../../../../shared/utils/to-posix-path.js";import{NESTED_CONFIG_FILENAME as o,deepMergeConfig as s,parseNestedConfig as c}from"../../../../config.js";import{contentIgnoreMatcherOf as l}from"../../../../ingest/scan.js";import{SPEC_KIND_GRAPHQL as u}from"../../../../../shared/constants/api-spec-kinds.js";import{MOCK_SERVER_ROUTE_PREFIX as d,mockPathPrefix as f}from"../../../types/api-entity.js";import{posix as p}from"node:path";import{decoratorTypes as m,preprocessorTypes as h}from"@redocly/config";import{FEEDBACK_TYPES as g}from"@redocly/theme/core/constants";const _=[`openapi`,`asyncapi`,`graphql`];function v(e,t,n){let r=O(t),i=Object.values(e.apis??{}),a=e=>O(p.join(n,e))===r;return i.find(e=>e.output!==void 0&&a(e.output))??i.find(e=>e.output===void 0&&a(e.root))}function y(e,t,n=``){let r=v(e,t,n);if(!r)return{};let i={};r.metadata&&(i.metadata=r.metadata);for(let e of _)r[e]&&typeof r[e]==`object`&&Object.assign(i,r[e]);return r.rbac!==void 0&&(i.rbac=r.rbac),i}async function b(e,t,n,r,i=n){let a=T(t,r),o=await w(e,i,l(t));return o===null?s(a,y(t,n)):s(s(a,E(o.config,r)),y(o.config,n,o.dir))}const x=[...m,...h];async function S(e,t,r,i=r){let a=await w(e,i,l(t)),o=a===null?[t,v(t,r,``)]:[t,a.config,v(a.config,r,a.dir)],c={};for(let e of o){if(!n(e))continue;let t={};for(let r of x)n(e[r])&&(t[r]=e[r]);c=s(c,t)}return{config:c,configDir:a?.dir??``}}async function C(e,t,n){return(await w(e,n,l(t)))?.config.feedback}async function w(e,t,n){for(let r=p.dirname(t);r!==`.`&&r!==`/`;r=p.dirname(r)){let t=p.join(r,o);if(n(t))continue;let i=await D(e,t);if(i!==null)return{config:i,dir:r}}return null}function T(e,t){return t===`arazzo`||t===`grpc`?{}:e[t]??{}}function E(e,t){let n={...T(e,t)};return e.mockServer&&(n.mockServer=e.mockServer),n}async function D(e,t){let n;try{n=await e.readFile(t)}catch(e){if(i(e))return null;throw e}return c(n,t).config}function O(e){return p.normalize(a(e)).replace(/^\.\/+/,``).replace(/^\/+/,``)}function k(r,i,a){let o=n(r.mockServer)?r.mockServer:{},s={...i.mockServer,...o};if(a===void 0||s.off===!0||!e(i,`mockServer`))return r;let c=t(d+f(a));return{...r,mockServer:{url:c,position:`first`,description:`Mock server`,...s}}}function A(e,n,i){if(i===`grpc`)return e;let a=e=>e.split(`/`).map(encodeURIComponent).join(`/`),o=i===u,s=o?r.graphql:r.bundle,c=(o?[n]:[`.json`,`.yaml`].map(e=>n.replace(/\.[^./]+$/u,e))).map(e=>({url:t(`${s}/${a(e)}?download`),title:p.basename(e)}));return{...e,downloadUrls:Array.isArray(e.downloadUrls)?e.downloadUrls:c,replayDefinitionUrl:c[0]?.url}}function j(e){return t(`${r.bundle}/${e}`)}const M={[g.RATING]:`Rate this section`,[g.SENTIMENT]:`Was this section helpful?`,[g.MOOD]:`Was this section helpful?`,[g.COMMENT]:`Share your feedback about this section`,[g.SCALE]:`How would you rate this section?`};function N(e,t,r){let i=[n(t)?t[`x-feedback`]:void 0,e.feedback,r].find(n);if(i===void 0)return e;let a=n(i.settings)?i.settings:{},o=typeof i.type==`string`?M[i.type]:void 0,s=a.label||o||``;return{...e,feedback:{...i,settings:{...a,label:s}}}}export{y as readApiOptionsFromConfig,S as resolveApiBundleConfig,b as resolveApiOptions,C as resolveNestedFeedback,j as schemaCatalogLink,A as withDownloadUrls,N as withFeedbackOption,k as withMockServerOption};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{SEARCH_HTTP_METHOD_FACET_FIELD as e,SEARCH_HTTP_PATH_FACET_FIELD as t}from"../../../../../shared/search/facets.js";import{isRbacScope as n}from"../../../../../shared/rbac/engine.js";import{
|
|
1
|
+
import{SEARCH_HTTP_METHOD_FACET_FIELD as e,SEARCH_HTTP_PATH_FACET_FIELD as t}from"../../../../../shared/search/facets.js";import{isRbacScope as n}from"../../../../../shared/rbac/engine.js";import{markdocAstToText as r}from"../../../../markdown/search/to-text.js";import{parseMarkdownCached as i}from"../../../../markdown/utils/parse-cache.js";import{annotateApiDocsRbac as a}from"../../../../../shared/rbac/api-docs.js";import{withImpliedDiscriminatorMappings as o}from"./implied-discriminators.js";import{createHash as s}from"node:crypto";import{REDOCLY_TEAMS_RBAC as c}from"@redocly/config";import{ApiDocsSearchIndexer as l,extractFullText as u,isOperationName as d}from"@redocly/api-docs/server";const f=`API Reference`;function p(e,t,n={}){let r=b(e.store)?e.store:{},i=a(t,e.specType,{warn:n.warn??(()=>{})}),s=o(i),c=new l(e.basePath,r.schemaStore,b(s)?s:void 0,{exampleStore:r.exampleStore,graphqlMeta:r.graphqlMeta,formatDescription:m}),u=e=>{for(let t of e)c.addItem(t),b(t)&&Array.isArray(t.items)&&u(t.items)};u(e.items);let d=[],f=/* @__PURE__ */ new Set,p=[],y=h(t),x=/* @__PURE__ */ new Map;return{docs:c.getResult().map(t=>{let r=(x.get(t.id)??0)+1;x.set(t.id,r);let i=r===1?t.id:`${t.id}#${r}`;for(let e of t.parameters??[]){let t=_(e),n=t.fragmentKey;f.has(n)||(f.add(n),d.push(t));let r={docKey:i,fragmentKey:n,place:e.place,anchor:v(e.deepLink)};e.path&&e.path.length>0&&(r.path=e.path),p.push(r)}let a=g(t,i,n);return y&&t.url===e.basePath&&(a.title=y),a}),fragments:d,uses:p}}const m=e=>typeof e==`string`&&e.includes(`{%`)?r(i(e)).replace(/\s+/g,` `):u(e);function h(e){let t=b(e)&&b(e.info)?e.info:{};if(typeof t.title!=`string`||t.title===``)return;let n=t.version;return typeof n==`string`&&n!==``||typeof n==`number`?`${t.title} (${n})`:t.title}function g(r,i,a){let o=r.httpPath?y(r.httpPath):void 0,s={...a.facets},l=r.isAdditionalOperation?r.httpMethod:r.httpMethod&&d(r.httpMethod)?r.httpMethod.toLowerCase():void 0;l&&(s[e]=l,o&&(s[t]=o));let u={docKey:i,routeSlug:r.url,title:y(r.title),text:y(r.text),groupKey:a.groupKey??`API Reference`,facets:s},f=r[c];return n(f)&&(u.rbacScope=f),r.httpMethod&&(u.httpMethod=r.httpMethod),o&&(u.httpPath=o),r.deprecated&&(u.deprecated=!0),r.isAdditionalOperation&&(u.isAdditionalOperation=!0),r.badges&&r.badges.length>0&&(u.badges=r.badges),u}function _(e){let t={name:y(e.name),description:y(e.description)};return e.example&&(t.example=e.example),e.enum&&e.enum.length>0&&(t.enum=e.enum),{fragmentKey:s(`sha1`).update(JSON.stringify([t.name,t.description,t.example??null,t.enum??null])).digest(`hex`),...t}}function v(e){if(!e)return``;let t=e.indexOf(`#`);return t>=0?e.slice(t+1):e}function y(e){return Array.isArray(e)?e.join(` `):e}function b(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}export{f as API_DOCS_SEARCH_GROUP,p as buildApiDocsSearchDocuments};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{EntityAccessDeniedError as e,notFoundResponse as t}from"../../../../../server/plugin-context.js";import{attachmentDisposition as n}from"../../../../../shared/utils/attachment-disposition.js";import{filePathToRouteSlug as r}from"../../../../../shared/utils/routes/file-path-to-route-slug.js";import"../../../../../shared/constants/api-spec-kinds.js";import{createApiEntityKey as i}from"../../../utils/api-entity-key.js";import{filterApiDocsByRbac as a}from"../../../../../shared/rbac/api-docs.js";import{SPEC_DOWNLOAD_HANDLER_ID as o,withMockServerEvent as s}from"../../../../../server/telemetry/mock-server-events.js";import{posix as c}from"node:path";import l from"js-yaml";const u={"Cache-Control":`no-store`};function d(e){return e.replace(/\.[^./]+$/u,``)}async function f(e,t,n){let r=d(t);return(await e.entities.list({type:`api`})).find(({metadata:e})=>{let{sourcePath:t,specType:i}=e??{};return typeof t==`string`&&d(t)===r&&i!==`grpc`&&i===`graphql`===n})??null}async function p(n,a){let o=r(a);return await n.hasRoute(o)&&!n.isSlugVisible(o)?new e(i(a),n.request.teams).getResponse():t()}function m(e,t,r,i,a){let o=new URL(t.request.url).searchParams.has(`download`);return e.body(r,200,{...u,"Content-Type":i,...o?{"Content-Disposition":n(a)}:{}})}function h(e,t,n){return s({handler:o,request:e.req.raw,logger:t.logger},n)}function g(e,t){return h(e,t,()=>v(e,t))}function _(e,t){return h(e,t,()=>y(e,t))}async function v(e,t){let n=e.req.param(`api`)??``,r=await f(t,n,!1);if(!r)return p(t,n);let i=a(await t.entities.load(r.key),r.metadata?.specType,t.request.teams,{warn:e=>t.logger?.warn(e)}),o=/\.ya?ml$/u.test(n),s=d(c.basename(String(r.metadata?.sourcePath)))+(o?`.yaml`:`.json`);return o?m(e,t,l.dump(i,{noRefs:!0}),`application/yaml`,s):m(e,t,JSON.stringify(i,null,2),`application/json`,s)}async function y(e,t){let n=e.req.param(`api`)??``,r=await f(t,n,!0);if(!r)return p(t,n);let i=await t.entities.load(r.key),a=String(r.metadata?.sourcePath);return m(e,t,i,`application/graphql`,c.basename(a))}export{g as bundle,_ as graphql};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{stripPathPrefix as e}from"../../../../../shared/path-prefix.js";import{API_FUNCTION_ENTITY_TYPE as t}from"../constants.js";import{errorMessage as n}from"../../../../../shared/utils/error-message.js";import{isSubprocessError as r}from"../../../../../server/subprocess/runner.js";import{compareApiFunctionRoutes as i}from"../route-path.js";import{resolveApiFunctionAccess as a,resolveRbacMatcher as o}from"./access.js";import{sendApiFunctionEvent as s}from"./api-function-telemetry.js";import{BodyTooLargeError as c,MAX_REQUEST_BODY_BYTES as l,MAX_RESPONSE_BODY_BYTES as u,deserializeResponse as d,serializeRequest as f}from"./serialize.js";import{invoke as p}from"./invoke.js";import{fileURLToPath as m}from"node:url";import{getCookie as h}from"hono/cookie";import{TrieRouter as g}from"hono/router/trie-router";import{getPath as _,tryDecodeURIComponent as v}from"hono/utils/url";const y=1048576,b=m(import.meta.url);function x(e){let{method:t,honoPath:n,sourcePath:r}=e.metadata??{};return typeof t==`string`&&typeof n==`string`&&typeof r==`string`?{method:t,honoPath:n,sourcePath:r}:null}const S=/* @__PURE__ */ new WeakMap;function C(e){let t=S.get(e);if(!t){t=new g;let n=e.map(x).filter(e=>e!==null);for(let e of n.sort(i))t.add(e.method,e.honoPath,e);S.set(e,t)}return t}function w(e,t,n){let r=C(e),i=t.toUpperCase(),[[a]]=r.match(i===`HEAD`?`GET`:i,n);if(!a)return null;let[o,s]=a,c=Object.fromEntries(Object.entries(s).map(([e,t])=>{let n=v(t);return[e,o.honoPath.includes(`:${e}{.+}`)?n.split(`/`).filter(Boolean):n]}));return{sourcePath:o.sourcePath,params:c}}function T(e){let t={};for(let n of new Set(e.searchParams.keys())){let r=e.searchParams.getAll(n);t[n]=r.length===1?r[0]:r}return t}const E=1048576,D=`Request body size exceeded limit of ${l/E} MB.`,O=`Response size exceeded limit of ${u/E}MB`,k=1e4,A=`Promise timed out after ${k} ms`;function j(e,t){return Response.json({message:t},{status:e,headers:{"Cache-Control":`no-store`}})}function M(e,t){switch(e){case`timeout`:return N(504,`Timeout exceeded`,A);case`input-too-large`:return N(413,D);case`output-too-large`:case`response-too-large`:return N(500,O);default:return N(500,import.meta.env.DEV?t:`Internal server error`,t)}}function N(e,t,n=t){return{response:j(e,t),failure:n}}async function P(r,i,c){let l=e(_(r.req.raw));if(l===null)return i();let u=new URL(c.request.url),d=w(await c.entities.list({type:t}),c.request.method,l);if(!d)return i();r.set(`realmApiFunctionResponder`,`runtime`);let f=o(c.config);if(f){let e=a(f,{sourcePath:d.sourcePath,pathname:l,teams:c.request.teams});if(!e.allow)return j(e.status,e.status===401?`Unauthorized`:`Forbidden`)}let{subprocess:p}=c;if(!p)return j(501,`API functions do not run on this host.`);let m=(e,t)=>s({sourcePath:d.sourcePath,status:e,failure:t},{logger:c.logger}),h;try{h=await F(r,c,p,d,u)}catch(e){throw m(500,n(e)),e}return m(h.response.status,h.failure),h.response}async function F(e,t,n,i,a){let o;try{o={modulePath:n.resolveContentModule(i.sourcePath),request:await f(e.req.raw,l),params:i.params,query:T(a),cookies:h(e),user:{teams:t.request.teams,claims:{...t.request.viewer},email:t.request.viewer?.email,idpAccessToken:void 0,idpId:void 0,isAuthenticated:t.request.viewer?.isAuthenticated??!1},config:t.config,baseUrl:a.origin}}catch(e){if(e instanceof c)return M(`input-too-large`,e.message);throw e}let s;try{s=await n.run({modulePath:b,exportName:`invoke`,input:o,reuse:!import.meta.env.DEV,timeoutMs:k,maxInputBytes:Math.ceil(4/3*l)+y,maxOutputBytes:Math.ceil(4/3*u)+y})}catch(n){if(!r(n))throw n;return n.code===`output-too-large`&&e.set(`realmApiFunctionResponder`,`project`),t.logger?.error(`API function ${i.sourcePath} failed (${n.code}): ${n.message}`),M(n.code,n.message)}if(e.set(`realmApiFunctionResponder`,`project`),!s.ok)return t.logger?.error(`API function ${i.sourcePath} failed (${s.code}): ${s.stack??s.message}`),M(s.code,s.message);let p=d(s.response);return p.headers.has(`cache-control`)||p.headers.set(`Cache-Control`,`no-store`),{response:p}}export{P as dispatch,p as invoke,w as matchApiFunction};
|
|
@@ -5,7 +5,7 @@ import type { SystemEntityDescriptor } from '../../../database/finalize';
|
|
|
5
5
|
import type { RouteAccess } from '../../utils/route-index.js';
|
|
6
6
|
export { APP_DATA_STATIC_DATA_SLUG } from '../../../../shared/constants/app-data';
|
|
7
7
|
export declare const APP_DATA_PLUGIN_ID = "internal.app-data";
|
|
8
|
-
export declare const APP_DATA_PLUGIN_VERSION = "1.
|
|
8
|
+
export declare const APP_DATA_PLUGIN_VERSION = "1.35.0";
|
|
9
9
|
export declare const APP_DATA_STATIC_DATA_LOADER_ID: "internal.app-data:app-data";
|
|
10
10
|
export type AppDataFragment = {
|
|
11
11
|
owner: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineContentPlugin as e}from"../../define.js";import{toJsonObject as t,toJsonValue as n}from"../../../database/utils/json.js";import{createEntityLoader as r}from"../../../loaders/define.js";import{createPluginScopedId as i}from"../../utils/scoped-id.js";import{buildSearchAppData as a}from"../../../../shared/search/facets.js";import{isAttributionRemoved as o,isPlanFeatureGranted as s}from"../../../../shared/plan-gates.js";import{
|
|
1
|
+
import{defineContentPlugin as e}from"../../define.js";import{toJsonObject as t,toJsonValue as n}from"../../../database/utils/json.js";import{createEntityLoader as r}from"../../../loaders/define.js";import{createPluginScopedId as i}from"../../utils/scoped-id.js";import{buildSearchAppData as a}from"../../../../shared/search/facets.js";import{isAttributionRemoved as o,isPlanFeatureGranted as s}from"../../../../shared/plan-gates.js";import{APP_DATA_STATIC_DATA_SLUG as c}from"../../../../shared/constants/app-data.js";import{isObject as l}from"../../../../shared/utils/is-object.js";import{splitUrlSuffix as u}from"../../../../shared/utils/routes/split-url-suffix.js";import{toNavItemRbacAnnotation as d}from"../../../../shared/rbac/filter.js";import{resolvePageTarget as f}from"../../../../shared/utils/routes/resolve-page-target.js";import{linkedPageAccess as p}from"../../utils/link-access.js";import{collectVersionGroups as m,findVersionedDirectories as h}from"../../../versions/version-groups.js";import{publicLink as g}from"../../../versions/public-link.js";import{isAiHidden as _}from"../../../../shared/ask-ai/config-gate.js";import{listConfiguredProducts as ee}from"../../../products.js";import{loadSidebarSubtreeLabel as v}from"../../utils/sidebar-label.js";import{resolveBannerForAppData as y}from"./banner.js";import{resolveLogoForAppData as te}from"./logo.js";import{resolveNavbarIconsForAppData as b}from"./navbar-icons.js";import{resolveHtmlForAppData as x}from"./html.js";import{resolveSeoForAppData as S}from"./seo.js";import{productConfigPath as C,productLandingLink as w,readProductConfig as T,resolveProductAssetsForAppData as E}from"./products.js";import{dirname as D,resolve as O}from"node:path";import{REDOCLY_TEAMS_RBAC as k}from"@redocly/config";const A=`internal.app-data`,j=`1.35.0`,M=i(A,`app-data`);function N(e){return l(e)&&typeof e.owner==`string`&&`value`in e}const P=r(M,async e=>{let n=new Set(e.pluginRegistry.listFinalizePlugins().map(e=>e.id)),r={};for(let[t,i]of Object.entries(e.args.fragments??{}))N(i)&&n.has(i.owner)&&(r[t]=i.value);let i=await te(e.config.logo,e.markdown,e.file.path);if(Object.keys(i.logo).length>0){let e=l(r.theme)?r.theme:{};r.theme=t({...e,logo:i.logo})}let a=await y(e.config.banner,e);if(a){let e=l(r.theme)?r.theme:{};r.theme=t({...e,banner:a.banner})}let o=await b(l(r.theme)?r.theme.navbar:void 0,e.markdown,e.file.path);if(o){let e=l(r.theme)?r.theme:{};r.theme=t({...e,navbar:o.navbar})}let s=await b(l(r.theme)?r.theme.footer:void 0,e.markdown,e.file.path);if(s){let e=l(r.theme)?r.theme:{};r.theme=t({...e,footer:s.navbar})}let c=await E(l(r.theme)?r.theme.products:void 0,e.markdown,e.file.path);if(c){let e=l(r.theme)?r.theme:{};r.theme=t({...e,products:c.products})}let u=await x(e.config,e.markdown,e.file.path,t=>e.io.readFile(O(D(e.file.absolutePath),t)),e.logger);u&&(r.html=t(u.html));let d=await S(r.seo,e.markdown,e.file.path);d&&(r.seo=d.seo);let f=[i,a,o,s,c,u,d];return{value:r,entityDeps:f.flatMap(e=>e?.deps??[]),assetUsages:f.flatMap(e=>e?.assetUsages??[])}});function F(e){return{isSystem:!0,key:c,kind:`loader`,type:null,metadata:null,loaderArgs:{pluginVersion:j},loaderId:M,pluginId:A,shouldInvalidateValue:!1,value:null,version:null,fragmentUpdates:e.fragmentUpdates}}const I=e({id:A,version:j,async finalize(e){let r=await m({io:e.io,routes:e.routes,versionedDirectories:h(e.routes.all())}),i=e=>e&&g(e,r),a=t=>t&&{slug:g(t,r),loadLabel:()=>v(e.entities,t)},o=t=>a(e.routes.byFilePath(t)),s=t=>a(e.routes.bySlug(t)),c=t=>p(t,e.routes,r),u=await V(e.config,o,s,e.logger,c),d=await R(e,o,s,i,c);if(Object.keys(d).length>0){let e=l(u.theme)?u.theme:{};u.theme=t({...e,products:d}),u.pageProducts=n(Object.values(d).map(L))}return{appData:u}},loaders:[P]});function L(e){let{name:t,slug:n,configOverride:r}=e,i={name:t,slug:n},a=r?.analytics?.ga;return a&&(i.ga=a),i}async function R(e,n,r,i,o){let s={};for(let t of ee(e.config)){let c=await w(t,e.routes,e.io,i);if(c===void 0){e.logger.warn(`Product "${t.id}" is left out of the product picker: "${t.folder}" has no page.`);continue}let l={name:t.name,folder:t.folder,slug:t.slug,link:c,[k]:o(c)??void 0};t.icon!==void 0&&(l.icon=t.icon);let u=C(t.folder),d=await e.io.exists(u)?await z(T(await e.io.readFile(u),u),{page:Q(n,r,u,e.logger),access:o},a(e.config),e.config):{};Object.keys(d).length>0&&(l.configOverride=d),s[t.id]=l}return t(s)}async function z(e,t,n,r){let i={},a=await K(e.navbar,t),o=await G(e.footer,t),c=W(e.breadcrumbs,t);return e.logo&&(i.logo=e.logo),a&&(i.navbar=a),o&&(i.footer=o),c&&s(r,`breadcrumbs`)&&(i.breadcrumbs=c),e.feedback&&(i.feedback=e.feedback),e.sidebar&&(i.sidebar=e.sidebar),e.codeSnippet&&(i.codeSnippet=e.codeSnippet),e.palette&&(i.palette=e.palette),e.search&&(i.search=await B(e.search,n,t)),e.analytics?.ga&&s(r,`analytics`)&&(i.analytics={ga:e.analytics.ga}),i}async function B(e,n,r){let i={...n},a=await q(e?.suggestedPages,r);return e?.hide!==void 0&&(i.hide=e.hide),e?.placement!==void 0&&(i.placement=e.placement),e?.shortcuts!==void 0&&(i.shortcuts=e.shortcuts),a.length>0&&(i.suggestedPages=a),t(i)}async function V(e,n,r,i,s=()=>void 0){let c={},l={page:Q(n,r,ie,i),access:s},u=await K(e.navbar,l),d=await G(e.footer,l),f=e.seo?.projectTitle,p=W(e.breadcrumbs,l),m={...u?{navbar:u}:{},...d?{footer:d}:{},...p?{breadcrumbs:p}:{},markdown:e.markdown,navigation:e.navigation,userMenu:await X(e.userMenu,l),feedback:e.feedback,consent:e.consent,...f?{seo:{projectTitle:f}}:{},aiAssistant:H(e),mcp:U(e),search:await B(e.search,a(e),l),sidebar:e.sidebar,versionPicker:e.versionPicker,codeSnippet:e.codeSnippet,palette:e.palette};if(e.colorMode&&(m.colorMode=e.colorMode),Object.keys(m).length>0&&(c.theme=m),e.analytics&&(c.analytics=e.analytics),e.planGates&&(c.removeAttribution=o(e)),e.removeAttribution===!0&&(c.removeConsoleAttribution=!0),e.seo){let{projectTitle:t,llmstxt:n,...r}=e.seo;Object.keys(r).length>0&&(c.seo=r)}return t(c)}function H(e){let t=_(e),n=e.aiAssistant?.trigger;return{...e.aiAssistant,hide:t,trigger:{...n,hide:n?.hide??t}}}function U(e){let t=e.mcp?.hide===!0;return{hide:t,docs:{hide:t}}}function W(e,n){if(!e)return null;let r={};e.hide!==void 0&&(r.hide=e.hide);let i=(e.prefixItems??[]).map(e=>{let t=e.page?n.page(e.page)?.link:void 0;return{icon:$(e.icon),label:$(e.label)??``,labelTranslationKey:$(e.labelTranslationKey),link:t,[k]:Y(n,t)}});return i.length>0&&(r.prefixItems=i),Object.keys(r).length>0?t(r):null}async function G(e,n){if(!e)return null;let r={hide:e.hide===!0},i=await q(e.items,n);return e.copyrightText!==void 0&&(r.copyrightText=e.copyrightText),e.logo&&(r.logo=e.logo),i.length>0&&(r.items=i),t(r)}async function K(e,n){if(!e)return null;let r={},i=await q(e.items,n);return e.hide!==void 0&&(r.hide=e.hide),i.length>0&&(r.items=i),Object.keys(r).length>0?t(r):null}async function q(e,t){return Array.isArray(e)?(await Promise.all(e.map(e=>J(e,t)))).filter(e=>e!==null):[]}async function J(e,n){if(typeof e==`string`)return J({page:e},n);if(!l(e))return null;if(typeof e.separator==`string`)return t({...Z(e),label:e.separator,type:`separator`});let r=await q(e.items,n),i=re(e,n.page),a=i?.link,o=e.rbac===void 0?Y(n,a):void 0,s=$(e.label)??$(e.group)??(i?i.anchor??await i.loadLabel?.()??i.link:``);return typeof e.group==`string`||r.length>0?t({...Z(e),...a?{link:a}:{},...r.length>0?{items:r}:{},label:s,labelTranslationKey:$(e.groupTranslationKey)??$(e.labelTranslationKey),type:`group`,[k]:o}):a?t({...Z(e),external:oe(e.external),label:s,link:a,type:`link`,[k]:o}):null}function Y(e,t){return t===void 0?void 0:e.access(t)??void 0}async function X(e,n){if(!e)return;let r=[];for(let t of e.items??[])r.push({...t,href:t.link});let i=await q(r,n);return t({...e,menu:i.length>0?i:void 0})}function Z(e){let t=ae(e,[`additionalProps`,`expanded`,`labelTranslationKey`,`languageInsensitive`,`linePosition`,`linkedSidebars`,`menuStyle`,`selectFirstItemOnExpand`,`separatorLine`,`target`,`version`]),n=ne(e.icon);return n.icon&&(t.icon=n.icon),n.srcSet&&(t.srcSet=n.srcSet),{...t,...d(e.rbac)}}function ne(e){return typeof e==`string`?{icon:e}:l(e)&&typeof e.srcSet==`string`?{srcSet:e.srcSet}:{}}function re(e,t){return typeof e.href==`string`&&e.href.trim()!==``?{link:e.href.trim()}:typeof e.page==`string`&&e.page.trim()!==``?t(e.page):null}const ie=`redocly.yaml`;function Q(e,t,n,r){let i={bySlug:e=>t?.(e),byFilePath:t=>e?.(t)};return e=>{let{path:t,suffix:a,anchor:o}=u(e.trim()),s=f(t,n,i);return s.kind===`escaped`?(r?.warn(`Config page reference escapes the content root`,{page:e}),null):s.kind===`missing`?(r?.warn(`Config page has no matching route`,{page:e}),{link:e.trim()}):{link:`${s.value.slug}${a}`,anchor:o,loadLabel:s.value.loadLabel}}}function ae(e,t){let n={};for(let r of t)e[r]!==void 0&&(n[r]=e[r]);return n}function $(e){return typeof e==`string`&&e.trim()!==``?e:void 0}function oe(e){return typeof e==`boolean`?e:void 0}export{A as APP_DATA_PLUGIN_ID,j as APP_DATA_PLUGIN_VERSION,M as APP_DATA_STATIC_DATA_LOADER_ID,c as APP_DATA_STATIC_DATA_SLUG,I as appDataContentPlugin,F as appDataSystemEntityDescriptor,V as buildConfigAppData,N as isAppDataFragment};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{joinSrcSet as e,parseSrcSet as t}from"../assets/srcset.js";import{resolveContentPath as n}from"../../../../shared/utils/resolve-content-path.js";import{isLocalImagePath as r}from"../assets/extensions.js";import{safeDecodeURI as i}from"../../../../shared/utils/safe-decode-uri.js";const a=[`favicon.png`,`favicon.svg`,`favicon.ico`];async function o(e={},t,n){let r={},i=[],o=[];if(e.image!==void 0){let[a,c,l]=await s(e.image,t,n);r.image=a,i.push(...c),o.push(...l)}if(e.srcSet!==void 0){let[a,s,l]=await c(e.srcSet,t,n);r.srcSet=a,i.push(...s),o.push(...l)}if(e.favicon!==void 0){let[a,c,l]=await s(e.favicon,t,n);r.favicon=a,i.push(...c),o.push(...l)}else for(let e of a){i.push({kind:`file`,path:e});let n=await t.resolveImageReference(`/${e}`,``);if(n.result.kind===`assetRef`){r.favicon=n.result.url,o.push(...n.assetUsages);break}}return e.altText!==void 0&&(r.altText=e.altText),e.link!==void 0&&(r.link=e.link),{logo:r,deps:i,assetUsages:o}}async function s(e,t,a){let o=r(e)?n(e,a):null;if(o===null)return[e,[],[]];let{result:s,entityDeps:c,assetUsages:l}=await t.resolveImageReference(o,``);return s.kind===`assetRef`?[s.url,c,l]:[`/${o}`,[{kind:`file`,path:i(o)}],[]]}async function c(n,r,i){let a=t(n);if(a===null||a.length===0)return[n,[],[]];let o=[],c=[],l=await Promise.all(a.map(async e=>{let[t,n,a]=await s(e.src,r,i);return o.push(...n),c.push(...a),{src:t,descriptor:e.descriptor}}));return[e(l),o,c]}export{s as resolveConfigImagePath,c as resolveConfigImageSrcSet,o as resolveLogoForAppData};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{toJsonObject as e}from"../../../database/utils/json.js";import{isObject as t}from"../../../../shared/utils/is-object.js";import{resolveContentPath as n}from"../../../../shared/utils/resolve-content-path.js";import{
|
|
1
|
+
import{toJsonObject as e}from"../../../database/utils/json.js";import{isObject as t}from"../../../../shared/utils/is-object.js";import{resolveContentPath as n}from"../../../../shared/utils/resolve-content-path.js";import{SIDEBAR_FILENAME_REGEX as r}from"../sidebar/index.js";import{parseNestedConfig as i}from"../../../config.js";import{PRODUCT_CONFIG_FILENAME as a,isInFolder as o}from"../../../products.js";import{resolveConfigImagePath as s,resolveConfigImageSrcSet as c}from"./logo.js";import{resolveNavbarIconsForAppData as l}from"./navbar-icons.js";import u from"js-yaml";function d(e){return e===``?a:`${e}/${a}`}function f(e,t){try{return i(e,t).config}catch{return{}}}async function p(e,i,a,s){let c=i.bySlug(e.slug===`/`?`/`:e.slug.slice(0,-1));if(c?.originFilePath&&o(c.originFilePath,e.folder))return s(c);let[l]=(await a.glob(e.folder===``?`**`:`${e.folder}/**`)).filter(e=>r.test(e)).sort((e,t)=>e.split(`/`).length-t.split(`/`).length||e.localeCompare(t));if(l){let e=d(m(await a.readFile(l)),l);if(e!==void 0)return e}let[u]=i.inDirectory(e.folder);return u?s(u):void 0;function d(e,n){if(Array.isArray(e))for(let r of e){if(!t(r))continue;let e=f(r,n),i=e?s(e):void 0;if(i!==void 0)return i;if(typeof r.href==`string`&&r.href.trim()!==``)return r.href.trim();let a=d(r.items,n);if(a!==void 0)return a}}function f(e,t){if(typeof e.page==`string`){let r=n(e.page,t);return r===null?void 0:i.byFilePath(r)}if(typeof e.directory==`string`){let r=n(e.directory,t);return r===null?void 0:i.inDirectory(r)[0]}}}function m(e){try{return u.load(e)}catch{return}}async function h(n,r,i){if(!t(n))return null;let a=[],o=[],u={};for(let[e,f]of Object.entries(n)){if(!t(f)||typeof f.folder!=`string`)continue;let n={...f};if(typeof f.icon==`string`){let[e,t,c]=await s(f.icon,r,i);n.icon=e,a.push(...t),o.push(...c)}if(t(f.configOverride)){let e={...f.configOverride},i=d(f.folder);if(t(e.logo)){let{favicon:t,...n}=e.logo;if(typeof n.image==`string`){let[e,t,c]=await s(n.image,r,i);n.image=e,a.push(...t),o.push(...c)}if(typeof n.srcSet==`string`){let[e,t,s]=await c(n.srcSet,r,i);n.srcSet=e,a.push(...t),o.push(...s)}Object.keys(n).length>0?e.logo=n:delete e.logo}for(let t of[`navbar`,`footer`]){let n=await l(e[t],r,i);n&&(e[t]=n.navbar,a.push(...n.deps),o.push(...n.assetUsages))}n.configOverride=e}u[e]=n}return{products:e(u),deps:a,assetUsages:o}}export{d as productConfigPath,p as productLandingLink,f as readProductConfig,h as resolveProductAssetsForAppData};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineContentPlugin as e}from"../../define.js";import{createInlineEntity as t}from"../../../loaders/define.js";import{buildContentAssetUrl as n}from"./url.js";import{
|
|
1
|
+
import{defineContentPlugin as e}from"../../define.js";import{createInlineEntity as t}from"../../../loaders/define.js";import{buildContentAssetUrl as n}from"./url.js";import{IMAGE_EXTENSIONS as r}from"./extensions.js";import{getContentType as i}from"../../../../shared/mime.js";const a=`internal.assets`,o=`asset:`,s=e({id:a,version:`1.1.0`,content:{filter:{extensions:[...r]},extractFile(e){let r={kind:`image`,originalPath:e.path,hash:e.hash,url:n(e.path,e.hash),mimeType:i(e.path)};return{routes:[],entities:[t(r,{stableKey:`${o}${e.path}`})]}}}});export{a as ASSETS_PLUGIN_ID,o as ASSET_ENTITY_KEY_PREFIX,s as assetsContentPlugin};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{LoaderDataContext as e}from"../../../../../client/contexts.js";import{telemetry as t}from"../../../../../client/telemetry/telemetry.js";import{CATALOG_CLASSIC_DEP_KEY as n}from"./contract.js";import{readSelectionsFromSearch as r,readTermFromSearch as i,resolveCatalog as a,selectFilterOption as o,toCatalogItems as s,toggleFilterOption as c,writeSelectionsToSearch as l}from"./catalog-filtering.js";import*as u from"react";import{useLocation as d,useNavigate as f}from"react-router";import{getBaseDataAttributes as p}from"@redocly/theme/core/utils";const m=[];function h(e){t.sendCatalogFilterChangedMessage([{...p(`catalogFilter`,`field`),type:e}])}function g(t){let p=d(),g=f(),_=u.useContext(e)[n],v=t.filters??m,[y,b]=u.useState(()=>r(p.search,v)),[x,S]=u.useState(()=>i(p.search)),C=u.useCallback(e=>{S(e),h(`term`)},[]),w=u.useMemo(()=>s(_?.items??[]),[_]);u.useEffect(()=>{let e=l(p.search,v,y,x);e!==p.search.replace(/^\?/,``)&&g({search:e},{replace:!0})},[v,x,p.search,g,y]);let T=u.useMemo(()=>a({filters:v,groupByFirstFilter:t.groupByFirstFilter,items:w,selections:y,term:x}),[t.groupByFirstFilter,v,x,w,y]);return u.useMemo(()=>({groups:T.groups,filters:T.filters.map((e,t)=>({...e,toggleOption:e=>{b(n=>c(n,t,e)),h(`toggle`),window.scrollTo(0,0)},selectOption:e=>{b(n=>o(n,v,t,e)),h(`select`),window.scrollTo(0,0)}})),filterTerm:x,setFilterTerm:C}),[C,v,x,T])}export{g as useCatalogClassic};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineContentPlugin as e}from"../../define.js";import{createEntityLoader as t}from"../../../loaders/define.js";import{runtimeFile as n}from"../../utils/runtime-file.js";import{createServerFn as r}from"../../server-fn.js";import{createPluginScopedId as i}from"../../utils/scoped-id.js";import{runtimeTemplate as a}from"../../templates.js";import{normalizeRouteSlug as o}from"../../../../shared/utils/routes/normalize-route-slug.js";import{
|
|
1
|
+
import{defineContentPlugin as e}from"../../define.js";import{createEntityLoader as t}from"../../../loaders/define.js";import{runtimeFile as n}from"../../utils/runtime-file.js";import{createServerFn as r}from"../../server-fn.js";import{createPluginScopedId as i}from"../../utils/scoped-id.js";import{runtimeTemplate as a}from"../../templates.js";import{normalizeRouteSlug as o}from"../../../../shared/utils/routes/normalize-route-slug.js";import{CATALOG_CLASSIC_DEP_KEY as s}from"./client/contract.js";import{SIDEBAR_CONTRIBUTIONS_ENTITY_TYPE as c}from"../sidebar/contributions.js";import{catalogEntityKey as l}from"./entity-key.js";import{buildCatalogCards as u,loadVersionGroups as d,pickDefaultVersions as f,resolveCatalogMembers as p}from"./resolve-items.js";import{catalogSidebarContributions as m}from"./sidebars.js";const h=`internal.catalog-classic`,g=`catalog-classic`,_=i(h,`catalog`),v=i(h,`sidebars`),y=i(h,`deliver`),b=t(_,async e=>{let t=p(e.args.items,e),{versionGroups:n,entityDeps:r}=await d(t,e),i=e.args.config.separateVersions?t:f(t,n),a=await u(i,n,e);return{value:{catalogId:e.args.catalogId,config:e.args.config,items:a},entityDeps:r}}),x=t(v,async e=>{let t=p(e.args.items,{routes:e.routes}),{versionGroups:n,entityDeps:r}=await d(t,e);return{value:await m(t,n,{label:e.args.title,link:e.args.slug},e),entityDeps:r}}),S=r(y,{filePath:`./server/deliver.ts`,importer:import.meta.url,exportName:`deliver`,cacheable:!0});function C(e){return Object.entries(e.catalogClassic??e.catalog??{})}const w=e({id:h,version:`1.9.0`,content:{extractAll(e){let t=[],n=[];for(let[r,i]of C(e.config)){let{items:e,...a}=i,u=o(String(i.slug)),d=typeof i.title==`string`?i.title:`API Catalog`;t.push(b.withArgs({catalogId:r,config:a,items:e},{stableKey:l(r),metadata:{sourcePath:u}}),x.withArgs({items:e,slug:u,title:d},{stableKey:`${l(r)}:sidebars`,type:c})),n.push({deps:{[s]:S.withArgs({catalogId:r})},metadata:{title:d},routeId:r,slug:u,template:g})}return{entities:t,routes:n}}},loaders:[b,x],server:{functions:[S]},templates:{[g]:a(n(`./client/template.tsx`,import.meta.url))}});export{_ as CATALOG_CLASSIC_LOADER_ID,h as CATALOG_CLASSIC_PLUGIN_ID,y as CATALOG_CLASSIC_SERVER_FN_ID,v as CATALOG_CLASSIC_SIDEBARS_LOADER_ID,g as CATALOG_CLASSIC_TEMPLATE_ID,w as catalogClassicContentPlugin};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{toStableJsonString as e}from"../../../database/utils/json.js";import{
|
|
1
|
+
import{toStableJsonString as e}from"../../../database/utils/json.js";import{L10N_DIR as t}from"../../../../shared/constants/l10n/defaults.js";import{isObject as n}from"../../../../shared/utils/is-object.js";import{normalizeRouteSlug as r}from"../../../../shared/utils/routes/normalize-route-slug.js";import"../../../../shared/utils/l10n.js";import{markdocAstToText as i}from"../../../markdown/search/to-text.js";import{resolveContentPath as a}from"../../../../shared/utils/resolve-content-path.js";import{collectVersionGroups as o,findVersionedDirectories as s,versionsYamlPath as c}from"../../../versions/version-groups.js";import{sidebarStartEntityKey as l}from"../sidebar/contributions.js";import{publicLink as u}from"../../../versions/public-link.js";import{parseMarkdown as d}from"../../../markdown/utils/parse-cache.js";import{createApiEntityKey as f}from"../../utils/api-entity-key.js";import{CATALOG_CARD_METADATA_ENTITY_TYPE as p}from"./card-metadata.js";import{resolve as m}from"node:path";import{REDOCLY_TEAMS_RBAC as h}from"@redocly/config";const g=`redocly.yaml`;function _(e,t){let n=[],r=e=>{if(typeof e.directory==`string`)n.push(...C(e,e.directory,t));else if(typeof e.page==`string`){let r=w(e,e.page,t);r&&n.push(r)}else typeof e.href==`string`&&n.push(T(e,e.href,t));for(let t of e.items??[])r(t)};for(let t of e??[])r(t);return n}async function v(e,t){let n=e.flatMap(e=>`route`in e?[e.route]:[]),r=s(n);return{versionGroups:await o({io:{exists:e=>t.io.exists(m(t.contentDir,e)),readFile:e=>t.io.readFile(m(t.contentDir,e))},routes:t.routes,versionedDirectories:r}),entityDeps:r.map(e=>({kind:`file`,path:c(e)}))}}function y(e,t){let n=/* @__PURE__ */ new Map;for(let[r,i]of e.entries()){let e=`route`in i?u(i.route,t,!0):`${r}`,a=`route`in i&&i.route.versionGroup!==null&&t.get(i.route.versionGroup)?.defaultVersion===i.route.version;(!n.has(e)||a)&&n.set(e,i)}return[...n.values()]}async function b(e,t){return P(e.route.metadata.title)??P(e.entry.label)??await A(e.route,t)??N(e.route.slug)}async function x(e,t,n){let r=await S(n.entities),i=[];for(let a of e)i.push(`route`in a?await E(a,t,r,n):{link:a.link,title:a.title});return i}async function S(e){let t=/* @__PURE__ */ new Map;for(let n of await e.list({type:p}))for(let{route:r,metadata:i}of await e.load(n.key))t.set(r,{...t.get(r),...i});return t}function C(e,r,i){let o=a(r,g);if(o===null)return i.logger?.warn(`Catalog directory reference escapes the content root`,{directory:r}),[];let s=i.routes.inDirectory(o);if(s.length===0)return i.logger?.warn(`Catalog directory matched no routes`,{directory:r}),[];let c=n(e.includeByMetadata)?e.includeByMetadata:void 0,l=o.startsWith(`${t}/`),u=[];for(let t of s){if(!l&&t.locale!==``)continue;let n=i.routes.get(t.slug);n&&M(j(n.metadata),c)&&u.push({route:n,entry:e})}return u}function w(e,t,n){let r=a(t,g);if(r===null){n.logger?.warn(`Catalog page reference escapes the content root`,{page:t});return}let i=n.routes.byFilePath(r),o=i&&n.routes.get(i.slug);if(!o){n.logger?.warn(`Catalog page has no matching route`,{page:t});return}return{route:o,entry:e}}function T(e,t,n){let i=t.startsWith(`/`)?n.routes.bySlug(r(t)):void 0,a=i&&n.routes.get(i.slug);return a?{route:a,entry:e}:{link:t,title:P(e.label)??t}}async function E(e,t,n,r){let{route:i}=e,a={...j(i.metadata),...n.get(i.slug)};delete a.rbac;let o=await b(e,r),s=k(a.description)??P(a.summary)??await O(i,r),c=F(a.tags),l=await D(i,t,r),d={link:u(i,t),title:o,metadata:a};return s!==void 0&&(d.description=s),c!==void 0&&(d.tags=c),l!==void 0&&(d.docsLink=l),i.version!==null&&(d.version=i.version),i.access!==null&&(d[h]=i.access),d}async function D(t,n,r){let i=l(t.slug);if(await r.entities.get(i)===null)return;let a=r.routes.get(await r.entities.load(i));if(a!==void 0&&a.slug!==t.slug&&e(a.access)===e(t.access))return u(a,n)}async function O(e,t){if(e.originFilePath===null)return;let r=f(e.originFilePath);if((await t.entities.get(r))?.type!==`api`)return;let i=await t.entities.tryLoad(r),a=n(i)&&n(i.info)?i.info:{};return P(a.summary)??k(a.description)}function k(e){let t=P(e);if(t!==void 0)return P(i(d(t)))}async function A(e,t){if(!e.sidebarSubtreeEntityKey)return;let r=await t.entities.tryLoad(e.sidebarSubtreeEntityKey);return n(r)?P(r.label):void 0}function j(e){let{metadata:t,...r}=e;return n(t)?{...r,...t}:r}function M(e,t){return!t||Object.entries(t).every(([t,n])=>{let r=e?.[t];return Array.isArray(n)?n.includes(r):r===n})}function N(e){return e.split(`/`).filter(Boolean).at(-1)??e}function P(e){return typeof e==`string`&&e.trim()!==``?e:void 0}function F(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)?e:void 0}export{x as buildCatalogCards,v as loadVersionGroups,y as pickDefaultVersions,_ as resolveCatalogMembers,b as resolveMemberTitle};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"
|
|
1
|
+
import{APP_DATA_STATIC_DATA_SLUG as e}from"../../../shared/constants/app-data.js";import{SIDEBAR_ROUTE_DEP_KEY as t}from"../../../shared/constants/route-deps.js";import{FOLDER_SIDEBAR_FILENAME_REGEX as n,SIDEBAR_AGGREGATOR_LOADER_ID as r,SIDEBAR_FILENAME_REGEX as i,SIDEBAR_PLUGIN_ID as a,isTabbedSidebar as o,resolveAutoSidebar as s,sidebarContentPlugin as c}from"./sidebar/index.js";import"./api-functions/constants.js";import{STATIC_FOLDER_PLUGIN_ID as l,STATIC_FOLDER_PREFIX as u,isStaticFolderPath as d,staticFolderContentPlugin as f}from"./static-folder/index.js";import{ASSETS_PLUGIN_ID as p,ASSET_ENTITY_KEY_PREFIX as m,assetsContentPlugin as h}from"./assets/index.js";import{APP_DATA_PLUGIN_ID as g,APP_DATA_PLUGIN_VERSION as ee,APP_DATA_STATIC_DATA_LOADER_ID as _,appDataContentPlugin as v,appDataSystemEntityDescriptor as y,buildConfigAppData as b,isAppDataFragment as x}from"./app-data/index.js";import{apiDocsContentPlugin as S}from"./api-docs/index.js";import{API_FUNCTIONS_PLUGIN_ID as C,apiFunctionsContentPlugin as w}from"./api-functions/index.js";import{CATALOG_CLASSIC_LOADER_ID as T,CATALOG_CLASSIC_PLUGIN_ID as E,CATALOG_CLASSIC_SERVER_FN_ID as D,CATALOG_CLASSIC_SIDEBARS_LOADER_ID as O,CATALOG_CLASSIC_TEMPLATE_ID as k,catalogClassicContentPlugin as A}from"./catalog-classic/index.js";import{L10N_PLUGIN_ID as j}from"./l10n/translations-loader.js";import{L10N_PLUGIN_VERSION as M,l10nContentPlugin as N}from"./l10n/index.js";import{MARKDOC_DOCUMENT_LOADER_ID as P,MARKDOC_SEARCH_GROUP as F,MARKDOC_SIDEBAR_ITEM_LOADER_ID as te,MARKDOC_TEMPLATE_ID as I,markdocContentPlugin as L}from"./markdoc/index.js";import{mcpContentPlugin as R}from"./mcp/index.js";import{MOCK_SERVER_PLUGIN_ID as z,MOCK_SERVER_ROUTE_PATH as B,mockServerContentPlugin as V}from"./mock/index.js";import{REACT_PAGE_SEARCH_LOADER_KEY as H,reactPageContentPlugin as U}from"./react-page/index.js";import{REVISIONS_PLUGIN_ID as W,revisionsContentPlugin as G}from"./revisions/index.js";import{SCORECARD_CLASSIC_PLUGIN_ID as K,SCORECARD_CLASSIC_TEMPLATE_ID as q,scorecardClassicContentPlugin as J}from"./scorecard-classic/index.js";import{SKILLS_PLUGIN_ID as Y,SKILL_MARKDOWN_ROUTE_PATH as X,skillsContentPlugin as Z}from"./skills/index.js";import{VERSIONS_PLUGIN_ID as Q,versionsContentPlugin as $}from"./versions/index.js";function ne(){return[v,N,f,h,L,c,$,G,A,S,J,w,V,R,U,Z]}export{C as API_FUNCTIONS_PLUGIN_ID,g as APP_DATA_PLUGIN_ID,ee as APP_DATA_PLUGIN_VERSION,_ as APP_DATA_STATIC_DATA_LOADER_ID,e as APP_DATA_STATIC_DATA_SLUG,p as ASSETS_PLUGIN_ID,m as ASSET_ENTITY_KEY_PREFIX,T as CATALOG_CLASSIC_LOADER_ID,E as CATALOG_CLASSIC_PLUGIN_ID,D as CATALOG_CLASSIC_SERVER_FN_ID,O as CATALOG_CLASSIC_SIDEBARS_LOADER_ID,k as CATALOG_CLASSIC_TEMPLATE_ID,n as FOLDER_SIDEBAR_FILENAME_REGEX,j as L10N_PLUGIN_ID,M as L10N_PLUGIN_VERSION,P as MARKDOC_DOCUMENT_LOADER_ID,F as MARKDOC_SEARCH_GROUP,te as MARKDOC_SIDEBAR_ITEM_LOADER_ID,I as MARKDOC_TEMPLATE_ID,z as MOCK_SERVER_PLUGIN_ID,B as MOCK_SERVER_ROUTE_PATH,H as REACT_PAGE_SEARCH_LOADER_KEY,W as REVISIONS_PLUGIN_ID,K as SCORECARD_CLASSIC_PLUGIN_ID,q as SCORECARD_CLASSIC_TEMPLATE_ID,r as SIDEBAR_AGGREGATOR_LOADER_ID,i as SIDEBAR_FILENAME_REGEX,a as SIDEBAR_PLUGIN_ID,t as SIDEBAR_ROUTE_DEP_KEY,Y as SKILLS_PLUGIN_ID,X as SKILL_MARKDOWN_ROUTE_PATH,l as STATIC_FOLDER_PLUGIN_ID,u as STATIC_FOLDER_PREFIX,Q as VERSIONS_PLUGIN_ID,S as apiDocsContentPlugin,w as apiFunctionsContentPlugin,v as appDataContentPlugin,y as appDataSystemEntityDescriptor,h as assetsContentPlugin,b as buildConfigAppData,A as catalogClassicContentPlugin,ne as createInternalContentPlugins,x as isAppDataFragment,d as isStaticFolderPath,o as isTabbedSidebar,N as l10nContentPlugin,L as markdocContentPlugin,R as mcpContentPlugin,V as mockServerContentPlugin,U as reactPageContentPlugin,s as resolveAutoSidebar,G as revisionsContentPlugin,J as scorecardClassicContentPlugin,c as sidebarContentPlugin,Z as skillsContentPlugin,f as staticFolderContentPlugin,$ as versionsContentPlugin};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineContentPlugin as e}from"../../define.js";import{toJsonObject as t}from"../../../database/utils/json.js";import{isPlanFeatureGranted as n}from"../../../../shared/plan-gates.js";import{
|
|
1
|
+
import{defineContentPlugin as e}from"../../define.js";import{toJsonObject as t}from"../../../database/utils/json.js";import{isPlanFeatureGranted as n}from"../../../../shared/plan-gates.js";import{TRANSLATIONS_FILE_PATTERN as r}from"../../../../shared/constants/l10n/defaults.js";import{compareStrings as i}from"../../../../shared/utils/compare-strings.js";import{normalizeL10nConfig as a}from"../../../../shared/utils/l10n.js";import{collectSlugOverrides as o}from"../../utils/slug-overrides.js";import{L10N_PLUGIN_ID as s,L10N_TRANSLATIONS_ENTITY_TYPE as c,l10nTranslationsLoader as l}from"./translations-loader.js";const u=`0.2.0`,d=e({id:s,version:u,loaders:[l],content:{filter:{match:e=>r.test(e)},extractFile(e){return{routes:[],entities:[l.withArgs({path:e.path},{stableKey:`${c}:${e.path}`,type:c})]}}},async finalize(e){let r=a(e.config.l10n).locales,{localeContext:i}=e,{defaultLocale:s,locales:c}=i,l={},u=n(e.config,`l10n`)?await f(e,i):/* @__PURE__ */ new Map;for(let[e,t]of u)l[e]={translation:t};l[s]??={translation:{}};let d={defaultLocale:s,locales:r??[s,...c].map(e=>({code:e,name:e})),contentLocales:[...c],slugOverrides:o(e.routes.all(),i),translations:l};return{appData:t({l10n:d})}}});async function f(e,t){let n=await e.entities.list({type:c}),r=/* @__PURE__ */ new Map;for(let a of[...n].sort((e,t)=>i(e.key,t.key))){let n=await e.entities.load(a.key),i=n?.dir;if(i==null)continue;let o=i===``?t.defaultLocale:i;(i===``||t.isLocale(i))&&(r.has(o)||r.set(o,n.translation))}return r}export{s as L10N_PLUGIN_ID,u as L10N_PLUGIN_VERSION,d as l10nContentPlugin};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createEntityLoader as e}from"../../../loaders/define.js";import{createPluginScopedId as t}from"../../utils/scoped-id.js";import{
|
|
1
|
+
import{createEntityLoader as e}from"../../../loaders/define.js";import{createPluginScopedId as t}from"../../utils/scoped-id.js";import{L10N_DIR as n,TRANSLATIONS_FILE_NAMES as r}from"../../../../shared/constants/l10n/defaults.js";import{isObject as i}from"../../../../shared/utils/is-object.js";import a from"js-yaml";const o=`internal.l10n`,s=`l10n-translations`,c=t(o,`translations`),l=RegExp(`^${n}/([^/]+)/(translations\\.ya?ml)$`,`i`),u=e(c,async e=>{let t=e.file.path,n=d(t);if(n===null)return{value:{dir:null,translation:{}},type:s,problems:[p(t,"Not loaded as UI-string translations: place the file at the project root or in `@l10n/<locale>/`.")]};let r;try{r=await e.io.readFile(e.file.absolutePath)}catch(e){return f(n,t,`reading failed`,e)}let o;try{o=a.load(r)}catch(e){return f(n,t,`invalid YAML`,e)}return o!=null&&!i(o)?f(n,t,`expected a key-value map`):{value:{dir:n,translation:o??{}},type:s}});function d(e){let t=e.toLowerCase();return r.some(e=>t===e)?``:l.exec(e)?.[1]??null}function f(e,t,n,r){let i=r instanceof Error?`: ${r.message}`:``;return{value:{dir:e,translation:{}},type:s,problems:[p(t,`Ignoring translations file: ${n}${i}.`)]}}function p(e,t){return{code:`configuration/l10n-translations-invalid`,message:t,location:{filePath:e}}}export{o as L10N_PLUGIN_ID,s as L10N_TRANSLATIONS_ENTITY_TYPE,c as L10N_TRANSLATIONS_LOADER_ID,u as l10nTranslationsLoader,d as translationsFileDir};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{MARKDOC_DOCUMENT_LOADER_KEY as e}from"../../../../../shared/constants/route-deps.js";import{collectHeadings as t}from"../../../../markdown/utils/collect-headings.js";import{MarkdocRenderer as n}from"../../../../markdown/client/markdoc-components.js";import{
|
|
1
|
+
import{MARKDOC_DOCUMENT_LOADER_KEY as e}from"../../../../../shared/constants/route-deps.js";import{collectHeadings as t}from"../../../../markdown/utils/collect-headings.js";import{MarkdocRenderer as n}from"../../../../markdown/client/markdoc-components.js";import*as r from"react";import{extendDetailsBehaviour as i}from"@redocly/theme/core/utils";import{DEFAULT_FEEDBACK_TYPE as a}from"@redocly/theme/core/constants";import{jsx as o}from"react/jsx-runtime";import{useThemeConfig as s,useThemeHooks as c}from"@redocly/theme/core/hooks";import{useLoaderData as l}from"virtual:realm-runtime";import{Feedback as u}from"@redocly/theme/components/Feedback/Feedback";import{TableOfContent as d}from"@redocly/theme/components/TableOfContent/TableOfContent";import{CodeWalkthroughLayout as f}from"@redocly/theme/layouts/CodeWalkthroughLayout";import{DocumentationLayout as p}from"@redocly/theme/layouts/DocumentationLayout";function m(m){let h=l(e),{useSidebarSiblingsData:g}=c(),{markdown:_,feedback:v}=s(),{nextPage:y,prevPage:b}=g()??{},[x,S]=r.useState(null),C=r.useMemo(()=>h?t(h.ast):[],[h]);if(r.useEffect(()=>i(),[h]),!h)return null;let w=/* @__PURE__ */ o(n,{ast:h.ast,withPageActions:!0});return h.tagList?.includes(`code-walkthrough`)?/* @__PURE__ */ o(f,{children:w}):/* @__PURE__ */ o(p,{config:_,editPage:h.editPage,lastModified:h.lastModified,feedback:/* @__PURE__ */ o(u,{...v,type:v?.type??a,settings:v?.settings??{},path:m.page.slug??m.page.path}),nextPage:y,prevPage:b,tableOfContent:/* @__PURE__ */ o(d,{contentWrapper:x,headings:C}),children:/* @__PURE__ */ o(`div`,{ref:S,children:w})})}export{m as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineContentPlugin as e}from"../../define.js";import{createEntityLoader as t}from"../../../loaders/define.js";import{runtimeFile as n}from"../../utils/runtime-file.js";import{createPluginScopedId as r}from"../../utils/scoped-id.js";import{runtimeTemplate as i}from"../../templates.js";import{SEARCH_GROUP_FACET_FIELD as a}from"../../../../shared/search/facets.js";import{configuredFacetFields as o,extractFacetsFromFrontmatter as s,invalidFacetValueProblems as c,searchCategoryOf as l}from"../../../search/facet-values.js";import{isPlanFeatureGranted as u}from"../../../../shared/plan-gates.js";import{SOURCE_TEMPLATE_PREFIX as d}from"../../../../shared/constants/template-ids.js";import{isObject as f}from"../../../../shared/utils/is-object.js";import{markdocNodeRange as p}from"../../../markdown/utils/node-source-range.js";import{replaceWithMarkdocError as m}from"../../../markdown/tags/markdoc-error.js";import{getPartialTwins as h}from"../../../markdown/tags/partial.js";import{CODE_WALKTHROUGH_TAG_NAMES as g,builtInMarkdocTags as _}from"../../../markdown/constants/builtin-tags.js";import{customMarkdocTagNames as v,isMarkdocValidationEnabled as ee,resolveMarkdocTagSet as y,resolveMarkdownPageValidationSet as te,userMarkdocSchemaFiles as b}from"../../../markdown/constants/tag-sets.js";import{normalizeRouteSlug as ne}from"../../../../shared/utils/routes/normalize-route-slug.js";import{resolveContentPath as x}from"../../../../shared/utils/resolve-content-path.js";import{PAGE_BANNER_SCHEMA as S,sanitizeConfig as C}from"../../../config-schema.js";import{notInPlanProblem as re}from"../../../plan-gates.js";import{matchPathMap as ie}from"../../utils/glob.js";import{filePathToRouteSlug as ae}from"../../../../shared/utils/routes/file-path-to-route-slug.js";import{splitUrlSuffix as w}from"../../../../shared/utils/routes/split-url-suffix.js";import{packMarkdocAst as oe,unpackMarkdocAst as T}from"../../../../shared/utils/packed-ast.js";import{isRouteSlugTarget as se}from"../../../../shared/utils/routes/is-route-slug-target.js";import{loadSidebarSubtreeLabel as ce}from"../../utils/sidebar-label.js";import{walkMarkdocAst as E}from"../../../markdown/utils/walk-markdoc-ast.js";import{markdocFirstHeading as le}from"../../../markdown/search/to-text.js";import{safeDecodeURI as ue}from"../../../../shared/utils/safe-decode-uri.js";import{shiftRange as de}from"../../../../shared/utils/shift-range.js";import{classifyLinkTarget as D}from"../../../link-checker/classify.js";import{onDiskLinkRefs as O}from"../../../link-checker/node-ref.js";import{isPartialPath as k}from"../../../markdown/utils/partials.js";import{FRONTMATTER_BLOCK_RE as A,computeFrontmatterLineOffset as j}from"../../../markdown/utils/frontmatter-offset.js";import{inlineRawPartials as M}from"../../../markdown/resolve/raw-partials.js";import{resolveMarkdownAst as N}from"../../../markdown/resolve/ast.js";import{resolveBannerForAppData as P}from"../app-data/banner.js";import{MARKDOC_DOCUMENT_LOADER_KEY as F}from"../../../../shared/constants/route-deps.js";import{pageLocale as I}from"../../utils/page-locale.js";import{captureSnippet as L,splitSourceLines as R}from"../../../../shared/utils/capture-snippet.js";import{collectAnchors as z}from"../../../markdown/utils/collect-anchors.js";import{frontmatterVariable as B}from"../../../markdown/utils/frontmatter-variable.js";import{markdownFirstHeading as V}from"../../../markdown/utils/first-heading.js";import{markdocAstToSearchSections as H}from"../../../markdown/search/to-sections.js";import{markdocAstToMarkdownDoc as fe}from"../../../markdown/search/to-markdown.js";import{isInternalPagePath as pe}from"../../utils/internal-page-path.js";import{parseExplicitSlugs as me}from"../../utils/explicit-slugs.js";import{isSkillContentPath as he}from"../../utils/skill-paths.js";import{curationKeywordsOf as ge}from"../../../search/keywords.js";import _e from"js-yaml";const U=`markdoc-page`,W=r(`internal.markdoc`,`document`),G=r(`internal.markdoc`,`sidebar-item`),ve=`Documentation`,K=t(W,async e=>{let t=await e.io.readFile(e.file.absolutePath),{content:n,frontmatter:r,frontmatterError:i}=Y(t),a=J(e),{ast:o,entityDeps:s,assetUsages:c,tagList:l,problems:d,linkRefs:f}=await N(n,e.file.path,{resolverContext:a,tags:(await y(void 0,e.config)).tags,variables:{get env(){return e.config.publicEnv??{}}},transform:t=>De(t,e.file.path,Ee(e.config)),validation:ee()?await te(e.config):void 0}),p=j(t);Me(o);let m=await Te(r.seo,e),h=u(e.config,`banner`)?await P(Ne(r,e.file.path,e.logger),a):void 0,g=await ke(r,e),_=await Ae(r.navigation,e),v={...g.frontmatter,navigation:_.value,seo:m.seo,banner:h?.banner},b=Pe(r,o);return{value:{ast:oe(o),frontmatter:v,tagList:l,title:b,editPage:we(e.config,r,e.file.path),lastModified:e.file.lastModifiedAt},entityDeps:[...s,...be(),...m.entityDeps,...h?.deps??[],...g.entityDeps,..._.entityDeps],assetUsages:[...c,...m.assetUsages,...h?.assetUsages??[],...g.assetUsages],problems:xe(t,e.file.path,p,d,i),linkRefs:[...O(f,p),..._.linkRefs],targetInventories:[Se(o,{frontmatter:B(v,b)})]}},{usesProjectMarkdocSchema:!0,async markdown(e,t){let{tags:n}=await y(void 0,t.config),{chunks:r,headings:i}=fe(T(e.ast),{tags:n,locale:I(t),variables:{frontmatter:B(e.frontmatter,e.title),env:t.config.publicEnv??{}}});return[{chunks:r,headings:i,...e.title?{title:e.title}:{}}]},searchable(e,t){if(t.route===void 0||t.route.metadata.excludeFromSearch===!0)return{docs:[]};let n=t.route.slug,r=e.title??Q(t.route.originFilePath??n),{category:i,isInvalid:u}=l(t.route.metadata),{facets:d,invalidFields:f}=s(t.route.metadata,o(t.config)),p=ge(e.frontmatter.keywords);return{docs:H(T(e.ast),r,{frontmatter:B(e.frontmatter,e.title)}).map((e,t)=>{let r={docKey:e.docKey,routeSlug:n,title:e.title,text:e.text,groupKey:i??`Documentation`,facets:d};e.anchor!==void 0&&(r.anchor=e.anchor),e.path!==void 0&&(r.path=e.path);let a=t===0?p:{excludes:p?.excludes};return(a?.includes||a?.excludes)&&(r.keywords=a),e.rbacTeams!==void 0&&(r.rbacScope=Object.fromEntries(e.rbacTeams.map(e=>[e,`read`]))),r}),problems:c([...f,...u?[a]:[]],t.route.originFilePath)}}}),q=t(G,async e=>{let{content:t,frontmatter:n}=Y(await e.io.readFile(e.file.absolutePath)),r=await M(t,e.file.path,J(e));return{value:{label:Z(n)??V(r.source)??Q(e.args.filePath)},entityDeps:r.entityDeps}});function J(e){return{config:e.config,contentDir:e.contentDir,entities:e.entities,file:e.file,io:e.io,logger:e.logger,markdown:e.markdown,plugin:e.plugin}}const ye=e({id:`internal.markdoc`,version:`3.52.0`,content:{filter:{match:e=>e.toLowerCase().endsWith(`.md`)&&!he(e)},extractFile(e,t){if(pe(e.path)||k(e.path,t.config))return{routes:[]};if(!u(t.config,`markdown`))return{routes:[],problems:[re(`Markdown pages`)]};let{banner:n,...r}=e.manifest,i=Fe(e,t),a=me(r.slug),o=K.withArgs({filePath:e.path}),s=q.withArgs({filePath:e.path});return{routes:a.length>0?a.map(e=>({deps:{[F]:o},metadata:r,routeId:`page`,sidebarSubtree:s,slug:e,slugHint:null,template:i})):[{deps:{[F]:o},metadata:r,routeId:`page`,sidebarSubtree:s,slug:null,slugHint:ae(e.path),template:i}],entities:[o]}}},loaders:[K,q],templates:{[U]:i(n(`./client/template.tsx`,import.meta.url))}});function Y(e){let t=e.match(A);if(!t)return{content:e,frontmatter:{}};let n=t[1]??``;try{let r=_e.load(n);return{content:e.slice(t[0].length),frontmatter:f(r)?r:{}}}catch(n){let r=n instanceof Error?n.message:String(n);return{content:e.slice(t[0].length),frontmatter:{},frontmatterError:r}}}function be(){return(b()??[]).map(e=>({kind:`file`,path:e}))}function xe(e,t,n,r,i){if(r.length===0&&i===void 0)return[];let a=R(e),o=r.map(e=>Ce(e,a,n,t));if(i!==void 0){let e={start:{line:1},end:{line:n}};o.push({code:`markdown/frontmatter-parse`,message:i,location:{filePath:t,range:e,snippet:L(a,e)}})}return o}function Se(e,t){let{ids:n,exhaustive:r}=z(e,t);return{kind:`anchor`,exhaustive:r,targets:n}}function Ce(e,t,n,r){let i=e.location?.range;if(!i)return e;let a=de(i,n);return{...e,location:{filePath:r,range:a,snippet:L(t,a)}}}function we(e,t,n){let r=f(t.markdown)?t.markdown:{},i={...e.markdown?.editPage,...f(r.editPage)?r.editPage:{}};if(i.hide!==!0&&typeof i.baseUrl==`string`&&i.baseUrl!==``)return{to:`${i.baseUrl.replace(/(?<!\/)\/+$/,``)}/${n}`}}async function Te(e,t){if(!f(e)||typeof e.image!=`string`)return{seo:e,entityDeps:[],assetUsages:[]};let n=await t.markdown.resolveImageReference(e.image,t.file.path);return n.result.kind===`assetRef`?{seo:{...e,image:n.result.url},entityDeps:n.entityDeps,assetUsages:n.assetUsages}:{seo:e,entityDeps:n.entityDeps,assetUsages:[]}}function Ee(e){let t=/* @__PURE__ */ new Map;if(!u(e,`customMarkdocTags`))for(let e of v())t.set(e,`Custom Markdoc tags are not in this project's plan, so \`${e}\` is ignored.`);if(!u(e,`codeWalkthrough`))for(let e of g)t.set(e,`\`${e}\` is not in this project's plan and is ignored.`);return t}function De(e,t,n){let r=[];if(n.size===0)return r;for(let i of E(e,{getExtraNodes:h})){let e=i.type===`tag`&&i.tag!==void 0?n.get(i.tag):void 0;e!==void 0&&(r.push({code:`configuration/ignored`,message:e,location:{filePath:t,range:p(i)??{start:{line:1},end:{line:1}}}}),m(i,e))}return r}const Oe=[`image`,`links`];async function ke(e,t){let n=t.config.markdown?.frontMatterKeysToResolve??Oe,r={...e},i=[],a=[];for(let o of n){let n=e[o];if(typeof n!=`string`)continue;let s=await t.markdown.resolveLocalReference(n,t.file.path);i.push(...s.entityDeps),a.push(...s.assetUsages),s.result.kind!==`passthrough`&&(r[o]=s.result.url)}return{frontmatter:r,entityDeps:i,assetUsages:a}}async function Ae(e,t){let n=[],r=[];if(!f(e))return{value:e,entityDeps:n,linkRefs:r};let i={...e};for(let a of[`nextButton`,`previousButton`]){let o=e[a];if(!f(o)||typeof o.page!=`string`)continue;let{page:s,...c}=o,l=D(ue(s),t.file.path);l!==null&&r.push({kind:`link`,raw:s,...l});let u=await je(s,t);n.push(...u.entityDeps),i[a]={...c,label:typeof c.label==`string`?c.label:u.route&&await X(u.route,t),link:u.link}}return{value:i,entityDeps:n,linkRefs:r}}async function X(e,t){let n=await ce(t.entities,e);if(n!==void 0)return n;let r=t.routes.get(e.slug)?.metadata.seo;return f(r)&&typeof r.title==`string`&&r.title.trim()!==``?r.title:e.slug}async function je(e,t){let n=e.trim(),{path:r,suffix:i}=w(n);if(se(r)){let e=t.routes.bySlug(ne(r));return{link:e&&`${e.slug}${i}`,route:e,entityDeps:[]}}let a=await t.markdown.resolveLocalReference(n,t.file.path);if(a.result.kind!==`pageUrl`)return{entityDeps:a.entityDeps};let o=a.result.url;return{link:o,route:t.routes.bySlug(w(o).path)??a.entityDeps.map(e=>e.kind===`file`?t.routes.byFilePath(e.path):void 0).reverse().find(e=>e!==void 0),entityDeps:a.entityDeps}}function Me(e){let t=/* @__PURE__ */ new Map;for(let n of E(e)){if(n.type!==`tag`||n.tag===void 0||_[n.tag]?.attributes?.__idx===void 0)continue;let e=(t.get(n.tag)??0)+1;t.set(n.tag,e),n.attributes.__idx=e}}function Ne(e,t,n){if(e.banner===void 0)return;let{value:r,problems:i}=C(S,{banner:e.banner});for(let e of i)n?.warn(`${t}: ${e.message}`);return r.banner}function Pe(e,t){return Z(e)??le(t)??void 0}function Z(e){let t=f(e.seo)?e.seo.title:void 0;return typeof t==`string`&&t.trim()!==``?t:void 0}function Q(e){let t=(e.split(`/`).pop()??e).replace(/\.[^.]+$/,``);return t===``?e:t}function Fe(e,t){let n=e.manifest.template;if(typeof n==`string`&&n.trim()!==``)return $(n,e.path,t.logger);let r=ie(e.path,t.config.markdown?.template);return typeof r==`string`&&r.trim()!==``?$(r,`redocly.yaml`,t.logger):U}function $(e,t,n){if(!e.startsWith(`./`)&&!e.startsWith(`../`)&&!e.startsWith(`/`))return e;let r=x(e,t);return r===null?(n.warn(`Template reference "${e}" in ${t} escapes the content root; falling back to ${U}.`),U):`${d}${r}`}export{W as MARKDOC_DOCUMENT_LOADER_ID,ve as MARKDOC_SEARCH_GROUP,G as MARKDOC_SIDEBAR_ITEM_LOADER_ID,U as MARKDOC_TEMPLATE_ID,ye as markdocContentPlugin};
|
|
1
|
+
import{defineContentPlugin as e}from"../../define.js";import{createEntityLoader as t}from"../../../loaders/define.js";import{runtimeFile as n}from"../../utils/runtime-file.js";import{createPluginScopedId as r}from"../../utils/scoped-id.js";import{runtimeTemplate as i}from"../../templates.js";import{SEARCH_GROUP_FACET_FIELD as a}from"../../../../shared/search/facets.js";import{configuredFacetFields as o,extractFacetsFromFrontmatter as s,invalidFacetValueProblems as c,searchCategoryOf as l}from"../../../search/facet-values.js";import{isPlanFeatureGranted as u}from"../../../../shared/plan-gates.js";import{isObject as d}from"../../../../shared/utils/is-object.js";import{normalizeRouteSlug as f}from"../../../../shared/utils/routes/normalize-route-slug.js";import{MARKDOC_DOCUMENT_LOADER_KEY as p}from"../../../../shared/constants/route-deps.js";import{markdocNodeRange as m}from"../../../markdown/utils/node-source-range.js";import{replaceWithMarkdocError as h}from"../../../markdown/tags/markdoc-error.js";import{getPartialTwins as g}from"../../../markdown/tags/partial.js";import{CODE_WALKTHROUGH_TAG_NAMES as _,builtInMarkdocTags as v}from"../../../markdown/constants/builtin-tags.js";import{customMarkdocTagNames as y,isMarkdocValidationEnabled as b,resolveMarkdocTagSet as x,resolveMarkdownPageValidationSet as ee,userMarkdocSchemaFiles as te}from"../../../markdown/constants/tag-sets.js";import{splitUrlSuffix as S}from"../../../../shared/utils/routes/split-url-suffix.js";import{isSkillContentPath as C}from"../../utils/skill-paths.js";import{matchPathMap as ne}from"../../utils/glob.js";import{markdocFirstHeading as re}from"../../../markdown/search/to-text.js";import{markdocAstToSearchSections as ie}from"../../../markdown/search/to-sections.js";import{curationKeywordsOf as ae}from"../../../search/keywords.js";import{packMarkdocAst as oe,unpackMarkdocAst as w}from"../../../../shared/utils/packed-ast.js";import{resolveContentPath as se}from"../../../../shared/utils/resolve-content-path.js";import{isRouteSlugTarget as ce}from"../../../../shared/utils/routes/is-route-slug-target.js";import{safeDecodeURI as le}from"../../../../shared/utils/safe-decode-uri.js";import{classifyLinkTarget as ue}from"../../../link-checker/classify.js";import{frontmatterVariable as T}from"../../../markdown/utils/frontmatter-variable.js";import{SOURCE_TEMPLATE_PREFIX as de}from"../../../../shared/constants/template-ids.js";import{PAGE_BANNER_SCHEMA as E,sanitizeConfig as D}from"../../../config-schema.js";import{notInPlanProblem as O}from"../../../plan-gates.js";import{filePathToRouteSlug as k}from"../../../../shared/utils/routes/file-path-to-route-slug.js";import{loadSidebarSubtreeLabel as A}from"../../utils/sidebar-label.js";import{walkMarkdocAst as j}from"../../../markdown/utils/walk-markdoc-ast.js";import{shiftRange as M}from"../../../../shared/utils/shift-range.js";import{onDiskLinkRefs as N}from"../../../link-checker/node-ref.js";import{isPartialPath as P}from"../../../markdown/utils/partials.js";import{FRONTMATTER_BLOCK_RE as F,computeFrontmatterLineOffset as I}from"../../../markdown/utils/frontmatter-offset.js";import{inlineRawPartials as L}from"../../../markdown/resolve/raw-partials.js";import{resolveMarkdownAst as R}from"../../../markdown/resolve/ast.js";import{resolveBannerForAppData as z}from"../app-data/banner.js";import{pageLocale as B}from"../../utils/page-locale.js";import{captureSnippet as V,splitSourceLines as H}from"../../../../shared/utils/capture-snippet.js";import{collectAnchors as fe}from"../../../markdown/utils/collect-anchors.js";import{markdownFirstHeading as pe}from"../../../markdown/utils/first-heading.js";import{markdocAstToMarkdownDoc as me}from"../../../markdown/search/to-markdown.js";import{isInternalPagePath as he}from"../../utils/internal-page-path.js";import{parseExplicitSlugs as ge}from"../../utils/explicit-slugs.js";import _e from"js-yaml";const U=`markdoc-page`,W=r(`internal.markdoc`,`document`),G=r(`internal.markdoc`,`sidebar-item`),ve=`Documentation`,K=t(W,async e=>{let t=await e.io.readFile(e.file.absolutePath),{content:n,frontmatter:r,frontmatterError:i}=Y(t),a=J(e),{ast:o,entityDeps:s,assetUsages:c,tagList:l,problems:d,linkRefs:f}=await R(n,e.file.path,{resolverContext:a,tags:(await x(void 0,e.config)).tags,variables:{get env(){return e.config.publicEnv??{}}},transform:t=>De(t,e.file.path,Ee(e.config)),validation:b()?await ee(e.config):void 0}),p=I(t);Me(o);let m=await Te(r.seo,e),h=u(e.config,`banner`)?await z(Ne(r,e.file.path,e.logger),a):void 0,g=await ke(r,e),_=await Ae(r.navigation,e),v={...g.frontmatter,navigation:_.value,seo:m.seo,banner:h?.banner},y=Pe(r,o);return{value:{ast:oe(o),frontmatter:v,tagList:l,title:y,editPage:we(e.config,r,e.file.path),lastModified:e.file.lastModifiedAt},entityDeps:[...s,...be(),...m.entityDeps,...h?.deps??[],...g.entityDeps,..._.entityDeps],assetUsages:[...c,...m.assetUsages,...h?.assetUsages??[],...g.assetUsages],problems:xe(t,e.file.path,p,d,i),linkRefs:[...N(f,p),..._.linkRefs],targetInventories:[Se(o,{frontmatter:T(v,y)})]}},{usesProjectMarkdocSchema:!0,async markdown(e,t){let{tags:n}=await x(void 0,t.config),{chunks:r,headings:i}=me(w(e.ast),{tags:n,locale:B(t),variables:{frontmatter:T(e.frontmatter,e.title),env:t.config.publicEnv??{}}});return[{chunks:r,headings:i,...e.title?{title:e.title}:{}}]},searchable(e,t){if(t.route===void 0||t.route.metadata.excludeFromSearch===!0)return{docs:[]};let n=t.route.slug,r=e.title??Q(t.route.originFilePath??n),{category:i,isInvalid:u}=l(t.route.metadata),{facets:d,invalidFields:f}=s(t.route.metadata,o(t.config)),p=ae(e.frontmatter.keywords);return{docs:ie(w(e.ast),r,{frontmatter:T(e.frontmatter,e.title)}).map((e,t)=>{let r={docKey:e.docKey,routeSlug:n,title:e.title,text:e.text,groupKey:i??`Documentation`,facets:d};e.anchor!==void 0&&(r.anchor=e.anchor),e.path!==void 0&&(r.path=e.path);let a=t===0?p:{excludes:p?.excludes};return(a?.includes||a?.excludes)&&(r.keywords=a),e.rbacTeams!==void 0&&(r.rbacScope=Object.fromEntries(e.rbacTeams.map(e=>[e,`read`]))),r}),problems:c([...f,...u?[a]:[]],t.route.originFilePath)}}}),q=t(G,async e=>{let{content:t,frontmatter:n}=Y(await e.io.readFile(e.file.absolutePath)),r=await L(t,e.file.path,J(e));return{value:{label:Z(n)??pe(r.source)??Q(e.args.filePath)},entityDeps:r.entityDeps}});function J(e){return{config:e.config,contentDir:e.contentDir,entities:e.entities,file:e.file,io:e.io,logger:e.logger,markdown:e.markdown,plugin:e.plugin}}const ye=e({id:`internal.markdoc`,version:`3.52.0`,content:{filter:{match:e=>e.toLowerCase().endsWith(`.md`)&&!C(e)},extractFile(e,t){if(he(e.path)||P(e.path,t.config))return{routes:[]};if(!u(t.config,`markdown`))return{routes:[],problems:[O(`Markdown pages`)]};let{banner:n,...r}=e.manifest,i=Fe(e,t),a=ge(r.slug),o=K.withArgs({filePath:e.path}),s=q.withArgs({filePath:e.path});return{routes:a.length>0?a.map(e=>({deps:{[p]:o},metadata:r,routeId:`page`,sidebarSubtree:s,slug:e,slugHint:null,template:i})):[{deps:{[p]:o},metadata:r,routeId:`page`,sidebarSubtree:s,slug:null,slugHint:k(e.path),template:i}],entities:[o]}}},loaders:[K,q],templates:{[U]:i(n(`./client/template.tsx`,import.meta.url))}});function Y(e){let t=e.match(F);if(!t)return{content:e,frontmatter:{}};let n=t[1]??``;try{let r=_e.load(n);return{content:e.slice(t[0].length),frontmatter:d(r)?r:{}}}catch(n){let r=n instanceof Error?n.message:String(n);return{content:e.slice(t[0].length),frontmatter:{},frontmatterError:r}}}function be(){return(te()??[]).map(e=>({kind:`file`,path:e}))}function xe(e,t,n,r,i){if(r.length===0&&i===void 0)return[];let a=H(e),o=r.map(e=>Ce(e,a,n,t));if(i!==void 0){let e={start:{line:1},end:{line:n}};o.push({code:`markdown/frontmatter-parse`,message:i,location:{filePath:t,range:e,snippet:V(a,e)}})}return o}function Se(e,t){let{ids:n,exhaustive:r}=fe(e,t);return{kind:`anchor`,exhaustive:r,targets:n}}function Ce(e,t,n,r){let i=e.location?.range;if(!i)return e;let a=M(i,n);return{...e,location:{filePath:r,range:a,snippet:V(t,a)}}}function we(e,t,n){let r=d(t.markdown)?t.markdown:{},i={...e.markdown?.editPage,...d(r.editPage)?r.editPage:{}};if(i.hide!==!0&&typeof i.baseUrl==`string`&&i.baseUrl!==``)return{to:`${i.baseUrl.replace(/(?<!\/)\/+$/,``)}/${n}`}}async function Te(e,t){if(!d(e)||typeof e.image!=`string`)return{seo:e,entityDeps:[],assetUsages:[]};let n=await t.markdown.resolveImageReference(e.image,t.file.path);return n.result.kind===`assetRef`?{seo:{...e,image:n.result.url},entityDeps:n.entityDeps,assetUsages:n.assetUsages}:{seo:e,entityDeps:n.entityDeps,assetUsages:[]}}function Ee(e){let t=/* @__PURE__ */ new Map;if(!u(e,`customMarkdocTags`))for(let e of y())t.set(e,`Custom Markdoc tags are not in this project's plan, so \`${e}\` is ignored.`);if(!u(e,`codeWalkthrough`))for(let e of _)t.set(e,`\`${e}\` is not in this project's plan and is ignored.`);return t}function De(e,t,n){let r=[];if(n.size===0)return r;for(let i of j(e,{getExtraNodes:g})){let e=i.type===`tag`&&i.tag!==void 0?n.get(i.tag):void 0;e!==void 0&&(r.push({code:`configuration/ignored`,message:e,location:{filePath:t,range:m(i)??{start:{line:1},end:{line:1}}}}),h(i,e))}return r}const Oe=[`image`,`links`];async function ke(e,t){let n=t.config.markdown?.frontMatterKeysToResolve??Oe,r={...e},i=[],a=[];for(let o of n){let n=e[o];if(typeof n!=`string`)continue;let s=await t.markdown.resolveLocalReference(n,t.file.path);i.push(...s.entityDeps),a.push(...s.assetUsages),s.result.kind!==`passthrough`&&(r[o]=s.result.url)}return{frontmatter:r,entityDeps:i,assetUsages:a}}async function Ae(e,t){let n=[],r=[];if(!d(e))return{value:e,entityDeps:n,linkRefs:r};let i={...e};for(let a of[`nextButton`,`previousButton`]){let o=e[a];if(!d(o)||typeof o.page!=`string`)continue;let{page:s,...c}=o,l=ue(le(s),t.file.path);l!==null&&r.push({kind:`link`,raw:s,...l});let u=await je(s,t);n.push(...u.entityDeps),i[a]={...c,label:typeof c.label==`string`?c.label:u.route&&await X(u.route,t),link:u.link}}return{value:i,entityDeps:n,linkRefs:r}}async function X(e,t){let n=await A(t.entities,e);if(n!==void 0)return n;let r=t.routes.get(e.slug)?.metadata.seo;return d(r)&&typeof r.title==`string`&&r.title.trim()!==``?r.title:e.slug}async function je(e,t){let n=e.trim(),{path:r,suffix:i}=S(n);if(ce(r)){let e=t.routes.bySlug(f(r));return{link:e&&`${e.slug}${i}`,route:e,entityDeps:[]}}let a=await t.markdown.resolveLocalReference(n,t.file.path);if(a.result.kind!==`pageUrl`)return{entityDeps:a.entityDeps};let o=a.result.url;return{link:o,route:t.routes.bySlug(S(o).path)??a.entityDeps.map(e=>e.kind===`file`?t.routes.byFilePath(e.path):void 0).reverse().find(e=>e!==void 0),entityDeps:a.entityDeps}}function Me(e){let t=/* @__PURE__ */ new Map;for(let n of j(e)){if(n.type!==`tag`||n.tag===void 0||v[n.tag]?.attributes?.__idx===void 0)continue;let e=(t.get(n.tag)??0)+1;t.set(n.tag,e),n.attributes.__idx=e}}function Ne(e,t,n){if(e.banner===void 0)return;let{value:r,problems:i}=D(E,{banner:e.banner});for(let e of i)n?.warn(`${t}: ${e.message}`);return r.banner}function Pe(e,t){return Z(e)??re(t)??void 0}function Z(e){let t=d(e.seo)?e.seo.title:void 0;return typeof t==`string`&&t.trim()!==``?t:void 0}function Q(e){let t=(e.split(`/`).pop()??e).replace(/\.[^.]+$/,``);return t===``?e:t}function Fe(e,t){let n=e.manifest.template;if(typeof n==`string`&&n.trim()!==``)return $(n,e.path,t.logger);let r=ne(e.path,t.config.markdown?.template);return typeof r==`string`&&r.trim()!==``?$(r,`redocly.yaml`,t.logger):U}function $(e,t,n){if(!e.startsWith(`./`)&&!e.startsWith(`../`)&&!e.startsWith(`/`))return e;let r=se(e,t);return r===null?(n.warn(`Template reference "${e}" in ${t} escapes the content root; falling back to ${U}.`),U):`${de}${r}`}export{W as MARKDOC_DOCUMENT_LOADER_ID,ve as MARKDOC_SEARCH_GROUP,G as MARKDOC_SIDEBAR_ITEM_LOADER_ID,U as MARKDOC_TEMPLATE_ID,ye as markdocContentPlugin};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{isMcpHidden as e,isPublicEndpointServedFromConfig as t}from"./server/config-gate.js";import"./constants.js";function n(n){let r=!e(n);return{docs:{enabled:r,name:n.mcp?.name||`Docs MCP server`,publicEndpoint:r&&t(n)}}}export{n as buildMcpAppData};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createInlineEntity as e}from"../../../loaders/define.js";import{isPlanFeatureGranted as t}from"../../../../shared/plan-gates.js";import{
|
|
1
|
+
import{createInlineEntity as e}from"../../../loaders/define.js";import{isPlanFeatureGranted as t}from"../../../../shared/plan-gates.js";import{isMcpHidden as n}from"./server/config-gate.js";import{notInPlanProblem as r}from"../../../plan-gates.js";import{MCP_TOOL_NAME_PATTERN as i}from"../../registry.js";import{CALL_API_WRITE_TOOL_NAME as a,CREATE_ANONYMOUS_SESSION_TOOL_NAME as o,DISCOVER_TOOL_NAME as s,EXECUTE_TOOL_NAME as c,GET_WORKFLOW_TOOL_NAME as l,LIST_WORKFLOWS_TOOL_NAME as u,MANAGE_API_CREDENTIALS_TOOL_NAME as d,MCP_TOOLS_ENTITY_TYPE as f,REMOVE_API_CREDENTIALS_TOOL_NAME as p,RUN_WORKFLOW_TOOL_NAME as m,SUBMIT_FEEDBACK_TOOL_NAME as h}from"./constants.js";import{buildMcpSetupPageRoutes as g}from"./setup-page.js";const _=`@mcp`,v=`mcp/invalid-tool`,y=/\.(ts|js)$/u,b=/\.d\.ts$/u,x=/* @__PURE__ */ new Set([a,`search`,`list-apis`,`get-endpoints`,`get-endpoint-info`,`get-security-schemes`,`get-full-api-description`,`list-graphql-apis`,`get-graphql-type-list`,`get-graphql-type`,`get-graphql-schema`,`list-pages`,`get-page`,`grep-pages`,`whoami`,h,c,s,`describe-tools`,o,d,p,u,l,m]);function S(e){return`mcp-tool-file:${e}`}function C(e){if(b.test(e)||!y.test(e))return!1;let t=e.split(`/`),n=t.indexOf(_);return n!==-1&&n<t.length-1}function w(e,t,n){if(!i.test(e))return`Invalid MCP tool file "${t}": the tool name "${e}" is derived from the file name and may only contain letters, numbers, hyphens, and underscores (max 64 characters). Rename the file.`;if(n!==void 0)return`Duplicate MCP tool name "${e}": defined by both "${n}" and "${t}". Tool names are file names, so each file name must be unique across @mcp folders.`;if(x.has(e))return`Invalid MCP tool file "${t}": the tool name "${e}" is already used by a built-in MCP tool. Rename the file.`}function T(i){let a=[],o=[];if(n(i.config))return{entities:a,problems:o};if(!t(i.config,`customMcpTools`)){for(let{path:e}of i.files)o.push({...r(`Custom MCP tools`),location:{filePath:e}});return{entities:a,problems:o}}let s=/* @__PURE__ */ new Map;for(let{path:t}of i.files){let n=t.slice(t.lastIndexOf(`/`)+1).replace(y,``),r=w(n,t,s.get(n));if(r!==void 0){o.push({code:v,message:r,location:{filePath:t}});continue}s.set(n,t);let i={name:n,sourcePath:t};a.push(e(i,{stableKey:S(t),type:f,metadata:i}))}return{entities:a,problems:o}}const E={filter:{match:C},extractAll(e){return{routes:g(e.config),entities:[]}}};export{_ as MCP_DIR_SEGMENT,v as MCP_TOOL_PROBLEM_CODE,x as RESERVED_MCP_TOOL_NAMES,C as isMcpToolFile,E as mcpContent,S as mcpToolFileEntityKey,T as scanMcpToolFiles};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{compareStrings as e}from"../../../../shared/utils/compare-strings.js";import{delocalizeRouteSlug as t,l10nDirOf as n}from"../../../../shared/utils/l10n.js";import{
|
|
1
|
+
import{compareStrings as e}from"../../../../shared/utils/compare-strings.js";import{delocalizeRouteSlug as t,l10nDirOf as n}from"../../../../shared/utils/l10n.js";import{toPublicVersionedSlug as r}from"../../../../shared/constants/versions.js";import{compileContentGlob as i}from"../../utils/glob.js";import{MCP_IGNORED_ROUTES_ENTITY_KEY as a}from"../../../../shared/constants/mcp.js";const o=/* @__PURE__ */ new Set;function s(e,r){let i=n(r);return(i===void 0?e:t(e,i)??e).replace(/^\/+/,``)}function c(t,n,r,a){if(n.length===0)return[];let o=i(n),c=/* @__PURE__ */ new Set,u=new Set(t.map(e=>e.slug)),d=e=>{let t=l(e,r),n=t!==void 0&&!u.has(t);for(let r of n?[e.slug,t]:[e.slug])if(c.add(r),e.locale===``&&a!==void 0)for(let e of a.locales)c.add(a.toL10nSlug(r,e))};for(let e of t){let t=s(e.slug,e.originFilePath??``);(e.originFilePath!==null&&o(e.originFilePath)||o(t))&&d(e)}return[...c].sort(e)}function l(e,t){if(e.versionGroup&&e.version&&t.get(e.versionGroup)?.defaultVersion===e.version)return r(e.slug,e.versionGroup,e.version,!0)}async function u(e){if(!await e.get(`mcp:ignored-routes`))return o;let t=await e.load(a);return Array.isArray(t)?new Set(t.filter(e=>typeof e==`string`)):o}export{a as MCP_IGNORED_ROUTES_ENTITY_KEY,s as canonicalSlugPath,c as collectIgnoredRouteSlugs,u as readIgnoredRouteSlugs};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineContentPlugin as e}from"../../define.js";import{createInlineEntity as t}from"../../../loaders/define.js";import{runtimeFile as n}from"../../utils/runtime-file.js";import{runtimeTemplate as r}from"../../templates.js";import{
|
|
1
|
+
import{defineContentPlugin as e}from"../../define.js";import{createInlineEntity as t}from"../../../loaders/define.js";import{runtimeFile as n}from"../../utils/runtime-file.js";import{runtimeTemplate as r}from"../../templates.js";import{collectVersionGroups as i,findVersionedDirectories as a}from"../../../versions/version-groups.js";import{MCP_CREDENTIALS_THEME_ENTITY_KEY as o,MCP_IGNORED_ROUTES_ENTITY_KEY as s}from"../../../../shared/constants/mcp.js";import{A2A_ROUTE as c,AGENT_CARD_ROUTE as l,MCP_AUTHORIZATION_SERVER_ROUTE as u,MCP_AUTHORIZE_ROUTE as d,MCP_CALLBACK_ROUTE as f,MCP_CREDENTIALS_ROUTE as p,MCP_PROTECTED_RESOURCE_ROUTE as m,MCP_REGISTER_ROUTE as h,MCP_ROUTE as g,MCP_SERVER_CARD_ROUTE as _,MCP_SETUP_TEMPLATE_ID as v,MCP_TOKEN_ROUTE as y,PUBLIC_MCP_ROUTE as b}from"./constants.js";import{buildMcpAppData as x}from"./app-data.js";import{readCredentialsTheme as S}from"./credentials-theme.js";import{mcpContent as C,scanMcpToolFiles as w}from"./content-tools.js";import{collectIgnoredRouteSlugs as T}from"./ignored-routes.js";import{findMcpRedirectConflict as E}from"./redirects.js";function D(e,t,n,r){return{path:e,auth:`manual`,...r?{method:r}:{},handler:{filePath:t,importer:import.meta.url,exportName:n}}}const O=[D(g,`./server/handler.ts`,`mcp`),D(b,`./server/handler.ts`,`mcpPublic`),D(_,`./server/server-card.ts`,`mcpServerCard`,`GET`),D(m,`./server/oauth/discovery.ts`,`oauthProtectedResource`,`GET`),D(u,`./server/oauth/discovery.ts`,`oauthAuthorizationServer`,`GET`),D(h,`./server/oauth/register.ts`,`mcpRegister`,`POST`),D(d,`./server/oauth/authorize.ts`,`mcpAuthorize`,`GET`),D(y,`./server/oauth/token.ts`,`mcpToken`,`POST`),D(f,`./server/oauth/callback.ts`,`mcpCallback`,`GET`),D(`${f}/*`,`./server/oauth/callback.ts`,`mcpCallback`,`GET`),D(f,`./server/oauth/callback.ts`,`mcpConsent`,`POST`),D(`${f}/*`,`./server/oauth/callback.ts`,`mcpConsent`,`POST`),D(p,`./server/gateway/credentials-handler.ts`,`mcpCredentials`,`ALL`),D(l,`./server/agent-card.ts`,`agentCard`,`GET`),D(c,`./server/agent-card.ts`,`a2a`,`POST`)],k=e({id:`internal.mcp`,version:`1.11.0`,content:C,server:{routes:O},templates:{[v]:r(n(`./client/template.tsx`,import.meta.url))},async finalize(e){let n=E(e.config.redirects);if(n)throw Error(`Redirect "${n.from}" references the reserved MCP route "${n.route}". Remove it: the MCP endpoints are served by the internal.mcp plugin and a redirect would shadow them.`);let r={mcp:x(e.config)},{entities:c,problems:l}=w(e),u=await S(e.io,e.config.palette,t=>e.logger.debug(t));c.push(t(u,{stableKey:o}));let d=e.config.mcp?.ignore??[];if(d.length===0)return{appData:r,problems:l,entities:c};let f=await i({io:e.io,routes:e.routes,versionedDirectories:a(e.routes.all())}),p=T(e.routes.all(),d,f,e.localeContext);return p.length===0?{appData:r,problems:l,entities:c}:(e.logger.debug(`mcp.ignore: hiding ${p.length} routes from the MCP tools`),c.push(t(p,{stableKey:s})),{appData:r,problems:l,entities:c})}});export{k as mcpContentPlugin};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{withPathPrefix as e}from"../../../../../shared/path-prefix.js";import{SKILLS_INDEX_SLUG as t,skillMarkdownPath as n}from"../../../utils/skill-paths.js";import{isEntityScopeVisible as r}from"../../../../../shared/rbac/entity-scope.js";import{notFoundResponse as i}from"../../../../../server/plugin-context.js";import{publicBaseUrl as a}from"../../../utils/request-origin.js";import{isMcpContentProtected as o,isMcpHidden as s,resolveMcpAccess as c}from"./config-gate.js";import{A2A_ROUTE as l,MCP_ROUTE as u,MCP_SERVER_CARD_ROUTE as d}from"../constants.js";import{SKILL_ENTITY_TYPE as f}from"../../../types/skill-entity.js";import{CORS_ANY_ORIGIN as p,MCP_AUTH_SCHEMES as m}from"./oauth/constants.js";import"./auth.js";const h=[`text/plain`],g=[`text/plain`],_={streaming:!1,pushNotifications:!1},v={"Cache-Control":`no-store`};async function y(t,i){let a=!!t.request.viewer?.isAuthenticated;return o(c(t.config))&&!a?[]:(await t.entities.list({type:f})).flatMap(a=>{let{slug:o,title:s,description:c}=a.metadata??{};return typeof o!=`string`||!r(a,t.request.teams,e=>t.logger?.warn(e))?[]:[{id:o,name:s??o,description:c??``,tags:[],url:`${i}${e(n(o))}`}]})}async function b(t,n){if(s(n.config)||n.config.skills?.hide===!0)return i();t.set(`realmCacheControlOwned`,!0);let r=a(n.config,n.request),d=o(c(n.config)),f=n.config.seo;return t.json({name:f?.title||f?.projectTitle||`Developer Documentation`,description:f?.description||`Documentation agent card announcing this site's agent skills and MCP server.`,url:`${r}${e(l)}`,documentationUrl:`${r}${e(`/`)}`,version:`0.0.1`,protocolVersion:`0.3.0`,preferredTransport:`HTTP+JSON`,capabilities:{..._,extensions:[{uri:`https://modelcontextprotocol.io`,description:`Model Context Protocol server exposing the documentation tools and skills.`,params:{url:`${r}${e(u)}`,...d?{authentication:{required:!0,schemes:[...m]}}:{}}}]},defaultInputModes:h,defaultOutputModes:g,skills:await y(n,r)},200,{...v,...p})}function x(n,r){if(s(r.config))return i();let a=[`<${e(d)}>; rel="mcp-server-card"`];return r.config.skills?.hide!==!0&&a.push(`<${e(t)}>; rel="agent-skills"`),n.json({error:{code:`405`,message:`Method not allowed`}},405,{Link:a.join(`, `),...p,"Access-Control-Expose-Headers":`Link`})}export{x as a2a,b as agentCard};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{isObject as e}from"../../../../../shared/utils/is-object.js";import{waitUntil as t}from"../../../../../server/wait-until.js";import"../constants.js";import{thrownErrorClass as n}from"./tool-errors.js";import{redactSecretShapes as r}from"./secret-patterns.js";import{maskBodyCredentials as i,maskCodeCredentials as a}from"./code-credentials.js";import{redactSecretsFromString as o}from"./gateway/fetch/redact.js";import{createHash as s}from"node:crypto";function c(e){return{client:e.client,clientVersion:e.clientVersion,requestId:e.requestId,messageId:e.messageId,callerSubject:e.callerSubject,clientIp:e.request.ip??void 0}}const l=`[mcp-audit]`,u=4096;function d(e){return s(`sha256`).update(e,`utf8`).digest(`hex`)}function f(e){if(e.length<=4096)return e;let t=e.slice(0,u),n=t.search(/\s\S*$/),r=n>0?t.slice(0,n):t;return`${r}…[truncated: kept ${r.length} of ${e.length} chars]`}function p(e,t=[]){return r(o(f(e),t))}const m=/(?<=^|[\s('"])(?:file:\/\/\/?|\/)(?:[^\s()/:'"]+\/)+/gm;function h(e){return p(e.replace(m,``))}function g(e){return{sha256:d(e),bytes:Buffer.byteLength(e,`utf8`)}}function _(e){return Object.keys(e??{}).map(e=>e.toLowerCase()).sort().join(`,`)}const v=/* @__PURE__ */ new Set([`access_token`,`api-key`,`api_key`,`apikey`,`assertion`,`auth`,`client_secret`,`code`,`code_verifier`,`id_token`,`id_token_hint`,`key`,`password`,`refresh_token`,`samlresponse`,`secret`,`session`,`sig`,`signature`,`token`,`x-amz-credential`,`x-amz-security-token`,`x-amz-signature`]);function y(e,t=[],n=[]){let r;try{r=new URL(e)}catch{return p(e,t)}let i=new Set(n.map(e=>e.toLowerCase()));for(let e of[...r.searchParams.keys()]){let t=e.toLowerCase();(v.has(t)||i.has(t))&&r.searchParams.set(e,`redacted`)}return r.username=``,r.password=``,p(r.href,t)}function b(e,t,n){let r=Object.fromEntries(Object.entries(n).filter(([,e])=>e!==void 0&&e!==``));try{e?.info(`${l} ${t}`,r)}catch{}}const x=/(169\.254\.169\.254|metadata\.google\.internal|\.consul\b|\.internal\b|localhost|127\.0\.0\.1|\b10\.\d{1,3}\.\d{1,3}\.\d{1,3}\b|\b192\.168\.\d{1,3}\.\d{1,3}\b|\b172\.(?:1[6-9]|2\d|3[01])\.\d{1,3}\.\d{1,3}\b)/i,S=/(process\s*(?:\.\s*env\b|\[)|globalThis|require\s*\(|__proto__)/;function C(e){let t=[];return S.test(e)&&t.push(`env_probe`),x.test(e)&&t.push(`internal_target`),{sha256:d(e),length:e.length,flags:t.sort().join(`,`)}}function w(e){try{return JSON.stringify(e)??String(e)}catch{return`«[unserializable]»`}}function T(e,{tool:t,mode:n,args:r,result:a,errorClass:o,client:s,clientVersion:c,requestId:l,messageId:u,callerSubject:f,clientIp:m}){if(t===`execute`||t===`call-api_write`)return;let h=w(r),_=a===void 0?void 0:g(a),v=r?.sessionHandle,y=typeof v==`string`&&v!==``?v:void 0,x=f??y;b(e,`Record MCP tool call`,{tool:t,mode:n,server_type:`docs`,error_class:o,client:s,client_version:c,request_id:l,message_id:u,subject_sha256:x?d(x):void 0,client_ip:m,args_sha256:d(h),args:p(i(h),y?[y]:[]),result_sha256:_?.sha256,result_bytes:_?.bytes})}async function E(e,r,i,a){let o={tool:r,mode:e.mcpMode,args:i,...c(e)},s=Date.now(),l;try{l=await a()}catch(i){throw T(e.logger,{...o,errorClass:n(i)}),e.telemetry?.toolThrew(r,Date.now()-s,i),e.telemetry&&t(e.telemetry.flush()),i}let u=O(l)&&l.isError===!0;return T(e.logger,{...o,result:j(l),errorClass:u?`tool_error`:void 0}),e.telemetry?.toolReturned(r,Date.now()-s,l),e.telemetry&&t(e.telemetry.flush()),l}const D=/* @__PURE__ */ new Set([`text`,`image`,`audio`,`resource`,`resource_link`]);function O(t){return e(t)&&Array.isArray(t.content)&&t.content.every(t=>e(t)&&D.has(t.type))}function k(t){return e(t)&&t.resultType===`input_required`}function A(e,t=``){return e.content.map(e=>e.type===`text`?e.text:``).join(t)}function j(e){if(typeof e==`string`)return e;if(O(e))return A(e);if(k(e))return``;try{return JSON.stringify(e)??``}catch{return``}}function M(e,{audit:t,code:n,description:r,sessionHandle:i,toolNames:o,fetchBudget:s,fetchCapable:c,requestId:l,messageId:u,callerSubject:f,clientIp:m}){let h=f??i;b(e,`Record code execution input`,{code_sha256:t.sha256,code_length:t.length,request_id:l,message_id:u,flags:t.flags,subject_sha256:h?d(h):void 0,client_ip:m,description:p(r),tools:[...o].sort().join(`,`),fetch_capable:c,fetch_budget:s,code:p(a(n))})}function N(e,{rawUrl:t,method:n,host:r,outcome:a,durationMs:o,injectedSecretValues:s,credentialQueryParams:c,path:l,api:u,status:f,injectedScheme:m,requestHeaders:h,requestBody:v,responseHeaders:x,responseBody:S,caller:C={}}){let{requestId:w,callerSubject:T,clientIp:E}=C,D=S===void 0?void 0:g(S);b(e,`Record gateway fetch`,{url_sha256:d(t),host:r,method:n,path:l,api:u,outcome:a,status:f,injected_scheme:m,duration_ms:o,request_id:w,subject_sha256:T?d(T):void 0,client_ip:E,url:y(t,s,c),request_header_names:_(h),request_body:v===void 0?void 0:p(i(v),s),response_header_names:_(x),response_sha256:D?.sha256,response_bytes:D?.bytes})}export{u as AUDIT_FIELD_MAX_CHARS,l as AUDIT_LOG_PREFIX,C as auditCode,_ as auditHeaderNames,p as auditInput,d as auditSha256,h as auditStack,E as auditToolCall,y as auditUrl,c as callAttribution,O as isCallToolResult,b as logAuditRecord,M as logCodeExecutionAudit,N as logGatewayFetchAudit,T as logMcpToolCallAudit,j as toolOutputText,A as toolResultText,f as truncateAuditField};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{withPathPrefix as e}from"../../../../../shared/path-prefix.js";import{ANONYMOUS_VIEWER as t}from"../../../../../shared/types/auth.js";import{getBearerVerifier as n,getSessionIssuer as r}from"../../../../../server/auth/middleware.js";import{publicOrigin as i}from"../../../utils/request-origin.js";import{canAccessMcpFeature as a,isMcpContentProtected as o,isPublicEndpointServed as s,resolveMcpAccess as c}from"./config-gate.js";import{isAssistantAnonymousToken as l}from"../../../../../server/ask-ai/assistant-anonymous-token.js";import{MCP_AUTHORIZATION_SERVER_ROUTE as u,MCP_PROTECTED_RESOURCE_ROUTE as d,PUBLIC_MCP_ROUTE as f}from"../constants.js";import{CORS_ANY_ORIGIN as p,CORS_EXPOSE_CHALLENGE as m,SUPPORTED_MCP_SCOPES as h}from"./oauth/constants.js";function g(e){let t=/^Bearer\s+(\S+)$/i.exec((e??``).trim());return t?t[1]:null}function _(t,n){let r=n?[`error="${n.code}"`,`error_description="${n.description}"`]:[];return r.push(`resource_metadata="${t}${e(d)}"`,`scope="${h.join(` `)}"`,`authorization_uri="${t}${e(u)}"`),`Bearer ${r.join(`, `)}`}function v(e,t){return t?`${e}. A public endpoint that serves anonymous-accessible content is available at ${t}.`:e}function y(e,t,n){return new Response(JSON.stringify(t),{status:e,headers:{"Content-Type":`application/json`,"Cache-Control":`no-store`,...n}})}function b(e,t){return y(401,{error:`unauthorized`,message:v(`Authentication required`,t)},{"WWW-Authenticate":_(e),...m})}function x(e,t){return y(401,{error:`invalid_token`,message:v(`Invalid or expired token`,t)},{"WWW-Authenticate":_(e,{code:`invalid_token`,description:`Invalid or expired token`}),...m})}function S(){return y(403,{error:`forbidden`,message:`You do not have access to this MCP server`},{...p})}async function C(u){let{c:d,ctx:p}=u,m=e=>p.logger?.warn(e),h=c(p.config),_=o(h);if(u.forceAnonymous){let e=await p.withViewer(t);return a(h,e.request.teams,!1,m)?{kind:`allow`,ctx:e,isProtected:_}:{kind:`deny`,response:S()}}let v=t=>{let n=i(p.request);return{kind:`deny`,response:t(n,s(p.config,h)?`${n}${e(f)}`:void 0)}},y=p.request.viewer??t,C,w,T=p,E=g(d.req.header(`authorization`)),D=r(d)?.artifactSecret,O=E!==null&&D!==void 0&&await l(E,D);if(!_)w=O||E===null?void 0:E;else if(O)y=t,T=await p.withViewer(t);else if(E!==null){let e=await n(d)?.(E);if(!e)return v(x);y=e.viewer,C=e.claims,w=E,T=await p.withViewer(y)}else if(!y.isAuthenticated)return v(b);return a(h,T.request.teams,y.isAuthenticated,m)?{kind:`allow`,ctx:T,isProtected:_,accessToken:w,claims:C}:{kind:`deny`,response:S()}}export{C as authorizeMcpRequest,o as isMcpContentProtected,s as isPublicEndpointServed,g as readBearerToken,c as resolveMcpAccess};
|