@redocly/realm 0.130.0-custom.2 → 0.130.0-custom.21

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 (428) hide show
  1. package/CHANGELOG.md +116 -0
  2. package/dist/bin.js +1 -1
  3. package/dist/cli/develop.js +1 -1
  4. package/dist/cli/eject/resolveTheme.d.ts +1 -1
  5. package/dist/cli/eject/resolveTheme.js +1 -1
  6. package/dist/cli/prepare/copy-env-files.js +1 -1
  7. package/dist/cli/prepare/index.js +1 -1
  8. package/dist/cli/stats/collectors/openapi.js +1 -1
  9. package/dist/cli/telemetry/index.js +1 -1
  10. package/dist/client/App.js +1 -1
  11. package/dist/client/ErrorBoundary.js +1 -1
  12. package/dist/client/app/DevModeFloatingBar/index.d.ts +3 -0
  13. package/dist/client/app/DevModeFloatingBar/index.js +43 -0
  14. package/dist/client/app/Feedback/useSubmitFeedback.js +1 -1
  15. package/dist/client/app/Sidebar/InstancePicker.d.ts +10 -0
  16. package/dist/client/app/Sidebar/InstancePicker.js +48 -0
  17. package/dist/client/app/Sidebar/Sidebar.js +11 -3
  18. package/dist/client/app/Sidebar/useBreadcrumbs.js +1 -1
  19. package/dist/client/app/Sidebar/useSidebarItems.js +1 -1
  20. package/dist/client/app/hooks/catalog/useCatalogClassic.js +1 -1
  21. package/dist/client/app/hooks/useAutoScroll.js +1 -1
  22. package/dist/client/app/hooks/useRouteChangeTracker.js +1 -1
  23. package/dist/client/app/hooks/utils/pathname-matches-active-section.d.ts +6 -0
  24. package/dist/client/app/hooks/utils/pathname-matches-active-section.js +1 -0
  25. package/dist/client/app/markdoc/custom-components/html-script.js +1 -0
  26. package/dist/client/app/markdoc/custom-components/openapi/openapi-code-sample.js +1 -0
  27. package/dist/client/app/markdoc/custom-components/openapi/openapi-response-sample.js +1 -0
  28. package/dist/client/app/markdoc/custom-components/openapi/replay-openapi.js +1 -0
  29. package/dist/client/app/markdoc/hooks/use-store.js +1 -0
  30. package/dist/client/browser-entry.js +5 -5
  31. package/dist/client/constants/common.d.ts +2 -0
  32. package/dist/client/constants/common.js +1 -0
  33. package/dist/client/providers/hooks.js +1 -1
  34. package/dist/client/runtime/loader.js +1 -1
  35. package/dist/client/runtime/useSocketMessages.js +1 -1
  36. package/dist/{server/plugins/asyncapi-docs/template → client/templates/asyncapi-docs}/helpers.d.ts +3 -3
  37. package/dist/client/templates/asyncapi-docs/helpers.js +1 -0
  38. package/dist/{server/plugins/asyncapi-docs/template/AsyncApiDocs.d.ts → client/templates/asyncapi-docs/template.d.ts} +1 -1
  39. package/dist/{server/plugins/asyncapi-docs/template/AsyncApiDocs.js → client/templates/asyncapi-docs/template.js} +1 -1
  40. package/dist/{server/plugins/openapi-docs/template → client/templates/openapi-docs}/helpers.d.ts +14 -1
  41. package/dist/client/templates/openapi-docs/helpers.js +5 -0
  42. package/dist/{server/plugins/openapi-docs/template/OpenAPIDocs.d.ts → client/templates/openapi-docs/template.d.ts} +1 -1
  43. package/dist/{server/plugins/openapi-docs/template/OpenAPIDocs.js → client/templates/openapi-docs/template.js} +1 -1
  44. package/dist/client/utils/catalog/inject-catalog-items.d.ts +1 -1
  45. package/dist/client/utils/catalog/inject-catalog-items.js +1 -1
  46. package/dist/constants/catalog-entities.d.ts +12 -0
  47. package/dist/constants/catalog-entities.js +1 -0
  48. package/dist/constants/common.d.ts +2 -2
  49. package/dist/constants/common.js +1 -1
  50. package/dist/constants/l10n/langs/ar.js +1 -1
  51. package/dist/constants/l10n/langs/de.js +1 -1
  52. package/dist/constants/l10n/langs/en.js +1 -1
  53. package/dist/constants/l10n/langs/es.js +1 -1
  54. package/dist/constants/l10n/langs/fr.js +1 -1
  55. package/dist/constants/l10n/langs/hi.js +1 -1
  56. package/dist/constants/l10n/langs/it.js +1 -1
  57. package/dist/constants/l10n/langs/ja.js +1 -1
  58. package/dist/constants/l10n/langs/ko.js +1 -1
  59. package/dist/constants/l10n/langs/pl.js +1 -1
  60. package/dist/constants/l10n/langs/pt-BR.js +1 -1
  61. package/dist/constants/l10n/langs/pt.js +1 -1
  62. package/dist/constants/l10n/langs/ru.js +1 -1
  63. package/dist/constants/l10n/langs/uk.js +1 -1
  64. package/dist/constants/l10n/langs/zh.js +1 -1
  65. package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/get-inner-text.d.ts +1 -1
  66. package/dist/markdoc/helpers/get-inner-text.js +2 -0
  67. package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/get-variable.d.ts +2 -2
  68. package/dist/markdoc/helpers/get-variable.js +1 -0
  69. package/dist/markdoc/nodes/fence/index.js +1 -0
  70. package/dist/markdoc/nodes/heading.js +1 -0
  71. package/dist/{server/plugins/markdown/markdoc → markdoc}/tags/index.d.ts +6 -6
  72. package/dist/markdoc/tags/json-example.d.ts +3 -0
  73. package/dist/markdoc/tags/json-schema.d.ts +3 -0
  74. package/dist/markdoc/tags/openapi-code-sample.d.ts +3 -0
  75. package/dist/markdoc/tags/openapi-example.d.ts +3 -0
  76. package/dist/markdoc/tags/openapi-response-sample.d.ts +3 -0
  77. package/dist/markdoc/tags/replay-openapi.d.ts +3 -0
  78. package/dist/markdoc/types.d.ts +8 -0
  79. package/dist/markdoc/types.js +0 -0
  80. package/dist/server/api-routes/import-api-routes-handlers.js +1 -1
  81. package/dist/server/api-routes/run-api-routes-worker.js +1 -1
  82. package/dist/server/config/env-config.js +1 -0
  83. package/dist/{config → server/config}/env-schema.d.ts +6 -3
  84. package/dist/{config → server/config}/env-schemas/database.d.ts +1 -1
  85. package/dist/server/config/env-schemas/database.js +1 -0
  86. package/dist/{config → server/config}/env-schemas/organization-project.d.ts +3 -0
  87. package/dist/{config → server/config}/env-schemas/organization-project.js +1 -1
  88. package/dist/server/constants/common.d.ts +3 -0
  89. package/dist/server/constants/common.js +1 -1
  90. package/dist/server/constants/feedback.d.ts +6 -0
  91. package/dist/server/constants/feedback.js +1 -0
  92. package/dist/server/constants/plugins/catalog-entities.d.ts +0 -11
  93. package/dist/server/constants/plugins/catalog-entities.js +1 -1
  94. package/dist/server/entitlements/entitlements-provider.js +1 -1
  95. package/dist/server/esbuild/esbuild-logger.js +1 -1
  96. package/dist/server/esbuild/esbuild.js +1 -1
  97. package/dist/server/esbuild/plugins/assets-resolver.js +1 -1
  98. package/dist/server/esbuild/plugins/esbuild-compile-resolver.js +1 -1
  99. package/dist/server/esbuild/plugins/styled-components-ssr.js +1 -1
  100. package/dist/server/esbuild/plugins/themes-resolver.js +2 -2
  101. package/dist/server/{config/external-plugins.d.ts → external-plugins/resolve-external-plugins.d.ts} +2 -2
  102. package/dist/server/external-plugins/resolve-external-plugins.js +1 -0
  103. package/dist/server/fs/cache.js +1 -1
  104. package/dist/server/fs/fast-mtime.js +3 -3
  105. package/dist/server/fs/last-modified-tracker.js +1 -1
  106. package/dist/server/fs/utils/is-loader-cache-enabled.js +1 -1
  107. package/dist/server/node-bundle-entry.js +1 -1
  108. package/dist/server/plugins/analytics/adobe/index.js +1 -1
  109. package/dist/server/plugins/analytics/amplitude/index.js +1 -1
  110. package/dist/server/plugins/analytics/fullstory/index.js +1 -1
  111. package/dist/server/plugins/analytics/ga/index.js +1 -1
  112. package/dist/server/plugins/analytics/gtm/browser-hooks.js +1 -1
  113. package/dist/server/plugins/analytics/gtm/index.js +1 -1
  114. package/dist/server/plugins/analytics/heap/index.js +1 -1
  115. package/dist/server/plugins/analytics/rudderstack/index.js +1 -1
  116. package/dist/server/plugins/analytics/segment/index.js +1 -1
  117. package/dist/server/plugins/asyncapi-docs/index.js +1 -1
  118. package/dist/server/plugins/asyncapi-docs/search/get-ai-search-documents.js +27 -27
  119. package/dist/server/plugins/catalog-classic/get-server-props.js +1 -1
  120. package/dist/server/plugins/catalog-entities/database/catalog-entities-service.js +1 -1
  121. package/dist/server/plugins/catalog-entities/database/repositories/local/catalog-entities-local-repository.d.ts +2 -2
  122. package/dist/server/plugins/catalog-entities/database/repositories/local/catalog-entities-local-write-repository.js +1 -1
  123. package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/arazzo-entities-extractor.js +1 -1
  124. package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/asyncapi-entities-extractor.js +1 -1
  125. package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/base.js +1 -1
  126. package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/graphql-entities-extractor.js +1 -1
  127. package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/openapi-entities-extractor.js +1 -1
  128. package/dist/server/plugins/catalog-entities/extensions/extractors/fs-entities-extractor.js +1 -1
  129. package/dist/server/plugins/catalog-entities/plugin.js +1 -1
  130. package/dist/server/plugins/config-parser/loaders/redocly-config-loader.js +1 -1
  131. package/dist/server/plugins/config-parser/loaders/utils/read-and-validate-config.js +1 -1
  132. package/dist/server/plugins/default-theme/index.js +1 -1
  133. package/dist/server/plugins/entitlements/index.js +1 -1
  134. package/dist/server/plugins/graphql-docs/index.js +1 -1
  135. package/dist/server/plugins/lifecycle.js +1 -1
  136. package/dist/server/plugins/markdown/attribute-resolvers/code-walkthrough/filesets-resolver.js +1 -1
  137. package/dist/server/plugins/markdown/attribute-resolvers/resolve-code-snippet-from-file.js +1 -1
  138. package/dist/server/plugins/markdown/attribute-resolvers/resolve-html-href.js +1 -1
  139. package/dist/server/plugins/markdown/attribute-resolvers/resolve-html-source-attribute.js +1 -1
  140. package/dist/server/plugins/markdown/attribute-resolvers/resolve-image-src-set.js +1 -1
  141. package/dist/server/plugins/markdown/attribute-resolvers/resolve-image-src.js +1 -1
  142. package/dist/server/plugins/markdown/attribute-resolvers/resolve-json-example-ref.js +1 -1
  143. package/dist/server/plugins/markdown/attribute-resolvers/resolve-json-schema-ref.js +1 -1
  144. package/dist/server/plugins/markdown/attribute-resolvers/resolve-link.js +1 -1
  145. package/dist/server/plugins/markdown/attribute-resolvers/resolve-native-md-link.js +1 -1
  146. package/dist/server/plugins/markdown/attribute-resolvers/resolve-nav-links.js +1 -1
  147. package/dist/server/plugins/markdown/attribute-resolvers/resolve-open-api-ref.js +1 -1
  148. package/dist/server/plugins/markdown/attribute-resolvers/resolve-parsed-yaml.js +1 -1
  149. package/dist/server/plugins/markdown/attribute-resolvers/resolve-raw-content.js +1 -1
  150. package/dist/server/plugins/markdown/attribute-resolvers/resolve-relative-or-cdn-icon.js +1 -1
  151. package/dist/server/plugins/markdown/attribute-resolvers/resolve-relative-path.js +1 -1
  152. package/dist/server/plugins/markdown/attribute-resolvers/resolve-sample-from-json-schema.js +1 -1
  153. package/dist/server/plugins/markdown/attribute-resolvers/resolve-svg-content.js +1 -1
  154. package/dist/server/plugins/markdown/markdoc/import-user-tags.js +1 -1
  155. package/dist/server/plugins/markdown/markdoc/markdoc-options.js +1 -1
  156. package/dist/server/plugins/markdown/markdoc/partials.js +1 -1
  157. package/dist/server/plugins/markdown/markdoc/plugins/headings.js +1 -1
  158. package/dist/server/plugins/markdown/markdoc/plugins/render-mermaid.js +1 -1
  159. package/dist/server/plugins/markdown/markdoc/plugins/utils.js +1 -1
  160. package/dist/server/plugins/markdown/runtime-transform.js +1 -1
  161. package/dist/server/plugins/markdown/search/get-ai-search-documents.js +1 -1
  162. package/dist/server/plugins/markdown/search/get-search-documents.js +2 -2
  163. package/dist/server/plugins/markdown/search/nodes/section-node.js +1 -1
  164. package/dist/server/plugins/markdown/search/search-resolver.js +1 -1
  165. package/dist/server/plugins/markdown/search/to-markdown.js +17 -13
  166. package/dist/server/plugins/markdown/search/walk-sections.js +1 -1
  167. package/dist/server/plugins/markdown/utils/stringify-tag-children-objects.js +1 -1
  168. package/dist/server/plugins/mcp/docs-mcp/tools/docs-mcp-tool.d.ts +5 -1
  169. package/dist/server/plugins/mcp/docs-mcp/tools/docs-mcp-tool.js +1 -1
  170. package/dist/server/plugins/mcp/docs-mcp/tools/index.js +1 -1
  171. package/dist/server/plugins/mcp/docs-mcp/tools/search.d.ts +3 -2
  172. package/dist/server/plugins/mcp/docs-mcp/tools/search.js +6 -1
  173. package/dist/server/plugins/mcp/handlers/docs-mcp-handler.js +1 -1
  174. package/dist/server/plugins/mcp/handlers/handle-mcp-request.js +1 -1
  175. package/dist/server/plugins/mcp/servers/docs-server.d.ts +9 -2
  176. package/dist/server/plugins/mcp/servers/docs-server.js +1 -1
  177. package/dist/server/plugins/mcp/types.d.ts +20 -1
  178. package/dist/server/plugins/openapi-docs/decorators.js +1 -1
  179. package/dist/server/plugins/openapi-docs/get-server-props-custom-fields.js +1 -1
  180. package/dist/server/plugins/openapi-docs/index.js +1 -1
  181. package/dist/server/plugins/openapi-docs/instances.d.ts +33 -0
  182. package/dist/server/plugins/openapi-docs/instances.js +1 -0
  183. package/dist/server/plugins/openapi-docs/search/get-ai-search-documents.js +20 -20
  184. package/dist/server/plugins/openapi-docs/search-indexer.js +1 -1
  185. package/dist/server/plugins/scorecard-classic/compute-scorecard.js +4 -4
  186. package/dist/server/plugins/scorecard-classic/index.js +1 -1
  187. package/dist/server/plugins/scorecard-classic/lint.js +1 -1
  188. package/dist/server/plugins/scorecard-classic/template/Grid/Grid.d.ts +2 -1
  189. package/dist/server/plugins/scorecard-classic/template/Grid/Grid.js +3 -3
  190. package/dist/server/plugins/scorecard-classic/template/Grid/GridHeader.js +15 -9
  191. package/dist/server/plugins/scorecard-classic/template/Grid/GridRow.js +1 -1
  192. package/dist/server/plugins/scorecard-classic/template/index.styles.js +5 -6
  193. package/dist/server/plugins/scorecard-classic/template/views.js +1 -1
  194. package/dist/server/plugins/scorecards/database/scorecards-config-service.js +1 -1
  195. package/dist/server/plugins/scorecards/plugin.js +1 -1
  196. package/dist/server/plugins/scorecards/workers/run-scorecards-worker.js +1 -1
  197. package/dist/server/plugins/search/ai-indexer/prepare-semantic-documents.d.ts +11 -0
  198. package/dist/server/plugins/search/ai-indexer/prepare-semantic-documents.js +1 -0
  199. package/dist/server/plugins/search/documents/search-documents.js +1 -1
  200. package/dist/server/plugins/search/engines/flexsearch/index.js +1 -1
  201. package/dist/server/plugins/search/engines/typesense/index.js +1 -1
  202. package/dist/server/plugins/search/index.js +1 -1
  203. package/dist/server/plugins/search/llmstxt/index.js +1 -1
  204. package/dist/server/plugins/search/utils.d.ts +2 -0
  205. package/dist/server/plugins/search/utils.js +2 -2
  206. package/dist/server/plugins/sidebars/index.js +2 -2
  207. package/dist/server/plugins/sso/index.js +1 -1
  208. package/dist/server/providers/database/base-repository.js +1 -1
  209. package/dist/server/providers/database/database-connection-factory.js +1 -1
  210. package/dist/server/providers/database/database-preconnect-service.js +1 -1
  211. package/dist/server/providers/database/databases/sqld-sqlite/drizzle.config.js +1 -1
  212. package/dist/server/ssr/render.js +1 -1
  213. package/dist/server/ssr/server-side-props/get-server-props-from-user-handler.js +1 -1
  214. package/dist/server/ssr/utils.js +1 -1
  215. package/dist/server/store.d.ts +3 -1
  216. package/dist/server/store.js +1 -1
  217. package/dist/server/telemetry/index.js +1 -1
  218. package/dist/server/tools/notifiers/formatter.js +1 -1
  219. package/dist/server/tools/notifiers/helpers/colors.js +1 -1
  220. package/dist/server/tools/notifiers/logger.js +1 -1
  221. package/dist/server/tools/notifiers/reporter.js +1 -1
  222. package/dist/server/tools/notifiers/terminal-manager.js +1 -1
  223. package/dist/server/types/plugins/common.d.ts +1 -0
  224. package/dist/server/types/plugins/markdown.d.ts +0 -7
  225. package/dist/server/utils/ai-agent-detection.d.ts +16 -0
  226. package/dist/server/utils/ai-agent-detection.js +1 -0
  227. package/dist/server/utils/envs/load-env-variables.js +1 -1
  228. package/dist/server/utils/fs.js +1 -1
  229. package/dist/server/utils/index.d.ts +2 -2
  230. package/dist/server/utils/index.js +1 -1
  231. package/dist/server/utils/is-catalog-entities-enabled.js +1 -1
  232. package/dist/server/utils/is-scorecards-enabled.js +1 -1
  233. package/dist/server/utils/report-all-errors.js +1 -1
  234. package/dist/server/version.js +1 -1
  235. package/dist/server/web-server/auth.d.ts +2 -0
  236. package/dist/server/web-server/auth.js +4 -4
  237. package/dist/server/web-server/handle-api-route-request.js +1 -1
  238. package/dist/server/web-server/http.js +2 -2
  239. package/dist/server/web-server/middleware/apiKeyMiddleware.js +1 -1
  240. package/dist/server/web-server/middleware/catalogAuthMiddleware.js +1 -1
  241. package/dist/server/web-server/middleware/corsMiddleware.js +1 -1
  242. package/dist/server/web-server/middleware/dynamic-middleware/dynamic-middleware.js +1 -1
  243. package/dist/server/web-server/middleware/idleTimeoutMiddleware.js +1 -1
  244. package/dist/server/web-server/middleware/responseHeadersMiddleware.js +1 -1
  245. package/dist/server/web-server/mime-types.js +1 -1
  246. package/dist/server/web-server/routes/auth.js +1 -1
  247. package/dist/server/web-server/routes/cors-proxy.d.ts +5 -0
  248. package/dist/server/web-server/routes/cors-proxy.js +2 -0
  249. package/dist/server/web-server/routes/dynamic-route.js +1 -1
  250. package/dist/server/web-server/routes/error.js +1 -1
  251. package/dist/server/web-server/routes/feedback.js +1 -1
  252. package/dist/server/web-server/routes/helpers/get-md-asset-pathname.d.ts +2 -0
  253. package/dist/server/web-server/routes/helpers/get-md-asset-pathname.js +1 -0
  254. package/dist/server/web-server/routes/index.js +1 -1
  255. package/dist/server/web-server/routes/info.js +1 -1
  256. package/dist/server/web-server/routes/mcp-oauth.js +1 -1
  257. package/dist/server/web-server/routes/otel/otel.js +1 -1
  258. package/dist/server/web-server/routes/page-data.js +1 -1
  259. package/dist/server/web-server/routes/path-prefix-redirect.js +1 -1
  260. package/dist/server/web-server/routes/resolve-route.js +1 -1
  261. package/dist/server/web-server/routes/semantic-search.d.ts +4 -0
  262. package/dist/server/web-server/routes/semantic-search.js +1 -0
  263. package/dist/server/workers/worker-pool.js +1 -1
  264. package/dist/{server/utils → utils}/slugger.d.ts +13 -0
  265. package/package.json +11 -11
  266. package/dist/client/app/ErrorBubble/index.d.ts +0 -3
  267. package/dist/client/app/ErrorBubble/index.js +0 -59
  268. package/dist/client/app/PageCounter/index.d.ts +0 -3
  269. package/dist/client/app/PageCounter/index.js +0 -64
  270. package/dist/config/env-config.js +0 -1
  271. package/dist/config/env-schemas/database.js +0 -1
  272. package/dist/server/config/external-plugins.js +0 -1
  273. package/dist/server/plugins/asyncapi-docs/template/helpers.js +0 -1
  274. package/dist/server/plugins/markdown/markdoc/custom-components/html-script.js +0 -1
  275. package/dist/server/plugins/markdown/markdoc/custom-components/openapi/openapi-code-sample.js +0 -1
  276. package/dist/server/plugins/markdown/markdoc/custom-components/openapi/openapi-response-sample.js +0 -1
  277. package/dist/server/plugins/markdown/markdoc/custom-components/openapi/replay-openapi.js +0 -1
  278. package/dist/server/plugins/markdown/markdoc/helpers/get-inner-text.js +0 -2
  279. package/dist/server/plugins/markdown/markdoc/helpers/get-variable.js +0 -1
  280. package/dist/server/plugins/markdown/markdoc/hooks/use-store.js +0 -1
  281. package/dist/server/plugins/markdown/markdoc/nodes/fence/index.js +0 -1
  282. package/dist/server/plugins/markdown/markdoc/nodes/heading.js +0 -1
  283. package/dist/server/plugins/markdown/markdoc/tags/json-example.d.ts +0 -3
  284. package/dist/server/plugins/markdown/markdoc/tags/json-schema.d.ts +0 -3
  285. package/dist/server/plugins/markdown/markdoc/tags/openapi-code-sample.d.ts +0 -3
  286. package/dist/server/plugins/markdown/markdoc/tags/openapi-example.d.ts +0 -3
  287. package/dist/server/plugins/markdown/markdoc/tags/openapi-response-sample.d.ts +0 -3
  288. package/dist/server/plugins/markdown/markdoc/tags/replay-openapi.d.ts +0 -3
  289. package/dist/server/plugins/openapi-docs/template/helpers.js +0 -5
  290. package/dist/server/plugins/search/ai-indexer/prepare-ai-search-documents.d.ts +0 -6
  291. package/dist/server/plugins/search/ai-indexer/prepare-ai-search-documents.js +0 -1
  292. /package/dist/client/app/{ErrorBubble → DevModeFloatingBar}/DetailedErrors.d.ts +0 -0
  293. /package/dist/client/app/{ErrorBubble → DevModeFloatingBar}/DetailedErrors.js +0 -0
  294. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/html-script.d.ts +0 -0
  295. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/index.d.ts +0 -0
  296. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/index.js +0 -0
  297. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/explain-step.d.ts +0 -0
  298. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/explain-step.js +0 -0
  299. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/get-operation-info-by-id.d.ts +0 -0
  300. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/get-operation-info-by-id.js +0 -0
  301. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/get-operation-info-by-pointer.d.ts +0 -0
  302. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/get-operation-info-by-pointer.js +0 -0
  303. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/get-operation.d.ts +0 -0
  304. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/get-operation.js +0 -0
  305. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/index.d.ts +0 -0
  306. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/index.js +0 -0
  307. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/types/index.d.ts +0 -0
  308. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/types/index.js +0 -0
  309. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/types/operation-identifier.d.ts +0 -0
  310. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/types/operation-identifier.js +0 -0
  311. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/types/operation-info.d.ts +0 -0
  312. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/types/operation-info.js +0 -0
  313. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/types/operation-parameters.d.ts +0 -0
  314. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/get-operation/types/operation-parameters.js +0 -0
  315. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/index.d.ts +0 -0
  316. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/index.js +0 -0
  317. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/json-example.d.ts +0 -0
  318. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/json-example.js +0 -0
  319. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/json-schema.d.ts +0 -0
  320. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/json-schema.js +0 -0
  321. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/openapi-code-sample.d.ts +0 -0
  322. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/openapi-example.d.ts +0 -0
  323. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/openapi-example.js +0 -0
  324. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/openapi-response-sample.d.ts +0 -0
  325. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/replay-openapi.d.ts +0 -0
  326. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/step-by-step-wrapper.d.ts +0 -0
  327. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/openapi/step-by-step-wrapper.js +0 -0
  328. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/styled.elements.d.ts +0 -0
  329. /package/dist/{server/plugins/markdown → client/app}/markdoc/custom-components/styled.elements.js +0 -0
  330. /package/dist/{server/plugins/markdown → client/app}/markdoc/hooks/use-store.d.ts +0 -0
  331. /package/dist/{server/plugins/openapi-docs/template → client/templates/openapi-docs}/mock-server-config.d.ts +0 -0
  332. /package/dist/{server/plugins/openapi-docs/template → client/templates/openapi-docs}/mock-server-config.js +0 -0
  333. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/definition-path.d.ts +0 -0
  334. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/definition-path.js +0 -0
  335. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/index.d.ts +0 -0
  336. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/index.js +0 -0
  337. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/json-example-ref.d.ts +0 -0
  338. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/json-example-ref.js +0 -0
  339. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/json-schema-ref.d.ts +0 -0
  340. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/json-schema-ref.js +0 -0
  341. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/parsed-yaml.d.ts +0 -0
  342. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/parsed-yaml.js +0 -0
  343. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/raw-content.d.ts +0 -0
  344. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/raw-content.js +0 -0
  345. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/sample-from-json-schema.d.ts +0 -0
  346. /package/dist/{server/plugins/markdown/markdoc → markdoc}/attributes/sample-from-json-schema.js +0 -0
  347. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/extract-rbac-from-condition-node.d.ts +0 -0
  348. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/extract-rbac-from-condition-node.js +0 -0
  349. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/get-node-attribute.d.ts +0 -0
  350. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/get-node-attribute.js +0 -0
  351. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-code-node.d.ts +0 -0
  352. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-code-node.js +0 -0
  353. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-conditional-node.d.ts +0 -0
  354. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-conditional-node.js +0 -0
  355. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-content-node.d.ts +0 -0
  356. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-content-node.js +0 -0
  357. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-example-node.d.ts +0 -0
  358. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-example-node.js +0 -0
  359. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-fence-node.d.ts +0 -0
  360. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-fence-node.js +0 -0
  361. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-function.d.ts +0 -0
  362. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-function.js +0 -0
  363. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-list-node.d.ts +0 -0
  364. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-list-node.js +0 -0
  365. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-node.d.ts +0 -0
  366. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-node.js +0 -0
  367. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-string-node.d.ts +0 -0
  368. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-string-node.js +0 -0
  369. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-tag.d.ts +0 -0
  370. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-tag.js +0 -0
  371. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-text-node.d.ts +0 -0
  372. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-text-node.js +0 -0
  373. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-variable.d.ts +0 -0
  374. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/guards/is-variable.js +0 -0
  375. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/remove-markdoc-tags.d.ts +0 -0
  376. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/remove-markdoc-tags.js +0 -0
  377. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/set-node-attribute-value.d.ts +0 -0
  378. /package/dist/{server/plugins/markdown/markdoc → markdoc}/helpers/set-node-attribute-value.js +0 -0
  379. /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/fence/escape-html.d.ts +0 -0
  380. /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/fence/escape-html.js +0 -0
  381. /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/fence/index.d.ts +0 -0
  382. /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/gfm-list-item.d.ts +0 -0
  383. /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/gfm-list-item.js +0 -0
  384. /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/heading.d.ts +0 -0
  385. /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/index.d.ts +0 -0
  386. /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/index.js +0 -0
  387. /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/table.d.ts +0 -0
  388. /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/table.js +0 -0
  389. /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/text.d.ts +0 -0
  390. /package/dist/{server/plugins/markdown/markdoc → markdoc}/nodes/text.js +0 -0
  391. /package/dist/{server/plugins/markdown/markdoc → markdoc}/tags/index.js +0 -0
  392. /package/dist/{server/plugins/markdown/markdoc → markdoc}/tags/json-example.js +0 -0
  393. /package/dist/{server/plugins/markdown/markdoc → markdoc}/tags/json-schema.js +0 -0
  394. /package/dist/{server/plugins/markdown/markdoc → markdoc}/tags/openapi-code-sample.js +0 -0
  395. /package/dist/{server/plugins/markdown/markdoc → markdoc}/tags/openapi-example.js +0 -0
  396. /package/dist/{server/plugins/markdown/markdoc → markdoc}/tags/openapi-response-sample.js +0 -0
  397. /package/dist/{server/plugins/markdown/markdoc → markdoc}/tags/replay-openapi.js +0 -0
  398. /package/dist/{config → server/config}/env-config.d.ts +0 -0
  399. /package/dist/{config → server/config}/env-schema.js +0 -0
  400. /package/dist/{config → server/config}/env-schemas/api-urls.d.ts +0 -0
  401. /package/dist/{config → server/config}/env-schemas/api-urls.js +0 -0
  402. /package/dist/{config → server/config}/env-schemas/auth.d.ts +0 -0
  403. /package/dist/{config → server/config}/env-schemas/auth.js +0 -0
  404. /package/dist/{config → server/config}/env-schemas/catalog.d.ts +0 -0
  405. /package/dist/{config → server/config}/env-schemas/catalog.js +0 -0
  406. /package/dist/{config → server/config}/env-schemas/environment-detection.d.ts +0 -0
  407. /package/dist/{config → server/config}/env-schemas/environment-detection.js +0 -0
  408. /package/dist/{config → server/config}/env-schemas/feature-flags.d.ts +0 -0
  409. /package/dist/{config → server/config}/env-schemas/feature-flags.js +0 -0
  410. /package/dist/{config → server/config}/env-schemas/scorecards.d.ts +0 -0
  411. /package/dist/{config → server/config}/env-schemas/scorecards.js +0 -0
  412. /package/dist/{config → server/config}/env-schemas/search.d.ts +0 -0
  413. /package/dist/{config → server/config}/env-schemas/search.js +0 -0
  414. /package/dist/{config → server/config}/env-schemas/server-config.d.ts +0 -0
  415. /package/dist/{config → server/config}/env-schemas/server-config.js +0 -0
  416. /package/dist/{config → server/config}/env-schemas/site.d.ts +0 -0
  417. /package/dist/{config → server/config}/env-schemas/site.js +0 -0
  418. /package/dist/{config → server/config}/env-schemas/ssr.d.ts +0 -0
  419. /package/dist/{config → server/config}/env-schemas/ssr.js +0 -0
  420. /package/dist/{config → server/config}/env-schemas/telemetry.d.ts +0 -0
  421. /package/dist/{config → server/config}/env-schemas/telemetry.js +0 -0
  422. /package/dist/{config → server/config}/env-schemas/test.d.ts +0 -0
  423. /package/dist/{config → server/config}/env-schemas/test.js +0 -0
  424. /package/dist/server/{config → external-plugins}/resolve-module.d.ts +0 -0
  425. /package/dist/server/{config → external-plugins}/resolve-module.js +0 -0
  426. /package/dist/{server/utils → utils}/conflict-resolvers.d.ts +0 -0
  427. /package/dist/{server/utils → utils}/conflict-resolvers.js +0 -0
  428. /package/dist/{server/utils → utils}/slugger.js +0 -0
