@redocly/framework 1.0.0-next.5 → 1.0.0-next.6

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 (246) 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/theme-global-style-compiler.js +1 -0
  4. package/dist/bundler/build/theme-global-stylesheets.js +1 -0
  5. package/dist/bundler/build/vite-config.js +2 -2
  6. package/dist/bundler/dev/materialization-sweeper.js +1 -1
  7. package/dist/bundler/dev/run.js +1 -1
  8. package/dist/bundler/dev/runtime-app.js +1 -1
  9. package/dist/bundler/node-bundle.js +1 -0
  10. package/dist/bundler/runtime-files.js +1 -1
  11. package/dist/bundler/user-markdoc-schema.js +1 -1
  12. package/dist/bundler/vite-config.base.js +12 -12
  13. package/dist/cli/commands/ingest.js +1 -1
  14. package/dist/cli/commands/translate.js +1 -1
  15. package/dist/cli/validate-react-pages.js +1 -1
  16. package/dist/client/ApiAccess.js +3 -0
  17. package/dist/client/NavigationProgress.js +1 -1
  18. package/dist/client/ProductsProvider.js +1 -1
  19. package/dist/client/RouteErrorBoundary.js +1 -1
  20. package/dist/client/ThemeGlobalStyle.js +1 -0
  21. package/dist/client/UnversionedVersionButton.js +1 -1
  22. package/dist/client/app.js +3 -3
  23. package/dist/client/client-entry.js +1 -1
  24. package/dist/client/dev-problems/ProblemsBar.js +6 -6
  25. package/dist/client/dev-problems/ProblemsModal.js +15 -15
  26. package/dist/client/l10n/use-l10n-config.js +1 -1
  27. package/dist/client/l10n/use-l10n-href.js +1 -1
  28. package/dist/client/l10n/use-translate.js +1 -1
  29. package/dist/client/products.js +1 -1
  30. package/dist/client/review/ReviewBar.js +53 -53
  31. package/dist/client/sidebar/PoweredByRedocly.js +2 -2
  32. package/dist/client/ssr.js +1 -1
  33. package/dist/client/telemetry/report-preload-failure.js +1 -0
  34. package/dist/client/templates/dev-login.js +4 -4
  35. package/dist/client/templates/unauthorized.js +5 -5
  36. package/dist/client/theme-global-css.js +1 -0
  37. package/dist/client/use-banner.js +1 -1
  38. package/dist/client/use-search.js +1 -1
  39. package/dist/content-layer/allowed-packages.js +1 -1
  40. package/dist/content-layer/config-schema.d.ts +5 -1
  41. package/dist/content-layer/config-schema.js +1 -1
  42. package/dist/content-layer/config.d.ts +6 -2
  43. package/dist/content-layer/config.js +1 -1
  44. package/dist/content-layer/database/adapters/node-sqlite-client.js +1 -1
  45. package/dist/content-layer/database/connection.js +1 -1
  46. package/dist/content-layer/database/entity-store.d.ts +9 -1
  47. package/dist/content-layer/database/entity-store.js +1 -1
  48. package/dist/content-layer/database/origins.d.ts +2 -4
  49. package/dist/content-layer/database/origins.js +1 -1
  50. package/dist/content-layer/ingest/extract-all-phase.js +1 -1
  51. package/dist/content-layer/ingest/finalize-phase.js +1 -1
  52. package/dist/content-layer/ingest/hook-inputs.js +1 -1
  53. package/dist/content-layer/ingest/l10n-warnings.js +1 -1
  54. package/dist/content-layer/ingest/rbac-teams.js +1 -1
  55. package/dist/content-layer/ingest/run.js +1 -1
  56. package/dist/content-layer/ingest/scan.d.ts +1 -1
  57. package/dist/content-layer/ingest/scan.js +1 -1
  58. package/dist/content-layer/ingest/search-sync.js +1 -1
  59. package/dist/content-layer/ingest/slugger/resolve-final-slugs.js +1 -1
  60. package/dist/content-layer/ingest/sync.js +1 -1
  61. package/dist/content-layer/loaders/context.js +1 -1
  62. package/dist/content-layer/markdown/client/OpenapiTagComponents.js +2 -2
  63. package/dist/content-layer/markdown/client/dynamic-components.js +1 -1
  64. package/dist/content-layer/markdown/client/markdoc-components.js +2 -2
  65. package/dist/content-layer/markdown/constants/tag-sets.js +1 -1
  66. package/dist/content-layer/markdown/nodes/fence.js +1 -1
  67. package/dist/content-layer/markdown/nodes/table.js +1 -1
  68. package/dist/content-layer/markdown/resolve/audience-tag.d.ts +1 -1
  69. package/dist/content-layer/markdown/resolve/audience-tag.js +1 -1
  70. package/dist/content-layer/markdown/resolve/markdoc-resolvers/operation-samples.d.ts +1 -1
  71. package/dist/content-layer/markdown/resolve/markdoc-resolvers/operation-samples.js +1 -1
  72. package/dist/content-layer/markdown/resolve/markdoc-resolvers/partial.js +1 -1
  73. package/dist/content-layer/markdown/search/to-markdown.js +2 -2
  74. package/dist/content-layer/markdown/search/to-sections.js +1 -1
  75. package/dist/content-layer/markdown/server/render.js +1 -1
  76. package/dist/content-layer/markdown/service.js +1 -1
  77. package/dist/content-layer/markdown/tags/html.d.ts +4 -1
  78. package/dist/content-layer/markdown/tags/html.js +1 -1
  79. package/dist/content-layer/markdown/types/service.d.ts +2 -0
  80. package/dist/content-layer/materialization/entity.js +1 -1
  81. package/dist/content-layer/materialization/materializer.js +1 -0
  82. package/dist/content-layer/materialization/static-files.js +1 -1
  83. package/dist/content-layer/plan-gates.d.ts +3 -2
  84. package/dist/content-layer/plan-gates.js +1 -1
  85. package/dist/content-layer/plugins/index.js +1 -1
  86. package/dist/content-layer/plugins/internal/api-docs/client/template.js +4 -4
  87. package/dist/content-layer/plugins/internal/api-docs/index.js +1 -1
  88. package/dist/content-layer/plugins/internal/api-docs/server/build-definition.d.ts +2 -2
  89. package/dist/content-layer/plugins/internal/api-docs/server/build-definition.js +1 -1
  90. package/dist/content-layer/plugins/internal/api-docs/server/build-sidebar.js +1 -1
  91. package/dist/content-layer/plugins/internal/api-docs/server/markdown-docs.js +1 -1
  92. package/dist/content-layer/plugins/internal/api-docs/server/options.d.ts +4 -2
  93. package/dist/content-layer/plugins/internal/api-docs/server/options.js +1 -1
  94. package/dist/content-layer/plugins/internal/api-docs/server/search-documents.js +1 -1
  95. package/dist/content-layer/plugins/internal/api-docs/server/spec-download.js +1 -1
  96. package/dist/content-layer/plugins/internal/api-functions/index.js +1 -1
  97. package/dist/content-layer/plugins/internal/api-functions/server/access.js +1 -1
  98. package/dist/content-layer/plugins/internal/api-functions/server/dispatch.js +1 -1
  99. package/dist/content-layer/plugins/internal/app-data/banner.js +1 -1
  100. package/dist/content-layer/plugins/internal/app-data/index.js +1 -1
  101. package/dist/content-layer/plugins/internal/app-data/products.d.ts +2 -0
  102. package/dist/content-layer/plugins/internal/app-data/products.js +1 -1
  103. package/dist/content-layer/plugins/internal/index.js +1 -1
  104. package/dist/content-layer/plugins/internal/l10n/index.js +1 -1
  105. package/dist/content-layer/plugins/internal/markdoc/client/template.js +1 -1
  106. package/dist/content-layer/plugins/internal/markdoc/index.js +1 -1
  107. package/dist/content-layer/plugins/internal/markdoc/server/shared.d.ts +1 -1
  108. package/dist/content-layer/plugins/internal/mcp/content-tools.js +1 -1
  109. package/dist/content-layer/plugins/internal/mcp/index.js +1 -1
  110. package/dist/content-layer/plugins/internal/mcp/server/agent-card.js +1 -1
  111. package/dist/content-layer/plugins/internal/mcp/server/audit.js +1 -1
  112. package/dist/content-layer/plugins/internal/mcp/server/auth.js +1 -1
  113. package/dist/content-layer/plugins/internal/mcp/server/config-gate.js +1 -1
  114. package/dist/content-layer/plugins/internal/mcp/server/custom-tools.js +1 -1
  115. package/dist/content-layer/plugins/internal/mcp/server/gateway/__tests__/secret-store-fixture.js +1 -0
  116. package/dist/content-layer/plugins/internal/mcp/server/gateway/credentials-page/form-page.js +1 -1
  117. package/dist/content-layer/plugins/internal/mcp/server/gateway/credentials.js +1 -1
  118. package/dist/content-layer/plugins/internal/mcp/server/gateway/elicitation.js +7 -7
  119. package/dist/content-layer/plugins/internal/mcp/server/gateway/fetch/fetch-bridge.js +1 -1
  120. package/dist/content-layer/plugins/internal/mcp/server/gateway/index.js +3 -3
  121. package/dist/content-layer/plugins/internal/mcp/server/gateway/secret-store.js +1 -1
  122. package/dist/content-layer/plugins/internal/mcp/server/gateway/tools.js +3 -3
  123. package/dist/content-layer/plugins/internal/mcp/server/handler.js +1 -1
  124. package/dist/content-layer/plugins/internal/mcp/server/mcp-server.js +1 -1
  125. package/dist/content-layer/plugins/internal/mcp/server/oauth/authorize.js +1 -1
  126. package/dist/content-layer/plugins/internal/mcp/server/oauth/discovery.js +1 -1
  127. package/dist/content-layer/plugins/internal/mcp/server/server-card.js +1 -1
  128. package/dist/content-layer/plugins/internal/mcp/server/skills-resources.js +1 -1
  129. package/dist/content-layer/plugins/internal/mcp/server/tools/graphql-catalog.js +1 -1
  130. package/dist/content-layer/plugins/internal/mcp/server/tools/openapi-catalog.js +1 -1
  131. package/dist/content-layer/plugins/internal/mcp/server/tools/openapi-document.js +1 -1
  132. package/dist/content-layer/plugins/internal/mcp/server/tools/openapi-refs.js +1 -1
  133. package/dist/content-layer/plugins/internal/mcp/server/tools/openapi.js +1 -1
  134. package/dist/content-layer/plugins/internal/mcp/server/tools/pages-navigation.js +1 -1
  135. package/dist/content-layer/plugins/internal/mock/server/handler.js +1 -1
  136. package/dist/content-layer/plugins/internal/react-page/index.js +1 -1
  137. package/dist/content-layer/plugins/internal/scorecard-classic/client/Grid.js +11 -11
  138. package/dist/content-layer/plugins/internal/scorecard-classic/client/ScorecardViews.js +1 -1
  139. package/dist/content-layer/plugins/internal/scorecard-classic/client/ScorecardWidgets.js +7 -7
  140. package/dist/content-layer/plugins/internal/scorecard-classic/client/template.js +2 -2
  141. package/dist/content-layer/plugins/internal/sidebar/bundle.d.ts +1 -1
  142. package/dist/content-layer/plugins/internal/sidebar/bundle.js +1 -1
  143. package/dist/content-layer/plugins/internal/sidebar/index.d.ts +1 -1
  144. package/dist/content-layer/plugins/internal/sidebar/index.js +1 -1
  145. package/dist/content-layer/plugins/internal/skills/index.js +1 -1
  146. package/dist/content-layer/plugins/internal/skills/server/routes.js +1 -1
  147. package/dist/content-layer/plugins/project/load.js +2 -2
  148. package/dist/content-layer/plugins/registry.js +1 -1
  149. package/dist/content-layer/plugins/request-context.d.ts +5 -0
  150. package/dist/content-layer/plugins/types/api-entity.d.ts +2 -6
  151. package/dist/content-layer/plugins/types/api-entity.js +1 -1
  152. package/dist/content-layer/plugins/types/plugin.d.ts +8 -0
  153. package/dist/content-layer/plugins/types/search.d.ts +1 -1
  154. package/dist/content-layer/plugins/utils/route-index.d.ts +1 -1
  155. package/dist/content-layer/plugins/utils/route-index.js +1 -1
  156. package/dist/content-layer/plugins/utils/version-path.js +1 -1
  157. package/dist/content-layer/revisions/config.js +1 -1
  158. package/dist/content-layer/server/context.js +1 -1
  159. package/dist/content-layer/server/materialize.js +1 -1
  160. package/dist/content-layer/static/audience.js +1 -1
  161. package/dist/content-layer/static/registry.js +1 -1
  162. package/dist/content-layer/templates/template-set.js +1 -1
  163. package/dist/content-layer/versions/redirect.d.ts +11 -6
  164. package/dist/content-layer/versions/redirect.js +1 -1
  165. package/dist/plugin-api.d.ts +3 -0
  166. package/dist/plugin-api.js +1 -1
  167. package/dist/server/__tests__/rbac-fixture.js +1 -1
  168. package/dist/server/app.js +2 -2
  169. package/dist/server/ask-ai/feature-gate.js +1 -1
  170. package/dist/server/ask-ai/route.js +1 -1
  171. package/dist/server/auth/gate.js +1 -1
  172. package/dist/server/auth/middleware.js +1 -1
  173. package/dist/server/auth/request.js +1 -1
  174. package/dist/server/auth/routes.js +1 -1
  175. package/dist/server/auth/runtime.js +1 -1
  176. package/dist/server/content-assets/access.js +1 -1
  177. package/dist/server/content.js +12 -12
  178. package/dist/server/feedback/route.js +1 -1
  179. package/dist/server/lambda-entry.js +1 -1
  180. package/dist/server/metrics/request-metrics.js +1 -1
  181. package/dist/server/node-entry.js +1 -1
  182. package/dist/server/plugin-context.js +1 -1
  183. package/dist/server/plugin-routes.js +1 -1
  184. package/dist/server/rbac/content-asset-access.js +1 -1
  185. package/dist/server/replay-oauth2/route.js +1 -1
  186. package/dist/server/review/route.js +1 -1
  187. package/dist/server/runtime-config.js +1 -1
  188. package/dist/server/search/route.js +1 -1
  189. package/dist/server/static-files/serve.js +1 -1
  190. package/dist/server/subprocess/runner.js +1 -1
  191. package/dist/server/telemetry/route.js +1 -1
  192. package/dist/server/template-ids.js +1 -1
  193. package/dist/shared/constants/api-spec-kinds.d.ts +6 -0
  194. package/dist/shared/constants/api-spec-kinds.js +1 -0
  195. package/dist/shared/constants/l10n/langs/ar.js +1 -1
  196. package/dist/shared/constants/l10n/langs/de.js +1 -1
  197. package/dist/shared/constants/l10n/langs/en.js +1 -1
  198. package/dist/shared/constants/l10n/langs/es.js +1 -1
  199. package/dist/shared/constants/l10n/langs/fr.js +1 -1
  200. package/dist/shared/constants/l10n/langs/hi.js +1 -1
  201. package/dist/shared/constants/l10n/langs/it.js +1 -1
  202. package/dist/shared/constants/l10n/langs/ja.js +1 -1
  203. package/dist/shared/constants/l10n/langs/ko.js +1 -1
  204. package/dist/shared/constants/l10n/langs/pl.js +1 -1
  205. package/dist/shared/constants/l10n/langs/pt-br.js +1 -1
  206. package/dist/shared/constants/l10n/langs/pt.js +1 -1
  207. package/dist/shared/constants/l10n/langs/ru.js +1 -1
  208. package/dist/shared/constants/l10n/langs/uk.js +1 -1
  209. package/dist/shared/constants/l10n/langs/zh.js +1 -1
  210. package/dist/{server → shared}/constants/system-routes.d.ts +1 -1
  211. package/dist/shared/constants/system-routes.js +1 -0
  212. package/dist/shared/plan-gates.d.ts +6 -1
  213. package/dist/shared/plan-gates.js +1 -1
  214. package/dist/shared/products.js +1 -1
  215. package/dist/{server → shared}/project-env.d.ts +1 -1
  216. package/dist/{server → shared}/rbac/api-docs.d.ts +1 -1
  217. package/dist/{server → shared}/rbac/engine.d.ts +1 -1
  218. package/dist/shared/rbac/engine.js +0 -0
  219. package/dist/shared/rbac/filter.js +1 -0
  220. package/dist/{server → shared}/rbac/l10n-rules.d.ts +1 -1
  221. package/dist/shared/rbac/l10n-rules.js +1 -0
  222. package/dist/shared/rbac/route-scope.js +1 -0
  223. package/dist/{server → shared}/rbac/team-templates.d.ts +6 -2
  224. package/dist/shared/rbac/team-templates.js +1 -0
  225. package/dist/{server → shared}/rbac/teams.d.ts +1 -1
  226. package/dist/shared/rbac/types.js +1 -0
  227. package/dist/shared/types/config.d.ts +2 -0
  228. package/dist/shared/utils/l10n.js +1 -1
  229. package/package.json +8 -8
  230. package/dist/content-layer/server/config.js +0 -1
  231. package/dist/server/constants/system-routes.js +0 -1
  232. package/dist/server/rbac/engine.js +0 -0
  233. package/dist/server/rbac/filter.js +0 -1
  234. package/dist/server/rbac/l10n-rules.js +0 -1
  235. package/dist/server/rbac/route-scope.js +0 -1
  236. package/dist/server/rbac/team-templates.js +0 -1
  237. package/dist/server/rbac/types.js +0 -1
  238. /package/dist/{server → shared}/project-env.js +0 -0
  239. /package/dist/{server → shared}/rbac/api-docs.js +0 -0
  240. /package/dist/{server → shared}/rbac/entity-scope.js +0 -0
  241. /package/dist/{server → shared}/rbac/filter.d.ts +0 -0
  242. /package/dist/{server → shared}/rbac/route-scope.d.ts +0 -0
  243. /package/dist/{server → shared}/rbac/teams.js +0 -0
  244. /package/dist/{server → shared}/rbac/types.d.ts +0 -0
  245. /package/dist/{content-layer/markdown → shared}/utils/packed-ast.d.ts +0 -0
  246. /package/dist/{content-layer/markdown → shared}/utils/packed-ast.js +0 -0
