@redocly/framework 1.0.0-next.7 → 1.0.0-next.8

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.
Files changed (233) hide show
  1. package/dist/bundler/build/output-metadata.js +1 -1
  2. package/dist/bundler/build/run.js +1 -1
  3. package/dist/bundler/build/vite-config.js +2 -2
  4. package/dist/bundler/dev/routes/dev-problems-route.js +1 -1
  5. package/dist/bundler/dev/routes/source-sync-route.js +1 -1
  6. package/dist/bundler/dev/run.js +1 -1
  7. package/dist/bundler/dev/runtime-app.js +1 -1
  8. package/dist/bundler/dev/vite-chunk-url.js +1 -1
  9. package/dist/bundler/user-markdoc-schema.js +1 -1
  10. package/dist/bundler/vite-config.base.js +2 -2
  11. package/dist/cli/args.js +1 -1
  12. package/dist/cli/commands/build.js +1 -1
  13. package/dist/cli/commands/dev.js +1 -1
  14. package/dist/cli/commands/ingest.js +1 -1
  15. package/dist/cli/commands/translate.js +2 -2
  16. package/dist/cli/dev-console/index.js +1 -1
  17. package/dist/cli/log-output/index.js +1 -1
  18. package/dist/cli/validate-react-pages.js +1 -1
  19. package/dist/client/ai-search/use-ai-search.js +1 -1
  20. package/dist/client/analytics-page-view.js +1 -1
  21. package/dist/client/app.js +2 -7
  22. package/dist/client/client-entry.js +1 -1
  23. package/dist/client/contexts.js +1 -1
  24. package/dist/client/dev-problems/ProblemsBar.js +26 -16
  25. package/dist/client/feedback.js +1 -1
  26. package/dist/client/l10n/ssr-l10n.js +1 -1
  27. package/dist/client/l10n/use-l10n-config.js +1 -1
  28. package/dist/client/products.js +1 -1
  29. package/dist/client/review/ReviewBar.js +163 -69
  30. package/dist/client/review/login-url.js +1 -0
  31. package/dist/client/review/use-review.js +1 -1
  32. package/dist/client/sidebar/SidebarDataProvider.js +1 -1
  33. package/dist/client/sidebar/drilldown.js +1 -1
  34. package/dist/client/ssr.js +1 -1
  35. package/dist/client/telemetry/config.js +1 -1
  36. package/dist/client/theme-logo.js +1 -1
  37. package/dist/client/use-bar-position.js +1 -0
  38. package/dist/client/use-entity-revisions.js +1 -1
  39. package/dist/client/use-page-versions.js +1 -1
  40. package/dist/client/use-search.js +1 -1
  41. package/dist/client/webmcp/tools/shared.js +1 -1
  42. package/dist/client/webmcp/tools/site-tools.js +1 -1
  43. package/dist/client/webmcp/use-webmcp-tools.js +1 -1
  44. package/dist/content-layer/api-outputs.js +1 -1
  45. package/dist/content-layer/config-schema.js +1 -1
  46. package/dist/content-layer/config.js +1 -1
  47. package/dist/content-layer/database/files.js +1 -1
  48. package/dist/content-layer/database/finalize.js +1 -1
  49. package/dist/content-layer/database/invalidation.js +26 -26
  50. package/dist/content-layer/database/origins.js +1 -1
  51. package/dist/content-layer/database/problems.d.ts +2 -0
  52. package/dist/content-layer/database/problems.js +1 -1
  53. package/dist/content-layer/database/reset.js +1 -1
  54. package/dist/content-layer/database/schema.d.ts +17 -0
  55. package/dist/content-layer/database/schema.js +1 -1
  56. package/dist/content-layer/ingest/finalize-phase.js +1 -1
  57. package/dist/content-layer/ingest/hash.js +1 -1
  58. package/dist/content-layer/ingest/l10n-warnings.js +1 -1
  59. package/dist/content-layer/ingest/normalize-artifacts.js +1 -1
  60. package/dist/content-layer/ingest/run.js +1 -1
  61. package/dist/content-layer/ingest/search-sync.js +1 -1
  62. package/dist/content-layer/ingest/sync.js +1 -1
  63. package/dist/content-layer/link-checker/delta.js +1 -1
  64. package/dist/content-layer/link-checker/fingerprint.js +1 -1
  65. package/dist/content-layer/link-checker/load-view.js +1 -1
  66. package/dist/content-layer/link-checker/run-build.js +1 -1
  67. package/dist/content-layer/link-checker/validate.js +1 -1
  68. package/dist/content-layer/link-checker/view.js +1 -1
  69. package/dist/content-layer/loaders/context.js +1 -1
  70. package/dist/content-layer/loaders/define.d.ts +3 -0
  71. package/dist/content-layer/markdown/client/JsonSchemaTag.js +1 -1
  72. package/dist/content-layer/markdown/client/code-highlight-notation.js +3 -3
  73. package/dist/content-layer/markdown/client/markdoc-components.js +2 -2
  74. package/dist/content-layer/markdown/client/markdown-text.js +1 -1
  75. package/dist/content-layer/markdown/constants/builtin-tags.js +1 -1
  76. package/dist/content-layer/markdown/constants/markdown-text-tag-set.js +1 -1
  77. package/dist/content-layer/markdown/constants/tag-sets.js +1 -1
  78. package/dist/content-layer/markdown/nodes/fence.js +1 -1
  79. package/dist/content-layer/markdown/nodes/heading.js +1 -1
  80. package/dist/content-layer/markdown/nodes/table.js +1 -1
  81. package/dist/content-layer/markdown/resolve/audience-tag.d.ts +1 -5
  82. package/dist/content-layer/markdown/resolve/audience-tag.js +1 -1
  83. package/dist/content-layer/markdown/resolve/markdoc-resolvers/json-schema.js +1 -1
  84. package/dist/content-layer/markdown/resolve/markdoc-resolvers/operation-samples.js +1 -1
  85. package/dist/content-layer/markdown/resolve/markdoc.js +1 -1
  86. package/dist/content-layer/markdown/resolve/references.js +1 -1
  87. package/dist/content-layer/markdown/search/to-markdown.js +2 -2
  88. package/dist/content-layer/markdown/search/to-sections.d.ts +1 -1
  89. package/dist/content-layer/markdown/search/to-sections.js +1 -1
  90. package/dist/content-layer/markdown/server/render.js +1 -1
  91. package/dist/content-layer/markdown/tags/html.d.ts +2 -2
  92. package/dist/content-layer/markdown/tags/html.js +1 -1
  93. package/dist/content-layer/markdown/tags/openapi.js +1 -1
  94. package/dist/content-layer/markdown/tags/variant.js +1 -1
  95. package/dist/content-layer/markdown/utils/parse-cache.js +1 -1
  96. package/dist/content-layer/materialization/entity.js +1 -1
  97. package/dist/content-layer/materialization/static-files.js +1 -1
  98. package/dist/content-layer/plugins/index.js +1 -1
  99. package/dist/content-layer/plugins/internal/api-docs/client/event-handlers.js +1 -1
  100. package/dist/content-layer/plugins/internal/api-docs/client/template.js +11 -3
  101. package/dist/content-layer/plugins/internal/api-docs/index.js +1 -1
  102. package/dist/content-layer/plugins/internal/api-docs/server/build-definition.d.ts +21 -11
  103. package/dist/content-layer/plugins/internal/api-docs/server/build-definition.js +1 -1
  104. package/dist/content-layer/plugins/internal/api-docs/server/build-sidebar.js +1 -1
  105. package/dist/content-layer/plugins/internal/api-docs/server/markdown-decorator.d.ts +1 -4
  106. package/dist/content-layer/plugins/internal/api-docs/server/markdown-decorator.js +1 -1
  107. package/dist/content-layer/plugins/internal/api-docs/server/markdown-docs.js +13 -13
  108. package/dist/content-layer/plugins/internal/api-docs/server/options.js +1 -1
  109. package/dist/content-layer/plugins/internal/api-functions/server/access.js +1 -1
  110. package/dist/content-layer/plugins/internal/api-functions/server/dispatch.js +1 -1
  111. package/dist/content-layer/plugins/internal/app-data/banner.js +1 -1
  112. package/dist/content-layer/plugins/internal/app-data/index.d.ts +1 -1
  113. package/dist/content-layer/plugins/internal/app-data/index.js +1 -1
  114. package/dist/content-layer/plugins/internal/catalog-classic/client/use-catalog-classic.js +1 -1
  115. package/dist/content-layer/plugins/internal/catalog-classic/index.js +1 -1
  116. package/dist/content-layer/plugins/internal/index.js +1 -1
  117. package/dist/content-layer/plugins/internal/l10n/index.js +1 -1
  118. package/dist/content-layer/plugins/internal/markdoc/client/template.js +1 -1
  119. package/dist/content-layer/plugins/internal/markdoc/index.js +1 -1
  120. package/dist/content-layer/plugins/internal/mcp/constants.d.ts +17 -0
  121. package/dist/content-layer/plugins/internal/mcp/constants.js +1 -1
  122. package/dist/content-layer/plugins/internal/mcp/content-tools.js +1 -1
  123. package/dist/content-layer/plugins/internal/mcp/ignored-routes.js +1 -1
  124. package/dist/content-layer/plugins/internal/mcp/server/agent-card.js +1 -1
  125. package/dist/content-layer/plugins/internal/mcp/server/audit.js +1 -1
  126. package/dist/content-layer/plugins/internal/mcp/server/auth.js +1 -1
  127. package/dist/content-layer/plugins/internal/mcp/server/codemode/capabilities.js +6 -6
  128. package/dist/content-layer/plugins/internal/mcp/server/codemode/constants.js +1 -1
  129. package/dist/content-layer/plugins/internal/mcp/server/codemode/discover.js +1 -1
  130. package/dist/content-layer/plugins/internal/mcp/server/codemode/prompts.js +8 -8
  131. package/dist/content-layer/plugins/internal/mcp/server/custom-tools.js +1 -1
  132. package/dist/content-layer/plugins/internal/mcp/server/gateway/allowed-http-methods.js +1 -1
  133. package/dist/content-layer/plugins/internal/mcp/server/gateway/api-call-operations.js +1 -1
  134. package/dist/content-layer/plugins/internal/mcp/server/gateway/call-api.js +2 -0
  135. package/dist/content-layer/plugins/internal/mcp/server/gateway/credentials-page/form-page.js +10 -10
  136. package/dist/content-layer/plugins/internal/mcp/server/gateway/credentials-page/outcome-pages.js +1 -1
  137. package/dist/content-layer/plugins/internal/mcp/server/gateway/credentials-page/site-branding.js +1 -1
  138. package/dist/content-layer/plugins/internal/mcp/server/gateway/credentials.js +1 -1
  139. package/dist/content-layer/plugins/internal/mcp/server/gateway/elicitation.js +6 -6
  140. package/dist/content-layer/plugins/internal/mcp/server/gateway/fetch/fetch-bridge.js +1 -1
  141. package/dist/content-layer/plugins/internal/mcp/server/gateway/fetch/ssrf-guard.js +1 -1
  142. package/dist/content-layer/plugins/internal/mcp/server/gateway/fetch/upstream-detail.js +1 -1
  143. package/dist/content-layer/plugins/internal/mcp/server/gateway/index.js +3 -3
  144. package/dist/content-layer/plugins/internal/mcp/server/gateway/tool-list.js +1 -0
  145. package/dist/content-layer/plugins/internal/mcp/server/gateway/tools.js +4 -4
  146. package/dist/content-layer/plugins/internal/mcp/server/gateway/upstream-auth-scheme.js +1 -1
  147. package/dist/content-layer/plugins/internal/mcp/server/handler.js +1 -1
  148. package/dist/content-layer/plugins/internal/mcp/server/mcp-server.js +1 -1
  149. package/dist/content-layer/plugins/internal/mcp/server/mcp-telemetry.js +1 -1
  150. package/dist/content-layer/plugins/internal/mcp/server/oauth/authorize.js +1 -1
  151. package/dist/content-layer/plugins/internal/mcp/server/oauth/callback.js +1 -1
  152. package/dist/content-layer/plugins/internal/mcp/server/oauth/discovery.js +1 -1
  153. package/dist/content-layer/plugins/internal/mcp/server/oauth/token.js +1 -1
  154. package/dist/content-layer/plugins/internal/mcp/server/oauth/tokens.js +1 -1
  155. package/dist/content-layer/plugins/internal/mcp/server/server-card.js +1 -1
  156. package/dist/content-layer/plugins/internal/mcp/server/server-info.js +1 -1
  157. package/dist/content-layer/plugins/internal/mcp/server/skills-resources.js +1 -1
  158. package/dist/content-layer/plugins/internal/mcp/server/tools/openapi-catalog.js +1 -1
  159. package/dist/content-layer/plugins/internal/mcp/server/tools/openapi-document.js +1 -1
  160. package/dist/content-layer/plugins/internal/mcp/server/tools/openapi.js +1 -1
  161. package/dist/content-layer/plugins/internal/mcp/server/tools/pages-navigation.js +1 -1
  162. package/dist/content-layer/plugins/internal/mcp/server/tools/pages.js +2 -2
  163. package/dist/content-layer/plugins/internal/mcp/server/tools/schemas.js +1 -1
  164. package/dist/content-layer/plugins/internal/mcp/server/tools/search.js +2 -2
  165. package/dist/content-layer/plugins/internal/mock/server/handler.js +1 -1
  166. package/dist/content-layer/plugins/internal/react-page/index.js +1 -1
  167. package/dist/content-layer/plugins/internal/scorecard-classic/index.js +1 -1
  168. package/dist/content-layer/plugins/internal/sidebar/bundle.js +1 -1
  169. package/dist/content-layer/plugins/internal/sidebar/index.d.ts +2 -1
  170. package/dist/content-layer/plugins/internal/sidebar/index.js +2 -2
  171. package/dist/content-layer/plugins/internal/sidebar/subtree.js +1 -1
  172. package/dist/content-layer/plugins/internal/skills/index.js +1 -1
  173. package/dist/content-layer/plugins/internal/skills/server/routes.js +1 -1
  174. package/dist/content-layer/plugins/project/load.js +2 -2
  175. package/dist/content-layer/plugins/types/markdoc.d.ts +2 -0
  176. package/dist/content-layer/plugins/utils/link-access.js +1 -1
  177. package/dist/content-layer/plugins/utils/route-index.js +1 -1
  178. package/dist/content-layer/problems/codes.js +1 -1
  179. package/dist/content-layer/search/postings/fragment-field.d.ts +2 -0
  180. package/dist/content-layer/search/postings/fragment-field.js +1 -1
  181. package/dist/content-layer/search/postings/postings-store.js +1 -1
  182. package/dist/content-layer/server/database.js +1 -1
  183. package/dist/content-layer/static/registry.js +1 -1
  184. package/dist/content-layer/templates/template-set.js +1 -1
  185. package/dist/content-layer/versions/redirect.js +1 -1
  186. package/dist/content-layer/versions/resolve.js +1 -1
  187. package/dist/content-layer/versions/version-groups.d.ts +5 -1
  188. package/dist/content-layer/versions/version-groups.js +1 -1
  189. package/dist/server/app.js +3 -3
  190. package/dist/server/ask-ai/route.js +1 -1
  191. package/dist/server/auth/access-config.js +1 -1
  192. package/dist/server/auth/gate.js +1 -1
  193. package/dist/server/auth/middleware.js +1 -1
  194. package/dist/server/auth/oidc.js +1 -1
  195. package/dist/server/auth/request.js +1 -1
  196. package/dist/server/auth/routes.js +1 -1
  197. package/dist/server/content.js +12 -12
  198. package/dist/server/cors-proxy/handler.js +1 -1
  199. package/dist/server/feedback/route.js +1 -1
  200. package/dist/server/lambda-entry.js +1 -1
  201. package/dist/server/manifest-assets.js +4 -4
  202. package/dist/server/node-entry.js +1 -1
  203. package/dist/server/page-handlers.js +2 -2
  204. package/dist/server/plugin-context.js +1 -1
  205. package/dist/server/review/route.js +1 -1
  206. package/dist/server/search/route.js +1 -1
  207. package/dist/server/seo-tags.js +2 -2
  208. package/dist/server/sitemap.js +1 -1
  209. package/dist/server/static-files/serve.js +1 -1
  210. package/dist/server/subprocess/child-entry.js +1 -1
  211. package/dist/server/subprocess/host.js +1 -1
  212. package/dist/shared/constants/manifest-version.d.ts +3 -1
  213. package/dist/shared/constants/openapi-operation-methods.d.ts +2 -0
  214. package/dist/shared/constants/openapi-operation-methods.js +1 -0
  215. package/dist/shared/constants/review.d.ts +5 -0
  216. package/dist/shared/constants/review.js +1 -1
  217. package/dist/shared/constants/system-routes.js +1 -1
  218. package/dist/shared/load-dot-env.js +1 -1
  219. package/dist/shared/rbac/api-docs.d.ts +2 -1
  220. package/dist/shared/rbac/api-docs.js +1 -1
  221. package/dist/shared/rbac/engine.d.ts +12 -9
  222. package/dist/shared/rbac/engine.js +0 -0
  223. package/dist/shared/rbac/filter.js +1 -1
  224. package/dist/shared/rbac/l10n-rules.js +1 -1
  225. package/dist/shared/rbac/route-scope.d.ts +1 -1
  226. package/dist/shared/rbac/team-templates.js +1 -1
  227. package/dist/shared/types/auth.d.ts +1 -0
  228. package/dist/shared/types/config.d.ts +1 -0
  229. package/dist/shared/utils/l10n.js +1 -1
  230. package/dist/shared/utils/routes/file-path-to-route-slug.js +1 -1
  231. package/drizzle/20261111152552_page_markdown_rbac_scope/migration.sql +1 -0
  232. package/package.json +6 -5
  233. package/dist/client/review/use-bar-position.js +0 -1
