@redocly/framework 1.0.0-next.1 → 1.0.0-next.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (519) hide show
  1. package/dist/bundler/build/dependency-pack.js +1 -1
  2. package/dist/bundler/build/output-metadata.js +1 -1
  3. package/dist/bundler/build/run.js +1 -1
  4. package/dist/bundler/build/theme-global-style-compiler.js +1 -0
  5. package/dist/bundler/build/theme-global-stylesheets.js +1 -0
  6. package/dist/bundler/build/vite-config.js +2 -2
  7. package/dist/bundler/dev/dev-content-build.js +1 -0
  8. package/dist/bundler/dev/dev-problems.js +1 -1
  9. package/dist/bundler/dev/dev-reporter.js +1 -1
  10. package/dist/bundler/dev/routes/dev-content-build-route.js +1 -0
  11. package/dist/bundler/dev/routes/dev-problems-route.js +1 -1
  12. package/dist/bundler/dev/routes/source-sync-route.js +1 -1
  13. package/dist/bundler/dev/run.js +1 -1
  14. package/dist/bundler/dev/runtime-app.js +1 -1
  15. package/dist/bundler/dev/vite-chunk-url.js +1 -1
  16. package/dist/bundler/dev/vite-config.js +1 -1
  17. package/dist/bundler/node-bundle.js +1 -0
  18. package/dist/bundler/runtime-files.js +1 -1
  19. package/dist/bundler/user-markdoc-schema.js +1 -1
  20. package/dist/bundler/vite-config.base.js +12 -12
  21. package/dist/cli/api-docs-build-event.js +1 -0
  22. package/dist/cli/args.js +1 -1
  23. package/dist/cli/commands/build.js +1 -1
  24. package/dist/cli/commands/dev.js +1 -1
  25. package/dist/cli/commands/ingest.js +1 -1
  26. package/dist/cli/commands/translate.js +1 -1
  27. package/dist/cli/dev-console/{sweep.js → content-build.js} +1 -1
  28. package/dist/cli/dev-console/index.js +1 -1
  29. package/dist/cli/dev-console/lines.js +2 -2
  30. package/dist/cli/dev-console/plain.js +1 -1
  31. package/dist/cli/dev-console/tui.js +2 -2
  32. package/dist/cli/output.js +12 -12
  33. package/dist/cli/problems-output.js +3 -3
  34. package/dist/cli/validate-react-pages.js +1 -1
  35. package/dist/client/ApiAccess.js +3 -0
  36. package/dist/client/NavigationProgress.js +1 -1
  37. package/dist/client/ProductsProvider.js +1 -1
  38. package/dist/client/RouteErrorBoundary.js +1 -1
  39. package/dist/client/RuntimeLink.js +1 -0
  40. package/dist/client/ThemeGlobalStyle.js +1 -0
  41. package/dist/client/UnversionedVersionButton.js +1 -1
  42. package/dist/client/ai-search/citations.js +3 -3
  43. package/dist/client/ai-search/use-ai-search.js +1 -1
  44. package/dist/client/analytics-page-view.js +1 -1
  45. package/dist/client/app.js +2 -7
  46. package/dist/client/classic-webview-sync.js +1 -0
  47. package/dist/client/client-entry.js +1 -1
  48. package/dist/client/contexts.js +1 -1
  49. package/dist/client/dev-problems/ProblemsBar.js +75 -15
  50. package/dist/client/dev-problems/ProblemsModal.js +15 -15
  51. package/dist/client/dev-problems/build-segment.js +1 -0
  52. package/dist/client/dev-problems/index.js +1 -1
  53. package/dist/client/dev-problems/use-dev-problems.js +1 -1
  54. package/dist/client/experiments/runtime.js +1 -1
  55. package/dist/client/feedback.js +1 -1
  56. package/dist/client/history-mount.js +1 -0
  57. package/dist/client/l10n/ssr-l10n.js +1 -1
  58. package/dist/client/l10n/use-l10n-config.js +1 -1
  59. package/dist/client/l10n/use-l10n-href.js +1 -1
  60. package/dist/client/l10n/use-translate.js +1 -1
  61. package/dist/client/page-sync.js +1 -0
  62. package/dist/client/products.js +1 -1
  63. package/dist/client/review/ReviewBar.js +163 -69
  64. package/dist/client/review/login-url.js +1 -0
  65. package/dist/client/review/use-review.js +1 -1
  66. package/dist/client/revisions-history.js +1 -1
  67. package/dist/client/sidebar/PoweredByRedocly.js +2 -2
  68. package/dist/client/sidebar/SidebarDataProvider.js +1 -1
  69. package/dist/client/sidebar/drilldown.js +1 -1
  70. package/dist/client/ssr.js +1 -1
  71. package/dist/client/telemetry/config.js +1 -1
  72. package/dist/client/telemetry/report-preload-failure.js +1 -0
  73. package/dist/client/templates/dev-login.js +4 -4
  74. package/dist/client/templates/unauthorized.js +5 -5
  75. package/dist/client/theme-global-css.js +1 -0
  76. package/dist/client/theme-logo.js +1 -1
  77. package/dist/client/use-banner.js +1 -1
  78. package/dist/client/use-bar-position.js +1 -0
  79. package/dist/client/use-entity-revisions.js +1 -1
  80. package/dist/client/use-page-versions.js +1 -1
  81. package/dist/client/use-router-for-local-links.js +1 -1
  82. package/dist/client/use-search.js +1 -1
  83. package/dist/client/utils/routes/is-router-path.js +1 -0
  84. package/dist/client/webmcp/tools/shared.js +1 -1
  85. package/dist/client/webmcp/tools/site-tools.js +1 -1
  86. package/dist/client/webmcp/use-webmcp-tools.js +1 -1
  87. package/dist/content-layer/allowed-packages.js +1 -1
  88. package/dist/content-layer/api-outputs.js +1 -1
  89. package/dist/content-layer/config-schema.d.ts +12 -3
  90. package/dist/content-layer/config-schema.js +1 -1
  91. package/dist/content-layer/config.d.ts +30 -12
  92. package/dist/content-layer/config.js +1 -1
  93. package/dist/content-layer/context-state.js +1 -1
  94. package/dist/content-layer/context.d.ts +2 -0
  95. package/dist/content-layer/context.js +1 -1
  96. package/dist/content-layer/database/adapters/node-sqlite-client.js +1 -1
  97. package/dist/content-layer/database/assets.js +1 -1
  98. package/dist/content-layer/database/connection.js +1 -1
  99. package/dist/content-layer/database/entity-store.d.ts +24 -3
  100. package/dist/content-layer/database/entity-store.js +1 -1
  101. package/dist/content-layer/database/invalidation.d.ts +6 -0
  102. package/dist/content-layer/database/invalidation.js +26 -26
  103. package/dist/content-layer/database/origins.d.ts +2 -4
  104. package/dist/content-layer/database/origins.js +1 -1
  105. package/dist/content-layer/database/problems.d.ts +2 -0
  106. package/dist/content-layer/database/problems.js +1 -1
  107. package/dist/content-layer/database/reset.js +1 -1
  108. package/dist/content-layer/database/schema.d.ts +50 -0
  109. package/dist/content-layer/database/schema.js +1 -1
  110. package/dist/content-layer/database/site-config.d.ts +23 -0
  111. package/dist/content-layer/database/site-config.js +1 -1
  112. package/dist/content-layer/ingest/extract-all-phase.js +1 -1
  113. package/dist/content-layer/ingest/finalize-phase.js +1 -1
  114. package/dist/content-layer/ingest/git-last-modified.js +3 -3
  115. package/dist/content-layer/ingest/hash.js +1 -1
  116. package/dist/content-layer/ingest/hook-inputs.js +1 -1
  117. package/dist/content-layer/ingest/markdoc-schema-problem.js +1 -0
  118. package/dist/content-layer/ingest/normalize-artifacts.js +1 -1
  119. package/dist/content-layer/ingest/rbac-teams.js +1 -1
  120. package/dist/content-layer/ingest/run.js +1 -1
  121. package/dist/content-layer/ingest/scan.d.ts +1 -1
  122. package/dist/content-layer/ingest/scan.js +1 -1
  123. package/dist/content-layer/ingest/search-sync.js +1 -1
  124. package/dist/content-layer/ingest/slugger/resolve-final-slugs.js +1 -1
  125. package/dist/content-layer/ingest/sync.js +1 -1
  126. package/dist/content-layer/link-checker/config-links.js +1 -1
  127. package/dist/content-layer/link-checker/delta.js +1 -1
  128. package/dist/content-layer/link-checker/fingerprint.js +1 -1
  129. package/dist/content-layer/link-checker/load-view.js +1 -1
  130. package/dist/content-layer/link-checker/node-ref.js +1 -1
  131. package/dist/content-layer/link-checker/run-build.js +1 -1
  132. package/dist/content-layer/link-checker/validate.js +1 -1
  133. package/dist/content-layer/link-checker/view.js +1 -1
  134. package/dist/content-layer/loaders/context.js +1 -1
  135. package/dist/content-layer/loaders/define.d.ts +3 -0
  136. package/dist/content-layer/markdown/client/JsonSchemaTag.js +1 -1
  137. package/dist/content-layer/markdown/client/OpenapiTagComponents.js +2 -2
  138. package/dist/content-layer/markdown/client/code-highlight-notation.js +3 -3
  139. package/dist/content-layer/markdown/client/dynamic-components.js +1 -1
  140. package/dist/content-layer/markdown/client/markdoc-components.js +2 -2
  141. package/dist/content-layer/markdown/client/markdown-text.js +1 -1
  142. package/dist/content-layer/markdown/constants/builtin-tags.js +1 -1
  143. package/dist/content-layer/markdown/constants/markdown-text-tag-set.js +1 -1
  144. package/dist/content-layer/markdown/constants/tag-sets.d.ts +20 -5
  145. package/dist/content-layer/markdown/constants/tag-sets.js +1 -1
  146. package/dist/content-layer/markdown/nodes/heading.js +1 -1
  147. package/dist/content-layer/markdown/nodes/table.js +1 -1
  148. package/dist/content-layer/markdown/resolve/ast.js +1 -1
  149. package/dist/content-layer/markdown/resolve/attribute-resolver-key.d.ts +8 -1
  150. package/dist/content-layer/markdown/resolve/attribute-resolver-key.js +1 -1
  151. package/dist/content-layer/markdown/resolve/audience-tag.d.ts +2 -6
  152. package/dist/content-layer/markdown/resolve/audience-tag.js +1 -1
  153. package/dist/content-layer/markdown/resolve/markdoc-resolvers/code-snippet.js +5 -4
  154. package/dist/content-layer/markdown/resolve/markdoc-resolvers/code-walkthrough/filesets.js +1 -1
  155. package/dist/content-layer/markdown/resolve/markdoc-resolvers/diagram-file.js +1 -1
  156. package/dist/content-layer/markdown/resolve/markdoc-resolvers/file-reference.js +1 -1
  157. package/dist/content-layer/markdown/resolve/markdoc-resolvers/json-schema.d.ts +2 -1
  158. package/dist/content-layer/markdown/resolve/markdoc-resolvers/json-schema.js +1 -1
  159. package/dist/content-layer/markdown/resolve/markdoc-resolvers/operation-samples.d.ts +1 -1
  160. package/dist/content-layer/markdown/resolve/markdoc-resolvers/operation-samples.js +1 -1
  161. package/dist/content-layer/markdown/resolve/markdoc-resolvers/partial.js +1 -1
  162. package/dist/content-layer/markdown/resolve/markdoc-resolvers/svg-content.js +1 -1
  163. package/dist/content-layer/markdown/resolve/markdoc.d.ts +2 -1
  164. package/dist/content-layer/markdown/resolve/markdoc.js +1 -1
  165. package/dist/content-layer/markdown/resolve/raw-partials.d.ts +2 -1
  166. package/dist/content-layer/markdown/resolve/raw-partials.js +1 -1
  167. package/dist/content-layer/markdown/resolve/references.d.ts +3 -1
  168. package/dist/content-layer/markdown/resolve/references.js +1 -1
  169. package/dist/content-layer/markdown/resolve/render-diagrams.d.ts +8 -1
  170. package/dist/content-layer/markdown/resolve/render-diagrams.js +1 -1
  171. package/dist/content-layer/markdown/search/to-sections.d.ts +8 -3
  172. package/dist/content-layer/markdown/search/to-sections.js +1 -1
  173. package/dist/content-layer/markdown/search/to-text.d.ts +4 -1
  174. package/dist/content-layer/markdown/search/to-text.js +5 -5
  175. package/dist/content-layer/markdown/server/render.d.ts +4 -2
  176. package/dist/content-layer/markdown/server/render.js +1 -1
  177. package/dist/content-layer/markdown/service.js +1 -1
  178. package/dist/content-layer/markdown/tags/html.d.ts +5 -2
  179. package/dist/content-layer/markdown/tags/html.js +1 -1
  180. package/dist/content-layer/markdown/tags/markdoc-error.d.ts +8 -0
  181. package/dist/content-layer/markdown/tags/markdoc-error.js +1 -1
  182. package/dist/content-layer/markdown/tags/openapi.d.ts +1 -1
  183. package/dist/content-layer/markdown/tags/openapi.js +1 -1
  184. package/dist/content-layer/markdown/tags/partial.d.ts +9 -3
  185. package/dist/content-layer/markdown/tags/partial.js +1 -1
  186. package/dist/content-layer/markdown/tags/variant.d.ts +6 -0
  187. package/dist/content-layer/markdown/tags/variant.js +1 -0
  188. package/dist/content-layer/markdown/types/service.d.ts +6 -0
  189. package/dist/content-layer/markdown/utils/collect-anchors.js +1 -1
  190. package/dist/content-layer/markdown/utils/collect-headings.d.ts +3 -1
  191. package/dist/content-layer/markdown/utils/collect-headings.js +1 -1
  192. package/dist/content-layer/markdown/utils/first-heading.js +1 -1
  193. package/dist/content-layer/markdown/utils/heading-slugger.d.ts +8 -0
  194. package/dist/content-layer/markdown/utils/heading-slugger.js +1 -1
  195. package/dist/content-layer/markdown/utils/node-source-range.d.ts +3 -3
  196. package/dist/content-layer/markdown/utils/node-source-range.js +1 -1
  197. package/dist/content-layer/markdown/utils/parse-cache.js +1 -1
  198. package/dist/content-layer/markdown/utils/reparse-example-fences.d.ts +4 -1
  199. package/dist/content-layer/markdown/utils/reparse-example-fences.js +1 -1
  200. package/dist/content-layer/markdown/utils/substitute-variables.js +1 -1
  201. package/dist/content-layer/markdown/utils/walk-markdoc-ast.d.ts +2 -2
  202. package/dist/content-layer/markdown/utils/walk-markdoc-ast.js +1 -1
  203. package/dist/content-layer/materialization/asset-reconcile.js +1 -1
  204. package/dist/content-layer/materialization/entity.js +1 -1
  205. package/dist/content-layer/materialization/materializer.js +1 -0
  206. package/dist/content-layer/materialization/static-files.js +1 -1
  207. package/dist/content-layer/plan-gates.d.ts +3 -2
  208. package/dist/content-layer/plan-gates.js +1 -1
  209. package/dist/content-layer/plugins/execute.js +1 -1
  210. package/dist/content-layer/plugins/index.js +1 -1
  211. package/dist/content-layer/plugins/internal/api-docs/client/event-handlers.js +1 -1
  212. package/dist/content-layer/plugins/internal/api-docs/client/rebase-item-links.js +1 -1
  213. package/dist/content-layer/plugins/internal/api-docs/client/template.js +12 -4
  214. package/dist/content-layer/plugins/internal/api-docs/index.js +1 -1
  215. package/dist/content-layer/plugins/internal/api-docs/server/build-definition.d.ts +28 -13
  216. package/dist/content-layer/plugins/internal/api-docs/server/build-definition.js +1 -1
  217. package/dist/content-layer/plugins/internal/api-docs/server/build-sidebar.js +1 -1
  218. package/dist/content-layer/plugins/internal/api-docs/server/declares-proto-service.d.ts +2 -0
  219. package/dist/content-layer/plugins/internal/api-docs/server/declares-proto-service.js +3 -0
  220. package/dist/content-layer/plugins/internal/api-docs/server/markdown-copy.d.ts +14 -0
  221. package/dist/content-layer/plugins/internal/api-docs/server/markdown-copy.js +23 -0
  222. package/dist/content-layer/plugins/internal/api-docs/server/markdown-decorator.d.ts +1 -4
  223. package/dist/content-layer/plugins/internal/api-docs/server/markdown-decorator.js +1 -1
  224. package/dist/content-layer/plugins/internal/api-docs/server/options.d.ts +4 -2
  225. package/dist/content-layer/plugins/internal/api-docs/server/options.js +1 -1
  226. package/dist/content-layer/plugins/internal/api-docs/server/search-documents.d.ts +1 -1
  227. package/dist/content-layer/plugins/internal/api-docs/server/search-documents.js +1 -1
  228. package/dist/content-layer/plugins/internal/api-docs/server/spec-download.js +1 -1
  229. package/dist/content-layer/plugins/internal/api-functions/index.js +1 -1
  230. package/dist/content-layer/plugins/internal/api-functions/server/access.js +1 -1
  231. package/dist/content-layer/plugins/internal/api-functions/server/api-function-telemetry.js +1 -0
  232. package/dist/content-layer/plugins/internal/api-functions/server/dispatch.js +1 -1
  233. package/dist/content-layer/plugins/internal/app-data/banner.js +1 -1
  234. package/dist/content-layer/plugins/internal/app-data/index.d.ts +1 -1
  235. package/dist/content-layer/plugins/internal/app-data/index.js +1 -1
  236. package/dist/content-layer/plugins/internal/app-data/logo.js +1 -1
  237. package/dist/content-layer/plugins/internal/app-data/products.d.ts +2 -0
  238. package/dist/content-layer/plugins/internal/app-data/products.js +1 -1
  239. package/dist/content-layer/plugins/internal/assets/index.js +1 -1
  240. package/dist/content-layer/plugins/internal/catalog-classic/client/catalog-filtering.js +1 -1
  241. package/dist/content-layer/plugins/internal/catalog-classic/client/use-catalog-classic.js +1 -1
  242. package/dist/content-layer/plugins/internal/catalog-classic/index.js +1 -1
  243. package/dist/content-layer/plugins/internal/catalog-classic/resolve-items.d.ts +1 -1
  244. package/dist/content-layer/plugins/internal/catalog-classic/resolve-items.js +1 -1
  245. package/dist/content-layer/plugins/internal/catalog-classic/sidebars.d.ts +1 -1
  246. package/dist/content-layer/plugins/internal/index.js +1 -1
  247. package/dist/content-layer/plugins/internal/l10n/index.js +1 -1
  248. package/dist/content-layer/plugins/internal/markdoc/client/template.js +1 -1
  249. package/dist/content-layer/plugins/internal/markdoc/index.js +1 -1
  250. package/dist/content-layer/plugins/internal/markdoc/server/shared.d.ts +1 -1
  251. package/dist/content-layer/plugins/internal/mcp/app-data.js +1 -1
  252. package/dist/content-layer/plugins/internal/mcp/constants.d.ts +20 -0
  253. package/dist/content-layer/plugins/internal/mcp/constants.js +1 -1
  254. package/dist/content-layer/plugins/internal/mcp/content-tools.d.ts +4 -1
  255. package/dist/content-layer/plugins/internal/mcp/content-tools.js +1 -1
  256. package/dist/content-layer/plugins/internal/mcp/ignored-routes.js +1 -1
  257. package/dist/content-layer/plugins/internal/mcp/index.js +1 -1
  258. package/dist/content-layer/plugins/internal/mcp/server/agent-card.js +1 -1
  259. package/dist/content-layer/plugins/internal/mcp/server/audit.js +1 -1
  260. package/dist/content-layer/plugins/internal/mcp/server/auth.js +1 -1
  261. package/dist/content-layer/plugins/internal/mcp/server/code-credentials.js +2 -2
  262. package/dist/content-layer/plugins/internal/mcp/server/codemode/capabilities.js +6 -6
  263. package/dist/content-layer/plugins/internal/mcp/server/codemode/constants.js +1 -1
  264. package/dist/content-layer/plugins/internal/mcp/server/codemode/discover.js +1 -1
  265. package/dist/content-layer/plugins/internal/mcp/server/codemode/execute-schema.js +1 -1
  266. package/dist/content-layer/plugins/internal/mcp/server/codemode/index.js +1 -1
  267. package/dist/content-layer/plugins/internal/mcp/server/codemode/prompts.js +8 -8
  268. package/dist/content-layer/plugins/internal/mcp/server/config-gate.js +1 -1
  269. package/dist/content-layer/plugins/internal/mcp/server/custom-tools.js +1 -1
  270. package/dist/content-layer/plugins/internal/mcp/server/gateway/allowed-http-methods.js +1 -1
  271. package/dist/content-layer/plugins/internal/mcp/server/gateway/api-call-operations.js +1 -1
  272. package/dist/content-layer/plugins/internal/mcp/server/gateway/call-api.js +2 -0
  273. package/dist/content-layer/plugins/internal/mcp/server/gateway/credentials-handler.js +1 -1
  274. package/dist/content-layer/plugins/internal/mcp/server/gateway/credentials-page/form-page.js +10 -10
  275. package/dist/content-layer/plugins/internal/mcp/server/gateway/credentials-page/outcome-pages.js +1 -1
  276. package/dist/content-layer/plugins/internal/mcp/server/gateway/credentials-page/site-branding.js +1 -1
  277. package/dist/content-layer/plugins/internal/mcp/server/gateway/credentials.js +1 -1
  278. package/dist/content-layer/plugins/internal/mcp/server/gateway/elicitation.js +6 -5
  279. package/dist/content-layer/plugins/internal/mcp/server/gateway/fetch/allowed-hosts.js +1 -1
  280. package/dist/content-layer/plugins/internal/mcp/server/gateway/fetch/fetch-bridge.js +1 -1
  281. package/dist/content-layer/plugins/internal/mcp/server/gateway/fetch/fetch-errors.js +1 -1
  282. package/dist/content-layer/plugins/internal/mcp/server/gateway/fetch/ssrf-guard.js +1 -1
  283. package/dist/content-layer/plugins/internal/mcp/server/gateway/fetch/upstream-detail.js +1 -1
  284. package/dist/content-layer/plugins/internal/mcp/server/gateway/index.js +3 -3
  285. package/dist/content-layer/plugins/internal/mcp/server/gateway/secret-store.js +1 -1
  286. package/dist/content-layer/plugins/internal/mcp/server/gateway/tool-list.js +1 -0
  287. package/dist/content-layer/plugins/internal/mcp/server/gateway/tools.js +4 -4
  288. package/dist/content-layer/plugins/internal/mcp/server/gateway/upstream-auth-scheme.js +2 -2
  289. package/dist/content-layer/plugins/internal/mcp/server/handler.js +1 -1
  290. package/dist/content-layer/plugins/internal/mcp/server/mcp-server.js +1 -1
  291. package/dist/content-layer/plugins/internal/mcp/server/mcp-telemetry.js +1 -1
  292. package/dist/content-layer/plugins/internal/mcp/server/oauth/authorize.js +1 -1
  293. package/dist/content-layer/plugins/internal/mcp/server/oauth/callback.js +1 -1
  294. package/dist/content-layer/plugins/internal/mcp/server/oauth/discovery.js +1 -1
  295. package/dist/content-layer/plugins/internal/mcp/server/oauth/error-reporting.js +1 -1
  296. package/dist/content-layer/plugins/internal/mcp/server/oauth/register.js +1 -1
  297. package/dist/content-layer/plugins/internal/mcp/server/oauth/token.js +1 -1
  298. package/dist/content-layer/plugins/internal/mcp/server/rate-limit.js +1 -1
  299. package/dist/content-layer/plugins/internal/mcp/server/server-card.js +1 -1
  300. package/dist/content-layer/plugins/internal/mcp/server/server-info.js +1 -1
  301. package/dist/content-layer/plugins/internal/mcp/server/skills-resources.js +1 -1
  302. package/dist/content-layer/plugins/internal/mcp/server/tools/graphql-catalog.js +1 -1
  303. package/dist/content-layer/plugins/internal/mcp/server/tools/openapi-catalog.js +1 -1
  304. package/dist/content-layer/plugins/internal/mcp/server/tools/openapi-document.js +1 -1
  305. package/dist/content-layer/plugins/internal/mcp/server/tools/openapi-refs.js +1 -1
  306. package/dist/content-layer/plugins/internal/mcp/server/tools/openapi.js +1 -1
  307. package/dist/content-layer/plugins/internal/mcp/server/tools/pages-navigation.js +1 -1
  308. package/dist/content-layer/plugins/internal/mcp/server/tools/pages.js +2 -2
  309. package/dist/content-layer/plugins/internal/mcp/server/tools/schemas.js +1 -1
  310. package/dist/content-layer/plugins/internal/mcp/server/tools/search.js +2 -2
  311. package/dist/content-layer/plugins/internal/mcp/server/workflows/catalog.js +1 -0
  312. package/dist/content-layer/plugins/internal/mcp/server/workflows/document-resolver.js +1 -0
  313. package/dist/content-layer/plugins/internal/mcp/server/workflows/operations-subset.js +1 -0
  314. package/dist/content-layer/plugins/internal/mcp/server/workflows/resolve-workflows.js +1 -0
  315. package/dist/content-layer/plugins/internal/mcp/server/workflows/run-workflow.js +1 -0
  316. package/dist/content-layer/plugins/internal/mcp/server/workflows/schemas.js +1 -0
  317. package/dist/content-layer/plugins/internal/mcp/server/workflows/tools.js +1 -0
  318. package/dist/content-layer/plugins/internal/mcp/server/workflows/types.js +1 -0
  319. package/dist/content-layer/plugins/internal/mcp/server/workflows/workflow-references.js +1 -0
  320. package/dist/content-layer/plugins/internal/mcp/setup-page.js +1 -1
  321. package/dist/content-layer/plugins/internal/mock/server/handler.js +1 -1
  322. package/dist/content-layer/plugins/internal/react-page/index.d.ts +3 -2
  323. package/dist/content-layer/plugins/internal/react-page/index.js +1 -1
  324. package/dist/content-layer/plugins/internal/scorecard-classic/client/Grid.js +11 -11
  325. package/dist/content-layer/plugins/internal/scorecard-classic/client/ScorecardViews.js +1 -1
  326. package/dist/content-layer/plugins/internal/scorecard-classic/client/ScorecardWidgets.js +7 -7
  327. package/dist/content-layer/plugins/internal/scorecard-classic/client/template.js +2 -2
  328. package/dist/content-layer/plugins/internal/scorecard-classic/index.js +1 -1
  329. package/dist/content-layer/plugins/internal/sidebar/bundle.d.ts +18 -17
  330. package/dist/content-layer/plugins/internal/sidebar/bundle.js +1 -1
  331. package/dist/content-layer/plugins/internal/sidebar/index.d.ts +5 -3
  332. package/dist/content-layer/plugins/internal/sidebar/index.js +2 -2
  333. package/dist/content-layer/plugins/internal/sidebar/subtree.js +1 -1
  334. package/dist/content-layer/plugins/internal/skills/index.js +1 -1
  335. package/dist/content-layer/plugins/internal/skills/server/routes.js +1 -1
  336. package/dist/content-layer/plugins/internal/versions/index.js +1 -1
  337. package/dist/content-layer/plugins/io.js +1 -1
  338. package/dist/content-layer/plugins/project/load.js +2 -2
  339. package/dist/content-layer/plugins/registry.js +1 -1
  340. package/dist/content-layer/plugins/request-context.d.ts +5 -0
  341. package/dist/content-layer/plugins/source-file.js +1 -1
  342. package/dist/content-layer/plugins/types/api-entity.d.ts +2 -6
  343. package/dist/content-layer/plugins/types/api-entity.js +1 -1
  344. package/dist/content-layer/plugins/types/markdoc.d.ts +2 -0
  345. package/dist/content-layer/plugins/types/plugin.d.ts +13 -0
  346. package/dist/content-layer/plugins/types/search.d.ts +14 -3
  347. package/dist/content-layer/plugins/utils/link-access.d.ts +2 -0
  348. package/dist/content-layer/plugins/utils/link-access.js +1 -1
  349. package/dist/content-layer/plugins/utils/route-index.d.ts +1 -1
  350. package/dist/content-layer/plugins/utils/route-index.js +1 -1
  351. package/dist/content-layer/plugins/utils/sidebar-label.d.ts +4 -1
  352. package/dist/content-layer/plugins/utils/sidebar-label.js +1 -1
  353. package/dist/content-layer/plugins/utils/version-path.js +1 -1
  354. package/dist/content-layer/plugins/work-time.js +1 -0
  355. package/dist/content-layer/problems/codes.d.ts +10 -0
  356. package/dist/content-layer/problems/codes.js +1 -1
  357. package/dist/content-layer/revisions/config.js +1 -1
  358. package/dist/content-layer/revisions/read.js +1 -1
  359. package/dist/content-layer/search/engine/core/content-parser.js +1 -1
  360. package/dist/content-layer/search/facet-rows.js +1 -1
  361. package/dist/content-layer/search/keywords.d.ts +18 -0
  362. package/dist/content-layer/search/keywords.js +1 -0
  363. package/dist/content-layer/search/postings/fragment-field.d.ts +2 -0
  364. package/dist/content-layer/search/postings/fragment-field.js +1 -1
  365. package/dist/content-layer/search/postings/postings-store.d.ts +14 -0
  366. package/dist/content-layer/search/postings/postings-store.js +1 -1
  367. package/dist/content-layer/search/store.d.ts +14 -1
  368. package/dist/content-layer/server/context.js +1 -1
  369. package/dist/content-layer/server/database.js +1 -1
  370. package/dist/content-layer/server/materialize.js +1 -1
  371. package/dist/content-layer/static/audience.js +1 -1
  372. package/dist/content-layer/static/registry.js +1 -1
  373. package/dist/content-layer/versions/group-info.d.ts +22 -0
  374. package/dist/content-layer/versions/group-info.js +1 -0
  375. package/dist/content-layer/versions/redirect.d.ts +24 -17
  376. package/dist/content-layer/versions/redirect.js +1 -1
  377. package/dist/content-layer/versions/resolve.d.ts +1 -21
  378. package/dist/content-layer/versions/resolve.js +1 -1
  379. package/dist/content-layer/versions/version-groups.d.ts +5 -1
  380. package/dist/content-layer/versions/version-groups.js +1 -1
  381. package/dist/plugin-api.d.ts +3 -0
  382. package/dist/plugin-api.js +1 -1
  383. package/dist/server/analytics-tags.js +1 -1
  384. package/dist/server/app.js +3 -3
  385. package/dist/server/ask-ai/feature-gate.js +1 -1
  386. package/dist/server/ask-ai/route.js +1 -1
  387. package/dist/server/auth/access-config.js +1 -1
  388. package/dist/server/auth/gate.js +1 -1
  389. package/dist/server/auth/middleware.js +1 -1
  390. package/dist/server/auth/oidc.js +1 -1
  391. package/dist/server/auth/request.js +1 -1
  392. package/dist/server/auth/routes.js +1 -1
  393. package/dist/server/auth/runtime.js +1 -1
  394. package/dist/server/content-assets/access.js +1 -1
  395. package/dist/server/content.js +15 -14
  396. package/dist/server/cors-proxy/handler.js +1 -1
  397. package/dist/server/feedback/route.js +1 -1
  398. package/dist/server/html-tags.js +2 -1
  399. package/dist/server/lambda-entry.js +1 -1
  400. package/dist/server/llms-txt.js +1 -1
  401. package/dist/server/manifest-assets.js +5 -5
  402. package/dist/server/metrics/request-metrics.js +1 -1
  403. package/dist/server/node-entry.js +1 -1
  404. package/dist/server/page-handlers.js +1 -1
  405. package/dist/server/plugin-context.js +1 -1
  406. package/dist/server/plugin-routes.js +1 -1
  407. package/dist/server/public-url.js +1 -0
  408. package/dist/server/rbac/content-asset-access.js +1 -1
  409. package/dist/server/redirects.js +1 -1
  410. package/dist/server/replay-oauth2/route.js +1 -1
  411. package/dist/server/review/route.js +1 -1
  412. package/dist/server/runtime-config.js +1 -1
  413. package/dist/server/search/cache.js +1 -0
  414. package/dist/server/search/route.js +1 -1
  415. package/dist/server/search/search-telemetry.js +1 -0
  416. package/dist/server/seo-tags.js +2 -2
  417. package/dist/server/sitemap.js +1 -1
  418. package/dist/server/ssrf/ssrf-blocklist.js +1 -1
  419. package/dist/server/static-files/serve.js +1 -1
  420. package/dist/server/subprocess/child-entry.js +1 -1
  421. package/dist/server/subprocess/runner.js +1 -1
  422. package/dist/server/telemetry/mock-server-events.js +1 -0
  423. package/dist/server/telemetry/redirect-event.js +1 -0
  424. package/dist/server/telemetry/route.js +1 -1
  425. package/dist/server/telemetry/sender.js +1 -1
  426. package/dist/server/telemetry/server-events.js +1 -1
  427. package/dist/server/template-ids.js +1 -1
  428. package/dist/server/wait-until.js +1 -0
  429. package/dist/shared/constants/api-spec-kinds.d.ts +7 -0
  430. package/dist/shared/constants/api-spec-kinds.js +1 -0
  431. package/dist/shared/constants/content-update.js +1 -1
  432. package/dist/shared/constants/dependency-pack.js +1 -1
  433. package/dist/shared/constants/dev-content-build.js +1 -0
  434. package/dist/shared/constants/dev-problems.js +1 -1
  435. package/dist/shared/constants/dev-source-sync.js +1 -1
  436. package/dist/shared/constants/l10n/langs/ar.js +1 -1
  437. package/dist/shared/constants/l10n/langs/de.js +1 -1
  438. package/dist/shared/constants/l10n/langs/en.js +1 -1
  439. package/dist/shared/constants/l10n/langs/es.js +1 -1
  440. package/dist/shared/constants/l10n/langs/fr.js +1 -1
  441. package/dist/shared/constants/l10n/langs/hi.js +1 -1
  442. package/dist/shared/constants/l10n/langs/it.js +1 -1
  443. package/dist/shared/constants/l10n/langs/ja.js +1 -1
  444. package/dist/shared/constants/l10n/langs/ko.js +1 -1
  445. package/dist/shared/constants/l10n/langs/pl.js +1 -1
  446. package/dist/shared/constants/l10n/langs/pt-br.js +1 -1
  447. package/dist/shared/constants/l10n/langs/pt.js +1 -1
  448. package/dist/shared/constants/l10n/langs/ru.js +1 -1
  449. package/dist/shared/constants/l10n/langs/uk.js +1 -1
  450. package/dist/shared/constants/l10n/langs/zh.js +1 -1
  451. package/dist/shared/constants/manifest-version.d.ts +3 -1
  452. package/dist/shared/constants/openapi-operation-methods.d.ts +2 -0
  453. package/dist/shared/constants/openapi-operation-methods.js +1 -0
  454. package/dist/shared/constants/review.d.ts +7 -0
  455. package/dist/shared/constants/review.js +1 -1
  456. package/dist/{server → shared}/constants/system-routes.d.ts +2 -2
  457. package/dist/shared/constants/system-routes.js +1 -0
  458. package/dist/shared/constants/versions.d.ts +2 -0
  459. package/dist/shared/constants/versions.js +1 -1
  460. package/dist/shared/experiments.js +1 -1
  461. package/dist/shared/load-dot-env.js +1 -1
  462. package/dist/shared/plan-gates.d.ts +9 -3
  463. package/dist/shared/plan-gates.js +1 -1
  464. package/dist/shared/products.js +1 -1
  465. package/dist/shared/project-env.d.ts +12 -0
  466. package/dist/shared/project-env.js +1 -0
  467. package/dist/shared/public-env.d.ts +9 -0
  468. package/dist/shared/public-env.js +1 -1
  469. package/dist/{server → shared}/rbac/api-docs.d.ts +3 -2
  470. package/dist/shared/rbac/api-docs.js +1 -0
  471. package/dist/{server → shared}/rbac/engine.d.ts +13 -10
  472. package/dist/shared/rbac/engine.js +0 -0
  473. package/dist/{server → shared}/rbac/filter.d.ts +2 -0
  474. package/dist/shared/rbac/filter.js +1 -0
  475. package/dist/{server → shared}/rbac/l10n-rules.d.ts +1 -1
  476. package/dist/shared/rbac/l10n-rules.js +1 -0
  477. package/dist/{server → shared}/rbac/route-scope.d.ts +1 -1
  478. package/dist/shared/rbac/route-scope.js +1 -0
  479. package/dist/{server → shared}/rbac/team-templates.d.ts +6 -2
  480. package/dist/shared/rbac/team-templates.js +1 -0
  481. package/dist/{server → shared}/rbac/teams.d.ts +1 -1
  482. package/dist/shared/rbac/types.js +1 -0
  483. package/dist/shared/search/facets.d.ts +5 -0
  484. package/dist/shared/search/facets.js +1 -1
  485. package/dist/shared/types/auth.d.ts +1 -0
  486. package/dist/shared/types/config.d.ts +5 -0
  487. package/dist/shared/types/search.d.ts +8 -2
  488. package/dist/shared/types/sidebar.d.ts +1 -0
  489. package/dist/shared/utils/redirect-match.js +1 -0
  490. package/dist/shared/utils/routes/file-path-to-route-slug.js +1 -1
  491. package/dist/shared/utils/routes/markdown-copy-url.js +1 -0
  492. package/drizzle/20261103061150_site_config_effective_hash/migration.sql +1 -0
  493. package/drizzle/20261105151816_search_http_path_tokens/migration.sql +1 -0
  494. package/drizzle/20261111152552_page_markdown_rbac_scope/migration.sql +1 -0
  495. package/package.json +37 -13
  496. package/dist/bundler/dev/__tests__/reset-content-update-state.js +0 -1
  497. package/dist/bundler/dev/materialization-sweeper.js +0 -1
  498. package/dist/client/dev-problems/sweep-segment.js +0 -1
  499. package/dist/client/review/use-bar-position.js +0 -1
  500. package/dist/content-layer/plugins/internal/api-docs/server/markdown-docs.d.ts +0 -5
  501. package/dist/content-layer/plugins/internal/api-docs/server/markdown-docs.js +0 -26
  502. package/dist/content-layer/plugins/internal/mcp/server/gateway/__tests__/fake-kv.js +0 -1
  503. package/dist/content-layer/server/config.js +0 -1
  504. package/dist/server/__tests__/rbac-fixture.js +0 -1
  505. package/dist/server/__tests__/test-session.js +0 -1
  506. package/dist/server/constants/system-routes.js +0 -1
  507. package/dist/server/rbac/api-docs.js +0 -1
  508. package/dist/server/rbac/engine.js +0 -0
  509. package/dist/server/rbac/filter.js +0 -1
  510. package/dist/server/rbac/l10n-rules.js +0 -1
  511. package/dist/server/rbac/route-scope.js +0 -1
  512. package/dist/server/rbac/team-templates.js +0 -1
  513. package/dist/server/rbac/types.js +0 -1
  514. package/dist/shared/utils/routes/markdown-path.js +0 -1
  515. /package/dist/{server → shared}/rbac/entity-scope.js +0 -0
  516. /package/dist/{server → shared}/rbac/teams.js +0 -0
  517. /package/dist/{server → shared}/rbac/types.d.ts +0 -0
  518. /package/dist/{content-layer/markdown → shared}/utils/packed-ast.d.ts +0 -0
  519. /package/dist/{content-layer/markdown → shared}/utils/packed-ast.js +0 -0