@@ -1 +1 @@
1
- import{collectL10nDirLocales as e,resolveLocaleContext as t}from"../../shared/utils/l10n.js";import{matchGlob as n}from"../plugins/utils/glob.js";import{createTrackedRedoclyConfig as r}from"../config-deps.js";import{buildDataRefMarker as i,hashBlobContent as a}from"../materialization/data-ref.js";import{resolveDataRef as o,upsertBlob as s}from"../database/blobs.js";import{createEntityStore as c}from"../database/entity-store.js";import{createRouteQueryEvaluator as l}from"../plugins/utils/route-index.js";import{createSearchHandle as u}from"../search/store.js";import{createAudienceTagResolver as d}from"../markdown/resolve/audience-tag.js";import{materializeEntityByKey as f}from"../materialization/entity.js";import{createMarkdownService as p}from"../markdown/service.js";import{resolve as m}from"node:path";function h(h,g,_={}){let v,y,b,x,S;return function C(w,T,E){let D=h.pluginRegistry.getById(w.pluginId);if(!D)throw Error(`Entity loader "${w.definition.id}" references missing plugin "${w.pluginId}".`);let{state:O}=h;if(!O)throw Error(`Entity loader "${w.definition.id}" ran before content state was loaded.`);let k=r(h.config),A=k.config.access?.rbac,j=h.config.access?.rbac;(j!==v||y===void 0)&&(v=j,y=d(A,e=>h.logger.warn(e)));let M=y,N=k.config.l10n?.defaultLocale;(S===void 0||S.defaultLocale!==N)&&(x??=e(O.filesByPath.keys()),S={defaultLocale:N,locales:t({defaultLocale:N},x).locales});let P=S.locales,F=[],I=[],L=[];return(b?.state!==O||b.config!==h.config)&&(b={state:O,config:h.config,evaluator:l(O,h.config)}),{args:T??{},config:k.config,contentDir:h.contentDir,file:{absolutePath:m(h.contentDir,E),path:E,lastModifiedAt:O.filesByPath.get(E)?.lastModifiedAt??null},io:{...h.pluginIO,async glob(e){return L.push(e),n(O.filesByPath.keys(),e)}},entities:c({database:g,state:O,materialize:e=>f({database:g,key:e,loaderRegistry:h.pluginRegistry,loaderContextFactory:C,contentDir:h.contentDir,revisions:_.revisions,logger:h.logger}),onEntityRead:e=>F.push(e),record:e=>I.push(e)}),search:u(g),logger:h.logger.child(`content-layer:entity:${w.definition.id}`),plugin:{id:D.id,version:D.version},pluginRegistry:h.pluginRegistry,resolveAudienceTag:M,routes:b.evaluator.index(e=>I.push(e)),markdown:p({state:O,resolveAudienceTag:M,contentLocales:P}),createBlobRef:async(e,t)=>{let n=t?.format??`json`,r=typeof e==`string`?e:Buffer.from(e).toString(`base64`),o=a(r);return await s(g,{key:o,content:r,size:r.length}),i(o,n)},resolveDataRef:e=>o(g,e),_trackedConfig:k,_loadedEntityKeys:F,_globPatterns:L,_routeQueries:I}}}export{h as createBuildTimeEntityLoaderContextFactory};
1
+ import{collectL10nDirLocales as e,resolveLocaleContext as t}from"../../shared/utils/l10n.js";import{matchGlob as n}from"../plugins/utils/glob.js";import{createTrackedRedoclyConfig as r}from"../config-deps.js";import{buildDataRefMarker as i,hashBlobContent as a}from"../materialization/data-ref.js";import{resolveDataRef as o,upsertBlob as s}from"../database/blobs.js";import{createEntityStore as c}from"../database/entity-store.js";import{createRouteQueryEvaluator as l}from"../plugins/utils/route-index.js";import{createSearchHandle as u}from"../search/store.js";import{createAudienceTagResolver as d}from"../markdown/resolve/audience-tag.js";import{createMarkdownService as f}from"../markdown/service.js";import{resolve as p}from"node:path";function m(m,h,g){let _,v,y,b,x;return function(S,C,w){let T=m.pluginRegistry.getById(S.pluginId);if(!T)throw Error(`Entity loader "${S.definition.id}" references missing plugin "${S.pluginId}".`);let{state:E}=m,D=r(m.config),O=D.config.access?.rbac,k=m.config.access?.rbac;(k!==_||v===void 0)&&(_=k,v=d(O,e=>m.logger.warn(e)));let A=v,j=D.config.l10n?.defaultLocale;(x===void 0||x.defaultLocale!==j)&&(b??=e(E.filesByPath.keys()),x={defaultLocale:j,locales:t({defaultLocale:j},b).locales});let M=x.locales,N=[],P=[],F=[];return(y?.state!==E||y.config!==m.config)&&(y={state:E,config:m.config,evaluator:l(E,m.config)}),{args:C??{},config:D.config,contentDir:m.contentDir,file:{absolutePath:p(m.contentDir,w),path:w,lastModifiedAt:E.filesByPath.get(w)?.lastModifiedAt??null},io:{...m.pluginIO,async glob(e){return F.push(e),n(E.filesByPath.keys(),e)}},entities:c({database:h,state:E,materialize:g,onEntityRead:e=>N.push(e),record:e=>P.push(e)}),search:u(h),logger:m.logger.child(`content-layer:entity:${S.definition.id}`),plugin:{id:T.id,version:T.version},pluginRegistry:m.pluginRegistry,resolveAudienceTag:A,routes:y.evaluator.index(e=>P.push(e)),markdown:f({state:E,resolveAudienceTag:A,contentLocales:M}),createBlobRef:async(e,t)=>{let n=t?.format??`json`,r=typeof e==`string`?e:Buffer.from(e).toString(`base64`),o=a(r);return await s(h,{key:o,content:r,size:r.length}),i(o,n)},resolveDataRef:e=>o(h,e),_trackedConfig:D,_loadedEntityKeys:N,_globPatterns:F,_routeQueries:P}}}export{m as createBuildTimeEntityLoaderContextFactory};
@@ -1,7 +1,7 @@
1
- import{jsx as e,jsxs as t}from"react/jsx-runtime";import{ClipboardService as n}from"@redocly/theme/core/utils";import r from"styled-components";import{JsonViewer as i}from"@redocly/theme/components/JsonViewer/JsonViewer";function a({json:r,title:a,errors:c}){let l=!!c?.length,u=l?c:r,d=/* @__PURE__ */ e(i,{data:u,expandLevel:3,onCopyClick:()=>{n.copyCustom(JSON.stringify(u))},title:a});return l?/* @__PURE__ */ t(o,{children:[/* @__PURE__ */ e(s,{children:`error`}),d]}):d}const o=r.div`
1
+ import e from"styled-components";import{ClipboardService as t}from"@redocly/theme/core/utils";import{jsx as n,jsxs as r}from"react/jsx-runtime";import{JsonViewer as i}from"@redocly/theme/components/JsonViewer/JsonViewer";function a({json:e,title:a,errors:c}){let l=!!c?.length,u=l?c:e,d=/* @__PURE__ */ n(i,{data:u,expandLevel:3,onCopyClick:()=>{t.copyCustom(JSON.stringify(u))},title:a});return l?/* @__PURE__ */ r(o,{children:[/* @__PURE__ */ n(s,{children:`error`}),d]}):d}const o=e.div`
2
2
  background-color: var(--code-block-bg-color);
3
3
  border: 2px solid var(--color-error-border);
4
- `,s=r.p`
4
+ `,s=e.p`
5
5
  color: var(--color-error-text);
6
6
  padding-left: var(--spacing-xs);
