@redocly/realm 0.136.0-next.6 → 0.136.0-next.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (249) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/dist/bin.js +1 -1
  3. package/dist/cli/build/analytics/collect-analytics.js +1 -1
  4. package/dist/cli/build/index.js +1 -1
  5. package/dist/cli/eject/resolveEjectParams.js +1 -1
  6. package/dist/cli/stats/collectors/openapi/index.js +1 -1
  7. package/dist/cli/stats/index.js +1 -1
  8. package/dist/client/App.js +1 -1
  9. package/dist/client/TestProvider.js +1 -1
  10. package/dist/client/api-docs-builder-entry.d.ts +3 -0
  11. package/dist/client/api-docs-builder-entry.js +1 -0
  12. package/dist/client/app/Feedback/useSubmitFeedback.js +1 -1
  13. package/dist/client/app/Sidebar/Sidebar.js +3 -3
  14. package/dist/client/app/Sidebar/useActions.js +1 -1
  15. package/dist/client/app/hooks/codeHighlight/useCodeHighlight.js +1 -1
  16. package/dist/client/app/hooks/index.d.ts +1 -0
  17. package/dist/client/app/hooks/index.js +1 -1
  18. package/dist/client/app/hooks/useAutoScroll.js +1 -1
  19. package/dist/client/app/hooks/useUserClaims.js +1 -1
  20. package/dist/client/app/l10n/hooks/index.d.ts +1 -0
  21. package/dist/client/app/l10n/hooks/index.js +1 -1
  22. package/dist/client/app/l10n/hooks/useTranslationKeys.d.ts +2 -0
  23. package/dist/client/app/l10n/hooks/useTranslationKeys.js +1 -0
  24. package/dist/client/app/markdoc/custom-components/openapi/json-schema.d.ts +1 -1
  25. package/dist/client/app/markdoc/custom-components/openapi/json-schema.js +1 -1
  26. package/dist/client/app/markdoc/custom-components/openapi/openapi-code-sample.d.ts +1 -5
  27. package/dist/client/app/markdoc/custom-components/openapi/openapi-code-sample.js +1 -1
  28. package/dist/client/app/markdoc/custom-components/openapi/openapi-example.js +1 -1
  29. package/dist/client/app/markdoc/custom-components/openapi/openapi-response-sample.js +1 -1
  30. package/dist/client/app/markdoc/custom-components/openapi/replay-openapi.d.ts +8 -24
  31. package/dist/client/app/markdoc/custom-components/openapi/replay-openapi.js +1 -1
  32. package/dist/client/app/markdoc/hooks/use-store.d.ts +8 -6
  33. package/dist/client/app/markdoc/utils/build-replay-operation-source-map.d.ts +20 -0
  34. package/dist/client/app/markdoc/utils/build-replay-operation-source-map.js +1 -0
  35. package/dist/client/app/markdoc/utils/find-api-item.d.ts +15 -0
  36. package/dist/client/app/markdoc/utils/find-api-item.js +1 -0
  37. package/dist/client/app/markdoc/utils/find-code-sample-panel.d.ts +11 -0
  38. package/dist/client/app/markdoc/utils/find-code-sample-panel.js +1 -0
  39. package/dist/client/app/markdoc/utils/find-openapi-response-samples.d.ts +15 -0
  40. package/dist/client/app/markdoc/utils/find-openapi-response-samples.js +1 -0
  41. package/dist/client/app/markdoc/utils/openapi-panel-entry.d.ts +18 -0
  42. package/dist/client/app/markdoc/utils/openapi-panel-entry.js +1 -0
  43. package/dist/client/app/utils/resolveRouteBySlug.js +1 -1
  44. package/dist/client/providers/theme/ThemeDataProvider.js +1 -1
  45. package/dist/client/runtime/loader.js +1 -1
  46. package/dist/client/templates/api-docs/helpers.d.ts +10 -0
  47. package/dist/client/templates/api-docs/helpers.js +1 -0
  48. package/dist/client/templates/api-docs/template.d.ts +17 -0
  49. package/dist/client/templates/api-docs/template.js +14 -0
  50. package/dist/client/types/sidebar.d.ts +0 -1
  51. package/dist/client/utils/utils.d.ts +0 -2
  52. package/dist/client/utils/utils.js +1 -1
  53. package/dist/constants/common.d.ts +1 -0
  54. package/dist/constants/common.js +1 -1
  55. package/dist/constants/l10n/langs/ar.js +1 -1
  56. package/dist/constants/l10n/langs/de.js +1 -1
  57. package/dist/constants/l10n/langs/en.js +1 -1
  58. package/dist/constants/l10n/langs/es.js +1 -1
  59. package/dist/constants/l10n/langs/fr.js +1 -1
  60. package/dist/constants/l10n/langs/hi.js +1 -1
  61. package/dist/constants/l10n/langs/it.js +1 -1
  62. package/dist/constants/l10n/langs/ja.js +1 -1
  63. package/dist/constants/l10n/langs/ko.js +1 -1
  64. package/dist/constants/l10n/langs/pl.js +1 -1
  65. package/dist/constants/l10n/langs/pt-BR.js +1 -1
  66. package/dist/constants/l10n/langs/pt.js +1 -1
  67. package/dist/constants/l10n/langs/ru.js +1 -1
  68. package/dist/constants/l10n/langs/uk.js +1 -1
  69. package/dist/constants/l10n/langs/zh.js +1 -1
  70. package/dist/server/constants/plugins/api-docs.d.ts +3 -0
  71. package/dist/server/constants/plugins/api-docs.js +1 -0
  72. package/dist/server/esbuild/esbuild-logger.js +3 -3
  73. package/dist/server/esbuild/esbuild.js +3 -3
  74. package/dist/server/esbuild/plugins/api-docs-module-replacer/empty-check.d.ts +9 -0
  75. package/dist/server/esbuild/plugins/api-docs-module-replacer/empty-check.js +1 -0
  76. package/dist/server/esbuild/plugins/api-docs-module-replacer/empty-overlay.d.ts +2 -0
  77. package/dist/server/esbuild/plugins/api-docs-module-replacer/empty-overlay.js +1 -0
  78. package/dist/server/esbuild/plugins/api-docs-module-replacer/index.d.ts +6 -0
  79. package/dist/server/esbuild/plugins/api-docs-module-replacer/index.js +1 -0
  80. package/dist/server/plugins/api-docs/get-server-props.d.ts +4 -0
  81. package/dist/server/plugins/api-docs/get-server-props.js +1 -0
  82. package/dist/server/plugins/api-docs/get-template-path.d.ts +2 -0
  83. package/dist/server/plugins/api-docs/get-template-path.js +1 -0
  84. package/dist/server/plugins/api-docs/import-api-docs-builder.d.ts +8 -0
  85. package/dist/server/plugins/api-docs/import-api-docs-builder.js +1 -0
  86. package/dist/server/plugins/api-docs/index.d.ts +19 -0
  87. package/dist/server/plugins/api-docs/index.js +1 -0
  88. package/dist/server/plugins/api-docs/loader.d.ts +35 -0
  89. package/dist/server/plugins/api-docs/loader.js +3 -0
  90. package/dist/server/plugins/api-docs/options.d.ts +14 -0
  91. package/dist/server/plugins/api-docs/options.js +1 -0
  92. package/dist/server/plugins/api-docs/search/get-ai-search-documents.d.ts +20 -0
  93. package/dist/server/plugins/api-docs/search/get-ai-search-documents.js +105 -0
  94. package/dist/server/plugins/api-docs/search/search-facets.d.ts +10 -0
  95. package/dist/server/plugins/api-docs/search/search-facets.js +1 -0
  96. package/dist/server/plugins/api-docs/search/search-indexer.d.ts +9 -0
  97. package/dist/server/plugins/api-docs/search/search-indexer.js +1 -0
  98. package/dist/server/plugins/api-docs/search/search-resolver.d.ts +5 -0
  99. package/dist/server/plugins/api-docs/search/search-resolver.js +1 -0
  100. package/dist/server/plugins/api-docs/spec-download.api.d.ts +4 -0
  101. package/dist/server/plugins/api-docs/spec-download.api.js +1 -0
  102. package/dist/server/plugins/api-docs/store-definition-bundles.d.ts +3 -0
  103. package/dist/server/plugins/api-docs/store-definition-bundles.js +1 -0
  104. package/dist/server/plugins/api-docs/utils/build-item-positions.d.ts +17 -0
  105. package/dist/server/plugins/api-docs/utils/build-item-positions.js +1 -0
  106. package/dist/server/plugins/api-docs/utils/build-routes-mapping.d.ts +3 -0
  107. package/dist/server/plugins/api-docs/utils/build-routes-mapping.js +1 -0
  108. package/dist/server/plugins/api-docs/utils/collect-item-routes.d.ts +12 -0
  109. package/dist/server/plugins/api-docs/utils/collect-item-routes.js +1 -0
  110. package/dist/server/plugins/api-docs/utils/decorators.d.ts +26 -0
  111. package/dist/server/plugins/api-docs/utils/decorators.js +1 -0
  112. package/dist/server/plugins/api-docs/utils/format-bundle-error.d.ts +6 -0
  113. package/dist/server/plugins/api-docs/utils/format-bundle-error.js +5 -0
  114. package/dist/server/plugins/api-docs/utils/normalize-api-version.d.ts +2 -0
  115. package/dist/server/plugins/api-docs/utils/normalize-api-version.js +1 -0
  116. package/dist/server/plugins/api-docs/utils/normalize-feedback-options.d.ts +2 -0
  117. package/dist/server/plugins/api-docs/utils/normalize-feedback-options.js +1 -0
  118. package/dist/server/plugins/api-docs/utils/relative-path-to-base-slug.d.ts +20 -0
  119. package/dist/server/plugins/api-docs/utils/relative-path-to-base-slug.js +1 -0
  120. package/dist/server/plugins/api-docs/utils/replace-file-extension.d.ts +2 -0
  121. package/dist/server/plugins/api-docs/utils/replace-file-extension.js +1 -0
  122. package/dist/server/plugins/api-docs/utils/resolve-api-doc-title.d.ts +3 -0
  123. package/dist/server/plugins/api-docs/utils/resolve-api-doc-title.js +1 -0
  124. package/dist/server/plugins/api-docs/utils/resolve-config-rbac.d.ts +10 -0
  125. package/dist/server/plugins/api-docs/utils/resolve-config-rbac.js +1 -0
  126. package/dist/server/plugins/api-docs/utils/to-relative-slug.d.ts +2 -0
  127. package/dist/server/plugins/api-docs/utils/to-relative-slug.js +1 -0
  128. package/dist/server/plugins/api-functions/index.js +1 -1
  129. package/dist/server/plugins/arazzo-docs/index.js +1 -1
  130. package/dist/server/plugins/asyncapi-docs/index.js +1 -1
  131. package/dist/server/plugins/catalog-classic/index.js +1 -1
  132. package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/arazzo-entities-extractor.js +1 -1
  133. package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/asyncapi-entities-extractor.d.ts +13 -5
  134. package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/asyncapi-entities-extractor.js +1 -1
  135. package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/base.js +1 -1
  136. package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/graphql-entities-extractor.d.ts +6 -5
  137. package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/graphql-entities-extractor.js +2 -2
  138. package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/openapi-entities-extractor.d.ts +12 -5
  139. package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/openapi-entities-extractor.js +1 -1
  140. package/dist/server/plugins/catalog-entities/plugin.js +1 -1
  141. package/dist/server/plugins/catalog-entities/template/index.js +1 -1
  142. package/dist/server/plugins/catalog-entities/types/openapi.d.ts +1 -1
  143. package/dist/server/plugins/catalog-entities/utils/openapi-component-content-extractor.d.ts +3 -3
  144. package/dist/server/plugins/catalog-entities/utils/openapi-component-content-extractor.js +1 -1
  145. package/dist/server/plugins/catalog-entities/utils/openapi-schema-resolver.d.ts +4 -3
  146. package/dist/server/plugins/catalog-entities/utils/openapi-schema-resolver.js +1 -1
  147. package/dist/server/plugins/config-parser/index.js +1 -1
  148. package/dist/server/plugins/create-slugify.d.ts +17 -0
  149. package/dist/server/plugins/create-slugify.js +1 -0
  150. package/dist/server/plugins/default-theme/index.js +1 -1
  151. package/dist/server/plugins/dev-onboarding/index.js +1 -1
  152. package/dist/server/plugins/entitlements/index.js +1 -1
  153. package/dist/server/plugins/graphql-docs/index.js +1 -1
  154. package/dist/server/plugins/helpers/parse-partials.d.ts +3 -0
  155. package/dist/server/plugins/helpers/parse-partials.js +1 -0
  156. package/dist/server/plugins/l10n/index.js +1 -1
  157. package/dist/server/plugins/lifecycle.js +2 -2
  158. package/dist/server/plugins/markdown/attribute-resolvers/helpers/load-openapi-bundle.d.ts +5 -3
  159. package/dist/server/plugins/markdown/attribute-resolvers/helpers/load-openapi-bundle.js +1 -1
  160. package/dist/server/plugins/markdown/attribute-resolvers/resolve-json-example-ref.js +1 -1
  161. package/dist/server/plugins/markdown/attribute-resolvers/resolve-open-api-ref.js +1 -1
  162. package/dist/server/plugins/markdown/attribute-resolvers/resolve-openapi-code-samples.js +1 -1
  163. package/dist/server/plugins/markdown/attribute-resolvers/resolve-openapi-response-samples.js +1 -1
  164. package/dist/server/plugins/markdown/index.js +1 -1
  165. package/dist/server/plugins/markdown/search/walk-sections.js +1 -1
  166. package/dist/server/plugins/mcp/codemode/constants.js +1 -1
  167. package/dist/server/plugins/mcp/codemode/tools/execute-schema.js +1 -1
  168. package/dist/server/plugins/mcp/codemode/tools/execute.d.ts +1 -0
  169. package/dist/server/plugins/mcp/constants.d.ts +1 -0
  170. package/dist/server/plugins/mcp/constants.js +1 -1
  171. package/dist/server/plugins/mcp/docs-mcp/tool-schemas.d.ts +1 -0
  172. package/dist/server/plugins/mcp/docs-mcp/tool-schemas.js +1 -1
  173. package/dist/server/plugins/mcp/docs-mcp/tools/core/create-anonymous-session.d.ts +11 -0
  174. package/dist/server/plugins/mcp/docs-mcp/tools/core/create-anonymous-session.js +1 -0
  175. package/dist/server/plugins/mcp/docs-mcp/tools/graphql/constants.d.ts +4 -0
  176. package/dist/server/plugins/mcp/docs-mcp/tools/graphql/constants.js +1 -0
  177. package/dist/server/plugins/mcp/docs-mcp/tools/graphql/get-graphql-type-list.js +1 -1
  178. package/dist/server/plugins/mcp/docs-mcp/tools/graphql/get-graphql-type.js +7 -4
  179. package/dist/server/plugins/mcp/docs-mcp/tools/graphql/types.d.ts +7 -1
  180. package/dist/server/plugins/mcp/docs-mcp/tools/graphql/types.js +0 -1
  181. package/dist/server/plugins/mcp/docs-mcp/tools/graphql/utils.d.ts +5 -1
  182. package/dist/server/plugins/mcp/docs-mcp/tools/graphql/utils.js +4 -2
  183. package/dist/server/plugins/mcp/docs-mcp/tools/index.d.ts +4 -0
  184. package/dist/server/plugins/mcp/docs-mcp/tools/index.js +1 -1
  185. package/dist/server/plugins/mcp/docs-mcp/tools/openapi/load-api-description.d.ts +1 -1
  186. package/dist/server/plugins/mcp/docs-mcp/tools/openapi/utils.d.ts +1 -1
  187. package/dist/server/plugins/mcp/docs-mcp/utils.d.ts +1 -1
  188. package/dist/server/plugins/mcp/gateway-mcp/elicitation.d.ts +2 -2
  189. package/dist/server/plugins/mcp/gateway-mcp/elicitation.js +2 -2
  190. package/dist/server/plugins/mcp/gateway-mcp/eligibility.d.ts +1 -2
  191. package/dist/server/plugins/mcp/gateway-mcp/fetch/allowed-hosts.d.ts +1 -1
  192. package/dist/server/plugins/mcp/gateway-mcp/secret-store.d.ts +4 -4
  193. package/dist/server/plugins/mcp/gateway-mcp/secret-store.js +1 -1
  194. package/dist/server/plugins/mcp/gateway-mcp/subject.d.ts +20 -0
  195. package/dist/server/plugins/mcp/gateway-mcp/subject.js +1 -0
  196. package/dist/server/plugins/mcp/handlers/mcp-credentials-handler.js +9 -9
  197. package/dist/server/plugins/mcp/index.js +1 -1
  198. package/dist/server/plugins/mcp/servers/docs-server.js +1 -1
  199. package/dist/server/plugins/mcp/servers/mcp-server.js +1 -1
  200. package/dist/server/plugins/mcp/types.d.ts +1 -2
  201. package/dist/server/plugins/mcp/utils/xmcp-utils.d.ts +1 -1
  202. package/dist/server/plugins/mcp/utils.d.ts +17 -5
  203. package/dist/server/plugins/mcp/utils.js +1 -1
  204. package/dist/server/plugins/openapi-docs/index.js +1 -1
  205. package/dist/server/plugins/pages/index.js +1 -1
  206. package/dist/server/plugins/scorecard-classic/compute-scorecard.js +4 -4
  207. package/dist/server/plugins/scorecard-classic/index.js +1 -1
  208. package/dist/server/plugins/scorecards/plugin.js +1 -1
  209. package/dist/server/plugins/search/ai-indexer/prepare-semantic-documents.js +2 -2
  210. package/dist/server/plugins/search/documents/search-documents.js +1 -1
  211. package/dist/server/plugins/search/index.js +1 -1
  212. package/dist/server/plugins/search/llmstxt/index.js +4 -4
  213. package/dist/server/plugins/sidebars/index.js +1 -1
  214. package/dist/server/plugins/sitemap/index.js +1 -1
  215. package/dist/server/plugins/sso/index.js +1 -1
  216. package/dist/server/ssr/render.js +1 -1
  217. package/dist/server/ssr/utils.d.ts +1 -0
  218. package/dist/server/ssr/utils.js +5 -5
  219. package/dist/server/store.d.ts +2 -6
  220. package/dist/server/store.js +1 -1
  221. package/dist/server/types/plugins/common.d.ts +3 -5
  222. package/dist/server/types/plugins/markdown.d.ts +1 -3
  223. package/dist/server/types/plugins/search.d.ts +1 -0
  224. package/dist/server/utils/catalog-classic/get-route-slug-to-catalog-slug-map.test.js +1 -1
  225. package/dist/server/utils/report-all-errors.js +1 -1
  226. package/dist/server/utils/shared-data.js +1 -1
  227. package/dist/server/web-server/routes/resolve-route.js +1 -1
  228. package/dist/types/markdoc.d.ts +2 -1
  229. package/dist/utils/url/get-shared-data-fetch-url.d.ts +17 -0
  230. package/dist/utils/url/get-shared-data-fetch-url.js +1 -0
  231. package/package.json +9 -8
  232. package/dist/markdoc/helpers/get-operation/get-operation-info-by-id.d.ts +0 -4
  233. package/dist/markdoc/helpers/get-operation/get-operation-info-by-id.js +0 -1
  234. package/dist/markdoc/helpers/get-operation/get-operation-info-by-pointer.d.ts +0 -4
  235. package/dist/markdoc/helpers/get-operation/get-operation-info-by-pointer.js +0 -1
  236. package/dist/markdoc/helpers/get-operation/get-operation.d.ts +0 -14
  237. package/dist/markdoc/helpers/get-operation/get-operation.js +0 -1
  238. package/dist/markdoc/helpers/get-operation/index.d.ts +0 -4
  239. package/dist/markdoc/helpers/get-operation/index.js +0 -1
  240. package/dist/markdoc/helpers/get-operation/types/index.d.ts +0 -4
  241. package/dist/markdoc/helpers/get-operation/types/index.js +0 -0
  242. package/dist/markdoc/helpers/get-operation/types/operation-identifier.d.ts +0 -5
  243. package/dist/markdoc/helpers/get-operation/types/operation-identifier.js +0 -0
  244. package/dist/markdoc/helpers/get-operation/types/operation-info.d.ts +0 -6
  245. package/dist/markdoc/helpers/get-operation/types/operation-info.js +0 -0
  246. package/dist/markdoc/helpers/get-operation/types/operation-parameters.d.ts +0 -3
  247. package/dist/markdoc/helpers/get-operation/types/operation-parameters.js +0 -0
  248. package/dist/server/plugins/markdown/attribute-resolvers/helpers/get-media-content-samples.d.ts +0 -4
  249. package/dist/server/plugins/markdown/attribute-resolvers/helpers/get-media-content-samples.js +0 -1