@@ -1 +1 @@
1
- import{isObject as e}from"../../../../shared/utils/is-object.js";import{markdocNodeProblem as t}from"../../utils/node-source-range.js";import{compileRouteAccessMatcher as n,matchContentScope as r}from"../../../../shared/rbac/engine.js";import{SPEC_KIND_OPENAPI as i}from"../../../../shared/constants/api-spec-kinds.js";import{createLruCache as a}from"../../../../shared/utils/lru-cache.js";import{parseMarkdownCached as o}from"../../utils/parse-cache.js";import{resolveResolverTarget as s}from"./context-paths.js";import{createApiEntityKey as c}from"../../../plugins/utils/api-entity-key.js";import{withMockServerOption as l}from"../../../plugins/internal/api-docs/server/options.js";import{annotateApiDocsRbac as u}from"../../../../shared/rbac/api-docs.js";import{posix as d}from"node:path";import{REDOCLY_TEAMS_RBAC as f}from"@redocly/config";const p={curl:`shell`,JavaScript:`javascript`,"Node.js":`javascript`,Python:`python`,Java:`java`,"Java8+Apache":`java`,"C#":`csharp`,"C#+Newtonsoft":`csharp`,PHP:`php`,Go:`go`,Ruby:`ruby`,R:`r`},m=/* @__PURE__ */ new WeakMap;async function h(e){let t=m.get(e.node);t===void 0&&(t=g(e),m.set(e.node,t));let n=await t;return{definition:n.definition,problems:n.problems.splice(0)}}async function g(e){let t=e.node.attributes.descriptionFile;if(typeof t!=`string`||t===``||e.entities===void 0)return{definition:null,problems:[]};let n=s(e,t);if(n===null)return _(e,`descriptionFile "${t}" must stay inside the content directory`);let r=c(n.contentPath),i=await e.entities.get(r);return i===null||i.type!==`api`?_(e,`no API description found at ${n.contentPath}`):i.metadata?.specType===`openapi`?{definition:{contentPath:n.contentPath,document:await e.entities.load(r),metadata:i.metadata??{},dataHash:i.status===`ready`?i.dataHash??null:null},problems:[]}:_(e,`${n.contentPath} is not an OpenAPI description`)}function _(e,n){return e.logger?.warn(`${e.node.tag} in ${e.sourceFilePath}: ${n}`),e.node.attributes.descriptionFileInvalid=!0,{definition:null,problems:[t(e.node,n,e.sourceFilePath)]}}const v=(e,t)=>e.node.attributes[t]??void 0;function y(t){let n=e(t.options)?t.options:{};return e(n.mockServer)?{...n,mockServer:{...n.mockServer,position:`off`}}:n}function b(t,n){let r=v(t,`language`),i=v(t,`options`);return{...n,...i,codeSamples:{...e(n.codeSamples)?n.codeSamples:{},...i?.codeSamples,...r&&{languages:[{lang:r}]}}}}async function x(e){let{definition:t,problems:n}=await h(e);if(t===null)return{problems:n};let{buildCodeSamples:r,getRequestBodySamples:i,normalizeOptions:a,resolveOperationSampleContext:s}=await import(`@redocly/api-docs/server`),c=a({specType:`openapi`,...b(e,y(t.metadata)),markdownParser:o}),l=s(t.document,c,{operationId:v(e,`operationId`),pointer:v(e,`pointer`)});if(!l)return null;let u={exampleKey:v(e,`exampleKey`),mimeType:v(e,`mimeType`),parameters:v(e,`parameters`),requestBody:v(e,`requestBody`),environments:v(e,`environments`),environment:v(e,`environment`)},d=r(l,u).map(e=>({lang:p[e.lang]??e.lang.toLowerCase(),title:e.label??e.lang,source:e.source})),f=c.codeSamples?.languages??[],m=f.findIndex(({lang:e})=>e===`Payload`);if(m!==-1){let e=i(l,{exampleKey:u.exampleKey,mimeType:u.mimeType,titlePrefix:f[m].label});d.splice(m,0,...e)}return d.length>0&&(e.node.attributes[e.attributeName]=d),null}async function S(e){let{definition:t,problems:n}=await h(e);if(t===null)return{problems:n};let{getResponseSamples:r,normalizeOptions:i,resolveOperationSampleContext:a}=await import(`@redocly/api-docs/server`),s=a(t.document,i({specType:`openapi`,...y(t.metadata),markdownParser:o}),{operationId:v(e,`operationId`),pointer:v(e,`pointer`)});if(!s)return null;let c=r(s,{exampleKey:v(e,`exampleKey`)});return c.length>0&&(e.node.attributes[e.attributeName]=c),null}const C=a({budget:4});function w(e,t,n){let r=async()=>{let{buildItems:r}=await import(`@redocly/api-docs/server`),a=u(t.document,i,{warn:t=>e.logger?.warn(t)}),{items:s,store:c}=await r({type:i,document:a,options:{...n,specType:i,markdownParser:o},basePath:`/`,markdownParser:o});return{items:s,store:c}};if(t.dataHash===null)return r();let a=JSON.stringify([t.contentPath,t.dataHash,n]),s=C.get(a);return s===void 0&&(s=r(),C.set(a,s)),s}function T(e){return e.startsWith(`#`)?e.slice(1):e}function E(e,t){let n=v(t,`pointer`),r=v(t,`operationId`);if(n!==void 0||r!==void 0)for(let i of e){let e=i.content?.meta;if(n!==void 0&&e?.pointer!==void 0&&T(e.pointer)===T(n)||r!==void 0&&e?.sourceId===r)return i;let a=E(i.items??[],t);if(a!==void 0)return a}}function D(e){return e[f]}function O(e,t,n){for(let r of e){if(r.nodeType!==`container`)continue;let e=D(r)??n;for(let n of r.panels??[]){let r=`children`in n?n.children.find(t):void 0;if(r!==void 0){let t=D(n)??e;return{entry:r,scope:t===void 0?{}:{[f]:t}}}}let i=O(r.children,t,e);if(i!==void 0)return i}}async function k(e,t){return F(e,t,await P(e,t))}async function A(e){let{definition:t,problems:n}=await h(e);if(t===null)return{problems:n};let r=y(t.metadata),{items:i,store:a}=await w(e,t,r),o=E(i,e),s=o?.content?O(o.content.children,e=>e.kind===`code-sample`,D(o)):void 0;if(s===void 0)return null;let c=s.entry,{appendUndeclaredConfigureParameters:l}=await import(`@redocly/api-docs/server`),u=v(e,`parameters`),d={apiStore:a,options:b(e,r),panel:{...c,source:l(c.source,{...u?.path&&{path:u.path},...u?.query&&{query:u.query},...u?.header&&{headers:u.header},...u?.cookie&&{cookie:u.cookie}}),...s.scope},...await k(e,t.contentPath)};return e.node.attributes[e.attributeName]=d,null}async function j(e){let{definition:t,problems:n}=await h(e);if(t===null)return{problems:n};let r=y(t.metadata),{items:i,store:a}=await w(e,t,r),o=E(i,e),s=o?.content?O(o.content.children,e=>e.kind===`response`&&!!e.responseCodes?.length,D(o)):void 0;if(s?.entry.responseCodes===void 0)return null;let c={apiStore:a,options:r,panel:{responseCodes:s.entry.responseCodes,...s.entry.schemaId!==void 0&&{schemaId:s.entry.schemaId},...s.scope},...await k(e,t.contentPath)};return e.node.attributes[e.attributeName]=c,null}async function M(e){let t=v(e,`pointer`);if(t===void 0)return null;let{definition:n,problems:r}=await h(e);if(n===null)return{problems:r};let i=y(n.metadata),{items:a,store:o}=await w(e,n,i),s=T(t).replace(/^\//,``),c=Object.fromEntries([s,s.replace(/\/value$/,``)].filter(e=>o.exampleStore[e]!==void 0).map(e=>[e,o.exampleStore[e]]));if(Object.keys(c).length===0)return null;let l=(await import(`@redocly/api-docs/server`)).findExampleEncoding(a,t),u={apiStore:{schemaStore:{},exampleStore:c,securitySchemeStore:{}},options:{...i,...v(e,`options`)},...l!==void 0&&{encoding:l},...await k(e,n.contentPath)};return e.node.attributes[e.attributeName]=u,null}function N(e,t,n,r,i){if(!e.requestBody||!t&&!n)return e;let a={...e.requestBody};if(t&&(a=a[t]?{[t]:a[t]}:{}),n)for(let[e,t]of Object.entries(a)){let o=t.exampleIds?.filter(e=>r[e]?.key!==void 0);if(!o?.length)continue;let s=i(o,n,e=>r[e]);a[e]={...t,exampleIds:s?[s]:[]}}return{...e,requestBody:a}}async function P(e,t){let n=d.relative(d.dirname(e.sourceFilePath),t),{result:r}=await e.markdown.resolveLocalReference(n,e.sourceFilePath);return r.kind===`pageUrl`?r.url:void 0}function F(e,t,i){let a=n(e.config);if(a===null)return{};let o=r(a,{filePath:t,slug:i??null});return{[f]:o??{}}}async function I(t){let{definition:n,problems:r}=await h(t);if(n===null)return{problems:r};let{findExampleIdByKey:a,JsonPointer:s,normalizeOptions:c,resolveOperationSampleContext:d}=await import(`@redocly/api-docs/server`),f=n.metadata,p=e(f.options)?f.options:{},m=await P(t,n.contentPath),g=l(p,t.config,m),_=v(t,`options`),y={...g,..._??{}},b=c({specType:`openapi`,...y,markdownParser:o}),x=u(n.document,i,{warn:e=>t.logger?.warn(e)}),S=d(x,b,{operationId:v(t,`operationId`),pointer:v(t,`pointer`)});if(!S)return null;let C=N(S.source,v(t,`mimeType`),v(t,`exampleKey`),S.storeCtx.exampleStore,a),w={apiStore:{schemaStore:S.storeCtx.schemaStore,exampleStore:S.storeCtx.exampleStore,securitySchemeStore:S.storeCtx.securitySchemeStore,specVersion:x.openapi},definition:x,operationId:S.operation.operationId??``,operationSource:C,options:y,pointer:s.compile([`paths`,S.pathName,S.method.toLowerCase()]),...F(t,n.contentPath,m)};return t.node.attributes[t.attributeName]=w,null}export{A as resolveOpenapiCodeSamplePanelAttribute,x as resolveOpenapiCodeSamplesAttribute,M as resolveOpenapiExampleAttribute,I as resolveOpenapiReplayAttribute,j as resolveOpenapiResponsePanelAttribute,S as resolveOpenapiResponseSamplesAttribute};
1
+ import{compileRouteAccessMatcher as e,matchContentScope as t}from"../../../../shared/rbac/engine.js";import{isObject as n}from"../../../../shared/utils/is-object.js";import{SPEC_KIND_OPENAPI as r}from"../../../../shared/constants/api-spec-kinds.js";import{markdocNodeProblem as i}from"../../utils/node-source-range.js";import{createLruCache as a}from"../../../../shared/utils/lru-cache.js";import{parseMarkdownCached as o}from"../../utils/parse-cache.js";import{resolveResolverTarget as s}from"./context-paths.js";import{createApiEntityKey as c}from"../../../plugins/utils/api-entity-key.js";import{withMockServerOption as l}from"../../../plugins/internal/api-docs/server/options.js";import{annotateApiDocsRbac as u}from"../../../../shared/rbac/api-docs.js";import{posix as d}from"node:path";import{REDOCLY_TEAMS_RBAC as f}from"@redocly/config";const p={curl:`shell`,JavaScript:`javascript`,"Node.js":`javascript`,Python:`python`,Java:`java`,"Java8+Apache":`java`,"C#":`csharp`,"C#+Newtonsoft":`csharp`,PHP:`php`,Go:`go`,Ruby:`ruby`,R:`r`},m=/* @__PURE__ */ new WeakMap;async function h(e){let t=m.get(e.node);t===void 0&&(t=g(e),m.set(e.node,t));let n=await t;return{definition:n.definition,problems:n.problems.splice(0)}}async function g(e){let t=e.node.attributes.descriptionFile;if(typeof t!=`string`||t===``||e.entities===void 0)return{definition:null,problems:[]};let n=s(e,t);if(n===null)return _(e,`descriptionFile "${t}" must stay inside the content directory`);let r=c(n.contentPath),i=await e.entities.get(r);return i===null||i.type!==`api`?_(e,`no API description found at ${n.contentPath}`):i.metadata?.specType===`openapi`?{definition:{contentPath:n.contentPath,document:await e.entities.load(r),metadata:i.metadata??{},dataHash:i.status===`ready`?i.dataHash??null:null},problems:[]}:_(e,`${n.contentPath} is not an OpenAPI description`)}function _(e,t){return e.logger?.warn(`${e.node.tag} in ${e.sourceFilePath}: ${t}`),e.node.attributes.descriptionFileInvalid=!0,{definition:null,problems:[i(e.node,t,e.sourceFilePath)]}}const v=(e,t)=>e.node.attributes[t]??void 0;function y(e){let t=n(e.options)?e.options:{};return n(t.mockServer)?{...t,mockServer:{...t.mockServer,position:`off`}}:t}function b(e,t){let r=v(e,`language`),i=v(e,`options`);return{...t,...i,codeSamples:{...n(t.codeSamples)?t.codeSamples:{},...i?.codeSamples,...r&&{languages:[{lang:r}]}}}}async function x(e){let{definition:t,problems:n}=await h(e);if(t===null)return{problems:n};let{buildCodeSamples:r,getRequestBodySamples:i,normalizeOptions:a,resolveOperationSampleContext:s}=await import(`@redocly/api-docs/server`),c=a({specType:`openapi`,...b(e,y(t.metadata)),markdownParser:o}),l=s(t.document,c,{operationId:v(e,`operationId`),pointer:v(e,`pointer`)});if(!l)return null;let u={exampleKey:v(e,`exampleKey`),mimeType:v(e,`mimeType`),parameters:v(e,`parameters`),requestBody:v(e,`requestBody`),environments:v(e,`environments`),environment:v(e,`environment`)},d=r(l,u).map(e=>({lang:p[e.lang]??e.lang.toLowerCase(),title:e.label??e.lang,source:e.source})),f=c.codeSamples?.languages??[],m=f.findIndex(({lang:e})=>e===`Payload`);if(m!==-1){let e=i(l,{exampleKey:u.exampleKey,mimeType:u.mimeType,titlePrefix:f[m].label});d.splice(m,0,...e)}return d.length>0&&(e.node.attributes[e.attributeName]=d),null}async function S(e){let{definition:t,problems:n}=await h(e);if(t===null)return{problems:n};let{getResponseSamples:r,normalizeOptions:i,resolveOperationSampleContext:a}=await import(`@redocly/api-docs/server`),s=a(t.document,i({specType:`openapi`,...y(t.metadata),markdownParser:o}),{operationId:v(e,`operationId`),pointer:v(e,`pointer`)});if(!s)return null;let c=r(s,{exampleKey:v(e,`exampleKey`)});return c.length>0&&(e.node.attributes[e.attributeName]=c),null}const C=a({budget:4});function w(e,t,n){let i=async()=>{let{buildItems:i}=await import(`@redocly/api-docs/server`),a=u(t.document,r,{warn:t=>e.logger?.warn(t)}),{items:s,store:c}=await i({type:r,document:a,options:{...n,specType:r,markdownParser:o},basePath:`/`,markdownParser:o});return{items:s,store:c}};if(t.dataHash===null)return i();let a=JSON.stringify([t.contentPath,t.dataHash,n]),s=C.get(a);return s===void 0&&(s=i(),C.set(a,s)),s}function T(e){return e.startsWith(`#`)?e.slice(1):e}function E(e,t){let n=v(t,`pointer`),r=v(t,`operationId`);if(n!==void 0||r!==void 0)for(let i of e){let e=i.content?.meta;if(n!==void 0&&e?.pointer!==void 0&&T(e.pointer)===T(n)||r!==void 0&&e?.sourceId===r)return i;let a=E(i.items??[],t);if(a!==void 0)return a}}function D(e){return e[f]}function O(e,t,n){for(let r of e){if(r.nodeType!==`container`)continue;let e=D(r)??n;for(let n of r.panels??[]){let r=`children`in n?n.children.find(t):void 0;if(r!==void 0){let t=D(n)??e;return{entry:r,scope:t===void 0?{}:{[f]:t}}}}let i=O(r.children,t,e);if(i!==void 0)return i}}async function k(e,t){return F(e,t,await P(e,t))}async function A(e){let{definition:t,problems:n}=await h(e);if(t===null)return{problems:n};let r=y(t.metadata),{items:i,store:a}=await w(e,t,r),o=E(i,e),s=o?.content?O(o.content.children,e=>e.kind===`code-sample`,D(o)):void 0;if(s===void 0)return null;let c=s.entry,{appendUndeclaredConfigureParameters:l}=await import(`@redocly/api-docs/server`),u=v(e,`parameters`),d={apiStore:a,options:b(e,r),panel:{...c,source:l(c.source,{...u?.path&&{path:u.path},...u?.query&&{query:u.query},...u?.header&&{headers:u.header},...u?.cookie&&{cookie:u.cookie}}),...s.scope},...await k(e,t.contentPath)};return e.node.attributes[e.attributeName]=d,null}async function j(e){let{definition:t,problems:n}=await h(e);if(t===null)return{problems:n};let r=y(t.metadata),{items:i,store:a}=await w(e,t,r),o=E(i,e),s=o?.content?O(o.content.children,e=>e.kind===`response`&&!!e.responseCodes?.length,D(o)):void 0;if(s?.entry.responseCodes===void 0)return null;let c={apiStore:a,options:r,panel:{responseCodes:s.entry.responseCodes,...s.entry.schemaId!==void 0&&{schemaId:s.entry.schemaId},...s.scope},...await k(e,t.contentPath)};return e.node.attributes[e.attributeName]=c,null}async function M(e){let t=v(e,`pointer`);if(t===void 0)return null;let{definition:n,problems:r}=await h(e);if(n===null)return{problems:r};let i=y(n.metadata),{items:a,store:o}=await w(e,n,i),s=T(t).replace(/^\//,``),c=Object.fromEntries([s,s.replace(/\/value$/,``)].filter(e=>o.exampleStore[e]!==void 0).map(e=>[e,o.exampleStore[e]]));if(Object.keys(c).length===0)return null;let l=(await import(`@redocly/api-docs/server`)).findExampleEncoding(a,t),u={apiStore:{schemaStore:{},exampleStore:c,securitySchemeStore:{}},options:{...i,...v(e,`options`)},...l!==void 0&&{encoding:l},...await k(e,n.contentPath)};return e.node.attributes[e.attributeName]=u,null}function N(e,t,n,r,i){if(!e.requestBody||!t&&!n)return e;let a={...e.requestBody};if(t&&(a=a[t]?{[t]:a[t]}:{}),n)for(let[e,t]of Object.entries(a)){let o=t.exampleIds?.filter(e=>r[e]?.key!==void 0);if(!o?.length)continue;let s=i(o,n,e=>r[e]);a[e]={...t,exampleIds:s?[s]:[]}}return{...e,requestBody:a}}async function P(e,t){let n=d.relative(d.dirname(e.sourceFilePath),t),{result:r}=await e.markdown.resolveLocalReference(n,e.sourceFilePath);return r.kind===`pageUrl`?r.url:void 0}function F(n,r,i){let a=e(n.config);if(a===null)return{};let o=t(a,{filePath:r,slug:i??null});return{[f]:o}}async function I(e){let{definition:t,problems:i}=await h(e);if(t===null)return{problems:i};let{findExampleIdByKey:a,JsonPointer:s,normalizeOptions:c,resolveOperationSampleContext:d}=await import(`@redocly/api-docs/server`),f=t.metadata,p=n(f.options)?f.options:{},m=await P(e,t.contentPath),g=l(p,e.config,m),_=v(e,`options`),y={...g,..._??{}},b=c({specType:`openapi`,...y,markdownParser:o}),x=u(t.document,r,{warn:t=>e.logger?.warn(t)}),S=d(x,b,{operationId:v(e,`operationId`),pointer:v(e,`pointer`)});if(!S)return null;let C=N(S.source,v(e,`mimeType`),v(e,`exampleKey`),S.storeCtx.exampleStore,a),w={apiStore:{schemaStore:S.storeCtx.schemaStore,exampleStore:S.storeCtx.exampleStore,securitySchemeStore:S.storeCtx.securitySchemeStore,specVersion:x.openapi},definition:x,operationId:S.operation.operationId??``,operationSource:C,options:y,pointer:s.compile([`paths`,S.pathName,S.method.toLowerCase()]),...F(e,t.contentPath,m)};return e.node.attributes[e.attributeName]=w,null}export{A as resolveOpenapiCodeSamplePanelAttribute,x as resolveOpenapiCodeSamplesAttribute,M as resolveOpenapiExampleAttribute,I as resolveOpenapiReplayAttribute,j as resolveOpenapiResponsePanelAttribute,S as resolveOpenapiResponseSamplesAttribute};
@@ -1 +1 @@
1
- import{markdocErrorResult as e,replaceWithMarkdocError as t}from"../tags/markdoc-error.js";import{getAttributeBuildTimeResolver as n}from"./attribute-resolver-key.js";import{walkMarkdocAst as r}from"../utils/walk-markdoc-ast.js";import{getExampleContent as i,walkWithExampleContent as a}from"../utils/reparse-example-fences.js";import{isLocalReference as o}from"./references.js";import{resolveLinkAttribute as s}from"./markdoc-resolvers/link.js";import{resolveIconAttribute as c,resolveImageAttribute as l,resolveImageSrcSetAttribute as u}from"./markdoc-resolvers/image.js";import{resolveCodeSnippetFileAttribute as d}from"./markdoc-resolvers/code-snippet.js";import{resolveSvgContentAttribute as f}from"./markdoc-resolvers/svg-content.js";import{resolveTagRawContentAttribute as p}from"./markdoc-resolvers/tag-raw-content.js";import{resolveHtmlAttrsAttribute as m}from"./markdoc-resolvers/html-attrs.js";import{resolveImageGalleryAttribute as h}from"./markdoc-resolvers/image-gallery.js";import{resolveCodeWalkthroughFilesetsAttribute as g}from"./markdoc-resolvers/code-walkthrough/filesets.js";import{resolvePartialFileAttribute as _}from"./markdoc-resolvers/partial.js";import{resolveDiagramFileAttribute as v}from"./markdoc-resolvers/diagram-file.js";import{resolveParsedYamlAttribute as y,resolveRawContentAttribute as b,resolveRelativePathAttribute as x}from"./markdoc-resolvers/file-reference.js";import{resolveJsonExampleRefAttribute as S,resolveJsonSchemaRefAttribute as C,resolveSampleFromJsonSchemaAttribute as w}from"./markdoc-resolvers/json-schema.js";import{resolveOpenapiCodeSamplePanelAttribute as T,resolveOpenapiCodeSamplesAttribute as E,resolveOpenapiExampleAttribute as D,resolveOpenapiReplayAttribute as O,resolveOpenapiResponsePanelAttribute as k,resolveOpenapiResponseSamplesAttribute as A}from"./markdoc-resolvers/operation-samples.js";import{PROMPT_TAG as j}from"@redocly/theme/core/constants";import{convertGithubAlertToAdmonition as M}from"@redocly/theme/markdoc/tags/admonition";async function N(e,o){let s=o.tags??{},c=F,l={entityDeps:[],assetUsages:[],linkRefs:[],problems:[]},u=o.resolverContext?.markdown?.disabledTags,d=R(o.source),f=[...r(e,{skipChildren:z})],p=f.flatMap(e=>{let t=i(e);return t?[...a(t,z)]:[]});for(let e of[...f,...p])M(e);let m=p.filter(e=>e.type===`tag`);for(let e of[...f,...m])if(e.type===`link`)await L(c.nativeMdLink,e,`href`,o,l,d);else if(e.type===`image`)await L(c.imageSrc,e,`src`,o,l,d);else if(e.type===`tag`){if(typeof e.tag==`string`&&u?.has(e.tag)){t(e,`The "${e.tag}" tag is not available here.`);continue}let r=typeof e.tag==`string`?s[e.tag]:void 0;for(let[t,i]of Object.entries(r?.attributes??{})){let r=n(i);if(!r)continue;let a=c[r];a&&await L(a,e,t,o,l,d)}}return l}const P=({attributeName:e,markdown:t,node:n,partialChain:r,sourceFilePath:i})=>s(n,e,i,t,r?.[0]),F={imageSrc({attributeName:e,markdown:t,node:n,sourceFilePath:r}){return l(n,e,r,t)},imageSrcSet({attributeName:e,markdown:t,node:n,sourceFilePath:r}){return u(n,e,r,t)},link:P,nativeMdLink:P,async relativeOrCdnIcon(e){let{attributeName:t,markdown:n,node:r,sourceFilePath:i}=e,a=r.attributes[t];return typeof a==`string`&&B(a)&&await f(e,{optional:!0}),c(r,t,i,n)},codeSnippetFile:d,diagramFile:v,svgContent:f,tagRawContent:p,htmlAttrs:m,imageGallery:h,codeWalkthroughFilesets:g,partialFile:_,jsonSchemaRef:C,sampleFromJsonSchema:w,jsonExampleRef:S,openapiCodeSamples:E,openapiCodeSamplePanel:T,openapiReplay:O,openapiResponseSamples:A,openapiResponsePanel:k,openapiExample:D,rawContent:b,parsedYaml:y,relativePath:x};function I(e){let t=/* @__PURE__ */ new Set;for(let n of a(e))n.type===`tag`&&typeof n.tag==`string`&&t.add(n.tag);return[...t].sort()}async function L(t,n,r,i,a,o){let s;try{s=await t({...i.resolverContext,attributeName:r,node:n,sourceFilePath:i.sourceFilePath,tags:i.tags,partialChain:i.partialChain,readSourceLines:o})}catch(t){let r=t instanceof Error?t.message:String(t);s=e(n,r,i.sourceFilePath)}s&&(s.entityDeps&&a.entityDeps.push(...s.entityDeps),s.assetUsages&&a.assetUsages.push(...s.assetUsages),s.linkRefs&&a.linkRefs.push(...s.linkRefs),s.problems&&a.problems.push(...s.problems))}function R(e){let t;return()=>(t??=e.split(/\r?\n/),t)}function z(e){return e.type===`tag`&&e.tag===j}function B(e){let t=(e.split(`#`,1)[0]??e).split(`?`,1)[0]??e;return/\.svg$/i.test(t)&&o(e)}export{F as builtInMarkdocAttributeResolvers,I as collectMarkdocTagNames,z as isPromptTag,N as resolveMarkdocBuildTimeAttributes};
1
+ import{markdocErrorResult as e,replaceWithMarkdocError as t}from"../tags/markdoc-error.js";import{walkMarkdocAst as n}from"../utils/walk-markdoc-ast.js";import{getExampleContent as r,walkWithExampleContent as i}from"../utils/reparse-example-fences.js";import{isLocalReference as a}from"./references.js";import{resolveLinkAttribute as o}from"./markdoc-resolvers/link.js";import{resolveIconAttribute as s,resolveImageAttribute as c,resolveImageSrcSetAttribute as l}from"./markdoc-resolvers/image.js";import{resolveCodeSnippetFileAttribute as u}from"./markdoc-resolvers/code-snippet.js";import{resolveSvgContentAttribute as d}from"./markdoc-resolvers/svg-content.js";import{resolveTagRawContentAttribute as f}from"./markdoc-resolvers/tag-raw-content.js";import{resolveHtmlAttrsAttribute as p}from"./markdoc-resolvers/html-attrs.js";import{resolveImageGalleryAttribute as m}from"./markdoc-resolvers/image-gallery.js";import{resolveCodeWalkthroughFilesetsAttribute as h}from"./markdoc-resolvers/code-walkthrough/filesets.js";import{resolvePartialFileAttribute as g}from"./markdoc-resolvers/partial.js";import{resolveDiagramFileAttribute as _}from"./markdoc-resolvers/diagram-file.js";import{resolveParsedYamlAttribute as v,resolveRawContentAttribute as y,resolveRelativePathAttribute as b}from"./markdoc-resolvers/file-reference.js";import{resolveJsonExampleRefAttribute as x,resolveJsonSchemaRefAttribute as S,resolveSampleFromJsonSchemaAttribute as C}from"./markdoc-resolvers/json-schema.js";import{resolveOpenapiCodeSamplePanelAttribute as w,resolveOpenapiCodeSamplesAttribute as T,resolveOpenapiExampleAttribute as E,resolveOpenapiReplayAttribute as D,resolveOpenapiResponsePanelAttribute as O,resolveOpenapiResponseSamplesAttribute as k}from"./markdoc-resolvers/operation-samples.js";import{getAttributeBuildTimeResolver as A}from"./attribute-resolver-key.js";import{PROMPT_TAG as j}from"@redocly/theme/core/constants";import{convertGithubAlertToAdmonition as M}from"@redocly/theme/markdoc/tags/admonition";async function N(e,a){let o=a.tags??{},s=F,c={entityDeps:[],assetUsages:[],linkRefs:[],problems:[]},l=a.resolverContext?.markdown?.disabledTags,u=R(a.source),d=[...n(e,{skipChildren:z})],f=d.flatMap(e=>{let t=r(e);return t?[...i(t,z)]:[]});for(let e of[...d,...f])M(e);let p=f.filter(e=>e.type===`tag`);for(let e of[...d,...p])if(e.type===`link`)await L(s.nativeMdLink,e,`href`,a,c,u);else if(e.type===`image`)await L(s.imageSrc,e,`src`,a,c,u);else if(e.type===`tag`){if(typeof e.tag==`string`&&l?.has(e.tag)){t(e,`The "${e.tag}" tag is not available here.`);continue}let n=typeof e.tag==`string`?o[e.tag]:void 0;for(let[t,r]of Object.entries(n?.attributes??{})){let n=A(r);if(!n)continue;let i=s[n];i&&await L(i,e,t,a,c,u)}}return c}const P=({attributeName:e,markdown:t,node:n,partialChain:r,sourceFilePath:i})=>o(n,e,i,t,r?.[0]),F={imageSrc({attributeName:e,markdown:t,node:n,sourceFilePath:r}){return c(n,e,r,t)},imageSrcSet({attributeName:e,markdown:t,node:n,sourceFilePath:r}){return l(n,e,r,t)},link:P,nativeMdLink:P,async relativeOrCdnIcon(e){let{attributeName:t,markdown:n,node:r,sourceFilePath:i}=e,a=r.attributes[t];return typeof a==`string`&&B(a)&&await d(e,{optional:!0}),s(r,t,i,n)},codeSnippetFile:u,diagramFile:_,svgContent:d,tagRawContent:f,htmlAttrs:p,imageGallery:m,codeWalkthroughFilesets:h,partialFile:g,jsonSchemaRef:S,sampleFromJsonSchema:C,jsonExampleRef:x,openapiCodeSamples:T,openapiCodeSamplePanel:w,openapiReplay:D,openapiResponseSamples:k,openapiResponsePanel:O,openapiExample:E,rawContent:y,parsedYaml:v,relativePath:b};function I(e){let t=/* @__PURE__ */ new Set;for(let n of i(e))n.type===`tag`&&typeof n.tag==`string`&&t.add(n.tag);return[...t].sort()}async function L(t,n,r,i,a,o){let s;try{s=await t({...i.resolverContext,attributeName:r,node:n,sourceFilePath:i.sourceFilePath,tags:i.tags,partialChain:i.partialChain,readSourceLines:o})}catch(t){let r=t instanceof Error?t.message:String(t);s=e(n,r,i.sourceFilePath)}s&&(s.entityDeps&&a.entityDeps.push(...s.entityDeps),s.assetUsages&&a.assetUsages.push(...s.assetUsages),s.linkRefs&&a.linkRefs.push(...s.linkRefs),s.problems&&a.problems.push(...s.problems))}function R(e){let t;return()=>(t??=e.split(/\r?\n/),t)}function z(e){return e.type===`tag`&&e.tag===j}function B(e){let t=(e.split(`#`,1)[0]??e).split(`?`,1)[0]??e;return/\.svg$/i.test(t)&&a(e)}export{F as builtInMarkdocAttributeResolvers,I as collectMarkdocTagNames,z as isPromptTag,N as resolveMarkdocBuildTimeAttributes};
@@ -1 +1 @@
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
+ import{buildContentAssetUrl as e}from"../../plugins/internal/assets/url.js";import{L10N_DIR as t}from"../../../shared/constants/l10n/defaults.js";import{delocalizeL10nPath as n,l10nDirOf as r,toLocaleSlug as i}from"../../../shared/utils/l10n.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=/[[\]()*_`#!|<>~]|\{%|\n[ \t\r]*\n|^\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,t){let r=await t(e);if(r)return r;let i=n(e);if(i!==void 0){let n=await t(i);if(n){let t=e.slice(0,e.length-i.length),r=n.entityDeps.filter(e=>e.kind===`file`).map(e=>({kind:`file`,path:`${t}${e.path}`}));return{...n,entityDeps:[...r,...n.entityDeps]}}}return{result:{kind:`passthrough`},entityDeps:[],assetUsages:[]}}async function x(e,t){let i=n(e),a=r(e);if(i===void 0||a===void 0)return null;let o=await t(i,a);return o===null?null:{...o,entityDeps:[{kind:`file`,path:e},...o.entityDeps]}}async function S(n,r,i,a,o){let[s]=n.assetUsages;if(!s||!a?.length||n.result.kind!==`assetRef`||r.startsWith(`@l10n/`))return n;let c=e(s.path,s.hash,s.tag),l=[];for(let e of a){let n=`${t}/${e}/${s.path}`,r=i.filesByPath.get(n);if(!r)continue;let a=await o?.(n)??null;l.push({path:n,hash:r.hash,kind:s.kind,tag:a,l10n:{locale:e,canonicalUrl:c}})}return l.length===0?n:{...n,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(t,n,r,o,c,u){if(!_(t))return{result:{kind:`passthrough`},entityDeps:[],assetUsages:[]};let{path:d,hash:h}=y(t),g=async(t,n)=>{let a=r.primaryRouteByFilePath.get(t);if(a!==void 0)return{result:{kind:`pageUrl`,url:`${n===void 0?a:i(a,n)}${h}`},entityDeps:[{kind:`file`,path:t}],assetUsages:[]};let c=r.filesByPath.get(t);if(c){let n=m.extname(t).toLowerCase(),r=s.has(n)?`image`:`file`,i=await o?.(t)??null;return{result:{kind:`assetRef`,url:`${e(t,c.hash,i)}${h}`,path:t,hash:c.hash},entityDeps:[{kind:`file`,path:t}],assetUsages:[{path:t,hash:c.hash,kind:r,tag:i}]}}return null};return S(await b(n,async e=>{let t=a(l(d),e);if(t===null)return null;let n=await g(t)??await x(t,g);if(n!==null)return n;let[i=``,o=``]=v(d);if(!d.startsWith(`/`)&&m.extname(i)===``){let t=u??e,n=r.primaryRouteByFilePath.get(t),a=n===void 0?m.extname(t).toLowerCase()===`.md`?void 0:p(i,`/${t}`,!1):p(i,n,f(t)),s=a===void 0?void 0:C(r,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}),n,r,c,o)}async function T(t,n,r,i,o){if(!_(t))return{result:{kind:`passthrough`},entityDeps:[],assetUsages:[]};let{path:s}=y(t),c=async t=>{let n=r.filesByPath.get(t);if(!n)return null;let a=await i?.(t)??null;return{result:{kind:`assetRef`,url:e(t,n.hash,a),path:t,hash:n.hash},entityDeps:[{kind:`file`,path:t}],assetUsages:[{path:t,hash:n.hash,kind:`image`,tag:a}]}};return S(await b(n,async e=>{let t=a(l(s),e);return t===null?null:await c(t)??await x(t,c)}),n,r,o,i)}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{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,`
1
+ import{headingSlugger as e}from"../utils/heading-slugger.js";import{getInnerText as t}from"../utils/get-inner-text.js";import{builtInMarkdocNodes as n,builtInMarkdocTags as r}from"../constants/builtin-tags.js";import i from"@redocly/markdoc";import{PROMPT_TAG as a}from"@redocly/theme/core/constants";const o=/* @__PURE__ */ new Set([`if`,`else`,a]),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(t,n={}){e.reset();let r=[],i=[];for(let e of f(t)){let t=p({type:`document`,children:e},n);t!==``&&(r.push(t),i.push(d(e[0],n.variables)))}return{chunks:r,headings:i}}function d(e,a){if(!v(e)||e.type!==`heading`)return null;let o=i.transform(i.Ast.fromJSON(JSON.stringify(e)),{nodes:n,tags:r,variables:a});if(!i.Tag.isTag(o))return null;let s=typeof o.attributes.id==`string`?o.attributes.id:``;return{heading:t(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(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(`
4
+ `).trim()}function m(e,t={}){if(i.Ast.isVariable(e))return Object.hasOwn(t,String(e.path[0]))?new i.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)||i.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??{},a=r.content;switch(e.type){case`text`:{let e=i.Ast.isVariable(a)?new i.Ast.Variable(a.path).resolve({variables:n.options.variables}):a;typeof e==`string`&&t.push(e);return}case`code`:typeof a==`string`&&t.push(`\`${a}\``);return;case`fence`:{let i=typeof r.language==`string`?r.language:``,o=[];for(let t of e.children??[])g(t,o,n);let s=e.children?.length?o.join(``):a,c=typeof s==`string`?s.replace(/\n$/,``):``;t.push(`\n\`\`\`${i}\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
  ---
@@ -21,7 +21,7 @@ export declare function teamBlockSectionKey(docKey: string): string;
21
21
  * page's own title opens the page, not `#title`. Section anchors follow the rendered heading
22
22
  * ids: an explicit `{% #id %}`, else the theme's slug of the heading's rendered text, numbered
23
23
  * on repeats in document order — headings nested in a tag count too, though only top-level
24
- * headings open a section. A section's `path` is its heading chain: the latest top-level
24
+ * headings and headings in raw HTML elements (`<details>`) open a section. A section's `path` is its heading chain: the latest top-level
25
25
  * heading of each shallower level, a shallower heading clearing the deeper ones and a
26
26
  * level-1 heading clearing them all.
27
27
  */
@@ -1 +1 @@
1
- import{HeadingSlugger as e}from"../utils/heading-slugger.js";import{hidesBodyFromSearch as t,markdocAstToText as n}from"./to-text.js";import{renderedHeadingText as r}from"../utils/heading-text.js";import{isNonControlVariant as i}from"@redocly/theme/markdoc/tags/variant";import{isForAgentsOnly as a}from"@redocly/theme/markdoc/tags/visibility";const o=/^(page|section-\d+)-team-\d+$/;function s(e){return o.exec(e)?.[1]??e}function c(t,i,a={}){let o=g(t)&&Array.isArray(t.children)?t.children:[],s=new e,c={title:i,body:[]},u=[],d=c,f=!1,p=[],_=e=>{let t=e.attributes?.id;return typeof t==`string`?t:s.slug(r(e,a))};for(let e of o){if(!g(e)||e.type!==`heading`){d.body.push(e);for(let t of h(e))_(t);continue}let t=r(e,a),n=_(e),o=m(e);if(o===1){!f&&t!==``&&(c.title=t,f=!0),d=c,p.length=0;continue}let s=t||i,l=p.slice(0,o).filter(e=>e!==void 0);p.length=o,p[o]=s;let v={anchor:n,title:s,ancestors:l,body:[]};u.push(v),d=v}let v=e=>n({type:`document`,children:e}),y=(e,t)=>[e,...l(t).map(({teams:t,children:n},r)=>({...e,docKey:`${e.docKey}-team-${r+1}`,text:v(n),rbacTeams:t})).filter(e=>e.text!==``)];return[...y({docKey:`page`,title:c.title,text:v(c.body)},c.body),...u.flatMap((e,t)=>y({docKey:`section-${t+1}`,anchor:e.anchor,title:e.title,text:v(e.body),path:[c.title,...e.ancestors,e.title]},e.body))]}function l(e){let n=[],r=(e,i)=>{if(g(e)&&!t(e)){if(e.type===`tag`&&e.tag===`if`){let t=u(e.attributes?.primary);if(t===void 0)return;let a=i===void 0?t:t.filter(e=>i.includes(e));if(a.length===0)return;let o=e.children??[],s=o.findIndex(e=>g(e)&&e.type===`tag`&&e.tag===`else`),c=s===-1?o:o.slice(0,s);n.push({teams:a,children:c});for(let e of c)r(e,a);return}for(let t of Object.values(e.slots??{}))r(t,i);for(let t of e.children??[])r(t,i)}};for(let t of e)r(t,void 0);return n}function u(e){if(!f(e))return;let t=Object.values(e.parameters??{});if(e.name===`includes`){let e=d(t);return e===void 0?void 0:[e]}if(e.name!==`or`)return;let n=t.map(e=>f(e)&&e.name===`includes`?d(Object.values(e.parameters??{})):void 0).filter(e=>e!==void 0);return n.length===0?void 0:n}function d([e,t]){let n=p(e,`Variable`)?e.path:void 0;return Array.isArray(n)&&n.length===2&&n[0]===`rbac`&&n[1]===`teams`&&typeof t==`string`&&t!==`*`?t:void 0}function f(e){return p(e,`Function`)}function p(e,t){return typeof e==`object`&&!!e&&e.$$mdtype===t}function m(e){let t=e.attributes?.level;return typeof t==`number`?t:2}function*h(e){if(!(!g(e)||a(e)||i(e))){for(let t of e.children??[])g(t)&&t.type===`heading`&&(yield t),yield*h(t);for(let t of Object.values(e.slots??{}))yield*h(t)}}function g(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}export{c as markdocAstToSearchSections,s as teamBlockSectionKey};
1
+ import{HeadingSlugger as e}from"../utils/heading-slugger.js";import{hidesBodyFromSearch as t,markdocAstToText as n}from"./to-text.js";import{renderedHeadingText as r}from"../utils/heading-text.js";import{isNonControlVariant as i}from"@redocly/theme/markdoc/tags/variant";import{isForAgentsOnly as a}from"@redocly/theme/markdoc/tags/visibility";const o=/^(page|section-\d+)-team-\d+$/;function s(e){return o.exec(e)?.[1]??e}function c(t,i,a={}){let o=v(t)&&Array.isArray(t.children)?t.children:[],s=new e,c={title:i,body:[]},u=[],d=c,f=!1,p=[],g=e=>{let t=e.attributes?.id;return typeof t==`string`?t:s.slug(r(e,a))};for(let e of h(o)){if(!v(e)||e.type!==`heading`){d.body.push(e);for(let t of _(e))g(t);continue}let t=r(e,a),n=g(e),o=m(e);if(o===1){!f&&t!==``&&(c.title=t,f=!0),d=c,p.length=0;continue}let s=t||i,l=p.slice(0,o).filter(e=>e!==void 0);p.length=o,p[o]=s;let h={anchor:n,title:s,ancestors:l,body:[]};u.push(h),d=h}let y=e=>n({type:`document`,children:e}),b=(e,t)=>[e,...l(t).map(({teams:t,children:n},r)=>({...e,docKey:`${e.docKey}-team-${r+1}`,text:y(n),rbacTeams:t})).filter(e=>e.text!==``)];return[...b({docKey:`page`,title:c.title,text:y(c.body)},c.body),...u.flatMap((e,t)=>b({docKey:`section-${t+1}`,anchor:e.anchor,title:e.title,text:y(e.body),path:[c.title,...e.ancestors,e.title]},e.body))]}function l(e){let n=[],r=(e,i)=>{if(v(e)&&!t(e)){if(e.type===`tag`&&e.tag===`if`){let t=u(e.attributes?.primary);if(t===void 0)return;let a=i===void 0?t:t.filter(e=>i.includes(e));if(a.length===0)return;let o=e.children??[],s=o.findIndex(e=>v(e)&&e.type===`tag`&&e.tag===`else`),c=s===-1?o:o.slice(0,s);n.push({teams:a,children:c});for(let e of c)r(e,a);return}for(let t of Object.values(e.slots??{}))r(t,i);for(let t of e.children??[])r(t,i)}};for(let t of e)r(t,void 0);return n}function u(e){if(!f(e))return;let t=Object.values(e.parameters??{});if(e.name===`includes`){let e=d(t);return e===void 0?void 0:[e]}if(e.name!==`or`)return;let n=t.map(e=>f(e)&&e.name===`includes`?d(Object.values(e.parameters??{})):void 0).filter(e=>e!==void 0);return n.length===0?void 0:n}function d([e,t]){let n=p(e,`Variable`)?e.path:void 0;return Array.isArray(n)&&n.length===2&&n[0]===`rbac`&&n[1]===`teams`&&typeof t==`string`&&t!==`*`?t:void 0}function f(e){return p(e,`Function`)}function p(e,t){return typeof e==`object`&&!!e&&e.$$mdtype===t}function m(e){let t=e.attributes?.level;return typeof t==`number`?t:2}function*h(e){for(let t of e)v(t)&&t.type===`tag`&&t.tag===`html`&&g(t)?yield*h(t.children??[]):yield t}function g(e){return!_(e).next().done}function*_(e){if(!(!v(e)||a(e)||i(e))){for(let t of e.children??[])v(t)&&t.type===`heading`&&(yield t),yield*_(t);for(let t of Object.values(e.slots??{}))yield*_(t)}}function v(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}export{c as markdocAstToSearchSections,s as teamBlockSectionKey};
@@ -1 +1 @@
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
+ import"../../../shared/constants/content-assets.js";import{getPublicEnv as e}from"../../../shared/public-env.js";import{isObject as t}from"../../../shared/utils/is-object.js";import{isPackedMarkdocAst as n,unpackMarkdocAst as r}from"../../../shared/utils/packed-ast.js";import{headingSlugger as i}from"../utils/heading-slugger.js";import{joinSrcSet as a,parseSrcSet as o}from"../../plugins/internal/assets/srcset.js";import{builtInMarkdocFunctions as s,rbacTeamList as c}from"../constants/builtin-functions.js";import{resolveMarkdocTagSet as l}from"../constants/tag-sets.js";import{frontmatterVariable as u}from"../utils/frontmatter-variable.js";import{stampHeadingIndexes as d}from"../utils/collect-headings.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:c(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(n,r,i,a){let{tags:o,nodes:c,functions:u}=await l(r.tagSet),f=x(n,{functions:u??s,tags:o,nodes:c,variables:{...p(i),env:e(),frontmatter:b(n),lang:a}});t(f)&&f.ast&&d(f.ast);let m=r.l10nAssets?.[a];return m?y(f,m):f}function y(e,t){let n=e=>{if(!e.includes(`/content-assets`))return e;let n=o(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?a(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(e){return t(e)?u(t(e.frontmatter)?e.frontmatter:{},e.title):{}}function x(e,t){i.reset();let a=e=>e instanceof f.Ast.Node,o=e=>{if(a(e))return m(f.transform(e,t));if(n(e)){let n=r(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(a)?m(f.transform(e,t)):e.length>0&&e.every(h)?m(f.transform(f.Ast.fromJSON(JSON.stringify(e)),t)):e.map(o);if(e&&typeof e==`object`){let t={};for(let[n,r]of Object.entries(e))t[n]=o(r);return t}return e};return o(e)}export{p as buildMarkdownRuntimeVariables,_ as detectMarkdocPayloadFlag,h as isMarkdocAstNode,y as localizeMarkdocAssetUrls,g as parseMarkdocPayloadDeep,x as transformMarkdocDeep,v as transformMarkdocPayload};
@@ -1,6 +1,6 @@
1
- import { type Schema } from '@redocly/markdoc';
1
+ import type { MarkdocTagSchema as Schema } from '@redocly/theme/markdoc/tags/types';
2
2
  /**
3
3
  * Render vehicle for raw HTML in markdown: the parser's `htmlTags()` turns HTML into this tag.
4
- * An `<html>`, `<head>` or `<body>` element is a validation error and renders as its content.
4
+ * An `<html>`, `<head>` or `<body>` element is a validation warning and renders as its content.
5
5
  */
6
6
  export declare const html: Schema;
@@ -1 +1 @@
1
- import e from"@redocly/markdoc";const t={a:`Link`,img:`Image`,script:`HtmlScript`},n=/* @__PURE__ */ new Set([`html`,`head`,`body`]),r={attributes:{name:{type:String,required:!0},attrs:{type:Object,buildTimeResolver:`htmlAttrs`}},validate(e){let t=String(e.attributes.name??``).toLowerCase();return n.has(t)?[{id:`html-document-element`,level:`error`,message:`HTML element <${t}> is not allowed in page content`}]:[]},transform(r,i){let a=String(r.attributes.name??``),o=r.attributes.attrs??{},s=r.transformChildren(i);return n.has(a.toLowerCase())?s:new e.Tag(t[a.toLowerCase()]??a,o,s)}};export{r as html};
1
+ import e from"@redocly/markdoc";const t={a:`Link`,img:`Image`,script:`HtmlScript`},n=/* @__PURE__ */ new Set([`html`,`head`,`body`]),r={attributes:{name:{type:String,required:!0},attrs:{type:Object,buildTimeResolver:`htmlAttrs`}},validate(e){let t=String(e.attributes.name??``).toLowerCase();return n.has(t)?[{id:`html-document-element`,level:`warning`,message:`HTML element <${t}> is not allowed in page content`}]:[]},transform(r,i){let a=String(r.attributes.name??``),o=r.attributes.attrs??{},s=r.transformChildren(i);return n.has(a.toLowerCase())?s:new e.Tag(t[a.toLowerCase()]??a,o,s)},renderForLlms(e,{getBody:t}){let n=e.attributes.attrs?.href;return String(e.attributes.name??``).toLowerCase()===`a`&&typeof n==`string`?`[${t()}](${n})`:t()}};export{r as html};
@@ -1 +1 @@
1
- import{isObject as e}from"../../../shared/utils/is-object.js";import t from"@redocly/markdoc";function n({lang:e,title:t,source:n}){return`\n\`\`\`${`${e??``}${t?`${e?` `:``}${t}`:``}`}\n${(n??``).trimEnd()}\n\`\`\`\n`}function r(e,t){let n=e.attributes?.[t];return Array.isArray(n)?n:[]}function i(e,t){return e===void 0?``:`\n\`\`\`${typeof t==`string`&&t!==``?`json ${t}`:`json`}\n${JSON.stringify(e,null,2)}\n\`\`\`\n`}function a(t){if(!e(t))return t;let{components:n,openapi:r,...i}=t,{__root:a,...o}=e(n)&&e(n.schemas)?n.schemas:{};return e(a)?{...i,...a,...Object.keys(o).length>0?{components:{schemas:o}}:{}}:t}function o(e,t){let{codeSamplesResolved:n,responseSamplesResolved:r,...i}=e.transformAttributes(t);return i}const s={attributes:{schema:{type:Object,buildTimeResolver:`jsonSchemaRef`},title:{type:String},options:{type:Object,default:{}},schemaResolved:{type:Object},schemaResolvedErrors:{type:Array,default:[]}},render:`JsonSchema`,selfClosing:!0,renderForLlms(e){return i(a(e.attributes?.schemaResolved),e.attributes?.title)}},c={attributes:{value:{buildTimeResolver:`jsonExampleRef`},schema:{buildTimeResolver:`sampleFromJsonSchema`},mode:{type:String,matches:[`read`,`write`]},title:{type:String},valueResolved:{},valueResolvedErrors:{type:Array,default:[]},schemaResolved:{},schemaResolvedErrors:{type:Array,default:[]}},render:`JsonExample`,selfClosing:!0,transform(e,n){let{valueResolved:r,valueResolvedErrors:i,schemaResolved:a,schemaResolvedErrors:o,title:s}=e.transformAttributes(n),c=r!==void 0||i.length>0;return new t.Tag(`JsonExample`,{title:s,json:c?r:a,errors:c?i:o})}},l={attributes:{descriptionFile:{type:String,required:!0},pointer:{type:String},operationId:{type:String},exampleKey:{type:String},mimeType:{type:String},language:{type:String},parameters:{type:Object,default:{}},requestBody:{type:Object},options:{type:Object,default:{}},environments:{type:Object,default:{}},environment:{type:String},codeSamplesResolved:{type:Array,buildTimeResolver:`openapiCodeSamples`},codeSamplePanelResolved:{type:Object,buildTimeResolver:`openapiCodeSamplePanel`},descriptionFileInvalid:{type:Boolean}},render:`OpenApiCodeSample`,selfClosing:!0,transform(e,n){return new t.Tag(`OpenApiCodeSample`,o(e,n))},renderForLlms(e){let t=r(e,`codeSamplesResolved`),i=t.find(({lang:e})=>e===`shell`)??t[0];return i===void 0?``:n(i)}},u={attributes:{descriptionFile:{type:String,required:!0},pointer:{type:String},operationId:{type:String},exampleKey:{type:String},responseSamplesResolved:{type:Array,buildTimeResolver:`openapiResponseSamples`},responsePanelResolved:{type:Object,buildTimeResolver:`openapiResponsePanel`},descriptionFileInvalid:{type:Boolean}},render:`OpenApiResponseSample`,selfClosing:!0,transform(e,n){return new t.Tag(`OpenApiResponseSample`,o(e,n))},renderForLlms(e){return r(e,`responseSamplesResolved`).map(n).join(``)}},d={attributes:{descriptionFile:{type:String,required:!0},pointer:{type:String,required:!0},mimeType:{type:String},options:{type:Object,default:{}},exampleResolved:{type:Object,buildTimeResolver:`openapiExample`},descriptionFileInvalid:{type:Boolean}},render:`OpenApiExample`,selfClosing:!0,renderForLlms(t){let n=t.attributes?.exampleResolved,r=e(n)&&e(n.apiStore)?n.apiStore:{},[a]=Object.values(e(r.exampleStore)?r.exampleStore:{});return e(a)?i(a.value,a.summary):``}},f={attributes:{descriptionFile:{type:String,required:!0},pointer:{type:String},operationId:{type:String},exampleKey:{type:String},mimeType:{type:String},parameters:{type:Object,default:{}},requestBody:{type:Object},options:{type:Object,default:{}},environments:{type:Object,default:{}},environment:{type:String},hideOtherSecuritySchemes:{type:Boolean},replayResolved:{type:Object,buildTimeResolver:`openapiReplay`},descriptionFileInvalid:{type:Boolean}},validate(e){return e.attributes.pointer&&e.attributes.operationId?[{id:`pointer-and-operationId-attributes-are-mutually-exclusive`,level:`error`,message:`The "pointer" and "operationId" attributes are mutually exclusive. Use only one.`}]:!e.attributes.pointer&&!e.attributes.operationId?[{id:`pointer-or-operationId-attribute-required`,level:`error`,message:`The tag requires a "pointer" or "operationId" attribute.`}]:[]},render:`ReplayOpenApi`,selfClosing:!0};export{c as jsonExampleTag,s as jsonSchemaTag,l as openapiCodeSampleTag,d as openapiExampleTag,u as openapiResponseSampleTag,f as replayOpenapiTag,n as sampleCodeBlock};
1
+ import{isObject as e}from"../../../shared/utils/is-object.js";import t from"@redocly/markdoc";function n({lang:e,title:t,source:n}){return`\n\`\`\`${`${e??``}${t?`${e?` `:``}${t}`:``}`}\n${(n??``).trimEnd()}\n\`\`\`\n`}function r(e,t){let n=e.attributes?.[t];return Array.isArray(n)?n:[]}function i(e,t){return e===void 0?``:`\n\`\`\`${typeof t==`string`&&t!==``?`json ${t}`:`json`}\n${JSON.stringify(e,null,2)}\n\`\`\`\n`}function a(t){if(!e(t))return t;let{components:n,openapi:r,...i}=t,{__root:a,...o}=e(n)&&e(n.schemas)?n.schemas:{};return e(a)?{...i,...a,...Object.keys(o).length>0?{components:{schemas:o}}:{}}:t}function o(e,t){let{codeSamplesResolved:n,responseSamplesResolved:r,schemaAsWritten:i,...a}=e.transformAttributes(t);return a}const s={attributes:{schema:{type:Object,buildTimeResolver:`jsonSchemaRef`},title:{type:String},options:{type:Object,default:{}},schemaResolved:{type:Object},schemaAsWritten:{type:Object},schemaResolvedErrors:{type:Array,default:[]}},render:`JsonSchema`,selfClosing:!0,transform(e,n){return new t.Tag(`JsonSchema`,o(e,n))},renderForLlms(e){return i(a(e.attributes?.schemaAsWritten??e.attributes?.schemaResolved),e.attributes?.title)}},c={attributes:{value:{buildTimeResolver:`jsonExampleRef`},schema:{buildTimeResolver:`sampleFromJsonSchema`},mode:{type:String,matches:[`read`,`write`]},title:{type:String},valueResolved:{},valueResolvedErrors:{type:Array,default:[]},schemaResolved:{},schemaResolvedErrors:{type:Array,default:[]}},render:`JsonExample`,selfClosing:!0,transform(e,n){let{valueResolved:r,valueResolvedErrors:i,schemaResolved:a,schemaResolvedErrors:o,title:s}=e.transformAttributes(n),c=r!==void 0||i.length>0;return new t.Tag(`JsonExample`,{title:s,json:c?r:a,errors:c?i:o})}},l={attributes:{descriptionFile:{type:String,required:!0},pointer:{type:String},operationId:{type:String},exampleKey:{type:String},mimeType:{type:String},language:{type:String},parameters:{type:Object,default:{}},requestBody:{type:Object},options:{type:Object,default:{}},environments:{type:Object,default:{}},environment:{type:String},codeSamplesResolved:{type:Array,buildTimeResolver:`openapiCodeSamples`},codeSamplePanelResolved:{type:Object,buildTimeResolver:`openapiCodeSamplePanel`},descriptionFileInvalid:{type:Boolean}},render:`OpenApiCodeSample`,selfClosing:!0,transform(e,n){return new t.Tag(`OpenApiCodeSample`,o(e,n))},renderForLlms(e){let t=r(e,`codeSamplesResolved`),i=t.find(({lang:e})=>e===`shell`)??t[0];return i===void 0?``:n(i)}},u={attributes:{descriptionFile:{type:String,required:!0},pointer:{type:String},operationId:{type:String},exampleKey:{type:String},responseSamplesResolved:{type:Array,buildTimeResolver:`openapiResponseSamples`},responsePanelResolved:{type:Object,buildTimeResolver:`openapiResponsePanel`},descriptionFileInvalid:{type:Boolean}},render:`OpenApiResponseSample`,selfClosing:!0,transform(e,n){return new t.Tag(`OpenApiResponseSample`,o(e,n))},renderForLlms(e){return r(e,`responseSamplesResolved`).map(n).join(``)}},d={attributes:{descriptionFile:{type:String,required:!0},pointer:{type:String,required:!0},mimeType:{type:String},options:{type:Object,default:{}},exampleResolved:{type:Object,buildTimeResolver:`openapiExample`},descriptionFileInvalid:{type:Boolean}},render:`OpenApiExample`,selfClosing:!0,renderForLlms(t){let n=t.attributes?.exampleResolved,r=e(n)&&e(n.apiStore)?n.apiStore:{},[a]=Object.values(e(r.exampleStore)?r.exampleStore:{});return e(a)?i(a.value,a.summary):``}},f={attributes:{descriptionFile:{type:String,required:!0},pointer:{type:String},operationId:{type:String},exampleKey:{type:String},mimeType:{type:String},parameters:{type:Object,default:{}},requestBody:{type:Object},options:{type:Object,default:{}},environments:{type:Object,default:{}},environment:{type:String},hideOtherSecuritySchemes:{type:Boolean},replayResolved:{type:Object,buildTimeResolver:`openapiReplay`},descriptionFileInvalid:{type:Boolean}},validate(e){return e.attributes.pointer&&e.attributes.operationId?[{id:`pointer-and-operationId-attributes-are-mutually-exclusive`,level:`error`,message:`The "pointer" and "operationId" attributes are mutually exclusive. Use only one.`}]:!e.attributes.pointer&&!e.attributes.operationId?[{id:`pointer-or-operationId-attribute-required`,level:`error`,message:`The tag requires a "pointer" or "operationId" attribute.`}]:[]},render:`ReplayOpenApi`,selfClosing:!0};export{c as jsonExampleTag,s as jsonSchemaTag,l as openapiCodeSampleTag,d as openapiExampleTag,u as openapiResponseSampleTag,f as replayOpenapiTag,n as sampleCodeBlock};
@@ -1 +1 @@
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
+ import{headingSlugger as e}from"../utils/heading-slugger.js";import t from"@redocly/markdoc";import{variant as n}from"@redocly/theme/markdoc/tags/variant";import{CONTROL as r}from"@redocly/theme/core/constants/experiments";const i={...n.schema,transform(i,a){let o=()=>new t.Tag(n.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{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
+ import{hashBlobContent as e}from"../../materialization/data-ref.js";import{MARKDOC_ERROR_TAG as t}from"../tags/markdoc-error.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:t}),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(t){let r=n(t);return t=>{let n=e(t),i=r.get(n);if(i!==void 0)return i;let a=c(t);return r.set(n,a),a}}function u(e,t){return i.parseFirstHeading(e,{...o,skip:t})}const d=l({budget:100});export{l as createCachedMarkdownParser,s as parseMarkdown,d as parseMarkdownCached,c as parseMarkdownDocument,u as parseMarkdownFirstHeading};
@@ -1 +1 @@
1
- import{hashJsonValue as e}from"../database/utils/json.js";import{entities as t,entityDeps as n,files as r,loaderConfigDeps as i}from"../database/schema.js";import{collectDataRefMarkers as a}from"./data-ref.js";import{replaceBlobRefsForEntityTx as o}from"../database/blobs.js";import{dedupeRouteQueryDependencies as s}from"../plugins/utils/route-index.js";import{MaterializationError as c,ProblemError as l}from"../problems/problem-error.js";import{replaceAssetRefsForEntityTx as u,upsertAssetsTx as d}from"../database/assets.js";import{createProblem as f}from"../problems/codes.js";import{problemRow as p,replaceEntityProblemsExceptCodesTx as m}from"../database/problems.js";import{replaceLinkRefsForEntityTx as h,upsertTargetInventoryTx as g}from"../database/link-refs.js";import{detectMarkdocPayloadFlag as _}from"../markdown/server/render.js";import{buildL10nAssetMap as v,dedupeAssetUsages as y,reconcileAsset as b,removeReplacedAssetFiles as x}from"./asset-reconcile.js";import{cutEntityRevisionTx as S}from"../revisions/cut.js";import{replaceRouteQueryDepsTx as C}from"../database/route-query-deps.js";import{replaceEntityRuntimeDeps as w}from"../database/origins.js";import{SEARCH_PROBLEM_CODES as T}from"../problems/producers.js";import{and as E,eq as D}from"drizzle-orm";const O=/* @__PURE__ */ new WeakMap;async function k(e){let t=await A(e.database,e.key);if(!t)throw Error(`Entity "${e.key}" is not registered.`);if(t.kind===`inline`){if(t.data===null)throw Error(`Inline entity "${e.key}" is missing its stored data.`);return t.data}if(t.status===`ready`&&t.data!==null)return t.data;let n=O.get(e.database);n===void 0&&(n=/* @__PURE__ */ new Map,O.set(e.database,n));let r=n.get(e.key);if(r!==void 0)return r;let i=j(e,t);n.set(e.key,i);try{return await i}finally{n.delete(e.key)}}async function A(e,n){let[r]=await e.db.select({id:t.id,key:t.key,kind:t.kind,pluginId:t.pluginId,loaderId:t.loaderId,loaderArgs:t.loaderArgs,type:t.type,metadata:t.metadata,status:t.status,data:t.data,markdoc:t.markdoc,dataHash:t.dataHash,version:t.version,revisionCreatedAt:t.revisionCreatedAt,isSystem:t.isSystem,invalidationSeq:t.invalidationSeq}).from(t).where(E(D(t.key,n),D(t.isCurrent,1))).limit(1);return r}async function j(i,l){if(!l.loaderId)throw Error(`Entity "${i.key}" is missing its loader id.`);let O=i.loaderRegistry.getEntityLoaderById(l.loaderId);if(!O)throw Error(`Entity loader "${l.loaderId}" is not registered.`);let[k]=await i.database.db.select({path:r.path,fileId:r.id}).from(n).leftJoin(r,D(n.originFileId,r.id)).where(D(n.entityId,l.id)).limit(1);if(!k&&!l.isSystem)throw Error(`Entity "${i.key}" has no origin dependency.`);let A=i.loaderContextFactory(O,l.loaderArgs,k?.path??``),j;try{j=await O.definition.handler(A)}catch(e){throw await M(i,l.id,e),new c(`Entity "${i.key}" failed to load.`,{cause:e})}let P=JSON.stringify(j.value??null),F=JSON.parse(P),I=j.markdoc??_(P),L=I?v(j.assetUsages??[]):void 0,R=L?{...I,l10nAssets:L}:I,z=a(F),B=Array.from(new Set(z.map(e=>e.blobKey))),V=y(j.assetUsages??[]),{contentDir:H}=i,U=H?(await Promise.all(V.map(e=>b(A.io,{contentDir:H,usage:e})))).filter(e=>e!==null):[],W=[];return await i.database.db.transaction(async n=>{let r=Date.now(),a=e(F),c=(l.dataHash??null)!==a,_=l.revisionCreatedAt;if(c&&(_=Math.max(r,l.revisionCreatedAt+1)),(await n.update(t).set({status:`ready`,data:F,markdoc:R,type:j.type??l.type,metadata:j.metadata??l.metadata,dataHash:a,revisionCreatedAt:_}).where(E(D(t.id,l.id),D(t.invalidationSeq,l.invalidationSeq))).returning({id:t.id})).length===0)return;c&&l.data!==null&&i.revisions?.isTracked(k?.path??``)&&await S(n,{current:l,max:i.revisions.max});let v=A._trackedConfig;await N(n,l.id,v?.collectDependencies()??[]);let y=A._loadedEntityKeys,b=A._globPatterns;if((j.entityDeps!==void 0||y.length>0||b.length>0)&&await w(n,{entityId:l.id,originPluginId:O.pluginId,isSystem:!!l.isSystem,deps:[...j.entityDeps??[],...y.map(e=>({kind:`entity`,key:e})),...b.map(e=>({kind:`glob`,pattern:e}))]}),await C(n,{originPluginId:O.pluginId,hook:`loader`,entityId:l.id,dependencies:s(A._routeQueries)}),await m(n,l.id,T,(j.problems??[]).map(e=>p(f(e),{scope:`entity`,entityId:l.id}))),await o(n,{entityId:l.id,blobKeys:B}),W=await d(n,U),await u(n,{entityId:l.id,refs:V.map(({path:e,hash:t})=>({path:e,hash:t}))}),(j.linkRefs!==void 0||j.targetInventories!==void 0)&&k?.path&&(await h(n,{entityId:l.id,originFileId:k.fileId,originPluginId:O.pluginId,filePath:k.path,drafts:j.linkRefs??[]}),k.fileId!==null))for(let e of j.targetInventories??[])await g(n,{fileId:k.fileId,originPluginId:O.pluginId,draft:e})}),H&&W.length>0&&await x(A.io,{contentDir:H,filenames:W,logger:i.logger}),F}async function M(e,t,n){let r=n instanceof l?n.draft:{code:`plugin/loader-failed`,message:`Loader failed for entity "${e.key}": ${n instanceof Error?n.message:String(n)}`,data:{entityKey:e.key}};try{let n=p(f(r),{scope:`entity`,entityId:t});await e.database.db.transaction(async e=>{await m(e,t,T,[n])})}catch{}}async function N(e,t,n){await e.delete(i).where(D(i.entityId,t)),n.length!==0&&await e.insert(i).values(n.map(e=>({...e,entityId:t})))}export{k as materializeEntityByKey};
1
+ import{hashJsonValue as e}from"../database/utils/json.js";import{entities as t,entityDeps as n,files as r,loaderConfigDeps as i}from"../database/schema.js";import{collectDataRefMarkers as a}from"./data-ref.js";import{replaceBlobRefsForEntityTx as o}from"../database/blobs.js";import{dedupeRouteQueryDependencies as s}from"../plugins/utils/route-index.js";import{MaterializationError as c,ProblemError as l}from"../problems/problem-error.js";import{problemRow as u,replaceEntityProblemsExceptCodesTx as d}from"../database/problems.js";import{replaceAssetRefsForEntityTx as f,upsertAssetsTx as p}from"../database/assets.js";import{createProblem as m}from"../problems/codes.js";import{replaceLinkRefsForEntityTx as h,upsertTargetInventoryTx as g}from"../database/link-refs.js";import{buildL10nAssetMap as _,dedupeAssetUsages as v,reconcileAsset as y,removeReplacedAssetFiles as b}from"./asset-reconcile.js";import{cutEntityRevisionTx as x}from"../revisions/cut.js";import{detectMarkdocPayloadFlag as S}from"../markdown/server/render.js";import{replaceRouteQueryDepsTx as C}from"../database/route-query-deps.js";import{replaceEntityRuntimeDeps as w}from"../database/origins.js";import{SEARCH_PROBLEM_CODES as T}from"../problems/producers.js";import{and as E,eq as D}from"drizzle-orm";const O=/* @__PURE__ */ new WeakMap;async function k(e){let t=await A(e.database,e.key);if(!t)throw Error(`Entity "${e.key}" is not registered.`);if(t.kind===`inline`){if(t.data===null)throw Error(`Inline entity "${e.key}" is missing its stored data.`);return t.data}if(t.status===`ready`&&t.data!==null)return t.data;let n=O.get(e.database);n===void 0&&(n=/* @__PURE__ */ new Map,O.set(e.database,n));let r=n.get(e.key);if(r!==void 0)return r;let i=j(e,t);n.set(e.key,i);try{return await i}finally{n.delete(e.key)}}async function A(e,n){let[r]=await e.db.select({id:t.id,key:t.key,kind:t.kind,pluginId:t.pluginId,loaderId:t.loaderId,loaderArgs:t.loaderArgs,type:t.type,metadata:t.metadata,status:t.status,data:t.data,markdoc:t.markdoc,dataHash:t.dataHash,version:t.version,revisionCreatedAt:t.revisionCreatedAt,isSystem:t.isSystem,invalidationSeq:t.invalidationSeq}).from(t).where(E(D(t.key,n),D(t.isCurrent,1))).limit(1);return r}async function j(i,l){if(!l.loaderId)throw Error(`Entity "${i.key}" is missing its loader id.`);let O=i.loaderRegistry.getEntityLoaderById(l.loaderId);if(!O)throw Error(`Entity loader "${l.loaderId}" is not registered.`);let[k]=await i.database.db.select({path:r.path,fileId:r.id}).from(n).leftJoin(r,D(n.originFileId,r.id)).where(D(n.entityId,l.id)).limit(1);if(!k&&!l.isSystem)throw Error(`Entity "${i.key}" has no origin dependency.`);let A=i.loaderContextFactory(O,l.loaderArgs,k?.path??``),j;try{j=await O.definition.handler(A)}catch(e){throw await M(i,l.id,e),new c(`Entity "${i.key}" failed to load.`,{cause:e})}let P=JSON.stringify(j.value??null),F=JSON.parse(P),I=j.markdoc??S(P),L=I?_(j.assetUsages??[]):void 0,R=L?{...I,l10nAssets:L}:I,z=a(F),B=Array.from(new Set(z.map(e=>e.blobKey))),V=v(j.assetUsages??[]),{contentDir:H}=i,U=H?(await Promise.all(V.map(e=>y(A.io,{contentDir:H,usage:e})))).filter(e=>e!==null):[],W=[];return await i.database.db.transaction(async n=>{let r=Date.now(),a=e(F),c=(l.dataHash??null)!==a,_=l.revisionCreatedAt;if(c&&(_=Math.max(r,l.revisionCreatedAt+1)),(await n.update(t).set({status:`ready`,data:F,markdoc:R,type:j.type??l.type,metadata:j.metadata??l.metadata,dataHash:a,revisionCreatedAt:_}).where(E(D(t.id,l.id),D(t.invalidationSeq,l.invalidationSeq))).returning({id:t.id})).length===0)return;c&&l.data!==null&&i.revisions?.isTracked(k?.path??``)&&await x(n,{current:l,max:i.revisions.max});let v=A._trackedConfig;await N(n,l.id,v?.collectDependencies()??[]);let y=A._loadedEntityKeys,b=A._globPatterns;if((j.entityDeps!==void 0||y.length>0||b.length>0)&&await w(n,{entityId:l.id,originPluginId:O.pluginId,isSystem:!!l.isSystem,deps:[...j.entityDeps??[],...y.map(e=>({kind:`entity`,key:e})),...b.map(e=>({kind:`glob`,pattern:e}))]}),await C(n,{originPluginId:O.pluginId,hook:`loader`,entityId:l.id,dependencies:s(A._routeQueries)}),await d(n,l.id,T,(j.problems??[]).map(e=>u(m(e),{scope:`entity`,entityId:l.id}))),await o(n,{entityId:l.id,blobKeys:B}),W=await p(n,U),await f(n,{entityId:l.id,refs:V.map(({path:e,hash:t})=>({path:e,hash:t}))}),(j.linkRefs!==void 0||j.targetInventories!==void 0)&&k?.path&&(await h(n,{entityId:l.id,originFileId:k.fileId,originPluginId:O.pluginId,filePath:k.path,drafts:j.linkRefs??[]}),k.fileId!==null))for(let e of j.targetInventories??[])await g(n,{fileId:k.fileId,originPluginId:O.pluginId,draft:e})}),H&&W.length>0&&await b(A.io,{contentDir:H,filenames:W,logger:i.logger}),F}async function M(e,t,n){let r=n instanceof l?n.draft:{code:`plugin/loader-failed`,message:`Loader failed for entity "${e.key}": ${n instanceof Error?n.message:String(n)}`,data:{entityKey:e.key}};try{let n=u(m(r),{scope:`entity`,entityId:t});await e.database.db.transaction(async e=>{await d(e,t,T,[n])})}catch{}}async function N(e,t,n){await e.delete(i).where(D(i.entityId,t)),n.length!==0&&await e.insert(i).values(n.map(e=>({...e,entityId:t})))}export{k as materializeEntityByKey};
@@ -1 +1 @@
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
+ import{compareStrings as e}from"../../shared/utils/compare-strings.js";import{getStaticFilesOutputDir as t,getStaticManifestPath as n}from"../../shared/constants/runtime-layout.js";import{isObject as r}from"../../shared/utils/is-object.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{writeFileAtomically as l}from"./asset-reconcile.js";import{producerContentType as u,toStaticBodyBytes as d}from"../static/producer-value.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,t,n,o,c){let l=n.entityKey?await s(t,n.entityKey):null;if(!l||l.status!==`ready`&&!c)throw Error(`Static file "${n.path}": producer entity "${n.entityKey}" is not ready.`);let f=l.data;if(!r(f)||!i(f.body)){if(c)return null;throw Error(`Static file "${n.path}": producer "${n.entityKey}" must return { body: BlobReference }.`)}let p=f.body;return{path:n.path,hash:p.blobKey,contentType:u(f,n),audience:o,write:async n=>e.writeFile(n,d(await a(t,p)))}}async function _(r,i){let a=t(i.contentDir),o=n(i.contentDir),s=new Map((await v(r,o))?.files.map(e=>[e.path,e])??[]),c=new Set(await y(r,a)),u=[],d=[];for(let e=0;e<i.entries.length;e+=16)await Promise.all(i.entries.slice(e,e+16).map(async e=>{let t=f(a,...e.path.split(`/`)),n=s.get(e.path),i=n?.hash===e.hash&&c.has(e.path)?n.size:null;i===null&&(await l(r,t,e.write),i=(await r.stat(t))?.size??0,u.push(e.path)),d.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=>r.unlink(f(a,...e.split(`/`))))),d.sort((t,n)=>e(t.path,n.path));let h={formatVersion:1,files:d};return await r.writeFile(o,JSON.stringify(h,null,2),{recursive:!0}),{manifest:h,written:u,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{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
+ 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 x,createPluginIO as S,createRecordingPluginIO as C}from"./io.js";import{STATIC_FOLDER_PLUGIN_ID as w,STATIC_FOLDER_PREFIX as T,isStaticFolderPath as E,staticFolderContentPlugin as D}from"./internal/static-folder/index.js";import{MCP_TOOL_NAME_PATTERN as O,createContentPluginRegistry as k,matchesContentPluginFilter as A,resolveContentPluginsForFile as j}from"./registry.js";import{dedupeFileDependencies as M,extractFileContributions as N,runContentPluginFinalize as P}from"./execute.js";import{createSourceFile as F}from"./source-file.js";import{createRouteIndex as I,createRouteQueryEvaluator as L,dedupeRouteQueryDependencies as R,isRouteQueryStale as z}from"./utils/route-index.js";import{SPEC_KIND_ARAZZO as B,SPEC_KIND_ASYNCAPI as V,SPEC_KIND_GRAPHQL as H,SPEC_KIND_OPENAPI as U}from"../../shared/constants/api-spec-kinds.js";import{MOCK_SERVER_ROUTE_PREFIX as W,mockPathPrefix as G}from"./types/api-entity.js";import{createContentOriginKey as K}from"./utils/origin-key.js";import{ASSETS_PLUGIN_ID as q,ASSET_ENTITY_KEY_PREFIX as J,assetsContentPlugin as Y}from"./internal/assets/index.js";import{APP_DATA_STATIC_DATA_SLUG as X}from"../../shared/constants/app-data.js";import{SIDEBAR_ROUTE_DEP_KEY as Z}from"../../shared/constants/route-deps.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,q as ASSETS_PLUGIN_ID,J 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,O as MCP_TOOL_NAME_PATTERN,Le as MOCK_SERVER_PLUGIN_ID,Re as MOCK_SERVER_ROUTE_PATH,W 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,Z as SIDEBAR_ROUTE_DEP_KEY,qe as SKILLS_PLUGIN_ID,Je as SKILL_MARKDOWN_ROUTE_PATH,B as SPEC_KIND_ARAZZO,V as SPEC_KIND_ASYNCAPI,H as SPEC_KIND_GRAPHQL,U as SPEC_KIND_OPENAPI,w as STATIC_FOLDER_PLUGIN_ID,T 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,Y as assetsContentPlugin,ue as buildConfigAppData,De as catalogClassicContentPlugin,K as createContentOriginKey,x as createContentPluginIO,k as createContentPluginRegistry,$e as createContentPlugins,r as createEntityLoader,i as createInlineEntity,a as createInlineEntityReference,Qe as createInternalContentPlugins,S as createPluginIO,y as createPluginScopedId,et as createProjectPluginLoadError,C as createRecordingPluginIO,I as createRouteIndex,L as createRouteQueryEvaluator,p as createServerFn,F as createSourceFile,m as createStoredEntityReference,M as dedupeFileDependencies,R as dedupeRouteQueryDependencies,e as defineContentPlugin,N as extractFileContributions,tt as formatProjectPluginDiagnostics,ge as getLoadedProjectPlugins,h as getRegisteredServerFnLoader,de as isAppDataFragment,o as isEntityLoaderReference,s as isInlineEntityReference,c as isRawEntityReference,z as isRouteQueryStale,g as isServerFnReference,E as isStaticFolderPath,ne as isTabbedSidebar,Ae as l10nContentPlugin,nt as loadAndRegisterProjectPlugins,rt as loadProjectPlugins,Fe as markdocContentPlugin,A as matchesContentPluginFilter,Ie as mcpContentPlugin,G as mockPathPrefix,ze as mockServerContentPlugin,_ as normalizeServerFnId,Ve as reactPageContentPlugin,it as readPluginEntries,ot as reloadProjectPluginsIfChanged,re as resolveAutoSidebar,j as resolveContentPluginsForFile,at as resolveProjectPluginPath,l as resolveRuntimeFilePath,v as resolveServerModuleReference,Ue as revisionsContentPlugin,P as runContentPluginFinalize,u as runtimeFile,b as runtimeTemplate,Ke as scorecardClassicContentPlugin,_e as setLoadedProjectPlugins,ie as sidebarContentPlugin,Ye as skillsContentPlugin,D as staticFolderContentPlugin,Ze as versionsContentPlugin,ve as warnWhenProjectPluginsAreNotLoaded};
@@ -1 +1 @@
1
- import{isObject as e}from"../../../../../shared/utils/is-object.js";function t(t){if(!e(t.events))return t;let r={};if(typeof window<`u`)for(let[e,i]of Object.entries(t.events)){let t=n(i);t===void 0?console.error(`The openapi.events.${e} handler is not a function and is not used.`):r[e]=t}return{...t,events:r}}function n(e){if(typeof e==`string`)try{let t=Function(`return (${e});`)();return typeof t==`function`?t:void 0}catch{return}}export{t as withEventHandlers};
1
+ import{isObject as e}from"../../../../../shared/utils/is-object.js";function t(t){if(!e(t.events))return t;let r={};if(typeof window<`u`)for(let[e,i]of Object.entries(t.events)){let t=n(i);t===void 0?console.error(`The openapi.events.${e} handler is not a function and is not used.`):r[e]=t}return{...t,events:r}}function n(e){if(typeof e==`string`)try{let t=Function(`const __redoclyEventHandler = ${e}\nreturn __redoclyEventHandler;`)();return typeof t==`function`?t:void 0}catch{return}}export{t as withEventHandlers};
@@ -1,7 +1,15 @@
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)`
1
+ import{REPLAY_OAUTH2_ROUTE_PATH as e}from"../../../../../shared/constants/replay.js";import{withPathPrefix as t}from"../../../../../shared/path-prefix.js";import{API_DOCS_INFO_BLOCK_DEP_KEY as n,API_DOCS_RENDER_DEP_KEY as r,apiPageTitle as i}from"../server/shared.js";import{ApiDocsLayoutContext as a,PageContext as o}from"../../../../../client/contexts.js";import{expandSecurityRequestValues as s,useDynamicRequestValues as c}from"../../../../../client/ApiAccess.js";import{MarkdocBlocks as l,markdocComponents as u}from"../../../../markdown/client/markdoc-components.js";import{rebaseItemLinks as d}from"./rebase-item-links.js";import{apiDocsTelemetryConfig as f}from"../../../../../client/telemetry/config.js";import{withReplayOptions as p}from"../../../../../client/replay-options.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={...u,JsonSchema:O.JsonSchema??m,JsonExample:O.JsonExample??h,...A},I={parse:e=>e,render:e=>/* @__PURE__ */ C(l,{ast:e,components:F})},L={MiddlePanelHeader:R};function R(){return/* @__PURE__ */ w(S,{children:[/* @__PURE__ */ C(j,{}),/* @__PURE__ */ C(W,{})]})}function z(e){return(e.length>1&&e.endsWith(`/`)?e.slice(0,-1):e).toLowerCase()}function B({page:e}){let t=D(r),i=D(n),{layout:o}=_(a),l=V(),u=c(),m=y(()=>{if(!t)return t;let e=s(u,Object.values(t.store.securitySchemeStore??{}));return{...g(p(t.options)),oAuth2RedirectURI:H(),userClaims:l,unstable_hooks:L,dynamicRequestValues:e}},[t,l,u]),h=e.slug.toLowerCase(),v=y(()=>t&&t.basePath!==h?d(t.items,t.basePath,h):t?.items,[t,h]);if(K(e.metadata,v,t?.title),!t)return null;let b=f();return/* @__PURE__ */ w(U,{children:[i&&/* @__PURE__ */ C(G,{layout:o,children:/* @__PURE__ */ C(M,{metadata:i})}),/* @__PURE__ */ C(k,{items:v,store:t.store,options:m,basePath:h,layout:o,markdownAdapter:I,telemetryConfig:b})]})}function V(){let e=_(o)?.auth?.userInfo,t=e?.isAuthenticated?e.email:void 0,n=e?.isAuthenticated?e.name:void 0;return y(()=>({email:t,name:n}),[t,n])}function H(){if(typeof window<`u`)return new URL(t(e),window.location.origin).toString()}const U=b.main`
2
+ [data-section-id] {
3
+ scroll-margin-top: var(--navbar-offset);
4
+ }
5
+
6
+ [id]:not([data-section-id]):has([data-deep-link-anchor]) {
7
+ scroll-margin-top: calc(var(--navbar-offset) + var(--deep-link-scroll-gap, var(--spacing-xl)));
8
+ }
9
+ `,W=b(N)`
2
10
  width: 100%;
3
- `,W=b(P)`
11
+ `,G=b(P)`
4
12
  && {
5
13
  padding-right: ${({layout:e})=>e===E.THREE_PANEL?`calc(var(--panel-gap-horizontal) * 2)`:`var(--panel-gap-horizontal)`};
6
14
  }
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};
15
+ `;function K(e,t,n){let{pathname:r}=x(),{seo:a}=T(),o=a?.projectTitle,s=t?i(e,t,z(r),n):void 0;v(()=>{s&&(document.title=o?`${s} | ${o}`:s)},[s,o])}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{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
+ 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{findVersionFolder as ee}from"../../utils/version-path.js";import{toPublicVersionedSlug as C}from"../../../../shared/constants/versions.js";import{readVersionsYaml as te,versionsYamlPath as ne}from"../../../versions/version-groups.js";import{parseMarkdownCached as w}from"../../../markdown/utils/parse-cache.js";import{createApiEntityKey as T}from"../../utils/api-entity-key.js";import{API_DOCS_API_LOADER_ID as E,API_DOCS_PLUGIN_ID as D,API_DOCS_RENDER_DEP_KEY as re,API_DOCS_RENDER_LOADER_ID as ie,API_DOCS_SIDEBAR_LOADER_ID as ae,API_DOCS_TEMPLATE_ID as O,SPEC_DOWNLOAD_ROUTE_PATHS as k,SPEC_PATH_PARAM as oe}from"./server/shared.js";import{resolveApiBundleConfig as se,resolveApiOptions as ce,resolveNestedFeedback as le,schemaCatalogLink as ue,withDownloadUrls as de,withFeedbackOption as fe,withMockServerOption as pe}from"./server/options.js";import{annotateApiDocsRbac as A}from"../../../../shared/rbac/api-docs.js";import{SERVER_ONLY_VALUE_KEY as j}from"../../../loaders/server-only-value.js";import{getLoadedProjectPlugins as M}from"../../project/loaded-set.js";import{API_OUTPUT_MANIFEST_KEY as N}from"../../../api-outputs.js";import{API_DOCS_MARKDOC_TAG_SET as P,resolveMarkdocTagSet as F}from"../../../markdown/constants/tag-sets.js";import{pageLocale as I}from"../../utils/page-locale.js";import{buildBundledApiDefinition as L,resolveLlmsDescriptions as R}from"./server/build-definition.js";import{collectSidebarSubpathTargets as z,toSidebarSubtree as B,toSubpathTarget as me}from"./server/build-sidebar.js";import{buildApiDocsMarkdownDocs as he}from"./server/markdown-docs.js";import{join as ge,relative as _e,resolve as V}from"node:path";import ve from"@redocly/markdoc";async function ye(e,t){let n=t.originFilePath===null?null:ee(t.originFilePath);if(n===null||t.version===null||t.versionGroup===null)return{slug:t.slug,entityDeps:[]};let r=(await te({io:{exists:t=>e.io.exists(V(e.contentDir,t)),readFile:t=>e.io.readFile(V(e.contentDir,t))},directory:n.parent}))?.default===t.version;return{slug:C(t.slug,t.versionGroup,t.version,r),entityDeps:[{kind:`file`,path:ne(n.parent)}]}}const be=[`.yaml`,`.yml`,`.json`,`.gql`,`.graphql`],xe={[b]:`OpenAPI`,[v]:`AsyncAPI`,[y]:`GraphQL`,[_]:`Arazzo`},H=t(ie,async e=>{let{buildItems:t,descriptionOptions:n}=await import(`@redocly/api-docs/server`),r=G(e),i=await e.io.readFile(r.absolutePath),a=e.routes.byFilePath(e.file.path),o=a?.slug,s=a&&e.args.kind===`openapi`?await ye(e,a):{slug:void 0,entityDeps:[]},c=de(e.args.options,e.file.path,e.args.kind),l=e.args.kind===`openapi`?pe(c,e.config,s.slug):c,u={entityDeps:[],assetUsages:[],linkRefs:[],problems:[],pending:[]},d=W(e.contentDir),f={markdown:e.markdown,loader:{config:e.config,entities:e.entities,file:e.file,io:e.io,logger:e.logger,plugin:e.plugin},sink:u},p=await L({kind:e.args.kind,source:i,relativePath:r.relativePath,contentDir:e.contentDir,pagePath:e.file.path,options:l,bundle:K(e.args,d),metadata:X(e.args.options),markdownResolution:f,rbac:{warn:t=>e.logger?.warn(t)}}),h={...m(p.document)&&m(p.document.info)?{infoDescription:p.document.info.description}:{},...await R(p.document,f,{contentDir:e.contentDir,specPath:r.relativePath,pagePath:e.file.path})};e.args.kind===`openapi`&&l.showSchemaCatalogLinks&&m(p.document)&&(p.document[`x-schema-catalog-link`]=ue(e.file.path)),p.options={...fe(p.options,p.document,e.args.feedback??e.config.feedback),...n(e.args.kind,p.document,X(e.args.options))};let g=o?.toLowerCase()??`/`,{items:_,store:v,specType:y}=await t({...p,basePath:g,markdownParser:e=>ve.compact(w(e))}),b=JSON.stringify({items:x(_),store:x(v),options:p.options,specType:y,basePath:g,title:Ee(p.document,e.args.kind,_),metadata:Te(p.document),[j]:{llms:h}});return{value:await e.createBlobRef(b,{format:`json`}),entityDeps:[...J(e.file.path,[...p.fileDependencies,...d.paths]),...u.entityDeps,...s.entityDeps],assetUsages:u.assetUsages,markdoc:{tagSet:P},linkRefs:u.linkRefs,problems:u.problems}},{async searchable(e,t){if(t.route===void 0||t.route.metadata.excludeFromSearch===!0)return{docs:[]};let n=S(e),r=await Me(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(T(r)).catch(()=>void 0):void 0,{tags:a}=await F(P);return he(n,A(Y(i,n[j]?.llms),n.specType,{warn:e=>t.logger?.warn(e)}),r,{tags:a,locale:I(t)})},usesProjectMarkdocSchema:!0}),U=t(E,async e=>{let t=G(e),n=await e.io.readFile(t.absolutePath),r=W(e.contentDir),i=await L({kind:e.args.kind,source:n,relativePath:t.relativePath,contentDir:e.contentDir,bundle:K(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),...Ce(i.document,e.routes.byFilePath(e.file.path)?.slug)},entityDeps:J(e.file.path,[...i.fileDependencies,...r.paths]),problems:i.problems}});function W(e){let t=M(e)?.lintPlugins??[];return{plugins:t,paths:t.map(t=>f(_e(e,t.path))).filter(e=>e!==``&&!e.startsWith(`../`))}}function G(e){let t=e.args.source?.path??e.file.path;return{relativePath:t,absolutePath:ge(e.contentDir,t)}}function Se(e){let t=e[N];return m(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 Ce(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 q=t(ae,async e=>{let{buildNavItems:t,collectPreviousRouteSlugs:n}=await import(`@redocly/api-docs/server`),r=await e.entities.load(T(e.file.path)),i=e.args.kind===`graphql`?(await import(`graphql`)).parse(r):r,a=A(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:w}),s=B(o),c=n(o).map(({from:e})=>me(e));return{value:s,targetInventories:[{kind:`subpath`,exhaustive:!0,targets:[...z(s),...c]}]}});function J(e,t){return[{kind:`file`,path:e},...t.map(e=>({kind:`file`,path:e}))]}const we={arazzo:`Arazzo Docs`,asyncapi:`AsyncAPI Docs`,graphql:`GraphQL Docs`,openapi:`OpenAPI Docs`};function Y(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 Te(e){let t=m(e)&&m(e.info)?e.info:{};return m(t[`x-metadata`])?t[`x-metadata`]:{}}function Ee(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:we[t]}const De=[`rbac`,`sidebar`,`excludeFromSearch`,`template`];function Oe(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 De)delete r[e];return r}function X(e){return m(e.metadata)?e.metadata:void 0}function ke(e){let t=X(e)?.title;return typeof t==`string`&&t.length>0?t:void 0}function Z(e,t,n,r){let i=ke(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 Ae(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 je=e({id:D,version:`0.48.0`,content:{filter:{extensions:be},async extractFile(e,t){if(p.test(e.path))return null;let n=Ae(e);if(n===null)return null;if(n!==`arazzo`&&!d(t.config,n))return{routes:[],problems:[h(`${xe[n]} documents`)]};let r=e.path,i=Se(e.manifest),a=i??r,{rbac:o,...s}=await ce(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 le(t.io,t.config,a);if(l!==void 0&&(c.feedback=l),n!==`graphql`){let e=await se(t.io,t.config,r,a);Object.keys(e.config).length>0&&(c.bundleConfig=e)}let u=U.withArgs(c,{stableKey:T(r),type:`api`,metadata:Z(r,n,s,c.rbac)});if(n===`arazzo`)return{routes:[],entities:[u]};let f=Oe(e,s);s.excludeFromSearch===!0&&(f.excludeFromSearch=!0),f.type=n,c.rbac!==void 0&&(f.rbac=c.rbac);let m=H.withArgs(c,{stableKey:`api-docs:render:${r}`}),_=q.withArgs(c,{stableKey:`api-docs:sidebar:${r}`}),v=g(r);return{routes:[{deps:{[re]:m},metadata:f,routeId:`page`,sidebarSubtree:_,slug:null,slugHint:v,template:O,wildcardPrefix:!0}],entities:[u,m,_]}}},loaders:[U,H,q],templates:{[O]:r(n(`./client/template.tsx`,import.meta.url))},server:{routes:[$(k.bundle,`bundle`),$(k.deprecatedBundle,`bundle`),$(k.graphql,`graphql`)]}});function $(e,t){return{method:`GET`,path:e+oe,handler:{filePath:`./server/spec-download.ts`,importer:import.meta.url,exportName:t}}}async function Me(e,t){if(t)try{return await e.load(T(t))}catch{return}}export{je as apiDocsContentPlugin};
@@ -1,8 +1,10 @@
1
- import { type MarkdownUsageSink } from './markdown-decorator.js';
1
+ import type { createConfig as CreateConfigFn } from '@redocly/openapi-core';
2
+ import { type MarkdownUsageSink, type PendingMarkdownResolution } from './markdown-decorator.js';
2
3
  import type { MarkdownService } from '../../../../markdown/types/service.js';
3
4
  import type { MarkdocResolverContextBase } from '../../../../markdown/resolve/markdoc.js';
4
5
  import { type ApiSpecType } from '../../../types/api-entity.js';
5
6
  import type { JsonObject } from '../../../../database/schema.js';
7
+ import type { ProblemDraft } from '../../../../problems/types.js';
6
8
  import { type RbacAnnotationOptions } from '../../../../../shared/rbac/api-docs.js';
7
9
  /**
8
10
  * Context for resolving markdown descriptions in an OpenAPI/AsyncAPI bundle. `markdown`
@@ -35,12 +37,18 @@ export type BundledApiDefinition = {
35
37
  relativePath: string;
36
38
  options: Record<string, unknown>;
37
39
  /**
38
- * Content-relative paths of external `$ref` files (transitively). Registered as
39
- * `file` invalidation deps so edits re-materialize the spec. Excludes the root
40
- * spec (tracked as the origin dep) and any ref outside the content root. Always
41
- * `[]` for graphql (no external ref resolution).
40
+ * Content-relative paths of external `$ref` files (transitively), and of the file each
41
+ * schema catalog link names, also when that file does not exist. Registered as `file`
42
+ * invalidation deps so edits re-materialize the spec. Excludes the root spec (tracked as
43
+ * the origin dep) and any ref outside the content root. Always `[]` for graphql (no
44
+ * external ref resolution).
42
45
  */
43
46
  fileDependencies: string[];
47
+ /**
48
+ * The errors of the bundle, such as a `$ref` that does not resolve, at the referencing file
49
+ * and line when it is in the content root, else at the spec. Always `[]` for graphql.
50
+ */
51
+ problems: ProblemDraft[];
44
52
  };
45
53
  export declare function buildBundledApiDefinition(input: {
46
54
  /** An Arazzo bundle has every `$ref` resolved inline. */
@@ -75,12 +83,13 @@ export declare function buildBundledApiDefinition(input: {
75
83
  */
76
84
  metadata?: Record<string, unknown>;
77
85
  }): Promise<BundledApiDefinition>;
78
- /**
79
- * The descriptions the `.md` routes render but the decorator leaves as strings, because
80
- * api-docs shows them as plain labels (see `MARKDOWN_FIELDS`): the root servers and their
81
- * variables, and the security schemes. Copies of the document's nodes, each description that
82
- * holds Markdoc resolved to its AST through the same pass as the decorated fields.
83
- */
86
+ export declare function createBundleConfig(createConfig: typeof CreateConfigFn, options: {
87
+ bundle: ApiBundleInput;
88
+ specRelativePath: string;
89
+ rootDir: string;
90
+ resolution: ApiDocsMarkdownResolution | undefined;
91
+ }): Promise<import("@redocly/openapi-core").Config>;
92
+ /** Copies of the root servers and security schemes with their descriptions resolved to Markdoc ASTs. */
84
93
  export type LlmsDescriptions = {
85
94
  servers?: unknown[] | Record<string, unknown>;
86
95
  securitySchemes?: Record<string, unknown>;
@@ -90,3 +99,4 @@ export declare function resolveLlmsDescriptions(document: unknown, resolution: A
90
99
  specPath: string;
91
100
  pagePath: string;
92
101
  }): Promise<LlmsDescriptions>;
102
+ export declare function resolvePendingMarkdown(resolution: ApiDocsMarkdownResolution, pendingList: readonly PendingMarkdownResolution[], contentDir: string, pagePath: string): Promise<void>;
@@ -1 +1 @@
1
- import{isObject as e}from"../../../../../shared/utils/is-object.js";import{toContainedContentPath as t}from"../../../../ingest/scan.js";import{SPEC_KIND_ARAZZO as n}from"../../../../../shared/constants/api-spec-kinds.js";import{annotateApiDocsRbac as r}from"../../../../../shared/rbac/api-docs.js";import{resolveMarkdownAst as i}from"../../../../markdown/resolve/ast.js";import{PLAIN_DESCRIPTION_SOURCE as a,REALM_MARKDOWN_DECORATOR_KEY as o,REALM_MARKDOWN_DECORATOR_NAME as s,createMarkdownDecoratorPlugin as c}from"./markdown-decorator.js";import{ProblemError as l}from"../../../../problems/problem-error.js";import{join as u}from"node:path";async function d(e){if(e.kind===`graphql`){let{parse:t}=await import(`graphql`),n;try{n=t(e.source)}catch(t){throw m(e.relativePath,t)}return{type:`graphql`,document:n,relativePath:e.relativePath,options:e.options??{},fileDependencies:[]}}let{bundleFromString:t,createConfig:i}=await import(`@redocly/openapi-core`),a=await h(i,{bundle:e.bundle??{config:{},configDir:``,plugins:[]},specRelativePath:e.relativePath,rootDir:e.contentDir,resolution:e.markdownResolution}),o;try{o=await t({source:e.source,absoluteRef:u(e.contentDir,e.relativePath),config:a,dereference:e.kind===n})}catch(t){throw m(e.relativePath,t)}let s=o.bundle.parsed,c=y(o.fileDependencies,e.contentDir);e.markdownResolution&&await _(e.markdownResolution,e.markdownResolution.sink.pending,e.contentDir,e.pagePath??e.relativePath);let l;try{l=await f(e.kind,s)}catch(t){throw m(e.relativePath,t)}let d=p(l,e.metadata);return{type:e.kind,document:e.rbac?r(d,e.kind,e.rbac):d,relativePath:e.relativePath,options:e.options??{},fileDependencies:c}}async function f(e,t){if(typeof t!=`object`||!t||Array.isArray(t))return t;let n=t;if(e===`openapi`&&n.swagger!==void 0){let{convertSwaggerToOpenApi:e}=await import(`@redocly/api-docs/server`);return e(n)}if(e===`asyncapi`){let{normalizeAsyncApiDefinition:e}=await import(`@redocly/api-docs/server`);return e(n)}return t}function p(t,n){if(n===void 0||!e(t))return t;let r=e(t.info)?t.info:{},i=e(r[`x-metadata`])?r[`x-metadata`]:{};return{...t,info:{...r,"x-metadata":{...i,...n}}}}function m(e,t){let n=t instanceof Error?t.message:String(t);return new l({code:`spec/parse-failed`,message:n,location:{filePath:e}})}function h(e,n){let{bundle:r,resolution:i}=n,a={configPath:u(n.rootDir,r.configDir,`redocly.yaml`)},l=r.plugins.map(({plugin:e,path:t})=>({...e,absolutePath:t}));if(i===void 0)return e({...r.config,plugins:l},a);let{sink:d}=i,f=c({specSourcePath:n.specRelativePath,sink:d,toContentRelative:e=>t(n.rootDir,e)});return e({...r.config,plugins:[...l,f],decorators:{...r.config.decorators,[o]:`on`,[s]:`on`}},a)}async function g(t,n,r){if(!e(t))return{};let i=[],o=(t,n)=>{if(!e(t)||!e(n))return;let o=n[a];i.push({read:()=>t.description,sourceFilePath:typeof o==`string`?o:r.specPath,writeBack:e=>{t.description=e}})},s={},c=t.servers;if(Array.isArray(c)||e(c)){s.servers=structuredClone(c);for(let[t,n]of Object.entries(c)){let r=s.servers[t];if(o(r,n),e(n)&&e(n.variables)&&e(r)){let e=r.variables;for(let[t,r]of Object.entries(n.variables))o(e[t],r)}}}let l=e(t.components)?t.components:void 0;if(e(l?.securitySchemes)){let e=l.securitySchemes;s.securitySchemes=structuredClone(e);for(let[t,n]of Object.entries(e))o(s.securitySchemes[t],n)}return await _(n,i,r.contentDir,r.pagePath),s}async function _(e,t,n,r){let{markdown:a,sink:o}=e,s={...e.loader,contentDir:n,markdown:a};await Promise.all(t.map(async e=>{let t=e.read();if(typeof t!=`string`||!a.looksLikeMarkdown(t))return;let{ast:n,entityDeps:c,assetUsages:l,linkRefs:u,problems:d}=await i(t,e.sourceFilePath,{resolverContext:s});o.entityDeps.push(...c),o.assetUsages.push(...l),o.linkRefs.push(...u.map(e=>v(e.raw.trim().startsWith(`#`)?{...e,target:r}:e)));for(let e of d)o.problems.push({...e,location:{filePath:r}});e.writeBack(n)}))}function v(e){if(e.range===void 0)return e;let t={...e};return delete t.range,t}function y(e,n){let r=/* @__PURE__ */ new Set;for(let i of e){let e=t(n,i);e!==null&&r.add(e)}return[...r].sort()}export{d as buildBundledApiDefinition,g as resolveLlmsDescriptions};
1
+ import{isObject as e}from"../../../../../shared/utils/is-object.js";import{toContainedContentPath as t}from"../../../../ingest/scan.js";import{SPEC_KIND_ARAZZO as n}from"../../../../../shared/constants/api-spec-kinds.js";import{annotateApiDocsRbac as r}from"../../../../../shared/rbac/api-docs.js";import{resolveMarkdownAst as i}from"../../../../markdown/resolve/ast.js";import{PLAIN_DESCRIPTION_SOURCE as a,REALM_MARKDOWN_DECORATOR_KEY as o,REALM_MARKDOWN_DECORATOR_NAME as s,createMarkdownDecoratorPlugin as c}from"./markdown-decorator.js";import{ProblemError as l}from"../../../../problems/problem-error.js";import{captureSnippet as u,splitSourceLines as d}from"../../../../../shared/utils/capture-snippet.js";import{existsSync as f}from"node:fs";import{join as p}from"node:path";async function m(e){if(e.kind===`graphql`){let{parse:t}=await import(`graphql`),n;try{n=t(e.source)}catch(t){throw b(e.relativePath,t)}return{type:`graphql`,document:n,relativePath:e.relativePath,options:e.options??{},fileDependencies:[],problems:[]}}let{BaseResolver:t,bundleFromString:i,createConfig:a,getLineColLocation:o}=await import(`@redocly/openapi-core`),s=await x(a,{bundle:e.bundle??{config:{},configDir:``,plugins:[]},specRelativePath:e.relativePath,rootDir:e.contentDir,resolution:e.markdownResolution}),c=v(t,s.resolve,e.contentDir),l;try{l=await i({source:e.source,absoluteRef:p(e.contentDir,e.relativePath),config:s,externalRefResolver:c,dereference:e.kind===n})}catch(t){throw b(e.relativePath,t)}let u=l.bundle.parsed,d=T([...l.fileDependencies,...c.catalogLinkPaths],e.contentDir),f=y(l.problems,o,{contentDir:e.contentDir,specRelativePath:e.relativePath});e.markdownResolution&&await C(e.markdownResolution,e.markdownResolution.sink.pending,e.contentDir,e.pagePath??e.relativePath);let m;try{m=await h(e.kind,u)}catch(t){throw b(e.relativePath,t)}let _=g(m,e.metadata);return{type:e.kind,document:e.rbac?r(_,e.kind,e.rbac):_,relativePath:e.relativePath,options:e.options??{},fileDependencies:d,problems:f}}async function h(e,t){if(typeof t!=`object`||!t||Array.isArray(t))return t;let n=t;if(e===`openapi`&&n.swagger!==void 0){let{convertSwaggerToOpenApi:e}=await import(`@redocly/api-docs/server`);return e(n)}if(e===`asyncapi`){let{normalizeAsyncApiDefinition:e}=await import(`@redocly/api-docs/server`);return e(n)}return t}function g(t,n){if(n===void 0||!e(t))return t;let r=e(t.info)?t.info:{},i=e(r[`x-metadata`])?r[`x-metadata`]:{};return{...t,info:{...r,"x-metadata":{...i,...n}}}}const _=/^https?:\/\/.*\/_bundle\/(.*\.(?:ya?ml|json))$/u;function v(e,n,r){class i extends e{catalogLinkPaths=/* @__PURE__ */ new Set;resolveExternalRef(e,n){let i=super.resolveExternalRef(e,n),a=_.exec(i)?.[1];if(a===void 0)return i;let o=p(r,a);return t(r,o)===null?i:(this.catalogLinkPaths.add(o),f(o)?o:i)}}return new i(n)}function y(e,n,r){return e.filter(e=>e.severity===`error`&&e.ignored!==!0).map(e=>{let i=e.message.replaceAll(`${r.contentDir}/`,``),a=e.location[0],o=a?.source?t(r.contentDir,a.source.absoluteRef):null;if(a===void 0||o===null)return{code:`spec/bundle-error`,message:i,location:{filePath:r.specRelativePath}};let{start:s,end:c}=n(a),l={start:{line:s.line,character:s.col},...c?{end:{line:c.line,character:c.col}}:{}};return{code:`spec/bundle-error`,message:i,location:{filePath:o,range:l,snippet:u(d(a.source.body),l)}}})}function b(e,t){let n=t instanceof Error?t.message:String(t);return new l({code:`spec/parse-failed`,message:n,location:{filePath:e}})}function x(e,n){let{bundle:r,resolution:i}=n,a={configPath:p(n.rootDir,r.configDir,`redocly.yaml`)},l=r.plugins.map(({plugin:e,path:t})=>({...e,absolutePath:t}));if(i===void 0)return e({...r.config,plugins:l},a);let{sink:u}=i,d=c({specSourcePath:n.specRelativePath,sink:u,toContentRelative:e=>t(n.rootDir,e)});return e({...r.config,plugins:[...l,d],decorators:{...r.config.decorators,[o]:`on`,[s]:`on`}},a)}async function S(t,n,r){if(!e(t))return{};let i=[],o=(t,n)=>{if(!e(t)||!e(n))return;let o=n[a];i.push({read:()=>t.description,sourceFilePath:typeof o==`string`?o:r.specPath,writeBack:e=>{t.description=e}})},s={},c=t.servers;if(Array.isArray(c)||e(c)){s.servers=structuredClone(c);for(let[e,t]of Object.entries(c))o(s.servers[e],t)}let l=e(t.components)?t.components:void 0;if(e(l?.securitySchemes)){let e=l.securitySchemes;s.securitySchemes=structuredClone(e);for(let[t,n]of Object.entries(e))o(s.securitySchemes[t],n)}return await C(n,i,r.contentDir,r.pagePath),s}async function C(e,t,n,r){let{markdown:a,sink:o}=e,s={...e.loader,contentDir:n,markdown:a};await Promise.all(t.map(async e=>{let t=e.read();if(typeof t!=`string`||!a.looksLikeMarkdown(t))return;let{ast:n,entityDeps:c,assetUsages:l,linkRefs:u,problems:d}=await i(t,e.sourceFilePath,{resolverContext:s});o.entityDeps.push(...c),o.assetUsages.push(...l);for(let t of u)t.raw.trim().startsWith(`#`)?o.linkRefs.push(w({...t,target:r})):e.sourceFilePath===r||t.filePath!==void 0?o.linkRefs.push(w(t)):o.linkRefs.push({...w(t),filePath:e.sourceFilePath});for(let e of d)o.problems.push({...e,location:{filePath:r}});e.writeBack(n)}))}function w(e){if(e.range===void 0)return e;let t={...e};return delete t.range,t}function T(e,n){let r=/* @__PURE__ */ new Set;for(let i of e){let e=t(n,i);e!==null&&r.add(e)}return[...r].sort()}export{m as buildBundledApiDefinition,x as createBundleConfig,S as resolveLlmsDescriptions,C as resolvePendingMarkdown};
@@ -1 +1 @@
1
- import{isRbacScope as e}from"../../../../../shared/rbac/engine.js";import{REDOCLY_TEAMS_RBAC as t}from"@redocly/config";function n(e){return e.map(o)}function r(e){let t=/* @__PURE__ */ new Set,n=e=>{for(let r of e){let e=i(r.slugSuffix??``);e!==``&&t.add(e),r.items&&r.items.length>0&&n(r.items)}};return n(e),[...t]}function i(e){return e.replace(/^\/+/,``)}function a(e){return e===``||e.startsWith(`/`)?e:`/${e}`}function o(n){let r={};n.label!==void 0&&(r.label=n.label),n.link!==void 0&&(r.slugSuffix=a(n.link)),n.httpVerb!==void 0&&(r.httpVerb=n.httpVerb),n.deprecated!==void 0&&(r.deprecated=n.deprecated),n.badges!==void 0&&(r.badges=n.badges),n.external!==void 0&&(r.external=n.external),n.separatorLine!==void 0&&(r.separatorLine=n.separatorLine),n.icon!==void 0&&(r.icon=n.icon),n.variant!==void 0&&(r.variant=n.variant);let i=n[t];return e(i)&&(r[t]=i),(n.type===`link`||n.type===`group`||n.type===`separator`)&&(r.type=n.type),r.type===`separator`&&(r.separatorLine=!0),n.items&&n.items.length>0&&(r.items=n.items.map(o)),r}export{r as collectSidebarSubpathTargets,n as toSidebarSubtree,i as toSubpathTarget};
1
+ import{isRbacScope as e}from"../../../../../shared/rbac/engine.js";import{REDOCLY_TEAMS_RBAC as t}from"@redocly/config";function n(e){return e.map(o)}function r(e){let t=/* @__PURE__ */ new Set,n=e=>{for(let r of e){let e=i(r.slugSuffix??``);e!==``&&t.add(e),r.items&&r.items.length>0&&n(r.items)}};return n(e),[...t]}function i(e){return e.replace(/^\/+/,``)}function a(e){return e===``||e.startsWith(`/`)?e:`/${e}`}function o(n){let r={};n.label!==void 0&&(r.label=n.label),n.link!==void 0&&(r.slugSuffix=a(n.link)),n.httpVerb!==void 0&&(r.httpVerb=n.httpVerb),n.deprecated!==void 0&&(r.deprecated=n.deprecated),n.badges!==void 0&&(r.badges=n.badges),n.external!==void 0&&(r.external=n.external),n.separatorLine!==void 0&&(r.separatorLine=n.separatorLine),n.icon!==void 0&&(r.icon=n.icon),n.variant!==void 0&&(r.variant=n.variant);let i=n[t];return e(i)&&(r[t]=i),(n.type===`link`||n.type===`group`||n.type===`separator`)&&(r.type=n.type),n.items&&n.items.length>0&&(r.items=n.items.map(o)),r}export{r as collectSidebarSubpathTargets,n as toSidebarSubtree,i as toSubpathTarget};
@@ -25,10 +25,7 @@ export type MarkdownUsageSink = {
25
25
  /** Filled during the sync bundle walk; drained by the async post-bundle pass. */
26
26
  pending: PendingMarkdownResolution[];
27
27
  };
28
- /**
29
- * Key of the content-relative source file on each bundled server, server variable and security
30
- * scheme node, whose `description` stays a plain string. Spread copies keep it; JSON drops it.
31
- */
28
+ /** Key of the content-relative source file on each bundled server and security scheme node. */
32
29
  export declare const PLAIN_DESCRIPTION_SOURCE: unique symbol;
33
30
  /** The unprefixed decorator name as registered on the plugin. openapi-core namespaces
34
31
  * plugin decorators as `<pluginId>/<name>` when it normalizes plugins (`resolvePlugins`),
@@ -1 +1 @@
1
- const e=Symbol(`plainDescriptionSource`),t=`realm-internal`,n=`resolve-markdown`,r=`${t}/${n}`,i=[`description`];function a(r){let a=e=>{let t=o(e);return(t===void 0?null:r.toContentRelative(t))??r.specSourcePath},s=(e,t)=>{if(typeof e!=`object`||!e)return;let n=e,o=a(t);for(let e of i)r.sink.pending.push({read:()=>n[e],sourceFilePath:o,writeBack:t=>{n[e]=t}});let s=n[`x-enumDescriptions`];if(s&&typeof s==`object`){let e=s;for(let t of Object.keys(e))r.sink.pending.push({read:()=>e[t],sourceFilePath:o,writeBack:n=>{e[t]=n}})}},c=(t,n)=>{typeof t==`object`&&t&&(t[e]=a(n))},l=()=>({Server:{enter:c},ServerVariable:{enter:c},SecurityScheme:{enter:c},Info:{enter:s},Tag:{enter:s},Operation:{enter:s},Parameter:{enter:s},Schema:{enter:s},Response:{enter:s},Header:{enter:s},RequestBody:{enter:s}});return{id:t,decorators:{oas3:{[n]:l},oas2:{[n]:l},async2:{[n]:l},async3:{[n]:l}}}}function o(e){let t=(e?.location)?.source?.absoluteRef;return typeof t==`string`?t:void 0}export{e as PLAIN_DESCRIPTION_SOURCE,r as REALM_MARKDOWN_DECORATOR_KEY,n as REALM_MARKDOWN_DECORATOR_NAME,a as createMarkdownDecoratorPlugin};
1
+ const e=Symbol(`plainDescriptionSource`),t=`realm-internal`,n=`resolve-markdown`,r=`${t}/${n}`,i=[`description`],a=/* @__PURE__ */ new Set([`Server`,`SecurityScheme`]);function o(r){let o=e=>{let t=s(e);return(t===void 0?null:r.toContentRelative(t))??r.specSourcePath},c=(e,t)=>{if(typeof e!=`object`||!e)return;let n=e,a=o(t);for(let e of i)r.sink.pending.push({read:()=>n[e],sourceFilePath:a,writeBack:t=>{n[e]=t}});let s=n[`x-enumDescriptions`];if(s&&typeof s==`object`){let e=s;for(let t of Object.keys(e))r.sink.pending.push({read:()=>e[t],sourceFilePath:a,writeBack:n=>{e[t]=n}})}},l=(t,n)=>{typeof t==`object`&&t&&(t[e]=o(n))},u=(e,t)=>{let n=t.type?.name;typeof e.description==`string`&&(n!==void 0&&a.has(n)||c(e,t))},d=()=>({ref:{enter:u},Server:{enter:l},SecurityScheme:{enter:l},ServerVariable:{enter:c},Example:{enter:c},Info:{enter:c},Tag:{enter:c},Operation:{enter:c},Parameter:{enter:c},Schema:{enter:c},Response:{enter:c},Header:{enter:c},RequestBody:{enter:c}});return{id:t,decorators:{oas3:{[n]:d},oas2:{[n]:d},async2:{[n]:d},async3:{[n]:d}}}}function s(e){let t=(e?.location)?.source?.absoluteRef;return typeof t==`string`?t:void 0}export{e as PLAIN_DESCRIPTION_SOURCE,r as REALM_MARKDOWN_DECORATOR_KEY,n as REALM_MARKDOWN_DECORATOR_NAME,o as createMarkdownDecoratorPlugin};