@@ -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{APP_DATA_STATIC_DATA_SLUG as x}from"../../shared/constants/app-data.js";import{SIDEBAR_ROUTE_DEP_KEY as S}from"../../shared/constants/route-deps.js";import{createRouteIndex as C,createRouteQueryEvaluator as w,dedupeRouteQueryDependencies as T,isRouteQueryStale as E}from"./utils/route-index.js";import{FOLDER_SIDEBAR_FILENAME_REGEX as D,SIDEBAR_AGGREGATOR_LOADER_ID as O,SIDEBAR_FILENAME_REGEX as k,SIDEBAR_PLUGIN_ID as A,isTabbedSidebar as j,resolveAutoSidebar as M,sidebarContentPlugin as N}from"./internal/sidebar/index.js";import"./internal/api-functions/constants.js";import{createContentPluginIO as P,createPluginIO as F,createRecordingPluginIO as I}from"./io.js";import{STATIC_FOLDER_PLUGIN_ID as L,STATIC_FOLDER_PREFIX as R,isStaticFolderPath as z,staticFolderContentPlugin as B}from"./internal/static-folder/index.js";import{MCP_TOOL_NAME_PATTERN as V,createContentPluginRegistry as H,matchesContentPluginFilter as U,resolveContentPluginsForFile as W}from"./registry.js";import{ASSETS_PLUGIN_ID as G,ASSET_ENTITY_KEY_PREFIX as K,assetsContentPlugin as q}from"./internal/assets/index.js";import{SPEC_KIND_ARAZZO as J,SPEC_KIND_ASYNCAPI as Y,SPEC_KIND_GRAPHQL as X,SPEC_KIND_GRPC as Z,SPEC_KIND_OPENAPI as Q}from"../../shared/constants/api-spec-kinds.js";import{MOCK_SERVER_ROUTE_PREFIX as $,mockPathPrefix as ee}from"./types/api-entity.js";import{APP_DATA_PLUGIN_ID as te,APP_DATA_PLUGIN_VERSION as ne,APP_DATA_STATIC_DATA_LOADER_ID as re,appDataContentPlugin as ie,appDataSystemEntityDescriptor as ae,buildConfigAppData as oe,isAppDataFragment as se}from"./internal/app-data/index.js";import{BUILT_IN_CLASSIC_PLUGINS as ce,DEFAULT_PROJECT_PLUGIN_FILES as le,INTERNAL_PLUGIN_ID_PREFIX as ue,PLAN_GATED_PLUGINS as de}from"./project/constants.js";import{getLoadedProjectPlugins as fe,setLoadedProjectPlugins as pe,warnWhenProjectPluginsAreNotLoaded as me}from"./project/loaded-set.js";import{apiDocsContentPlugin as he}from"./internal/api-docs/index.js";import{API_FUNCTIONS_PLUGIN_ID as ge,apiFunctionsContentPlugin as _e}from"./internal/api-functions/index.js";import{CATALOG_CLASSIC_LOADER_ID as ve,CATALOG_CLASSIC_PLUGIN_ID as ye,CATALOG_CLASSIC_SERVER_FN_ID as be,CATALOG_CLASSIC_SIDEBARS_LOADER_ID as xe,CATALOG_CLASSIC_TEMPLATE_ID as Se,catalogClassicContentPlugin as Ce}from"./internal/catalog-classic/index.js";import{L10N_PLUGIN_ID as we}from"./internal/l10n/translations-loader.js";import{L10N_PLUGIN_VERSION as Te,l10nContentPlugin as Ee}from"./internal/l10n/index.js";import{MARKDOC_DOCUMENT_LOADER_ID as De,MARKDOC_SEARCH_GROUP as Oe,MARKDOC_SIDEBAR_ITEM_LOADER_ID as ke,MARKDOC_TEMPLATE_ID as Ae,markdocContentPlugin as je}from"./internal/markdoc/index.js";import{mcpContentPlugin as Me}from"./internal/mcp/index.js";import{MOCK_SERVER_PLUGIN_ID as Ne,MOCK_SERVER_ROUTE_PATH as Pe,mockServerContentPlugin as Fe}from"./internal/mock/index.js";import{REACT_PAGE_SEARCH_LOADER_KEY as Ie,reactPageContentPlugin as Le}from"./internal/react-page/index.js";import{REVISIONS_PLUGIN_ID as Re,revisionsContentPlugin as ze}from"./internal/revisions/index.js";import{SCORECARD_CLASSIC_PLUGIN_ID as Be,SCORECARD_CLASSIC_TEMPLATE_ID as Ve,scorecardClassicContentPlugin as He}from"./internal/scorecard-classic/index.js";import{SKILLS_PLUGIN_ID as Ue,SKILL_MARKDOWN_ROUTE_PATH as We,skillsContentPlugin as Ge}from"./internal/skills/index.js";import{VERSIONS_PLUGIN_ID as Ke,versionsContentPlugin as qe}from"./internal/versions/index.js";import{createInternalContentPlugins as Je}from"./internal/index.js";import{createContentPlugins as Ye}from"./create-content-plugins.js";import{dedupeFileDependencies as Xe,extractFileContributions as Ze,runContentPluginFinalize as Qe}from"./execute.js";import{createSourceFile as $e}from"./source-file.js";import{createContentOriginKey as et}from"./utils/origin-key.js";import{createProjectPluginLoadError as tt,formatProjectPluginDiagnostics as nt,loadAndRegisterProjectPlugins as rt,loadProjectPlugins as it,readPluginEntries as at,resolveProjectPluginPath as ot}from"./project/load.js";import{reloadProjectPluginsIfChanged as st}from"./project/reload.js";export{ge as API_FUNCTIONS_PLUGIN_ID,te as APP_DATA_PLUGIN_ID,ne as APP_DATA_PLUGIN_VERSION,re as APP_DATA_STATIC_DATA_LOADER_ID,x as APP_DATA_STATIC_DATA_SLUG,G as ASSETS_PLUGIN_ID,K as ASSET_ENTITY_KEY_PREFIX,ce as BUILT_IN_CLASSIC_PLUGINS,ve as CATALOG_CLASSIC_LOADER_ID,ye as CATALOG_CLASSIC_PLUGIN_ID,be as CATALOG_CLASSIC_SERVER_FN_ID,xe as CATALOG_CLASSIC_SIDEBARS_LOADER_ID,Se as CATALOG_CLASSIC_TEMPLATE_ID,le as DEFAULT_PROJECT_PLUGIN_FILES,t as ENTITY_LOADER_REFERENCE_KIND,D as FOLDER_SIDEBAR_FILENAME_REGEX,n as INLINE_ENTITY_REFERENCE_KIND,ue as INTERNAL_PLUGIN_ID_PREFIX,we as L10N_PLUGIN_ID,Te as L10N_PLUGIN_VERSION,De as MARKDOC_DOCUMENT_LOADER_ID,Oe as MARKDOC_SEARCH_GROUP,ke as MARKDOC_SIDEBAR_ITEM_LOADER_ID,Ae as MARKDOC_TEMPLATE_ID,V as MCP_TOOL_NAME_PATTERN,Ne as MOCK_SERVER_PLUGIN_ID,Pe as MOCK_SERVER_ROUTE_PATH,$ as MOCK_SERVER_ROUTE_PREFIX,de as PLAN_GATED_PLUGINS,Ie as REACT_PAGE_SEARCH_LOADER_KEY,Re as REVISIONS_PLUGIN_ID,Be as SCORECARD_CLASSIC_PLUGIN_ID,Ve as SCORECARD_CLASSIC_TEMPLATE_ID,d as SERVER_FN_REFERENCE_KIND,O as SIDEBAR_AGGREGATOR_LOADER_ID,k as SIDEBAR_FILENAME_REGEX,A as SIDEBAR_PLUGIN_ID,S as SIDEBAR_ROUTE_DEP_KEY,Ue as SKILLS_PLUGIN_ID,We as SKILL_MARKDOWN_ROUTE_PATH,J as SPEC_KIND_ARAZZO,Y as SPEC_KIND_ASYNCAPI,X as SPEC_KIND_GRAPHQL,Z as SPEC_KIND_GRPC,Q as SPEC_KIND_OPENAPI,L as STATIC_FOLDER_PLUGIN_ID,R as STATIC_FOLDER_PREFIX,f as STORED_ENTITY_REFERENCE_KIND,Ke as VERSIONS_PLUGIN_ID,he as apiDocsContentPlugin,_e as apiFunctionsContentPlugin,ie as appDataContentPlugin,ae as appDataSystemEntityDescriptor,q as assetsContentPlugin,oe as buildConfigAppData,Ce as catalogClassicContentPlugin,et as createContentOriginKey,P as createContentPluginIO,H as createContentPluginRegistry,Ye as createContentPlugins,r as createEntityLoader,i as createInlineEntity,a as createInlineEntityReference,Je as createInternalContentPlugins,F as createPluginIO,y as createPluginScopedId,tt as createProjectPluginLoadError,I as createRecordingPluginIO,C as createRouteIndex,w as createRouteQueryEvaluator,p as createServerFn,$e as createSourceFile,m as createStoredEntityReference,Xe as dedupeFileDependencies,T as dedupeRouteQueryDependencies,e as defineContentPlugin,Ze as extractFileContributions,nt as formatProjectPluginDiagnostics,fe as getLoadedProjectPlugins,h as getRegisteredServerFnLoader,se as isAppDataFragment,o as isEntityLoaderReference,s as isInlineEntityReference,c as isRawEntityReference,E as isRouteQueryStale,g as isServerFnReference,z as isStaticFolderPath,j as isTabbedSidebar,Ee as l10nContentPlugin,rt as loadAndRegisterProjectPlugins,it as loadProjectPlugins,je as markdocContentPlugin,U as matchesContentPluginFilter,Me as mcpContentPlugin,ee as mockPathPrefix,Fe as mockServerContentPlugin,_ as normalizeServerFnId,Le as reactPageContentPlugin,at as readPluginEntries,st as reloadProjectPluginsIfChanged,M as resolveAutoSidebar,W as resolveContentPluginsForFile,ot as resolveProjectPluginPath,l as resolveRuntimeFilePath,v as resolveServerModuleReference,ze as revisionsContentPlugin,Qe as runContentPluginFinalize,u as runtimeFile,b as runtimeTemplate,He as scorecardClassicContentPlugin,pe as setLoadedProjectPlugins,N as sidebarContentPlugin,Ge as skillsContentPlugin,B as staticFolderContentPlugin,qe as versionsContentPlugin,me as warnWhenProjectPluginsAreNotLoaded};
@@ -1 +1 @@
1
- import{isObject as e}from"../../../../../shared/utils/is-object.js";function t(t){if(!e(t.events))return t;let r={};if(typeof window<`u`)for(let[e,i]of Object.entries(t.events)){let t=n(i);t===void 0?console.error(`The openapi.events.${e} handler is not a function and is not used.`):r[e]=t}return{...t,events:r}}function n(e){if(typeof e==`string`)try{let t=Function(`return (${e});`)();return typeof t==`function`?t:void 0}catch{return}}export{t as withEventHandlers};
1
+ import{isObject as e}from"../../../../../shared/utils/is-object.js";function t(t){if(!e(t.events))return t;let r={};if(typeof window<`u`)for(let[e,i]of Object.entries(t.events)){let t=n(i);t===void 0?console.error(`The openapi.events.${e} handler is not a function and is not used.`):r[e]=t}return{...t,events:r}}function n(e){if(typeof e==`string`)try{let t=Function(`const __redoclyEventHandler = ${e}\nreturn __redoclyEventHandler;`)();return typeof t==`function`?t:void 0}catch{return}}export{t as withEventHandlers};
@@ -1 +1 @@
1
- import{ITEM_ROUTE_PATH_KEYS as e}from"@redocly/api-docs/lib/utils/previous-route-slug.js";const t=new Set(e);function n(e,n,r){let i=n===`/`?`/`:`${n}/`,a=r===`/`?``:r,o=e=>e===n?r:e.startsWith(i)?`${a}/${e.slice(i.length)}`:e,s=e=>{if(Array.isArray(e))return e.map(s);if(typeof e!=`object`||!e)return e;let n={};for(let[r,i]of Object.entries(e))n[r]=t.has(r)&&typeof i==`string`?o(i):typeof i==`object`&&i?s(i):i;return n};return e.map(s)}export{n as rebaseItemLinks};
1
+ import{ITEM_ROUTE_PATH_KEYS as e}from"@redocly/api-docs/lib/utils/previous-route-slug.js";function t(t,n,r){let i=n===`/`?`/`:`${n}/`,a=r===`/`?``:r,o=e=>e===n?r:e.startsWith(i)?`${a}/${e.slice(i.length)}`:e,s=t=>{if(typeof t!=`object`||!t)return t;let n={...t};for(let t of e){let e=n[t];typeof e==`string`&&(n[t]=o(e))}return Array.isArray(n.items)&&(n.items=n.items.map(s)),n};return t.map(s)}export{t as rebaseItemLinks};
@@ -1,7 +1,15 @@
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 _,useState as v}from"react";import{useLocation as y}from"react-router";import{Fragment as b,jsx as x,jsxs as S}from"react/jsx-runtime";import C from"styled-components";import{useThemeConfig as w}from"@redocly/theme/core/hooks";import{LayoutVariant as T}from"@redocly/theme/components/SidebarActions/SidebarActions";import{useLoaderData as E}from"virtual:realm-runtime";import{userMarkdocComponents as D}from"virtual:realm-markdoc-components";import{RedoclyApiDocs as O,apiDocsMarkdocComponents as k}from"@redocly/api-docs";import{Breadcrumbs as A}from"@redocly/theme/components/Breadcrumbs/Breadcrumbs";import{CatalogClassicInfoBlock as j}from"@redocly/theme/components/CatalogClassic/CatalogClassicInfoBlock";import{MissingTranslationNotice as M}from"@redocly/theme/components/MissingTranslationNotice/MissingTranslationNotice";import{ThreePanelLayout as N}from"@redocly/theme/layouts/ThreePanelLayout";const P={...c,JsonSchema:f,JsonExample:p,...D,...k},F={parse:e=>e,render:e=>/* @__PURE__ */ x(s,{ast:e,components:P})},I={MiddlePanelHeader:L};function L(){let e=R(),{pathname:t}=y(),n=h(o)?.slug;return!e&&n!==void 0&&z(t)!==n.toLowerCase()?null:/* @__PURE__ */ S(b,{children:[/* @__PURE__ */ x(A,{}),/* @__PURE__ */ x(U,{})]})}function R(){let[e,t]=v(!1);return g(()=>{t(!0)},[]),e}function z(e){return(e.length>1&&e.endsWith(`/`)?e.slice(0,-1):e).toLowerCase()}function B({page:e}){let t=E(r),i=E(n),{layout:o}=h(a),s=V(),c=_(()=>t&&{...m(d(t.options)),oAuth2RedirectURI:H(),userClaims:s,unstable_hooks:I},[t,s]),f=e.slug.toLowerCase(),p=_(()=>t&&t.basePath!==f?l(t.items,t.basePath,f):t?.items,[t,f]);if(G(e.metadata,p,t?.title),!t)return null;let g=u();return/* @__PURE__ */ S(b,{children:[i&&/* @__PURE__ */ x(W,{layout:o,children:/* @__PURE__ */ x(j,{metadata:i})}),/* @__PURE__ */ x(O,{items:p,store:t.store,options:c,basePath:f,layout:o,markdownAdapter:F,telemetryConfig:g})]})}function V(){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 H(){if(typeof window<`u`)return new URL(t(e),window.location.origin).toString()}const U=C(M)`
1
+ import{withPathPrefix as e}from"../../../../../shared/path-prefix.js";import{ApiDocsLayoutContext as t,PageContext as n}from"../../../../../client/contexts.js";import{expandSecurityRequestValues as r,useDynamicRequestValues as i}from"../../../../../client/ApiAccess.js";import{MarkdocBlocks as a,markdocComponents as o}from"../../../../markdown/client/markdoc-components.js";import{API_DOCS_INFO_BLOCK_DEP_KEY as s,API_DOCS_RENDER_DEP_KEY as c,apiPageTitle as l}from"../server/shared.js";import{rebaseItemLinks as u}from"./rebase-item-links.js";import{apiDocsTelemetryConfig as d}from"../../../../../client/telemetry/config.js";import{withReplayOptions as f}from"../../../../../client/replay-options.js";import{REPLAY_OAUTH2_ROUTE_PATH as p}from"../../../../../shared/constants/replay.js";import{JsonSchemaTag as m}from"../../../../markdown/client/JsonSchemaTag.js";import{JsonExample as h}from"../../../../markdown/client/OpenapiTagComponents.js";import{withEventHandlers as g}from"./event-handlers.js";import{useContext as _,useEffect as v,useMemo as y}from"react";import b from"styled-components";import{useLocation as x}from"react-router";import{Fragment as S,jsx as C,jsxs as w}from"react/jsx-runtime";import{useThemeConfig as T}from"@redocly/theme/core/hooks";import{LayoutVariant as E}from"@redocly/theme/components/SidebarActions/SidebarActions";import{useLoaderData as D}from"virtual:realm-runtime";import{userMarkdocComponents as O}from"virtual:realm-markdoc-components";import{RedoclyApiDocs as k,apiDocsMarkdocComponents as A}from"@redocly/api-docs";import{Breadcrumbs as j}from"@redocly/theme/components/Breadcrumbs/Breadcrumbs";import{CatalogClassicInfoBlock as M}from"@redocly/theme/components/CatalogClassic/CatalogClassicInfoBlock";import{MissingTranslationNotice as N}from"@redocly/theme/components/MissingTranslationNotice/MissingTranslationNotice";import{ThreePanelLayout as P}from"@redocly/theme/layouts/ThreePanelLayout";const F={...o,JsonSchema:O.JsonSchema??m,JsonExample:O.JsonExample??h,...A},I={parse:e=>e,render:e=>/* @__PURE__ */ C(a,{ast:e,components:F})},L={MiddlePanelHeader:R};function R(){return/* @__PURE__ */ w(S,{children:[/* @__PURE__ */ C(j,{}),/* @__PURE__ */ C(W,{})]})}function z(e){return(e.length>1&&e.endsWith(`/`)?e.slice(0,-1):e).toLowerCase()}function B({page:e}){let n=D(c),a=D(s),{layout:o}=_(t),l=V(),p=i(),m=y(()=>{if(!n)return n;let e=r(p,Object.values(n.store.securitySchemeStore??{}));return{...g(f(n.options)),oAuth2RedirectURI:H(),userClaims:l,unstable_hooks:L,dynamicRequestValues:e}},[n,l,p]),h=e.slug.toLowerCase(),v=y(()=>n&&n.basePath!==h?u(n.items,n.basePath,h):n?.items,[n,h]);if(K(e.metadata,v,n?.title),!n)return null;let b=d();return/* @__PURE__ */ w(U,{children:[a&&/* @__PURE__ */ C(G,{layout:o,children:/* @__PURE__ */ C(M,{metadata:a})}),/* @__PURE__ */ C(k,{items:v,store:n.store,options:m,basePath:h,layout:o,markdownAdapter:I,telemetryConfig:b})]})}function V(){let e=_(n)?.auth?.userInfo,t=e?.isAuthenticated?e.email:void 0,r=e?.isAuthenticated?e.name:void 0;return y(()=>({email:t,name:r}),[t,r])}function H(){if(typeof window<`u`)return new URL(e(p),window.location.origin).toString()}const U=b.main`
2
+ [data-section-id] {
3
+ scroll-margin-top: var(--navbar-offset);
4
+ }
5
+
6
+ [id]:not([data-section-id]):has([data-deep-link-anchor]) {
7
+ scroll-margin-top: calc(var(--navbar-offset) + var(--deep-link-scroll-gap, var(--spacing-xl)));
8
+ }
9
+ `,W=b(N)`
2
10
  width: 100%;
3
- `,W=C(N)`
11
+ `,G=b(P)`
4
12
  && {
5
- padding-right: ${({layout:e})=>e===T.THREE_PANEL?`calc(var(--panel-gap-horizontal) * 2)`:`var(--panel-gap-horizontal)`};
13
+ padding-right: ${({layout:e})=>e===E.THREE_PANEL?`calc(var(--panel-gap-horizontal) * 2)`:`var(--panel-gap-horizontal)`};
6
14
  }
7
- `;function G(e,t,n){let{pathname:r}=y(),{seo:a}=w(),o=a?.projectTitle,s=t?i(e,t,z(r),n):void 0;g(()=>{s&&(document.title=o?`${s} | ${o}`:s)},[s,o])}export{B as default};
15
+ `;function K(e,t,n){let{pathname:r}=x(),{seo:i}=T(),a=i?.projectTitle,o=t?l(e,t,z(r),n):void 0;v(()=>{o&&(document.title=a?`${o} | ${a}`:o)},[o,a])}export{B as default};
@@ -1 +1 @@
1
- import{defineContentPlugin as e}from"../../define.js";import{createEntityLoader as t}from"../../../loaders/define.js";import{runtimeFile as n}from"../../utils/runtime-file.js";import{runtimeTemplate as r}from"../../templates.js";import{SEARCH_GROUP_FACET_FIELD as i}from"../../../../shared/search/facets.js";import{configuredFacetFields as a,extractFacetsFromFrontmatter as o,invalidFacetValueProblems as s,searchCategoryOf as c}from"../../../search/facet-values.js";import{toPosixPath as l}from"../../../../shared/utils/to-posix-path.js";import{TRANSLATIONS_FILE_PATTERN as u}from"../../../../shared/constants/l10n/defaults.js";import{isObject as d}from"../../../../shared/utils/is-object.js";import{notInPlanProblem as f}from"../../../plan-gates.js";import{filePathToRouteSlug as p}from"../../../../shared/utils/routes/file-path-to-route-slug.js";import{SPEC_KIND_ARAZZO as m,SPEC_KIND_ASYNCAPI as h,SPEC_KIND_GRAPHQL as g,SPEC_KIND_OPENAPI as _}from"../../types/api-entity.js";import{isPlanFeatureGranted as v}from"../../../../shared/plan-gates.js";import{packMarkdocAstsDeep as y,unpackMarkdocAstsDeep as b}from"../../../markdown/utils/packed-ast.js";import{parseMarkdownCached as x}from"../../../markdown/utils/parse-cache.js";import{createApiEntityKey as S}from"../../utils/api-entity-key.js";import{API_DOCS_API_LOADER_ID as ee,API_DOCS_PLUGIN_ID as te,API_DOCS_RENDER_DEP_KEY as ne,API_DOCS_RENDER_LOADER_ID as C,API_DOCS_SIDEBAR_LOADER_ID as w,API_DOCS_TEMPLATE_ID as T,SPEC_DOWNLOAD_ROUTE_PATHS as E,SPEC_PATH_PARAM as re}from"./server/shared.js";import{resolveApiBundleConfig as ie,resolveApiOptions as ae,resolveNestedFeedback as oe,schemaCatalogLink as se,withDownloadUrls as ce,withFeedbackOption as le,withMockServerOption as ue}from"./server/options.js";import{annotateApiDocsRbac as de}from"../../../../server/rbac/api-docs.js";import{SERVER_ONLY_VALUE_KEY as D}from"../../../loaders/server-only-value.js";import{getLoadedProjectPlugins as fe}from"../../project/loaded-set.js";import{API_OUTPUT_MANIFEST_KEY as O}from"../../../api-outputs.js";import{API_DOCS_MARKDOC_TAG_SET as k,resolveMarkdocTagSet as A}from"../../../markdown/constants/tag-sets.js";import{pageLocale as j}from"../../utils/page-locale.js";import{buildBundledApiDefinition as M,resolveLlmsDescriptions as N}from"./server/build-definition.js";import{collectSidebarSubpathTargets as P,toSidebarSubtree as F,toSubpathTarget as I}from"./server/build-sidebar.js";import{buildApiDocsMarkdownDocs as L}from"./server/markdown-docs.js";import{join as R,relative as z}from"node:path";import B from"@redocly/markdoc";const V=[`.yaml`,`.yml`,`.json`,`.gql`,`.graphql`],pe={[_]:`OpenAPI`,[h]:`AsyncAPI`,[g]:`GraphQL`,[m]:`Arazzo`},H=t(C,async e=>{let{buildItems:t}=await import(`@redocly/api-docs`),n=G(e),r=await e.io.readFile(n.absolutePath),i=e.routes.byFilePath(e.file.path)?.slug,a=ce(e.args.options,e.file.path,e.args.kind),o=e.args.kind===`openapi`?ue(a,e.config,i):a,s={entityDeps:[],assetUsages:[],linkRefs:[],problems:[],pending:[]},c=W(e.contentDir),l={markdown:e.markdown,loader:{config:e.config,entities:e.entities,file:e.file,io:e.io,logger:e.logger,plugin:e.plugin},sink:s},u=await M({kind:e.args.kind,source:r,relativePath:n.relativePath,contentDir:e.contentDir,pagePath:e.file.path,options:o,bundle:K(e.args,c),metadata:X(e.args.options),markdownResolution:l,rbac:{warn:t=>e.logger?.warn(t)}}),f={...d(u.document)&&d(u.document.info)?{infoDescription:u.document.info.description}:{},...await N(u.document,l,{contentDir:e.contentDir,specPath:n.relativePath,pagePath:e.file.path})};e.args.kind===`openapi`&&o.showSchemaCatalogLinks&&d(u.document)&&(u.document[`x-schema-catalog-link`]=se(e.file.path)),u.options=le(u.options,u.document,e.args.feedback??e.config.feedback);let p=i?.toLowerCase()??`/`,{items:m,store:h,specType:g}=await t({...u,basePath:p,markdownParser:e=>B.compact(x(e))}),_=JSON.stringify({items:y(m),store:y(h),options:u.options,specType:g,basePath:p,title:ye(u.document,e.args.kind,m),metadata:ve(u.document),[D]:{llms:f}});return{value:await e.createBlobRef(_,{format:`json`}),entityDeps:[...J(e.file.path,[...u.fileDependencies,...c.paths]),...s.entityDeps],assetUsages:s.assetUsages,markdoc:{tagSet:k},linkRefs:s.linkRefs,problems:s.problems}},{async searchable(e,t){if(t.route===void 0||t.route.metadata.excludeFromSearch===!0)return{docs:[]};let n=b(e),r=await we(t.entities,t.route.originFilePath),l={...t.route.metadata,...d(n.metadata)?n.metadata:{}},{category:u,isInvalid:f}=c(l),{facets:p,invalidFields:m}=o(l,a(t.config)),{buildApiDocsSearchDocuments:h}=await import(`./server/search-documents.js`);return{...h(n,r,{groupKey:u,facets:p,warn:e=>t.logger?.warn(e)}),problems:s([...m,...f?[i]:[]],t.route.originFilePath)}},async markdown(e,t){if(t.route===void 0)return null;let n=b(e),r=t.route.originFilePath??void 0,i=r?await t.entities.load(S(r)).catch(()=>void 0):void 0,{tags:a}=await A(k);return L(n,_e(i,n[D]?.llms),r,{tags:a,locale:j(t)})},usesProjectMarkdocSchema:!0}),U=t(ee,async e=>{let t=G(e),n=await e.io.readFile(t.absolutePath),r=W(e.contentDir),i=await M({kind:e.args.kind,source:n,relativePath:t.relativePath,contentDir:e.contentDir,bundle:K(e.args,r),metadata:X(e.args.options)}),a=e.args.kind===g,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),...he(i.document,e.routes.byFilePath(e.file.path)?.slug)},entityDeps:J(e.file.path,[...i.fileDependencies,...r.paths])}});function W(e){let t=fe(e)?.lintPlugins??[];return{plugins:t,paths:t.map(t=>l(z(e,t.path))).filter(e=>e!==``&&!e.startsWith(`../`))}}function G(e){let t=e.args.source?.path??e.file.path;return{relativePath:t,absolutePath:R(e.contentDir,t)}}function me(e){let t=e[O];return d(t)&&typeof t.root==`string`?t.root:void 0}function K(e,t){let{config:n,configDir:r}=e.bundleConfig??{config:{},configDir:``};return{config:n,configDir:r,plugins:t.plugins}}function he(e,t){let n=d(e)&&d(e.info)?e.info:{},r=d(n[`x-metadata`])?n[`x-metadata`]:{},i=typeof n.description==`string`?n.description.trim():``;return{...t===void 0?{}:{routeSlug:t},...Q(n.version)?{version:String(n.version)}:{},...typeof r.apiId==`string`?{apiId:r.apiId}:{},description:i||void 0}}const q=t(w,async e=>{let{buildNavItems:t,collectPreviousRouteSlugs:n}=await import(`@redocly/api-docs`),r=await e.entities.load(S(e.file.path)),i=e.args.kind===`graphql`?(await import(`graphql`)).parse(r):r,a=de(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:x}),s=F(o),c=n(o).map(({from:e})=>I(e));return{value:s,targetInventories:[{kind:`subpath`,exhaustive:!0,targets:[...P(s),...c]}]}});function J(e,t){return[{kind:`file`,path:e},...t.map(e=>({kind:`file`,path:e}))]}const ge={arazzo:`Arazzo Docs`,asyncapi:`AsyncAPI Docs`,graphql:`GraphQL Docs`,openapi:`OpenAPI Docs`};function _e(e,t){if(t===void 0||!d(e))return e;let n=d(e.info)?e.info:{},r=d(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 ve(e){let t=d(e)&&d(e.info)?e.info:{};return d(t[`x-metadata`])?t[`x-metadata`]:{}}function ye(e,t,n){let r=d(e)&&d(e.info)?e.info:{};if(typeof r.title==`string`&&r.title!==``)return r.title;let i=d(n[0])?n[0].label:void 0;return typeof i==`string`&&i!==``?i:ge[t]}const be=[`rbac`,`sidebar`,`excludeFromSearch`,`template`];function Y(e,t){let n=d(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),d(n[`x-metadata`])&&Object.assign(r,n[`x-metadata`]),d(t.metadata)&&Object.assign(r,t.metadata);for(let e of be)delete r[e];return r}function X(e){return d(e.metadata)?e.metadata:void 0}function xe(e){let t=X(e)?.title;return typeof t==`string`&&t.length>0?t:void 0}function Z(e,t,n,r){let i=xe(n);return{specType:t,sourcePath:e,...i===void 0?{}:{title:i},...r===void 0?{}:{rbac:r},...Object.keys(n).length>0?{options:n}:{},...d(n.mockServer)?{mockServer:n.mockServer}:{}}}function Q(e){return typeof e==`string`||typeof e==`number`}function Se(e){if(e.ext===`.gql`||e.ext===`.graphql`)return g;let{openapi:t,swagger:n,asyncapi:r,arazzo:i}=e.manifest;return Q(t)||Q(n)?_:Q(r)?h:Q(i)?m:null}const Ce=e({id:te,version:`0.41.0`,content:{filter:{extensions:V},async extractFile(e,t){if(u.test(e.path))return null;let n=Se(e);if(n===null)return null;if(n!==`arazzo`&&!v(t.config,n))return{routes:[],problems:[f(`${pe[n]} documents`)]};let r=e.path,i=me(e.manifest),a=i??r,{rbac:o,...s}=await ae(t.io,t.config,r,n,a),c={filePath:r,kind:n,options:s,...o===void 0||!v(t.config,`rbac`)?{}:{rbac:o}};i!==void 0&&(c.source={path:i});let l=await oe(t.io,t.config,a);if(l!==void 0&&(c.feedback=l),n!==`graphql`){let e=await ie(t.io,t.config,r,a);Object.keys(e.config).length>0&&(c.bundleConfig=e)}let d=U.withArgs(c,{stableKey:S(r),type:`api`,metadata:Z(r,n,s,c.rbac)});if(n===`arazzo`)return{routes:[],entities:[d]};let m=Y(e,s);s.excludeFromSearch===!0&&(m.excludeFromSearch=!0),m.type=n,c.rbac!==void 0&&(m.rbac=c.rbac);let h=H.withArgs(c,{stableKey:`api-docs:render:${r}`}),g=q.withArgs(c,{stableKey:`api-docs:sidebar:${r}`}),_=p(r);return{routes:[{deps:{[ne]:h},metadata:m,routeId:`page`,sidebarSubtree:g,slug:null,slugHint:_,template:T,wildcardPrefix:!0}],entities:[d,h,g]}}},loaders:[U,H,q],templates:{[T]:r(n(`./client/template.tsx`,import.meta.url))},server:{routes:[$(E.bundle,`bundle`),$(E.deprecatedBundle,`bundle`),$(E.graphql,`graphql`)]}});function $(e,t){return{method:`GET`,path:e+re,handler:{filePath:`./server/spec-download.ts`,importer:import.meta.url,exportName:t}}}async function we(e,t){if(t)try{return await e.load(S(t))}catch{return}}export{Ce as apiDocsContentPlugin};
1
+ import{defineContentPlugin as e}from"../../define.js";import{createEntityLoader as t}from"../../../loaders/define.js";import{runtimeFile as n}from"../../utils/runtime-file.js";import{runtimeTemplate as r}from"../../templates.js";import{SEARCH_API_TITLE_FACET_FIELD as i,SEARCH_API_VERSION_FACET_FIELD as a,SEARCH_GROUP_FACET_FIELD as o}from"../../../../shared/search/facets.js";import{configuredFacetFields as s,extractFacetsFromFrontmatter as c,invalidFacetValueProblems as l,searchCategoryOf as u}from"../../../search/facet-values.js";import{isPlanFeatureGranted as d}from"../../../../shared/plan-gates.js";import{TRANSLATIONS_FILE_PATTERN as f}from"../../../../shared/constants/l10n/defaults.js";import{isObject as p}from"../../../../shared/utils/is-object.js";import{slugifySegment as m}from"../../../../shared/utils/routes/slugify-segment.js";import{API_DOCS_API_LOADER_ID as h,API_DOCS_PLUGIN_ID as g,API_DOCS_RENDER_DEP_KEY as _,API_DOCS_RENDER_LOADER_ID as v,API_DOCS_SIDEBAR_LOADER_ID as y,API_DOCS_TEMPLATE_ID as b,SPEC_DOWNLOAD_ROUTE_PATHS as x,SPEC_PATH_PARAM as ee}from"./server/shared.js";import{toPublicVersionedSlug as te}from"../../../../shared/constants/versions.js";import{API_DOCS_MARKDOC_TAG_SET as S,resolveMarkdocTagSet as ne}from"../../../markdown/constants/tag-sets.js";import{SERVER_ONLY_VALUE_KEY as C}from"../../../loaders/server-only-value.js";import{packMarkdocAstsDeep as w,unpackMarkdocAstsDeep as T}from"../../../../shared/utils/packed-ast.js";import{toPosixPath as re}from"../../../../shared/utils/to-posix-path.js";import{findVersionFolder as ie}from"../../utils/version-path.js";import{readVersionsYaml as ae,versionsYamlPath as oe}from"../../../versions/version-groups.js";import{notInPlanProblem as E}from"../../../plan-gates.js";import{filePathToRouteSlug as se}from"../../../../shared/utils/routes/file-path-to-route-slug.js";import{parseMarkdownCached as D}from"../../../markdown/utils/parse-cache.js";import{SPEC_KIND_ARAZZO as O,SPEC_KIND_ASYNCAPI as k,SPEC_KIND_GRAPHQL as A,SPEC_KIND_GRPC as j,SPEC_KIND_OPENAPI as M}from"../../../../shared/constants/api-spec-kinds.js";import{createApiEntityKey as N}from"../../utils/api-entity-key.js";import{resolveApiBundleConfig as ce,resolveApiOptions as le,resolveNestedFeedback as ue,schemaCatalogLink as de,withDownloadUrls as fe,withFeedbackOption as pe,withMockServerOption as me}from"./server/options.js";import{annotateApiDocsRbac as P}from"../../../../shared/rbac/api-docs.js";import{getLoadedProjectPlugins as F}from"../../project/loaded-set.js";import{API_OUTPUT_MANIFEST_KEY as I}from"../../../api-outputs.js";import{pageLocale as L}from"../../utils/page-locale.js";import{buildBundledApiDefinition as R,resolveLlmsDescriptions as z}from"./server/build-definition.js";import{collectSidebarSubpathTargets as he,toSidebarSubtree as ge,toSubpathTarget as _e}from"./server/build-sidebar.js";import{declaresProtoService as B}from"./server/declares-proto-service.js";import{join as ve,relative as ye,resolve as V}from"node:path";import be from"@redocly/markdoc";async function xe(e,t){let n=t.originFilePath===null?null:ie(t.originFilePath);if(n===null||t.version===null||t.versionGroup===null)return{slug:t.slug,entityDeps:[]};let r=await ae({io:{exists:t=>e.io.exists(V(e.contentDir,t)),readFile:t=>e.io.readFile(V(e.contentDir,t))},directory:n.parent}),i=typeof r?.default==`string`&&m(r.default)===t.version;return{slug:te(t.slug,t.versionGroup,t.version,i),entityDeps:[{kind:`file`,path:oe(n.parent)}]}}const Se=[`.yaml`,`.yml`,`.json`,`.gql`,`.graphql`,`.proto`],Ce={[M]:`OpenAPI`,[k]:`AsyncAPI`,[A]:`GraphQL`,[O]:`Arazzo`,[j]:`gRPC`},H=t(v,async e=>{let{buildItems:t,descriptionOptions:n}=await import(`@redocly/api-docs/server`),r=G(e),i=await e.io.readFile(r.absolutePath),a=e.routes.byFilePath(e.file.path),o=a?.slug,s=a&&e.args.kind===`openapi`?await xe(e,a):{slug:void 0,entityDeps:[]},c=fe(e.args.options,e.file.path,e.args.kind),l=e.args.kind===`openapi`?me(c,e.config,s.slug):c,u={entityDeps:[],assetUsages:[],linkRefs:[],problems:[],pending:[]},d=W(e.contentDir),f={markdown:e.markdown,loader:{config:e.config,entities:e.entities,file:e.file,io:e.io,logger:e.logger,plugin:e.plugin},sink:u},m=await R({kind:e.args.kind,source:i,relativePath:r.relativePath,contentDir:e.contentDir,pagePath:e.file.path,options:l,bundle:K(e.args,d),metadata:Y(e.args.options),io:e.io,markdownResolution:f,rbac:{warn:t=>e.logger?.warn(t)}}),h={...p(m.document)&&p(m.document.info)?{infoDescription:m.document.info.description}:{},...await z(m.document,f,{contentDir:e.contentDir,specPath:r.relativePath,pagePath:e.file.path})};e.args.kind===`openapi`&&l.showSchemaCatalogLinks&&p(m.document)&&(m.document[`x-schema-catalog-link`]=de(e.file.path)),m.options={...pe(m.options,m.document,e.args.feedback??e.config.feedback),...n(e.args.kind,m.document,Y(e.args.options))};let g=o?.toLowerCase()??`/`,{items:_,store:v,specType:y}=await t({...m,basePath:g,markdownParser:e=>be.compact(D(e))}),b=JSON.stringify({items:w(_),store:w(v),options:m.options,specType:y,basePath:g,title:ke(m.document,e.args.kind,_),metadata:Oe(m.document),[C]:{llms:h}});return{value:await e.createBlobRef(b,{format:`json`}),entityDeps:[...J(e.file.path,[...m.fileDependencies,...d.paths]),...u.entityDeps,...s.entityDeps],assetUsages:u.assetUsages,markdoc:{tagSet:S},linkRefs:u.linkRefs,problems:u.problems}},{async searchable(e,t){if(t.route===void 0||t.route.metadata.excludeFromSearch===!0)return{docs:[]};let n=T(e);if(n.specType===`grpc`)return{docs:[]};let r=await $(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=T(e);if(n.specType===`grpc`)return null;let r=t.route.originFilePath??void 0,i=await $(t.entities,r),{tags:a}=await ne(S,t.config),{buildApiDocsMarkdownCopies:o}=await import(`./server/markdown-copy.js`);return o(n,De(i,n[C]?.llms),{originFilePath:r,markdown:{tags:a,locale:L(t)},warn:e=>t.logger?.warn(e)})},usesProjectMarkdocSchema:!0}),U=t(h,async e=>{let t=G(e),n=await e.io.readFile(t.absolutePath),r=W(e.contentDir),i=await R({kind:e.args.kind,source:n,relativePath:t.relativePath,contentDir:e.contentDir,bundle:K(e.args,r),metadata:Y(e.args.options),io:e.io}),a=e.args.kind===A,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:{...X(e.file.path,e.args.kind,e.args.options,e.args.rbac),...Te(i.document,e.routes.byFilePath(e.file.path)?.slug)},entityDeps:J(e.file.path,[...i.fileDependencies,...r.paths]),problems:i.problems}});function W(e){let t=F(e)?.lintPlugins??[];return{plugins:t,paths:t.map(t=>re(ye(e,t.path))).filter(e=>e!==``&&!e.startsWith(`../`))}}function G(e){let t=e.args.source?.path??e.file.path;return{relativePath:t,absolutePath:ve(e.contentDir,t)}}function we(e){let t=e[I];return p(t)&&typeof t.root==`string`?t.root:void 0}function K(e,t){let{config:n,configDir:r}=e.bundleConfig??{config:{},configDir:``};return{config:n,configDir:r,plugins:t.plugins}}function Te(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},...Z(n.version)?{version:String(n.version)}:{},...typeof r.apiId==`string`?{apiId:r.apiId}:{},description:i||void 0}}const q=t(y,async e=>{let{buildNavItems:t,collectPreviousRouteSlugs:n}=await import(`@redocly/api-docs/server`),r=await e.entities.load(N(e.file.path)),i=e.args.kind===`graphql`?(await import(`graphql`)).parse(r):r,a=P(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:D}),s=ge(o),c=n(o).map(({from:e})=>_e(e));return{value:s,targetInventories:[{kind:`subpath`,exhaustive:!0,targets:[...he(s),...c]}]}});function J(e,t){return[{kind:`file`,path:e},...t.map(e=>({kind:`file`,path:e}))]}const Ee={arazzo:`Arazzo Docs`,asyncapi:`AsyncAPI Docs`,graphql:`GraphQL Docs`,grpc:`gRPC Docs`,openapi:`OpenAPI Docs`};function De(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 Oe(e){let t=p(e)&&p(e.info)?e.info:{};return p(t[`x-metadata`])?t[`x-metadata`]:{}}function ke(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:Ee[t]}const Ae=[`rbac`,`sidebar`,`excludeFromSearch`,`template`];function je(e,t){let n=p(e.manifest.info)?e.manifest.info:{},r={};typeof n.title==`string`&&(r.title=n.title),Z(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 Ae)delete r[e];return r}function Y(e){return p(e.metadata)?e.metadata:void 0}function Me(e){let t=Y(e)?.title;return typeof t==`string`&&t.length>0?t:void 0}function X(e,t,n,r){let i=Me(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 Z(e){return typeof e==`string`||typeof e==`number`}function Ne(e){if(e.ext===`.gql`||e.ext===`.graphql`)return A;let{openapi:t,swagger:n,asyncapi:r,arazzo:i}=e.manifest;return Z(t)||Z(n)?M:Z(r)?k:Z(i)?O:null}async function Pe(e,t){return t.config.grpcDocsEnabled===!0&&B(await t.io.readFile(e.path))?j:null}const Fe=e({id:g,version:`0.52.0`,content:{filter:{extensions:Se},async extractFile(e,t){if(f.test(e.path))return null;let n=e.ext===`.proto`?await Pe(e,t):Ne(e);if(n===null)return null;if(n!==`arazzo`&&n!==`grpc`&&!d(t.config,n))return{routes:[],problems:[E(`${Ce[n]} documents`)]};let r=e.path,i=we(e.manifest),a=i??r,{rbac:o,...s}=await le(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 ue(t.io,t.config,a);if(l!==void 0&&(c.feedback=l),n!==`graphql`&&n!==`grpc`){let e=await ce(t.io,t.config,r,a);Object.keys(e.config).length>0&&(c.bundleConfig=e)}let u=U.withArgs(c,{stableKey:N(r),type:`api`,metadata:X(r,n,s,c.rbac)});if(n===`arazzo`)return{routes:[],entities:[u]};let p=je(e,s);s.excludeFromSearch===!0&&(p.excludeFromSearch=!0),p.type=n,c.rbac!==void 0&&(p.rbac=c.rbac);let m=H.withArgs(c,{stableKey:`api-docs:render:${r}`}),h=q.withArgs(c,{stableKey:`api-docs:sidebar:${r}`}),g=se(r);return{routes:[{deps:{[_]:m},metadata:p,routeId:`page`,sidebarSubtree:h,slug:null,slugHint:g,template:b,wildcardPrefix:!0}],entities:[u,m,h]}}},loaders:[U,H,q],templates:{[b]:r(n(`./client/template.tsx`,import.meta.url))},server:{routes:[Q(x.bundle,`bundle`),Q(x.deprecatedBundle,`bundle`),Q(x.graphql,`graphql`)]}});function Q(e,t){return{method:`GET`,path:e+ee,handler:{filePath:`./server/spec-download.ts`,importer:import.meta.url,exportName:t}}}async function $(e,t){if(t)try{return await e.load(N(t))}catch{return}}export{Fe as apiDocsContentPlugin};
@@ -1,9 +1,12 @@
1
- import { type MarkdownUsageSink } from './markdown-decorator.js';
1
+ import type { createConfig as CreateConfigFn } from '@redocly/openapi-core';
2
+ import { type MarkdownUsageSink, type PendingMarkdownResolution } from './markdown-decorator.js';
2
3
  import type { MarkdownService } from '../../../../markdown/types/service.js';
3
4
  import type { MarkdocResolverContextBase } from '../../../../markdown/resolve/markdoc.js';
4
5
  import { type ApiSpecType } from '../../../types/api-entity.js';
5
6
  import type { JsonObject } from '../../../../database/schema.js';
6
- import { type RbacAnnotationOptions } from '../../../../../server/rbac/api-docs.js';
7
+ import type { ProblemDraft } from '../../../../problems/types.js';
8
+ import type { ContentPluginIO } from '../../../types/io.js';
9
+ import { type RbacAnnotationOptions } from '../../../../../shared/rbac/api-docs.js';
7
10
  /**
8
11
  * Context for resolving markdown descriptions in an OpenAPI/AsyncAPI bundle. `markdown`
9
12
  * carries state + slug resolution; `loader` is the render loader's context, without which
@@ -35,12 +38,20 @@ export type BundledApiDefinition = {
35
38
  relativePath: string;
36
39
  options: Record<string, unknown>;
37
40
  /**
38
- * Content-relative paths of external `$ref` files (transitively). Registered as
39
- * `file` invalidation deps so edits re-materialize the spec. Excludes the root
40
- * spec (tracked as the origin dep) and any ref outside the content root. Always
41
- * `[]` for graphql (no external ref resolution).
41
+ * Content-relative paths of external `$ref` files (transitively), and of the file each
42
+ * schema catalog link names, also when that file does not exist. Registered as `file`
43
+ * invalidation deps so edits re-materialize the spec. Excludes the root spec (tracked as
44
+ * the origin dep) and any ref outside the content root. Always `[]` for graphql (no
45
+ * external ref resolution). For grpc: every path the parser read or looked for an import
46
+ * at, so a file that appears there rebuilds the API.
42
47
  */
43
48
  fileDependencies: string[];
49
+ /**
50
+ * The errors of the bundle, such as a `$ref` that does not resolve, at the referencing file
51
+ * and line when it is in the content root, else at the spec. Always `[]` for graphql. For grpc:
52
+ * each missing import, at the importing file.
53
+ */
54
+ problems: ProblemDraft[];
44
55
  };
45
56
  export declare function buildBundledApiDefinition(input: {
46
57
  /** An Arazzo bundle has every `$ref` resolved inline. */
@@ -63,7 +74,7 @@ export declare function buildBundledApiDefinition(input: {
63
74
  pagePath?: string;
64
75
  /**
65
76
  * 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
77
+ * (see `src/shared/rbac/api-docs.ts`) so `buildItems`/`buildNavItems` apply tag-to-operation
67
78
  * inheritance and `$ref` propagation. GraphQL does not use `x-rbac`.
68
79
  */
69
80
  rbac?: RbacAnnotationOptions;
@@ -74,13 +85,16 @@ export declare function buildBundledApiDefinition(input: {
74
85
  * description. Ignored for graphql.
75
86
  */
76
87
  metadata?: Record<string, unknown>;
88
+ /** The loader's file access, with absolute paths; required for grpc, which reads imports through it. */
89
+ io?: Pick<ContentPluginIO, 'exists' | 'readFile'>;
77
90
  }): Promise<BundledApiDefinition>;
78
- /**
79
- * The descriptions the `.md` routes render but the decorator leaves as strings, because
80
- * api-docs shows them as plain labels (see `MARKDOWN_FIELDS`): the root servers and their
81
- * variables, and the security schemes. Copies of the document's nodes, each description that
82
- * holds Markdoc resolved to its AST through the same pass as the decorated fields.
83
- */
91
+ export declare function createBundleConfig(createConfig: typeof CreateConfigFn, options: {
92
+ bundle: ApiBundleInput;
93
+ specRelativePath: string;
94
+ rootDir: string;
95
+ resolution: ApiDocsMarkdownResolution | undefined;
96
+ }): Promise<import("@redocly/openapi-core").Config>;
97
+ /** Copies of the root servers and security schemes with their descriptions resolved to Markdoc ASTs. */
84
98
  export type LlmsDescriptions = {
85
99
  servers?: unknown[] | Record<string, unknown>;
86
100
  securitySchemes?: Record<string, unknown>;
@@ -90,3 +104,4 @@ export declare function resolveLlmsDescriptions(document: unknown, resolution: A
90
104
  specPath: string;
91
105
  pagePath: string;
92
106
  }): Promise<LlmsDescriptions>;
107
+ export declare function resolvePendingMarkdown(resolution: ApiDocsMarkdownResolution, pendingList: readonly PendingMarkdownResolution[], contentDir: string, pagePath: string): Promise<void>;
@@ -1 +1 @@
1
- import{isObject as e}from"../../../../../shared/utils/is-object.js";import{toContainedContentPath as t}from"../../../../ingest/scan.js";import{SPEC_KIND_ARAZZO as n}from"../../../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{ProblemError as t}from"../../../../problems/problem-error.js";import{toContainedContentPath as n}from"../../../../ingest/scan.js";import{SPEC_KIND_ARAZZO as r,SPEC_KIND_GRPC as i}from"../../../../../shared/constants/api-spec-kinds.js";import{annotateApiDocsRbac as a}from"../../../../../shared/rbac/api-docs.js";import{resolveMarkdownAst as o}from"../../../../markdown/resolve/ast.js";import{PLAIN_DESCRIPTION_SOURCE as s,REALM_MARKDOWN_DECORATOR_KEY as c,REALM_MARKDOWN_DECORATOR_NAME as l,createMarkdownDecoratorPlugin as u}from"./markdown-decorator.js";import{captureSnippet as d,splitSourceLines as f}from"../../../../../shared/utils/capture-snippet.js";import{existsSync as p}from"node:fs";import{join as m}from"node:path";async function h(e){if(e.kind===`grpc`){let{io:t}=e;if(t===void 0)throw Error(`A gRPC definition reads its imports through the loader io.`);return x({...e,io:t})}if(e.kind===`graphql`){let{parse:t}=await import(`graphql`),n;try{n=t(e.source)}catch(t){throw C(e.relativePath,t)}return{type:`graphql`,document:n,relativePath:e.relativePath,options:e.options??{},fileDependencies:[],problems:[]}}let{BaseResolver:t,bundleFromString:n,createConfig:i,getLineColLocation:o}=await import(`@redocly/openapi-core`),s=await w(i,{bundle:e.bundle??{config:{},configDir:``,plugins:[]},specRelativePath:e.relativePath,rootDir:e.contentDir,resolution:e.markdownResolution}),c=y(t,s.resolve,e.contentDir),l;try{l=await n({source:e.source,absoluteRef:m(e.contentDir,e.relativePath),config:s,externalRefResolver:c,dereference:e.kind===r})}catch(t){throw C(e.relativePath,t)}let u=l.bundle.parsed,d=O([...l.fileDependencies,...c.catalogLinkPaths],e.contentDir),f=b(l.problems,o,{contentDir:e.contentDir,specRelativePath:e.relativePath});e.markdownResolution&&await E(e.markdownResolution,e.markdownResolution.sink.pending,e.contentDir,e.pagePath??e.relativePath);let p;try{p=await g(e.kind,u)}catch(t){throw C(e.relativePath,t)}let h=_(p,e.metadata);return{type:e.kind,document:e.rbac?a(h,e.kind,e.rbac):h,relativePath:e.relativePath,options:e.options??{},fileDependencies:d,problems:f}}async function g(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 _(t,n){if(n===void 0||!e(t))return t;let r=e(t.info)?t.info:{},i=e(r[`x-metadata`])?r[`x-metadata`]:{};return{...t,info:{...r,"x-metadata":{...i,...n}}}}const v=/^https?:\/\/.*\/_bundle\/(.*\.(?:ya?ml|json))$/u;function y(e,t,r){class i extends e{catalogLinkPaths=/* @__PURE__ */ new Set;resolveExternalRef(e,t){let i=super.resolveExternalRef(e,t),a=v.exec(i)?.[1];if(a===void 0)return i;let o=m(r,a);return n(r,o)===null?i:(this.catalogLinkPaths.add(o),p(o)?o:i)}}return new i(t)}function b(e,t,r){return e.filter(e=>e.severity===`error`&&e.ignored!==!0).map(e=>{let i=e.message.replaceAll(`${r.contentDir}/`,``),a=e.location[0],o=a?.source?n(r.contentDir,a.source.absoluteRef):null;if(a===void 0||o===null)return{code:`spec/bundle-error`,message:i,location:{filePath:r.specRelativePath}};let{start:s,end:c}=t(a),l={start:{line:s.line,character:s.col},...c?{end:{line:c.line,character:c.col}}:{}};return{code:`spec/bundle-error`,message:i,location:{filePath:o,range:l,snippet:d(f(a.source.body),l)}}})}async function x(e){let{parseProto:n}=await import(`@redocly/api-docs/server`),r=/* @__PURE__ */ new Set,a=[],o;try{o=await n({entry:e.relativePath,importPaths:[``],read:async t=>{if(t===e.relativePath)return e.source;r.add(t);let n=m(e.contentDir,t);return await e.io.exists(n)?e.io.readFile(n):void 0},onMissingImport:({file:e,message:t})=>{a.push({code:`spec/bundle-error`,message:t,location:{filePath:e}})}})}catch(n){let r=n instanceof Error&&`file`in n?n.file:void 0,i=typeof r==`string`?r:e.relativePath;throw a.length===0?C(i,n):new t({code:`spec/bundle-error`,message:`${a.map(e=>e.message).join(` `)} ${S(n)}`,location:{filePath:i}})}return{type:i,document:o,relativePath:e.relativePath,options:e.options??{},fileDependencies:[...r].sort(),problems:a}}function S(e){return e instanceof Error?e.message:String(e)}function C(e,n){let r=S(n);return new t({code:`spec/parse-failed`,message:r,location:{filePath:e}})}function w(e,t){let{bundle:r,resolution:i}=t,a=m(t.rootDir,r.configDir,`redocly.yaml`),o={configPath:m(a,`redocly.yaml`)},s=async(t,n)=>{let r=await e(t,n);return r.configPath=a,r},d=r.plugins.map(({plugin:e,path:t})=>({...e,absolutePath:t}));if(i===void 0)return s({...r.config,plugins:d},o);let{sink:f}=i,p=u({specSourcePath:t.specRelativePath,sink:f,toContentRelative:e=>n(t.rootDir,e)});return s({...r.config,plugins:[...d,p],decorators:{...r.config.decorators,[c]:`on`,[l]:`on`}},o)}async function T(t,n,r){if(!e(t))return{};let i=[],a=(t,n)=>{if(!e(t)||!e(n))return;let a=n[s];i.push({read:()=>t.description,sourceFilePath:typeof a==`string`?a:r.specPath,writeBack:e=>{t.description=e}})},o={},c=t.servers;if(Array.isArray(c)||e(c)){o.servers=structuredClone(c);for(let[e,t]of Object.entries(c))a(o.servers[e],t)}let l=e(t.components)?t.components:void 0;if(e(l?.securitySchemes)){let e=l.securitySchemes;o.securitySchemes=structuredClone(e);for(let[t,n]of Object.entries(e))a(o.securitySchemes[t],n)}return await E(n,i,r.contentDir,r.pagePath),o}async function E(e,t,n,r){let{markdown:i,sink:a}=e,s={...e.loader,contentDir:n,markdown:i};await Promise.all(t.map(async e=>{let t=e.read();if(typeof t!=`string`||!i.looksLikeMarkdown(t))return;let{ast:n,entityDeps:c,assetUsages:l,linkRefs:u,problems:d}=await o(t,e.sourceFilePath,{resolverContext:s});a.entityDeps.push(...c),a.assetUsages.push(...l);for(let t of u)t.raw.trim().startsWith(`#`)?a.linkRefs.push(D({...t,target:r})):e.sourceFilePath===r||t.filePath!==void 0?a.linkRefs.push(D(t)):a.linkRefs.push({...D(t),filePath:e.sourceFilePath});for(let e of d)a.problems.push({...e,location:{filePath:r}});e.writeBack(n)}))}function D(e){if(e.range===void 0)return e;let t={...e};return delete t.range,t}function O(e,t){let r=/* @__PURE__ */ new Set;for(let i of e){let e=n(t,i);e!==null&&r.add(e)}return[...r].sort()}export{h as buildBundledApiDefinition,w as createBundleConfig,T as resolveLlmsDescriptions,E as resolvePendingMarkdown};
@@ -1 +1 @@
1
- import{isRbacScope as e}from"../../../../../server/rbac/engine.js";import{REDOCLY_TEAMS_RBAC as t}from"@redocly/config";function n(e){return e.map(o)}function r(e){let t=/* @__PURE__ */ new Set,n=e=>{for(let r of e){let e=i(r.slugSuffix??``);e!==``&&t.add(e),r.items&&r.items.length>0&&n(r.items)}};return n(e),[...t]}function i(e){return e.replace(/^\/+/,``)}function a(e){return e===``||e.startsWith(`/`)?e:`/${e}`}function o(n){let r={};n.label!==void 0&&(r.label=n.label),n.link!==void 0&&(r.slugSuffix=a(n.link)),n.httpVerb!==void 0&&(r.httpVerb=n.httpVerb),n.deprecated!==void 0&&(r.deprecated=n.deprecated),n.badges!==void 0&&(r.badges=n.badges),n.external!==void 0&&(r.external=n.external),n.separatorLine!==void 0&&(r.separatorLine=n.separatorLine),n.icon!==void 0&&(r.icon=n.icon),n.variant!==void 0&&(r.variant=n.variant);let i=n[t];return e(i)&&(r[t]=i),n.type===`separator`&&(r.type=`separator`,r.separatorLine=!0),n.items&&n.items.length>0&&(r.items=n.items.map(o)),r}export{r as collectSidebarSubpathTargets,n as toSidebarSubtree,i as toSubpathTarget};
1
+ import{isRbacScope as e}from"../../../../../shared/rbac/engine.js";import{REDOCLY_TEAMS_RBAC as t}from"@redocly/config";function n(e){return e.map(o)}function r(e){let t=/* @__PURE__ */ new Set,n=e=>{for(let r of e){let e=i(r.slugSuffix??``);e!==``&&t.add(e),r.items&&r.items.length>0&&n(r.items)}};return n(e),[...t]}function i(e){return e.replace(/^\/+/,``)}function a(e){return e===``||e.startsWith(`/`)?e:`/${e}`}function o(n){let r={};n.label!==void 0&&(r.label=n.label),n.link!==void 0&&(r.slugSuffix=a(n.link)),n.httpVerb!==void 0&&(r.httpVerb=n.httpVerb),n.deprecated!==void 0&&(r.deprecated=n.deprecated),n.badges!==void 0&&(r.badges=n.badges),n.external!==void 0&&(r.external=n.external),n.separatorLine!==void 0&&(r.separatorLine=n.separatorLine),n.icon!==void 0&&(r.icon=n.icon),n.variant!==void 0&&(r.variant=n.variant);let i=n[t];return e(i)&&(r[t]=i),(n.type===`link`||n.type===`group`||n.type===`separator`)&&(r.type=n.type),n.items&&n.items.length>0&&(r.items=n.items.map(o)),r}export{r as collectSidebarSubpathTargets,n as toSidebarSubtree,i as toSubpathTarget};
@@ -0,0 +1,2 @@
1
+ /** Whether `source`, a `.proto` file, declares a service outside comments and string literals. */
2
+ export declare function declaresProtoService(source: string): boolean;
@@ -0,0 +1,3 @@
1
+ const e=/\bservice\s+[A-Za-z_]\w*\s*\{/u;function t(t){return e.test(n(t))}function n(e){let t=``,n=0;for(;n<e.length;){let i=e[n],a=e[n+1];if(i===`/`&&a===`/`){let t=e.indexOf(`
2
+ `,n);n=t===-1?e.length:t}else if(i===`/`&&a===`*`){let r=e.indexOf(`*/`,n+2);n=r===-1?e.length:r+2,t+=` `}else i===`"`||i===`'`?(n=r(e,n),t+=` `):(t+=i,n+=1)}return t}function r(e,t){let n=e[t],r=t+1;for(;r<e.length&&e[r]!==n&&e[r]!==`
3
+ `;)r+=e[r]===`\\`?2:1;return r+1}export{t as declaresProtoService};
@@ -0,0 +1,14 @@
1
+ import type { MarkdownDoc } from '../../../../loaders/define.js';
2
+ import { type MarkdownRenderOptions } from '../../../../markdown/search/to-markdown.js';
3
+ import { type ApiDocsRenderPayload } from './shared.js';
4
+ /** A page's slice longer than this many characters is left out; the copy still links the download. */
5
+ export declare const MAX_MARKDOWN_SLICE_LENGTH = 1000000;
6
+ export type ApiDocsMarkdownCopyOptions = {
7
+ /** The content-relative path of the API description, which the download route serves. */
8
+ originFilePath: string | undefined;
9
+ /** The tag set the descriptions were parsed with, and the page locale. */
10
+ markdown: MarkdownRenderOptions;
11
+ warn: (message: string) => void;
12
+ };
13
+ /** One Markdown doc per page. Built once for all viewers: anything anonymous can't read is left out, and the page's `x-rbac` goes to `rbacScope`. */
14
+ export declare function buildApiDocsMarkdownCopies(payload: ApiDocsRenderPayload, document: unknown, options: ApiDocsMarkdownCopyOptions): Promise<MarkdownDoc[]>;
@@ -0,0 +1,23 @@
1
+ import{isObject as e}from"../../../../../shared/utils/is-object.js";import{SPEC_DOWNLOAD_ROUTE_PATHS as t}from"./shared.js";import{headingSlugger as n}from"../../../../markdown/utils/heading-slugger.js";import{RBAC_TEAM_ANONYMOUS as r}from"../../../../../shared/rbac/types.js";import{canView as i,isRbacScope as a,resolveRole as o}from"../../../../../shared/rbac/engine.js";import{filterRbacAnnotatedDocument as s,withoutRemovedRequired as c}from"../../../../../shared/rbac/filter.js";import{isMarkdocAstNode as l}from"../../../../markdown/server/render.js";import{parseMarkdownCached as u}from"../../../../markdown/utils/parse-cache.js";import{annotateApiDocsRbac as d}from"../../../../../shared/rbac/api-docs.js";import{markdocAstToMarkdownChunks as f}from"../../../../markdown/search/to-markdown.js";import{REDOCLY_TEAMS_RBAC as p}from"@redocly/config";import{JsonPointer as m,buildSpecSlice as h,describeSliceTarget as g,resolveSpecSliceScope as _,sliceCopyIntro as v,wrapSliceForCopy as y}from"@redocly/api-docs/server";const b=1e6;async function x(t,n,r){let i=S(r.markdown),{slice:a,readable:o}=await C(t,n,i,r.warn),s=e(n)&&e(n.info)?n.info:{},c=e(s[`x-metadata`])?s[`x-metadata`]:{},l=typeof s.title==`string`&&s.title!==``?s.title:t.title,u=i(typeof c.description==`string`?c.description:s.description).join(`
2
+
3
+ `),d=T(t.specType,r.originFilePath),f=t.items,p=/* @__PURE__ */ new Map,m=e=>{typeof e.link==`string`&&!p.has(e.link)&&H(e)&&p.set(e.link,U(e));for(let t of e.items??[])m(t)};for(let e of f)m(e);let h=/* @__PURE__ */ new Map,v=e=>{let n=_(t.specType,e.content,e.label);n?.kind===`graphql-type`&&typeof e.link==`string`&&h.set(n.name,e.link);for(let t of e.items??[])v(t)};if(t.specType===`graphql`)for(let e of f)v(e);let y=[],b=/* @__PURE__ */ new Set,x=async e=>{let r=e.content?.contentType,c=e.link;if(typeof c==`string`&&r!==void 0&&!b.has(c)){b.add(c);let m=r===`overview`,v=p.has(c)?p.get(c):U(e),x=m?l:e.label??``,S={specType:t.specType,document:n,renderMarkdown:i},C=r===`item`?_(t.specType,e.content,e.label):void 0,T=C===void 0?void 0:await a(C,p.has(c)),O;if(m)O=D({...S,title:x,description:u,info:s,readable:o,download:d,items:f});else if(C!==void 0&&T!==void 0){let e=w(T,{scope:C,title:x,target:g(C,n),specUrl:d,contentKind:t.specType===`graphql`?`graphql`:`yaml`}),r=t.specType===`graphql`?await E(T,h):``;O=[r===``?e:`${e}\n\n${r}`]}else O=[x===``?``:`# ${x}`,...V(e.content?.children??[],i),M(e.items??[],`##`,S)].filter(e=>e!==``);y.push({routeSlug:c,chunks:O,headings:G(O),title:x,description:m?u:void 0,rbacScope:v})}for(let t of e.items??[])await x(t)};for(let e of f)await x(e);return y}function S(e){let t=t=>{let n=W(t)?t:{type:`document`,children:Array.isArray(t)?t:[t]};return f(n,e)};return e=>{if(e==null)return[];if(typeof e!=`string`)return t(e);if(!e.includes(`{%`)){let t=e.trim();return t===``?[]:[t]}return t(u(e))}}async function C(e,t,n,r){let i=e.specType,a=e=>n(e).join(`
4
+
5
+ `);if(i===`graphql`){let e=typeof t==`string`?await B(t,a):void 0;return{slice:t=>h(i,e,t,{maxRefDepth:0}),readable:void 0}}let o=(e,t)=>h(i,e,t,{maxRefDepth:3}),s=z(t,a),c=d(s,e.specType,{warn:r});if(c===s)return{slice:e=>o(s,e),readable:s};let l=N(c);return{slice:(e,t)=>o(t?l:N(R(c,L(e,c))),e),readable:l}}function w(e,t){return e.length<=1e6?y(e,t).trimEnd():`${v(t)}\n\nThe subset is longer than ${b} characters, so it is not included.`}function T(e,n){if(n!==void 0)return`${e===`graphql`?t.graphql:t.bundle}/${n}`}async function E(e,t){let{parse:n,visit:r}=await import(`graphql`),i=n(e,{noLocation:!0}),a=new Set(i.definitions.map(e=>`name`in e?e.name?.value:``)),o=/* @__PURE__ */ new Set;r(i,{NamedType(e){o.add(e.name.value)}});let s=[...o].filter(e=>!a.has(e)&&t.has(e)).map(e=>`- [${e}](${t.get(e)}.md)`);return s.length===0?``:`Types:\n\n${s.join(`
6
+ `)}`}function D(t){let{info:n}=t,r=[`# ${t.title}`,t.description];typeof n.summary==`string`&&r.push(n.summary);let i=[];n.version!==void 0&&n.version!==``&&i.push(`Version: ${String(n.version)}`);let a=e(n.license)?n.license:void 0;typeof a?.name==`string`&&i.push(`License: ${a.name}`);let o=e(n[`x-metadata`])?n[`x-metadata`]:{},s=Object.entries(o).filter(([,e])=>typeof e==`string`||typeof e==`number`).filter(([e,t])=>e!==`description`||typeof t!=`string`).map(([e,t])=>`- ${e}: ${String(t)}`);s.length>0&&i.push(`Metadata:\n${s.join(`
7
+ `)}`),r.push(i.join(`
8
+ `));let c=e(t.readable)?t.readable:{},l=O[t.specType]??`API description`;return[r.filter(e=>e!==``).join(`
9
+
10
+ `),k(c.servers,t.renderMarkdown),A(c.components,t.renderMarkdown),t.download===void 0?``:`## Download ${l}\n\n[${t.title}](${t.download})`,M(t.items,`##`,t)].filter(e=>e!==``)}const O={openapi:`OpenAPI description`,asyncapi:`AsyncAPI description`,graphql:`GraphQL schema`};function k(t,n){if(!Array.isArray(t)||t.length===0)return``;let r=`## Servers
11
+
12
+ `;for(let i of t){if(!e(i))continue;let t=n(i.description).join(`
13
+
14
+ `);if(t&&(r+=`${t}\n`),r+=`\`\`\`\n${String(i.url??``)}\n\`\`\`\n\n`,e(i.variables)){r+=`Variables:
15
+ `;for(let[t,a]of Object.entries(i.variables)){if(!e(a))continue;let i=n(a.description).join(` `).replace(/\s+/g,` `);r+=`- \`${t}\`${i?`: ${i}`:``}\n`,a.default!==void 0&&(r+=` Default: ${JSON.stringify(a.default)}\n`),Array.isArray(a.enum)&&(r+=` Enum: ${a.enum.map(e=>JSON.stringify(e)).join(`, `)}\n`)}r+=`
16
+ `}}return r.trim()}function A(t,n){let r=e(t)&&e(t.securitySchemes)?t.securitySchemes:void 0;if(r===void 0)return``;let i=`## Security
17
+
18
+ `;for(let[t,a]of Object.entries(r)){if(!e(a)||`$ref`in a)continue;i+=`### ${t}\n\n`;let r=n(a.description).join(`
19
+
20
+ `);r&&(i+=`${r}\n\n`);for(let[e,t]of j)typeof a[t]==`string`&&a[t]&&(i+=`${e}: ${a[t]}\n`);let o=e(a.flows)?a.flows:{},s=[o.implicit,o.password,o.clientCredentials,o.authorizationCode].find(e);if(s!==void 0&&(typeof s.authorizationUrl==`string`&&(i+=`Authorization URL: ${s.authorizationUrl}\n`),typeof s.tokenUrl==`string`&&(i+=`Token URL: ${s.tokenUrl}\n`),e(s.scopes))){i+=`Scopes:
21
+ `;for(let[e,t]of Object.entries(s.scopes))i+=`- \`${e}\`: ${String(t)}\n`}i+=`
22
+ `}return i.trim()}const j=[[`Type`,`type`],[`In`,`in`],[`Name`,`name`],[`Scheme`,`scheme`],[`Bearer Format`,`bearerFormat`],[`OpenID Connect URL`,`openIdConnectUrl`]];function M(e,t,n){let r=``;for(let i of e)if(H(i)){if(i.content?.contentType===`group`){r+=`${t} ${i.label??``}\n\n`;let e=M(i.items??[],`${t}#`,n);e!==``&&(r+=`${e}\n\n`)}else if(i.content?.contentType===`item`&&typeof i.link==`string`){let e=_(n.specType,i.content,i.label),t=(e===void 0?void 0:g(e,n.document))??i.label??``,a=V(i.content.children??[],n.renderMarkdown).join(` `).replace(/\s+/g,` `).trim();r+=`- [${t}](${i.link}.md)${a?`: ${a.slice(0,200)}`:``}\n`}}return r.trim()}function N(e){return F(s(e,[r]),e)}const P=Symbol(`removed`);function F(t,n){let r=/* @__PURE__ */ new Map,i=a=>{let o=r.get(a);if(o!==void 0)return o;let s=I(t,a),c=s===void 0?I(n,a)!==void 0:e(s)&&typeof s.$ref==`string`&&i(s.$ref);return r.set(a,c),c},a=t=>{if(Array.isArray(t))return t.map(a).filter(e=>e!==P);if(!e(t))return t;if(typeof t.$ref==`string`&&i(t.$ref))return P;let n={};for(let[e,r]of Object.entries(t)){let t=a(r);t!==P&&(n[e]=t)}return c(t,n)},o=a(t);return o===P?void 0:o}function I(t,n){if(!n.startsWith(`#/`))return;let r=t;for(let t of m.parse(n)){if(!(e(r)||Array.isArray(r))||!Object.hasOwn(r,t))return;r=r[t]}return r}function L(t,n){switch(t.kind){case`operation`:{let r=e(n)&&n[`x-webhooks`]?`x-webhooks`:`webhooks`;return[t.source===`webhooks`?r:`paths`,t.pathName,t.httpVerb]}case`schema`:return[`components`,`schemas`,t.name];case`channel`:return[`channels`,t.channelId];case`async-operation`:return[`operations`,t.operationId];default:return[]}}function R(t,n){let[r,...i]=n;if(r===void 0){if(!e(t))return t;let n={...t};return delete n[p],n}return!e(t)||!Object.hasOwn(t,r)?t:{...t,[r]:R(t[r],i)}}function z(t,n,r=!1){if(Array.isArray(t)){let e=t.map(e=>z(e,n));return e.some((e,n)=>e!==t[n])?e:t}if(!e(t))return t;let i;for(let[e,a]of Object.entries(t)){let o=(r||e===`description`||e===`summary`||e===`x-summary`)&&(typeof a==`string`?a.includes(`{%`):l(a))?n(a):z(a,n,e===`x-enumDescriptions`);o!==a&&((i??={...t})[e]=o)}return i??t}async function B(e,t){if(!e.includes(`{%`))return e;let{parse:n,print:r,visit:i}=await import(`graphql`);return r(i(n(e,{noLocation:!0}),{enter(e){let n=`description`in e?e.description:void 0;if(n?.value.includes(`{%`))return{...e,description:{...n,value:t(n.value)}}}}))}function V(e,t){let n=[],r=e=>{if(H(e)){if(e.nodeType===`markdoc`){n.push(...t(e.content));return}if(e.nodeType===`container`)for(let t of e.children??[])r(t)}};for(let t of e)r(t);return n}function H(e){let t=U(e);return t===void 0||i(o(t,[`anonymous`]))}function U(e){let t=e[p];if(t!==void 0)return a(t)?t:{}}function W(t){return e(t)&&t.type===`document`}function G(e){return n.reset(),e.map(e=>{let t=/^#{1,6} +(?! )(.+)$/.exec(e.split(`
23
+ `,1)[0]??``);if(!t)return null;let r=t[1].trim();return{heading:r,anchor:n.slug(r)}})}export{b as MAX_MARKDOWN_SLICE_LENGTH,x as buildApiDocsMarkdownCopies};
@@ -25,10 +25,7 @@ export type MarkdownUsageSink = {
25
25
  /** Filled during the sync bundle walk; drained by the async post-bundle pass. */
26
26
  pending: PendingMarkdownResolution[];
27
27
  };
28
- /**
29
- * Key of the content-relative source file on each bundled server, server variable and security
30
- * scheme node, whose `description` stays a plain string. Spread copies keep it; JSON drops it.
31
- */
28
+ /** Key of the content-relative source file on each bundled server and security scheme node. */
32
29
  export declare const PLAIN_DESCRIPTION_SOURCE: unique symbol;
33
30
  /** The unprefixed decorator name as registered on the plugin. openapi-core namespaces
34
31
  * plugin decorators as `<pluginId>/<name>` when it normalizes plugins (`resolvePlugins`),
@@ -1 +1 @@
1
- const e=Symbol(`plainDescriptionSource`),t=`realm-internal`,n=`resolve-markdown`,r=`${t}/${n}`,i=[`description`];function a(r){let a=e=>{let t=o(e);return(t===void 0?null:r.toContentRelative(t))??r.specSourcePath},s=(e,t)=>{if(typeof e!=`object`||!e)return;let n=e,o=a(t);for(let e of i)r.sink.pending.push({read:()=>n[e],sourceFilePath:o,writeBack:t=>{n[e]=t}});let s=n[`x-enumDescriptions`];if(s&&typeof s==`object`){let e=s;for(let t of Object.keys(e))r.sink.pending.push({read:()=>e[t],sourceFilePath:o,writeBack:n=>{e[t]=n}})}},c=(t,n)=>{typeof t==`object`&&t&&(t[e]=a(n))},l=()=>({Server:{enter:c},ServerVariable:{enter:c},SecurityScheme:{enter:c},Info:{enter:s},Tag:{enter:s},Operation:{enter:s},Parameter:{enter:s},Schema:{enter:s},Response:{enter:s},Header:{enter:s},RequestBody:{enter:s}});return{id:t,decorators:{oas3:{[n]:l},oas2:{[n]:l},async2:{[n]:l},async3:{[n]:l}}}}function o(e){let t=(e?.location)?.source?.absoluteRef;return typeof t==`string`?t:void 0}export{e as PLAIN_DESCRIPTION_SOURCE,r as REALM_MARKDOWN_DECORATOR_KEY,n as REALM_MARKDOWN_DECORATOR_NAME,a as createMarkdownDecoratorPlugin};
1
+ const e=Symbol(`plainDescriptionSource`),t=`realm-internal`,n=`resolve-markdown`,r=`${t}/${n}`,i=[`description`],a=/* @__PURE__ */ new Set([`Server`,`SecurityScheme`]);function o(r){let o=e=>{let t=s(e);return(t===void 0?null:r.toContentRelative(t))??r.specSourcePath},c=(e,t)=>{if(typeof e!=`object`||!e)return;let n=e,a=o(t);for(let e of i)r.sink.pending.push({read:()=>n[e],sourceFilePath:a,writeBack:t=>{n[e]=t}});let s=n[`x-enumDescriptions`];if(s&&typeof s==`object`){let e=s;for(let t of Object.keys(e))r.sink.pending.push({read:()=>e[t],sourceFilePath:a,writeBack:n=>{e[t]=n}})}},l=(t,n)=>{typeof t==`object`&&t&&(t[e]=o(n))},u=(e,t)=>{let n=t.type?.name;typeof e.description==`string`&&(n!==void 0&&a.has(n)||c(e,t))},d=()=>({ref:{enter:u},Server:{enter:l},SecurityScheme:{enter:l},ServerVariable:{enter:c},Example:{enter:c},Info:{enter:c},Tag:{enter:c},Operation:{enter:c},Parameter:{enter:c},Schema:{enter:c},Response:{enter:c},Header:{enter:c},RequestBody:{enter:c}});return{id:t,decorators:{oas3:{[n]:d},oas2:{[n]:d},async2:{[n]:d},async3:{[n]:d}}}}function s(e){let t=(e?.location)?.source?.absoluteRef;return typeof t==`string`?t:void 0}export{e as PLAIN_DESCRIPTION_SOURCE,r as REALM_MARKDOWN_DECORATOR_KEY,n as REALM_MARKDOWN_DECORATOR_NAME,o as createMarkdownDecoratorPlugin};
@@ -39,8 +39,10 @@ export declare function resolveNestedFeedback(io: Pick<PluginIO, 'readFile'>, co
39
39
  */
40
40
  export declare function withMockServerOption(options: Record<string, unknown>, config: Pick<RealmConfig, 'mockServer' | 'planGates'>, routeSlug: string | undefined): Record<string, unknown>;
41
41
  /**
42
- * The api-docs `downloadUrls` option: the spec download routes (`server/spec-download.ts`) for
43
- * `sourcePath`, path-prefixed, unless the per-API config sets its own list.
42
+ * The api-docs `downloadUrls` and `replayDefinitionUrl` options. `downloadUrls` is the spec
43
+ * download routes (`server/spec-download.ts`) for `sourcePath`, path-prefixed, unless the per-API
44
+ * config sets its own list. `replayDefinitionUrl` is always the first of those routes, so Try it
45
+ * loads the description from this site even when the configured list points to another origin.
44
46
  */
45
47
  export declare function withDownloadUrls(options: Record<string, unknown>, sourcePath: string, kind: ApiSpecType): Record<string, unknown>;
46
48
  /** The `x-schema-catalog-link` value: the bundle route for `sourcePath` (`showSchemaCatalogLinks`). */
@@ -1 +1 @@
1
- import{toPosixPath as e}from"../../../../../shared/utils/to-posix-path.js";import{isMissingError as t}from"../../../../../shared/utils/is-missing-error.js";import{isObject as n}from"../../../../../shared/utils/is-object.js";import{NESTED_CONFIG_FILENAME as r,deepMergeConfig as i,parseNestedConfig as a}from"../../../../config.js";import{contentIgnoreMatcherOf as o}from"../../../../ingest/scan.js";import{MOCK_SERVER_ROUTE_PREFIX as s,SPEC_KIND_GRAPHQL as c,mockPathPrefix as l}from"../../../types/api-entity.js";import{isPlanFeatureGranted as u}from"../../../../../shared/plan-gates.js";import{withPathPrefix as d}from"../../../../../shared/path-prefix.js";import{SPEC_DOWNLOAD_ROUTE_PATHS as f}from"./shared.js";import{posix as p}from"node:path";import{decoratorTypes as m,preprocessorTypes as h}from"@redocly/config";import{FEEDBACK_TYPES as g}from"@redocly/theme/core/constants";const _=[`openapi`,`asyncapi`,`graphql`];function v(e,t,n){let r=O(t),i=Object.values(e.apis??{}),a=e=>O(p.join(n,e))===r;return i.find(e=>e.output!==void 0&&a(e.output))??i.find(e=>e.output===void 0&&a(e.root))}function y(e,t,n=``){let r=v(e,t,n);if(!r)return{};let i={};r.metadata&&(i.metadata=r.metadata);for(let e of _)r[e]&&typeof r[e]==`object`&&Object.assign(i,r[e]);return r.rbac!==void 0&&(i.rbac=r.rbac),i}async function b(e,t,n,r,a=n){let s=T(t,r),c=await w(e,a,o(t));return c===null?i(s,y(t,n)):i(i(s,E(c.config,r)),y(c.config,n,c.dir))}const x=[...m,...h];async function S(e,t,r,a=r){let s=await w(e,a,o(t)),c=s===null?[t,v(t,r,``)]:[t,s.config,v(s.config,r,s.dir)],l={};for(let e of c){if(!n(e))continue;let t={};for(let r of x)n(e[r])&&(t[r]=e[r]);l=i(l,t)}return{config:l,configDir:s?.dir??``}}async function C(e,t,n){return(await w(e,n,o(t)))?.config.feedback}async function w(e,t,n){for(let i=p.dirname(t);i!==`.`&&i!==`/`;i=p.dirname(i)){let t=p.join(i,r);if(n(t))continue;let a=await D(e,t);if(a!==null)return{config:a,dir:i}}return null}function T(e,t){return t===`arazzo`?{}:e[t]??{}}function E(e,t){let n={...T(e,t)};return e.mockServer&&(n.mockServer=e.mockServer),n}async function D(e,n){let r;try{r=await e.readFile(n)}catch(e){if(t(e))return null;throw e}return a(r,n).config}function O(t){return p.normalize(e(t)).replace(/^\.\/+/,``).replace(/^\/+/,``)}function k(e,t,r){let i=n(e.mockServer)?e.mockServer:{},a={...t.mockServer,...i};if(r===void 0||a.off===!0||!u(t,`mockServer`))return e;let o=d(s+l(r));return{...e,mockServer:{url:o,position:`first`,description:`Mock server`,...a}}}function A(e,t,n){if(Array.isArray(e.downloadUrls))return e;let r=e=>e.split(`/`).map(encodeURIComponent).join(`/`),i=n===c,a=i?f.graphql:f.bundle,o=i?[t]:[`.json`,`.yaml`].map(e=>t.replace(/\.[^./]+$/u,e));return{...e,downloadUrls:o.map(e=>({url:d(`${a}/${r(e)}?download`),title:p.basename(e)}))}}function j(e){return d(`${f.bundle}/${e}`)}const M={[g.RATING]:`Rate this section`,[g.SENTIMENT]:`Was this section helpful?`,[g.MOOD]:`Was this section helpful?`,[g.COMMENT]:`Share your feedback about this section`,[g.SCALE]:`How would you rate this section?`};function N(e,t,r){let i=[n(t)?t[`x-feedback`]:void 0,e.feedback,r].find(n);if(i===void 0)return e;let a=n(i.settings)?i.settings:{},o=typeof i.type==`string`?M[i.type]:void 0,s=a.label||o||``;return{...e,feedback:{...i,settings:{...a,label:s}}}}export{y as readApiOptionsFromConfig,S as resolveApiBundleConfig,b as resolveApiOptions,C as resolveNestedFeedback,j as schemaCatalogLink,A as withDownloadUrls,N as withFeedbackOption,k as withMockServerOption};
1
+ import{isPlanFeatureGranted as e}from"../../../../../shared/plan-gates.js";import{withPathPrefix as t}from"../../../../../shared/path-prefix.js";import{isObject as n}from"../../../../../shared/utils/is-object.js";import{SPEC_DOWNLOAD_ROUTE_PATHS as r}from"./shared.js";import{isMissingError as i}from"../../../../../shared/utils/is-missing-error.js";import{toPosixPath as a}from"../../../../../shared/utils/to-posix-path.js";import{NESTED_CONFIG_FILENAME as o,deepMergeConfig as s,parseNestedConfig as c}from"../../../../config.js";import{contentIgnoreMatcherOf as l}from"../../../../ingest/scan.js";import{SPEC_KIND_GRAPHQL as u}from"../../../../../shared/constants/api-spec-kinds.js";import{MOCK_SERVER_ROUTE_PREFIX as d,mockPathPrefix as f}from"../../../types/api-entity.js";import{posix as p}from"node:path";import{decoratorTypes as m,preprocessorTypes as h}from"@redocly/config";import{FEEDBACK_TYPES as g}from"@redocly/theme/core/constants";const _=[`openapi`,`asyncapi`,`graphql`];function v(e,t,n){let r=O(t),i=Object.values(e.apis??{}),a=e=>O(p.join(n,e))===r;return i.find(e=>e.output!==void 0&&a(e.output))??i.find(e=>e.output===void 0&&a(e.root))}function y(e,t,n=``){let r=v(e,t,n);if(!r)return{};let i={};r.metadata&&(i.metadata=r.metadata);for(let e of _)r[e]&&typeof r[e]==`object`&&Object.assign(i,r[e]);return r.rbac!==void 0&&(i.rbac=r.rbac),i}async function b(e,t,n,r,i=n){let a=T(t,r),o=await w(e,i,l(t));return o===null?s(a,y(t,n)):s(s(a,E(o.config,r)),y(o.config,n,o.dir))}const x=[...m,...h];async function S(e,t,r,i=r){let a=await w(e,i,l(t)),o=a===null?[t,v(t,r,``)]:[t,a.config,v(a.config,r,a.dir)],c={};for(let e of o){if(!n(e))continue;let t={};for(let r of x)n(e[r])&&(t[r]=e[r]);c=s(c,t)}return{config:c,configDir:a?.dir??``}}async function C(e,t,n){return(await w(e,n,l(t)))?.config.feedback}async function w(e,t,n){for(let r=p.dirname(t);r!==`.`&&r!==`/`;r=p.dirname(r)){let t=p.join(r,o);if(n(t))continue;let i=await D(e,t);if(i!==null)return{config:i,dir:r}}return null}function T(e,t){return t===`arazzo`||t===`grpc`?{}:e[t]??{}}function E(e,t){let n={...T(e,t)};return e.mockServer&&(n.mockServer=e.mockServer),n}async function D(e,t){let n;try{n=await e.readFile(t)}catch(e){if(i(e))return null;throw e}return c(n,t).config}function O(e){return p.normalize(a(e)).replace(/^\.\/+/,``).replace(/^\/+/,``)}function k(r,i,a){let o=n(r.mockServer)?r.mockServer:{},s={...i.mockServer,...o};if(a===void 0||s.off===!0||!e(i,`mockServer`))return r;let c=t(d+f(a));return{...r,mockServer:{url:c,position:`first`,description:`Mock server`,...s}}}function A(e,n,i){if(i===`grpc`)return e;let a=e=>e.split(`/`).map(encodeURIComponent).join(`/`),o=i===u,s=o?r.graphql:r.bundle,c=(o?[n]:[`.json`,`.yaml`].map(e=>n.replace(/\.[^./]+$/u,e))).map(e=>({url:t(`${s}/${a(e)}?download`),title:p.basename(e)}));return{...e,downloadUrls:Array.isArray(e.downloadUrls)?e.downloadUrls:c,replayDefinitionUrl:c[0]?.url}}function j(e){return t(`${r.bundle}/${e}`)}const M={[g.RATING]:`Rate this section`,[g.SENTIMENT]:`Was this section helpful?`,[g.MOOD]:`Was this section helpful?`,[g.COMMENT]:`Share your feedback about this section`,[g.SCALE]:`How would you rate this section?`};function N(e,t,r){let i=[n(t)?t[`x-feedback`]:void 0,e.feedback,r].find(n);if(i===void 0)return e;let a=n(i.settings)?i.settings:{},o=typeof i.type==`string`?M[i.type]:void 0,s=a.label||o||``;return{...e,feedback:{...i,settings:{...a,label:s}}}}export{y as readApiOptionsFromConfig,S as resolveApiBundleConfig,b as resolveApiOptions,C as resolveNestedFeedback,j as schemaCatalogLink,A as withDownloadUrls,N as withFeedbackOption,k as withMockServerOption};
@@ -4,7 +4,7 @@ export declare const API_DOCS_SEARCH_GROUP = "API Reference";
4
4
  export type ApiDocsSearchDocumentOptions = {
5
5
  /** The category of every document; `API Reference` by default. */
6
6
  groupKey?: string;
7
- /** Facet values every document carries. */
7
+ /** Facet values every document carries; an HTTP operation also carries its method and path. */
8
8
  facets?: SearchDocumentFacets;
9
9
  /** Receives the warnings of the `x-rbac` annotation; the render loader reported the same ones. */
10
10
  warn?: (message: string) => void;
@@ -1 +1 @@
1
- import{isRbacScope as e}from"../../../../../server/rbac/engine.js";import{annotateApiDocsRbac as t}from"../../../../../server/rbac/api-docs.js";import{withImpliedDiscriminatorMappings as n}from"./implied-discriminators.js";import{createHash as r}from"node:crypto";import{REDOCLY_TEAMS_RBAC as i}from"@redocly/config";import{ApiDocsSearchIndexer as a}from"@redocly/api-docs/lib/services/search/indexer/index.js";const o=`API Reference`;function s(e,r,i={}){let o=f(e.store)?e.store:{},s=t(r,e.specType,{warn:i.warn??(()=>{})}),d=n(s),p=new a(e.basePath,o.schemaStore,f(d)?d:void 0,{exampleStore:o.exampleStore}),m=e=>{for(let t of e)p.addItem(t),f(t)&&Array.isArray(t.items)&&m(t.items)};m(e.items);let h=[],g=/* @__PURE__ */ new Set,_=[];return{docs:p.getResult().map(e=>{for(let t of e.parameters??[]){let n=l(t),r=n.fragmentKey;g.has(r)||(g.add(r),h.push(n));let i={docKey:e.id,fragmentKey:r,place:t.place,anchor:u(t.deepLink)};t.path&&t.path.length>0&&(i.path=t.path),_.push(i)}return c(e,i)}),fragments:h,uses:_}}function c(t,n){let r={docKey:t.id,routeSlug:t.url,title:d(t.title),text:d(t.text),groupKey:n.groupKey??`API Reference`,facets:n.facets},a=t[i];return e(a)&&(r.rbacScope=a),t.httpMethod&&(r.httpMethod=t.httpMethod),t.httpPath&&(r.httpPath=d(t.httpPath)),t.deprecated&&(r.deprecated=!0),t.isAdditionalOperation&&(r.isAdditionalOperation=!0),t.badges&&t.badges.length>0&&(r.badges=t.badges),r}function l(e){let t={name:d(e.name),description:d(e.description)};return e.example&&(t.example=e.example),e.enum&&e.enum.length>0&&(t.enum=e.enum),{fragmentKey:r(`sha1`).update(JSON.stringify([t.name,t.description,t.example??null,t.enum??null])).digest(`hex`),...t}}function u(e){if(!e)return``;let t=e.indexOf(`#`);return t>=0?e.slice(t+1):e}function d(e){return Array.isArray(e)?e.join(` `):e}function f(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}export{o as API_DOCS_SEARCH_GROUP,s as buildApiDocsSearchDocuments};
1
+ import{SEARCH_HTTP_METHOD_FACET_FIELD as e,SEARCH_HTTP_PATH_FACET_FIELD as t}from"../../../../../shared/search/facets.js";import{isRbacScope as n}from"../../../../../shared/rbac/engine.js";import{markdocAstToText as r}from"../../../../markdown/search/to-text.js";import{parseMarkdownCached as i}from"../../../../markdown/utils/parse-cache.js";import{annotateApiDocsRbac as a}from"../../../../../shared/rbac/api-docs.js";import{withImpliedDiscriminatorMappings as o}from"./implied-discriminators.js";import{createHash as s}from"node:crypto";import{REDOCLY_TEAMS_RBAC as c}from"@redocly/config";import{ApiDocsSearchIndexer as l,extractFullText as u,isOperationName as d}from"@redocly/api-docs/server";const f=`API Reference`;function p(e,t,n={}){let r=b(e.store)?e.store:{},i=a(t,e.specType,{warn:n.warn??(()=>{})}),s=o(i),c=new l(e.basePath,r.schemaStore,b(s)?s:void 0,{exampleStore:r.exampleStore,graphqlMeta:r.graphqlMeta,formatDescription:m}),u=e=>{for(let t of e)c.addItem(t),b(t)&&Array.isArray(t.items)&&u(t.items)};u(e.items);let d=[],f=/* @__PURE__ */ new Set,p=[],y=h(t),x=/* @__PURE__ */ new Map;return{docs:c.getResult().map(t=>{let r=(x.get(t.id)??0)+1;x.set(t.id,r);let i=r===1?t.id:`${t.id}#${r}`;for(let e of t.parameters??[]){let t=_(e),n=t.fragmentKey;f.has(n)||(f.add(n),d.push(t));let r={docKey:i,fragmentKey:n,place:e.place,anchor:v(e.deepLink)};e.path&&e.path.length>0&&(r.path=e.path),p.push(r)}let a=g(t,i,n);return y&&t.url===e.basePath&&(a.title=y),a}),fragments:d,uses:p}}const m=e=>typeof e==`string`&&e.includes(`{%`)?r(i(e)).replace(/\s+/g,` `):u(e);function h(e){let t=b(e)&&b(e.info)?e.info:{};if(typeof t.title!=`string`||t.title===``)return;let n=t.version;return typeof n==`string`&&n!==``||typeof n==`number`?`${t.title} (${n})`:t.title}function g(r,i,a){let o=r.httpPath?y(r.httpPath):void 0,s={...a.facets},l=r.isAdditionalOperation?r.httpMethod:r.httpMethod&&d(r.httpMethod)?r.httpMethod.toLowerCase():void 0;l&&(s[e]=l,o&&(s[t]=o));let u={docKey:i,routeSlug:r.url,title:y(r.title),text:y(r.text),groupKey:a.groupKey??`API Reference`,facets:s},f=r[c];return n(f)&&(u.rbacScope=f),r.httpMethod&&(u.httpMethod=r.httpMethod),o&&(u.httpPath=o),r.deprecated&&(u.deprecated=!0),r.isAdditionalOperation&&(u.isAdditionalOperation=!0),r.badges&&r.badges.length>0&&(u.badges=r.badges),u}function _(e){let t={name:y(e.name),description:y(e.description)};return e.example&&(t.example=e.example),e.enum&&e.enum.length>0&&(t.enum=e.enum),{fragmentKey:s(`sha1`).update(JSON.stringify([t.name,t.description,t.example??null,t.enum??null])).digest(`hex`),...t}}function v(e){if(!e)return``;let t=e.indexOf(`#`);return t>=0?e.slice(t+1):e}function y(e){return Array.isArray(e)?e.join(` `):e}function b(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}export{f as API_DOCS_SEARCH_GROUP,p as buildApiDocsSearchDocuments};
@@ -1 +1 @@
1
- import{filePathToRouteSlug as e}from"../../../../../shared/utils/routes/file-path-to-route-slug.js";import"../../../types/api-entity.js";import{createApiEntityKey as t}from"../../../utils/api-entity-key.js";import{filterApiDocsByRbac as n}from"../../../../../server/rbac/api-docs.js";import{EntityAccessDeniedError as r,notFoundResponse as i}from"../../../../../server/plugin-context.js";import{attachmentDisposition as a}from"../../../../../shared/utils/attachment-disposition.js";import{posix as o}from"node:path";import s from"js-yaml";const c={"Cache-Control":`no-store`};function l(e){return e.replace(/\.[^./]+$/u,``)}async function u(e,t,n){let r=l(t);return(await e.entities.list({type:`api`})).find(({metadata:e})=>{let{sourcePath:t,specType:i}=e??{};return typeof t==`string`&&l(t)===r&&i===`graphql`===n})??null}async function d(n,a){let o=e(a);return await n.hasRoute(o)&&!n.isSlugVisible(o)?new r(t(a),n.request.teams).getResponse():i()}function f(e,t,n,r,i){let o=new URL(t.request.url).searchParams.has(`download`);return e.body(n,200,{...c,"Content-Type":r,...o?{"Content-Disposition":a(i)}:{}})}async function p(e,t){let r=e.req.param(`api`)??``,i=await u(t,r,!1);if(!i)return d(t,r);let a=n(await t.entities.load(i.key),i.metadata?.specType,t.request.teams,{warn:e=>t.logger?.warn(e)}),c=/\.ya?ml$/u.test(r),p=l(o.basename(String(i.metadata?.sourcePath)))+(c?`.yaml`:`.json`);return c?f(e,t,s.dump(a),`application/yaml`,p):f(e,t,JSON.stringify(a,null,2),`application/json`,p)}async function m(e,t){let n=e.req.param(`api`)??``,r=await u(t,n,!0);if(!r)return d(t,n);let i=await t.entities.load(r.key),a=String(r.metadata?.sourcePath);return f(e,t,i,`application/graphql`,o.basename(a))}export{p as bundle,m as graphql};
1
+ import{EntityAccessDeniedError as e,notFoundResponse as t}from"../../../../../server/plugin-context.js";import{attachmentDisposition as n}from"../../../../../shared/utils/attachment-disposition.js";import{filePathToRouteSlug as r}from"../../../../../shared/utils/routes/file-path-to-route-slug.js";import"../../../../../shared/constants/api-spec-kinds.js";import{createApiEntityKey as i}from"../../../utils/api-entity-key.js";import{filterApiDocsByRbac as a}from"../../../../../shared/rbac/api-docs.js";import{SPEC_DOWNLOAD_HANDLER_ID as o,withMockServerEvent as s}from"../../../../../server/telemetry/mock-server-events.js";import{posix as c}from"node:path";import l from"js-yaml";const u={"Cache-Control":`no-store`};function d(e){return e.replace(/\.[^./]+$/u,``)}async function f(e,t,n){let r=d(t);return(await e.entities.list({type:`api`})).find(({metadata:e})=>{let{sourcePath:t,specType:i}=e??{};return typeof t==`string`&&d(t)===r&&i!==`grpc`&&i===`graphql`===n})??null}async function p(n,a){let o=r(a);return await n.hasRoute(o)&&!n.isSlugVisible(o)?new e(i(a),n.request.teams).getResponse():t()}function m(e,t,r,i,a){let o=new URL(t.request.url).searchParams.has(`download`);return e.body(r,200,{...u,"Content-Type":i,...o?{"Content-Disposition":n(a)}:{}})}function h(e,t,n){return s({handler:o,request:e.req.raw,logger:t.logger},n)}function g(e,t){return h(e,t,()=>v(e,t))}function _(e,t){return h(e,t,()=>y(e,t))}async function v(e,t){let n=e.req.param(`api`)??``,r=await f(t,n,!1);if(!r)return p(t,n);let i=a(await t.entities.load(r.key),r.metadata?.specType,t.request.teams,{warn:e=>t.logger?.warn(e)}),o=/\.ya?ml$/u.test(n),s=d(c.basename(String(r.metadata?.sourcePath)))+(o?`.yaml`:`.json`);return o?m(e,t,l.dump(i,{noRefs:!0}),`application/yaml`,s):m(e,t,JSON.stringify(i,null,2),`application/json`,s)}async function y(e,t){let n=e.req.param(`api`)??``,r=await f(t,n,!0);if(!r)return p(t,n);let i=await t.entities.load(r.key),a=String(r.metadata?.sourcePath);return m(e,t,i,`application/graphql`,c.basename(a))}export{g as bundle,_ as graphql};
@@ -1 +1 @@
1
- import{defineContentPlugin as e}from"../../define.js";import{createInlineEntity as t}from"../../../loaders/define.js";import{notInPlanProblem as n}from"../../../plan-gates.js";import{isPlanFeatureGranted as r}from"../../../../shared/plan-gates.js";import{API_FUNCTION_ENTITY_TYPE as i,apiFunctionEntityKey as a}from"./constants.js";import{parseApiFunctionRoute as o}from"./route-path.js";const s=`internal.api-functions`,c=/\.(ts|js)$/u,l=e({id:s,version:`1.1.0`,content:{filter:{match:e=>c.test(e)},extractFile(e,s){let c=o(e.path,s.config.apiFunctions?.folders??[]);if(!c)return null;if(!r(s.config,`apiFunctions`))return{routes:[],problems:[n(`API functions`)]};let l={...c,sourcePath:e.path};return{routes:[],entities:[t(l,{stableKey:a(e.path),type:i,metadata:l})]}}},server:{routes:[{path:`/*`,handler:{filePath:`./server/dispatch.ts`,importer:import.meta.url,exportName:`dispatch`}}]}});export{s as API_FUNCTIONS_PLUGIN_ID,l as apiFunctionsContentPlugin};
1
+ import{defineContentPlugin as e}from"../../define.js";import{createInlineEntity as t}from"../../../loaders/define.js";import{isPlanFeatureGranted as n}from"../../../../shared/plan-gates.js";import{API_FUNCTION_ENTITY_TYPE as r,apiFunctionEntityKey as i}from"./constants.js";import{notInPlanProblem as a}from"../../../plan-gates.js";import{parseApiFunctionRoute as o}from"./route-path.js";const s=`internal.api-functions`,c=/\.(ts|js)$/u,l=e({id:s,version:`1.1.0`,content:{filter:{match:e=>c.test(e)},extractFile(e,s){let c=o(e.path,s.config.apiFunctions?.folders??[]);if(!c)return null;if(!n(s.config,`apiFunctions`))return{routes:[],problems:[a(`API functions`)]};let l={...c,sourcePath:e.path};return{routes:[],entities:[t(l,{stableKey:i(e.path),type:r,metadata:l})]}}},server:{routes:[{path:`/*`,handler:{filePath:`./server/dispatch.ts`,importer:import.meta.url,exportName:`dispatch`}}]}});export{s as API_FUNCTIONS_PLUGIN_ID,l as apiFunctionsContentPlugin};
@@ -1 +1 @@
1
- import{canView as e,compileRouteAccessMatcher as t,matchContentRule as n,resolveRbacDenialStatus as r,resolveRole as i}from"../../../../../server/rbac/engine.js";const a=/* @__PURE__ */ new WeakMap;function o(e){let n=a.get(e);return n===void 0&&(n=t(e),a.set(e,n)),n}function s(t,a){let o=n(t,{filePath:a.sourcePath,slug:a.pathname})?.scope;return e(i(o,a.teams))?{allow:!0}:{allow:!1,status:r(a.teams)}}export{s as resolveApiFunctionAccess,o as resolveRbacMatcher};
1
+ import{canView as e,compileRouteAccessMatcher as t,matchContentScope as n,resolveRbacDenialStatus as r,resolveRole as i}from"../../../../../shared/rbac/engine.js";const a=/* @__PURE__ */ new WeakMap;function o(e){let n=a.get(e);return n===void 0&&(n=t(e),a.set(e,n)),n}function s(t,a){let o=n(t,{filePath:a.sourcePath,slug:a.pathname});return e(i(o,a.teams))?{allow:!0}:{allow:!1,status:r(a.teams)}}export{s as resolveApiFunctionAccess,o as resolveRbacMatcher};
@@ -0,0 +1 @@
1
+ import{sendServerEvent as e}from"../../../../../server/telemetry/sender.js";function t({sourcePath:t,status:n,failure:r},i){let a=r!==void 0,o={id:`apiFunctionId`,object:`apiFunction`,uri:`urn:redocly:realm:api:apiFunction:apiFunctionId`,handler:`api-functions:${t}`,status:n,message:a?r:null};return e({type:a?`com.redocly.apiFunction.error`:`com.redocly.apiFunction.called`,data:[o]},i)}export{t as sendApiFunctionEvent};
@@ -1 +1 @@
1
- import{stripPathPrefix as e}from"../../../../../shared/path-prefix.js";import{API_FUNCTION_ENTITY_TYPE as t}from"../constants.js";import{compareApiFunctionRoutes as n}from"../route-path.js";import{SUBPROCESS_DEFAULT_TIMEOUT_MS as r,isSubprocessError as i}from"../../../../../server/subprocess/runner.js";import{resolveApiFunctionAccess as a,resolveRbacMatcher as o}from"./access.js";import{BodyTooLargeError as s,MAX_REQUEST_BODY_BYTES as c,MAX_RESPONSE_BODY_BYTES as l,deserializeResponse as u,serializeRequest as d}from"./serialize.js";import{invoke as f}from"./invoke.js";import{fileURLToPath as p}from"node:url";import{getCookie as m}from"hono/cookie";import{TrieRouter as h}from"hono/router/trie-router";import{getPath as g,tryDecodeURIComponent as _}from"hono/utils/url";const v=1048576,y=p(import.meta.url);function b(e){let{method:t,honoPath:n,sourcePath:r}=e.metadata??{};return typeof t==`string`&&typeof n==`string`&&typeof r==`string`?{method:t,honoPath:n,sourcePath:r}:null}const x=/* @__PURE__ */ new WeakMap;function S(e){let t=x.get(e);if(!t){t=new h;let r=e.map(b).filter(e=>e!==null);for(let e of r.sort(n))t.add(e.method,e.honoPath,e);x.set(e,t)}return t}function C(e,t,n){let r=S(e),i=t.toUpperCase(),[[a]]=r.match(i===`HEAD`?`GET`:i,n);if(!a)return null;let[o,s]=a,c=Object.fromEntries(Object.entries(s).map(([e,t])=>{let n=_(t);return[e,o.honoPath.includes(`:${e}{.+}`)?n.split(`/`).filter(Boolean):n]}));return{sourcePath:o.sourcePath,params:c}}function w(e){let t={};for(let n of new Set(e.searchParams.keys())){let r=e.searchParams.getAll(n);t[n]=r.length===1?r[0]:r}return t}const T=1048576,E=`Request body size exceeded limit of ${c/T} MB.`,D=`Response size exceeded limit of ${l/T}MB`;function O(e,t){return Response.json({message:t},{status:e,headers:{"Cache-Control":`no-store`}})}function k(e,t){switch(e){case`timeout`:return O(504,`Timeout exceeded`);case`input-too-large`:return O(413,E);case`output-too-large`:case`response-too-large`:return O(500,D);default:return O(500,import.meta.env.DEV?t:`Internal server error`)}}async function A(n,f,p){let h=e(g(n.req.raw));if(h===null)return f();let _=new URL(p.request.url),b=C(await p.entities.list({type:t}),p.request.method,h);if(!b)return f();n.set(`realmApiFunctionResponder`,`runtime`);let x=o(p.config);if(x){let e=a(x,{sourcePath:b.sourcePath,pathname:h,teams:p.request.teams});if(!e.allow)return O(e.status,e.status===401?`Unauthorized`:`Forbidden`)}let{subprocess:S}=p;if(!S)return O(501,`API functions do not run on this host.`);let T;try{T={modulePath:S.resolveContentModule(b.sourcePath),request:await d(n.req.raw,c),params:b.params,query:w(_),cookies:m(n),user:{teams:p.request.teams,claims:{...p.request.viewer},email:p.request.viewer?.email,idpAccessToken:void 0,idpId:void 0,isAuthenticated:p.request.viewer?.isAuthenticated??!1},config:p.config,baseUrl:_.origin}}catch(e){if(e instanceof s)return k(`input-too-large`,e.message);throw e}let E;try{E=await S.run({modulePath:y,exportName:`invoke`,input:T,reuse:!import.meta.env.DEV,timeoutMs:r,maxInputBytes:Math.ceil(4/3*c)+v,maxOutputBytes:Math.ceil(4/3*l)+v})}catch(e){if(!i(e))throw e;return e.code===`output-too-large`&&n.set(`realmApiFunctionResponder`,`project`),p.logger?.error(`API function ${b.sourcePath} failed (${e.code}): ${e.message}`),k(e.code,e.message)}if(n.set(`realmApiFunctionResponder`,`project`),!E.ok)return p.logger?.error(`API function ${b.sourcePath} failed (${E.code}): ${E.stack??E.message}`),k(E.code,E.message);let D=u(E.response);return D.headers.has(`cache-control`)||D.headers.set(`Cache-Control`,`no-store`),D}export{A as dispatch,f as invoke,C as matchApiFunction};
1
+ import{stripPathPrefix as e}from"../../../../../shared/path-prefix.js";import{API_FUNCTION_ENTITY_TYPE as t}from"../constants.js";import{errorMessage as n}from"../../../../../shared/utils/error-message.js";import{isSubprocessError as r}from"../../../../../server/subprocess/runner.js";import{compareApiFunctionRoutes as i}from"../route-path.js";import{resolveApiFunctionAccess as a,resolveRbacMatcher as o}from"./access.js";import{sendApiFunctionEvent as s}from"./api-function-telemetry.js";import{BodyTooLargeError as c,MAX_REQUEST_BODY_BYTES as l,MAX_RESPONSE_BODY_BYTES as u,deserializeResponse as d,serializeRequest as f}from"./serialize.js";import{invoke as p}from"./invoke.js";import{fileURLToPath as m}from"node:url";import{getCookie as h}from"hono/cookie";import{TrieRouter as g}from"hono/router/trie-router";import{getPath as _,tryDecodeURIComponent as v}from"hono/utils/url";const y=1048576,b=m(import.meta.url);function x(e){let{method:t,honoPath:n,sourcePath:r}=e.metadata??{};return typeof t==`string`&&typeof n==`string`&&typeof r==`string`?{method:t,honoPath:n,sourcePath:r}:null}const S=/* @__PURE__ */ new WeakMap;function C(e){let t=S.get(e);if(!t){t=new g;let n=e.map(x).filter(e=>e!==null);for(let e of n.sort(i))t.add(e.method,e.honoPath,e);S.set(e,t)}return t}function w(e,t,n){let r=C(e),i=t.toUpperCase(),[[a]]=r.match(i===`HEAD`?`GET`:i,n);if(!a)return null;let[o,s]=a,c=Object.fromEntries(Object.entries(s).map(([e,t])=>{let n=v(t);return[e,o.honoPath.includes(`:${e}{.+}`)?n.split(`/`).filter(Boolean):n]}));return{sourcePath:o.sourcePath,params:c}}function T(e){let t={};for(let n of new Set(e.searchParams.keys())){let r=e.searchParams.getAll(n);t[n]=r.length===1?r[0]:r}return t}const E=1048576,D=`Request body size exceeded limit of ${l/E} MB.`,O=`Response size exceeded limit of ${u/E}MB`,k=1e4,A=`Promise timed out after ${k} ms`;function j(e,t){return Response.json({message:t},{status:e,headers:{"Cache-Control":`no-store`}})}function M(e,t){switch(e){case`timeout`:return N(504,`Timeout exceeded`,A);case`input-too-large`:return N(413,D);case`output-too-large`:case`response-too-large`:return N(500,O);default:return N(500,import.meta.env.DEV?t:`Internal server error`,t)}}function N(e,t,n=t){return{response:j(e,t),failure:n}}async function P(r,i,c){let l=e(_(r.req.raw));if(l===null)return i();let u=new URL(c.request.url),d=w(await c.entities.list({type:t}),c.request.method,l);if(!d)return i();r.set(`realmApiFunctionResponder`,`runtime`);let f=o(c.config);if(f){let e=a(f,{sourcePath:d.sourcePath,pathname:l,teams:c.request.teams});if(!e.allow)return j(e.status,e.status===401?`Unauthorized`:`Forbidden`)}let{subprocess:p}=c;if(!p)return j(501,`API functions do not run on this host.`);let m=(e,t)=>s({sourcePath:d.sourcePath,status:e,failure:t},{logger:c.logger}),h;try{h=await F(r,c,p,d,u)}catch(e){throw m(500,n(e)),e}return m(h.response.status,h.failure),h.response}async function F(e,t,n,i,a){let o;try{o={modulePath:n.resolveContentModule(i.sourcePath),request:await f(e.req.raw,l),params:i.params,query:T(a),cookies:h(e),user:{teams:t.request.teams,claims:{...t.request.viewer},email:t.request.viewer?.email,idpAccessToken:void 0,idpId:void 0,isAuthenticated:t.request.viewer?.isAuthenticated??!1},config:t.config,baseUrl:a.origin}}catch(e){if(e instanceof c)return M(`input-too-large`,e.message);throw e}let s;try{s=await n.run({modulePath:b,exportName:`invoke`,input:o,reuse:!import.meta.env.DEV,timeoutMs:k,maxInputBytes:Math.ceil(4/3*l)+y,maxOutputBytes:Math.ceil(4/3*u)+y})}catch(n){if(!r(n))throw n;return n.code===`output-too-large`&&e.set(`realmApiFunctionResponder`,`project`),t.logger?.error(`API function ${i.sourcePath} failed (${n.code}): ${n.message}`),M(n.code,n.message)}if(e.set(`realmApiFunctionResponder`,`project`),!s.ok)return t.logger?.error(`API function ${i.sourcePath} failed (${s.code}): ${s.stack??s.message}`),M(s.code,s.message);let p=d(s.response);return p.headers.has(`cache-control`)||p.headers.set(`Cache-Control`,`no-store`),{response:p}}export{P as dispatch,p as invoke,w as matchApiFunction};
@@ -1 +1 @@
1
- import{toJsonValue as e}from"../../../database/utils/json.js";import{isRbacScope as t}from"../../../../server/rbac/engine.js";import{hashBlobContent as n}from"../../../materialization/data-ref.js";import{builtInMarkdocTags as r}from"../../../markdown/constants/builtin-tags.js";import{resolveMarkdownAst as i}from"../../../markdown/resolve/ast.js";import{REDOCLY_TEAMS_RBAC as a}from"@redocly/config";async function o(o,s){if(!o||o.length===0)return null;let c=[],l=[],u=[];for(let[d,f]of o.entries()){if(!f.content){s.logger?.warn(`${s.file.path}: banner[${d}] has no content — the item is not shown`);continue}let{content:o,rbac:p,...m}=f,{ast:h,entityDeps:g,assetUsages:_}=await i(f.content,s.file.path,{resolverContext:s,tags:r}),v=p===void 0?{}:{[a]:t(p)?p:(s.logger?.warn(`${s.file.path}: banner[${d}] has an invalid "rbac" value — the item is hidden from everyone`),{})};c.push(e({...m,...v,ast:h,hash:n(f.content)})),l.push(...g),u.push(..._)}return c.length>0?{banner:c,deps:l,assetUsages:u}:null}export{o as resolveBannerForAppData};
1
+ import{toJsonValue as e}from"../../../database/utils/json.js";import{builtInMarkdocTags as t}from"../../../markdown/constants/builtin-tags.js";import{isRbacScope as n}from"../../../../shared/rbac/engine.js";import{hashBlobContent as r}from"../../../materialization/data-ref.js";import{resolveMarkdownAst as i}from"../../../markdown/resolve/ast.js";import{REDOCLY_TEAMS_RBAC as a}from"@redocly/config";async function o(o,s){if(!o||o.length===0)return null;let c=[],l=[],u=[];for(let[d,f]of o.entries()){if(!f.content){s.logger?.warn(`${s.file.path}: banner[${d}] has no content — the item is not shown`);continue}let{content:o,rbac:p,...m}=f,{ast:h,entityDeps:g,assetUsages:_}=await i(f.content,s.file.path,{resolverContext:s,tags:t}),v=p===void 0?{}:{[a]:n(p)?p:(s.logger?.warn(`${s.file.path}: banner[${d}] has an invalid "rbac" value — the item is hidden from everyone`),{})};c.push(e({...m,...v,ast:h,hash:r(f.content)})),l.push(...g),u.push(..._)}return c.length>0?{banner:c,deps:l,assetUsages:u}:null}export{o as resolveBannerForAppData};
@@ -5,7 +5,7 @@ import type { SystemEntityDescriptor } from '../../../database/finalize';
5
5
  import type { RouteAccess } from '../../utils/route-index.js';
6
6
  export { APP_DATA_STATIC_DATA_SLUG } from '../../../../shared/constants/app-data';
7
7
  export declare const APP_DATA_PLUGIN_ID = "internal.app-data";
8
- export declare const APP_DATA_PLUGIN_VERSION = "1.32.0";
8
+ export declare const APP_DATA_PLUGIN_VERSION = "1.35.0";
9
9
  export declare const APP_DATA_STATIC_DATA_LOADER_ID: "internal.app-data:app-data";
10
10
  export type AppDataFragment = {
11
11
  owner: string;