7
7
  `;export{a as JsonExample};
@@ -1 +1 @@
1
- import{markdocComponents as e}from"./markdoc-components.js";const t=e=>typeof e==`object`&&!!e&&e.$$mdtype===`Tag`,n=e=>typeof e?.preload==`function`;function r(e,n){if(Array.isArray(e)){for(let t of e)r(t,n);return}if(t(e)&&(typeof e.name==`string`&&n.add(e.name),r(e.children,n),typeof e.attributes==`object`&&e.attributes!==null))for(let t of Object.values(e.attributes))r(t,n)}async function i(t){let i=/* @__PURE__ */ new Set;for(let e of Object.values(t))typeof e==`object`&&e&&`ast`in e&&r(e.ast,i);await Promise.all([...i].map(async t=>{let r=Object.hasOwn(e,t)?e[t]:null;if(n(r))try{await r.preload()}catch(e){console.error(`Realm: failed to preload the ${t} component.`,e)}}))}export{i as preloadDynamicMarkdocComponents};
1
+ import{markdocComponents as e}from"./markdoc-components.js";const t=e=>typeof e==`object`&&!!e&&e.$$mdtype===`Tag`,n=e=>typeof e?.preload==`function`;function r(e,n){if(Array.isArray(e)){for(let t of e)r(t,n);return}if(t(e)&&(typeof e.name==`string`&&n.add(e.name),r(e.children,n),typeof e.attributes==`object`&&e.attributes!==null))for(let t of Object.values(e.attributes))r(t,n)}async function i(t,i){let a=/* @__PURE__ */ new Set;for(let e of Object.values(t))typeof e==`object`&&e&&`ast`in e&&r(e.ast,a);await Promise.all([...a].map(async t=>{let r=Object.hasOwn(e,t)?e[t]:null;if(n(r))try{await r.preload()}catch(e){console.error(`Realm: failed to preload the ${t} component.`,e),i(e)}}))}export{i as preloadDynamicMarkdocComponents};
@@ -1,4 +1,4 @@
1
- import{withPathPrefix as e,withPathPrefixForSrcSet as t}from"../../../shared/path-prefix.js";import{isRouterPath as n}from"../../../client/utils/routes/is-router-path.js";import{resolveRelativeHref as r}from"../../../client/utils/routes/resolve-relative-href.js";import*as i from"react";import{Link as a,useLocation as o}from"react-router";import{jsx as s}from"react/jsx-runtime";import{dynamic as c}from"@redocly/theme/core/utils";import l from"styled-components";import{CodeSnippetProvider as u,PageActionsContext as d}from"@redocly/theme/core/contexts";import{Accordion as ee}from"@redocly/theme/markdoc/components/Accordion/Accordion";import{AccordionGroup as f}from"@redocly/theme/markdoc/components/Accordion/AccordionGroup";import{Admonition as p}from"@redocly/theme/markdoc/components/Admonition/Admonition";import{Card as m}from"@redocly/theme/markdoc/components/Cards/Card";import{Cards as h}from"@redocly/theme/markdoc/components/Cards/Cards";import{CodeBlock as g}from"@redocly/theme/markdoc/components/CodeBlock/CodeBlock";import{CodeGroup as _}from"@redocly/theme/markdoc/components/CodeGroup/CodeGroup";import{CodeStep as te}from"@redocly/theme/markdoc/components/CodeWalkthrough/CodeStep";import{CodeToggle as ne}from"@redocly/theme/markdoc/components/CodeWalkthrough/CodeToggle";import{CodeWalkthrough as re}from"@redocly/theme/markdoc/components/CodeWalkthrough/CodeWalkthrough";import{ConnectMCP as v}from"@redocly/theme/markdoc/components/ConnectMCP/ConnectMCP";import{Diagram as y}from"@redocly/theme/markdoc/components/Diagram/Diagram";import{Experiment as b}from"@redocly/theme/components/Experiment/Experiment";import{Variant as x}from"@redocly/theme/components/Experiment/Variant";import{Heading as S}from"@redocly/theme/markdoc/components/Heading/Heading";import{Input as C}from"@redocly/theme/markdoc/components/CodeWalkthrough/Input";import{Icon as w}from"@redocly/theme/markdoc/components/Icon/Icon";import{Image as T}from"@redocly/theme/markdoc/components/Image/Image";import{InlineSvg as E}from"@redocly/theme/markdoc/components/InlineSvg/InlineSvg";import{LoginButton as D}from"@redocly/theme/markdoc/components/LoginButton/LoginButton";import{MarkdocExample as O}from"@redocly/theme/markdoc/components/MarkdocExample/MarkdocExample";import{NumberedItem as k}from"@redocly/theme/markdoc/components/NumberedList/NumberedItem";import{NumberedList as A}from"@redocly/theme/markdoc/components/NumberedList/NumberedList";import{Prompt as j}from"@redocly/theme/markdoc/components/Prompt/Prompt";import{Tabs as M}from"@redocly/theme/markdoc/components/Tabs/Tabs";import{TabItemFragment as N}from"@redocly/theme/markdoc/components/Tabs/TabItemFragment";import{Markdown as P}from"@redocly/theme/components/Markdown/Markdown";import{SearchAiCitation as F}from"@redocly/theme/components/Search/SearchAiCitation";import I from"@redocly/markdoc/dist/react.js";import{useL10nHref as ie}from"virtual:realm-runtime";import{userMarkdocComponents as L}from"virtual:realm-markdoc-components";const R=t=>typeof t==`string`?e(t):void 0,z=e=>typeof e==`string`?t(e):void 0,B=e=>/^(https?:|\/\/)/.test(e);function V(e){let t=ie(),{pathname:i}=o();if(!e||B(e)||e.startsWith(`mailto:`))return{kind:`external`,href:e};let a=r(e,i);return n(a)?{kind:`page`,href:t(a)}:{kind:`file`,href:a}}function H({href:t,children:n,...r}){let i=V(t);if(i.kind===`external`){let e=t&&B(t)?`_blank`:void 0;return/* @__PURE__ */ s(`a`,{href:t,target:e,...r,rel:typeof r.rel==`string`?r.rel:`noreferrer`,children:n})}return i.kind===`file`?/* @__PURE__ */ s(`a`,{href:e(i.href),...r,children:n}):/* @__PURE__ */ s(a,{to:i.href,...r,children:n})}function U(e){return function({href:t,...n}){return/* @__PURE__ */ s(e,{...n,href:V(t).href})}}const{MarkdownLink:W,...G}=L;function K({src:e,srcSet:t,...n}){return/* @__PURE__ */ s(T,{...n,src:R(e),srcSet:z(t)})}let q=Promise.resolve();function J(){return q}function Y(e,t){return new Promise(n=>{t&&(e.addEventListener(`load`,()=>n()),e.addEventListener(`error`,()=>n())),document.body.appendChild(e),t||n()})}function X({src:e,children:t,...n}){return i.useEffect(()=>{let r=typeof e==`string`?e:void 0;if(r&&document.querySelector(`script[src="${CSS.escape(r)}"]`))return;let a=document.createElement(`script`);r?a.src=r:t!=null&&(a.textContent=i.Children.toArray(t).join(``));for(let[e,t]of Object.entries(n))(typeof t==`string`||typeof t==`boolean`)&&a.setAttribute(e,String(t));r&&n.async?Y(a,!0):q=q.then(()=>Y(a,!!r))},[e]),null}function Z({image:e,icon:t,...n}){return/* @__PURE__ */ s(m,{...n,image:R(e),icon:R(t)})}const ae=l.span.attrs({role:`alert`,"data-component-name":`MarkdocInlineError`})`
1
+ import{withPathPrefix as e,withPathPrefixForSrcSet as t}from"../../../shared/path-prefix.js";import{isRouterPath as n}from"../../../client/utils/routes/is-router-path.js";import{resolveRelativeHref as r}from"../../../client/utils/routes/resolve-relative-href.js";import*as i from"react";import a from"styled-components";import{Link as o,useLocation as s}from"react-router";import{dynamic as c}from"@redocly/theme/core/utils";import{jsx as l}from"react/jsx-runtime";import{CodeSnippetProvider as u,PageActionsContext as d}from"@redocly/theme/core/contexts";import{Accordion as ee}from"@redocly/theme/markdoc/components/Accordion/Accordion";import{AccordionGroup as f}from"@redocly/theme/markdoc/components/Accordion/AccordionGroup";import{Admonition as p}from"@redocly/theme/markdoc/components/Admonition/Admonition";import{Card as m}from"@redocly/theme/markdoc/components/Cards/Card";import{Cards as h}from"@redocly/theme/markdoc/components/Cards/Cards";import{CodeBlock as g}from"@redocly/theme/markdoc/components/CodeBlock/CodeBlock";import{CodeGroup as _}from"@redocly/theme/markdoc/components/CodeGroup/CodeGroup";import{CodeStep as te}from"@redocly/theme/markdoc/components/CodeWalkthrough/CodeStep";import{CodeToggle as ne}from"@redocly/theme/markdoc/components/CodeWalkthrough/CodeToggle";import{CodeWalkthrough as re}from"@redocly/theme/markdoc/components/CodeWalkthrough/CodeWalkthrough";import{ConnectMCP as v}from"@redocly/theme/markdoc/components/ConnectMCP/ConnectMCP";import{Diagram as y}from"@redocly/theme/markdoc/components/Diagram/Diagram";import{Experiment as b}from"@redocly/theme/components/Experiment/Experiment";import{Variant as x}from"@redocly/theme/components/Experiment/Variant";import{Heading as S}from"@redocly/theme/markdoc/components/Heading/Heading";import{Input as C}from"@redocly/theme/markdoc/components/CodeWalkthrough/Input";import{Icon as w}from"@redocly/theme/markdoc/components/Icon/Icon";import{Image as T}from"@redocly/theme/markdoc/components/Image/Image";import{InlineSvg as E}from"@redocly/theme/markdoc/components/InlineSvg/InlineSvg";import{LoginButton as D}from"@redocly/theme/markdoc/components/LoginButton/LoginButton";import{MarkdocExample as O}from"@redocly/theme/markdoc/components/MarkdocExample/MarkdocExample";import{NumberedItem as k}from"@redocly/theme/markdoc/components/NumberedList/NumberedItem";import{NumberedList as A}from"@redocly/theme/markdoc/components/NumberedList/NumberedList";import{Prompt as j}from"@redocly/theme/markdoc/components/Prompt/Prompt";import{Tabs as M}from"@redocly/theme/markdoc/components/Tabs/Tabs";import{TabItemFragment as N}from"@redocly/theme/markdoc/components/Tabs/TabItemFragment";import{Markdown as P}from"@redocly/theme/components/Markdown/Markdown";import{SearchAiCitation as F}from"@redocly/theme/components/Search/SearchAiCitation";import I from"@redocly/markdoc/dist/react.js";import{useL10nHref as ie}from"virtual:realm-runtime";import{userMarkdocComponents as L}from"virtual:realm-markdoc-components";const R=t=>typeof t==`string`?e(t):void 0,z=e=>typeof e==`string`?t(e):void 0,B=e=>/^(https?:|\/\/)/.test(e);function V(e){let t=ie(),{pathname:i}=s();if(!e||B(e)||e.startsWith(`mailto:`))return{kind:`external`,href:e};let a=r(e,i);return n(a)?{kind:`page`,href:t(a)}:{kind:`file`,href:a}}function H({href:t,children:n,...r}){let i=V(t);if(i.kind===`external`){let e=t&&B(t)?`_blank`:void 0;return/* @__PURE__ */ l(`a`,{href:t,target:e,...r,rel:typeof r.rel==`string`?r.rel:`noreferrer`,children:n})}return i.kind===`file`?/* @__PURE__ */ l(`a`,{href:e(i.href),...r,children:n}):/* @__PURE__ */ l(o,{to:i.href,...r,children:n})}function U(e){return function({href:t,...n}){return/* @__PURE__ */ l(e,{...n,href:V(t).href})}}const{MarkdownLink:W,...G}=L;function K({src:e,srcSet:t,...n}){return/* @__PURE__ */ l(T,{...n,src:R(e),srcSet:z(t)})}let q=Promise.resolve();function J(){return q}function Y(e,t){return new Promise(n=>{t&&(e.addEventListener(`load`,()=>n()),e.addEventListener(`error`,()=>n())),document.body.appendChild(e),t||n()})}function X({src:e,children:t,...n}){return i.useEffect(()=>{let r=typeof e==`string`?e:void 0;if(r&&document.querySelector(`script[src="${CSS.escape(r)}"]`))return;let a=document.createElement(`script`);r?a.src=r:t!=null&&(a.textContent=i.Children.toArray(t).join(``));for(let[e,t]of Object.entries(n))(typeof t==`string`||typeof t==`boolean`)&&a.setAttribute(e,String(t));r&&n.async?Y(a,!0):q=q.then(()=>Y(a,!!r))},[e]),null}function Z({image:e,icon:t,...n}){return/* @__PURE__ */ l(m,{...n,image:R(e),icon:R(t)})}const ae=a.span.attrs({role:`alert`,"data-component-name":`MarkdocInlineError`})`
2
2
  display: inline;
3
3
  padding: 0 var(--spacing-xs);
4
4
  border: var(--admonition-danger-border);
@@ -6,4 +6,4 @@ import{withPathPrefix as e,withPathPrefixForSrcSet as t}from"../../../shared/pat
6
6
  background-color: var(--admonition-danger-bg-color);
7
7
  color: var(--admonition-danger-text-color);
8
8
  font-size: var(--font-size-sm);
9
- `,Q={Accordion:ee,AccordionGroup:f,Admonition:p,AiCitation:F,Card:Z,Cards:h,CodeBlock:g,CodeGroup:_,CodeStep:te,CodeToggle:ne,CodeWalkthrough:re,ConnectMCP:v,Diagram:y,Experiment:b,ExperimentVariant:x,Heading:S,HtmlScript:X,Icon:w,Image:K,InlineSvg:E,Input:C,JsonExample:c(()=>import(`./OpenapiTagComponents.js`).then(e=>e.JsonExample)),JsonSchema:c(()=>import(`./JsonSchemaTag.js`).then(e=>e.JsonSchemaTag)),LoginButton:D,MarkdocExample:O,MarkdocInlineError:ae,NumberedItem:k,NumberedList:A,OpenApiCodeSample:c(()=>import(`./OpenApiEmbedTags.js`).then(e=>e.OpenApiCodeSample)),OpenApiExample:c(()=>import(`./OpenApiEmbedTags.js`).then(e=>e.OpenApiExample)),OpenApiResponseSample:c(()=>import(`./OpenApiEmbedTags.js`).then(e=>e.OpenApiResponseSample)),Prompt:j,ReplayOpenApi:c(()=>import(`./ReplayOpenApiTag.js`).then(e=>e.ReplayOpenApiTag)),Tabs:M,TabItemFragment:N,Link:H,...G,MarkdownLink:W===void 0?H:U(W)},oe=I;function $(e,t=Q){return/* @__PURE__ */ s(u,{children:oe(e,i,{components:t})})}function se({ast:e,components:t=Q,withPageActions:n}){let r=i.useMemo(()=>$(e,t),[e,t]);return/* @__PURE__ */ s(d.Provider,{value:n??null,children:/* @__PURE__ */ s(P,{children:r})})}export{X as HtmlScript,Z as MarkdocCard,K as MarkdocImage,H as MarkdocLink,se as MarkdocRenderer,Q as markdocComponents,$ as renderMarkdocAst,J as waitForMarkdownScripts};
9
+ `,Q={Accordion:ee,AccordionGroup:f,Admonition:p,AiCitation:F,Card:Z,Cards:h,CodeBlock:g,CodeGroup:_,CodeStep:te,CodeToggle:ne,CodeWalkthrough:re,ConnectMCP:v,Diagram:y,Experiment:b,ExperimentVariant:x,Heading:S,HtmlScript:X,Icon:w,Image:K,InlineSvg:E,Input:C,JsonExample:c(()=>import(`./OpenapiTagComponents.js`).then(e=>e.JsonExample)),JsonSchema:c(()=>import(`./JsonSchemaTag.js`).then(e=>e.JsonSchemaTag)),LoginButton:D,MarkdocExample:O,MarkdocInlineError:ae,NumberedItem:k,NumberedList:A,OpenApiCodeSample:c(()=>import(`./OpenApiEmbedTags.js`).then(e=>e.OpenApiCodeSample)),OpenApiExample:c(()=>import(`./OpenApiEmbedTags.js`).then(e=>e.OpenApiExample)),OpenApiResponseSample:c(()=>import(`./OpenApiEmbedTags.js`).then(e=>e.OpenApiResponseSample)),Prompt:j,ReplayOpenApi:c(()=>import(`./ReplayOpenApiTag.js`).then(e=>e.ReplayOpenApiTag)),Tabs:M,TabItemFragment:N,Link:H,...G,MarkdownLink:W===void 0?H:U(W)},oe=I;function $(e,t=Q){return/* @__PURE__ */ l(u,{children:oe(e,i,{components:t})})}function se({ast:e,components:t=Q,withPageActions:n}){let r=i.useMemo(()=>$(e,t),[e,t]);return/* @__PURE__ */ l(d.Provider,{value:n??null,children:/* @__PURE__ */ l(P,{children:r})})}export{X as HtmlScript,Z as MarkdocCard,K as MarkdocImage,H as MarkdocLink,se as MarkdocRenderer,Q as markdocComponents,$ as renderMarkdocAst,J as waitForMarkdownScripts};
@@ -1 +1 @@
1
- import{builtInMarkdocNodes as e,builtInMarkdocTags as t}from"./builtin-tags.js";import{builtInMarkdocFunctions as n}from"./builtin-functions.js";const r=`@theme/markdoc/schema.ts`;let i,a,o=!1;function s(e,t,n){globalThis.__REALM_MARKDOC_USER_SCHEMA__=e,i=t,a=n,o=!1}function c(e){s(void 0,void 0,e),o=!0}function l(){return a}function u(){return Object.keys(globalThis.__REALM_MARKDOC_USER_SCHEMA__?.tags??{})}function d(){return a!==void 0&&!o}function f(){return i}const p=`builtin`,m=`api-docs`,h={[m]:async()=>{let{apiDocsMarkdocNodes:e,apiDocsMarkdocTags:t}=await import(`@redocly/api-docs/lib/components/markdoc/defaultMarkdocConfig.js`);return{tags:t,nodes:e}}},g=/* @__PURE__ */ new Map;let _;const v=/* @__PURE__ */ new Set,y=e=>!!e&&typeof e==`object`;function b(e,t){let r={tags:{...e.tags},nodes:{...e.nodes},functions:{...n,...e.functions}};for(let e of[`tags`,`nodes`,`functions`])for(let[n,i]of Object.entries(t[e]??{}))if(y(i)){if(e===`functions`&&n in r.functions){v.has(n)||(v.add(n),console.warn(`[markdoc] The user schema defines the "${n}" function, but the engine already defines it. The engine function is used.`));continue}r[e][n]=i}return r}async function x(r){let i=globalThis.__REALM_MARKDOC_USER_SCHEMA__;i!==_&&(_=i,g.clear(),v.clear());let a=r??`builtin`,o=g.get(a);if(o)return o;let s={tags:t,nodes:e,functions:n};if(i&&(s=b(s,i)),a!==`builtin`){let e=await h[a]?.();if(!e)throw Error(`Unknown markdoc tag set "${a}".`);s={tags:{...s.tags,...e.tags},nodes:{...s.nodes,...e.nodes},functions:{...s.functions,...e.functions}}}return g.set(a,s),s}const S=`page-validation`;async function C(){let e=await x(),t=await x(m),n=g.get(S);if(n)return n;let r={...t,tags:{...t.tags,...e.tags},nodes:{...t.nodes,...e.nodes}};return g.set(S,r),r}export{m as API_DOCS_MARKDOC_TAG_SET,p as BUILTIN_MARKDOC_TAG_SET,r as USER_MARKDOC_SCHEMA_FILE,d as isMarkdocValidationEnabled,y as isSchemaLike,s as registerUserMarkdocSchema,c as registerUserMarkdocSchemaFailure,x as resolveMarkdocTagSet,C as resolveMarkdownPageValidationSet,f as userMarkdocSchemaDigest,l as userMarkdocSchemaFiles,u as userMarkdocTagNames};
1
+ import{builtInMarkdocNodes as e,builtInMarkdocTags as t}from"./builtin-tags.js";import{builtInMarkdocFunctions as n}from"./builtin-functions.js";const r=`@theme/markdoc/schema.ts`;let i,a,o=!1;function s(e,t,n){globalThis.__REALM_MARKDOC_USER_SCHEMA__=e,i=t,a=n,o=!1}function c(e){s(void 0,void 0,e),o=!0}function l(){return a}function u(){return Object.keys(globalThis.__REALM_MARKDOC_USER_SCHEMA__?.tags??{})}function d(){return a!==void 0&&!o}function f(){return i}const p=`builtin`,m=`api-docs`,h={[m]:async()=>{let{apiDocsMarkdocNodes:e,apiDocsMarkdocTags:t}=await import(`@redocly/api-docs/markdoc`);return{tags:t,nodes:e}}},g=/* @__PURE__ */ new Map;let _;const v=/* @__PURE__ */ new Set,y=e=>!!e&&typeof e==`object`;function b(e,t){let r={tags:{...e.tags},nodes:{...e.nodes},functions:{...n,...e.functions}};for(let e of[`tags`,`nodes`,`functions`])for(let[n,i]of Object.entries(t[e]??{}))if(y(i)){if(e===`functions`&&n in r.functions){v.has(n)||(v.add(n),console.warn(`[markdoc] The user schema defines the "${n}" function, but the engine already defines it. The engine function is used.`));continue}r[e][n]=i}return r}async function x(r){let i=globalThis.__REALM_MARKDOC_USER_SCHEMA__;i!==_&&(_=i,g.clear(),v.clear());let a=r??`builtin`,o=g.get(a);if(o)return o;let s={tags:t,nodes:e,functions:n};if(i&&(s=b(s,i)),a!==`builtin`){let e=await h[a]?.();if(!e)throw Error(`Unknown markdoc tag set "${a}".`);s={tags:{...s.tags,...e.tags},nodes:{...s.nodes,...e.nodes},functions:{...s.functions,...e.functions}}}return g.set(a,s),s}const S=`page-validation`;async function C(){let e=await x(),t=await x(m),n=g.get(S);if(n)return n;let r={...t,tags:{...t.tags,...e.tags},nodes:{...t.nodes,...e.nodes}};return g.set(S,r),r}export{m as API_DOCS_MARKDOC_TAG_SET,p as BUILTIN_MARKDOC_TAG_SET,r as USER_MARKDOC_SCHEMA_FILE,d as isMarkdocValidationEnabled,y as isSchemaLike,s as registerUserMarkdocSchema,c as registerUserMarkdocSchemaFailure,x as resolveMarkdocTagSet,C as resolveMarkdownPageValidationSet,f as userMarkdocSchemaDigest,l as userMarkdocSchemaFiles,u as userMarkdocTagNames};
@@ -1 +1 @@
1
- import{EXAMPLE_CONTENT_ATTRIBUTE as e}from"@redocly/theme/core/constants";import t from"@redocly/markdoc";const n=/* @__PURE__ */ new Set([`mermaid`,`excalidraw`,`plantuml`]),r={...t.nodes.fence,attributes:{...t.nodes.fence.attributes,label:{type:String,render:`data-label`},title:{type:String,render:`data-title`},highlight:{type:String,render:`data-highlight`},align:{type:String,matches:[`left`,`center`,`right`]},width:{type:String},[e]:{type:Object,render:!1}},transform(e,r){let i=e.transformAttributes(r),a=e.transformChildren(r),o=i[`data-language`],s=i[`data-title`];if(e.attributes.process===!1&&(a=[e.attributes.content]),typeof a[0]!=`string`)return new t.Tag(e.tag,i,a);if(typeof o==`string`&&n.has(o)){let{diagramHtml:n,diagramHtmlDark:r,diagramError:s}=e.attributes;if(typeof n==`string`||typeof s==`string`)return new t.Tag(`Diagram`,{...i,diagramType:o,diagramSource:a[0],diagramHtml:n,diagramHtmlDark:r,diagramError:s},[])}let c=a.map(e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`?e.toString():t.Tag.isTag(e)?String(e.attributes?.rawtag??``):``).join(``);return new t.Tag(`CodeBlock`,{...i,header:{title:s,controls:{copy:{}}},source:c,lang:o},[])}};export{n as DIAGRAM_LANGUAGES,r as fence};
1
+ import e from"@redocly/markdoc";import{EXAMPLE_CONTENT_ATTRIBUTE as t}from"@redocly/theme/core/constants";const n=/* @__PURE__ */ new Set([`mermaid`,`excalidraw`,`plantuml`]),r={...e.nodes.fence,attributes:{...e.nodes.fence.attributes,label:{type:String,render:`data-label`},title:{type:String,render:`data-title`},highlight:{type:String,render:`data-highlight`},align:{type:String,matches:[`left`,`center`,`right`]},width:{type:String},[t]:{type:Object,render:!1}},transform(t,r){let i=t.transformAttributes(r),a=t.transformChildren(r),o=i[`data-language`],s=i[`data-title`];if(t.attributes.process===!1&&(a=[t.attributes.content]),typeof a[0]!=`string`)return new e.Tag(t.tag,i,a);if(typeof o==`string`&&n.has(o)){let{diagramHtml:n,diagramHtmlDark:r,diagramError:s}=t.attributes;if(typeof n==`string`||typeof s==`string`)return new e.Tag(`Diagram`,{...i,diagramType:o,diagramSource:a[0],diagramHtml:n,diagramHtmlDark:r,diagramError:s},[])}let c=a.map(t=>typeof t==`string`||typeof t==`number`||typeof t==`boolean`?t.toString():e.Tag.isTag(t)?String(t.attributes?.rawtag??``):``).join(``);return new e.Tag(`CodeBlock`,{...i,header:{title:s,controls:{copy:{}}},source:c,lang:o},[])}};export{n as DIAGRAM_LANGUAGES,r as fence};
@@ -1 +1 @@
1
- import{MARKDOWN_CLASS_NAME as e}from"@redocly/theme/core/constants";import t from"@redocly/markdoc";const n={transform(n,r){let{class:i,...a}=n.transformAttributes(r),s=n.transformChildren(r);return o(s),new t.Tag(`div`,{className:`md-table-wrapper`},[new t.Tag(`table`,{...a,className:[e,i].filter(Boolean).join(` `)},s)])}},r={type:String,matches:[`top`,`middle`,`bottom`],render:`vAlign`},i={...t.nodes.td,attributes:{...t.nodes.td.attributes,valign:r}},a={...t.nodes.th,attributes:{...t.nodes.th.attributes,valign:r}};function o([e]){if(t.Tag.isTag(e)&&e.name===`thead`){for(let n of e.children)if(t.Tag.isTag(n))for(let e of n.children)t.Tag.isTag(e)&&e.name===`th`&&(e.attributes[`data-label`]=s(e.children))}}function s(e){return e.map(e=>typeof e==`string`||typeof e==`number`?String(e):t.Tag.isTag(e)?s(e.children):``).join(``).trim()}export{n as table,i as td,a as th};
1
+ import e from"@redocly/markdoc";import{MARKDOWN_CLASS_NAME as t}from"@redocly/theme/core/constants";const n={transform(n,r){let{class:i,...a}=n.transformAttributes(r),s=n.transformChildren(r);return o(s),new e.Tag(`div`,{className:`md-table-wrapper`},[new e.Tag(`table`,{...a,className:[t,i].filter(Boolean).join(` `)},s)])}},r={type:String,matches:[`top`,`middle`,`bottom`],render:`vAlign`},i={...e.nodes.td,attributes:{...e.nodes.td.attributes,valign:r}},a={...e.nodes.th,attributes:{...e.nodes.th.attributes,valign:r}};function o([t]){if(e.Tag.isTag(t)&&t.name===`thead`){for(let n of t.children)if(e.Tag.isTag(n))for(let t of n.children)e.Tag.isTag(t)&&t.name===`th`&&(t.attributes[`data-label`]=s(t.children))}}function s(t){return t.map(t=>typeof t==`string`||typeof t==`number`?String(t):e.Tag.isTag(t)?s(t.children):``).join(``).trim()}export{n as table,i as td,a as th};
@@ -1,4 +1,4 @@
1
- import { type AssetAudienceDescriptor } from '../../../server/rbac/engine.js';
1
+ import { type AssetAudienceDescriptor } from '../../../shared/rbac/engine.js';
2
2
  export type AudienceTagResolver = (path: string) => Promise<string | null>;