@@ -1,4 +1,4 @@
1
- import{pathToFileURL as d}from"url";import{removeTrailingSlash as u}from"../../utils/url/remove-trailing-slash.js";import{slash as p}from"../../utils/path/slash.js";import{getClientPageDataUrl as f}from"../../utils/url/get-client-page-data-url.js";import{DEFAULT_COLOR_MODES as m}from"@redocly/theme/core/constants";import{envConfig as h}from"../config/env-config.js";function C(t){const o=t?.colorMode,{modes:e=[m.LIGHT,m.DARK],hide:r,ignoreDetection:n}=o||{},a=e&&`'${e[0]}'`,s=e?.[0],l=e?.some(c=>c===s)?`'${s}'`:void 0;return r||!a?"":`
1
+ import{pathToFileURL as u}from"url";import{removeTrailingSlash as p}from"../../utils/url/remove-trailing-slash.js";import{slash as f}from"../../utils/path/slash.js";import{getClientPageDataUrl as h}from"../../utils/url/get-client-page-data-url.js";import{getSharedDataFetchUrl as g}from"../../utils/url/get-shared-data-fetch-url.js";import{DEFAULT_COLOR_MODES as l}from"@redocly/theme/core/constants";import{envConfig as m}from"../config/env-config.js";function q(t){const o=t?.colorMode,{modes:e=[l.LIGHT,l.DARK],hide:r,ignoreDetection:s}=o||{},a=e&&`'${e[0]}'`,n=e?.[0],d=e?.some(c=>c===n)?`'${n}'`:void 0;return r||!a?"":`
2
2
  <script>
3
3
  if(window&&document.documentElement)
4
4
  {
@@ -9,13 +9,13 @@ import{pathToFileURL as d}from"url";import{removeTrailingSlash as u}from"../../u
9
9
  ${i("modeToSet",e)}
10
10
  } else {
11
11
  if (window.matchMedia) {
12
- ${g(n,l,a,e)}
12
+ ${S(s,d,a,e)}
13
13
  } else {
14
14
  ${i(a,e)}
15
15
  }
16
16
  }
17
17
  }