@@ -1 +1 @@
1
- import{REDOCLY_TEAMS_RBAC as $}from"@redocly/config";import{removeLeadingSlash as x}from"@redocly/theme/core/utils";import{toKebabCase as p}from"../../../../../../utils/string/to-kebab-case.js";import{promiseMapLimit as E}from"../../../../../utils/async/promise-map-limit.js";import{promiseMapLimitWithStatus as T}from"../../../../../utils/async/promise-map-limit-with-status.js";import{extractTeamsFromScopeItems as R}from"../../../../../utils/rbac.js";import{removeMarkdocTags as w}from"../../../../markdown/markdoc/helpers/remove-markdoc-tags.js";import{BaseApiEntitiesExtractor as N}from"./base.js";import{OpenapiSchemaResolver as S}from"../../../utils/openapi-schema-resolver.js";import{extractPartsFromComponentsRef as v}from"../../../utils/extract-parts-from-components-ref.js";import{isValidTagName as O}from"../../../utils/is-valid-tag-name.js";const A=["get","post","put","delete","patch"],b=15,d=15;class _ extends N{#e;constructor(e){super("openapi",e),this.#e=e.context.logger}async loadApiDescriptions(){return await this.actions.loadOpenApiDefinitions(this.context)}mapApiDescriptionToEntity(e,o){const s=x(e.realRelativePath),n=e.definition.info.title,t=s.replace(/\.[^.]+$/,""),a=p(t.replace(/[\\/]/g,"-")),r=e.definition["x-redocly-catalog-key"],i=typeof r=="string"&&r.trim()?p(r.trim()):a;return{type:this.type,key:i,title:n,summary:w(e.definition.info.description),tags:e.definition.tags?.filter(c=>c.name&&O(c.name)).map(c=>c.name),metadata:{specType:this.specType,descriptionFile:s},version:o}}async processApiDescription(e,o,s,n){if(S.clearSchemaCache(),!e?.definition?.paths)return;const t=this.getRbacTeamsForDefinition(e.relativePath),a=this.mapApiDescriptionToEntity(e,s);await this.catalogEntitiesService.createEntityInLocalDatabase({entity:a,sourceFile:e.realRelativePath,fileHash:e.hash,isRootEntity:!0,revision:o,rbacTeams:t}),n.delete(`${a.key}:${s}`),await this.#n(e,a.key,a.version,s,o,n,t);const r=this.#s(e.definition.paths);if(r.length!==0){const c=(await T(r,b,async({operation:h,path:m,method:l})=>{if(!h.operationId)return;const f=await this.#r(h,m,l,e,a.key,a.version,o,t);f&&n.delete(`${f}:${s}`)},this.#e)).count.failed;c>0&&this.#e.warn(`Extraction completed with ${c} failures out of ${r.length} operations for ${a.key}`)}}#s(e){return Object.entries(e).flatMap(([o,s])=>A.filter(n=>s[n]).map(n=>{const t=s[n];if(!t)throw new Error(`Operation not found for method ${n} on path ${o}`);return{operation:t,path:o,method:n.toUpperCase()}}))}async#n(e,o,s,n,t,a,r){const i=e.definition.components?.schemas;if(!i)return;const c=Object.entries(i);c.length!==0&&await E(c,d,async([h,m])=>{const l=await this.#o({schemaName:h,schema:m,description:e,parentKey:o,parentVersion:s,parentRevision:t,rbacTeams:r});a.delete(`${l.entityKey}:${n}`),l.result==="created"&&await this.catalogEntitiesService.createEntityRelationInLocalDatabase({sourceKey:o,sourceVersion:s,sourceRevision:t,type:"uses",targetKey:l.entityKey,targetVersion:s,targetRevision:t,fileHash:e.hash})})}async#o({schemaName:e,schema:o,description:s,parentKey:n,parentVersion:t,parentRevision:a,rbacTeams:r}){const i=S.resolveSchemaRefs(o,s),c=JSON.stringify(i),h=i[$]?R(i[$]):r,m=R(i["x-rbac"]),l={type:"data-schema",key:`${n}-${p(e)}`,title:e,summary:i.description??i.title??null,tags:[],metadata:{specType:this.specType,schema:c},version:t};return await this.catalogEntitiesService.createEntityInLocalDatabase({entity:l,sourceFile:s.realRelativePath,fileHash:s.hash,revision:a,rbacTeams:m.length?m:h})}async#r(e,o,s,n,t,a,r,i){const c=await Promise.all([this.#m(e.requestBody??null,n),this.#h(e.responses??{},n)]),h=c[0].schemaNames,m=c[1].schemaNames;c[0].errors.length>0&&this.#e.warn(`Schema extraction errors for operation ${e.operationId}: ${c[0].errors.join(", ")}`),c[1].errors.length>0&&this.#e.warn(`Response schema extraction errors for operation ${e.operationId}: ${c[1].errors.join(", ")}`);const l=h.map(g=>`${t}-${p(g)}`),f=m.map(g=>`${t}-${p(g)}`),y=await this.#p({path:o,method:s,operation:e,requestBodySchemasKeys:l,responseSchemasKeys:f,description:n,parentKey:t,parentVersion:a,parentRevision:r,rbacTeams:i});return y.result==="created"&&await Promise.all([this.#i(h,e.operationId??"",n.hash,t,a,r),this.#c(m,e.operationId??"",n.hash,t,a,r),this.#f({apiOperationKey:y.entityKey,operationRelations:e["x-catalog-relations"],descriptionUniqueKey:t,description:n,parentVersion:a,parentRevision:r})]),y.entityKey??null}async#i(e,o,s,n,t,a){return e.length===0||!o?[]:await this.#a(e,o,s,n,t,a)}async#c(e,o,s,n,t,a){return e.length===0||!o?[]:await this.#a(e,o,s,n,t,a)}#m(e,o){const s=[],n=[];try{if(e&&"content"in e&&e.content)for(const t of Object.values(e.content)){if(!t.schema?.$ref)continue;const a=this.#t(t.schema.$ref);a?.componentType==="schemas"&&a.componentName&&s.push(a.componentName)}if(e&&e.$ref){const t=this.#t(e.$ref);if(t?.componentType==="requestBodies"&&t.componentName){const a=o.definition.components?.requestBodies?.[t.componentName];if(a&&"content"in a)for(const r of Object.values(a.content??{})){if(!r.schema?.$ref)continue;const i=this.#t(r.schema.$ref);i?.componentType==="schemas"&&i.componentName&&s.push(i.componentName)}}}}catch(t){n.push(`Failed to extract request body schemas: ${t instanceof Error?t.message:"Unknown error"}`)}return{schemaNames:[...new Set(s)],errors:n}}#h(e,o){const s=[],n=[];try{for(const t of Object.values(e)){if(t&&"content"in t&&t.content)for(const a of Object.values(t.content)){if(!a.schema?.$ref)continue;const r=this.#t(a.schema.$ref);r?.componentType==="schemas"&&r.componentName&&s.push(r.componentName)}if(t&&t.$ref){const a=this.#t(t.$ref);if(a?.componentType==="responses"&&a.componentName){const r=o.definition.components?.responses?.[a.componentName];if(r&&"content"in r)for(const i of Object.values(r.content??{})){if(!i.schema?.$ref)continue;const c=this.#t(i.schema.$ref);c?.componentType==="schemas"&&c.componentName&&s.push(c.componentName)}}}}}catch(t){n.push(`Failed to extract response schemas: ${t instanceof Error?t.message:"Unknown error"}`)}return{schemaNames:[...new Set(s)],errors:n}}#t(e){try{return v(e)}catch{return{componentType:"",componentName:null}}}async#a(e,o,s,n,t,a){return e.length===0?[]:await E(e,d,async r=>await this.#l({operationId:o,schemaName:r,descriptionHash:s,parentKey:n,parentVersion:t,parentRevision:a}))}async#l({operationId:e,schemaName:o,descriptionHash:s,parentKey:n,parentVersion:t,parentRevision:a}){const r=`${n}-${p(o)}`;try{return await this.catalogEntitiesService.createEntityRelationInLocalDatabase({sourceKey:`${n}-${p(e)}`,type:"uses",targetKey:r,fileHash:s,sourceVersion:t,targetVersion:t,sourceRevision:a,targetRevision:a}),r}catch(i){throw this.#e.error(`Failed to create relation between operation ${e} and schema ${o}: ${i instanceof Error?i.message:"Unknown error"}`),i}}async#p({path:e,method:o,operation:s,requestBodySchemasKeys:n,responseSchemasKeys:t,description:a,parentKey:r,parentVersion:i,parentRevision:c,rbacTeams:h}){const m=`${s.operationId}`,l=`${r}-${p(m)}`,f=s[$]?R(s[$]):h,y=R(s["x-rbac"]),g={type:"api-operation",key:l,title:m,summary:w(s.summary),tags:s.tags?.filter(u=>O(u)),metadata:{path:e,method:o,payload:n,responses:t},version:i};try{return await this.catalogEntitiesService.createEntityInLocalDatabase({entity:g,sourceFile:a.realRelativePath,fileHash:a.hash,revision:c,rbacTeams:y.length>0?y:f})}catch(u){throw this.#e.error(`Failed to create API operation entity for ${m}: ${u instanceof Error?u.message:"Unknown error"}`),u}}async#f({apiOperationKey:e,operationRelations:o,descriptionUniqueKey:s,description:n,parentVersion:t,parentRevision:a}){try{await this.catalogEntitiesService.createEntityRelationInLocalDatabase({sourceKey:e,type:"partOf",targetKey:s,fileHash:n.hash,sourceVersion:t,targetVersion:t,sourceRevision:a,targetRevision:a}),await this.#y(e,o,t,a)}catch(r){this.#e.error(`Failed to create API operation relations for ${e}: ${r instanceof Error?r.message:"Unknown error"}`)}}async#y(e,o,s,n){o?.length&&await E(o,b,async t=>{try{this.validateEntityRelationFileSchema(t),await this.catalogEntitiesService.createEntityRelationInLocalDatabase({sourceKey:e,type:t.type,targetKey:t.key,sourceVersion:s,targetVersion:"",sourceRevision:n,targetRevision:""})}catch(a){this.context.logger.warn(`Error creating entity relation for operation ${e} based on custom property: ${a instanceof Error?a.message:"Unknown error"}`)}})}}export{_ as OpenApiEntitiesExtractor};
1
+ import{REDOCLY_TEAMS_RBAC as $}from"@redocly/config";import{removeLeadingSlash as x}from"@redocly/theme/core/utils";import{toKebabCase as p}from"../../../../../../utils/string/to-kebab-case.js";import{promiseMapLimit as E}from"../../../../../utils/async/promise-map-limit.js";import{promiseMapLimitWithStatus as T}from"../../../../../utils/async/promise-map-limit-with-status.js";import{extractTeamsFromScopeItems as R}from"../../../../../utils/rbac.js";import{removeMarkdocTags as w}from"../../../../../../markdoc/helpers/remove-markdoc-tags.js";import{BaseApiEntitiesExtractor as N}from"./base.js";import{OpenapiSchemaResolver as S}from"../../../utils/openapi-schema-resolver.js";import{extractPartsFromComponentsRef as v}from"../../../utils/extract-parts-from-components-ref.js";import{isValidTagName as O}from"../../../utils/is-valid-tag-name.js";const A=["get","post","put","delete","patch"],b=15,d=15;class _ extends N{#e;constructor(e){super("openapi",e),this.#e=e.context.logger}async loadApiDescriptions(){return await this.actions.loadOpenApiDefinitions(this.context)}mapApiDescriptionToEntity(e,o){const s=x(e.realRelativePath),n=e.definition.info.title,t=s.replace(/\.[^.]+$/,""),a=p(t.replace(/[\\/]/g,"-")),r=e.definition["x-redocly-catalog-key"],i=typeof r=="string"&&r.trim()?p(r.trim()):a;return{type:this.type,key:i,title:n,summary:w(e.definition.info.description),tags:e.definition.tags?.filter(c=>c.name&&O(c.name)).map(c=>c.name),metadata:{specType:this.specType,descriptionFile:s},version:o}}async processApiDescription(e,o,s,n){if(S.clearSchemaCache(),!e?.definition?.paths)return;const t=this.getRbacTeamsForDefinition(e.relativePath),a=this.mapApiDescriptionToEntity(e,s);await this.catalogEntitiesService.createEntityInLocalDatabase({entity:a,sourceFile:e.realRelativePath,fileHash:e.hash,isRootEntity:!0,revision:o,rbacTeams:t}),n.delete(`${a.key}:${s}`),await this.#n(e,a.key,a.version,s,o,n,t);const r=this.#s(e.definition.paths);if(r.length!==0){const c=(await T(r,b,async({operation:h,path:m,method:l})=>{if(!h.operationId)return;const f=await this.#r(h,m,l,e,a.key,a.version,o,t);f&&n.delete(`${f}:${s}`)},this.#e)).count.failed;c>0&&this.#e.warn(`Extraction completed with ${c} failures out of ${r.length} operations for ${a.key}`)}}#s(e){return Object.entries(e).flatMap(([o,s])=>A.filter(n=>s[n]).map(n=>{const t=s[n];if(!t)throw new Error(`Operation not found for method ${n} on path ${o}`);return{operation:t,path:o,method:n.toUpperCase()}}))}async#n(e,o,s,n,t,a,r){const i=e.definition.components?.schemas;if(!i)return;const c=Object.entries(i);c.length!==0&&await E(c,d,async([h,m])=>{const l=await this.#o({schemaName:h,schema:m,description:e,parentKey:o,parentVersion:s,parentRevision:t,rbacTeams:r});a.delete(`${l.entityKey}:${n}`),l.result==="created"&&await this.catalogEntitiesService.createEntityRelationInLocalDatabase({sourceKey:o,sourceVersion:s,sourceRevision:t,type:"uses",targetKey:l.entityKey,targetVersion:s,targetRevision:t,fileHash:e.hash})})}async#o({schemaName:e,schema:o,description:s,parentKey:n,parentVersion:t,parentRevision:a,rbacTeams:r}){const i=S.resolveSchemaRefs(o,s),c=JSON.stringify(i),h=i[$]?R(i[$]):r,m=R(i["x-rbac"]),l={type:"data-schema",key:`${n}-${p(e)}`,title:e,summary:i.description??i.title??null,tags:[],metadata:{specType:this.specType,schema:c},version:t};return await this.catalogEntitiesService.createEntityInLocalDatabase({entity:l,sourceFile:s.realRelativePath,fileHash:s.hash,revision:a,rbacTeams:m.length?m:h})}async#r(e,o,s,n,t,a,r,i){const c=await Promise.all([this.#m(e.requestBody??null,n),this.#h(e.responses??{},n)]),h=c[0].schemaNames,m=c[1].schemaNames;c[0].errors.length>0&&this.#e.warn(`Schema extraction errors for operation ${e.operationId}: ${c[0].errors.join(", ")}`),c[1].errors.length>0&&this.#e.warn(`Response schema extraction errors for operation ${e.operationId}: ${c[1].errors.join(", ")}`);const l=h.map(g=>`${t}-${p(g)}`),f=m.map(g=>`${t}-${p(g)}`),y=await this.#p({path:o,method:s,operation:e,requestBodySchemasKeys:l,responseSchemasKeys:f,description:n,parentKey:t,parentVersion:a,parentRevision:r,rbacTeams:i});return y.result==="created"&&await Promise.all([this.#i(h,e.operationId??"",n.hash,t,a,r),this.#c(m,e.operationId??"",n.hash,t,a,r),this.#f({apiOperationKey:y.entityKey,operationRelations:e["x-catalog-relations"],descriptionUniqueKey:t,description:n,parentVersion:a,parentRevision:r})]),y.entityKey??null}async#i(e,o,s,n,t,a){return e.length===0||!o?[]:await this.#a(e,o,s,n,t,a)}async#c(e,o,s,n,t,a){return e.length===0||!o?[]:await this.#a(e,o,s,n,t,a)}#m(e,o){const s=[],n=[];try{if(e&&"content"in e&&e.content)for(const t of Object.values(e.content)){if(!t.schema?.$ref)continue;const a=this.#t(t.schema.$ref);a?.componentType==="schemas"&&a.componentName&&s.push(a.componentName)}if(e&&e.$ref){const t=this.#t(e.$ref);if(t?.componentType==="requestBodies"&&t.componentName){const a=o.definition.components?.requestBodies?.[t.componentName];if(a&&"content"in a)for(const r of Object.values(a.content??{})){if(!r.schema?.$ref)continue;const i=this.#t(r.schema.$ref);i?.componentType==="schemas"&&i.componentName&&s.push(i.componentName)}}}}catch(t){n.push(`Failed to extract request body schemas: ${t instanceof Error?t.message:"Unknown error"}`)}return{schemaNames:[...new Set(s)],errors:n}}#h(e,o){const s=[],n=[];try{for(const t of Object.values(e)){if(t&&"content"in t&&t.content)for(const a of Object.values(t.content)){if(!a.schema?.$ref)continue;const r=this.#t(a.schema.$ref);r?.componentType==="schemas"&&r.componentName&&s.push(r.componentName)}if(t&&t.$ref){const a=this.#t(t.$ref);if(a?.componentType==="responses"&&a.componentName){const r=o.definition.components?.responses?.[a.componentName];if(r&&"content"in r)for(const i of Object.values(r.content??{})){if(!i.schema?.$ref)continue;const c=this.#t(i.schema.$ref);c?.componentType==="schemas"&&c.componentName&&s.push(c.componentName)}}}}}catch(t){n.push(`Failed to extract response schemas: ${t instanceof Error?t.message:"Unknown error"}`)}return{schemaNames:[...new Set(s)],errors:n}}#t(e){try{return v(e)}catch{return{componentType:"",componentName:null}}}async#a(e,o,s,n,t,a){return e.length===0?[]:await E(e,d,async r=>await this.#l({operationId:o,schemaName:r,descriptionHash:s,parentKey:n,parentVersion:t,parentRevision:a}))}async#l({operationId:e,schemaName:o,descriptionHash:s,parentKey:n,parentVersion:t,parentRevision:a}){const r=`${n}-${p(o)}`;try{return await this.catalogEntitiesService.createEntityRelationInLocalDatabase({sourceKey:`${n}-${p(e)}`,type:"uses",targetKey:r,fileHash:s,sourceVersion:t,targetVersion:t,sourceRevision:a,targetRevision:a}),r}catch(i){throw this.#e.error(`Failed to create relation between operation ${e} and schema ${o}: ${i instanceof Error?i.message:"Unknown error"}`),i}}async#p({path:e,method:o,operation:s,requestBodySchemasKeys:n,responseSchemasKeys:t,description:a,parentKey:r,parentVersion:i,parentRevision:c,rbacTeams:h}){const m=`${s.operationId}`,l=`${r}-${p(m)}`,f=s[$]?R(s[$]):h,y=R(s["x-rbac"]),g={type:"api-operation",key:l,title:m,summary:w(s.summary),tags:s.tags?.filter(u=>O(u)),metadata:{path:e,method:o,payload:n,responses:t},version:i};try{return await this.catalogEntitiesService.createEntityInLocalDatabase({entity:g,sourceFile:a.realRelativePath,fileHash:a.hash,revision:c,rbacTeams:y.length>0?y:f})}catch(u){throw this.#e.error(`Failed to create API operation entity for ${m}: ${u instanceof Error?u.message:"Unknown error"}`),u}}async#f({apiOperationKey:e,operationRelations:o,descriptionUniqueKey:s,description:n,parentVersion:t,parentRevision:a}){try{await this.catalogEntitiesService.createEntityRelationInLocalDatabase({sourceKey:e,type:"partOf",targetKey:s,fileHash:n.hash,sourceVersion:t,targetVersion:t,sourceRevision:a,targetRevision:a}),await this.#y(e,o,t,a)}catch(r){this.#e.error(`Failed to create API operation relations for ${e}: ${r instanceof Error?r.message:"Unknown error"}`)}}async#y(e,o,s,n){o?.length&&await E(o,b,async t=>{try{this.validateEntityRelationFileSchema(t),await this.catalogEntitiesService.createEntityRelationInLocalDatabase({sourceKey:e,type:t.type,targetKey:t.key,sourceVersion:s,targetVersion:"",sourceRevision:n,targetRevision:""})}catch(a){this.context.logger.warn(`Error creating entity relation for operation ${e} based on custom property: ${a instanceof Error?a.message:"Unknown error"}`)}})}}export{_ as OpenApiEntitiesExtractor};
@@ -1 +1 @@
1
- import{CATALOG_ENTITIES_FILES_REGEX as E,ENTITY_SCHEMA_EXCLUDED_FOLDERS as d}from"../../../../constants/plugins/catalog-entities.js";import{FileHashStatus as l,FileType as a}from"../../../../persistence/file-hashes/types.js";import{OPERATORS as u}from"../../../../providers/database/pagination/constants.js";import{promiseMapLimit as m}from"../../../../utils/async/promise-map-limit.js";import{VERSION_NOT_SPECIFIED as p}from"@redocly/theme/core/constants";import{parseEntities as h}from"../../../../web-server/routes/catalog/parsers/entities/parse-entities.js";import{envConfig as g}from"../../../../../config/env-config.js";import{extractFileContent as y}from"../../entities/extract-file-content.js";import{resolveEntityVersion as I}from"../../utils/resolve-entity-version.js";import{catalogDataCollector as f}from"../../utils/catalog-data-collector.js";const T=15;class ${#t;#e;#i;#r;#s;constructor({fileHashManager:e,context:t,catalogEntitiesService:i,catalogConfig:o,shouldCalculateEntities:s}){this.#t=e,this.#e=t,this.#i=i,this.#r=o,this.#s=s}async extract(e){try{if(e&&this.#o(e)){await this.#n(e);return}await this.#t.markAllAsOutdated(a.ENTITY_DEFINITION);const i=this.#e.fs.scan(E).filter(({relativePath:o})=>this.#o(o));i.length&&f.addExtractor("fs"),await m(i,T,async({relativePath:o})=>{await this.#n(o)}),await this.#f()}catch(t){this.#e.logger.error("Error extracting entities.",t)}}#o=e=>!!(e.match(E)&&!d.some(t=>e.includes(t)));#n=async e=>{try{const t=await y(e,this.#e);if(!t){this.#e.logger.warn(`Error extracting content from ${e}.`);return}const i=await this.#t.computeFileHash(t);if(!((await this.#t.getByPath(e))?.hash!==i||this.#s||g.FORCE_CATALOG_CACHE_REVALIDATE==="true")){f.increaseSkippedFilesCount(),await this.#t.upsert(a.ENTITY_DEFINITION,e,i,l.UP_TO_DATE);return}const r=this.#a(t.entities,e);if(!r)return;const n=await this.#i.getEntityKeysAndVersionsBySourceFile(e);await this.#c(r,e,i,n),await this.#l(n,e),f.increaseProcessedFilesCount(),await this.#t.upsert(a.ENTITY_DEFINITION,e,i,l.UP_TO_DATE)}catch(t){this.#e.logger.warn(`Error processing file "${e}". ${t instanceof Error?t.message:String(t)}.`)}};#a=(e,t)=>{try{return h(e,this.#r)}catch(i){return this.#e.logger.warn(`Error validating entities in "${t}". ${i instanceof Error?i.message:String(i)}.`),null}};#c=async(e,t,i,o)=>{for(const s of e)try{const r=I(s.version,t);if(!r.success){this.#e.logger.warn(`Entity "${s.key}" in file "${t}" has conflicting versions: file version "${r.fileVersion}" differs from folder version "${r.folderVersion}". Entity will not be created.`);continue}const n={...s,version:r.version};if(await this.#i.createEntityInLocalDatabase({entity:n,sourceFile:t,fileHash:i}),s.key){const c=r.version??p;o.delete(`${s.key}:${c}`)}}catch(r){const n=s.key??"unknown";this.#e.logger.warn(`Error processing entity "${n}" from "${t}". ${r instanceof Error?r.message:String(r)}.`)}};#l=async(e,t)=>{if(e.size===0)return;const i=Array.from(e).map(r=>{const[n,c]=r.split(":");return{key:n,version:c}}),o=Array.from(new Set(i.map(({key:r})=>r))),s=i.map(({key:r,version:n})=>({op:u.AND,conditions:[{field:"key",operator:"equal",value:r},{field:"version",operator:"equal",value:n}]}));await this.#i.deleteEntitiesInLocalDatabase({op:"AND",conditions:[{field:"key",operator:"in",value:o},{op:u.OR,conditions:s},{field:"source",operator:"equal",value:"file"},{field:"source_file",operator:"equal",value:t}]})};#f=async()=>{const e=await this.#t.getAllOutdated(a.ENTITY_DEFINITION);if(!e||e.length===0)return;const t=await this.#i.getEntities({paginationParams:{limit:1e3,filter:{op:"AND",conditions:[{field:"source_file",operator:"in",value:e.map(({filePath:i})=>i)},{field:"is_current",operator:"equal",value:!0}]}}});!t||t.items.length===0||(await this.#i.deleteEntitiesInLocalDatabase({field:"key",operator:"in",value:t.items.map(({key:i})=>i)}),await this.#t.deleteFileHashes({op:"AND",conditions:[{field:"file_type",operator:"equal",value:a.ENTITY_DEFINITION},{field:"status",operator:"equal",value:l.OUTDATED}]}))}}export{$ as FsEntitiesExtractor};
1
+ import{CATALOG_ENTITIES_FILES_REGEX as E,ENTITY_SCHEMA_EXCLUDED_FOLDERS as d}from"../../../../constants/plugins/catalog-entities.js";import{FileHashStatus as l,FileType as a}from"../../../../persistence/file-hashes/types.js";import{OPERATORS as u}from"../../../../providers/database/pagination/constants.js";import{promiseMapLimit as m}from"../../../../utils/async/promise-map-limit.js";import{VERSION_NOT_SPECIFIED as p}from"@redocly/theme/core/constants";import{parseEntities as h}from"../../../../web-server/routes/catalog/parsers/entities/parse-entities.js";import{envConfig as g}from"../../../../config/env-config.js";import{extractFileContent as y}from"../../entities/extract-file-content.js";import{resolveEntityVersion as I}from"../../utils/resolve-entity-version.js";import{catalogDataCollector as f}from"../../utils/catalog-data-collector.js";const T=15;class ${#t;#e;#i;#r;#s;constructor({fileHashManager:e,context:t,catalogEntitiesService:i,catalogConfig:o,shouldCalculateEntities:s}){this.#t=e,this.#e=t,this.#i=i,this.#r=o,this.#s=s}async extract(e){try{if(e&&this.#o(e)){await this.#n(e);return}await this.#t.markAllAsOutdated(a.ENTITY_DEFINITION);const i=this.#e.fs.scan(E).filter(({relativePath:o})=>this.#o(o));i.length&&f.addExtractor("fs"),await m(i,T,async({relativePath:o})=>{await this.#n(o)}),await this.#f()}catch(t){this.#e.logger.error("Error extracting entities.",t)}}#o=e=>!!(e.match(E)&&!d.some(t=>e.includes(t)));#n=async e=>{try{const t=await y(e,this.#e);if(!t){this.#e.logger.warn(`Error extracting content from ${e}.`);return}const i=await this.#t.computeFileHash(t);if(!((await this.#t.getByPath(e))?.hash!==i||this.#s||g.FORCE_CATALOG_CACHE_REVALIDATE==="true")){f.increaseSkippedFilesCount(),await this.#t.upsert(a.ENTITY_DEFINITION,e,i,l.UP_TO_DATE);return}const r=this.#a(t.entities,e);if(!r)return;const n=await this.#i.getEntityKeysAndVersionsBySourceFile(e);await this.#c(r,e,i,n),await this.#l(n,e),f.increaseProcessedFilesCount(),await this.#t.upsert(a.ENTITY_DEFINITION,e,i,l.UP_TO_DATE)}catch(t){this.#e.logger.warn(`Error processing file "${e}". ${t instanceof Error?t.message:String(t)}.`)}};#a=(e,t)=>{try{return h(e,this.#r)}catch(i){return this.#e.logger.warn(`Error validating entities in "${t}". ${i instanceof Error?i.message:String(i)}.`),null}};#c=async(e,t,i,o)=>{for(const s of e)try{const r=I(s.version,t);if(!r.success){this.#e.logger.warn(`Entity "${s.key}" in file "${t}" has conflicting versions: file version "${r.fileVersion}" differs from folder version "${r.folderVersion}". Entity will not be created.`);continue}const n={...s,version:r.version};if(await this.#i.createEntityInLocalDatabase({entity:n,sourceFile:t,fileHash:i}),s.key){const c=r.version??p;o.delete(`${s.key}:${c}`)}}catch(r){const n=s.key??"unknown";this.#e.logger.warn(`Error processing entity "${n}" from "${t}". ${r instanceof Error?r.message:String(r)}.`)}};#l=async(e,t)=>{if(e.size===0)return;const i=Array.from(e).map(r=>{const[n,c]=r.split(":");return{key:n,version:c}}),o=Array.from(new Set(i.map(({key:r})=>r))),s=i.map(({key:r,version:n})=>({op:u.AND,conditions:[{field:"key",operator:"equal",value:r},{field:"version",operator:"equal",value:n}]}));await this.#i.deleteEntitiesInLocalDatabase({op:"AND",conditions:[{field:"key",operator:"in",value:o},{op:u.OR,conditions:s},{field:"source",operator:"equal",value:"file"},{field:"source_file",operator:"equal",value:t}]})};#f=async()=>{const e=await this.#t.getAllOutdated(a.ENTITY_DEFINITION);if(!e||e.length===0)return;const t=await this.#i.getEntities({paginationParams:{limit:1e3,filter:{op:"AND",conditions:[{field:"source_file",operator:"in",value:e.map(({filePath:i})=>i)},{field:"is_current",operator:"equal",value:!0}]}}});!t||t.items.length===0||(await this.#i.deleteEntitiesInLocalDatabase({field:"key",operator:"in",value:t.items.map(({key:i})=>i)}),await this.#t.deleteFileHashes({op:"AND",conditions:[{field:"file_type",operator:"equal",value:a.ENTITY_DEFINITION},{field:"status",operator:"equal",value:l.OUTDATED}]}))}}export{$ as FsEntitiesExtractor};
@@ -1 +1 @@
1
- import{FileType as p}from"../../persistence/file-hashes/types.js";import{envConfig as P}from"../../../config/env-config.js";import{deepEqual as I}from"../../../utils/object/deep-equal.js";import{telemetryTraceStep as D}from"../../../cli/telemetry/helpers/trace-step.js";import{catalogDataCollector as O}from"./utils/catalog-data-collector.js";import{CATALOG_BASE_SLUG as m,CATALOG_FILTERS_CACHE_NAMESPACE as b,ENTITIES_MAP_GLOBAL_DATA_KEY as _}from"../../constants/plugins/catalog-entities.js";import{CacheService as v}from"../../persistence/cache/services/cache-service.js";import{getTemplatePath as f}from"./utils/get-template-path.js";import{getCompleteCatalogConfig as E}from"./get-complete-catalog-config.js";import{AsyncApiEntitiesExtractor as w}from"./extensions/extractors/api-description/asyncapi-entities-extractor.js";import{GraphqlEntitiesExtractor as R}from"./extensions/extractors/api-description/graphql-entities-extractor.js";import{FileHashesService as N}from"../../persistence/file-hashes/services/file-hashes-service.js";import{CatalogEntitiesService as L}from"./database/catalog-entities-service.js";import{ArazzoEntitiesExtractor as G}from"./extensions/extractors/api-description/arazzo-entities-extractor.js";import{FsEntitiesExtractor as x}from"./extensions/extractors/fs-entities-extractor.js";import{HashManager as F}from"./utils/hash-manager.js";import{OpenApiEntitiesExtractor as H}from"./extensions/extractors/api-description/openapi-entities-extractor.js";const B="catalog-entity-template",M="catalog-entity";let C=!0,d;async function Y(){return{id:"CatalogEntities",requiredEntitlements:["catalog"],async processContent(t,e){const a=await e.getConfig(),r=E(a.entitiesCatalog);if(!r.show)return;const{logger:s}=e,n=t.registerServerPropsGetter(M,f("../get-server-props.js")),g=t.createTemplate(B,f("../template/index.js"));t.addRoute({duplicateInAllLocales:!0,slug:m,fsPath:"",templateId:g,excludeFromSidebar:!0,hasClientRoutes:!0,serverPropsGetterIds:[n],getNavText:()=>Promise.resolve("Catalog"),getStaticData:async()=>({props:{catalogConfig:r}})});const[u]=Object.entries(r.catalogs??{}).find(([o,i])=>!i?.hide)||[];u&&t.addRedirect(m,{type:302,to:`${m}/${u}`}),s.info("Catalog Entities plugin finished")},async afterRoutesCreated(t,e){await D("build.plugin.catalog_entities",async a=>{const r=await e.getConfig(),s=E(r.entitiesCatalog);if(a?.setAttribute("config",JSON.stringify(s)),!s.show)return;const{logger:n}=e,g=C&&P.isDevelopMode,u=!I(d,r.rbac);d=r.rbac;const o=g||u,i=await L.getInstance({baseDbDir:t.serverOutDir,removeExisting:g,runOnlyLocalDatabase:!0,runWithPragmaWalWriteOptimization:!0}),A=await N.getInstance({baseDbDir:t.serverOutDir}),l=new F(A),T=[new x({fileHashManager:l,context:e,catalogEntitiesService:i,catalogConfig:s,shouldCalculateEntities:o}),new H({actions:t,context:e,catalogEntitiesService:i,fileHashManager:l,fileType:p.OPENAPI_DESCRIPTION,shouldCalculateEntities:o}),new w({actions:t,context:e,catalogEntitiesService:i,fileHashManager:l,fileType:p.ASYNCAPI_DESCRIPTION,shouldCalculateEntities:o}),new R({actions:t,context:e,catalogEntitiesService:i,fileHashManager:l,fileType:p.GRAPHQL_DESCRIPTION,shouldCalculateEntities:o}),new G({actions:t,context:e,catalogEntitiesService:i,fileHashManager:l,fileType:p.ARAZZO_DESCRIPTION,shouldCalculateEntities:o})];n.info("Starting entities extractors...");const y=n.startTiming();await i.transaction(async()=>{await Promise.all(T.map(async S=>S.extract()))});const h=i.getEntitySources();t.setGlobalData({[_]:h}),await(await v.getInstance({baseDbDir:t.serverOutDir})).deleteByNamespace(b),n.infoTime(y,"Entities extractors finished");const c=await O.getCatalogEntitiesData(i);a?.setAttribute("totalEntities",c.totalEntitiesCount),a?.setAttribute("entitiesCountByType",JSON.stringify(c.countOfEntitiesByType)),a?.setAttribute("totalFilesSkippedByHash",c.totalFilesSkippedByHash),a?.setAttribute("totalProcessedFiles",c.totalProcessedFiles),a?.setAttribute("extractors",c.extractors),C=!1})}}}var ot=Y;export{Y as catalogEntitiesPlugin,ot as default};
1
+ import{FileType as p}from"../../persistence/file-hashes/types.js";import{envConfig as P}from"../../config/env-config.js";import{deepEqual as I}from"../../../utils/object/deep-equal.js";import{CATALOG_BASE_SLUG as u}from"../../../constants/catalog-entities.js";import{telemetryTraceStep as D}from"../../../cli/telemetry/helpers/trace-step.js";import{catalogDataCollector as O}from"./utils/catalog-data-collector.js";import{CATALOG_FILTERS_CACHE_NAMESPACE as b,ENTITIES_MAP_GLOBAL_DATA_KEY as _}from"../../constants/plugins/catalog-entities.js";import{CacheService as v}from"../../persistence/cache/services/cache-service.js";import{getTemplatePath as f}from"./utils/get-template-path.js";import{getCompleteCatalogConfig as E}from"./get-complete-catalog-config.js";import{AsyncApiEntitiesExtractor as w}from"./extensions/extractors/api-description/asyncapi-entities-extractor.js";import{GraphqlEntitiesExtractor as R}from"./extensions/extractors/api-description/graphql-entities-extractor.js";import{FileHashesService as N}from"../../persistence/file-hashes/services/file-hashes-service.js";import{CatalogEntitiesService as L}from"./database/catalog-entities-service.js";import{ArazzoEntitiesExtractor as G}from"./extensions/extractors/api-description/arazzo-entities-extractor.js";import{FsEntitiesExtractor as x}from"./extensions/extractors/fs-entities-extractor.js";import{HashManager as F}from"./utils/hash-manager.js";import{OpenApiEntitiesExtractor as H}from"./extensions/extractors/api-description/openapi-entities-extractor.js";const B="catalog-entity-template",M="catalog-entity";let C=!0,d;async function Y(){return{id:"CatalogEntities",requiredEntitlements:["catalog"],async processContent(t,e){const a=await e.getConfig(),r=E(a.entitiesCatalog);if(!r.show)return;const{logger:s}=e,n=t.registerServerPropsGetter(M,f("../get-server-props.js")),g=t.createTemplate(B,f("../template/index.js"));t.addRoute({duplicateInAllLocales:!0,slug:u,fsPath:"",templateId:g,excludeFromSidebar:!0,hasClientRoutes:!0,serverPropsGetterIds:[n],getNavText:()=>Promise.resolve("Catalog"),getStaticData:async()=>({props:{catalogConfig:r}})});const[m]=Object.entries(r.catalogs??{}).find(([o,i])=>!i?.hide)||[];m&&t.addRedirect(u,{type:302,to:`${u}/${m}`}),s.info("Catalog Entities plugin finished")},async afterRoutesCreated(t,e){await D("build.plugin.catalog_entities",async a=>{const r=await e.getConfig(),s=E(r.entitiesCatalog);if(a?.setAttribute("config",JSON.stringify(s)),!s.show)return;const{logger:n}=e,g=C&&P.isDevelopMode,m=!I(d,r.rbac);d=r.rbac;const o=g||m,i=await L.getInstance({baseDbDir:t.serverOutDir,removeExisting:g,runOnlyLocalDatabase:!0,runWithPragmaWalWriteOptimization:!0}),A=await N.getInstance({baseDbDir:t.serverOutDir}),l=new F(A),T=[new x({fileHashManager:l,context:e,catalogEntitiesService:i,catalogConfig:s,shouldCalculateEntities:o}),new H({actions:t,context:e,catalogEntitiesService:i,fileHashManager:l,fileType:p.OPENAPI_DESCRIPTION,shouldCalculateEntities:o}),new w({actions:t,context:e,catalogEntitiesService:i,fileHashManager:l,fileType:p.ASYNCAPI_DESCRIPTION,shouldCalculateEntities:o}),new R({actions:t,context:e,catalogEntitiesService:i,fileHashManager:l,fileType:p.GRAPHQL_DESCRIPTION,shouldCalculateEntities:o}),new G({actions:t,context:e,catalogEntitiesService:i,fileHashManager:l,fileType:p.ARAZZO_DESCRIPTION,shouldCalculateEntities:o})];n.info("Starting entities extractors...");const y=n.startTiming();await i.transaction(async()=>{await Promise.all(T.map(async S=>S.extract()))});const h=i.getEntitySources();t.setGlobalData({[_]:h}),await(await v.getInstance({baseDbDir:t.serverOutDir})).deleteByNamespace(b),n.infoTime(y,"Entities extractors finished");const c=await O.getCatalogEntitiesData(i);a?.setAttribute("totalEntities",c.totalEntitiesCount),a?.setAttribute("entitiesCountByType",JSON.stringify(c.countOfEntitiesByType)),a?.setAttribute("totalFilesSkippedByHash",c.totalFilesSkippedByHash),a?.setAttribute("totalProcessedFiles",c.totalProcessedFiles),a?.setAttribute("extractors",c.extractors),C=!1})}}}var st=Y;export{Y as catalogEntitiesPlugin,st as default};
@@ -1 +1 @@
1
- import{redocConfigSchema as m,rootRedoclyConfigSchema as t}from"@redocly/config";import p from"is-glob";import{I18N_DIR_NAME as d,L10N_DIR_NAME as u}from"../../../constants/common.js";import{CONFIG_FILE_NAME as f}from"../../../../constants/common.js";import{DEFAULT_SEARCH_ENGINE as A}from"../../../constants/plugins/search.js";import{deepMerge as F}from"../../../../utils/object/deep-merge.js";import{logger as b}from"../../../tools/notifiers/logger.js";import{EntitlementsProvider as C}from"../../../entitlements/entitlements-provider.js";import{readAndValidateConfig as h}from"./utils/read-and-validate-config.js";import{resolvePlugins as v}from"../../../config/external-plugins.js";import{getPathForAllLocales as l}from"../../../fs/utils/get-path-for-all-locales.js";import{parseRbacConfig as y}from"../../../utils/rbac.js";import{RbacConfigLocation as g,validateRbacConfig as S}from"../../validate-rbac-config.js";const z=async(e,{fs:r},a)=>{const n=await h(e,r,a,async c=>e===f?E(r.cwd,c?.plugins||[]):void 0);n?.rbac&&(n.rbac=await y(n.rbac),S(n.rbac,e===f?g.RootRedoclyYaml:void 0)),(n?.l10n||n?.i18n)&&(n.l10n=L(n),n.i18n=void 0);const s=F(n||{},{markdown:{partialsFolders:(n?.markdown?.partialsFolders||[]).flatMap(c=>l(c,r))}});return R({...s,configPath:e,ignore:I(n?.ignore,r)})};async function E(e,r){const a=await v(e,r),n=a.map(i=>i.config.schema?i.lifecyclePlugin.id:""),s={};for(const i of a){const o=i.lifecyclePlugin?.id;i.config.schema&&o&&t.properties&&(s[o]=i.config.schema)}return{...t,properties:{...s,...t.properties,openapi:m},$id:t.$id+n.join("")}}function R(e){const r=C.instance();return r.canAccessFeature("apiFunctions")||(e.apiFunctions=void 0),r.canAccessFeature("products")||(e.products=void 0),r.canAccessFeature("breadcrumbs")||(e.breadcrumbs={hide:!0}),r.canAccessFeature("seo")||(e.seo=void 0),r.canAccessFeature("redirects")||(e.redirects={}),r.canAccessFeature("l10n")||(e.l10n=void 0),r.canAccessFeature("rbac")||(e.rbac=void 0),r.canAccessFeature("sso")||(e.sso=void 0),r.canAccessFeature("ssoDirect")||(e.ssoDirect=void 0),r.canAccessFeature("catalogClassic")||(e.catalog=void 0,e.catalogClassic=void 0),r.canAccessFeature("scorecard")||(e.scorecard=void 0,e.scorecardClassic=void 0),r.canAccessFeature("scorecards")||(e.scorecards=void 0),r.canAccessFeature("devOnboarding")||(e.developerOnboarding=void 0),r.canAccessFeature("analytics")||(e.analytics=void 0),r.canAccessFeature("removeAttribution")||(e.removeAttribution=void 0),r.canAccessFeature("mockServer")||(e.mockServer={off:!0}),r.canAccessFeature("advancedSearch")||e.search&&(e.search.engine=A),r.canAccessFeature("banner")||(e.banner=void 0),e}function I(e=[],r){return["static",...e].flatMap(a=>p(a)&&(a.startsWith("*")||a.startsWith(u)||a.startsWith("/"+u)||a.startsWith(d)||a.startsWith("/"+d))?a:l(a,r))}function L(e){return e.i18n&&b.warn("The `i18n` configuration is deprecated. Please use `l10n` instead."),e.l10n||e.i18n||{}}export{z as redoclyConfigLoader};
1
+ import{redocConfigSchema as m,rootRedoclyConfigSchema as t}from"@redocly/config";import p from"is-glob";import{I18N_DIR_NAME as d,L10N_DIR_NAME as u}from"../../../constants/common.js";import{CONFIG_FILE_NAME as f}from"../../../../constants/common.js";import{DEFAULT_SEARCH_ENGINE as A}from"../../../constants/plugins/search.js";import{deepMerge as F}from"../../../../utils/object/deep-merge.js";import{logger as b}from"../../../tools/notifiers/logger.js";import{EntitlementsProvider as C}from"../../../entitlements/entitlements-provider.js";import{readAndValidateConfig as h}from"./utils/read-and-validate-config.js";import{resolveExternalPlugins as v}from"../../../external-plugins/resolve-external-plugins.js";import{getPathForAllLocales as l}from"../../../fs/utils/get-path-for-all-locales.js";import{parseRbacConfig as y}from"../../../utils/rbac.js";import{RbacConfigLocation as g,validateRbacConfig as E}from"../../validate-rbac-config.js";const z=async(e,{fs:r},a)=>{const n=await h(e,r,a,async c=>e===f?S(r.cwd,c?.plugins||[]):void 0);n?.rbac&&(n.rbac=await y(n.rbac),E(n.rbac,e===f?g.RootRedoclyYaml:void 0)),(n?.l10n||n?.i18n)&&(n.l10n=L(n),n.i18n=void 0);const s=F(n||{},{markdown:{partialsFolders:(n?.markdown?.partialsFolders||[]).flatMap(c=>l(c,r))}});return R({...s,configPath:e,ignore:I(n?.ignore,r)})};async function S(e,r){const a=await v(e,r),n=a.map(i=>i.config.schema?i.lifecyclePlugin.id:""),s={};for(const i of a){const o=i.lifecyclePlugin?.id;i.config.schema&&o&&t.properties&&(s[o]=i.config.schema)}return{...t,properties:{...s,...t.properties,openapi:m},$id:t.$id+n.join("")}}function R(e){const r=C.instance();return r.canAccessFeature("apiFunctions")||(e.apiFunctions=void 0),r.canAccessFeature("products")||(e.products=void 0),r.canAccessFeature("breadcrumbs")||(e.breadcrumbs={hide:!0}),r.canAccessFeature("seo")||(e.seo=void 0),r.canAccessFeature("redirects")||(e.redirects={}),r.canAccessFeature("l10n")||(e.l10n=void 0),r.canAccessFeature("rbac")||(e.rbac=void 0),r.canAccessFeature("sso")||(e.sso=void 0),r.canAccessFeature("ssoDirect")||(e.ssoDirect=void 0),r.canAccessFeature("catalogClassic")||(e.catalog=void 0,e.catalogClassic=void 0),r.canAccessFeature("scorecard")||(e.scorecard=void 0,e.scorecardClassic=void 0),r.canAccessFeature("scorecards")||(e.scorecards=void 0),r.canAccessFeature("devOnboarding")||(e.developerOnboarding=void 0),r.canAccessFeature("analytics")||(e.analytics=void 0),r.canAccessFeature("removeAttribution")||(e.removeAttribution=void 0),r.canAccessFeature("mockServer")||(e.mockServer={off:!0}),r.canAccessFeature("advancedSearch")||e.search&&(e.search.engine=A),r.canAccessFeature("banner")||(e.banner=void 0),e}function I(e=[],r){return["static",...e].flatMap(a=>p(a)&&(a.startsWith("*")||a.startsWith(u)||a.startsWith("/"+u)||a.startsWith(d)||a.startsWith("/"+d))?a:l(a,r))}function L(e){return e.i18n&&b.warn("The `i18n` configuration is deprecated. Please use `l10n` instead."),e.l10n||e.i18n||{}}export{z as redoclyConfigLoader};
@@ -1 +1 @@
1
- import P from"path";import{lintConfig as C,loadConfig as T,createConfigTypes as A}from"@redocly/openapi-core";import{deepMerge as U}from"../../../../../utils/object/deep-merge.js";import{logger as d}from"../../../../tools/notifiers/logger.js";import{BRANCH_ENV_PREFIX as $}from"../../../../../constants/common.js";import{sanitizeBranchName as L}from"../../../../utils/envs/sanitize-branch-name.js";import{safeParsePartial as E}from"../../safe-parse.js";import{formatConfigProblem as q}from"../../format-error.js";import{ExternalResolver as x}from"../../../../fs/utils/external-ref-resolver.js";import{resolveMutuallyExclusiveProps as B}from"../../resolve-mutual-exclusion.js";function g(s,e,t,r){e in s&&s[e]&&typeof s[e]=="string"&&(/^https?:\/\/.*/.test(s[e])||r(new Error(`Invalid ${t} URL: "${s[e]}". ${t} must start with "http://" or "https://".`)))}function j(s,e){if("access"in s&&s.access&&typeof s.access=="object"){const t=s.access;g(t,"logoutReturnUrl","access.logoutReturnUrl",e),g(t,"residency","access.residency",e);const r=["requiresLogin","logoutReturnUrl","residency","sso","rbac"];for(const n of r)n in t&&t[n]!==void 0&&n in s&&s[n]!==void 0&&e(new Error(`Property '${n}' is defined both at root level and in 'access' object. Please use 'access.${n}' to define this configuration.`))}}async function X(s,e,t,r){const h=e.getFileInfo(s)?.realRelativePath||s;async function l(){const a=new x(e),u=P.join(e.cwd,h),i=await T({configPath:u,externalRefResolver:a}),p=await r(i.resolvedConfig);if(p===void 0)return i.resolvedConfig;const m=[...i.document?.source?await C({config:i,externalConfigTypes:A(p,i)}):[],...i.document?.source?B(i.resolvedConfig,i.document?.source):[]];if(m.length>0)for(const b of m)t(new Error(q(b,e.cwd)));return i.resolvedConfig}const c=await e.exists(s)?await l():{},R=M(c),w=await r(c);g(c,"residency","Residency",t),g(c,"logoutReturnUrl","Logout return URL",t),j(c,t);let f=w?E(w,c):c;const{env:y}=f;if(y){const{envConfig:a}=await import("../../../../../config/env-config.js"),u=a.redoclyEnv,i=y[u]||{},p=a.PUBLIC_REDOCLY_BRANCH_NAME||"",v=p?L(p):"",m=v&&y[`${$}${v}`]||{};f=U(f,m,i)}const o=N(f,R);if(o.imports&&o.imports.length>0){d.warn("The 'imports' property is deprecated. Please use 'plugins' property instead.");const a=new Set([...o.plugins||[],...o.imports.map(u=>P.posix.join(u,"plugin.js"))]);o.plugins=Array.from(a),delete o.imports}if(o.catalog&&(d.warn("The 'catalog' property is deprecated. Please use 'catalogClassic' property instead."),o.catalogClassic={...o.catalog},delete o.catalog),o.scorecard&&(d.warn("The 'scorecard' property is deprecated. Please use 'scorecardClassic' property instead."),o.scorecardClassic=o.scorecard,delete o.scorecard),o.search?.ai){d.warn("The 'search.ai' property is deprecated. Please use 'aiAssistant' property instead.");const a={...o.search?.ai,...o.aiAssistant,suggestions:o.aiAssistant?.suggestions?.length?o.aiAssistant.suggestions:o.search?.ai.suggestions||[]};o.aiAssistant=a,delete o.search.ai}return I(o)}function I(s){const e="access"in s?s.access:void 0;if(!e||typeof e!="object")return s;const t={...s},r=[{name:"requiresLogin",type:"boolean"},{name:"logoutReturnUrl",type:"string"},{name:"residency",type:"string"},{name:"sso",type:"string | string[]"},{name:"rbac",type:"object"}],n=[];for(const h of r){const l=h.name;l in t&&t[l]!==void 0&&!(l in e)&&n.push(l)}return n.length>0&&d.warn(`The following properties at root level are deprecated: ${n.join(", ")}. Please move them to the 'access' object.`),"requiresLogin"in e&&e.requiresLogin!==void 0&&(t.requiresLogin=e.requiresLogin),"logoutReturnUrl"in e&&e.logoutReturnUrl!==void 0&&(t.logoutReturnUrl=e.logoutReturnUrl),"residency"in e&&e.residency!==void 0&&(t.residency=e.residency),"sso"in e&&e.sso!==void 0&&(t.sso=e.sso),"rbac"in e&&e.rbac!==void 0&&(t.rbac=e.rbac),delete t.access,t}function M(s){if(!s.theme)return[];const e=[];for(const t of Object.keys(s.theme))s[t]==null?e.push(t):d.warn(`Detected both '${t}' and 'theme.${t}' properties in redocly.yaml. The 'theme.${t}' property will be ignored and needs to be removed or merged into the '${t}'.`);return e}function N(s,e){if(!s.theme||e.length===0)return s;const t={...s};for(const r of e)t[r]=s.theme[r];return delete t.theme,t}export{X as readAndValidateConfig};
1
+ import P from"path";import{lintConfig as C,loadConfig as T,createConfigTypes as A}from"@redocly/openapi-core";import{deepMerge as U}from"../../../../../utils/object/deep-merge.js";import{logger as d}from"../../../../tools/notifiers/logger.js";import{BRANCH_ENV_PREFIX as $}from"../../../../../constants/common.js";import{sanitizeBranchName as L}from"../../../../utils/envs/sanitize-branch-name.js";import{safeParsePartial as E}from"../../safe-parse.js";import{formatConfigProblem as q}from"../../format-error.js";import{ExternalResolver as x}from"../../../../fs/utils/external-ref-resolver.js";import{resolveMutuallyExclusiveProps as B}from"../../resolve-mutual-exclusion.js";function g(s,e,t,r){e in s&&s[e]&&typeof s[e]=="string"&&(/^https?:\/\/.*/.test(s[e])||r(new Error(`Invalid ${t} URL: "${s[e]}". ${t} must start with "http://" or "https://".`)))}function j(s,e){if("access"in s&&s.access&&typeof s.access=="object"){const t=s.access;g(t,"logoutReturnUrl","access.logoutReturnUrl",e),g(t,"residency","access.residency",e);const r=["requiresLogin","logoutReturnUrl","residency","sso","rbac"];for(const n of r)n in t&&t[n]!==void 0&&n in s&&s[n]!==void 0&&e(new Error(`Property '${n}' is defined both at root level and in 'access' object. Please use 'access.${n}' to define this configuration.`))}}async function X(s,e,t,r){const h=e.getFileInfo(s)?.realRelativePath||s;async function l(){const a=new x(e),u=P.join(e.cwd,h),i=await T({configPath:u,externalRefResolver:a}),p=await r(i.resolvedConfig);if(p===void 0)return i.resolvedConfig;const m=[...i.document?.source?await C({config:i,externalConfigTypes:A(p,i)}):[],...i.document?.source?B(i.resolvedConfig,i.document?.source):[]];if(m.length>0)for(const b of m)t(new Error(q(b,e.cwd)));return i.resolvedConfig}const c=await e.exists(s)?await l():{},R=M(c),w=await r(c);g(c,"residency","Residency",t),g(c,"logoutReturnUrl","Logout return URL",t),j(c,t);let f=w?E(w,c):c;const{env:y}=f;if(y){const{envConfig:a}=await import("../../../../config/env-config.js"),u=a.redoclyEnv,i=y[u]||{},p=a.PUBLIC_REDOCLY_BRANCH_NAME||"",v=p?L(p):"",m=v&&y[`${$}${v}`]||{};f=U(f,m,i)}const o=N(f,R);if(o.imports&&o.imports.length>0){d.warn("The 'imports' property is deprecated. Please use 'plugins' property instead.");const a=new Set([...o.plugins||[],...o.imports.map(u=>P.posix.join(u,"plugin.js"))]);o.plugins=Array.from(a),delete o.imports}if(o.catalog&&(d.warn("The 'catalog' property is deprecated. Please use 'catalogClassic' property instead."),o.catalogClassic={...o.catalog},delete o.catalog),o.scorecard&&(d.warn("The 'scorecard' property is deprecated. Please use 'scorecardClassic' property instead."),o.scorecardClassic=o.scorecard,delete o.scorecard),o.search?.ai){d.warn("The 'search.ai' property is deprecated. Please use 'aiAssistant' property instead.");const a={...o.search?.ai,...o.aiAssistant,suggestions:o.aiAssistant?.suggestions?.length?o.aiAssistant.suggestions:o.search?.ai.suggestions||[]};o.aiAssistant=a,delete o.search.ai}return I(o)}function I(s){const e="access"in s?s.access:void 0;if(!e||typeof e!="object")return s;const t={...s},r=[{name:"requiresLogin",type:"boolean"},{name:"logoutReturnUrl",type:"string"},{name:"residency",type:"string"},{name:"sso",type:"string | string[]"},{name:"rbac",type:"object"}],n=[];for(const h of r){const l=h.name;l in t&&t[l]!==void 0&&!(l in e)&&n.push(l)}return n.length>0&&d.warn(`The following properties at root level are deprecated: ${n.join(", ")}. Please move them to the 'access' object.`),"requiresLogin"in e&&e.requiresLogin!==void 0&&(t.requiresLogin=e.requiresLogin),"logoutReturnUrl"in e&&e.logoutReturnUrl!==void 0&&(t.logoutReturnUrl=e.logoutReturnUrl),"residency"in e&&e.residency!==void 0&&(t.residency=e.residency),"sso"in e&&e.sso!==void 0&&(t.sso=e.sso),"rbac"in e&&e.rbac!==void 0&&(t.rbac=e.rbac),delete t.access,t}function M(s){if(!s.theme)return[];const e=[];for(const t of Object.keys(s.theme))s[t]==null?e.push(t):d.warn(`Detected both '${t}' and 'theme.${t}' properties in redocly.yaml. The 'theme.${t}' property will be ignored and needs to be removed or merged into the '${t}'.`);return e}function N(s,e){if(!s.theme||e.length===0)return s;const t={...s};for(const r of e)t[r]=s.theme[r];return delete t.theme,t}export{X as readAndValidateConfig};
@@ -1 +1 @@
1
- import{REDOCLY_TEAMS_RBAC as c}from"@redocly/config";import{DEV_LOGIN_SLUG as g,INVITE_SLUG as h,PUBLIC_RBAC_SCOPE_ITEM as m,UI_ACCESSIBLE_CONFIG_PROPS as P,CONFIG_FILE_NAME as n,DEFAULT_SSO_IDP_TITLE as _}from"../../../constants/common.js";import{envConfig as T}from"../../../config/env-config.js";import{getTemplatePath as s}from"./get-template-path.js";import{resolveLinksFromConfig as p}from"../nav-utils.js";import{resolveLogoConfig as F}from"./resolve-logo.js";import{extractTeamNames as E}from"./extract-team-names.js";import{resolveProductsConfig as O}from"./resolve-products-config.js";import{getExcludedFromLinkCheckerPatterns as y}from"../sidebars/utils.js";import{resolveEntitiesCatalogConfig as A}from"./resolve-catalog-entities.js";import{telemetryTraceStep as j}from"../../../cli/telemetry/helpers/trace-step.js";async function q(r){return{id:"Default Theme",async processContent(e){await j("build.plugin.default_theme",async()=>{const t=v(e),o=Object.keys(e.getConfig()?.ssoDirect||{}).length>0,a=e.createTemplate("invite",s("../../../../dist/client/app/pages/Invite/Invite.js"));if(e.addRoute({duplicateInAllLocales:!0,excludeFromSidebar:!0,excludeFromSearch:!0,slug:h,[c]:m,fsPath:h,templateId:a}),r.devLogin&&o){const i={frontmatter:{},seo:{title:"Login page"},authIdps:S(t),rbac:{teams:E(e.getConfig().rbac)}},l=e.createTemplate("dev-login",s("../../../../dist/client/app/pages/DevLogin/DevLogin.js"));e.addRoute({duplicateInAllLocales:!0,excludeFromSidebar:!0,excludeFromSearch:!0,slug:g,[c]:m,fsPath:g,templateId:l,getStaticData:async()=>({props:i})})}else if(t.length>1){const i={frontmatter:{},seo:{title:"Login page"},authIdps:S(t)},l=e.createTemplate("login",s("../../../../dist/client/app/pages/Login/Login.js"));e.addRoute({duplicateInAllLocales:!0,excludeFromSidebar:!0,slug:g,[c]:m,fsPath:g,templateId:l,getStaticData:async()=>({props:i})})}e.createTemplate("404",s("../../../../dist/client/app/pages/404/404.js")),e.createTemplate("403",s("../../../../dist/client/app/pages/403/403.js")),e.createTemplate("403OIDC",s("../../../../dist/client/app/pages/403/403OIDC.js")),T.isDevelopMode&&e.createTemplate("compilation-error",s("../../../../dist/client/app/pages/CompilationError/CompilationError.js"))})},async afterRoutesCreated(e,t){const{contentDir:o,outdir:a}=e,i=e.getConfig(),{navbar:l,footer:D,userMenu:u,search:f,breadcrumbs:I,products:b}=i,C=Object.keys(i?.ssoDirect||{}).length>0,d=y(i),L={navFile:n,excludedFromLinkCheckerPatterns:d};e.setGlobalData({...k(i),navbar:await p(l,o,e,t,L),footer:await p(D,o,e,t,L),breadcrumbs:{...I,prefixItems:await p(I?.prefixItems||[],o,e,t,{navFile:n,excludedFromLinkCheckerPatterns:d})},userMenu:{...u,hide:u?.hide??!C,menu:await p(u?.items,o,e,t,{navFile:n,excludedFromLinkCheckerPatterns:d})},logo:await F(i.logo,n,a,t.fs),auth:{idpsInfo:v(e),devLogin:r.devLogin&&C},products:await O(b,e,t),search:{...f,suggestedPages:await p(f?.suggestedPages,o,e,t,{navFile:n,excludedFromLinkCheckerPatterns:d})},entitiesCatalog:await A(i.entitiesCatalog,n,a,t.fs),headScriptTags:void 0,linkTags:void 0,postBodyScriptTags:void 0,preBodyScriptTags:void 0})}}}function v(r){const e=r.getConfig().ssoDirect;return Object.entries(e||{}).map(([o,a])=>({idpId:o,type:a.type,title:a.title}))}function S(r){return T.LOCALHOST_LOGIN==="true"?r:r.filter(t=>t.title!==_)}function k(r){const e={};for(const t of P)r[t]&&(e[t]=r[t]);return e}export{q as defaultThemePlugin,k as pickUiAccessibleConfig};
1
+ import{REDOCLY_TEAMS_RBAC as c}from"@redocly/config";import{DEV_LOGIN_SLUG as g,INVITE_SLUG as h,PUBLIC_RBAC_SCOPE_ITEM as m,UI_ACCESSIBLE_CONFIG_PROPS as P,CONFIG_FILE_NAME as n,DEFAULT_SSO_IDP_TITLE as _}from"../../../constants/common.js";import{envConfig as T}from"../../config/env-config.js";import{getTemplatePath as s}from"./get-template-path.js";import{resolveLinksFromConfig as p}from"../nav-utils.js";import{resolveLogoConfig as F}from"./resolve-logo.js";import{extractTeamNames as E}from"./extract-team-names.js";import{resolveProductsConfig as O}from"./resolve-products-config.js";import{getExcludedFromLinkCheckerPatterns as y}from"../sidebars/utils.js";import{resolveEntitiesCatalogConfig as A}from"./resolve-catalog-entities.js";import{telemetryTraceStep as j}from"../../../cli/telemetry/helpers/trace-step.js";async function q(r){return{id:"Default Theme",async processContent(e){await j("build.plugin.default_theme",async()=>{const t=v(e),o=Object.keys(e.getConfig()?.ssoDirect||{}).length>0,a=e.createTemplate("invite",s("../../../../dist/client/app/pages/Invite/Invite.js"));if(e.addRoute({duplicateInAllLocales:!0,excludeFromSidebar:!0,excludeFromSearch:!0,slug:h,[c]:m,fsPath:h,templateId:a}),r.devLogin&&o){const i={frontmatter:{},seo:{title:"Login page"},authIdps:S(t),rbac:{teams:E(e.getConfig().rbac)}},l=e.createTemplate("dev-login",s("../../../../dist/client/app/pages/DevLogin/DevLogin.js"));e.addRoute({duplicateInAllLocales:!0,excludeFromSidebar:!0,excludeFromSearch:!0,slug:g,[c]:m,fsPath:g,templateId:l,getStaticData:async()=>({props:i})})}else if(t.length>1){const i={frontmatter:{},seo:{title:"Login page"},authIdps:S(t)},l=e.createTemplate("login",s("../../../../dist/client/app/pages/Login/Login.js"));e.addRoute({duplicateInAllLocales:!0,excludeFromSidebar:!0,slug:g,[c]:m,fsPath:g,templateId:l,getStaticData:async()=>({props:i})})}e.createTemplate("404",s("../../../../dist/client/app/pages/404/404.js")),e.createTemplate("403",s("../../../../dist/client/app/pages/403/403.js")),e.createTemplate("403OIDC",s("../../../../dist/client/app/pages/403/403OIDC.js")),T.isDevelopMode&&e.createTemplate("compilation-error",s("../../../../dist/client/app/pages/CompilationError/CompilationError.js"))})},async afterRoutesCreated(e,t){const{contentDir:o,outdir:a}=e,i=e.getConfig(),{navbar:l,footer:D,userMenu:u,search:f,breadcrumbs:I,products:b}=i,C=Object.keys(i?.ssoDirect||{}).length>0,d=y(i),L={navFile:n,excludedFromLinkCheckerPatterns:d};e.setGlobalData({...k(i),navbar:await p(l,o,e,t,L),footer:await p(D,o,e,t,L),breadcrumbs:{...I,prefixItems:await p(I?.prefixItems||[],o,e,t,{navFile:n,excludedFromLinkCheckerPatterns:d})},userMenu:{...u,hide:u?.hide??!C,menu:await p(u?.items,o,e,t,{navFile:n,excludedFromLinkCheckerPatterns:d})},logo:await F(i.logo,n,a,t.fs),auth:{idpsInfo:v(e),devLogin:r.devLogin&&C},products:await O(b,e,t),search:{...f,suggestedPages:await p(f?.suggestedPages,o,e,t,{navFile:n,excludedFromLinkCheckerPatterns:d})},entitiesCatalog:await A(i.entitiesCatalog,n,a,t.fs),headScriptTags:void 0,linkTags:void 0,postBodyScriptTags:void 0,preBodyScriptTags:void 0})}}}function v(r){const e=r.getConfig().ssoDirect;return Object.entries(e||{}).map(([o,a])=>({idpId:o,type:a.type,title:a.title}))}function S(r){return T.LOCALHOST_LOGIN==="true"?r:r.filter(t=>t.title!==_)}function k(r){const e={};for(const t of P)r[t]&&(e[t]=r[t]);return e}export{q as defaultThemePlugin,k as pickUiAccessibleConfig};
@@ -1 +1 @@
1
- import{writeFileSync as P}from"node:fs";import T from"path";import{PAGE_COUNT_OUTPUT_FILE_NAME as y}from"../../constants/common.js";import{envConfig as F}from"../../../config/env-config.js";import{logger as o}from"../../tools/notifiers/logger.js";import{isReactPage as S}from"../../utils/content/is-react-page.js";import{EntitlementsProvider as b}from"../../entitlements/entitlements-provider.js";import{getBilledPagesCount as O,isPathIgnored as R}from"../../utils/index.js";import{isGraphqlDoc as $}from"../graphql-docs/is-graphql-doc.js";import{isMarkdownPage as M}from"../markdown/is-markdown-page.js";import{isOpenapiDoc as k}from"../openapi-docs/is-openapi-doc.js";import{PRODUCT_NAME as l}from"../../../config/product-gates.js";import{isAsyncapiDoc as E}from"../asyncapi-docs/is-asyncapi-doc.js";import{telemetryTraceStep as _}from"../../../cli/telemetry/helpers/trace-step.js";async function z(){return{id:"entitlements",async afterRoutesCreated(w,u){await _("build.plugin.entitlements",async t=>{const i=b.instance(),n=[],r=[],s=[],a=[],p=[];for(const{relativePath:e}of u.fs.scan())R(e)||(M(e)?n.push(e):$(e)?s.push(e):S(e)?a.push(e):await k(e,u)?r.push(e):await E(e,u)&&p.push(e));const g=i.canAccessFeature("markdown");t?.setAttribute("totalMarkdownFiles",n.length.toString()),t?.setAttribute("isMarkdownSupported",(!!g).toString()),n.length>0&&!g&&o.warn(`The product you are using ("${l}") does not support Markdown pages. The following Markdown files were detected but will be ignored: ${n.map(()=>"%rp").join(", ")}`,...n);const c=i.canAccessFeature("openapi");t?.setAttribute("totalOpenApiFiles",r.length.toString()),t?.setAttribute("isOpenApiSupported",(!!c).toString()),r.length>0&&!c&&o.warn(`The product you are using ("${l}") does not support OpenAPI documents. The following files are ignored: ${r.map(()=>"%rp").join(", ")}`,...r);const d=i.canAccessFeature("asyncapi");t?.setAttribute("totalAsyncApiFiles",p.length.toString()),t?.setAttribute("isAsyncApiSupported",(!!d).toString()),p.length>0&&!d&&o.warn(`The product you are using ("${l}") does not support AsyncAPI documents. The following files are ignored: ${p.map(()=>"%rp").join(", ")}`,...p);const m=i.canAccessFeature("graphql");t?.setAttribute("totalGraphqlFiles",s.length.toString()),t?.setAttribute("isGraphqlSupported",(!!m).toString()),s.length>0&&!m&&o.warn(`The product you are using ("${l}") does not support GraphQL documents. The following files are ignored: ${s.map(()=>"%rp").join(", ")}`,...s);const f=i.canAccessFeature("reactPages");t?.setAttribute("totalReactFiles",a.length.toString()),t?.setAttribute("isReactPagesSupported",(!!f).toString()),a.length>0&&!f&&o.warn(`The product you are using ("${l}") does not support React pages. The following files are ignored: ${a.map(()=>"%rp").join(", ")}`,...a);const A=O(w.getAllRoutes());t?.setAttribute("totalBilledPages",A.toString());const h=F.REDOCLY_METADATA_OUTPUT_FOLDER;h&&(o.info("Save total pages..."),P(T.join(h,y),JSON.stringify({totalPages:A},null)))})}}}export{z as entitlementsPlugin};
1
+ import{writeFileSync as P}from"node:fs";import T from"path";import{PAGE_COUNT_OUTPUT_FILE_NAME as y}from"../../constants/common.js";import{envConfig as F}from"../../config/env-config.js";import{logger as o}from"../../tools/notifiers/logger.js";import{isReactPage as S}from"../../utils/content/is-react-page.js";import{EntitlementsProvider as b}from"../../entitlements/entitlements-provider.js";import{getBilledPagesCount as O,isPathIgnored as R}from"../../utils/index.js";import{isGraphqlDoc as $}from"../graphql-docs/is-graphql-doc.js";import{isMarkdownPage as M}from"../markdown/is-markdown-page.js";import{isOpenapiDoc as k}from"../openapi-docs/is-openapi-doc.js";import{PRODUCT_NAME as l}from"../../../config/product-gates.js";import{isAsyncapiDoc as E}from"../asyncapi-docs/is-asyncapi-doc.js";import{telemetryTraceStep as _}from"../../../cli/telemetry/helpers/trace-step.js";async function z(){return{id:"entitlements",async afterRoutesCreated(w,u){await _("build.plugin.entitlements",async t=>{const i=b.instance(),n=[],r=[],s=[],a=[],p=[];for(const{relativePath:e}of u.fs.scan())R(e)||(M(e)?n.push(e):$(e)?s.push(e):S(e)?a.push(e):await k(e,u)?r.push(e):await E(e,u)&&p.push(e));const g=i.canAccessFeature("markdown");t?.setAttribute("totalMarkdownFiles",n.length.toString()),t?.setAttribute("isMarkdownSupported",(!!g).toString()),n.length>0&&!g&&o.warn(`The product you are using ("${l}") does not support Markdown pages. The following Markdown files were detected but will be ignored: ${n.map(()=>"%rp").join(", ")}`,...n);const c=i.canAccessFeature("openapi");t?.setAttribute("totalOpenApiFiles",r.length.toString()),t?.setAttribute("isOpenApiSupported",(!!c).toString()),r.length>0&&!c&&o.warn(`The product you are using ("${l}") does not support OpenAPI documents. The following files are ignored: ${r.map(()=>"%rp").join(", ")}`,...r);const d=i.canAccessFeature("asyncapi");t?.setAttribute("totalAsyncApiFiles",p.length.toString()),t?.setAttribute("isAsyncApiSupported",(!!d).toString()),p.length>0&&!d&&o.warn(`The product you are using ("${l}") does not support AsyncAPI documents. The following files are ignored: ${p.map(()=>"%rp").join(", ")}`,...p);const m=i.canAccessFeature("graphql");t?.setAttribute("totalGraphqlFiles",s.length.toString()),t?.setAttribute("isGraphqlSupported",(!!m).toString()),s.length>0&&!m&&o.warn(`The product you are using ("${l}") does not support GraphQL documents. The following files are ignored: ${s.map(()=>"%rp").join(", ")}`,...s);const f=i.canAccessFeature("reactPages");t?.setAttribute("totalReactFiles",a.length.toString()),t?.setAttribute("isReactPagesSupported",(!!f).toString()),a.length>0&&!f&&o.warn(`The product you are using ("${l}") does not support React pages. The following files are ignored: ${a.map(()=>"%rp").join(", ")}`,...a);const A=O(w.getAllRoutes());t?.setAttribute("totalBilledPages",A.toString());const h=F.REDOCLY_METADATA_OUTPUT_FOLDER;h&&(o.info("Save total pages..."),P(T.join(h,y),JSON.stringify({totalPages:A},null)))})}}}export{z as entitlementsPlugin};
@@ -1 +1 @@
1
- import{writeFileSync as C}from"node:fs";import $ from"node:path";import{REDOCLY_TEAMS_RBAC as v}from"@redocly/config";import{combineUrls as I}from"@redocly/theme/core/utils";import{PUBLIC_API_DEFINITIONS_FOLDER as w}from"../../constants/common.js";import{GRAPHQL_TEMPLATE_ID as H,GRAPHQL_SPEC_SLUG as N,PUBLIC_RBAC_SCOPE_ITEM as O}from"../../../constants/common.js";import{removeTrailingSlash as _}from"../../../utils/url/remove-trailing-slash.js";import{getTemplatePath as Q}from"./get-template-path.js";import{searchResolver as F}from"./search/search-resolver.js";import{graphqlDocLoader as M}from"./graphql-doc-loader.js";import{getAiDocumentsStore as A}from"./search/ai/get-ai-search-document.js";import{fromCurrentDir as U}from"../../utils/paths.js";import{ensureDir as k}from"../../utils/fs.js";import{telemetryTraceStep as x}from"../../../cli/telemetry/helpers/trace-step.js";const B="graphql-docs-",L="graphql-spec-download";async function nt(){return{id:"graphql",requiredEntitlements:["graphql"],loaders:{"graphql-doc":M},processContent:async(t,{fs:l,cache:i,isPathIgnored:u,withPathPrefix:p})=>{await x("build.plugin.graphql_docs",async()=>{t.createRequestHandler(L,U(import.meta.url,"./spec-download.api.js")),t.addApiRoute({slug:N+"/*",requestHandlerId:L,httpMethod:"all",[v]:O,getStaticData:async()=>({props:{}})});const m=t.createTemplate(H,Q("./template/GraphQLDocs.js"));for(const{relativePath:s}of l.scan(/(\.gql|\.graphql)$/)){if(await u(s))continue;const D=await i.load(s,"graphql-doc");if(!D.data)continue;j(D.data.content,t.outdir,s);const{menu:q,content:T,settings:n,metadata:y,store:d}=D.data,R=`${B}${s}`;await t.createSharedData(R,T);const c=[{key:"graphQlSettings",id:R}],b=q.getGroups(),G=q.getSidebarItems(),g={type:"graphql",title:n.metadata?.title||b[0].name,...y},e=[{slugSuffix:"",fsPath:s,templateId:m,getStaticData:h(void 0,n,p),sharedData:c,getAiDocumentsStore:A({label:n.info?.title??"GraphQL Overview",groupName:"overview",metadata:g,actions:t,store:d,includeInLLMsTxt:!0})}];for(const o of b){const S=`${o.id}`;e.push({slugSuffix:S,fsPath:s,templateId:m,getStaticData:h(o,n,p),sharedData:c});for(const a of o.typeGroups){const r=`${a.id}`;e.push({slugSuffix:r,fsPath:s,templateId:m,getStaticData:h(a,n,p),sharedData:c,getAiDocumentsStore:A({label:a.name,groupName:a.name,metadata:g,actions:t,store:d,isTypeGroup:!0,items:new Set(a.items)})});for(const E of a.items){const P=`${a.id}/${E}`;e.push({slugSuffix:P,fsPath:s,templateId:m,getStaticData:h(a,n,p),sharedData:c,getAiDocumentsStore:A({label:E,groupName:a.name,metadata:g,actions:t,store:d})})}}}if(!e.length)return;const f=e[0];e[0]=e[e.length-1],e[e.length-1]=f,f.metadata=g,f.getSidebar=o=>{function S(a){return a.map(r=>({...r,slug:r.slug&&_(I(o.baseSlug,r.slug)),routeSlug:r.routeSlug&&_(I(o.baseSlug,r.routeSlug)),link:r.link&&_(I(o.baseSlug,r.link)),items:r.items&&S(r.items)}))}return S(G)},f.getSearchDocuments=F(t,d);for(const o of e)t.addRoute(o)}})}}}function h(t,l,i){return async function(u){return{props:{seo:{title:t?.name},settings:{...l,location:{section:t?.id},sidebar:{hide:!0},baseUrlPath:i(u.baseSlug)},disableAutoScroll:!0}}}}function j(t,l,i){const u=w.slice(1);C(k($.resolve(l,`${u}/${i}`)),t,"utf8")}export{nt as graphqlDocsPlugin,j as storeGqlSchema};
1
+ import{writeFileSync as v}from"node:fs";import $ from"node:path";import{REDOCLY_TEAMS_RBAC as w}from"@redocly/config";import{combineUrls as _}from"@redocly/theme/core/utils";import{PUBLIC_API_DEFINITIONS_FOLDER as F}from"../../constants/common.js";import{GRAPHQL_TEMPLATE_ID as N,GRAPHQL_SPEC_SLUG as H,PUBLIC_RBAC_SCOPE_ITEM as M}from"../../../constants/common.js";import{removeTrailingSlash as I}from"../../../utils/url/remove-trailing-slash.js";import{getTemplatePath as Q}from"./get-template-path.js";import{searchResolver as U}from"./search/search-resolver.js";import{graphqlDocLoader as k}from"./graphql-doc-loader.js";import{getAiDocumentsStore as E}from"./search/ai/get-ai-search-document.js";import{fromCurrentDir as x}from"../../utils/paths.js";import{ensureDir as B}from"../../utils/fs.js";import{telemetryTraceStep as j}from"../../../cli/telemetry/helpers/trace-step.js";import{OPENAPI_CUSTOM_FIELDS_SERVER_PROPS_GETTER_ID as K}from"../../constants/plugins/openapi-docs.js";const V="graphql-docs-",L="graphql-spec-download";async function pt(){return{id:"graphql",requiredEntitlements:["graphql"],loaders:{"graphql-doc":k},processContent:async(t,{fs:l,cache:i,isPathIgnored:u,withPathPrefix:m,getConfig:T})=>{await j("build.plugin.graphql_docs",async()=>{t.createRequestHandler(L,x(import.meta.url,"./spec-download.api.js"));const b=!!(await T()).rules?.["custom-fields-schema"];t.addApiRoute({slug:H+"/*",requestHandlerId:L,httpMethod:"all",[w]:M,getStaticData:async()=>({props:{}})});const p=t.createTemplate(N,Q("./template/GraphQLDocs.js"));for(const{relativePath:s}of l.scan(/(\.gql|\.graphql)$/)){if(await u(s))continue;const D=await i.load(s,"graphql-doc");if(!D.data)continue;W(D.data.content,t.outdir,s);const{menu:R,content:G,settings:n,metadata:C,store:c}=D.data,A=`${V}${s}`;await t.createSharedData(A,G);const d=[{key:"graphQlSettings",id:A}],q=R.getGroups(),y=R.getSidebarItems(),g={type:"graphql",title:n.metadata?.title||q[0].name,...C},e=[{slugSuffix:"",fsPath:s,templateId:p,getStaticData:h(void 0,n,m),sharedData:d,getAiDocumentsStore:E({label:n.info?.title??"GraphQL Overview",groupName:"overview",metadata:g,actions:t,store:c,includeInLLMsTxt:!0}),serverPropsGetterIds:b?[K]:[]}];for(const o of q){const S=`${o.id}`;e.push({slugSuffix:S,fsPath:s,templateId:p,getStaticData:h(o,n,m),sharedData:d});for(const a of o.typeGroups){const r=`${a.id}`;e.push({slugSuffix:r,fsPath:s,templateId:p,getStaticData:h(a,n,m),sharedData:d,getAiDocumentsStore:E({label:a.name,groupName:a.name,metadata:g,actions:t,store:c,isTypeGroup:!0,items:new Set(a.items)})});for(const P of a.items){const O=`${a.id}/${P}`;e.push({slugSuffix:O,fsPath:s,templateId:p,getStaticData:h(a,n,m),sharedData:d,getAiDocumentsStore:E({label:P,groupName:a.name,metadata:g,actions:t,store:c})})}}}if(!e.length)return;const f=e[0];e[0]=e[e.length-1],e[e.length-1]=f,f.metadata=g,f.getSidebar=o=>{function S(a){return a.map(r=>({...r,slug:r.slug&&I(_(o.baseSlug,r.slug)),routeSlug:r.routeSlug&&I(_(o.baseSlug,r.routeSlug)),link:r.link&&I(_(o.baseSlug,r.link)),items:r.items&&S(r.items)}))}return S(y)},f.getSearchDocuments=U(t,c);for(const o of e)t.addRoute(o)}})}}}function h(t,l,i){return async function(u){return{props:{seo:{title:t?.name},settings:{...l,location:{section:t?.id},sidebar:{hide:!0},baseUrlPath:i(u.baseSlug)},disableAutoScroll:!0}}}}function W(t,l,i){const u=F.slice(1);v(B($.resolve(l,`${u}/${i}`)),t,"utf8")}export{pt as graphqlDocsPlugin,W as storeGqlSchema};
@@ -1,2 +1,2 @@
1
- import x from"@redocly/portal-plugin-mock-server";import O from"path";import{REDOCLY_ROUTE_RBAC as N}from"@redocly/config";import{combineUrls as E,withPathPrefix as L}from"@redocly/theme/core/utils";import{VERSION_SEPARATOR as V}from"../constants/common.js";import{removeTrailingSlash as F}from"../../utils/url/remove-trailing-slash.js";import{removeLeadingSlash as j}from"../../utils/url/remove-leading-slash.js";import{isTruthy as k}from"../../utils/guards/is-truthy.js";import{normalizeRouteSlug as T}from"../../utils/path/normalize-route-slug.js";import{slash as $}from"../../utils/path/slash.js";import{parsePathVersions as M}from"../../utils/path/parse-path-versions.js";import{reporter as b}from"../tools/notifiers/reporter.js";import{logger as P}from"../tools/notifiers/logger.js";import{envConfig as A}from"../../config/env-config.js";import{shaDirPathShort as z}from"../utils/crypto/sha-dir-path-short.js";import{customPagesPlugin as q}from"../../server/plugins/pages/index.js";import{openAPIDocsPlugin as I}from"../../server/plugins/openapi-docs/index.js";import{asyncAPIDocsPlugin as U}from"../../server/plugins/asyncapi-docs/index.js";import{configParserPlugin as G}from"./config-parser/index.js";import{markdownPlugin as W}from"./markdown/index.js";import{generateBrowserPluginsModule as K,generateClientRoutes as H,generateTemplatesModule as Y}from"../esbuild/generate.js";import{graphqlDocsPlugin as J}from"./graphql-docs/index.js";import{searchPlugin as Q}from"./search/index.js";import{defaultThemePlugin as X}from"./default-theme/index.js";import{apiKeyMgmtPlugin as Z}from"./dev-onboarding/index.js";import{apiFunctionsPlugin as ee}from"./api-functions/index.js";import{scorecardClassicPlugin as te}from"./scorecard-classic/index.js";import{lintPlugin as oe}from"./lint/index.js";import{resolvePlugins as ie}from"../config/external-plugins.js";import{sidebarsPlugin as ne}from"./sidebars/index.js";import{l10nPlugin as re}from"./l10n/index.js";import{analyticsPlugins as se}from"./analytics/index.js";import{sitemapPlugin as ae}from"./sitemap/index.js";import{entitlementsPlugin as le}from"./entitlements/index.js";import{getBilledPagesCount as ce,slug as ue}from"../utils/index.js";import{telemetry as fe}from"../../cli/telemetry/index.js";import{telemetryTraceStep as D}from"../../cli/telemetry/helpers/trace-step.js";import{EntitlementsProvider as B}from"../entitlements/entitlements-provider.js";import{ssoPlugin as me}from"./sso/index.js";import{Cache as de}from"../fs/cache.js";import{ContentFs as pe}from"../fs/content-fs.js";import{findProductBySlug as ge}from"../utils/product.js";import{parseBaseName as Pe}from"./utils.js";import{isRouteReserved as he}from"./get-reserved-routes.js";import{catalogClassicPlugin as ye}from"./catalog-classic/index.js";import{arazzoDocsPlugin as we}from"./arazzo-docs/index.js";const Ce=[G,me,X,re,W,I,U,we,te,oe,ee,q,J,Z,ye,{importPath:"./catalog-entities/plugin.js",loadCondition:()=>A.NEW_CATALOG_ENABLED==="true"},{importPath:"./scorecards/plugin.js",loadCondition:()=>A.NEW_SCORECARDS_ENABLED==="true"},{importPath:"./mcp/index.js",loadCondition:()=>B.instance().canAccessFeature("mcp")},ne,ae,le,Q,x,...se];async function Pt(t,o=Ce){return await D("build.plugins_init",async()=>{const r=[],v=B.instance(),h={};for(const d of o){let a;if("loadCondition"in d){if(!d.loadCondition())continue;const e=await import(d.importPath);if(!e.default||typeof e.default!="function"){await b.panicOnBuild(`Dynamic plugin ${d.importPath} does not export a default export or it is not a function`);continue}a=e.default}else a=d;const p=await a(t);for(const[e,i]of Object.entries(p.loaders||{}))h[e]&&await b.panicOnBuild(`Duplicate loader with name ${e}`),h[e]=i;(!p.requiredEntitlements||p.requiredEntitlements?.every(e=>v.canAccessFeature(e)))&&r.push(p)}const s=new pe(t.contentDir);await s.ready;const m=new de(s);return m.setLoaders(h),P.verbose("All plugins instantiated"),{pluginInstances:r,lifecycleContext:Ee(s,m)}})}function _(t){P.verbose("Generating templates"),D("build.write_client_entries",()=>{Y(t),K(t),H(t)})}async function Re(t){const o=t.getAllRoutes();ce(o)||await b.panicOnBuild("No routes created by plugins. Please check your project configuration.")}async function ht(t,o,r,v={}){const h=B.instance();try{await D("build.plugins_run",async()=>{o.startPluginsRun();let s=[];await D("build.plugins_process_content",async a=>{for(const e of t){const i=P.startTiming();await e.processContent?.(o,r),P.verboseTime(i,`processContent for ${e.id}`)}s=(await ie(o.contentDir,o.config.plugins)).map(e=>e.lifecyclePlugin).filter(e=>k(e)&&(!e.requiredEntitlements||e.requiredEntitlements?.every(i=>h.canAccessFeature(i)))),r.cache.setLoaders(Object.fromEntries(s.flatMap(e=>Object.entries(e.loaders||{}))));for(const e of s){const i=P.startTiming();await e.processContent?.(o,r),P.verboseTime(i,`processContent for ${e.id}`)}a?.setAttribute("externalPluginsProcessed",s.length.toString())});const m=await ve(o,r),d=[...t,...s];_(o),A.isDevelopMode?await o.userCodeReady:o.buildRevision++,await D("build.plugins_after_routes_created",async()=>{for(const a of d){const p=P.startTiming();await a.afterRoutesCreated?.(o,m),P.verboseTime(p,`afterRoutesCreated for ${a.id}`)}}),await o.reportUnsetEnvVars(),await Re(o),_(o)})}catch(s){const m="Unhandled error in plugin. "+s.message+`
1
+ import x from"@redocly/portal-plugin-mock-server";import O from"path";import{REDOCLY_ROUTE_RBAC as N}from"@redocly/config";import{combineUrls as E,withPathPrefix as L}from"@redocly/theme/core/utils";import{VERSION_SEPARATOR as V}from"../constants/common.js";import{removeTrailingSlash as F}from"../../utils/url/remove-trailing-slash.js";import{removeLeadingSlash as j}from"../../utils/url/remove-leading-slash.js";import{isTruthy as k}from"../../utils/guards/is-truthy.js";import{normalizeRouteSlug as T}from"../../utils/path/normalize-route-slug.js";import{slash as $}from"../../utils/path/slash.js";import{parsePathVersions as M}from"../../utils/path/parse-path-versions.js";import{reporter as b}from"../tools/notifiers/reporter.js";import{logger as P}from"../tools/notifiers/logger.js";import{envConfig as A}from"../config/env-config.js";import{shaDirPathShort as z}from"../utils/crypto/sha-dir-path-short.js";import{customPagesPlugin as q}from"../../server/plugins/pages/index.js";import{openAPIDocsPlugin as I}from"../../server/plugins/openapi-docs/index.js";import{asyncAPIDocsPlugin as U}from"../../server/plugins/asyncapi-docs/index.js";import{configParserPlugin as G}from"./config-parser/index.js";import{markdownPlugin as W}from"./markdown/index.js";import{generateBrowserPluginsModule as K,generateClientRoutes as H,generateTemplatesModule as Y}from"../esbuild/generate.js";import{graphqlDocsPlugin as J}from"./graphql-docs/index.js";import{searchPlugin as Q}from"./search/index.js";import{defaultThemePlugin as X}from"./default-theme/index.js";import{apiKeyMgmtPlugin as Z}from"./dev-onboarding/index.js";import{apiFunctionsPlugin as ee}from"./api-functions/index.js";import{scorecardClassicPlugin as te}from"./scorecard-classic/index.js";import{lintPlugin as oe}from"./lint/index.js";import{resolveExternalPlugins as ie}from"../external-plugins/resolve-external-plugins.js";import{sidebarsPlugin as ne}from"./sidebars/index.js";import{l10nPlugin as re}from"./l10n/index.js";import{analyticsPlugins as se}from"./analytics/index.js";import{sitemapPlugin as ae}from"./sitemap/index.js";import{entitlementsPlugin as le}from"./entitlements/index.js";import{getBilledPagesCount as ce,slug as ue}from"../utils/index.js";import{telemetry as fe}from"../../cli/telemetry/index.js";import{telemetryTraceStep as D}from"../../cli/telemetry/helpers/trace-step.js";import{EntitlementsProvider as B}from"../entitlements/entitlements-provider.js";import{ssoPlugin as me}from"./sso/index.js";import{Cache as de}from"../fs/cache.js";import{ContentFs as pe}from"../fs/content-fs.js";import{findProductBySlug as ge}from"../utils/product.js";import{parseBaseName as Pe}from"./utils.js";import{isRouteReserved as he}from"./get-reserved-routes.js";import{catalogClassicPlugin as ye}from"./catalog-classic/index.js";import{arazzoDocsPlugin as we}from"./arazzo-docs/index.js";const Ce=[G,me,X,re,W,I,U,we,te,oe,ee,q,J,Z,ye,{importPath:"./catalog-entities/plugin.js",loadCondition:()=>A.NEW_CATALOG_ENABLED==="true"},{importPath:"./scorecards/plugin.js",loadCondition:()=>A.NEW_SCORECARDS_ENABLED==="true"},{importPath:"./mcp/index.js",loadCondition:()=>B.instance().canAccessFeature("mcp")},ne,ae,le,Q,x,...se];async function Pt(t,o=Ce){return await D("build.plugins_init",async()=>{const r=[],v=B.instance(),h={};for(const d of o){let a;if("loadCondition"in d){if(!d.loadCondition())continue;const e=await import(d.importPath);if(!e.default||typeof e.default!="function"){await b.panicOnBuild(`Dynamic plugin ${d.importPath} does not export a default export or it is not a function`);continue}a=e.default}else a=d;const p=await a(t);for(const[e,i]of Object.entries(p.loaders||{}))h[e]&&await b.panicOnBuild(`Duplicate loader with name ${e}`),h[e]=i;(!p.requiredEntitlements||p.requiredEntitlements?.every(e=>v.canAccessFeature(e)))&&r.push(p)}const s=new pe(t.contentDir);await s.ready;const m=new de(s);return m.setLoaders(h),P.verbose("All plugins instantiated"),{pluginInstances:r,lifecycleContext:Ee(s,m)}})}function _(t){P.verbose("Generating templates"),D("build.write_client_entries",()=>{Y(t),K(t),H(t)})}async function Re(t){const o=t.getAllRoutes();ce(o)||await b.panicOnBuild("No routes created by plugins. Please check your project configuration.")}async function ht(t,o,r,v={}){const h=B.instance();try{await D("build.plugins_run",async()=>{o.startPluginsRun();let s=[];await D("build.plugins_process_content",async a=>{for(const e of t){const i=P.startTiming();await e.processContent?.(o,r),P.verboseTime(i,`processContent for ${e.id}`)}s=(await ie(o.contentDir,o.config.plugins)).map(e=>e.lifecyclePlugin).filter(e=>k(e)&&(!e.requiredEntitlements||e.requiredEntitlements?.every(i=>h.canAccessFeature(i)))),r.cache.setLoaders(Object.fromEntries(s.flatMap(e=>Object.entries(e.loaders||{}))));for(const e of s){const i=P.startTiming();await e.processContent?.(o,r),P.verboseTime(i,`processContent for ${e.id}`)}a?.setAttribute("externalPluginsProcessed",s.length.toString())});const m=await ve(o,r),d=[...t,...s];_(o),A.isDevelopMode?await o.userCodeReady:o.buildRevision++,await D("build.plugins_after_routes_created",async()=>{for(const a of d){const p=P.startTiming();await a.afterRoutesCreated?.(o,m),P.verboseTime(p,`afterRoutesCreated for ${a.id}`)}}),await o.reportUnsetEnvVars(),await Re(o),_(o)})}catch(s){const m="Unhandled error in plugin. "+s.message+`
2
2
  `+s.stack;fe.sendCliErrorCaughtMessage({message:m}),v.failFast?await b.panic(m):await b.panicOnBuild(m)}finally{o.finishPluginsRun()}}async function ve(t,o){const{cache:r,fs:v}=o,h=await o.getConfig(),s=Object.values(h.products||{}),m=(await r.load("versions-config","versions-config")).data,d=(await r.load("content-slugs","content-slugs")).data;t.routesByDir=new Map;for(const{duplicateInAllLocales:e,slugSuffix:i,sharedData:y=[],redirectFrom:w=[],...c}of t.newRoutes){const u=T(c.slug?c.slug:a(c.fsPath)),g=F(i?E(u,i):u),n={...c,[N]:{slug:g,fsPath:c.fsPath},slug:g,baseSlug:u,versions:p(c.fsPath,i),product:ge(s,g,a)};he(g,h)&&await b.panicOnBuildContentError(`Route "${g}" is reserved and cannot be used. Please choose a different slug for "${c.fsPath}".`),t.routesByFsPath.set(n.fsPath,n.slug),t.routesBySlug.set(n.slug,n);let C="";for(const f of c.fsPath.split("/")){const l=t.routesByDir.get(C),R=l||[];R.push(n),l||t.routesByDir.set(C,R),C=(C&&C+"/"||"")+f}for(const{key:f,id:l}of y)t.addRouteSharedData(n.slug,f,l);for(const f of w)t.addRedirect(f.from,{type:f.type,to:n.slug});if(e)for(const f of v.localeFolders){const l={...n,slug:"/"+f.toLowerCase()+n.slug};t.routesByFsPath.set(l.fsPath,l.slug),t.routesBySlug.set(l.slug,l);for(const{key:R,id:S}of y)t.addRouteSharedData(l.slug,R,S);for(const R of w){const S=E(v.localizationFolder,f,R.from);t.addRedirect(S,{type:R.type,to:l.slug})}}}return t.newRoutes=[],{...o,slugify:a};function a(e){const i=$(e).replace(new RegExp("^(@i18n|@l10n)\\/"),""),y=d.fileSlugs.get(i)||d.dirSlugs.get(F(i));if(y)return y;const{baseName:w,isIndexFile:c}=Pe(e);let u=O.dirname(e.replace(new RegExp("^(@i18n|@l10n)\\/"),""));return u=u==="."?"/":u,E("/",ue(c?u:E(u,w)),"/")}function p(e,i=""){const y=M(e);if(!y?.versionName)return;const{versionFolderPath:w,filePathInVersion:c,versionName:u}=y,g=m.get(w);if(g)return g.versions.map(n=>{const C=g.defaultVersion===n.version,f=j(E(w,V+n.version,c)),l=a(f);return{version:n.version,label:n.name||n.version,link:T(E(l,i)),default:C,active:u===n.version,folderId:z(`${w}`)}})}}function Ee(t,o){return{fs:t,cache:o,getConfig:async(r=".")=>(await o.load(r,"nearest-redocly-config",t.localeFolders)).data,isPathIgnored:async r=>(await o.load(r,"is-ignored")).data,withPathPrefix:L,logger:P}}export{Ce as INTERNAL_PLUGINS,Ee as createLifecycleContext,Pt as initPlugins,ht as runPlugins,_ as writeClientEntries};
@@ -1 +1 @@
1
- import c from"node:path";import v from"is-glob";import m from"picomatch";import{parseFileChunks as h}from"./file-chunk-parser.js";import{getNodeAttribute as b}from"../../markdoc/helpers/get-node-attribute.js";import{setNodeAttributeValue as d}from"../../markdoc/helpers/set-node-attribute-value.js";import{readFileContent as g}from"../../read-file-content.js";import{resolvePathInMarkdown as x}from"../../resolve-path-in-markdown.js";import{removeL10nPrefix as P}from"../../../../fs/utils/remove-l10n-prefix.js";import{mapFileExtensionToLanguage as k}from"./map-file-extension-to-language.js";async function V(a,f,p,u){const{actions:{contentDir:F},context:{fs:i}}=u,n=b(a,f);if(!Array.isArray(n))d(a,"resolvedFilesets",[]);else{const w=await Promise.all(n.map(async e=>{const s=Array.isArray(e.files)?e.files:[],o=Array.isArray(e.downloadAssociatedFiles)?e.downloadAssociatedFiles:[],r=await Promise.all(s.map(l)),t=await Promise.all(o.map(l));return{...e,files:r.flat(),downloadAssociatedFiles:t.flat()}}));d(a,"resolvedFilesets",w.filter(e=>!!e));async function l(e){const s=x(e,P(p),F),o=await A(s);return(await Promise.all(o.map(y))).filter(t=>t!==null)}async function A(e){if(!v(e))return[e];const{base:s}=m.scan(e);return i.scan(new RegExp(s)).filter(({isVirtual:t})=>!t).map(({realRelativePath:t})=>t).filter(t=>m(e)(t))}async function y(e){const s=await g(e,i);if(s==null)return null;const{root:o,metadata:r}=await h(s,e);return{path:e,content:o,metadata:r,basename:c.basename(e),language:k(c.extname(e))}}}}export{V as resolveCodeWalkthroughFilesets};
1
+ import c from"node:path";import v from"is-glob";import m from"picomatch";import{getNodeAttribute as h}from"../../../../../markdoc/helpers/get-node-attribute.js";import{setNodeAttributeValue as d}from"../../../../../markdoc/helpers/set-node-attribute-value.js";import{parseFileChunks as b}from"./file-chunk-parser.js";import{readFileContent as g}from"../../read-file-content.js";import{resolvePathInMarkdown as x}from"../../resolve-path-in-markdown.js";import{removeL10nPrefix as P}from"../../../../fs/utils/remove-l10n-prefix.js";import{mapFileExtensionToLanguage as k}from"./map-file-extension-to-language.js";async function V(a,f,p,u){const{actions:{contentDir:F},context:{fs:i}}=u,n=h(a,f);if(!Array.isArray(n))d(a,"resolvedFilesets",[]);else{const w=await Promise.all(n.map(async e=>{const s=Array.isArray(e.files)?e.files:[],o=Array.isArray(e.downloadAssociatedFiles)?e.downloadAssociatedFiles:[],r=await Promise.all(s.map(l)),t=await Promise.all(o.map(l));return{...e,files:r.flat(),downloadAssociatedFiles:t.flat()}}));d(a,"resolvedFilesets",w.filter(e=>!!e));async function l(e){const s=x(e,P(p),F),o=await A(s);return(await Promise.all(o.map(y))).filter(t=>t!==null)}async function A(e){if(!v(e))return[e];const{base:s}=m.scan(e);return i.scan(new RegExp(s)).filter(({isVirtual:t})=>!t).map(({realRelativePath:t})=>t).filter(t=>m(e)(t))}async function y(e){const s=await g(e,i);if(s==null)return null;const{root:o,metadata:r}=await b(s,e);return{path:e,content:o,metadata:r,basename:c.basename(e),language:k(c.extname(e))}}}}export{V as resolveCodeWalkthroughFilesets};
@@ -1,4 +1,4 @@
1
- import c from"node:path";import{slash as L}from"../../../../utils/path/slash.js";import{reporter as F}from"../../../tools/notifiers/reporter.js";import{getNodeAttribute as n}from"../markdoc/helpers/get-node-attribute.js";import{MdResolveError as h}from"./md-resolve-error.js";async function V(i,w,b,{actions:{contentDir:m},context:u}){const o=n(i,w);if(!o)return;const r=o.startsWith("/")?o.slice(1):L(c.relative(m,c.resolve(m,c.dirname(b),o)));if(!u.fs.exists(r)){await F.panicOnBuildContentError(`Code snippet file ${r} does not exist`);return}let e=await u.fs.read(r);const d=n(i,"after"),p=n(i,"before"),y=n(i,"from"),C=n(i,"to"),v=n(i,"prefix")||"",s=y??d,f=C??p,g=d!==null,x=p!==null,E=(typeof s=="number"?Math.max(s||0,1):1)+(g?1:0);let a=(typeof f=="number"?f:1/0)-(x?1:0);if(typeof s=="string"){let t=e.indexOf(s);if(t===-1)throw new h(`Cannot find start text "${s}" in snippet file`,{rawLink:r});for(;e[t]!==`
1
+ import c from"node:path";import{slash as L}from"../../../../utils/path/slash.js";import{reporter as F}from"../../../tools/notifiers/reporter.js";import{getNodeAttribute as n}from"../../../../markdoc/helpers/get-node-attribute.js";import{MdResolveError as h}from"./md-resolve-error.js";async function V(i,w,b,{actions:{contentDir:m},context:u}){const o=n(i,w);if(!o)return;const r=o.startsWith("/")?o.slice(1):L(c.relative(m,c.resolve(m,c.dirname(b),o)));if(!u.fs.exists(r)){await F.panicOnBuildContentError(`Code snippet file ${r} does not exist`);return}let e=await u.fs.read(r);const d=n(i,"after"),p=n(i,"before"),y=n(i,"from"),C=n(i,"to"),v=n(i,"prefix")||"",s=y??d,f=C??p,g=d!==null,x=p!==null,E=(typeof s=="number"?Math.max(s||0,1):1)+(g?1:0);let a=(typeof f=="number"?f:1/0)-(x?1:0);if(typeof s=="string"){let t=e.indexOf(s);if(t===-1)throw new h(`Cannot find start text "${s}" in snippet file`,{rawLink:r});for(;e[t]!==`
2
2
  `&&t>0;)t--;typeof a=="number"&&(a-=e.slice(0,t-1).split(`
3
3
  `).length),e=e.slice(t+1)}if(typeof f=="string"){let t=e.indexOf(f);if(t===-1)throw new h(`Cannot find end text "${p}" in snippet file`,{rawLink:r});e[t-1]===`
4
4
  `&&t--,e=e.slice(0,t)}const l=e.split(`
@@ -1 +1 @@
1
- import{withPathPrefix as m,withoutPathPrefix as p}from"@redocly/theme/core/utils";import{isLocalLink as u}from"../../../../utils/path/is-local-link.js";import{getNodeAttribute as s}from"../markdoc/helpers/get-node-attribute.js";import{setNodeAttributeValue as l}from"../markdoc/helpers/set-node-attribute-value.js";import{resolveLink as a}from"./resolve-link.js";async function H(r,t="href",n,c){const i=s(r,"attrs")||{},e=i[t];if(!e)return;const h=p(e);l(r,t,h),await a(r,t,n,c);const o=s(r,t);if(delete r.attributes[t],!o)return;let f=o;!o.startsWith("#")&&u(o)&&(f=m(o)),l(r,"attrs",{...i,[t]:f})}export{H as resolveHtmlHref};
1
+ import{withPathPrefix as m,withoutPathPrefix as p}from"@redocly/theme/core/utils";import{isLocalLink as u}from"../../../../utils/path/is-local-link.js";import{getNodeAttribute as s}from"../../../../markdoc/helpers/get-node-attribute.js";import{setNodeAttributeValue as l}from"../../../../markdoc/helpers/set-node-attribute-value.js";import{resolveLink as a}from"./resolve-link.js";async function H(r,t="href",n,c){const i=s(r,"attrs")||{},e=i[t];if(!e)return;const h=p(e);l(r,t,h),await a(r,t,n,c);const o=s(r,t);if(delete r.attributes[t],!o)return;let f=o;!o.startsWith("#")&&u(o)&&(f=m(o)),l(r,"attrs",{...i,[t]:f})}export{H as resolveHtmlHref};
@@ -1 +1 @@
1
- import S from"node:path";import{normalizeRouteSlug as v}from"../../../../utils/path/normalize-route-slug.js";import{reporter as a}from"../../../tools/notifiers/reporter.js";import{getNodeAttribute as m}from"../markdoc/helpers/get-node-attribute.js";import{FileNotFoundError as u,resolveAssetPath as w,resolveSrcSet as h}from"../../../utils/index.js";import{MdResolveError as $}from"./md-resolve-error.js";import{getLinkOriginalAttrName as A}from"./utils.js";async function B(e,o,s,{actions:{contentDir:n,outdir:l,getRouteBySlug:p},context:c}){const i=m(e,"attrs")?.[o],g=m(e,"name");if(!i)return;const f=A(o),t=e[f]||i;if(!(g==="iframe"&&p(v(t)))){if(e[f]=t,o==="src"){if(!S.extname(t))return;try{const r=await w(t,c.fs,{fromFileRelativePath:s,contentDir:n,outdir:l});e.attributes.attrs[o]=r}catch(r){if(r instanceof u)throw new $(`File ${t} does not exist`,{rawLink:t,link:t});await a.panicOnBuild(`Cannot resolve %rp: ${r.message}`,t)}}if(o==="srcSet")try{const r=await h(i,c.fs,{fromFileRelativePath:s,contentDir:n,outdir:l});e.attributes.attrs[o]=r}catch(r){r instanceof u?await a.panicOnBuildContentError(`Cannot resolve 'srcSet' attribute: ${i}: ${r.message}`):await a.panicOnBuild(`Cannot resolve 'srcSet' attribute: ${i}: ${r.message}`)}}}export{B as resolveHtmlSourceAttribute};
1
+ import S from"node:path";import{normalizeRouteSlug as v}from"../../../../utils/path/normalize-route-slug.js";import{reporter as a}from"../../../tools/notifiers/reporter.js";import{getNodeAttribute as m}from"../../../../markdoc/helpers/get-node-attribute.js";import{FileNotFoundError as u,resolveAssetPath as w,resolveSrcSet as h}from"../../../utils/index.js";import{MdResolveError as $}from"./md-resolve-error.js";import{getLinkOriginalAttrName as A}from"./utils.js";async function B(e,o,s,{actions:{contentDir:n,outdir:l,getRouteBySlug:p},context:c}){const i=m(e,"attrs")?.[o],g=m(e,"name");if(!i)return;const f=A(o),t=e[f]||i;if(!(g==="iframe"&&p(v(t)))){if(e[f]=t,o==="src"){if(!S.extname(t))return;try{const r=await w(t,c.fs,{fromFileRelativePath:s,contentDir:n,outdir:l});e.attributes.attrs[o]=r}catch(r){if(r instanceof u)throw new $(`File ${t} does not exist`,{rawLink:t,link:t});await a.panicOnBuild(`Cannot resolve %rp: ${r.message}`,t)}}if(o==="srcSet")try{const r=await h(i,c.fs,{fromFileRelativePath:s,contentDir:n,outdir:l});e.attributes.attrs[o]=r}catch(r){r instanceof u?await a.panicOnBuildContentError(`Cannot resolve 'srcSet' attribute: ${i}: ${r.message}`):await a.panicOnBuild(`Cannot resolve 'srcSet' attribute: ${i}: ${r.message}`)}}}export{B as resolveHtmlSourceAttribute};
@@ -1 +1 @@
1
- import{reporter as c}from"../../../tools/notifiers/reporter.js";import{getNodeAttribute as a}from"../markdoc/helpers/get-node-attribute.js";import{setNodeAttributeValue as m}from"../markdoc/helpers/set-node-attribute-value.js";import{FileNotFoundError as p,resolveSrcSet as u}from"../../../utils/index.js";import{getLinkOriginalAttrName as g}from"./utils.js";import{MdResolveError as v}from"./md-resolve-error.js";async function k(r,e,l,{actions:{contentDir:n,outdir:s},context:f}){if(a(r,e)){const i=g(e),o=r[i]||a(r,e);if(r[i]=o,!o)return;try{const t=await u(o,f.fs,{fromFileRelativePath:l,contentDir:n,outdir:s});m(r,e,t)}catch(t){if(t instanceof p)throw new v(`File ${t.filePath} does not exist`,{rawLink:t.filePath,link:t.filePath});await c.panicOnBuild(`Cannot resolve 'srcSet' attribute: ${t.message}`)}}}export{k as resolveImageSrcSet};
1
+ import{reporter as c}from"../../../tools/notifiers/reporter.js";import{getNodeAttribute as a}from"../../../../markdoc/helpers/get-node-attribute.js";import{setNodeAttributeValue as m}from"../../../../markdoc/helpers/set-node-attribute-value.js";import{FileNotFoundError as p,resolveSrcSet as u}from"../../../utils/index.js";import{getLinkOriginalAttrName as g}from"./utils.js";import{MdResolveError as v}from"./md-resolve-error.js";async function k(r,e,l,{actions:{contentDir:n,outdir:s},context:f}){if(a(r,e)){const i=g(e),o=r[i]||a(r,e);if(r[i]=o,!o)return;try{const t=await u(o,f.fs,{fromFileRelativePath:l,contentDir:n,outdir:s});m(r,e,t)}catch(t){if(t instanceof p)throw new v(`File ${t.filePath} does not exist`,{rawLink:t.filePath,link:t.filePath});await c.panicOnBuild(`Cannot resolve 'srcSet' attribute: ${t.message}`)}}}export{k as resolveImageSrcSet};
@@ -1 +1 @@
1
- import{reporter as m}from"../../../tools/notifiers/reporter.js";import{getNodeAttribute as n}from"../markdoc/helpers/get-node-attribute.js";import{setNodeAttributeValue as c}from"../markdoc/helpers/set-node-attribute-value.js";import{FileNotFoundError as p,resolveAssetPath as g}from"../../../utils/index.js";import{MdResolveError as u}from"./md-resolve-error.js";import{getLinkOriginalAttrName as v}from"./utils.js";async function x(t,o,s,{actions:{contentDir:a,outdir:l},context:f}){if(n(t,o)){const i=v(o),r=t[i]||n(t,o);if(typeof r!="string"||(t[i]=r,!r))return;try{const e=await g(r,f.fs,{fromFileRelativePath:s,contentDir:a,outdir:l});c(t,o,e)}catch(e){if(e instanceof p)throw new u(`File ${r} does not exist`,{rawLink:r,link:r});await m.panicOnBuild(`Cannot resolve %rp: ${e.message}`,r)}}}export{x as resolveImageSrc};
1
+ import{reporter as m}from"../../../tools/notifiers/reporter.js";import{getNodeAttribute as n}from"../../../../markdoc/helpers/get-node-attribute.js";import{setNodeAttributeValue as c}from"../../../../markdoc/helpers/set-node-attribute-value.js";import{FileNotFoundError as p,resolveAssetPath as g}from"../../../utils/index.js";import{MdResolveError as u}from"./md-resolve-error.js";import{getLinkOriginalAttrName as v}from"./utils.js";async function x(t,o,s,{actions:{contentDir:a,outdir:l},context:f}){if(n(t,o)){const i=v(o),r=t[i]||n(t,o);if(typeof r!="string"||(t[i]=r,!r))return;try{const e=await g(r,f.fs,{fromFileRelativePath:s,contentDir:a,outdir:l});c(t,o,e)}catch(e){if(e instanceof p)throw new u(`File ${r} does not exist`,{rawLink:r,link:r});await m.panicOnBuild(`Cannot resolve %rp: ${e.message}`,r)}}}export{x as resolveImageSrc};
@@ -1 +1 @@
1
- import{JsonPointer as w}from"@redocly/openapi-docs";import{isObject as d}from"../../../../utils/guards/is-object.js";import{getNodeAttribute as u}from"../markdoc/helpers/get-node-attribute.js";import{setNodeAttributeValue as s}from"../markdoc/helpers/set-node-attribute-value.js";import{MdResolveError as p}from"./md-resolve-error.js";import{resolvePathInMarkdown as $}from"../resolve-path-in-markdown.js";async function b(e,o,m,{context:n,actions:h}){const r=u(e,o);try{if(!d(r)||typeof r.$ref!="string"){try{JSON.stringify(r)}catch(i){throw new Error(`Invalid JSON value: ${i.message}`)}s(e,o+"Resolved",r);return}const[t,f]=r.$ref.split("#");if(!t)throw new Error(`Invalid $ref. Path to file is required: ${r.$ref}`);const l=$(t,m,h.contentDir),c=await n.fs.getFileInfo(l);if(!c)throw new Error(`Invalid $ref. No such file: ${l}`);let a;try{a=(await n.cache.load(c.realRelativePath,"yaml")).data}catch(i){throw new Error(`Invalid file format. File must be valid json or yaml: ${l} ${i?.message||""}`)}if(!f){s(e,o+"Resolved",a);return}const v=w.get(a,f);s(e,o+"Resolved",v)}catch(t){throw s(e,o+"ResolvedErrors",[t.message]),new p(t.message,{rawLink:""})}}export{b as resolveJsonExampleRef};
1
+ import{JsonPointer as w}from"@redocly/openapi-docs";import{isObject as d}from"../../../../utils/guards/is-object.js";import{getNodeAttribute as u}from"../../../../markdoc/helpers/get-node-attribute.js";import{setNodeAttributeValue as s}from"../../../../markdoc/helpers/set-node-attribute-value.js";import{MdResolveError as p}from"./md-resolve-error.js";import{resolvePathInMarkdown as $}from"../resolve-path-in-markdown.js";async function b(e,o,m,{context:n,actions:h}){const r=u(e,o);try{if(!d(r)||typeof r.$ref!="string"){try{JSON.stringify(r)}catch(i){throw new Error(`Invalid JSON value: ${i.message}`)}s(e,o+"Resolved",r);return}const[t,f]=r.$ref.split("#");if(!t)throw new Error(`Invalid $ref. Path to file is required: ${r.$ref}`);const l=$(t,m,h.contentDir),c=await n.fs.getFileInfo(l);if(!c)throw new Error(`Invalid $ref. No such file: ${l}`);let a;try{a=(await n.cache.load(c.realRelativePath,"yaml")).data}catch(i){throw new Error(`Invalid file format. File must be valid json or yaml: ${l} ${i?.message||""}`)}if(!f){s(e,o+"Resolved",a);return}const v=w.get(a,f);s(e,o+"Resolved",v)}catch(t){throw s(e,o+"ResolvedErrors",[t.message]),new p(t.message,{rawLink:""})}}export{b as resolveJsonExampleRef};
@@ -1 +1 @@
1
- import a from"node:path";import{getNodeAttribute as u}from"../markdoc/helpers/get-node-attribute.js";import{setNodeAttributeValue as f}from"../markdoc/helpers/set-node-attribute-value.js";import{formatBundleFromMarkdocError as b}from"../errors.js";import{MdResolveError as d}from"./md-resolve-error.js";import{dereferenceJsonSchemaRefs as h}from"./helpers/dereference-json-schema-refs.js";async function k(o,r,e,{context:c,actions:i}){const l=u(o,r),t=i.contentDir,p=a.resolve(t,e),s=await h({schemaOrRef:l,filePath:p,fs:c.fs});f(o,r+"Resolved",s?.oas);const n=s?.problems[0];if(!n)return{};const m=b(n,e,t);throw f(o,r+"ResolvedErrors",[m]),new d(m,{rawLink:""})}export{k as resolveJsonSchemaRef};
1
+ import a from"node:path";import{getNodeAttribute as u}from"../../../../markdoc/helpers/get-node-attribute.js";import{setNodeAttributeValue as f}from"../../../../markdoc/helpers/set-node-attribute-value.js";import{formatBundleFromMarkdocError as b}from"../errors.js";import{MdResolveError as d}from"./md-resolve-error.js";import{dereferenceJsonSchemaRefs as h}from"./helpers/dereference-json-schema-refs.js";async function k(o,r,e,{context:c,actions:i}){const l=u(o,r),t=i.contentDir,p=a.resolve(t,e),s=await h({schemaOrRef:l,filePath:p,fs:c.fs});f(o,r+"Resolved",s?.oas);const n=s?.problems[0];if(!n)return{};const m=b(n,e,t);throw f(o,r+"ResolvedErrors",[m]),new d(m,{rawLink:""})}export{k as resolveJsonSchemaRef};
@@ -1 +1 @@
1
- import o from"node:path";import{ASYNC_API_DOCS_TEMPLATE_ID as F,GRAPHQL_SPEC_SLUG as T,GRAPHQL_TEMPLATE_ID as d,OPENAPI_DOCS_TEMPLATE_ID as v}from"../../../../constants/common.js";import{isLocalLink as U}from"../../../../utils/path/is-local-link.js";import{normalizeRouteSlug as P}from"../../../../utils/path/normalize-route-slug.js";import{removeFragment as y}from"../../../../utils/path/remove-fragment.js";import{PUBLIC_API_DEFINITIONS_FOLDER as C,DEPRECATED_PUBLIC_API_DEFINITIONS_FOLDER as M}from"../../../constants/common.js";import{getInnerText as N}from"../markdoc/helpers/get-inner-text.js";import{getNodeAttribute as W}from"../markdoc/helpers/get-node-attribute.js";import{setNodeAttributeValue as p}from"../markdoc/helpers/set-node-attribute-value.js";import{MdResolveError as g}from"./md-resolve-error.js";import{getLinkOriginalAttrName as B}from"./utils.js";import{isOpenApiURL as j}from"../../openapi-docs/is-openapi-doc.js";import{parseBaseName as G}from"../../utils.js";import{isMarkdownPage as $}from"../is-markdown-page.js";import{copyStaticFile as H}from"../../../utils/fs.js";const V=i=>[C,M,T].some(r=>i.startsWith(r));async function lt(i,r,k,{actions:L,context:c}){const{contentDir:w,outdir:D,getRouteByFsPath:A,slugHasRouteOrRedirect:E}=L,_=B(r),s=i[_]||W(i,r);if(i[_]=s,!U(s)||V(s))return;const[b,t="",R,h]=/^([^\?#]+)?([^#]+)?(.+)?/.exec(s)||[],f=i.type==="image"?"IMAGE":"LINK",u=()=>String(i.attributes.title||i.attributes.alt||N([i])||""),n=y(k);if(i.type!=="image"){const{isOpenapiDetected:e,isOpenapiValid:m}=await j(t,n,L,c);if(e&&!m)throw new g(`OpenAPI route ${s} does not exist`,{rawLink:s,link:t,title:u(),brokenLinkType:f})}if(o.extname(t)===""){if(t.startsWith("/")){if(!E(P(t)))throw new g(`Route ${t} does not exist`,{rawLink:s,link:t,title:u(),brokenLinkType:f});p(i,r,t+(R||"")+(h||""))}if(!s.startsWith("#")&&!t.startsWith("/")&&$(n)){const e=A(n)?.slug;if(!e)return;const{isIndexFile:m}=G(n),I=m?P(o.posix.join(e,t)):P(o.posix.join(e,"../",t));if(!E(P(I)))throw new g(`Route ${t} does not exist`,{rawLink:s,link:I,title:u(),brokenLinkType:f});p(i,r,I+(R||"")+(h||""))}return}const a=t.startsWith("/")?t.substring(1):o.posix.join(o.posix.dirname(n),decodeURI(t)),O=t.startsWith("/")?o.posix.join("static",t.substring(1)):"",x=c.fs.exists(a),S=c.fs.exists(O),l=A(a);if(!x&&!l&&!S)throw p(i,r,"#"),new g(`File ${a} does not exist`,{rawLink:s,link:a,title:u(),brokenLinkType:f});if(l){const e=[v,d,F].includes(l.templateId);p(i,r,(e?l.baseSlug:l.slug)+(h||""))}else if(x){const e=c.fs.getFileInfo(a);if(!e||e.isVirtual)return;const m=await H(w,e.realRelativePath,D);p(i,r,m)}}export{lt as resolveLink};
1
+ import o from"node:path";import{ASYNC_API_DOCS_TEMPLATE_ID as F,GRAPHQL_SPEC_SLUG as T,GRAPHQL_TEMPLATE_ID as d,OPENAPI_DOCS_TEMPLATE_ID as v}from"../../../../constants/common.js";import{isLocalLink as U}from"../../../../utils/path/is-local-link.js";import{normalizeRouteSlug as P}from"../../../../utils/path/normalize-route-slug.js";import{removeFragment as y}from"../../../../utils/path/remove-fragment.js";import{PUBLIC_API_DEFINITIONS_FOLDER as C,DEPRECATED_PUBLIC_API_DEFINITIONS_FOLDER as M}from"../../../constants/common.js";import{getInnerText as N}from"../../../../markdoc/helpers/get-inner-text.js";import{getNodeAttribute as W}from"../../../../markdoc/helpers/get-node-attribute.js";import{setNodeAttributeValue as p}from"../../../../markdoc/helpers/set-node-attribute-value.js";import{MdResolveError as g}from"./md-resolve-error.js";import{getLinkOriginalAttrName as B}from"./utils.js";import{isOpenApiURL as j}from"../../openapi-docs/is-openapi-doc.js";import{parseBaseName as G}from"../../utils.js";import{isMarkdownPage as $}from"../is-markdown-page.js";import{copyStaticFile as H}from"../../../utils/fs.js";const V=i=>[C,M,T].some(r=>i.startsWith(r));async function lt(i,r,k,{actions:L,context:c}){const{contentDir:w,outdir:D,getRouteByFsPath:A,slugHasRouteOrRedirect:E}=L,_=B(r),s=i[_]||W(i,r);if(i[_]=s,!U(s)||V(s))return;const[b,t="",R,h]=/^([^\?#]+)?([^#]+)?(.+)?/.exec(s)||[],f=i.type==="image"?"IMAGE":"LINK",u=()=>String(i.attributes.title||i.attributes.alt||N([i])||""),n=y(k);if(i.type!=="image"){const{isOpenapiDetected:e,isOpenapiValid:m}=await j(t,n,L,c);if(e&&!m)throw new g(`OpenAPI route ${s} does not exist`,{rawLink:s,link:t,title:u(),brokenLinkType:f})}if(o.extname(t)===""){if(t.startsWith("/")){if(!E(P(t)))throw new g(`Route ${t} does not exist`,{rawLink:s,link:t,title:u(),brokenLinkType:f});p(i,r,t+(R||"")+(h||""))}if(!s.startsWith("#")&&!t.startsWith("/")&&$(n)){const e=A(n)?.slug;if(!e)return;const{isIndexFile:m}=G(n),I=m?P(o.posix.join(e,t)):P(o.posix.join(e,"../",t));if(!E(P(I)))throw new g(`Route ${t} does not exist`,{rawLink:s,link:I,title:u(),brokenLinkType:f});p(i,r,I+(R||"")+(h||""))}return}const a=t.startsWith("/")?t.substring(1):o.posix.join(o.posix.dirname(n),decodeURI(t)),O=t.startsWith("/")?o.posix.join("static",t.substring(1)):"",x=c.fs.exists(a),S=c.fs.exists(O),l=A(a);if(!x&&!l&&!S)throw p(i,r,"#"),new g(`File ${a} does not exist`,{rawLink:s,link:a,title:u(),brokenLinkType:f});if(l){const e=[v,d,F].includes(l.templateId);p(i,r,(e?l.baseSlug:l.slug)+(h||""))}else if(x){const e=c.fs.getFileInfo(a);if(!e||e.isVirtual)return;const m=await H(w,e.realRelativePath,D);p(i,r,m)}}export{lt as resolveLink};
@@ -1 +1 @@
1
- import{getPathPrefix as s,withPathPrefix as n}from"@redocly/theme/core/utils";import{isLocalLink as m}from"../../../../utils/path/is-local-link.js";import{getNodeAttribute as a}from"../markdoc/helpers/get-node-attribute.js";import{setNodeAttributeValue as p}from"../markdoc/helpers/set-node-attribute-value.js";import{resolveLink as h}from"./resolve-link.js";async function x(r,i,e,f){await h(r,i,e,f);const o=s();if(!o)return;const t=a(r,i);!t||t==="#"||!m(t)||t.startsWith(o)||p(r,i,t.startsWith("#")?t:n(t))}export{x as resolveNativeMdLink};
1
+ import{getPathPrefix as s,withPathPrefix as n}from"@redocly/theme/core/utils";import{isLocalLink as m}from"../../../../utils/path/is-local-link.js";import{getNodeAttribute as a}from"../../../../markdoc/helpers/get-node-attribute.js";import{setNodeAttributeValue as p}from"../../../../markdoc/helpers/set-node-attribute-value.js";import{resolveLink as h}from"./resolve-link.js";async function x(r,i,e,f){await h(r,i,e,f);const o=s();if(!o)return;const t=a(r,i);!t||t==="#"||!m(t)||t.startsWith(o)||p(r,i,t.startsWith("#")?t:n(t))}export{x as resolveNativeMdLink};
@@ -1 +1 @@
1
- import n from"node:path";import{getNodeAttribute as f}from"../markdoc/helpers/get-node-attribute.js";import{setNodeAttributeValue as p}from"../markdoc/helpers/set-node-attribute-value.js";import{getLinkOriginalAttrName as a}from"./utils.js";import{resolveLinksFromConfig as v}from"../../nav-utils.js";async function L(o,r,t,{context:s,actions:i}){const e=a(r),m=o[e]||f(o,r);o[e]=m;const l=await v(m,n.dirname(n.resolve(i.contentDir,t)),i,s,{navFile:t});p(o,r,l)}export{L as resolveNavLinks};
1
+ import n from"node:path";import{getNodeAttribute as f}from"../../../../markdoc/helpers/get-node-attribute.js";import{setNodeAttributeValue as p}from"../../../../markdoc/helpers/set-node-attribute-value.js";import{getLinkOriginalAttrName as a}from"./utils.js";import{resolveLinksFromConfig as v}from"../../nav-utils.js";async function L(o,r,t,{context:s,actions:i}){const e=a(r),m=o[e]||f(o,r);o[e]=m;const l=await v(m,n.dirname(n.resolve(i.contentDir,t)),i,s,{navFile:t});p(o,r,l)}export{L as resolveNavLinks};
@@ -1 +1 @@
1
- import f from"node:path";import{OPENAPI_SHARED_DATA_PREFIX as p}from"../../../constants/plugins/openapi-docs.js";import{getNodeAttribute as A}from"../markdoc/helpers/get-node-attribute.js";import{setNodeAttributeValue as w}from"../markdoc/helpers/set-node-attribute-value.js";import{isOpenapiDoc as d}from"../../openapi-docs/is-openapi-doc.js";import{MdResolveError as a}from"./md-resolve-error.js";import{getLinkOriginalAttrName as g}from"./utils.js";async function O(r,t,e,{context:n}){const s=g(t);let o=r[s]||A(r,t);if(o||await d(e,n)&&(o=f.basename(e)),r[s]=o,!o)return;const i=f.posix.join(f.posix.dirname(e),o),m=p+i;if(w(r,t,m),!n.fs.exists(i))throw new a(`Definition file ${i} does not exist`,{rawLink:i});if(await n.isPathIgnored(i))throw new a(`Definition file ${i} is ignored in config`,{rawLink:i});return{sharedDataId:m}}export{O as resolveOpenApiRef};
1
+ import f from"node:path";import{OPENAPI_SHARED_DATA_PREFIX as p}from"../../../constants/plugins/openapi-docs.js";import{getNodeAttribute as A}from"../../../../markdoc/helpers/get-node-attribute.js";import{setNodeAttributeValue as w}from"../../../../markdoc/helpers/set-node-attribute-value.js";import{isOpenapiDoc as d}from"../../openapi-docs/is-openapi-doc.js";import{MdResolveError as a}from"./md-resolve-error.js";import{getLinkOriginalAttrName as g}from"./utils.js";async function O(r,t,e,{context:n}){const s=g(t);let o=r[s]||A(r,t);if(o||await d(e,n)&&(o=f.basename(e)),r[s]=o,!o)return;const i=f.posix.join(f.posix.dirname(e),o),m=p+i;if(w(r,t,m),!n.fs.exists(i))throw new a(`Definition file ${i} does not exist`,{rawLink:i});if(await n.isPathIgnored(i))throw new a(`Definition file ${i} is ignored in config`,{rawLink:i});return{sharedDataId:m}}export{O as resolveOpenApiRef};
@@ -1 +1 @@
1
- import{getNodeAttribute as m}from"../markdoc/helpers/get-node-attribute.js";import{setNodeAttributeValue as c}from"../markdoc/helpers/set-node-attribute-value.js";import{MdResolveError as f}from"./md-resolve-error.js";import{resolvePathInMarkdown as l}from"../resolve-path-in-markdown.js";async function p(t,r,a,{context:o}){const s=m(t,r);if(s){const e=l(s,a,o.fs.cwd);if(!o.fs.exists(e))throw new f(`Schema file ${e} does not exist`,{rawLink:e});const i=(await o.cache.load(e,"yaml")).data;c(t,r+"Resolved",i)}}export{p as resolveParsedYaml};
1
+ import{getNodeAttribute as m}from"../../../../markdoc/helpers/get-node-attribute.js";import{setNodeAttributeValue as c}from"../../../../markdoc/helpers/set-node-attribute-value.js";import{MdResolveError as f}from"./md-resolve-error.js";import{resolvePathInMarkdown as l}from"../resolve-path-in-markdown.js";async function p(t,r,a,{context:o}){const s=m(t,r);if(s){const e=l(s,a,o.fs.cwd);if(!o.fs.exists(e))throw new f(`Schema file ${e} does not exist`,{rawLink:e});const i=(await o.cache.load(e,"yaml")).data;c(t,r+"Resolved",i)}}export{p as resolveParsedYaml};
@@ -1 +1 @@
1
- import{getNodeAttribute as m}from"../markdoc/helpers/get-node-attribute.js";import{setNodeAttributeValue as c}from"../markdoc/helpers/set-node-attribute-value.js";import{readFileContent as l}from"../read-file-content.js";import{resolvePathInMarkdown as w}from"../resolve-path-in-markdown.js";import{MdResolveError as p}from"./md-resolve-error.js";async function R(o,e,i,{context:r,actions:s}){const n=m(o,e),a=s.contentDir;if(n){const t=w(n,i,a);if(!r.fs.exists(t))throw new p(`File ${t} does not exist`,{rawLink:t});const f=await l(t,r.fs);c(o,e+"RawContent",f)}}export{R as resolveRawContent};
1
+ import{getNodeAttribute as m}from"../../../../markdoc/helpers/get-node-attribute.js";import{setNodeAttributeValue as c}from"../../../../markdoc/helpers/set-node-attribute-value.js";import{readFileContent as l}from"../read-file-content.js";import{resolvePathInMarkdown as w}from"../resolve-path-in-markdown.js";import{MdResolveError as p}from"./md-resolve-error.js";async function R(o,e,i,{context:r,actions:s}){const n=m(o,e),a=s.contentDir;if(n){const t=w(n,i,a);if(!r.fs.exists(t))throw new p(`File ${t} does not exist`,{rawLink:t});const f=await l(t,r.fs);c(o,e+"RawContent",f)}}export{R as resolveRawContent};
@@ -1 +1 @@
1
- import{getNodeAttribute as s}from"../markdoc/helpers/get-node-attribute.js";import{resolveLink as m}from"./resolve-link.js";import{resolveSvgContent as g}from"./resolve-svg-content.js";import{isIconPath as l}from"../../../utils/index.js";import{getLinkOriginalAttrName as p}from"./utils.js";async function k(i,r,t,{context:e,actions:n}){const f=p(r),o=i[f]||s(i,r);!o||typeof o!="string"||(o.endsWith(".svg")?await g(i,r,t,{context:e,actions:n}):l(o)&&await m(i,r,t,{context:e,actions:n}))}export{k as resolveRelativeOrCdnIcon};
1
+ import{getNodeAttribute as s}from"../../../../markdoc/helpers/get-node-attribute.js";import{resolveLink as m}from"./resolve-link.js";import{resolveSvgContent as g}from"./resolve-svg-content.js";import{isIconPath as l}from"../../../utils/index.js";import{getLinkOriginalAttrName as p}from"./utils.js";async function k(i,r,t,{context:e,actions:n}){const f=p(r),o=i[f]||s(i,r);!o||typeof o!="string"||(o.endsWith(".svg")?await g(i,r,t,{context:e,actions:n}):l(o)&&await m(i,r,t,{context:e,actions:n}))}export{k as resolveRelativeOrCdnIcon};
@@ -1 +1 @@
1
- import e from"node:path";import{slash as g}from"../../../../utils/path/slash.js";import{getNodeAttribute as h}from"../markdoc/helpers/get-node-attribute.js";import{setNodeAttributeValue as v}from"../markdoc/helpers/set-node-attribute-value.js";import{isL10nPath as m}from"../../../fs/utils/is-l10n-path.js";import{getLocaleFromRelativePath as A}from"../../../fs/utils/get-locale-from-relative-path.js";import{getLinkOriginalAttrName as d}from"./utils.js";async function R(o,i,r,n){const s=h(o,i);if(!s)return;const l=n.actions.contentDir,a=d(i),t=o[a]||s;o[a]=t;const c=m(r)?A(r):void 0,f=n.context.fs,p=c&&!m(t.slice(1))?`${f.localizationFolder}/${c}/`:"",u=t.startsWith("/")?p+t.slice(1):g(e.relative(l,e.resolve(l,e.dirname(r),t)));v(o,i,u)}export{R as resolveRelativePath};
1
+ import e from"node:path";import{slash as g}from"../../../../utils/path/slash.js";import{getNodeAttribute as h}from"../../../../markdoc/helpers/get-node-attribute.js";import{setNodeAttributeValue as v}from"../../../../markdoc/helpers/set-node-attribute-value.js";import{isL10nPath as m}from"../../../fs/utils/is-l10n-path.js";import{getLocaleFromRelativePath as A}from"../../../fs/utils/get-locale-from-relative-path.js";import{getLinkOriginalAttrName as d}from"./utils.js";async function R(o,i,r,n){const s=h(o,i);if(!s)return;const l=n.actions.contentDir,a=d(i),t=o[a]||s;o[a]=t;const c=m(r)?A(r):void 0,f=n.context.fs,p=c&&!m(t.slice(1))?`${f.localizationFolder}/${c}/`:"",u=t.startsWith("/")?p+t.slice(1):g(e.relative(l,e.resolve(l,e.dirname(r),t)));v(o,i,u)}export{R as resolveRelativePath};
@@ -1 +1 @@
1
- import S from"node:path";import{getNodeAttribute as f}from"../markdoc/helpers/get-node-attribute.js";import{setNodeAttributeValue as i}from"../markdoc/helpers/set-node-attribute-value.js";import{MdResolveError as a}from"./md-resolve-error.js";import{generateSampleFromSchema as g}from"./helpers/generate-sample-from-schema.js";import{formatBundleFromMarkdocError as k}from"../errors.js";import{dereferenceJsonSchemaRefs as E}from"./helpers/dereference-json-schema-refs.js";async function y(o,e,r,{context:p,actions:l}){const h=f(o,e),t=l.contentDir,d=S.resolve(t,r),s=await E({schemaOrRef:h,filePath:d,fs:p.fs});if(!s)return;const{schema:u,problems:w,oas:b}=s,m=w[0];if(m){const c=k(m,r,t);throw i(o,e+"ResolvedErrors",[c]),new a(c,{rawLink:""})}const R=f(o,"mode"),{value:v,error:n}=g(u,{mode:R,spec:b});if(i(o,e+"Resolved",v),n)throw new a(n,{rawLink:""})}export{y as resolveSampleFromJsonSchema};
1
+ import S from"node:path";import{getNodeAttribute as f}from"../../../../markdoc/helpers/get-node-attribute.js";import{setNodeAttributeValue as i}from"../../../../markdoc/helpers/set-node-attribute-value.js";import{MdResolveError as a}from"./md-resolve-error.js";import{generateSampleFromSchema as g}from"./helpers/generate-sample-from-schema.js";import{formatBundleFromMarkdocError as k}from"../errors.js";import{dereferenceJsonSchemaRefs as E}from"./helpers/dereference-json-schema-refs.js";async function y(o,e,r,{context:p,actions:l}){const h=f(o,e),t=l.contentDir,d=S.resolve(t,r),s=await E({schemaOrRef:h,filePath:d,fs:p.fs});if(!s)return;const{schema:u,problems:w,oas:b}=s,m=w[0];if(m){const c=k(m,r,t);throw i(o,e+"ResolvedErrors",[c]),new a(c,{rawLink:""})}const R=f(o,"mode"),{value:v,error:n}=g(u,{mode:R,spec:b});if(i(o,e+"Resolved",v),n)throw new a(n,{rawLink:""})}export{y as resolveSampleFromJsonSchema};
@@ -1 +1 @@
1
- import{getNodeAttribute as m}from"../markdoc/helpers/get-node-attribute.js";import{setNodeAttributeValue as l}from"../markdoc/helpers/set-node-attribute-value.js";import{optimize as p}from"../../../../compiled/svgo/svgo-node.js";import{slug as c}from"../../../utils/index.js";import{MdResolveError as d}from"./md-resolve-error.js";import{resolvePathInMarkdown as u}from"../resolve-path-in-markdown.js";async function b(o,r,n,{context:i,actions:s}){const e=m(o,r),a=s.contentDir;if(e){const t=u(e,n,a);if(!i.fs.exists(t))throw new d(`File ${t} does not exist`,{rawLink:e});let f=p(await i.fs.read(t),{plugins:[{name:"prefixIds",params:{prefix:c(t).replaceAll(/[\/\.]/g,"-")}}]}).data;l(o,r+"RawContent",f)}}export{b as resolveSvgContent};
1
+ import{getNodeAttribute as m}from"../../../../markdoc/helpers/get-node-attribute.js";import{setNodeAttributeValue as l}from"../../../../markdoc/helpers/set-node-attribute-value.js";import{optimize as p}from"../../../../compiled/svgo/svgo-node.js";import{slug as c}from"../../../utils/index.js";import{MdResolveError as d}from"./md-resolve-error.js";import{resolvePathInMarkdown as u}from"../resolve-path-in-markdown.js";async function b(o,r,n,{context:i,actions:s}){const e=m(o,r),a=s.contentDir;if(e){const t=u(e,n,a);if(!i.fs.exists(t))throw new d(`File ${t} does not exist`,{rawLink:e});let f=p(await i.fs.read(t),{plugins:[{name:"prefixIds",params:{prefix:c(t).replaceAll(/[\/\.]/g,"-")}}]}).data;l(o,r+"RawContent",f)}}export{b as resolveSvgContent};
@@ -1 +1 @@
1
- import{pathToFileURL as o}from"url";import{envConfig as r}from"../../../../config/env-config.js";async function n(t){if(r.isRuntimeMode)return await import("@redocly-markdoc/schema");try{const e=r.isDevelopMode?"js":"mjs";return await import(o(`${t}/user-tags-entry.${e}`)+"?"+new Date)}catch(e){if(r.isDevelopMode)return{schema:{}};throw e}}export{n as importUserTags};
1
+ import{pathToFileURL as o}from"url";import{envConfig as r}from"../../../config/env-config.js";async function n(t){if(r.isRuntimeMode)return await import("@redocly-markdoc/schema");try{const e=r.isDevelopMode?"js":"mjs";return await import(o(`${t}/user-tags-entry.${e}`)+"?"+new Date)}catch(e){if(r.isDevelopMode)return{schema:{}};throw e}}export{n as importUserTags};
@@ -1 +1 @@
1
- import f from"@markdoc/markdoc";import*as g from"@redocly/theme/markdoc/default";import{reporter as p}from"../../../tools/notifiers/reporter.js";import{includes as u}from"./functions/includes.js";import{importUserTags as d}from"./import-user-tags.js";import*as l from"./nodes/index.js";import h from"./tags/index.js";import{concat as O}from"./functions/concat.js";const y=g.tags;function b(o){return Object.fromEntries(Object.entries(o).map(([r,e])=>[e.tagName||r,e]))}function T(o){const{tags:r,functions:e={},...n}=o,a={...r,...n};let i=Object.entries(a);const s=[],t=[];for(const[c,m]of i)c in f.nodes?s.push([c,m]):t.push([c,m]);return{nodes:Object.fromEntries(s),tags:Object.fromEntries(t),functions:e}}async function D(o="../../../esbuild/cache/server/",r=""){let e;try{e=(await d(o)).schema}catch(t){throw t.code==="ERR_MODULE_NOT_FOUND"?(p.printErrors(),new Error("Please fix the errors above and try again.")):t}const{tags:n={},nodes:a={},functions:i={}}=T(e),s={tags:{schemaDefinition:{render:"SchemaDefinition",attributes:{schemaRef:{type:String},exampleRef:{type:String},showReadOnly:{type:Boolean},showWriteOnly:{type:Boolean}}}}};return{nodes:{...l,...a},tags:{...h,...y,...b(n),...s.tags},functions:{...f.functions,...i,includes:u,concat:O}}}export{D as getMarkdocOptions};
1
+ import f from"@markdoc/markdoc";import*as g from"@redocly/theme/markdoc/default";import{reporter as p}from"../../../tools/notifiers/reporter.js";import*as u from"../../../../markdoc/nodes/index.js";import d from"../../../../markdoc/tags/index.js";import{includes as l}from"./functions/includes.js";import{importUserTags as h}from"./import-user-tags.js";import{concat as O}from"./functions/concat.js";const y=g.tags;function b(o){return Object.fromEntries(Object.entries(o).map(([r,e])=>[e.tagName||r,e]))}function T(o){const{tags:r,functions:e={},...n}=o,a={...r,...n};let i=Object.entries(a);const s=[],t=[];for(const[c,m]of i)c in f.nodes?s.push([c,m]):t.push([c,m]);return{nodes:Object.fromEntries(s),tags:Object.fromEntries(t),functions:e}}async function D(o="../../../esbuild/cache/server/",r=""){let e;try{e=(await h(o)).schema}catch(t){throw t.code==="ERR_MODULE_NOT_FOUND"?(p.printErrors(),new Error("Please fix the errors above and try again.")):t}const{tags:n={},nodes:a={},functions:i={}}=T(e),s={tags:{schemaDefinition:{render:"SchemaDefinition",attributes:{schemaRef:{type:String},exampleRef:{type:String},showReadOnly:{type:Boolean},showWriteOnly:{type:Boolean}}}}};return{nodes:{...u,...a},tags:{...d,...y,...b(n),...s.tags},functions:{...f.functions,...i,includes:l,concat:O}}}export{D as getMarkdocOptions};
@@ -1 +1 @@
1
- import*as l from"path";import{MARKDOC_PARTIALS_DATA_KEY as f,MARKDOC_PARTIALS_DEPS_KEY as D}from"../../../store.js";import{isPartial as h}from"../is-partial.js";function A(e,t){return Promise.all(e.map(t)).then(o=>e.filter((i,n)=>o[n]))}async function C(e,t){const{markdown:o}=await e.getConfig(),i=o?.partialsFolders??[],n=await A(e.fs.scan(/\.md$/),async a=>!(!l.posix.basename(a.relativePath).endsWith(".md")||await e.isPathIgnored(a.relativePath)||!h(a.relativePath,i)));t.setGlobalConfig({[f]:Object.fromEntries(n.map(a=>[a.relativePath,{}]))});const m={},p={};for(const a of n){const{ast:s,info:r}=await t.parseMarkdoc(a,e);m[a.relativePath]=s;const c=Array.isArray(r.dynamicMarkdocComponents)?r.dynamicMarkdocComponents:[],d=r.sharedDataDeps instanceof Set?Array.from(r.sharedDataDeps):Array.isArray(r.sharedDataDeps)?r.sharedDataDeps:[];p[a.relativePath]={dynamicComponents:new Set(c),sharedDataDeps:new Set(d)}}return t.setGlobalConfig({[D]:Object.fromEntries(Object.entries(p).map(([a,s])=>[a,{dynamicComponents:Array.from(s.dynamicComponents),sharedDataDeps:Array.from(s.sharedDataDeps)}]))}),m}export{C as prepareMarkdocPartials};
1
+ import*as f from"path";import{MARKDOC_PARTIALS_DATA_KEY as D,MARKDOC_PARTIALS_DEPS_KEY as A}from"../../../store.js";import{isPartial as y}from"../is-partial.js";function h(t,s){return Promise.all(t.map(s)).then(i=>t.filter((o,n)=>i[n]))}async function b(t,s){const{markdown:i}=await t.getConfig(),o=i?.partialsFolders??[],n=await h(t.fs.scan(/\.md$/),async a=>!(!f.posix.basename(a.relativePath).endsWith(".md")||await t.isPathIgnored(a.relativePath)||!y(a.relativePath,o)));s.setGlobalConfig({[D]:Object.fromEntries(n.map(a=>[a.relativePath,{}]))});const p={},m={};for(const a of n){const{ast:e,info:r}=await s.parseMarkdoc(a,t);p[a.relativePath]=e;const l=Array.isArray(r.dynamicMarkdocComponents)?r.dynamicMarkdocComponents:[],c=r.sharedDataDeps instanceof Set?Array.from(r.sharedDataDeps):Array.isArray(r.sharedDataDeps)?r.sharedDataDeps:[],d=Array.isArray(r.partials)?r.partials:[];m[a.relativePath]={dynamicComponents:new Set(l),sharedDataDeps:new Set(c),partials:new Set(d)}}return s.setGlobalConfig({[A]:Object.fromEntries(Object.entries(m).map(([a,e])=>[a,{dynamicComponents:Array.from(e.dynamicComponents),sharedDataDeps:Array.from(e.sharedDataDeps),partials:Array.from(e.partials)}]))}),p}export{b as prepareMarkdocPartials};
@@ -1 +1 @@
1
- import{getNodeAttribute as r}from"../helpers/get-node-attribute.js";import{getInnerText as i}from"../helpers/get-inner-text.js";function u(t){const e=r(t,"level");if(e)return{value:i(t.children),id:r(t,"id"),depth:e}}export{u as getHeadingData};
1
+ import{getNodeAttribute as r}from"../../../../../markdoc/helpers/get-node-attribute.js";import{getInnerText as i}from"../../../../../markdoc/helpers/get-inner-text.js";function u(t){const e=r(t,"level");if(e)return{value:i(t.children),id:r(t,"id"),depth:e}}export{u as getHeadingData};
@@ -1 +1 @@
1
- import{nanoid as R}from"nanoid";import{envConfig as i}from"../../../../../config/env-config.js";import{logger as h}from"../../../../tools/notifiers/logger.js";import{sha as g}from"../../../../utils/crypto/sha.js";const s={};function c(t){if(t.toLowerCase().includes("gantt")&&!t.toLowerCase().includes("todaymarker off")){const o=new Date().toISOString().split("T")[0];return g(t+o)}return g(t)}async function O(t,d="default"){if(t.length===0)return[];const r=[];for(let e=0;e<t.length;e++){const n=c(t[e]);s[n]||r.push(t[e])}if(r.length){const e=i.REDOCLY_MERMAID_MICROSERVICE_URL||"https://api.redocly.com/mermaid",n=h.startTiming(),f=R(),m=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json","x-request-id":i.REQUEST_ID||""},body:JSON.stringify({definitions:r,rayId:f,theme:d,organizationId:i.ORGANIZATION_ID})});if(m.status!==200)throw new Error(`Something went wrong during remote rendering. Please, save this Ray ID: ${f} and contact Redocly team.`);h.verboseTime(n,"Rendered mermaid diagrams (%s)",r.length);const l=await m.json();for(let a=0;a<r.length;a++){const p=c(r[a]);s[p]=l[a]}}const o=[];for(let e=0;e<t.length;e++){const n=c(t[e]);o.push(s[n])}return o}export{s as cache,c as generateDiagramHash,O as renderMermaid};
1
+ import{nanoid as R}from"nanoid";import{envConfig as i}from"../../../../config/env-config.js";import{logger as h}from"../../../../tools/notifiers/logger.js";import{sha as g}from"../../../../utils/crypto/sha.js";const s={};function c(t){if(t.toLowerCase().includes("gantt")&&!t.toLowerCase().includes("todaymarker off")){const o=new Date().toISOString().split("T")[0];return g(t+o)}return g(t)}async function O(t,d="default"){if(t.length===0)return[];const r=[];for(let e=0;e<t.length;e++){const n=c(t[e]);s[n]||r.push(t[e])}if(r.length){const e=i.REDOCLY_MERMAID_MICROSERVICE_URL||"https://api.redocly.com/mermaid",n=h.startTiming(),f=R(),m=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json","x-request-id":i.REQUEST_ID||""},body:JSON.stringify({definitions:r,rayId:f,theme:d,organizationId:i.ORGANIZATION_ID})});if(m.status!==200)throw new Error(`Something went wrong during remote rendering. Please, save this Ray ID: ${f} and contact Redocly team.`);h.verboseTime(n,"Rendered mermaid diagrams (%s)",r.length);const l=await m.json();for(let a=0;a<r.length;a++){const p=c(r[a]);s[p]=l[a]}}const o=[];for(let e=0;e<t.length;e++){const n=c(t[e]);o.push(s[n])}return o}export{s as cache,c as generateDiagramHash,O as renderMermaid};
@@ -1 +1 @@
1
- import{isNode as l}from"../helpers/guards/is-node.js";import{isStringNode as s}from"../helpers/guards/is-string-node.js";import{getNodeAttribute as c}from"../helpers/get-node-attribute.js";import{getInnerText as a}from"../helpers/get-inner-text.js";function p(t){const r=c(t,"level");if(r)return{value:a(t.children),id:c(t,"id"),depth:r}}function h(t){let r;return f(t,i=>{if(l(i)&&i.type==="heading")return r=p(i)?.value,o}),r}const o=Symbol("Exit visitor");function f(t,r){if(!t)return;const i=r(t);if(i===o)return i;for(const e of t.children){if(!e||s(e))continue;const n=f(e,r);if(n===o)return n}const u=t.slots||{};for(const e of Object.values(u)){if(!e||s(e))continue;const n=f(e,r);if(n===o)return n}}export{o as EXIT,h as extractFirstHeading,p as getHeadingData,f as visit};
1
+ import{isNode as l}from"../../../../../markdoc/helpers/guards/is-node.js";import{isStringNode as s}from"../../../../../markdoc/helpers/guards/is-string-node.js";import{getNodeAttribute as c}from"../../../../../markdoc/helpers/get-node-attribute.js";import{getInnerText as a}from"../../../../../markdoc/helpers/get-inner-text.js";function p(t){const r=c(t,"level");if(r)return{value:a(t.children),id:c(t,"id"),depth:r}}function h(t){let r;return f(t,i=>{if(l(i)&&i.type==="heading")return r=p(i)?.value,o}),r}const o=Symbol("Exit visitor");function f(t,r){if(!t)return;const i=r(t);if(i===o)return i;for(const e of t.children){if(!e||s(e))continue;const n=f(e,r);if(n===o)return n}const u=t.slots||{};for(const e of Object.values(u)){if(!e||s(e))continue;const n=f(e,r);if(n===o)return n}}export{o as EXIT,h as extractFirstHeading,p as getHeadingData,f as visit};
@@ -1 +1 @@
1
- import u from"@markdoc/markdoc";import{isTag as b}from"./markdoc/helpers/guards/is-tag.js";import{slugger as g}from"../../utils/index.js";import{getMarkdocOptions as l}from"./markdoc/markdoc-options.js";import{visit as h,getHeadingData as k}from"./markdoc/plugins/utils.js";import{renderMermaid as v}from"./markdoc/plugins/render-mermaid.js";import{deepStringify as M}from"./markdoc/utils/deep-stringify.js";import{stringifyTagChildrenObjects as w}from"./utils/stringify-tag-children-objects.js";async function _(d,e,p){const c=await l(p),t=[],a=[],i=M(e.variables?.pageProps),{headers:y,...f}=e.variables||{};g.reset();const s=u.transform(d,{...c,...e,variables:{...f,pageProps:i}});let o=0;h(s,r=>{if(b(r)){switch(r.name){case"Heading":r.attributes.__idx=o,o++;const n=k(r);n&&t.push(n);break;case"Mermaid":a.push({tag:r,source:r.attributes.diagramSource});break}w(r)}});const m=await v(a.map(r=>r.source));for(let r=0;r<m.length;r++)a[r].tag.attributes.diagramHtml=m[r];return{headings:t,renderableAst:s,pageProps:i}}export{_ as transformMdAst};
1
+ import u from"@markdoc/markdoc";import{isTag as b}from"../../../markdoc/helpers/guards/is-tag.js";import{slugger as g}from"../../utils/index.js";import{getMarkdocOptions as l}from"./markdoc/markdoc-options.js";import{visit as h,getHeadingData as k}from"./markdoc/plugins/utils.js";import{renderMermaid as v}from"./markdoc/plugins/render-mermaid.js";import{deepStringify as M}from"./markdoc/utils/deep-stringify.js";import{stringifyTagChildrenObjects as w}from"./utils/stringify-tag-children-objects.js";async function _(d,e,p){const c=await l(p),t=[],a=[],i=M(e.variables?.pageProps),{headers:y,...f}=e.variables||{};g.reset();const s=u.transform(d,{...c,...e,variables:{...f,pageProps:i}});let o=0;h(s,r=>{if(b(r)){switch(r.name){case"Heading":r.attributes.__idx=o,o++;const n=k(r);n&&t.push(n);break;case"Mermaid":a.push({tag:r,source:r.attributes.diagramSource});break}w(r)}});const m=await v(a.map(r=>r.source));for(let r=0;r<m.length;r++)a[r].tag.attributes.diagramHtml=m[r];return{headings:t,renderableAst:s,pageProps:i}}export{_ as transformMdAst};
@@ -1,4 +1,4 @@
1
- import _ from"@markdoc/markdoc";import D from"node:path";import{AI_SEARCH_CHUNK_SIZE as E,AI_SEARCH_DOCUMENT_CHUNK_SIZE as M}from"../../../constants/plugins/search.js";import{slugger as P}from"../../../utils/slugger.js";import{toMarkdown as U}from"./to-markdown.js";import{AstToSearchNodeTransformer as b}from"./walk-sections.js";import{getLocaleFromRelativePath as x}from"../../../fs/utils/get-locale-from-relative-path.js";import{HeadingNode as I}from"./nodes/heading-node.js";import{extractDocumentSearchFacets as y}from"./search-facets.js";import{formatDocumentMetadata as L}from"../../search/utils.js";import{TagNode as H}from"./nodes/tag-node.js";import{MARKDOC_PARTIALS_DATA_KEY as K}from"../../../store.js";const N=Symbol(),W=(n,c)=>async(e,r,u,s)=>{if(c?.excludeFromSearch)return;P.reset();const i=await e.getNavText?.()||D.basename(e.fsPath),p=_.Ast.fromJSON(r.ast),m=new b({partials:s.getGlobalConfig(K)||{},getInnerContent:U,ast:p,skipConditionals:!0}),f=Array.from(m.transform());return{async getLLMsTxts(){const o=c?.seo,g=o&&typeof o=="object"&&"description"in o?String(o.description):void 0,C=f.map(t=>t.content).filter(Boolean).join(`
1
+ import _ from"@markdoc/markdoc";import D from"node:path";import{AI_SEARCH_CHUNK_SIZE as E,AI_SEARCH_DOCUMENT_CHUNK_SIZE as M}from"../../../constants/plugins/search.js";import{slugger as P}from"../../../../utils/slugger.js";import{toMarkdown as U}from"./to-markdown.js";import{AstToSearchNodeTransformer as b}from"./walk-sections.js";import{getLocaleFromRelativePath as x}from"../../../fs/utils/get-locale-from-relative-path.js";import{HeadingNode as I}from"./nodes/heading-node.js";import{extractDocumentSearchFacets as y}from"./search-facets.js";import{formatDocumentMetadata as L}from"../../search/utils.js";import{TagNode as H}from"./nodes/tag-node.js";import{MARKDOC_PARTIALS_DATA_KEY as K}from"../../../store.js";const N=Symbol(),W=(n,c)=>async(e,r,u,s)=>{if(c?.excludeFromSearch)return;P.reset();const i=await e.getNavText?.()||D.basename(e.fsPath),p=_.Ast.fromJSON(r.ast),m=new b({partials:s.getGlobalConfig(K)||{},getInnerContent:U,ast:p,skipConditionals:!0}),f=Array.from(m.transform());return{async getLLMsTxts(){const o=c?.seo,g=o&&typeof o=="object"&&"description"in o?String(o.description):void 0,C=f.map(t=>t.content).filter(Boolean).join(`
2
2
  `).trim();return[{title:i,description:g,slug:e.slug,fsPath:e.fsPath,content:C,includeInLLMsTxt:!0}]},async getSearchDocuments(){return j(e,f,n,i)}}};function j(n,c,e,r){const u=n.slug,s=new Map,i=n.metadata||{},p=y(i,e),m=L(i),f=m?`Metadata:
3
3
  ${m}
4
4
  `:"";let o=[];for(const t of c)if(t instanceof I){o.splice(t.attributes.level-1,6);const a=t.attributes.level>2,l=o[o.length-1]?.title,S=o[o.length-1]?.url,A=a&&l?l:w(r,t),T=a&&S?S:t.getUrl(u),d={title:A,content:"",url:T,level:t.attributes.level,toc:o.map(v=>h(v.section)).join(`
@@ -1,2 +1,2 @@
1
- import{SEARCH_DOCUMENT_METADATA_KEY as p}from"../../../constants/plugins/search.js";import{TagNode as E}from"./nodes/tag-node.js";import{TextNode as U}from"./nodes/text-node.js";import{slugger as M}from"../../../utils/slugger.js";import{MdSearchDocument as A}from"./md-search-document.js";import{HeadingNode as N}from"./nodes/heading-node.js";const T=Symbol();function _(c,e){if(!c)return e;if(!e)return c;const u=[" ",`
2
- `," "],s=u.some(n=>c.endsWith(n)),a=u.some(n=>e.startsWith(n));return c+(!s&&!a?" ":"")+e}function v(c,e,u,s,a,d={},n){const g=new Map(Array.from({length:6},(t,m)=>[m,""])),i=new Map;let h=null;s=s??{},M.reset();for(const t of c.transform()){const m=t.getUrl(e),f={...s};if(t.rbacTeam&&(f[t.rbacTeam.toLowerCase()]="read"),t instanceof U){const o=t.parentNode?.id,r=o?`${m}#${o}`:T,l=i.get(r)??new A(u,e,[],d,f,a);l.text=_(l.text,t.content),l.facets=d,i.set(r,l);continue}if(t instanceof E){const o=`${m}#${t.id}`,r=new A(t.content,t.getUrl(e),t.getPath(g),d,f,a);i.set(o,r);continue}if(t instanceof N){g.set(t.attributes.level,t.content);const o=new A(t.content,t.getUrl(e),t.getPath(g),d,f,a),r=`${m}#${t.id}`;i.set(r,o),h===null&&(h=o)}}const D=Array.from(i.values()),S=h??D[0];if(S&&n?.includes&&(S[p].curated=!0,S[p].includes=n.includes),n?.excludes)for(const t of D)t[p].curated=!0,t[p].excludes=n.excludes;return D}export{v as getSearchDocuments};
1
+ import{SEARCH_DOCUMENT_METADATA_KEY as p}from"../../../constants/plugins/search.js";import{slugger as E}from"../../../../utils/slugger.js";import{TagNode as U}from"./nodes/tag-node.js";import{TextNode as M}from"./nodes/text-node.js";import{MdSearchDocument as A}from"./md-search-document.js";import{HeadingNode as N}from"./nodes/heading-node.js";const T=Symbol();function _(c,e){if(!c)return e;if(!e)return c;const u=[" ",`
2
+ `," "],s=u.some(n=>c.endsWith(n)),a=u.some(n=>e.startsWith(n));return c+(!s&&!a?" ":"")+e}function v(c,e,u,s,a,d={},n){const g=new Map(Array.from({length:6},(t,m)=>[m,""])),i=new Map;let h=null;s=s??{},E.reset();for(const t of c.transform()){const m=t.getUrl(e),f={...s};if(t.rbacTeam&&(f[t.rbacTeam.toLowerCase()]="read"),t instanceof M){const o=t.parentNode?.id,r=o?`${m}#${o}`:T,l=i.get(r)??new A(u,e,[],d,f,a);l.text=_(l.text,t.content),l.facets=d,i.set(r,l);continue}if(t instanceof U){const o=`${m}#${t.id}`,r=new A(t.content,t.getUrl(e),t.getPath(g),d,f,a);i.set(o,r);continue}if(t instanceof N){g.set(t.attributes.level,t.content);const o=new A(t.content,t.getUrl(e),t.getPath(g),d,f,a),r=`${m}#${t.id}`;i.set(r,o),h===null&&(h=o)}}const D=Array.from(i.values()),S=h??D[0];if(S&&n?.includes&&(S[p].curated=!0,S[p].includes=n.includes),n?.excludes)for(const t of D)t[p].curated=!0,t[p].excludes=n.excludes;return D}export{v as getSearchDocuments};
@@ -1 +1 @@
1
- import{getInnerText as o}from"../../markdoc/helpers/get-inner-text.js";import{slugger as c}from"../../../../utils/slugger.js";class a{#t;#e;#r;#n;constructor(t){const{node:r,content:n,rbacTeam:s,parentNode:i}=t;this.#t=r,this.#e=n,this.#r=i,this.#n=s}get attributes(){return this.#t.attributes}get content(){return this.#e}get node(){return this.#t}get id(){throw new Error("SectionNode needs an id mixin applied")}get parentNode(){return this.#r}get rbacTeam(){return this.#n}}function h(e){let t=0;return class extends e{#t=++t;get id(){return this.#t}}}function g(e){return class extends e{#t;constructor(...t){super(...t);const r=this;this.#t=c.slug(o(r.node.children),{replaceDots:!0,replaceSlashes:!0})}get id(){return this.#t}}}export{a as SectionNode,h as WithCounterId,g as WithSlugId};
1
+ import{getInnerText as o}from"../../../../../markdoc/helpers/get-inner-text.js";import{slugger as c}from"../../../../../utils/slugger.js";class a{#t;#e;#r;#n;constructor(t){const{node:r,content:n,rbacTeam:s,parentNode:i}=t;this.#t=r,this.#e=n,this.#r=i,this.#n=s}get attributes(){return this.#t.attributes}get content(){return this.#e}get node(){return this.#t}get id(){throw new Error("SectionNode needs an id mixin applied")}get parentNode(){return this.#r}get rbacTeam(){return this.#n}}function h(e){let t=0;return class extends e{#t=++t;get id(){return this.#t}}}function g(e){return class extends e{#t;constructor(...t){super(...t);const r=this;this.#t=c.slug(o(r.node.children),{replaceDots:!0,replaceSlashes:!0})}get id(){return this.#t}}}export{a as SectionNode,h as WithCounterId,g as WithSlugId};
@@ -1 +1 @@
1
- import p from"@markdoc/markdoc";import{REDOCLY_ROUTE_RBAC as l,REDOCLY_TEAMS_RBAC as A}from"@redocly/config";import{getSearchDocuments as h}from"./get-search-documents.js";import{AstToSearchNodeTransformer as T}from"./walk-sections.js";import{setDocumentSearchFacets as R,extractDocumentSearchFacets as S}from"./search-facets.js";import{getInnerText as C}from"../markdoc/helpers/get-inner-text.js";import{MARKDOC_PARTIALS_DATA_KEY as D}from"../../../store.js";import{normalizeFrontmatterKeywords as _}from"../../helpers/normalize-frontmatter-keywords.js";function K(e,m,o,c){return async(t,r,a)=>{if(e?.excludeFromSearch)return[];const i=p.Ast.fromJSON(r.ast),f=new T({ast:i,getInnerContent:C,partials:a.getGlobalConfig(D)||{}}),u=t.metadata||{},n=S(u,o);R(n,o,c);const d=e?.seo?.title||m,{result:s}=_(e?.keywords);return h(f,t.slug,d,r[A],r[l],n,s||void 0)}}export{K as searchResolver};
1
+ import p from"@markdoc/markdoc";import{REDOCLY_ROUTE_RBAC as l,REDOCLY_TEAMS_RBAC as A}from"@redocly/config";import{getInnerText as h}from"../../../../markdoc/helpers/get-inner-text.js";import{getSearchDocuments as T}from"./get-search-documents.js";import{AstToSearchNodeTransformer as R}from"./walk-sections.js";import{setDocumentSearchFacets as S,extractDocumentSearchFacets as C}from"./search-facets.js";import{MARKDOC_PARTIALS_DATA_KEY as D}from"../../../store.js";import{normalizeFrontmatterKeywords as _}from"../../helpers/normalize-frontmatter-keywords.js";function K(e,m,o,c){return async(t,r,a)=>{if(e?.excludeFromSearch)return[];const i=p.Ast.fromJSON(r.ast),f=new R({ast:i,getInnerContent:h,partials:a.getGlobalConfig(D)||{}}),u=t.metadata||{},n=C(u,o);S(n,o,c);const d=e?.seo?.title||m,{result:s}=_(e?.keywords);return T(f,t.slug,d,r[A],r[l],n,s||void 0)}}export{K as searchResolver};