3
3
  /**
4
4
  * Builds a per-invocation resolver from a raw `access.rbac` config value —
@@ -1 +1 @@
1
- import{compileAssetAudiences as e,compileRbacMatcher as t,deriveAssetTag as n,parseRbacConfigData as r,resolveAssetTagInputs as i}from"../../../server/rbac/engine.js";function a(e,a){let o=r(e);if(!o)return async()=>null;let s=t(o);return async e=>{let t=i(s,e);return t===null?null:(t.pattern===``&&a?.(`rbac config: "${e}" matches no content rule — it will be unreachable by any viewer. Add a catch-all "**" rule if this asset should be public.`),n(t))}}async function o(n,i){let a=r(n);return a?e(t(a),i):null}export{o as compileAssetAudienceTable,a as createAudienceTagResolver};
1
+ import{compileAssetAudiences as e,compileRbacMatcher as t,deriveAssetTag as n,parseRbacConfigData as r,resolveAssetTagInputs as i}from"../../../shared/rbac/engine.js";function a(e,a){let o=r(e);if(!o)return async()=>null;let s=t(o);return async e=>{let t=i(s,e);return t===null?null:(t.pattern===``&&a?.(`rbac config: "${e}" matches no content rule — it will be unreachable by any viewer. Add a catch-all "**" rule if this asset should be public.`),n(t))}}async function o(n,i){let a=r(n);return a?e(t(a),i):null}export{o as compileAssetAudienceTable,a as createAudienceTagResolver};
@@ -1,7 +1,7 @@
1
1
  import type { ApiStore, CodeSamplePanelItem, CodeSampleSource, OpenAPIDefinition, ResponseCodeItem, findExampleEncoding } from '@redocly/api-docs';
2
2
  import { REDOCLY_TEAMS_RBAC } from '@redocly/config';
3
3
  import type { MarkdocAttributeResolverContext, MarkdocAttributeResolverResult } from '../../../plugins/types/markdoc.js';
4
- import type { RbacScope } from '../../../../server/rbac/types.js';
4
+ import type { RbacScope } from '../../../../shared/rbac/types.js';
5
5
  export type ResolvedSampleBlock = {
6
6
  lang: string;
7
7
  title: string;
@@ -1 +1 @@
1
- import{compileRouteAccessMatcher as e,matchContentScope as t}from"../../../../server/rbac/engine.js";import{isObject as n}from"../../../../shared/utils/is-object.js";import{SPEC_KIND_OPENAPI as r}from"../../../plugins/types/api-entity.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"../../../../server/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`),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`),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`),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`),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`)).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`),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
+ 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{L10N_DIR as e}from"../../../../shared/constants/l10n/defaults.js";import{delocalizeL10nPath as t,l10nDirOf as n}from"../../../../shared/utils/l10n.js";import{markdocErrorResult as r,replaceWithMarkdocError as i}from"../../tags/markdoc-error.js";import{PARTIAL_L10N_ATTRIBUTE as a}from"../../tags/partial.js";import{shiftRange as o}from"../../../../shared/utils/shift-range.js";import{inlinedLinkRefs as s}from"../../../link-checker/node-ref.js";import{resolveResolverTarget as c}from"./context-paths.js";import{getPartialsFolders as l,isPartialPath as u}from"../../utils/partials.js";import{FRONTMATTER_BLOCK_RE as d,computeFrontmatterLineOffset as f}from"../../utils/frontmatter-offset.js";import{substituteStaticVariables as p}from"../../utils/substitute-variables.js";import{resolveMarkdocBuildTimeAttributes as m}from"../markdoc.js";import{join as h}from"node:path";async function g(o){let{node:s,attributeName:d}=o,f=s.attributes[d];if(typeof f!=`string`||f===``||o.io===void 0)return null;let p=c(o,f);if(p===null)return null;if(!u(p.contentPath,o.config)){let e=`Partial ${p.contentPath} must live in a partials folder (markdown.partialsFolders: ${l(o.config).join(`, `)})`;return r(s,e,o.sourceFilePath)}let m=n(o.sourceFilePath),g=[],v=m!==void 0&&n(p.contentPath)===void 0?`${e}/${m}/${p.contentPath}`:p.contentPath;if(!await o.io.exists(h(o.contentDir,v))){g.push({kind:`file`,path:v});let e=t(v);if(e!==void 0&&g.push({kind:`file`,path:e}),e===void 0||!await o.io.exists(h(o.contentDir,e))){let e=`Partial file ${p.contentPath} does not exist`;return r(s,e,o.sourceFilePath,g)}v=e}let y=o.partialChain??[o.sourceFilePath];if(y.includes(v))return i(s,`Circular partial inclusion: ${[...y,v].join(` -> `)}`),{entityDeps:[{kind:`file`,path:v}]};let b=await o.io.readFile(h(o.contentDir,v)),x=await _(o,v,b,y);s.children=x.ast.children;let S=[{entityDeps:g},x.result];if(m===void 0&&n(p.contentPath)===void 0){let t={};for(let n of o.markdown.contentLocales){let r=`${e}/${n}/${p.contentPath}`,i=h(o.contentDir,r);if(!await o.io.exists(i)){S.push({entityDeps:[{kind:`file`,path:r}]});continue}let a=await _(o,r,await o.io.readFile(i),y);t[n]=a.ast,S.push(a.result)}Object.keys(t).length>0&&(s.attributes[a]=t)}return{entityDeps:S.flatMap(e=>e.entityDeps??[]),assetUsages:S.flatMap(e=>e.assetUsages??[]),linkRefs:S.flatMap(e=>e.linkRefs??[]),problems:S.flatMap(e=>e.problems??[])}}async function _(e,t,n,r){let i=n.replace(d,``),a=structuredClone(e.markdown.parseCached(i)),o=await m(a,{tags:e.tags,sourceFilePath:t,resolverContext:{config:e.config,contentDir:e.contentDir,entities:e.entities,file:e.file,io:e.io,logger:e.logger,markdown:e.markdown,plugin:e.plugin},partialChain:[...r,t],source:i}),c=e.node.attributes.variables;typeof c==`object`&&c&&!Array.isArray(c)&&p(a,c);let l=f(n);return{ast:a,result:{entityDeps:[{kind:`file`,path:t},...o.entityDeps],assetUsages:o.assetUsages,linkRefs:s(o.linkRefs,t,l),problems:o.problems.map(e=>v(e,l))}}}function v(e,t){if(t===0||e.location?.range===void 0)return e;let n={...e.location,range:o(e.location.range,t)};return{...e,location:n}}export{g as resolvePartialFileAttribute};
1
+ import{L10N_DIR as e}from"../../../../shared/constants/l10n/defaults.js";import{delocalizeL10nPath as t,l10nDirOf as n}from"../../../../shared/utils/l10n.js";import{markdocErrorResult as r,replaceWithMarkdocError as i}from"../../tags/markdoc-error.js";import{PARTIAL_L10N_ATTRIBUTE as a}from"../../tags/partial.js";import{shiftRange as o}from"../../../../shared/utils/shift-range.js";import{inlinedLinkRefs as s}from"../../../link-checker/node-ref.js";import{resolveResolverTarget as c}from"./context-paths.js";import{getPartialsFolders as l,isPartialPath as u}from"../../utils/partials.js";import{FRONTMATTER_BLOCK_RE as d,computeFrontmatterLineOffset as f}from"../../utils/frontmatter-offset.js";import{substituteStaticVariables as p}from"../../utils/substitute-variables.js";import{resolveMarkdocBuildTimeAttributes as m}from"../markdoc.js";import{join as h}from"node:path";async function g(o){let{node:s,attributeName:d}=o,f=s.attributes[d];if(typeof f!=`string`||f===``||o.io===void 0)return null;let p=c(o,f);if(p===null)return null;if(!u(p.contentPath,o.config)){let e=`Partial ${p.contentPath} must live in a partials folder (markdown.partialsFolders: ${l(o.config).join(`, `)})`;return r(s,e,o.sourceFilePath)}let m=n(o.sourceFilePath),g=[],v=m!==void 0&&n(p.contentPath)===void 0?`${e}/${m}/${p.contentPath}`:p.contentPath;if(!await o.io.exists(h(o.contentDir,v))){g.push({kind:`file`,path:v});let e=t(v);if(e!==void 0&&g.push({kind:`file`,path:e}),e===void 0||!await o.io.exists(h(o.contentDir,e))){let e=`Partial file ${p.contentPath} does not exist`;return r(s,e,o.sourceFilePath,g)}v=e}let y=o.partialChain??[o.sourceFilePath];if(y.includes(v))return i(s,`Circular partial inclusion: ${[...y,v].join(` -> `)}`),{entityDeps:[{kind:`file`,path:v}]};let b=await o.io.readFile(h(o.contentDir,v)),x=await _(o,v,b,y);s.children=x.ast.children;let S=[{entityDeps:g},x.result];if(m===void 0&&n(p.contentPath)===void 0){let t={},r=n(o.file.path);for(let n of o.markdown.contentLocales){let i=`${e}/${n}/${o.file.path}`;if(r===void 0&&S.push({entityDeps:[{kind:`file`,path:i}]}),r===void 0?o.markdown.hasPageRoute(i):n!==r)continue;let a=`${e}/${n}/${p.contentPath}`,s=h(o.contentDir,a);if(!await o.io.exists(s)){S.push({entityDeps:[{kind:`file`,path:a}]});continue}let c=await _(o,a,await o.io.readFile(s),y);t[n]=c.ast,S.push(c.result)}Object.keys(t).length>0&&(s.attributes[a]=t)}return{entityDeps:S.flatMap(e=>e.entityDeps??[]),assetUsages:S.flatMap(e=>e.assetUsages??[]),linkRefs:S.flatMap(e=>e.linkRefs??[]),problems:S.flatMap(e=>e.problems??[])}}async function _(e,t,n,r){let i=n.replace(d,``),a=structuredClone(e.markdown.parseCached(i)),o=await m(a,{tags:e.tags,sourceFilePath:t,resolverContext:{config:e.config,contentDir:e.contentDir,entities:e.entities,file:e.file,io:e.io,logger:e.logger,markdown:e.markdown,plugin:e.plugin},partialChain:[...r,t],source:i}),c=e.node.attributes.variables;typeof c==`object`&&c&&!Array.isArray(c)&&p(a,c);let l=f(n);return{ast:a,result:{entityDeps:[{kind:`file`,path:t},...o.entityDeps],assetUsages:o.assetUsages,linkRefs:s(o.linkRefs,t,l),problems:o.problems.map(e=>v(e,l))}}}function v(e,t){if(t===0||e.location?.range===void 0)return e;let n={...e.location,range:o(e.location.range,t)};return{...e,location:n}}export{g as resolvePartialFileAttribute};
@@ -1,7 +1,7 @@
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{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(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,i){if(!v(e)||e.type!==`heading`)return null;let o=a.transform(a.Ast.fromJSON(JSON.stringify(e)),{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: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,`
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
  ---
@@ -1 +1 @@
1
- import"../../../server/rbac/types.js";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=g(t)&&Array.isArray(t.children)?t.children:[],s=new e,c={title:i,body:[]},u=[],d=c,f=!1,p=[],_=e=>{let t=e.attributes?.id;return typeof t==`string`?t:s.slug(r(e,a))};for(let e of o){if(!g(e)||e.type!==`heading`){d.body.push(e);for(let t of h(e))_(t);continue}let t=r(e,a),n=_(e),o=m(e);if(o===1){!f&&t!==``&&(c.title=t,f=!0),d=c,p.length=0;continue}let s=t||i,l=p.slice(0,o).filter(e=>e!==void 0);p.length=o,p[o]=s;let v={anchor:n,title:s,ancestors:l,body:[]};u.push(v),d=v}let v=e=>n({type:`document`,children:e}),y=(e,t)=>[e,...l(t).map(({teams:t,children:n},r)=>({...e,docKey:`${e.docKey}-team-${r+1}`,text:v(n),rbacTeams:t})).filter(e=>e.text!==``)];return[...y({docKey:`page`,title:c.title,text:v(c.body)},c.body),...u.flatMap((e,t)=>y({docKey:`section-${t+1}`,anchor:e.anchor,title:e.title,text:v(e.body),path:[c.title,...e.ancestors,e.title]},e.body))]}function l(e){let n=[],r=(e,i)=>{if(g(e)&&!t(e)){if(e.type===`tag`&&e.tag===`if`){let t=u(e.attributes?.primary);if(t===void 0)return;let a=i===void 0?t:t.filter(e=>i.includes(e));if(a.length===0)return;let o=e.children??[],s=o.findIndex(e=>g(e)&&e.type===`tag`&&e.tag===`else`),c=s===-1?o:o.slice(0,s);n.push({teams:a,children:c});for(let e of c)r(e,a);return}for(let t of Object.values(e.slots??{}))r(t,i);for(let t of e.children??[])r(t,i)}};for(let t of e)r(t,void 0);return n}function u(e){if(!f(e))return;let t=Object.values(e.parameters??{});if(e.name===`includes`){let e=d(t);return e===void 0?void 0:[e]}if(e.name!==`or`)return;let n=t.map(e=>f(e)&&e.name===`includes`?d(Object.values(e.parameters??{})):void 0).filter(e=>e!==void 0);return n.length===0?void 0:n}function d([e,t]){let n=p(e,`Variable`)?e.path:void 0;return Array.isArray(n)&&n.length===2&&n[0]===`rbac`&&n[1]===`teams`&&typeof t==`string`&&t!==`*`?t:void 0}function f(e){return p(e,`Function`)}function p(e,t){return typeof e==`object`&&!!e&&e.$$mdtype===t}function m(e){let t=e.attributes?.level;return typeof t==`number`?t:2}function*h(e){if(!(!g(e)||a(e)||i(e))){for(let t of e.children??[])g(t)&&t.type===`heading`&&(yield t),yield*h(t);for(let t of Object.values(e.slots??{}))yield*h(t)}}function g(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}export{c as markdocAstToSearchSections,s as teamBlockSectionKey};
@@ -1 +1 @@
1
- import"../../../shared/constants/content-assets.js";import{isObject as e}from"../../../shared/utils/is-object.js";import{getPublicEnv as t}from"../../../shared/public-env.js";import{isPackedMarkdocAst as n,unpackMarkdocAst as r}from"../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:t(),frontmatter:b(n),lang:a}});e(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(t){return e(t)?u(e(t.frontmatter)?t.frontmatter:{},t.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
+ 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 +1 @@
1
- import{parseMarkdownCached as e}from"./utils/parse-cache.js";import{looksLikeMarkdown as t,resolveImageReference as n,resolveImageSrcSet as r,resolveLocalReference as i}from"./resolve/references.js";function a(a){return{disabledTags:a.disabledTags??/* @__PURE__ */ new Set,contentLocales:a.contentLocales??[],looksLikeMarkdown:t,parseCached:e,resolveLocalReference:(e,t,n)=>i(e,t,a.state,a.resolveAudienceTag,a.contentLocales,n),resolveImageReference:(e,t)=>n(e,t,a.state,a.resolveAudienceTag,a.contentLocales),resolveImageSrcSet:(e,t)=>r(e,t,a.state,a.resolveAudienceTag,a.contentLocales)}}export{a as createMarkdownService};
1
+ import{parseMarkdownCached as e}from"./utils/parse-cache.js";import{looksLikeMarkdown as t,resolveImageReference as n,resolveImageSrcSet as r,resolveLocalReference as i}from"./resolve/references.js";function a(a){return{disabledTags:a.disabledTags??/* @__PURE__ */ new Set,contentLocales:a.contentLocales??[],hasPageRoute:e=>a.state.primaryRouteByFilePath.has(e),looksLikeMarkdown:t,parseCached:e,resolveLocalReference:(e,t,n)=>i(e,t,a.state,a.resolveAudienceTag,a.contentLocales,n),resolveImageReference:(e,t)=>n(e,t,a.state,a.resolveAudienceTag,a.contentLocales),resolveImageSrcSet:(e,t)=>r(e,t,a.state,a.resolveAudienceTag,a.contentLocales)}}export{a as createMarkdownService};
@@ -1,3 +1,6 @@
1
1
  import { type Schema } from '@redocly/markdoc';
