@redocly/framework 1.0.0-next.6 → 1.0.0-next.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundler/build/run.js +1 -1
- package/dist/bundler/build/vite-config.js +2 -2
- package/dist/bundler/dev/dev-content-build.js +1 -0
- package/dist/bundler/dev/dev-problems.js +1 -1
- package/dist/bundler/dev/dev-reporter.js +1 -1
- package/dist/bundler/dev/routes/dev-content-build-route.js +1 -0
- package/dist/bundler/dev/routes/dev-problems-route.js +1 -1
- package/dist/bundler/dev/routes/source-sync-route.js +1 -1
- package/dist/bundler/dev/run.js +1 -1
- package/dist/bundler/dev/runtime-app.js +1 -1
- package/dist/bundler/dev/vite-chunk-url.js +1 -1
- package/dist/bundler/user-markdoc-schema.js +1 -1
- package/dist/bundler/vite-config.base.js +2 -2
- package/dist/cli/commands/build.js +1 -1
- package/dist/cli/commands/dev.js +1 -1
- package/dist/cli/commands/ingest.js +1 -1
- package/dist/cli/commands/translate.js +2 -2
- package/dist/cli/dev-console/{sweep.js → content-build.js} +1 -1
- package/dist/cli/dev-console/index.js +1 -1
- package/dist/cli/dev-console/lines.js +2 -2
- package/dist/cli/dev-console/plain.js +1 -1
- package/dist/cli/dev-console/tui.js +2 -2
- package/dist/cli/log-output/index.js +1 -1
- package/dist/cli/validate-react-pages.js +1 -1
- package/dist/client/ai-search/use-ai-search.js +1 -1
- package/dist/client/analytics-page-view.js +1 -1
- package/dist/client/app.js +3 -3
- package/dist/client/client-entry.js +1 -1
- package/dist/client/contexts.js +1 -1
- package/dist/client/dev-problems/ProblemsBar.js +61 -11
- package/dist/client/dev-problems/build-segment.js +1 -0
- package/dist/client/dev-problems/index.js +1 -1
- package/dist/client/dev-problems/use-dev-problems.js +1 -1
- package/dist/client/feedback.js +1 -1
- package/dist/client/l10n/ssr-l10n.js +1 -1
- package/dist/client/l10n/use-l10n-config.js +1 -1
- package/dist/client/products.js +1 -1
- package/dist/client/review/ReviewBar.js +50 -50
- package/dist/client/review/use-review.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.d.ts +2 -1
- package/dist/content-layer/config.js +1 -1
- package/dist/content-layer/database/invalidation.js +26 -26
- package/dist/content-layer/ingest/finalize-phase.js +1 -1
- package/dist/content-layer/ingest/git-last-modified.js +3 -3
- package/dist/content-layer/ingest/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/search-sync.js +1 -1
- package/dist/content-layer/link-checker/load-view.js +1 -1
- package/dist/content-layer/link-checker/validate.js +1 -1
- package/dist/content-layer/markdown/client/markdown-text.js +1 -1
- package/dist/content-layer/markdown/constants/builtin-tags.js +1 -1
- package/dist/content-layer/markdown/constants/markdown-text-tag-set.js +1 -1
- package/dist/content-layer/markdown/constants/tag-sets.js +1 -1
- package/dist/content-layer/markdown/nodes/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/json-schema.js +1 -1
- package/dist/content-layer/markdown/resolve/markdoc-resolvers/operation-samples.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/server/render.js +1 -1
- package/dist/content-layer/markdown/tags/variant.js +1 -1
- package/dist/content-layer/markdown/utils/parse-cache.js +1 -1
- package/dist/content-layer/materialization/static-files.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/markdown-docs.js +13 -13
- package/dist/content-layer/plugins/internal/api-docs/server/options.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/banner.js +1 -1
- package/dist/content-layer/plugins/internal/app-data/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/index.js +1 -1
- package/dist/content-layer/plugins/internal/l10n/index.js +1 -1
- package/dist/content-layer/plugins/internal/markdoc/client/template.js +1 -1
- package/dist/content-layer/plugins/internal/markdoc/index.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/ignored-routes.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/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 +2 -2
- package/dist/content-layer/plugins/internal/mcp/server/mcp-server.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/oauth/authorize.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/oauth/discovery.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/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/tools/pages-navigation.js +1 -1
- package/dist/content-layer/plugins/internal/mcp/server/tools/search.js +2 -2
- package/dist/content-layer/plugins/internal/mock/server/handler.js +1 -1
- package/dist/content-layer/plugins/internal/react-page/index.js +1 -1
- package/dist/content-layer/plugins/internal/scorecard-classic/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/project/load.js +2 -2
- package/dist/content-layer/plugins/utils/link-access.js +1 -1
- package/dist/content-layer/templates/template-set.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/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/page-handlers.js +1 -1
- package/dist/server/plugin-context.js +1 -1
- package/dist/server/redirects.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/telemetry/mock-server-events.js +1 -0
- package/dist/server/telemetry/redirect-event.js +1 -0
- package/dist/server/telemetry/sender.js +1 -1
- package/dist/shared/constants/content-update.js +1 -1
- package/dist/shared/constants/dev-content-build.js +1 -0
- package/dist/shared/constants/dev-problems.js +1 -1
- package/dist/shared/constants/dev-source-sync.js +1 -1
- package/dist/shared/constants/system-routes.js +1 -1
- package/dist/shared/rbac/l10n-rules.js +1 -1
- package/dist/shared/rbac/team-templates.js +1 -1
- package/dist/shared/types/search.d.ts +7 -2
- package/dist/shared/utils/l10n.js +1 -1
- package/dist/shared/utils/routes/file-path-to-route-slug.js +1 -1
- package/package.json +22 -2
- package/dist/bundler/dev/__tests__/reset-content-update-state.js +0 -1
- package/dist/bundler/dev/materialization-sweeper.js +0 -1
- package/dist/client/dev-problems/sweep-segment.js +0 -1
- package/dist/content-layer/plugins/internal/mcp/server/gateway/__tests__/fake-kv.js +0 -1
- package/dist/content-layer/plugins/internal/mcp/server/gateway/__tests__/secret-store-fixture.js +0 -1
- package/dist/server/__tests__/rbac-fixture.js +0 -1
- package/dist/server/__tests__/test-session.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{L10N_DIR as e}from"../../../shared/constants/l10n/defaults.js";import{delocalizeL10nPath as t,l10nDirOf as n,toLocaleSlug as r}from"../../../shared/utils/l10n.js";import{buildContentAssetUrl as i}from"../../plugins/internal/assets/url.js";import{resolveContentPath as a}from"../../../shared/utils/resolve-content-path.js";import{computePathPrefixes as o}from"../../../shared/utils/routes/compute-path-prefixes.js";import{IMAGE_EXTENSIONS as s}from"../../plugins/internal/assets/extensions.js";import{isRouteSlugTarget as c}from"../../../shared/utils/routes/is-route-slug-target.js";import{safeDecodeURI as l}from"../../../shared/utils/safe-decode-uri.js";import{joinSrcSet as u,parseSrcSet as d}from"../../plugins/internal/assets/srcset.js";import{isIndexPagePath as f,resolveRelativeSlug as p}from"../../../shared/utils/routes/resolve-relative-slug.js";import{posix as m}from"node:path";const h=/[[\]()*_`#!|<>~]|\{%|^\s{0,3}([-+*]\s|\d+\.\s|>|-{3,}|={2,})/m;function g(e){return h.test(e)}function _(e){return e.startsWith(`#`)||e.startsWith(`//`)||/^[a-z][a-z0-9+.-]*:/i.test(e)?!1:!e.startsWith(`/`)||!c(y(e).path)}function v(e){let t=e.indexOf(`?`);return t===-1?[e,``]:[e.slice(0,t),e.slice(t)]}function y(e){let t=e.indexOf(`#`);return t===-1?{path:e,hash:``}:{path:e.slice(0,t),hash:e.slice(t)}}async function b(e,n){let r=await n(e);if(r)return r;let i=t(e);if(i!==void 0){let t=await n(i);if(t){let n=e.slice(0,e.length-i.length),r=t.entityDeps.filter(e=>e.kind===`file`).map(e=>({kind:`file`,path:`${n}${e.path}`}));return{...t,entityDeps:[...r,...t.entityDeps]}}}return{result:{kind:`passthrough`},entityDeps:[],assetUsages:[]}}async function x(e,r){let i=t(e),a=n(e);if(i===void 0||a===void 0)return null;let o=await r(i,a);return o===null?null:{...o,entityDeps:[{kind:`file`,path:e},...o.entityDeps]}}async function S(t,n,r,a,o){let[s]=t.assetUsages;if(!s||!a?.length||t.result.kind!==`assetRef`||n.startsWith(`@l10n/`))return t;let c=i(s.path,s.hash,s.tag),l=[];for(let t of a){let n=`${e}/${t}/${s.path}`,i=r.filesByPath.get(n);if(!i)continue;let a=await o?.(n)??null;l.push({path:n,hash:i.hash,kind:s.kind,tag:a,l10n:{locale:t,canonicalUrl:c}})}return l.length===0?t:{...t,assetUsages:[s,...l]}}function C(e,t){let n=e.routeBySlug.get(t);return n===void 0?o(t).reverse().map(t=>e.routeBySlug.get(t)).find(e=>e?.wildcardPrefix===!0):n}async function w(e,t,n,o,c,u){if(!_(e))return{result:{kind:`passthrough`},entityDeps:[],assetUsages:[]};let{path:d,hash:h}=y(e),g=async(e,t)=>{let a=n.primaryRouteByFilePath.get(e);if(a!==void 0)return{result:{kind:`pageUrl`,url:`${t===void 0?a:r(a,t)}${h}`},entityDeps:[{kind:`file`,path:e}],assetUsages:[]};let c=n.filesByPath.get(e);if(c){let t=m.extname(e).toLowerCase(),n=s.has(t)?`image`:`file`,r=await o?.(e)??null;return{result:{kind:`assetRef`,url:`${i(e,c.hash,r)}${h}`,path:e,hash:c.hash},entityDeps:[{kind:`file`,path:e}],assetUsages:[{path:e,hash:c.hash,kind:n,tag:r}]}}return null};return S(await b(t,async e=>{let t=a(l(d),e);if(t===null)return null;let r=await g(t)??await x(t,g);if(r!==null)return r;let[i=``,o=``]=v(d);if(!d.startsWith(`/`)&&m.extname(i)===``){let t=u??e,r=n.primaryRouteByFilePath.get(t),a=r===void 0?void 0:p(i,r,f(t)),s=a===void 0?void 0:C(n,a);if(a!==void 0&&s!==void 0)return{result:{kind:`pageUrl`,url:`${a}${o}${h}`},entityDeps:s.originFilePath===null?[]:[{kind:`file`,path:s.originFilePath}],assetUsages:[]}}return null}),t,n,c,o)}async function T(e,t,n,r,o){if(!_(e))return{result:{kind:`passthrough`},entityDeps:[],assetUsages:[]};let{path:s}=y(e),c=async e=>{let t=n.filesByPath.get(e);if(!t)return null;let a=await r?.(e)??null;return{result:{kind:`assetRef`,url:i(e,t.hash,a),path:e,hash:t.hash},entityDeps:[{kind:`file`,path:e}],assetUsages:[{path:e,hash:t.hash,kind:`image`,tag:a}]}};return S(await b(t,async e=>{let t=a(l(s),e);return t===null?null:await c(t)??await x(t,c)}),t,n,o,r)}async function E(e,t,n,r,i){let a=[],o=[],s=d(e);if(!s||s.length===0)return{value:e,entityDeps:a,assetUsages:o};let c=await Promise.all(s.map(async e=>{let s=await T(e.src,t,n,r,i);return s.result.kind===`assetRef`&&(a.push(...s.entityDeps),o.push(...s.assetUsages),e.src=s.result.url),e}));return{value:u(c),entityDeps:a,assetUsages:o}}export{_ as isLocalReference,g as looksLikeMarkdown,T as resolveImageReference,E as resolveImageSrcSet,w as resolveLocalReference,y as splitHash};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{getInnerText as e}from"../utils/get-inner-text.js";import{headingSlugger as t}from"../utils/heading-slugger.js";import{builtInMarkdocNodes as n,builtInMarkdocTags as r}from"../constants/builtin-tags.js";import{PROMPT_TAG as i}from"@redocly/theme/core/constants";import a from"@redocly/markdoc";const o=/* @__PURE__ */ new Set([`if`,`else`,i]),s=[`title`,`name`,`label`],c=((e,t)=>typeof t==`string`?t:e??``);function l(e,t={}){return f(e).map(e=>p({type:`document`,children:e},t)).filter(e=>e!==``)}function u(e,n={}){t.reset();let r=[],i=[];for(let t of f(e)){let e=p({type:`document`,children:t},n);e!==``&&(r.push(e),i.push(d(t[0],n.variables)))}return{chunks:r,headings:i}}function d(t,i){if(!v(t)||t.type!==`heading`)return null;let o=a.transform(a.Ast.fromJSON(JSON.stringify(t)),{nodes:n,tags:r,variables:i});if(!a.Tag.isTag(o))return null;let s=typeof o.attributes.id==`string`?o.attributes.id:``;return{heading:e(o.children),anchor:s}}function f(e){let t=v(e)&&Array.isArray(e.children)?e.children:[e],n=[],r=[];for(let e of t)(v(e)&&e.type===`heading`||n.length===0)&&(r=[],n.push(r)),r.push(e);return n}function p(e,t){let n=[];return g(e,n,{listDepth:0,ordered:!1,index:0,options:t}),n.join(``).replace(/(?<![ \t])[ \t]+\n/g,`
|
|
2
2
|
`).replace(/\n{3,}/g,`
|
|
3
3
|
|
|
4
|
-
`).trim()}function m(e,t={}){if(
|
|
4
|
+
`).trim()}function m(e,t={}){if(a.Ast.isVariable(e))return Object.hasOwn(t,String(e.path[0]))?new a.Ast.Variable(e.path).resolve({variables:t}):e;if(Array.isArray(e)){let n;for(let r=0;r<e.length;r++){let i=m(e[r],t);i!==e[r]&&((n??=e.slice())[r]=i)}return n??e}if(!v(e)||a.Ast.isAst(e))return e;let n;for(let[r,i]of Object.entries(e)){let a=m(i,t);a!==i&&((n??={...e})[r]=a)}return n??e}function h(e,t){let n=[];for(let r of e??[])g(r,n,t);return n.join(``).trim()}function g(e,t,n){if(!v(e)||e.type===`tag`&&e.tag!==void 0&&o.has(e.tag))return;let r=e.attributes??{},i=r.content;switch(e.type){case`text`:{let e=a.Ast.isVariable(i)?new a.Ast.Variable(i.path).resolve({variables:n.options.variables}):i;typeof e==`string`&&t.push(e);return}case`code`:typeof i==`string`&&t.push(`\`${i}\``);return;case`fence`:{let a=typeof r.language==`string`?r.language:``,o=[];for(let t of e.children??[])g(t,o,n);let s=e.children?.length?o.join(``):i,c=typeof s==`string`?s.replace(/\n$/,``):``;t.push(`\n\`\`\`${a}\n${c}\n\`\`\`\n\n`);return}case`softbreak`:t.push(`
|
|
5
5
|
`);return;case`hardbreak`:t.push(`
|
|
6
6
|
`);return;case`hr`:t.push(`
|
|
7
7
|
---
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../../../shared/
|
|
1
|
+
import{isObject as e}from"../../../shared/utils/is-object.js";import"../../../shared/constants/content-assets.js";import{stampHeadingIndexes as t}from"../utils/collect-headings.js";import{builtInMarkdocFunctions as n,rbacTeamList as r}from"../constants/builtin-functions.js";import{headingSlugger as i}from"../utils/heading-slugger.js";import{resolveMarkdocTagSet as a}from"../constants/tag-sets.js";import{getPublicEnv as o}from"../../../shared/public-env.js";import{isPackedMarkdocAst as s,unpackMarkdocAst as c}from"../../../shared/utils/packed-ast.js";import{joinSrcSet as l,parseSrcSet as u}from"../../plugins/internal/assets/srcset.js";import{frontmatterVariable as d}from"../utils/frontmatter-variable.js";import f from"@redocly/markdoc";function p(e){let t=e.viewer,n=t?.isAuthenticated===!0;return{userAgent:n?e.userAgent:null,userIp:n?e.ip:null,remoteAddr:{ipAddress:n?e.ip:null},rbac:{teams:r(e.teams)},user:t?.isAuthenticated?{isAuthenticated:!0,name:t.name??null,email:t.email??null,teams:t.teams}:{isAuthenticated:!1,name:null,email:null,teams:[]}}}function m(e){let t=e=>{Array.isArray(e)?e.forEach(t):f.Tag.isTag(e)&&(e.children=e.children.map(e=>typeof e==`object`&&e&&!f.Tag.isTag(e)?JSON.stringify(e,null,2):(t(e),e)))};return t(e),e}function h(e){return!!e&&typeof e==`object`&&e.$$mdtype===`Node`}function g(e){return f.Ast.fromJSON(e)}function _(e){return e.includes(`"$$mdtype":"Node"`)||e.includes(`"$$mdpack":`)?{}:null}async function v(r,i,s,c){let{tags:l,nodes:u,functions:d}=await a(i.tagSet),f=x(r,{functions:d??n,tags:l,nodes:u,variables:{...p(s),env:o(),frontmatter:b(r),lang:c}});e(f)&&f.ast&&t(f.ast);let m=i.l10nAssets?.[c];return m?y(f,m):f}function y(e,t){let n=e=>{if(!e.includes(`/content-assets`))return e;let n=u(e);if(!n||n.length===0)return e;let r=!1,i=n.map(e=>{let n=e.src.search(/[?#]/),i=t[n===-1?e.src:e.src.slice(0,n)];return i===void 0?e:(r=!0,e.src=n===-1?i:`${i}${e.src.slice(n)}`,e)});return r?l(i):e},r=e=>{if(typeof e==`string`)return n(e);if(Array.isArray(e)){let t=!1,n=e.map(e=>{let n=r(e);return t||=n!==e,n});return t?n:e}if(e&&typeof e==`object`){let t=!1,n=Object.entries(e).map(([e,n])=>{let i=r(n);return t||=i!==n,[e,i]});return t?Object.fromEntries(n):e}return e},i=e=>{f.Tag.isTag(e)?(e.attributes=r(e.attributes),e.children.forEach(i)):Array.isArray(e)?e.forEach(i):e&&typeof e==`object`&&Object.values(e).forEach(i)};return i(e),e}function b(t){return e(t)?d(e(t.frontmatter)?t.frontmatter:{},t.title):{}}function x(e,t){i.reset();let n=e=>e instanceof f.Ast.Node,r=e=>{if(n(e))return m(f.transform(e,t));if(s(e)){let n=c(e);return m(f.transform(n,t))}if(h(e))return m(f.transform(f.Ast.fromJSON(JSON.stringify(e)),t));if(Array.isArray(e))return e.length>0&&e.every(n)?m(f.transform(e,t)):e.length>0&&e.every(h)?m(f.transform(f.Ast.fromJSON(JSON.stringify(e)),t)):e.map(r);if(e&&typeof e==`object`){let t={};for(let[n,i]of Object.entries(e))t[n]=r(i);return t}return e};return r(e)}export{p as buildMarkdownRuntimeVariables,_ as detectMarkdocPayloadFlag,h as isMarkdocAstNode,y as localizeMarkdocAssetUrls,g as parseMarkdocPayloadDeep,x as transformMarkdocDeep,v as transformMarkdocPayload};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{headingSlugger as e}from"../utils/heading-slugger.js";import t
|
|
1
|
+
import{headingSlugger as e}from"../utils/heading-slugger.js";import{variant as t}from"@redocly/theme/markdoc/tags/variant";import n from"@redocly/markdoc";import{CONTROL as r}from"@redocly/theme/core/constants/experiments";const i={...t.schema,transform(i,a){let o=()=>new n.Tag(t.schema.render,i.transformAttributes(a),i.transformChildren(a)),{name:s}=i.attributes;return typeof s==`string`&&s!==r?e.withScope(s,o):o()}};export{i as variant};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{MARKDOC_ERROR_TAG as e}from"../tags/markdoc-error.js";import{hashBlobContent as t}from"../../materialization/data-ref.js";import{createLruCache as n}from"../../../shared/utils/lru-cache.js";import{reparseExampleFences as r}from"./reparse-example-fences.js";import i from"@redocly/markdoc";import{htmlTags as a}from"@redocly/markdoc/html";const o={html:a({errorTag:e}),allowIndentation:!0,allowComments:!0,slots:!0};function s(e){return i.parse(e,o)}function c(e){let t=s(e);return r(t,e,s),t}function l(e){let r=n(e);return e=>{let n=t(e),i=r.get(n);if(i!==void 0)return i;let a=c(e);return r.set(n,a),a}}function u(e,t){return i.parseFirstHeading(e,{...o,skip:t})}const d=l({budget:100});export{l as createCachedMarkdownParser,s as parseMarkdown,d as parseMarkdownCached,c as parseMarkdownDocument,u as parseMarkdownFirstHeading};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{compareStrings as e}from"../../shared/utils/compare-strings.js";import{
|
|
1
|
+
import{compareStrings as e}from"../../shared/utils/compare-strings.js";import{isObject as t}from"../../shared/utils/is-object.js";import{getStaticFilesOutputDir as n,getStaticManifestPath as r}from"../../shared/constants/runtime-layout.js";import{isDataRefMarker as i}from"./data-ref.js";import{resolveDataRef as a}from"../database/blobs.js";import{MaterializationError as o}from"../problems/problem-error.js";import{loadEntityRecordByKey as s}from"../database/entities.js";import{updateStaticFileBodies as c}from"../database/static-files.js";import{producerContentType as l,toStaticBodyBytes as u}from"../static/producer-value.js";import{writeFileAtomically as d}from"./asset-reconcile.js";import{join as f}from"node:path";function p(e){return new Set(e.flatMap(e=>e.kind===`producer`&&e.entityKey?[e.entityKey]:[]))}async function m(e){let t=/* @__PURE__ */ new Set;for(let n of e.staleProducers)try{await e.materializeEntity(n)}catch(r){if(!(r instanceof o))throw r;t.add(n.key),e.logger.debug(`Could not materialize the static producer ${n.key}; recorded the problem and moved on`)}let n=[];for(let r of e.rows){let i=e.resolveAudience(r);if(r.kind===`copy`){n.push(h(e.io,e.contentDir,r,i));continue}let a=await g(e.io,e.database,r,i,r.entityKey!==null&&t.has(r.entityKey));a&&n.push(a)}let r=await _(e.io,{contentDir:e.contentDir,entries:n}),i=new Map(e.rows.map(e=>[e.path,e]));return await c(e.database,r.manifest.files.filter(e=>{let t=i.get(e.path);return t?.hash!==e.hash||t.size!==e.size}).map(e=>({path:e.path,hash:e.hash,size:e.size}))),e.logger.info(`Static files: ${r.manifest.files.length} registered, ${r.written.length} written, ${r.removed.length} removed`),r.manifest}function h(e,t,n,r){if(!n.sourcePath||!n.hash)throw Error(`Static file "${n.path}" has no copy source.`);let i=f(t,n.sourcePath);return{path:n.path,hash:n.hash,contentType:n.contentType,audience:r,write:t=>e.copyFile(i,t)}}async function g(e,n,r,o,c){let d=r.entityKey?await s(n,r.entityKey):null;if(!d||d.status!==`ready`&&!c)throw Error(`Static file "${r.path}": producer entity "${r.entityKey}" is not ready.`);let f=d.data;if(!t(f)||!i(f.body)){if(c)return null;throw Error(`Static file "${r.path}": producer "${r.entityKey}" must return { body: BlobReference }.`)}let p=f.body;return{path:r.path,hash:p.blobKey,contentType:l(f,r),audience:o,write:async t=>e.writeFile(t,u(await a(n,p)))}}async function _(t,i){let a=n(i.contentDir),o=r(i.contentDir),s=new Map((await v(t,o))?.files.map(e=>[e.path,e])??[]),c=new Set(await y(t,a)),l=[],u=[];for(let e=0;e<i.entries.length;e+=16)await Promise.all(i.entries.slice(e,e+16).map(async e=>{let n=f(a,...e.path.split(`/`)),r=s.get(e.path),i=r?.hash===e.hash&&c.has(e.path)?r.size:null;i===null&&(await d(t,n,e.write),i=(await t.stat(n))?.size??0,l.push(e.path)),u.push({path:e.path,hash:e.hash,contentType:e.contentType,size:i,audience:e.audience})}));let p=new Set(i.entries.map(e=>e.path)),m=[...c].filter(e=>!p.has(e));await Promise.all(m.map(e=>t.unlink(f(a,...e.split(`/`))))),u.sort((t,n)=>e(t.path,n.path));let h={formatVersion:1,files:u};return await t.writeFile(o,JSON.stringify(h,null,2),{recursive:!0}),{manifest:h,written:l,removed:m}}async function v(e,t){try{let n=JSON.parse(await e.readFile(t));return Array.isArray(n.files)?n:null}catch{return null}}async function y(e,t,n=``){let r=[],i;try{i=await e.readdir(t)}catch{return r}for(let a of i){let i=`${n}${a.name}`;a.type===`directory`?r.push(...await y(e,f(t,a.name),`${i}/`)):a.type===`file`&&r.push(i)}return r}export{p as collectStaticProducerKeys,m as materializeStaticProducers,_ as reconcileStaticFiles};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineContentPlugin as e}from"./define.js";import{ENTITY_LOADER_REFERENCE_KIND as t,INLINE_ENTITY_REFERENCE_KIND as n,createEntityLoader as r,createInlineEntity as i,createInlineEntityReference as a,isEntityLoaderReference as o,isInlineEntityReference as s,isRawEntityReference as c}from"../loaders/define.js";import{resolveRuntimeFilePath as l,runtimeFile as u}from"./utils/runtime-file.js";import{SERVER_FN_REFERENCE_KIND as d,STORED_ENTITY_REFERENCE_KIND as f,createServerFn as p,createStoredEntityReference as m,getRegisteredServerFnLoader as h,isServerFnReference as g,normalizeServerFnId as _,resolveServerModuleReference as v}from"./server-fn.js";import{createPluginScopedId as y}from"./utils/scoped-id.js";import{runtimeTemplate as b}from"./templates.js";import"./internal/api-functions/constants.js";import{createContentPluginIO as
|
|
1
|
+
import{defineContentPlugin as e}from"./define.js";import{ENTITY_LOADER_REFERENCE_KIND as t,INLINE_ENTITY_REFERENCE_KIND as n,createEntityLoader as r,createInlineEntity as i,createInlineEntityReference as a,isEntityLoaderReference as o,isInlineEntityReference as s,isRawEntityReference as c}from"../loaders/define.js";import{resolveRuntimeFilePath as l,runtimeFile as u}from"./utils/runtime-file.js";import{SERVER_FN_REFERENCE_KIND as d,STORED_ENTITY_REFERENCE_KIND as f,createServerFn as p,createStoredEntityReference as m,getRegisteredServerFnLoader as h,isServerFnReference as g,normalizeServerFnId as _,resolveServerModuleReference as v}from"./server-fn.js";import{createPluginScopedId as y}from"./utils/scoped-id.js";import{runtimeTemplate as b}from"./templates.js";import{APP_DATA_STATIC_DATA_SLUG as x}from"../../shared/constants/app-data.js";import{SIDEBAR_ROUTE_DEP_KEY as S}from"../../shared/constants/route-deps.js";import"./internal/api-functions/constants.js";import{createContentPluginIO as C,createPluginIO as w,createRecordingPluginIO as T}from"./io.js";import{STATIC_FOLDER_PLUGIN_ID as E,STATIC_FOLDER_PREFIX as D,isStaticFolderPath as O,staticFolderContentPlugin as k}from"./internal/static-folder/index.js";import{MCP_TOOL_NAME_PATTERN as A,createContentPluginRegistry as j,matchesContentPluginFilter as M,resolveContentPluginsForFile as N}from"./registry.js";import{dedupeFileDependencies as P,extractFileContributions as F,runContentPluginFinalize as I}from"./execute.js";import{createSourceFile as L}from"./source-file.js";import{createRouteIndex as R,createRouteQueryEvaluator as z,dedupeRouteQueryDependencies as B,isRouteQueryStale as V}from"./utils/route-index.js";import{SPEC_KIND_ARAZZO as H,SPEC_KIND_ASYNCAPI as U,SPEC_KIND_GRAPHQL as W,SPEC_KIND_OPENAPI as G}from"../../shared/constants/api-spec-kinds.js";import{MOCK_SERVER_ROUTE_PREFIX as K,mockPathPrefix as q}from"./types/api-entity.js";import{createContentOriginKey as J}from"./utils/origin-key.js";import{ASSETS_PLUGIN_ID as Y,ASSET_ENTITY_KEY_PREFIX as X,assetsContentPlugin as Z}from"./internal/assets/index.js";import{FOLDER_SIDEBAR_FILENAME_REGEX as Q,SIDEBAR_AGGREGATOR_LOADER_ID as $,SIDEBAR_FILENAME_REGEX as ee,SIDEBAR_PLUGIN_ID as te,isTabbedSidebar as ne,resolveAutoSidebar as re,sidebarContentPlugin as ie}from"./internal/sidebar/index.js";import{APP_DATA_PLUGIN_ID as ae,APP_DATA_PLUGIN_VERSION as oe,APP_DATA_STATIC_DATA_LOADER_ID as se,appDataContentPlugin as ce,appDataSystemEntityDescriptor as le,buildConfigAppData as ue,isAppDataFragment as de}from"./internal/app-data/index.js";import{BUILT_IN_CLASSIC_PLUGINS as fe,DEFAULT_PROJECT_PLUGIN_FILES as pe,INTERNAL_PLUGIN_ID_PREFIX as me,PLAN_GATED_PLUGINS as he}from"./project/constants.js";import{getLoadedProjectPlugins as ge,setLoadedProjectPlugins as _e,warnWhenProjectPluginsAreNotLoaded as ve}from"./project/loaded-set.js";import{apiDocsContentPlugin as ye}from"./internal/api-docs/index.js";import{API_FUNCTIONS_PLUGIN_ID as be,apiFunctionsContentPlugin as xe}from"./internal/api-functions/index.js";import{CATALOG_CLASSIC_LOADER_ID as Se,CATALOG_CLASSIC_PLUGIN_ID as Ce,CATALOG_CLASSIC_SERVER_FN_ID as we,CATALOG_CLASSIC_SIDEBARS_LOADER_ID as Te,CATALOG_CLASSIC_TEMPLATE_ID as Ee,catalogClassicContentPlugin as De}from"./internal/catalog-classic/index.js";import{L10N_PLUGIN_ID as Oe}from"./internal/l10n/translations-loader.js";import{L10N_PLUGIN_VERSION as ke,l10nContentPlugin as Ae}from"./internal/l10n/index.js";import{MARKDOC_DOCUMENT_LOADER_ID as je,MARKDOC_SEARCH_GROUP as Me,MARKDOC_SIDEBAR_ITEM_LOADER_ID as Ne,MARKDOC_TEMPLATE_ID as Pe,markdocContentPlugin as Fe}from"./internal/markdoc/index.js";import{mcpContentPlugin as Ie}from"./internal/mcp/index.js";import{MOCK_SERVER_PLUGIN_ID as Le,MOCK_SERVER_ROUTE_PATH as Re,mockServerContentPlugin as ze}from"./internal/mock/index.js";import{REACT_PAGE_SEARCH_LOADER_KEY as Be,reactPageContentPlugin as Ve}from"./internal/react-page/index.js";import{REVISIONS_PLUGIN_ID as He,revisionsContentPlugin as Ue}from"./internal/revisions/index.js";import{SCORECARD_CLASSIC_PLUGIN_ID as We,SCORECARD_CLASSIC_TEMPLATE_ID as Ge,scorecardClassicContentPlugin as Ke}from"./internal/scorecard-classic/index.js";import{SKILLS_PLUGIN_ID as qe,SKILL_MARKDOWN_ROUTE_PATH as Je,skillsContentPlugin as Ye}from"./internal/skills/index.js";import{VERSIONS_PLUGIN_ID as Xe,versionsContentPlugin as Ze}from"./internal/versions/index.js";import{createInternalContentPlugins as Qe}from"./internal/index.js";import{createContentPlugins as $e}from"./create-content-plugins.js";import{createProjectPluginLoadError as et,formatProjectPluginDiagnostics as tt,loadAndRegisterProjectPlugins as nt,loadProjectPlugins as rt,readPluginEntries as it,resolveProjectPluginPath as at}from"./project/load.js";import{reloadProjectPluginsIfChanged as ot}from"./project/reload.js";export{be as API_FUNCTIONS_PLUGIN_ID,ae as APP_DATA_PLUGIN_ID,oe as APP_DATA_PLUGIN_VERSION,se as APP_DATA_STATIC_DATA_LOADER_ID,x as APP_DATA_STATIC_DATA_SLUG,Y as ASSETS_PLUGIN_ID,X as ASSET_ENTITY_KEY_PREFIX,fe as BUILT_IN_CLASSIC_PLUGINS,Se as CATALOG_CLASSIC_LOADER_ID,Ce as CATALOG_CLASSIC_PLUGIN_ID,we as CATALOG_CLASSIC_SERVER_FN_ID,Te as CATALOG_CLASSIC_SIDEBARS_LOADER_ID,Ee as CATALOG_CLASSIC_TEMPLATE_ID,pe as DEFAULT_PROJECT_PLUGIN_FILES,t as ENTITY_LOADER_REFERENCE_KIND,Q as FOLDER_SIDEBAR_FILENAME_REGEX,n as INLINE_ENTITY_REFERENCE_KIND,me as INTERNAL_PLUGIN_ID_PREFIX,Oe as L10N_PLUGIN_ID,ke as L10N_PLUGIN_VERSION,je as MARKDOC_DOCUMENT_LOADER_ID,Me as MARKDOC_SEARCH_GROUP,Ne as MARKDOC_SIDEBAR_ITEM_LOADER_ID,Pe as MARKDOC_TEMPLATE_ID,A as MCP_TOOL_NAME_PATTERN,Le as MOCK_SERVER_PLUGIN_ID,Re as MOCK_SERVER_ROUTE_PATH,K as MOCK_SERVER_ROUTE_PREFIX,he as PLAN_GATED_PLUGINS,Be as REACT_PAGE_SEARCH_LOADER_KEY,He as REVISIONS_PLUGIN_ID,We as SCORECARD_CLASSIC_PLUGIN_ID,Ge as SCORECARD_CLASSIC_TEMPLATE_ID,d as SERVER_FN_REFERENCE_KIND,$ as SIDEBAR_AGGREGATOR_LOADER_ID,ee as SIDEBAR_FILENAME_REGEX,te as SIDEBAR_PLUGIN_ID,S as SIDEBAR_ROUTE_DEP_KEY,qe as SKILLS_PLUGIN_ID,Je as SKILL_MARKDOWN_ROUTE_PATH,H as SPEC_KIND_ARAZZO,U as SPEC_KIND_ASYNCAPI,W as SPEC_KIND_GRAPHQL,G as SPEC_KIND_OPENAPI,E as STATIC_FOLDER_PLUGIN_ID,D as STATIC_FOLDER_PREFIX,f as STORED_ENTITY_REFERENCE_KIND,Xe as VERSIONS_PLUGIN_ID,ye as apiDocsContentPlugin,xe as apiFunctionsContentPlugin,ce as appDataContentPlugin,le as appDataSystemEntityDescriptor,Z as assetsContentPlugin,ue as buildConfigAppData,De as catalogClassicContentPlugin,J as createContentOriginKey,C as createContentPluginIO,j as createContentPluginRegistry,$e as createContentPlugins,r as createEntityLoader,i as createInlineEntity,a as createInlineEntityReference,Qe as createInternalContentPlugins,w as createPluginIO,y as createPluginScopedId,et as createProjectPluginLoadError,T as createRecordingPluginIO,R as createRouteIndex,z as createRouteQueryEvaluator,p as createServerFn,L as createSourceFile,m as createStoredEntityReference,P as dedupeFileDependencies,B as dedupeRouteQueryDependencies,e as defineContentPlugin,F as extractFileContributions,tt as formatProjectPluginDiagnostics,ge as getLoadedProjectPlugins,h as getRegisteredServerFnLoader,de as isAppDataFragment,o as isEntityLoaderReference,s as isInlineEntityReference,c as isRawEntityReference,V as isRouteQueryStale,g as isServerFnReference,O as isStaticFolderPath,ne as isTabbedSidebar,Ae as l10nContentPlugin,nt as loadAndRegisterProjectPlugins,rt as loadProjectPlugins,Fe as markdocContentPlugin,M as matchesContentPluginFilter,Ie as mcpContentPlugin,q as mockPathPrefix,ze as mockServerContentPlugin,_ as normalizeServerFnId,Ve as reactPageContentPlugin,it as readPluginEntries,ot as reloadProjectPluginsIfChanged,re as resolveAutoSidebar,N as resolveContentPluginsForFile,at as resolveProjectPluginPath,l as resolveRuntimeFilePath,v as resolveServerModuleReference,Ue as revisionsContentPlugin,I as runContentPluginFinalize,u as runtimeFile,b as runtimeTemplate,Ke as scorecardClassicContentPlugin,_e as setLoadedProjectPlugins,ie as sidebarContentPlugin,Ye as skillsContentPlugin,k as staticFolderContentPlugin,Ze as versionsContentPlugin,ve as warnWhenProjectPluginsAreNotLoaded};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{withPathPrefix as e}from"../../../../../shared/path-prefix.js";import{ApiDocsLayoutContext as t,PageContext as n}from"../../../../../client/contexts.js";import{expandSecurityRequestValues as r,useDynamicRequestValues as i}from"../../../../../client/ApiAccess.js";import{MarkdocRenderer as a,markdocComponents as o}from"../../../../markdown/client/markdoc-components.js";import{API_DOCS_INFO_BLOCK_DEP_KEY as s,API_DOCS_RENDER_DEP_KEY as c,apiPageTitle as l}from"../server/shared.js";import{rebaseItemLinks as u}from"./rebase-item-links.js";import{apiDocsTelemetryConfig as d}from"../../../../../client/telemetry/config.js";import{withReplayOptions as f}from"../../../../../client/replay-options.js";import{REPLAY_OAUTH2_ROUTE_PATH as p}from"../../../../../shared/constants/replay.js";import{JsonSchemaTag as m}from"../../../../markdown/client/JsonSchemaTag.js";import{JsonExample as h}from"../../../../markdown/client/OpenapiTagComponents.js";import{withEventHandlers as g}from"./event-handlers.js";import{useContext as _,useEffect as v,useMemo as y}from"react";import b from"styled-components";import{useLocation as x}from"react-router";import{Fragment as S,jsx as C,jsxs as w}from"react/jsx-runtime";import{useThemeConfig as T}from"@redocly/theme/core/hooks";import{LayoutVariant as E}from"@redocly/theme/components/SidebarActions/SidebarActions";import{useLoaderData as D}from"virtual:realm-runtime";import{userMarkdocComponents as O}from"virtual:realm-markdoc-components";import{RedoclyApiDocs as k,apiDocsMarkdocComponents as A}from"@redocly/api-docs";import{Breadcrumbs as j}from"@redocly/theme/components/Breadcrumbs/Breadcrumbs";import{CatalogClassicInfoBlock as M}from"@redocly/theme/components/CatalogClassic/CatalogClassicInfoBlock";import{MissingTranslationNotice as N}from"@redocly/theme/components/MissingTranslationNotice/MissingTranslationNotice";import{ThreePanelLayout as P}from"@redocly/theme/layouts/ThreePanelLayout";const F={...o,JsonSchema:O.JsonSchema??m,JsonExample:O.JsonExample??h,...A},I={parse:e=>e,render:e=>/* @__PURE__ */ C(a,{ast:e,components:F})},L={MiddlePanelHeader:R};function R(){return/* @__PURE__ */ w(S,{children:[/* @__PURE__ */ C(j,{}),/* @__PURE__ */ C(U,{})]})}function z(e){return(e.length>1&&e.endsWith(`/`)?e.slice(0,-1):e).toLowerCase()}function B({page:e}){let n=D(c),a=D(s),{layout:o}=_(t),l=V(),p=i(),m=y(()=>{if(!n)return n;let e=r(p,Object.values(n.store.securitySchemeStore??{}));return{...g(f(n.options)),oAuth2RedirectURI:H(),userClaims:l,unstable_hooks:L,dynamicRequestValues:e}},[n,l,p]),h=e.slug.toLowerCase(),v=y(()=>n&&n.basePath!==h?u(n.items,n.basePath,h):n?.items,[n,h]);if(G(e.metadata,v,n?.title),!n)return null;let b=d();return/* @__PURE__ */ w(S,{children:[a&&/* @__PURE__ */ C(W,{layout:o,children:/* @__PURE__ */ C(M,{metadata:a})}),/* @__PURE__ */ C(k,{items:v,store:n.store,options:m,basePath:h,layout:o,markdownAdapter:I,telemetryConfig:b})]})}function V(){let e=_(n)?.auth?.userInfo,t=e?.isAuthenticated?e.email:void 0,r=e?.isAuthenticated?e.name:void 0;return y(()=>({email:t,name:r}),[t,r])}function H(){if(typeof window<`u`)return new URL(e(p),window.location.origin).toString()}const U=b(N)`
|
|
2
2
|
width: 100%;
|
|
3
3
|
`,W=b(P)`
|
|
4
4
|
&& {
|
|
5
5
|
padding-right: ${({layout:e})=>e===E.THREE_PANEL?`calc(var(--panel-gap-horizontal) * 2)`:`var(--panel-gap-horizontal)`};
|
|
6
6
|
}
|
|
7
|
-
`;function G(e,t,n){let{pathname:r}=x(),{seo:
|
|
7
|
+
`;function G(e,t,n){let{pathname:r}=x(),{seo:i}=T(),a=i?.projectTitle,o=t?l(e,t,z(r),n):void 0;v(()=>{o&&(document.title=a?`${o} | ${a}`:o)},[o,a])}export{B as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineContentPlugin as e}from"../../define.js";import{createEntityLoader as t}from"../../../loaders/define.js";import{runtimeFile as n}from"../../utils/runtime-file.js";import{runtimeTemplate as r}from"../../templates.js";import{SEARCH_API_TITLE_FACET_FIELD as i,SEARCH_API_VERSION_FACET_FIELD as a,SEARCH_GROUP_FACET_FIELD as o}from"../../../../shared/search/facets.js";import{configuredFacetFields as s,extractFacetsFromFrontmatter as c,invalidFacetValueProblems as l,searchCategoryOf as u}from"../../../search/facet-values.js";import{isPlanFeatureGranted as d}from"../../../../shared/plan-gates.js";import{toPosixPath as f}from"../../../../shared/utils/to-posix-path.js";import{TRANSLATIONS_FILE_PATTERN as p}from"../../../../shared/constants/l10n/defaults.js";import{isObject as m}from"../../../../shared/utils/is-object.js";import{notInPlanProblem as h}from"../../../plan-gates.js";import{filePathToRouteSlug as g}from"../../../../shared/utils/routes/file-path-to-route-slug.js";import{SPEC_KIND_ARAZZO as _,SPEC_KIND_ASYNCAPI as v,SPEC_KIND_GRAPHQL as y,SPEC_KIND_OPENAPI as b}from"../../../../shared/constants/api-spec-kinds.js";import{packMarkdocAstsDeep as x,unpackMarkdocAstsDeep as S}from"../../../../shared/utils/packed-ast.js";import{parseMarkdownCached as C}from"../../../markdown/utils/parse-cache.js";import{createApiEntityKey as w}from"../../utils/api-entity-key.js";import{API_DOCS_API_LOADER_ID as ee,API_DOCS_PLUGIN_ID as T,API_DOCS_RENDER_DEP_KEY as te,API_DOCS_RENDER_LOADER_ID as ne,API_DOCS_SIDEBAR_LOADER_ID as E,API_DOCS_TEMPLATE_ID as D,SPEC_DOWNLOAD_ROUTE_PATHS as O,SPEC_PATH_PARAM as k}from"./server/shared.js";import{resolveApiBundleConfig as re,resolveApiOptions as ie,resolveNestedFeedback as ae,schemaCatalogLink as oe,withDownloadUrls as se,withFeedbackOption as ce,withMockServerOption as le}from"./server/options.js";import{annotateApiDocsRbac as ue}from"../../../../shared/rbac/api-docs.js";import{SERVER_ONLY_VALUE_KEY as A}from"../../../loaders/server-only-value.js";import{getLoadedProjectPlugins as de}from"../../project/loaded-set.js";import{API_OUTPUT_MANIFEST_KEY as j}from"../../../api-outputs.js";import{API_DOCS_MARKDOC_TAG_SET as M,resolveMarkdocTagSet as N}from"../../../markdown/constants/tag-sets.js";import{pageLocale as P}from"../../utils/page-locale.js";import{buildBundledApiDefinition as F,resolveLlmsDescriptions as I}from"./server/build-definition.js";import{collectSidebarSubpathTargets as L,toSidebarSubtree as R,toSubpathTarget as z}from"./server/build-sidebar.js";import{buildApiDocsMarkdownDocs as B}from"./server/markdown-docs.js";import{join as V,relative as H}from"node:path";import fe from"@redocly/markdoc";const pe=[`.yaml`,`.yml`,`.json`,`.gql`,`.graphql`],me={[b]:`OpenAPI`,[v]:`AsyncAPI`,[y]:`GraphQL`,[_]:`Arazzo`},U=t(ne,async e=>{let{buildItems:t}=await import(`@redocly/api-docs/server`),n=K(e),r=await e.io.readFile(n.absolutePath),i=e.routes.byFilePath(e.file.path)?.slug,a=se(e.args.options,e.file.path,e.args.kind),o=e.args.kind===`openapi`?le(a,e.config,i):a,s={entityDeps:[],assetUsages:[],linkRefs:[],problems:[],pending:[]},c=G(e.contentDir),l={markdown:e.markdown,loader:{config:e.config,entities:e.entities,file:e.file,io:e.io,logger:e.logger,plugin:e.plugin},sink:s},u=await F({kind:e.args.kind,source:r,relativePath:n.relativePath,contentDir:e.contentDir,pagePath:e.file.path,options:o,bundle:q(e.args,c),metadata:X(e.args.options),markdownResolution:l,rbac:{warn:t=>e.logger?.warn(t)}}),d={...m(u.document)&&m(u.document.info)?{infoDescription:u.document.info.description}:{},...await I(u.document,l,{contentDir:e.contentDir,specPath:n.relativePath,pagePath:e.file.path})};e.args.kind===`openapi`&&o.showSchemaCatalogLinks&&m(u.document)&&(u.document[`x-schema-catalog-link`]=oe(e.file.path)),u.options=ce(u.options,u.document,e.args.feedback??e.config.feedback);let f=i?.toLowerCase()??`/`,{items:p,store:h,specType:g}=await t({...u,basePath:f,markdownParser:e=>fe.compact(C(e))}),_=JSON.stringify({items:x(p),store:x(h),options:u.options,specType:g,basePath:f,title:be(u.document,e.args.kind,p),metadata:ye(u.document),[A]:{llms:d}});return{value:await e.createBlobRef(_,{format:`json`}),entityDeps:[...Y(e.file.path,[...u.fileDependencies,...c.paths]),...s.entityDeps],assetUsages:s.assetUsages,markdoc:{tagSet:M},linkRefs:s.linkRefs,problems:s.problems}},{async searchable(e,t){if(t.route===void 0||t.route.metadata.excludeFromSearch===!0)return{docs:[]};let n=S(e),r=await Ee(t.entities,t.route.originFilePath),d={...t.route.metadata,...m(n.metadata)?n.metadata:{}},{category:f,isInvalid:p}=u(d),{facets:h,invalidFields:g}=c({[i]:t.route.metadata.title,[a]:t.route.metadata.version,...d},s(t.config)),{buildApiDocsSearchDocuments:_}=await import(`./server/search-documents.js`);return{..._(n,r,{groupKey:f,facets:h,warn:e=>t.logger?.warn(e)}),problems:l([...g,...p?[o]:[]],t.route.originFilePath)}},async markdown(e,t){if(t.route===void 0)return null;let n=S(e),r=t.route.originFilePath??void 0,i=r?await t.entities.load(w(r)).catch(()=>void 0):void 0,{tags:a}=await N(M);return B(n,ve(i,n[A]?.llms),r,{tags:a,locale:P(t)})},usesProjectMarkdocSchema:!0}),W=t(ee,async e=>{let t=K(e),n=await e.io.readFile(t.absolutePath),r=G(e.contentDir),i=await F({kind:e.args.kind,source:n,relativePath:t.relativePath,contentDir:e.contentDir,bundle:q(e.args,r),metadata:X(e.args.options)}),a=e.args.kind===y,o=a?n:JSON.stringify(i.document);return{value:o.length>65536?await e.createBlobRef(o,{format:a?`text`:`json`}):a?n:i.document,metadata:{...Z(e.file.path,e.args.kind,e.args.options,e.args.rbac),...ge(i.document,e.routes.byFilePath(e.file.path)?.slug)},entityDeps:Y(e.file.path,[...i.fileDependencies,...r.paths])}});function G(e){let t=de(e)?.lintPlugins??[];return{plugins:t,paths:t.map(t=>f(H(e,t.path))).filter(e=>e!==``&&!e.startsWith(`../`))}}function K(e){let t=e.args.source?.path??e.file.path;return{relativePath:t,absolutePath:V(e.contentDir,t)}}function he(e){let t=e[j];return m(t)&&typeof t.root==`string`?t.root:void 0}function q(e,t){let{config:n,configDir:r}=e.bundleConfig??{config:{},configDir:``};return{config:n,configDir:r,plugins:t.plugins}}function ge(e,t){let n=m(e)&&m(e.info)?e.info:{},r=m(n[`x-metadata`])?n[`x-metadata`]:{},i=typeof n.description==`string`?n.description.trim():``;return{...t===void 0?{}:{routeSlug:t},...Q(n.version)?{version:String(n.version)}:{},...typeof r.apiId==`string`?{apiId:r.apiId}:{},description:i||void 0}}const J=t(E,async e=>{let{buildNavItems:t,collectPreviousRouteSlugs:n}=await import(`@redocly/api-docs/server`),r=await e.entities.load(w(e.file.path)),i=e.args.kind===`graphql`?(await import(`graphql`)).parse(r):r,a=ue(i,e.args.kind,{warn:t=>e.logger?.warn(t)}),{items:o}=await t({type:e.args.kind,document:a,options:e.args.options,basePath:`/`,markdownParser:C}),s=R(o),c=n(o).map(({from:e})=>z(e));return{value:s,targetInventories:[{kind:`subpath`,exhaustive:!0,targets:[...L(s),...c]}]}});function Y(e,t){return[{kind:`file`,path:e},...t.map(e=>({kind:`file`,path:e}))]}const _e={arazzo:`Arazzo Docs`,asyncapi:`AsyncAPI Docs`,graphql:`GraphQL Docs`,openapi:`OpenAPI Docs`};function ve(e,t){if(t===void 0||!m(e))return e;let n=m(e.info)?e.info:{},r=m(e.components)?e.components:{};return{...e,...t.infoDescription===void 0?{}:{info:{...n,description:t.infoDescription}},...t.servers===void 0?{}:{servers:t.servers},...t.securitySchemes===void 0?{}:{components:{...r,securitySchemes:t.securitySchemes}}}}function ye(e){let t=m(e)&&m(e.info)?e.info:{};return m(t[`x-metadata`])?t[`x-metadata`]:{}}function be(e,t,n){let r=m(e)&&m(e.info)?e.info:{};if(typeof r.title==`string`&&r.title!==``)return r.title;let i=m(n[0])?n[0].label:void 0;return typeof i==`string`&&i!==``?i:_e[t]}const xe=[`rbac`,`sidebar`,`excludeFromSearch`,`template`];function Se(e,t){let n=m(e.manifest.info)?e.manifest.info:{},r={};typeof n.title==`string`&&(r.title=n.title),Q(n.version)&&(r.version=String(n.version)),typeof n.summary==`string`&&(r.summary=n.summary),m(n[`x-metadata`])&&Object.assign(r,n[`x-metadata`]),m(t.metadata)&&Object.assign(r,t.metadata);for(let e of xe)delete r[e];return r}function X(e){return m(e.metadata)?e.metadata:void 0}function Ce(e){let t=X(e)?.title;return typeof t==`string`&&t.length>0?t:void 0}function Z(e,t,n,r){let i=Ce(n);return{specType:t,sourcePath:e,...i===void 0?{}:{title:i},...r===void 0?{}:{rbac:r},...Object.keys(n).length>0?{options:n}:{},...m(n.mockServer)?{mockServer:n.mockServer}:{}}}function Q(e){return typeof e==`string`||typeof e==`number`}function we(e){if(e.ext===`.gql`||e.ext===`.graphql`)return y;let{openapi:t,swagger:n,asyncapi:r,arazzo:i}=e.manifest;return Q(t)||Q(n)?b:Q(r)?v:Q(i)?_:null}const Te=e({id:T,version:`0.45.0`,content:{filter:{extensions:pe},async extractFile(e,t){if(p.test(e.path))return null;let n=we(e);if(n===null)return null;if(n!==`arazzo`&&!d(t.config,n))return{routes:[],problems:[h(`${me[n]} documents`)]};let r=e.path,i=he(e.manifest),a=i??r,{rbac:o,...s}=await ie(t.io,t.config,r,n,a),c={filePath:r,kind:n,options:s,...o===void 0||!d(t.config,`rbac`)?{}:{rbac:o}};i!==void 0&&(c.source={path:i});let l=await ae(t.io,t.config,a);if(l!==void 0&&(c.feedback=l),n!==`graphql`){let e=await re(t.io,t.config,r,a);Object.keys(e.config).length>0&&(c.bundleConfig=e)}let u=W.withArgs(c,{stableKey:w(r),type:`api`,metadata:Z(r,n,s,c.rbac)});if(n===`arazzo`)return{routes:[],entities:[u]};let f=Se(e,s);s.excludeFromSearch===!0&&(f.excludeFromSearch=!0),f.type=n,c.rbac!==void 0&&(f.rbac=c.rbac);let m=U.withArgs(c,{stableKey:`api-docs:render:${r}`}),_=J.withArgs(c,{stableKey:`api-docs:sidebar:${r}`}),v=g(r);return{routes:[{deps:{[te]:m},metadata:f,routeId:`page`,sidebarSubtree:_,slug:null,slugHint:v,template:D,wildcardPrefix:!0}],entities:[u,m,_]}}},loaders:[W,U,J],templates:{[D]:r(n(`./client/template.tsx`,import.meta.url))},server:{routes:[$(O.bundle,`bundle`),$(O.deprecatedBundle,`bundle`),$(O.graphql,`graphql`)]}});function $(e,t){return{method:`GET`,path:e+k,handler:{filePath:`./server/spec-download.ts`,importer:import.meta.url,exportName:t}}}async function Ee(e,t){if(t)try{return await e.load(w(t))}catch{return}}export{Te as apiDocsContentPlugin};
|
|
1
|
+
import{defineContentPlugin as e}from"../../define.js";import{createEntityLoader as t}from"../../../loaders/define.js";import{runtimeFile as n}from"../../utils/runtime-file.js";import{runtimeTemplate as r}from"../../templates.js";import{SEARCH_API_TITLE_FACET_FIELD as i,SEARCH_API_VERSION_FACET_FIELD as a,SEARCH_GROUP_FACET_FIELD as o}from"../../../../shared/search/facets.js";import{configuredFacetFields as s,extractFacetsFromFrontmatter as c,invalidFacetValueProblems as l,searchCategoryOf as u}from"../../../search/facet-values.js";import{isPlanFeatureGranted as d}from"../../../../shared/plan-gates.js";import{TRANSLATIONS_FILE_PATTERN as f}from"../../../../shared/constants/l10n/defaults.js";import{isObject as p}from"../../../../shared/utils/is-object.js";import{API_DOCS_API_LOADER_ID as m,API_DOCS_PLUGIN_ID as h,API_DOCS_RENDER_DEP_KEY as g,API_DOCS_RENDER_LOADER_ID as _,API_DOCS_SIDEBAR_LOADER_ID as ee,API_DOCS_TEMPLATE_ID as v,SPEC_DOWNLOAD_ROUTE_PATHS as y,SPEC_PATH_PARAM as te}from"./server/shared.js";import{API_DOCS_MARKDOC_TAG_SET as b,resolveMarkdocTagSet as ne}from"../../../markdown/constants/tag-sets.js";import{toPosixPath as x}from"../../../../shared/utils/to-posix-path.js";import{notInPlanProblem as re}from"../../../plan-gates.js";import{filePathToRouteSlug as ie}from"../../../../shared/utils/routes/file-path-to-route-slug.js";import{SPEC_KIND_ARAZZO as S,SPEC_KIND_ASYNCAPI as C,SPEC_KIND_GRAPHQL as w,SPEC_KIND_OPENAPI as T}from"../../../../shared/constants/api-spec-kinds.js";import{packMarkdocAstsDeep as E,unpackMarkdocAstsDeep as D}from"../../../../shared/utils/packed-ast.js";import{parseMarkdownCached as O}from"../../../markdown/utils/parse-cache.js";import{createApiEntityKey as k}from"../../utils/api-entity-key.js";import{resolveApiBundleConfig as ae,resolveApiOptions as oe,resolveNestedFeedback as se,schemaCatalogLink as ce,withDownloadUrls as le,withFeedbackOption as ue,withMockServerOption as de}from"./server/options.js";import{annotateApiDocsRbac as fe}from"../../../../shared/rbac/api-docs.js";import{SERVER_ONLY_VALUE_KEY as A}from"../../../loaders/server-only-value.js";import{getLoadedProjectPlugins as j}from"../../project/loaded-set.js";import{API_OUTPUT_MANIFEST_KEY as M}from"../../../api-outputs.js";import{pageLocale as N}from"../../utils/page-locale.js";import{buildBundledApiDefinition as P,resolveLlmsDescriptions as F}from"./server/build-definition.js";import{collectSidebarSubpathTargets as I,toSidebarSubtree as L,toSubpathTarget as R}from"./server/build-sidebar.js";import{buildApiDocsMarkdownDocs as z}from"./server/markdown-docs.js";import{join as B,relative as V}from"node:path";import pe from"@redocly/markdoc";const me=[`.yaml`,`.yml`,`.json`,`.gql`,`.graphql`],he={[T]:`OpenAPI`,[C]:`AsyncAPI`,[w]:`GraphQL`,[S]:`Arazzo`},H=t(_,async e=>{let{buildItems:t}=await import(`@redocly/api-docs/server`),n=G(e),r=await e.io.readFile(n.absolutePath),i=e.routes.byFilePath(e.file.path)?.slug,a=le(e.args.options,e.file.path,e.args.kind),o=e.args.kind===`openapi`?de(a,e.config,i):a,s={entityDeps:[],assetUsages:[],linkRefs:[],problems:[],pending:[]},c=W(e.contentDir),l={markdown:e.markdown,loader:{config:e.config,entities:e.entities,file:e.file,io:e.io,logger:e.logger,plugin:e.plugin},sink:s},u=await P({kind:e.args.kind,source:r,relativePath:n.relativePath,contentDir:e.contentDir,pagePath:e.file.path,options:o,bundle:K(e.args,c),metadata:Y(e.args.options),markdownResolution:l,rbac:{warn:t=>e.logger?.warn(t)}}),d={...p(u.document)&&p(u.document.info)?{infoDescription:u.document.info.description}:{},...await F(u.document,l,{contentDir:e.contentDir,specPath:n.relativePath,pagePath:e.file.path})};e.args.kind===`openapi`&&o.showSchemaCatalogLinks&&p(u.document)&&(u.document[`x-schema-catalog-link`]=ce(e.file.path)),u.options=ue(u.options,u.document,e.args.feedback??e.config.feedback);let f=i?.toLowerCase()??`/`,{items:m,store:h,specType:g}=await t({...u,basePath:f,markdownParser:e=>pe.compact(O(e))}),_=JSON.stringify({items:E(m),store:E(h),options:u.options,specType:g,basePath:f,title:xe(u.document,e.args.kind,m),metadata:be(u.document),[A]:{llms:d}});return{value:await e.createBlobRef(_,{format:`json`}),entityDeps:[...J(e.file.path,[...u.fileDependencies,...c.paths]),...s.entityDeps],assetUsages:s.assetUsages,markdoc:{tagSet:b},linkRefs:s.linkRefs,problems:s.problems}},{async searchable(e,t){if(t.route===void 0||t.route.metadata.excludeFromSearch===!0)return{docs:[]};let n=D(e),r=await Ee(t.entities,t.route.originFilePath),d={...t.route.metadata,...p(n.metadata)?n.metadata:{}},{category:f,isInvalid:m}=u(d),{facets:h,invalidFields:g}=c({[i]:t.route.metadata.title,[a]:t.route.metadata.version,...d},s(t.config)),{buildApiDocsSearchDocuments:_}=await import(`./server/search-documents.js`);return{..._(n,r,{groupKey:f,facets:h,warn:e=>t.logger?.warn(e)}),problems:l([...g,...m?[o]:[]],t.route.originFilePath)}},async markdown(e,t){if(t.route===void 0)return null;let n=D(e),r=t.route.originFilePath??void 0,i=r?await t.entities.load(k(r)).catch(()=>void 0):void 0,{tags:a}=await ne(b);return z(n,ye(i,n[A]?.llms),r,{tags:a,locale:N(t)})},usesProjectMarkdocSchema:!0}),U=t(m,async e=>{let t=G(e),n=await e.io.readFile(t.absolutePath),r=W(e.contentDir),i=await P({kind:e.args.kind,source:n,relativePath:t.relativePath,contentDir:e.contentDir,bundle:K(e.args,r),metadata:Y(e.args.options)}),a=e.args.kind===w,o=a?n:JSON.stringify(i.document);return{value:o.length>65536?await e.createBlobRef(o,{format:a?`text`:`json`}):a?n:i.document,metadata:{...Z(e.file.path,e.args.kind,e.args.options,e.args.rbac),..._e(i.document,e.routes.byFilePath(e.file.path)?.slug)},entityDeps:J(e.file.path,[...i.fileDependencies,...r.paths])}});function W(e){let t=j(e)?.lintPlugins??[];return{plugins:t,paths:t.map(t=>x(V(e,t.path))).filter(e=>e!==``&&!e.startsWith(`../`))}}function G(e){let t=e.args.source?.path??e.file.path;return{relativePath:t,absolutePath:B(e.contentDir,t)}}function ge(e){let t=e[M];return p(t)&&typeof t.root==`string`?t.root:void 0}function K(e,t){let{config:n,configDir:r}=e.bundleConfig??{config:{},configDir:``};return{config:n,configDir:r,plugins:t.plugins}}function _e(e,t){let n=p(e)&&p(e.info)?e.info:{},r=p(n[`x-metadata`])?n[`x-metadata`]:{},i=typeof n.description==`string`?n.description.trim():``;return{...t===void 0?{}:{routeSlug:t},...Q(n.version)?{version:String(n.version)}:{},...typeof r.apiId==`string`?{apiId:r.apiId}:{},description:i||void 0}}const q=t(ee,async e=>{let{buildNavItems:t,collectPreviousRouteSlugs:n}=await import(`@redocly/api-docs/server`),r=await e.entities.load(k(e.file.path)),i=e.args.kind===`graphql`?(await import(`graphql`)).parse(r):r,a=fe(i,e.args.kind,{warn:t=>e.logger?.warn(t)}),{items:o}=await t({type:e.args.kind,document:a,options:e.args.options,basePath:`/`,markdownParser:O}),s=L(o),c=n(o).map(({from:e})=>R(e));return{value:s,targetInventories:[{kind:`subpath`,exhaustive:!0,targets:[...I(s),...c]}]}});function J(e,t){return[{kind:`file`,path:e},...t.map(e=>({kind:`file`,path:e}))]}const ve={arazzo:`Arazzo Docs`,asyncapi:`AsyncAPI Docs`,graphql:`GraphQL Docs`,openapi:`OpenAPI Docs`};function ye(e,t){if(t===void 0||!p(e))return e;let n=p(e.info)?e.info:{},r=p(e.components)?e.components:{};return{...e,...t.infoDescription===void 0?{}:{info:{...n,description:t.infoDescription}},...t.servers===void 0?{}:{servers:t.servers},...t.securitySchemes===void 0?{}:{components:{...r,securitySchemes:t.securitySchemes}}}}function be(e){let t=p(e)&&p(e.info)?e.info:{};return p(t[`x-metadata`])?t[`x-metadata`]:{}}function xe(e,t,n){let r=p(e)&&p(e.info)?e.info:{};if(typeof r.title==`string`&&r.title!==``)return r.title;let i=p(n[0])?n[0].label:void 0;return typeof i==`string`&&i!==``?i:ve[t]}const Se=[`rbac`,`sidebar`,`excludeFromSearch`,`template`];function Ce(e,t){let n=p(e.manifest.info)?e.manifest.info:{},r={};typeof n.title==`string`&&(r.title=n.title),Q(n.version)&&(r.version=String(n.version)),typeof n.summary==`string`&&(r.summary=n.summary),p(n[`x-metadata`])&&Object.assign(r,n[`x-metadata`]),p(t.metadata)&&Object.assign(r,t.metadata);for(let e of Se)delete r[e];return r}function Y(e){return p(e.metadata)?e.metadata:void 0}function X(e){let t=Y(e)?.title;return typeof t==`string`&&t.length>0?t:void 0}function Z(e,t,n,r){let i=X(n);return{specType:t,sourcePath:e,...i===void 0?{}:{title:i},...r===void 0?{}:{rbac:r},...Object.keys(n).length>0?{options:n}:{},...p(n.mockServer)?{mockServer:n.mockServer}:{}}}function Q(e){return typeof e==`string`||typeof e==`number`}function we(e){if(e.ext===`.gql`||e.ext===`.graphql`)return w;let{openapi:t,swagger:n,asyncapi:r,arazzo:i}=e.manifest;return Q(t)||Q(n)?T:Q(r)?C:Q(i)?S:null}const Te=e({id:h,version:`0.45.0`,content:{filter:{extensions:me},async extractFile(e,t){if(f.test(e.path))return null;let n=we(e);if(n===null)return null;if(n!==`arazzo`&&!d(t.config,n))return{routes:[],problems:[re(`${he[n]} documents`)]};let r=e.path,i=ge(e.manifest),a=i??r,{rbac:o,...s}=await oe(t.io,t.config,r,n,a),c={filePath:r,kind:n,options:s,...o===void 0||!d(t.config,`rbac`)?{}:{rbac:o}};i!==void 0&&(c.source={path:i});let l=await se(t.io,t.config,a);if(l!==void 0&&(c.feedback=l),n!==`graphql`){let e=await ae(t.io,t.config,r,a);Object.keys(e.config).length>0&&(c.bundleConfig=e)}let u=U.withArgs(c,{stableKey:k(r),type:`api`,metadata:Z(r,n,s,c.rbac)});if(n===`arazzo`)return{routes:[],entities:[u]};let p=Ce(e,s);s.excludeFromSearch===!0&&(p.excludeFromSearch=!0),p.type=n,c.rbac!==void 0&&(p.rbac=c.rbac);let m=H.withArgs(c,{stableKey:`api-docs:render:${r}`}),h=q.withArgs(c,{stableKey:`api-docs:sidebar:${r}`}),_=ie(r);return{routes:[{deps:{[g]:m},metadata:p,routeId:`page`,sidebarSubtree:h,slug:null,slugHint:_,template:v,wildcardPrefix:!0}],entities:[u,m,h]}}},loaders:[U,H,q],templates:{[v]:r(n(`./client/template.tsx`,import.meta.url))},server:{routes:[$(y.bundle,`bundle`),$(y.deprecatedBundle,`bundle`),$(y.graphql,`graphql`)]}});function $(e,t){return{method:`GET`,path:e+te,handler:{filePath:`./server/spec-download.ts`,importer:import.meta.url,exportName:t}}}async function Ee(e,t){if(t)try{return await e.load(k(t))}catch{return}}export{Te as apiDocsContentPlugin};
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{isObject as e}from"../../../../../shared/utils/is-object.js";import{SPEC_DOWNLOAD_ROUTE_PATHS as t}from"./shared.js";import{headingSlugger as n}from"../../../../markdown/utils/heading-slugger.js";import{RBAC_TEAM_ANONYMOUS as r}from"../../../../../shared/rbac/types.js";import{canView as i,isRbacScope as a,resolveRole as o}from"../../../../../shared/rbac/engine.js";import{parseMarkdown as s}from"../../../../markdown/utils/parse-cache.js";import{markdocAstToMarkdownChunks as c}from"../../../../markdown/search/to-markdown.js";import{REDOCLY_TEAMS_RBAC as l}from"@redocly/config";const u=e=>{let t=e[l];return t!==void 0&&!i(o(a(t)?t:{},[r]))};function d(t,n,r,i={}){let a=/* @__PURE__ */ new Map,o=e=>{let t=y(e)?e:{type:`document`,children:Array.isArray(e)?e:[e]};return c(t,i)},l=e=>{if(typeof e!=`string`)return o(e);if(!e.includes(`{%`)){let t=e.trim();return t===``?[]:[t]}let t=a.get(e);return t===void 0&&(t=o(s(e)),a.set(e,t)),t},d=[],m=/* @__PURE__ */ new Set,h=t.items,g=e(t.store)?t.store.schemaStore:{},x=e(n)?n:void 0,S=x?.security,C=e(x?.info)?x.info:{},w=(e,t,n,r)=>{d.push({routeSlug:e,chunks:t,headings:f(t),...typeof n==`string`&&n!==``?{title:n}:{},...r?{description:r}:{}})},T=e(C[`x-metadata`])?C[`x-metadata`]:{},E=l((typeof T.description==`string`?T.description:void 0)??C.description).join(`
|
|
2
2
|
|
|
3
|
-
`),D=
|
|
4
|
-
`,1)[0]??``);if(!t)return null;let
|
|
3
|
+
`),D=e=>{let n=e.content,i=n?.contentType??(e.items?.length&&e.link?`group`:void 0);if(!u(e)&&typeof e.link==`string`&&i!==void 0){let a=i===`overview`,o=e.link;if(!m.has(o)){if(a&&n)m.add(o),w(o,p({doc:x,info:C,description:E,specType:t.specType,items:h,originFilePath:r,renderMarkdown:l}),C.title,E);else if(i===`item`&&n)m.add(o),w(o,v(e,{info:C,schemaStore:g,document:x,globalSecurity:S,specType:t.specType,renderMarkdown:l}),e.label);else if(i===`group`){m.add(o);let t=e.deprecated===!0||n?.meta?.deprecated===!0,r=_(e.items??[],l);w(o,[`# ${e.label??``}${t?` (deprecated)`:``}`.trim(),...b(n?.children??[],l),...r?[r]:[]].filter(e=>e!==``),e.label)}}}for(let t of e.items??[])D(t)};for(let e of h)D(e);return d}function f(e){return n.reset(),e.map(e=>{let t=/^#{1,6} +(?! )(.+)$/.exec(e.split(`
|
|
4
|
+
`,1)[0]??``);if(!t)return null;let r=t[1].trim();return{heading:r,anchor:n.slug(r)}})}function p(t){let{doc:n,info:r}=t,i=[],a=[];typeof r.title==`string`&&r.title&&a.push(`# ${r.title}`),t.description&&a.push(t.description),typeof r.summary==`string`&&r.summary&&a.push(r.summary);let o=[];r.version!==void 0&&r.version!==``&&o.push(`Version: ${String(r.version)}`);let s=e(r.license)?r.license:void 0;typeof s?.name==`string`&&o.push(`License: ${s.name}`);let c=e(r[`x-metadata`])?r[`x-metadata`]:void 0;if(c){let e=Object.entries(c).filter(([,e])=>typeof e==`string`||typeof e==`number`).filter(([e,t])=>e!==`description`||typeof t!=`string`).map(([e,t])=>`- ${e}: ${String(t)}`);e.length>0&&o.push(`Metadata:\n${e.join(`
|
|
5
5
|
`)}`)}o.length>0&&a.push(o.join(`
|
|
6
|
-
`)),a.length>0&&
|
|
6
|
+
`)),a.length>0&&i.push(a.join(`
|
|
7
7
|
|
|
8
|
-
`));let l=m(t
|
|
8
|
+
`));let l=m(n,t.renderMarkdown);l&&i.push(l);let u=h(n,t.renderMarkdown);u&&i.push(u);let d=g(t.specType,r,t.originFilePath);d&&i.push(d);let f=_(t.items,t.renderMarkdown);return f&&i.push(f),i}function m(t,n){let r=t?.servers;if(!Array.isArray(r)||r.length===0)return;let i=`## Servers
|
|
9
9
|
|
|
10
|
-
`;for(let
|
|
10
|
+
`;for(let t of r){if(!e(t))continue;let r=n(t.description).join(`
|
|
11
11
|
|
|
12
|
-
`);if(
|
|
13
|
-
`;for(let[
|
|
14
|
-
`}}return
|
|
12
|
+
`);if(r&&(i+=`${r}\n`),i+=`\`\`\`\n${String(t.url??``)}\n\`\`\`\n\n`,e(t.variables)){i+=`Variables:
|
|
13
|
+
`;for(let[r,a]of Object.entries(t.variables)){if(!e(a))continue;let t=n(a.description).join(` `).replace(/\s+/g,` `);i+=`- \`${r}\`${t?`: ${t}`:``}\n`,a.default!==void 0&&(i+=` Default: ${JSON.stringify(a.default)}\n`),Array.isArray(a.enum)&&(i+=` Enum: ${a.enum.map(e=>JSON.stringify(e)).join(`, `)}\n`)}i+=`
|
|
14
|
+
`}}return i.trim()}function h(t,n){let r=e(t?.components)?t.components:void 0,i=e(r?.securitySchemes)?r.securitySchemes:void 0;if(!i)return;let a=`## Security
|
|
15
15
|
|
|
16
|
-
`;for(let[
|
|
16
|
+
`;for(let[t,r]of Object.entries(i)){if(!e(r)||`$ref`in r)continue;a+=`### ${t}\n\n`;let i=n(r.description).join(`
|
|
17
17
|
|
|
18
|
-
`);
|
|
18
|
+
`);i&&(a+=`${i}\n\n`);for(let[e,t]of[[`Type`,`type`],[`In`,`in`],[`Name`,`name`],[`Scheme`,`scheme`],[`Bearer Format`,`bearerFormat`],[`OpenID Connect URL`,`openIdConnectUrl`]])typeof r[t]==`string`&&r[t]&&(a+=`${e}: ${r[t]}\n`);let o=e(r.flows)?r.flows:void 0,s=[o?.implicit,o?.password,o?.clientCredentials,o?.authorizationCode].find(e);if(s&&(typeof s.authorizationUrl==`string`&&(a+=`Authorization URL: ${s.authorizationUrl}\n`),typeof s.tokenUrl==`string`&&(a+=`Token URL: ${s.tokenUrl}\n`),e(s.scopes))){a+=`Scopes:
|
|
19
19
|
`;for(let[e,t]of Object.entries(s.scopes))a+=`- \`${e}\`: ${String(t)}\n`}a+=`
|
|
20
|
-
`}return a.trim()}function g(e,
|
|
20
|
+
`}return a.trim()}function g(e,n,r){if(!r)return;let i=typeof n.title==`string`&&n.title?n.title:void 0;if(e===`openapi`||e===`asyncapi`){let n=e===`openapi`?`OpenAPI`:`AsyncAPI`;return`## Download ${n} description\n\n[${i??`${n} definition`}](${t.bundle}/${r})`}if(e===`graphql`)return`## Download GraphQL schema\n\n[${i??`GraphQL schema`}](${t.graphql}/${r})`}function _(e,t){let n=``,r=(e,i)=>{for(let a of e)if(!(u(a)||typeof a.link!=`string`)){if(a.content?.contentType===`group`)n+=`${i} ${a.label??``}\n\n`,a.items?.length&&r(a.items,`${i}#`);else if(a.content?.contentType===`item`){let e=a.httpVerb&&a.httpPath?`${a.httpVerb.toUpperCase()} ${a.httpPath}`:a.label??``,r=x(a.content.children??[],t),i=r?`: ${r.slice(0,200)}`:``;n+=`- [${e}](${a.link}.md)${i}\n`}}};return r(e,`##`),n.trim()===``?void 0:n.trim()}function v(e,t){let n=e.content,r=n?.children??[],i=e.deprecated===!0||n?.meta?.deprecated===!0,a=[`# ${e.label??``}${i?` (deprecated)`:``}`.trim()];a.push(...b(r,t.renderMarkdown));let o=[];if(t.specType===`openapi`||t.specType===`asyncapi`){e.httpVerb&&e.httpPath?o.push(`Endpoint: ${e.httpVerb.toUpperCase()} ${e.httpPath}`):e.httpVerb&&o.push(`Method: ${e.httpVerb.toUpperCase()}`),t.info.version!==void 0&&t.info.version!==``&&o.push(`Version: ${String(t.info.version)}`);let n=S(r,t.globalSecurity);n&&o.push(`Security: ${n}`)}if(o.length>0&&a.push(o.join(`
|
|
21
21
|
`)),t.specType!==`graphql`){let e=C(r,{schemaStore:t.schemaStore,document:t.document,renderMarkdown:t.renderMarkdown});e.length>0&&a.push(P(e))}return a.filter(e=>e!==``)}function y(e){return typeof e==`object`&&!!e&&e.type===`document`}function b(e,t){let n=[],r=e=>{if(!u(e)){if(e.nodeType===`markdoc`){n.push(...t(e.content));return}if(e.nodeType===`container`||e.nodeType===`overview-section-wrapper`)for(let t of e.children??[])r(t)}};for(let t of e)r(t);return n}function x(e,t){return b(e,t).join(` `).replace(/\s+/g,` `).trim()}function S(e,t){let n=[],r=e=>{for(let t of e)if(t.nodeType===`security`){let e=t.requirements;for(let t of e??[])for(let e of t.schemes??[])u(e)||e.name&&!n.includes(e.name)&&n.push(e.name)}else(t.nodeType===`container`||t.nodeType===`overview-section-wrapper`)&&r(t.children??[])};if(r(e),n.length>0)return n.join(`, `);if(t?.length){let e=[...new Set(t.flatMap(e=>Object.keys(e)))];if(e.length>0)return e.join(`, `)}}function C(e,t){let n=/* @__PURE__ */ new Map,r=/* @__PURE__ */ new Set,i=e=>{for(let a of e)if(a.nodeType===`item-content`){if(u(a))continue;for(let e of a.parameters??[])!u(e)&&e.name&&w(n,{name:e.name,path:[],place:E(a.variant),type:O(e.schemaId,t),required:e.required??!1,description:T(e.description,t.renderMarkdown)});D(a,n,r,t)}else if(a.nodeType===`container`||a.nodeType===`overview-section-wrapper`){if(u(a))continue;i(a.children??[])}};return i(e),[...n.values()]}function w(e,t){e.set([...t.path,t.name].join(`.`)+t.description+t.place,t)}function T(e,t){return e==null?``:t(e).join(`
|
|
22
22
|
|
|
23
|
-
`)}function E(e){switch(e){case`query`:return`query parameters`;case`path`:return`path parameters`;case`headers`:return`header parameters`;case`cookies`:return`cookie parameters`;case`parameters`:return`channel parameters`;case`body`:return`request fields`;case`responses`:return`response fields`;default:return e?`${e} parameters`:`parameters`}}function D(e,t,n,r){let i=E(e.variant),a=i.startsWith(`response`);if(e.mediaTypeSchemas){let o=Object.values(e.mediaTypeSchemas).find(e=>!u(e));o?.schemaId&&k(o.schemaId,i,a,t,n,r)}else e.schemaId&&k(e.schemaId,i,a,t,n,r);for(let n of e.responses??[]){if(u(n))continue;let e=`response ${n.code??``} fields`.replace(` `,` `),i=/* @__PURE__ */ new Set,a=(n.mediaTypeContent?Object.values(n.mediaTypeContent).find(e=>!u(e)):void 0)?.schemaId??n.schemaId;a&&k(a,e,!0,t,i,r)}for(let n of e.messages??[])!u(n)&&n.name&&w(t,{name:n.name,path:[],place:`message`,type:`unknown`,required:!1,description:`${T(n.description,r.renderMarkdown)} ${n.summary??``}`.trim()})}function O(
|
|
23
|
+
`)}function E(e){switch(e){case`query`:return`query parameters`;case`path`:return`path parameters`;case`headers`:return`header parameters`;case`cookies`:return`cookie parameters`;case`parameters`:return`channel parameters`;case`body`:return`request fields`;case`responses`:return`response fields`;default:return e?`${e} parameters`:`parameters`}}function D(e,t,n,r){let i=E(e.variant),a=i.startsWith(`response`);if(e.mediaTypeSchemas){let o=Object.values(e.mediaTypeSchemas).find(e=>!u(e));o?.schemaId&&k(o.schemaId,i,a,t,n,r)}else e.schemaId&&k(e.schemaId,i,a,t,n,r);for(let n of e.responses??[]){if(u(n))continue;let e=`response ${n.code??``} fields`.replace(` `,` `),i=/* @__PURE__ */ new Set,a=(n.mediaTypeContent?Object.values(n.mediaTypeContent).find(e=>!u(e)):void 0)?.schemaId??n.schemaId;a&&k(a,e,!0,t,i,r)}for(let n of e.messages??[])!u(n)&&n.name&&w(t,{name:n.name,path:[],place:`message`,type:`unknown`,required:!1,description:`${T(n.description,r.renderMarkdown)} ${n.summary??``}`.trim()})}function O(t,n){if(!t)return`unknown`;let r=n.schemaStore[t];return!e(r)||r.kind!==`json-schema`?`unknown`:M(j(r.data,n))}function k(t,n,r,i,a,o){let s=o.schemaStore[t];e(s)&&s.kind===`json-schema`&&!u(s)&&N(s.data,n,r,i,[],a,0,o)}function A(t,n){if(!t.startsWith(`#/`)||!n.document)return;let r=n.document;for(let e of t.slice(2).split(`/`)){if(typeof r!=`object`||!r)return;r=r[e]}return e(r)?r:void 0}function j(e,t){if(e.allOf){let n={};for(let r of e.allOf){let e=r.$ref?A(r.$ref,t):r;if(e){let t=n.properties,r=n.required;Object.assign(n,e),(t||e.properties)&&(n.properties={...t??{},...e.properties??{}}),(r||e.required)&&(n.required=[...r??[],...e.required??[]])}}return delete n.allOf,e.description&&(n.description=e.description),n}if(e.$ref){let n=A(e.$ref,t);if(n){let t={...n};return e.description&&(t.description=e.description),t}}return e}function M(e){return Array.isArray(e.type)?e.type.join(` | `):e.type?e.type:e.properties||e.additionalProperties?`object`:e.items?`array`:e.enum?`string`:`any`}function N(t,n,r,i,a,o,s,c){if(!(s>10||u(t))){if(t.$ref){if(o.has(t.$ref))return;o.add(t.$ref);let e=A(t.$ref,c);e&&N(e,n,r,i,a,o,s,c);return}if(t.allOf){N(j(t,c),n,r,i,a,o,s,c);return}if(t.discriminator&&t.properties&&t.oneOf){N({...t,oneOf:void 0,discriminator:void 0},n,r,i,a,o,s,c);return}if(t.oneOf||t.anyOf){for(let e of t.oneOf??t.anyOf??[]){if(e.$ref){if(o.has(e.$ref))continue;o.add(e.$ref)}let t=e.$ref?A(e.$ref,c):e;t&&N(t,n,r,i,a,o,s+1,c)}return}if(t.properties){let e=t.required??[];for(let[l,d]of Object.entries(t.properties)){if(u(d))continue;if(d.$ref){if(o.has(d.$ref))continue;o.add(d.$ref)}let t=d.$ref?A(d.$ref,c):d;if(!t)continue;let f=j(t,c);if(u(t)||u(f)||f.readOnly&&!r||f.writeOnly&&r||t.additionalProperties!==void 0&&!t.properties)continue;let p=t.example??f.example;w(i,{name:l,path:a,place:n,type:M(f),required:e.includes(l),description:T(t.description??f.description,c.renderMarkdown),enumValues:Array.isArray(f.enum)&&f.enum.length>0?f.enum:void 0,example:p===void 0?void 0:(typeof p==`string`?p:JSON.stringify(p)).slice(0,200)}),(f.properties||f.items)&&N(f,n,r,i,[...a,l],o,s+1,c)}}if(t.items&&e(t.items)&&!Array.isArray(t.items)){let e=t.items;if(e.$ref){if(o.has(e.$ref))return;o.add(e.$ref)}let l=e.$ref?A(e.$ref,c):e;l&&N(l,n,r,i,a,o,s+1,c)}}}function P(e){let t=/* @__PURE__ */ new Map;for(let n of e){let e=t.get(n.place);e?e.push(n):t.set(n.place,[n])}let n=[];for(let[e,r]of t){let t=r.map(e=>{let t=`- \`${[...e.path,e.name].join(`.`)}\` (${e.type}${e.required?`, required`:``})`,n=e.description.replace(/\s+/g,` `).trim();return n&&(t+=`\n ${n}`),e.enumValues?t+=`\n Enum: ${e.enumValues.map(e=>JSON.stringify(e)).join(`, `)}`:e.example&&(t+=`\n Example: ${e.example}`),t});n.push(`## ${e.charAt(0).toUpperCase()}${e.slice(1)}\n\n${t.join(`
|
|
24
24
|
`)}`)}return n.join(`
|
|
25
25
|
|
|
26
26
|
`)}export{d as buildApiDocsMarkdownDocs};
|
|
@@ -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{toPosixPath as i}from"../../../../../shared/utils/to-posix-path.js";import{isMissingError as a}from"../../../../../shared/utils/is-missing-error.js";import{NESTED_CONFIG_FILENAME as o,deepMergeConfig as s,parseNestedConfig as c}from"../../../../config.js";import{contentIgnoreMatcherOf as l}from"../../../../ingest/scan.js";import{SPEC_KIND_GRAPHQL as u}from"../../../../../shared/constants/api-spec-kinds.js";import{MOCK_SERVER_ROUTE_PREFIX as d,mockPathPrefix as f}from"../../../types/api-entity.js";import{posix as p}from"node:path";import{decoratorTypes as m,preprocessorTypes as h}from"@redocly/config";import{FEEDBACK_TYPES as g}from"@redocly/theme/core/constants";const _=[`openapi`,`asyncapi`,`graphql`];function v(e,t,n){let r=O(t),i=Object.values(e.apis??{}),a=e=>O(p.join(n,e))===r;return i.find(e=>e.output!==void 0&&a(e.output))??i.find(e=>e.output===void 0&&a(e.root))}function y(e,t,n=``){let r=v(e,t,n);if(!r)return{};let i={};r.metadata&&(i.metadata=r.metadata);for(let e of _)r[e]&&typeof r[e]==`object`&&Object.assign(i,r[e]);return r.rbac!==void 0&&(i.rbac=r.rbac),i}async function b(e,t,n,r,i=n){let a=T(t,r),o=await w(e,i,l(t));return o===null?s(a,y(t,n)):s(s(a,E(o.config,r)),y(o.config,n,o.dir))}const x=[...m,...h];async function S(e,t,r,i=r){let a=await w(e,i,l(t)),o=a===null?[t,v(t,r,``)]:[t,a.config,v(a.config,r,a.dir)],c={};for(let e of o){if(!n(e))continue;let t={};for(let r of x)n(e[r])&&(t[r]=e[r]);c=s(c,t)}return{config:c,configDir:a?.dir??``}}async function C(e,t,n){return(await w(e,n,l(t)))?.config.feedback}async function w(e,t,n){for(let r=p.dirname(t);r!==`.`&&r!==`/`;r=p.dirname(r)){let t=p.join(r,o);if(n(t))continue;let i=await D(e,t);if(i!==null)return{config:i,dir:r}}return null}function T(e,t){return t===`arazzo`?{}:e[t]??{}}function E(e,t){let n={...T(e,t)};return e.mockServer&&(n.mockServer=e.mockServer),n}async function D(e,t){let n;try{n=await e.readFile(t)}catch(e){if(a(e))return null;throw e}return c(n,t).config}function O(e){return p.normalize(i(e)).replace(/^\.\/+/,``).replace(/^\/+/,``)}function k(r,i,a){let o=n(r.mockServer)?r.mockServer:{},s={...i.mockServer,...o};if(a===void 0||s.off===!0||!e(i,`mockServer`))return r;let c=t(d+f(a));return{...r,mockServer:{url:c,position:`first`,description:`Mock server`,...s}}}function A(e,n,i){let a=e=>e.split(`/`).map(encodeURIComponent).join(`/`),o=i===u,s=o?r.graphql:r.bundle,c=(o?[n]:[`.json`,`.yaml`].map(e=>n.replace(/\.[^./]+$/u,e))).map(e=>({url:t(`${s}/${a(e)}?download`),title:p.basename(e)}));return{...e,downloadUrls:Array.isArray(e.downloadUrls)?e.downloadUrls:c,replayDefinitionUrl:c[0]?.url}}function j(e){return t(`${r.bundle}/${e}`)}const M={[g.RATING]:`Rate this section`,[g.SENTIMENT]:`Was this section helpful?`,[g.MOOD]:`Was this section helpful?`,[g.COMMENT]:`Share your feedback about this section`,[g.SCALE]:`How would you rate this section?`};function N(e,t,r){let i=[n(t)?t[`x-feedback`]:void 0,e.feedback,r].find(n);if(i===void 0)return e;let a=n(i.settings)?i.settings:{},o=typeof i.type==`string`?M[i.type]:void 0,s=a.label||o||``;return{...e,feedback:{...i,settings:{...a,label:s}}}}export{y as readApiOptionsFromConfig,S as resolveApiBundleConfig,b as resolveApiOptions,C as resolveNestedFeedback,j as schemaCatalogLink,A as withDownloadUrls,N as withFeedbackOption,k as withMockServerOption};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{filePathToRouteSlug as e}from"../../../../../shared/utils/routes/file-path-to-route-slug.js";import"../../../../../shared/constants/api-spec-kinds.js";import{createApiEntityKey as t}from"../../../utils/api-entity-key.js";import{filterApiDocsByRbac as n}from"../../../../../shared/rbac/api-docs.js";import{EntityAccessDeniedError as r,notFoundResponse as i}from"../../../../../server/plugin-context.js";import{attachmentDisposition as a}from"../../../../../shared/utils/attachment-disposition.js";import{
|
|
1
|
+
import{filePathToRouteSlug as e}from"../../../../../shared/utils/routes/file-path-to-route-slug.js";import"../../../../../shared/constants/api-spec-kinds.js";import{createApiEntityKey as t}from"../../../utils/api-entity-key.js";import{filterApiDocsByRbac as n}from"../../../../../shared/rbac/api-docs.js";import{EntityAccessDeniedError as r,notFoundResponse as i}from"../../../../../server/plugin-context.js";import{attachmentDisposition as a}from"../../../../../shared/utils/attachment-disposition.js";import{SPEC_DOWNLOAD_HANDLER_ID as o,withMockServerEvent as s}from"../../../../../server/telemetry/mock-server-events.js";import{posix as c}from"node:path";import l from"js-yaml";const u={"Cache-Control":`no-store`};function d(e){return e.replace(/\.[^./]+$/u,``)}async function f(e,t,n){let r=d(t);return(await e.entities.list({type:`api`})).find(({metadata:e})=>{let{sourcePath:t,specType:i}=e??{};return typeof t==`string`&&d(t)===r&&i===`graphql`===n})??null}async function p(n,a){let o=e(a);return await n.hasRoute(o)&&!n.isSlugVisible(o)?new r(t(a),n.request.teams).getResponse():i()}function m(e,t,n,r,i){let o=new URL(t.request.url).searchParams.has(`download`);return e.body(n,200,{...u,"Content-Type":r,...o?{"Content-Disposition":a(i)}:{}})}function h(e,t,n){return s({handler:o,request:e.req.raw,logger:t.logger},n)}function g(e,t){return h(e,t,()=>v(e,t))}function _(e,t){return h(e,t,()=>y(e,t))}async function v(e,t){let r=e.req.param(`api`)??``,i=await f(t,r,!1);if(!i)return p(t,r);let a=n(await t.entities.load(i.key),i.metadata?.specType,t.request.teams,{warn:e=>t.logger?.warn(e)}),o=/\.ya?ml$/u.test(r),s=d(c.basename(String(i.metadata?.sourcePath)))+(o?`.yaml`:`.json`);return o?m(e,t,l.dump(a,{noRefs:!0}),`application/yaml`,s):m(e,t,JSON.stringify(a,null,2),`application/json`,s)}async function y(e,t){let n=e.req.param(`api`)??``,r=await f(t,n,!0);if(!r)return p(t,n);let i=await t.entities.load(r.key),a=String(r.metadata?.sourcePath);return m(e,t,i,`application/graphql`,c.basename(a))}export{g as bundle,_ as graphql};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{stripPathPrefix as e}from"../../../../../shared/path-prefix.js";import{API_FUNCTION_ENTITY_TYPE as t}from"../constants.js";import{compareApiFunctionRoutes as n}from"../route-path.js";import{errorMessage as r}from"../../../../../shared/utils/error-message.js";import{isSubprocessError as i}from"../../../../../server/subprocess/runner.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 r=e.map(x).filter(e=>e!==null);for(let e of r.sort(n))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(n,i,c){let l=e(_(n.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();n.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(n,c,p,d,u)}catch(e){throw await m(500,r(e)),e}return await m(h.response.status,h.failure),h.response}async function F(e,t,n,r,a){let o;try{o={modulePath:n.resolveContentModule(r.sourcePath),request:await f(e.req.raw,l),params:r.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(!i(n))throw n;return n.code===`output-too-large`&&e.set(`realmApiFunctionResponder`,`project`),t.logger?.error(`API function ${r.sourcePath} failed (${n.code}): ${n.message}`),M(n.code,n.message)}if(e.set(`realmApiFunctionResponder`,`project`),!s.ok)return t.logger?.error(`API function ${r.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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{toJsonValue as e}from"../../../database/utils/json.js";import{
|
|
1
|
+
import{toJsonValue as e}from"../../../database/utils/json.js";import{builtInMarkdocTags as t}from"../../../markdown/constants/builtin-tags.js";import{isRbacScope as n}from"../../../../shared/rbac/engine.js";import{hashBlobContent as r}from"../../../materialization/data-ref.js";import{resolveMarkdownAst as i}from"../../../markdown/resolve/ast.js";import{REDOCLY_TEAMS_RBAC as a}from"@redocly/config";async function o(o,s){if(!o||o.length===0)return null;let c=[],l=[],u=[];for(let[d,f]of o.entries()){if(!f.content){s.logger?.warn(`${s.file.path}: banner[${d}] has no content — the item is not shown`);continue}let{content:o,rbac:p,...m}=f,{ast:h,entityDeps:g,assetUsages:_}=await i(f.content,s.file.path,{resolverContext:s,tags:t}),v=p===void 0?{}:{[a]:n(p)?p:(s.logger?.warn(`${s.file.path}: banner[${d}] has an invalid "rbac" value — the item is hidden from everyone`),{})};c.push(e({...m,...v,ast:h,hash:r(f.content)})),l.push(...g),u.push(..._)}return c.length>0?{banner:c,deps:l,assetUsages:u}:null}export{o as resolveBannerForAppData};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineContentPlugin as e}from"../../define.js";import{toJsonObject as t,toJsonValue as n}from"../../../database/utils/json.js";import{createEntityLoader as r}from"../../../loaders/define.js";import{createPluginScopedId as i}from"../../utils/scoped-id.js";import{buildSearchAppData as a}from"../../../../shared/search/facets.js";import{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{isAiHidden as d}from"../../../../shared/ask-ai/config-gate.js";import{toNavItemRbacAnnotation as f}from"../../../../shared/rbac/filter.js";import{resolvePageTarget as p}from"../../../../shared/utils/routes/resolve-page-target.js";import{listConfiguredProducts as m}from"../../../products.js";import{collectVersionGroups as h,findVersionedDirectories as g}from"../../../versions/version-groups.js";import{publicLink as _}from"../../../versions/public-link.js";import{linkedPageAccess as v}from"../../utils/link-access.js";import{loadSidebarSubtreeLabel as ee}from"../../utils/sidebar-label.js";import{resolveBannerForAppData as te}from"./banner.js";import{resolveLogoForAppData as ne}from"./logo.js";import{resolveNavbarIconsForAppData as y}from"./navbar-icons.js";import{resolveHtmlForAppData as b}from"./html.js";import{resolveSeoForAppData as x}from"./seo.js";import{productConfigPath as S,productLandingLink as C,readProductConfig as w,resolveProductAssetsForAppData as T}from"./products.js";import{dirname as E,resolve as D}from"node:path";import{REDOCLY_TEAMS_RBAC as O}from"@redocly/config";const k=`internal.app-data`,A=`1.32.0`,j=i(k,`app-data`);function M(e){return l(e)&&typeof e.owner==`string`&&`value`in e}const N=r(j,async e=>{let n=new Set(e.pluginRegistry.listFinalizePlugins().map(e=>e.id)),r={};for(let[t,i]of Object.entries(e.args.fragments??{}))M(i)&&n.has(i.owner)&&(r[t]=i.value);let i=await ne(e.config.logo,e.markdown,e.file.path);if(Object.keys(i.logo).length>0){let e=l(r.theme)?r.theme:{};r.theme=t({...e,logo:i.logo})}let a=await te(e.config.banner,e);if(a){let e=l(r.theme)?r.theme:{};r.theme=t({...e,banner:a.banner})}let o=await y(l(r.theme)?r.theme.navbar:void 0,e.markdown,e.file.path);if(o){let e=l(r.theme)?r.theme:{};r.theme=t({...e,navbar:o.navbar})}let s=await y(l(r.theme)?r.theme.footer:void 0,e.markdown,e.file.path);if(s){let e=l(r.theme)?r.theme:{};r.theme=t({...e,footer:s.navbar})}let c=await T(l(r.theme)?r.theme.products:void 0,e.markdown,e.file.path);if(c){let e=l(r.theme)?r.theme:{};r.theme=t({...e,products:c.products})}let u=await b(e.config,e.markdown,e.file.path,t=>e.io.readFile(D(E(e.file.absolutePath),t)),e.logger);u&&(r.html=t(u.html));let d=await x(r.seo,e.markdown,e.file.path);d&&(r.seo=d.seo);let f=[i,a,o,s,c,u,d];return{value:r,entityDeps:f.flatMap(e=>e?.deps??[]),assetUsages:f.flatMap(e=>e?.assetUsages??[])}});function P(e){return{isSystem:!0,key:c,kind:`loader`,type:null,metadata:null,loaderArgs:{pluginVersion:A},loaderId:j,pluginId:k,shouldInvalidateValue:!1,value:null,version:null,fragmentUpdates:e.fragmentUpdates}}const F=e({id:k,version:A,async finalize(e){let r=await h({io:e.io,routes:e.routes,versionedDirectories:g(e.routes.all())}),i=e=>e&&_(e,r),a=t=>t&&{slug:_(t,r),loadLabel:()=>ee(e.entities,t)},o=t=>a(e.routes.byFilePath(t)),s=t=>a(e.routes.bySlug(t)),c=t=>v(t,e.routes,r),u=await B(e.config,o,s,e.logger,c),d=await L(e,o,s,i,c);if(Object.keys(d).length>0){let e=l(u.theme)?u.theme:{};u.theme=t({...e,products:d}),u.pageProducts=n(Object.values(d).map(I))}return{appData:u}},loaders:[N]});function I(e){let{name:t,slug:n,configOverride:r}=e,i={name:t,slug:n},a=r?.analytics?.ga;return a&&(i.ga=a),i}async function L(e,n,r,i,o){let s={};for(let t of m(e.config)){let c=await C(t,e.routes,e.io,i);if(c===void 0){e.logger.warn(`Product "${t.id}" is left out of the product picker: "${t.folder}" has no page.`);continue}let l={name:t.name,folder:t.folder,slug:t.slug,link:c,[O]:o(c)??void 0};t.icon!==void 0&&(l.icon=t.icon);let u=S(t.folder),d=await e.io.exists(u)?await R(w(await e.io.readFile(u),u),{page:Q(n,r,u,e.logger),access:o},a(e.config),e.config):{};Object.keys(d).length>0&&(l.configOverride=d),s[t.id]=l}return t(s)}async function R(e,t,n,r){let i={},a=await G(e.navbar,t),o=await W(e.footer,t),c=U(e.breadcrumbs,t);return e.logo&&(i.logo=e.logo),a&&(i.navbar=a),o&&(i.footer=o),c&&s(r,`breadcrumbs`)&&(i.breadcrumbs=c),e.feedback&&(i.feedback=e.feedback),e.sidebar&&(i.sidebar=e.sidebar),e.codeSnippet&&(i.codeSnippet=e.codeSnippet),e.palette&&(i.palette=e.palette),e.search&&(i.search=await z(e.search,n,t)),e.analytics?.ga&&s(r,`analytics`)&&(i.analytics={ga:e.analytics.ga}),i}async function z(e,n,r){let i={...n},a=await K(e?.suggestedPages,r);return e?.hide!==void 0&&(i.hide=e.hide),e?.placement!==void 0&&(i.placement=e.placement),e?.shortcuts!==void 0&&(i.shortcuts=e.shortcuts),a.length>0&&(i.suggestedPages=a),t(i)}async function B(e,n,r,i,s=()=>void 0){let c={},l={page:Q(n,r,Z,i),access:s},u=await G(e.navbar,l),d=await W(e.footer,l),f=e.seo?.projectTitle,p=U(e.breadcrumbs,l),m={...u?{navbar:u}:{},...d?{footer:d}:{},...p?{breadcrumbs:p}:{},markdown:e.markdown,navigation:e.navigation,userMenu:await Y(e.userMenu,l),feedback:e.feedback,consent:e.consent,...f?{seo:{projectTitle:f}}:{},aiAssistant:V(e),mcp:H(e),search:await z(e.search,a(e),l),sidebar:e.sidebar,versionPicker:e.versionPicker,codeSnippet:e.codeSnippet,palette:e.palette};if(e.colorMode&&(m.colorMode=e.colorMode),Object.keys(m).length>0&&(c.theme=m),e.analytics&&(c.analytics=e.analytics),e.planGates&&(c.removeAttribution=o(e)),e.removeAttribution===!0&&(c.removeConsoleAttribution=!0),e.seo){let{projectTitle:t,llmstxt:n,...r}=e.seo;Object.keys(r).length>0&&(c.seo=r)}return t(c)}function V(e){let t=d(e),n=e.aiAssistant?.trigger;return{...e.aiAssistant,hide:t,trigger:{...n,hide:n?.hide??t}}}function H(e){let t=e.mcp?.hide===!0;return{hide:t,docs:{hide:t}}}function U(e,n){if(!e)return null;let r={};e.hide!==void 0&&(r.hide=e.hide);let i=(e.prefixItems??[]).map(e=>{let t=e.page?n.page(e.page)?.link:void 0;return{icon:$(e.icon),label:$(e.label)??``,labelTranslationKey:$(e.labelTranslationKey),link:t,[O]:J(n,t)}});return i.length>0&&(r.prefixItems=i),Object.keys(r).length>0?t(r):null}async function W(e,n){if(!e)return null;let r={hide:e.hide===!0},i=await K(e.items,n);return e.copyrightText!==void 0&&(r.copyrightText=e.copyrightText),e.logo&&(r.logo=e.logo),i.length>0&&(r.items=i),t(r)}async function G(e,n){if(!e)return null;let r={},i=await K(e.items,n);return e.hide!==void 0&&(r.hide=e.hide),i.length>0&&(r.items=i),Object.keys(r).length>0?t(r):null}async function K(e,t){return Array.isArray(e)?(await Promise.all(e.map(e=>q(e,t)))).filter(e=>e!==null):[]}async function q(e,n){if(typeof e==`string`)return q({page:e},n);if(!l(e))return null;if(typeof e.separator==`string`)return t({...X(e),label:e.separator,type:`separator`});let r=await K(e.items,n),i=ie(e,n.page),a=i?.link,o=e.rbac===void 0?J(n,a):void 0,s=$(e.label)??$(e.group)??(i?i.anchor??await i.loadLabel?.()??i.link:``);return typeof e.group==`string`||r.length>0?t({...X(e),...a?{link:a}:{},...r.length>0?{items:r}:{},label:s,labelTranslationKey:$(e.groupTranslationKey)??$(e.labelTranslationKey),type:`group`,[O]:o}):a?t({...X(e),...se(e.external)??ae(a)?{external:!0}:{},label:s,link:a,type:`link`,[O]:o}):null}function J(e,t){return t===void 0?void 0:e.access(t)??void 0}async function Y(e,n){if(!e)return;let r=[];for(let t of e.items??[])r.push({...t,href:t.link});let i=await K(r,n);return t({...e,menu:i.length>0?i:void 0})}function X(e){let t=oe(e,[`additionalProps`,`expanded`,`labelTranslationKey`,`languageInsensitive`,`linePosition`,`linkedSidebars`,`menuStyle`,`selectFirstItemOnExpand`,`separatorLine`,`target`,`version`]),n=re(e.icon);return n.icon&&(t.icon=n.icon),n.srcSet&&(t.srcSet=n.srcSet),{...t,...f(e.rbac)}}function re(e){return typeof e==`string`?{icon:e}:l(e)&&typeof e.srcSet==`string`?{srcSet:e.srcSet}:{}}function ie(e,t){return typeof e.href==`string`&&e.href.trim()!==``?{link:e.href.trim()}:typeof e.page==`string`&&e.page.trim()!==``?t(e.page):null}const Z=`redocly.yaml`;function Q(e,t,n,r){let i={bySlug:e=>t?.(e),byFilePath:t=>e?.(t)};return e=>{let{path:t,suffix:a,anchor:o}=u(e.trim()),s=p(t,n,i);return s.kind===`escaped`?(r?.warn(`Config page reference escapes the content root`,{page:e}),null):s.kind===`missing`?(r?.warn(`Config page has no matching route`,{page:e}),{link:e.trim()}):{link:`${s.value.slug}${a}`,anchor:o,loadLabel:s.value.loadLabel}}}function ae(e){return/^(?:[a-z][a-z\d+.-]*:)?\/\//i.test(e)||/^(?:mailto|tel):/i.test(e)}function oe(e,t){let n={};for(let r of t)e[r]!==void 0&&(n[r]=e[r]);return n}function $(e){return typeof e==`string`&&e.trim()!==``?e:void 0}function se(e){return typeof e==`boolean`?e:void 0}export{k as APP_DATA_PLUGIN_ID,A as APP_DATA_PLUGIN_VERSION,j as APP_DATA_STATIC_DATA_LOADER_ID,c as APP_DATA_STATIC_DATA_SLUG,F as appDataContentPlugin,P as appDataSystemEntityDescriptor,B as buildConfigAppData,M as isAppDataFragment};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{LoaderDataContext as e}from"../../../../../client/contexts.js";import{telemetry as t}from"../../../../../client/telemetry/telemetry.js";import{CATALOG_CLASSIC_DEP_KEY as n}from"./contract.js";import{readSelectionsFromSearch as r,readTermFromSearch as i,resolveCatalog as a,selectFilterOption as o,toCatalogItems as s,toggleFilterOption as c,writeSelectionsToSearch as l}from"./catalog-filtering.js";import*as u from"react";import{useLocation as d,useNavigate as f}from"react-router";import{getBaseDataAttributes as p}from"@redocly/theme/core/utils";const m=[];function h(e){t.sendCatalogFilterChangedMessage([{...p(`catalogFilter`,`field`),type:e}])}function g(t){let p=d(),g=f(),_=u.useContext(e)[n],v=t.filters??m,[y,b]=u.useState(()=>r(p.search,v)),[x,S]=u.useState(()=>i(p.search)),C=u.useCallback(e=>{S(e),h(`term`)},[]),w=u.useMemo(()=>s(_?.items??[]),[_]);u.useEffect(()=>{let e=l(p.search,v,y,x);e!==p.search.replace(/^\?/,``)&&g({search:e},{replace:!0})},[v,x,p.search,g,y]);let T=u.useMemo(()=>a({filters:v,groupByFirstFilter:t.groupByFirstFilter,items:w,selections:y,term:x}),[t.groupByFirstFilter,v,x,w,y]);return u.useMemo(()=>({groups:T.groups,filters:T.filters.map((e,t)=>({...e,toggleOption:e=>{b(n=>c(n,t,e)),h(`toggle`),window.scrollTo(0,0)},selectOption:e=>{b(n=>o(n,v,t,e)),h(`select`),window.scrollTo(0,0)}})),filterTerm:x,setFilterTerm:C}),[C,v,x,T])}export{g as useCatalogClassic};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineContentPlugin as e}from"../../define.js";import{createEntityLoader as t}from"../../../loaders/define.js";import{runtimeFile as n}from"../../utils/runtime-file.js";import{createServerFn as r}from"../../server-fn.js";import{createPluginScopedId as i}from"../../utils/scoped-id.js";import{runtimeTemplate as a}from"../../templates.js";import{normalizeRouteSlug as o}from"../../../../shared/utils/routes/normalize-route-slug.js";import{
|
|
1
|
+
import{defineContentPlugin as e}from"../../define.js";import{createEntityLoader as t}from"../../../loaders/define.js";import{runtimeFile as n}from"../../utils/runtime-file.js";import{createServerFn as r}from"../../server-fn.js";import{createPluginScopedId as i}from"../../utils/scoped-id.js";import{runtimeTemplate as a}from"../../templates.js";import{normalizeRouteSlug as o}from"../../../../shared/utils/routes/normalize-route-slug.js";import{CATALOG_CLASSIC_DEP_KEY as s}from"./client/contract.js";import{SIDEBAR_CONTRIBUTIONS_ENTITY_TYPE as c}from"../sidebar/contributions.js";import{catalogEntityKey as l}from"./entity-key.js";import{buildCatalogCards as u,loadVersionGroups as d,pickDefaultVersions as f,resolveCatalogMembers as p}from"./resolve-items.js";import{catalogSidebarContributions as m}from"./sidebars.js";const h=`internal.catalog-classic`,g=`catalog-classic`,_=i(h,`catalog`),v=i(h,`sidebars`),y=i(h,`deliver`),b=t(_,async e=>{let t=p(e.args.items,e),{versionGroups:n,entityDeps:r}=await d(t,e),i=e.args.config.separateVersions?t:f(t,n),a=await u(i,n,e);return{value:{catalogId:e.args.catalogId,config:e.args.config,items:a},entityDeps:r}}),x=t(v,async e=>{let t=p(e.args.items,{routes:e.routes}),{versionGroups:n,entityDeps:r}=await d(t,e);return{value:await m(t,n,{label:e.args.title,link:e.args.slug},e),entityDeps:r}}),S=r(y,{filePath:`./server/deliver.ts`,importer:import.meta.url,exportName:`deliver`,cacheable:!0});function C(e){return Object.entries(e.catalogClassic??e.catalog??{})}const w=e({id:h,version:`1.7.0`,content:{extractAll(e){let t=[],n=[];for(let[r,i]of C(e.config)){let{items:e,...a}=i,u=o(String(i.slug)),d=typeof i.title==`string`?i.title:`API Catalog`;t.push(b.withArgs({catalogId:r,config:a,items:e},{stableKey:l(r),metadata:{sourcePath:u}}),x.withArgs({items:e,slug:u,title:d},{stableKey:`${l(r)}:sidebars`,type:c})),n.push({deps:{[s]:S.withArgs({catalogId:r})},metadata:{title:d},routeId:r,slug:u,template:g})}return{entities:t,routes:n}}},loaders:[b,x],server:{functions:[S]},templates:{[g]:a(n(`./client/template.tsx`,import.meta.url))}});export{_ as CATALOG_CLASSIC_LOADER_ID,h as CATALOG_CLASSIC_PLUGIN_ID,y as CATALOG_CLASSIC_SERVER_FN_ID,v as CATALOG_CLASSIC_SIDEBARS_LOADER_ID,g as CATALOG_CLASSIC_TEMPLATE_ID,w as catalogClassicContentPlugin};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./api-functions/constants.js";import{STATIC_FOLDER_PLUGIN_ID as
|
|
1
|
+
import{APP_DATA_STATIC_DATA_SLUG as e}from"../../../shared/constants/app-data.js";import{SIDEBAR_ROUTE_DEP_KEY as t}from"../../../shared/constants/route-deps.js";import"./api-functions/constants.js";import{STATIC_FOLDER_PLUGIN_ID as n,STATIC_FOLDER_PREFIX as r,isStaticFolderPath as i,staticFolderContentPlugin as a}from"./static-folder/index.js";import{ASSETS_PLUGIN_ID as o,ASSET_ENTITY_KEY_PREFIX as s,assetsContentPlugin as c}from"./assets/index.js";import{FOLDER_SIDEBAR_FILENAME_REGEX as l,SIDEBAR_AGGREGATOR_LOADER_ID as u,SIDEBAR_FILENAME_REGEX as d,SIDEBAR_PLUGIN_ID as f,isTabbedSidebar as p,resolveAutoSidebar as m,sidebarContentPlugin as h}from"./sidebar/index.js";import{APP_DATA_PLUGIN_ID as g,APP_DATA_PLUGIN_VERSION as ee,APP_DATA_STATIC_DATA_LOADER_ID as _,appDataContentPlugin as v,appDataSystemEntityDescriptor as y,buildConfigAppData as b,isAppDataFragment as x}from"./app-data/index.js";import{apiDocsContentPlugin as S}from"./api-docs/index.js";import{API_FUNCTIONS_PLUGIN_ID as C,apiFunctionsContentPlugin as w}from"./api-functions/index.js";import{CATALOG_CLASSIC_LOADER_ID as T,CATALOG_CLASSIC_PLUGIN_ID as E,CATALOG_CLASSIC_SERVER_FN_ID as D,CATALOG_CLASSIC_SIDEBARS_LOADER_ID as O,CATALOG_CLASSIC_TEMPLATE_ID as k,catalogClassicContentPlugin as A}from"./catalog-classic/index.js";import{L10N_PLUGIN_ID as j}from"./l10n/translations-loader.js";import{L10N_PLUGIN_VERSION as M,l10nContentPlugin as N}from"./l10n/index.js";import{MARKDOC_DOCUMENT_LOADER_ID as P,MARKDOC_SEARCH_GROUP as F,MARKDOC_SIDEBAR_ITEM_LOADER_ID as te,MARKDOC_TEMPLATE_ID as I,markdocContentPlugin as L}from"./markdoc/index.js";import{mcpContentPlugin as R}from"./mcp/index.js";import{MOCK_SERVER_PLUGIN_ID as z,MOCK_SERVER_ROUTE_PATH as B,mockServerContentPlugin as V}from"./mock/index.js";import{REACT_PAGE_SEARCH_LOADER_KEY as H,reactPageContentPlugin as U}from"./react-page/index.js";import{REVISIONS_PLUGIN_ID as W,revisionsContentPlugin as G}from"./revisions/index.js";import{SCORECARD_CLASSIC_PLUGIN_ID as K,SCORECARD_CLASSIC_TEMPLATE_ID as q,scorecardClassicContentPlugin as J}from"./scorecard-classic/index.js";import{SKILLS_PLUGIN_ID as Y,SKILL_MARKDOWN_ROUTE_PATH as X,skillsContentPlugin as Z}from"./skills/index.js";import{VERSIONS_PLUGIN_ID as Q,versionsContentPlugin as $}from"./versions/index.js";function ne(){return[v,N,a,c,L,h,$,G,A,S,J,w,V,R,U,Z]}export{C as API_FUNCTIONS_PLUGIN_ID,g as APP_DATA_PLUGIN_ID,ee as APP_DATA_PLUGIN_VERSION,_ as APP_DATA_STATIC_DATA_LOADER_ID,e as APP_DATA_STATIC_DATA_SLUG,o as ASSETS_PLUGIN_ID,s as ASSET_ENTITY_KEY_PREFIX,T as CATALOG_CLASSIC_LOADER_ID,E as CATALOG_CLASSIC_PLUGIN_ID,D as CATALOG_CLASSIC_SERVER_FN_ID,O as CATALOG_CLASSIC_SIDEBARS_LOADER_ID,k as CATALOG_CLASSIC_TEMPLATE_ID,l as FOLDER_SIDEBAR_FILENAME_REGEX,j as L10N_PLUGIN_ID,M as L10N_PLUGIN_VERSION,P as MARKDOC_DOCUMENT_LOADER_ID,F as MARKDOC_SEARCH_GROUP,te as MARKDOC_SIDEBAR_ITEM_LOADER_ID,I as MARKDOC_TEMPLATE_ID,z as MOCK_SERVER_PLUGIN_ID,B as MOCK_SERVER_ROUTE_PATH,H as REACT_PAGE_SEARCH_LOADER_KEY,W as REVISIONS_PLUGIN_ID,K as SCORECARD_CLASSIC_PLUGIN_ID,q as SCORECARD_CLASSIC_TEMPLATE_ID,u as SIDEBAR_AGGREGATOR_LOADER_ID,d as SIDEBAR_FILENAME_REGEX,f as SIDEBAR_PLUGIN_ID,t as SIDEBAR_ROUTE_DEP_KEY,Y as SKILLS_PLUGIN_ID,X as SKILL_MARKDOWN_ROUTE_PATH,n as STATIC_FOLDER_PLUGIN_ID,r as STATIC_FOLDER_PREFIX,Q as VERSIONS_PLUGIN_ID,S as apiDocsContentPlugin,w as apiFunctionsContentPlugin,v as appDataContentPlugin,y as appDataSystemEntityDescriptor,c as assetsContentPlugin,b as buildConfigAppData,A as catalogClassicContentPlugin,ne as createInternalContentPlugins,x as isAppDataFragment,i as isStaticFolderPath,p as isTabbedSidebar,N as l10nContentPlugin,L as markdocContentPlugin,R as mcpContentPlugin,V as mockServerContentPlugin,U as reactPageContentPlugin,m as resolveAutoSidebar,G as revisionsContentPlugin,J as scorecardClassicContentPlugin,h as sidebarContentPlugin,Z as skillsContentPlugin,a as staticFolderContentPlugin,$ as versionsContentPlugin};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineContentPlugin as e}from"../../define.js";import{toJsonObject as t}from"../../../database/utils/json.js";import{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{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};
|