18
- </script>`}function g(t,o,e,r=["light","dark"]){return t?o?i(o,r):e?i(e,r):"return":$(o,r)}function i(t=`'${m.LIGHT}'`,o=["light","dark"]){return`(function() {
18
+ </script>`}function S(t,o,e,r=["light","dark"]){return t?o?i(o,r):e?i(e,r):"return":$(o,r)}function i(t=`'${l.LIGHT}'`,o=["light","dark"]){return`(function() {
19
19
  var root = document.documentElement;
20
20
  var modes = [${o.map(r=>`'${r}'`).join(", ")}];
21
21
  var value = ${t};
@@ -23,7 +23,7 @@ import{pathToFileURL as d}from"url";import{removeTrailingSlash as u}from"../../u
23
23
  root.classList.remove(className);
24
24
  });
25
25
  root.classList.add(value);
26
- })();`}function $(t,o=["light","dark"]){const e=o.map(n=>`'${n}'`).join(", "),r=t?`root.classList.add(${t});`:"";return`(function() {
26
+ })();`}function $(t,o=["light","dark"]){const e=o.map(s=>`'${s}'`).join(", "),r=t?`root.classList.add(${t});`:"";return`(function() {
27
27
  var root = document.documentElement;
28
28
  var modes = [${e}];
29
29
  modes.forEach(function(className) {
@@ -36,4 +36,4 @@ import{pathToFileURL as d}from"url";import{removeTrailingSlash as u}from"../../u
36
36
  }${r?` else {
37
37
  ${r}
38
38
  }`:""}
39
- })();`}async function E(t){try{return h.isRuntimeMode?await import("@portal/server-props"):await import(d(`${p(t)}/server-props-entry.js`)+"?"+new Date)}catch{return{}}}function T(t){const o=t.split("/").map(encodeURIComponent).join("/"),e=o==="/"?o:u(o);return`<link rel="preload" as="fetch" crossorigin="anonymous" href="${f(e)}" />`}const k=(t,o)=>{if(!o)return{params:[],queries:{}};const e=t.slug||"",n=o.req.path.split(e.endsWith("/")?e:`${e}/`)[1]||"",a=o.req.query(),s=n.replace("data.json","");return!s||s==="/"?{params:[],queries:a}:{params:s.split("/").filter(Boolean),queries:a}};export{C as detectColorSchemaScript,T as generatePreloadPageData,k as getPathParams,E as importServerProps};
39
+ })();`}async function T(t){try{return m.isRuntimeMode?await import("@portal/server-props"):await import(u(`${f(t)}/server-props-entry.js`)+"?"+new Date)}catch{return{}}}function j(t){const o=t.split("/").map(encodeURIComponent).join("/"),e=o==="/"?o:p(o);return`<link rel="preload" as="fetch" crossorigin="anonymous" href="${h(e)}" />`}function x(t={}){const o=new Set;for(const e of Object.values(t))e&&o.add(g(e,m.isDevelopMode));return[...o].map(e=>`<link rel="preload" as="fetch" crossorigin="anonymous" href="${w(e)}" />`)}function w(t){return t.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}const y=(t,o)=>{if(!o)return{params:[],queries:{}};const e=t.slug||"",s=o.req.path.split(e.endsWith("/")?e:`${e}/`)[1]||"",a=o.req.query(),n=s.replace("data.json","");return!n||n==="/"?{params:[],queries:a}:{params:n.split("/").filter(Boolean),queries:a}};export{q as detectColorSchemaScript,j as generatePreloadPageData,x as generatePreloadSharedData,y as getPathParams,T as importServerProps};
@@ -5,9 +5,7 @@ import type { MiddlewareDetails, PageRouteInit, PageRouteDetails, RouteDetails,
5
5
  import type { Skill } from './types/plugins/skills.js';
6
6
  import type { RedoclyConfig, RedirectConfig, CompilationError, PageStaticData } from '@redocly/config';
7
7
  import type { SearchFacet } from '@redocly/theme/core/types';
8
- import type { BundledDefinition as OpenApiBundledDefinition } from './plugins/openapi-docs/load-definition.js';
9
- import type { BundledDefinition as AsyncApiBundledDefinition } from './plugins/asyncapi-docs/asyncapi-doc-loader.js';
10
- import type { BundledDefinition as GraphqlBundledDefinition } from './plugins/graphql-docs/graphql-doc-loader.js';
8
+ import type { BundledApiDefinition } from './plugins/api-docs/loader.js';
11
9
  import type { SearchEngine } from './plugins/search/engines/search-engine.js';
12
10
  import { KvService } from './persistence/kv/services/kv-service.js';
13
11
  export declare const USER_DEFINED_API_FUNCTIONS_COUNTER_KEY = "userDefinedApiFunctions";
@@ -109,9 +107,7 @@ export declare class Store {
109
107
  ast: Node;
110
108
  compoundHash: string;
111
109
  }>;
112
- loadOpenApiDefinitions(context: LifecycleContext): Promise<OpenApiBundledDefinition[]>;
113
- loadAsyncApiDefinitions(context: LifecycleContext): Promise<AsyncApiBundledDefinition[]>;
114
- loadGraphqlDefinitions(context: LifecycleContext): Promise<GraphqlBundledDefinition[]>;
110
+ loadApiDocuments(context: LifecycleContext): Promise<BundledApiDefinition[]>;
115
111
  setSearchEngine(engine: SearchEngine): void;
116
112
  setSearchFacets: (searchFacets: Map<string, SearchFacet>) => void;
117
113
  setGlobalConfig: (data: Partial<RedoclyConfig>) => void;
@@ -1 +1 @@
1
- import C from"@markdoc/markdoc";import{getPathnameForLocale as A}from"@redocly/theme/core/utils";import{DEFAULT_LOCALE_PLACEHOLDER as g}from"../constants/common.js";import{DEFAULT_TITLE as T}from"./constants/common.js";import{GATED_MARKDOC_TAGS as y}from"./constants/entitlements.js";import{MARKDOC_PARTIALS_DATA_KEY as m,MARKDOC_PARTIALS_DEPS_KEY as O}from"./constants/common.js";import{isObject as M}from"../utils/guards/is-object.js";import{mapObject as k}from"../utils/object/map-object.js";import{getValueDeep as D}from"../utils/object/get-value-deep.js";import{removeTrailingSlash as L}from"../utils/url/remove-trailing-slash.js";import{normalizeRouteSlug as h}from"../utils/path/normalize-route-slug.js";import{isLocalLink as R}from"../utils/path/is-local-link.js";import{reporter as S}from"./tools/notifiers/reporter.js";import{logger as u}from"./tools/notifiers/logger.js";import{sha1 as H}from"./utils/crypto/sha1.js";import{envConfig as _,setEnv as G}from"./config/env-config.js";import{KvService as B}from"./persistence/kv/services/kv-service.js";import{SandboxContext as F}from"./utils/sandbox-context.js";import{writeSharedData as I}from"./utils/index.js";import{renderComponents as N}from"./ssr/render.js";import{readStaticData as q,writeStaticData as V}from"./utils/static-data.js";import{parseAndResolveMarkdoc as j}from"./plugins/markdown/compiler.js";import{getMarkdocOptions as U}from"./plugins/markdown/markdoc/markdoc-options.js";import{EntitlementsProvider as w}from"./entitlements/entitlements-provider.js";import{isL10nPath as K}from"./fs/utils/is-l10n-path.js";import{resolveGlobMapValue as x}from"./utils/globs.js";import{replaceEnvVariablesDeep as J}from"./utils/envs/replace-env-variables-deep.js";import{findRedirect as W}from"./utils/redirects/find-redirect.js";import{followRedirectChain as $}from"./utils/redirects/follow-redirect-chain.js";import{addWildcardRedirectToTree as z}from"./utils/redirects/add-wildcard-redirect-to-tree.js";import{telemetryTraceStep as Y}from"../cli/telemetry/helpers/trace-step.js";const v={routesBySlug:"map",apiRoutes:"object",middleware:"object",routesByFsPath:"map",routesSharedData:"map",globalData:"object",config:"object",ssr:"object",searchFacets:"map",routesPartials:"map",mcpToolHandlers:"map",skills:"map"},E="PLAN_GATES",Z=["OAUTH_CLIENT_ID","OAUTH_CLIENT_SECRET","ORGANIZATION_SLUG","ORGANIZATION_ID","ORG_ID"],Me="userDefinedApiFunctions";class P{routesBySlug=new Map;replacedEnvVars={};unsetEnvVars=new Set;lifecycleContext;newRoutes=[];#t={};routesByFsPath=new Map;apiRoutes=[];middleware=[];routesSharedData=new Map;sharedDataDeps=new Map;sharedDataMarkdocComponents=new Map;routesDynamicComponents=new Map;routesPartials=new Map;ssr={preBodyTags:[],postBodyTags:[],headTags:[]};searchFacets=new Map;searchEngine;templates=new Map;browserPlugins=new Set;apiRoutesRequestHandlers=new Map;mcpToolHandlers=new Map;skills=new Map;serverPropsGetters=new Map;pagePropsGetters=new Map;listeners=new Map;globalData={};#o=void 0;config={configFilePath:"",redirects:{},wildcardRedirectsTree:{},access:{rbac:{},requiresLogin:!1},directoryPermissions:{},devLogin:!1,ssoDirect:{}};#i;serverMode;serverOutDir;outdir;buildRevision=0;hasSitemap=!1;compilationErrors=[];#n;userCodeReady;#s=Promise.resolve();#c;#l=Promise.resolve();#d;#u=Promise.resolve();#h;#e=!1;#r=0;#f=0;#a=new Map;constructor({outdir:e,contentDir:t,serverMode:s=!1,serverOutDir:a}){this.#i=t,this.outdir=e,this.serverMode=s,this.serverOutDir=a,F.register({serverOutDir:a,readRoots:[e,process.cwd()]}),this.userCodeReady=new Promise(r=>{this.#n=r})}on(e,t){const s=this.listeners.get(e);s?s.add(t):this.listeners.set(e,new Set([t]))}queueEvent=(e,t,...s)=>{this.#a.set(e+String(t),[e,t,...s])};runListeners=(e,t,...s)=>{for(const a of this.listeners.get(e)||new Set)t?a(t,...s):a(...s)};startPluginsRun(){this.clear(),this.#s=new Promise(e=>{this.#c=e})}waitForPluginsLifecycle(){return Promise.all([this.#s,this.#l,this.#u])}waitForPluginsRun(){return this.#s}finishPluginsRun(){this.#c?.();for(const e of this.#a.values())this.runListeners(...e);this.#a.clear()}startEsbuildRun(){this.#l=new Promise(e=>{this.#d=e})}finishEsbuildRun(){this.#d?.()}markRequestHandlersEntryOutdated(){this.#r++,!this.#e&&(this.#e=!0,this.#u=new Promise(e=>{this.#h=e}))}noteRequestHandlersEntryBuildStart(){this.#f=this.#r}markRequestHandlersEntryUpdated(){this.#e&&(this.#r>this.#f||(this.#e=!1,this.#h?.()))}get contentDir(){if(this.serverMode)throw new Error("contentDir should not be used in server mode");return this.#i}markUserCodeReady(){this.#n?.(!0)}async reloadMarkdocOptions(){await Y("build.reload_markdoc_options",async()=>{const e=w.instance(),t=await U(this.serverOutDir),s=Object.fromEntries(Object.entries(t.tags).filter(([a])=>y[a]!=null?e.canAccessFeature(y[a]):!0));this.#o={...t,tags:s}})}get markdocOptions(){return{...this.#o,partials:this.getGlobalConfig(m),themeConfig:this.config.markdown}}setGlobalData=e=>{const t=this.globalData,s={...this.globalData,...e};this.globalData=s,JSON.stringify(s)!==JSON.stringify(t)&&this.queueEvent("global-data-updated",void 0,s)};getGlobalData=()=>this.globalData;getKv=async()=>B.getInstance({baseDbDir:this.serverOutDir});parseMarkdoc=async({input:e,context:t,deps:s,resource:a})=>{const{data:{info:r,ast:o},compoundHash:l}=await j(e,this.markdocOptions,{actions:this,context:t},a);for(const i of r.sharedDataDeps||[]){for(const n of s?.routeSlugs||[])this.addRouteSharedData(n,i,i);for(const n of s?.sharedDataIds||[]){const c=this.sharedDataDeps.get(n)||new Set;c.add(i),this.sharedDataDeps.set(n,c)}}for(const i of r.dynamicMarkdocComponents||[]){for(const n of s?.routeSlugs||[]){const c=this.routesDynamicComponents.get(n)||new Set;c.add(i),this.routesDynamicComponents.set(n,c)}for(const n of s?.sharedDataIds||[]){const c=this.sharedDataMarkdocComponents.get(n)||new Set;c.add(i),this.sharedDataMarkdocComponents.set(n,c)}}if(s?.routeSlugs&&r.partials?.length)for(const i of s.routeSlugs){const n=this.routesPartials.get(i)||[];for(const c of r.partials)n.includes(c)||n.push(c);this.routesPartials.set(i,n)}return{info:r,ast:o,compoundHash:l}};async loadOpenApiDefinitions(e){return(await e.cache.load(".","load-oas-docs")).data}async loadAsyncApiDefinitions(e){return(await e.cache.load(".","asyncapi-docs")).data}async loadGraphqlDefinitions(e){return(await e.cache.load(".","load-graphql-docs")).data}setSearchEngine(e){this.searchEngine=e}setSearchFacets=e=>{this.searchFacets=e};setGlobalConfig=e=>{const t=Object.keys(e);for(const o of t)for(const l in this.replacedEnvVars)if(l===o||l.startsWith(`${o}:`)){const i=l.split(":"),{error:n,value:c}=D(e,i);(n||c!==this.replacedEnvVars[l].replaced)&&delete this.replacedEnvVars[l]}const{resolvedObj:s,unsetEnvVars:a,replacedValues:r}=J(e);for(const o of a)this.unsetEnvVars.add(o);Object.assign(this.replacedEnvVars,r),Object.assign(this.config,s)};getConfig=()=>this.config;getGlobalConfig=e=>this.config[e];getSearchFacets=()=>this.searchFacets;addRedirect=(e,t,s={})=>{if(!w.instance().canAccessFeature("redirects")&&e!=="/")return;this.config.redirects||(this.config.redirects={});const o=h(e).toLowerCase();this.config.redirects[o]=t;const{trackOriginalSource:l=!0}=s,i=this.getGlobalConfig("originalRedirectSources");l&&Array.isArray(i)&&!i.includes(o)&&i.push(o),o.endsWith("*")&&z(this.config.wildcardRedirectsTree,o)};getRedirect=e=>{const t=h(e).toLowerCase(),s=W(t,this.config.redirects,this.config.wildcardRedirectsTree);if(!s)return null;if(R(s.to)){const a=h(s.to).toLowerCase();if(!a.endsWith("*")&&$(a,[t],this.config.redirects,this.config.wildcardRedirectsTree).type==="cycle")return null}return{to:s.to,type:s.type}};createSharedData=async(e,t,s)=>{if(s&&this.#t[e]===s)return e;const a=JSON.stringify(t),r=s??H(a);return this.#t[e]===r||(this.#t[e]=r,await I(e,a,this.outdir),this.queueEvent("shared-data-updated",e)),e};addRouteSharedData=(e,t,s)=>{const a=L(e),r=this.routesSharedData.get(a)||{};r[t]=s,this.routesSharedData.set(a,r),u.verbose(`Adding shared data to ${e}, ${t}, ${s}`)};getRouteSharedDataByFsPath=e=>{const t=this.routesByFsPath.get(e);return t?this.routesSharedData.get(t)||{}:{}};getPartialsForRoute=e=>{const t=this.getGlobalConfig(m)||{},s=this.routesPartials.get(e);if(!s||s.length===0)return{};const a=this.getGlobalConfig(O)||{},r=new Set(s),o=Array.from(s);for(let i=0;i<o.length;i++){const n=o[i],c=a[n]?.partials??[];for(const d of c)r.has(d)||(r.add(d),o.push(d))}const l={};for(const i of r)t[i]&&(l[i]=t[i]);return l};addRoute=e=>{const s={...x(e.fsPath,this.config.metadataGlobs),...e.metadata||{}};this.newRoutes.push({...e,metadata:s}),u.verbose("Created route %s",e.slug)};addRouteSharedDataToAllLocales=(e,t,s)=>{const a=[g,...this.lifecycleContext?.fs.localeFolders||[]].map(r=>({code:r,name:r}));for(const r of a){const o=A(e,g,r.code,a);this.addRouteSharedData(o,t,s)}};addApiRoute=e=>{this.apiRoutes.push(e),u.verbose("Created API route %s",e.slug)};addMcpTools=(e,t)=>{for(const s of t)this.mcpToolHandlers.set(s.name,{...s,importPath:e}),u.verbose("Created MCP tool %s",s.name)};getMcpTools=()=>Array.from(this.mcpToolHandlers.values());addSkills=e=>{for(const t of e)this.skills.set(t.slug,t),u.verbose("Discovered skill %s",t.slug)};getSkills=()=>Array.from(this.skills.values());addMiddleware=e=>{this.middleware.push(e),u.verbose("Created middleware %s",e.id)};setResourceResponseHeaders=(e,t)=>{this.config.responseHeaders||(this.config.responseHeaders={});const s=new Set(t.map(o=>o.name.toLowerCase())),r=[...(this.config.responseHeaders[e]??[]).filter(o=>!s.has(o.name.toLowerCase())),...t];this.config.responseHeaders[e]=r};getRouteByFsPath=e=>{const t=this.routesByFsPath.get(e);return t?this.getRouteBySlug(t):void 0};getRouteBySlug=(e,t={})=>{const{followRedirect:s=!0}=t,a=this.getRedirect(e);return s&&a?this.routesBySlug.get(h(a.to)):this.routesBySlug.get(e)};hasRouteOrRedirectBySlug=e=>{if(this.routesBySlug.has(e))return!0;const t=this.getRedirect(e);if(!t)return!1;if(!R(t.to))return!0;const s=h(t.to);return this.routesBySlug.has(s)};getRoutesByTemplateId=e=>this.newRoutes.filter(t=>t.templateId===e);getAllRoutesForLocale=(e=g)=>{const t=Array.from(this.routesBySlug.values()),s=e.toLowerCase();return t.filter(a=>e===g?!K(a.fsPath):a.slug.startsWith(`/${s}`))};getAllRoutes=()=>Array.from(this.routesBySlug.values());getAllApiRoutes=()=>this.apiRoutes;getAllMiddleware=()=>this.middleware;getTemplate=e=>this.templates.get(e);getRequestHandler=e=>this.apiRoutesRequestHandlers.get(e);createTemplate=(e,t)=>(this.templates.set(e,t),e);addBrowserPlugin=e=>{this.browserPlugins.add(e)};createRequestHandler=(e,t)=>(this.apiRoutesRequestHandlers.set(e,t),e);clearRequestHandlersByPrefix=e=>{for(const t of this.apiRoutesRequestHandlers.keys())t.startsWith(e)&&this.apiRoutesRequestHandlers.delete(t)};registerServerPropsGetter=(e,t)=>(this.serverPropsGetters.set(e,t),e);registerPagePropsGetter=(e,t)=>{this.pagePropsGetters.set(e,t)};async writeRouteStaticData(e,t){const s=await this.resolveRouteStaticData(e,t,!1);s&&V(e.slug,s,this.outdir)}async resolveRouteStaticData(e,t,s){if(this.serverMode)return q(e.slug,this.outdir);const a={...this,contentDir:this.contentDir,parseMarkdoc:({input:c,context:d,resource:f})=>this.parseMarkdoc({input:c,context:d,deps:{routeSlugs:[e.slug]},resource:f})},r=await e.getStaticData?.(e,a)||{},o=new Set(this.routesDynamicComponents.get(e.slug)),l=this.routesSharedData.get(e.slug)||{};for(const c of Object.values(l)){const d=this.sharedDataMarkdocComponents.get(c);d&&d.forEach(p=>o.add(p));const f=this.sharedDataDeps.get(c);f&&f.forEach(p=>this.addRouteSharedData(e.slug,p,p))}const i=this.getGlobalConfig("seo"),n=r?.frontmatter||{};return{...r,frontmatter:{...n,seo:{...n?.seo,title:n?.seo?.title||await e.getNavText?.()}},props:{...r.props,dynamicMarkdocComponents:Array.from(o),metadata:{...r?.props?.metadata,...e.metadata},seo:{title:T,...i,...r.props?.seo},compilationErrors:this.compilationErrors},lastModified:s||!e.fsPath?null:await this.lifecycleContext?.fs.getLastModified(e.fsPath)}}addSsrComponents(e,t){if(!e?.length)return;const s=typeof e[0]=="string"?e.join(""):N(e);s&&(t==="head"?this.ssr.headTags.push(s):t==="preBody"?this.ssr.preBodyTags.push(s):this.ssr.postBodyTags.push(s))}clear=()=>{this.routesByFsPath.clear(),this.templates.clear(),this.newRoutes=[],this.routesBySlug.clear(),this.apiRoutes=[],this.middleware=[],this.routesSharedData.clear(),this.sharedDataDeps.clear(),this.sharedDataMarkdocComponents.clear(),this.routesDynamicComponents.clear(),this.routesPartials.clear(),this.skills.clear(),this.config.redirects={},this.config.wildcardRedirectsTree={},this.config.directoryPermissions={},this.ssr={preBodyTags:[],postBodyTags:[],headTags:[]}};async toJson(){const e=[];for(const[s,a]of Object.entries(v))switch(a){case"map":const r=Array.from(this[s].entries());e.push([s,r]);break;case"object":s==="config"&&e.push([s,await this.getConfigWithEnvPlaceholders()]),e.push([s,this[s]]);break;default:throw new Error("Invalid format")}const t=Object.fromEntries(e);return t[E]=_.PLAN_GATES,t}static fromJson(e,t){const s=new P(t);for(const[r,o]of Object.entries(v))switch(o){case"map":s[r]=new Map(e[r]);break;case"object":if(r==="config"){s.setGlobalConfig(e[r]);break}s[r]=e[r];break;default:throw new Error("Invalid format")}s.config[m]=Q(s.config[m]||{});const a=e[E];return a&&G("PLAN_GATES",a),s}async getConfigWithEnvPlaceholders(){const e=JSON.parse(JSON.stringify(this.config));for(const t in this.replacedEnvVars){const{original:s}=this.replacedEnvVars[t],a=t.split(":"),r=a.pop(),{error:o,value:l}=D(e,a);if(o||!M(l)&&!Array.isArray(l)){await S.panicOnBuild(`Failed to replace env var with env name for ${t}`);continue}l[r]=s}return e}async reportUnsetEnvVars(){if(this.unsetEnvVars.size===0)return;const e=Array.from(this.unsetEnvVars).filter(s=>!Z.includes(s));if(e.length===0)return;const t=`Failed to resolve config. The following environment variables are not set: ${e.join(", ")}`;await S.panicOnBuildContentError(t)}}function Q(b){return k(b,e=>C.Ast.fromJSON(JSON.stringify(e)))}export{P as Store,Me as USER_DEFINED_API_FUNCTIONS_COUNTER_KEY};
1
+ import C from"@markdoc/markdoc";import{getPathnameForLocale as A}from"@redocly/theme/core/utils";import{DEFAULT_LOCALE_PLACEHOLDER as g}from"../constants/common.js";import{DEFAULT_TITLE as T}from"./constants/common.js";import{GATED_MARKDOC_TAGS as R}from"./constants/entitlements.js";import{MARKDOC_PARTIALS_DATA_KEY as m,MARKDOC_PARTIALS_DEPS_KEY as O}from"./constants/common.js";import{isObject as M}from"../utils/guards/is-object.js";import{mapObject as k}from"../utils/object/map-object.js";import{getValueDeep as D}from"../utils/object/get-value-deep.js";import{removeTrailingSlash as L}from"../utils/url/remove-trailing-slash.js";import{normalizeRouteSlug as h}from"../utils/path/normalize-route-slug.js";import{isLocalLink as y}from"../utils/path/is-local-link.js";import{reporter as S}from"./tools/notifiers/reporter.js";import{logger as u}from"./tools/notifiers/logger.js";import{sha1 as H}from"./utils/crypto/sha1.js";import{envConfig as _,setEnv as B}from"./config/env-config.js";import{KvService as F}from"./persistence/kv/services/kv-service.js";import{SandboxContext as G}from"./utils/sandbox-context.js";import{writeSharedData as I}from"./utils/index.js";import{renderComponents as N}from"./ssr/render.js";import{readStaticData as V,writeStaticData as q}from"./utils/static-data.js";import{parseAndResolveMarkdoc as j}from"./plugins/markdown/compiler.js";import{getMarkdocOptions as U}from"./plugins/markdown/markdoc/markdoc-options.js";import{EntitlementsProvider as w}from"./entitlements/entitlements-provider.js";import{isL10nPath as K}from"./fs/utils/is-l10n-path.js";import{resolveGlobMapValue as x}from"./utils/globs.js";import{replaceEnvVariablesDeep as J}from"./utils/envs/replace-env-variables-deep.js";import{findRedirect as W}from"./utils/redirects/find-redirect.js";import{followRedirectChain as $}from"./utils/redirects/follow-redirect-chain.js";import{addWildcardRedirectToTree as z}from"./utils/redirects/add-wildcard-redirect-to-tree.js";import{telemetryTraceStep as Y}from"../cli/telemetry/helpers/trace-step.js";const v={routesBySlug:"map",apiRoutes:"object",middleware:"object",routesByFsPath:"map",routesSharedData:"map",globalData:"object",config:"object",ssr:"object",searchFacets:"map",routesPartials:"map",mcpToolHandlers:"map",skills:"map"},E="PLAN_GATES",Z=["OAUTH_CLIENT_ID","OAUTH_CLIENT_SECRET","ORGANIZATION_SLUG","ORGANIZATION_ID","ORG_ID"],Me="userDefinedApiFunctions";class P{routesBySlug=new Map;replacedEnvVars={};unsetEnvVars=new Set;lifecycleContext;newRoutes=[];#t={};routesByFsPath=new Map;apiRoutes=[];middleware=[];routesSharedData=new Map;sharedDataDeps=new Map;sharedDataMarkdocComponents=new Map;routesDynamicComponents=new Map;routesPartials=new Map;ssr={preBodyTags:[],postBodyTags:[],headTags:[]};searchFacets=new Map;searchEngine;templates=new Map;browserPlugins=new Set;apiRoutesRequestHandlers=new Map;mcpToolHandlers=new Map;skills=new Map;serverPropsGetters=new Map;pagePropsGetters=new Map;listeners=new Map;globalData={};#o=void 0;config={configFilePath:"",redirects:{},wildcardRedirectsTree:{},access:{rbac:{},requiresLogin:!1},directoryPermissions:{},devLogin:!1,ssoDirect:{}};#i;serverMode;serverOutDir;outdir;buildRevision=0;hasSitemap=!1;compilationErrors=[];#n;userCodeReady;#s=Promise.resolve();#c;#l=Promise.resolve();#d;#u=Promise.resolve();#h;#e=!1;#r=0;#f=0;#a=new Map;constructor({outdir:e,contentDir:t,serverMode:s=!1,serverOutDir:a}){this.#i=t,this.outdir=e,this.serverMode=s,this.serverOutDir=a,G.register({serverOutDir:a,readRoots:[e,process.cwd()]}),this.userCodeReady=new Promise(r=>{this.#n=r})}on(e,t){const s=this.listeners.get(e);s?s.add(t):this.listeners.set(e,new Set([t]))}queueEvent=(e,t,...s)=>{this.#a.set(e+String(t),[e,t,...s])};runListeners=(e,t,...s)=>{for(const a of this.listeners.get(e)||new Set)t?a(t,...s):a(...s)};startPluginsRun(){this.clear(),this.#s=new Promise(e=>{this.#c=e})}waitForPluginsLifecycle(){return Promise.all([this.#s,this.#l,this.#u])}waitForPluginsRun(){return this.#s}finishPluginsRun(){this.#c?.();for(const e of this.#a.values())this.runListeners(...e);this.#a.clear()}startEsbuildRun(){this.#l=new Promise(e=>{this.#d=e})}finishEsbuildRun(){this.#d?.()}markRequestHandlersEntryOutdated(){this.#r++,!this.#e&&(this.#e=!0,this.#u=new Promise(e=>{this.#h=e}))}noteRequestHandlersEntryBuildStart(){this.#f=this.#r}markRequestHandlersEntryUpdated(){this.#e&&(this.#r>this.#f||(this.#e=!1,this.#h?.()))}get contentDir(){if(this.serverMode)throw new Error("contentDir should not be used in server mode");return this.#i}markUserCodeReady(){this.#n?.(!0)}async reloadMarkdocOptions(){await Y("com.redocly.build.reloadMarkdocOptions",async()=>{const e=w.instance(),t=await U(this.serverOutDir),s=Object.fromEntries(Object.entries(t.tags).filter(([a])=>R[a]!=null?e.canAccessFeature(R[a]):!0));this.#o={...t,tags:s}})}get markdocOptions(){return{...this.#o,partials:this.getGlobalConfig(m),themeConfig:this.config.markdown}}setGlobalData=e=>{const t=this.globalData,s={...this.globalData,...e};this.globalData=s,JSON.stringify(s)!==JSON.stringify(t)&&this.queueEvent("global-data-updated",void 0,s)};getGlobalData=()=>this.globalData;getKv=async()=>F.getInstance({baseDbDir:this.serverOutDir});parseMarkdoc=async({input:e,context:t,deps:s,resource:a})=>{const{data:{info:r,ast:o},compoundHash:l}=await j(e,this.markdocOptions,{actions:this,context:t},a);for(const i of r.sharedDataDeps||[]){for(const n of s?.routeSlugs||[])this.addRouteSharedData(n,i,i);for(const n of s?.sharedDataIds||[]){const c=this.sharedDataDeps.get(n)||new Set;c.add(i),this.sharedDataDeps.set(n,c)}}for(const i of r.dynamicMarkdocComponents||[]){for(const n of s?.routeSlugs||[]){const c=this.routesDynamicComponents.get(n)||new Set;c.add(i),this.routesDynamicComponents.set(n,c)}for(const n of s?.sharedDataIds||[]){const c=this.sharedDataMarkdocComponents.get(n)||new Set;c.add(i),this.sharedDataMarkdocComponents.set(n,c)}}if(s?.routeSlugs&&r.partials?.length)for(const i of s.routeSlugs){const n=this.routesPartials.get(i)||[];for(const c of r.partials)n.includes(c)||n.push(c);this.routesPartials.set(i,n)}return{info:r,ast:o,compoundHash:l}};async loadApiDocuments(e){return(await e.cache.load(".","api-docs")).data}setSearchEngine(e){this.searchEngine=e}setSearchFacets=e=>{this.searchFacets=e};setGlobalConfig=e=>{const t=Object.keys(e);for(const o of t)for(const l in this.replacedEnvVars)if(l===o||l.startsWith(`${o}:`)){const i=l.split(":"),{error:n,value:c}=D(e,i);(n||c!==this.replacedEnvVars[l].replaced)&&delete this.replacedEnvVars[l]}const{resolvedObj:s,unsetEnvVars:a,replacedValues:r}=J(e);for(const o of a)this.unsetEnvVars.add(o);Object.assign(this.replacedEnvVars,r),Object.assign(this.config,s)};getConfig=()=>this.config;getGlobalConfig=e=>this.config[e];getSearchFacets=()=>this.searchFacets;addRedirect=(e,t,s={})=>{if(!w.instance().canAccessFeature("redirects")&&e!=="/")return;this.config.redirects||(this.config.redirects={});const o=h(e).toLowerCase();this.config.redirects[o]=t;const{trackOriginalSource:l=!0}=s,i=this.getGlobalConfig("originalRedirectSources");l&&Array.isArray(i)&&!i.includes(o)&&i.push(o),o.endsWith("*")&&z(this.config.wildcardRedirectsTree,o)};getRedirect=e=>{const t=h(e).toLowerCase(),s=W(t,this.config.redirects,this.config.wildcardRedirectsTree);if(!s)return null;if(y(s.to)){const a=h(s.to).toLowerCase();if(!a.endsWith("*")&&$(a,[t],this.config.redirects,this.config.wildcardRedirectsTree).type==="cycle")return null}return{to:s.to,type:s.type}};createSharedData=async(e,t,s)=>{if(s&&this.#t[e]===s)return e;const a=JSON.stringify(t),r=s??H(a);return this.#t[e]===r||(this.#t[e]=r,await I(e,a,this.outdir),this.queueEvent("shared-data-updated",e)),e};addRouteSharedData=(e,t,s)=>{const a=L(e),r=this.routesSharedData.get(a)||{};r[t]=s,this.routesSharedData.set(a,r),u.verbose(`Adding shared data to ${e}, ${t}, ${s}`)};getRouteSharedDataByFsPath=e=>{const t=this.routesByFsPath.get(e);return t?this.routesSharedData.get(t)||{}:{}};getPartialsForRoute=e=>{const t=this.getGlobalConfig(m)||{},s=this.routesPartials.get(e);if(!s||s.length===0)return{};const a=this.getGlobalConfig(O)||{},r=new Set(s),o=Array.from(s);for(let i=0;i<o.length;i++){const n=o[i],c=a[n]?.partials??[];for(const d of c)r.has(d)||(r.add(d),o.push(d))}const l={};for(const i of r)t[i]&&(l[i]=t[i]);return l};addRoute=e=>{const s={...x(e.fsPath,this.config.metadataGlobs),...e.metadata||{}};this.newRoutes.push({...e,metadata:s}),u.verbose("Created route %s",e.slug)};addRouteSharedDataToAllLocales=(e,t,s)=>{const a=[g,...this.lifecycleContext?.fs.localeFolders||[]].map(r=>({code:r,name:r}));for(const r of a){const o=A(e,g,r.code,a);this.addRouteSharedData(o,t,s)}};addApiRoute=e=>{this.apiRoutes.push(e),u.verbose("Created API route %s",e.slug)};addMcpTools=(e,t)=>{for(const s of t)this.mcpToolHandlers.set(s.name,{...s,importPath:e}),u.verbose("Created MCP tool %s",s.name)};getMcpTools=()=>Array.from(this.mcpToolHandlers.values());addSkills=e=>{for(const t of e)this.skills.set(t.slug,t),u.verbose("Discovered skill %s",t.slug)};getSkills=()=>Array.from(this.skills.values());addMiddleware=e=>{this.middleware.push(e),u.verbose("Created middleware %s",e.id)};setResourceResponseHeaders=(e,t)=>{this.config.responseHeaders||(this.config.responseHeaders={});const s=new Set(t.map(o=>o.name.toLowerCase())),r=[...(this.config.responseHeaders[e]??[]).filter(o=>!s.has(o.name.toLowerCase())),...t];this.config.responseHeaders[e]=r};getRouteByFsPath=e=>{const t=this.routesByFsPath.get(e);return t?this.getRouteBySlug(t):void 0};getRouteBySlug=(e,t={})=>{const{followRedirect:s=!0}=t,a=this.getRedirect(e);return s&&a?this.routesBySlug.get(h(a.to)):this.routesBySlug.get(e)};hasRouteOrRedirectBySlug=e=>{if(this.routesBySlug.has(e))return!0;const t=this.getRedirect(e);if(!t)return!1;if(!y(t.to))return!0;const s=h(t.to);return this.routesBySlug.has(s)};getRoutesByTemplateId=e=>this.newRoutes.filter(t=>t.templateId===e);getAllRoutesForLocale=(e=g)=>{const t=Array.from(this.routesBySlug.values()),s=e.toLowerCase();return t.filter(a=>e===g?!K(a.fsPath):a.slug.startsWith(`/${s}`))};getAllRoutes=()=>Array.from(this.routesBySlug.values());getAllApiRoutes=()=>this.apiRoutes;getAllMiddleware=()=>this.middleware;getTemplate=e=>this.templates.get(e);getRequestHandler=e=>this.apiRoutesRequestHandlers.get(e);createTemplate=(e,t)=>(this.templates.set(e,t),e);addBrowserPlugin=e=>{this.browserPlugins.add(e)};createRequestHandler=(e,t)=>(this.apiRoutesRequestHandlers.set(e,t),e);clearRequestHandlersByPrefix=e=>{for(const t of this.apiRoutesRequestHandlers.keys())t.startsWith(e)&&this.apiRoutesRequestHandlers.delete(t)};registerServerPropsGetter=(e,t)=>(this.serverPropsGetters.set(e,t),e);registerPagePropsGetter=(e,t)=>{this.pagePropsGetters.set(e,t)};async writeRouteStaticData(e,t){const s=await this.resolveRouteStaticData(e,t,!1);s&&q(e.slug,s,this.outdir)}async resolveRouteStaticData(e,t,s){if(this.serverMode)return V(e.slug,this.outdir);const a={...this,contentDir:this.contentDir,parseMarkdoc:({input:c,context:d,resource:f})=>this.parseMarkdoc({input:c,context:d,deps:{routeSlugs:[e.slug]},resource:f})},r=await e.getStaticData?.(e,a)||{},o=new Set(this.routesDynamicComponents.get(e.slug)),l=this.routesSharedData.get(e.slug)||{};for(const c of Object.values(l)){const d=this.sharedDataMarkdocComponents.get(c);d&&d.forEach(p=>o.add(p));const f=this.sharedDataDeps.get(c);f&&f.forEach(p=>this.addRouteSharedData(e.slug,p,p))}const i=this.getGlobalConfig("seo"),n=r?.frontmatter||{};return{...r,frontmatter:{...n,seo:{...n?.seo,title:n?.seo?.title||await e.getNavText?.()}},props:{...r.props,dynamicMarkdocComponents:Array.from(o),metadata:{...r?.props?.metadata,...e.metadata},seo:{title:T,...i,...r.props?.seo},compilationErrors:this.compilationErrors},lastModified:s||!e.fsPath?null:await this.lifecycleContext?.fs.getLastModified(e.fsPath)}}addSsrComponents(e,t){if(!e?.length)return;const s=typeof e[0]=="string"?e.join(""):N(e);s&&(t==="head"?this.ssr.headTags.push(s):t==="preBody"?this.ssr.preBodyTags.push(s):this.ssr.postBodyTags.push(s))}clear=()=>{this.routesByFsPath.clear(),this.templates.clear(),this.newRoutes=[],this.routesBySlug.clear(),this.apiRoutes=[],this.middleware=[],this.routesSharedData.clear(),this.sharedDataDeps.clear(),this.sharedDataMarkdocComponents.clear(),this.routesDynamicComponents.clear(),this.routesPartials.clear(),this.skills.clear(),this.config.redirects={},this.config.wildcardRedirectsTree={},this.config.directoryPermissions={},this.ssr={preBodyTags:[],postBodyTags:[],headTags:[]}};async toJson(){const e=[];for(const[s,a]of Object.entries(v))switch(a){case"map":const r=Array.from(this[s].entries());e.push([s,r]);break;case"object":s==="config"&&e.push([s,await this.getConfigWithEnvPlaceholders()]),e.push([s,this[s]]);break;default:throw new Error("Invalid format")}const t=Object.fromEntries(e);return t[E]=_.PLAN_GATES,t}static fromJson(e,t){const s=new P(t);for(const[r,o]of Object.entries(v))switch(o){case"map":s[r]=new Map(e[r]);break;case"object":if(r==="config"){s.setGlobalConfig(e[r]);break}s[r]=e[r];break;default:throw new Error("Invalid format")}s.config[m]=Q(s.config[m]||{});const a=e[E];return a&&B("PLAN_GATES",a),s}async getConfigWithEnvPlaceholders(){const e=JSON.parse(JSON.stringify(this.config));for(const t in this.replacedEnvVars){const{original:s}=this.replacedEnvVars[t],a=t.split(":"),r=a.pop(),{error:o,value:l}=D(e,a);if(o||!M(l)&&!Array.isArray(l)){await S.panicOnBuild(`Failed to replace env var with env name for ${t}`);continue}l[r]=s}return e}async reportUnsetEnvVars(){if(this.unsetEnvVars.size===0)return;const e=Array.from(this.unsetEnvVars).filter(s=>!Z.includes(s));if(e.length===0)return;const t=`Failed to resolve config. The following environment variables are not set: ${e.join(", ")}`;await S.panicOnBuildContentError(t)}}function Q(b){return k(b,e=>C.Ast.fromJSON(JSON.stringify(e)))}export{P as Store,Me as USER_DEFINED_API_FUNCTIONS_COUNTER_KEY};
@@ -8,8 +8,7 @@ import type { GlobalData, Feature } from '../../../types/index.js';
8
8
  import type { SearchDocument } from '../../types';
9
9
  import type { RbacScopeItems, RedirectConfig, RedoclyConfig, ServerPropsContext, ServerPropsRequest, PageProps, PageStaticData, NavItem, ResolvedNavItem, Version, MdOptions, KvService } from '@redocly/config';
10
10
  import type { LoaderFn } from '../fs';
11
- import type { BundledDefinition } from '../../plugins/openapi-docs/load-definition';
12
- import type { BundledDefinition as GraphqlBundledDefinition } from '../../plugins/graphql-docs/graphql-doc-loader';
11
+ import type { BundledApiDefinition } from '../../plugins/api-docs/loader';
13
12
  import type { Cache } from '../../fs/cache';
14
13
  import type { ContentFs } from '../../fs/content-fs';
15
14
  import type { SearchEngine } from '../../plugins/search/engines/search-engine';
@@ -148,8 +147,7 @@ export type ProcessContentActions = {
148
147
  createSharedData(id: string, data: unknown, hash?: string): Promise<string>;
149
148
  addRouteSharedData(slug: string, dataKey: string, dataId: string): void;
150
149
  addRouteSharedDataToAllLocales(slug: string, dataKey: string, dataId: string): void;
151
- loadOpenApiDefinitions(context: LifecycleContext): Promise<BundledDefinition[]>;
152
- loadGraphqlDefinitions(context: LifecycleContext): Promise<GraphqlBundledDefinition[]>;
150
+ loadApiDocuments(context: LifecycleContext): Promise<BundledApiDefinition[]>;
153
151
  setGlobalConfig: (data: Record<string, unknown>) => void;
154
152
  setGlobalData: (data: GlobalData) => void;
155
153
  getConfig: () => RedoclyConfig;
@@ -210,7 +208,7 @@ export type AfterRoutesCreatedActions = {
210
208
  addApiRoute: (route: ApiRoute) => void;
211
209
  addSkills: (skills: Skill[]) => void;
212
210
  getSkills: () => Skill[];
213
- loadOpenApiDefinitions(context: LifecycleContext): Promise<BundledDefinition[]>;
211
+ loadApiDocuments(context: LifecycleContext): Promise<BundledApiDefinition[]>;
214
212
  getRouteSharedDataByFsPath: (routeFsPath: string) => Record<string, string> | undefined;
215
213
  getKv: () => Promise<KvService>;
216
214
  setResourceResponseHeaders: (resourcePath: string, headers: NonNullable<RedoclyConfig['responseHeaders']>[string]) => void;
@@ -1,8 +1,6 @@
1
- import type { Node } from '@markdoc/markdoc';
2
1
  import type { PageStaticData, REDOCLY_ROUTE_RBAC, REDOCLY_TEAMS_RBAC, RbacScopeItems } from '@redocly/config';
3
2
  import type { PluginDefaultOptions, PageRouteDetails, LifecycleContext, AfterRoutesCreatedActions, MarkdownParseInput } from '../../types';
4
3
  import type { LINK_ORIGINAL_ATTR_NAME } from '../../constants/common';
5
- import type { RenderForLlmsRenderContext } from '@redocly/theme/markdoc/tags/types';
6
4
  export type RoutesInfoActions = {
7
5
  outdir: string;
8
6
  getRouteByFsPath: (relativePath: string) => PageRouteDetails | undefined;
@@ -42,5 +40,5 @@ export type ParseMarkdocOpts = {
42
40
  deps?: MarkdocDeps;
43
41
  resource?: string;
44
42
  };
45
- export type RenderTagFn = (node: Node, context: RenderForLlmsRenderContext) => string | undefined;
43
+ export type { RenderTagFn } from '../../../types/index.js';
46
44
  //# sourceMappingURL=markdown.d.ts.map
@@ -55,6 +55,7 @@ export type AiSearchDocument = {
55
55
  locale: string;
56
56
  product?: string;
57
57
  facets?: Record<string, string>;
58
+ rbacTeams?: string[];
58
59
  };
59
60
  export type SearchDocument = {
60
61
  id: string;
@@ -1 +1 @@
1
- import{describe as d,it as u,expect as t,vi as e,beforeEach as m}from"vitest";import{getRouteSlugToCatalogSlugMap as r}from"./get-route-slug-to-catalog-slug-map.js";import{resolveItems as s}from"../../plugins/nav-utils.js";import{collectPropValueDeep as n}from"../../../utils/tree/collect-prop-value-deep.js";e.mock("~/server/plugins/nav-utils.js"),e.mock("~/shared/utils/tree/collect-prop-value-deep.js"),d("getRouteSlugToCatalogSlugMap",()=>{let g,c;m(()=>{e.clearAllMocks(),g={contentDir:"/content",outdir:"/out",serverOutDir:"/server-out",hasSitemap:!1,createSharedData:e.fn(),addRouteSharedData:e.fn(),getRouteByFsPath:e.fn(),getRouteBySlug:e.fn(),getConfig:e.fn(),getGlobalConfig:e.fn(),getAllRoutes:e.fn(),getAllRoutesForLocale:e.fn(),getAllApiRoutes:e.fn(),setGlobalData:e.fn(),getGlobalData:e.fn(),setGlobalConfig:e.fn(),parseMarkdoc:e.fn(),setSearchFacets:e.fn(),getSearchFacets:e.fn(),setSearchEngine:e.fn(),addRedirect:e.fn(),addBrowserPlugin:e.fn(),addSsrComponents:e.fn(),addApiRoute:e.fn(),loadOpenApiDefinitions:e.fn(),getRouteSharedDataByFsPath:e.fn()},c={fs:{},cache:{},getConfig:e.fn(),isPathIgnored:e.fn(),withPathPrefix:e.fn(),logger:{}}}),u("should return empty map when catalogs object is empty",async()=>{const a=await r(g,c,{});t(a).toBeInstanceOf(Map),t(a.size).toBe(0),t(s).not.toHaveBeenCalled()}),u("should return empty map when catalog has no resolved items",async()=>{const o={catalog1:{slug:"catalog1",items:[]}};e.mocked(s).mockResolvedValue(void 0);const a=await r(g,c,o);t(a).toBeInstanceOf(Map),t(a.size).toBe(0),t(s).toHaveBeenCalledTimes(1),t(n).not.toHaveBeenCalled()}),u("should map route slugs to catalog slug for single catalog with items",async()=>{const o={catalog1:{slug:"catalog1",items:[]}},a=[{routeSlug:"/page1",label:"Page 1"},{routeSlug:"/page2",label:"Page 2"}];e.mocked(s).mockResolvedValue(a),e.mocked(n).mockReturnValue(["/page1","/page2"]);const l=await r(g,c,o);t(l.size).toBe(2),t(l.get("/page1")).toBe("catalog1"),t(l.get("/page2")).toBe("catalog1"),t(s).toHaveBeenCalledWith(o.catalog1.items,g.contentDir,g,c,{navFile:""}),t(n).toHaveBeenCalledWith(a,"routeSlug")}),u("should map route slugs to catalog slug for multiple catalogs",async()=>{const o={catalog1:{slug:"catalog1",items:[]},catalog2:{slug:"catalog2",items:[]}},a=[{routeSlug:"/page1",label:"Page 1"}],l=[{routeSlug:"/page2",label:"Page 2"},{routeSlug:"/page3",label:"Page 3"}];e.mocked(s).mockResolvedValueOnce(a).mockResolvedValueOnce(l),e.mocked(n).mockReturnValueOnce(["/page1"]).mockReturnValueOnce(["/page2","/page3"]);const i=await r(g,c,o);t(i.size).toBe(3),t(i.get("/page1")).toBe("catalog1"),t(i.get("/page2")).toBe("catalog2"),t(i.get("/page3")).toBe("catalog2"),t(s).toHaveBeenCalledTimes(2),t(n).toHaveBeenCalledTimes(2)}),u("should handle catalog with empty resolved items array",async()=>{const o={catalog1:{slug:"catalog1",items:[]}};e.mocked(s).mockResolvedValue([]),e.mocked(n).mockReturnValue([]);const a=await r(g,c,o);t(a.size).toBe(0),t(s).toHaveBeenCalledTimes(1),t(n).toHaveBeenCalledWith([],"routeSlug")}),u("should handle nested items with route slugs",async()=>{const o={catalog1:{slug:"catalog1",items:[]}},a=[{routeSlug:"/parent",label:"Parent",items:[{routeSlug:"/parent/child1",label:"Child 1"},{routeSlug:"/parent/child2",label:"Child 2"}]}];e.mocked(s).mockResolvedValue(a),e.mocked(n).mockReturnValue(["/parent","/parent/child1","/parent/child2"]);const l=await r(g,c,o);t(l.size).toBe(3),t(l.get("/parent")).toBe("catalog1"),t(l.get("/parent/child1")).toBe("catalog1"),t(l.get("/parent/child2")).toBe("catalog1")}),u("should handle items without routeSlug property",async()=>{const o={catalog1:{slug:"catalog1",items:[]}},a=[{label:"Page without route slug"},{routeSlug:"/page-with-slug",label:"Page with slug"}];e.mocked(s).mockResolvedValue(a),e.mocked(n).mockReturnValue(["/page-with-slug"]);const l=await r(g,c,o);t(l.size).toBe(1),t(l.get("/page-with-slug")).toBe("catalog1")}),u("should overwrite route slug mapping when same route slug appears in multiple catalogs",async()=>{const o={catalog1:{slug:"catalog1",items:[]},catalog2:{slug:"catalog2",items:[]}},a=[{routeSlug:"/shared-page",label:"Shared Page"}],l=[{routeSlug:"/shared-page",label:"Shared Page"}];e.mocked(s).mockResolvedValueOnce(a).mockResolvedValueOnce(l),e.mocked(n).mockReturnValueOnce(["/shared-page"]).mockReturnValueOnce(["/shared-page"]);const i=await r(g,c,o);t(i.size).toBe(1),t(i.get("/shared-page")).toBe("catalog2")})});
1
+ import{describe as d,it as u,expect as t,vi as e,beforeEach as m}from"vitest";import{getRouteSlugToCatalogSlugMap as r}from"./get-route-slug-to-catalog-slug-map.js";import{resolveItems as s}from"../../plugins/nav-utils.js";import{collectPropValueDeep as n}from"../../../utils/tree/collect-prop-value-deep.js";e.mock("~/server/plugins/nav-utils.js"),e.mock("~/shared/utils/tree/collect-prop-value-deep.js"),d("getRouteSlugToCatalogSlugMap",()=>{let g,c;m(()=>{e.clearAllMocks(),g={contentDir:"/content",outdir:"/out",serverOutDir:"/server-out",hasSitemap:!1,createSharedData:e.fn(),addRouteSharedData:e.fn(),getRouteByFsPath:e.fn(),getRouteBySlug:e.fn(),getConfig:e.fn(),getGlobalConfig:e.fn(),getAllRoutes:e.fn(),getAllRoutesForLocale:e.fn(),getAllApiRoutes:e.fn(),setGlobalData:e.fn(),getGlobalData:e.fn(),setGlobalConfig:e.fn(),parseMarkdoc:e.fn(),setSearchFacets:e.fn(),getSearchFacets:e.fn(),setSearchEngine:e.fn(),addRedirect:e.fn(),addBrowserPlugin:e.fn(),addSsrComponents:e.fn(),addApiRoute:e.fn(),loadApiDocuments:e.fn(),getRouteSharedDataByFsPath:e.fn()},c={fs:{},cache:{},getConfig:e.fn(),isPathIgnored:e.fn(),withPathPrefix:e.fn(),logger:{}}}),u("should return empty map when catalogs object is empty",async()=>{const a=await r(g,c,{});t(a).toBeInstanceOf(Map),t(a.size).toBe(0),t(s).not.toHaveBeenCalled()}),u("should return empty map when catalog has no resolved items",async()=>{const o={catalog1:{slug:"catalog1",items:[]}};e.mocked(s).mockResolvedValue(void 0);const a=await r(g,c,o);t(a).toBeInstanceOf(Map),t(a.size).toBe(0),t(s).toHaveBeenCalledTimes(1),t(n).not.toHaveBeenCalled()}),u("should map route slugs to catalog slug for single catalog with items",async()=>{const o={catalog1:{slug:"catalog1",items:[]}},a=[{routeSlug:"/page1",label:"Page 1"},{routeSlug:"/page2",label:"Page 2"}];e.mocked(s).mockResolvedValue(a),e.mocked(n).mockReturnValue(["/page1","/page2"]);const l=await r(g,c,o);t(l.size).toBe(2),t(l.get("/page1")).toBe("catalog1"),t(l.get("/page2")).toBe("catalog1"),t(s).toHaveBeenCalledWith(o.catalog1.items,g.contentDir,g,c,{navFile:""}),t(n).toHaveBeenCalledWith(a,"routeSlug")}),u("should map route slugs to catalog slug for multiple catalogs",async()=>{const o={catalog1:{slug:"catalog1",items:[]},catalog2:{slug:"catalog2",items:[]}},a=[{routeSlug:"/page1",label:"Page 1"}],l=[{routeSlug:"/page2",label:"Page 2"},{routeSlug:"/page3",label:"Page 3"}];e.mocked(s).mockResolvedValueOnce(a).mockResolvedValueOnce(l),e.mocked(n).mockReturnValueOnce(["/page1"]).mockReturnValueOnce(["/page2","/page3"]);const i=await r(g,c,o);t(i.size).toBe(3),t(i.get("/page1")).toBe("catalog1"),t(i.get("/page2")).toBe("catalog2"),t(i.get("/page3")).toBe("catalog2"),t(s).toHaveBeenCalledTimes(2),t(n).toHaveBeenCalledTimes(2)}),u("should handle catalog with empty resolved items array",async()=>{const o={catalog1:{slug:"catalog1",items:[]}};e.mocked(s).mockResolvedValue([]),e.mocked(n).mockReturnValue([]);const a=await r(g,c,o);t(a.size).toBe(0),t(s).toHaveBeenCalledTimes(1),t(n).toHaveBeenCalledWith([],"routeSlug")}),u("should handle nested items with route slugs",async()=>{const o={catalog1:{slug:"catalog1",items:[]}},a=[{routeSlug:"/parent",label:"Parent",items:[{routeSlug:"/parent/child1",label:"Child 1"},{routeSlug:"/parent/child2",label:"Child 2"}]}];e.mocked(s).mockResolvedValue(a),e.mocked(n).mockReturnValue(["/parent","/parent/child1","/parent/child2"]);const l=await r(g,c,o);t(l.size).toBe(3),t(l.get("/parent")).toBe("catalog1"),t(l.get("/parent/child1")).toBe("catalog1"),t(l.get("/parent/child2")).toBe("catalog1")}),u("should handle items without routeSlug property",async()=>{const o={catalog1:{slug:"catalog1",items:[]}},a=[{label:"Page without route slug"},{routeSlug:"/page-with-slug",label:"Page with slug"}];e.mocked(s).mockResolvedValue(a),e.mocked(n).mockReturnValue(["/page-with-slug"]);const l=await r(g,c,o);t(l.size).toBe(1),t(l.get("/page-with-slug")).toBe("catalog1")}),u("should overwrite route slug mapping when same route slug appears in multiple catalogs",async()=>{const o={catalog1:{slug:"catalog1",items:[]},catalog2:{slug:"catalog2",items:[]}},a=[{routeSlug:"/shared-page",label:"Shared Page"}],l=[{routeSlug:"/shared-page",label:"Shared Page"}];e.mocked(s).mockResolvedValueOnce(a).mockResolvedValueOnce(l),e.mocked(n).mockReturnValueOnce(["/shared-page"]).mockReturnValueOnce(["/shared-page"]);const i=await r(g,c,o);t(i.size).toBe(1),t(i.get("/shared-page")).toBe("catalog2")})});
@@ -1 +1 @@
1
- import{envConfig as p}from"../config/env-config.js";import{reporter as r}from"../tools/notifiers/reporter.js";import{isMarkdocError as d}from"../plugins/markdown/errors.js";import{telemetryTraceStep as m}from"../../cli/telemetry/helpers/trace-step.js";async function k(i){await m("build.validation_errors",async n=>{let e=0;for(const[a,c]of i.cache.errors.entries()){const f=a.split(":")[1];for(const o of c)d(o)?(r.reportMarkdocProblem(o),o.type!=="BROKEN_LINK"&&e++):await r.panicOnBuild(o.message,f)}const s=await i.getConfig();if(!p.isBuildMode)return;const t=r.getPageRenderProblems().length;n?.setAttribute("markdocErrors",e.toString()),n?.setAttribute("pageRenderErrors",t.toString()),e>0&&!s?.reunite?.ignoreMarkdocErrors?(r.printErrors(),await r.panic(`Need to fix ${e} Markdoc issue(s) or set the \`ignoreMarkdocErrors\` option to \`true\` in the \`reunite\` section of your \`redocly.yaml\``)):t>0&&(r.printErrors(),await r.panic(`Need to fix ${t} runtime error(s) in React pages`))})}export{k as reportAllErrors};
1
+ import{envConfig as d}from"../config/env-config.js";import{reporter as r}from"../tools/notifiers/reporter.js";import{isMarkdocError as p}from"../plugins/markdown/errors.js";import{telemetryTraceStep as m}from"../../cli/telemetry/helpers/trace-step.js";async function y(i){await m("com.redocly.build.validationErrors",async n=>{let e=0;for(const[a,c]of i.cache.errors.entries()){const f=a.split(":")[1];for(const o of c)p(o)?(r.reportMarkdocProblem(o),o.type!=="BROKEN_LINK"&&e++):await r.panicOnBuild(o.message,f)}const s=await i.getConfig();if(!d.isBuildMode)return;const t=r.getPageRenderProblems().length;n?.setAttribute("markdocErrors",e.toString()),n?.setAttribute("pageRenderErrors",t.toString()),e>0&&!s?.reunite?.ignoreMarkdocErrors?(r.printErrors(),await r.panic(`Need to fix ${e} Markdoc issue(s) or set the \`ignoreMarkdocErrors\` option to \`true\` in the \`reunite\` section of your \`redocly.yaml\``)):t>0&&(r.printErrors(),await r.panic(`Need to fix ${t} runtime error(s) in React pages`))})}export{y as reportAllErrors};
@@ -1 +1 @@
1
- import n from"path";import{readFile as c,writeFileSync as l}from"fs";import{getSharedDataUrl as f}from"../../utils/url/get-shared-data-url.js";import{logger as m}from"../tools/notifiers/logger.js";import{ensureDir as p}from"./fs.js";const s={},v=async(e,t,r)=>{const a=d(e,r);await s[a],l(p(a),t,{encoding:"utf-8",flush:!0})},P=async(e,t)=>{try{const r=d(e,t),a=new Promise(o=>c(r,"utf-8",(i,h)=>{o(i?void 0:JSON.parse(h))}));return s[r]=a,a.finally(()=>{delete s[r]})}catch(r){m.warnProd(`Failed to read shared data ${e} with error: ${r instanceof Error?r.message:"Unknown error"}`);return}},d=(e,t)=>{const r=n.join(t,f(e)),a=n.resolve(t,"page-data/shared"),o=n.resolve(t,r);if(n.relative(a,o).startsWith(".."))throw new Error(`Invalid shared data id: ${e}`);return o};export{P as readSharedData,v as writeSharedData};
1
+ import s from"path";import{readFile as l,writeFileSync as p}from"fs";import{stat as u}from"fs/promises";import{LRUCache as w}from"lru-cache";import{getSharedDataUrl as z}from"../../utils/url/get-shared-data-url.js";import{logger as D}from"../tools/notifiers/logger.js";import{ensureDir as S}from"./fs.js";const o={},h=new w({max:64,maxSize:192*1024*1024,sizeCalculation:a=>Math.max(a.size,1)}),R=async(a,n,e)=>{const i=c(a,e);await o[i],h.delete(i),p(S(i),n,{encoding:"utf-8",flush:!0})},C=async(a,n)=>{try{const e=c(a,n),i=o[e];if(i)return i;const t=await u(e).catch(()=>{});if(t){const r=h.get(e);if(r&&r.mtimeMs===t.mtimeMs&&r.size===t.size)return r.data}const d=new Promise(r=>l(e,"utf-8",(m,f)=>{r(m?void 0:JSON.parse(f))}));return o[e]=d,d.finally(()=>{delete o[e]}).then(r=>(t&&r!==void 0&&h.set(e,{mtimeMs:t.mtimeMs,size:t.size,data:r},{size:Math.max(t.size,1)}),r))}catch(e){D.warnProd(`Failed to read shared data ${a} with error: ${e instanceof Error?e.message:"Unknown error"}`);return}},c=(a,n)=>{const e=s.join(n,z(a)),i=s.resolve(n,"page-data/shared"),t=s.resolve(n,e);if(s.relative(i,t).startsWith(".."))throw new Error(`Invalid shared data id: ${a}`);return t};export{C as readSharedData,R as writeSharedData};
@@ -1 +1 @@
1
- import{Source as m}from"@redocly/openapi-core";import g from"node:fs/promises";import d from"node:path";import{withPathPrefix as S,getPathPrefix as h,combineUrls as E}from"@redocly/theme/core/utils";import{OPENAPI_SHARED_DATA_PREFIX as P}from"../../constants/plugins/openapi-docs.js";import{CATALOG_BASE_SLUG as y,CATALOG_SLUGS as _}from"../../../constants/catalog-entities.js";import{CATALOG_ENTITIES_FILES_REGEX as I}from"../../constants/plugins/catalog-entities.js";import{removeTrailingSlash as T}from"../../../utils/url/remove-trailing-slash.js";import{normalizeRouteSlug as U}from"../../../utils/path/normalize-route-slug.js";import{promiseMapLimit as $}from"../../utils/async/promise-map-limit.js";import{getRoutesByLines as R,getPointerPosition as q}from"../../plugins/openapi-docs/ast-utils.js";import{readSharedData as j}from"../../utils/index.js";function X(o){return async t=>{const s=await t.req.json(),n=decodeURI(T(s.split("?")[0])),[e]=n.split("#"),u=h(),a=U(e.slice(u.length)),l=a.startsWith(y)?y:a,r=o.getRouteBySlug(l);if(r&&o.getRouteByFsPath(r.fsPath)?.metadata?.type==="openapi"){const c=await j(`${P}${r.fsPath}`,o.outdir),i=Object.keys(c.routesMapping).find(p=>E(r.baseSlug,c.routesMapping[p])===n);if(!c.sourcePath)return t.json({route:r},200);let f;if(i){const p=d.join(o.contentDir,r.fsPath),b=await g.readFile(p,"utf-8"),L=new m(p,b);f=q(i,L)}return t.json({route:{fsPath:r.fsPath,pointer:i,position:f}},200)}return t.json({route:r},200)}}function k(o){return async t=>{const s=await t.req.json(),n=await $(s,5,async e=>A(e,o));return t.json({routes:n},200)}}function J(o){return async t=>{const s=await t.req.json(),n=await A(s,o);return t.json(n,200)}}function K(o){return async t=>{const s=(t.req.query("lines")||"").split(",").map(a=>parseInt(a)),n=t.req.query("file");if(!n)return t.json("No data",400);const e=await j(`${P}${n}`,o.outdir),u=d.join(o.contentDir,n);try{const a=await g.readFile(u,"utf-8");if(!e)return t.json("No data",400);const l=new m(u,a),r=R(s,l,e.routesMapping,e.baseSlug);return t.json(r,200)}catch{return t.json("No data",400)}}}async function A(o,t){const[s,n]=o.split(":");if(I.test(s))return{route:{slug:`${y}/${_.ALL}`}};let e=t.getRouteByFsPath(s);if(e?.metadata?.type==="openapi"){const l=await j(`${P}${s}`,t.outdir);if(l?.sourcePath){const r=d.join(t.contentDir,e.fsPath),w=await g.readFile(r,"utf-8"),c=new m(r,w),i=R([parseInt(n,10)],c,l.routesMapping,e.baseSlug);if(i.length)return{route:{slug:h()?S(i[0]):i[0],filePath:o}}}}const u=e?.slug?h()?S(e?.slug):e?.slug:"";return{route:{...e,pageName:e?await e?.getNavText?.():"",slug:u,filePath:o}}}export{K as getRoutesByLineHandler,J as resolvePathHandler,k as resolvePathsHandler,X as resolveSlugHandler};
1
+ import{Source as P}from"@redocly/openapi-core";import y from"node:fs/promises";import S from"node:path";import{withPathPrefix as j,getPathPrefix as h,combineUrls as w}from"@redocly/theme/core/utils";import{API_DOCS_SHARED_DATA_PREFIX as d}from"../../constants/plugins/api-docs.js";import{CATALOG_BASE_SLUG as b,CATALOG_SLUGS as $}from"../../../constants/catalog-entities.js";import{CATALOG_ENTITIES_FILES_REGEX as I}from"../../constants/plugins/catalog-entities.js";import{removeTrailingSlash as E}from"../../../utils/url/remove-trailing-slash.js";import{normalizeRouteSlug as N}from"../../../utils/path/normalize-route-slug.js";import{promiseMapLimit as T}from"../../utils/async/promise-map-limit.js";import{getRoutesByLines as L,getPointerPosition as U}from"../../plugins/openapi-docs/ast-utils.js";import{readSharedData as m}from"../../utils/index.js";const q=new Set(["openapi","asyncapi"]);function K(n){return async t=>{const i=await t.req.json(),r=decodeURI(E(i.split("?")[0])),[o]=r.split("#"),g=h(),f=N(o.slice(g.length)),u=f.startsWith(b)?b:f,e=n.getRouteBySlug(u);if(e){const p=n.getRouteByFsPath(e.fsPath);if(p?.metadata?.type&&q.has(p.metadata.type)){const a=await m(`${d}${e.fsPath}`,n.outdir);if(!a?.routesMapping)return t.json({route:e},200);const s=Object.keys(a.routesMapping).find(c=>w(e.baseSlug,a.routesMapping[c])===r);if(!a.sourcePath)return t.json({route:e},200);let l;if(s){const c=S.join(n.contentDir,e.fsPath),R=await y.readFile(c,"utf-8"),_=new P(c,R);l=U(s,_)}return t.json({route:{fsPath:e.fsPath,pointer:s,position:l}},200)}if(p?.metadata?.type==="graphql"){const a=await m(`${d}${e.fsPath}`,n.outdir);if(!a?.graphqlPositions)return t.json({route:e},200);const s=Object.keys(a.graphqlPositions).find(c=>w(e.baseSlug,c)===r),l=s?a.graphqlPositions[s].position:void 0;return t.json({route:{fsPath:e.fsPath,position:l}},200)}}return t.json({route:e},200)}}function X(n){return async t=>{const i=await t.req.json(),r=await T(i,5,async o=>A(o,n));return t.json({routes:r},200)}}function Y(n){return async t=>{const i=await t.req.json(),r=await A(i,n);return t.json(r,200)}}function J(n){return async t=>{const i=(t.req.query("lines")||"").split(",").map(f=>parseInt(f)),r=t.req.query("file");if(!r)return t.json("No data",400);const o=await m(`${d}${r}`,n.outdir),g=S.join(n.contentDir,r);try{const f=await y.readFile(g,"utf-8");if(!o)return t.json("No data",400);const u=new P(g,f),e=L(i,u,o.routesMapping,o.baseSlug);return t.json(e,200)}catch{return t.json("No data",400)}}}async function A(n,t){const[i,r]=n.split(":");if(I.test(i))return{route:{slug:`${b}/${$.ALL}`}};let o=t.getRouteByFsPath(i);if(o?.metadata?.type&&q.has(o.metadata.type)){const u=await m(`${d}${i}`,t.outdir);if(u?.sourcePath){const e=S.join(t.contentDir,o.fsPath),p=await y.readFile(e,"utf-8"),a=new P(e,p),s=L([parseInt(r,10)],a,u.routesMapping,o.baseSlug);if(s.length)return{route:{slug:h()?j(s[0]):s[0],filePath:n}}}}if(o?.metadata?.type==="graphql"){const u=await m(`${d}${i}`,t.outdir),e=parseInt(r,10);if(u?.sourcePath&&u.graphqlPositions&&!Number.isNaN(e)){let p,a=1/0;for(const[s,{startLine:l,endLine:c}]of Object.entries(u.graphqlPositions))l<=e&&e<=c&&c-l<a&&(a=c-l,p=s);if(p){const s=w(o.baseSlug,p);return{route:{slug:h()?j(s):s,filePath:n}}}}}const g=o?.slug?h()?j(o?.slug):o?.slug:"";return{route:{...o,pageName:o?await o?.getNavText?.():"",slug:g,filePath:n}}}export{J as getRoutesByLineHandler,Y as resolvePathHandler,X as resolvePathsHandler,K as resolveSlugHandler};
@@ -1,5 +1,6 @@
1
1
  import type { Node, Variable, RenderableTreeNode, Function } from '@markdoc/markdoc';
2
- import type { RenderTagFn } from '../server/types/plugins/markdown.js';
2
+ import type { RenderForLlmsRenderContext } from '@redocly/theme/markdoc/tags/types';
3
+ export type RenderTagFn = (node: Node, context: RenderForLlmsRenderContext) => string | undefined;
3
4
  export type GetInnerContentFnOptions = {
4
5
  indent?: number;
5
6
  isTrim?: boolean;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Builds the exact URL used to fetch shared page data over HTTP. The client
3
+ * loader and the server-side `<link rel="preload">` generation must both use
4
+ * this function so the preloaded URL matches the fetched URL byte for byte.
5
+ *
6
+ * @param id - The unique identifier of the shared data resource.
7
+ * @param isDevelopMode - Whether the portal runs in develop mode, where the URL is kept raw instead of URI-encoded.
8
+ * @returns The path-prefixed (and, outside develop mode, URI-encoded) shared data URL.
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * getSharedDataFetchUrl('with space', false);
13
+ * // "/page-data/shared/with%20space.json"
14
+ * ```
15
+ */
16
+ export declare function getSharedDataFetchUrl(id: string, isDevelopMode: boolean): string;
17
+ //# sourceMappingURL=get-shared-data-fetch-url.d.ts.map
@@ -0,0 +1 @@
1
+ import{withPathPrefix as a}from"@redocly/theme/core/utils";import{getSharedDataUrl as o}from"./get-shared-data-url.js";function n(t,e){const r=a(o(t));return e?r:encodeURI(r)}export{n as getSharedDataFetchUrl};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/realm",
3
- "version": "0.136.0-next.6",
3
+ "version": "0.136.0-next.7",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "bin": {
@@ -33,7 +33,7 @@
33
33
  "@opentelemetry/semantic-conventions": "1.40.0",
34
34
  "@redocly/ajv": "8.18.0",
35
35
  "@redocly/mcp-typescript-sdk": "1.18.1",
36
- "@redocly/openapi-core": "2.40.0",
36
+ "@redocly/openapi-core": "2.43.1",
37
37
  "@shikijs/transformers": "3.21.0",
38
38
  "@tanstack/react-query": "5.62.3",
39
39
  "@tanstack/react-table": "8.21.3",
@@ -94,14 +94,15 @@
94
94
  "xpath": "0.0.34",
95
95
  "yaml-ast-parser": "0.0.43",
96
96
  "zod": "^3.25.76",
97
- "@redocly/asyncapi-docs": "1.13.0-next.6",
98
- "@redocly/config": "0.53.0",
99
- "@redocly/graphql-docs": "1.13.0-next.6",
100
- "@redocly/openapi-docs": "3.24.0-next.6",
97
+ "@redocly/api-docs": "0.1.0-next.0",
98
+ "@redocly/asyncapi-docs": "1.13.0-next.7",
99
+ "@redocly/config": "0.53.1",
100
+ "@redocly/graphql-docs": "1.13.0-next.7",
101
+ "@redocly/openapi-docs": "3.24.0-next.7",
101
102
  "@redocly/portal-legacy-ui": "0.18.0",
102
- "@redocly/portal-plugin-mock-server": "0.21.0-next.6",
103
+ "@redocly/portal-plugin-mock-server": "0.21.0-next.7",
103
104
  "@redocly/realm-asyncapi-sdk": "0.14.0-next.0",
104
- "@redocly/theme": "0.68.0-next.4"
105
+ "@redocly/theme": "0.68.0-next.5"
105
106
  },
106
107
  "peerDependencies": {
107
108
  "react": "^19.2.4",
@@ -1,4 +0,0 @@
1
- import type { OpenAPIDefinition } from '@redocly/openapi-docs';
2
- import type { OperationInfo } from './types';
3
- export declare function getOperationInfoById(definition: OpenAPIDefinition, operationId?: string): OperationInfo | undefined;
4
- //# sourceMappingURL=get-operation-info-by-id.d.ts.map
@@ -1 +0,0 @@
1
- import{isOperationName as f,JsonPointer as c}from"@redocly/openapi-docs";function m(i,s){const a=i.paths||{};for(const p of Object.entries(a)){const[r,e]=p,o=Object.entries(e).find(([t,n])=>f(t)&&n.operationId===s);if(o){const[t,n]=o;return{...n,pathName:r,httpVerb:t,pathParameters:e.parameters||[],pathServers:e.servers,pointer:c.compile(["paths",r,t]),isWebhook:!1}}}}export{m as getOperationInfoById};
@@ -1,4 +0,0 @@
1
- import type { OpenAPIDefinition } from '@redocly/openapi-docs';
2
- import type { OperationInfo } from './types';
3
- export declare function getOperationInfoByPointer(definition: OpenAPIDefinition, pointer: string): OperationInfo | undefined;
4
- //# sourceMappingURL=get-operation-info-by-pointer.d.ts.map
@@ -1 +0,0 @@
1
- import{JsonPointer as i}from"@redocly/openapi-docs";function h(s,e){try{const[t,o,n]=i.parse(e),r=s.paths[o],a=r?.[n];return a&&{...a,pathName:o,httpVerb:n,pathParameters:r.parameters||[],pathServers:r.servers,pointer:e,isWebhook:!1}}catch(t){console.error(t);return}}export{h as getOperationInfoByPointer};
@@ -1,14 +0,0 @@
1
- import type { OperationIdentifier } from './types';
2
- import type { OpenAPIDefinition, Options, OperationModel } from '@redocly/openapi-docs';
3
- import type { RedocConfig } from '@redocly/config';
4
- export declare function getOperation(store: {
5
- definition: OpenAPIDefinition;
6
- options: RedocConfig;
7
- }, { operationId, pointer }: OperationIdentifier, options: Options, { exampleKey, mimeType, environments, environment, requestBody, }: {
8
- exampleKey?: string;
9
- mimeType?: string;
10
- environments?: Record<string, Record<string, string>>;
11
- environment?: string;
12
- requestBody?: any;
13
- }): OperationModel | undefined;
14
- //# sourceMappingURL=get-operation.d.ts.map
@@ -1 +0,0 @@
1
- import{getOperation as E,getServerEnvName as l,normalizeOptions as x,OpenAPIParser as h,getTagOrGroup as q}from"@redocly/openapi-docs";import{getOperationInfoById as v}from"./get-operation-info-by-id.js";import{getOperationInfoByPointer as y}from"./get-operation-info-by-pointer.js";function M(s,{operationId:i,pointer:f},m,{exampleKey:r,mimeType:a,environments:p,environment:d,requestBody:g}){let o;if(i?o=v(s.definition,i):f&&(o=y(s.definition,f)),!o)return;const O=new h(s.definition,void 0,x(s.options)),u=o.tags?.[0],B=u?q("group",{name:u},void 0):void 0,n=E(O,o,B,m,"");if(a&&n.requestBody?.content?.mediaTypes&&(n.requestBody.content.mediaTypes=n.requestBody?.content?.mediaTypes.filter(e=>e.name===a)),r&&(n.requestBody?.content?.mediaTypes.forEach(e=>{if(!e.examples)return;const t=e.examples[r];e.examples=t?{[r]:t}:{}}),n.responses?.forEach(e=>{e.content?.mediaTypes?.forEach(t=>{if(!t.examples)return;const c=t.examples[r];t.examples=c?{[r]:c}:{}})})),g&&n.requestBody?.content?.mediaTypes.forEach(e=>{e.examples={}}),p&&(n.servers=n.servers.map(e=>{const t=p?.[l(e)];return t?{...e,url:t.server||e.url}:e})),d){const e=n.servers.filter(t=>d===l(t));n.servers=e.length?e:n.servers}return n}export{M as getOperation};
@@ -1,4 +0,0 @@
1
- export * from './get-operation-info-by-id.js';
2
- export * from './get-operation-info-by-pointer.js';
3
- export * from './get-operation.js';
4
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- export*from"./get-operation-info-by-id.js";export*from"./get-operation-info-by-pointer.js";export*from"./get-operation.js";
@@ -1,4 +0,0 @@
1
- export type * from './operation-identifier';
2
- export type * from './operation-info';
3
- export type * from './operation-parameters';
4
- //# sourceMappingURL=index.d.ts.map
File without changes
@@ -1,5 +0,0 @@
1
- export type OperationIdentifier = {
2
- operationId?: string;
3
- pointer?: string;
4
- };
5
- //# sourceMappingURL=operation-identifier.d.ts.map
@@ -1,6 +0,0 @@
1
- import type { OpenAPIOperation } from '@redocly/openapi-docs';
2
- export type OperationInfo = {
3
- pathName: string;
4
- httpVerb: string;
5
- } & OpenAPIOperation;
6
- //# sourceMappingURL=operation-info.d.ts.map
@@ -1,3 +0,0 @@
1
- import type { OpenAPIParameterLocation } from '@redocly/openapi-docs';
2
- export type OperationParameters = Partial<Record<OpenAPIParameterLocation, object>>;
3
- //# sourceMappingURL=operation-parameters.d.ts.map
@@ -1,4 +0,0 @@
1
- import type { MediaContentModel } from '@redocly/openapi-docs/lib/models/types.js';
2
- import type { ResolvedSampleBlock } from '../../../../../types/index.js';
3
- export declare function getMediaContentSamples(content: MediaContentModel | undefined, exampleKey: string | undefined, titlePrefix: string): ResolvedSampleBlock[];
4
- //# sourceMappingURL=get-media-content-samples.d.ts.map
@@ -1 +0,0 @@
1
- import{convertSampleToString as p}from"@redocly/openapi-docs/lib/services/code-samples/convertSampleToString.js";import{langFromMime as r}from"@redocly/openapi-docs/lib/utils/openapi.js";import{getExampleValueByMimeType as c}from"@redocly/openapi-docs/lib/services/code-samples/get-example-value-by-mime-type.js";function d(o,t,l){const a=[];if(!o?.hasSample)return a;for(const e of o.mediaTypes??[]){const n=e.examples||e.formExamples||{},m=Object.keys(n);if(!m.length)continue;const s=m.length===1?n[m[0]]:t&&n[t]||n[m[0]],i=p(s.value,e.name,e.schema);i!==void 0&&a.push({lang:r(e.name),title:`${l} ${e.name}`,source:c(i,e.name,s.encoding)})}return a}export{d as getMediaContentSamples};