2
- /** Render vehicle for raw HTML in markdown: the parser's `htmlTags()` turns HTML into this tag. */
2
+ /**
3
+ * Render vehicle for raw HTML in markdown: the parser's `htmlTags()` turns HTML into this tag.
4
+ * An `<html>`, `<head>` or `<body>` element is a validation error and renders as its content.
5
+ */
3
6
  export declare const html: Schema;
@@ -1 +1 @@
1
- import e from"@redocly/markdoc";const t={a:`Link`,img:`Image`,script:`HtmlScript`},n={attributes:{name:{type:String,required:!0},attrs:{type:Object,buildTimeResolver:`htmlAttrs`}},transform(n,r){let i=String(n.attributes.name??``),a=n.attributes.attrs??{},o=n.transformChildren(r);return new e.Tag(t[i.toLowerCase()]??i,a,o)}};export{n 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:`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};
@@ -5,6 +5,8 @@ export type MarkdownService = {
5
5
  disabledTags: ReadonlySet<string>;
6
6
  /** Content locales whose `@l10n/<locale>/` twins a root source reports. */
7
7
  contentLocales: readonly string[];
8
+ /** Whether the content file at `path` has a page route. */
9
+ hasPageRoute(path: string): boolean;
8
10
  looksLikeMarkdown(value: string): boolean;
9
11
  parseCached(rawSource: string): ParsedMarkdown;
10
12
  /** `includingPagePath`: the page a partial source is inlined into. */
@@ -1 +1 @@
1
- import{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?.capture&&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{replaceAssetRefsForEntityTx as u,upsertAssetsTx as d}from"../database/assets.js";import{createProblem as f}from"../problems/codes.js";import{problemRow as p,replaceEntityProblemsExceptCodesTx as m}from"../database/problems.js";import{replaceLinkRefsForEntityTx as h,upsertTargetInventoryTx as g}from"../database/link-refs.js";import{detectMarkdocPayloadFlag as _}from"../markdown/server/render.js";import{buildL10nAssetMap as v,dedupeAssetUsages as y,reconcileAsset as b,removeReplacedAssetFiles as x}from"./asset-reconcile.js";import{cutEntityRevisionTx as S}from"../revisions/cut.js";import{replaceRouteQueryDepsTx as C}from"../database/route-query-deps.js";import{replaceEntityRuntimeDeps as w}from"../database/origins.js";import{SEARCH_PROBLEM_CODES as T}from"../problems/producers.js";import{and as E,eq as D}from"drizzle-orm";const O=/* @__PURE__ */ new WeakMap;async function k(e){let t=await A(e.database,e.key);if(!t)throw Error(`Entity "${e.key}" is not registered.`);if(t.kind===`inline`){if(t.data===null)throw Error(`Inline entity "${e.key}" is missing its stored data.`);return t.data}if(t.status===`ready`&&t.data!==null)return t.data;let n=O.get(e.database);n===void 0&&(n=/* @__PURE__ */ new Map,O.set(e.database,n));let r=n.get(e.key);if(r!==void 0)return r;let i=j(e,t);n.set(e.key,i);try{return await i}finally{n.delete(e.key)}}async function A(e,n){let[r]=await e.db.select({id:t.id,key:t.key,kind:t.kind,pluginId:t.pluginId,loaderId:t.loaderId,loaderArgs:t.loaderArgs,type:t.type,metadata:t.metadata,status:t.status,data:t.data,markdoc:t.markdoc,dataHash:t.dataHash,version:t.version,revisionCreatedAt:t.revisionCreatedAt,isSystem:t.isSystem,invalidationSeq:t.invalidationSeq}).from(t).where(E(D(t.key,n),D(t.isCurrent,1))).limit(1);return r}async function j(i,l){if(!l.loaderId)throw Error(`Entity "${i.key}" is missing its loader id.`);let O=i.loaderRegistry.getEntityLoaderById(l.loaderId);if(!O)throw Error(`Entity loader "${l.loaderId}" is not registered.`);let[k]=await i.database.db.select({path:r.path,fileId:r.id}).from(n).leftJoin(r,D(n.originFileId,r.id)).where(D(n.entityId,l.id)).limit(1);if(!k&&!l.isSystem)throw Error(`Entity "${i.key}" has no origin dependency.`);let A=i.loaderContextFactory(O,l.loaderArgs,k?.path??``),j;try{j=await O.definition.handler(A)}catch(e){throw await M(i,l.id,e),new c(`Entity "${i.key}" failed to load.`,{cause:e})}let P=JSON.stringify(j.value??null),F=JSON.parse(P),I=j.markdoc??_(P),L=I?v(j.assetUsages??[]):void 0,R=L?{...I,l10nAssets:L}:I,z=a(F),B=Array.from(new Set(z.map(e=>e.blobKey))),V=y(j.assetUsages??[]),{contentDir:H}=i,U=H?(await Promise.all(V.map(e=>b(A.io,{contentDir:H,usage:e})))).filter(e=>e!==null):[],W=[];return await i.database.db.transaction(async n=>{let r=Date.now(),a=e(F),c=(l.dataHash??null)!==a,_=l.revisionCreatedAt;if(c&&(_=Math.max(r,l.revisionCreatedAt+1)),(await n.update(t).set({status:`ready`,data:F,markdoc:R,type:j.type??l.type,metadata:j.metadata??l.metadata,dataHash:a,revisionCreatedAt:_}).where(E(D(t.id,l.id),D(t.invalidationSeq,l.invalidationSeq))).returning({id:t.id})).length===0)return;c&&l.data!==null&&i.revisions?.isTracked(k?.path??``)&&await S(n,{current:l,max:i.revisions.max});let v=A._trackedConfig;await N(n,l.id,v?.collectDependencies()??[]);let y=A._loadedEntityKeys,b=A._globPatterns;if((j.entityDeps!==void 0||y.length>0||b.length>0)&&await w(n,{entityId:l.id,originPluginId:O.pluginId,isSystem:!!l.isSystem,deps:[...j.entityDeps??[],...y.map(e=>({kind:`entity`,key:e})),...b.map(e=>({kind:`glob`,pattern:e}))]}),await C(n,{originPluginId:O.pluginId,hook:`loader`,entityId:l.id,dependencies:s(A._routeQueries)}),await m(n,l.id,T,(j.problems??[]).map(e=>p(f(e),{scope:`entity`,entityId:l.id}))),await o(n,{entityId:l.id,blobKeys:B}),W=await d(n,U),await u(n,{entityId:l.id,refs:V.map(({path:e,hash:t})=>({path:e,hash:t}))}),(j.linkRefs!==void 0||j.targetInventories!==void 0)&&k?.path&&(await h(n,{entityId:l.id,originFileId:k.fileId,originPluginId:O.pluginId,filePath:k.path,drafts:j.linkRefs??[]}),k.fileId!==null))for(let e of j.targetInventories??[])await g(n,{fileId:k.fileId,originPluginId:O.pluginId,draft:e})}),H&&W.length>0&&await x(A.io,{contentDir:H,filenames:W,logger:i.logger}),F}async function M(e,t,n){let r=n instanceof l?n.draft:{code:`plugin/loader-failed`,message:`Loader failed for entity "${e.key}": ${n instanceof Error?n.message:String(n)}`,data:{entityKey:e.key}};try{let n=p(f(r),{scope:`entity`,entityId:t});await e.database.db.transaction(async e=>{await m(e,t,T,[n])})}catch{}}async function N(e,t,n){await e.delete(i).where(D(i.entityId,t)),n.length!==0&&await e.insert(i).values(n.map(e=>({...e,entityId:t})))}export{k as materializeEntityByKey};
@@ -0,0 +1 @@
1
+ import{loadContentLayerConfig as e}from"../config.js";import{refreshStateEntity as t}from"../database/entity-store.js";import{loadContentLayerState as n}from"../context-state.js";import{createBuildTimeEntityLoaderContextFactory as r}from"../loaders/context.js";import{resolveRevisionCapture as i}from"../revisions/config.js";import{materializeEntityByKey as a}from"./entity.js";function o(e){let{deps:n,database:i,revisions:o}=e,s=async e=>{let r=await a({database:i,key:e,loaderRegistry:n.pluginRegistry,loaderContextFactory:c,contentDir:n.contentDir,revisions:o,logger:n.logger});return await t(i,n.state,e),r},c=r(n,i,s);return{state:n.state,materialize:s}}async function s(t){let{context:r,database:a}=t;await e({context:r});let s=await n({context:r,database:a});return o({deps:{...r,state:s},database:a,revisions:i(r.config,t.captureRevisions)})}export{o as createEntityMaterializer,s as loadEntityMaterializer};
@@ -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{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,t,n,o,c){let d=n.entityKey?await s(t,n.entityKey):null;if(!d||d.status!==`ready`&&!c)throw Error(`Static file "${n.path}": producer entity "${n.entityKey}" is not ready.`);let f=d.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:l(f,n),audience:o,write:async n=>e.writeFile(n,u(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)),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 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 d(r,t,e.write),i=(await r.stat(t))?.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=>r.unlink(f(a,...e.split(`/`))))),u.sort((t,n)=>e(t.path,n.path));let h={formatVersion:1,files:u};return await r.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};
@@ -3,8 +3,9 @@ import type { RealmConfig } from '../shared/types/config.js';
3
3
  import type { ProblemDraft } from './problems/types.js';
4
4
  /**
5
5
  * The config with the features that the plan in `PLAN_GATES` lacks turned off, as classic Realm
6
- * does, and the decisions under `planGates` for `isPlanFeatureGranted`. A plan claim the token
7
- * does not have denies its feature; a product gate claim it does not have is granted.
6
+ * does, the decisions under `planGates` for `isPlanFeatureGranted`, and the token's claims under
7
+ * `planClaims` for `isPlanClaimGranted`. A plan claim the token does not have denies its
8
+ * feature; a product gate claim it does not have is granted.
8
9
  * Without a token the config is returned unchanged. Reports each configured feature it turns
9
10
  * off to `warn`.
10
11
  */
@@ -1 +1 @@
1
- import{isAdvancedSearchEnabled as e}from"../shared/search/facets.js";import{isObject as t}from"../shared/utils/is-object.js";import{isAiHidden as n}from"../shared/ask-ai/config-gate.js";const r=[[`products`,`products`],[`catalogClassic`,`catalog`],[`catalogClassic`,`catalogClassic`],[`l10n`,`l10n`],[`apiFunctions`,`apiFunctions`],[`redirects`,`redirects`],[`banner`,`banner`]];function i(i,a,u){if(!a.PLAN_GATES)return i;let d=o(a.PLAN_GATES);d||u(`PLAN_GATES is not a token, so the features of the plan are off.`);let f=e=>!!d?.[e],p=e=>d?.[e]!==!1,m=d!==void 0&&!(`cookieConsent`in d),h={rbac:f(`rbac`),sso:f(`sso`),analytics:f(`analytics`),advancedSearch:f(`advancedSearch`),aiSearch:f(`aiSearchLimit`),mcp:f(`mcp`),mcpGateway:f(`mcpGateway`),cookieConsent:m||f(`cookieConsent`),removeAttribution:!d?.pricingTier||f(`removeAttribution`),products:p(`products`),catalogClassic:p(`catalogClassic`),l10n:p(`l10n`),apiFunctions:p(`apiFunctions`),mockServer:p(`mockServer`),seo:p(`seo`),redirects:p(`redirects`),breadcrumbs:p(`breadcrumbs`),banner:p(`banner`),codeWalkthrough:p(`codeWalkthrough`),customPlugins:p(`customPlugins`),markdown:p(`markdown`),openapi:p(`openapi`),asyncapi:p(`asyncapi`),graphql:p(`graphql`),reactPages:p(`reactPages`),soap:p(`soap`),customPackages:p(`customPackages`),customMarkdocTags:p(`customMarkdocTags`),customMcpTools:p(`customMcpTools`)},g=e=>u(`\`${e}\` is not in this project's plan and is ignored.`),_={...i,planGates:h};h.customPackages||(_.allowedPackages=l(d?.allowedPackages));for(let e of[`rbac`,`sso`]){if(h[e]||!t(_.access)||_.access[e]===void 0)continue;g(`access.${e}`);let{[e]:n,...r}=_.access;_.access=r}!h.analytics&&_.analytics!==void 0&&(g(`analytics`),delete _.analytics),!f(`removeAttribution`)&&_.removeAttribution!==void 0&&(_.removeAttribution===!0&&g(`removeAttribution`),delete _.removeAttribution);for(let[e,t]of r)h[e]||_[t]===void 0||(c(_[t])&&g(t),delete _[t]);if(!h.advancedSearch){let t=s(_.search);t.filters!==void 0&&e(i)&&g(`search.filters`),_.search={...t,filters:{...s(t.filters),hide:!0}}}if(h.aiSearch||((_.aiAssistant!==void 0||s(_.search).ai!==void 0)&&!n(i)&&g(`aiAssistant`),_.aiAssistant={...s(_.aiAssistant),hide:!0}),!h.mcp){let e=s(_.mcp);_.mcp!==void 0&&e.hide!==!0&&g(`mcp`),_.mcp={...e,hide:!0}}if(!h.mockServer){let e=s(_.mockServer);_.mockServer!==void 0&&e.off!==!0&&g(`mockServer`),_.mockServer={...e,off:!0}}if(!h.breadcrumbs){let e=s(_.breadcrumbs);_.breadcrumbs!==void 0&&e.hide!==!0&&g(`breadcrumbs`),_.breadcrumbs={...e,hide:!0}}return h.seo||(_.seo!==void 0&&g(`seo`),_.seo={llmstxt:{hide:!0}}),_.consent!==void 0&&m?u("The PLAN_GATES token has no cookieConsent claim, so `consent` stays on."):_.consent!==void 0&&!h.cookieConsent&&(u("`consent` is not in this project's plan and is ignored: analytics loads without consent."),delete _.consent),_}function a(e){return{code:`configuration/ignored`,message:`${e} are not in this project's plan, so this file is ignored.`}}function o(e){try{let n=(e.split(`.`)[1]??``).replace(/-/g,`+`).replace(/_/g,`/`),r=JSON.parse(atob(n));return t(r)?r:void 0}catch{return}}function s(e){return t(e)?e:{}}function c(e){return Array.isArray(e)?e.length>0:t(e)?Object.keys(e).length>0:e!==void 0}function l(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)?e:[]}export{i as applyPlanGates,a as notInPlanProblem};
1
+ import{isAdvancedSearchEnabled as e}from"../shared/search/facets.js";import{isObject as t}from"../shared/utils/is-object.js";import{isAiHidden as n}from"../shared/ask-ai/config-gate.js";const r=[[`products`,`products`],[`catalogClassic`,`catalog`],[`catalogClassic`,`catalogClassic`],[`l10n`,`l10n`],[`apiFunctions`,`apiFunctions`],[`redirects`,`redirects`],[`banner`,`banner`],[`devOnboarding`,`developerOnboarding`]];function i(i,a,u){if(!a.PLAN_GATES)return i;let d=o(a.PLAN_GATES);d||u(`PLAN_GATES is not a token, so the features of the plan are off.`);let f=e=>!!d?.[e],p=e=>d?.[e]!==!1,m=d!==void 0&&!(`cookieConsent`in d),h={rbac:f(`rbac`),sso:f(`sso`),analytics:f(`analytics`),advancedSearch:f(`advancedSearch`),aiSearch:f(`aiSearchLimit`),mcp:f(`mcp`),mcpGateway:f(`mcpGateway`),cookieConsent:m||f(`cookieConsent`),removeAttribution:!d?.pricingTier||f(`removeAttribution`),products:p(`products`),catalogClassic:p(`catalogClassic`),l10n:p(`l10n`),apiFunctions:p(`apiFunctions`),mockServer:p(`mockServer`),seo:p(`seo`),redirects:p(`redirects`),breadcrumbs:p(`breadcrumbs`),banner:p(`banner`),codeWalkthrough:p(`codeWalkthrough`),customPlugins:p(`customPlugins`),markdown:p(`markdown`),openapi:p(`openapi`),asyncapi:p(`asyncapi`),graphql:p(`graphql`),reactPages:p(`reactPages`),soap:p(`soap`),devOnboarding:p(`devOnboarding`),customPackages:p(`customPackages`),customMarkdocTags:p(`customMarkdocTags`),customMcpTools:p(`customMcpTools`)},g=e=>u(`\`${e}\` is not in this project's plan and is ignored.`),_={...i,planGates:h,planClaims:d??{}};h.customPackages||(_.allowedPackages=l(d?.allowedPackages));for(let e of[`rbac`,`sso`]){if(h[e]||!t(_.access)||_.access[e]===void 0)continue;g(`access.${e}`);let{[e]:n,...r}=_.access;_.access=r}!h.analytics&&_.analytics!==void 0&&(g(`analytics`),delete _.analytics),!f(`removeAttribution`)&&_.removeAttribution!==void 0&&(_.removeAttribution===!0&&g(`removeAttribution`),delete _.removeAttribution);for(let[e,t]of r)h[e]||_[t]===void 0||(c(_[t])&&g(t),delete _[t]);if(!h.advancedSearch){let t=s(_.search);t.filters!==void 0&&e(i)&&g(`search.filters`),_.search={...t,filters:{...s(t.filters),hide:!0}}}if(h.aiSearch||((_.aiAssistant!==void 0||s(_.search).ai!==void 0)&&!n(i)&&g(`aiAssistant`),_.aiAssistant={...s(_.aiAssistant),hide:!0}),!h.mcp){let e=s(_.mcp);_.mcp!==void 0&&e.hide!==!0&&g(`mcp`),_.mcp={...e,hide:!0}}if(!h.mockServer){let e=s(_.mockServer);_.mockServer!==void 0&&e.off!==!0&&g(`mockServer`),_.mockServer={...e,off:!0}}if(!h.breadcrumbs){let e=s(_.breadcrumbs);_.breadcrumbs!==void 0&&e.hide!==!0&&g(`breadcrumbs`),_.breadcrumbs={...e,hide:!0}}return h.seo||(_.seo!==void 0&&g(`seo`),_.seo={llmstxt:{hide:!0}}),_.consent!==void 0&&m?u("The PLAN_GATES token has no cookieConsent claim, so `consent` stays on."):_.consent!==void 0&&!h.cookieConsent&&(u("`consent` is not in this project's plan and is ignored: analytics loads without consent."),delete _.consent),_}function a(e){return{code:`configuration/ignored`,message:`${e} are not in this project's plan, so this file is ignored.`}}function o(e){try{let n=(e.split(`.`)[1]??``).replace(/-/g,`+`).replace(/_/g,`/`),r=JSON.parse(atob(n));return t(r)?r:void 0}catch{return}}function s(e){return t(e)?e:{}}function c(e){return Array.isArray(e)?e.length>0:t(e)?Object.keys(e).length>0:e!==void 0}function l(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)?e:[]}export{i as applyPlanGates,a as notInPlanProblem};
@@ -1 +1 @@
1
- import{defineContentPlugin as e}from"./define.js";import{ENTITY_LOADER_REFERENCE_KIND as t,INLINE_ENTITY_REFERENCE_KIND as n,createEntityLoader as r,createInlineEntity as i,createInlineEntityReference as a,isEntityLoaderReference as o,isInlineEntityReference as s,isRawEntityReference as c}from"../loaders/define.js";import{resolveRuntimeFilePath as l,runtimeFile as u}from"./utils/runtime-file.js";import{SERVER_FN_REFERENCE_KIND as d,STORED_ENTITY_REFERENCE_KIND as f,createServerFn as p,createStoredEntityReference as m,getRegisteredServerFnLoader as h,isServerFnReference as g,normalizeServerFnId as _,resolveServerModuleReference as v}from"./server-fn.js";import{createPluginScopedId as y}from"./utils/scoped-id.js";import{runtimeTemplate as b}from"./templates.js";import{createContentPluginIO as 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{MOCK_SERVER_ROUTE_PREFIX as B,SPEC_KIND_ARAZZO as V,SPEC_KIND_ASYNCAPI as H,SPEC_KIND_GRAPHQL as U,SPEC_KIND_OPENAPI 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"./internal/api-functions/constants.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,B 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,V as SPEC_KIND_ARAZZO,H as SPEC_KIND_ASYNCAPI,U as SPEC_KIND_GRAPHQL,W 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
+ 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,7 +1,7 @@
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{MarkdocRenderer as s,markdocComponents as c}from"../../../../markdown/client/markdoc-components.js";import{rebaseItemLinks as l}from"./rebase-item-links.js";import{apiDocsTelemetryConfig as u}from"../../../../../client/telemetry/config.js";import{withReplayOptions as d}from"../../../../../client/replay-options.js";import{JsonSchemaTag as f}from"../../../../markdown/client/JsonSchemaTag.js";import{JsonExample as p}from"../../../../markdown/client/OpenapiTagComponents.js";import{withEventHandlers as m}from"./event-handlers.js";import{useContext as h,useEffect as g,useMemo as _}from"react";import{useLocation as v}from"react-router";import{Fragment as y,jsx as b,jsxs as x}from"react/jsx-runtime";import S from"styled-components";import{useThemeConfig as C}from"@redocly/theme/core/hooks";import{LayoutVariant as w}from"@redocly/theme/components/SidebarActions/SidebarActions";import{useLoaderData as T}from"virtual:realm-runtime";import{userMarkdocComponents as E}from"virtual:realm-markdoc-components";import{RedoclyApiDocs as D,apiDocsMarkdocComponents as O}from"@redocly/api-docs";import{Breadcrumbs as k}from"@redocly/theme/components/Breadcrumbs/Breadcrumbs";import{CatalogClassicInfoBlock as A}from"@redocly/theme/components/CatalogClassic/CatalogClassicInfoBlock";import{MissingTranslationNotice as j}from"@redocly/theme/components/MissingTranslationNotice/MissingTranslationNotice";import{ThreePanelLayout as M}from"@redocly/theme/layouts/ThreePanelLayout";const N={...c,JsonSchema:E.JsonSchema??f,JsonExample:E.JsonExample??p,...O},P={parse:e=>e,render:e=>/* @__PURE__ */ b(s,{ast:e,components:N})},F={MiddlePanelHeader:I};function I(){return/* @__PURE__ */ x(y,{children:[/* @__PURE__ */ b(k,{}),/* @__PURE__ */ b(V,{})]})}function L(e){return(e.length>1&&e.endsWith(`/`)?e.slice(0,-1):e).toLowerCase()}function R({page:e}){let t=T(r),i=T(n),{layout:o}=h(a),s=z(),c=_(()=>t&&{...m(d(t.options)),oAuth2RedirectURI:B(),userClaims:s,unstable_hooks:F},[t,s]),f=e.slug.toLowerCase(),p=_(()=>t&&t.basePath!==f?l(t.items,t.basePath,f):t?.items,[t,f]);if(U(e.metadata,p,t?.title),!t)return null;let g=u();return/* @__PURE__ */ x(y,{children:[i&&/* @__PURE__ */ b(H,{layout:o,children:/* @__PURE__ */ b(A,{metadata:i})}),/* @__PURE__ */ b(D,{items:p,store:t.store,options:c,basePath:f,layout:o,markdownAdapter:P,telemetryConfig:g})]})}function z(){let e=h(o)?.auth?.userInfo,t=e?.isAuthenticated?e.email:void 0,n=e?.isAuthenticated?e.name:void 0;return _(()=>({email:t,name:n}),[t,n])}function B(){if(typeof window<`u`)return new URL(t(e),window.location.origin).toString()}const V=S(j)`
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{MarkdocRenderer 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(U,{})]})}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(G(e.metadata,v,t?.title),!t)return null;let b=f();return/* @__PURE__ */ w(S,{children:[i&&/* @__PURE__ */ C(W,{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(N)`
2
2
  width: 100%;
3
- `,H=S(M)`
3
+ `,W=b(P)`
4
4
  && {
5
- padding-right: ${({layout:e})=>e===w.THREE_PANEL?`calc(var(--panel-gap-horizontal) * 2)`:`var(--panel-gap-horizontal)`};
5
+ padding-right: ${({layout:e})=>e===E.THREE_PANEL?`calc(var(--panel-gap-horizontal) * 2)`:`var(--panel-gap-horizontal)`};
6
6
  }
7
- `;function U(e,t,n){let{pathname:r}=v(),{seo:a}=C(),o=a?.projectTitle,s=t?i(e,t,L(r),n):void 0;g(()=>{s&&(document.title=o?`${s} | ${o}`:s)},[s,o])}export{R as default};
7
+ `;function G(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{toPosixPath as d}from"../../../../shared/utils/to-posix-path.js";import{TRANSLATIONS_FILE_PATTERN as f}from"../../../../shared/constants/l10n/defaults.js";import{isObject as p}from"../../../../shared/utils/is-object.js";import{notInPlanProblem as m}from"../../../plan-gates.js";import{filePathToRouteSlug as h}from"../../../../shared/utils/routes/file-path-to-route-slug.js";import{SPEC_KIND_ARAZZO as g,SPEC_KIND_ASYNCAPI as _,SPEC_KIND_GRAPHQL as v,SPEC_KIND_OPENAPI as y}from"../../types/api-entity.js";import{isPlanFeatureGranted as b}from"../../../../shared/plan-gates.js";import{packMarkdocAstsDeep as x,unpackMarkdocAstsDeep as S}from"../../../markdown/utils/packed-ast.js";import{parseMarkdownCached as C}from"../../../markdown/utils/parse-cache.js";import{createApiEntityKey as w}from"../../utils/api-entity-key.js";import{API_DOCS_API_LOADER_ID as T,API_DOCS_PLUGIN_ID as ee,API_DOCS_RENDER_DEP_KEY as E,API_DOCS_RENDER_LOADER_ID as D,API_DOCS_SIDEBAR_LOADER_ID as te,API_DOCS_TEMPLATE_ID as O,SPEC_DOWNLOAD_ROUTE_PATHS as k,SPEC_PATH_PARAM as ne}from"./server/shared.js";import{resolveApiBundleConfig as re,resolveApiOptions as ie,resolveNestedFeedback as ae,schemaCatalogLink as oe,withDownloadUrls as se,withFeedbackOption as ce,withMockServerOption as le}from"./server/options.js";import{annotateApiDocsRbac as ue}from"../../../../server/rbac/api-docs.js";import{SERVER_ONLY_VALUE_KEY as A}from"../../../loaders/server-only-value.js";import{getLoadedProjectPlugins as de}from"../../project/loaded-set.js";import{API_OUTPUT_MANIFEST_KEY as j}from"../../../api-outputs.js";import{API_DOCS_MARKDOC_TAG_SET as M,resolveMarkdocTagSet as N}from"../../../markdown/constants/tag-sets.js";import{pageLocale as P}from"../../utils/page-locale.js";import{buildBundledApiDefinition as F,resolveLlmsDescriptions as I}from"./server/build-definition.js";import{collectSidebarSubpathTargets as L,toSidebarSubtree as R,toSubpathTarget as z}from"./server/build-sidebar.js";import{buildApiDocsMarkdownDocs as B}from"./server/markdown-docs.js";import{join as V,relative as H}from"node:path";import fe from"@redocly/markdoc";const pe=[`.yaml`,`.yml`,`.json`,`.gql`,`.graphql`],me={[y]:`OpenAPI`,[_]:`AsyncAPI`,[v]:`GraphQL`,[g]:`Arazzo`},U=t(D,async e=>{let{buildItems:t}=await import(`@redocly/api-docs`),n=K(e),r=await e.io.readFile(n.absolutePath),i=e.routes.byFilePath(e.file.path)?.slug,a=se(e.args.options,e.file.path,e.args.kind),o=e.args.kind===`openapi`?le(a,e.config,i):a,s={entityDeps:[],assetUsages:[],linkRefs:[],problems:[],pending:[]},c=G(e.contentDir),l={markdown:e.markdown,loader:{config:e.config,entities:e.entities,file:e.file,io:e.io,logger:e.logger,plugin:e.plugin},sink:s},u=await F({kind:e.args.kind,source:r,relativePath:n.relativePath,contentDir:e.contentDir,pagePath:e.file.path,options:o,bundle:q(e.args,c),metadata:X(e.args.options),markdownResolution:l,rbac:{warn:t=>e.logger?.warn(t)}}),d={...p(u.document)&&p(u.document.info)?{infoDescription:u.document.info.description}:{},...await I(u.document,l,{contentDir:e.contentDir,specPath:n.relativePath,pagePath:e.file.path})};e.args.kind===`openapi`&&o.showSchemaCatalogLinks&&p(u.document)&&(u.document[`x-schema-catalog-link`]=oe(e.file.path)),u.options=ce(u.options,u.document,e.args.feedback??e.config.feedback);let f=i?.toLowerCase()??`/`,{items:m,store:h,specType:g}=await t({...u,basePath:f,markdownParser:e=>fe.compact(C(e))}),_=JSON.stringify({items:x(m),store:x(h),options:u.options,specType:g,basePath:f,title:be(u.document,e.args.kind,m),metadata:ye(u.document),[A]:{llms:d}});return{value:await e.createBlobRef(_,{format:`json`}),entityDeps:[...Y(e.file.path,[...u.fileDependencies,...c.paths]),...s.entityDeps],assetUsages:s.assetUsages,markdoc:{tagSet:M},linkRefs:s.linkRefs,problems:s.problems}},{async searchable(e,t){if(t.route===void 0||t.route.metadata.excludeFromSearch===!0)return{docs:[]};let n=S(e),r=await Ee(t.entities,t.route.originFilePath),d={...t.route.metadata,...p(n.metadata)?n.metadata:{}},{category:f,isInvalid:m}=u(d),{facets:h,invalidFields:g}=c({[i]:t.route.metadata.title,[a]:t.route.metadata.version,...d},s(t.config)),{buildApiDocsSearchDocuments:_}=await import(`./server/search-documents.js`);return{..._(n,r,{groupKey:f,facets:h,warn:e=>t.logger?.warn(e)}),problems:l([...g,...m?[o]:[]],t.route.originFilePath)}},async markdown(e,t){if(t.route===void 0)return null;let n=S(e),r=t.route.originFilePath??void 0,i=r?await t.entities.load(w(r)).catch(()=>void 0):void 0,{tags:a}=await N(M);return B(n,ve(i,n[A]?.llms),r,{tags:a,locale:P(t)})},usesProjectMarkdocSchema:!0}),W=t(T,async e=>{let t=K(e),n=await e.io.readFile(t.absolutePath),r=G(e.contentDir),i=await F({kind:e.args.kind,source:n,relativePath:t.relativePath,contentDir:e.contentDir,bundle:q(e.args,r),metadata:X(e.args.options)}),a=e.args.kind===v,o=a?n:JSON.stringify(i.document);return{value:o.length>65536?await e.createBlobRef(o,{format:a?`text`:`json`}):a?n:i.document,metadata:{...Z(e.file.path,e.args.kind,e.args.options,e.args.rbac),...ge(i.document,e.routes.byFilePath(e.file.path)?.slug)},entityDeps:Y(e.file.path,[...i.fileDependencies,...r.paths])}});function G(e){let t=de(e)?.lintPlugins??[];return{plugins:t,paths:t.map(t=>d(H(e,t.path))).filter(e=>e!==``&&!e.startsWith(`../`))}}function K(e){let t=e.args.source?.path??e.file.path;return{relativePath:t,absolutePath:V(e.contentDir,t)}}function he(e){let t=e[j];return p(t)&&typeof t.root==`string`?t.root:void 0}function q(e,t){let{config:n,configDir:r}=e.bundleConfig??{config:{},configDir:``};return{config:n,configDir:r,plugins:t.plugins}}function ge(e,t){let n=p(e)&&p(e.info)?e.info:{},r=p(n[`x-metadata`])?n[`x-metadata`]:{},i=typeof n.description==`string`?n.description.trim():``;return{...t===void 0?{}:{routeSlug:t},...Q(n.version)?{version:String(n.version)}:{},...typeof r.apiId==`string`?{apiId:r.apiId}:{},description:i||void 0}}const J=t(te,async e=>{let{buildNavItems:t,collectPreviousRouteSlugs:n}=await import(`@redocly/api-docs`),r=await e.entities.load(w(e.file.path)),i=e.args.kind===`graphql`?(await import(`graphql`)).parse(r):r,a=ue(i,e.args.kind,{warn:t=>e.logger?.warn(t)}),{items:o}=await t({type:e.args.kind,document:a,options:e.args.options,basePath:`/`,markdownParser:C}),s=R(o),c=n(o).map(({from:e})=>z(e));return{value:s,targetInventories:[{kind:`subpath`,exhaustive:!0,targets:[...L(s),...c]}]}});function Y(e,t){return[{kind:`file`,path:e},...t.map(e=>({kind:`file`,path:e}))]}const _e={arazzo:`Arazzo Docs`,asyncapi:`AsyncAPI Docs`,graphql:`GraphQL Docs`,openapi:`OpenAPI Docs`};function ve(e,t){if(t===void 0||!p(e))return e;let n=p(e.info)?e.info:{},r=p(e.components)?e.components:{};return{...e,...t.infoDescription===void 0?{}:{info:{...n,description:t.infoDescription}},...t.servers===void 0?{}:{servers:t.servers},...t.securitySchemes===void 0?{}:{components:{...r,securitySchemes:t.securitySchemes}}}}function ye(e){let t=p(e)&&p(e.info)?e.info:{};return p(t[`x-metadata`])?t[`x-metadata`]:{}}function be(e,t,n){let r=p(e)&&p(e.info)?e.info:{};if(typeof r.title==`string`&&r.title!==``)return r.title;let i=p(n[0])?n[0].label:void 0;return typeof i==`string`&&i!==``?i:_e[t]}const xe=[`rbac`,`sidebar`,`excludeFromSearch`,`template`];function Se(e,t){let n=p(e.manifest.info)?e.manifest.info:{},r={};typeof n.title==`string`&&(r.title=n.title),Q(n.version)&&(r.version=String(n.version)),typeof n.summary==`string`&&(r.summary=n.summary),p(n[`x-metadata`])&&Object.assign(r,n[`x-metadata`]),p(t.metadata)&&Object.assign(r,t.metadata);for(let e of xe)delete r[e];return r}function X(e){return p(e.metadata)?e.metadata:void 0}function Ce(e){let t=X(e)?.title;return typeof t==`string`&&t.length>0?t:void 0}function Z(e,t,n,r){let i=Ce(n);return{specType:t,sourcePath:e,...i===void 0?{}:{title:i},...r===void 0?{}:{rbac:r},...Object.keys(n).length>0?{options:n}:{},...p(n.mockServer)?{mockServer:n.mockServer}:{}}}function Q(e){return typeof e==`string`||typeof e==`number`}function we(e){if(e.ext===`.gql`||e.ext===`.graphql`)return v;let{openapi:t,swagger:n,asyncapi:r,arazzo:i}=e.manifest;return Q(t)||Q(n)?y:Q(r)?_:Q(i)?g:null}const Te=e({id:ee,version:`0.44.0`,content:{filter:{extensions:pe},async extractFile(e,t){if(f.test(e.path))return null;let n=we(e);if(n===null)return null;if(n!==`arazzo`&&!b(t.config,n))return{routes:[],problems:[m(`${me[n]} documents`)]};let r=e.path,i=he(e.manifest),a=i??r,{rbac:o,...s}=await ie(t.io,t.config,r,n,a),c={filePath:r,kind:n,options:s,...o===void 0||!b(t.config,`rbac`)?{}:{rbac:o}};i!==void 0&&(c.source={path:i});let l=await ae(t.io,t.config,a);if(l!==void 0&&(c.feedback=l),n!==`graphql`){let e=await re(t.io,t.config,r,a);Object.keys(e.config).length>0&&(c.bundleConfig=e)}let u=W.withArgs(c,{stableKey:w(r),type:`api`,metadata:Z(r,n,s,c.rbac)});if(n===`arazzo`)return{routes:[],entities:[u]};let d=Se(e,s);s.excludeFromSearch===!0&&(d.excludeFromSearch=!0),d.type=n,c.rbac!==void 0&&(d.rbac=c.rbac);let p=U.withArgs(c,{stableKey:`api-docs:render:${r}`}),g=J.withArgs(c,{stableKey:`api-docs:sidebar:${r}`}),_=h(r);return{routes:[{deps:{[E]:p},metadata:d,routeId:`page`,sidebarSubtree:g,slug:null,slugHint:_,template:O,wildcardPrefix:!0}],entities:[u,p,g]}}},loaders:[W,U,J],templates:{[O]:r(n(`./client/template.tsx`,import.meta.url))},server:{routes:[$(k.bundle,`bundle`),$(k.deprecatedBundle,`bundle`),$(k.graphql,`graphql`)]}});function $(e,t){return{method:`GET`,path:e+ne,handler:{filePath:`./server/spec-download.ts`,importer:import.meta.url,exportName:t}}}async function Ee(e,t){if(t)try{return await e.load(w(t))}catch{return}}export{Te as apiDocsContentPlugin};
1
+ import{defineContentPlugin as e}from"../../define.js";import{createEntityLoader as t}from"../../../loaders/define.js";import{runtimeFile as n}from"../../utils/runtime-file.js";import{runtimeTemplate as r}from"../../templates.js";import{SEARCH_API_TITLE_FACET_FIELD as i,SEARCH_API_VERSION_FACET_FIELD as a,SEARCH_GROUP_FACET_FIELD as o}from"../../../../shared/search/facets.js";import{configuredFacetFields as s,extractFacetsFromFrontmatter as c,invalidFacetValueProblems as l,searchCategoryOf as u}from"../../../search/facet-values.js";import{isPlanFeatureGranted as d}from"../../../../shared/plan-gates.js";import{toPosixPath as f}from"../../../../shared/utils/to-posix-path.js";import{TRANSLATIONS_FILE_PATTERN as p}from"../../../../shared/constants/l10n/defaults.js";import{isObject as m}from"../../../../shared/utils/is-object.js";import{notInPlanProblem as h}from"../../../plan-gates.js";import{filePathToRouteSlug as g}from"../../../../shared/utils/routes/file-path-to-route-slug.js";import{SPEC_KIND_ARAZZO as _,SPEC_KIND_ASYNCAPI as v,SPEC_KIND_GRAPHQL as y,SPEC_KIND_OPENAPI as b}from"../../../../shared/constants/api-spec-kinds.js";import{packMarkdocAstsDeep as x,unpackMarkdocAstsDeep as S}from"../../../../shared/utils/packed-ast.js";import{parseMarkdownCached as C}from"../../../markdown/utils/parse-cache.js";import{createApiEntityKey as w}from"../../utils/api-entity-key.js";import{API_DOCS_API_LOADER_ID as ee,API_DOCS_PLUGIN_ID as T,API_DOCS_RENDER_DEP_KEY as te,API_DOCS_RENDER_LOADER_ID as ne,API_DOCS_SIDEBAR_LOADER_ID as E,API_DOCS_TEMPLATE_ID as D,SPEC_DOWNLOAD_ROUTE_PATHS as O,SPEC_PATH_PARAM as k}from"./server/shared.js";import{resolveApiBundleConfig as re,resolveApiOptions as ie,resolveNestedFeedback as ae,schemaCatalogLink as oe,withDownloadUrls as se,withFeedbackOption as ce,withMockServerOption as le}from"./server/options.js";import{annotateApiDocsRbac as ue}from"../../../../shared/rbac/api-docs.js";import{SERVER_ONLY_VALUE_KEY as A}from"../../../loaders/server-only-value.js";import{getLoadedProjectPlugins as de}from"../../project/loaded-set.js";import{API_OUTPUT_MANIFEST_KEY as j}from"../../../api-outputs.js";import{API_DOCS_MARKDOC_TAG_SET as M,resolveMarkdocTagSet as N}from"../../../markdown/constants/tag-sets.js";import{pageLocale as P}from"../../utils/page-locale.js";import{buildBundledApiDefinition as F,resolveLlmsDescriptions as I}from"./server/build-definition.js";import{collectSidebarSubpathTargets as L,toSidebarSubtree as R,toSubpathTarget as z}from"./server/build-sidebar.js";import{buildApiDocsMarkdownDocs as B}from"./server/markdown-docs.js";import{join as V,relative as H}from"node:path";import fe from"@redocly/markdoc";const pe=[`.yaml`,`.yml`,`.json`,`.gql`,`.graphql`],me={[b]:`OpenAPI`,[v]:`AsyncAPI`,[y]:`GraphQL`,[_]:`Arazzo`},U=t(ne,async e=>{let{buildItems:t}=await import(`@redocly/api-docs/server`),n=K(e),r=await e.io.readFile(n.absolutePath),i=e.routes.byFilePath(e.file.path)?.slug,a=se(e.args.options,e.file.path,e.args.kind),o=e.args.kind===`openapi`?le(a,e.config,i):a,s={entityDeps:[],assetUsages:[],linkRefs:[],problems:[],pending:[]},c=G(e.contentDir),l={markdown:e.markdown,loader:{config:e.config,entities:e.entities,file:e.file,io:e.io,logger:e.logger,plugin:e.plugin},sink:s},u=await F({kind:e.args.kind,source:r,relativePath:n.relativePath,contentDir:e.contentDir,pagePath:e.file.path,options:o,bundle:q(e.args,c),metadata:X(e.args.options),markdownResolution:l,rbac:{warn:t=>e.logger?.warn(t)}}),d={...m(u.document)&&m(u.document.info)?{infoDescription:u.document.info.description}:{},...await I(u.document,l,{contentDir:e.contentDir,specPath:n.relativePath,pagePath:e.file.path})};e.args.kind===`openapi`&&o.showSchemaCatalogLinks&&m(u.document)&&(u.document[`x-schema-catalog-link`]=oe(e.file.path)),u.options=ce(u.options,u.document,e.args.feedback??e.config.feedback);let f=i?.toLowerCase()??`/`,{items:p,store:h,specType:g}=await t({...u,basePath:f,markdownParser:e=>fe.compact(C(e))}),_=JSON.stringify({items:x(p),store:x(h),options:u.options,specType:g,basePath:f,title:be(u.document,e.args.kind,p),metadata:ye(u.document),[A]:{llms:d}});return{value:await e.createBlobRef(_,{format:`json`}),entityDeps:[...Y(e.file.path,[...u.fileDependencies,...c.paths]),...s.entityDeps],assetUsages:s.assetUsages,markdoc:{tagSet:M},linkRefs:s.linkRefs,problems:s.problems}},{async searchable(e,t){if(t.route===void 0||t.route.metadata.excludeFromSearch===!0)return{docs:[]};let n=S(e),r=await Ee(t.entities,t.route.originFilePath),d={...t.route.metadata,...m(n.metadata)?n.metadata:{}},{category:f,isInvalid:p}=u(d),{facets:h,invalidFields:g}=c({[i]:t.route.metadata.title,[a]:t.route.metadata.version,...d},s(t.config)),{buildApiDocsSearchDocuments:_}=await import(`./server/search-documents.js`);return{..._(n,r,{groupKey:f,facets:h,warn:e=>t.logger?.warn(e)}),problems:l([...g,...p?[o]:[]],t.route.originFilePath)}},async markdown(e,t){if(t.route===void 0)return null;let n=S(e),r=t.route.originFilePath??void 0,i=r?await t.entities.load(w(r)).catch(()=>void 0):void 0,{tags:a}=await N(M);return B(n,ve(i,n[A]?.llms),r,{tags:a,locale:P(t)})},usesProjectMarkdocSchema:!0}),W=t(ee,async e=>{let t=K(e),n=await e.io.readFile(t.absolutePath),r=G(e.contentDir),i=await F({kind:e.args.kind,source:n,relativePath:t.relativePath,contentDir:e.contentDir,bundle:q(e.args,r),metadata:X(e.args.options)}),a=e.args.kind===y,o=a?n:JSON.stringify(i.document);return{value:o.length>65536?await e.createBlobRef(o,{format:a?`text`:`json`}):a?n:i.document,metadata:{...Z(e.file.path,e.args.kind,e.args.options,e.args.rbac),...ge(i.document,e.routes.byFilePath(e.file.path)?.slug)},entityDeps:Y(e.file.path,[...i.fileDependencies,...r.paths])}});function G(e){let t=de(e)?.lintPlugins??[];return{plugins:t,paths:t.map(t=>f(H(e,t.path))).filter(e=>e!==``&&!e.startsWith(`../`))}}function K(e){let t=e.args.source?.path??e.file.path;return{relativePath:t,absolutePath:V(e.contentDir,t)}}function he(e){let t=e[j];return m(t)&&typeof t.root==`string`?t.root:void 0}function q(e,t){let{config:n,configDir:r}=e.bundleConfig??{config:{},configDir:``};return{config:n,configDir:r,plugins:t.plugins}}function ge(e,t){let n=m(e)&&m(e.info)?e.info:{},r=m(n[`x-metadata`])?n[`x-metadata`]:{},i=typeof n.description==`string`?n.description.trim():``;return{...t===void 0?{}:{routeSlug:t},...Q(n.version)?{version:String(n.version)}:{},...typeof r.apiId==`string`?{apiId:r.apiId}:{},description:i||void 0}}const J=t(E,async e=>{let{buildNavItems:t,collectPreviousRouteSlugs:n}=await import(`@redocly/api-docs/server`),r=await e.entities.load(w(e.file.path)),i=e.args.kind===`graphql`?(await import(`graphql`)).parse(r):r,a=ue(i,e.args.kind,{warn:t=>e.logger?.warn(t)}),{items:o}=await t({type:e.args.kind,document:a,options:e.args.options,basePath:`/`,markdownParser:C}),s=R(o),c=n(o).map(({from:e})=>z(e));return{value:s,targetInventories:[{kind:`subpath`,exhaustive:!0,targets:[...L(s),...c]}]}});function Y(e,t){return[{kind:`file`,path:e},...t.map(e=>({kind:`file`,path:e}))]}const _e={arazzo:`Arazzo Docs`,asyncapi:`AsyncAPI Docs`,graphql:`GraphQL Docs`,openapi:`OpenAPI Docs`};function ve(e,t){if(t===void 0||!m(e))return e;let n=m(e.info)?e.info:{},r=m(e.components)?e.components:{};return{...e,...t.infoDescription===void 0?{}:{info:{...n,description:t.infoDescription}},...t.servers===void 0?{}:{servers:t.servers},...t.securitySchemes===void 0?{}:{components:{...r,securitySchemes:t.securitySchemes}}}}function ye(e){let t=m(e)&&m(e.info)?e.info:{};return m(t[`x-metadata`])?t[`x-metadata`]:{}}function be(e,t,n){let r=m(e)&&m(e.info)?e.info:{};if(typeof r.title==`string`&&r.title!==``)return r.title;let i=m(n[0])?n[0].label:void 0;return typeof i==`string`&&i!==``?i:_e[t]}const xe=[`rbac`,`sidebar`,`excludeFromSearch`,`template`];function Se(e,t){let n=m(e.manifest.info)?e.manifest.info:{},r={};typeof n.title==`string`&&(r.title=n.title),Q(n.version)&&(r.version=String(n.version)),typeof n.summary==`string`&&(r.summary=n.summary),m(n[`x-metadata`])&&Object.assign(r,n[`x-metadata`]),m(t.metadata)&&Object.assign(r,t.metadata);for(let e of xe)delete r[e];return r}function X(e){return m(e.metadata)?e.metadata:void 0}function Ce(e){let t=X(e)?.title;return typeof t==`string`&&t.length>0?t:void 0}function Z(e,t,n,r){let i=Ce(n);return{specType:t,sourcePath:e,...i===void 0?{}:{title:i},...r===void 0?{}:{rbac:r},...Object.keys(n).length>0?{options:n}:{},...m(n.mockServer)?{mockServer:n.mockServer}:{}}}function Q(e){return typeof e==`string`||typeof e==`number`}function we(e){if(e.ext===`.gql`||e.ext===`.graphql`)return y;let{openapi:t,swagger:n,asyncapi:r,arazzo:i}=e.manifest;return Q(t)||Q(n)?b:Q(r)?v:Q(i)?_:null}const Te=e({id:T,version:`0.45.0`,content:{filter:{extensions:pe},async extractFile(e,t){if(p.test(e.path))return null;let n=we(e);if(n===null)return null;if(n!==`arazzo`&&!d(t.config,n))return{routes:[],problems:[h(`${me[n]} documents`)]};let r=e.path,i=he(e.manifest),a=i??r,{rbac:o,...s}=await ie(t.io,t.config,r,n,a),c={filePath:r,kind:n,options:s,...o===void 0||!d(t.config,`rbac`)?{}:{rbac:o}};i!==void 0&&(c.source={path:i});let l=await ae(t.io,t.config,a);if(l!==void 0&&(c.feedback=l),n!==`graphql`){let e=await re(t.io,t.config,r,a);Object.keys(e.config).length>0&&(c.bundleConfig=e)}let u=W.withArgs(c,{stableKey:w(r),type:`api`,metadata:Z(r,n,s,c.rbac)});if(n===`arazzo`)return{routes:[],entities:[u]};let f=Se(e,s);s.excludeFromSearch===!0&&(f.excludeFromSearch=!0),f.type=n,c.rbac!==void 0&&(f.rbac=c.rbac);let m=U.withArgs(c,{stableKey:`api-docs:render:${r}`}),_=J.withArgs(c,{stableKey:`api-docs:sidebar:${r}`}),v=g(r);return{routes:[{deps:{[te]:m},metadata:f,routeId:`page`,sidebarSubtree:_,slug:null,slugHint:v,template:D,wildcardPrefix:!0}],entities:[u,m,_]}}},loaders:[W,U,J],templates:{[D]:r(n(`./client/template.tsx`,import.meta.url))},server:{routes:[$(O.bundle,`bundle`),$(O.deprecatedBundle,`bundle`),$(O.graphql,`graphql`)]}});function $(e,t){return{method:`GET`,path:e+k,handler:{filePath:`./server/spec-download.ts`,importer:import.meta.url,exportName:t}}}async function Ee(e,t){if(t)try{return await e.load(w(t))}catch{return}}export{Te as apiDocsContentPlugin};
@@ -3,7 +3,7 @@ import type { MarkdownService } from '../../../../markdown/types/service.js';
3
3
  import type { MarkdocResolverContextBase } from '../../../../markdown/resolve/markdoc.js';
4
4
  import { type ApiSpecType } from '../../../types/api-entity.js';
5
5
  import type { JsonObject } from '../../../../database/schema.js';
6
- import { type RbacAnnotationOptions } from '../../../../../server/rbac/api-docs.js';
6
+ import { type RbacAnnotationOptions } from '../../../../../shared/rbac/api-docs.js';
7
7
  /**
8
8
  * Context for resolving markdown descriptions in an OpenAPI/AsyncAPI bundle. `markdown`
9
9
  * carries state + slug resolution; `loader` is the render loader's context, without which
@@ -63,7 +63,7 @@ export declare function buildBundledApiDefinition(input: {
63
63
  pagePath?: string;
64
64
  /**
65
65
  * When present, copies each node's `x-rbac` onto the upstream `REDOCLY_TEAMS_RBAC` key
66
- * (see `src/server/rbac/api-docs.ts`) so `buildItems`/`buildNavItems` apply tag-to-operation
66
+ * (see `src/shared/rbac/api-docs.ts`) so `buildItems`/`buildNavItems` apply tag-to-operation
67
67
  * inheritance and `$ref` propagation. GraphQL does not use `x-rbac`.
68
68
  */
69
69
  rbac?: RbacAnnotationOptions;
@@ -1 +1 @@
1
- import{isObject as e}from"../../../../../shared/utils/is-object.js";import{toContainedContentPath as t}from"../../../../ingest/scan.js";import{SPEC_KIND_ARAZZO as n}from"../../../types/api-entity.js";import{annotateApiDocsRbac as r}from"../../../../../server/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/lib/services/spec-convert/swagger.js`);return e(n)}if(e===`asyncapi`){let{normalizeAsyncApiDefinition:e}=await import(`@redocly/api-docs/lib/services/spec-convert/asyncapi.js`);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{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};